Files
msd-core/commands/gsd/review-backlog.md
Tom Boucher 54e6da3126 fix(#2767): pass paths via --files to gsd-sdk query commit + lint guard (#2781)
* fix(#2767): pass paths via --files to gsd-sdk query commit + lint guard

Workflows, agents, commands, and references passed file paths positionally
to `gsd-sdk query commit`, which silently appended them to the commit
subject and triggered the `.planning/` wholesale-stage fallback in
sdk/src/query/commit.ts:136. Regression of #733/#798.

Inserted `--files` before the path list at every site (81 invocations
across 50 files). Added tests/bug-2767-gsd-sdk-commit-files-flag.test.cjs
as a permanent lint that scans every shipped .md file and asserts each
`gsd-sdk query commit[-to-subrepo]` invocation either uses `--files` or
carries no path arguments.

Closes #2767

* test(#2767): replace source-grep with behavioral SDK test

The original test walked every shipped .md file and regex-tokenized
`gsd-sdk query commit` invocations to assert `--files` was present.
CONTRIBUTING.md prohibits this source-grep pattern.

Rewrite as behavioral SDK tests against `sdk/dist/cli.js` over a real
tmp git project (createTempGitProject helper). Cover both the
well-formed (`--files <paths>`) form — clean subject, exactly-staged
files, .planning/ left untouched — and the buggy positional form,
asserting the documented misbehavior (paths leak into subject + the
`.planning/` wholesale-stage fallback at commit.ts:136). Also asserts
`commit-to-subrepo` rejects when `--files` is omitted (commit.ts:258).

The doc-lint is retained as a supplementary defense-in-depth guard
since agent-prompt markdown invocations cannot be exercised end-to-end
— but it is no longer the primary contract.

* docs(#2767): correct contradictory --files guidance in zh-CN/en docs + fix test docstring
2026-04-27 12:31:43 -04:00

63 lines
1.8 KiB
Markdown

---
name: gsd:review-backlog
description: Review and promote backlog items to active milestone
allowed-tools:
- Read
- Write
- Bash
- AskUserQuestion
---
<objective>
Review all 999.x backlog items and optionally promote them into the active
milestone sequence or remove stale entries.
</objective>
<process>
1. **List backlog items:**
```bash
ls -d .planning/phases/999* 2>/dev/null || echo "No backlog items found"
```
2. **Read ROADMAP.md** and extract all 999.x phase entries:
```bash
cat .planning/ROADMAP.md
```
Show each backlog item with its description, any accumulated context (CONTEXT.md, RESEARCH.md), and creation date.
3. **Present the list to the user** via AskUserQuestion:
- For each backlog item, show: phase number, description, accumulated artifacts
- Options per item: **Promote** (move to active), **Keep** (leave in backlog), **Remove** (delete)
4. **For items to PROMOTE:**
- Find the next sequential phase number in the active milestone
- Rename the directory from `999.x-slug` to `{new_num}-slug`:
```bash
NEW_NUM=$(gsd-sdk query phase.add "${DESCRIPTION}" --raw)
```
- Move accumulated artifacts to the new phase directory
- Update ROADMAP.md: move the entry from `## Backlog` section to the active phase list
- Remove `(BACKLOG)` marker
- Add appropriate `**Depends on:**` field
5. **For items to REMOVE:**
- Delete the phase directory
- Remove the entry from ROADMAP.md `## Backlog` section
6. **Commit changes:**
```bash
gsd-sdk query commit "docs: review backlog — promoted N, removed M" --files .planning/ROADMAP.md
```
7. **Report summary:**
```
## 📋 Backlog Review Complete
Promoted: {list of promoted items with new phase numbers}
Kept: {list of items remaining in backlog}
Removed: {list of deleted items}
```
</process>