refactor(opencode): let @pm read TODO.md via git show, drop tempfile
Gives @pm narrowly-scoped bash access (git show *, git rev-parse *) so it can read TODO.md directly from any git ref. The workflow no longer needs to mktemp + redirect the file before invoking the agent; Phase 2 just tells @pm the bare repo path and default branch and lets it run git show "$DEFAULT_BRANCH:TODO.md" itself. Cleanup steps for the temp snapshot are removed from Phase 10 and the failure handler.
This commit is contained in:
parent
37be2d9505
commit
d22acf6906
2 changed files with 23 additions and 23 deletions
|
|
@ -24,19 +24,13 @@ Verify you are in a bare git repo and that the issue tracker exists.
|
|||
|
||||
Store as `DEFAULT_BRANCH`.
|
||||
4. Verify TODO.md exists on the default branch: `git show "$DEFAULT_BRANCH:TODO.md" > /dev/null 2>&1`. If not, stop: "TODO.md not found on `$DEFAULT_BRANCH`. Commit a TODO.md there first — the workflow expects it to be a tracked file."
|
||||
5. Snapshot TODO.md to a temp file so `@pm` can read it before any worktree exists:
|
||||
```bash
|
||||
TODO_READ_PATH="$(mktemp -t todo.XXXXXX.md)"
|
||||
git show "$DEFAULT_BRANCH:TODO.md" > "$TODO_READ_PATH"
|
||||
```
|
||||
Pass `$TODO_READ_PATH` to `@pm` in Phase 2 (read-only context).
|
||||
6. Proceed to Phase 2.
|
||||
5. Proceed to Phase 2.
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Issue Context
|
||||
|
||||
Use `@pm` to fetch the issue matching `$ARGUMENTS` from the snapshot at `$TODO_READ_PATH`:
|
||||
Dispatch `@pm` in **read-only git-ref mode**: tell it the bare repo path is `$BARE_REPO_ROOT` and to read TODO.md via `git show "$DEFAULT_BRANCH:TODO.md"`. Ask for the issue matching `$ARGUMENTS`:
|
||||
- Issue title, description, acceptance criteria
|
||||
- Labels and priority
|
||||
- Any existing branch name
|
||||
|
|
@ -238,8 +232,6 @@ The workflow is forge-agnostic. It commits locally and stops. **Do not push, and
|
|||
- Files changed
|
||||
- Commit the summary: `chore(workflow): summary for <issue-id>`
|
||||
|
||||
### Cleanup
|
||||
- Remove the temp snapshot from Phase 1: `rm -f "$TODO_READ_PATH"`
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -250,8 +242,7 @@ At any phase, if an unrecoverable error occurs:
|
|||
2. If any code was written, commit it with message `wip: incomplete workflow run for <issue-id>`
|
||||
3. Leave the branch and worktree intact for the user to inspect — do not push, do not delete
|
||||
4. If a worktree exists, use `@pm` to add a comment on the issue in `./TODO.md` summarising what failed
|
||||
5. Remove the temp snapshot if it was created: `rm -f "$TODO_READ_PATH"`
|
||||
6. Stop execution
|
||||
5. Stop execution
|
||||
|
||||
**Never hang on interactive prompts.** If any command appears to require input, treat it as a failure and follow the above procedure.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue