@hegemonart/get-design-done 1.57.1 → 1.57.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +26 -41
- package/.claude-plugin/plugin.json +23 -48
- package/CHANGELOG.md +91 -0
- package/README.md +166 -511
- package/SKILL.md +2 -0
- package/agents/README.md +33 -36
- package/agents/a11y-mapper.md +3 -3
- package/agents/component-benchmark-harvester.md +6 -6
- package/agents/component-benchmark-synthesizer.md +3 -3
- package/agents/compose-executor.md +3 -3
- package/agents/cost-forecaster.md +2 -2
- package/agents/design-auditor.md +7 -7
- package/agents/design-authority-watcher.md +15 -15
- package/agents/design-context-builder.md +4 -4
- package/agents/design-context-checker-gate.md +1 -1
- package/agents/design-discussant.md +2 -2
- package/agents/design-doc-writer.md +1 -1
- package/agents/design-executor.md +2 -2
- package/agents/design-figma-writer.md +2 -2
- package/agents/design-fixer.md +7 -7
- package/agents/design-integration-checker-gate.md +1 -1
- package/agents/design-integration-checker.md +1 -1
- package/agents/design-paper-writer.md +3 -3
- package/agents/design-pencil-writer.md +1 -1
- package/agents/design-planner.md +21 -0
- package/agents/design-reflector.md +39 -39
- package/agents/design-research-synthesizer.md +1 -0
- package/agents/design-start-writer.md +1 -1
- package/agents/design-update-checker.md +5 -5
- package/agents/design-verifier-gate.md +1 -1
- package/agents/design-verifier.md +52 -48
- package/agents/ds-generator.md +2 -2
- package/agents/ds-migration-planner.md +4 -4
- package/agents/email-executor.md +9 -9
- package/agents/experiment-result-ingester.md +3 -3
- package/agents/flutter-executor.md +5 -5
- package/agents/gdd-graph-refresh.md +3 -3
- package/agents/gdd-intel-updater.md +2 -2
- package/agents/motion-mapper.md +2 -2
- package/agents/motion-verifier.md +4 -4
- package/agents/pdf-executor.md +8 -8
- package/agents/perf-analyzer.md +17 -17
- package/agents/pr-commenter.md +9 -9
- package/agents/prototype-gate.md +2 -2
- package/agents/quality-gate-runner.md +1 -1
- package/agents/rollout-coordinator.md +3 -3
- package/agents/swift-executor.md +4 -4
- package/agents/ticket-sync-agent.md +6 -6
- package/agents/user-research-synthesizer.md +2 -2
- package/connections/connections.md +44 -45
- package/connections/cursor.md +73 -0
- package/connections/preview.md +3 -3
- package/dist/claude-code/.claude/skills/cache-manager/SKILL.md +3 -3
- package/dist/claude-code/.claude/skills/cache-manager/cache-policy.md +1 -1
- package/dist/claude-code/.claude/skills/design/SKILL.md +19 -0
- package/dist/claude-code/.claude/skills/explore/SKILL.md +11 -0
- package/dist/claude-code/.claude/skills/figma-write/SKILL.md +13 -2
- package/dist/claude-code/.claude/skills/paper-write/SKILL.md +54 -0
- package/dist/claude-code/.claude/skills/pencil-write/SKILL.md +54 -0
- package/dist/claude-code/.claude/skills/report-issue/SKILL.md +2 -2
- package/dist/claude-code/.claude/skills/router/SKILL.md +2 -2
- package/dist/claude-code/.claude/skills/verify/verify-procedure.md +10 -11
- package/dist/claude-code/.claude/skills/warm-cache/SKILL.md +1 -1
- package/hooks/first-run-nudge.cjs +171 -0
- package/hooks/gdd-intel-trigger.js +243 -0
- package/hooks/gdd-mcp-circuit-breaker.js +62 -7
- package/hooks/gdd-precompact-snapshot.js +50 -29
- package/hooks/gdd-protected-paths.js +150 -18
- package/hooks/gdd-risk-gate.js +93 -1
- package/hooks/gdd-sessionstart-recap.js +59 -24
- package/hooks/hooks.json +13 -4
- package/hooks/inject-using-gdd.cjs +188 -0
- package/hooks/update-check.cjs +511 -0
- package/package.json +9 -2
- package/reference/STATE-TEMPLATE.md +10 -13
- package/reference/audit-scoring.md +1 -1
- package/reference/cache-tier-doctrine.md +46 -0
- package/reference/config-schema.md +9 -9
- package/reference/i18n.md +1 -1
- package/reference/intel-schema.md +37 -2
- package/reference/meta-rules.md +4 -4
- package/reference/model-tiers.md +2 -2
- package/reference/registry.json +101 -94
- package/reference/runtime-models.md +11 -1
- package/reference/shared-preamble.md +13 -14
- package/reference/skill-graph.md +24 -1
- package/scripts/bootstrap.cjs +373 -0
- package/scripts/injection-patterns.cjs +58 -0
- package/scripts/lib/apply-reflections/incubator-proposals.cjs +57 -26
- package/scripts/lib/install/converters/codex-plugin.cjs +5 -2
- package/scripts/lib/install/converters/cursor.cjs +20 -0
- package/scripts/lib/issue-reporter/report-flow.cjs +1 -1
- package/scripts/lib/manifest/skills.json +80 -13
- package/scripts/lib/state/query-surface.cjs +67 -9
- package/scripts/lib/state/state-store.cjs +68 -26
- package/sdk/cli/commands/stage.ts +17 -0
- package/sdk/cli/index.js +14 -0
- package/skills/cache-manager/SKILL.md +3 -3
- package/skills/cache-manager/cache-policy.md +1 -1
- package/skills/design/SKILL.md +19 -0
- package/skills/explore/SKILL.md +11 -0
- package/skills/figma-write/SKILL.md +13 -2
- package/skills/paper-write/SKILL.md +54 -0
- package/skills/pencil-write/SKILL.md +54 -0
- package/skills/report-issue/SKILL.md +2 -2
- package/skills/router/SKILL.md +2 -2
- package/skills/verify/verify-procedure.md +10 -11
- package/skills/warm-cache/SKILL.md +1 -1
- package/hooks/first-run-nudge.sh +0 -82
- package/hooks/inject-using-gdd.sh +0 -72
- package/hooks/update-check.sh +0 -251
- package/scripts/lib/audit-aggregator/index.cjs +0 -219
- package/scripts/lib/hedge-ensemble.cjs +0 -217
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Cursor — Runtime Install Notes
|
|
2
|
+
|
|
3
|
+
This file documents the get-design-done install path on Cursor and one known limitation.
|
|
4
|
+
|
|
5
|
+
Cursor is one of the 14 first-class runtimes for `gdd install` (see `reference/runtimes.md` for the full set). It uses the `multi-artifact` install kind: skills land as `~/.cursor/skills/<gdd-name>/SKILL.md` after passing through `scripts/lib/install/converters/cursor.cjs`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
gdd install --runtime cursor # global → ~/.cursor/skills/
|
|
11
|
+
gdd install --runtime cursor --local # repo-local → .cursor/skills/
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Each installed skill is name-prefixed with `gdd-` (e.g. `gdd-explore`, `gdd-discover`) so it cannot collide with user-authored Cursor skills.
|
|
15
|
+
|
|
16
|
+
## Converter behavior
|
|
17
|
+
|
|
18
|
+
`converters/cursor.cjs#convert` is a pure string→string transform that:
|
|
19
|
+
|
|
20
|
+
- Normalizes the frontmatter `name:` field to `gdd-<skill>` (no double-prefix).
|
|
21
|
+
- Rewrites mixed-shape slash references (`gdd-x`, `/gdd:x`) to a consistent `/gdd-<name>` shape.
|
|
22
|
+
- Passes the Claude tool vocabulary through unchanged (Read / Write / Bash / Edit / Grep / Glob — Cursor accepts these).
|
|
23
|
+
- Injects a 1-line HTML adapter header recording auto-generation.
|
|
24
|
+
|
|
25
|
+
The output is byte-stable per source — re-running `gdd install --runtime cursor` is a no-op when nothing has changed.
|
|
26
|
+
|
|
27
|
+
## Known limitation — sibling .md files are NOT installed
|
|
28
|
+
|
|
29
|
+
Some skills ship procedure detail in sibling `.md` files next to `SKILL.md`. For example:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
skills/discover/
|
|
33
|
+
├── SKILL.md ← installed
|
|
34
|
+
└── discover-procedure.md ← NOT installed (sibling)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`SKILL.md` references the sibling via a relative link (e.g. `./discover-procedure.md`). On Cursor, that link resolves to nothing.
|
|
38
|
+
|
|
39
|
+
This is a systemic limitation of the current `multi-artifact` install pipeline (`scripts/lib/install/runtime-artifact-layout.cjs#skillsKind`), not a Cursor-specific bug. It affects every runtime that uses `skillsKind`: claude global, cursor, codex, copilot, antigravity, windsurf, augment, trae, qwen, codebuddy. Skills with sibling files currently affected:
|
|
40
|
+
|
|
41
|
+
- `apply-reflections/apply-reflections-procedure.md`
|
|
42
|
+
- `cache-manager/cache-policy.md`
|
|
43
|
+
- `compare/compare-rubric.md`
|
|
44
|
+
- `connections/connections-onboarding.md`
|
|
45
|
+
- `darkmode/darkmode-audit-procedure.md`
|
|
46
|
+
- `debug/debug-feedback-loops.md`
|
|
47
|
+
- `design/design-procedure.md`
|
|
48
|
+
- `discover/discover-procedure.md`
|
|
49
|
+
- `explore/explore-procedure.md`
|
|
50
|
+
- `health/health-mcp-detection.md`
|
|
51
|
+
- `health/health-skill-length-report.md`
|
|
52
|
+
- `new-cycle/milestone-completeness-rubric.md`
|
|
53
|
+
- `peer-cli-add/peer-cli-protocol.md`
|
|
54
|
+
- `plan/plan-procedure.md`
|
|
55
|
+
- `quality-gate/threat-modeling.md`
|
|
56
|
+
- `report-issue/report-issue-procedure.md`
|
|
57
|
+
- `router/capability-gap-emitter.md`
|
|
58
|
+
- `router/router-pick-emitter.md`
|
|
59
|
+
- `router/router-rules.md`
|
|
60
|
+
- `scan/scan-procedure.md`
|
|
61
|
+
- `start/start-procedure.md`
|
|
62
|
+
- `style/style-doc-procedure.md`
|
|
63
|
+
- `verify/verify-procedure.md`
|
|
64
|
+
|
|
65
|
+
### Workarounds until a fix lands
|
|
66
|
+
|
|
67
|
+
1. **Use the cursor-marketplace distribution channel** — `scripts/lib/install/converters/cursor-marketplace.cjs` copies the entire `skills/` tree byte-for-byte (siblings included). Install through the marketplace plugin rather than per-skill if you need the full procedure detail.
|
|
68
|
+
2. **Clone the repo locally** — Cursor can read sibling files directly from the source checkout if you point it at the repo tree.
|
|
69
|
+
3. **Inline-grep the source** — for one-off questions, read the source `SKILL.md` directly; siblings are short and self-contained.
|
|
70
|
+
|
|
71
|
+
### Fix scope (tracked as follow-up beyond batch H6)
|
|
72
|
+
|
|
73
|
+
Properly enumerating siblings requires extending the StagedArtifact contract to emit multiple files per skill (one SKILL.md + N siblings), updating `computeDestPath` for non-SKILL.md paths inside a skill subdir, the foreign-file detection in `installer.cjs#detectMultiArtifactInstalled`, and the uninstall enumeration in `uninstallMultiArtifact`. See the `KNOWN LIMITATION` block at the top of `scripts/lib/install/converters/cursor.cjs` for the technical detail.
|
package/connections/preview.md
CHANGED
|
@@ -107,10 +107,10 @@ When preview is `not_configured` or `unavailable`, stages degrade gracefully —
|
|
|
107
107
|
|
|
108
108
|
**verify stage (`skills/verify/SKILL.md` + `agents/design-verifier.md`):**
|
|
109
109
|
|
|
110
|
-
- Skip
|
|
110
|
+
- Skip Stage 4B screenshot evidence loop entirely
|
|
111
111
|
- Keep existing `? VISUAL` static analysis path for H-02, H-06, H-07 heuristics
|
|
112
|
-
- Mark all
|
|
113
|
-
- Design-verifier continues to
|
|
112
|
+
- Mark all Stage 4B checks: `[SKIPPED — browser not available]`
|
|
113
|
+
- Design-verifier continues to Stage 5 gap analysis with partial scores
|
|
114
114
|
|
|
115
115
|
**compare stage (`skills/compare/SKILL.md`):**
|
|
116
116
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gdd-cache-manager
|
|
3
|
-
description: "Maintains .design/cache-manifest.json for Layer B explicit cache per D-08. Computes deterministic SHA-256 input-hash from (agent-path + sorted-input-file-paths + input-content-hashes). On spawn: lookup key → return cached blob if within TTL, else miss. On completion: write result + TTL. Consulted by hooks/budget-enforcer.
|
|
3
|
+
description: "Maintains .design/cache-manifest.json for Layer B explicit cache per D-08. Computes deterministic SHA-256 input-hash from (agent-path + sorted-input-file-paths + input-content-hashes). On spawn: lookup key → return cached blob if within TTL, else miss. On completion: write result + TTL. Consulted by hooks/budget-enforcer.ts before every Agent spawn."
|
|
4
4
|
user-invocable: false
|
|
5
5
|
tools: Read, Bash, Write
|
|
6
6
|
disable-model-invocation: true
|
|
@@ -38,11 +38,11 @@ You are the deterministic cache-key computer and cache-manifest writer for the o
|
|
|
38
38
|
|
|
39
39
|
## Deterministic Input-Hash Algorithm
|
|
40
40
|
|
|
41
|
-
The canonical reference implementation (single source of truth; `hooks/budget-enforcer.
|
|
41
|
+
The canonical reference implementation (single source of truth; `hooks/budget-enforcer.ts` imports the same primitive via a shared helper) lives in `./cache-policy.md#deterministic-input-hash-algorithm-layer-b` - it documents the JS implementation, the maintainer notes (sorted-unique paths, MISSING-file sentinel, agent-path bust behavior), the manifest shape, and TTL semantics in one place. Conform to the algorithm exactly so the hook and any orchestrator agree byte-for-byte.
|
|
42
42
|
|
|
43
43
|
## Integration Points
|
|
44
44
|
|
|
45
|
-
- **`hooks/budget-enforcer.
|
|
45
|
+
- **`hooks/budget-enforcer.ts`** (Plan 10.1-01) reads the manifest on every Agent spawn. The hook already calls `cacheLookup(agent, inputHash)` against `.design/cache-manifest.json`. This skill is the authority on how `inputHash` is computed so the hook and any orchestrator agree byte-for-byte.
|
|
46
46
|
- **Orchestrators** (e.g., `skills/map/`, `skills/discover/`, `skills/plan/`) invoke Phase 1 (compute-key) + Phase 4 (write-result-on-completion) around each Agent spawn they launch. Phase 2 + Phase 3 are executed by the hook.
|
|
47
47
|
- **Warm-cache command** (`skills/warm-cache/SKILL.md`, Task 02) does not touch Layer B - it only primes Anthropic's 5-min prompt cache (Layer A). Do not confuse the two.
|
|
48
48
|
|
|
@@ -21,7 +21,7 @@ The two layers (D-08):
|
|
|
21
21
|
|
|
22
22
|
## Deterministic Input-Hash Algorithm (Layer B)
|
|
23
23
|
|
|
24
|
-
The canonical reference implementation (the single source of truth; `hooks/budget-enforcer.
|
|
24
|
+
The canonical reference implementation (the single source of truth; `hooks/budget-enforcer.ts` imports the same primitive via a shared helper):
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
// Deterministic cache-key primitive (reference implementation)
|
|
@@ -79,6 +79,25 @@ Print the `=== Design stage complete ===` summary (tasks complete/total, deviati
|
|
|
79
79
|
|
|
80
80
|
After all tasks finish, if STATE.md `<connections>` has `figma: available`, offer the user the figma-write opt-in prompt (modes: annotate / tokenize / mappings, with optional `--dry-run`). Spawn `design-figma-writer` with the selected mode on "yes"; skip silently on "no". NEVER auto-run without confirmation. Full prompt + dispatch logic: `./design-procedure.md` §Figma Write Dispatch.
|
|
81
81
|
|
|
82
|
+
## Component Generator Dispatch
|
|
83
|
+
|
|
84
|
+
If the DESIGN-PLAN has a `task_type: component` task without a matching `src/components/*.tsx`, OR the brief / DESIGN-CONTEXT.md explicitly asks for a new component, AND STATE.md `<connections>` shows a generator connection (`21st-dev: available`, `magic-patterns: available`, `plasmic: available`, `builder-io: available`, or `v0-dev: available`); offer the component-generator opt-in.
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Task("design-component-generator", """
|
|
88
|
+
mode: <21st|magic-patterns|plasmic|builder-io|v0-dev>
|
|
89
|
+
component_spec: <DESIGN-PLAN task summary + DESIGN-CONTEXT acceptance criteria>
|
|
90
|
+
required_reading:
|
|
91
|
+
- .design/STATE.md
|
|
92
|
+
- .design/DESIGN-PLAN.md
|
|
93
|
+
- .design/DESIGN-CONTEXT.md
|
|
94
|
+
""")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Sequential (the agent is `parallel-safe: never`). Wait for the agent's `## design-component-generator complete.` marker. Skip silently when no generator connection is available OR no component task is pending. Auto-mode bypasses the prompt; otherwise prompt "Generate component via [tool]? (y/n)" and only spawn on "y".
|
|
98
|
+
|
|
99
|
+
The dispatch fires AFTER `design-executor` completes the hand-coded plan tasks. The agent's output (component file path + tokens used + provenance) is appended to `.design/DESIGN-SUMMARY.md` as a single `## Generated Components` section so verify can audit it.
|
|
100
|
+
|
|
82
101
|
<HARD-GATE>
|
|
83
102
|
Do NOT transition to verify (or invoke `/gdd:verify`) until `.design/DESIGN-SUMMARY.md` is committed. If this project uses a custom `.design` location, read the artifact path from `.design/STATE.md` rather than assuming the default.
|
|
84
103
|
</HARD-GATE>
|
|
@@ -61,6 +61,16 @@ Run the canonical scan grep/glob inventory (POSIX ERE, preserving PLAT-01/02): c
|
|
|
61
61
|
- **Project-local skills**: read `./.claude/skills/design-*-conventions.md` -> include in DESIGN-CONTEXT.md `<project_conventions>` (these override defaults).
|
|
62
62
|
- **Global skills**: `~/.claude/gdd/global-skills/*.md` (other than README) -> prepend to `<project_conventions>` under `<global_conventions>` sub-block. Project-local D-XX wins on conflict.
|
|
63
63
|
|
|
64
|
+
## Step 2.6 - Graph review (gate then reviewer)
|
|
65
|
+
|
|
66
|
+
Runs only when Step 2's mapper batch + synthesizer produced `.design/context-graph.json`. Skip the whole step if the file is absent (pre-Phase-52 project, or `--skip-scan`).
|
|
67
|
+
|
|
68
|
+
1. **Gate first (cheap Haiku check).** Spawn `design-context-reviewer-gate` via `Task()` with the classifier signal from Step 2's incremental batching pass: `change_pct` (fingerprint classifier `pct`), `classifier_action` (`SKIP` / `PARTIAL_UPDATE` / `ARCHITECTURE_UPDATE` / `FULL_UPDATE`), and `graph_path: ".design/context-graph.json"`. Gate emits a single-line `{spawn, rationale}` JSON decision then `## GATE COMPLETE`.
|
|
69
|
+
2. **If `spawn: false`**: record `mcp__gdd_state__set_status: "explore_graph_review_skipped"`, log the gate `rationale` (e.g., "project change 3% < 5% threshold"), set telemetry `lazy_skipped: true`. Done - proceed to Step 3.
|
|
70
|
+
3. **If `spawn: true`**: spawn `design-context-reviewer` via `Task()` with `<required_reading>` pointing at `.design/STATE.md`, `.design/context-graph.json`, `reference/design-context-schema.md`, `reference/design-context-tag-vocab.md`. The reviewer runs `scripts/validate-design-context.cjs --json` as the deterministic floor (checks 1/2/3/5) then layers the semantic checks (4/6/7/8/9) and returns the 9-check verdict inline (`APPROVED` or `REJECT`).
|
|
71
|
+
4. **Capture verdict (read-only contract).** The reviewer does NOT write `.design/DESIGN-CONTEXT-REVIEW.md` - it is `reads-only: true, writes: []`. WARN findings surface through `scripts/lib/health-mirror#getHealthChecks` as `status: 'warn'`; a hard-reject maps to `status: 'fail'`. Record the overall verdict via `mcp__gdd_state__set_status: "explore_graph_review_approved"` (or `"_rejected"`).
|
|
72
|
+
5. **On REJECT**: record `mcp__gdd_state__add_blocker` with the reviewer's blocking-issues list verbatim. Do not advance to Step 3 until the synthesizer or the implicated mapper is re-run. On `APPROVED` (with or without WARNs): proceed.
|
|
73
|
+
|
|
64
74
|
---
|
|
65
75
|
|
|
66
76
|
## Step 3 - Design interview (unless `--skip-interview`)
|
|
@@ -80,6 +90,7 @@ Full interview protocol + JSON line schema: `./explore-procedure.md` §Step 3.
|
|
|
80
90
|
## Step 4 - Close out explore
|
|
81
91
|
|
|
82
92
|
- If the synthesizer / mapper batch ran in Step 2: `mcp__gdd_state__update_progress` with `task_progress: "<done>/<total>"`, `status: "explore_mappers_done"`.
|
|
93
|
+
- If Step 2.6 ran the graph review: ensure the verdict status is recorded (`explore_graph_review_approved` / `_rejected` / `_skipped`); on `_rejected` do NOT checkpoint until re-run.
|
|
83
94
|
- `mcp__gdd_state__checkpoint` - bumps `last_checkpoint`.
|
|
84
95
|
- Stage advance to `plan` happens at the next stage's entry (plan owns its own `transition_stage`); do not edit frontmatter directly.
|
|
85
96
|
|
|
@@ -34,6 +34,17 @@ Read `.design/STATE.md` and `.design/DESIGN-CONTEXT.md` before dispatching the a
|
|
|
34
34
|
|
|
35
35
|
## Dispatch
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
```
|
|
38
|
+
Task("design-figma-writer", """
|
|
39
|
+
mode: <annotate|tokenize|mappings>
|
|
40
|
+
dry_run: <true|false>
|
|
41
|
+
confirm_shared: <true|false>
|
|
42
|
+
required_reading:
|
|
43
|
+
- .design/STATE.md
|
|
44
|
+
- .design/DESIGN-CONTEXT.md
|
|
45
|
+
""")
|
|
46
|
+
```
|
|
38
47
|
|
|
39
|
-
Pass
|
|
48
|
+
Pass `mode` from the first positional argument; `dry_run` from `--dry-run`;
|
|
49
|
+
`confirm_shared` from `--confirm-shared`. Wait for the agent's completion
|
|
50
|
+
marker before returning.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gdd-paper-write
|
|
3
|
+
description: "Push design decisions from `.design/DESIGN-CONTEXT.md` into the active paper.design canvas by dispatching the `design-paper-writer` agent in one of three modes (annotate / tokenize / roundtrip). Use when the user has completed a design pipeline cycle and wants the decisions reflected in their paper.design canvas. Operates proposal->confirm with `--dry-run`."
|
|
4
|
+
argument-hint: "<annotate|tokenize|roundtrip> [--dry-run]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tools: Read, Write, Bash, Grep, Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# gdd-paper-write
|
|
10
|
+
|
|
11
|
+
Dispatches the `design-paper-writer` agent to write design decisions back to the active paper.design canvas. The shared probe pattern (ToolSearch → live call → STATE.md write) and connection handshake are documented at `../../reference/shared-preamble.md#connection-handshake-summary` and `../../connections/paper-design.md`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/get-design-done paper-write <mode> [--dry-run]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Modes:
|
|
20
|
+
- `annotate` - add design decision comments to canvas nodes
|
|
21
|
+
- `tokenize` - sync CSS token values to paper.design node styles
|
|
22
|
+
- `roundtrip` - write implementation status back as text/HTML layers
|
|
23
|
+
|
|
24
|
+
Flags:
|
|
25
|
+
- `--dry-run` - emit the proposal without executing any paper.design writes
|
|
26
|
+
|
|
27
|
+
paper.design has no team-library concept, so there is no `--confirm-shared` flag. Every write still requires an explicit `yes` confirmation (unless `--dry-run` is set).
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
1. paper.design MCP registered. Install: `claude mcp add paper-design --transport http https://mcp.paper.design/sse` then restart the session. See `../../connections/paper-design.md` for the full probe pattern and budget rules.
|
|
32
|
+
2. `.design/DESIGN-CONTEXT.md` exists (run `discover` first)
|
|
33
|
+
3. `.design/STATE.md` `<connections>` shows `paper-design: available`. If `not_configured` or `unavailable`, the agent will STOP with a diagnostic.
|
|
34
|
+
|
|
35
|
+
Budget: the agent tracks `budget_used` in STATE.md `<connections>` and warns when usage reaches 90/100 on the free tier.
|
|
36
|
+
|
|
37
|
+
## Required Reading
|
|
38
|
+
|
|
39
|
+
Read `.design/STATE.md` and `.design/DESIGN-CONTEXT.md` before dispatching the agent.
|
|
40
|
+
|
|
41
|
+
## Dispatch
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Task("design-paper-writer", """
|
|
45
|
+
mode: <annotate|tokenize|roundtrip>
|
|
46
|
+
dry_run: <true|false>
|
|
47
|
+
required_reading:
|
|
48
|
+
- .design/STATE.md
|
|
49
|
+
- .design/DESIGN-CONTEXT.md
|
|
50
|
+
""")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Pass `mode` from the first positional argument; `dry_run` from `--dry-run`.
|
|
54
|
+
Wait for the agent's completion marker before returning.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gdd-pencil-write
|
|
3
|
+
description: "Update local `.pen` source files with design decisions from `.design/DESIGN-CONTEXT.md` by dispatching the `design-pencil-writer` agent in one of two modes (annotate / roundtrip). Use when the user has completed a design pipeline cycle and wants the decisions reflected in their `.pen` files. Operates proposal->confirm with `--dry-run`."
|
|
4
|
+
argument-hint: "<annotate|roundtrip> [--dry-run]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
tools: Read, Write, Bash, Grep, Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# gdd-pencil-write
|
|
10
|
+
|
|
11
|
+
Dispatches the `design-pencil-writer` agent to write design decisions back to `.pen` spec files. Unlike Figma/paper.design, pencil.dev keeps `.pen` YAML specs as the project's git-tracked source of truth; no MCP is required and every write is committed atomically. The probe pattern (file-based, no ToolSearch) and integration contract are documented at `../../connections/pencil-dev.md`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/get-design-done pencil-write <mode> [--dry-run]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Modes:
|
|
20
|
+
- `annotate` - append DESIGN-DEBT findings as comments to the relevant `.pen` files
|
|
21
|
+
- `roundtrip` - update `.pen` spec frontmatter (design-tokens, state) from verified implementation
|
|
22
|
+
|
|
23
|
+
There is no `tokenize` mode; `.pen` files are source-of-truth specs, not derived artifacts.
|
|
24
|
+
|
|
25
|
+
Flags:
|
|
26
|
+
- `--dry-run` - emit the proposal without writing or committing any `.pen` changes
|
|
27
|
+
|
|
28
|
+
## Prerequisites
|
|
29
|
+
|
|
30
|
+
1. pencil.dev workspace detected; one or more `.pen` files in `cwd` (no MCP install required):
|
|
31
|
+
```bash
|
|
32
|
+
find . -name "*.pen" -not -path "*/node_modules/*" | head -5
|
|
33
|
+
```
|
|
34
|
+
2. `.design/DESIGN-CONTEXT.md` exists (run `discover` first). For `annotate` mode, `.design/DESIGN-DEBT.md` is also required. For `roundtrip` mode, `.design/DESIGN-VERIFICATION.md` is also required.
|
|
35
|
+
3. `.design/STATE.md` `<connections>` shows `pencil-dev: available`. If `not_configured`, no `.pen` files were found at probe time; re-run `discover` or `connections` after adding `.pen` specs.
|
|
36
|
+
|
|
37
|
+
## Required Reading
|
|
38
|
+
|
|
39
|
+
Read `.design/STATE.md` and `.design/DESIGN-CONTEXT.md` before dispatching the agent.
|
|
40
|
+
|
|
41
|
+
## Dispatch
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Task("design-pencil-writer", """
|
|
45
|
+
mode: <annotate|roundtrip>
|
|
46
|
+
dry_run: <true|false>
|
|
47
|
+
required_reading:
|
|
48
|
+
- .design/STATE.md
|
|
49
|
+
- .design/DESIGN-CONTEXT.md
|
|
50
|
+
""")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Pass `mode` from the first positional argument; `dry_run` from `--dry-run`.
|
|
54
|
+
Wait for the agent's completion marker before returning.
|
|
@@ -15,7 +15,7 @@ If invoked without an error context (the user just typed `/gdd:report-issue` col
|
|
|
15
15
|
|
|
16
16
|
## Steps
|
|
17
17
|
|
|
18
|
-
0. **Kill-switch** (D-08). Call `isDisabled()` from `scripts/lib/issue-reporter/kill-switch.cjs` FIRST. Either env (`GDD_DISABLE_ISSUE_REPORTER=1`) OR config (`.design/config.json` with `{ "issue_reporter": false }`) makes the command unavailable. Surface the disable line via `getDisableReason()` ('env' wins when both set) and stop. No draft, no triage, no payload.
|
|
18
|
+
0. **Kill-switch** (D-08). Call `isDisabled()` from `scripts/lib/issue-reporter/kill-switch.cjs` FIRST. Either env (`GDD_DISABLE_ISSUE_REPORTER=1`) OR config (`.design/config.json` with `{ "issue_reporter": false }`) makes the command unavailable. Surface the disable line via `getDisableReason()` ('env' wins when both set) and stop. No draft, no triage, no payload. `/gdd:health` mirrors the same line for at-a-glance verification.
|
|
19
19
|
1. **Triage**. Call `matchKnownFailure(errorContext)` from `scripts/lib/issue-reporter/triage-matcher.cjs` (Plan 30-03). If `matched === true` and `--force-report` is NOT set: print the suggested diagnosis + remedy, stop. Do NOT write a draft. (D-07)
|
|
20
20
|
2. **Assemble**. Call `assemble(commandName, errorContext, trajectoryRef?, capabilityGapEvent?)` from `scripts/lib/issue-reporter/payload-assembly.cjs` (Plan 30-02). This layers Phase 22 redact → Phase 30 pseudonymize, computes the fingerprint, and renders bilingual disclaimer + sections.
|
|
21
21
|
3. **Draft**. Call `writeDraft({title, body, fingerprint})` from `scripts/lib/issue-reporter/draft-writer.cjs`. Print the absolute path: `Draft written to .design/issue-drafts/<timestamp>-<fp8>.md`. The file persists across decline - the user keeps their work either way. (D-04)
|
|
@@ -48,6 +48,6 @@ Available on `/gdd:report-issue`. Overrides the triage gate (Step 1) but does NO
|
|
|
48
48
|
- **No `EDITOR` set.** The path is printed; open it in whatever editor you prefer, save, then return to the consent prompt.
|
|
49
49
|
- **Triage matched something irrelevant.** Pass `--force-report` to bypass the gate. Consent is still required.
|
|
50
50
|
- **`gh` not installed (D-10).** After consent, the payload is copied to your clipboard and an issue-template URL is printed. Paste into the URL to file manually. Install `gh` later and the existing draft can be re-submitted.
|
|
51
|
-
- **Command unavailable / disabled (D-08).** Run
|
|
51
|
+
- **Command unavailable / disabled (D-08).** Run `/gdd:health`. The `issue reporter:` line shows the active disable surface - either `disabled by env (GDD_DISABLE_ISSUE_REPORTER=1)` or `disabled by config (.design/config.json: issue_reporter=false)`. Unset the env var or flip the config key to re-enable.
|
|
52
52
|
|
|
53
53
|
See [report-issue-procedure.md](./report-issue-procedure.md) for the full procedure with rationale per decision (D-02, D-03, D-04, D-05, D-07, D-11).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: gdd-router
|
|
3
|
-
description: "Routes a /gdd command to fast|quick|full path + S|M|L|XL complexity_class and returns {path, complexity_class, model_tier_overrides, resolved_models, estimated_cost_usd, cache_hits}. Deterministic - no model call. Invoked once at command entry before any Agent spawn. Read by hooks/budget-enforcer.
|
|
3
|
+
description: "Routes a /gdd command to fast|quick|full path + S|M|L|XL complexity_class and returns {path, complexity_class, model_tier_overrides, resolved_models, estimated_cost_usd, cache_hits}. Deterministic - no model call. Invoked once at command entry before any Agent spawn. Read by hooks/budget-enforcer.ts."
|
|
4
4
|
argument-hint: "<intent-string> [<target-artifacts-csv>]"
|
|
5
5
|
tools: Read, Bash, Grep
|
|
6
6
|
---
|
|
@@ -9,7 +9,7 @@ tools: Read, Bash, Grep
|
|
|
9
9
|
|
|
10
10
|
## Role
|
|
11
11
|
|
|
12
|
-
You are a deterministic routing skill. You do not spawn agents. You read `.design/budget.json`, `reference/model-prices.md`, `.design/cache-manifest.json` (if present), and the agent frontmatter list, then emit a single JSON object describing the planned spawn graph. The budget-enforcer hook (`hooks/budget-enforcer.
|
|
12
|
+
You are a deterministic routing skill. You do not spawn agents. You read `.design/budget.json`, `reference/model-prices.md`, `.design/cache-manifest.json` (if present), and the agent frontmatter list, then emit a single JSON object describing the planned spawn graph. The budget-enforcer hook (`hooks/budget-enforcer.ts`) consumes your output on every `Agent` tool call.
|
|
13
13
|
|
|
14
14
|
## Invocation Contract
|
|
15
15
|
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
name: verify-procedure
|
|
3
3
|
type: meta-rules
|
|
4
4
|
version: 1.0.0
|
|
5
|
-
phase: 28.5
|
|
6
5
|
tags: [verify, procedure, extracted, pipeline-stage, gap-loop, must-have, quality-gate]
|
|
7
6
|
last_updated: 2026-05-18
|
|
8
7
|
---
|
|
9
8
|
|
|
10
|
-
Source: extracted from `skills/verify/SKILL.md`
|
|
9
|
+
Source: extracted from `skills/verify/SKILL.md` to keep the SKILL focused on the essential workflow.
|
|
11
10
|
The skill's essential workflow stays in `../skills/verify/SKILL.md`; this file holds the
|
|
12
11
|
detail the agent reaches for when executing a specific step (state integration, quality-gate
|
|
13
12
|
decision tree, agent spawn protocols, gap-response loop, must-have flipping).
|
|
@@ -28,9 +27,9 @@ methodology, agent prompts, and gap-loop semantics.
|
|
|
28
27
|
1. `mcp__gdd_state__transition_stage` with `to: "verify"`.
|
|
29
28
|
2. `mcp__gdd_state__get` → snapshot `state`. Read `state.must_haves` - this is the verification checklist; each M-XX starts at `status: pending` and will be flipped to `pass` or `fail` as verification concludes.
|
|
30
29
|
|
|
31
|
-
#### Step 2.5 - Quality-gate gate
|
|
30
|
+
#### Step 2.5 - Quality-gate gate
|
|
32
31
|
|
|
33
|
-
Before resume detection, inspect `state.quality_gate` from the same snapshot. The
|
|
32
|
+
Before resume detection, inspect `state.quality_gate` from the same snapshot. The quality-gate skill (see `skills/quality-gate/SKILL.md`) writes a single `<run/>` element capturing the most recent run; this step is the verify-side consumer of that result. Three branches, evaluated in order:
|
|
34
33
|
|
|
35
34
|
- **`state.quality_gate?.run?.status === "fail"`** → Refuse to advance. The fix loop in `quality-gate/SKILL.md` Step 4 reached `max_iters` without converging, and the verify stage MUST NOT paper over it. Print a blocker reason that includes the iteration count and the `commands_run` field from the run, then call:
|
|
36
35
|
|
|
@@ -43,9 +42,9 @@ Before resume detection, inspect `state.quality_gate` from the same snapshot. Th
|
|
|
43
42
|
|
|
44
43
|
Exit immediately with the failure surface visible to the user. Do NOT call `mcp__gdd_state__update_progress` to open the verify stage; the gate refused entry, so the stage was never opened.
|
|
45
44
|
|
|
46
|
-
- **`state.quality_gate?.run?.status === "timeout"` OR `=== "skipped"`** → Print a one-line warning naming the status and the `commands_run` value, then continue normally.
|
|
45
|
+
- **`state.quality_gate?.run?.status === "timeout"` OR `=== "skipped"`** → Print a one-line warning naming the status and the `commands_run` value, then continue normally. These are signals, not walls: a slow test suite must not hostage the pipeline, and a project with no detectable quality commands must not block verify entry. The warning surfaces the degraded state without halting.
|
|
47
46
|
|
|
48
|
-
- **`state.quality_gate?.run?.status === "pass"` OR `state.quality_gate === null`** → Continue silently. `pass` is the happy path; `null` means the gate has never been run for this cycle (the user skipped
|
|
47
|
+
- **`state.quality_gate?.run?.status === "pass"` OR `state.quality_gate === null`** → Continue silently. `pass` is the happy path; `null` means the gate has never been run for this cycle (the user skipped the quality-gate stage entirely, which is permitted - verify only *checks* the gate result, never *runs* the gate itself).
|
|
49
48
|
|
|
50
49
|
This step is a pure read against the snapshot already loaded in Step 2 - no extra MCP call is required.
|
|
51
50
|
|
|
@@ -93,7 +92,7 @@ Step P2 — Live tool call:
|
|
|
93
92
|
Record the preview probe result via `mcp__gdd_state__probe_connections` (batched with the storybook and chromatic probes below — one call per stage, see "Batched connections write" at the end of this section).
|
|
94
93
|
```
|
|
95
94
|
|
|
96
|
-
When `preview: available`, the design-verifier agent runs
|
|
95
|
+
When `preview: available`, the design-verifier agent runs Stage 4B - Screenshot Evidence to resolve `? VISUAL` heuristic flags with real screenshot evidence. See `agents/design-verifier.md` Stage 4B for the screenshot evidence loop.
|
|
97
96
|
|
|
98
97
|
### Probe Storybook connection
|
|
99
98
|
|
|
@@ -202,7 +201,7 @@ Initialize iteration counter to 0 (used for fix loop limit in Step 3).
|
|
|
202
201
|
|
|
203
202
|
Three agents run in sequence. Each waits for its completion marker before the next is spawned.
|
|
204
203
|
|
|
205
|
-
**Note on lazy gates
|
|
204
|
+
**Note on lazy gates:** Each full checker is preceded by a cheap Haiku gate that reads the diff and may return `{spawn: false}` to short-circuit. When gated out, `lazy_skipped: true` is appended to `.design/telemetry/costs.jsonl`. Gates: `design-verifier-gate` (before 1b), `design-integration-checker-gate` (before 1c). `design-context-checker-gate` is wired into `skills/discover/SKILL.md` Step 1.75.
|
|
206
205
|
|
|
207
206
|
### 1a. Run design-auditor first (retrospective 7-pillar audit)
|
|
208
207
|
|
|
@@ -274,9 +273,9 @@ Task("design-verifier", """
|
|
|
274
273
|
You are the design-verifier agent. Run the 5-phase verification against completed design work.
|
|
275
274
|
|
|
276
275
|
DESIGN-AUDIT.md (above) contains a retrospective 7-pillar qualitative audit from design-auditor.
|
|
277
|
-
Read it as supplementary signal — incorporate the priority fix list into your
|
|
276
|
+
Read it as supplementary signal — incorporate the priority fix list into your Stage 5 gap analysis
|
|
278
277
|
where relevant. The auditor's 1-4 scores complement your 0-10 category scores; they do not
|
|
279
|
-
replace your
|
|
278
|
+
replace your Stage 1 category scoring.
|
|
280
279
|
|
|
281
280
|
Context:
|
|
282
281
|
auto_mode: <true|false>
|
|
@@ -432,7 +431,7 @@ Task("design-fixer", """
|
|
|
432
431
|
@.design/DESIGN-CONTEXT.md
|
|
433
432
|
</required_reading>
|
|
434
433
|
|
|
435
|
-
Fix all BLOCKER and MAJOR gaps from ##
|
|
434
|
+
Fix all BLOCKER and MAJOR gaps from ## Stage 5 - Gaps in DESIGN-VERIFICATION.md.
|
|
436
435
|
For each gap: apply the targeted fix to the file/location in the gap's Location field.
|
|
437
436
|
After each fix, make an atomic commit: fix(design-gap-GNN): [gap title].
|
|
438
437
|
|
|
@@ -62,7 +62,7 @@ Full + filtered command-output examples live in `./../cache-manager/cache-policy
|
|
|
62
62
|
|
|
63
63
|
- **Pre-sprint**: `/gdd:warm-cache` is the recommended first line of a `/gdd:discover`, `/gdd:plan`, or `/gdd:verify` sprint. Users type it before the real command, or an orchestrator-level wrapper runs it automatically if `agent-metrics.json` (Plan 10.1-05) indicates the last sprint was > 5 min ago.
|
|
64
64
|
- **`reference/shared-preamble.md`** (authored in Plan 10.1-04) is the essential file for this command - agents import it first per D-17, which makes the first N tokens of every agent's rendered system prompt identical, which is what Anthropic's prompt cache keys on.
|
|
65
|
-
- **No interaction with `hooks/budget-enforcer.
|
|
65
|
+
- **No interaction with `hooks/budget-enforcer.ts`** - the hook is a PreToolUse gate; warm-cache runs as an ordinary Agent tool call itself and is subject to the hook (each no-op Haiku ping is budgeted and logged like any other spawn). This is intentional: warm-cache's own telemetry rows in `.design/telemetry/costs.jsonl` are the evidence that cache priming happened.
|
|
66
66
|
|
|
67
67
|
## Cost Model
|
|
68
68
|
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* get-design-done — first-run nudge (Phase 14.7)
|
|
6
|
+
*
|
|
7
|
+
* Port of hooks/first-run-nudge.sh to pure Node CommonJS (Phase 28.x).
|
|
8
|
+
* SessionStart hook. Silent-on-failure by policy: exits 0 on every error path.
|
|
9
|
+
* Prints exactly one restrained line pointing at /gdd:start when all gates
|
|
10
|
+
* pass, and nothing otherwise.
|
|
11
|
+
*
|
|
12
|
+
* Non-obvious behavior preserved:
|
|
13
|
+
* - Logger is silent unless GDD_NUDGE_DEBUG=1 (matches bash `${VAR:-0}`).
|
|
14
|
+
* - HOME falls back to USERPROFILE (Windows). Mirrors bash `${HOME:-$USERPROFILE}`.
|
|
15
|
+
* - read_state_stage uses the same regex shape as the bash sed: drops an
|
|
16
|
+
* optional surrounding double-quote and stops at the first whitespace.
|
|
17
|
+
* - has_recent_gdd_command is a placeholder that always returns false (matches
|
|
18
|
+
* the bash `return 1` → `is_active` boolean false).
|
|
19
|
+
* - Sourcing guard: helpers are exported on module.exports; main() only runs
|
|
20
|
+
* when invoked as the entry point (require.main === module).
|
|
21
|
+
* - Always exit 0 — every error path is swallowed.
|
|
22
|
+
* - The locked nudge copy appears exactly once in this file (test asserts
|
|
23
|
+
* the nudge string occurs exactly once in the hook source).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const fs = require('node:fs');
|
|
27
|
+
const path = require('node:path');
|
|
28
|
+
|
|
29
|
+
const NUDGE_LINE =
|
|
30
|
+
'Tip: run /gdd:start to let GDD inspect this codebase and suggest one first fix.\n';
|
|
31
|
+
|
|
32
|
+
function log(msg) {
|
|
33
|
+
if (process.env.GDD_NUDGE_DEBUG === '1') {
|
|
34
|
+
process.stderr.write(`[gdd first-run-nudge] ${msg}\n`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gate 1 — repo already has GDD state, suppress.
|
|
40
|
+
* @param {string} designDir absolute path to <cwd>/.design
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
function hasDesignState(designDir) {
|
|
44
|
+
try {
|
|
45
|
+
const config = path.join(designDir, 'config.json');
|
|
46
|
+
const state = path.join(designDir, 'STATE.md');
|
|
47
|
+
return isFile(config) || isFile(state);
|
|
48
|
+
} catch (_e) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gate 2 — per-install dismissal flag.
|
|
55
|
+
* @param {string} homeDir resolved HOME (or USERPROFILE on Windows)
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
function isDismissed(homeDir) {
|
|
59
|
+
try {
|
|
60
|
+
if (!homeDir) return false;
|
|
61
|
+
return isFile(path.join(homeDir, '.claude', 'gdd-nudge-dismissed'));
|
|
62
|
+
} catch (_e) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Reads the first `stage:` line out of STATE.md and strips surrounding quoting
|
|
69
|
+
* the way the bash sed expression does (drops an optional surrounding double
|
|
70
|
+
* quote, captures non-quote/non-whitespace chars, ignores any trailing text).
|
|
71
|
+
*
|
|
72
|
+
* @param {string} stateFilePath absolute path to STATE.md
|
|
73
|
+
* @returns {string} the captured stage value, or '' if unavailable
|
|
74
|
+
*/
|
|
75
|
+
function readStateStage(stateFilePath) {
|
|
76
|
+
try {
|
|
77
|
+
if (!isFile(stateFilePath)) return '';
|
|
78
|
+
const text = fs.readFileSync(stateFilePath, 'utf8');
|
|
79
|
+
const lines = text.split(/\r?\n/);
|
|
80
|
+
for (const line of lines) {
|
|
81
|
+
if (/^stage:/.test(line)) {
|
|
82
|
+
const m = line.match(/^stage:[ \t]*"?([^"\s]+)"?.*/);
|
|
83
|
+
if (m && m[1]) return m[1];
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return '';
|
|
88
|
+
} catch (_e) {
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const ACTIVE_STAGES = new Set(['plan', 'design', 'verify', 'executing', 'discussing']);
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Gate 3 — STATE.md stage belongs to an active pipeline window.
|
|
97
|
+
* @param {string} stateFilePath absolute path to STATE.md
|
|
98
|
+
* @returns {boolean}
|
|
99
|
+
*/
|
|
100
|
+
function isActiveStage(stateFilePath) {
|
|
101
|
+
const s = readStateStage(stateFilePath);
|
|
102
|
+
return ACTIVE_STAGES.has(s);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Gate 4 — recent session history has a gdd:* command.
|
|
107
|
+
* Placeholder: no portable transcript path exposed to SessionStart hooks today.
|
|
108
|
+
* Mirrors the bash version's `return 1` (false) so we never falsely suppress.
|
|
109
|
+
* @returns {boolean}
|
|
110
|
+
*/
|
|
111
|
+
function hasRecentGddCommand() {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function isFile(p) {
|
|
116
|
+
try {
|
|
117
|
+
const st = fs.statSync(p);
|
|
118
|
+
return st.isFile();
|
|
119
|
+
} catch (_e) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function resolveHomeDir() {
|
|
125
|
+
// bash: ${HOME:-$USERPROFILE} — HOME wins if set (even on Windows), else USERPROFILE.
|
|
126
|
+
return process.env.HOME || process.env.USERPROFILE || '';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function main() {
|
|
130
|
+
try {
|
|
131
|
+
const cwd = process.cwd();
|
|
132
|
+
const designDir = path.join(cwd, '.design');
|
|
133
|
+
const stateFile = path.join(designDir, 'STATE.md');
|
|
134
|
+
const homeDir = resolveHomeDir();
|
|
135
|
+
|
|
136
|
+
if (hasDesignState(designDir)) {
|
|
137
|
+
log('design state present — suppress');
|
|
138
|
+
process.exit(0);
|
|
139
|
+
}
|
|
140
|
+
if (isDismissed(homeDir)) {
|
|
141
|
+
log('dismissal flag present — suppress');
|
|
142
|
+
process.exit(0);
|
|
143
|
+
}
|
|
144
|
+
if (isActiveStage(stateFile)) {
|
|
145
|
+
log('active stage — suppress');
|
|
146
|
+
process.exit(0);
|
|
147
|
+
}
|
|
148
|
+
if (hasRecentGddCommand()) {
|
|
149
|
+
log('recent gdd:* command detected — suppress');
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
// All gates passed — emit the locked one-line nudge.
|
|
153
|
+
process.stdout.write(NUDGE_LINE);
|
|
154
|
+
process.exit(0);
|
|
155
|
+
} catch (_e) {
|
|
156
|
+
// Silent-on-failure: every error path exits 0.
|
|
157
|
+
process.exit(0);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = {
|
|
162
|
+
hasDesignState,
|
|
163
|
+
isDismissed,
|
|
164
|
+
readStateStage,
|
|
165
|
+
isActiveStage,
|
|
166
|
+
hasRecentGddCommand,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
if (require.main === module) {
|
|
170
|
+
main();
|
|
171
|
+
}
|