@drafthq/draft 3.5.3 → 3.7.1
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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/README.md +28 -49
- package/bin/README.md +47 -1
- package/cli/src/hosts/cursor.js +3 -0
- package/cli/src/installer.js +8 -4
- package/cli/src/lib/cursor-registry.js +10 -0
- package/cli/src/lib/fsx.js +3 -0
- package/cli/src/lib/marker.js +8 -3
- package/core/agents/architect.md +21 -9
- package/core/agents/debugger.md +5 -0
- package/core/agents/ops.md +7 -2
- package/core/agents/planner.md +7 -0
- package/core/agents/rca.md +14 -3
- package/core/agents/reviewer.md +1 -0
- package/core/agents/writer.md +6 -0
- package/core/knowledge-base.md +22 -3
- package/core/methodology.md +30 -5
- package/core/shared/condensation.md +28 -18
- package/core/shared/context-verify.md +3 -1
- package/core/shared/cross-skill-dispatch.md +7 -3
- package/core/shared/draft-context-loading.md +3 -0
- package/core/shared/git-report-metadata.md +2 -1
- package/core/shared/graph-query.md +24 -26
- package/core/shared/graph-usage-report.md +1 -1
- package/core/shared/jira-sync.md +10 -6
- package/core/shared/okf-retrieval.md +1 -1
- package/core/shared/parallel-analysis.md +14 -7
- package/core/shared/pattern-learning.md +2 -0
- package/core/shared/template-contract.md +1 -1
- package/core/shared/tool-resolver.md +20 -15
- package/core/shared/vcs-commands.md +5 -2
- package/core/templates/ai-context.md +3 -2
- package/core/templates/ai-profile.md +7 -0
- package/core/templates/architecture.md +6 -2
- package/core/templates/discovery.md +1 -1
- package/core/templates/guardrails.md +9 -0
- package/core/templates/hld.md +5 -4
- package/core/templates/intake-questions.md +45 -0
- package/core/templates/jira.md +11 -2
- package/core/templates/lld.md +8 -5
- package/core/templates/okf/concept.md +0 -1
- package/core/templates/plan.md +1 -1
- package/core/templates/product.md +11 -2
- package/core/templates/rca.md +6 -0
- package/core/templates/service-index.md +1 -0
- package/core/templates/spec.md +15 -0
- package/core/templates/tech-stack.md +12 -0
- package/core/templates/workflow.md +20 -0
- package/integrations/agents/AGENTS.md +1449 -817
- package/integrations/copilot/.github/copilot-instructions.md +1449 -817
- package/package.json +1 -1
- package/scripts/fetch-memory-engine.sh +25 -7
- package/scripts/lib.sh +90 -6
- package/scripts/tools/_graph_queries.sh +22 -8
- package/scripts/tools/_lib.sh +81 -11
- package/scripts/tools/adr-index.sh +1 -1
- package/scripts/tools/check-repo-size.sh +125 -0
- package/scripts/tools/check-skill-line-caps.sh +3 -4
- package/scripts/tools/check-template-noop.sh +0 -1
- package/scripts/tools/check-track-hygiene.sh +41 -21
- package/scripts/tools/classify-files.sh +3 -3
- package/scripts/tools/cycle-detect.sh +18 -17
- package/scripts/tools/detect-test-framework.sh +1 -1
- package/scripts/tools/emit-skill-metrics.sh +7 -2
- package/scripts/tools/fix-whitespace.sh +3 -0
- package/scripts/tools/freshness-check.sh +2 -2
- package/scripts/tools/git-metadata.sh +12 -6
- package/scripts/tools/graph-arch.sh +5 -11
- package/scripts/tools/graph-callers.sh +10 -15
- package/scripts/tools/graph-deps.sh +3 -10
- package/scripts/tools/graph-errors.sh +4 -11
- package/scripts/tools/graph-hierarchy.sh +4 -11
- package/scripts/tools/graph-impact.sh +21 -19
- package/scripts/tools/graph-init.sh +13 -9
- package/scripts/tools/graph-preflight.sh +4 -1
- package/scripts/tools/graph-query.sh +74 -18
- package/scripts/tools/graph-risk.sh +3 -10
- package/scripts/tools/graph-search.sh +4 -11
- package/scripts/tools/graph-snapshot.sh +38 -9
- package/scripts/tools/graph-snippet.sh +3 -10
- package/scripts/tools/graph-tests.sh +3 -10
- package/scripts/tools/graph-traces.sh +3 -10
- package/scripts/tools/hotspot-rank.sh +6 -12
- package/scripts/tools/install-smoke-test.sh +223 -0
- package/scripts/tools/mermaid-from-graph.sh +5 -11
- package/scripts/tools/migrate-track-frontmatter.sh +11 -10
- package/scripts/tools/okf-coverage-check.sh +8 -7
- package/scripts/tools/okf-emit-catalog.sh +256 -0
- package/scripts/tools/okf-fix-links.sh +251 -0
- package/scripts/tools/okf-plan-concepts.sh +242 -14
- package/scripts/tools/okf-render-views.sh +63 -21
- package/scripts/tools/okf-validate-all.sh +20 -9
- package/scripts/tools/okf-validate-quality.sh +15 -10
- package/scripts/tools/okf-validate.sh +20 -6
- package/scripts/tools/parse-git-log.sh +23 -5
- package/scripts/tools/parse-reports.sh +1 -1
- package/scripts/tools/render-track.sh +1 -1
- package/scripts/tools/resolve-tools.sh +24 -8
- package/scripts/tools/run-coverage.sh +1 -1
- package/scripts/tools/scan-markers.sh +4 -4
- package/scripts/tools/validate-frontmatter.sh +2 -2
- package/scripts/tools/verify-citations.sh +3 -4
- package/scripts/tools/verify-doc-anchors.sh +14 -34
- package/scripts/tools/verify-graph-binary.sh +15 -5
- package/skills/GRAPH.md +21 -10
- package/skills/adr/SKILL.md +25 -7
- package/skills/assist-review/SKILL.md +2 -1
- package/skills/bughunt/SKILL.md +55 -12
- package/skills/bughunt/references/regression-tests.md +14 -4
- package/skills/change/SKILL.md +19 -9
- package/skills/coverage/SKILL.md +28 -12
- package/skills/debug/SKILL.md +13 -3
- package/skills/decompose/SKILL.md +42 -12
- package/skills/deep-review/SKILL.md +19 -6
- package/skills/deploy-checklist/SKILL.md +10 -3
- package/skills/documentation/SKILL.md +12 -1
- package/skills/draft/SKILL.md +40 -29
- package/skills/draft/context-files.md +8 -1
- package/skills/draft/quality-guide.md +10 -2
- package/skills/graph/SKILL.md +2 -2
- package/skills/impact/SKILL.md +4 -2
- package/skills/implement/SKILL.md +62 -20
- package/skills/incident-response/SKILL.md +5 -2
- package/skills/init/SKILL.md +112 -30
- package/skills/init/references/architecture-spec.md +32 -8
- package/skills/init/references/okf-emitter.md +42 -78
- package/skills/jira/SKILL.md +33 -13
- package/skills/jira/references/review.md +61 -19
- package/skills/learn/SKILL.md +30 -7
- package/skills/new-track/SKILL.md +73 -18
- package/skills/quick-review/SKILL.md +8 -3
- package/skills/revert/SKILL.md +11 -5
- package/skills/review/SKILL.md +126 -27
- package/skills/review/references/zero-setup-mode.md +117 -0
- package/skills/standup/SKILL.md +10 -2
- package/skills/status/SKILL.md +7 -7
- package/skills/tech-debt/SKILL.md +9 -3
- package/skills/testing-strategy/SKILL.md +10 -2
- package/skills/tour/SKILL.md +2 -1
- package/skills/upload/SKILL.md +4 -3
- package/core/templates/track-architecture.md +0 -311
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"name": "draft",
|
|
13
13
|
"source": "./",
|
|
14
14
|
"description": "Context-Driven Development: draft specs and plans before implementation. Structured workflows for features and fixes.",
|
|
15
|
-
"version": "3.
|
|
15
|
+
"version": "3.7.1",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "mayurpise"
|
|
18
18
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "draft",
|
|
3
3
|
"displayName": "Draft",
|
|
4
4
|
"description": "Context-Driven Development: draft specs and plans before implementation. Structured workflows for features and fixes.",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.7.1",
|
|
6
6
|
"skills": "./skills/",
|
|
7
7
|
"agents": "./core/agents/",
|
|
8
8
|
"author": {
|
package/README.md
CHANGED
|
@@ -40,6 +40,8 @@ Three stages, one command:
|
|
|
40
40
|
2. **Spec compliance** — checks the diff against the agreed spec, not vibes
|
|
41
41
|
3. **Code quality** — flags hotspots, blast radius, and missing test coverage using a tree-sitter knowledge graph of your repo
|
|
42
42
|
|
|
43
|
+
No setup required for the first run: on an un-indexed repo it reviews the diff and names the structural checks it skipped, so you see findings before you spend anything.
|
|
44
|
+
|
|
43
45
|
Free. No API keys. No paid tier. No vendor lock-in. Catches the 3 bugs you missed before they hit your reviewer.
|
|
44
46
|
|
|
45
47
|
> *Demo coming soon — for now, [watch the 8-minute walkthrough](https://www.youtube.com/watch?v=gBSwFEFVd7Y).*
|
|
@@ -76,35 +78,44 @@ Flags: `--global` / `--project` to pick scope, `--dry-run` to preview, `--force`
|
|
|
76
78
|
Then, in Claude Code (after restarting):
|
|
77
79
|
|
|
78
80
|
```bash
|
|
79
|
-
/draft:
|
|
80
|
-
/draft:
|
|
81
|
+
/draft:review # ← start here. No setup, no indexing. Reviews your current diff.
|
|
82
|
+
/draft:init # once you've seen what it catches: index the repo (one-time)
|
|
83
|
+
/draft:review # same command, now with blast radius + hotspots + cycle detection
|
|
81
84
|
```
|
|
82
85
|
|
|
86
|
+
`/draft:review` runs on an un-indexed repo and tells you exactly which structural checks it had to skip. Indexing is the upgrade, not the entry fee.
|
|
87
|
+
|
|
83
88
|
Run `/draft` for the full command map.
|
|
84
89
|
|
|
85
90
|
<details>
|
|
86
91
|
<summary><strong>Other ways to install →</strong></summary>
|
|
87
92
|
|
|
88
93
|
### Claude Code — native marketplace
|
|
94
|
+
|
|
89
95
|
```bash
|
|
90
96
|
/plugin marketplace add drafthq/draft
|
|
91
97
|
/plugin install draft
|
|
92
98
|
```
|
|
93
99
|
|
|
94
100
|
### Cursor — from GitHub
|
|
101
|
+
|
|
95
102
|
Cursor requires `.cursor-plugin/plugin.json`; the `draft install cursor` command also registers the plugin via the shared Claude plugin registry that Cursor reads on many builds. To add from source instead, use *Settings > Rules, Skills, Subagents > Rules > New > Add from Github*:
|
|
96
|
-
|
|
103
|
+
|
|
104
|
+
```text
|
|
97
105
|
https://github.com/drafthq/draft.git
|
|
98
106
|
```
|
|
99
107
|
|
|
100
108
|
### GitHub Copilot
|
|
109
|
+
|
|
101
110
|
Copilot reads a committed instructions file — copy it directly (not a `draft install` host):
|
|
111
|
+
|
|
102
112
|
```bash
|
|
103
113
|
mkdir -p .github && curl -o .github/copilot-instructions.md \
|
|
104
114
|
https://raw.githubusercontent.com/drafthq/draft/main/integrations/copilot/.github/copilot-instructions.md
|
|
105
115
|
```
|
|
106
116
|
|
|
107
117
|
### Gemini
|
|
118
|
+
|
|
108
119
|
```bash
|
|
109
120
|
curl -o .gemini.md https://raw.githubusercontent.com/drafthq/draft/main/integrations/gemini/.gemini.md
|
|
110
121
|
```
|
|
@@ -113,53 +124,19 @@ curl -o .gemini.md https://raw.githubusercontent.com/drafthq/draft/main/integrat
|
|
|
113
124
|
|
|
114
125
|
---
|
|
115
126
|
|
|
116
|
-
##
|
|
127
|
+
## The five commands
|
|
117
128
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
| Command | What it does |
|
|
130
|
+
|---------|--------------|
|
|
131
|
+
| **`/draft:review`** | 3-stage review of your diff. **Works with zero setup** — run it first. |
|
|
132
|
+
| **`/draft:init`** | Index the repo once. Adds blast radius, caller lookup, hotspot ranking, and cycle detection to every later review. |
|
|
133
|
+
| **`/draft:new-track`** | Turn an idea into a spec + plan before any code is written. |
|
|
134
|
+
| **`/draft:implement`** | Execute the plan task-by-task under TDD with verification gates. |
|
|
135
|
+
| **`/draft:graph`** | Build or refresh the knowledge-graph snapshot on its own. |
|
|
121
136
|
|
|
122
|
-
|
|
137
|
+
That is the whole loop. 28 more specialist commands — bug hunting, ACID audits, ADRs, tech debt, incident response, Jira, coverage, standups — sit behind five intent routers (`/draft:plan`, `/draft:discover`, `/draft:ops`, `/draft:docs`, `/draft:jira`).
|
|
123
138
|
|
|
124
|
-
|
|
125
|
-
|---------|--------------|
|
|
126
|
-
| **`/draft`** | Overview, intent mapping, and command reference |
|
|
127
|
-
| **`/draft:plan`** | Router for planning, architecture, and track management |
|
|
128
|
-
| **`/draft:ops`** | Router for operations, deployment, incident, and lifecycle |
|
|
129
|
-
| **`/draft:docs`** | Router for authoring and documentation workflows |
|
|
130
|
-
| **`/draft:discover`** | Router for discovery, debugging, investigation, and quality |
|
|
131
|
-
| **`/draft:init`** | Analyze codebase, create context files + state tracking |
|
|
132
|
-
| **`/draft:graph`** | Build / refresh the knowledge-graph snapshot |
|
|
133
|
-
| **`/draft:new-track`** | Collaborative spec + plan with AI |
|
|
134
|
-
| **`/draft:decompose`** | Module decomposition with dependency mapping |
|
|
135
|
-
| **`/draft:implement`** | TDD workflow with checkpoints |
|
|
136
|
-
| **`/draft:coverage`** | Code coverage report (target 95%+) |
|
|
137
|
-
| **`/draft:review`** | 3-stage review (validation + spec compliance + code quality) |
|
|
138
|
-
| **`/draft:deep-review`** | Enterprise-grade module lifecycle and ACID audit |
|
|
139
|
-
| **`/draft:bughunt`** | Exhaustive 14-dimension defect discovery with taint tracking |
|
|
140
|
-
| **`/draft:learn`** | Discover coding patterns, update guardrails |
|
|
141
|
-
| **`/draft:adr`** | Architecture Decision Records |
|
|
142
|
-
| **`/draft:status`** | Show progress overview |
|
|
143
|
-
| **`/draft:revert`** | Git-aware rollback |
|
|
144
|
-
| **`/draft:change`** | Handle mid-track requirement changes |
|
|
145
|
-
| **`/draft:debug`** | Structured debugging: reproduce, isolate, diagnose, fix |
|
|
146
|
-
| **`/draft:quick-review`** | Lightweight 4-dimension code review |
|
|
147
|
-
| **`/draft:deploy-checklist`** | Pre-deployment verification with rollback triggers |
|
|
148
|
-
| **`/draft:upload`** | Pre-upload handoff gate (review, HLD, checklist, validators) |
|
|
149
|
-
| **`/draft:testing-strategy`** | Test plan design with coverage targets |
|
|
150
|
-
| **`/draft:tech-debt`** | Technical debt analysis across 6 dimensions |
|
|
151
|
-
| **`/draft:standup`** | Git activity standup summary (read-only) |
|
|
152
|
-
| **`/draft:incident-response`** | Incident lifecycle: triage, communicate, mitigate, postmortem |
|
|
153
|
-
| **`/draft:documentation`** | Technical docs: readme, runbook, api, onboarding |
|
|
154
|
-
| **`/draft:integrations`** | External system exports and syncs (jira preview / create) |
|
|
155
|
-
| **`/draft:jira`** | Unified Jira workflows (preview / create / review) |
|
|
156
|
-
| **`/draft:tour`** | Interactive architecture mentorship and codebase walk-through |
|
|
157
|
-
| **`/draft:impact`** | ROI analytics tracking friction and timeline metrics |
|
|
158
|
-
| **`/draft:assist-review`** | Summarize intent and highlight structural PR risks for reviewers |
|
|
159
|
-
|
|
160
|
-
[See full command reference →](core/methodology.md#command-workflows)
|
|
161
|
-
|
|
162
|
-
> **Recommended next step after install:** run `/draft:init` to index your repo, then `/draft:review` on any branch with AI-generated changes. Once you've seen what it catches, explore the rest.
|
|
139
|
+
[Full command reference →](docs/COMMANDS.md) · run `/draft` for the interactive intent map
|
|
163
140
|
|
|
164
141
|
---
|
|
165
142
|
|
|
@@ -193,7 +170,7 @@ Skills also call into **shell helpers** under `scripts/tools/` for mechanical wo
|
|
|
193
170
|
|
|
194
171
|
## How It Works
|
|
195
172
|
|
|
196
|
-
```
|
|
173
|
+
```text
|
|
197
174
|
┌─────────────────────────────────────────────────────────────┐
|
|
198
175
|
│ /draft:init │
|
|
199
176
|
│ 5-phase codebase analysis + signal detection + state │
|
|
@@ -249,7 +226,7 @@ Both modes produce the same `product.md`, `tech-stack.md`, `workflow.md`,
|
|
|
249
226
|
|
|
250
227
|
AI tools are fast but unstructured. Draft applies Context-Driven Development to impose clear boundaries: explicit context, phased execution, and built-in verification, ensuring outputs remain aligned, predictable, and production-ready.
|
|
251
228
|
|
|
252
|
-
```
|
|
229
|
+
```text
|
|
253
230
|
product.md → "Build a task manager"
|
|
254
231
|
tech-stack.md → "React, TypeScript, Tailwind"
|
|
255
232
|
architecture.md → Comprehensive: 10-section graph-primary engineering reference, Mermaid diagrams (source of truth). Mature brownfield projects with strong existing agent docs (CLAUDE.md, INVARIANTS.md, etc.) receive early Context Quality Audit, graph fidelity dashboard, and explicit Relationship + Gaps sections (no blind duplication).
|
|
@@ -270,11 +247,13 @@ Each layer narrows the solution space. By the time AI writes code, decisions are
|
|
|
270
247
|
## Contributing
|
|
271
248
|
|
|
272
249
|
### Source of Truth
|
|
250
|
+
|
|
273
251
|
1. `core/methodology.md` — Master methodology
|
|
274
252
|
2. `skills/<name>/SKILL.md` — Command implementations
|
|
275
253
|
3. `integrations/` — Auto-generated (don't edit)
|
|
276
254
|
|
|
277
255
|
### Update Workflow
|
|
256
|
+
|
|
278
257
|
```bash
|
|
279
258
|
# 1. Edit core/methodology.md or skills/*/SKILL.md
|
|
280
259
|
# 2. Rebuild integrations
|
package/bin/README.md
CHANGED
|
@@ -13,7 +13,7 @@ CMM_VERSION=latest scripts/fetch-memory-engine.sh # or a specific tag / latest
|
|
|
13
13
|
|
|
14
14
|
This installs the binary to the **Draft-managed location**:
|
|
15
15
|
|
|
16
|
-
```
|
|
16
|
+
```text
|
|
17
17
|
~/.cache/draft/bin/codebase-memory-mcp
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -57,3 +57,49 @@ Structural graph data (architecture, hotspots, module deps, service routes) is q
|
|
|
57
57
|
## Offline / air-gapped distributions
|
|
58
58
|
|
|
59
59
|
To ship the engine in-tree, place the binary at `bin/<os>-<arch>/codebase-memory-mcp` (resolution step 4). This is optional and not the default; the managed fetch is preferred.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Trust story
|
|
64
|
+
|
|
65
|
+
Draft's differentiator depends on a binary published by a third party ([DeusData](https://github.com/DeusData)). That is a real supply-chain dependency and deserves a stated position rather than an implied one.
|
|
66
|
+
|
|
67
|
+
### What is actually guaranteed
|
|
68
|
+
|
|
69
|
+
| Property | Status |
|
|
70
|
+
|---|---|
|
|
71
|
+
| Version pinned | Yes — `DEFAULT_VERSION` in `scripts/fetch-memory-engine.sh`. Bumps are deliberate commits, never floating. `CMM_VERSION` overrides per-install. |
|
|
72
|
+
| SHA-256 verified | Yes when the release publishes `checksums.txt` and lists the archive. A **mismatch is always fatal.** |
|
|
73
|
+
| Missing checksum | **Warns and installs by default.** Set `DRAFT_STRICT_VERIFY=1` to make an unverifiable download fatal instead. |
|
|
74
|
+
| Signature / attestation | **No.** There is no code signing or SLSA provenance today. Verification is checksum-only. |
|
|
75
|
+
| Source available | Yes — the engine is open source at [DeusData/codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp). |
|
|
76
|
+
| Reproducible build | Not verified by Draft. We check the archive matches the publisher's checksum, not that the checksum matches the source. |
|
|
77
|
+
|
|
78
|
+
Be explicit about the residual risk: a checksum proves the download matches what the publisher released. It does not prove the publisher released what the source says.
|
|
79
|
+
|
|
80
|
+
### What the engine does at runtime
|
|
81
|
+
|
|
82
|
+
- Reads the repository you point it at and writes a SQLite graph under its own cache.
|
|
83
|
+
- Runs entirely locally. No API key, no telemetry endpoint, no outbound calls during indexing or querying.
|
|
84
|
+
- Network is used exactly once, by `fetch-memory-engine.sh`, to download the release archive.
|
|
85
|
+
|
|
86
|
+
Draft invokes it only through `codebase-memory-mcp cli <tool> '<json>'` (see `_lib.sh:memory_cli`). It is never given credentials and never writes into your source tree.
|
|
87
|
+
|
|
88
|
+
### If you cannot run an unvetted binary
|
|
89
|
+
|
|
90
|
+
Three supported postures, in increasing strictness:
|
|
91
|
+
|
|
92
|
+
1. **Strict verification** — `DRAFT_STRICT_VERIFY=1 scripts/fetch-memory-engine.sh`. Refuses to install anything it cannot checksum.
|
|
93
|
+
2. **Vendor it yourself** — review the source, build the binary in your own pipeline, and place it at `bin/<os>-<arch>/codebase-memory-mcp` (resolution step 4) or point `DRAFT_MEMORY_BIN` at it. Draft never re-downloads when a binary already resolves.
|
|
94
|
+
3. **Run without it** — `DRAFT_MEMORY_DISABLE=1`, or `draft install <host> --no-graph`. Every graph-backed skill degrades to a documented reduced-context mode; `/draft:review` still runs (see `skills/review/references/zero-setup-mode.md`). You lose blast radius, caller enumeration, hotspot ranking, and cycle detection — nothing silently returns wrong answers.
|
|
95
|
+
|
|
96
|
+
### Contingency if the upstream project stalls
|
|
97
|
+
|
|
98
|
+
The dependency is bounded by design, which is what makes this survivable:
|
|
99
|
+
|
|
100
|
+
- **The interface is small.** Draft consumes a documented CLI (`cli <tool> '<json>'`), not a library. The entire coupling lives in `scripts/tools/_lib.sh` (`memory_cli`, `memory_ensure_index`, `memory_project_for_repo`) and `_graph_queries.sh`. Swapping engines means reimplementing those, not rewriting skills.
|
|
101
|
+
- **Skills never call the engine directly.** They call `graph-*.sh` wrappers, all of which already fail loud with `source: "unavailable"`. An engine that disappears degrades the product; it does not break it.
|
|
102
|
+
- **Pinning buys time.** A stalled upstream keeps working at the pinned version; only new language support would be lost.
|
|
103
|
+
- **The graph contract is replaceable.** The queries are ordinary Cypher-shaped structural lookups (callers, callees, fan-in, cycles, routes) over a tree-sitter/LSP index — reproducible on another indexer.
|
|
104
|
+
|
|
105
|
+
If upstream goes unmaintained, the migration path is: fork at the pinned tag for continuity, then reimplement `_lib.sh`'s three wrappers against a replacement indexer. No skill markdown changes.
|
package/cli/src/hosts/cursor.js
CHANGED
|
@@ -48,6 +48,9 @@ module.exports = {
|
|
|
48
48
|
targetSummary: `${base} (${ctx.scope})`,
|
|
49
49
|
actions,
|
|
50
50
|
graph: true,
|
|
51
|
+
// The actual install root (scope/CURSOR_HOME aware) — used for the
|
|
52
|
+
// plugin-root marker instead of re-deriving a default path.
|
|
53
|
+
pluginRoot: base,
|
|
51
54
|
// Runs after the file copies: register + enable the plugin in the shared
|
|
52
55
|
// Claude registry. On a dry run it computes the merges and writes nothing.
|
|
53
56
|
postInstall(c) {
|
package/cli/src/installer.js
CHANGED
|
@@ -10,9 +10,13 @@ const { writePluginRootMarker } = require('./lib/marker');
|
|
|
10
10
|
// before we even reach the real (separately-timed) install steps.
|
|
11
11
|
const CHECK_TIMEOUT_MS = 10000;
|
|
12
12
|
|
|
13
|
+
// On Windows, npm global CLIs are .cmd shims that CreateProcess can't resolve
|
|
14
|
+
// without a shell; elsewhere a shell is unnecessary overhead.
|
|
15
|
+
const USE_SHELL = process.platform === 'win32';
|
|
16
|
+
|
|
13
17
|
function hasBinary(name) {
|
|
14
18
|
// ENOENT on the error means the binary is not on PATH.
|
|
15
|
-
const r = spawnSync(name, ['--version'], { stdio: 'ignore', timeout: CHECK_TIMEOUT_MS });
|
|
19
|
+
const r = spawnSync(name, ['--version'], { stdio: 'ignore', timeout: CHECK_TIMEOUT_MS, shell: USE_SHELL });
|
|
16
20
|
return !(r.error && r.error.code === 'ENOENT');
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -25,7 +29,7 @@ function execAction(act, ctx) {
|
|
|
25
29
|
const printable = `${act.cmd} ${act.args.join(' ')}`;
|
|
26
30
|
log.plan(`${ctx.dryRun ? 'would run' : 'running'}: ${printable}`);
|
|
27
31
|
if (ctx.dryRun) return 0;
|
|
28
|
-
const r = spawnSync(act.cmd, act.args, { stdio: 'inherit', timeout: STEP_TIMEOUT_MS });
|
|
32
|
+
const r = spawnSync(act.cmd, act.args, { stdio: 'inherit', timeout: STEP_TIMEOUT_MS, shell: USE_SHELL });
|
|
29
33
|
if (r.error) {
|
|
30
34
|
if (r.error.code === 'ETIMEDOUT') {
|
|
31
35
|
log.error(`timed out after ${Math.round(STEP_TIMEOUT_MS / 1000)}s: ${printable}`);
|
|
@@ -79,7 +83,7 @@ function install(host, ctx) {
|
|
|
79
83
|
// failure writes nothing.
|
|
80
84
|
for (const act of plan.actions) {
|
|
81
85
|
if (act.kind === 'exec') continue;
|
|
82
|
-
if (!fsx.exists(act.src)) {
|
|
86
|
+
if (act.src && !fsx.exists(act.src)) {
|
|
83
87
|
log.error(`Bundled asset missing: ${act.src}`);
|
|
84
88
|
log.error('Reinstall @drafthq/draft — the package looks incomplete.');
|
|
85
89
|
return 1;
|
|
@@ -123,7 +127,7 @@ function install(host, ctx) {
|
|
|
123
127
|
// Record the install path so skills can locate scripts/tools/ from the user's
|
|
124
128
|
// project cwd (best-effort; graph skills glob-fallback if the marker is absent).
|
|
125
129
|
if (!ctx.dryRun) {
|
|
126
|
-
const root = writePluginRootMarker(host.id);
|
|
130
|
+
const root = writePluginRootMarker(host.id, plan.pluginRoot);
|
|
127
131
|
if (root) log.note(`Recorded plugin path for graph tooling: ${root}`);
|
|
128
132
|
}
|
|
129
133
|
|
|
@@ -24,11 +24,21 @@ function readJson(filePath, fallback) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// The temp file is a fresh inode, so renaming it over the destination discards
|
|
28
|
+
// the destination's permissions. settings.json can carry env secrets and is often
|
|
29
|
+
// deliberately 0600 — a plain write would silently widen it to the umask default.
|
|
27
30
|
function writeJsonAtomic(filePath, data) {
|
|
28
31
|
const dir = path.dirname(filePath);
|
|
29
32
|
fs.mkdirSync(dir, { recursive: true });
|
|
30
33
|
const tmp = `${filePath}.tmp.${process.pid}`;
|
|
34
|
+
let mode;
|
|
35
|
+
try {
|
|
36
|
+
mode = fs.statSync(filePath).mode & 0o777;
|
|
37
|
+
} catch {
|
|
38
|
+
/* new file — let the umask decide, exactly as a plain write would */
|
|
39
|
+
}
|
|
31
40
|
fs.writeFileSync(tmp, JSON.stringify(data, null, 2) + '\n', 'utf8');
|
|
41
|
+
if (mode !== undefined) fs.chmodSync(tmp, mode);
|
|
32
42
|
fs.renameSync(tmp, filePath);
|
|
33
43
|
}
|
|
34
44
|
|
package/cli/src/lib/fsx.js
CHANGED
|
@@ -18,6 +18,9 @@ function ensureDir(dir) {
|
|
|
18
18
|
|
|
19
19
|
function copyTree(src, dest) {
|
|
20
20
|
ensureDir(path.dirname(dest));
|
|
21
|
+
// Mirror, don't merge: dests are fully draft-owned bundled dirs, and a
|
|
22
|
+
// merge-copy would keep files deleted by newer releases around forever.
|
|
23
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
21
24
|
fs.cpSync(src, dest, { recursive: true });
|
|
22
25
|
}
|
|
23
26
|
|
package/cli/src/lib/marker.js
CHANGED
|
@@ -14,9 +14,14 @@ const os = require('os');
|
|
|
14
14
|
const path = require('path');
|
|
15
15
|
|
|
16
16
|
// Resolve the installed draft plugin root for a given host, or null if unknown.
|
|
17
|
-
|
|
17
|
+
// hintRoot: the root the just-executed install plan actually wrote to — it
|
|
18
|
+
// already accounts for scope (--project) and env overrides (CURSOR_HOME) that
|
|
19
|
+
// the per-host defaults below cannot see.
|
|
20
|
+
function resolvePluginRoot(hostId, hintRoot) {
|
|
18
21
|
const home = os.homedir();
|
|
19
22
|
|
|
23
|
+
if (hintRoot && fs.existsSync(path.join(hintRoot, 'scripts', 'tools'))) return hintRoot;
|
|
24
|
+
|
|
20
25
|
if (hostId === 'claude-code') {
|
|
21
26
|
// 1. Claude Code's own registry holds the authoritative installPath.
|
|
22
27
|
const reg = path.join(home, '.claude', 'plugins', 'installed_plugins.json');
|
|
@@ -77,9 +82,9 @@ function compareVersions(a, b) {
|
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
// Write ~/.cache/draft/plugin-root for the host. Returns the path written, or null.
|
|
80
|
-
function writePluginRootMarker(hostId) {
|
|
85
|
+
function writePluginRootMarker(hostId, hintRoot) {
|
|
81
86
|
try {
|
|
82
|
-
const root = resolvePluginRoot(hostId);
|
|
87
|
+
const root = resolvePluginRoot(hostId, hintRoot);
|
|
83
88
|
if (!root) return null;
|
|
84
89
|
const dest = path.join(os.homedir(), '.cache', 'draft', 'plugin-root');
|
|
85
90
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
package/core/agents/architect.md
CHANGED
|
@@ -25,6 +25,7 @@ You are an architecture agent for Draft-based development. You guide developers
|
|
|
25
25
|
### Module Definition Format
|
|
26
26
|
|
|
27
27
|
For each module, define:
|
|
28
|
+
|
|
28
29
|
- **Name** - Short, descriptive (e.g., `auth`, `scheduler`, `parser`)
|
|
29
30
|
- **Responsibility** - One sentence describing what it owns
|
|
30
31
|
- **Files** - Expected source files
|
|
@@ -39,7 +40,8 @@ Output format: Use the template at `core/templates/ai-context.md` for project-wi
|
|
|
39
40
|
Represent API surfaces using the conventions of the project's primary language:
|
|
40
41
|
|
|
41
42
|
**TypeScript:**
|
|
42
|
-
|
|
43
|
+
|
|
44
|
+
```text
|
|
43
45
|
- API Surface:
|
|
44
46
|
- `createUser(data: CreateUserInput): Promise<User>`
|
|
45
47
|
- `deleteUser(id: string): Promise<void>`
|
|
@@ -48,7 +50,8 @@ Represent API surfaces using the conventions of the project's primary language:
|
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
**Python:**
|
|
51
|
-
|
|
53
|
+
|
|
54
|
+
```text
|
|
52
55
|
- API Surface:
|
|
53
56
|
- `create_user(data: CreateUserInput) -> User`
|
|
54
57
|
- `delete_user(user_id: str) -> None`
|
|
@@ -57,7 +60,8 @@ Represent API surfaces using the conventions of the project's primary language:
|
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
**Go:**
|
|
60
|
-
|
|
63
|
+
|
|
64
|
+
```text
|
|
61
65
|
- API Surface:
|
|
62
66
|
- `func CreateUser(data CreateUserInput) (*User, error)`
|
|
63
67
|
- `func DeleteUser(id string) error`
|
|
@@ -66,7 +70,8 @@ Represent API surfaces using the conventions of the project's primary language:
|
|
|
66
70
|
```
|
|
67
71
|
|
|
68
72
|
**Rust:**
|
|
69
|
-
|
|
73
|
+
|
|
74
|
+
```text
|
|
70
75
|
- API Surface:
|
|
71
76
|
- `pub fn create_user(data: CreateUserInput) -> Result<User, Error>`
|
|
72
77
|
- `pub fn delete_user(id: &str) -> Result<(), Error>`
|
|
@@ -79,6 +84,7 @@ Use the project's primary language from `draft/tech-stack.md`. Include function
|
|
|
79
84
|
### Ingredients
|
|
80
85
|
|
|
81
86
|
Each module typically contains some combination of:
|
|
87
|
+
|
|
82
88
|
- **API** - Public interface exposed to other modules
|
|
83
89
|
- **Control Flow** - Core logic and decision paths
|
|
84
90
|
- **Execution State** - Intermediate data structures used during processing
|
|
@@ -97,7 +103,7 @@ Each module typically contains some combination of:
|
|
|
97
103
|
|
|
98
104
|
### Dependency Diagram Format
|
|
99
105
|
|
|
100
|
-
```
|
|
106
|
+
```json
|
|
101
107
|
[auth] ──> [database]
|
|
102
108
|
│ │
|
|
103
109
|
└──> [config] <──┘
|
|
@@ -128,18 +134,21 @@ When modules form a circular dependency (A → B → A), apply this decision pro
|
|
|
128
134
|
**Example:**
|
|
129
135
|
|
|
130
136
|
Before (cycle):
|
|
131
|
-
|
|
137
|
+
|
|
138
|
+
```json
|
|
132
139
|
[user-service] ──> [notification-service]
|
|
133
140
|
↑ │
|
|
134
141
|
└────────────────────┘
|
|
135
142
|
```
|
|
143
|
+
|
|
136
144
|
`user-service` imports `sendNotification` from `notification-service`.
|
|
137
145
|
`notification-service` imports `getUserPreferences` from `user-service`.
|
|
138
146
|
|
|
139
147
|
Analysis: Both modules need user preference data. Extract it.
|
|
140
148
|
|
|
141
149
|
After (resolved):
|
|
142
|
-
|
|
150
|
+
|
|
151
|
+
```json
|
|
143
152
|
[user-preferences] (new - extracted shared concern)
|
|
144
153
|
↑ ↑
|
|
145
154
|
│ │
|
|
@@ -149,6 +158,7 @@ After (resolved):
|
|
|
149
158
|
```
|
|
150
159
|
|
|
151
160
|
New module `user-preferences`:
|
|
161
|
+
|
|
152
162
|
- **Responsibility:** Owns user notification/display preference data and access
|
|
153
163
|
- **API Surface:** `getUserPreferences(userId): Preferences`
|
|
154
164
|
- **Files:** `user-preferences.ts`, `user-preferences.test.ts`
|
|
@@ -178,6 +188,7 @@ Stories flow through three stages:
|
|
|
178
188
|
1. **Placeholder** — During `/draft:decompose`, each module in `.ai-context.md` (or track-level `architecture.md`) gets a Story field set to `[placeholder - filled during /draft:implement]`. This signals that the module exists but its algorithm hasn't been documented yet.
|
|
179
189
|
|
|
180
190
|
2. **Written** — During `/draft:implement` (with architecture mode), before coding each module's first file, write the Story as a code comment at the top of the file. Present it to the developer for approval. Once approved, update the module's Story field in `.ai-context.md` (or `architecture.md`) with a one-line summary referencing the file:
|
|
191
|
+
|
|
181
192
|
```markdown
|
|
182
193
|
- **Story:** Documented in `src/auth.ts:1-12` — validates token, resolves user, checks permissions
|
|
183
194
|
```
|
|
@@ -188,7 +199,7 @@ Stories flow through three stages:
|
|
|
188
199
|
|
|
189
200
|
### Story Format
|
|
190
201
|
|
|
191
|
-
```
|
|
202
|
+
```text
|
|
192
203
|
// Story: [Module/File Name]
|
|
193
204
|
//
|
|
194
205
|
// Input: [what this module/function receives]
|
|
@@ -238,7 +249,7 @@ Define the intermediate state variables your code will use during processing. Th
|
|
|
238
249
|
|
|
239
250
|
### Execution State Format
|
|
240
251
|
|
|
241
|
-
```
|
|
252
|
+
```text
|
|
242
253
|
## Execution State: [Module Name]
|
|
243
254
|
|
|
244
255
|
### Input State
|
|
@@ -332,6 +343,7 @@ function validateEntries(
|
|
|
332
343
|
### Escalation
|
|
333
344
|
|
|
334
345
|
If module boundaries are unclear after analysis:
|
|
346
|
+
|
|
335
347
|
1. Document what you know
|
|
336
348
|
2. List the ambiguous boundaries
|
|
337
349
|
3. Ask developer to clarify responsibility ownership
|
package/core/agents/debugger.md
CHANGED
|
@@ -29,6 +29,7 @@ Before investigating, follow the context loading procedure in `core/shared/draft
|
|
|
29
29
|
4. **Document findings** - Write down what you observe
|
|
30
30
|
|
|
31
31
|
**Red Flags - STOP if you're:**
|
|
32
|
+
|
|
32
33
|
- Tempted to make a "quick fix"
|
|
33
34
|
- Guessing at the cause
|
|
34
35
|
- Changing code "to see what happens"
|
|
@@ -47,6 +48,7 @@ Before investigating, follow the context loading procedure in `core/shared/draft
|
|
|
47
48
|
4. **Narrow the scope** - What's the smallest change that breaks it?
|
|
48
49
|
|
|
49
50
|
**Questions to answer:**
|
|
51
|
+
|
|
50
52
|
- Is this a data problem or code problem?
|
|
51
53
|
- Is this a timing/race condition?
|
|
52
54
|
- Is this an environment difference?
|
|
@@ -81,6 +83,7 @@ Select techniques appropriate to the language and failure type. Not all techniqu
|
|
|
81
83
|
4. **Run the test** - Execute and compare to prediction
|
|
82
84
|
|
|
83
85
|
**If hypothesis is wrong:**
|
|
86
|
+
|
|
84
87
|
- Return to Phase 2
|
|
85
88
|
- Do NOT try another random fix
|
|
86
89
|
- Update your understanding
|
|
@@ -146,6 +149,7 @@ Do NOT guess at performance bottlenecks. Profile first.
|
|
|
146
149
|
5. **Re-profile** — confirm the hot path is resolved and no new bottleneck appeared
|
|
147
150
|
|
|
148
151
|
**Anti-patterns for performance debugging:**
|
|
152
|
+
|
|
149
153
|
- Optimizing without profiling data
|
|
150
154
|
- Optimizing code that isn't on the hot path
|
|
151
155
|
- Micro-optimizing when the bottleneck is I/O
|
|
@@ -167,6 +171,7 @@ Do NOT guess at performance bottlenecks. Profile first.
|
|
|
167
171
|
## When to Escalate
|
|
168
172
|
|
|
169
173
|
If after 3 hypothesis cycles you haven't found root cause:
|
|
174
|
+
|
|
170
175
|
1. Document all findings
|
|
171
176
|
2. List what you've eliminated
|
|
172
177
|
3. Ask for external input
|
package/core/agents/ops.md
CHANGED
|
@@ -37,6 +37,7 @@ You are an operations agent. When assessing production readiness, managing incid
|
|
|
37
37
|
## Operational Checklists
|
|
38
38
|
|
|
39
39
|
### Pre-Deploy Assessment
|
|
40
|
+
|
|
40
41
|
1. Rollback plan documented and tested?
|
|
41
42
|
2. Database migrations reversible?
|
|
42
43
|
3. Feature flags in place for new features?
|
|
@@ -46,6 +47,7 @@ You are an operations agent. When assessing production readiness, managing incid
|
|
|
46
47
|
7. On-call engineer aware and available?
|
|
47
48
|
|
|
48
49
|
### Incident Response Framework
|
|
50
|
+
|
|
49
51
|
1. **Detect** — Alert fires or user report received
|
|
50
52
|
2. **Triage** — Assess severity, assign incident commander
|
|
51
53
|
3. **Communicate** — Notify stakeholders, open war room (if SEV1/2)
|
|
@@ -57,6 +59,7 @@ You are an operations agent. When assessing production readiness, managing incid
|
|
|
57
59
|
### Rollback Decision Framework
|
|
58
60
|
|
|
59
61
|
Initiate rollback if ANY of these are true:
|
|
62
|
+
|
|
60
63
|
- Error rate exceeds 2x baseline
|
|
61
64
|
- p95 latency exceeds 3x baseline
|
|
62
65
|
- Data corruption detected
|
|
@@ -67,7 +70,8 @@ Initiate rollback if ANY of these are true:
|
|
|
67
70
|
## Communication Templates
|
|
68
71
|
|
|
69
72
|
### Stakeholder Update (During Incident)
|
|
70
|
-
|
|
73
|
+
|
|
74
|
+
```json
|
|
71
75
|
[SEV{N}] {Service Name} — {1-line summary}
|
|
72
76
|
Status: {Investigating | Mitigating | Monitoring | Resolved}
|
|
73
77
|
Impact: {user-facing impact description}
|
|
@@ -76,7 +80,8 @@ Next update: {time of next update}
|
|
|
76
80
|
```
|
|
77
81
|
|
|
78
82
|
### Post-Incident Summary
|
|
79
|
-
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
80
85
|
Incident: {title}
|
|
81
86
|
Duration: {start} → {end} ({total time})
|
|
82
87
|
Impact: {users affected, SLO impact}
|
package/core/agents/planner.md
CHANGED
|
@@ -50,12 +50,14 @@ Organize plans into phases:
|
|
|
50
50
|
## Task Granularity
|
|
51
51
|
|
|
52
52
|
Good task:
|
|
53
|
+
|
|
53
54
|
- Completable in a focused session
|
|
54
55
|
- Has clear success criteria
|
|
55
56
|
- Produces testable output
|
|
56
57
|
- Fits in single commit
|
|
57
58
|
|
|
58
59
|
Bad task:
|
|
60
|
+
|
|
59
61
|
- "Implement the feature"
|
|
60
62
|
- Multi-day scope
|
|
61
63
|
- Vague completion criteria
|
|
@@ -63,11 +65,13 @@ Bad task:
|
|
|
63
65
|
## Dependency Mapping
|
|
64
66
|
|
|
65
67
|
Identify:
|
|
68
|
+
|
|
66
69
|
- Which tasks must complete before others
|
|
67
70
|
- Parallel execution opportunities
|
|
68
71
|
- External blockers
|
|
69
72
|
|
|
70
73
|
Format in plan.md:
|
|
74
|
+
|
|
71
75
|
```markdown
|
|
72
76
|
- [ ] Task 2.1: Add validation
|
|
73
77
|
- Depends on: Task 1.1, Task 1.2
|
|
@@ -76,6 +80,7 @@ Format in plan.md:
|
|
|
76
80
|
## Risk Identification
|
|
77
81
|
|
|
78
82
|
Flag in spec.md:
|
|
83
|
+
|
|
79
84
|
- Technical unknowns
|
|
80
85
|
- External dependencies
|
|
81
86
|
- Performance concerns
|
|
@@ -128,6 +133,7 @@ Each criterion must be:
|
|
|
128
133
|
| **Complete** | Covers both success and failure paths | Include error scenarios |
|
|
129
134
|
|
|
130
135
|
**Anti-patterns:**
|
|
136
|
+
|
|
131
137
|
- "System works correctly" (too vague)
|
|
132
138
|
- "Code is clean" (subjective)
|
|
133
139
|
- "Performance is good" (not measurable — use "Response time < 200ms at p95")
|
|
@@ -152,6 +158,7 @@ When recommending technical approaches, cite sources from `core/knowledge-base.m
|
|
|
152
158
|
## Escalation
|
|
153
159
|
|
|
154
160
|
If requirements are ambiguous after analysis:
|
|
161
|
+
|
|
155
162
|
1. Document what is clear
|
|
156
163
|
2. List specific ambiguities with options
|
|
157
164
|
3. Present to developer with trade-off analysis
|