@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.
Files changed (158) hide show
  1. package/.claude-plugin/marketplace.json +38 -0
  2. package/.claude-plugin/plugin.json +26 -0
  3. package/LICENSE +21 -0
  4. package/README.md +272 -0
  5. package/bin/README.md +49 -0
  6. package/cli/bin/draft.js +13 -0
  7. package/cli/src/cli.js +113 -0
  8. package/cli/src/hosts/claude-code.js +46 -0
  9. package/cli/src/hosts/codex.js +33 -0
  10. package/cli/src/hosts/cursor.js +50 -0
  11. package/cli/src/hosts/index.js +24 -0
  12. package/cli/src/hosts/opencode.js +39 -0
  13. package/cli/src/installer.js +61 -0
  14. package/cli/src/lib/fsx.js +34 -0
  15. package/cli/src/lib/graph.js +23 -0
  16. package/cli/src/lib/log.js +32 -0
  17. package/cli/src/lib/paths.js +14 -0
  18. package/core/agents/architect.md +338 -0
  19. package/core/agents/debugger.md +193 -0
  20. package/core/agents/ops.md +104 -0
  21. package/core/agents/planner.md +158 -0
  22. package/core/agents/rca.md +314 -0
  23. package/core/agents/reviewer.md +256 -0
  24. package/core/agents/writer.md +110 -0
  25. package/core/guardrails/README.md +4 -0
  26. package/core/guardrails/code-quality.md +4 -0
  27. package/core/guardrails/dependency-triage.md +4 -0
  28. package/core/guardrails/design-norms.md +4 -0
  29. package/core/guardrails/language-standards.md +4 -0
  30. package/core/guardrails/review-checks.md +4 -0
  31. package/core/guardrails/secure-patterns.md +4 -0
  32. package/core/guardrails/security.md +4 -0
  33. package/core/guardrails.md +22 -0
  34. package/core/knowledge-base.md +127 -0
  35. package/core/methodology.md +1221 -0
  36. package/core/shared/condensation.md +224 -0
  37. package/core/shared/context-verify.md +44 -0
  38. package/core/shared/cross-skill-dispatch.md +127 -0
  39. package/core/shared/discovery-schema.md +75 -0
  40. package/core/shared/draft-context-loading.md +282 -0
  41. package/core/shared/git-report-metadata.md +106 -0
  42. package/core/shared/graph-query.md +239 -0
  43. package/core/shared/graph-usage-report.md +22 -0
  44. package/core/shared/jira-sync.md +170 -0
  45. package/core/shared/parallel-analysis.md +386 -0
  46. package/core/shared/parallel-fanout.md +10 -0
  47. package/core/shared/pattern-learning.md +146 -0
  48. package/core/shared/red-flags.md +58 -0
  49. package/core/shared/template-contract.md +22 -0
  50. package/core/shared/template-hygiene.md +10 -0
  51. package/core/shared/tool-resolver.md +10 -0
  52. package/core/shared/vcs-commands.md +97 -0
  53. package/core/shared/verification-gates.md +47 -0
  54. package/core/templates/CHANGELOG.md +70 -0
  55. package/core/templates/ai-context-export.md +8 -0
  56. package/core/templates/ai-context.md +270 -0
  57. package/core/templates/ai-profile.md +41 -0
  58. package/core/templates/architecture.md +203 -0
  59. package/core/templates/dependency-graph.md +103 -0
  60. package/core/templates/discovery.md +79 -0
  61. package/core/templates/guardrails.md +143 -0
  62. package/core/templates/hld.md +327 -0
  63. package/core/templates/intake-questions.md +403 -0
  64. package/core/templates/jira.md +119 -0
  65. package/core/templates/lld.md +283 -0
  66. package/core/templates/metadata.json +66 -0
  67. package/core/templates/plan.md +130 -0
  68. package/core/templates/product.md +110 -0
  69. package/core/templates/rca.md +86 -0
  70. package/core/templates/root-architecture.md +127 -0
  71. package/core/templates/root-product.md +53 -0
  72. package/core/templates/root-tech-stack.md +117 -0
  73. package/core/templates/service-index.md +55 -0
  74. package/core/templates/session-summary.md +8 -0
  75. package/core/templates/spec.md +165 -0
  76. package/core/templates/tech-matrix.md +101 -0
  77. package/core/templates/tech-stack.md +169 -0
  78. package/core/templates/track-architecture.md +311 -0
  79. package/core/templates/workflow.md +187 -0
  80. package/integrations/agents/AGENTS.md +24384 -0
  81. package/integrations/copilot/.github/copilot-instructions.md +24384 -0
  82. package/integrations/gemini/.gemini.md +26 -0
  83. package/package.json +53 -0
  84. package/scripts/fetch-memory-engine.sh +116 -0
  85. package/scripts/lib.sh +256 -0
  86. package/scripts/tools/_lib.sh +220 -0
  87. package/scripts/tools/adr-index.sh +117 -0
  88. package/scripts/tools/check-graph-usage-report.sh +95 -0
  89. package/scripts/tools/check-scope-conflicts.sh +139 -0
  90. package/scripts/tools/check-skill-line-caps.sh +115 -0
  91. package/scripts/tools/check-template-noop.sh +87 -0
  92. package/scripts/tools/check-track-hygiene.sh +230 -0
  93. package/scripts/tools/classify-files.sh +231 -0
  94. package/scripts/tools/cycle-detect.sh +75 -0
  95. package/scripts/tools/detect-test-framework.sh +135 -0
  96. package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
  97. package/scripts/tools/emit-skill-metrics.sh +71 -0
  98. package/scripts/tools/fix-whitespace.sh +192 -0
  99. package/scripts/tools/freshness-check.sh +143 -0
  100. package/scripts/tools/git-metadata.sh +203 -0
  101. package/scripts/tools/graph-callers.sh +74 -0
  102. package/scripts/tools/graph-impact.sh +93 -0
  103. package/scripts/tools/graph-snapshot.sh +102 -0
  104. package/scripts/tools/hotspot-rank.sh +75 -0
  105. package/scripts/tools/manage-symlinks.sh +85 -0
  106. package/scripts/tools/mermaid-from-graph.sh +92 -0
  107. package/scripts/tools/migrate-track-frontmatter.sh +241 -0
  108. package/scripts/tools/parse-git-log.sh +135 -0
  109. package/scripts/tools/parse-reports.sh +114 -0
  110. package/scripts/tools/render-track.sh +145 -0
  111. package/scripts/tools/run-coverage.sh +153 -0
  112. package/scripts/tools/scan-markers.sh +144 -0
  113. package/scripts/tools/skill-caps.conf +24 -0
  114. package/scripts/tools/validate-frontmatter.sh +125 -0
  115. package/scripts/tools/verify-citations.sh +250 -0
  116. package/scripts/tools/verify-doc-anchors.sh +204 -0
  117. package/scripts/tools/verify-graph-binary.sh +154 -0
  118. package/skills/GRAPH.md +332 -0
  119. package/skills/adr/SKILL.md +374 -0
  120. package/skills/assist-review/SKILL.md +49 -0
  121. package/skills/bughunt/SKILL.md +668 -0
  122. package/skills/bughunt/references/regression-tests.md +399 -0
  123. package/skills/change/SKILL.md +267 -0
  124. package/skills/coverage/SKILL.md +336 -0
  125. package/skills/debug/SKILL.md +201 -0
  126. package/skills/decompose/SKILL.md +656 -0
  127. package/skills/deep-review/SKILL.md +326 -0
  128. package/skills/deploy-checklist/SKILL.md +254 -0
  129. package/skills/discover/SKILL.md +66 -0
  130. package/skills/docs/SKILL.md +42 -0
  131. package/skills/documentation/SKILL.md +197 -0
  132. package/skills/draft/SKILL.md +177 -0
  133. package/skills/draft/context-files.md +57 -0
  134. package/skills/draft/intent-mapping.md +37 -0
  135. package/skills/draft/quality-guide.md +51 -0
  136. package/skills/graph/SKILL.md +107 -0
  137. package/skills/impact/SKILL.md +86 -0
  138. package/skills/implement/SKILL.md +794 -0
  139. package/skills/incident-response/SKILL.md +245 -0
  140. package/skills/index/SKILL.md +848 -0
  141. package/skills/init/SKILL.md +1784 -0
  142. package/skills/init/references/architecture-spec.md +1259 -0
  143. package/skills/integrations/SKILL.md +53 -0
  144. package/skills/jira/SKILL.md +577 -0
  145. package/skills/jira/references/review.md +1322 -0
  146. package/skills/learn/SKILL.md +478 -0
  147. package/skills/new-track/SKILL.md +841 -0
  148. package/skills/ops/SKILL.md +57 -0
  149. package/skills/plan/SKILL.md +60 -0
  150. package/skills/quick-review/SKILL.md +216 -0
  151. package/skills/revert/SKILL.md +178 -0
  152. package/skills/review/SKILL.md +1114 -0
  153. package/skills/standup/SKILL.md +183 -0
  154. package/skills/status/SKILL.md +183 -0
  155. package/skills/tech-debt/SKILL.md +318 -0
  156. package/skills/testing-strategy/SKILL.md +195 -0
  157. package/skills/tour/SKILL.md +38 -0
  158. package/skills/upload/SKILL.md +117 -0
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: incident-response
3
+ description: Incident management lifecycle — triage, communicate, mitigate, postmortem. Three modes — new (start incident), update (status update), postmortem (blameless RCA report).
4
+ ---
5
+
6
+ # Incident Response
7
+
8
+ You are managing an incident through its full lifecycle using structured incident management practices.
9
+
10
+ ## Red Flags — STOP if you're:
11
+
12
+ - Fixing before communicating (stakeholders must know first)
13
+ - Skipping severity classification
14
+ - Writing a postmortem with blame (blameless only)
15
+ - Closing an incident without prevention items
16
+ - Ignoring rollback as a mitigation option
17
+
18
+ **Communicate first. Fix second. Learn always.**
19
+
20
+ ---
21
+
22
+ ## Pre-Check
23
+
24
+ 1. Check for Draft context:
25
+ ```bash
26
+ ls draft/ 2>/dev/null
27
+ ```
28
+
29
+ This skill works standalone — incidents don't wait for project setup.
30
+
31
+ 2. If available, follow the base procedure in `core/shared/draft-context-loading.md`.
32
+
33
+ ## Step 1: Parse Arguments
34
+
35
+ - `/draft:incident-response new <description>` — Start new incident
36
+ - `/draft:incident-response update <status>` — Post status update
37
+ - `/draft:incident-response postmortem` — Generate postmortem report
38
+ - `/draft:incident-response` (no args) — Interactive: ask which mode
39
+
40
+ ---
41
+
42
+ ## NEW Mode — Start Incident
43
+
44
+ ### Step 2: Triage
45
+
46
+ Classify severity:
47
+
48
+ | Level | Response Time | Who | Examples |
49
+ |-------|--------------|-----|---------|
50
+ | **SEV1** | Immediate, all-hands | Entire team | Data loss, complete outage, security breach |
51
+ | **SEV2** | 15 minutes | On-call + team lead | Major feature broken, significant degradation |
52
+ | **SEV3** | 1 hour | On-call | Minor feature broken, workaround exists |
53
+ | **SEV4** | Next business day | Assigned engineer | Cosmetic issue, minor inconvenience |
54
+
55
+ Assess:
56
+ 1. **What is broken?** (from description or Jira ticket)
57
+ 2. **Who is affected?** (from `draft/product.md` user types if available)
58
+ 3. **What is the blast radius?** (from `draft/.ai-context.md` service topology if available)
59
+ 4. **Is data at risk?** (escalate to SEV1 if yes)
60
+
61
+ ### Step 3: Communicate
62
+
63
+ Generate initial status update:
64
+
65
+ ```
66
+ INCIDENT: {description}
67
+ Severity: SEV{1-4}
68
+ Impact: {who/what is affected}
69
+ Status: Investigating
70
+ Commander: {name or "unassigned"}
71
+ Next update: {time — SEV1: 15min, SEV2: 30min, SEV3: 1hr}
72
+ ```
73
+
74
+ ### Step 4: Gather Evidence
75
+
76
+ - If Jira ticket linked: pull details via MCP (`get_issue`, `get_issue_description`, `get_issue_comments`)
77
+ - Extract URLs and log paths from ticket
78
+ - Use `curl`/`wget` to fetch dashboards or error pages mentioned
79
+ - Use `ssh` to access remote log paths if mentioned
80
+ - If GitHub MCP available: check recent deployments (`last 24h`)
81
+ - Record all evidence in incident timeline
82
+
83
+ ### Step 5: Mitigate
84
+
85
+ Following `core/agents/ops.md` production-safety mindset:
86
+
87
+ 1. **Can we rollback?** If yes and severity ≥ SEV2: recommend rollback first, investigate after
88
+ 2. **Can we hotfix?** If rollback not possible: identify minimal fix
89
+ 3. **Can we mitigate?** Feature flag, config change, traffic routing
90
+ 4. **Need to escalate?** If none of above work, escalate severity
91
+
92
+ Document all actions taken with timestamps.
93
+
94
+ ### Step 6: Save Incident File
95
+
96
+ Save to: `draft/incidents/incident-<timestamp>.md` or `draft/tracks/<id>/incident.md`
97
+
98
+ ```markdown
99
+ # Incident: {description}
100
+
101
+ | Field | Value |
102
+ |-------|-------|
103
+ | **Severity** | SEV{N} |
104
+ | **Status** | {Investigating/Mitigating/Resolved} |
105
+ | **Started** | {timestamp} |
106
+ | **Commander** | {name} |
107
+
108
+ ## Timeline
109
+ | Time | Action |
110
+ |------|--------|
111
+ | {time} | Incident detected |
112
+ | {time} | Triage: classified as SEV{N} |
113
+ | {time} | {mitigation action} |
114
+
115
+ ## Evidence
116
+ | Source | Finding |
117
+ |--------|---------|
118
+ | {source} | {finding} |
119
+
120
+ ## Status Updates
121
+ {chronological updates}
122
+ ```
123
+
124
+ ---
125
+
126
+ ## UPDATE Mode
127
+
128
+ 1. Read existing incident file
129
+ 2. Add new timeline entry with timestamp
130
+ 3. Update status field if changed
131
+ 4. Update severity if changed (with justification)
132
+ 5. Generate formatted status update for stakeholders
133
+
134
+ ---
135
+
136
+ ## POSTMORTEM Mode
137
+
138
+ ### Step 2: Gather Timeline
139
+
140
+ - Read incident file for timeline and evidence
141
+ - `git log` for related commits during incident window
142
+ - If Jira MCP: pull ticket history and transitions
143
+ - If GitHub MCP: pull changes submitted during/after incident
144
+
145
+ ### Step 3: Root Cause Analysis
146
+
147
+ Reference `core/agents/rca.md` methodology:
148
+
149
+ 1. **5 Whys Analysis:**
150
+ - Why did {symptom} happen? → Because {cause 1}
151
+ - Why {cause 1}? → Because {cause 2}
152
+ - Continue until root cause reached (typically 3-5 levels)
153
+
154
+ 2. **Root Cause Classification:**
155
+ - Logic error | Race condition | Data corruption | Configuration error
156
+ - Dependency failure | Capacity exceeded | Security exploit | Human error
157
+
158
+ 3. **Detection Lag:** When was the bug introduced vs when was it detected?
159
+
160
+ 4. **SLO Impact:** Which SLOs were affected and by how much?
161
+
162
+ 5. **HLD Claims vs Reality ():** If the affected service has a `hld.md` (search `draft/tracks/*/hld.md` for §Detailed Design components matching the failing module), compare incident behavior against HLD claims:
163
+ - Did §Resiliency claims (graceful degradation, circuit breakers, timeout handling) actually hold during the incident?
164
+ - Did §Multi-tenancy claims (tenant isolation, predictable performance) hold? Did one tenant impact another?
165
+ - Did §Upgrade claims (backward compat, dependent service order) hold? Did an upgrade trigger this?
166
+ - Did §Scale claims hold under the load that triggered the incident?
167
+ - Did §Observability claims hold — were the listed key metrics sufficient for detection?
168
+ - Cite the specific HLD §section using section text (`draft/tracks/<id>/hld.md §Resiliency`) for each gap — avoid markdown anchor slugs since renderers (GitHub, mkdocs, Hugo) generate different slugs for nested headings. These citations feed the §Action Items as "amend HLD §X — claim was {claim} but reality showed {reality}."
169
+
170
+ ### Step 4: Generate Postmortem
171
+
172
+ **MANDATORY: Include YAML frontmatter with git metadata.** Follow `core/shared/git-report-metadata.md`.
173
+
174
+ Save to: `draft/incidents/postmortem-<timestamp>.md` with symlink `postmortem-latest.md`
175
+ Or track-scoped: `draft/tracks/<id>/postmortem.md`
176
+
177
+ ```markdown
178
+ # Postmortem: {incident title}
179
+
180
+ ## Summary
181
+ {2-3 sentences: what happened, impact, duration}
182
+
183
+ ## Impact
184
+ - **Duration:** {start} to {end} ({total time})
185
+ - **Users affected:** {count or percentage}
186
+ - **SLO impact:** {which SLOs, by how much}
187
+ - **Data impact:** {any data loss or corruption}
188
+
189
+ ## Timeline
190
+ | Time | Event |
191
+ |------|-------|
192
+ | {time} | {event} |
193
+
194
+ ## Root Cause
195
+ {1-2 sentence root cause statement}
196
+
197
+ ### 5 Whys
198
+ 1. Why? → {answer}
199
+ 2. Why? → {answer}
200
+ ...
201
+
202
+ ### Classification
203
+ - **Type:** {classification}
204
+ - **Detection Lag:** {introduced} → {detected} = {gap}
205
+
206
+ ## What Went Well
207
+ - {positive observations}
208
+
209
+ ## What Went Wrong
210
+ - {things that made the incident worse}
211
+
212
+ ## Design Claims vs Reality
213
+ {populated when an HLD was available — list each HLD claim that did not hold, citing the specific §section}
214
+
215
+ | HLD Section | Claim | Reality During Incident | Recommended HLD Amendment |
216
+ |-------------|-------|-------------------------|---------------------------|
217
+ | §Resiliency | {what was claimed} | {what actually happened} | {how to update HLD} |
218
+
219
+ ## Action Items
220
+ | # | Action | Owner | Deadline | Status |
221
+ |---|--------|-------|----------|--------|
222
+ | 1 | {detection improvement} | {name} | {date} | [ ] |
223
+ | 2 | {process improvement} | {name} | {date} | [ ] |
224
+ | 3 | {code improvement} | {name} | {date} | [ ] |
225
+ | 4 | Amend `draft/tracks/<id>/hld.md` §{section} (if claim drift identified) | {design owner} | {date} | [ ] |
226
+ ```
227
+
228
+ ### Step 5: Jira Sync
229
+
230
+ Follow `core/shared/jira-sync.md`:
231
+ - Attach postmortem to Jira ticket
232
+ - Post comment: "[draft] Postmortem complete. Root cause: {1-line summary}. {N} action items."
233
+
234
+ ⚠️ **Test Writing Guardrail:** If postmortem identifies missing tests, ASK: "Want me to create regression test tasks? [Y/n]"
235
+
236
+ ## Cross-Skill Dispatch
237
+
238
+ - **Triggered by:** `/draft:new-track` when incident keywords detected in description
239
+ - **Postmortem feeds into:** `/draft:regression` (find the breaking commit), `/draft:learn` (update guardrails)
240
+ - **Can create:** Bug track via `/draft:new-track` for the fix
241
+
242
+ ## Error Handling
243
+
244
+ **If no incident file found (update/postmortem mode):** List available incidents, ask which one
245
+ **If no Jira ticket:** Proceed without sync, note: "Link a Jira ticket for automatic sync"