diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index 5346f1d43..826a073af 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -892,8 +892,14 @@ After /office-hours completes, re-run the design doc check: setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` diff --git a/plan-ceo-review/SKILL.md b/plan-ceo-review/SKILL.md index 3d3208bee..586eb2d34 100644 --- a/plan-ceo-review/SKILL.md +++ b/plan-ceo-review/SKILL.md @@ -949,11 +949,17 @@ Then read CLAUDE.md, TODOS.md, and any existing architecture docs. setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` -If a design doc exists (from `/office-hours`), read it. Use it as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design. +If a design doc exists, read it. Prefer repo-local `DESIGN.md` or `design-system.md` when present — that is the best signal for the current subproject in a monorepo. Otherwise, fall back to the most relevant `~/.gstack/projects/$SLUG/*-design-*.md` document from `/office-hours`. Use the selected document as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design. **Handoff note check** (reuses $SLUG and $BRANCH from the design doc check above): ```bash @@ -1020,8 +1026,14 @@ After /office-hours completes, re-run the design doc check: setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` diff --git a/plan-ceo-review/SKILL.md.tmpl b/plan-ceo-review/SKILL.md.tmpl index c43cfe641..374e7ca1a 100644 --- a/plan-ceo-review/SKILL.md.tmpl +++ b/plan-ceo-review/SKILL.md.tmpl @@ -138,11 +138,17 @@ Then read CLAUDE.md, TODOS.md, and any existing architecture docs. setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` -If a design doc exists (from `/office-hours`), read it. Use it as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design. +If a design doc exists, read it. Prefer repo-local `DESIGN.md` or `design-system.md` when present — that is the best signal for the current subproject in a monorepo. Otherwise, fall back to the most relevant `~/.gstack/projects/$SLUG/*-design-*.md` document from `/office-hours`. Use the selected document as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design. **Handoff note check** (reuses $SLUG and $BRANCH from the design doc check above): ```bash diff --git a/plan-eng-review/SKILL.md b/plan-eng-review/SKILL.md index 5557a33fa..68b64fba2 100644 --- a/plan-eng-review/SKILL.md +++ b/plan-eng-review/SKILL.md @@ -913,11 +913,17 @@ sections. Read a section in full before doing its step; do not work from memory. setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` -If a design doc exists, read it. Use it as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design — check the prior version for context on what changed and why. +If a design doc exists, read it. Prefer repo-local `DESIGN.md` or `design-system.md` when present — that is the best signal for the current subproject in a monorepo. Otherwise, fall back to the most relevant `~/.gstack/projects/$SLUG/*-design-*.md` document from `/office-hours`. Use the selected document as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design — check the prior version for context on what changed and why. ## Prerequisite Skill Offer @@ -968,8 +974,14 @@ After /office-hours completes, re-run the design doc check: setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` diff --git a/plan-eng-review/SKILL.md.tmpl b/plan-eng-review/SKILL.md.tmpl index 1d5be0e6f..0a2e0108b 100644 --- a/plan-eng-review/SKILL.md.tmpl +++ b/plan-eng-review/SKILL.md.tmpl @@ -104,11 +104,17 @@ When evaluating architecture, think "boring by default." When reviewing tests, t setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" ``` -If a design doc exists, read it. Use it as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design — check the prior version for context on what changed and why. +If a design doc exists, read it. Prefer repo-local `DESIGN.md` or `design-system.md` when present — that is the best signal for the current subproject in a monorepo. Otherwise, fall back to the most relevant `~/.gstack/projects/$SLUG/*-design-*.md` document from `/office-hours`. Use the selected document as the source of truth for the problem statement, constraints, and chosen approach. If it has a `Supersedes:` field, note that this is a revised design — check the prior version for context on what changed and why. {{BENEFITS_FROM}} diff --git a/scripts/resolvers/review.ts b/scripts/resolvers/review.ts index 7dccd8e50..b65f61d36 100644 --- a/scripts/resolvers/review.ts +++ b/scripts/resolvers/review.ts @@ -309,8 +309,14 @@ After /${first} completes, re-run the design doc check: setopt +o nomatch 2>/dev/null || true # zsh compat SLUG=$(~/.claude/skills/gstack/browse/bin/remote-slug 2>/dev/null || basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)") BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr '/' '-' || echo 'no-branch') -DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) -[ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +if [ -f DESIGN.md ]; then + DESIGN="$PWD/DESIGN.md" +elif [ -f design-system.md ]; then + DESIGN="$PWD/design-system.md" +else + DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-$BRANCH-design-*.md 2>/dev/null | head -1) + [ -z "$DESIGN" ] && DESIGN=$(ls -t ~/.gstack/projects/$SLUG/*-design-*.md 2>/dev/null | head -1) +fi [ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found" \`\`\` diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index 2fb783ffd..e7a1e6327 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -1410,6 +1410,18 @@ describe('BENEFITS_FROM resolver', () => { expect(engContent).toContain('skipping these sections'); expect(ceoContent).toContain('Follow its instructions from top to bottom'); }); + + test('plan reviews prefer repo-local design docs before ~/.gstack history', () => { + expect(ceoContent).toContain('if [ -f DESIGN.md ]; then'); + expect(ceoContent).toContain('DESIGN="$PWD/DESIGN.md"'); + expect(ceoContent).toContain('design-system.md'); + expect(ceoContent).toContain('~/.gstack/projects/$SLUG'); + + expect(engContent).toContain('if [ -f DESIGN.md ]; then'); + expect(engContent).toContain('DESIGN="$PWD/DESIGN.md"'); + expect(engContent).toContain('design-system.md'); + expect(engContent).toContain('~/.gstack/projects/$SLUG'); + }); }); // --- {{INVOKE_SKILL}} resolver tests ---