fn build_worker_extra_args(
is_git_repo: bool,
label: &str,
interactive: bool,
) -> Vec<(String, Option<String>)>Expand description
Build the list of (flag, value) extra CLI args specific to a
worker spawn. When the project is a git repo, append
("worktree", Some(label)) so the spawned claude subprocess
creates a worktree at <base>/.claude/worktrees/<label>/ - base
the repo’s canonical root, the main checkout for a project that is
itself a linked worktree - and runs the session inside it. In all
cases, append the worker’s
blocked_tools_for set as its --disallowedTools entry: workers are
pinned to their spawn-time location (whether a worktree or the
project cwd) and must not be able to call claude’s built-in
worktree-hop tools to escape. Comma-separated value form is
empirically accepted by the CLI’s variadic <tools...> parser.
Unless interactive, AskUserQuestion joins that list. A worker’s
question renders in its own row, which nobody is usually looking
at, and an answer that does arrive is indistinguishable from a
decision the user made. Denying it at spawn means the capability is
never offered rather than refused after the model has already
decided to ask.
The is_git_repo boolean is passed in (already-computed by the
caller) so the git-repo probe runs at most once per spawn even
when the same answer is needed for both the WorkerEntry.is_git_repo_at_spawn
field and this argument list.