sdtk-code-kit 0.1.3 → 0.2.1

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 (39) hide show
  1. package/README.md +17 -0
  2. package/assets/manifest/toolkit-bundle.manifest.json +147 -147
  3. package/assets/manifest/toolkit-bundle.sha256.txt +10 -10
  4. package/assets/toolkit/toolkit/AGENTS.md +219 -219
  5. package/assets/toolkit/toolkit/install.ps1 +156 -156
  6. package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
  7. package/assets/toolkit/toolkit/skills/code-debug/SKILL.md +295 -295
  8. package/assets/toolkit/toolkit/skills/code-discover/SKILL.md +54 -54
  9. package/assets/toolkit/toolkit/skills/code-tdd/SKILL.md +377 -377
  10. package/assets/toolkit/toolkit/skills/code-worktree/SKILL.md +215 -215
  11. package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +28 -0
  12. package/package.json +44 -44
  13. package/src/commands/doctor.js +52 -0
  14. package/src/commands/guardrails.js +215 -0
  15. package/src/commands/help.js +244 -220
  16. package/src/commands/init.js +98 -98
  17. package/src/commands/readiness.js +77 -0
  18. package/src/commands/resume.js +62 -0
  19. package/src/commands/sleep.js +132 -0
  20. package/src/commands/status.js +78 -0
  21. package/src/commands/update.js +11 -11
  22. package/src/commands/verify.js +5 -0
  23. package/src/index.js +108 -73
  24. package/src/lib/project-target-guard.js +53 -53
  25. package/src/lib/ship-readiness.js +281 -0
  26. package/src/lib/sleep-plan.js +175 -0
  27. package/src/lib/sleep-report.js +229 -0
  28. package/src/lib/trust-events.js +166 -0
  29. package/src/lib/trust-file-scope.js +154 -0
  30. package/src/lib/trust-policy.js +212 -0
  31. package/src/lib/trust-redact.js +35 -0
  32. package/src/lib/trust-trace.js +179 -0
  33. package/src/lib/update.js +344 -344
  34. package/src/lib/workflow-artifact.js +9 -2
  35. package/src/lib/workflow-doctor.js +84 -0
  36. package/src/lib/workflow-handoff.js +111 -19
  37. package/src/lib/workflow-review-packet.js +650 -561
  38. package/src/lib/workflow-state.js +439 -0
  39. package/src/lib/workflow-verify.js +393 -356
@@ -1,219 +1,219 @@
1
- # SDTK-CODE Workflow Routing Contract
2
-
3
- ## 1. Product Identity
4
- `SDTK-CODE` is the coding-only product in the `SDTK-SPEC -> SDTK-CODE -> SDTK-OPS` family.
5
-
6
- It is a separate product from `SDTK-SPEC`, not a sub-phase inside `SDTK-SPEC`.
7
-
8
- `SDTK-CODE` exists to enforce disciplined implementation work:
9
- - execution-planning refinement after valid intake
10
- - TDD-first execution
11
- - systematic debugging
12
- - evidence-first verification
13
- - spec-first and quality-second review
14
- - ship and finish discipline
15
-
16
- It does not own PM, BA, ARCH, or QA artifact generation.
17
- It also does not own upstream implementation-readiness planning.
18
-
19
- ## 2. Upstream Boundary With SDTK-SPEC
20
- `SDTK-SPEC` is the upstream docs-first system.
21
-
22
- `SDTK-SPEC` produces the handoff artifacts.
23
- `SDTK-CODE` starts after those handoff artifacts already exist.
24
-
25
- Minimum expected inputs:
26
- - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
27
- - `sdtk-spec.config.json`
28
- - relevant architecture, API, DB, and flow/screen specs for the current slice when applicable
29
-
30
- Preferred upstream intake artifact:
31
- - `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
32
-
33
- Compatibility fallback when the formal handoff file is missing:
34
- - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
35
- - `sdtk-spec.config.json`
36
- - relevant architecture, API, DB, and flow/screen specs for the current slice when applicable
37
-
38
- Task-breakdown truth:
39
- - upstream `SDTK-SPEC` `/dev` owns implementation-readiness planning and formal handoff scope
40
- - `FEATURE_IMPL_PLAN_[FEATURE_KEY].md` remains the upstream readiness plan
41
- - `sdtk-code plan` refines downstream execution slices only after intake succeeds
42
-
43
- Expected outputs from `SDTK-CODE`:
44
- - code changes
45
- - test changes
46
- - summarized verification evidence
47
- - `docs/dev/REVIEW_PACKET_[FEATURE_KEY].md` from `verify` as downstream QA/controller input
48
- - review findings
49
- - ship or finish decisions
50
- - `docs/dev/OPS_HANDOFF_[FEATURE_KEY].json` on completed formal-handoff-backed closeout
51
-
52
- ## 3. Default Operating Model
53
- The default product direction is workflow-first.
54
-
55
- Normal mode is not "pick one of 12 skills and self-orchestrate from scratch."
56
- Normal mode is:
57
- - start from the workflow layer
58
- - follow lane-aware routing
59
- - keep execution traceable through `docs/dev/CODE_WORKFLOW_[FEATURE_KEY].md`
60
-
61
- Important current truth:
62
- - the workflow-first direction is locked
63
- - the workflow routing contract now exists
64
- - `start`, `plan`, `build`, `verify`, and `ship` now exist in the current package as control-plane workflow commands
65
-
66
- That means this file is the routing contract for the workflow-first model. It describes the full intended workflow surface, which now exists in the CLI as control-plane workflow commands.
67
-
68
- ## 4. Two-Layer Model
69
- ### Workflow layer
70
- This is the planned normal-mode surface.
71
-
72
- Workflow phases:
73
- - `start`
74
- - `plan`
75
- - `build`
76
- - `verify`
77
- - `ship`
78
-
79
- The workflow layer is control-plane and routing-oriented.
80
- It is intended to:
81
- - validate state and inputs
82
- - decide legal next steps
83
- - update the workflow artifact
84
- - route to the existing specialist engine
85
-
86
- ### Specialist skill engine
87
- The existing 12 `code-*` skills remain intact.
88
-
89
- They are:
90
- - the internal execution engine behind the workflow layer
91
- - the expert-mode direct entrypoints
92
- - not the default onboarding surface
93
-
94
- ## 5. V1 Lane Model
95
- V1 supports only two explicit lanes:
96
- - `feature`
97
- - `bugfix`
98
-
99
- Deferred lanes remain out of scope for v1:
100
- - `hardening`
101
- - `review-only`
102
- - `ship-only`
103
-
104
- Lane intent:
105
- - `feature` = full workflow: `start -> plan -> build -> verify -> ship`
106
- - `bugfix` = lighter path: `start -> build -> verify -> ship`
107
-
108
- Lane intake note:
109
- - `feature` expects formal handoff by default and uses compatibility fallback only when the handoff file is missing
110
- - `bugfix` also prefers formal handoff, but bounded compatibility fallback remains acceptable when the handoff file is missing
111
-
112
- ## 6. Workflow Artifact
113
- Canonical workflow artifact:
114
- - `docs/dev/CODE_WORKFLOW_[FEATURE_KEY].md`
115
-
116
- Canonical template path:
117
- - `products/sdtk-code/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md`
118
-
119
- The workflow artifact is not a replacement for `FEATURE_IMPL_PLAN_[FEATURE_KEY].md`.
120
- It is the coding execution memory that sits beside the upstream handoff artifact.
121
-
122
- Evidence rule:
123
- - summarized evidence belongs in `CODE_WORKFLOW_[FEATURE_KEY].md`
124
- - raw command output should be stored separately and referenced from the workflow artifact
125
- - `verify` also emits `docs/dev/REVIEW_PACKET_[FEATURE_KEY].md` as an evidence package for QA/controller review, not as final approval
126
-
127
- ## 7. Phase-To-Engine Mapping
128
- | Workflow phase | Primary engine skills | Conditional engine skills | Notes |
129
- |---|---|---|---|
130
- | `start` | `code-discover` | `code-brainstorm` | Use `code-brainstorm` only when the slice is still ambiguous after intake grounding. |
131
- | `plan` | `code-plan` | `code-brainstorm` | `code-brainstorm` remains optional when the implementation path is unclear. |
132
- | `build` | `code-worktree`, `code-tdd`, `code-execute` | `code-parallel` | `code-parallel` should be used only for clearly independent tasks. |
133
- | `verify` | `code-verify`, `code-review` | none | Review order stays evidence first, then spec/compliance, then quality. |
134
- | `ship` | `code-ship`, `code-finish` | none | Ship stays coding-scope only and does not expand into full release governance. |
135
-
136
- ### Cross-cutting reactive skill
137
- `code-debug` is cross-cutting and reactive.
138
-
139
- It is not a fixed top-level workflow phase.
140
- Trigger it when failures occur during:
141
- - `build`
142
- - `verify`
143
- - `ship` pre-flight or integration checks
144
-
145
- ## 8. Normal Mode vs Expert Mode
146
- ### Normal mode
147
- Normal mode is workflow-first.
148
-
149
- It should:
150
- - begin from the workflow layer
151
- - follow the lane model
152
- - use the workflow artifact as the execution memory
153
- - route to the engine skills intentionally rather than making the user choose blindly
154
-
155
- ### Expert mode
156
- Expert mode is direct raw `code-*` usage inside the runtime.
157
-
158
- Examples:
159
- - `/code-plan`
160
- - `/code-tdd`
161
- - `/code-debug`
162
-
163
- Expert mode rules:
164
- - raw skill usage remains available
165
- - it is an advanced path, not the default onboarding path
166
- - if a workflow artifact already exists, expert-mode deviations should be recorded against it
167
- - v1 does not require a dedicated CLI expert-mode flag
168
-
169
- ### Expert-mode deviation recording convention
170
- Batch 7 keeps expert mode lightweight.
171
-
172
- If a workflow artifact already exists and you bypass the normal workflow command path with raw `code-*` usage, record the deviation under `## 6. Evidence And Review Notes` using a lightweight note that captures:
173
- - date/time
174
- - current phase
175
- - raw skill used
176
- - reason for bypass
177
- - evidence refs
178
- - outcome or next action
179
-
180
- This batch does not add runtime interception or a new artifact section for expert mode.
181
- The rule is documentation plus lightweight recording inside the existing workflow artifact.
182
-
183
- ## 9. Runtime Truth
184
- | Runtime | Current truth | Workflow note |
185
- |---|---|---|
186
- | Claude | strongest intended runtime for v1 | full workflow direction is designed with Claude in mind |
187
- | Codex | defaults to user scope; project-local installs require the explicit local `CODEX_HOME=<project>/.codex` contract | workflow routing must stay honest about degraded collaboration behavior and not claim native `.codex/skills` auto-discovery |
188
-
189
- Codex fallback note:
190
- - `code-parallel` must degrade to sequential fallback when collaboration or subagent behavior is unavailable
191
- - workflow routing must not assume runtime capabilities that Codex cannot reliably support
192
-
193
- ## 10. Current Practical Reality
194
- The current package can already handle:
195
- - `sdtk-code init`
196
- - `sdtk-code runtime install|uninstall|status`
197
- - runtime skill installation for Claude and Codex
198
-
199
- The workflow-first direction now defines the normal practical path:
200
- - `sdtk-code start` for formal-handoff-first intake and artifact initialization
201
- - `sdtk-code plan` for feature-lane refinement and optional lightweight bugfix planning
202
- - `sdtk-code build` for build-progress tracking and next-step routing
203
- - `sdtk-code verify` for summarized evidence capture, `REVIEW_PACKET` generation, and ordered review gating
204
- - `sdtk-code ship` for final ship or finish decision capture
205
- - direct raw `code-*` skills in Claude or Codex as the expert-mode escape hatch and specialist engine
206
- - guided by this workflow routing contract
207
-
208
- Current `start` intake truth:
209
- - prefer `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
210
- - fall back to `FEATURE_IMPL_PLAN + sdtk-spec.config.json` only when the formal handoff file is missing
211
- - block cleanly when the formal handoff file exists but is invalid or upstream-blocked
212
-
213
- ## 11. What This Contract Prevents
214
- This routing contract exists to prevent:
215
- - treating `SDTK-CODE` as a loose 12-skill catalog
216
- - creating a second competing wrapper-skill catalog
217
- - drifting into PM/BA/ARCH/QA responsibilities
218
- - modeling `code-debug` as a fixed linear phase
219
- - overpromising workflow command behavior that is not implemented yet
1
+ # SDTK-CODE Workflow Routing Contract
2
+
3
+ ## 1. Product Identity
4
+ `SDTK-CODE` is the coding-only product in the `SDTK-SPEC -> SDTK-CODE -> SDTK-OPS` family.
5
+
6
+ It is a separate product from `SDTK-SPEC`, not a sub-phase inside `SDTK-SPEC`.
7
+
8
+ `SDTK-CODE` exists to enforce disciplined implementation work:
9
+ - execution-planning refinement after valid intake
10
+ - TDD-first execution
11
+ - systematic debugging
12
+ - evidence-first verification
13
+ - spec-first and quality-second review
14
+ - ship and finish discipline
15
+
16
+ It does not own PM, BA, ARCH, or QA artifact generation.
17
+ It also does not own upstream implementation-readiness planning.
18
+
19
+ ## 2. Upstream Boundary With SDTK-SPEC
20
+ `SDTK-SPEC` is the upstream docs-first system.
21
+
22
+ `SDTK-SPEC` produces the handoff artifacts.
23
+ `SDTK-CODE` starts after those handoff artifacts already exist.
24
+
25
+ Minimum expected inputs:
26
+ - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
27
+ - `sdtk-spec.config.json`
28
+ - relevant architecture, API, DB, and flow/screen specs for the current slice when applicable
29
+
30
+ Preferred upstream intake artifact:
31
+ - `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
32
+
33
+ Compatibility fallback when the formal handoff file is missing:
34
+ - `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
35
+ - `sdtk-spec.config.json`
36
+ - relevant architecture, API, DB, and flow/screen specs for the current slice when applicable
37
+
38
+ Task-breakdown truth:
39
+ - upstream `SDTK-SPEC` `/dev` owns implementation-readiness planning and formal handoff scope
40
+ - `FEATURE_IMPL_PLAN_[FEATURE_KEY].md` remains the upstream readiness plan
41
+ - `sdtk-code plan` refines downstream execution slices only after intake succeeds
42
+
43
+ Expected outputs from `SDTK-CODE`:
44
+ - code changes
45
+ - test changes
46
+ - summarized verification evidence
47
+ - `docs/dev/REVIEW_PACKET_[FEATURE_KEY].md` from `verify` as downstream QA/controller input
48
+ - review findings
49
+ - ship or finish decisions
50
+ - `docs/dev/OPS_HANDOFF_[FEATURE_KEY].json` on completed formal-handoff-backed closeout
51
+
52
+ ## 3. Default Operating Model
53
+ The default product direction is workflow-first.
54
+
55
+ Normal mode is not "pick one of 12 skills and self-orchestrate from scratch."
56
+ Normal mode is:
57
+ - start from the workflow layer
58
+ - follow lane-aware routing
59
+ - keep execution traceable through `docs/dev/CODE_WORKFLOW_[FEATURE_KEY].md`
60
+
61
+ Important current truth:
62
+ - the workflow-first direction is locked
63
+ - the workflow routing contract now exists
64
+ - `start`, `plan`, `build`, `verify`, and `ship` now exist in the current package as control-plane workflow commands
65
+
66
+ That means this file is the routing contract for the workflow-first model. It describes the full intended workflow surface, which now exists in the CLI as control-plane workflow commands.
67
+
68
+ ## 4. Two-Layer Model
69
+ ### Workflow layer
70
+ This is the planned normal-mode surface.
71
+
72
+ Workflow phases:
73
+ - `start`
74
+ - `plan`
75
+ - `build`
76
+ - `verify`
77
+ - `ship`
78
+
79
+ The workflow layer is control-plane and routing-oriented.
80
+ It is intended to:
81
+ - validate state and inputs
82
+ - decide legal next steps
83
+ - update the workflow artifact
84
+ - route to the existing specialist engine
85
+
86
+ ### Specialist skill engine
87
+ The existing 12 `code-*` skills remain intact.
88
+
89
+ They are:
90
+ - the internal execution engine behind the workflow layer
91
+ - the expert-mode direct entrypoints
92
+ - not the default onboarding surface
93
+
94
+ ## 5. V1 Lane Model
95
+ V1 supports only two explicit lanes:
96
+ - `feature`
97
+ - `bugfix`
98
+
99
+ Deferred lanes remain out of scope for v1:
100
+ - `hardening`
101
+ - `review-only`
102
+ - `ship-only`
103
+
104
+ Lane intent:
105
+ - `feature` = full workflow: `start -> plan -> build -> verify -> ship`
106
+ - `bugfix` = lighter path: `start -> build -> verify -> ship`
107
+
108
+ Lane intake note:
109
+ - `feature` expects formal handoff by default and uses compatibility fallback only when the handoff file is missing
110
+ - `bugfix` also prefers formal handoff, but bounded compatibility fallback remains acceptable when the handoff file is missing
111
+
112
+ ## 6. Workflow Artifact
113
+ Canonical workflow artifact:
114
+ - `docs/dev/CODE_WORKFLOW_[FEATURE_KEY].md`
115
+
116
+ Canonical template path:
117
+ - `products/sdtk-code/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md`
118
+
119
+ The workflow artifact is not a replacement for `FEATURE_IMPL_PLAN_[FEATURE_KEY].md`.
120
+ It is the coding execution memory that sits beside the upstream handoff artifact.
121
+
122
+ Evidence rule:
123
+ - summarized evidence belongs in `CODE_WORKFLOW_[FEATURE_KEY].md`
124
+ - raw command output should be stored separately and referenced from the workflow artifact
125
+ - `verify` also emits `docs/dev/REVIEW_PACKET_[FEATURE_KEY].md` as an evidence package for QA/controller review, not as final approval
126
+
127
+ ## 7. Phase-To-Engine Mapping
128
+ | Workflow phase | Primary engine skills | Conditional engine skills | Notes |
129
+ |---|---|---|---|
130
+ | `start` | `code-discover` | `code-brainstorm` | Use `code-brainstorm` only when the slice is still ambiguous after intake grounding. |
131
+ | `plan` | `code-plan` | `code-brainstorm` | `code-brainstorm` remains optional when the implementation path is unclear. |
132
+ | `build` | `code-worktree`, `code-tdd`, `code-execute` | `code-parallel` | `code-parallel` should be used only for clearly independent tasks. |
133
+ | `verify` | `code-verify`, `code-review` | none | Review order stays evidence first, then spec/compliance, then quality. |
134
+ | `ship` | `code-ship`, `code-finish` | none | Ship stays coding-scope only and does not expand into full release governance. |
135
+
136
+ ### Cross-cutting reactive skill
137
+ `code-debug` is cross-cutting and reactive.
138
+
139
+ It is not a fixed top-level workflow phase.
140
+ Trigger it when failures occur during:
141
+ - `build`
142
+ - `verify`
143
+ - `ship` pre-flight or integration checks
144
+
145
+ ## 8. Normal Mode vs Expert Mode
146
+ ### Normal mode
147
+ Normal mode is workflow-first.
148
+
149
+ It should:
150
+ - begin from the workflow layer
151
+ - follow the lane model
152
+ - use the workflow artifact as the execution memory
153
+ - route to the engine skills intentionally rather than making the user choose blindly
154
+
155
+ ### Expert mode
156
+ Expert mode is direct raw `code-*` usage inside the runtime.
157
+
158
+ Examples:
159
+ - `/code-plan`
160
+ - `/code-tdd`
161
+ - `/code-debug`
162
+
163
+ Expert mode rules:
164
+ - raw skill usage remains available
165
+ - it is an advanced path, not the default onboarding path
166
+ - if a workflow artifact already exists, expert-mode deviations should be recorded against it
167
+ - v1 does not require a dedicated CLI expert-mode flag
168
+
169
+ ### Expert-mode deviation recording convention
170
+ Batch 7 keeps expert mode lightweight.
171
+
172
+ If a workflow artifact already exists and you bypass the normal workflow command path with raw `code-*` usage, record the deviation under `## 6. Evidence And Review Notes` using a lightweight note that captures:
173
+ - date/time
174
+ - current phase
175
+ - raw skill used
176
+ - reason for bypass
177
+ - evidence refs
178
+ - outcome or next action
179
+
180
+ This batch does not add runtime interception or a new artifact section for expert mode.
181
+ The rule is documentation plus lightweight recording inside the existing workflow artifact.
182
+
183
+ ## 9. Runtime Truth
184
+ | Runtime | Current truth | Workflow note |
185
+ |---|---|---|
186
+ | Claude | strongest intended runtime for v1 | full workflow direction is designed with Claude in mind |
187
+ | Codex | defaults to user scope; project-local installs require the explicit local `CODEX_HOME=<project>/.codex` contract | workflow routing must stay honest about degraded collaboration behavior and not claim native `.codex/skills` auto-discovery |
188
+
189
+ Codex fallback note:
190
+ - `code-parallel` must degrade to sequential fallback when collaboration or subagent behavior is unavailable
191
+ - workflow routing must not assume runtime capabilities that Codex cannot reliably support
192
+
193
+ ## 10. Current Practical Reality
194
+ The current package can already handle:
195
+ - `sdtk-code init`
196
+ - `sdtk-code runtime install|uninstall|status`
197
+ - runtime skill installation for Claude and Codex
198
+
199
+ The workflow-first direction now defines the normal practical path:
200
+ - `sdtk-code start` for formal-handoff-first intake and artifact initialization
201
+ - `sdtk-code plan` for feature-lane refinement and optional lightweight bugfix planning
202
+ - `sdtk-code build` for build-progress tracking and next-step routing
203
+ - `sdtk-code verify` for summarized evidence capture, `REVIEW_PACKET` generation, and ordered review gating
204
+ - `sdtk-code ship` for final ship or finish decision capture
205
+ - direct raw `code-*` skills in Claude or Codex as the expert-mode escape hatch and specialist engine
206
+ - guided by this workflow routing contract
207
+
208
+ Current `start` intake truth:
209
+ - prefer `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
210
+ - fall back to `FEATURE_IMPL_PLAN + sdtk-spec.config.json` only when the formal handoff file is missing
211
+ - block cleanly when the formal handoff file exists but is invalid or upstream-blocked
212
+
213
+ ## 11. What This Contract Prevents
214
+ This routing contract exists to prevent:
215
+ - treating `SDTK-CODE` as a loose 12-skill catalog
216
+ - creating a second competing wrapper-skill catalog
217
+ - drifting into PM/BA/ARCH/QA responsibilities
218
+ - modeling `code-debug` as a fixed linear phase
219
+ - overpromising workflow command behavior that is not implemented yet