loadTeamInWorktree creates the requested worktree (if any) and then loads the team with the worktree as its working directory. The ordering matters: toolsets capture runConfig.WorkingDir when they are constructed during LoadTeam, so the worktree must be settled first for every tool — the shell inclu
(ctx context.Context, userSettings *userconfig.Settings)
| 527 | // --worktree nor --worktree-pr was given) and the working directory to run in |
| 528 | // (the worktree's directory when one was created, otherwise wd unchanged). |
| 529 | func (f *runExecFlags) applyUserSettings(ctx context.Context, userSettings *userconfig.Settings) { |
| 530 | if userSettings.HideToolResults && !f.hideToolResults { |
| 531 | f.hideToolResults = true |
| 532 | slog.DebugContext(ctx, "Applying user settings", "hide_tool_results", true) |
| 533 | } |
| 534 | if userSettings.YOLO && !f.autoApprove { |
| 535 | f.autoApprove = true |
| 536 | slog.DebugContext(ctx, "Applying user settings", "YOLO", true) |
| 537 | } |
| 538 | // The tour needs the full TUI's overlay support, so a lean default from |
| 539 | // user config is not applied when the tour was requested. |
| 540 | if userSettings.Lean && !f.leanChanged && !f.lean && !f.tour { |
| 541 | f.lean = true |
| 542 | slog.DebugContext(ctx, "Applying user settings", "lean", true) |
| 543 | } |
| 544 | if userSettings.SnapshotsEnabled() { |
| 545 | f.snapshotsEnabled = true |
| 546 | slog.DebugContext(ctx, "Applying user settings", "snapshot", true) |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | func (f *runExecFlags) loadTeamInWorktree(ctx context.Context, b backend, wd string) (*teamloader.LoadResult, *worktree.Worktree, string, error) { |
| 551 | createdWorktree, err := f.setupWorktree(ctx, wd) |