thachvd-kit 1.0.37 → 1.0.38
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 +241 -11
- package/bin/cli.js +1791 -1785
- package/bin/config.js +164 -0
- package/bin/entry.js +11 -1
- package/bin/native-skills.js +183 -149
- package/bin/spec-doctor.js +251 -0
- package/bin/spec-link.js +97 -0
- package/bin/spec-recipe.js +74 -0
- package/bin/spec-state.js +415 -0
- package/bin/spec.js +859 -0
- package/package.json +3 -3
- package/skills/system-discovery/SKILL.md +140 -0
- package/skills/system-reverse-engineer/SKILL.md +208 -0
- package/skills/system-spec-review/SKILL.md +177 -0
package/README.md
CHANGED
|
@@ -27,6 +27,218 @@ thachvd-kit doctor
|
|
|
27
27
|
|
|
28
28
|
After the first skill install, run `/setup-matt-pocock-skills` once inside your AI client to configure the issue tracker, triage labels, and generated docs location — thachvd-kit does not simulate that skill.
|
|
29
29
|
|
|
30
|
+
## Brownfield System Specs
|
|
31
|
+
|
|
32
|
+
This workflow is **opt-in**. Normal `thachvd-kit init/upgrade -> setup -> development` behavior is unchanged unless you run `thachvd-kit spec init`.
|
|
33
|
+
|
|
34
|
+
The same happy path works for **one repository or many**:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd your-repo-or-workspace
|
|
38
|
+
|
|
39
|
+
thachvd-kit spec init --language vi # optional; omit for English
|
|
40
|
+
thachvd-kit spec index
|
|
41
|
+
thachvd-kit spec discover
|
|
42
|
+
|
|
43
|
+
# In your AI client:
|
|
44
|
+
# /system-discovery
|
|
45
|
+
|
|
46
|
+
# Human-review:
|
|
47
|
+
# system-specs/architecture/capability-map.md
|
|
48
|
+
|
|
49
|
+
thachvd-kit spec reverse
|
|
50
|
+
|
|
51
|
+
# In your AI client:
|
|
52
|
+
# /system-reverse-engineer
|
|
53
|
+
|
|
54
|
+
thachvd-kit spec verify
|
|
55
|
+
|
|
56
|
+
# In your AI client:
|
|
57
|
+
# /system-spec-review
|
|
58
|
+
|
|
59
|
+
thachvd-kit spec check
|
|
60
|
+
thachvd-kit spec link
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Documentation language
|
|
64
|
+
|
|
65
|
+
Use `--language vi` when you want human-facing specs in Vietnamese:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
thachvd-kit spec init --language vi
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If Vietnamese is your normal preference across projects, set it once at user level:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
thachvd-kit config set spec-language vi
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then plain `thachvd-kit spec init` uses Vietnamese by default. A project-level `--language en|vi` always overrides the user default. Use `thachvd-kit config show` to inspect the current setting.
|
|
78
|
+
|
|
79
|
+
The setting is stored in `.thachvd/system.json` and reused by `/system-discovery`, `/system-reverse-engineer`, and `/system-spec-review`. Only prose/headings/explanations are localized; code identifiers, class/function names, API routes, event/queue names, database/schema names, file paths, commands, and source anchors remain exactly as they appear in source. Default is `en`.
|
|
80
|
+
|
|
81
|
+
### Analysis profiles
|
|
82
|
+
|
|
83
|
+
Profiles adjust what discovery/reverse/review should inspect most carefully. They do **not** override code/tests and they do not hide behavior outside the selected profile.
|
|
84
|
+
|
|
85
|
+
The default is `auto`, so the normal command remains:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
thachvd-kit spec init
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
In `auto` mode, the agent infers a practical profile for each repository from code/config evidence. A multi-repo system can therefore contain a backend API, frontend app, worker and infra repo without forcing one profile across all of them.
|
|
92
|
+
|
|
93
|
+
You can explicitly bias the checklist when a project is known:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
thachvd-kit spec init --profile backend
|
|
97
|
+
thachvd-kit spec init --profile frontend
|
|
98
|
+
thachvd-kit spec init --profile fullstack
|
|
99
|
+
thachvd-kit spec init --profile mobile
|
|
100
|
+
thachvd-kit spec init --profile infra
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Current emphasis:
|
|
104
|
+
|
|
105
|
+
- `backend`: routes/RPC, auth/policies, services/domain, DB/migrations/transactions, queues/jobs/events/schedulers, retries/idempotency/concurrency, external clients and rollback/failure behavior.
|
|
106
|
+
- `frontend`: routes/navigation, components/pages, state/data clients, forms/validation, auth/session, accessibility, analytics, loading/error states, browser storage and runtime/build config.
|
|
107
|
+
- `fullstack`: both sides plus client/server contracts, shared schemas/types, auth propagation, SSR/BFF/server actions and end-to-end failures.
|
|
108
|
+
- `mobile`: app lifecycle/background work, offline/sync, local storage, permissions, push/deep links, auth refresh, platform/device integrations and release config.
|
|
109
|
+
- `infra`: IaC, environments, CI/CD, secrets/IAM/networking, state backends, observability, scaling, deployment order, rollback/recovery and destructive-change safeguards.
|
|
110
|
+
|
|
111
|
+
Set a user default if you frequently work on the same class of project:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
thachvd-kit config set spec-profile backend
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Precedence is: explicit `--profile` → user config → `auto`.
|
|
118
|
+
|
|
119
|
+
### Automatic repository detection
|
|
120
|
+
|
|
121
|
+
`spec init` does not require `--repo` in the normal case:
|
|
122
|
+
|
|
123
|
+
- if the current directory is a Git repository, it is treated as a single-repo system;
|
|
124
|
+
- otherwise, direct child Git repositories are detected as a multi-repo system;
|
|
125
|
+
- `--repo` remains available only as an override for unusual directory layouts.
|
|
126
|
+
|
|
127
|
+
For a single repo, `system-specs/` lives in that repo. For multiple repos, run from the common workspace directory; that workspace owns `.thachvd/system.json` and `system-specs/`.
|
|
128
|
+
|
|
129
|
+
For team use, make sure the configured `spec_root` is version-controlled. In a single repo this happens naturally. In a multi-repo workspace whose parent directory is not itself a Git worktree, use a dedicated docs/spec Git repository or set `--spec-root` to a location that is committed. `thachvd-kit spec doctor` warns when the spec root is not in a committed Git worktree; the kit does not silently initialize or choose a remote repository for you.
|
|
130
|
+
|
|
131
|
+
`spec init` also installs the bundled `/system-discovery`, `/system-reverse-engineer`, and `/system-spec-review` skills into the workspace so the flow can run from the common parent directory.
|
|
132
|
+
|
|
133
|
+
### What the AI phases do
|
|
134
|
+
|
|
135
|
+
`/system-discovery` builds the coarse AS-IS map first:
|
|
136
|
+
|
|
137
|
+
- system overview
|
|
138
|
+
- repository responsibilities
|
|
139
|
+
- capability map
|
|
140
|
+
- cross-repository integrations
|
|
141
|
+
- domain glossary
|
|
142
|
+
|
|
143
|
+
A human reviews the capability boundaries before deep documentation begins.
|
|
144
|
+
|
|
145
|
+
Then `thachvd-kit spec reverse` writes the handoff for `/system-reverse-engineer`. With **no capability argument**, one invocation processes the entire approved capability map and creates/updates:
|
|
146
|
+
|
|
147
|
+
- `system-specs/capabilities/<capability>/prd.md`
|
|
148
|
+
- `system-specs/capabilities/<capability>/design.md`
|
|
149
|
+
- real cross-repository flow specs under `system-specs/flows/`
|
|
150
|
+
- real cross-boundary contracts under `system-specs/contracts/`
|
|
151
|
+
|
|
152
|
+
Internally the agent works capability-by-capability, persists progress to `system-specs/_meta/reverse-progress.json`, and resumes incomplete capabilities on later invocations. The user does **not** need to manually run one command per module.
|
|
153
|
+
|
|
154
|
+
A capability argument is only a targeted refresh:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
thachvd-kit spec reverse booking
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Use that later when only Booking changed or needs to be re-documented.
|
|
161
|
+
|
|
162
|
+
### Independent verification and drift detection
|
|
163
|
+
|
|
164
|
+
After reverse engineering finishes:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
thachvd-kit spec verify
|
|
168
|
+
# In your AI client: /system-spec-review
|
|
169
|
+
thachvd-kit spec check
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`/system-spec-review` independently reconstructs implementation coverage and tries to find missing behavior, unsupported claims, weak/broken source anchors, PRD/design contradictions, and cross-repository contract gaps. It writes:
|
|
173
|
+
|
|
174
|
+
- `system-specs/_meta/review.md`
|
|
175
|
+
- `system-specs/_meta/verification.json`
|
|
176
|
+
|
|
177
|
+
The verification JSON stores a full-system repository snapshot plus **capability-specific `verified_commits` and repository-relative `source_paths`**. `spec check` compares each capability against its own baseline, including committed, staged, unstaged, and untracked changes, so re-verifying one capability cannot accidentally make unrelated specs look current.
|
|
178
|
+
|
|
179
|
+
Use `thachvd-kit spec check --strict` in CI when stale/unknown specs should fail the check.
|
|
180
|
+
|
|
181
|
+
For an incremental refresh:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
thachvd-kit spec reverse booking
|
|
185
|
+
# /system-reverse-engineer
|
|
186
|
+
thachvd-kit spec verify booking
|
|
187
|
+
# /system-spec-review
|
|
188
|
+
thachvd-kit spec check
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Only Booking's verification baseline advances; unrelated capabilities keep their previous verified commits.
|
|
192
|
+
|
|
193
|
+
The reverse author is not allowed to call its own output independently verified; only the review phase may mark a capability `verified`.
|
|
194
|
+
|
|
195
|
+
### Spec health check
|
|
196
|
+
|
|
197
|
+
`thachvd-kit spec doctor` is read-only and summarizes the documentation system in one place:
|
|
198
|
+
|
|
199
|
+
- configured repos and Git HEAD availability
|
|
200
|
+
- Codebase Memory availability
|
|
201
|
+
- system-spec skills installed on agent surfaces
|
|
202
|
+
- capability map presence
|
|
203
|
+
- reverse checkpoint progress
|
|
204
|
+
- independent verification/review metadata
|
|
205
|
+
- current drift state
|
|
206
|
+
- whether the spec root is version-controlled
|
|
207
|
+
- AGENTS.md links
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
thachvd-kit spec doctor
|
|
211
|
+
thachvd-kit spec doctor --strict
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`--strict` exits non-zero when any WARN/ERROR remains, which is useful for CI or release gates.
|
|
215
|
+
|
|
216
|
+
### Optional Shinpr recipe integration
|
|
217
|
+
|
|
218
|
+
`recipe-reverse-engineer` is no longer part of the required flow. If you use Claude Code and want its extra generate -> verify -> review -> revise loop for individual implementation scopes, install it once:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
thachvd-kit spec recipe-setup
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The bundled `/system-reverse-engineer` skill may use that helper when available, but it still works without it.
|
|
225
|
+
|
|
226
|
+
### Flow summary
|
|
227
|
+
|
|
228
|
+
1. `spec init` auto-detects one or many repos and creates the workspace/spec structure.
|
|
229
|
+
2. `spec index` indexes all configured repos with codebase-memory-mcp.
|
|
230
|
+
3. `spec discover` creates the handoff for `/system-discovery`.
|
|
231
|
+
4. Human review confirms the system/capability boundaries.
|
|
232
|
+
5. `spec reverse` creates/resumes the whole-system `/system-reverse-engineer` checkpoint.
|
|
233
|
+
6. The author agent writes AS-IS PRD/design/flow/contract docs using fixed templates.
|
|
234
|
+
7. `spec verify` creates the handoff for independent `/system-spec-review`.
|
|
235
|
+
8. The reviewer writes machine-readable verification/provenance metadata.
|
|
236
|
+
9. `spec check` detects code/spec drift deterministically from Git.
|
|
237
|
+
10. `spec doctor` provides a read-only health summary for the spec system.
|
|
238
|
+
11. `spec link` adds an idempotent managed block to each repo's `AGENTS.md` so future agents discover and check the reviewed system specs. By default it refuses to link when any capability is not independently `verified`; `--allow-unverified` is an explicit escape hatch.
|
|
239
|
+
|
|
240
|
+
Observed behavior from code/tests and undocumented business rationale must remain distinct. Existing human-edited spec docs are not overwritten by `spec init --yes`.
|
|
241
|
+
|
|
30
242
|
## Generated Files
|
|
31
243
|
|
|
32
244
|
- `AGENTS.md`: shared project instructions.
|
|
@@ -141,12 +353,27 @@ Examples: `rtk git status`, `rtk npm test`, `rtk git log`. If it is not installe
|
|
|
141
353
|
thachvd-kit init [--yes]
|
|
142
354
|
thachvd-kit upgrade [--dry-run]
|
|
143
355
|
thachvd-kit global [--dry-run] [--antigravity-only|--codex-only]
|
|
356
|
+
thachvd-kit config show
|
|
357
|
+
thachvd-kit config set spec-language en|vi
|
|
358
|
+
thachvd-kit config unset spec-language
|
|
359
|
+
thachvd-kit config set spec-profile auto|backend|frontend|fullstack|mobile|infra
|
|
360
|
+
thachvd-kit config unset spec-profile
|
|
144
361
|
thachvd-kit setup [--no-setup-mcp] [--no-setup-hook] [--no-install-rtk] [--no-index] [--no-install-skills]
|
|
145
362
|
thachvd-kit doctor
|
|
146
363
|
thachvd-kit prompt
|
|
147
364
|
thachvd-kit skills install [--dry-run]
|
|
148
365
|
thachvd-kit skills check
|
|
149
366
|
thachvd-kit skills update [--dry-run]
|
|
367
|
+
thachvd-kit spec init [--name NAME] [--language en|vi] [--profile auto|backend|frontend|fullstack|mobile|infra] [--repo PATH ...] [--spec-root PATH] [--yes]
|
|
368
|
+
thachvd-kit spec index [--repo NAME ...] [--dry-run]
|
|
369
|
+
thachvd-kit spec discover
|
|
370
|
+
thachvd-kit spec reverse [CAPABILITY] [--reset]
|
|
371
|
+
thachvd-kit spec verify [CAPABILITY]
|
|
372
|
+
thachvd-kit spec check [--strict]
|
|
373
|
+
thachvd-kit spec doctor [--strict]
|
|
374
|
+
thachvd-kit spec recipe-setup [--fullstack] [--dry-run] # optional Claude Code helper
|
|
375
|
+
thachvd-kit spec link [--dry-run] [--allow-unverified]
|
|
376
|
+
thachvd-kit spec status
|
|
150
377
|
thachvd-kit --help
|
|
151
378
|
```
|
|
152
379
|
|
|
@@ -162,14 +389,17 @@ npm test
|
|
|
162
389
|
npm run release:verify
|
|
163
390
|
```
|
|
164
391
|
|
|
165
|
-
Release only from a clean, verified, pushed `main` branch. `npm publish` requires valid npm authentication and any configured 2FA code.
|
|
166
|
-
|
|
167
|
-
## Native Workflow Skills
|
|
168
|
-
|
|
169
|
-
The workflow layer combines Matt Pocock's planning and implementation skills with thachvd-kit's bundled native skills. `thachvd-kit setup` and `thachvd-kit skills install` install the native set to both `.agents/skills/` and `.claude/skills/`.
|
|
170
|
-
|
|
171
|
-
- `/using-git-worktrees` is opt-in workspace isolation; an explicit choice to work on the current branch always wins.
|
|
172
|
-
- `/subagent-driven-development` is an alternative executor to `/implement` for plans with multiple relatively independent tasks. It uses bundled cross-platform Node entrypoints on Windows and falls back to `/implement` when subagent dispatch is unavailable.
|
|
173
|
-
- `/finishing-a-development-branch` verifies and hands off a branch, cleaning only manually managed project-local worktrees safely.
|
|
174
|
-
|
|
175
|
-
|
|
392
|
+
Release only from a clean, verified, pushed `main` branch. `npm publish` requires valid npm authentication and any configured 2FA code.
|
|
393
|
+
|
|
394
|
+
## Native Workflow Skills
|
|
395
|
+
|
|
396
|
+
The workflow layer combines Matt Pocock's planning and implementation skills with thachvd-kit's bundled native skills. `thachvd-kit setup` and `thachvd-kit skills install` install the native set to both `.agents/skills/` and `.claude/skills/`.
|
|
397
|
+
|
|
398
|
+
- `/using-git-worktrees` is opt-in workspace isolation; an explicit choice to work on the current branch always wins.
|
|
399
|
+
- `/subagent-driven-development` is an alternative executor to `/implement` for plans with multiple relatively independent tasks. It uses bundled cross-platform Node entrypoints on Windows and falls back to `/implement` when subagent dispatch is unavailable.
|
|
400
|
+
- `/finishing-a-development-branch` verifies and hands off a branch, cleaning only manually managed project-local worktrees safely.
|
|
401
|
+
- `/system-discovery` builds the reviewed AS-IS repo/capability/integration map for a brownfield system with one or many repositories, using Codebase Memory MCP as the primary structural source.
|
|
402
|
+
- `/system-reverse-engineer` turns the approved map into PRD/design/flow/contract specs for the whole system, using a durable checkpoint so large systems can resume safely; a named capability is only a targeted refresh.
|
|
403
|
+
- `/system-spec-review` independently verifies coverage/evidence and writes commit/source-path provenance used by `spec check` for drift detection.
|
|
404
|
+
|
|
405
|
+
`thachvd-kit skills update` refreshes native skills from bundled repository copies and never fetches Superpowers at runtime. See `THIRD_PARTY_NOTICES.md` for recorded upstream provenance.
|