Add claude yolo mode#86
Conversation
| let maxNum = project.tabs | ||
| .compactMap { tab -> Int? in | ||
| guard tab.name.hasPrefix(prefix) else { return nil } | ||
| return Int(tab.name.dropFirst(prefix.count)) | ||
| } | ||
| .max() ?? 0 |
There was a problem hiding this comment.
Small nit: the equivalent counter in createTabInProject (around line 641) does .filter { $0.isClaude == isClaude } before extracting numbers. This one doesn't, so if a user ever renamed a terminal tab to Yolo #3 the counter would skew. Not exploitable in practice — just worth matching the existing convention.
| .max() ?? 0 | ||
| let tabName = "\(prefix)\(maxNum + 1)" | ||
|
|
||
| let baseArgs = project.defaultArgs ?? UserDefaults.standard.string(forKey: "claudeExtraArgs") ?? "" |
There was a problem hiding this comment.
This fallback already exists inside createTabInProject at line 664 (extraArgs ?? project.defaultArgs ?? UserDefaults.standard.string(forKey: "claudeExtraArgs") ?? ""). It works today because you pass a non-nil extraArgs: and the ?? chain short-circuits, but the two copies can drift. Consider adding something like a yolo: Bool = false parameter to createTabInProject (or passing just the extra flag to splice in) so args resolution stays in one place.
| let yoloFlag = "--dangerously-skip-permissions" | ||
| let yoloArgs = baseArgs.contains(yoloFlag) ? baseArgs : (baseArgs.isEmpty ? yoloFlag : "\(baseArgs) \(yoloFlag)") | ||
|
|
||
| createTabInProject(project, isClaude: true, name: tabName, extraArgs: yoloArgs) |
There was a problem hiding this comment.
Heads-up: yolo state won't survive an app restart. ProjectTabState (in Sources/Session/SessionState.swift) doesn't persist extraArgs, and the restore paths at DeckardWindowController.swift:473 and :1301 call createTabInProject without passing extraArgs:. So a Yolo #1 tab reappears by name on relaunch but without --dangerously-skip-permissions — the name suggests yolo mode, but it's a normal permission-prompting session. Fix would be adding an isYolo: Bool (or extraArgs: String?) field to ProjectTabState and threading it through the restore sites.
gi11es
left a comment
There was a problem hiding this comment.
Thanks for the idea — a one-keystroke "yolo" tab is a reasonable feature request, but the PR as it stands can't land:
Blocking
-
Doesn't compile against current master. The branch predates #91 (bd3ca6e), which renamed the folder/project terminology to workspace/group.
addYoloTabToCurrentProjectusesprojects,selectedProjectIndex,project.defaultArgs,createTabInProject(...)andfinalizeTabCreation(in: project)— none of these symbols exist anymore (workspaces,selectedWorkspaceIndex,createTabInWorkspace(_:kind:name:...extraArgs:)are the current API). The hunk contexts inAppDelegate.swiftare also stale (they showaddTabToCurrentProject(isClaude:)and omit the Codex menu item), so the diff won't apply cleanly either. The green CI run on this PR is from January, against the tree it was written for. -
The yolo flag is lost on restore.
--dangerously-skip-permissionsis passed as transientextraArgsonly; nothing is persisted on the tab. After an app restart, a "Yolo #N" tab is recreated as a normal claude tab without the flag — the mode silently disappears while the tab name still claims otherwise. -
Flag conflicts aren't handled. The dedup only checks for the literal
--dangerously-skip-permissionssubstring. Ifworkspace.defaultArgsor the globalclaudeExtraArgscontain--permission-mode …, the composed command mixes mutually exclusive permission flags and the tab errors out at launch.
Worth addressing too
-
Duplication: the method re-implements both the
defaultArgs → claudeExtraArgsfallback and the "#N" tab-numbering loop thatcreateTabInWorkspacealready does. After rebasing, this can shrink to: resolve the base args, append the flag, callcreateTabInWorkspace(workspace, kind: .claude, name: …, extraArgs: yoloArgs). -
Dangerous default needs friction/labeling: a default
⌘Ybinding one key away from⌘Tsilently launches an agent with all permission prompts disabled. Suggest no default shortcut (leave it configurable), and/or a first-use confirmation, and a clearer name like "New Claude Tab (skip permissions)".
Happy to re-review after a rebase onto current master addressing 1–3.
I don't have your xcode key files so i can't build and test it but this feature seems simple enough to test