Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/KanbanCode/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ struct ContentView: View {
onCreate: { prompt, projectPath, title, startImmediately, images in
createManualTask(prompt: prompt, projectPath: projectPath, title: title, startImmediately: startImmediately, images: images)
},
onCreateAndLaunch: { prompt, projectPath, title, createWorktree, runRemotely, skipPermissions, commandOverride, images, assistant in
createManualTaskAndLaunch(prompt: prompt, projectPath: projectPath, title: title, createWorktree: createWorktree, runRemotely: runRemotely, skipPermissions: skipPermissions, commandOverride: commandOverride, images: images, assistant: assistant)
onCreateAndLaunch: { prompt, projectPath, title, createWorktree, worktreeBranch, runRemotely, skipPermissions, commandOverride, images, assistant in
createManualTaskAndLaunch(prompt: prompt, projectPath: projectPath, title: title, createWorktree: createWorktree, worktreeBranch: worktreeBranch, runRemotely: runRemotely, skipPermissions: skipPermissions, commandOverride: commandOverride, images: images, assistant: assistant)
}
)
}
Expand Down Expand Up @@ -2259,7 +2259,7 @@ struct ContentView: View {
}
}

private func createManualTaskAndLaunch(prompt: String, projectPath: String?, title: String? = nil, createWorktree: Bool, runRemotely: Bool, skipPermissions: Bool = true, commandOverride: String? = nil, images: [ImageAttachment] = [], assistant: CodingAssistant = .claude) {
private func createManualTaskAndLaunch(prompt: String, projectPath: String?, title: String? = nil, createWorktree: Bool, worktreeBranch: String? = nil, runRemotely: Bool, skipPermissions: Bool = true, commandOverride: String? = nil, images: [ImageAttachment] = [], assistant: CodingAssistant = .claude) {
let trimmed = prompt.trimmingCharacters(in: .whitespacesAndNewlines)
let name: String
if let title, !title.isEmpty {
Expand Down Expand Up @@ -2291,7 +2291,7 @@ struct ContentView: View {
let project = settings?.projects.first(where: { $0.path == effectivePath })
let builtPrompt = PromptBuilder.buildPrompt(card: link, project: project, settings: settings)

let wtName: String? = (createWorktree && assistant.supportsWorktree) ? "" : nil
let wtName: String? = (createWorktree && assistant.supportsWorktree) ? (worktreeBranch ?? "") : nil
executeLaunch(cardId: link.id, prompt: builtPrompt, projectPath: effectivePath, worktreeName: wtName, runRemotely: runRemotely, skipPermissions: skipPermissions, commandOverride: commandOverride, images: images, assistant: assistant)
}
}
Expand Down
6 changes: 4 additions & 2 deletions Sources/KanbanCode/NewTaskDialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ struct NewTaskDialog: View {
var enabledAssistants: [CodingAssistant] = CodingAssistant.allCases
/// (prompt, projectPath, title, startImmediately, images) — creates task without an assistant set
var onCreate: (String, String?, String?, Bool, [ImageAttachment]) -> Void = { _, _, _, _, _ in }
/// (prompt, projectPath, title, createWorktree, runRemotely, skipPermissions, commandOverride, images, assistant) — creates and launches directly (skips LaunchConfirmation)
var onCreateAndLaunch: (String, String?, String?, Bool, Bool, Bool, String?, [ImageAttachment], CodingAssistant) -> Void = { _, _, _, _, _, _, _, _, _ in }
/// (prompt, projectPath, title, createWorktree, worktreeBranch, runRemotely, skipPermissions, commandOverride, images, assistant) — creates and launches directly (skips LaunchConfirmation)
var onCreateAndLaunch: (String, String?, String?, Bool, String?, Bool, Bool, String?, [ImageAttachment], CodingAssistant) -> Void = { _, _, _, _, _, _, _, _, _, _ in }

@AppStorage("selectedAssistant") private var selectedAssistantRaw: String = CodingAssistant.claude.rawValue
private var selectedAssistant: CodingAssistant {
Expand Down Expand Up @@ -234,11 +234,13 @@ struct NewTaskDialog: View {
let titleOrNil = title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ? nil : title.trimmingCharacters(in: .whitespacesAndNewlines)
if let proj { lastSelectedProjectPath = proj }
if startImmediately {
let branch = worktreeBranch.trimmingCharacters(in: .whitespacesAndNewlines)
onCreateAndLaunch(
prompt,
proj,
titleOrNil,
createWorktree && isGitRepo && selectedAssistant.supportsWorktree,
branch.isEmpty ? nil : branch,
runRemotely && hasRemoteConfig,
dangerouslySkipPermissions,
commandEdited ? command : nil,
Expand Down