sdtk-spec-kit 0.11.0 → 0.12.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 +1 -1
- package/assets/manifest/toolkit-bundle.manifest.json +24 -24
- package/assets/manifest/toolkit-bundle.sha256.txt +11 -11
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +14 -1
- package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +7 -3
- package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +33 -2
- package/assets/toolkit/toolkit/skills-claude/dev-backend/SKILL.md +10 -0
- package/assets/toolkit/toolkit/skills-claude/dev-frontend/SKILL.md +10 -0
- package/assets/toolkit/toolkit/skills-claude/pm/SKILL.md +14 -3
- package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +40 -2
- package/assets/toolkit/toolkit/skills-claude/test-case-spec/SKILL.md +6 -0
- package/package.json +1 -1
- package/src/commands/help.js +7 -2
- package/src/lib/args.js +5 -2
- package/src/lib/design-handoff-provenance.js +30 -5
- package/src/lib/office-ingest.js +376 -0
- package/src/lib/requirement-analysis.js +77 -41
- package/src/lib/requirement-sources.js +259 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
It exposes the `sdtk-spec` CLI as the primary upstream command surface.
|
|
6
6
|
|
|
7
|
-
Package version in this source snapshot: `0.
|
|
7
|
+
Package version in this source snapshot: `0.12.0`
|
|
8
8
|
Full usage guide: `products/sdtk-spec/governance/SDTK_SPEC_USAGE_GUIDE.md`
|
|
9
9
|
|
|
10
10
|
Wraps the `SDTK-SPEC` PowerShell toolkit for portable, reproducible feature documentation scaffolding.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"sourceCommit": "
|
|
2
|
+
"version": "0.12.0",
|
|
3
|
+
"sourceCommit": "c47f2828735905708b4d2f48ad961442a2fc6463",
|
|
4
4
|
"fileCount": 167,
|
|
5
5
|
"files": [
|
|
6
6
|
{
|
|
@@ -110,13 +110,13 @@
|
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
"path": "toolkit/skills-claude/arch/SKILL.md",
|
|
113
|
-
"sha256": "
|
|
114
|
-
"size":
|
|
113
|
+
"sha256": "0643699734762f86fbd8be85c803e9f4b4bb28109cefd9ccae987976652dcd50",
|
|
114
|
+
"size": 4666
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"path": "toolkit/skills-claude/ba/SKILL.md",
|
|
118
|
-
"sha256": "
|
|
119
|
-
"size":
|
|
118
|
+
"sha256": "d4d65ee633d67e84951f8e62fa791852d0f7f6f6105814640cd0b79b67c6ba55",
|
|
119
|
+
"size": 5019
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
"path": "toolkit/skills-claude/customer-qa-sheet/SKILL.md",
|
|
@@ -135,18 +135,18 @@
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
"path": "toolkit/skills-claude/dev-backend/SKILL.md",
|
|
138
|
-
"sha256": "
|
|
139
|
-
"size":
|
|
138
|
+
"sha256": "349b9dfbfff3f402d7781f2c22639df6a1eef51075a03e5f59b01b229d09b64e",
|
|
139
|
+
"size": 5363
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
"path": "toolkit/skills-claude/dev-frontend/SKILL.md",
|
|
143
|
-
"sha256": "
|
|
144
|
-
"size":
|
|
143
|
+
"sha256": "9d2b38759bbb123b76a09c61f00e9722f3be5ae772d9cc80102f3f33649c7190",
|
|
144
|
+
"size": 5359
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
"path": "toolkit/skills-claude/dev/SKILL.md",
|
|
148
|
-
"sha256": "
|
|
149
|
-
"size":
|
|
148
|
+
"sha256": "d28ea91c627473f7fb04beaa1010d98c67e736bc4dc52a9d5928f5e94e89afd1",
|
|
149
|
+
"size": 7050
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
"path": "toolkit/skills-claude/evolve/SKILL.md",
|
|
@@ -165,13 +165,13 @@
|
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
"path": "toolkit/skills-claude/pm/SKILL.md",
|
|
168
|
-
"sha256": "
|
|
169
|
-
"size":
|
|
168
|
+
"sha256": "8fd4fff73baad99e719f45a5b5bd61adc743e9de391da322a52a669ab263077a",
|
|
169
|
+
"size": 6815
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
"path": "toolkit/skills-claude/qa/SKILL.md",
|
|
173
|
-
"sha256": "
|
|
174
|
-
"size":
|
|
173
|
+
"sha256": "beb3063e732376c0b19e1daf3589a072b1fb594b62cc0d374f91c7f97b4bbb2e",
|
|
174
|
+
"size": 8167
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
"path": "toolkit/skills-claude/screen-design-spec/SKILL.md",
|
|
@@ -195,8 +195,8 @@
|
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
197
|
"path": "toolkit/skills-claude/test-case-spec/SKILL.md",
|
|
198
|
-
"sha256": "
|
|
199
|
-
"size":
|
|
198
|
+
"sha256": "9a50d417509d53d395eaa7ab4be67a88bd5e7d18d9b1ee519f77a85ffd302e93",
|
|
199
|
+
"size": 6494
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
"path": "toolkit/skills-claude/test-case-xlsx/SKILL.md",
|
|
@@ -225,13 +225,13 @@
|
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
"path": "toolkit/skills/sdtk-arch/SKILL.md",
|
|
228
|
-
"sha256": "
|
|
229
|
-
"size":
|
|
228
|
+
"sha256": "99374ea865764eee1f182e1df7087b87b0c0b8820622f853d5f24c0cd06f98e2",
|
|
229
|
+
"size": 5929
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
"path": "toolkit/skills/sdtk-ba/SKILL.md",
|
|
233
|
-
"sha256": "
|
|
234
|
-
"size":
|
|
233
|
+
"sha256": "edb9ddd84a15aabcb97e358d9015c2e0bdeae56abcb223b57c642686181ada17",
|
|
234
|
+
"size": 2711
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
"path": "toolkit/skills/sdtk-customer-qa-sheet/references/PROFILE_TEMPLATE.md",
|
|
@@ -320,8 +320,8 @@
|
|
|
320
320
|
},
|
|
321
321
|
{
|
|
322
322
|
"path": "toolkit/skills/sdtk-pm/SKILL.md",
|
|
323
|
-
"sha256": "
|
|
324
|
-
"size":
|
|
323
|
+
"sha256": "681195e9bab01602e61083d70a2d9b58e7c8446e494bfe868e76bd9c0c128dfd",
|
|
324
|
+
"size": 4513
|
|
325
325
|
},
|
|
326
326
|
{
|
|
327
327
|
"path": "toolkit/skills/sdtk-qa/SKILL.md",
|
|
@@ -19,31 +19,31 @@ ab376df00d0fe92307ff862bac0ffe431254903cf9ccac00117d979ddc9c7f88 toolkit/sessio
|
|
|
19
19
|
fba56394ff7cae3ab8cd510b4bfb5b299df9f4f1a3e59be9bbcd573e3df477ae toolkit/session/SDTK_AGENT_WORKING_RULES.md
|
|
20
20
|
c17bb4faff318032ee99ead56e5fa182811c7bcaa176e463d0377cefde213ac1 toolkit/skills-claude/api-design-spec/SKILL.md
|
|
21
21
|
5e6716b6777029579da7314306269d22ca5a5a208940f2fe8fa6d78cd23273fb toolkit/skills-claude/api-doc/SKILL.md
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
0643699734762f86fbd8be85c803e9f4b4bb28109cefd9ccae987976652dcd50 toolkit/skills-claude/arch/SKILL.md
|
|
23
|
+
d4d65ee633d67e84951f8e62fa791852d0f7f6f6105814640cd0b79b67c6ba55 toolkit/skills-claude/ba/SKILL.md
|
|
24
24
|
1f119250175071bc6dd36520cd9e14dae7ba551f8b01c03b32e5e35130a6fe92 toolkit/skills-claude/customer-qa-sheet/SKILL.md
|
|
25
25
|
7339307d84101a76b16ab3e5e4873e3e7d3a1fc3ed316f84c3e39035085dbfbe toolkit/skills-claude/db-design/SKILL.md
|
|
26
26
|
2b96d5dcddd018d5b5a04fb90bbd15bf38885733d7e7e67206874bff04e3ed7c toolkit/skills-claude/design-layout/SKILL.md
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
349b9dfbfff3f402d7781f2c22639df6a1eef51075a03e5f59b01b229d09b64e toolkit/skills-claude/dev-backend/SKILL.md
|
|
28
|
+
9d2b38759bbb123b76a09c61f00e9722f3be5ae772d9cc80102f3f33649c7190 toolkit/skills-claude/dev-frontend/SKILL.md
|
|
29
|
+
d28ea91c627473f7fb04beaa1010d98c67e736bc4dc52a9d5928f5e94e89afd1 toolkit/skills-claude/dev/SKILL.md
|
|
30
30
|
caab483c02ff355634dd3e94c2d3d585ba6469c092ce5ab4bee97357da40be99 toolkit/skills-claude/evolve/SKILL.md
|
|
31
31
|
6fa2283aa1ebb7bf5b6e84d5d5d9d9ddf71082091b108bd46895923a5fca3e09 toolkit/skills-claude/mailbox-dispatch/SKILL.md
|
|
32
32
|
51d0d05d0f62df87a2d4d2566f8adeebe9277f668b000070063b3f9ca511a778 toolkit/skills-claude/orchestrator/SKILL.md
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
8fd4fff73baad99e719f45a5b5bd61adc743e9de391da322a52a669ab263077a toolkit/skills-claude/pm/SKILL.md
|
|
34
|
+
beb3063e732376c0b19e1daf3589a072b1fb594b62cc0d374f91c7f97b4bbb2e toolkit/skills-claude/qa/SKILL.md
|
|
35
35
|
320263e423dff2e9748b373aa9286b97721379ded62fde4e8a4dc5435a5f0048 toolkit/skills-claude/screen-design-spec/SKILL.md
|
|
36
36
|
7e2a5799440236a957af07785f825373eb5805ec986adc72641511cb1671d9e2 toolkit/skills-claude/screen-design-xlsx/SKILL.md
|
|
37
37
|
eaeae1fba56313c55bbc878e710ecf01d446bbc95bd9e885cafe4ca60dc8c658 toolkit/skills-claude/session-handoff/SKILL.md
|
|
38
38
|
ca6d2b9a8576f7c6e541c8578f8ede7de1542a128137af7d59201ba2dc98ada9 toolkit/skills-claude/smoke-test-spec/SKILL.md
|
|
39
|
-
|
|
39
|
+
9a50d417509d53d395eaa7ab4be67a88bd5e7d18d9b1ee519f77a85ffd302e93 toolkit/skills-claude/test-case-spec/SKILL.md
|
|
40
40
|
3debca695c4fe6e3497792ef5ab1781cd2d51b16cfa32d890171ec749d4e53e6 toolkit/skills-claude/test-case-xlsx/SKILL.md
|
|
41
41
|
b5f7aa816f1f6dce3ab0e7750a438f0f4f470e6f9f2ed21ad3f4091fce3082d3 toolkit/skills-claude/xlsx-safe-edit/SKILL.md
|
|
42
42
|
d6190662345da009ce8c5c235bc2cda9ef44e7e96802d103666055e26d393551 toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py
|
|
43
43
|
2fd046a8b229e54ae70d0f1091f10f9dc269f02630f443cffebc0206eac5daaf toolkit/skills/sdtk-api-design-spec/SKILL.md
|
|
44
44
|
b1e480f8c077927775be5b1b39010c29700c12f2c0eb052d836254bccf0c13ff toolkit/skills/sdtk-api-doc/SKILL.md
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
99374ea865764eee1f182e1df7087b87b0c0b8820622f853d5f24c0cd06f98e2 toolkit/skills/sdtk-arch/SKILL.md
|
|
46
|
+
edb9ddd84a15aabcb97e358d9015c2e0bdeae56abcb223b57c642686181ada17 toolkit/skills/sdtk-ba/SKILL.md
|
|
47
47
|
68a621f7ee1a6d57aae3fee59ff529be15bc7638c5fcecd6bb2680e1400104bc toolkit/skills/sdtk-customer-qa-sheet/references/PROFILE_TEMPLATE.md
|
|
48
48
|
5b6ab2ad1aab8cd3d0b2e7acc170588e9e2960128aaa8aac870b245f3811e247 toolkit/skills/sdtk-customer-qa-sheet/scripts/oq_sync.py
|
|
49
49
|
c8672bdadb96025c72d699d9cd8606496a7723047bc409fc91787732a0bf9bf7 toolkit/skills/sdtk-customer-qa-sheet/scripts/test_oq_sync.py
|
|
@@ -61,7 +61,7 @@ dfc54ea79ed315391dffea7495bcb6f6cb2514f7c0cd6ef62b75b203d38a3c64 toolkit/skills
|
|
|
61
61
|
691e7a0dd50262f247ad8a4c8ca05892c1240245de20580cc411c2d063bf9a1f toolkit/skills/sdtk-evolve/SKILL.md
|
|
62
62
|
df593d5ab4e7c5f4b05ac9ddb5078189b25bd954e546ab65c0147d024e4f4d59 toolkit/skills/sdtk-mailbox-dispatch/SKILL.md
|
|
63
63
|
e62d8044c77d525e0edf67a857767419325bc4a2679e045c0e26b769d8309a2f toolkit/skills/sdtk-orchestrator/SKILL.md
|
|
64
|
-
|
|
64
|
+
681195e9bab01602e61083d70a2d9b58e7c8446e494bfe868e76bd9c0c128dfd toolkit/skills/sdtk-pm/SKILL.md
|
|
65
65
|
95bfb5943aeb151c62d6085ea732892b34417ae3c30bed777ba7f1b18c873056 toolkit/skills/sdtk-qa/SKILL.md
|
|
66
66
|
0702605f4c3a42cd06eb35ef61ca4b64f928c6b89dfb1204bcc978fb3ce033f9 toolkit/skills/sdtk-screen-design-spec/references/commerce-profile-screens.md
|
|
67
67
|
cad3bda4560548c329041c403edf3192c6e3864f47d56736fa02690ab175964c toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md
|
|
@@ -34,7 +34,7 @@ digraph sdtk_arch_flow {
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Process
|
|
37
|
-
1. Read BA spec and PRD/backlog.
|
|
37
|
+
1. Read BA spec and PRD/backlog. For source evidence use the readable paths and line ranges in `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` when it exists (cite `source_path` when it lists more than one source).
|
|
38
38
|
2. Read `sdtk-spec.config.json` for project stack assumptions (backend/frontend/db/auth).
|
|
39
39
|
3. If architecture output includes API contracts/flows, read and apply:
|
|
40
40
|
- `toolkit/templates/docs/api/YAML_CREATION_RULES.md`
|
|
@@ -30,7 +30,7 @@ questions from the Open Questions For Human Review section must be carried
|
|
|
30
30
|
forward as explicit OQ-xx items in BA_SPEC rather than silently resolved.
|
|
31
31
|
|
|
32
32
|
## Process
|
|
33
|
-
1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements.
|
|
33
|
+
1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements. When `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` exists (from `sdtk-spec analyze`), read it first and open only the readable sources and line ranges it lists: Office files are already extracted to Markdown there, so never parse the binary copies.
|
|
34
34
|
2. Produce:
|
|
35
35
|
- Glossary
|
|
36
36
|
- BR-xx (numbered)
|
|
@@ -15,7 +15,7 @@ description: Product Manager + meta-orchestrator workflow for SDTK-SPEC. Use whe
|
|
|
15
15
|
- Phase 2+ (after BA spec): `docs/product/PRD_[FEATURE_KEY].md` + `docs/product/BACKLOG_[FEATURE_KEY].md`
|
|
16
16
|
|
|
17
17
|
## Process
|
|
18
|
-
1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out.
|
|
18
|
+
1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out. Requirement sources from `sdtk-spec analyze`: read `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` first, then only the readable sources it lists.
|
|
19
19
|
2. Create/update PM artifact(s) using `toolkit/templates/docs/product/*` as structure.
|
|
20
20
|
3. Ensure REQ-xx list is clear and testable.
|
|
21
21
|
4. If requirements are provided in VI/JP: keep the original text in an appendix and add an EN translation (literal) for traceability.
|
|
@@ -37,7 +37,7 @@ $ARGUMENTS
|
|
|
37
37
|
- `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md`
|
|
38
38
|
|
|
39
39
|
## Process
|
|
40
|
-
1. Read BA spec and PRD/backlog.
|
|
40
|
+
1. Read BA spec and PRD/backlog. For source evidence use the readable paths and line ranges in `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` when it exists (cite `source_path` when it lists more than one source).
|
|
41
41
|
2. Read `sdtk-spec.config.json` for project stack assumptions.
|
|
42
42
|
3. If architecture output includes API contracts or flows, read and apply:
|
|
43
43
|
- `./references/YAML_CREATION_RULES.md`
|
|
@@ -57,3 +57,16 @@ $ARGUMENTS
|
|
|
57
57
|
9. If anything is unclear, record OQ-xx in `ARCH_DESIGN` and escalate to PM.
|
|
58
58
|
10. Update shared state and Phase 3 checklist.
|
|
59
59
|
11. Handoff: suggest `/dev` to prepare `FEATURE_IMPL_PLAN + CODE_HANDOFF` after the design is complete.
|
|
60
|
+
|
|
61
|
+
## Order-Critical Hard Gate
|
|
62
|
+
For UI-scope features, do not generate or update `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md` until `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` already exists and is current enough to serve as the design source for the same scope.
|
|
63
|
+
|
|
64
|
+
If the layout is missing, stale, or cannot support the flow-action spec, stop and fix the layout first. Do not reverse the order and repair it later.
|
|
65
|
+
|
|
66
|
+
## Common Mistakes
|
|
67
|
+
| Mistake | Why it is wrong | Do instead |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| Generate `FLOW_ACTION_SPEC` before `DESIGN_LAYOUT` for UI scope | Forces the spec to invent screen behavior without a design source | Create or refresh the layout first, then derive the flow-action spec |
|
|
70
|
+
| Treat API YAML, API detail, and flow-action outputs as independent documents | Causes naming and traceability drift across artifacts | Keep ARCH outputs linked through shared requirements and path policy |
|
|
71
|
+
| Close open questions silently during ARCH | Hides unresolved design decisions from downstream roles | Record `OQ-xx` explicitly and escalate through `/pm` |
|
|
72
|
+
| Hand off a workflow/tooling hardening batch without a validator matrix or exact DEV surface list | Leaves `/dev` and SDTK-CODE with an under-specified contract boundary | Lock the validator matrix, exact DEV surfaces, exact out-of-scope list, and stop-before-`/dev` wording before handoff |
|
|
@@ -19,8 +19,8 @@ If prerequisites are not met, report which gate is missing and suggest user run
|
|
|
19
19
|
|
|
20
20
|
## Current Context
|
|
21
21
|
- Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
22
|
-
- Pipeline: !`node -e "
|
|
23
|
-
- Gates: !`node -e "
|
|
22
|
+
- Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
|
|
23
|
+
- Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
|
|
24
24
|
- State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
25
25
|
|
|
26
26
|
## Input
|
|
@@ -30,6 +30,10 @@ If no arguments are provided, read current feature context from SHARED_PLANNING.
|
|
|
30
30
|
|
|
31
31
|
# SDTK-SPEC BA (Business Analysis)
|
|
32
32
|
|
|
33
|
+
## Critical Constraints
|
|
34
|
+
- I do not mark BA analysis complete until `REQ`, `UC`, `BR`, and `AC` traceability is explicit.
|
|
35
|
+
- I do not silently resolve business ambiguities that belong to PM or the user.
|
|
36
|
+
|
|
33
37
|
## Output
|
|
34
38
|
- `docs/specs/BA_SPEC_[FEATURE_KEY].md`
|
|
35
39
|
|
|
@@ -51,7 +55,7 @@ questions from the Open Questions For Human Review section must be carried
|
|
|
51
55
|
forward as explicit OQ-xx items in BA_SPEC rather than silently resolved.
|
|
52
56
|
|
|
53
57
|
## Process
|
|
54
|
-
1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements.
|
|
58
|
+
1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements. When `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` exists (from `sdtk-spec analyze`), read it first and open only the readable sources and line ranges it lists: Office files are already extracted to Markdown there, so never parse the binary copies.
|
|
55
59
|
2. Produce:
|
|
56
60
|
- Glossary
|
|
57
61
|
- BR-xx (numbered)
|
|
@@ -19,8 +19,8 @@ If prerequisites are not met: report which gate is missing, suggest user run `/a
|
|
|
19
19
|
|
|
20
20
|
## Current Context
|
|
21
21
|
- Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
22
|
-
- Pipeline: !`node -e "
|
|
23
|
-
- Gates: !`node -e "
|
|
22
|
+
- Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
|
|
23
|
+
- Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
|
|
24
24
|
- State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
25
25
|
|
|
26
26
|
## Input
|
|
@@ -30,6 +30,10 @@ If no arguments provided, read current feature context from SHARED_PLANNING.md.
|
|
|
30
30
|
|
|
31
31
|
# SDTK-SPEC DEV (Planning + SDTK-CODE Handoff)
|
|
32
32
|
|
|
33
|
+
## Critical Constraints
|
|
34
|
+
- I do not emit `READY_FOR_SDTK_CODE` until the current `FEATURE_IMPL_PLAN` scope is approved and all required upstream refs are explicit.
|
|
35
|
+
- I do not claim downstream implementation is complete from within `/dev`.
|
|
36
|
+
|
|
33
37
|
## Outputs
|
|
34
38
|
- `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
|
|
35
39
|
- `docs/dev/CODE_HANDOFF_[FEATURE_KEY].json`
|
|
@@ -57,3 +61,30 @@ If no arguments provided, read current feature context from SHARED_PLANNING.md.
|
|
|
57
61
|
8. If ready, suggest:
|
|
58
62
|
- `sdtk-code start --feature-key <KEY> --lane <feature|bugfix> --project-path .`
|
|
59
63
|
9. Do not claim that `/dev` executed downstream code, build, verify, ship, or QA handoff.
|
|
64
|
+
|
|
65
|
+
## Verification Before Completion
|
|
66
|
+
Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md`.
|
|
67
|
+
|
|
68
|
+
Do not:
|
|
69
|
+
- say the handoff is ready without validating the current refs, blockers, slices, and obligations
|
|
70
|
+
- cite downstream readiness without fresh verification evidence for the claim
|
|
71
|
+
- use `should`, `probably`, or `seems` in place of executed checks
|
|
72
|
+
- rely on partial output, stale command runs, or unchecked agent reports
|
|
73
|
+
- manually compose `CODE_HANDOFF` JSON when the canonical generator script is available
|
|
74
|
+
|
|
75
|
+
If validation fails or cannot be run, report the handoff as blocked and explain the blocker.
|
|
76
|
+
|
|
77
|
+
## Order-Critical Hard Gate
|
|
78
|
+
Do not emit `READY_FOR_SDTK_CODE` until `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md` exists and the current execution scope is explicitly approved in that plan for downstream implementation.
|
|
79
|
+
|
|
80
|
+
If the plan is missing, incomplete, or still awaiting approval for the current task slice, stop and update the plan first. Do not emit the handoff first and backfill the plan later.
|
|
81
|
+
|
|
82
|
+
Do not let placeholder commands, vague slice names, or missing required refs stand in for real downstream readiness.
|
|
83
|
+
|
|
84
|
+
## Common Mistakes
|
|
85
|
+
| Mistake | Why it is wrong | Do instead |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| Treat `/dev` as the place where final code and QA handoff happen | Collapses the boundary between SDTK-SPEC and SDTK-CODE | Stop `/dev` at `FEATURE_IMPL_PLAN + CODE_HANDOFF` |
|
|
88
|
+
| Emit `READY_FOR_SDTK_CODE` with missing refs or vague slices | Pushes ambiguity downstream and weakens handoff quality | Make refs, slices, obligations, and blockers explicit before the handoff |
|
|
89
|
+
| Retry a `BLOCKED` manual helper prompt with the same context | Repeats the same failure mode | Add missing context, split the task, or keep the handoff blocked |
|
|
90
|
+
| Copy `UPDATE_ME` placeholder commands into the plan as if they were executable verification | Fakes downstream readiness and weakens verification-before-completion | Replace placeholders with issue-specific real commands or state truthfully that a project-level command is unknown |
|
|
@@ -71,3 +71,13 @@ Do not declare a slice done without verifying the generated endpoints satisfy th
|
|
|
71
71
|
| Omit `transaction.atomic()` on multi-step writes | Risk of partial writes and data corruption | Wrap every write sequence in an atomic block |
|
|
72
72
|
| Use a different module pattern than the existing repo reference | Inconsistency that maintainers must correct | Read the reference module and match its structure exactly |
|
|
73
73
|
| Treat this skill as a replacement for `sdtk-dev` | Collapses bounded specialist scope into general DEV ownership | Keep scope explicitly bounded to the current slice |
|
|
74
|
+
|
|
75
|
+
## Reference Loading Guidance
|
|
76
|
+
Read at slice start:
|
|
77
|
+
- `docs/api/[FeaturePascal]_API.yaml` (required)
|
|
78
|
+
- `docs/api/[FEATURE_KEY]_ENDPOINTS.md` (required)
|
|
79
|
+
- `docs/specs/BA_SPEC_[FEATURE_KEY].md` or `docs/architecture/ARCH_DESIGN_[FEATURE_KEY].md` (required)
|
|
80
|
+
|
|
81
|
+
Read on demand:
|
|
82
|
+
- Existing backend reference module in `src/backend/` (match its patterns)
|
|
83
|
+
- `sdtk-spec.config.json` for stack-specific test/lint commands
|
|
@@ -71,3 +71,13 @@ Do not declare a slice done without verifying all implemented screens satisfy th
|
|
|
71
71
|
| Use a different structure than the existing frontend reference | Inconsistency maintainers must correct | Read the reference module and match its structure exactly |
|
|
72
72
|
| Treat this skill as a replacement for `sdtk-dev` | Collapses bounded specialist scope into general DEV ownership | Keep scope explicitly bounded to the current slice |
|
|
73
73
|
| Add field labels from memory | Labels drift from the spec | Copy field label text exactly from the layout or flow-action doc |
|
|
74
|
+
|
|
75
|
+
## Reference Loading Guidance
|
|
76
|
+
Read at slice start:
|
|
77
|
+
- `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` (required)
|
|
78
|
+
- `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md` (required)
|
|
79
|
+
- `docs/api/[FEATURE_KEY]_ENDPOINTS.md` (required)
|
|
80
|
+
|
|
81
|
+
Read on demand:
|
|
82
|
+
- Existing frontend reference module in `src/frontend/` (match its patterns)
|
|
83
|
+
- `sdtk-spec.config.json` for stack-specific commands
|
|
@@ -20,8 +20,8 @@ If prerequisites NOT met: report which gate is missing, suggest user run the pre
|
|
|
20
20
|
|
|
21
21
|
## Current Context
|
|
22
22
|
- Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
23
|
-
- Pipeline: !`node -e "
|
|
24
|
-
- Gates: !`node -e "
|
|
23
|
+
- Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
|
|
24
|
+
- Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
|
|
25
25
|
- State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
26
26
|
|
|
27
27
|
## Input
|
|
@@ -31,12 +31,17 @@ If no arguments provided, read current feature context from SHARED_PLANNING.md.
|
|
|
31
31
|
|
|
32
32
|
# SDTK-SPEC PM (Entry Point + Planning)
|
|
33
33
|
|
|
34
|
+
## Critical Constraints
|
|
35
|
+
- I do not hand off PM work until `SHARED_PLANNING.md` and `QUALITY_CHECKLIST.md` reflect the current phase.
|
|
36
|
+
- I do not hide unresolved scope or decision gaps; I record them as `OQ-xx` items for downstream roles.
|
|
37
|
+
- I do not write `committed`, `pushed`, `publish-ready`, or `ship complete` closure wording without exact git and downstream-phase evidence to support it.
|
|
38
|
+
|
|
34
39
|
## Outputs
|
|
35
40
|
- Phase 1: `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md`
|
|
36
41
|
- Phase 2+ (after BA spec): `docs/product/PRD_[FEATURE_KEY].md` + `docs/product/BACKLOG_[FEATURE_KEY].md`
|
|
37
42
|
|
|
38
43
|
## Process
|
|
39
|
-
1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out.
|
|
44
|
+
1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out. Requirement sources from `sdtk-spec analyze`: read `.sdtk/spec/requirements/SOURCE_INDEX_[FEATURE_KEY].md` first, then only the readable sources it lists.
|
|
40
45
|
2. Create/update PM artifact(s).
|
|
41
46
|
3. Ensure REQ-xx list is clear and testable.
|
|
42
47
|
4. If requirements are provided in VI/JP: keep the original text in an appendix and add an EN translation (literal) for traceability.
|
|
@@ -86,3 +91,9 @@ Rules:
|
|
|
86
91
|
- Try to resolve OQ-xx using existing docs and reasonable product/tech decisions.
|
|
87
92
|
- If still missing information from the original input: ask the user (final stakeholder) and record the answer as the resolution.
|
|
88
93
|
- Record decisions in PRD `Decision Log` and update OQ-xx `Resolution` fields in the originating docs.
|
|
94
|
+
|
|
95
|
+
## Phase 6 Closure Truth
|
|
96
|
+
- Review the final QA and controller decisions before closing the issue.
|
|
97
|
+
- Treat `SHARED_PLANNING.md`, `QUALITY_CHECKLIST.md`, and `governance/ai/core/IMPROVEMENT_BACKLOG.md` as closure-state surfaces that must stay synchronized.
|
|
98
|
+
- Before using `committed` or `pushed` wording, verify the actual git state that supports the claim.
|
|
99
|
+
- Do not turn issue closeout into a fake standalone publish or release-wave claim unless that separate evidence truly exists.
|
|
@@ -22,8 +22,8 @@ If prerequisites are not met, report which gate or downstream evidence is missin
|
|
|
22
22
|
|
|
23
23
|
## Current Context
|
|
24
24
|
- Config: !`node -e "try{process.stdout.write(require('fs').readFileSync('sdtk-spec.config.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
25
|
-
- Pipeline: !`node -e "
|
|
26
|
-
- Gates: !`node -e "
|
|
25
|
+
- Pipeline (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" SHARED_PLANNING.md 8000 4000`
|
|
26
|
+
- Gates (head + newest tail, bounded): !`node -e "const fs=require('fs'),[f,H,T]=process.argv.slice(1).map((v,i)=>i?+v:v);let s;try{s=fs.readFileSync(f,'utf8')}catch(e){process.stdout.write('Not initialized');process.exit(0)}if(s.length<=H+T){process.stdout.write(s)}else{let h=s.slice(0,H),t=s.slice(-T);h=h.slice(0,h.lastIndexOf('\n')+1);t=t.slice(t.indexOf('\n')+1);process.stdout.write(h+'\n[... '+(s.length-h.length-t.length)+' of '+s.length+' chars omitted to keep context small -- open '+f+' and read only the section you need ...]\n\n'+t)}" QUALITY_CHECKLIST.md 8000 4000`
|
|
27
27
|
- State: !`node -e "try{process.stdout.write(require('fs').readFileSync('.sdtk/orchestration-state.json','utf8'))}catch{process.stdout.write('{}')}"`
|
|
28
28
|
|
|
29
29
|
## Input
|
|
@@ -33,6 +33,15 @@ If no arguments are provided, read current feature context from SHARED_PLANNING.
|
|
|
33
33
|
|
|
34
34
|
# SDTK-SPEC QA (Testing + Release Decision)
|
|
35
35
|
|
|
36
|
+
## Critical Constraints
|
|
37
|
+
- I do not start QA handoff or release decision work until downstream implementation evidence exists, normally from SDTK-CODE.
|
|
38
|
+
- I do not approve without exact specification quotes and fresh verification evidence.
|
|
39
|
+
- `docs/dev/REVIEW_PACKET_[FEATURE_KEY].md` is a required QA input when `SDTK-CODE verify` has run.
|
|
40
|
+
- `OPS_HANDOFF_[FEATURE_KEY].json` alone is not sufficient final release evidence.
|
|
41
|
+
- When operationalization is in scope, I require both CODE evidence and OPS evidence before I can issue `APPROVED`.
|
|
42
|
+
- I remain the final release authority for the QA verdict and do not hand final release-status ownership back to PM after QA approval.
|
|
43
|
+
- `docs/qa/QA_RELEASE_REPORT_[FEATURE_KEY].md` remains the primary QA output even when `docs/qa/CONTROLLER_ACCEPTANCE_[FEATURE_KEY].md` exists.
|
|
44
|
+
|
|
36
45
|
## Output
|
|
37
46
|
- `docs/qa/QA_RELEASE_REPORT_[FEATURE_KEY].md`
|
|
38
47
|
- `docs/qa/CONTROLLER_ACCEPTANCE_[FEATURE_KEY].md` remains a separate downstream controller artifact and does not replace the primary QA output
|
|
@@ -56,3 +65,32 @@ If no arguments are provided, read current feature context from SHARED_PLANNING.
|
|
|
56
65
|
14. Decide: APPROVED vs REJECTED (with reasons). `OPS_HANDOFF` alone is not sufficient final release evidence, and missing required OPS evidence blocks approval.
|
|
57
66
|
15. Update shared state + Phase 5 checklist.
|
|
58
67
|
16. Handoff: notify PM and stakeholders of the QA verdict and follow-up without reassigning final QA release authority.
|
|
68
|
+
|
|
69
|
+
## Verification Before Completion
|
|
70
|
+
Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md` and require fresh verification evidence before any QA verdict or handoff.
|
|
71
|
+
|
|
72
|
+
Do not:
|
|
73
|
+
- issue an APPROVED verdict without fresh verification evidence
|
|
74
|
+
- infer PASS from expected behavior, partial logs, or missing runtime access
|
|
75
|
+
- overstate benchmark-mode results as if they were live execution results
|
|
76
|
+
- let severity ordering, verdict wording, or release-gate wording drift out of sync
|
|
77
|
+
|
|
78
|
+
If the environment cannot run the proving checks, follow the benchmark QA mode policy explicitly and state that the result is not fully verified at runtime.
|
|
79
|
+
|
|
80
|
+
## Specification Quoting
|
|
81
|
+
When validating a requirement, quote the exact source text before judging the evidence.
|
|
82
|
+
|
|
83
|
+
Use this format:
|
|
84
|
+
- `Spec says: "[exact quote]" -> Evidence: [match/mismatch + file reference]`
|
|
85
|
+
|
|
86
|
+
Apply it to BA, PRD or BACKLOG, ARCH, API, DB, and flow-action sources whenever they define the expected behavior.
|
|
87
|
+
|
|
88
|
+
## Order-Critical Hard Gate
|
|
89
|
+
Do not start QA handoff, release testing, or release decision work until downstream implementation evidence is documented for the current feature, normally from SDTK-CODE `verify`/`ship` outputs or equivalent coding-review evidence.
|
|
90
|
+
|
|
91
|
+
If downstream implementation evidence is missing or stale, keep the work blocked and request a refreshed downstream handoff before QA starts.
|
|
92
|
+
|
|
93
|
+
Block final QA approval until:
|
|
94
|
+
- `docs/dev/OPS_HANDOFF_[FEATURE_KEY].json` exists and matches the current feature scope
|
|
95
|
+
- downstream OPS evidence is present and current
|
|
96
|
+
- QA release notes show `REVIEW_PACKET`, CODE evidence, and OPS evidence as separate first-class inputs
|
|
@@ -113,3 +113,9 @@ Read at slice start:
|
|
|
113
113
|
Read on demand:
|
|
114
114
|
- `docs/specs/Q&A.md` or `docs/en/specs/Q&A.md` (when clarification is needed)
|
|
115
115
|
- `governance/ai/core/SDTK_BENCHMARK_OQ_POLICY.md` (when OQ-xx items need policy guidance)
|
|
116
|
+
|
|
117
|
+
## Specification Quoting
|
|
118
|
+
When a testcase, coverage note, or defect check depends on a requirement, quote the exact source text before stating coverage or mismatch.
|
|
119
|
+
|
|
120
|
+
Use this format:
|
|
121
|
+
- `Spec says: "[exact quote]" -> Evidence: [covered/not covered + file reference]`
|
package/package.json
CHANGED
package/src/commands/help.js
CHANGED
|
@@ -104,7 +104,8 @@ function cmdHelp() {
|
|
|
104
104
|
" --verbose Show detailed PowerShell script output",
|
|
105
105
|
"",
|
|
106
106
|
"Analyze options:",
|
|
107
|
-
" --source <file>
|
|
107
|
+
" --source <file|dir> Requirement source: text/Markdown or .docx/.xlsx/.pptx file, or a",
|
|
108
|
+
" directory (recursive). Repeatable; at least one required",
|
|
108
109
|
" --key <KEY> Identifier, UPPER_SNAKE_CASE (required; alias: --feature-key)",
|
|
109
110
|
" --name \"<text>\" Human-readable name (required; alias: --feature-name)",
|
|
110
111
|
" --project-path <path> Target project directory (default: cwd)",
|
|
@@ -209,7 +210,11 @@ function cmdHelp() {
|
|
|
209
210
|
" Output is written to docs/ subdirectories under the project path.",
|
|
210
211
|
"",
|
|
211
212
|
"Analyze behavior:",
|
|
212
|
-
" The analyze command preserves
|
|
213
|
+
" The analyze command preserves every requirement source under .sdtk/spec/requirements/.",
|
|
214
|
+
" Office files (.docx/.xlsx/.pptx) are extracted once to Markdown under extracted/<KEY>/.",
|
|
215
|
+
" It writes SOURCE_INDEX_<KEY>.md: each source's readable path, size and heading outline",
|
|
216
|
+
" with line numbers, so agents open only what a phase needs. PDF and legacy .doc/.xls/.ppt",
|
|
217
|
+
" are refused when named explicitly and skipped (listed in the index) inside a directory.",
|
|
213
218
|
" It bootstraps the standard 17-file scaffold when missing by reusing generate behavior.",
|
|
214
219
|
" It creates .sdtk/spec/tasks/<KEY>/ task packets for PM/BA/ARCH/DEV/QA agent analysis.",
|
|
215
220
|
" It reports likely mojibake/encoding risk and source hash traceability.",
|
package/src/lib/args.js
CHANGED
|
@@ -7,7 +7,8 @@ const { ValidationError } = require("./errors");
|
|
|
7
7
|
* Supports: --flag value, --flag=value, --bool-flag (no value).
|
|
8
8
|
*
|
|
9
9
|
* @param {string[]} argv - Raw arguments (after command is stripped).
|
|
10
|
-
* @param {Object<string, {type: 'string'|'boolean', required?: boolean, alias?: string}>} defs - Flag definitions.
|
|
10
|
+
* @param {Object<string, {type: 'string'|'boolean', required?: boolean, alias?: string, multiple?: boolean}>} defs - Flag definitions.
|
|
11
|
+
* `multiple: true` (string flags) collects every occurrence into an array (default []).
|
|
11
12
|
* @returns {{ flags: Object, positional: string[] }}
|
|
12
13
|
*/
|
|
13
14
|
function parseFlags(argv, defs) {
|
|
@@ -18,6 +19,7 @@ function parseFlags(argv, defs) {
|
|
|
18
19
|
for (const [name, def] of Object.entries(defs)) {
|
|
19
20
|
if (def.alias) aliasMap[def.alias] = name;
|
|
20
21
|
if (def.type === "boolean") flags[name] = false;
|
|
22
|
+
else if (def.multiple) flags[name] = [];
|
|
21
23
|
else flags[name] = undefined;
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -65,7 +67,8 @@ function parseFlags(argv, defs) {
|
|
|
65
67
|
}
|
|
66
68
|
value = argv[i];
|
|
67
69
|
}
|
|
68
|
-
flags[resolved]
|
|
70
|
+
if (def.multiple) flags[resolved].push(value);
|
|
71
|
+
else flags[resolved] = value;
|
|
69
72
|
i++;
|
|
70
73
|
}
|
|
71
74
|
}
|
|
@@ -84,13 +84,16 @@ function validateDesignHandoffProvenance(options) {
|
|
|
84
84
|
const handoffPath = options && options.handoffPath;
|
|
85
85
|
const sourcePath = options && options.sourcePath;
|
|
86
86
|
const sampleNames = options && Array.isArray(options.sampleNames) ? options.sampleNames : [];
|
|
87
|
+
// BK-465: with several indexed sources a screen names its readable file in
|
|
88
|
+
// `source_path` (project-relative, from SOURCE_INDEX); projectPath resolves it.
|
|
89
|
+
const projectPath = options && options.projectPath ? path.resolve(options.projectPath) : null;
|
|
87
90
|
|
|
88
91
|
const violations = [];
|
|
89
92
|
if (!handoffPath || !fs.existsSync(handoffPath)) {
|
|
90
93
|
addViolation(violations, "(handoff)", "handoffPath", `Handoff JSON does not exist: ${handoffPath || ""}`);
|
|
91
94
|
return { ok: false, code: PROVENANCE_VIOLATION, violations };
|
|
92
95
|
}
|
|
93
|
-
if (
|
|
96
|
+
if ((sourcePath && !fs.existsSync(sourcePath)) || (!sourcePath && !projectPath)) {
|
|
94
97
|
addViolation(violations, "(source)", "sourcePath", `Requirement source does not exist: ${sourcePath || ""}`);
|
|
95
98
|
return { ok: false, code: PROVENANCE_VIOLATION, violations };
|
|
96
99
|
}
|
|
@@ -103,8 +106,25 @@ function validateDesignHandoffProvenance(options) {
|
|
|
103
106
|
return { ok: false, code: PROVENANCE_VIOLATION, violations };
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
const
|
|
107
|
-
const
|
|
109
|
+
const defaultText = sourcePath ? readSourceText(sourcePath) : null;
|
|
110
|
+
const textCache = new Map();
|
|
111
|
+
// Returns { text } or { error } for one screen's source.
|
|
112
|
+
function sourceFor(screen) {
|
|
113
|
+
const rel = screen && typeof screen.source_path === "string" ? screen.source_path.trim() : "";
|
|
114
|
+
if (!rel) {
|
|
115
|
+
return defaultText === null
|
|
116
|
+
? { error: "source_path is required when no single requirement source is given." }
|
|
117
|
+
: { text: defaultText };
|
|
118
|
+
}
|
|
119
|
+
if (!projectPath) return { error: "source_path needs projectPath to resolve it." };
|
|
120
|
+
const abs = path.resolve(projectPath, rel);
|
|
121
|
+
if (abs !== projectPath && !abs.startsWith(projectPath + path.sep)) {
|
|
122
|
+
return { error: `source_path escapes the project: ${rel}` };
|
|
123
|
+
}
|
|
124
|
+
if (!textCache.has(abs)) textCache.set(abs, fs.existsSync(abs) ? readSourceText(abs) : null);
|
|
125
|
+
const text = textCache.get(abs);
|
|
126
|
+
return text === null ? { error: `source_path does not exist: ${rel}` } : { text };
|
|
127
|
+
}
|
|
108
128
|
const screens = extractScreens(handoff);
|
|
109
129
|
const normalizedSamples = new Set(sampleNames.map(normalizedSampleName).filter(Boolean));
|
|
110
130
|
|
|
@@ -125,7 +145,12 @@ function validateDesignHandoffProvenance(options) {
|
|
|
125
145
|
if (!title) {
|
|
126
146
|
addViolation(violations, screenRef, "title", "Screen title is required.");
|
|
127
147
|
}
|
|
128
|
-
|
|
148
|
+
const source = sourceFor(screen);
|
|
149
|
+
const sourceText = source.text || "";
|
|
150
|
+
const sourceLines = sourceText.split("\n");
|
|
151
|
+
if (source.error) {
|
|
152
|
+
addViolation(violations, screenRef, "source_path", source.error);
|
|
153
|
+
} else if (!quote) {
|
|
129
154
|
addViolation(violations, screenRef, "source_quote", "source_quote is required.");
|
|
130
155
|
} else {
|
|
131
156
|
if (codePointLength(quote) < MIN_SOURCE_QUOTE_CODE_POINTS) {
|
|
@@ -162,7 +187,7 @@ function validateDesignHandoffProvenance(options) {
|
|
|
162
187
|
ok: violations.length === 0,
|
|
163
188
|
code: violations.length === 0 ? "OK" : PROVENANCE_VIOLATION,
|
|
164
189
|
handoffPath: path.resolve(handoffPath),
|
|
165
|
-
sourcePath: path.resolve(sourcePath),
|
|
190
|
+
sourcePath: sourcePath ? path.resolve(sourcePath) : null,
|
|
166
191
|
screenCount: screens.length,
|
|
167
192
|
violations,
|
|
168
193
|
};
|