@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.
- package/.claude-plugin/marketplace.json +38 -0
- package/.claude-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +272 -0
- package/bin/README.md +49 -0
- package/cli/bin/draft.js +13 -0
- package/cli/src/cli.js +113 -0
- package/cli/src/hosts/claude-code.js +46 -0
- package/cli/src/hosts/codex.js +33 -0
- package/cli/src/hosts/cursor.js +50 -0
- package/cli/src/hosts/index.js +24 -0
- package/cli/src/hosts/opencode.js +39 -0
- package/cli/src/installer.js +61 -0
- package/cli/src/lib/fsx.js +34 -0
- package/cli/src/lib/graph.js +23 -0
- package/cli/src/lib/log.js +32 -0
- package/cli/src/lib/paths.js +14 -0
- package/core/agents/architect.md +338 -0
- package/core/agents/debugger.md +193 -0
- package/core/agents/ops.md +104 -0
- package/core/agents/planner.md +158 -0
- package/core/agents/rca.md +314 -0
- package/core/agents/reviewer.md +256 -0
- package/core/agents/writer.md +110 -0
- package/core/guardrails/README.md +4 -0
- package/core/guardrails/code-quality.md +4 -0
- package/core/guardrails/dependency-triage.md +4 -0
- package/core/guardrails/design-norms.md +4 -0
- package/core/guardrails/language-standards.md +4 -0
- package/core/guardrails/review-checks.md +4 -0
- package/core/guardrails/secure-patterns.md +4 -0
- package/core/guardrails/security.md +4 -0
- package/core/guardrails.md +22 -0
- package/core/knowledge-base.md +127 -0
- package/core/methodology.md +1221 -0
- package/core/shared/condensation.md +224 -0
- package/core/shared/context-verify.md +44 -0
- package/core/shared/cross-skill-dispatch.md +127 -0
- package/core/shared/discovery-schema.md +75 -0
- package/core/shared/draft-context-loading.md +282 -0
- package/core/shared/git-report-metadata.md +106 -0
- package/core/shared/graph-query.md +239 -0
- package/core/shared/graph-usage-report.md +22 -0
- package/core/shared/jira-sync.md +170 -0
- package/core/shared/parallel-analysis.md +386 -0
- package/core/shared/parallel-fanout.md +10 -0
- package/core/shared/pattern-learning.md +146 -0
- package/core/shared/red-flags.md +58 -0
- package/core/shared/template-contract.md +22 -0
- package/core/shared/template-hygiene.md +10 -0
- package/core/shared/tool-resolver.md +10 -0
- package/core/shared/vcs-commands.md +97 -0
- package/core/shared/verification-gates.md +47 -0
- package/core/templates/CHANGELOG.md +70 -0
- package/core/templates/ai-context-export.md +8 -0
- package/core/templates/ai-context.md +270 -0
- package/core/templates/ai-profile.md +41 -0
- package/core/templates/architecture.md +203 -0
- package/core/templates/dependency-graph.md +103 -0
- package/core/templates/discovery.md +79 -0
- package/core/templates/guardrails.md +143 -0
- package/core/templates/hld.md +327 -0
- package/core/templates/intake-questions.md +403 -0
- package/core/templates/jira.md +119 -0
- package/core/templates/lld.md +283 -0
- package/core/templates/metadata.json +66 -0
- package/core/templates/plan.md +130 -0
- package/core/templates/product.md +110 -0
- package/core/templates/rca.md +86 -0
- package/core/templates/root-architecture.md +127 -0
- package/core/templates/root-product.md +53 -0
- package/core/templates/root-tech-stack.md +117 -0
- package/core/templates/service-index.md +55 -0
- package/core/templates/session-summary.md +8 -0
- package/core/templates/spec.md +165 -0
- package/core/templates/tech-matrix.md +101 -0
- package/core/templates/tech-stack.md +169 -0
- package/core/templates/track-architecture.md +311 -0
- package/core/templates/workflow.md +187 -0
- package/integrations/agents/AGENTS.md +24384 -0
- package/integrations/copilot/.github/copilot-instructions.md +24384 -0
- package/integrations/gemini/.gemini.md +26 -0
- package/package.json +53 -0
- package/scripts/fetch-memory-engine.sh +116 -0
- package/scripts/lib.sh +256 -0
- package/scripts/tools/_lib.sh +220 -0
- package/scripts/tools/adr-index.sh +117 -0
- package/scripts/tools/check-graph-usage-report.sh +95 -0
- package/scripts/tools/check-scope-conflicts.sh +139 -0
- package/scripts/tools/check-skill-line-caps.sh +115 -0
- package/scripts/tools/check-template-noop.sh +87 -0
- package/scripts/tools/check-track-hygiene.sh +230 -0
- package/scripts/tools/classify-files.sh +231 -0
- package/scripts/tools/cycle-detect.sh +75 -0
- package/scripts/tools/detect-test-framework.sh +135 -0
- package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
- package/scripts/tools/emit-skill-metrics.sh +71 -0
- package/scripts/tools/fix-whitespace.sh +192 -0
- package/scripts/tools/freshness-check.sh +143 -0
- package/scripts/tools/git-metadata.sh +203 -0
- package/scripts/tools/graph-callers.sh +74 -0
- package/scripts/tools/graph-impact.sh +93 -0
- package/scripts/tools/graph-snapshot.sh +102 -0
- package/scripts/tools/hotspot-rank.sh +75 -0
- package/scripts/tools/manage-symlinks.sh +85 -0
- package/scripts/tools/mermaid-from-graph.sh +92 -0
- package/scripts/tools/migrate-track-frontmatter.sh +241 -0
- package/scripts/tools/parse-git-log.sh +135 -0
- package/scripts/tools/parse-reports.sh +114 -0
- package/scripts/tools/render-track.sh +145 -0
- package/scripts/tools/run-coverage.sh +153 -0
- package/scripts/tools/scan-markers.sh +144 -0
- package/scripts/tools/skill-caps.conf +24 -0
- package/scripts/tools/validate-frontmatter.sh +125 -0
- package/scripts/tools/verify-citations.sh +250 -0
- package/scripts/tools/verify-doc-anchors.sh +204 -0
- package/scripts/tools/verify-graph-binary.sh +154 -0
- package/skills/GRAPH.md +332 -0
- package/skills/adr/SKILL.md +374 -0
- package/skills/assist-review/SKILL.md +49 -0
- package/skills/bughunt/SKILL.md +668 -0
- package/skills/bughunt/references/regression-tests.md +399 -0
- package/skills/change/SKILL.md +267 -0
- package/skills/coverage/SKILL.md +336 -0
- package/skills/debug/SKILL.md +201 -0
- package/skills/decompose/SKILL.md +656 -0
- package/skills/deep-review/SKILL.md +326 -0
- package/skills/deploy-checklist/SKILL.md +254 -0
- package/skills/discover/SKILL.md +66 -0
- package/skills/docs/SKILL.md +42 -0
- package/skills/documentation/SKILL.md +197 -0
- package/skills/draft/SKILL.md +177 -0
- package/skills/draft/context-files.md +57 -0
- package/skills/draft/intent-mapping.md +37 -0
- package/skills/draft/quality-guide.md +51 -0
- package/skills/graph/SKILL.md +107 -0
- package/skills/impact/SKILL.md +86 -0
- package/skills/implement/SKILL.md +794 -0
- package/skills/incident-response/SKILL.md +245 -0
- package/skills/index/SKILL.md +848 -0
- package/skills/init/SKILL.md +1784 -0
- package/skills/init/references/architecture-spec.md +1259 -0
- package/skills/integrations/SKILL.md +53 -0
- package/skills/jira/SKILL.md +577 -0
- package/skills/jira/references/review.md +1322 -0
- package/skills/learn/SKILL.md +478 -0
- package/skills/new-track/SKILL.md +841 -0
- package/skills/ops/SKILL.md +57 -0
- package/skills/plan/SKILL.md +60 -0
- package/skills/quick-review/SKILL.md +216 -0
- package/skills/revert/SKILL.md +178 -0
- package/skills/review/SKILL.md +1114 -0
- package/skills/standup/SKILL.md +183 -0
- package/skills/status/SKILL.md +183 -0
- package/skills/tech-debt/SKILL.md +318 -0
- package/skills/testing-strategy/SKILL.md +195 -0
- package/skills/tour/SKILL.md +38 -0
- 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.
|