sdtk-kit 0.3.6 → 0.3.8
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 +10 -1
- package/assets/manifest/toolkit-bundle.manifest.json +116 -56
- package/assets/manifest/toolkit-bundle.sha256.txt +38 -26
- package/assets/toolkit/toolkit/AGENTS.md +31 -9
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +4 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +7 -1
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +4 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +34 -2
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +7 -1
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +56 -9
- package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +4 -0
- package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +20 -0
- package/assets/toolkit/toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py +213 -0
- package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +75 -5
- package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/code-quality-reviewer.md +35 -0
- package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/implementer.md +61 -0
- package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/spec-reviewer.md +42 -0
- package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +4 -0
- package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +4 -0
- package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +38 -2
- package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +4 -0
- package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +36 -6
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +10 -3
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +56 -9
- package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +11 -0
- package/assets/toolkit/toolkit/skills/skills.catalog.yaml +302 -0
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +7 -1
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +6 -0
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +17 -0
- package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +56 -9
- package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_TEMPLATE.md +14 -2
- package/assets/toolkit/toolkit/templates/handoffs/ARCH_TO_DEV.md +31 -0
- package/assets/toolkit/toolkit/templates/handoffs/BA_TO_ARCH.md +28 -0
- package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE1_SPEC_REVIEW.md +26 -0
- package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE2_CODE_QUALITY_REVIEW.md +20 -0
- package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +23 -0
- package/assets/toolkit/toolkit/templates/handoffs/PM_TO_BA.md +26 -0
- package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +21 -0
- package/package.json +1 -1
|
@@ -5,6 +5,10 @@ description: Solution Architect workflow for SDTK. Use when you need to convert
|
|
|
5
5
|
|
|
6
6
|
# SDTK ARCH (Solution Architecture)
|
|
7
7
|
|
|
8
|
+
## Critical Constraints
|
|
9
|
+
- I do not generate `FLOW_ACTION_SPEC` before `DESIGN_LAYOUT` for UI-scope features.
|
|
10
|
+
- I do not let API, DB, and UI artifacts drift from the same BA and PM source of truth.
|
|
11
|
+
|
|
8
12
|
## Outputs
|
|
9
13
|
- `docs/architecture/ARCH_DESIGN_[FEATURE_KEY].md`
|
|
10
14
|
- If applicable:
|
|
@@ -16,6 +20,19 @@ description: Solution Architect workflow for SDTK. Use when you need to convert
|
|
|
16
20
|
- `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`
|
|
17
21
|
- `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md`
|
|
18
22
|
|
|
23
|
+
## Flow Overview
|
|
24
|
+
|
|
25
|
+
```dot
|
|
26
|
+
digraph sdtk_arch_flow {
|
|
27
|
+
rankdir=TB;
|
|
28
|
+
BA_SPEC -> ARCH_DESIGN;
|
|
29
|
+
ARCH_DESIGN -> DESIGN_LAYOUT;
|
|
30
|
+
DESIGN_LAYOUT -> FLOW_ACTION_SPEC;
|
|
31
|
+
ARCH_DESIGN -> API_YAML;
|
|
32
|
+
API_YAML -> API_DETAIL;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
19
36
|
## Process
|
|
20
37
|
1. Read BA spec and PRD/backlog.
|
|
21
38
|
2. Read `sdtk.config.json` for project stack assumptions (backend/frontend/db/auth).
|
|
@@ -27,8 +44,9 @@ description: Solution Architect workflow for SDTK. Use when you need to convert
|
|
|
27
44
|
5. If API detail spec is required, use `sdtk-api-design-spec` to build/update `docs/api/[FEATURE_KEY]_API_DESIGN_DETAIL.md` using YAML + flow list.
|
|
28
45
|
6. For UI-scope features, enforce this generation sequence:
|
|
29
46
|
a. Generate/update `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` first (using `sdtk-design-layout`).
|
|
30
|
-
b.
|
|
31
|
-
c.
|
|
47
|
+
b. Attempt to render screen preview images from the layout using `render_design_layout_images.py`. Output: `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`. If rendering fails (no Java/plantuml.jar), fall back to the render-skipped note -- do not silently skip.
|
|
48
|
+
c. Then generate/update `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md` (using `sdtk-screen-design-spec`).
|
|
49
|
+
d. The flow-action spec must reference the design-layout doc as its design source when no Figma/screenshot is available (Design Source Type: `generated-draft`). Use rendered `.svg` files as the screen image. If render failed, use the render-skipped note instead of a broken image reference.
|
|
32
50
|
7. For complex UI flow-action specs, use `sdtk-screen-design-spec` to build/update `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md`.
|
|
33
51
|
8. Define:
|
|
34
52
|
- System components + data model
|
|
@@ -49,3 +67,17 @@ description: Solution Architect workflow for SDTK. Use when you need to convert
|
|
|
49
67
|
12. If anything is unclear, record OQ-xx in ARCH_DESIGN "Open Questions" and escalate to `@pm` for a decision.
|
|
50
68
|
13. Update shared state + Phase 3 checklist.
|
|
51
69
|
14. Handoff: `@dev please implement ...`.
|
|
70
|
+
|
|
71
|
+
## Order-Critical Hard Gate
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Common Mistakes
|
|
78
|
+
|
|
79
|
+
| Mistake | Why it is wrong | Do instead |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| 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 |
|
|
82
|
+
| 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 |
|
|
83
|
+
| Close open questions silently during ARCH | Hides unresolved design decisions from downstream roles | Record `OQ-xx` explicitly and escalate through `@pm` |
|
|
@@ -7,10 +7,16 @@ The active rule source for API design detail and API flowchart behavior is now:
|
|
|
7
7
|
- `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` (root)
|
|
8
8
|
- `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` (toolkit)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Even in compatibility mode, generated API design detail docs must still include:
|
|
11
|
+
- a top-level `## Assumptions` section
|
|
12
|
+
- this table format: `| # | Assumption | Verified | Risk if wrong |`
|
|
13
|
+
- explicit unresolved assumptions when downstream review depends on them
|
|
14
|
+
|
|
15
|
+
Use the active rule file for:
|
|
11
16
|
- API design detail markdown structure
|
|
12
17
|
- flowchart integration and synchronization rules
|
|
13
18
|
- error section rules
|
|
14
19
|
- flow summary / notes / login rules
|
|
20
|
+
- assumptions-section requirements
|
|
15
21
|
|
|
16
22
|
This compatibility note should remain only until all references are migrated.
|
package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md
CHANGED
|
@@ -38,6 +38,23 @@ Primary sample references:
|
|
|
38
38
|
- `GET /bukken/info/{company_uuid}/{bukken_uuid}` style
|
|
39
39
|
- search API query-builder style shown in the Bukken sample helper flow
|
|
40
40
|
|
|
41
|
+
## 2.1 API Design Detail Markdown Requirements
|
|
42
|
+
|
|
43
|
+
Generated `*_API_DESIGN_DETAIL.md` files must keep this minimum structure:
|
|
44
|
+
- `## 0. Abbreviations`
|
|
45
|
+
- `## 1. Document Scope`
|
|
46
|
+
- `## Assumptions`
|
|
47
|
+
- per-endpoint `## <n>. API Detail ...` sections
|
|
48
|
+
- `## 3. Generation Notes` or the current equivalent final notes section
|
|
49
|
+
|
|
50
|
+
`## Assumptions` must use this table shape:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
| # | Assumption | Verified | Risk if wrong |
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If an assumption is not verified yet, keep it explicit and treat it as a downstream review risk instead of silently collapsing it into a fact.
|
|
57
|
+
|
|
41
58
|
## 3. Core Flowchart Writing Rules
|
|
42
59
|
|
|
43
60
|
### Rule A. Add a visible API header for every block
|
package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md
CHANGED
|
@@ -19,12 +19,13 @@ A flow-action spec should include, at minimum:
|
|
|
19
19
|
|
|
20
20
|
1. `Abbreviations`
|
|
21
21
|
2. `Feature overview`
|
|
22
|
-
3. `
|
|
23
|
-
4. `Screen
|
|
24
|
-
5. `
|
|
25
|
-
6. `
|
|
26
|
-
7. `
|
|
27
|
-
8. `
|
|
22
|
+
3. `Assumptions`
|
|
23
|
+
4. `Screen flow action` (with PlantUML)
|
|
24
|
+
5. `Screen layout spec by flow action`
|
|
25
|
+
6. `System processing flow`
|
|
26
|
+
7. `Open questions`
|
|
27
|
+
8. `Screen - API mapping`
|
|
28
|
+
9. `Document history`
|
|
28
29
|
|
|
29
30
|
If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
|
|
30
31
|
|
|
@@ -40,7 +41,34 @@ If a section is not in scope, keep the section and mark explicitly as `N/A` with
|
|
|
40
41
|
- Table rows must keep column count consistent with the header (no broken or merged rows).
|
|
41
42
|
- Avoid single-line merged content that collapses multiple logical items into one table row.
|
|
42
43
|
|
|
43
|
-
### 3.1
|
|
44
|
+
### 3.1 Action Table Mapping Completion Rules
|
|
45
|
+
|
|
46
|
+
- After API endpoint spec and database spec are available, the action-table columns `Attribute`, `DB Column`, `Size`, and `Default Value` must not be left blank when the mapping can be derived from current source-of-truth inputs.
|
|
47
|
+
- Fill these four columns only after the relevant API contract and DB schema are stable enough to be treated as the current source of truth for the active phase.
|
|
48
|
+
- Source priority for filling the four columns:
|
|
49
|
+
1. `docs/api/*_ENDPOINTS.md` and OpenAPI YAML for request/response contract
|
|
50
|
+
2. `docs/database/DATABASE_SPEC_*.md` for physical column names, nullability, storage shape, and query-source aliases
|
|
51
|
+
3. confirmed flow/business rules for default state and behavior
|
|
52
|
+
4. design source (Figma/Excel) for screen label and control type only
|
|
53
|
+
- `Attribute` rules:
|
|
54
|
+
- input item: use the canonical request payload path
|
|
55
|
+
- display item: use the canonical response path
|
|
56
|
+
- UI-only item: use `ui.*` namespace
|
|
57
|
+
- `DB Column` rules:
|
|
58
|
+
- use physical DB column names or query-source aliases from the API/database spec
|
|
59
|
+
- if multiple columns participate, list them explicitly
|
|
60
|
+
- if the control is UI-only, write `N/A`
|
|
61
|
+
- `Size` rules:
|
|
62
|
+
- document data format/type, not pixel width
|
|
63
|
+
- prefer canonical forms such as `uuid`, `DATE (YYYY-MM-DD)`, `DATETIME`, `TIME (HH:mm)`, `boolean`, `array[uuid]`, `enum(...)`, `JSON string`
|
|
64
|
+
- prefer DB storage type first; if not available, fall back to API schema type/format
|
|
65
|
+
- `Default Value` rules:
|
|
66
|
+
- use confirmed business, UI, or runtime defaults
|
|
67
|
+
- if the default comes from settings or environment, state that clearly
|
|
68
|
+
- if not finalized, use `TBD` and keep or raise an open-question reference in `Note`
|
|
69
|
+
- If screen labels conflict with canonical API/DB naming, preserve the original screen label in the visible screen columns, but keep `Attribute` and `DB Column` aligned to API/DB source of truth and explain the mismatch in `Note`.
|
|
70
|
+
|
|
71
|
+
### 3.2 Language and Encoding Standards (EN Artifacts)
|
|
44
72
|
|
|
45
73
|
- For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
|
|
46
74
|
- JP labels, if provided by the input, should be kept in a clearly marked appendix or note column, not in the default item table columns.
|
|
@@ -49,12 +77,19 @@ If a section is not in scope, keep the section and mark explicitly as `N/A` with
|
|
|
49
77
|
- Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
|
|
50
78
|
- Keep canonical terminology stable across documents (for example: `bukken`, `sagyo`, `customer employee`).
|
|
51
79
|
|
|
52
|
-
### 3.
|
|
80
|
+
### 3.3 Markdown Structure Hygiene
|
|
53
81
|
|
|
54
82
|
- Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
|
|
55
83
|
- Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
|
|
56
84
|
- Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
|
|
57
85
|
|
|
86
|
+
### 3.4 Assumptions Section
|
|
87
|
+
|
|
88
|
+
- Every flow-action spec must include a top-level `## Assumptions` section.
|
|
89
|
+
- Use this table format exactly: `# | Assumption | Verified | Risk if wrong`.
|
|
90
|
+
- Keep assumptions explicit when downstream mapping or behavior depends on an unresolved decision.
|
|
91
|
+
- If an assumption affects UI behavior, API mapping, or DB mapping, reflect the risk in `Note` and keep or raise the related `OQ-xx` item.
|
|
92
|
+
|
|
58
93
|
## 4. Item Numbering and Duplication Rules
|
|
59
94
|
|
|
60
95
|
- Use one numbering mode only: `global across document`.
|
|
@@ -115,6 +150,17 @@ Rules:
|
|
|
115
150
|
- Store images in repository-relative paths.
|
|
116
151
|
- Do not keep temporary local absolute paths in markdown.
|
|
117
152
|
|
|
153
|
+
### 8.1 Rendered Screen Images for Generated-Draft Screens
|
|
154
|
+
|
|
155
|
+
When `Design Source Type` is `generated-draft`:
|
|
156
|
+
- Screen preview images may be rendered from `DESIGN_LAYOUT_[FEATURE_KEY].md` PlantUML SALT wireframes.
|
|
157
|
+
- Renderer: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
|
|
158
|
+
- Expected output path: `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
|
|
159
|
+
- If the rendered `.svg` file exists, use it as the `Screen image:` reference.
|
|
160
|
+
- If rendering is unavailable or the `.svg` does not exist, replace the image line with:
|
|
161
|
+
`> Screen image not rendered in this environment. See Design Source Reference for layout.`
|
|
162
|
+
- Do not leave a broken image reference pointing to a non-existent file.
|
|
163
|
+
|
|
118
164
|
## 9. Consistency with Other Specs
|
|
119
165
|
|
|
120
166
|
- Align terms with:
|
|
@@ -145,8 +191,9 @@ Rules:
|
|
|
145
191
|
- All mandatory sections exist.
|
|
146
192
|
- All tables include `No`.
|
|
147
193
|
- Numbering is global across the document (no resets).
|
|
148
|
-
- No broken image links.
|
|
194
|
+
- No broken image links (for `generated-draft` screens: `.svg` exists or render-skipped note is present).
|
|
149
195
|
- Screen/API mappings are consistent with `*_ENDPOINTS.md`.
|
|
196
|
+
- Assumptions section exists and unresolved assumptions are traceable.
|
|
150
197
|
- Open questions are explicit and traceable.
|
|
151
198
|
- For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
|
|
152
199
|
- No mojibake/encoding corruption markers.
|
|
@@ -5,6 +5,10 @@ description: Business Analyst workflow for SDTK. Use when you need to turn PM in
|
|
|
5
5
|
|
|
6
6
|
# SDTK BA (Business Analysis)
|
|
7
7
|
|
|
8
|
+
## Critical Constraints
|
|
9
|
+
- I do not mark BA analysis complete until `REQ`, `UC`, `BR`, and `AC` traceability is explicit.
|
|
10
|
+
- I do not silently resolve business ambiguities that belong to PM or the user.
|
|
11
|
+
|
|
8
12
|
## Output
|
|
9
13
|
- `docs/specs/BA_SPEC_[FEATURE_KEY].md`
|
|
10
14
|
|
|
@@ -5,6 +5,10 @@ description: Generate UI screen layout documentation for a feature, including Pl
|
|
|
5
5
|
|
|
6
6
|
# SDTK Screen Layout Design
|
|
7
7
|
|
|
8
|
+
## Critical Constraints
|
|
9
|
+
- I do not skip screen IDs or item numbering alignment with the wireframe.
|
|
10
|
+
- I do not hide render limitations; I record when screen preview rendering is unavailable.
|
|
11
|
+
|
|
8
12
|
## Output
|
|
9
13
|
- `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`
|
|
10
14
|
|
|
@@ -15,6 +19,22 @@ description: Generate UI screen layout documentation for a feature, including Pl
|
|
|
15
19
|
- API list table
|
|
16
20
|
- Item table with numbering that matches the wireframe
|
|
17
21
|
3. Keep screen IDs consistent (A-*, B-*, C-*).
|
|
22
|
+
4. After writing `DESIGN_LAYOUT`, attempt to render screen preview images by default:
|
|
23
|
+
- Run `render_design_layout_images.py` to extract `@startsalt` blocks and render `.svg` files.
|
|
24
|
+
- Output path: `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
|
|
25
|
+
- If PlantUML is unavailable, rendering is skipped with a warning and the render-skipped note is used in `FLOW_ACTION_SPEC`. The layout doc remains valid.
|
|
26
|
+
|
|
27
|
+
## Screen Image Renderer
|
|
28
|
+
- Script: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
|
|
29
|
+
- Usage:
|
|
30
|
+
```
|
|
31
|
+
python "toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py" \
|
|
32
|
+
--design-layout "docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md" \
|
|
33
|
+
--feature-key [FEATURE_KEY]
|
|
34
|
+
```
|
|
35
|
+
- Requires: Java + `plantuml.jar` (auto-detected from VSCode PlantUML extension, or pass `--plantuml-jar`)
|
|
36
|
+
- Output: `.svg` files under `docs/specs/assets/<feature_snake>/screens/`
|
|
37
|
+
- Failure policy: non-blocking. Warns and continues if rendering is unavailable.
|
|
18
38
|
|
|
19
39
|
## Template
|
|
20
40
|
- Use `toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md` as starting structure.
|
package/assets/toolkit/toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Render screen preview SVGs from DESIGN_LAYOUT PlantUML SALT wireframes.
|
|
4
|
+
|
|
5
|
+
Extracts @startsalt blocks from a DESIGN_LAYOUT_[FEATURE_KEY].md file,
|
|
6
|
+
renders each to .svg using a local plantuml.jar, and writes the images
|
|
7
|
+
to docs/specs/assets/<feature_snake>/screens/.
|
|
8
|
+
|
|
9
|
+
Graceful failure: if PlantUML is unavailable or a block fails to render,
|
|
10
|
+
the script warns but does not exit with an error code.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
16
|
+
import re
|
|
17
|
+
import shutil
|
|
18
|
+
import subprocess
|
|
19
|
+
import sys
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import List, Optional, Tuple
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def parse_args() -> argparse.Namespace:
|
|
25
|
+
parser = argparse.ArgumentParser(
|
|
26
|
+
description="Render screen images from DESIGN_LAYOUT PlantUML SALT blocks."
|
|
27
|
+
)
|
|
28
|
+
parser.add_argument(
|
|
29
|
+
"--design-layout",
|
|
30
|
+
required=True,
|
|
31
|
+
help="Path to DESIGN_LAYOUT_[FEATURE_KEY].md",
|
|
32
|
+
)
|
|
33
|
+
parser.add_argument(
|
|
34
|
+
"--feature-key",
|
|
35
|
+
required=True,
|
|
36
|
+
help="Feature key, e.g. CRM_LITE",
|
|
37
|
+
)
|
|
38
|
+
parser.add_argument(
|
|
39
|
+
"--output-dir",
|
|
40
|
+
default="",
|
|
41
|
+
help="Output directory for SVGs. Default: docs/specs/assets/<feature_snake>/screens/",
|
|
42
|
+
)
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--plantuml-jar",
|
|
45
|
+
default="",
|
|
46
|
+
help="Explicit path to plantuml.jar. Auto-detected if omitted.",
|
|
47
|
+
)
|
|
48
|
+
parser.add_argument(
|
|
49
|
+
"--skip-render",
|
|
50
|
+
action="store_true",
|
|
51
|
+
help="Extract .puml files only, skip SVG rendering.",
|
|
52
|
+
)
|
|
53
|
+
return parser.parse_args()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def normalize_feature_snake(feature_key: str) -> str:
|
|
57
|
+
return re.sub(r"[^a-z0-9]+", "_", feature_key.lower()).strip("_")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def find_plantuml_jar(explicit: str) -> Optional[Path]:
|
|
61
|
+
if explicit:
|
|
62
|
+
p = Path(explicit).expanduser().resolve()
|
|
63
|
+
return p if p.exists() else None
|
|
64
|
+
user_home = Path.home()
|
|
65
|
+
candidates = sorted(
|
|
66
|
+
(user_home / ".vscode" / "extensions").glob("jebbs.plantuml-*/plantuml.jar")
|
|
67
|
+
)
|
|
68
|
+
if candidates:
|
|
69
|
+
return candidates[-1]
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def extract_screens(text: str) -> List[Tuple[str, str]]:
|
|
74
|
+
"""Extract (screen_id, plantuml_block) pairs from DESIGN_LAYOUT markdown.
|
|
75
|
+
|
|
76
|
+
Looks for heading patterns like '## A-1. Screen Name' or '## SCR-01 Screen Name'
|
|
77
|
+
followed by a fenced plantuml block containing @startsalt.
|
|
78
|
+
"""
|
|
79
|
+
screens: List[Tuple[str, str]] = []
|
|
80
|
+
heading_pattern = re.compile(
|
|
81
|
+
r"^##\s+([A-Z]+-?\d+|SCR-?\d+)[.\s]",
|
|
82
|
+
re.MULTILINE,
|
|
83
|
+
)
|
|
84
|
+
salt_pattern = re.compile(
|
|
85
|
+
r"```plantuml\s*\n(@startsalt[\s\S]*?@endsalt)\s*\n```",
|
|
86
|
+
re.MULTILINE,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
headings = list(heading_pattern.finditer(text))
|
|
90
|
+
for i, match in enumerate(headings):
|
|
91
|
+
screen_id = match.group(1).strip().lower().replace("-", "_")
|
|
92
|
+
start = match.start()
|
|
93
|
+
end = headings[i + 1].start() if i + 1 < len(headings) else len(text)
|
|
94
|
+
section = text[start:end]
|
|
95
|
+
|
|
96
|
+
salt_match = salt_pattern.search(section)
|
|
97
|
+
if salt_match:
|
|
98
|
+
screens.append((screen_id, salt_match.group(1)))
|
|
99
|
+
|
|
100
|
+
return screens
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def render_svg(
|
|
104
|
+
plantuml_jar: Path, puml_path: Path, output_dir: Path
|
|
105
|
+
) -> Optional[str]:
|
|
106
|
+
"""Render a single .puml to .svg. Returns error string or None on success."""
|
|
107
|
+
proc = subprocess.run(
|
|
108
|
+
["java", "-jar", str(plantuml_jar), "-tsvg", str(puml_path)],
|
|
109
|
+
stdout=subprocess.PIPE,
|
|
110
|
+
stderr=subprocess.STDOUT,
|
|
111
|
+
text=True,
|
|
112
|
+
check=False,
|
|
113
|
+
)
|
|
114
|
+
# PlantUML writes .svg next to the .puml file.
|
|
115
|
+
svg_path = puml_path.with_suffix(".svg")
|
|
116
|
+
if not svg_path.exists():
|
|
117
|
+
return f"Render failed (no svg produced): {puml_path.name}"
|
|
118
|
+
|
|
119
|
+
# If .puml is already in the output dir, no copy needed.
|
|
120
|
+
# Otherwise move the svg to the output dir.
|
|
121
|
+
svg_dst = output_dir / svg_path.name
|
|
122
|
+
if svg_path.resolve() != svg_dst.resolve():
|
|
123
|
+
shutil.copy2(svg_path, svg_dst)
|
|
124
|
+
svg_path.unlink(missing_ok=True)
|
|
125
|
+
svg_path = svg_dst
|
|
126
|
+
|
|
127
|
+
svg_text = svg_path.read_text(encoding="utf-8", errors="ignore")
|
|
128
|
+
if any(
|
|
129
|
+
x in svg_text
|
|
130
|
+
for x in ("Cannot find group", "Syntax Error", "contains errors")
|
|
131
|
+
):
|
|
132
|
+
return f"Rendered with error content: {svg_path.name}"
|
|
133
|
+
if proc.returncode != 0:
|
|
134
|
+
return f"PlantUML exit={proc.returncode} for {puml_path.name}"
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def main() -> int:
|
|
139
|
+
args = parse_args()
|
|
140
|
+
|
|
141
|
+
feature_key = args.feature_key.strip()
|
|
142
|
+
if not feature_key:
|
|
143
|
+
print("[ERROR] --feature-key is empty", file=sys.stderr)
|
|
144
|
+
return 1
|
|
145
|
+
|
|
146
|
+
feature_snake = normalize_feature_snake(feature_key)
|
|
147
|
+
layout_path = Path(args.design_layout)
|
|
148
|
+
if not layout_path.exists():
|
|
149
|
+
print(f"[ERROR] Design layout not found: {layout_path}", file=sys.stderr)
|
|
150
|
+
return 1
|
|
151
|
+
|
|
152
|
+
if args.output_dir:
|
|
153
|
+
output_dir = Path(args.output_dir)
|
|
154
|
+
else:
|
|
155
|
+
output_dir = Path(f"docs/specs/assets/{feature_snake}/screens")
|
|
156
|
+
|
|
157
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
158
|
+
|
|
159
|
+
text = layout_path.read_text(encoding="utf-8")
|
|
160
|
+
screens = extract_screens(text)
|
|
161
|
+
|
|
162
|
+
if not screens:
|
|
163
|
+
print("[WARN] No screen sections with @startsalt blocks found.")
|
|
164
|
+
print("[OK] Nothing to render.")
|
|
165
|
+
return 0
|
|
166
|
+
|
|
167
|
+
print(f"[OK] Found {len(screens)} screen(s) with SALT wireframes.")
|
|
168
|
+
|
|
169
|
+
# Write .puml files
|
|
170
|
+
puml_files: List[Path] = []
|
|
171
|
+
for screen_id, salt_block in screens:
|
|
172
|
+
puml_name = f"{screen_id}.puml"
|
|
173
|
+
puml_path = output_dir / puml_name
|
|
174
|
+
puml_path.write_text(salt_block + "\n", encoding="utf-8")
|
|
175
|
+
puml_files.append(puml_path)
|
|
176
|
+
|
|
177
|
+
if args.skip_render:
|
|
178
|
+
print(f"[OK] Wrote {len(puml_files)} .puml file(s). Render skipped (--skip-render).")
|
|
179
|
+
return 0
|
|
180
|
+
|
|
181
|
+
# Find PlantUML
|
|
182
|
+
jar = find_plantuml_jar(args.plantuml_jar)
|
|
183
|
+
if not jar:
|
|
184
|
+
print("[WARN] PlantUML jar not found. SVG rendering skipped.")
|
|
185
|
+
print(" Use --plantuml-jar or install VSCode PlantUML extension.")
|
|
186
|
+
print(f"[OK] Wrote {len(puml_files)} .puml file(s) without SVG rendering.")
|
|
187
|
+
return 0
|
|
188
|
+
|
|
189
|
+
# Render SVGs
|
|
190
|
+
errors: List[str] = []
|
|
191
|
+
rendered = 0
|
|
192
|
+
for puml_path in puml_files:
|
|
193
|
+
err = render_svg(jar, puml_path, output_dir)
|
|
194
|
+
if err:
|
|
195
|
+
errors.append(err)
|
|
196
|
+
else:
|
|
197
|
+
rendered += 1
|
|
198
|
+
|
|
199
|
+
print(f"[OK] Rendered {rendered}/{len(puml_files)} screen image(s) to: {output_dir}")
|
|
200
|
+
if errors:
|
|
201
|
+
print("[WARN] Render issues:")
|
|
202
|
+
for item in errors:
|
|
203
|
+
print(f" - {item}")
|
|
204
|
+
|
|
205
|
+
return 0
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
if __name__ == "__main__":
|
|
209
|
+
try:
|
|
210
|
+
raise SystemExit(main())
|
|
211
|
+
except Exception as exc:
|
|
212
|
+
print(f"[ERROR] {exc}", file=sys.stderr)
|
|
213
|
+
raise
|
|
@@ -5,16 +5,86 @@ description: Developer workflow for SDTK. Use when you need to implement a featu
|
|
|
5
5
|
|
|
6
6
|
# SDTK DEV (Implementation + Code Review)
|
|
7
7
|
|
|
8
|
+
## Critical Constraints
|
|
9
|
+
- I do not start implementation before the current `FEATURE_IMPL_PLAN` scope is approved.
|
|
10
|
+
- I do not claim implementation is complete without fresh verification evidence.
|
|
11
|
+
|
|
8
12
|
## Outputs
|
|
9
13
|
- `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md`
|
|
10
14
|
- Code + tests (follow repo conventions)
|
|
11
15
|
|
|
16
|
+
## Prompt Templates
|
|
17
|
+
- `./prompts/implementer.md`
|
|
18
|
+
- `./prompts/spec-reviewer.md`
|
|
19
|
+
- `./prompts/code-quality-reviewer.md`
|
|
20
|
+
|
|
21
|
+
Use these templates when you need a controller -> subagent execution loop for implementation and review. The controller owns context selection and pastes the task text into the template placeholders.
|
|
22
|
+
|
|
12
23
|
## Process
|
|
13
24
|
1. Read `ARCH_DESIGN_*` + backlog.
|
|
14
25
|
2. Read `sdtk.config.json` for project stack + test/lint commands.
|
|
15
26
|
3. Write `FEATURE_IMPL_PLAN_*` (scope, file list, test plan).
|
|
16
|
-
4. If anything is unclear: record OQ-xx in FEATURE_IMPL_PLAN
|
|
17
|
-
5.
|
|
18
|
-
6.
|
|
19
|
-
7.
|
|
20
|
-
8.
|
|
27
|
+
4. If anything is unclear: record OQ-xx in FEATURE_IMPL_PLAN "Open Questions" and escalate to `@pm` for a decision (PM asks the user if still missing info).
|
|
28
|
+
5. Dispatch implementation work with `./prompts/implementer.md` when task slicing or delegated execution is needed. The controller must paste the full task text and relevant constraints into the template; do not make the implementer subagent discover missing context on its own.
|
|
29
|
+
6. Implement incrementally with tests.
|
|
30
|
+
7. Run the verification commands that prove the current claim (unit tests, lint, typecheck, build, or targeted smoke checks as applicable) and read the full output before saying the work is done.
|
|
31
|
+
8. If delegated review is needed, run the review loop in this order:
|
|
32
|
+
- `./prompts/spec-reviewer.md` first for artifact/spec compliance
|
|
33
|
+
- `./prompts/code-quality-reviewer.md` only after spec reviewer PASS is documented
|
|
34
|
+
9. Complete mandatory code review gate (self + peer checklist; AI peer review allowed).
|
|
35
|
+
10. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md` Phase 4.
|
|
36
|
+
11. Handoff: `@qa please test ...` (only after code review PASS and fresh verification evidence is recorded).
|
|
37
|
+
|
|
38
|
+
## Delegated Execution Contract
|
|
39
|
+
- The implementer subagent receives the full task text directly in the prompt.
|
|
40
|
+
- Required implementer status values:
|
|
41
|
+
- `DONE`
|
|
42
|
+
- `DONE_WITH_CONCERNS`
|
|
43
|
+
- `NEEDS_CONTEXT`
|
|
44
|
+
- `BLOCKED`
|
|
45
|
+
- `DONE_WITH_CONCERNS` means the task is complete but the controller must read the concerns before review.
|
|
46
|
+
- `NEEDS_CONTEXT` means the controller must supply missing information and re-dispatch.
|
|
47
|
+
- `BLOCKED` means do not retry the same task unchanged; resolve the blocker first.
|
|
48
|
+
- The spec reviewer must verify real artifacts, not trust implementer claims.
|
|
49
|
+
- The code-quality reviewer is a second-stage review and must not run before spec compliance passes.
|
|
50
|
+
|
|
51
|
+
## Model Selection Guidance
|
|
52
|
+
Choose the cheapest model that can safely complete the task without creating avoidable rework.
|
|
53
|
+
|
|
54
|
+
| Task type | Recommended model tier | Why |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Single-file mechanical change with a clear spec | Fast model | Speed matters more than deep judgment |
|
|
57
|
+
| Multi-file integration that follows an approved plan | Standard model | Needs pattern matching across several files |
|
|
58
|
+
| Architecture or design tradeoff for the current implementation slice | Most capable model | Requires judgment and ambiguity handling |
|
|
59
|
+
| Stage 1 artifact/spec review | Standard model | Needs careful comparison against requirements |
|
|
60
|
+
| Stage 2 code-quality review | Standard or most capable model | Choose most capable when boundaries or refactors are non-trivial |
|
|
61
|
+
| Cross-artifact consistency investigation | Most capable model | Requires broader synthesis across docs and code |
|
|
62
|
+
|
|
63
|
+
Blocked-task rule:
|
|
64
|
+
- If an implementer returns `BLOCKED`, do not force the same model to retry the same task unchanged.
|
|
65
|
+
- First resolve missing context or reduce task scope.
|
|
66
|
+
- Escalate to a stronger model only when the blocker is judgment or synthesis bound, not because the prompt was incomplete.
|
|
67
|
+
|
|
68
|
+
## Verification Before Completion
|
|
69
|
+
Apply `governance/ai/core/SDTK_VERIFICATION_BEFORE_COMPLETION_POLICY.md`.
|
|
70
|
+
|
|
71
|
+
Do not:
|
|
72
|
+
- say implementation is done, passing, or QA-ready without fresh verification evidence
|
|
73
|
+
- use `should`, `probably`, or `seems` in place of executed checks
|
|
74
|
+
- rely on partial output, stale command runs, or unchecked agent reports
|
|
75
|
+
|
|
76
|
+
If verification fails or cannot be run, report the status as not verified and explain the blocker.
|
|
77
|
+
|
|
78
|
+
## Order-Critical Hard Gate
|
|
79
|
+
Do not start implementation work until `docs/dev/FEATURE_IMPL_PLAN_[FEATURE_KEY].md` exists and the current execution scope is explicitly approved in that plan for implementation.
|
|
80
|
+
|
|
81
|
+
If the plan is missing, incomplete, or still awaiting approval for the current task slice, stop and update the plan first. Do not implement first and backfill the plan later.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Common Mistakes
|
|
85
|
+
|
|
86
|
+
| Mistake | Why it is wrong | Do instead |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| Start coding before the implementation plan is approved | Causes scope drift and invalidates review order | Finish and approve `FEATURE_IMPL_PLAN` first |
|
|
89
|
+
| Run Stage 2 code-quality review before Stage 1 spec review passes | Hides requirement mismatches behind style feedback | Keep the review order strict: spec first, quality second |
|
|
90
|
+
| Retry a `BLOCKED` implementer with the same prompt and same model | Repeats the same failure mode | Add missing context, split the task, or change model tier intentionally |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# SDTK DEV Code Quality Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
You are the Stage 2 code-quality reviewer for a completed SDTK development task.
|
|
4
|
+
|
|
5
|
+
## Gate Position
|
|
6
|
+
Run this prompt only after the spec reviewer has passed Stage 1 artifact/spec compliance.
|
|
7
|
+
|
|
8
|
+
## Inputs From Controller
|
|
9
|
+
- Task ID: `{{TASK_ID}}`
|
|
10
|
+
- Feature key: `{{FEATURE_KEY}}`
|
|
11
|
+
- Stage 1 PASS evidence: `{{SPEC_REVIEW_PASS_EVIDENCE}}`
|
|
12
|
+
- Files to review:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
{{FILES_TO_REVIEW}}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Relevant coding standards or repo conventions:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
{{CODE_QUALITY_RULES}}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Review Rules
|
|
25
|
+
- Confirm Stage 1 PASS before reviewing code quality.
|
|
26
|
+
- Review structure, naming, maintainability, boundary clarity, and test quality.
|
|
27
|
+
- Flag issues that make the implementation fragile even if it is spec-compliant.
|
|
28
|
+
- Do not reopen Stage 1 scope unless you find a direct contradiction in the shipped code.
|
|
29
|
+
|
|
30
|
+
## Response Format
|
|
31
|
+
- Gate result: `{{GATE_RESULT}}`
|
|
32
|
+
- Code quality findings: `{{QUALITY_FINDINGS}}`
|
|
33
|
+
- Test quality findings: `{{TEST_FINDINGS}}`
|
|
34
|
+
- Required improvements: `{{REQUIRED_IMPROVEMENTS}}`
|
|
35
|
+
- Final recommendation: `{{FINAL_RECOMMENDATION}}`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# SDTK DEV Implementer Prompt Template
|
|
2
|
+
|
|
3
|
+
You are the implementation subagent for a single SDTK development task.
|
|
4
|
+
|
|
5
|
+
## Mission
|
|
6
|
+
Implement exactly the task provided by the controller, then report one of the required status values.
|
|
7
|
+
|
|
8
|
+
## Inputs From Controller
|
|
9
|
+
- Task ID: `{{TASK_ID}}`
|
|
10
|
+
- Feature key: `{{FEATURE_KEY}}`
|
|
11
|
+
- Scene-setting context: `{{SCENE_CONTEXT}}`
|
|
12
|
+
- Full task text:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
{{FULL_TASK_TEXT}}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Relevant requirements or constraints:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
{{RELEVANT_CONSTRAINTS}}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- Files already identified by the controller:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
{{KNOWN_FILE_PATHS}}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- Verification commands to run before claiming completion:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
{{VERIFICATION_COMMANDS}}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Before You Begin
|
|
37
|
+
1. Read the full task text carefully.
|
|
38
|
+
2. If required information is missing, ask focused questions immediately instead of guessing.
|
|
39
|
+
3. Do not ask the controller to make you read unrelated planning files. The controller is responsible for pasting the task context you need.
|
|
40
|
+
|
|
41
|
+
## Working Rules
|
|
42
|
+
- Stay within the provided task scope.
|
|
43
|
+
- Follow repo conventions and existing patterns in the touched files.
|
|
44
|
+
- Update or add tests when the task requires it.
|
|
45
|
+
- Run the provided verification commands before reporting `DONE` or `DONE_WITH_CONCERNS`.
|
|
46
|
+
- Perform a short self-review against the task requirements and obvious code quality issues before you report back.
|
|
47
|
+
|
|
48
|
+
## Required Status Taxonomy
|
|
49
|
+
Return exactly one of these statuses:
|
|
50
|
+
- `DONE`
|
|
51
|
+
- `DONE_WITH_CONCERNS`
|
|
52
|
+
- `NEEDS_CONTEXT`
|
|
53
|
+
- `BLOCKED`
|
|
54
|
+
|
|
55
|
+
## Response Format
|
|
56
|
+
- Status: `{{STATUS}}`
|
|
57
|
+
- Files changed: `{{FILES_CHANGED}}`
|
|
58
|
+
- What was implemented: `{{IMPLEMENTATION_SUMMARY}}`
|
|
59
|
+
- Verification evidence: `{{VERIFICATION_RESULTS}}`
|
|
60
|
+
- Open concerns or blocker details: `{{CONCERNS_OR_BLOCKERS}}`
|
|
61
|
+
- Questions for the controller (if any): `{{FOLLOW_UP_QUESTIONS}}`
|