@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,4 @@
1
+ # Guardrails — dependency-triage (Foundations Stub)
2
+
3
+ Generalized public Draft baseline. Full ruleset ported from internal systems in subsequent work.
4
+ See core/guardrails.md for entry point and loading rules.
@@ -0,0 +1,4 @@
1
+ # Guardrails — design-norms (Foundations Stub)
2
+
3
+ Generalized public Draft baseline. Full ruleset ported from internal systems in subsequent work.
4
+ See core/guardrails.md for entry point and loading rules.
@@ -0,0 +1,4 @@
1
+ # Guardrails — language-standards (Foundations Stub)
2
+
3
+ Generalized public Draft baseline. Full ruleset ported from internal systems in subsequent work.
4
+ See core/guardrails.md for entry point and loading rules.
@@ -0,0 +1,4 @@
1
+ # Guardrails — review-checks (Foundations Stub)
2
+
3
+ Generalized public Draft baseline. Full ruleset ported from internal systems in subsequent work.
4
+ See core/guardrails.md for entry point and loading rules.
@@ -0,0 +1,4 @@
1
+ # Guardrails — secure-patterns (Foundations Stub)
2
+
3
+ Generalized public Draft baseline. Full ruleset ported from internal systems in subsequent work.
4
+ See core/guardrails.md for entry point and loading rules.
@@ -0,0 +1,4 @@
1
+ # Guardrails — security (Foundations Stub)
2
+
3
+ Generalized public Draft baseline. Full ruleset ported from internal systems in subsequent work.
4
+ See core/guardrails.md for entry point and loading rules.
@@ -0,0 +1,22 @@
1
+ # Guardrails — Baseline Ruleset
2
+
3
+ > **See also:** [`core/guardrails/README.md`](guardrails/README.md) for the full rule reference (SEC/CQ/DN/RC IDs) and precedence. This file contains the generalized systems programming guardrails and is loaded for C/C++ projects when language signals indicate. For other languages, see `core/guardrails/language-standards.md`. Generalized for public Draft (language-agnostic where possible) per manifest §2.1.
4
+
5
+ Mandatory baseline guardrails for quality commands. All quality commands (`/draft:bughunt`, `/draft:review`, `/draft:deep-review`, `/draft:quick-review`, `/draft:implement`, `/draft:debug`, `/draft:assist-review`) **must** enforce these rules where applicable. Violations are always flagged — no exceptions.
6
+
7
+ These guardrails are pre-seeded into every project's `draft/guardrails.md` by `/draft:init` and loaded at runtime via `core/shared/draft-context-loading.md` Layer 0.5.
8
+
9
+ **Source:** Generalized from proven internal systems guidelines.
10
+
11
+ ---
12
+
13
+ ## G1 — Object Lifecycle & Memory Safety (C++ example; opt-in for other stacks via language-standards)
14
+
15
+ ### G1.1: No temporary strings in Printf-style trace APIs
16
+
17
+ Passing `.c_str()` of a temporary to `Printf`-style APIs that store format arguments by reference creates a dangling pointer. The temporary is destroyed at the end of the statement; the stored pointer becomes invalid.
18
+
19
+ - **Wrong:** `mem_tracer_->Printf("Bug: %s", my_proto->ShortDebugString().c_str());`
20
+ - **Fix:** Use `Print(StringPrintf(...))` when arguments include short-lived `.c_str()` pointers.
21
+
22
+ (Additional G rules generalized/conditioned; full list in language-standards.md for non-C++ and the plugin guardrails sub-system.)
@@ -0,0 +1,127 @@
1
+ # Knowledge Base
2
+
3
+ AI guidance during track creation must be grounded in vetted sources. When providing advice, cite the source to ensure credibility and traceability.
4
+
5
+ ---
6
+
7
+ ## Books
8
+
9
+ ### Architecture & Design
10
+ - **Domain-Driven Design** (Eric Evans) — Bounded contexts, ubiquitous language, aggregates, strategic design
11
+ - **Clean Architecture** (Robert Martin) — Dependency rule, boundaries, use cases, separation of concerns
12
+ - **Designing Data-Intensive Applications** (Martin Kleppmann) — Data models, replication, partitioning, consistency, stream processing
13
+ - **Building Evolutionary Architectures** (Ford, Parsons, Kua) — Fitness functions, incremental change, architectural governance
14
+
15
+ ### Reliability & Operations
16
+ - **Release It!** (Michael Nygard) — Stability patterns, circuit breakers, bulkheads, timeouts, failure modes
17
+ - **Site Reliability Engineering** (Google) — SLOs, error budgets, toil reduction, incident response
18
+ - **The Phoenix Project** (Kim, Behr, Spafford) — Flow, feedback, continuous improvement
19
+
20
+ ### Craft & Practice
21
+ - **The Pragmatic Programmer** (Hunt, Thomas, 20th Anniversary ed., 2019) — Tracer bullets, DRY, orthogonality, good enough software
22
+ - **Clean Code** (Robert Martin) — Naming, functions, error handling, code smells
23
+ - **Refactoring** (Martin Fowler, 2nd ed., 2018) — Code smells, refactoring patterns, incremental improvement
24
+ - **Working Effectively with Legacy Code** (Michael Feathers) — Seams, characterization tests, breaking dependencies
25
+
26
+ ### Microservices & Distribution
27
+ - **Building Microservices** (Sam Newman, 2nd ed., 2021) — Service boundaries, decomposition, communication patterns
28
+ - **Microservices Patterns** (Chris Richardson) — Saga, CQRS, event sourcing, API gateway
29
+ - **Enterprise Integration Patterns** (Hohpe, Woolf) — Messaging, routing, transformation, endpoints
30
+
31
+ ### Testing
32
+ - **Growing Object-Oriented Software, Guided by Tests** (Freeman, Pryce) — TDD outside-in, mock objects
33
+ - **Unit Testing Principles, Practices, and Patterns** (Khorikov) — Test pyramid, test doubles, maintainable tests
34
+
35
+ ---
36
+
37
+ ## Standards & Principles
38
+
39
+ ### Security
40
+ - **OWASP Top 10** — Injection, broken auth, XSS, insecure deserialization, security misconfiguration
41
+ - **OWASP ASVS** — Application Security Verification Standard, security requirements
42
+ - **OWASP Cheat Sheets** — Specific guidance for auth, session management, input validation
43
+
44
+ ### Design Principles
45
+ - **SOLID** — Single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion
46
+ - **12-Factor App** — Codebase, dependencies, config, backing services, build/release/run, processes, port binding, concurrency, disposability, dev/prod parity, logs, admin processes
47
+ - **KISS / YAGNI / DRY** — Simplicity, avoiding premature abstraction, avoiding duplication
48
+
49
+ ### API Design
50
+ - **REST Constraints** — Stateless, cacheable, uniform interface, layered system
51
+ - **GraphQL Best Practices** — Schema design, resolvers, N+1 prevention
52
+ - **API Versioning Strategies** — URL, header, content negotiation
53
+
54
+ ### Cloud Native
55
+ - **CNCF Patterns** — Containers, service mesh, observability, declarative configuration
56
+ - **GitOps Principles** — Declarative, versioned, automated, auditable
57
+
58
+ ---
59
+
60
+ ## Patterns
61
+
62
+ ### Creational (GoF)
63
+ - Factory, Abstract Factory, Builder, Prototype, Singleton
64
+
65
+ ### Structural (GoF)
66
+ - Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy
67
+
68
+ ### Behavioral (GoF)
69
+ - Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor
70
+
71
+ ### Resilience
72
+ - **Circuit Breaker** — Fail fast, prevent cascade failures
73
+ - **Bulkhead** — Isolate failures, limit blast radius
74
+ - **Retry with Backoff** — Transient failure recovery
75
+ - **Timeout** — Bound wait time, fail deterministically
76
+ - **Fallback** — Graceful degradation
77
+
78
+ ### Data
79
+ - **CQRS** — Separate read/write models
80
+ - **Event Sourcing** — Append-only event log as source of truth
81
+ - **Saga** — Distributed transaction coordination
82
+ - **Outbox** — Reliable event publishing
83
+
84
+ ### Integration (EIP)
85
+ - Message Channel, Message Router, Message Translator, Message Endpoint
86
+ - Publish-Subscribe, Request-Reply, Competing Consumers
87
+ - Dead Letter Channel, Wire Tap, Content-Based Router
88
+
89
+ ---
90
+
91
+ ## Anti-Patterns to Flag
92
+
93
+ ### Distributed Systems
94
+ - **Fallacies of Distributed Computing** — Network reliability, zero latency, infinite bandwidth, secure network, topology stability, single admin, zero transport cost, homogeneous network
95
+ - **Distributed Monolith** — Microservices with tight coupling
96
+ - **Shared Database** — Services coupled through data
97
+
98
+ ### Architecture
99
+ - **Big Ball of Mud** — No discernible structure
100
+ - **Golden Hammer** — Using one solution for everything
101
+ - **Cargo Cult** — Copying patterns without understanding
102
+ - **Premature Optimization** — Optimizing before measuring
103
+
104
+ ### Code
105
+ - **God Class** — Class doing too much
106
+ - **Feature Envy** — Method more interested in other class's data
107
+ - **Shotgun Surgery** — Changes requiring many small edits across codebase
108
+ - **Leaky Abstraction** — Implementation details bleeding through interface
109
+
110
+ ### Security
111
+ - **Security by Obscurity** — Hiding instead of securing
112
+ - **Trust on First Use** — Accepting unverified credentials
113
+ - **Hardcoded Secrets** — Credentials in source code
114
+
115
+ ---
116
+
117
+ ## Citation Format
118
+
119
+ When providing guidance, cite sources naturally:
120
+
121
+ > "Consider CQRS here (DDIA, Ch. 11) — separates read/write concerns which fits your high-read workload."
122
+
123
+ > "This violates the Dependency Rule (Clean Architecture) — domain shouldn't know about infrastructure."
124
+
125
+ > "Watch for N+1 queries (common GraphQL pitfall) — use DataLoader pattern."
126
+
127
+ > "Circuit breaker pattern (Release It!) would help here — fail fast instead of cascading timeouts."