fix(quick-dev): use absolute paths in code -r invocations

Agent CWD may differ from the project root in worktree setups,
causing relative paths to silently fail. Resolve paths via
git rev-parse --show-toplevel before invoking code -r.
This commit is contained in:
Alex Verkhovsky 2026-03-21 02:49:48 -06:00
parent 93a1e1dc46
commit b989ec069e
2 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ When there is only one concern, omit the bold label — just list the stops dire
1. Change `{spec_file}` status to `done` in the frontmatter. 1. Change `{spec_file}` status to `done` in the frontmatter.
2. If version control is available and the tree is dirty, create a local commit with a conventional message derived from the spec title. 2. If version control is available and the tree is dirty, create a local commit with a conventional message derived from the spec title.
3. Open the spec in the user's editor so they can click through the Suggested Review Order: 3. Open the spec in the user's editor so they can click through the Suggested Review Order:
- Run `code -r "{spec_file}"` to open the spec in the current VS Code window (reuses the window where the project or worktree is open). Always double-quote the path to handle spaces and special characters. - Resolve two absolute paths: (1) the repository root (`git rev-parse --show-toplevel` — returns the worktree root when in a worktree, project root otherwise), (2) `{spec_file}`. Run `code -r "{absolute-root}" "{absolute-spec-file}"` — the root first so VS Code opens in the right context, then the spec file. Always double-quote paths to handle spaces and special characters.
- If `code` is not available (command fails), skip gracefully and tell the user the spec file path instead. - If `code` is not available (command fails), skip gracefully and tell the user the spec file path instead.
4. Display summary of your work to the user, including the commit hash if one was created. Any file paths shown in conversation/terminal output must use CWD-relative format (no leading `/`) for terminal clickability — this differs from spec-file links which use project-root-relative paths. Include: 4. Display summary of your work to the user, including the commit hash if one was created. Any file paths shown in conversation/terminal output must use CWD-relative format (no leading `/`) for terminal clickability — this differs from spec-file links which use project-root-relative paths. Include:
- A note that the spec is open in their editor (or the file path if it couldn't be opened). Mention that `{spec_file}` now contains a Suggested Review Order. - A note that the spec is open in their editor (or the file path if it couldn't be opened). Mention that `{spec_file}` now contains a Suggested Review Order.

View File

@ -36,7 +36,7 @@ If version control is available and the tree is dirty, create a local commit wit
### Present ### Present
1. Open all changed files in the user's editor so they can review the code directly: 1. Open all changed files in the user's editor so they can review the code directly:
- Run `code -r "{project-root}" <changed-file-paths>` — the project root as the first argument, then each changed file path. Always double-quote paths with spaces. - Resolve two sets of absolute paths: (1) the repository root (`git rev-parse --show-toplevel` — returns the worktree root when in a worktree, project root otherwise), (2) each changed file. Run `code -r "{absolute-root}" <absolute-changed-file-paths>` — the root first so VS Code opens in the right context, then each changed file. Always double-quote paths to handle spaces and special characters.
- If `code` is not available (command fails), skip gracefully and list the file paths instead. - If `code` is not available (command fails), skip gracefully and list the file paths instead.
2. Display a summary in conversation output, including: 2. Display a summary in conversation output, including:
- The commit hash (if one was created). - The commit hash (if one was created).