@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,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ops
|
|
3
|
+
description: "Primary router for operations, deployment, incident, and lifecycle workflows. Analyzes intent and dispatches to deploy-checklist, incident-response, standup, status, revert. Use for pre-deploy verification, handling outages, daily summaries, progress checks, and safe rollbacks."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ops - Operations & Lifecycle Router
|
|
7
|
+
|
|
8
|
+
`/draft:ops` groups all operational, deployment, and runtime lifecycle commands.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Preparing a deployment or release
|
|
13
|
+
- Responding to incidents or outages
|
|
14
|
+
- Generating team standup / activity summaries
|
|
15
|
+
- Checking overall project or track status
|
|
16
|
+
- Performing git-aware reverts or rollbacks
|
|
17
|
+
|
|
18
|
+
## Routing Logic
|
|
19
|
+
|
|
20
|
+
Intent keywords drive deterministic dispatch. Multi-intent requests are sequenced (e.g., status then incident).
|
|
21
|
+
|
|
22
|
+
| User Intent Keywords | Dispatches To | Purpose |
|
|
23
|
+
|------------------------------------------|----------------------------|---------|
|
|
24
|
+
| upload for review, git upload, submit code, open PR | `/draft:upload` | Pre-upload gate: review, approvals, validators, then push |
|
|
25
|
+
| deploy checklist, pre-deploy, release check, readiness | `/draft:deploy-checklist` | Pre-deployment verification with rollback triggers |
|
|
26
|
+
| incident, outage, sev, postmortem, triage | `/draft:incident-response` | Full incident lifecycle (triage → mitigate → postmortem) |
|
|
27
|
+
| standup, daily summary, what did I do, activity report | `/draft:standup` | Git activity standup summary (read-only) |
|
|
28
|
+
| status, progress, what's the state, track overview | `/draft:status` | Progress overview across tracks and git |
|
|
29
|
+
| revert, rollback, undo, git revert, restore | `/draft:revert` | Git-aware safe rollback of changes or tracks |
|
|
30
|
+
|
|
31
|
+
## Dispatch Examples
|
|
32
|
+
|
|
33
|
+
User: "run the deploy checklist for the auth track"
|
|
34
|
+
|
|
35
|
+
→ dispatches to `/draft:deploy-checklist [track auth]`
|
|
36
|
+
|
|
37
|
+
User: "we had an outage last night, start postmortem"
|
|
38
|
+
|
|
39
|
+
→ dispatches to `/draft:incident-response postmortem`
|
|
40
|
+
|
|
41
|
+
User: "give me today's standup"
|
|
42
|
+
|
|
43
|
+
→ dispatches to `/draft:standup`
|
|
44
|
+
|
|
45
|
+
User: "what's the current status of the project"
|
|
46
|
+
|
|
47
|
+
→ dispatches to `/draft:status`
|
|
48
|
+
|
|
49
|
+
User: "revert the last two commits on this branch safely"
|
|
50
|
+
|
|
51
|
+
→ dispatches to `/draft:revert`
|
|
52
|
+
|
|
53
|
+
## Integration Notes
|
|
54
|
+
|
|
55
|
+
Ops commands often read `draft/tracks.md`, `draft/*/plan.md`, and git metadata. They feed forward into documentation and jira flows when needed.
|
|
56
|
+
|
|
57
|
+
Direct invocation of the leaf skills continues to work for power users and scripts during the deprecation window.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan
|
|
3
|
+
description: "Primary router for planning, architecture, and track management workflows. Analyzes user intent and dispatches to new-track, decompose, adr, tech-debt, change (and related). Use for starting features, breaking down work, recording decisions, managing debt, or handling scope changes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Plan - Planning & Architecture Router
|
|
7
|
+
|
|
8
|
+
`/draft:plan` is the consolidated entry point for all planning and upfront architecture work in the Context-Driven Development lifecycle.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Starting a new feature, bug fix, or refactor track
|
|
13
|
+
- Decomposing large modules or changes into dependency-aware units
|
|
14
|
+
- Recording Architecture Decision Records (ADRs)
|
|
15
|
+
- Cataloging and prioritizing technical debt
|
|
16
|
+
- Handling mid-track requirement or scope changes
|
|
17
|
+
|
|
18
|
+
## Routing Logic
|
|
19
|
+
|
|
20
|
+
The router parses intent from natural language and dispatches to the correct leaf skill. Ambiguous requests surface a short menu of options.
|
|
21
|
+
|
|
22
|
+
| User Intent Keywords | Dispatches To | Purpose |
|
|
23
|
+
|---------------------------------------|-----------------------|---------|
|
|
24
|
+
| new feature, new track, start X, add Y, plan a refactor, fix the Z bug | `/draft:new-track` | Collaborative spec + plan creation for track |
|
|
25
|
+
| decompose, break into modules, dependency map | `/draft:decompose` | Module decomposition + graph |
|
|
26
|
+
| adr, architecture decision, record decision, design decision | `/draft:adr` | ADR authoring and evaluation |
|
|
27
|
+
| tech debt, technical debt, catalog debt, debt analysis | `/draft:tech-debt` | 6-dimension debt scan + prioritization |
|
|
28
|
+
| change, scope changed, requirements changed, update spec, mid-track pivot | `/draft:change` | Structured change impact & plan update |
|
|
29
|
+
|
|
30
|
+
## Dispatch Examples
|
|
31
|
+
|
|
32
|
+
User: "start a new feature for user profile editing"
|
|
33
|
+
|
|
34
|
+
→ dispatches to `/draft:new-track "user profile editing"`
|
|
35
|
+
|
|
36
|
+
User: "decompose the payment module"
|
|
37
|
+
|
|
38
|
+
→ dispatches to `/draft:decompose "payment module"`
|
|
39
|
+
|
|
40
|
+
User: "document our decision to use event sourcing"
|
|
41
|
+
|
|
42
|
+
→ dispatches to `/draft:adr "Use event sourcing for order processing"`
|
|
43
|
+
|
|
44
|
+
User: "find and prioritize our technical debt"
|
|
45
|
+
|
|
46
|
+
→ dispatches to `/draft:tech-debt`
|
|
47
|
+
|
|
48
|
+
User: "the requirements changed, we need to support multi-tenancy now"
|
|
49
|
+
|
|
50
|
+
→ dispatches to `/draft:change "add multi-tenancy support"`
|
|
51
|
+
|
|
52
|
+
## Relationship to Primary Workflow
|
|
53
|
+
|
|
54
|
+
`/draft:plan` augments but does not replace the core `/draft:new-track` and `/draft:implement` flow. Many planning activities are launched via `/draft:plan` for discoverability, then flow into the primary track lifecycle.
|
|
55
|
+
|
|
56
|
+
Direct leaf commands remain available during the transition period (see MIGRATION).
|
|
57
|
+
|
|
58
|
+
## Quality Gate
|
|
59
|
+
|
|
60
|
+
All planning dispatches should result in updated `draft/tracks/<id>/spec.md` or `plan.md` (or new ADR/debt artifacts) with proper metadata headers and citations back to product/tech-stack context.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quick-review
|
|
3
|
+
description: Ad-hoc PR/diff/file review. No track context needed. Four dimensions — security, performance, correctness, maintainability. Use for one-off reviews when you don't have or don't need a Draft track.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Quick Review
|
|
7
|
+
|
|
8
|
+
You are performing a lightweight, ad-hoc code review. This is the fast alternative to `/draft:review` — no track context needed, focused on a specific PR, diff, or file set.
|
|
9
|
+
|
|
10
|
+
## MANDATORY GRAPH LOOKUP (read before dimension review)
|
|
11
|
+
|
|
12
|
+
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Quick-review keeps the graph load light:
|
|
13
|
+
|
|
14
|
+
1. Always check `draft/graph/hotspots.jsonl` for every changed file (Step 2 blast-radius pre-check below).
|
|
15
|
+
2. If a finding spans more than one file, run `scripts/tools/graph-callers.sh --repo . --symbol <name>` to enumerate the call sites before claiming "no other usages".
|
|
16
|
+
|
|
17
|
+
Filesystem `grep` is reserved for source-text scans (literal strings, regex patterns). Symbol and caller discovery go through the graph.
|
|
18
|
+
|
|
19
|
+
## Red Flags — STOP if you're:
|
|
20
|
+
|
|
21
|
+
See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
|
|
22
|
+
|
|
23
|
+
Skill-specific:
|
|
24
|
+
- Reviewing without reading the code first
|
|
25
|
+
- Providing generic feedback not grounded in the actual code
|
|
26
|
+
- Missing security implications in authentication/authorization code
|
|
27
|
+
- Ignoring error handling paths
|
|
28
|
+
- Reviewing a whole module when asked for a specific file
|
|
29
|
+
|
|
30
|
+
**Read the code. Ground every finding in a specific line.**
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Pre-Check
|
|
35
|
+
|
|
36
|
+
### 0. Capture Git Context
|
|
37
|
+
|
|
38
|
+
Before starting, capture the current git state:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git branch --show-current # Current branch name
|
|
42
|
+
git rev-parse --short HEAD # Current commit hash
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Store this for the review report header. The review is scoped to this specific branch/commit.
|
|
46
|
+
|
|
47
|
+
### 1. Load Draft Context (if available)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ls draft/ 2>/dev/null
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If `draft/` exists, read and follow `core/shared/draft-context-loading.md`. This enriches review with project patterns, guardrails, and accepted patterns from `tech-stack.md`. Layer 0.5 of that procedure includes loading the relevant `core/guardrails/language-standards.md` section for the project stack — apply those standards in Dimension 4 (Maintainability) and Dimension 3 (Correctness) for language-specific patterns.
|
|
54
|
+
|
|
55
|
+
If no draft context, proceed with generic review — still valuable.
|
|
56
|
+
|
|
57
|
+
## Step 1: Parse Arguments
|
|
58
|
+
|
|
59
|
+
Check for arguments:
|
|
60
|
+
- `/draft:quick-review` — Review staged changes (`git diff --cached`) or current branch diff
|
|
61
|
+
- `/draft:quick-review <file>` — Review specific file(s)
|
|
62
|
+
- `/draft:quick-review <PR-URL>` — Review a pull request (via GitHub/GitHub MCP)
|
|
63
|
+
- `/draft:quick-review <commit-range>` — Review specific commits
|
|
64
|
+
|
|
65
|
+
Determine the diff to review:
|
|
66
|
+
1. If PR URL: fetch via GitHub MCP (`get_change_detail`, `get_change_diff`) or GitHub
|
|
67
|
+
2. If file path: read the file(s)
|
|
68
|
+
3. If commit range: `git diff <range>`
|
|
69
|
+
4. Default: `git diff HEAD~1..HEAD` (last commit)
|
|
70
|
+
|
|
71
|
+
## Step 2: Blast Radius Pre-check (if `draft/graph/hotspots.jsonl` exists)
|
|
72
|
+
|
|
73
|
+
Before the four-dimension review, check if any files in scope appear in `draft/graph/hotspots.jsonl`. If any file has a `fanIn` in the top 20% of the list, add this warning at the top of the review report:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
⚠ HIGH IMPACT: {file} is a high-fanIn hotspot (fanIn={N}). Changes here propagate to many callers — review with extra care.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If no hotspot data exists or no file matches, skip silently.
|
|
80
|
+
|
|
81
|
+
## Step 3: Four-Dimension Review
|
|
82
|
+
|
|
83
|
+
Review the code across four dimensions. For each finding, cite the specific `file:line`.
|
|
84
|
+
|
|
85
|
+
### Dimension 1: Security
|
|
86
|
+
|
|
87
|
+
Load `core/guardrails/security.md` before this dimension. Apply the **5-step security reasoning chain** (identify goal → check hard red lines SEC-01…SEC-10 → assess blast radius → trace generative paths → classify). Any hard red line violation is automatically **Critical**.
|
|
88
|
+
|
|
89
|
+
If a violation has a `// SECURITY-OVERRIDE: <ticket> <justification>` annotation, downgrade to **Important** and include the ticket in the finding.
|
|
90
|
+
|
|
91
|
+
- Authentication/authorization gaps `[RC-005, SEC-10]`
|
|
92
|
+
- Input validation and sanitization `[RC-003]`
|
|
93
|
+
- SQL injection, XSS, CSRF vulnerabilities `[RC-002, RC-011, SEC-03]`
|
|
94
|
+
- Secrets or credentials in code `[RC-001, SEC-01]`
|
|
95
|
+
- Disabled TLS or certificate verification `[SEC-04]`
|
|
96
|
+
- Shell injection or unsafe subprocess calls `[SEC-06]`
|
|
97
|
+
- PII or credentials in log output `[RC-006, SEC-05]`
|
|
98
|
+
- OWASP Top 10 patterns
|
|
99
|
+
- Insecure deserialization
|
|
100
|
+
|
|
101
|
+
### Dimension 2: Performance
|
|
102
|
+
|
|
103
|
+
- N+1 query patterns
|
|
104
|
+
- Missing indexes for frequent queries
|
|
105
|
+
- Unnecessary allocations in hot paths
|
|
106
|
+
- Missing caching opportunities
|
|
107
|
+
- Unbounded loops or recursion
|
|
108
|
+
- Large payload serialization
|
|
109
|
+
|
|
110
|
+
### Dimension 3: Correctness
|
|
111
|
+
|
|
112
|
+
- Logic errors, off-by-one, null handling
|
|
113
|
+
- Race conditions in concurrent code
|
|
114
|
+
- Error handling gaps (uncaught exceptions, missing error paths)
|
|
115
|
+
- Edge cases not covered
|
|
116
|
+
- State management issues
|
|
117
|
+
- Contract violations (API, type, invariant)
|
|
118
|
+
|
|
119
|
+
### Dimension 4: Maintainability
|
|
120
|
+
|
|
121
|
+
- Code clarity and naming
|
|
122
|
+
- DRY violations (repeated logic)
|
|
123
|
+
- Dead code or unreachable paths
|
|
124
|
+
- Missing or misleading comments
|
|
125
|
+
- Test coverage for new logic
|
|
126
|
+
- Consistency with project patterns (from tech-stack.md if available)
|
|
127
|
+
|
|
128
|
+
## Step 4: Classify Findings
|
|
129
|
+
|
|
130
|
+
Classify each finding:
|
|
131
|
+
|
|
132
|
+
| Severity | Action | Description |
|
|
133
|
+
|----------|--------|-------------|
|
|
134
|
+
| Critical | Must fix before merge | Security vulnerabilities, data corruption risks, crashes |
|
|
135
|
+
| Important | Should fix | Performance issues, logic bugs, error handling gaps |
|
|
136
|
+
| Suggestion | Nice to have | Style improvements, refactoring opportunities, documentation |
|
|
137
|
+
|
|
138
|
+
## Step 5: Generate Review Report
|
|
139
|
+
|
|
140
|
+
Present findings organized by severity:
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
## Quick Review: {scope description}
|
|
144
|
+
|
|
145
|
+
**Reviewer:** Draft Quick Review
|
|
146
|
+
**Scope:** {files/PR/commits reviewed}
|
|
147
|
+
**Date:** {ISO_TIMESTAMP}
|
|
148
|
+
|
|
149
|
+
### Summary
|
|
150
|
+
- Critical: {count}
|
|
151
|
+
- Important: {count}
|
|
152
|
+
- Suggestion: {count}
|
|
153
|
+
|
|
154
|
+
### Verdict: {PASS | PASS WITH NOTES | NEEDS CHANGES}
|
|
155
|
+
|
|
156
|
+
### Findings
|
|
157
|
+
|
|
158
|
+
#### Critical
|
|
159
|
+
1. **[finding title]** — `file:line`
|
|
160
|
+
[description and recommendation]
|
|
161
|
+
|
|
162
|
+
#### Important
|
|
163
|
+
...
|
|
164
|
+
|
|
165
|
+
#### Suggestion
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
### What Went Well
|
|
169
|
+
[2-3 positive observations about the code — good patterns, clean logic, thorough error handling]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**If track-scoped, save to `draft/tracks/<id>/quick-review-<timestamp>.md`.**
|
|
173
|
+
|
|
174
|
+
Also check `core/guardrails/dependency-triage.md` if the diff modifies a dependency manifest file.
|
|
175
|
+
|
|
176
|
+
**MANDATORY: Include YAML frontmatter with git metadata when saving.** Follow `core/shared/git-report-metadata.md`.
|
|
177
|
+
|
|
178
|
+
Include the report header table immediately after frontmatter:
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
| Field | Value |
|
|
182
|
+
|-------|-------|
|
|
183
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
184
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
185
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
186
|
+
| **Synced To** | `{FULL_SHA}` |
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Mandatory Self-Check (before review report)
|
|
190
|
+
|
|
191
|
+
Before printing the review report, internally verify and report:
|
|
192
|
+
|
|
193
|
+
1. **Graph files queried** — JSONL files loaded plus any live graph query-tool invocations.
|
|
194
|
+
2. **Layer 1 files deliberately skipped** — list any context sections skipped.
|
|
195
|
+
3. **Filesystem grep fallback justification** — for every `grep`/`find` run, state the concept it searched for.
|
|
196
|
+
|
|
197
|
+
If `draft/graph/schema.yaml` does not exist, set `Graph files queried: NONE` and use justification `graph data unavailable`.
|
|
198
|
+
|
|
199
|
+
## Graph Usage Report (append to review report)
|
|
200
|
+
|
|
201
|
+
Emit the canonical footer from [core/shared/graph-usage-report.md](../../core/shared/graph-usage-report.md) §Canonical footer. The lint hook `scripts/tools/check-graph-usage-report.sh` validates the section on save.
|
|
202
|
+
## Cross-Skill Dispatch
|
|
203
|
+
|
|
204
|
+
- **Offered by:** `/draft:implement` at phase boundaries as lightweight alternative to full review
|
|
205
|
+
- **Escalates to:** `/draft:review` if critical findings require deeper analysis
|
|
206
|
+
- **Feeds into:** `/draft:learn` (findings update guardrails via pattern learning)
|
|
207
|
+
- **Suggests at completion:**
|
|
208
|
+
- If many findings: "Consider running `/draft:review` for full three-stage analysis"
|
|
209
|
+
- If security findings: "Consider running `/draft:deep-review` for security audit"
|
|
210
|
+
- **Jira sync:** If ticket linked, attach review and post summary via `core/shared/jira-sync.md`
|
|
211
|
+
|
|
212
|
+
## Error Handling
|
|
213
|
+
|
|
214
|
+
**If no diff/file found:** "No changes to review. Specify a file, PR URL, or commit range."
|
|
215
|
+
**If MCP unavailable for PR:** Fall back to local git diff. "GitHub/GitHub MCP unavailable. Reviewing local diff instead."
|
|
216
|
+
**If no draft context:** Proceed with generic review patterns. Note: "Review enriched when draft context is available (run `/draft:init`)."
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: revert
|
|
3
|
+
description: "Git-aware revert that understands Draft tracks, phases, and tasks. Safely undo work at task, phase, or track level. Use when the user asks to 'revert this track', 'undo a phase', 'revert task X', or says 'roll back the last task', 'undo this work'."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draft Revert
|
|
7
|
+
|
|
8
|
+
Perform intelligent git revert that understands Draft's logical units of work.
|
|
9
|
+
|
|
10
|
+
## Red Flags - STOP if you're:
|
|
11
|
+
|
|
12
|
+
- Reverting without showing preview first
|
|
13
|
+
- Skipping user confirmation
|
|
14
|
+
- Not checking for uncommitted changes first
|
|
15
|
+
- Reverting more than requested
|
|
16
|
+
- Not updating Draft state after git revert
|
|
17
|
+
- Assuming you know which commits to revert without checking
|
|
18
|
+
|
|
19
|
+
**Preview and confirm before any destructive action.**
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Step 0: Pre-flight Check
|
|
24
|
+
|
|
25
|
+
1. **Verify Draft context exists:**
|
|
26
|
+
```bash
|
|
27
|
+
ls draft/tracks.md 2>/dev/null
|
|
28
|
+
```
|
|
29
|
+
If `draft/` does not exist: **STOP** — "No Draft context found. Run `/draft:init` first."
|
|
30
|
+
|
|
31
|
+
2. **Check working tree:**
|
|
32
|
+
Run `git status --porcelain`. If output is non-empty, warn the user about uncommitted changes and suggest stashing or committing first. Do NOT proceed until working tree is clean.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 1: Analyze What to Revert
|
|
37
|
+
|
|
38
|
+
Ask user what level to revert:
|
|
39
|
+
|
|
40
|
+
1. **Task** - Revert a single task's commits
|
|
41
|
+
2. **Phase** - Revert all commits in a phase
|
|
42
|
+
3. **Track** - Revert entire track's commits
|
|
43
|
+
|
|
44
|
+
If user specifies by name/description, find the matching commits.
|
|
45
|
+
|
|
46
|
+
## Step 2: Find Related Commits
|
|
47
|
+
|
|
48
|
+
**Primary method:** Read `plan.md` — every completed task has its commit SHA recorded inline. Use these SHAs directly.
|
|
49
|
+
|
|
50
|
+
**If no commits found** (all tasks are `[ ]` Pending with no SHAs): announce "No commits found for this scope — nothing to revert." and **STOP**.
|
|
51
|
+
|
|
52
|
+
**Fallback method (if SHAs missing but completed tasks exist):** Search git log by track ID pattern:
|
|
53
|
+
|
|
54
|
+
For Draft-managed work, commits follow pattern:
|
|
55
|
+
- `feat(<track_id>): <description>`
|
|
56
|
+
- `fix(<track_id>): <description>`
|
|
57
|
+
- `test(<track_id>): <description>`
|
|
58
|
+
- `refactor(<track_id>): <description>`
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Find commits for a track
|
|
62
|
+
git log --oneline --grep="<track_id>"
|
|
63
|
+
|
|
64
|
+
# Find commits in date range (for phase)
|
|
65
|
+
git log --oneline --since="<phase_start>" --until="<phase_end>" --grep="<track_id>"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Cross-reference:** Verify SHAs from `plan.md` match the git log results. Git log is always authoritative for commit identification. plan.md is authoritative for task-to-commit mapping. On SHA mismatch, prefer git log and warn the user.
|
|
69
|
+
|
|
70
|
+
## Step 3: Preview Revert
|
|
71
|
+
|
|
72
|
+
Show user what will be reverted:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
═══════════════════════════════════════════════════════════
|
|
76
|
+
REVERT PREVIEW
|
|
77
|
+
═══════════════════════════════════════════════════════════
|
|
78
|
+
|
|
79
|
+
Reverting: [Task/Phase/Track] "[name]"
|
|
80
|
+
|
|
81
|
+
Commits to revert (newest first):
|
|
82
|
+
abc1234 feat(add-auth): Add JWT validation
|
|
83
|
+
def5678 feat(add-auth): Create auth middleware
|
|
84
|
+
ghi9012 test(add-auth): Add auth middleware tests
|
|
85
|
+
|
|
86
|
+
Files affected:
|
|
87
|
+
src/auth/middleware.ts
|
|
88
|
+
src/auth/jwt.ts
|
|
89
|
+
tests/auth/middleware.test.ts
|
|
90
|
+
|
|
91
|
+
Plan.md changes:
|
|
92
|
+
Task 2.1: [x] (abc1234) → [ ]
|
|
93
|
+
Task 2.2: [x] (def5678) → [ ]
|
|
94
|
+
|
|
95
|
+
═══════════════════════════════════════════════════════════
|
|
96
|
+
Proceed with revert? (yes/no)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Step 4: Execute Revert
|
|
100
|
+
|
|
101
|
+
If confirmed:
|
|
102
|
+
|
|
103
|
+
Maintain a list of successfully reverted commits during execution.
|
|
104
|
+
|
|
105
|
+
Read `draft/workflow.md` → `## Toolchain` section for VCS CLI. See `core/shared/vcs-commands.md` for the full command mapping.
|
|
106
|
+
|
|
107
|
+
**git mode:**
|
|
108
|
+
```bash
|
|
109
|
+
# Revert each commit in reverse order (newest first)
|
|
110
|
+
git revert --no-commit <commit1>
|
|
111
|
+
git revert --no-commit <commit2>
|
|
112
|
+
# ... continue for all commits
|
|
113
|
+
|
|
114
|
+
# Create single revert commit
|
|
115
|
+
git commit -m "revert(<track_id>): Revert [task/phase description]"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
On conflict, report: "Successfully reverted: [list]. Conflict on: [sha]. Run `git revert --abort` to undo partial state."
|
|
119
|
+
|
|
120
|
+
## Step 5: Update Draft State
|
|
121
|
+
|
|
122
|
+
1. Update `plan.md`:
|
|
123
|
+
- Change reverted tasks from `[x]` to `[ ]`
|
|
124
|
+
- Remove the commit SHA from the reverted task line
|
|
125
|
+
- Add revert note
|
|
126
|
+
|
|
127
|
+
2. Update `metadata.json`:
|
|
128
|
+
- Decrement tasks.completed
|
|
129
|
+
- Decrement phases.completed if applicable
|
|
130
|
+
- Update timestamp
|
|
131
|
+
- **Note:** `metadata.json` only stores `phases.total` (int) and `phases.completed` (int). Decrement `phases.completed` if all tasks in a previously completed phase are reverted. Phase status markers (`[~]`, `[x]`, `[ ]`) are tracked in `plan.md` text, not in `metadata.json`. Update `plan.md` phase headings accordingly: if any task in a completed phase is reverted, mark that phase `[~]` In Progress in `plan.md`; if ALL tasks are reverted, mark it `[ ]` Pending in `plan.md`.
|
|
132
|
+
|
|
133
|
+
3. Update `draft/tracks.md` if track status changed
|
|
134
|
+
|
|
135
|
+
4. **Stale reports:** After revert, existing `review-report-latest.md` and `bughunt-report-latest.md` for the track are stale. Resolve symlink targets first: `readlink -f review-report-latest.md` and `readlink -f bughunt-report-latest.md`. Add a warning header to the symlink targets (the actual timestamped files): `> **WARNING: This report predates a revert operation and may be stale. Re-run the review/bughunt.**` Or delete them if the revert is substantial.
|
|
136
|
+
|
|
137
|
+
## Step 6: Confirm
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Revert complete
|
|
141
|
+
|
|
142
|
+
Reverted:
|
|
143
|
+
- [list of tasks/commits]
|
|
144
|
+
|
|
145
|
+
Updated:
|
|
146
|
+
- draft/tracks/<track_id>/plan.md
|
|
147
|
+
- draft/tracks/<track_id>/metadata.json
|
|
148
|
+
|
|
149
|
+
Git status:
|
|
150
|
+
- Created revert commit: [sha]
|
|
151
|
+
|
|
152
|
+
The reverted tasks are now available to re-implement.
|
|
153
|
+
Run /draft:implement to continue.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Recovery
|
|
157
|
+
|
|
158
|
+
If the process is interrupted between git revert and Draft state update, the recovery procedure is: check `git log` for the revert commit, then manually update plan.md task statuses to match the reverted state.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Abort Handling
|
|
163
|
+
|
|
164
|
+
If user says no to preview:
|
|
165
|
+
```
|
|
166
|
+
Revert cancelled. No changes made.
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
If git revert has conflicts:
|
|
170
|
+
```
|
|
171
|
+
Revert conflict detected in: [files]
|
|
172
|
+
|
|
173
|
+
Options:
|
|
174
|
+
1. Resolve conflicts manually, then run: git revert --continue
|
|
175
|
+
2. Abort revert: git revert --abort
|
|
176
|
+
|
|
177
|
+
Draft state NOT updated (pending revert completion).
|
|
178
|
+
```
|