thachvd-kit 1.0.36 → 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.
Files changed (32) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +240 -0
  3. package/THIRD_PARTY_NOTICES.md +49 -0
  4. package/bin/cli.js +80 -24
  5. package/bin/config.js +164 -0
  6. package/bin/entry.js +11 -1
  7. package/bin/native-skills.js +183 -0
  8. package/bin/spec-doctor.js +251 -0
  9. package/bin/spec-link.js +97 -0
  10. package/bin/spec-recipe.js +74 -0
  11. package/bin/spec-state.js +415 -0
  12. package/bin/spec.js +859 -0
  13. package/bin/upgrade.js +303 -298
  14. package/package.json +5 -3
  15. package/skills/finishing-a-development-branch/SKILL.md +240 -0
  16. package/skills/requesting-code-review/code-reviewer.md +198 -0
  17. package/skills/subagent-driven-development/SKILL.md +574 -0
  18. package/skills/subagent-driven-development/implementer-prompt.md +154 -0
  19. package/skills/subagent-driven-development/re-review-prompt.md +115 -0
  20. package/skills/subagent-driven-development/scripts/review-package +53 -0
  21. package/skills/subagent-driven-development/scripts/review-package.js +52 -0
  22. package/skills/subagent-driven-development/scripts/sdd-workspace +82 -0
  23. package/skills/subagent-driven-development/scripts/sdd-workspace-lib.js +62 -0
  24. package/skills/subagent-driven-development/scripts/sdd-workspace.js +15 -0
  25. package/skills/subagent-driven-development/scripts/task-brief +43 -0
  26. package/skills/subagent-driven-development/scripts/task-brief.js +46 -0
  27. package/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
  28. package/skills/system-discovery/SKILL.md +140 -0
  29. package/skills/system-reverse-engineer/SKILL.md +208 -0
  30. package/skills/system-spec-review/SKILL.md +177 -0
  31. package/skills/upstream.json +30 -0
  32. package/skills/using-git-worktrees/SKILL.md +175 -0
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: system-spec-review
3
+ description: Independently verify generated AS-IS system specs against implementation and tests, then write machine-readable verification metadata for drift detection.
4
+ ---
5
+
6
+ # System Spec Review
7
+
8
+ Review an existing generated system-spec set independently from the agent that wrote it.
9
+
10
+ Do not modify product code. Do not silently rewrite the source specs during the first review pass.
11
+
12
+ ## Goal
13
+
14
+ Try to prove the generated specs incomplete, unsupported, stale, or internally inconsistent.
15
+
16
+ ## Analysis profile
17
+
18
+ Read `profile` from `.thachvd/system.json`. Use it to expand the independent coverage inventory with the same specialized concerns used during discovery/reverse engineering. In `auto` mode, independently check whether the inferred per-repository profiles are supported by code/config evidence.
19
+
20
+ Do not treat profile compliance as proof of completeness; actively look for behavior outside the expected profile.
21
+
22
+ The result is not a style review. It is an evidence and coverage review.
23
+
24
+ ## Read first
25
+
26
+ 1. `.thachvd/system.json`
27
+ 2. the configured `spec_root/architecture/*`
28
+ 3. `spec_root/capabilities/*/{prd.md,design.md}`
29
+ 4. `spec_root/flows/*`
30
+ 5. `spec_root/contracts/*`
31
+ 6. `spec_root/_meta/reverse-progress.json` when present
32
+
33
+ Read `language` from the manifest and write the human-facing review report in that language. Preserve all code identifiers and source anchors exactly.
34
+
35
+ ## Source of truth
36
+
37
+ Use:
38
+ - production implementation
39
+ - tests
40
+ - config
41
+ - schemas/migrations
42
+ - Codebase Memory MCP for structural discovery and cross-repository tracing
43
+
44
+ Do not trust generated specs simply because they contain source anchors. Follow a representative and risk-weighted sample of anchors into code and verify them.
45
+
46
+ ## Independent verification method
47
+
48
+ If the client supports subagents, run this review in a fresh reviewer subagent that did not author the specs. Otherwise, deliberately reconstruct the implementation inventory from code/MCP before reading each capability's conclusions in detail. Do not rely on the author agent's summary as evidence.
49
+
50
+ For each approved capability:
51
+
52
+ 1. Build an implementation inventory independently from the capability spec:
53
+ - entry points/routes/commands
54
+ - services/modules
55
+ - state transitions
56
+ - persistence
57
+ - jobs/schedulers
58
+ - events/listeners/queues
59
+ - middleware/policies/observers/hooks
60
+ - external clients/integrations
61
+ - tests
62
+ 2. Compare that inventory with PRD and design docs.
63
+ 3. Check important claims against implementation/tests.
64
+ 4. Look for implementation behavior not represented in the spec.
65
+ 5. Look for spec claims with no implementation/test evidence.
66
+ 6. Check PRD vs design consistency.
67
+ 7. Check cross-repository flows and contracts from both sides of each boundary.
68
+ 8. Check whether dead/unreachable code was described as active.
69
+ 9. Check ambiguous business rationale remains marked unknown rather than invented.
70
+
71
+ Prioritize high-risk boundaries: authentication/authorization, money/payment/refund, schema/state changes, async processing, external side effects, retries/idempotency, concurrency, and destructive operations.
72
+
73
+ ## Verification statuses
74
+
75
+ A capability may be:
76
+
77
+ - `verified`: no material unsupported claims or coverage gaps found in the performed review.
78
+ - `needs_review`: material gaps, unsupported claims, contradictions, or ambiguous coverage remain.
79
+ - `blocked`: verification could not be completed because required code, tests, repositories, or runtime evidence are unavailable.
80
+
81
+ Do not use `verified` to mean mathematically complete. The review report must state what was sampled and any residual risk.
82
+
83
+ ## Required outputs
84
+
85
+ Create/update:
86
+
87
+ - `spec_root/_meta/review.md`
88
+ - `spec_root/_meta/verification.json`
89
+
90
+ If the handoff names one capability, perform a targeted re-review:
91
+ - verify only that capability against current code/tests
92
+ - update only that capability entry in `verification.json`
93
+ - preserve other capability entries and their per-capability verified commits
94
+ - append/update the human review report without erasing unrelated findings
95
+
96
+ ### review.md
97
+
98
+ Include:
99
+ - review scope and date
100
+ - repositories/commits reviewed
101
+ - capability-by-capability status
102
+ - missing behavior
103
+ - unsupported claims
104
+ - broken or weak source anchors
105
+ - PRD/design contradictions
106
+ - flow/contract gaps
107
+ - unresolved ambiguities
108
+ - residual review risk
109
+ - recommended remediation
110
+
111
+ Do not automatically edit the source spec to hide findings.
112
+
113
+ ### verification.json
114
+
115
+ Write valid JSON with this shape:
116
+
117
+ ```json
118
+ {
119
+ "schema_version": 1,
120
+ "verified_at": "<ISO-8601>",
121
+ "system": "<manifest name>",
122
+ "repositories": {
123
+ "<repo-name>": {
124
+ "commit": "<git HEAD SHA>"
125
+ }
126
+ },
127
+ "capabilities": {
128
+ "<capability-slug>": {
129
+ "title": "<human title>",
130
+ "status": "verified",
131
+ "source_paths": {
132
+ "<repo-name>": [
133
+ "path/to/module",
134
+ "path/to/important-file.ext"
135
+ ]
136
+ },
137
+ "verified_commits": {
138
+ "<repo-name>": "<Git SHA used to verify this capability>"
139
+ },
140
+ "evidence": {
141
+ "implementation_claims_checked": 0,
142
+ "test_claims_checked": 0,
143
+ "unsupported_claims": 0,
144
+ "potential_gaps": 0,
145
+ "broken_anchors": 0
146
+ },
147
+ "notes": []
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ Rules:
154
+ - top-level repository commits MUST be current `git rev-parse HEAD` values for a full-system review; they represent the latest whole-system review snapshot
155
+ - every `verified` capability MUST record `verified_commits` for each repo present in its `source_paths`
156
+ - for targeted re-review, update that capability's `verified_commits` to current HEAD without advancing unrelated capabilities' baselines
157
+ - `source_paths` MUST contain paths actually relevant to the capability; prefer stable module/directory prefixes plus exceptional files
158
+ - do not use wildcards; paths are repository-relative
159
+ - every capability in the approved capability map must appear
160
+ - capabilities that were not fully checked must not be marked `verified`
161
+ - every `verified` capability must have at least one repository-relative `source_paths` entry and matching `verified_commits`
162
+ - for a `verified` capability, `unsupported_claims`, `potential_gaps`, and `broken_anchors` must all be 0; otherwise use `needs_review`
163
+ - all evidence counts must be non-negative integers; use 0 rather than inventing counts
164
+ - source paths must stay inside their repository; never use absolute paths or `../`
165
+
166
+ ## Final gate
167
+
168
+ Before marking the review complete:
169
+
170
+ - every approved capability has a verification status
171
+ - every configured repo has a top-level reviewed commit SHA after a full review
172
+ - verified capabilities have source paths and capability-specific verified commits for every repo they materially use
173
+ - no known material gap is hidden under `verified`
174
+ - the JSON parses cleanly
175
+ - the human report and JSON statuses agree
176
+
177
+ Return a concise summary of verified, needs-review, blocked, and the highest-risk gaps.
@@ -0,0 +1,30 @@
1
+ {
2
+ "obra/superpowers": {
3
+ "commit": "5bf4e78011075bcfc0dc295f0724994cd123ee71",
4
+ "files": [
5
+ "skills/using-git-worktrees/SKILL.md",
6
+ "skills/subagent-driven-development/SKILL.md",
7
+ "skills/subagent-driven-development/implementer-prompt.md",
8
+ "skills/subagent-driven-development/task-reviewer-prompt.md",
9
+ "skills/subagent-driven-development/re-review-prompt.md",
10
+ "skills/subagent-driven-development/scripts/review-package",
11
+ "skills/subagent-driven-development/scripts/sdd-workspace",
12
+ "skills/subagent-driven-development/scripts/task-brief",
13
+ "skills/requesting-code-review/code-reviewer.md",
14
+ "skills/finishing-a-development-branch/SKILL.md"
15
+ ],
16
+ "adapted_entrypoints": [
17
+ "skills/subagent-driven-development/scripts/review-package.js",
18
+ "skills/subagent-driven-development/scripts/sdd-workspace.js",
19
+ "skills/subagent-driven-development/scripts/task-brief.js",
20
+ "skills/subagent-driven-development/scripts/sdd-workspace-lib.js"
21
+ ],
22
+ "adapted_files": [
23
+ "skills/using-git-worktrees/SKILL.md",
24
+ "skills/subagent-driven-development/SKILL.md",
25
+ "skills/subagent-driven-development/task-reviewer-prompt.md",
26
+ "skills/subagent-driven-development/re-review-prompt.md",
27
+ "skills/finishing-a-development-branch/SKILL.md"
28
+ ]
29
+ }
30
+ }
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: using-git-worktrees
3
+ description: Use when the user explicitly wants an isolated workspace, especially for parallel feature development
4
+ ---
5
+
6
+ # Using Git Worktrees
7
+
8
+ ## Overview
9
+
10
+ When isolation is intended, ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
11
+
12
+ **Core principle:** Determine the intended workspace first. Respect an explicit request to stay on the current branch/workspace. If isolation is requested, prefer native tools, then fall back to git. Never fight the harness.
13
+
14
+ **Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
15
+
16
+ ## Step 0: Detect Existing Isolation
17
+
18
+ **Before creating anything, check if you are already in an isolated workspace.**
19
+
20
+ ```text
21
+ git rev-parse --git-dir
22
+ git rev-parse --git-common-dir
23
+ git rev-parse --show-toplevel
24
+ git rev-parse --show-superproject-working-tree
25
+ git branch --show-current
26
+ ```
27
+
28
+ **Submodule guard:** differing Git directory results are also possible inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
29
+
30
+ ```text
31
+ # If this returns a path, you're in a submodule, not a worktree — treat as normal repo
32
+ git rev-parse --show-superproject-working-tree
33
+ ```
34
+
35
+ **If `--git-dir` differs from `--git-common-dir` (and this is not a submodule):** You are already in a linked worktree. Skip to Step 2 (Project Setup). Do NOT create another worktree.
36
+
37
+ Report with branch state:
38
+ - On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
39
+ - Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
40
+
41
+ **If the values match (or this is a submodule):** You are in a normal repo checkout.
42
+
43
+ If the user explicitly says to work on the current branch/workspace, stay there. If the user invokes `/using-git-worktrees` or explicitly requests isolation, that is consent to isolate. If intent is unspecified, stay in the current workspace by default. Do not recommend or create a worktree solely because an implementation plan is large, risky, or being executed by SDD. Follow a project-level preference only when it explicitly requires isolation.
44
+
45
+ Honor any existing declared preference without asking. If isolation is not explicitly requested or required by project policy, skip to Step 2 in the current workspace.
46
+
47
+ ## Step 1: Create Isolated Workspace
48
+
49
+ **You have two mechanisms. Try them in this order.**
50
+
51
+ ### 1a. Native Worktree Tools (preferred)
52
+
53
+ The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 2.
54
+
55
+ Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
56
+
57
+ Only proceed to Step 1b if you have no native worktree tool available.
58
+
59
+ ### 1b. Git Worktree Fallback
60
+
61
+ **Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
62
+
63
+ #### Directory Selection
64
+
65
+ Follow this priority order. Explicit user preference always beats observed filesystem state.
66
+
67
+ 1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
68
+
69
+ 2. **Check for an existing project-local worktree directory:**
70
+ ```text
71
+ PowerShell: Test-Path .worktrees; Test-Path worktrees
72
+ CMD: if exist .worktrees echo .worktrees & if exist worktrees echo worktrees
73
+ ```
74
+ If found, use it. If both exist, `.worktrees` wins.
75
+
76
+ 3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
77
+
78
+ #### Safety Verification (project-local directories only)
79
+
80
+ **MUST verify directory is ignored before creating worktree:**
81
+
82
+ ```text
83
+ git check-ignore .worktrees
84
+ ```
85
+
86
+ If `.worktrees` does not exist, check the directory name you will create:
87
+
88
+ ```text
89
+ git check-ignore worktrees
90
+ ```
91
+
92
+ **If NOT ignored:** Add the appropriate entry to `.gitignore`, show that change clearly, and proceed only after the ignore rule is in place. Do not silently commit unrelated changes.
93
+
94
+ **Why critical:** Prevents accidentally committing worktree contents to repository.
95
+
96
+ #### Create the Worktree
97
+
98
+ ```text
99
+ # Determine the path using the host shell, then run the portable Git command.
100
+ git worktree list --porcelain
101
+ git branch --list <branch>
102
+ git worktree add "<path>" -b "<branch>" # new branch
103
+ git worktree add "<path>" "<branch>" # existing, unattached branch
104
+ ```
105
+
106
+ Never reset, force-checkout, delete, or steal an existing branch attached to another worktree.
107
+
108
+ **Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), report that clearly. If isolation was explicitly required, stop rather than silently working on the current branch; otherwise ask whether to continue in the current workspace, then run setup and baseline tests there only with that choice.
109
+
110
+ ## Step 2: Project Setup
111
+
112
+ Auto-detect and run appropriate setup. Read the repository's `AGENTS.md`, `.agent/docs/tooling.md`, package scripts, and lockfiles first; do not install dependencies that the project workflow does not require:
113
+
114
+ ```text
115
+ package-lock.json -> npm
116
+ pnpm-lock.yaml -> pnpm
117
+ yarn.lock -> yarn
118
+ bun.lock* -> bun
119
+ requirements.txt -> pip
120
+ uv.lock -> uv
121
+ Cargo.toml -> cargo
122
+ go.mod -> go
123
+ composer.json -> composer
124
+ ```
125
+
126
+ Use the project's documented bootstrap command after detecting the package manager.
127
+
128
+ ## Step 3: Verify Clean Baseline
129
+
130
+ Run tests to ensure workspace starts clean:
131
+
132
+ ```text
133
+ # Run the project-appropriate command (one command, not a shell expression):
134
+ npm test
135
+ # or cargo test / pytest / go test ./...
136
+ ```
137
+
138
+ **If tests fail:** Report failures, ask whether to proceed or investigate.
139
+
140
+ **If tests pass:** Report ready.
141
+
142
+ ### Report
143
+
144
+ ```
145
+ Worktree ready at <full-path>
146
+ Tests passing (<N> tests, 0 failures)
147
+ Ready to implement <feature-name>
148
+ ```
149
+
150
+ ## Quick Reference
151
+
152
+ | Situation | Action |
153
+ |-----------|--------|
154
+ | Already in linked worktree | Skip creation (Step 0) |
155
+ | In a submodule | Treat as normal repo (Step 0 guard) |
156
+ | Native worktree tool available | Use it (Step 1a) |
157
+ | No native tool | Git worktree fallback (Step 1b) |
158
+ | `.worktrees/` exists | Use it (verify ignored) |
159
+ | `worktrees/` exists | Use it (verify ignored) |
160
+ | Both exist | Use `.worktrees/` |
161
+ | Neither exists | Check instruction file, then default `.worktrees/` |
162
+ | Directory not ignored | Add to .gitignore + commit |
163
+ | Permission error on create | Sandbox fallback, work in place |
164
+ | Tests fail during baseline | Report failures + ask |
165
+ | No package.json/Cargo.toml | Skip dependency install |
166
+
167
+ ## Common Rationalizations
168
+
169
+ | Excuse | Reality |
170
+ |--------|---------|
171
+ | "I'm obviously not in a worktree — no need to check" | Run Step 0. Harness-created isolation and submodules both fool eyeballing; the detection commands settle it. |
172
+ | "`git worktree add` is quicker than hunting for a native tool" | A native tool (e.g. `EnterWorktree`) owns placement, branching, and cleanup. Bypassing it is the #1 mistake — it creates phantom state your harness can't see or manage. |
173
+ | "The worktree directory is surely ignored already" | Run `git check-ignore`. An unignored worktree directory commits the whole tree into the repo. |
174
+ | "Any directory name works" | Explicit instructions beat an existing project-local directory, which beats the `.worktrees/` default. |
175
+ | "The workspace is fresh — baseline tests can wait" | A dirty baseline makes every later failure ambiguous. Run the tests now; proceeding past failures is your human partner's call. |