Skill Tracer
Skills › gstack › gstack › design-doc-discovery.ts

design-doc-discovery.ts

31 lines · scripts/resolvers/design-doc-discovery.ts at 3f79d81

1/**
2 * {{DESIGN_DOC_DISCOVERY}} — the canonical design-doc discovery block.
3 *
4 * One invocation of bin/gstack-design-doc-find, which owns the precedence
5 * (newest branch-scoped doc in the state root's project directory, then the
6 * newest project-scoped doc, then the newest repo-local docs/designs/*.md when
7 * it is at least as fresh; a root DESIGN.md is the design system, never the doc) and resolves the state root through
8 * bin/gstack-paths. Plan reviews, autoplan and the prerequisite-skill re-check
9 * in spec-review.ts all render this one block, so they agree on which doc wins.
10 *
11 * The fragment carries no code fences — the {{DESIGN_DOC_DISCOVERY}} token
12 * sits inside each caller's ```bash block. Callers must set $SLUG and
13 * $BRANCH first; the block sets $DESIGN and prints "Design doc found: ..." or
14 * "No design doc found". When /office-hours recorded a host plan-mode copy of
15 * the doc, the helper also prints DESIGN_PLAN_COPY (and STALE_DESIGN_DOC when
16 * the copy is newer) on stderr with the write-through command (#542), so this
17 * block stays the same size in every caller.
18 */
20import type { TemplateContext } from './types';
22/**
23 * Raw canonical fragment, exported so TS resolvers (spec-review.ts's
24 * prerequisite re-check) can interpolate it into their own template strings.
25 */
26export const DESIGN_DOC_DISCOVERY_BLOCK = `DESIGN=$(~/.claude/skills/gstack/bin/gstack-design-doc-find "$SLUG" "$BRANCH")
27[ -n "$DESIGN" ] && echo "Design doc found: $DESIGN" || echo "No design doc found"`;
29export function generateDesignDocDiscovery(_ctx: TemplateContext): string {
30 return DESIGN_DOC_DISCOVERY_BLOCK;