@drafthq/draft 2.7.0

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.
Files changed (158) hide show
  1. package/.claude-plugin/marketplace.json +38 -0
  2. package/.claude-plugin/plugin.json +26 -0
  3. package/LICENSE +21 -0
  4. package/README.md +272 -0
  5. package/bin/README.md +49 -0
  6. package/cli/bin/draft.js +13 -0
  7. package/cli/src/cli.js +113 -0
  8. package/cli/src/hosts/claude-code.js +46 -0
  9. package/cli/src/hosts/codex.js +33 -0
  10. package/cli/src/hosts/cursor.js +50 -0
  11. package/cli/src/hosts/index.js +24 -0
  12. package/cli/src/hosts/opencode.js +39 -0
  13. package/cli/src/installer.js +61 -0
  14. package/cli/src/lib/fsx.js +34 -0
  15. package/cli/src/lib/graph.js +23 -0
  16. package/cli/src/lib/log.js +32 -0
  17. package/cli/src/lib/paths.js +14 -0
  18. package/core/agents/architect.md +338 -0
  19. package/core/agents/debugger.md +193 -0
  20. package/core/agents/ops.md +104 -0
  21. package/core/agents/planner.md +158 -0
  22. package/core/agents/rca.md +314 -0
  23. package/core/agents/reviewer.md +256 -0
  24. package/core/agents/writer.md +110 -0
  25. package/core/guardrails/README.md +4 -0
  26. package/core/guardrails/code-quality.md +4 -0
  27. package/core/guardrails/dependency-triage.md +4 -0
  28. package/core/guardrails/design-norms.md +4 -0
  29. package/core/guardrails/language-standards.md +4 -0
  30. package/core/guardrails/review-checks.md +4 -0
  31. package/core/guardrails/secure-patterns.md +4 -0
  32. package/core/guardrails/security.md +4 -0
  33. package/core/guardrails.md +22 -0
  34. package/core/knowledge-base.md +127 -0
  35. package/core/methodology.md +1221 -0
  36. package/core/shared/condensation.md +224 -0
  37. package/core/shared/context-verify.md +44 -0
  38. package/core/shared/cross-skill-dispatch.md +127 -0
  39. package/core/shared/discovery-schema.md +75 -0
  40. package/core/shared/draft-context-loading.md +282 -0
  41. package/core/shared/git-report-metadata.md +106 -0
  42. package/core/shared/graph-query.md +239 -0
  43. package/core/shared/graph-usage-report.md +22 -0
  44. package/core/shared/jira-sync.md +170 -0
  45. package/core/shared/parallel-analysis.md +386 -0
  46. package/core/shared/parallel-fanout.md +10 -0
  47. package/core/shared/pattern-learning.md +146 -0
  48. package/core/shared/red-flags.md +58 -0
  49. package/core/shared/template-contract.md +22 -0
  50. package/core/shared/template-hygiene.md +10 -0
  51. package/core/shared/tool-resolver.md +10 -0
  52. package/core/shared/vcs-commands.md +97 -0
  53. package/core/shared/verification-gates.md +47 -0
  54. package/core/templates/CHANGELOG.md +70 -0
  55. package/core/templates/ai-context-export.md +8 -0
  56. package/core/templates/ai-context.md +270 -0
  57. package/core/templates/ai-profile.md +41 -0
  58. package/core/templates/architecture.md +203 -0
  59. package/core/templates/dependency-graph.md +103 -0
  60. package/core/templates/discovery.md +79 -0
  61. package/core/templates/guardrails.md +143 -0
  62. package/core/templates/hld.md +327 -0
  63. package/core/templates/intake-questions.md +403 -0
  64. package/core/templates/jira.md +119 -0
  65. package/core/templates/lld.md +283 -0
  66. package/core/templates/metadata.json +66 -0
  67. package/core/templates/plan.md +130 -0
  68. package/core/templates/product.md +110 -0
  69. package/core/templates/rca.md +86 -0
  70. package/core/templates/root-architecture.md +127 -0
  71. package/core/templates/root-product.md +53 -0
  72. package/core/templates/root-tech-stack.md +117 -0
  73. package/core/templates/service-index.md +55 -0
  74. package/core/templates/session-summary.md +8 -0
  75. package/core/templates/spec.md +165 -0
  76. package/core/templates/tech-matrix.md +101 -0
  77. package/core/templates/tech-stack.md +169 -0
  78. package/core/templates/track-architecture.md +311 -0
  79. package/core/templates/workflow.md +187 -0
  80. package/integrations/agents/AGENTS.md +24384 -0
  81. package/integrations/copilot/.github/copilot-instructions.md +24384 -0
  82. package/integrations/gemini/.gemini.md +26 -0
  83. package/package.json +53 -0
  84. package/scripts/fetch-memory-engine.sh +116 -0
  85. package/scripts/lib.sh +256 -0
  86. package/scripts/tools/_lib.sh +220 -0
  87. package/scripts/tools/adr-index.sh +117 -0
  88. package/scripts/tools/check-graph-usage-report.sh +95 -0
  89. package/scripts/tools/check-scope-conflicts.sh +139 -0
  90. package/scripts/tools/check-skill-line-caps.sh +115 -0
  91. package/scripts/tools/check-template-noop.sh +87 -0
  92. package/scripts/tools/check-track-hygiene.sh +230 -0
  93. package/scripts/tools/classify-files.sh +231 -0
  94. package/scripts/tools/cycle-detect.sh +75 -0
  95. package/scripts/tools/detect-test-framework.sh +135 -0
  96. package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
  97. package/scripts/tools/emit-skill-metrics.sh +71 -0
  98. package/scripts/tools/fix-whitespace.sh +192 -0
  99. package/scripts/tools/freshness-check.sh +143 -0
  100. package/scripts/tools/git-metadata.sh +203 -0
  101. package/scripts/tools/graph-callers.sh +74 -0
  102. package/scripts/tools/graph-impact.sh +93 -0
  103. package/scripts/tools/graph-snapshot.sh +102 -0
  104. package/scripts/tools/hotspot-rank.sh +75 -0
  105. package/scripts/tools/manage-symlinks.sh +85 -0
  106. package/scripts/tools/mermaid-from-graph.sh +92 -0
  107. package/scripts/tools/migrate-track-frontmatter.sh +241 -0
  108. package/scripts/tools/parse-git-log.sh +135 -0
  109. package/scripts/tools/parse-reports.sh +114 -0
  110. package/scripts/tools/render-track.sh +145 -0
  111. package/scripts/tools/run-coverage.sh +153 -0
  112. package/scripts/tools/scan-markers.sh +144 -0
  113. package/scripts/tools/skill-caps.conf +24 -0
  114. package/scripts/tools/validate-frontmatter.sh +125 -0
  115. package/scripts/tools/verify-citations.sh +250 -0
  116. package/scripts/tools/verify-doc-anchors.sh +204 -0
  117. package/scripts/tools/verify-graph-binary.sh +154 -0
  118. package/skills/GRAPH.md +332 -0
  119. package/skills/adr/SKILL.md +374 -0
  120. package/skills/assist-review/SKILL.md +49 -0
  121. package/skills/bughunt/SKILL.md +668 -0
  122. package/skills/bughunt/references/regression-tests.md +399 -0
  123. package/skills/change/SKILL.md +267 -0
  124. package/skills/coverage/SKILL.md +336 -0
  125. package/skills/debug/SKILL.md +201 -0
  126. package/skills/decompose/SKILL.md +656 -0
  127. package/skills/deep-review/SKILL.md +326 -0
  128. package/skills/deploy-checklist/SKILL.md +254 -0
  129. package/skills/discover/SKILL.md +66 -0
  130. package/skills/docs/SKILL.md +42 -0
  131. package/skills/documentation/SKILL.md +197 -0
  132. package/skills/draft/SKILL.md +177 -0
  133. package/skills/draft/context-files.md +57 -0
  134. package/skills/draft/intent-mapping.md +37 -0
  135. package/skills/draft/quality-guide.md +51 -0
  136. package/skills/graph/SKILL.md +107 -0
  137. package/skills/impact/SKILL.md +86 -0
  138. package/skills/implement/SKILL.md +794 -0
  139. package/skills/incident-response/SKILL.md +245 -0
  140. package/skills/index/SKILL.md +848 -0
  141. package/skills/init/SKILL.md +1784 -0
  142. package/skills/init/references/architecture-spec.md +1259 -0
  143. package/skills/integrations/SKILL.md +53 -0
  144. package/skills/jira/SKILL.md +577 -0
  145. package/skills/jira/references/review.md +1322 -0
  146. package/skills/learn/SKILL.md +478 -0
  147. package/skills/new-track/SKILL.md +841 -0
  148. package/skills/ops/SKILL.md +57 -0
  149. package/skills/plan/SKILL.md +60 -0
  150. package/skills/quick-review/SKILL.md +216 -0
  151. package/skills/revert/SKILL.md +178 -0
  152. package/skills/review/SKILL.md +1114 -0
  153. package/skills/standup/SKILL.md +183 -0
  154. package/skills/status/SKILL.md +183 -0
  155. package/skills/tech-debt/SKILL.md +318 -0
  156. package/skills/testing-strategy/SKILL.md +195 -0
  157. package/skills/tour/SKILL.md +38 -0
  158. package/skills/upload/SKILL.md +117 -0
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: graph
3
+ description: Initialize or refresh the knowledge-graph snapshot for a repository. Ensures the codebase-memory-mcp engine is present (fetching it if needed), then builds draft/graph/ and reports engine, counts, hotspots, and cycles. Accepts an optional repo path.
4
+ ---
5
+
6
+ # Draft Graph
7
+
8
+ Initialize or refresh the `draft/graph/` knowledge-graph snapshot for a repository. This is the narrow "give me a fresh structural graph" command — it does **not** generate `architecture.md`/`.ai-context.md` (that is `/draft:init`) and does **not** re-inject doc diagram slots (that is `/draft:index`).
9
+
10
+ ## Red Flags - STOP if you're:
11
+
12
+ - Reporting counts without actually running `graph-snapshot.sh`
13
+ - Claiming the graph is built when the engine was unavailable
14
+ - Treating an engine-unavailable result as a hard failure (it degrades gracefully)
15
+ - Running against a path that isn't a directory
16
+
17
+ **Build, then report what the tools actually returned.**
18
+
19
+ ---
20
+
21
+ ## Step 1: Resolve the target repo
22
+
23
+ The command takes an optional path argument: `/draft:graph [path]`.
24
+
25
+ - No argument → use the current directory (`.`).
26
+ - With a path → use it as the repo root.
27
+
28
+ ```bash
29
+ REPO="${1:-.}"
30
+ if [ ! -d "$REPO" ]; then
31
+ echo "ERROR: '$REPO' is not a directory."
32
+ exit 1
33
+ fi
34
+ REPO_ABS="$(cd "$REPO" && pwd)"
35
+ echo "Target repo: $REPO_ABS"
36
+ ```
37
+
38
+ ## Step 2: Ensure the engine is present
39
+
40
+ Resolve the engine; if it is missing, fetch it once, then re-check. If it is still unavailable (e.g. offline, opted out via `DRAFT_MEMORY_DISABLE`), report and stop gracefully — graph features are optional everywhere in Draft.
41
+
42
+ ```bash
43
+ if ! scripts/tools/verify-graph-binary.sh --repo "$REPO_ABS" --json 2>/dev/null | grep -q '"status":"ok"'; then
44
+ echo "Graph engine not found — attempting to fetch it..."
45
+ scripts/fetch-memory-engine.sh || true
46
+ fi
47
+
48
+ ENGINE="$(scripts/tools/verify-graph-binary.sh --repo "$REPO_ABS" --json 2>/dev/null || true)"
49
+ if ! echo "$ENGINE" | grep -q '"status":"ok"'; then
50
+ echo "Graph engine unavailable — skipping. Install with scripts/fetch-memory-engine.sh, or unset DRAFT_MEMORY_DISABLE."
51
+ exit 0
52
+ fi
53
+ echo "Engine: $ENGINE"
54
+ ```
55
+
56
+ ## Step 3: Build / refresh the snapshot
57
+
58
+ One call resolves the engine, indexes the repo (incrementally on refresh), and writes the committed snapshot under `<repo>/draft/graph/` — `schema.yaml`, `architecture.json`, `hotspots.jsonl`, `module-deps.mermaid`, `proto-map.mermaid`.
59
+
60
+ ```bash
61
+ scripts/tools/graph-snapshot.sh --repo "$REPO_ABS"
62
+ ```
63
+
64
+ If this exits non-zero, the engine became unavailable mid-run — report it and stop; do not fabricate results.
65
+
66
+ ## Step 4: Report
67
+
68
+ Summarize what the snapshot contains. Read `draft/graph/schema.yaml` for engine/version/counts, and use the live tools for a quick health view:
69
+
70
+ ```bash
71
+ echo "--- Snapshot ---"
72
+ cat "$REPO_ABS/draft/graph/schema.yaml"
73
+
74
+ echo "--- Top hotspots ---"
75
+ scripts/tools/hotspot-rank.sh --repo "$REPO_ABS" --top 5
76
+
77
+ echo "--- Cycles ---"
78
+ scripts/tools/cycle-detect.sh --repo "$REPO_ABS"
79
+
80
+ echo "--- Snapshot state ---"
81
+ git -C "$REPO_ABS" rev-parse --short HEAD 2>/dev/null \
82
+ && { git -C "$REPO_ABS" diff --quiet 2>/dev/null || echo "(working tree dirty — snapshot reflects uncommitted changes)"; }
83
+ ```
84
+
85
+ Present a concise summary:
86
+
87
+ - **Engine**: version + resolution source (path / managed / bundled / override)
88
+ - **Graph**: node and edge counts (from `schema.yaml`)
89
+ - **Top hotspots**: the highest fan-in symbols
90
+ - **Cycles**: count, or `None ✓`
91
+ - **Freshness**: the commit the snapshot reflects, and whether the tree was dirty
92
+
93
+ Then point the user at the natural next steps:
94
+
95
+ - To re-inject the refreshed diagrams/hotspot tables into `architecture.md` / `.ai-context.md`: run `/draft:index`.
96
+ - For a first-time full context bootstrap (architecture + profiles): run `/draft:init`.
97
+
98
+ ## Graceful Degradation
99
+
100
+ | Scenario | Behavior |
101
+ |----------|----------|
102
+ | Engine resolvable | Build snapshot, report counts/hotspots/cycles |
103
+ | Engine missing, fetch succeeds | Build proceeds after fetch |
104
+ | Engine missing, fetch fails / `DRAFT_MEMORY_DISABLE=1` | Report unavailable and exit 0 — no error, no partial snapshot |
105
+ | Path not a directory | Exit 1 with a clear message |
106
+
107
+ See `core/shared/graph-query.md` and `bin/README.md` for the query contract and engine resolution.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: impact
3
+ description: Generate a project-wide impact report on Draft track delivery — pace, phase duration, completion rate, friction hotspots, ADR/guardrail/decomposition adoption — by parsing track metadata, git revert history, and phase timestamps. Use when measuring CDD effectiveness ("show project impact", "where are bottlenecks", "measure track delivery").
4
+ ---
5
+
6
+ # Draft Impact: Track Telemetry & Analytics
7
+
8
+ Generate a project-wide impact report measuring Context-Driven Development effectiveness across all tracks.
9
+
10
+ ## Red Flags - STOP if you're:
11
+ - Profiling code coverage instead of measuring track-level impact.
12
+ - Rewriting tracker logic when local state objects are available for inspection.
13
+ - Generating reports without reading existing track metadata first.
14
+
15
+ ---
16
+
17
+ ## Execution Constraints
18
+
19
+ 1. **Load Track State:**
20
+ - Read all `draft/tracks.md` entries.
21
+ - For each track, read `metadata.json` to extract: `created_at`, `updated`, `status`, phase counts, task counts, `scope_includes`, `scope_excludes`.
22
+ - If no tracks exist, report "No tracks found. Run `/draft:new-track` to create your first track."
23
+ - Run `scripts/tools/check-scope-conflicts.sh` to surface adjacent
24
+ tracks sharing scope tags — duplicate effort signals in impact
25
+ reporting. Schema:
26
+ [core/shared/template-contract.md](../../core/shared/template-contract.md).
27
+
28
+ 2. **Compute Metrics:**
29
+ - **Delivery Pace:** Average elapsed time from track creation to completion (planning → implementation → review).
30
+ - **Phase Duration:** Time spent in each phase (planning, implementation, review). Flag any phase exceeding 14 days without updates.
31
+ - **Completion Rate:** Ratio of completed tracks to total tracks.
32
+ - **Task Granularity:** Average tasks per track. Flag tracks with fewer than 3 tasks (under-decomposed) or more than 30 (over-decomposed).
33
+
34
+ 3. **Friction Detection:**
35
+ - Scan `git log` for revert commits associated with each track.
36
+ - High revert count (>2 per track) signals unclear specification boundaries.
37
+ - Flag tracks that moved backward (e.g., from implementation back to planning).
38
+
39
+ 4. **Architectural Impact:**
40
+ - Count ADRs created (`draft/adrs/`).
41
+ - Count guardrail entries added via `/draft:learn`.
42
+ - Count modules decomposed via `/draft:decompose`.
43
+
44
+ 5. **Report Output:**
45
+ Generate a Markdown report with sections shown below. The shape is fixed so reports diff cleanly across runs.
46
+
47
+ ```markdown
48
+ # Draft Impact Report — {YYYY-MM-DD}
49
+
50
+ ## Summary
51
+ - Total tracks: 12 (Completed: 7, In-progress: 3, Abandoned: 2)
52
+
53
+ ## Delivery Pace
54
+ - Average track duration: 8.4 days | Median: 6 days
55
+ - Phases exceeding 14d without update: <list track IDs or "none">
56
+
57
+ ## Friction Hotspots
58
+ | Track | Reverts | Stall (days) | Notes |
59
+ |---|---|---|---|
60
+ | track-042 | 3 | 9 | Reverted after review; spec scope unclear |
61
+
62
+ ## CDD Adoption
63
+ - ADRs: 4 | Guardrail entries: 11 | Decomposed modules: 6
64
+
65
+ ## Recommendations
66
+ - <one actionable suggestion per detected pattern>
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Report Closing: Next Actions (REQUIRED)
72
+
73
+ Every impact/telemetry report must end with a `## Next Actions` section listing the smallest set of follow-ups in execution order. Use this exact shape:
74
+
75
+ ```markdown
76
+ ## Next Actions
77
+
78
+ | # | Action | Owner | Blocker? | Skill / Command |
79
+ |---|---|---|---|---|
80
+ | 1 | <imperative one-liner> | <team-lead|TBD> | no | `/draft:<skill> <args>` or `n/a` |
81
+ ```
82
+
83
+ Rules:
84
+ - Impact reports are advisory — `Blocker? = no` is the default; mark `yes` only when a metric breach demands immediate process change.
85
+ - Suggest `/draft:tech-debt` for systemic friction, `/draft:adr` for methodology adjustments, `/draft:tour` for onboarding gaps.
86
+ - Cap at 7 actions.