@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,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
project: "{PROJECT_NAME}"
|
|
3
|
+
module: "root"
|
|
4
|
+
generated_by: "draft:init"
|
|
5
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Tech Stack
|
|
9
|
+
|
|
10
|
+
| Field | Value |
|
|
11
|
+
|-------|-------|
|
|
12
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
13
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
14
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
15
|
+
| **Synced To** | `{FULL_SHA}` |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Languages
|
|
20
|
+
|
|
21
|
+
| Language | Version | Purpose |
|
|
22
|
+
|----------|---------|---------|
|
|
23
|
+
| [Primary] | [Version] | Main application code |
|
|
24
|
+
| [Secondary] | [Version] | [Scripts/tooling/etc] |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Frameworks & Libraries
|
|
29
|
+
|
|
30
|
+
### Core
|
|
31
|
+
| Name | Version | Purpose |
|
|
32
|
+
|------|---------|---------|
|
|
33
|
+
| [Framework] | [Version] | [Purpose] |
|
|
34
|
+
| [Library] | [Version] | [Purpose] |
|
|
35
|
+
|
|
36
|
+
### Development
|
|
37
|
+
| Name | Version | Purpose |
|
|
38
|
+
|------|---------|---------|
|
|
39
|
+
| [Tool] | [Version] | [Purpose] |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Database
|
|
44
|
+
|
|
45
|
+
| Type | Technology | Purpose |
|
|
46
|
+
|------|------------|---------|
|
|
47
|
+
| Primary | [DB Name] | Main data storage |
|
|
48
|
+
| Cache | [Cache Name] | [If applicable] |
|
|
49
|
+
| Search | [Search Engine] | [If applicable] |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Testing
|
|
54
|
+
|
|
55
|
+
| Level | Framework | Coverage Target |
|
|
56
|
+
|-------|-----------|-----------------|
|
|
57
|
+
| Unit | [Framework] | [80%+] |
|
|
58
|
+
| Integration | [Framework] | [Key flows] |
|
|
59
|
+
| E2E | [Framework] | [Critical paths] |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Build & Deploy
|
|
64
|
+
|
|
65
|
+
### Build
|
|
66
|
+
- **Tool**: [Webpack/Vite/esbuild/etc]
|
|
67
|
+
- **Output**: [dist/build/etc]
|
|
68
|
+
|
|
69
|
+
### CI/CD
|
|
70
|
+
- **Platform**: [GitHub Actions/CircleCI/etc]
|
|
71
|
+
- **Triggers**: [on push, PR, etc]
|
|
72
|
+
|
|
73
|
+
### Deployment
|
|
74
|
+
- **Target**: [Vercel/AWS/GCP/etc]
|
|
75
|
+
- **Environments**: [dev, staging, prod]
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Code Patterns
|
|
80
|
+
|
|
81
|
+
### Architecture
|
|
82
|
+
- **Pattern**: [Clean Architecture/MVC/Hexagonal/etc]
|
|
83
|
+
- **Rationale**: [Why this pattern]
|
|
84
|
+
|
|
85
|
+
### State Management
|
|
86
|
+
- **Approach**: [Redux/Zustand/Context/etc]
|
|
87
|
+
- **Rationale**: [Why this approach]
|
|
88
|
+
|
|
89
|
+
### Error Handling
|
|
90
|
+
- **Strategy**: [Centralized/per-module/etc]
|
|
91
|
+
- **Logging**: [Tool/service]
|
|
92
|
+
|
|
93
|
+
### API Design
|
|
94
|
+
- **Style**: [REST/GraphQL/gRPC]
|
|
95
|
+
- **Conventions**: [Naming, versioning]
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Component Overview
|
|
100
|
+
|
|
101
|
+
```mermaid
|
|
102
|
+
graph TD
|
|
103
|
+
subgraph Frontend["Frontend"]
|
|
104
|
+
UI["UI Framework"]
|
|
105
|
+
State["State Management"]
|
|
106
|
+
end
|
|
107
|
+
subgraph Backend["Backend"]
|
|
108
|
+
API["API Layer"]
|
|
109
|
+
BL["Business Logic"]
|
|
110
|
+
DAL["Data Access"]
|
|
111
|
+
end
|
|
112
|
+
subgraph Infrastructure["Infrastructure"]
|
|
113
|
+
DB[(Database)]
|
|
114
|
+
Cache[(Cache)]
|
|
115
|
+
Queue["Message Queue"]
|
|
116
|
+
end
|
|
117
|
+
UI --> State
|
|
118
|
+
State --> API
|
|
119
|
+
API --> BL
|
|
120
|
+
BL --> DAL
|
|
121
|
+
DAL --> DB
|
|
122
|
+
DAL --> Cache
|
|
123
|
+
BL --> Queue
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> Replace with actual components and their relationships from the codebase. For detailed architecture analysis see `draft/.ai-context.md`.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## External Services
|
|
131
|
+
|
|
132
|
+
| Service | Purpose | Credentials Location |
|
|
133
|
+
|---------|---------|---------------------|
|
|
134
|
+
| [Service 1] | [Purpose] | [.env / secrets manager] |
|
|
135
|
+
| [Service 2] | [Purpose] | [.env / secrets manager] |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Code Style
|
|
140
|
+
|
|
141
|
+
### Linting
|
|
142
|
+
- **Tool**: [ESLint/Prettier/etc]
|
|
143
|
+
- **Config**: [.eslintrc / prettier.config.js]
|
|
144
|
+
|
|
145
|
+
### Formatting
|
|
146
|
+
- **Indentation**: [2 spaces / 4 spaces / tabs]
|
|
147
|
+
- **Line Length**: [80 / 100 / 120]
|
|
148
|
+
- **Quotes**: [single / double]
|
|
149
|
+
|
|
150
|
+
### Naming Conventions
|
|
151
|
+
- **Files**: [kebab-case / camelCase / PascalCase]
|
|
152
|
+
- **Functions**: [camelCase]
|
|
153
|
+
- **Classes**: [PascalCase]
|
|
154
|
+
- **Constants**: [SCREAMING_SNAKE_CASE]
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Accepted Patterns
|
|
159
|
+
|
|
160
|
+
<!-- Intentional design decisions that may appear unusual but are correct -->
|
|
161
|
+
<!-- bughunt, deep-review, and review commands will honor these exceptions -->
|
|
162
|
+
|
|
163
|
+
| Pattern | Location | Rationale |
|
|
164
|
+
|---------|----------|-----------|
|
|
165
|
+
| [e.g., Empty catch blocks] | [src/resilient-loader.ts] | [Intentional silent failure for optional plugins] |
|
|
166
|
+
| [e.g., Circular import] | [moduleA ↔ moduleB] | [Lazy resolution pattern, not a bug] |
|
|
167
|
+
| [e.g., `any` type usage] | [src/legacy-adapter.ts] | [Bridging untyped legacy API] |
|
|
168
|
+
|
|
169
|
+
> Add patterns here that static analysis might flag but are intentional. Include enough context for reviewers to understand the decision.
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
---
|
|
2
|
+
project: "{PROJECT_NAME}"
|
|
3
|
+
module: "root"
|
|
4
|
+
track_id: "{TRACK_ID}"
|
|
5
|
+
generated_by: "draft:decompose"
|
|
6
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
7
|
+
git:
|
|
8
|
+
branch: "{LOCAL_BRANCH}"
|
|
9
|
+
remote: "{REMOTE/BRANCH}"
|
|
10
|
+
commit: "{FULL_SHA}"
|
|
11
|
+
commit_short: "{SHORT_SHA}"
|
|
12
|
+
commit_date: "{COMMIT_DATE}"
|
|
13
|
+
commit_message: "{COMMIT_MESSAGE}"
|
|
14
|
+
dirty: false
|
|
15
|
+
synced_to_commit: "{FULL_SHA}"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Track Architecture: {TRACK_TITLE}
|
|
19
|
+
|
|
20
|
+
> Track-scoped HLD/LLD for a single feature, bug fix, or refactor.
|
|
21
|
+
> Source of truth for implementation — `/draft:implement` consumes this to guide build order, contracts, and story generation.
|
|
22
|
+
> For project-wide architecture, see `draft/architecture.md`.
|
|
23
|
+
|
|
24
|
+
| Field | Value |
|
|
25
|
+
|-------|-------|
|
|
26
|
+
| **Track ID** | `{TRACK_ID}` |
|
|
27
|
+
| **Spec** | `./spec.md` |
|
|
28
|
+
| **Plan** | `./plan.md` |
|
|
29
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
30
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
31
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
32
|
+
| **LLD Included** | {true | false} |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Table of Contents
|
|
37
|
+
|
|
38
|
+
1. [Overview](#1-overview)
|
|
39
|
+
2. [Module Breakdown](#2-module-breakdown)
|
|
40
|
+
3. [High-Level Design (HLD)](#3-high-level-design-hld)
|
|
41
|
+
- 3.1 Component Diagram
|
|
42
|
+
- 3.2 Data Flow
|
|
43
|
+
- 3.3 Sequence Diagrams (Critical Flows)
|
|
44
|
+
- 3.4 State Machine(s)
|
|
45
|
+
4. [Dependency Analysis](#4-dependency-analysis)
|
|
46
|
+
5. [Implementation Order](#5-implementation-order)
|
|
47
|
+
6. [Low-Level Design (LLD)](#6-low-level-design-lld)
|
|
48
|
+
- 6.1 Per-Module API Contracts
|
|
49
|
+
- 6.2 Data Models & Schemas
|
|
50
|
+
- 6.3 Error Handling & Retry Semantics
|
|
51
|
+
- 6.4 Algorithm Pseudocode (where non-trivial)
|
|
52
|
+
7. [Notes & Decisions](#7-notes--decisions)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 1. Overview
|
|
57
|
+
|
|
58
|
+
**What this track delivers:** {one paragraph from spec.md — the feature, bug fix, or refactor being scoped}
|
|
59
|
+
|
|
60
|
+
**Inputs:** {what triggers or feeds into this feature}
|
|
61
|
+
**Outputs:** {what this feature produces — data, side effects, API responses}
|
|
62
|
+
**Constraints:** {latency, throughput, compatibility, security — anything from spec.md Non-Functional Requirements}
|
|
63
|
+
|
|
64
|
+
**Integration points:** {which existing modules from `draft/.ai-context.md` this track touches}
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 2. Module Breakdown
|
|
69
|
+
|
|
70
|
+
### Modules Introduced or Modified
|
|
71
|
+
|
|
72
|
+
For each module in scope, fill out one block:
|
|
73
|
+
|
|
74
|
+
#### Module: `{module-name}`
|
|
75
|
+
|
|
76
|
+
- **Status:** `[ ] New` | `[ ] Modified` | `[x] Existing (unchanged)`
|
|
77
|
+
- **Responsibility:** {one sentence — what this module owns}
|
|
78
|
+
- **Files:** `{path/to/file1}`, `{path/to/file2}`
|
|
79
|
+
- **API Surface:** {public functions, classes, or interfaces — names only, contracts in §6.1}
|
|
80
|
+
- **Dependencies:** {other modules this imports from}
|
|
81
|
+
- **Complexity:** `Low` | `Medium` | `High`
|
|
82
|
+
- **Story placeholder:** _populated by `/draft:implement`_
|
|
83
|
+
|
|
84
|
+
{Repeat for each module.}
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 3. High-Level Design (HLD)
|
|
89
|
+
|
|
90
|
+
### 3.1 Component Diagram
|
|
91
|
+
|
|
92
|
+
Shows modules in scope + the external collaborators they talk to.
|
|
93
|
+
|
|
94
|
+
```mermaid
|
|
95
|
+
flowchart TD
|
|
96
|
+
subgraph Track["Track: {TRACK_ID}"]
|
|
97
|
+
M1["{module-1}"]
|
|
98
|
+
M2["{module-2}"]
|
|
99
|
+
M3["{module-3}"]
|
|
100
|
+
end
|
|
101
|
+
subgraph Existing["Existing System"]
|
|
102
|
+
E1["{existing-module-A}"]
|
|
103
|
+
E2["{existing-module-B}"]
|
|
104
|
+
end
|
|
105
|
+
subgraph External["External"]
|
|
106
|
+
X1["{DB / queue / API}"]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
M1 --> M2
|
|
110
|
+
M2 --> M3
|
|
111
|
+
M1 --> E1
|
|
112
|
+
M3 --> X1
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
> Draw one node per module in scope. Include existing modules only when this track calls into them. Label edges with the transport (HTTP, RPC, queue, direct call) when non-obvious.
|
|
116
|
+
|
|
117
|
+
### 3.2 Data Flow
|
|
118
|
+
|
|
119
|
+
End-to-end flow of data through the track's modules.
|
|
120
|
+
|
|
121
|
+
```mermaid
|
|
122
|
+
flowchart LR
|
|
123
|
+
In["{input — request / event}"] --> V["{validation}"]
|
|
124
|
+
V --> L["{business logic}"]
|
|
125
|
+
L --> P["{persistence}"]
|
|
126
|
+
P --> Out["{output — response / emitted event}"]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
> Replace with the actual transforms. If the track has distinct read and write paths, draw them separately.
|
|
130
|
+
|
|
131
|
+
### 3.3 Sequence Diagrams — Critical Flows
|
|
132
|
+
|
|
133
|
+
One sequence per acceptance criterion that involves more than a single module call. Skip for trivial single-module tracks.
|
|
134
|
+
|
|
135
|
+
#### Flow: {name — e.g., "Happy path: user submits X"}
|
|
136
|
+
|
|
137
|
+
```mermaid
|
|
138
|
+
sequenceDiagram
|
|
139
|
+
participant U as {Caller}
|
|
140
|
+
participant A as {module-1}
|
|
141
|
+
participant B as {module-2}
|
|
142
|
+
participant D as {DB / external}
|
|
143
|
+
|
|
144
|
+
U->>A: {request payload}
|
|
145
|
+
A->>B: {internal call}
|
|
146
|
+
B->>D: {query / write}
|
|
147
|
+
D-->>B: {result}
|
|
148
|
+
B-->>A: {response}
|
|
149
|
+
A-->>U: {final response}
|
|
150
|
+
|
|
151
|
+
Note over A,B: {invariant / gate — e.g., "tx must be open here"}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Flow: {error path — e.g., "Dependency timeout"}
|
|
155
|
+
|
|
156
|
+
```mermaid
|
|
157
|
+
sequenceDiagram
|
|
158
|
+
participant U as {Caller}
|
|
159
|
+
participant A as {module-1}
|
|
160
|
+
participant D as {External}
|
|
161
|
+
|
|
162
|
+
U->>A: {request}
|
|
163
|
+
A->>D: {call with timeout={N}ms}
|
|
164
|
+
D--xA: {timeout}
|
|
165
|
+
A->>A: {fallback / circuit breaker}
|
|
166
|
+
A-->>U: {degraded response or error}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 3.4 State Machine(s)
|
|
170
|
+
|
|
171
|
+
Include only if the track introduces or modifies stateful entities. Omit otherwise.
|
|
172
|
+
|
|
173
|
+
```mermaid
|
|
174
|
+
stateDiagram-v2
|
|
175
|
+
[*] --> Pending
|
|
176
|
+
Pending --> Processing: start
|
|
177
|
+
Processing --> Complete: success
|
|
178
|
+
Processing --> Failed: error
|
|
179
|
+
Failed --> Pending: retry (max {N})
|
|
180
|
+
Failed --> DeadLetter: retries exhausted
|
|
181
|
+
Complete --> [*]
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 4. Dependency Analysis
|
|
187
|
+
|
|
188
|
+
### ASCII Dependency Graph
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
[module-1] ──> [module-2]
|
|
192
|
+
│ │
|
|
193
|
+
└──> [module-3] <──┘
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Dependency Table
|
|
197
|
+
|
|
198
|
+
| Module | Depends On | Depended By | Cycle? |
|
|
199
|
+
|--------|------------|-------------|--------|
|
|
200
|
+
| `{mod}` | `{list}` | `{list}` | no |
|
|
201
|
+
|
|
202
|
+
### Cycle Mitigation
|
|
203
|
+
|
|
204
|
+
_If any cycles detected, describe how they are broken (shared interface extraction, dependency inversion, etc.). Otherwise: "No cycles detected."_
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 5. Implementation Order
|
|
209
|
+
|
|
210
|
+
Topological sort — leaves first.
|
|
211
|
+
|
|
212
|
+
1. `{module-A}` (no internal deps) — foundational
|
|
213
|
+
2. `{module-B}` (depends on: A)
|
|
214
|
+
3. `{module-C}` (depends on: A, B)
|
|
215
|
+
|
|
216
|
+
**Parallel opportunities:** {which modules can be built concurrently}
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 6. Low-Level Design (LLD)
|
|
221
|
+
|
|
222
|
+
> Present when `--lld` flag was passed to `/draft:decompose` OR any module in §2 has `Complexity: High`. Otherwise this section reads: _"LLD not generated. Run `/draft:decompose --lld` to expand."_
|
|
223
|
+
|
|
224
|
+
### 6.1 Per-Module API Contracts
|
|
225
|
+
|
|
226
|
+
For each module in §2 marked `New` or `Modified`:
|
|
227
|
+
|
|
228
|
+
#### `{module-name}` — Public API
|
|
229
|
+
|
|
230
|
+
| Function / Method | Signature | Params | Returns | Errors / Exceptions |
|
|
231
|
+
|-------------------|-----------|--------|---------|---------------------|
|
|
232
|
+
| `{name}` | `{lang-appropriate signature}` | `{param: type — constraint}` | `{type — shape}` | `{error types / codes}` |
|
|
233
|
+
|
|
234
|
+
**Preconditions:** {what must be true before call — caller responsibilities}
|
|
235
|
+
**Postconditions:** {what is guaranteed after successful call}
|
|
236
|
+
**Invariants:** {properties preserved across calls — thread safety, idempotency, ordering}
|
|
237
|
+
|
|
238
|
+
{Repeat per module.}
|
|
239
|
+
|
|
240
|
+
### 6.2 Data Models & Schemas
|
|
241
|
+
|
|
242
|
+
Concrete shapes for every new or modified entity this track introduces.
|
|
243
|
+
|
|
244
|
+
#### `{ModelName}`
|
|
245
|
+
|
|
246
|
+
```{language}
|
|
247
|
+
{actual type definition — struct, class, interface, proto message, TypedDict, etc.}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
| Field | Type | Nullable | Default | Validation / Constraint |
|
|
251
|
+
|-------|------|----------|---------|-------------------------|
|
|
252
|
+
| `{field}` | `{type}` | yes/no | `{default or —}` | `{rule}` |
|
|
253
|
+
|
|
254
|
+
**Storage:** {where persisted — table, collection, key prefix}
|
|
255
|
+
**Indexes / Keys:** {primary key, unique constraints, indexed fields}
|
|
256
|
+
**Migration:** {if this is a schema change — migration path and rollback}
|
|
257
|
+
|
|
258
|
+
{Repeat per model.}
|
|
259
|
+
|
|
260
|
+
### 6.3 Error Handling & Retry Semantics
|
|
261
|
+
|
|
262
|
+
Per-operation policy. One row per operation that has non-trivial error handling.
|
|
263
|
+
|
|
264
|
+
| Operation | Error Class | Classification | Retry? | Backoff | Max Attempts | Fallback |
|
|
265
|
+
|-----------|-------------|----------------|--------|---------|--------------|----------|
|
|
266
|
+
| `{op}` | `{ErrorType}` | transient / permanent / timeout | yes/no | `{policy}` | `{N}` | `{behavior}` |
|
|
267
|
+
|
|
268
|
+
**Propagation model:** {how errors surface — Result type, exceptions, error codes}
|
|
269
|
+
**Circuit breaker:** {thresholds, half-open policy, reset} — omit if N/A
|
|
270
|
+
**Idempotency:** {which operations are idempotent and how — dedup key, tx id}
|
|
271
|
+
|
|
272
|
+
### 6.4 Algorithm Pseudocode
|
|
273
|
+
|
|
274
|
+
Include only for non-trivial logic. Skip for straightforward CRUD.
|
|
275
|
+
|
|
276
|
+
#### {Algorithm name}
|
|
277
|
+
|
|
278
|
+
**Inputs:** `{...}`
|
|
279
|
+
**Outputs:** `{...}`
|
|
280
|
+
**Complexity:** `O({...})` time, `O({...})` space
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
{numbered or indented pseudocode — language-agnostic}
|
|
284
|
+
1. validate inputs
|
|
285
|
+
2. ...
|
|
286
|
+
3. return result
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Edge cases handled:**
|
|
290
|
+
- {case 1 — what happens}
|
|
291
|
+
- {case 2 — what happens}
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 7. Notes & Decisions
|
|
296
|
+
|
|
297
|
+
### Architecture Decisions
|
|
298
|
+
|
|
299
|
+
- {decision 1 — rationale, alternatives considered}
|
|
300
|
+
- {decision 2 — rationale, alternatives considered}
|
|
301
|
+
|
|
302
|
+
### Open Questions
|
|
303
|
+
|
|
304
|
+
- {question tracked during decomposition — to resolve before or during implementation}
|
|
305
|
+
|
|
306
|
+
### Links
|
|
307
|
+
|
|
308
|
+
- Spec: `./spec.md`
|
|
309
|
+
- Plan: `./plan.md`
|
|
310
|
+
- Related ADRs: `{paths if any, created via /draft:adr}`
|
|
311
|
+
- Project architecture: `draft/.ai-context.md` → `draft/architecture.md`
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
project: "{PROJECT_NAME}"
|
|
3
|
+
module: "root"
|
|
4
|
+
generated_by: "draft:init"
|
|
5
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
6
|
+
git:
|
|
7
|
+
branch: "{LOCAL_BRANCH}"
|
|
8
|
+
remote: "{REMOTE/BRANCH}"
|
|
9
|
+
commit: "{FULL_SHA}"
|
|
10
|
+
commit_short: "{SHORT_SHA}"
|
|
11
|
+
commit_date: "{COMMIT_DATE}"
|
|
12
|
+
commit_message: "{COMMIT_MESSAGE}"
|
|
13
|
+
dirty: false
|
|
14
|
+
synced_to_commit: "{FULL_SHA}"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Development Workflow
|
|
18
|
+
|
|
19
|
+
| Field | Value |
|
|
20
|
+
|-------|-------|
|
|
21
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
22
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
23
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
24
|
+
| **Synced To** | `{FULL_SHA}` |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Test-Driven Development
|
|
29
|
+
|
|
30
|
+
**Mode:** [strict | flexible | none]
|
|
31
|
+
|
|
32
|
+
**Coverage Target:**
|
|
33
|
+
```yaml
|
|
34
|
+
coverage_target: 95 # Minimum coverage percentage (default: 95%)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Strict TDD
|
|
38
|
+
|
|
39
|
+
**Iron Law:** No production code without a failing test first.
|
|
40
|
+
|
|
41
|
+
The Cycle:
|
|
42
|
+
1. **RED** - Write failing test, run it, VERIFY it FAILS
|
|
43
|
+
2. **GREEN** - Write minimum code, run test, VERIFY it PASSES
|
|
44
|
+
3. **REFACTOR** - Clean up, keep tests green throughout
|
|
45
|
+
|
|
46
|
+
**Red Flags - Delete and Restart if:**
|
|
47
|
+
- Code written before test exists
|
|
48
|
+
- Test passes immediately (testing wrong thing or wrong code)
|
|
49
|
+
- "Just this once" rationalization
|
|
50
|
+
- "This is too simple to test"
|
|
51
|
+
- Running test mentally instead of actually
|
|
52
|
+
|
|
53
|
+
**Checklist:**
|
|
54
|
+
- [ ] Test written and committed BEFORE implementation
|
|
55
|
+
- [ ] Test fails with expected failure (not syntax error)
|
|
56
|
+
- [ ] Minimum code to pass (no extra features)
|
|
57
|
+
- [ ] Refactor preserves green state
|
|
58
|
+
|
|
59
|
+
### Flexible TDD
|
|
60
|
+
- [ ] Tests required but can be written after implementation
|
|
61
|
+
- [ ] All code must have tests before marking complete
|
|
62
|
+
- [ ] Refactoring encouraged
|
|
63
|
+
|
|
64
|
+
### No TDD
|
|
65
|
+
- [ ] Tests optional
|
|
66
|
+
- [ ] Manual verification acceptable
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Commit Strategy
|
|
71
|
+
|
|
72
|
+
**Format:** `type(scope): description`
|
|
73
|
+
|
|
74
|
+
### Types
|
|
75
|
+
| Type | Use For |
|
|
76
|
+
|------|---------|
|
|
77
|
+
| `feat` | New feature |
|
|
78
|
+
| `fix` | Bug fix |
|
|
79
|
+
| `docs` | Documentation only |
|
|
80
|
+
| `style` | Formatting, whitespace |
|
|
81
|
+
| `refactor` | Code restructure without behavior change |
|
|
82
|
+
| `test` | Adding or fixing tests |
|
|
83
|
+
| `chore` | Build, tooling, dependencies |
|
|
84
|
+
|
|
85
|
+
### Scope
|
|
86
|
+
- Use track ID for Draft work: `feat(add-auth): ...`
|
|
87
|
+
- Use component name otherwise: `fix(api): ...`
|
|
88
|
+
|
|
89
|
+
### Commit Frequency
|
|
90
|
+
- [ ] After each task completion
|
|
91
|
+
- [ ] At phase boundaries
|
|
92
|
+
- [ ] End of session
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Code Review
|
|
97
|
+
|
|
98
|
+
### Self-Review Checklist
|
|
99
|
+
- [ ] Code follows project style guide
|
|
100
|
+
- [ ] Tests pass locally
|
|
101
|
+
- [ ] No console.log or debug statements
|
|
102
|
+
- [ ] Error handling complete
|
|
103
|
+
- [ ] Edge cases considered
|
|
104
|
+
|
|
105
|
+
### Before Marking Task Complete
|
|
106
|
+
- [ ] Run linter
|
|
107
|
+
- [ ] Run tests
|
|
108
|
+
- [ ] Review diff
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Phase Verification
|
|
113
|
+
|
|
114
|
+
At the end of each phase:
|
|
115
|
+
|
|
116
|
+
1. **Run full test suite**
|
|
117
|
+
2. **Manual smoke test** if applicable
|
|
118
|
+
3. **Review against phase goals** in plan.md
|
|
119
|
+
4. **Document any issues** found
|
|
120
|
+
|
|
121
|
+
Do not proceed to next phase until verification passes.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Review Settings
|
|
126
|
+
|
|
127
|
+
### Auto-Review
|
|
128
|
+
- [ ] Auto-review at track completion
|
|
129
|
+
|
|
130
|
+
When enabled, runs `/draft:review track <id>` automatically when `/draft:implement` completes a track.
|
|
131
|
+
|
|
132
|
+
### Blocking Behavior
|
|
133
|
+
- [ ] Block on review failures
|
|
134
|
+
|
|
135
|
+
When enabled, halt track completion if critical (✗) issues found. Requires fixes before marking complete.
|
|
136
|
+
|
|
137
|
+
When disabled (default), review failures produce warnings only. Issues documented in `draft/tracks/<id>/review-report.md`.
|
|
138
|
+
|
|
139
|
+
### Review Scope (Stage 1 Automation)
|
|
140
|
+
- [x] Architecture conformance
|
|
141
|
+
- [x] Dead code detection
|
|
142
|
+
- [x] Dependency cycle detection
|
|
143
|
+
- [x] Security scan
|
|
144
|
+
- [x] Performance anti-patterns
|
|
145
|
+
|
|
146
|
+
Uncheck categories to skip during validation phase of review. All enabled by default.
|
|
147
|
+
|
|
148
|
+
> **How to configure:** Edit the checkboxes above directly in this file. Change `[x]` to `[ ]` to disable a category. The `/draft:review` command reads these settings before running.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Session Management
|
|
153
|
+
|
|
154
|
+
### Starting a Session
|
|
155
|
+
1. Run `/draft:status` to see current state
|
|
156
|
+
2. Read active track's spec.md and plan.md
|
|
157
|
+
3. Find current task (marked `[~]` or first `[ ]`)
|
|
158
|
+
|
|
159
|
+
### Ending a Session
|
|
160
|
+
1. Commit any pending changes
|
|
161
|
+
2. Update plan.md with progress
|
|
162
|
+
3. Add notes for next session if mid-task
|
|
163
|
+
|
|
164
|
+
### Context Handoff
|
|
165
|
+
If task exceeds 5 iterations:
|
|
166
|
+
1. Document current state in plan.md
|
|
167
|
+
2. Note any discoveries or blockers
|
|
168
|
+
3. Suggest resumption approach
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Toolchain
|
|
173
|
+
|
|
174
|
+
### VCS
|
|
175
|
+
- [x] git + GitHub Pull Requests
|
|
176
|
+
|
|
177
|
+
### MCP Auto-Connect (optional)
|
|
178
|
+
- [ ] Jira MCP — for ticket linking via `/draft:jira` (preview / create / review)
|
|
179
|
+
- [ ] Confluence MCP — for design-doc and runbook lookups
|
|
180
|
+
|
|
181
|
+
> **How to configure:** Check the MCP boxes above to enable optional integrations. See `core/shared/vcs-commands.md` for git command conventions used across skills.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Guardrails
|
|
186
|
+
|
|
187
|
+
> **See `draft/guardrails.md`** — Hard guardrails, learned conventions, and learned anti-patterns are managed in the dedicated guardrails file. Run `/draft:learn` to discover patterns and update guardrails.
|