@drafthq/draft 3.5.3 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor-plugin/plugin.json +1 -1
  4. package/README.md +28 -49
  5. package/bin/README.md +47 -1
  6. package/cli/src/hosts/cursor.js +3 -0
  7. package/cli/src/installer.js +8 -4
  8. package/cli/src/lib/cursor-registry.js +10 -0
  9. package/cli/src/lib/fsx.js +3 -0
  10. package/cli/src/lib/marker.js +8 -3
  11. package/core/agents/architect.md +21 -9
  12. package/core/agents/debugger.md +5 -0
  13. package/core/agents/ops.md +7 -2
  14. package/core/agents/planner.md +7 -0
  15. package/core/agents/rca.md +14 -3
  16. package/core/agents/reviewer.md +1 -0
  17. package/core/agents/writer.md +6 -0
  18. package/core/knowledge-base.md +22 -3
  19. package/core/methodology.md +30 -5
  20. package/core/shared/condensation.md +28 -18
  21. package/core/shared/context-verify.md +3 -1
  22. package/core/shared/cross-skill-dispatch.md +7 -3
  23. package/core/shared/draft-context-loading.md +3 -0
  24. package/core/shared/git-report-metadata.md +2 -1
  25. package/core/shared/graph-query.md +24 -26
  26. package/core/shared/graph-usage-report.md +1 -1
  27. package/core/shared/jira-sync.md +10 -6
  28. package/core/shared/okf-retrieval.md +1 -1
  29. package/core/shared/parallel-analysis.md +14 -7
  30. package/core/shared/pattern-learning.md +2 -0
  31. package/core/shared/template-contract.md +1 -1
  32. package/core/shared/tool-resolver.md +20 -15
  33. package/core/shared/vcs-commands.md +5 -2
  34. package/core/templates/ai-context.md +3 -2
  35. package/core/templates/ai-profile.md +7 -0
  36. package/core/templates/architecture.md +6 -2
  37. package/core/templates/discovery.md +1 -1
  38. package/core/templates/guardrails.md +9 -0
  39. package/core/templates/hld.md +5 -4
  40. package/core/templates/intake-questions.md +45 -0
  41. package/core/templates/jira.md +11 -2
  42. package/core/templates/lld.md +8 -5
  43. package/core/templates/okf/concept.md +0 -1
  44. package/core/templates/plan.md +1 -1
  45. package/core/templates/product.md +11 -2
  46. package/core/templates/rca.md +6 -0
  47. package/core/templates/service-index.md +1 -0
  48. package/core/templates/spec.md +15 -0
  49. package/core/templates/tech-stack.md +12 -0
  50. package/core/templates/workflow.md +20 -0
  51. package/integrations/agents/AGENTS.md +1449 -817
  52. package/integrations/copilot/.github/copilot-instructions.md +1449 -817
  53. package/package.json +1 -1
  54. package/scripts/fetch-memory-engine.sh +25 -7
  55. package/scripts/lib.sh +90 -6
  56. package/scripts/tools/_graph_queries.sh +22 -8
  57. package/scripts/tools/_lib.sh +81 -11
  58. package/scripts/tools/adr-index.sh +1 -1
  59. package/scripts/tools/check-repo-size.sh +125 -0
  60. package/scripts/tools/check-skill-line-caps.sh +3 -4
  61. package/scripts/tools/check-template-noop.sh +0 -1
  62. package/scripts/tools/check-track-hygiene.sh +41 -21
  63. package/scripts/tools/classify-files.sh +3 -3
  64. package/scripts/tools/cycle-detect.sh +18 -17
  65. package/scripts/tools/detect-test-framework.sh +1 -1
  66. package/scripts/tools/emit-skill-metrics.sh +7 -2
  67. package/scripts/tools/fix-whitespace.sh +3 -0
  68. package/scripts/tools/freshness-check.sh +2 -2
  69. package/scripts/tools/git-metadata.sh +12 -6
  70. package/scripts/tools/graph-arch.sh +5 -11
  71. package/scripts/tools/graph-callers.sh +10 -15
  72. package/scripts/tools/graph-deps.sh +3 -10
  73. package/scripts/tools/graph-errors.sh +4 -11
  74. package/scripts/tools/graph-hierarchy.sh +4 -11
  75. package/scripts/tools/graph-impact.sh +21 -19
  76. package/scripts/tools/graph-init.sh +13 -9
  77. package/scripts/tools/graph-preflight.sh +4 -1
  78. package/scripts/tools/graph-query.sh +74 -18
  79. package/scripts/tools/graph-risk.sh +3 -10
  80. package/scripts/tools/graph-search.sh +4 -11
  81. package/scripts/tools/graph-snapshot.sh +38 -9
  82. package/scripts/tools/graph-snippet.sh +3 -10
  83. package/scripts/tools/graph-tests.sh +3 -10
  84. package/scripts/tools/graph-traces.sh +3 -10
  85. package/scripts/tools/hotspot-rank.sh +6 -12
  86. package/scripts/tools/install-smoke-test.sh +223 -0
  87. package/scripts/tools/mermaid-from-graph.sh +5 -11
  88. package/scripts/tools/migrate-track-frontmatter.sh +11 -10
  89. package/scripts/tools/okf-coverage-check.sh +8 -7
  90. package/scripts/tools/okf-emit-catalog.sh +256 -0
  91. package/scripts/tools/okf-fix-links.sh +251 -0
  92. package/scripts/tools/okf-plan-concepts.sh +242 -14
  93. package/scripts/tools/okf-render-views.sh +63 -21
  94. package/scripts/tools/okf-validate-all.sh +20 -9
  95. package/scripts/tools/okf-validate-quality.sh +15 -10
  96. package/scripts/tools/okf-validate.sh +20 -6
  97. package/scripts/tools/parse-git-log.sh +23 -5
  98. package/scripts/tools/parse-reports.sh +1 -1
  99. package/scripts/tools/render-track.sh +1 -1
  100. package/scripts/tools/resolve-tools.sh +24 -8
  101. package/scripts/tools/run-coverage.sh +1 -1
  102. package/scripts/tools/scan-markers.sh +4 -4
  103. package/scripts/tools/validate-frontmatter.sh +2 -2
  104. package/scripts/tools/verify-citations.sh +3 -4
  105. package/scripts/tools/verify-doc-anchors.sh +14 -34
  106. package/scripts/tools/verify-graph-binary.sh +15 -5
  107. package/skills/GRAPH.md +21 -10
  108. package/skills/adr/SKILL.md +25 -7
  109. package/skills/assist-review/SKILL.md +2 -1
  110. package/skills/bughunt/SKILL.md +55 -12
  111. package/skills/bughunt/references/regression-tests.md +14 -4
  112. package/skills/change/SKILL.md +19 -9
  113. package/skills/coverage/SKILL.md +28 -12
  114. package/skills/debug/SKILL.md +13 -3
  115. package/skills/decompose/SKILL.md +42 -12
  116. package/skills/deep-review/SKILL.md +19 -6
  117. package/skills/deploy-checklist/SKILL.md +10 -3
  118. package/skills/documentation/SKILL.md +12 -1
  119. package/skills/draft/SKILL.md +40 -29
  120. package/skills/draft/context-files.md +8 -1
  121. package/skills/draft/quality-guide.md +10 -2
  122. package/skills/graph/SKILL.md +2 -2
  123. package/skills/impact/SKILL.md +4 -2
  124. package/skills/implement/SKILL.md +62 -20
  125. package/skills/incident-response/SKILL.md +5 -2
  126. package/skills/init/SKILL.md +112 -30
  127. package/skills/init/references/architecture-spec.md +32 -8
  128. package/skills/init/references/okf-emitter.md +42 -78
  129. package/skills/jira/SKILL.md +33 -13
  130. package/skills/jira/references/review.md +61 -19
  131. package/skills/learn/SKILL.md +30 -7
  132. package/skills/new-track/SKILL.md +73 -18
  133. package/skills/quick-review/SKILL.md +8 -3
  134. package/skills/revert/SKILL.md +11 -5
  135. package/skills/review/SKILL.md +126 -27
  136. package/skills/review/references/zero-setup-mode.md +117 -0
  137. package/skills/standup/SKILL.md +10 -2
  138. package/skills/status/SKILL.md +7 -7
  139. package/skills/tech-debt/SKILL.md +9 -3
  140. package/skills/testing-strategy/SKILL.md +10 -2
  141. package/skills/tour/SKILL.md +2 -1
  142. package/skills/upload/SKILL.md +4 -3
  143. 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`