@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,146 @@
|
|
|
1
|
+
# Pattern Learning — Post-Analysis Phase
|
|
2
|
+
|
|
3
|
+
Shared procedure for auto-discovering coding patterns after quality analysis. Run as the final phase of `/draft:bughunt`, `/draft:deep-review`, and `/draft:review`.
|
|
4
|
+
|
|
5
|
+
Referenced by: `/draft:bughunt`, `/draft:deep-review`, `/draft:review`, `/draft:learn`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to Run
|
|
10
|
+
|
|
11
|
+
Execute this phase **after** the main analysis and report generation are complete. This phase updates `draft/guardrails.md` with newly discovered patterns.
|
|
12
|
+
|
|
13
|
+
**Skip this phase if:**
|
|
14
|
+
- `draft/` directory does not exist (no Draft context)
|
|
15
|
+
- Analysis found zero findings to learn from
|
|
16
|
+
- Running in a read-only or preview mode
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 1: Identify Pattern Candidates
|
|
21
|
+
|
|
22
|
+
Review the findings from the just-completed analysis and identify:
|
|
23
|
+
|
|
24
|
+
### Convention Candidates (patterns to NOT flag in future)
|
|
25
|
+
|
|
26
|
+
Look for patterns that were **considered during analysis but determined to be intentional**:
|
|
27
|
+
|
|
28
|
+
- Patterns checked during the Pattern Prevalence Check that were found >3x and all instances were correct
|
|
29
|
+
- Patterns that matched a framework idiom confirmed by documentation
|
|
30
|
+
- Patterns flagged as MEDIUM confidence but verified as intentional after investigation
|
|
31
|
+
- Recurring code structures that follow a consistent project convention
|
|
32
|
+
|
|
33
|
+
### Anti-Pattern Candidates (patterns to ALWAYS flag in future)
|
|
34
|
+
|
|
35
|
+
Look for patterns that were **confirmed as bugs across multiple locations**:
|
|
36
|
+
|
|
37
|
+
- Bug patterns found in 3+ locations with the same root cause
|
|
38
|
+
- Patterns that violate documented invariants consistently
|
|
39
|
+
- Security or reliability patterns that appeared as confirmed bugs
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Step 2: Apply Confidence Threshold
|
|
44
|
+
|
|
45
|
+
| Evidence | Confidence | Action |
|
|
46
|
+
|----------|------------|--------|
|
|
47
|
+
| Pattern found 1-2x | — | Do not learn (insufficient data) |
|
|
48
|
+
| Pattern found 3-5x, all consistent | `medium` | Add to guardrails.md |
|
|
49
|
+
| Pattern found >5x, all consistent, verified across multiple files | `high` | Add to guardrails.md, suggest promotion |
|
|
50
|
+
| Pattern found >5x but some instances are buggy | — | Do NOT learn (inconsistent — real problem exists) |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Step 3: Check for Duplicates
|
|
55
|
+
|
|
56
|
+
Before adding a new entry to `draft/guardrails.md`:
|
|
57
|
+
|
|
58
|
+
1. Read current `draft/guardrails.md`
|
|
59
|
+
2. Check if the pattern already exists under Learned Conventions or Learned Anti-Patterns
|
|
60
|
+
3. If it exists:
|
|
61
|
+
- Update `last_verified` and `last_active` dates
|
|
62
|
+
- Increase evidence count if new instances were found
|
|
63
|
+
- Upgrade confidence from `medium` → `high` if threshold met
|
|
64
|
+
- Preserve original `discovered_at` and `established_at` dates (never overwrite these)
|
|
65
|
+
4. If it does NOT exist: append as new entry with all four timestamps populated
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Step 4: Write to guardrails.md
|
|
70
|
+
|
|
71
|
+
### 4.0: Update Project Metadata
|
|
72
|
+
|
|
73
|
+
Before writing entries, update `draft/metadata.json` with the current git state — this is the single source of truth for `synced_to_commit` and all `git.*` fields for project-level artifacts including `guardrails.md`. Use `git-metadata.sh --project-metadata --generated-by "draft:learn"` or update `git.commit`, `git.commit_short`, `git.commit_date`, `git.commit_message`, and `synced_to_commit` manually. Do NOT write these fields to `guardrails.md` frontmatter (WS-8).
|
|
74
|
+
|
|
75
|
+
### Convention Entry Format
|
|
76
|
+
|
|
77
|
+
Append under `## Learned Conventions`:
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
### [Pattern Name]
|
|
81
|
+
- **Category:** error-handling | naming | architecture | concurrency | state-management | data-flow | testing | configuration
|
|
82
|
+
- **Confidence:** high | medium
|
|
83
|
+
- **Evidence:** Found in N files — `path/file1.ext:line`, `path/file2.ext:line`, `path/file3.ext:line`
|
|
84
|
+
- **Discovered at:** YYYY-MM-DD (when Draft first observed this pattern)
|
|
85
|
+
- **Established at:** YYYY-MM-DD (when the pattern entered the codebase, via git blame)
|
|
86
|
+
- **Last verified:** YYYY-MM-DD
|
|
87
|
+
- **Last active:** YYYY-MM-DD (when source files containing this pattern were last modified)
|
|
88
|
+
- **Discovered by:** draft:[command] on YYYY-MM-DD
|
|
89
|
+
- **Description:** [What the pattern is and why it's intentional]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Anti-Pattern Entry Format
|
|
93
|
+
|
|
94
|
+
Append under `## Learned Anti-Patterns`:
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
### [Anti-Pattern Name]
|
|
98
|
+
- **Category:** security | reliability | performance | correctness | concurrency
|
|
99
|
+
- **Severity:** critical | high | medium
|
|
100
|
+
- **graph_severity:** critical | high | medium | low | unresolved (derived from fanIn of evidence files; "unresolved" if no graph data available)
|
|
101
|
+
- **high_fanin_files:** `path/file.go` (fanIn:12), `path/other.go` (fanIn:7) (omit line if none meet fanIn ≥ 5)
|
|
102
|
+
- **Evidence:** Found in N files — `path/file1.ext:line`, `path/file2.ext:line`
|
|
103
|
+
- **Discovered at:** YYYY-MM-DD (when Draft first observed this pattern)
|
|
104
|
+
- **Established at:** YYYY-MM-DD (when the pattern entered the codebase, via git blame)
|
|
105
|
+
- **Last verified:** YYYY-MM-DD
|
|
106
|
+
- **Last active:** YYYY-MM-DD (when source files containing this pattern were last modified)
|
|
107
|
+
- **Discovered by:** draft:[command] on YYYY-MM-DD
|
|
108
|
+
- **Description:** [What the pattern is and why it's problematic]
|
|
109
|
+
- **Suggested fix:** [Brief description of the correct approach]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`graph_severity` derivation rules (from `draft/graph/hotspots.jsonl` fanIn values):
|
|
113
|
+
- fanIn ≥ 10 in any evidence file → `critical`
|
|
114
|
+
- fanIn 5–9 → `high`
|
|
115
|
+
- fanIn 1–4 → `medium`
|
|
116
|
+
- fanIn 0 or file not in hotspots.jsonl → `low`
|
|
117
|
+
- Graph data absent → `unresolved`
|
|
118
|
+
|
|
119
|
+
When `graph_severity` differs from `severity`, use `graph_severity` as the enforcement priority — it is objective and graph-derived.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Step 5: Report Learning Summary
|
|
124
|
+
|
|
125
|
+
After updating guardrails.md, append a brief learning summary to the end of the quality report:
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
## Pattern Learning
|
|
129
|
+
|
|
130
|
+
| Action | Count | Details |
|
|
131
|
+
|--------|-------|---------|
|
|
132
|
+
| New conventions learned | N | [names] |
|
|
133
|
+
| New anti-patterns learned | N | [names] |
|
|
134
|
+
| Existing patterns re-verified | N | [names] |
|
|
135
|
+
| Promotion candidates (high confidence) | N | [names] |
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Constraints
|
|
141
|
+
|
|
142
|
+
- **Never auto-promote** learned patterns to Hard Guardrails — that requires human decision via `/draft:learn promote`
|
|
143
|
+
- **Never remove** existing entries — only update evidence/confidence/dates
|
|
144
|
+
- **Cap at 50 learned entries** per section — if at capacity, replace the oldest `medium` confidence entry that hasn't been re-verified in 90+ days
|
|
145
|
+
- **Human-curated always wins** — Hard Guardrails and `tech-stack.md ## Accepted Patterns` take precedence over learned patterns if there's a conflict
|
|
146
|
+
- **Preserve project metadata** — update `draft/metadata.json:synced_to_commit` when modifying `guardrails.md`; do NOT write `synced_to_commit` to `guardrails.md` frontmatter (WS-8)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
shared: red-flags
|
|
3
|
+
applies_to: all code-touching skills
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Shared Red Flags
|
|
7
|
+
|
|
8
|
+
Cross-skill red flags that any code-touching skill must enforce. Skills include their own skill-specific red flags **in addition to** the universal block below. The graph-first red flags are non-negotiable — they protect correctness against premature `grep`/`find` fallbacks that miss structural truth.
|
|
9
|
+
|
|
10
|
+
Referenced by: `/draft:decompose`, `/draft:implement`, `/draft:review`, `/draft:deep-review`, `/draft:quick-review`, `/draft:bughunt`, `/draft:debug`, `/draft:learn`, `/draft:tech-debt`, `/draft:deploy-checklist`, `/draft:new-track`.
|
|
11
|
+
|
|
12
|
+
## Universal Red Flags (STOP if any apply)
|
|
13
|
+
|
|
14
|
+
- **Ran `grep`/`find`/`rg` for symbol or file discovery before consulting the graph** (when `draft/graph/schema.yaml` exists).
|
|
15
|
+
- **Read more than 50 lines of source before consulting `draft/graph/hotspots.jsonl`** to know whether the file is a hotspot.
|
|
16
|
+
- **Omitted the Graph Usage Report footer** from the final output (see [graph-query.md](graph-query.md) §Mandatory Lookup Contract).
|
|
17
|
+
- **Used a `grep` fallback without an explicit graph-miss statement** in the form: `Graph returned no match for <X>; falling back to grep.`
|
|
18
|
+
- **Loaded full Layer 0.5 guardrails when the command type does not require them** (see selective-loading matrix in [draft-context-loading.md](draft-context-loading.md) §Layer 0.5).
|
|
19
|
+
- **Marked a task complete without verification evidence** (test run, build output, lint output — pasted, not summarized).
|
|
20
|
+
- **Made up file paths or line numbers** instead of reading the file (`file_path:line_number` references must resolve).
|
|
21
|
+
|
|
22
|
+
## Ground-Truth Red Flags (STOP if any apply)
|
|
23
|
+
|
|
24
|
+
These enforce [graph-query.md](graph-query.md) §Ground-Truth Discipline. Graph identifies candidates; Read confirms them. Shipping unread claims is the dominant correctness failure mode observed in Draft output.
|
|
25
|
+
|
|
26
|
+
- **Wrote a `path:line` / `func()` / `symbol` reference into a deliverable without opening the file in this run.** Graph hit ≠ Read. (G1)
|
|
27
|
+
- **Declared something in-scope or out-of-scope without Reading at least one file in that path.** Module names from `architecture.json` are a candidate set, not proof that the candidate contains the named cost. (G2)
|
|
28
|
+
- **Shipped `Citation: TBD` / `Path: TBD` / `Symbol: TBD` on a row whose Status is `Modified` or `Existing`.** TBD is reserved for `Status: New` rows with a planned path filled in. (G3)
|
|
29
|
+
- **Claimed code behavior (writes / blocks / loops / fails / is the only path) from graph metadata alone.** Fan-in / fan-out / complexity scores are necessary signal, not sufficient evidence. (G4)
|
|
30
|
+
- **Promoted a spec / generated an HLD or LLD / closed a review without checking that the in-scope file set covers every cost term in the problem statement.** Silent scope narrowing that excludes the named cost is the highest-impact failure class. (G5)
|
|
31
|
+
- **Treated a graph query result as the terminal answer.** Graph is the index; the source files are the territory. Every claim that survives to a deliverable needs at least one Read behind it.
|
|
32
|
+
|
|
33
|
+
When in doubt, prefer "not yet validated against source" over an unbacked assertion. A flagged uncertainty is reviewable; a confident wrong claim is not.
|
|
34
|
+
|
|
35
|
+
## Graph-First Lookup Order (non-negotiable)
|
|
36
|
+
|
|
37
|
+
1. **Graph first** — the committed snapshot (`draft/graph/architecture.json`, `draft/graph/hotspots.jsonl`) and the live query tools (`scripts/tools/graph-callers.sh`, `graph-impact.sh`, `cycle-detect.sh`, `hotspot-rank.sh`).
|
|
38
|
+
2. **Generated context second** — `draft/.ai-context.md`, relevant `draft/architecture.md` slices, track-level `hld.md`/`lld.md`.
|
|
39
|
+
3. **Source file reads third** — only narrowed targets identified via graph or generated context.
|
|
40
|
+
4. **Filesystem `grep`/`find` last** — only after a graph miss, with the explicit fallback sentence above.
|
|
41
|
+
|
|
42
|
+
Using a lower tier before a higher tier is a **Red Flag** and must be reported in the skill's Graph Usage Report (justification required).
|
|
43
|
+
|
|
44
|
+
## How to Extend
|
|
45
|
+
|
|
46
|
+
Skill-specific red flags live in the skill's `SKILL.md` under `## Red Flags - STOP if you're:`. Skills should not duplicate the universal block above — instead they reference this file:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Red Flags - STOP if you're:
|
|
50
|
+
|
|
51
|
+
See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
|
|
52
|
+
|
|
53
|
+
Skill-specific:
|
|
54
|
+
- <skill-specific red flag>
|
|
55
|
+
- <skill-specific red flag>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This keeps boilerplate centralized while leaving room for skill-specific guardrails.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
shared: template-contract
|
|
3
|
+
applies_to: quality + init + graph skills
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Template Contract
|
|
7
|
+
|
|
8
|
+
Tracks under `draft/tracks/<id>/` must conform to the artifact set and section headers in `core/templates/`. Enforcement tools:
|
|
9
|
+
|
|
10
|
+
| Tool | Purpose |
|
|
11
|
+
|------|---------|
|
|
12
|
+
| `scripts/tools/diff-templates-vs-tracks.sh` | Missing files, section headers, removed 2.0 fields |
|
|
13
|
+
| `scripts/tools/check-track-hygiene.sh` | Status parity, author placeholders, TBD budget, plan staleness |
|
|
14
|
+
| `scripts/tools/check-scope-conflicts.sh` | Overlapping `scope_includes` without mutual exclusion |
|
|
15
|
+
| `scripts/tools/verify-citations.sh` | `path:line` citations vs `synced_to_commit` |
|
|
16
|
+
| `scripts/tools/verify-doc-anchors.sh` | Internal `§` / `#anchor` references |
|
|
17
|
+
|
|
18
|
+
See [verification-gates.md](verification-gates.md) for the canonical WS-9 gate chain and [template-hygiene.md](template-hygiene.md) for hygiene rules.
|
|
19
|
+
|
|
20
|
+
**Required track artifacts (2.0):** `spec.md`, `plan.md`, `hld.md`, `lld.md`, `metadata.json`, `discovery.md`.
|
|
21
|
+
|
|
22
|
+
**Scope fields:** `metadata.json:scope_includes` / `scope_excludes` (or spec frontmatter fallback) define track footprint; conflicts block parallel work without explicit exclusion.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
shared: template-hygiene
|
|
3
|
+
applies_to: quality + init + graph skills
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# template-hygiene (Foundations Stub)
|
|
7
|
+
|
|
8
|
+
Portable generalized stub per manifest §2.1. Full content will be expanded in later agent tranche or manual follow-up.
|
|
9
|
+
|
|
10
|
+
See verification-gates.md and template-hygiene.md for usage contracts.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
shared: tool-resolver
|
|
3
|
+
applies_to: quality + init + graph skills
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# tool-resolver (Foundations Stub)
|
|
7
|
+
|
|
8
|
+
Portable generalized stub per manifest §2.1. Full content will be expanded in later agent tranche or manual follow-up.
|
|
9
|
+
|
|
10
|
+
See verification-gates.md and template-hygiene.md for usage contracts.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# VCS Command Abstraction
|
|
2
|
+
|
|
3
|
+
Shared procedure for VCS write operations across all Draft skills. Draft is GitHub-first and uses the standard `git` CLI throughout.
|
|
4
|
+
|
|
5
|
+
Referenced by: All skills that execute VCS write operations (`/draft:implement`, `/draft:revert`, `/draft:new-track`).
|
|
6
|
+
|
|
7
|
+
## Standard Operations
|
|
8
|
+
|
|
9
|
+
| Operation | Command |
|
|
10
|
+
|-------------------|------------------------------------------|
|
|
11
|
+
| Stage files | `git add <files>` |
|
|
12
|
+
| Remove files | `git rm <files>` |
|
|
13
|
+
| Commit | `git commit -m "<message>"` |
|
|
14
|
+
| Reset | `git reset --soft <ref>` |
|
|
15
|
+
| Revert | `git revert --no-commit <sha>` |
|
|
16
|
+
| Checkout branch | `git checkout -b <branch>` |
|
|
17
|
+
| Pull | `git pull` |
|
|
18
|
+
| Push (new branch) | `git push -u origin <branch>` |
|
|
19
|
+
| Push (existing) | `git push` |
|
|
20
|
+
| Rebase | `git rebase <ref>` |
|
|
21
|
+
|
|
22
|
+
### Read Operations
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git diff [options] # Diff (staged, unstaged, ranges)
|
|
26
|
+
git log [options] # History
|
|
27
|
+
git rev-parse [options] # SHA resolution
|
|
28
|
+
git branch --show-current # Current branch name
|
|
29
|
+
git status --porcelain # Machine-readable status
|
|
30
|
+
git ls-files [pattern] # File listing
|
|
31
|
+
git diff --cached --quiet # Check if anything staged
|
|
32
|
+
git rev-list [range] # Commit listing
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Commit Message Convention
|
|
38
|
+
|
|
39
|
+
Draft uses [Conventional Commits](https://www.conventionalcommits.org/) for traceability:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
<type>(<track_id>): <description>
|
|
43
|
+
|
|
44
|
+
[optional body]
|
|
45
|
+
|
|
46
|
+
[optional footer(s)]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Common `<type>` values: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `perf`.
|
|
50
|
+
|
|
51
|
+
Footer fields (when applicable):
|
|
52
|
+
- `Refs: <issue or PR number>` — link to issue tracker
|
|
53
|
+
- `Co-Authored-By: <name> <email>` — for AI-assisted commits
|
|
54
|
+
|
|
55
|
+
If a Jira ticket is linked in `spec.md`, include it in the body or footer:
|
|
56
|
+
```
|
|
57
|
+
feat(add-auth): implement OAuth2 callback
|
|
58
|
+
|
|
59
|
+
Refs: ENG-1234
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Branch Creation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git checkout -b <track_id>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Track IDs are kebab-case (e.g., `add-user-auth`, `fix-login-bug`). They become the branch name directly.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Push for Review
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git push -u origin <branch>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then open a PR via the `gh` CLI or the GitHub web UI:
|
|
81
|
+
```bash
|
|
82
|
+
gh pr create --title "<title>" --body "<description>"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The PR title should match the track title from `spec.md`. The body should reference the track and include the standard test plan.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Verification Gates
|
|
90
|
+
|
|
91
|
+
Before any push or PR creation, skills run the project's test/lint commands as defined in `draft/workflow.md` → `## Verification`. Common gates:
|
|
92
|
+
|
|
93
|
+
- `make test` or `npm test` / `pytest` / `cargo test` — unit tests
|
|
94
|
+
- `make lint` or `npm run lint` / `ruff` / `cargo clippy` — static analysis
|
|
95
|
+
- `make build` or framework-specific build — type-check / compile
|
|
96
|
+
|
|
97
|
+
If `workflow.md` does not specify gates, skills detect the test framework via `scripts/tools/detect-test-framework.sh` and use sensible defaults.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Verification Gates
|
|
2
|
+
|
|
3
|
+
> Shared block defining the validator chain every track passes through
|
|
4
|
+
> before promoting status. Imported by quality and implementation flows
|
|
5
|
+
> that gate on artifact correctness.
|
|
6
|
+
|
|
7
|
+
## The chain
|
|
8
|
+
|
|
9
|
+
Run in this order. Single non-zero exit aborts the chain.
|
|
10
|
+
|
|
11
|
+
| Step | Tool | What it checks |
|
|
12
|
+
|------|------|----------------|
|
|
13
|
+
| 1 | `scripts/tools/check-track-hygiene.sh` | status parity, author resolution, approver placeholders, TBD budget vs `metadata.json:status`, plan staleness vs HLD/LLD |
|
|
14
|
+
| 2 | `scripts/tools/verify-citations.sh` | every `path:line` resolves against `metadata.json:synced_to_commit` (±tolerance) |
|
|
15
|
+
| 3 | `scripts/tools/verify-doc-anchors.sh` | `§X.Y` references and `<doc>.md#anchor` links resolve |
|
|
16
|
+
| 4 | `scripts/tools/check-graph-usage-report.sh` | Graph Usage Report footer present and well-formed |
|
|
17
|
+
| 5 | `scripts/tools/check-scope-conflicts.sh` | no overlap with adjacent tracks under same scope tags |
|
|
18
|
+
| 6 | `scripts/tools/diff-templates-vs-tracks.sh` | no drift between track and current template schema |
|
|
19
|
+
|
|
20
|
+
## Output convention
|
|
21
|
+
|
|
22
|
+
Each tool emits:
|
|
23
|
+
|
|
24
|
+
- exit code 0/1 (clean / violations)
|
|
25
|
+
- text mode by default; `--json` for machine-readable
|
|
26
|
+
- one line per violation: `[<kind>] <track>/<file>:<line> — <detail>`
|
|
27
|
+
|
|
28
|
+
## Result persistence
|
|
29
|
+
|
|
30
|
+
After the chain runs, persist the outcome to `metadata.json:pre_deploy_status`:
|
|
31
|
+
|
|
32
|
+
- `unrun` — chain has never executed against this track
|
|
33
|
+
- `passing` — last run exited 0
|
|
34
|
+
- `failing` — last run exited 1; details in CI log
|
|
35
|
+
- `bypassed` — explicit override; requires `bypass_reason` in metadata
|
|
36
|
+
|
|
37
|
+
`/draft:deploy-checklist` reads this field and refuses to deploy a track
|
|
38
|
+
whose `pre_deploy_status != passing`.
|
|
39
|
+
|
|
40
|
+
## When to invoke
|
|
41
|
+
|
|
42
|
+
- `/draft:deploy-checklist` — mandatory before any production deploy.
|
|
43
|
+
- `/draft:implement` — at the end of each phase before flipping
|
|
44
|
+
`phases.completed`.
|
|
45
|
+
- `/draft:decompose` — after rewriting `plan.md`, to catch plan-staleness
|
|
46
|
+
immediately.
|
|
47
|
+
- CI hook — gate every merge that touches `tracks/**`.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Template Schema Changelog
|
|
2
|
+
|
|
3
|
+
Semver-style change log for the schema defined by files under `core/templates/`.
|
|
4
|
+
Tracks are generated from these templates by `skills/new-track`, `skills/decompose`,
|
|
5
|
+
and downstream skills. Any change here is a contract change consumed by every
|
|
6
|
+
downstream repo. Major bumps require a `scripts/tools/migrate-track-frontmatter.sh`
|
|
7
|
+
migration path.
|
|
8
|
+
|
|
9
|
+
## How template versions are referenced
|
|
10
|
+
|
|
11
|
+
- `metadata.json` carries the optional field `template_version` (semver string).
|
|
12
|
+
- Validators in `scripts/tools/` (hygiene, citations, anchors, scope-conflicts,
|
|
13
|
+
graph-usage-report) read this field and refuse to lint tracks whose
|
|
14
|
+
`template_version` major-bumps past the validator's known schema.
|
|
15
|
+
|
|
16
|
+
## Shared blocks each template depends on
|
|
17
|
+
|
|
18
|
+
| Template | Depends on (under `core/shared/`) |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `spec.md` | `template-contract.md`, `template-hygiene.md`, `discovery-schema.md` (back-link), `verification-gates.md` |
|
|
21
|
+
| `hld.md` | `template-contract.md`, `template-hygiene.md`, `graph-query.md`, `verification-gates.md` |
|
|
22
|
+
| `lld.md` | `template-contract.md`, `template-hygiene.md`, `graph-query.md`, `verification-gates.md` |
|
|
23
|
+
| `plan.md` | `template-contract.md`, `template-hygiene.md`, `verification-gates.md` |
|
|
24
|
+
| `metadata.json` | `template-contract.md` (canonical schema for ephemeral fields) |
|
|
25
|
+
| `discovery.md` | `discovery-schema.md` |
|
|
26
|
+
|
|
27
|
+
Templates are markdown-only (and JSON for `metadata.json`). Viewer artifacts
|
|
28
|
+
(HTML/PDF) are rendered on demand by `scripts/tools/render-track.sh` and are
|
|
29
|
+
git-ignored at the track level. No HTML or PDF templates ship here.
|
|
30
|
+
|
|
31
|
+
## Versions
|
|
32
|
+
|
|
33
|
+
### 2.0.0 — Templates-as-contract baseline
|
|
34
|
+
|
|
35
|
+
- **Breaking:** Introduces parseable sentinel placeholders (`_TBD_<field>_`,
|
|
36
|
+
`_PLACEHOLDER_<kind>_`). Silent placeholders such as `Author1`,
|
|
37
|
+
`xxx@example.com`, pre-checked `Status: [x] Complete` are forbidden.
|
|
38
|
+
- **Breaking:** Introduces `<!-- REQUIRED -->` and `<!-- OPTIONAL -->` markers
|
|
39
|
+
next to authorable fields. Hygiene validator gates `ready-for-review` on the
|
|
40
|
+
required set being populated; optional fields may carry sentinels indefinitely.
|
|
41
|
+
- **New:** `core/templates/discovery.md` becomes a first-class artifact.
|
|
42
|
+
- **New:** `core/templates/CHANGELOG.md` (this file) and
|
|
43
|
+
`core/shared/template-contract.md` (narrative + field index).
|
|
44
|
+
- **New:** Scope frontmatter — `scope_includes: []`, `scope_excludes: []`.
|
|
45
|
+
Lives on `spec.md` and mirrored into `metadata.json`.
|
|
46
|
+
- **New:** Table columns required by WS-7 — `concurrency_model`,
|
|
47
|
+
`aggregate_resource_cap`, `derived_from`, `mitigation_test_id`, `test_id`,
|
|
48
|
+
`entry_gate_command`, `exit_gate_command`, `owner`, `flag_name`,
|
|
49
|
+
`cluster_feature_gate`, `kill_switch_test_id`, `runbook_link`,
|
|
50
|
+
`sunset_criteria`, `promote_to_adr`, `lock_acquired`, `reentrant`,
|
|
51
|
+
`fault_injection_site`.
|
|
52
|
+
- **New:** `<!-- DECOMPOSE:REGENERATE START -->` / `<!-- ... END -->` markers
|
|
53
|
+
in `plan.md` so `draft:decompose` can rewrite phase tables without clobbering
|
|
54
|
+
manual notes outside the markers.
|
|
55
|
+
- **New:** `<!-- META:<key> -->` directives in `spec.md`, `hld.md`, `lld.md`,
|
|
56
|
+
`plan.md` that pull ephemeral fields from `metadata.json` at render time.
|
|
57
|
+
- **Breaking:** Ephemeral fields stripped from per-file YAML frontmatter —
|
|
58
|
+
`git.*`, `synced_to_commit`, `classification.*`, `status`. They live solely
|
|
59
|
+
in `metadata.json` from this version forward.
|
|
60
|
+
- **Migration:** `scripts/tools/migrate-track-frontmatter.sh` rewrites pre-2.0
|
|
61
|
+
tracks in place (idempotent; emits `.bak`).
|
|
62
|
+
- **Validators:** any commit touching `skills/**` or `scripts/tools/**` that
|
|
63
|
+
affects artifact schema must also touch `core/templates/**`, or carry
|
|
64
|
+
`[template-noop]` in the commit message.
|
|
65
|
+
|
|
66
|
+
### 1.x.y — pre-baseline (historical)
|
|
67
|
+
|
|
68
|
+
- See `git log -- core/templates/` for changes before 2.0.0. No formal version
|
|
69
|
+
tagging; downstream consumers relied on `generated_by` and `generated_at`
|
|
70
|
+
frontmatter only.
|