@@ -585,7 +585,7 @@ class DeckardWindowController: NSWindowController, NSSplitViewDelegate {
585585
586586 // MARK: - Tab Management (within a project)
587587
588- func createTabInProject( _ project: ProjectItem , isClaude: Bool , name: String ? = nil , sessionIdToResume: String ? = nil , tmuxSessionToResume: String ? = nil ) {
588+ func createTabInProject( _ project: ProjectItem , isClaude: Bool , name: String ? = nil , sessionIdToResume: String ? = nil , tmuxSessionToResume: String ? = nil , extraArgs : String ? = nil ) {
589589 let surface = TerminalSurface ( )
590590 let tabName : String
591591 if let name = name {
@@ -614,8 +614,8 @@ class DeckardWindowController: NSWindowController, NSSplitViewDelegate {
614614
615615 let initialInput : String ?
616616 if isClaude {
617- let extraArgs = UserDefaults . standard. string ( forKey: " claudeExtraArgs " ) ?? " "
618- let extraArgsSuffix = extraArgs . isEmpty ? " " : " \( extraArgs ) "
617+ let resolvedArgs = extraArgs ?? UserDefaults . standard. string ( forKey: " claudeExtraArgs " ) ?? " "
618+ let extraArgsSuffix = resolvedArgs . isEmpty ? " " : " \( resolvedArgs ) "
619619 var claudeArgs = extraArgsSuffix
620620 if let sessionIdToResume {
621621 let encoded = project. path. claudeProjectDirName
@@ -665,7 +665,29 @@ class DeckardWindowController: NSWindowController, NSSplitViewDelegate {
665665 return
666666 }
667667 let project = projects [ selectedProjectIndex]
668- createTabInProject ( project, isClaude: isClaude)
668+
669+ if isClaude && UserDefaults . standard. bool ( forKey: " promptForSessionArgs " ) {
670+ promptForClaudeArgs { [ weak self] args in
671+ guard let self else { return }
672+ guard let args else {
673+ // User cancelled
674+ self . isCreatingTab = false
675+ return
676+ }
677+ guard self . projects. contains ( where: { $0 === project } ) else {
678+ self . isCreatingTab = false
679+ return
680+ }
681+ self . createTabInProject ( project, isClaude: true , extraArgs: args)
682+ self . finalizeTabCreation ( in: project)
683+ }
684+ } else {
685+ createTabInProject ( project, isClaude: isClaude)
686+ finalizeTabCreation ( in: project)
687+ }
688+ }
689+
690+ private func finalizeTabCreation( in project: ProjectItem ) {
669691 project. selectedTabIndex = project. tabs. count - 1
670692 rebuildTabBar ( )
671693 rebuildSidebar ( )
@@ -677,6 +699,33 @@ class DeckardWindowController: NSWindowController, NSSplitViewDelegate {
677699 }
678700 }
679701
702+ private func promptForClaudeArgs( completion: @escaping ( String ? ) -> Void ) {
703+ let alert = NSAlert ( )
704+ alert. messageText = " Claude Code Arguments "
705+ alert. informativeText = " Arguments passed to this session: "
706+ alert. addButton ( withTitle: " Start " )
707+ alert. addButton ( withTitle: " Cancel " )
708+
709+ let field = NSTextField ( frame: NSRect ( x: 0 , y: 0 , width: 300 , height: 24 ) )
710+ field. font = . monospacedSystemFont( ofSize: 12 , weight: . regular)
711+ field. stringValue = UserDefaults . standard. string ( forKey: " claudeExtraArgs " ) ?? " "
712+ field. placeholderString = " --permission-mode auto "
713+ alert. accessoryView = field
714+
715+ guard let window else {
716+ completion ( nil )
717+ return
718+ }
719+
720+ alert. beginSheetModal ( for: window) { response in
721+ if response == . alertFirstButtonReturn {
722+ completion ( field. stringValue)
723+ } else {
724+ completion ( nil )
725+ }
726+ }
727+ }
728+
680729 func closeCurrentTab( ) {
681730 guard let project = currentProject else { return }
682731 let idx = project. selectedTabIndex
0 commit comments