@imix-js/taproot 0.2.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/README.md +88 -0
- package/dist/adapters/index.d.ts +20 -0
- package/dist/adapters/index.js +452 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/acceptance-check.d.ts +26 -0
- package/dist/commands/acceptance-check.js +213 -0
- package/dist/commands/acceptance-check.js.map +1 -0
- package/dist/commands/check-orphans.d.ts +8 -0
- package/dist/commands/check-orphans.js +157 -0
- package/dist/commands/check-orphans.js.map +1 -0
- package/dist/commands/commithook.d.ts +15 -0
- package/dist/commands/commithook.js +389 -0
- package/dist/commands/commithook.js.map +1 -0
- package/dist/commands/coverage.d.ts +41 -0
- package/dist/commands/coverage.js +390 -0
- package/dist/commands/coverage.js.map +1 -0
- package/dist/commands/dod.d.ts +13 -0
- package/dist/commands/dod.js +141 -0
- package/dist/commands/dod.js.map +1 -0
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.js +378 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/link-commits.d.ts +12 -0
- package/dist/commands/link-commits.js +126 -0
- package/dist/commands/link-commits.js.map +1 -0
- package/dist/commands/overview.d.ts +6 -0
- package/dist/commands/overview.js +192 -0
- package/dist/commands/overview.js.map +1 -0
- package/dist/commands/plan.d.ts +23 -0
- package/dist/commands/plan.js +167 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/sync-check.d.ts +8 -0
- package/dist/commands/sync-check.js +118 -0
- package/dist/commands/sync-check.js.map +1 -0
- package/dist/commands/update.d.ts +7 -0
- package/dist/commands/update.js +309 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate-format.d.ts +8 -0
- package/dist/commands/validate-format.js +93 -0
- package/dist/commands/validate-format.js.map +1 -0
- package/dist/commands/validate-structure.d.ts +8 -0
- package/dist/commands/validate-structure.js +29 -0
- package/dist/commands/validate-structure.js.map +1 -0
- package/dist/core/config.d.ts +6 -0
- package/dist/core/config.js +86 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/configuration.d.ts +7 -0
- package/dist/core/configuration.js +112 -0
- package/dist/core/configuration.js.map +1 -0
- package/dist/core/dod-runner.d.ts +20 -0
- package/dist/core/dod-runner.js +233 -0
- package/dist/core/dod-runner.js.map +1 -0
- package/dist/core/dor-runner.d.ts +18 -0
- package/dist/core/dor-runner.js +156 -0
- package/dist/core/dor-runner.js.map +1 -0
- package/dist/core/fs-walker.d.ts +5 -0
- package/dist/core/fs-walker.js +74 -0
- package/dist/core/fs-walker.js.map +1 -0
- package/dist/core/git.d.ts +24 -0
- package/dist/core/git.js +76 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/impl-reader.d.ts +8 -0
- package/dist/core/impl-reader.js +39 -0
- package/dist/core/impl-reader.js.map +1 -0
- package/dist/core/language.d.ts +39 -0
- package/dist/core/language.js +159 -0
- package/dist/core/language.js.map +1 -0
- package/dist/core/markdown-parser.d.ts +3 -0
- package/dist/core/markdown-parser.js +37 -0
- package/dist/core/markdown-parser.js.map +1 -0
- package/dist/core/reporter.d.ts +3 -0
- package/dist/core/reporter.js +33 -0
- package/dist/core/reporter.js.map +1 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/index.js +126 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/validators/format-rules.d.ts +10 -0
- package/dist/validators/format-rules.js +238 -0
- package/dist/validators/format-rules.js.map +1 -0
- package/dist/validators/structure-rules.d.ts +10 -0
- package/dist/validators/structure-rules.js +94 -0
- package/dist/validators/structure-rules.js.map +1 -0
- package/dist/validators/types.d.ts +68 -0
- package/dist/validators/types.js +2 -0
- package/dist/validators/types.js.map +1 -0
- package/docs/agents.md +88 -0
- package/docs/architecture.md +53 -0
- package/docs/cli.md +226 -0
- package/docs/concepts.md +268 -0
- package/docs/configuration.md +255 -0
- package/docs/demo.svg +111 -0
- package/docs/patterns.md +118 -0
- package/docs/security.md +95 -0
- package/docs/workflows.md +151 -0
- package/languages/de.json +20 -0
- package/languages/en.json +20 -0
- package/languages/es.json +20 -0
- package/languages/fr.json +20 -0
- package/languages/ja.json +20 -0
- package/languages/pt.json +20 -0
- package/package.json +54 -0
- package/skills/analyse-change.md +101 -0
- package/skills/behaviour.md +179 -0
- package/skills/bug.md +70 -0
- package/skills/commit.md +99 -0
- package/skills/decompose.md +101 -0
- package/skills/discover.md +392 -0
- package/skills/grill-me.md +65 -0
- package/skills/guide.md +118 -0
- package/skills/implement.md +149 -0
- package/skills/ineed.md +147 -0
- package/skills/intent.md +104 -0
- package/skills/plan.md +63 -0
- package/skills/promote.md +69 -0
- package/skills/refine.md +78 -0
- package/skills/research.md +122 -0
- package/skills/review-all.md +92 -0
- package/skills/review.md +80 -0
- package/skills/status.md +103 -0
- package/skills/sweep.md +89 -0
- package/skills/trace.md +151 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Workflows
|
|
2
|
+
|
|
3
|
+
Taproot supports several development patterns. The right starting point depends on where you are: building something new, fixing a bug, joining an existing project, or onboarding a codebase that has no specs yet.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## I have an idea or requirement
|
|
8
|
+
|
|
9
|
+
Use `/tr-ineed` when you have a requirement but aren't sure where it belongs in the hierarchy, or when the requirement is vague and needs sharpening before you can write a spec.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/tr-ineed "users need to be able to export their data as CSV"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The agent classifies the requirement (clear vs. vague), searches the existing hierarchy for near-duplicates, and proposes the right placement. If the requirement is ambiguous or under-specified, it runs a structured discovery conversation — problem, persona, success criteria, scope boundary — before proposing a placement. It then calls `/tr-intent` or `/tr-behaviour` to write the actual document.
|
|
16
|
+
|
|
17
|
+
If you already know what you want and where it goes, skip `/tr-ineed` and call `/tr-intent` or `/tr-behaviour` directly.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Building a new feature (top-down)
|
|
22
|
+
|
|
23
|
+
When you're starting from a business goal and working toward code, the typical sequence is:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
/tr-intent "users need to reset their password without contacting support"
|
|
27
|
+
/tr-review taproot/password-reset/intent.md
|
|
28
|
+
/tr-decompose taproot/password-reset/
|
|
29
|
+
/tr-implement taproot/password-reset/request-reset/
|
|
30
|
+
taproot coverage --path taproot/password-reset/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
1. **`/tr-intent`** — writes `intent.md` with goal, stakeholders, and success criteria. Asks clarifying questions before writing.
|
|
34
|
+
2. **`/tr-review`** — stress-tests the intent: challenges success criteria, surfaces scope ambiguity, flags missing stakeholders. Run this before writing behaviours — it's much cheaper to find gaps at the intent level.
|
|
35
|
+
3. **`/tr-decompose`** — breaks the intent into a set of behaviours (UseCases). Each behaviour covers one observable thing the system does. For each proposed behaviour the agent asks a probing question to validate it's a real, testable system behaviour — not a technical module.
|
|
36
|
+
4. **`/tr-implement`** — for one behaviour at a time: writes the code, writes the tests, creates `impl.md`, and commits using the conventional tag format.
|
|
37
|
+
5. **`taproot coverage`** — shows what's implemented vs. still planned.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Fixing a bug or investigating unexpected behaviour (bottom-up)
|
|
42
|
+
|
|
43
|
+
When you're starting from code and need to understand what it's supposed to do:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
/tr-trace src/auth/password-reset.ts
|
|
47
|
+
/tr-refine taproot/password-reset/request-reset/ "missing rate limit allows spam"
|
|
48
|
+
/tr-implement taproot/password-reset/request-reset/
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
1. **`/tr-trace`** — navigates from a source file up through impl → behaviour → intent, showing you the full context: why this code exists, what behaviour it implements, what the success criteria are. Also works top-down (intent → impl) and laterally (sibling behaviours).
|
|
52
|
+
2. **`/tr-refine`** — updates the behaviour spec based on what you found. If the bug reveals a gap in the spec (e.g., rate limiting wasn't specified), refine adds it before you fix the code. This keeps the spec honest.
|
|
53
|
+
3. **`/tr-implement`** — re-implements the behaviour with the updated spec as the source of truth.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Onboarding an existing codebase
|
|
58
|
+
|
|
59
|
+
If your project has working code but no taproot hierarchy, use `/tr-discover` to reverse-engineer one:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/tr-discover
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The skill works in phases:
|
|
66
|
+
|
|
67
|
+
1. **Orient** — reads README, package manifests, and any existing taproot documents to understand the project
|
|
68
|
+
2. **Intents** — proposes top-level business intents one at a time, asking a probing question about each to validate it reflects a real business goal (not just a technical module)
|
|
69
|
+
3. **Behaviours** — for each confirmed intent, reads the source code and proposes use cases as observable system behaviours
|
|
70
|
+
4. **Implementations** — for each confirmed behaviour, identifies source files, tests, and commits, then writes `impl.md`
|
|
71
|
+
|
|
72
|
+
You confirm each proposed item before anything is written. Discovery can be stopped and resumed at any time — it saves a status file after each confirmed item.
|
|
73
|
+
|
|
74
|
+
Use the `depth` argument to limit scope: `intents-only` for a quick intent capture session, `behaviours` to stop before writing impl records.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Health check and maintenance
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
/tr-status
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or via CLI:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
taproot coverage && taproot check-orphans && taproot sync-check
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **`/tr-status`** — an AI-driven health dashboard: coverage by intent, orphaned files, stale specs, unlinked commits. Produces a prioritized list of what to address next.
|
|
91
|
+
- **`taproot coverage`** — counts implementations vs. planned behaviours across the hierarchy.
|
|
92
|
+
- **`taproot check-orphans`** — finds folders missing their marker files, source files that no impl references, and commits not linked to any impl.
|
|
93
|
+
- **`taproot sync-check`** — detects staleness: source files modified after the `impl.md` was last verified, or specs reviewed after the implementation was completed.
|
|
94
|
+
|
|
95
|
+
Run these before a release, after a refactor, or when you suspect the specs have drifted from the code.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Keeping specs current after implementation
|
|
100
|
+
|
|
101
|
+
Implementations teach you things the spec didn't anticipate — edge cases, performance constraints, API quirks. Capture those learnings:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
/tr-refine taproot/password-reset/request-reset/ "discovered that the email service has a 10s timeout"
|
|
105
|
+
/tr-promote taproot/password-reset/request-reset/ "all email-sending features are constrained by the 10s timeout"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- **`/tr-refine`** — updates a behaviour spec with post-implementation learnings. Preserves the existing spec structure; only adds or adjusts what changed.
|
|
109
|
+
- **`/tr-promote`** — escalates a finding to the intent level. Use when something discovered during implementation has implications for the business goal itself (e.g., a third-party constraint that affects success criteria).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Before making a significant change
|
|
114
|
+
|
|
115
|
+
Before editing a behaviour or intent that already has implementations, assess the impact:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
/tr-analyse-change taproot/password-reset/intent.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The skill walks the hierarchy below the artifact and identifies: which implementations would break, which sibling behaviours share preconditions, and what tests would need updating. Run this before refactoring an intent or splitting a behaviour.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Stress-testing a spec
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
/tr-review taproot/password-reset/request-reset/usecase.md
|
|
129
|
+
/tr-review-all taproot/password-reset/
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- **`/tr-review`** — stress-tests a single artifact: challenges assumptions, asks adversarial questions, identifies coverage gaps and contradictions.
|
|
133
|
+
- **`/tr-review-all`** — comprehensive review of an entire subtree: runs validation, checks orphans and staleness, cross-checks every intent criterion against the behaviours below it, and identifies duplication or contradictions across siblings.
|
|
134
|
+
|
|
135
|
+
Use `/tr-review` on a fresh spec before starting implementation. Use `/tr-review-all` before a release or after significant scope changes.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## When you need to think something through
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
/tr-grill-me
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Use `/tr-grill-me` when you want to stress-test a plan or design before committing it to a spec. The agent interviews you relentlessly — one decision branch at a time, always providing a recommended answer — until you've worked through every significant trade-off. Use it when:
|
|
146
|
+
|
|
147
|
+
- You have a rough idea for an architecture and want to pressure-test it
|
|
148
|
+
- You're about to write an intent for a domain you don't fully understand yet
|
|
149
|
+
- You want to surface assumptions before they become bugs
|
|
150
|
+
|
|
151
|
+
`/tr-grill-me` is a conversation, not a document. It produces a decision summary at the end, which you can use as input to `/tr-intent` or `/tr-behaviour`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Goal": "Ziel",
|
|
3
|
+
"Actor": "Akteur",
|
|
4
|
+
"Preconditions": "Vorbedingungen",
|
|
5
|
+
"Main Flow": "Hauptablauf",
|
|
6
|
+
"Alternate Flows": "Alternative Abläufe",
|
|
7
|
+
"Postconditions": "Nachbedingungen",
|
|
8
|
+
"Error Conditions": "Fehlerfälle",
|
|
9
|
+
"Acceptance Criteria": "Akzeptanzkriterien",
|
|
10
|
+
"Status": "Status",
|
|
11
|
+
"Stakeholders": "Stakeholder",
|
|
12
|
+
"Success Criteria": "Erfolgskriterien",
|
|
13
|
+
"Given": "Gegeben",
|
|
14
|
+
"When": "Wenn",
|
|
15
|
+
"Then": "Dann",
|
|
16
|
+
"specified": "spezifiziert",
|
|
17
|
+
"implemented": "implementiert",
|
|
18
|
+
"complete": "vollständig",
|
|
19
|
+
"active": "aktiv"
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Goal": "Goal",
|
|
3
|
+
"Actor": "Actor",
|
|
4
|
+
"Preconditions": "Preconditions",
|
|
5
|
+
"Main Flow": "Main Flow",
|
|
6
|
+
"Alternate Flows": "Alternate Flows",
|
|
7
|
+
"Postconditions": "Postconditions",
|
|
8
|
+
"Error Conditions": "Error Conditions",
|
|
9
|
+
"Acceptance Criteria": "Acceptance Criteria",
|
|
10
|
+
"Status": "Status",
|
|
11
|
+
"Stakeholders": "Stakeholders",
|
|
12
|
+
"Success Criteria": "Success Criteria",
|
|
13
|
+
"Given": "Given",
|
|
14
|
+
"When": "When",
|
|
15
|
+
"Then": "Then",
|
|
16
|
+
"specified": "specified",
|
|
17
|
+
"implemented": "implemented",
|
|
18
|
+
"complete": "complete",
|
|
19
|
+
"active": "active"
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Goal": "Objetivo",
|
|
3
|
+
"Actor": "Actor",
|
|
4
|
+
"Preconditions": "Precondiciones",
|
|
5
|
+
"Main Flow": "Flujo Principal",
|
|
6
|
+
"Alternate Flows": "Flujos Alternativos",
|
|
7
|
+
"Postconditions": "Postcondiciones",
|
|
8
|
+
"Error Conditions": "Condiciones de Error",
|
|
9
|
+
"Acceptance Criteria": "Criterios de Aceptación",
|
|
10
|
+
"Status": "Estado",
|
|
11
|
+
"Stakeholders": "Partes Interesadas",
|
|
12
|
+
"Success Criteria": "Criterios de Éxito",
|
|
13
|
+
"Given": "Dado",
|
|
14
|
+
"When": "Cuando",
|
|
15
|
+
"Then": "Entonces",
|
|
16
|
+
"specified": "especificado",
|
|
17
|
+
"implemented": "implementado",
|
|
18
|
+
"complete": "completo",
|
|
19
|
+
"active": "activo"
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Goal": "Objectif",
|
|
3
|
+
"Actor": "Acteur",
|
|
4
|
+
"Preconditions": "Préconditions",
|
|
5
|
+
"Main Flow": "Flux Principal",
|
|
6
|
+
"Alternate Flows": "Flux Alternatifs",
|
|
7
|
+
"Postconditions": "Postconditions",
|
|
8
|
+
"Error Conditions": "Conditions d'Erreur",
|
|
9
|
+
"Acceptance Criteria": "Critères d'Acceptation",
|
|
10
|
+
"Status": "Statut",
|
|
11
|
+
"Stakeholders": "Parties Prenantes",
|
|
12
|
+
"Success Criteria": "Critères de Succès",
|
|
13
|
+
"Given": "Étant donné",
|
|
14
|
+
"When": "Quand",
|
|
15
|
+
"Then": "Alors",
|
|
16
|
+
"specified": "spécifié",
|
|
17
|
+
"implemented": "implémenté",
|
|
18
|
+
"complete": "complet",
|
|
19
|
+
"active": "actif"
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Goal": "目標",
|
|
3
|
+
"Actor": "アクター",
|
|
4
|
+
"Preconditions": "前提条件",
|
|
5
|
+
"Main Flow": "メインフロー",
|
|
6
|
+
"Alternate Flows": "代替フロー",
|
|
7
|
+
"Postconditions": "事後条件",
|
|
8
|
+
"Error Conditions": "エラー条件",
|
|
9
|
+
"Acceptance Criteria": "受け入れ基準",
|
|
10
|
+
"Status": "ステータス",
|
|
11
|
+
"Stakeholders": "ステークホルダー",
|
|
12
|
+
"Success Criteria": "成功基準",
|
|
13
|
+
"Given": "前提として",
|
|
14
|
+
"When": "実行時",
|
|
15
|
+
"Then": "結果として",
|
|
16
|
+
"specified": "指定済み",
|
|
17
|
+
"implemented": "実装済み",
|
|
18
|
+
"complete": "完了",
|
|
19
|
+
"active": "アクティブ"
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Goal": "Objetivo",
|
|
3
|
+
"Actor": "Ator",
|
|
4
|
+
"Preconditions": "Pré-condições",
|
|
5
|
+
"Main Flow": "Fluxo Principal",
|
|
6
|
+
"Alternate Flows": "Fluxos Alternativos",
|
|
7
|
+
"Postconditions": "Pós-condições",
|
|
8
|
+
"Error Conditions": "Condições de Erro",
|
|
9
|
+
"Acceptance Criteria": "Critérios de Aceitação",
|
|
10
|
+
"Status": "Status",
|
|
11
|
+
"Stakeholders": "Partes Interessadas",
|
|
12
|
+
"Success Criteria": "Critérios de Sucesso",
|
|
13
|
+
"Given": "Dado",
|
|
14
|
+
"When": "Quando",
|
|
15
|
+
"Then": "Então",
|
|
16
|
+
"specified": "especificado",
|
|
17
|
+
"implemented": "implementado",
|
|
18
|
+
"complete": "completo",
|
|
19
|
+
"active": "ativo"
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@imix-js/taproot",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Folder-based requirement hierarchy with CLI validation and AI skills",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"taproot": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"skills/",
|
|
12
|
+
"languages/",
|
|
13
|
+
"docs/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"requirements",
|
|
18
|
+
"traceability",
|
|
19
|
+
"cli",
|
|
20
|
+
"ai",
|
|
21
|
+
"specs",
|
|
22
|
+
"documentation"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"dev": "node --import tsx/esm src/cli.ts",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"typecheck": "tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/imix/taproot"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@inquirer/checkbox": "^5.1.2",
|
|
41
|
+
"@inquirer/confirm": "^6.0.10",
|
|
42
|
+
"chalk": "^5.6.2",
|
|
43
|
+
"commander": "^14.0.3",
|
|
44
|
+
"js-yaml": "^4.1.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/js-yaml": "^4.0.9",
|
|
48
|
+
"@types/node": "^25.5.0",
|
|
49
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
50
|
+
"tsx": "^4.21.0",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
|
+
"vitest": "^4.1.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Skill: analyse-change
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Analyse the impact of a proposed change to an existing hierarchy artefact before any edits are made. Identifies what is currently in place, which sections the change affects, and what downstream and upstream artefacts will need review. Produces an impact report and gates on caller confirmation. Read-only — never modifies the hierarchy.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
|
|
9
|
+
- `path` (required): Path to the existing artefact being changed (`intent.md`, `usecase.md`, or `impl.md`).
|
|
10
|
+
- `change` (required): Natural language description of the proposed change.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Verify the target exists.** If the path does not exist, report: "No artefact found at `<path>`. If you're adding something new, use `/tr-ineed` instead." Then stop.
|
|
15
|
+
|
|
16
|
+
2. **Read the target artefact.** Identify its type (intent / behaviour / implementation) by filename.
|
|
17
|
+
|
|
18
|
+
3. **Confirm interpretation.** State which sections and fields you believe the change affects:
|
|
19
|
+
> "I interpret this change as affecting: [list of sections — e.g., Goal, Success Criteria, Main Flow step 3]. Is that right?"
|
|
20
|
+
|
|
21
|
+
Wait for confirmation. If the caller corrects the interpretation, update your understanding and re-confirm before continuing.
|
|
22
|
+
|
|
23
|
+
4. **Check scope.** If the change only affects status, dates, or notes fields — report: "This is a minor update (status/date/notes only) — no impact analysis needed." Then stop.
|
|
24
|
+
|
|
25
|
+
5. **Build the hierarchy map.** Run `taproot coverage --format json` and parse the output to get the full intent → behaviour → implementation tree.
|
|
26
|
+
|
|
27
|
+
6. **Walk for dependencies** using three methods:
|
|
28
|
+
|
|
29
|
+
**Structural** (definitive):
|
|
30
|
+
- If target is an `intent.md`: all behaviours and their implementations are downstream
|
|
31
|
+
- If target is a `usecase.md`: its parent intent is upstream; all its `impl.md` files are downstream
|
|
32
|
+
- If target is an `impl.md`: its parent `usecase.md` and grandparent `intent.md` are upstream
|
|
33
|
+
|
|
34
|
+
**Implementing** (definitive):
|
|
35
|
+
- Scan all `impl.md` files in the hierarchy for a `## Behaviour` field referencing the changed `usecase.md`
|
|
36
|
+
- These are direct implementing dependents
|
|
37
|
+
|
|
38
|
+
**Conceptual** (advisory — agent reasoning):
|
|
39
|
+
- Identify 3–5 key terms from the changed sections (actor names, capability phrases, postcondition states)
|
|
40
|
+
- Scan other `intent.md` and `usecase.md` files for these terms
|
|
41
|
+
- Flag matches as "possibly affected — review recommended", not confirmed impact
|
|
42
|
+
|
|
43
|
+
7. **Classify every found artefact:**
|
|
44
|
+
- **Direct** — the target itself
|
|
45
|
+
- **Downstream** — structural children or implementing impls
|
|
46
|
+
- **Upstream** — structural parents
|
|
47
|
+
- **Possibly affected** — conceptual matches
|
|
48
|
+
|
|
49
|
+
8. **Present the impact summary:**
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
## Change Impact Report
|
|
53
|
+
Target: <path>
|
|
54
|
+
Change: <summary of proposed delta>
|
|
55
|
+
|
|
56
|
+
### Current State
|
|
57
|
+
<key fields being changed, quoted from the artefact>
|
|
58
|
+
|
|
59
|
+
### Proposed Delta
|
|
60
|
+
<what changes>
|
|
61
|
+
|
|
62
|
+
### Confirmed Impact
|
|
63
|
+
Downstream:
|
|
64
|
+
- taproot/<path> [behaviour/impl — reason]
|
|
65
|
+
Upstream:
|
|
66
|
+
- taproot/<path> [intent — reason]
|
|
67
|
+
|
|
68
|
+
### Possibly Affected (review recommended)
|
|
69
|
+
- taproot/<path> — shares term "<term>" in <section>
|
|
70
|
+
|
|
71
|
+
### Next Step
|
|
72
|
+
[A] Proceed with full scope [N] Narrow the change [C] Cancel
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
9. **Gate on confirmation:**
|
|
76
|
+
- **[A] Proceed**: return the impact report as context and indicate the caller may now make edits. Then:
|
|
77
|
+
|
|
78
|
+
> 💡 If this session is getting long, consider running `/compact` or starting a fresh context before the next task.
|
|
79
|
+
|
|
80
|
+
**What's next?**
|
|
81
|
+
[A1] `/tr-refine <path>` — apply the change to the behaviour spec
|
|
82
|
+
[A2] `/tr-intent <path>` — revise the intent if upstream is affected
|
|
83
|
+
|
|
84
|
+
- **[N] Narrow**: ask "What would you like to change about the proposed delta?" then return to Step 3 with the revised description
|
|
85
|
+
- **[C] Cancel**: report "No changes made." and stop
|
|
86
|
+
|
|
87
|
+
## Output
|
|
88
|
+
|
|
89
|
+
An impact report presented in the conversation, followed by a confirmed go/no-go for the calling skill to proceed with edits. No files are written unless the caller explicitly requests the report saved to `.taproot/change-analysis.md`.
|
|
90
|
+
|
|
91
|
+
## CLI Dependencies
|
|
92
|
+
|
|
93
|
+
- `taproot coverage`
|
|
94
|
+
|
|
95
|
+
## Notes
|
|
96
|
+
|
|
97
|
+
- This skill is read-only. It reports impact; it does not apply changes.
|
|
98
|
+
- Conceptual matching (Step 6) is agent reasoning, not a deterministic algorithm — it may miss indirect dependencies or flag false positives. Treat "possibly affected" as a prompt for human review, not a definitive list.
|
|
99
|
+
- This skill is typically called by other skills (`tr-intent` in refine mode, `tr-refine`, `tr-promote`, `tr-ineed` when detecting a change) rather than directly by the user. Direct invocation is also valid.
|
|
100
|
+
- Concurrent invocations are not protected by any locking mechanism. In parallel agent pipelines, external coordination is required.
|
|
101
|
+
- `/tr-analyse-change` is the Claude Code adapter command name for this skill.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Skill: behaviour
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Define a UseCase (observable system behaviour) under an intent or another behaviour. Each behaviour is testable, has a clear actor, and describes what the system does — not how it does it.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
|
|
9
|
+
- `parent` (required): Path to the parent intent folder or parent behaviour folder.
|
|
10
|
+
- `description` (required): Natural language description of the behaviour to define.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. Read the parent artifact at `parent`:
|
|
15
|
+
- If `parent` contains `intent.md`: read the intent to understand the goal and success criteria.
|
|
16
|
+
- If `parent` contains `usecase.md`: read the parent behaviour — this new behaviour is a sub-behaviour.
|
|
17
|
+
|
|
18
|
+
1a. **Pattern check** — If `.taproot/docs/patterns.md` exists, scan the behaviour description for semantic matches. Match signals:
|
|
19
|
+
- "apply to all / every implementation / every skill" → `check-if-affected-by`
|
|
20
|
+
- "enforce a rule / architectural constraint / agents should follow" → `check-if-affected-by`
|
|
21
|
+
- "keep docs current / enforce documentation quality" → `document-current`
|
|
22
|
+
- "every new feature must update X" → `check-if-affected: X`
|
|
23
|
+
|
|
24
|
+
If a match is found, **interrupt before asking clarifying questions**:
|
|
25
|
+
> "Before I write this spec — that sounds like the **`<pattern-name>`** pattern. <one-line description>. See `.taproot/docs/patterns.md`."
|
|
26
|
+
> **[A] Use this pattern now** — I'll guide you through applying it instead of writing a spec
|
|
27
|
+
> **[B] Continue writing the spec** — the spec is distinct from the pattern
|
|
28
|
+
|
|
29
|
+
- **[A]**: guide the user through applying the pattern. Do not write a new `usecase.md`.
|
|
30
|
+
- **[B]** or no match: proceed to step 2.
|
|
31
|
+
|
|
32
|
+
2. Read all sibling `usecase.md` files (other behaviours already under the same parent). Identify any overlap with the described behaviour and flag it: "There's an existing behaviour `<slug>` that covers X — should this new behaviour focus on Y specifically?"
|
|
33
|
+
|
|
34
|
+
3. Ask clarifying questions through dialogue until you have enough to write the full UseCase. Minimum required:
|
|
35
|
+
- Who or what initiates this behaviour? (the Actor)
|
|
36
|
+
- What must be true before this can happen? (Preconditions)
|
|
37
|
+
- Walk me through the main steps — what does the user/system do, and what does the system respond?
|
|
38
|
+
- What's true when it succeeds? (Postconditions)
|
|
39
|
+
- What can go wrong, and how should the system respond? (Error Conditions)
|
|
40
|
+
|
|
41
|
+
4. Identify alternate flows and error conditions proactively — don't just ask for them. Walk every step in the main flow and challenge it:
|
|
42
|
+
- "What if the input at this step is invalid or missing?"
|
|
43
|
+
- "What if an external call here times out or returns an error?"
|
|
44
|
+
- "What if the user navigates away or cancels mid-flow?"
|
|
45
|
+
- "What if this step is attempted twice in a row?"
|
|
46
|
+
Each recoverable branch becomes an **Alternate Flow** (with trigger + steps + outcome). Each unrecoverable failure becomes an **Error Condition** (with trigger + system response). Do not accept vague answers like "the request fails" — push for the specific trigger and the exact system response (e.g., "API returns 5xx — system shows inline error, preserves form state, and allows retry").
|
|
47
|
+
|
|
48
|
+
5. Generate a Mermaid diagram that visualises the main flow and key alternate/error branches. Use `sequenceDiagram` for actor–system interactions or `flowchart TD` for branching logic — choose whichever makes the flow most readable. This is the human-readable visual contract for the behaviour. Include it in the `## Flow` section of `usecase.md`.
|
|
49
|
+
|
|
50
|
+
6. Identify related behaviours. Scan sibling and parent behaviours for any that: share the same actor, share a precondition with this behaviour, produce an outcome this behaviour depends on, or are commonly triggered alongside this one. List them in `## Related` with a one-line note on the relationship (e.g., "must precede", "shares actor", "produces input for this flow").
|
|
51
|
+
|
|
52
|
+
7. Draft the `usecase.md`. Write main flow steps as active-voice actions: subject + verb + object. Bad: "The form is submitted." Good: "User submits the registration form."
|
|
53
|
+
|
|
54
|
+
7a. After writing the main flow, alternate flows, and error conditions, generate a `## Acceptance Criteria` section. Derive one Gherkin scenario per flow: the main flow, each named alternate flow, and each error condition. Assign stable IDs starting at `AC-1`. Insert the section immediately before `## Status`:
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
## Acceptance Criteria
|
|
58
|
+
|
|
59
|
+
**AC-1: <Happy path title>**
|
|
60
|
+
- Given <precondition>
|
|
61
|
+
- When <actor action>
|
|
62
|
+
- Then <observable outcome>
|
|
63
|
+
|
|
64
|
+
**AC-2: <Alternate flow title>**
|
|
65
|
+
- Given <context>
|
|
66
|
+
- When <trigger>
|
|
67
|
+
- Then <system response>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Note to developer: "I've generated N acceptance criteria — review and adjust the Given/When/Then wording before committing. IDs are immutable once assigned."
|
|
71
|
+
|
|
72
|
+
7b. After generating functional ACs, ask: "Are there quality constraints on this behaviour — performance targets, security requirements, reliability thresholds, or accessibility standards?" If yes, derive one `**NFR-N:**` entry per constraint using the NFR Gherkin pattern:
|
|
73
|
+
- **Given** — the environmental or load condition (e.g. "500 concurrent users", "mobile network", "authenticated session")
|
|
74
|
+
- **When** — the actor action that triggers measurement
|
|
75
|
+
- **Then** — a measurable threshold: number + unit, named standard, or testable boolean condition
|
|
76
|
+
|
|
77
|
+
Assign IDs starting at `NFR-1`, placed after the last functional AC. Note: "I've generated N NFR criteria — confirm the thresholds are specific and measurable before committing."
|
|
78
|
+
|
|
79
|
+
If no quality constraints are identified, skip silently.
|
|
80
|
+
|
|
81
|
+
8. Determine the folder slug: kebab-case, verb-noun or noun phrase (e.g., `register-account`, `reset-password`, `verify-email-address`). Should be distinct from sibling behaviour slugs.
|
|
82
|
+
|
|
83
|
+
9. Create the directory `<parent>/<slug>/` and write `usecase.md`.
|
|
84
|
+
|
|
85
|
+
10. Update the parent document's `## Behaviours <!-- taproot-managed -->` section:
|
|
86
|
+
- Read the parent `intent.md` (or parent `usecase.md` for sub-behaviours).
|
|
87
|
+
- If the `## Behaviours` section does not exist, insert it immediately before `## Status` (or append at end of file if `## Status` is absent), with the heading `## Behaviours <!-- taproot-managed -->`.
|
|
88
|
+
- Derive the link title from the first `# Heading` line of the new `usecase.md`; strip any type prefix (e.g. `# Behaviour: Foo` → `Foo`). Fall back to the folder slug if no heading is found.
|
|
89
|
+
- Append `- [<Title>](./<slug>/usecase.md)` to the section if the link is not already present.
|
|
90
|
+
- Write the updated parent document.
|
|
91
|
+
|
|
92
|
+
11. Run `taproot validate-structure --path <taproot-root>` and `taproot validate-format --path <parent>/<slug>/`.
|
|
93
|
+
|
|
94
|
+
12. If the behaviour has clear sub-components, suggest decomposition: "This behaviour has three distinct phases — would you like to break it into sub-behaviours: `<sub-slug-1>`, `<sub-slug-2>`, `<sub-slug-3>`?"
|
|
95
|
+
|
|
96
|
+
13. Present next steps:
|
|
97
|
+
|
|
98
|
+
> 💡 If this session is getting long, consider running `/compact` or starting a fresh context before the next task.
|
|
99
|
+
|
|
100
|
+
**What's next?**
|
|
101
|
+
[A] `/tr-implement taproot/<parent>/<slug>/` — start building
|
|
102
|
+
[B] `/tr-review taproot/<parent>/<slug>/usecase.md` — stress-test the spec first
|
|
103
|
+
|
|
104
|
+
## Output
|
|
105
|
+
|
|
106
|
+
A new `usecase.md` in `<parent>/<slug>/usecase.md`.
|
|
107
|
+
|
|
108
|
+
## CLI Dependencies
|
|
109
|
+
|
|
110
|
+
- `taproot validate-structure`
|
|
111
|
+
- `taproot validate-format`
|
|
112
|
+
|
|
113
|
+
## Document Format Reference
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Behaviour: <Title>
|
|
117
|
+
|
|
118
|
+
## Actor
|
|
119
|
+
<Who or what initiates this behaviour>
|
|
120
|
+
|
|
121
|
+
## Preconditions
|
|
122
|
+
- <What must be true before this behaviour can occur>
|
|
123
|
+
|
|
124
|
+
## Main Flow
|
|
125
|
+
1. <Actor does something>
|
|
126
|
+
2. <System responds>
|
|
127
|
+
3. <Actor does something>
|
|
128
|
+
|
|
129
|
+
## Alternate Flows
|
|
130
|
+
### <Alternate flow name>
|
|
131
|
+
- **Trigger:** <When does this alternate flow occur?>
|
|
132
|
+
- **Steps:**
|
|
133
|
+
1. <Step>
|
|
134
|
+
2. <Step>
|
|
135
|
+
|
|
136
|
+
## Postconditions
|
|
137
|
+
- <What is true after successful completion>
|
|
138
|
+
|
|
139
|
+
## Error Conditions
|
|
140
|
+
- **<Trigger>**: <Exact system response — specific, not generic>
|
|
141
|
+
|
|
142
|
+
## Flow
|
|
143
|
+
```mermaid
|
|
144
|
+
sequenceDiagram
|
|
145
|
+
Actor->>System: <initiating action>
|
|
146
|
+
System-->>Actor: <response>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Related
|
|
150
|
+
- `<path/to/sibling/usecase.md>` — <relationship: must precede / shares actor / produces input / commonly co-triggered>
|
|
151
|
+
|
|
152
|
+
## Acceptance Criteria
|
|
153
|
+
|
|
154
|
+
**AC-1: <Happy path title>**
|
|
155
|
+
- Given <precondition>
|
|
156
|
+
- When <actor action>
|
|
157
|
+
- Then <observable outcome>
|
|
158
|
+
|
|
159
|
+
**AC-2: <Alternate flow title>**
|
|
160
|
+
- Given <context>
|
|
161
|
+
- When <trigger>
|
|
162
|
+
- Then <system response>
|
|
163
|
+
|
|
164
|
+
## Status
|
|
165
|
+
- **State:** proposed | specified | implemented | tested | deprecated
|
|
166
|
+
- **Created:** <YYYY-MM-DD>
|
|
167
|
+
- **Last reviewed:** <YYYY-MM-DD>
|
|
168
|
+
|
|
169
|
+
## Notes
|
|
170
|
+
<Edge cases, open questions>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Notes
|
|
174
|
+
|
|
175
|
+
- A behaviour should be completable in one user session. If it spans sessions or days, it is likely multiple behaviours.
|
|
176
|
+
- Aim for 3–7 steps in the main flow. Fewer usually means the behaviour is too abstract; more usually means it should be decomposed.
|
|
177
|
+
- The Mermaid diagram is the human-readable contract — it should be understandable by a non-technical stakeholder. Prefer `sequenceDiagram` for flows with clear actor–system turns; use `flowchart TD` for decision-heavy branching.
|
|
178
|
+
- Error conditions should be specific: name the exact trigger (HTTP 5xx, timeout, duplicate key) and the exact system response (error message shown, state preserved, retry offered). Vague conditions ("request fails") are not acceptable.
|
|
179
|
+
- Related behaviours are not just cross-references — they define the dependency graph that `/tr-analyse-change` uses for impact analysis.
|