@drafthq/draft 3.5.2 → 3.6.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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/cli/src/hosts/cursor.js +3 -0
- package/cli/src/installer.js +7 -3
- package/cli/src/lib/fsx.js +3 -0
- package/cli/src/lib/marker.js +8 -3
- package/core/shared/condensation.md +1 -1
- package/core/shared/git-report-metadata.md +1 -1
- package/core/shared/graph-query.md +24 -24
- package/core/shared/tool-resolver.md +20 -15
- package/core/templates/okf/index.md +6 -10
- package/core/templates/okf/section-index.md +2 -11
- package/core/templates/plan.md +1 -1
- package/integrations/agents/AGENTS.md +142 -492
- package/integrations/copilot/.github/copilot-instructions.md +142 -492
- package/package.json +1 -1
- package/scripts/fetch-memory-engine.sh +1 -1
- package/scripts/lib.sh +79 -2
- package/scripts/tools/_graph_queries.sh +12 -5
- package/scripts/tools/_lib.sh +56 -8
- package/scripts/tools/adr-index.sh +1 -1
- package/scripts/tools/check-skill-line-caps.sh +2 -2
- package/scripts/tools/check-track-hygiene.sh +41 -21
- package/scripts/tools/classify-files.sh +1 -1
- package/scripts/tools/cycle-detect.sh +2 -9
- package/scripts/tools/detect-test-framework.sh +1 -1
- package/scripts/tools/emit-skill-metrics.sh +7 -2
- package/scripts/tools/freshness-check.sh +2 -2
- package/scripts/tools/git-metadata.sh +6 -6
- package/scripts/tools/graph-arch.sh +4 -10
- package/scripts/tools/graph-callers.sh +4 -12
- package/scripts/tools/graph-deps.sh +3 -10
- package/scripts/tools/graph-errors.sh +4 -11
- package/scripts/tools/graph-hierarchy.sh +4 -11
- package/scripts/tools/graph-impact.sh +17 -17
- package/scripts/tools/graph-init.sh +1 -1
- package/scripts/tools/graph-preflight.sh +1 -1
- package/scripts/tools/graph-query.sh +5 -12
- package/scripts/tools/graph-risk.sh +3 -10
- package/scripts/tools/graph-search.sh +4 -11
- package/scripts/tools/graph-snapshot.sh +9 -4
- package/scripts/tools/graph-snippet.sh +3 -10
- package/scripts/tools/graph-tests.sh +3 -10
- package/scripts/tools/graph-traces.sh +3 -10
- package/scripts/tools/hotspot-rank.sh +4 -11
- package/scripts/tools/mermaid-from-graph.sh +3 -10
- package/scripts/tools/migrate-track-frontmatter.sh +3 -1
- package/scripts/tools/okf-coverage-check.sh +24 -6
- package/scripts/tools/okf-emit-catalog.sh +256 -0
- package/scripts/tools/okf-fix-links.sh +326 -0
- package/scripts/tools/okf-plan-concepts.sh +245 -14
- package/scripts/tools/okf-render-views.sh +65 -13
- package/scripts/tools/okf-validate-all.sh +20 -9
- package/scripts/tools/okf-validate-quality.sh +2 -8
- package/scripts/tools/okf-validate.sh +20 -10
- package/scripts/tools/parse-git-log.sh +4 -4
- package/scripts/tools/parse-reports.sh +1 -1
- package/scripts/tools/render-track.sh +1 -1
- package/scripts/tools/run-coverage.sh +1 -1
- package/scripts/tools/scan-markers.sh +4 -4
- package/scripts/tools/validate-frontmatter.sh +2 -2
- package/scripts/tools/verify-citations.sh +2 -2
- package/scripts/tools/verify-doc-anchors.sh +1 -1
- package/scripts/tools/verify-graph-binary.sh +2 -2
- package/skills/adr/SKILL.md +1 -1
- package/skills/bughunt/SKILL.md +1 -1
- package/skills/coverage/SKILL.md +2 -2
- package/skills/debug/SKILL.md +1 -1
- package/skills/decompose/SKILL.md +3 -3
- package/skills/deep-review/SKILL.md +2 -2
- package/skills/deploy-checklist/SKILL.md +1 -1
- package/skills/graph/SKILL.md +1 -1
- package/skills/impact/SKILL.md +1 -1
- package/skills/implement/SKILL.md +2 -2
- package/skills/init/SKILL.md +10 -7
- package/skills/init/references/architecture-spec.md +1 -1
- package/skills/init/references/okf-emitter.md +51 -76
- package/skills/learn/SKILL.md +1 -1
- package/skills/quick-review/SKILL.md +1 -1
- package/skills/review/SKILL.md +3 -3
- package/skills/standup/SKILL.md +1 -1
- package/skills/status/SKILL.md +1 -1
- package/skills/tech-debt/SKILL.md +2 -2
- package/skills/upload/SKILL.md +1 -1
- package/core/templates/track-architecture.md +0 -311
|
@@ -1,311 +0,0 @@
|
|
|
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`
|