Files
msd-core/get-shit-done/workflows/scan.md
Tom Boucher 73c1af5168 fix(#2543): replace legacy /gsd-<cmd> syntax with /gsd:<cmd> across all source files (#2595)
Commands are now installed as commands/gsd/<name>.md and invoked as
/gsd:<name> in Claude Code. The old hyphen form /gsd-<name> was still
hardcoded in hundreds of places across workflows, references, templates,
lib modules, and command files — causing "Unknown command" errors
whenever GSD suggested a command to the user.

Replace all /gsd-<cmd> occurrences where <cmd> is a known command name
(derived at runtime from commands/gsd/*.md) using a targeted Node.js
script. Agent names, tool names (gsd-sdk, gsd-tools), directory names,
and path fragments are not touched.

Adds regression test tests/bug-2543-gsd-slash-namespace.test.cjs that
enforces zero legacy occurrences going forward. Removes inverted
tests/stale-colon-refs.test.cjs (bug #1748) which enforced the now-obsolete
hyphen form; the new bug-2543 test supersedes it. Updates 5 assertion
tests that hardcoded the old hyphen form to accept the new colon form.

Closes #2543

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 12:04:25 -04:00

103 lines
2.7 KiB
Markdown

<purpose>
Lightweight codebase assessment. Spawns a single gsd-codebase-mapper agent for one focus area,
producing targeted documents in `.planning/codebase/`.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<available_agent_types>
Valid GSD subagent types (use exact names — do not fall back to 'general-purpose'):
- gsd-codebase-mapper — Maps project structure and dependencies
</available_agent_types>
<process>
## Focus-to-Document Mapping
| Focus | Documents Produced |
|-------|-------------------|
| `tech` | STACK.md, INTEGRATIONS.md |
| `arch` | ARCHITECTURE.md, STRUCTURE.md |
| `quality` | CONVENTIONS.md, TESTING.md |
| `concerns` | CONCERNS.md |
| `tech+arch` | STACK.md, INTEGRATIONS.md, ARCHITECTURE.md, STRUCTURE.md |
## Step 1: Parse arguments and resolve focus
Parse the user's input for `--focus <area>`. Default to `tech+arch` if not specified.
Validate that the focus is one of: `tech`, `arch`, `quality`, `concerns`, `tech+arch`.
If invalid:
```
Unknown focus area: "{input}". Valid options: tech, arch, quality, concerns, tech+arch
```
Exit.
## Step 2: Check for existing documents
```bash
INIT=$(gsd-sdk query init.map-codebase 2>/dev/null || echo "{}")
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
```
Look up which documents would be produced for the selected focus (from the mapping table above).
For each target document, check if it already exists in `.planning/codebase/`:
```bash
ls -la .planning/codebase/{DOCUMENT}.md 2>/dev/null
```
If any exist, show their modification dates and ask:
```
Existing documents found:
- STACK.md (modified 2026-04-03)
- INTEGRATIONS.md (modified 2026-04-01)
Overwrite with fresh scan? [y/N]
```
If user says no, exit.
## Step 3: Create output directory
```bash
mkdir -p .planning/codebase
```
## Step 4: Spawn mapper agent
Spawn a single `gsd-codebase-mapper` agent with the selected focus area:
```
Task(
prompt="Scan this codebase with focus: {focus}. Write results to .planning/codebase/. Produce only: {document_list}",
subagent_type="gsd-codebase-mapper",
model="{resolved_model}"
)
```
## Step 5: Report
```
## Scan Complete
**Focus:** {focus}
**Documents produced:**
{list of documents written with line counts}
Use `/gsd:map-codebase` for a comprehensive 4-area parallel scan.
```
</process>
<success_criteria>
- [ ] Focus area correctly parsed (default: tech+arch)
- [ ] Existing documents detected with modification dates shown
- [ ] User prompted before overwriting
- [ ] Single mapper agent spawned with correct focus
- [ ] Output documents written to .planning/codebase/
</success_criteria>