Skip to content

Commit c344ea1

Browse files
mcintyre94claude
andcommitted
Add "Start Chat" button to Bash quick actions outside of chat context
When Quick Actions is opened from the overview/sprite-detail toolbar (no active chat session), running a bash command now shows a "Start Chat" button instead of nothing. Tapping it pre-seeds the chat input with the formatted command output, switches to the chat tab, and dismisses the sheet — making it easy to ask Claude about unexpected command output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 87a41c3 commit c344ea1

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

Wisp/Views/QuickActions/BashQuickView.swift

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ struct BashQuickView: View {
44
@Environment(SpritesAPIClient.self) private var apiClient
55
@Bindable var viewModel: BashQuickViewModel
66
var onInsert: ((String) -> Void)? = nil
7+
var onStartChat: ((String) -> Void)? = nil
78
@FocusState private var isInputFocused: Bool
89

910
private let shellChars = ["/", "-", "|", ">", "~", "`", "$", "&", "*", "."]
@@ -109,12 +110,20 @@ struct BashQuickView: View {
109110
.padding(.vertical, 8)
110111
.padding(.bottom, isRunningOnMac ? 12 : 0)
111112

112-
if let onInsert, !viewModel.output.isEmpty, !viewModel.isRunning {
113-
Button("Insert into chat") {
114-
onInsert(viewModel.insertFormatted())
113+
if !viewModel.output.isEmpty, !viewModel.isRunning {
114+
if let onInsert {
115+
Button("Insert into chat") {
116+
onInsert(viewModel.insertFormatted())
117+
}
118+
.buttonStyle(.borderedProminent)
119+
.padding(.bottom, 8)
120+
} else if let onStartChat {
121+
Button("Start Chat") {
122+
onStartChat(viewModel.insertFormatted())
123+
}
124+
.buttonStyle(.borderedProminent)
125+
.padding(.bottom, 8)
115126
}
116-
.buttonStyle(.borderedProminent)
117-
.padding(.bottom, 8)
118127
}
119128
}
120129
.background(Color(.systemBackground))

Wisp/Views/QuickActions/QuickActionsView.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ struct QuickActionsView: View {
55
@Environment(\.dismiss) private var dismiss
66
let viewModel: QuickActionsViewModel
77
var insertCallback: ((String) -> Void)? = nil
8+
var startChatCallback: ((String) -> Void)? = nil
89

910
@State private var selectedTab = 0
1011

@@ -43,10 +44,15 @@ struct QuickActionsView: View {
4344

4445
@ViewBuilder private var bashTab: some View {
4546
if let cb = insertCallback {
46-
BashQuickView(viewModel: viewModel.bashViewModel) { text in
47+
BashQuickView(viewModel: viewModel.bashViewModel, onInsert: { text in
4748
cb(text)
4849
dismiss()
49-
}
50+
})
51+
} else if let cb = startChatCallback {
52+
BashQuickView(viewModel: viewModel.bashViewModel, onStartChat: { text in
53+
cb(text)
54+
dismiss()
55+
})
5056
} else {
5157
BashQuickView(viewModel: viewModel.bashViewModel)
5258
}

Wisp/Views/SpriteDetail/SpriteDetailView.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,17 @@ struct SpriteDetailView: View {
234234
ChatSwitcherSheet(viewModel: chatListViewModel)
235235
}
236236
.sheet(item: $spriteQuickActionsViewModel) { vm in
237-
QuickActionsView(viewModel: vm)
238-
.environment(apiClient)
239-
.presentationDetents([.medium, .large])
240-
.presentationDragIndicator(.visible)
237+
QuickActionsView(
238+
viewModel: vm,
239+
startChatCallback: { text in
240+
chatViewModel?.inputText += (chatViewModel?.inputText.isEmpty == true ? "" : "\n") + text
241+
selectedTab = .chat
242+
spriteQuickActionsViewModel = nil
243+
}
244+
)
245+
.environment(apiClient)
246+
.presentationDetents([.medium, .large])
247+
.presentationDragIndicator(.visible)
241248
}
242249
.alert("Sprite Recreated", isPresented: $showStaleChatsAlert) {
243250
Button("Start Fresh", role: .destructive) {

0 commit comments

Comments
 (0)