sdtk-kit 0.3.9 → 1.0.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/LICENSE +21 -0
- package/README.md +123 -177
- package/package.json +52 -46
- package/scripts/postinstall.js +40 -0
- package/assets/manifest/toolkit-bundle.manifest.json +0 -473
- package/assets/manifest/toolkit-bundle.sha256.txt +0 -93
- package/assets/toolkit/toolkit/AGENTS.md +0 -131
- package/assets/toolkit/toolkit/install.ps1 +0 -310
- package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +0 -54
- package/assets/toolkit/toolkit/runtimes/codex/CODEX_TEMPLATE.md +0 -32
- package/assets/toolkit/toolkit/scripts/init-feature.ps1 +0 -261
- package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +0 -169
- package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +0 -189
- package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +0 -139
- package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +0 -116
- package/assets/toolkit/toolkit/sdtk.config.json +0 -28
- package/assets/toolkit/toolkit/sdtk.config.profiles.example.json +0 -50
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +0 -84
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +0 -22
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +0 -20
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +0 -732
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +0 -43
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +0 -20
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +0 -128
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +0 -83
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +0 -22
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +0 -20
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -220
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +0 -128
- package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +0 -29
- package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +0 -52
- package/assets/toolkit/toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py +0 -246
- package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +0 -90
- package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/code-quality-reviewer.md +0 -35
- package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/implementer.md +0 -61
- package/assets/toolkit/toolkit/skills/sdtk-dev/prompts/spec-reviewer.md +0 -42
- package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +0 -21
- package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +0 -19
- package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +0 -80
- package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +0 -30
- package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +0 -53
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +0 -86
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -220
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +0 -51
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +0 -54
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/numbering-rules.md +0 -28
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/renumber_flow_action_spec_global.py +0 -136
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/validate_flow_action_spec_numbering.py +0 -414
- package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +0 -74
- package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/references/TEST_CASE_CREATION_RULES.md +0 -129
- package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/scripts/validate_test_case_spec.py +0 -97
- package/assets/toolkit/toolkit/skills/skills.catalog.yaml +0 -302
- package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +0 -90
- package/assets/toolkit/toolkit/skills-claude/api-doc/SKILL.md +0 -47
- package/assets/toolkit/toolkit/skills-claude/arch/SKILL.md +0 -59
- package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +0 -50
- package/assets/toolkit/toolkit/skills-claude/design-layout/SKILL.md +0 -57
- package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +0 -45
- package/assets/toolkit/toolkit/skills-claude/dev-backend/SKILL.md +0 -20
- package/assets/toolkit/toolkit/skills-claude/dev-frontend/SKILL.md +0 -18
- package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +0 -63
- package/assets/toolkit/toolkit/skills-claude/pm/SKILL.md +0 -52
- package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +0 -48
- package/assets/toolkit/toolkit/skills-claude/screen-design-spec/SKILL.md +0 -90
- package/assets/toolkit/toolkit/skills-claude/test-case-spec/SKILL.md +0 -61
- package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +0 -124
- package/assets/toolkit/toolkit/templates/README.md +0 -63
- package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +0 -80
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +0 -22
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +0 -67
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +0 -468
- package/assets/toolkit/toolkit/templates/docs/api/API_ENDPOINTS_TEMPLATE.md +0 -229
- package/assets/toolkit/toolkit/templates/docs/api/FEATURE_API_TEMPLATE.yaml +0 -20
- package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +0 -20
- package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +0 -128
- package/assets/toolkit/toolkit/templates/docs/api/feature_api_flow_list_TEMPLATE.txt +0 -12
- package/assets/toolkit/toolkit/templates/docs/architecture/ARCH_DESIGN_TEMPLATE.md +0 -109
- package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +0 -175
- package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +0 -60
- package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +0 -73
- package/assets/toolkit/toolkit/templates/docs/product/BACKLOG_TEMPLATE.md +0 -50
- package/assets/toolkit/toolkit/templates/docs/product/PRD_TEMPLATE.md +0 -66
- package/assets/toolkit/toolkit/templates/docs/product/PROJECT_INITIATION_TEMPLATE.md +0 -98
- package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +0 -61
- package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_CREATION_RULES.md +0 -129
- package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_TEMPLATE.md +0 -104
- package/assets/toolkit/toolkit/templates/docs/specs/BA_SPEC_TEMPLATE.md +0 -139
- package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +0 -220
- package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_TEMPLATE.md +0 -197
- package/assets/toolkit/toolkit/templates/handoffs/ARCH_TO_DEV.md +0 -31
- package/assets/toolkit/toolkit/templates/handoffs/BA_TO_ARCH.md +0 -28
- package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE1_SPEC_REVIEW.md +0 -26
- package/assets/toolkit/toolkit/templates/handoffs/DEV_STAGE2_CODE_QUALITY_REVIEW.md +0 -20
- package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +0 -23
- package/assets/toolkit/toolkit/templates/handoffs/PM_TO_BA.md +0 -26
- package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +0 -21
- package/bin/sdtk.js +0 -15
- package/src/commands/auth.js +0 -85
- package/src/commands/generate.js +0 -177
- package/src/commands/help.js +0 -101
- package/src/commands/init.js +0 -97
- package/src/commands/runtime.js +0 -217
- package/src/index.js +0 -59
- package/src/lib/args.js +0 -116
- package/src/lib/errors.js +0 -41
- package/src/lib/github-access.js +0 -68
- package/src/lib/powershell.js +0 -85
- package/src/lib/scope.js +0 -68
- package/src/lib/state.js +0 -83
- package/src/lib/toolkit-payload.js +0 -99
package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
# Flow Action Spec Creation Rules for AI Agents
|
|
2
|
-
|
|
3
|
-
This document defines reusable rules for creating and updating screen flow-action specifications
|
|
4
|
-
(for example `docs/specs/*_FLOW_ACTION_SPEC.md`).
|
|
5
|
-
|
|
6
|
-
## 1. Scope and Goal
|
|
7
|
-
|
|
8
|
-
- Produce a screen-level specification that is traceable from BA/ARCH to FE/BE implementation.
|
|
9
|
-
- Keep one source of truth for:
|
|
10
|
-
- screen flow
|
|
11
|
-
- UI items and actions
|
|
12
|
-
- API calls per action
|
|
13
|
-
- screen-to-API mapping
|
|
14
|
-
- Keep documentation implementation-aware and review-friendly.
|
|
15
|
-
|
|
16
|
-
## 2. Mandatory Document Structure
|
|
17
|
-
|
|
18
|
-
A flow-action spec should include, at minimum:
|
|
19
|
-
|
|
20
|
-
1. `Abbreviations`
|
|
21
|
-
2. `Feature overview`
|
|
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`
|
|
29
|
-
|
|
30
|
-
If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
|
|
31
|
-
|
|
32
|
-
## 3. Table Standards
|
|
33
|
-
|
|
34
|
-
- Every table must include a `No` column (sequential numbering).
|
|
35
|
-
- Use stable headers for action tables:
|
|
36
|
-
- `No | Item Name | Item Type | Attribute | DB Column | Size | Default Value | Action | Description | Note`
|
|
37
|
-
- Use stable headers for API mapping tables:
|
|
38
|
-
- `No | Trigger/When | UI item (No / Item Name) | API to call | Data usage / Notes`
|
|
39
|
-
- Use stable headers for screen mapping:
|
|
40
|
-
- `No | Screen (section) | Screen ID | Read/Search APIs | Write APIs | Notes / Q&A refs`
|
|
41
|
-
- Table rows must keep column count consistent with the header (no broken or merged rows).
|
|
42
|
-
- Avoid single-line merged content that collapses multiple logical items into one table row.
|
|
43
|
-
|
|
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)
|
|
72
|
-
|
|
73
|
-
- For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
|
|
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.
|
|
75
|
-
- Do not leave mixed-language fragments in one sentence/cell (for example VI+EN mixed text).
|
|
76
|
-
- If original VI/JP text is required for traceability, keep it in a clearly marked appendix block (`Original Text`), then provide EN translation.
|
|
77
|
-
- Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
|
|
78
|
-
- Keep canonical terminology stable across documents (for example: `bukken`, `sagyo`, `customer employee`).
|
|
79
|
-
|
|
80
|
-
### 3.3 Markdown Structure Hygiene
|
|
81
|
-
|
|
82
|
-
- Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
|
|
83
|
-
- Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
|
|
84
|
-
- Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
|
|
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
|
-
|
|
93
|
-
## 4. Item Numbering and Duplication Rules
|
|
94
|
-
|
|
95
|
-
- Use one numbering mode only: `global across document`.
|
|
96
|
-
- Number values must increase across all action tables in the document.
|
|
97
|
-
- DESIGN_LAYOUT wireframe markers are a separate screen-local visual system. They may reset per screen and do not need to numerically equal the global action-table `No`.
|
|
98
|
-
- Avoid duplicate item descriptions for the same UI control across screens unless behavior differs.
|
|
99
|
-
- If duplicate number is intentional (rare), annotate reason in `Note`.
|
|
100
|
-
|
|
101
|
-
## 5. Screen Section Rules
|
|
102
|
-
|
|
103
|
-
For each screen section:
|
|
104
|
-
|
|
105
|
-
- Provide metadata:
|
|
106
|
-
- official screen name
|
|
107
|
-
- Screen ID
|
|
108
|
-
- Design Source Type
|
|
109
|
-
- Design Source Reference
|
|
110
|
-
- Embed one representative image per screen (from Figma, screenshot, or generated layout).
|
|
111
|
-
- Provide one action table.
|
|
112
|
-
- Provide one API mapping table.
|
|
113
|
-
- If a screen has dialogs, create explicit dialog sub-sections with their own tables and API mapping.
|
|
114
|
-
|
|
115
|
-
## 5.1 Design Source Modes
|
|
116
|
-
|
|
117
|
-
Each screen section must declare a design source using one of these modes:
|
|
118
|
-
|
|
119
|
-
| Mode | When | Design Source Reference |
|
|
120
|
-
|------|------|----------------------|
|
|
121
|
-
| `source-backed` | Figma URL or screenshot is available | Figma URL or screenshot path |
|
|
122
|
-
| `generated-draft` | No Figma/screenshot, but feature has UI scope | Section reference in `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md` |
|
|
123
|
-
| `none` | Feature has no UI scope for this screen | State `N/A - no UI scope` |
|
|
124
|
-
|
|
125
|
-
Rules:
|
|
126
|
-
- For UI-scope features, `none` is only valid when the specific screen truly has no visual layout.
|
|
127
|
-
- When using `generated-draft`, the `DESIGN_LAYOUT_[FEATURE_KEY].md` must exist before the flow-action spec is finalized.
|
|
128
|
-
- The flow-action spec and the design-layout doc must remain separate documents.
|
|
129
|
-
- When Figma becomes available later, update the source mode from `generated-draft` to `source-backed`.
|
|
130
|
-
|
|
131
|
-
## 5.2 Wireframe Marker Mapping for Generated-Draft Screens
|
|
132
|
-
|
|
133
|
-
For generated-draft screens with rendered design-layout images:
|
|
134
|
-
|
|
135
|
-
- Treat wireframe markers as screen-local visual references only.
|
|
136
|
-
- Keep action-table `No` global across the document per section 4.
|
|
137
|
-
- Add a wireframe marker mapping table directly under the screen image.
|
|
138
|
-
- Use this stable header:
|
|
139
|
-
- `No | Wireframe Marker | Action Table No | Item Name | Notes`
|
|
140
|
-
- Map only the items visibly present on the wireframe image.
|
|
141
|
-
- If an action-table row is not visible on the wireframe, state `Not shown on wireframe` in `Notes` instead of inventing a marker.
|
|
142
|
-
- If the wireframe label and the action-table label differ slightly, keep the action-table item name and explain the label difference in `Notes`.
|
|
143
|
-
|
|
144
|
-
## 6. API Traceability Rules
|
|
145
|
-
|
|
146
|
-
- Every actionable UI event that changes state must map to a write API.
|
|
147
|
-
- Every data-loading UI event must map to a read/search API.
|
|
148
|
-
- If one endpoint serves multiple actions (initial load, search, refresh), state this explicitly.
|
|
149
|
-
- If no API is called for an action, state `No API` and explain why.
|
|
150
|
-
|
|
151
|
-
## 7. PlantUML Rules for Screen Flow
|
|
152
|
-
|
|
153
|
-
- Use new-style PlantUML activity diagram syntax only for screen-flow diagrams.
|
|
154
|
-
- Allowed activity constructs include: `start`, `stop`, `partition "..." {}`, `:Activity;`, `->`, `if/then/else/endif`, `fork`, `fork again`, `end fork`, and `note right/left`.
|
|
155
|
-
- Do not mix legacy activity syntax such as `(*)`, `-->`, or `[edge label]` with new-style activity actions like `:Activity;`.
|
|
156
|
-
- Validate renderability before handoff. If a renderer is unavailable in the current environment, at minimum keep the block internally consistent with new-style activity syntax only.
|
|
157
|
-
- Use `\\n` for multi-line labels in activity nodes and notes.
|
|
158
|
-
- Keep diagram at navigation/action level (not low-level SQL or backend internals).
|
|
159
|
-
- Ensure screen names in PlantUML match section names in layout spec.
|
|
160
|
-
|
|
161
|
-
## 8. Data Source and Asset Rules
|
|
162
|
-
|
|
163
|
-
- Prioritize source order:
|
|
164
|
-
1. Confirmed design source (for example Figma)
|
|
165
|
-
2. Confirmed requirement files (Excel/spec)
|
|
166
|
-
3. User-provided screenshots
|
|
167
|
-
- Store images in repository-relative filesystem paths.
|
|
168
|
-
- Reference images in markdown using file-relative paths from the spec file's directory.
|
|
169
|
-
- Do not keep temporary local absolute paths in markdown.
|
|
170
|
-
|
|
171
|
-
### 8.1 Rendered Screen Images for Generated-Draft Screens
|
|
172
|
-
|
|
173
|
-
When `Design Source Type` is `generated-draft`:
|
|
174
|
-
- Screen preview images may be rendered from `DESIGN_LAYOUT_[FEATURE_KEY].md` PlantUML SALT wireframes.
|
|
175
|
-
- Renderer: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
|
|
176
|
-
- Expected output path (filesystem): `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
|
|
177
|
-
- Markdown image path (file-relative from `docs/specs/*_FLOW_ACTION_SPEC.md`): `assets/<feature_snake>/screens/<screen_id>.svg`
|
|
178
|
-
- DESIGN_LAYOUT markers inside the image are screen-local visual references and may reset per screen; use the wireframe mapping table to bridge them to the global action-table `No`.
|
|
179
|
-
- If the rendered `.svg` file exists, use the file-relative markdown path in the `Screen image:` reference.
|
|
180
|
-
- If rendering is unavailable or the `.svg` does not exist, replace the image line with:
|
|
181
|
-
`> Screen image not rendered in this environment. See Design Source Reference for layout.`
|
|
182
|
-
- Do not leave a broken image reference pointing to a non-existent file.
|
|
183
|
-
|
|
184
|
-
## 9. Consistency with Other Specs
|
|
185
|
-
|
|
186
|
-
- Align terms with:
|
|
187
|
-
- BA spec glossary
|
|
188
|
-
- API endpoints spec
|
|
189
|
-
- Database spec
|
|
190
|
-
- If terminology differs across docs, raise an open question and add a temporary mapping note.
|
|
191
|
-
- Keep endpoint paths in flow-action spec consistent with API endpoint spec.
|
|
192
|
-
|
|
193
|
-
## 10. Open Questions and Uncertainty Handling
|
|
194
|
-
|
|
195
|
-
- Capture unresolved items in `Open questions` table.
|
|
196
|
-
- Do not invent UI behavior or API contracts when source is ambiguous.
|
|
197
|
-
- Mark uncertain mappings as `Draft` and include impacted files/sections.
|
|
198
|
-
|
|
199
|
-
## 11. Change Management
|
|
200
|
-
|
|
201
|
-
- On each update:
|
|
202
|
-
- update impacted screen sections
|
|
203
|
-
- update API mapping tables
|
|
204
|
-
- update screen-to-API mapping summary
|
|
205
|
-
- append one row in document history
|
|
206
|
-
- Never overwrite past history rows.
|
|
207
|
-
|
|
208
|
-
## 12. Final Checklist Before Handoff
|
|
209
|
-
|
|
210
|
-
- PlantUML renders successfully.
|
|
211
|
-
- All mandatory sections exist.
|
|
212
|
-
- All tables include `No`.
|
|
213
|
-
- Numbering is global across the document (no resets).
|
|
214
|
-
- No broken image links (for `generated-draft` screens: `.svg` exists or render-skipped note is present).
|
|
215
|
-
- Screen/API mappings are consistent with `*_ENDPOINTS.md`.
|
|
216
|
-
- Assumptions section exists and unresolved assumptions are traceable.
|
|
217
|
-
- Open questions are explicit and traceable.
|
|
218
|
-
- For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
|
|
219
|
-
- No mojibake/encoding corruption markers.
|
|
220
|
-
- Headings/tables are structurally clean (no merged lines that break readability/traceability).
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# YAML CREATION RULES FINAL
|
|
2
|
-
|
|
3
|
-
This file is the canonical rule set for designing and maintaining feature-level OpenAPI YAML.
|
|
4
|
-
|
|
5
|
-
Use this file for:
|
|
6
|
-
- OpenAPI YAML contract design
|
|
7
|
-
- endpoint path/method decisions
|
|
8
|
-
- request/response schema design
|
|
9
|
-
- endpoint summary and contract consistency checks
|
|
10
|
-
|
|
11
|
-
Do not use this file as the primary rule source for:
|
|
12
|
-
- flowchart writing details
|
|
13
|
-
- API design detail markdown layout
|
|
14
|
-
|
|
15
|
-
Use `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` for those.
|
|
16
|
-
|
|
17
|
-
## 1. Rule Precedence
|
|
18
|
-
- Priority 1: follow the existing system's real route, method, payload, and response conventions.
|
|
19
|
-
- Priority 2: match the current source code and runtime behavior.
|
|
20
|
-
- Priority 3: apply the reusable standards in this document.
|
|
21
|
-
- If a reusable rule conflicts with the target system, keep the system rule and document the exception explicitly.
|
|
22
|
-
|
|
23
|
-
## 2. API Scope Classification
|
|
24
|
-
- Every endpoint must be classified as one of:
|
|
25
|
-
- `New`
|
|
26
|
-
- `Deferred`
|
|
27
|
-
- `Existing (reuse)`
|
|
28
|
-
- Do not silently create a new feature-local API if an existing system API already provides the same behavior with a compatible contract.
|
|
29
|
-
- If the existing API is close in purpose but payload or response is incompatible with the feature need, create a bounded new API.
|
|
30
|
-
|
|
31
|
-
## 3. Endpoint Path Design
|
|
32
|
-
- Use singular resource names in endpoint paths.
|
|
33
|
-
- Use explicit action segments only when needed by system convention:
|
|
34
|
-
- `list`
|
|
35
|
-
- `search`
|
|
36
|
-
- `edit`
|
|
37
|
-
- `delete`
|
|
38
|
-
- `multi-create`
|
|
39
|
-
- Prefer stable system-style patterns such as:
|
|
40
|
-
- list: `GET /{resource}/list/{company_uuid}/{parent_uuid}`
|
|
41
|
-
- search: `POST /{resource}/search/{company_uuid}`
|
|
42
|
-
- view-specific search: `POST /{resource}/bukken-view/search/{company_uuid}`
|
|
43
|
-
- create: `POST /{resource}/{company_uuid}`
|
|
44
|
-
- detail: `GET /{resource}/{company_uuid}/{resource_uuid}`
|
|
45
|
-
- edit: `POST /{resource}/edit/{company_uuid}/{resource_uuid}`
|
|
46
|
-
- delete: `POST /{resource}/delete/{company_uuid}/{resource_uuid}`
|
|
47
|
-
- Separate namespaces by bounded context.
|
|
48
|
-
- Do not repeat namespace meaning in child path segments.
|
|
49
|
-
|
|
50
|
-
## 4. Request Contract Rules
|
|
51
|
-
- For feature-owned POST search and write APIs, prefer a stable wrapper:
|
|
52
|
-
- `data: { ... }`
|
|
53
|
-
- For complex filters, place fields under:
|
|
54
|
-
- `data.info`
|
|
55
|
-
- If reusing an existing system API, keep the owning module's contract shape exactly as-is.
|
|
56
|
-
- Do not force reused APIs into the feature wrapper pattern.
|
|
57
|
-
- If a payload field changes behavior, the field must be explicit in the schema and must not remain only in examples.
|
|
58
|
-
|
|
59
|
-
## 5. Response Contract Rules
|
|
60
|
-
- Success responses must include `status` at minimum.
|
|
61
|
-
- Create APIs should return the minimum new identifier required by the caller.
|
|
62
|
-
- Example: `status + sagyo_assign_uuid`
|
|
63
|
-
- Edit and delete APIs should return status-only unless the target system has a stronger standard.
|
|
64
|
-
- Pre-check or validation helper APIs should return only the minimum boolean or status needed by the UI.
|
|
65
|
-
- Do not return detail payloads the UI does not consume.
|
|
66
|
-
- Do not add FE-only visual helper payloads when the client can derive them safely.
|
|
67
|
-
- Example: remove `timeline_backgrounds` if the frontend renders timeline lines from existing data.
|
|
68
|
-
|
|
69
|
-
## 6. Naming and Field Mapping Rules
|
|
70
|
-
- Use canonical business-domain terminology from the system glossary and database.
|
|
71
|
-
- Prefer actual system terms such as:
|
|
72
|
-
- `bukken`
|
|
73
|
-
- `sagyo`
|
|
74
|
-
- `sagyoin`
|
|
75
|
-
- `certification`
|
|
76
|
-
- Avoid legacy aliases when an official term already exists.
|
|
77
|
-
- Field names should align with database semantics when they represent the same concept.
|
|
78
|
-
- If the DB uses a string state code, the API field must not be modeled as an integer.
|
|
79
|
-
- If a field is date-only (`format: date`), include the display format in the description.
|
|
80
|
-
- Example: `Start date (YYYYMMDD)`
|
|
81
|
-
|
|
82
|
-
## 7. Search and List API Rules
|
|
83
|
-
- One search API may serve multiple UI actions when the logic is the same:
|
|
84
|
-
- initial load
|
|
85
|
-
- search button
|
|
86
|
-
- refresh after mode/date change
|
|
87
|
-
- If one endpoint serves multiple UI actions, document that explicitly in YAML description and endpoint docs.
|
|
88
|
-
- Search APIs must define filter combination semantics clearly:
|
|
89
|
-
- AND across different fields
|
|
90
|
-
- OR within each `*_uuids` array
|
|
91
|
-
- If UI rendering depends on stable order, the YAML description must state the confirmed ORDER BY logic.
|
|
92
|
-
|
|
93
|
-
## 8. Split vs Reuse Rules
|
|
94
|
-
- Split read/search endpoints when the FE needs materially different grouped or view-shaped datasets.
|
|
95
|
-
- Merge or remove helper payloads when they add maintenance cost without business value.
|
|
96
|
-
- Reuse existing platform APIs when behavior already exists and only a feature-level mapping layer is needed.
|
|
97
|
-
- Example: reuse shared environment setting APIs instead of creating feature-local setting APIs.
|
|
98
|
-
|
|
99
|
-
## 9. Sample Data Rules
|
|
100
|
-
- For fields declared as `format: uuid`, use canonical UUID samples.
|
|
101
|
-
- Example: `123e4567-e89b-12d3-a456-426614174000`
|
|
102
|
-
- Do not use placeholder UUID-like labels such as:
|
|
103
|
-
- `customer-uuid-001`
|
|
104
|
-
- `assign-uuid-001`
|
|
105
|
-
- Keep sample data deterministic and internally consistent across request and response examples.
|
|
106
|
-
|
|
107
|
-
## 10. Cross-Artifact Consistency Rules
|
|
108
|
-
- The YAML contract is the source of truth for:
|
|
109
|
-
- endpoint path
|
|
110
|
-
- method
|
|
111
|
-
- request wrapper
|
|
112
|
-
- response shape
|
|
113
|
-
- After any YAML contract change, sync these artifacts:
|
|
114
|
-
- endpoint markdown
|
|
115
|
-
- flow list
|
|
116
|
-
- PlantUML flow assets
|
|
117
|
-
- API design detail markdown
|
|
118
|
-
- If any artifact cannot yet be synced, note the mismatch explicitly rather than leaving stale content.
|
|
119
|
-
|
|
120
|
-
## 11. Minimum YAML Quality Gate
|
|
121
|
-
- Path/method follow the target system convention.
|
|
122
|
-
- API type is classified (`New`, `Deferred`, `Existing (reuse)`).
|
|
123
|
-
- Request/response wrappers are stable and explicit.
|
|
124
|
-
- FE-only helper payloads are removed.
|
|
125
|
-
- Field names and types match DB semantics.
|
|
126
|
-
- UUID examples are valid UUIDs.
|
|
127
|
-
- Date descriptions include display format where needed.
|
|
128
|
-
- Search/list APIs document filter semantics and ordering when relevant.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sdtk-ba
|
|
3
|
-
description: Business Analyst workflow for SDTK. Use when you need to turn PM initiation into BA_SPEC with glossary, business rules (BR-xx), use cases (UC-xx), acceptance criteria (AC-xx), NFRs, risks, open questions, and a traceability matrix.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SDTK BA (Business Analysis)
|
|
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
|
-
|
|
12
|
-
## Output
|
|
13
|
-
- `docs/specs/BA_SPEC_[FEATURE_KEY].md`
|
|
14
|
-
|
|
15
|
-
## Process
|
|
16
|
-
1. Read `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md` and any source requirements.
|
|
17
|
-
2. Produce:
|
|
18
|
-
- Glossary
|
|
19
|
-
- BR-xx (numbered)
|
|
20
|
-
- UC-xx (cover 100% REQ-xx)
|
|
21
|
-
- AC-xx (mapped to UC/BR)
|
|
22
|
-
- NFR-xx
|
|
23
|
-
- Risks + Open Questions
|
|
24
|
-
- Traceability summary table (REQ -> UC/BR/AC)
|
|
25
|
-
3. If source requirements are VI/JP, preserve the original text and add a literal EN translation in appendices.
|
|
26
|
-
4. For benchmark runs, apply `governance/ai/core/SDTK_BENCHMARK_OQ_POLICY.md`: keep benchmark-expected open questions explicitly OPEN and do not silently resolve them in BA output.
|
|
27
|
-
5. If anything is unclear, record OQ-xx in BA_SPEC "Open Questions" and escalate to `@pm` for a decision.
|
|
28
|
-
6. Update `SHARED_PLANNING.md` and `QUALITY_CHECKLIST.md` Phase 2.
|
|
29
|
-
7. Handoff: `@pm specs ready for PRD`.
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sdtk-design-layout
|
|
3
|
-
description: Generate UI screen layout documentation for a feature, including PlantUML @startsalt wireframes and item tables. Use when a feature includes frontend/admin screens and you need docs/design/* deliverables.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SDTK Screen Layout Design
|
|
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
|
-
- I do not leave rendered wireframes without visible local item markers that map back to the `Items` table.
|
|
12
|
-
- I do not pretend wireframe markers are the same thing as `FLOW_ACTION_SPEC` global action-table numbers.
|
|
13
|
-
|
|
14
|
-
## Output
|
|
15
|
-
- `docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md`
|
|
16
|
-
|
|
17
|
-
## Process
|
|
18
|
-
1. Read BA spec (screens + fields) and API list.
|
|
19
|
-
2. For each screen, include:
|
|
20
|
-
- PlantUML `@startsalt` wireframe first, with visible screen-local markers embedded directly in the SALT labels
|
|
21
|
-
- API list table
|
|
22
|
-
- Item table whose `No` values exactly match the local marker sequence used in the wireframe for that screen
|
|
23
|
-
3. Use this wireframe-marker convention so the rendered SVG can be cross-referenced visually:
|
|
24
|
-
- markers are screen-local visual references and reset per screen
|
|
25
|
-
- prefer Unicode circled-number markers in generated docs; avoid parenthetical `(N)` markers because they blend into UI text and can conflict with SALT parsing
|
|
26
|
-
- text label or input prompt: prefix the visible label with the local marker
|
|
27
|
-
- button: place the local marker inside the visible button label
|
|
28
|
-
- table header: prefix the header text with the local marker
|
|
29
|
-
- standalone control, pagination, toggle, or status chip: prefix the visible label with the local marker
|
|
30
|
-
- do not rely on prose, comments, or a separate legend; the marker must be visible inside the rendered wireframe itself
|
|
31
|
-
- the local marker does not need to equal the `FLOW_ACTION_SPEC` global `No`; `screen-design-spec` publishes the mapping table
|
|
32
|
-
4. Keep screen IDs consistent (A-*, B-*, C-*).
|
|
33
|
-
5. After writing `DESIGN_LAYOUT`, attempt to render screen preview images by default:
|
|
34
|
-
- Run `render_design_layout_images.py` to extract `@startsalt` blocks and render `.svg` files.
|
|
35
|
-
- Output path: `docs/specs/assets/<feature_snake>/screens/<screen_id>.svg`
|
|
36
|
-
- The renderer warns if a screen wireframe has no visible local markers or still uses legacy `(N)` markers.
|
|
37
|
-
- 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.
|
|
38
|
-
|
|
39
|
-
## Screen Image Renderer
|
|
40
|
-
- Script: `toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py`
|
|
41
|
-
- Usage:
|
|
42
|
-
```
|
|
43
|
-
python "toolkit/skills/sdtk-design-layout/scripts/render_design_layout_images.py" \
|
|
44
|
-
--design-layout "docs/design/DESIGN_LAYOUT_[FEATURE_KEY].md" \
|
|
45
|
-
--feature-key [FEATURE_KEY]
|
|
46
|
-
```
|
|
47
|
-
- Requires: Java + `plantuml.jar` (auto-detected from VSCode PlantUML extension, or pass `--plantuml-jar`)
|
|
48
|
-
- Output: `.svg` files under `docs/specs/assets/<feature_snake>/screens/`
|
|
49
|
-
- Failure policy: non-blocking. Warns and continues if rendering is unavailable.
|
|
50
|
-
|
|
51
|
-
## Template
|
|
52
|
-
- 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
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
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
|
-
CIRCLED_ITEM_MARKER_RE = re.compile(r"[\u2460-\u2473\u3251-\u325F\u32B1-\u32BF]")
|
|
25
|
-
LEGACY_ITEM_MARKER_RE = re.compile(r"\(\d+\)")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def parse_args() -> argparse.Namespace:
|
|
29
|
-
parser = argparse.ArgumentParser(
|
|
30
|
-
description="Render screen images from DESIGN_LAYOUT PlantUML SALT blocks."
|
|
31
|
-
)
|
|
32
|
-
parser.add_argument(
|
|
33
|
-
"--design-layout",
|
|
34
|
-
required=True,
|
|
35
|
-
help="Path to DESIGN_LAYOUT_[FEATURE_KEY].md",
|
|
36
|
-
)
|
|
37
|
-
parser.add_argument(
|
|
38
|
-
"--feature-key",
|
|
39
|
-
required=True,
|
|
40
|
-
help="Feature key, e.g. CRM_LITE",
|
|
41
|
-
)
|
|
42
|
-
parser.add_argument(
|
|
43
|
-
"--output-dir",
|
|
44
|
-
default="",
|
|
45
|
-
help="Output directory for SVGs. Default: docs/specs/assets/<feature_snake>/screens/",
|
|
46
|
-
)
|
|
47
|
-
parser.add_argument(
|
|
48
|
-
"--plantuml-jar",
|
|
49
|
-
default="",
|
|
50
|
-
help="Explicit path to plantuml.jar. Auto-detected if omitted.",
|
|
51
|
-
)
|
|
52
|
-
parser.add_argument(
|
|
53
|
-
"--skip-render",
|
|
54
|
-
action="store_true",
|
|
55
|
-
help="Extract .puml files only, skip SVG rendering.",
|
|
56
|
-
)
|
|
57
|
-
return parser.parse_args()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def normalize_feature_snake(feature_key: str) -> str:
|
|
61
|
-
return re.sub(r"[^a-z0-9]+", "_", feature_key.lower()).strip("_")
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def find_plantuml_jar(explicit: str) -> Optional[Path]:
|
|
65
|
-
if explicit:
|
|
66
|
-
p = Path(explicit).expanduser().resolve()
|
|
67
|
-
return p if p.exists() else None
|
|
68
|
-
user_home = Path.home()
|
|
69
|
-
candidates = sorted(
|
|
70
|
-
(user_home / ".vscode" / "extensions").glob("jebbs.plantuml-*/plantuml.jar")
|
|
71
|
-
)
|
|
72
|
-
if candidates:
|
|
73
|
-
return candidates[-1]
|
|
74
|
-
return None
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def extract_screens(text: str) -> List[Tuple[str, str]]:
|
|
78
|
-
"""Extract (screen_id, plantuml_block) pairs from DESIGN_LAYOUT markdown.
|
|
79
|
-
|
|
80
|
-
Looks for heading patterns like '## A-1. Screen Name' or '## SCR-01 Screen Name'
|
|
81
|
-
followed by a fenced plantuml block containing @startsalt.
|
|
82
|
-
"""
|
|
83
|
-
screens: List[Tuple[str, str]] = []
|
|
84
|
-
heading_pattern = re.compile(
|
|
85
|
-
r"^##\s+([A-Z]+-?\d+|SCR-?\d+)[.\s]",
|
|
86
|
-
re.MULTILINE,
|
|
87
|
-
)
|
|
88
|
-
salt_pattern = re.compile(
|
|
89
|
-
r"```plantuml\s*\n(@startsalt[\s\S]*?@endsalt)\s*\n```",
|
|
90
|
-
re.MULTILINE,
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
headings = list(heading_pattern.finditer(text))
|
|
94
|
-
for i, match in enumerate(headings):
|
|
95
|
-
screen_id = match.group(1).strip().lower().replace("-", "_")
|
|
96
|
-
start = match.start()
|
|
97
|
-
end = headings[i + 1].start() if i + 1 < len(headings) else len(text)
|
|
98
|
-
section = text[start:end]
|
|
99
|
-
|
|
100
|
-
salt_match = salt_pattern.search(section)
|
|
101
|
-
if salt_match:
|
|
102
|
-
screens.append((screen_id, salt_match.group(1)))
|
|
103
|
-
|
|
104
|
-
return screens
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def count_visible_item_markers(salt_block: str) -> int:
|
|
108
|
-
return len(CIRCLED_ITEM_MARKER_RE.findall(salt_block))
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def count_legacy_item_markers(salt_block: str) -> int:
|
|
112
|
-
return len(LEGACY_ITEM_MARKER_RE.findall(salt_block))
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
def render_svg(
|
|
116
|
-
plantuml_jar: Path, puml_path: Path, output_dir: Path
|
|
117
|
-
) -> Optional[str]:
|
|
118
|
-
"""Render a single .puml to .svg. Returns error string or None on success."""
|
|
119
|
-
proc = subprocess.run(
|
|
120
|
-
["java", "-Dfile.encoding=UTF-8", "-jar", str(plantuml_jar), "-charset", "UTF-8", "-tsvg", str(puml_path)],
|
|
121
|
-
stdout=subprocess.PIPE,
|
|
122
|
-
stderr=subprocess.STDOUT,
|
|
123
|
-
text=True,
|
|
124
|
-
check=False,
|
|
125
|
-
)
|
|
126
|
-
# PlantUML writes .svg next to the .puml file.
|
|
127
|
-
svg_path = puml_path.with_suffix(".svg")
|
|
128
|
-
if not svg_path.exists():
|
|
129
|
-
return f"Render failed (no svg produced): {puml_path.name}"
|
|
130
|
-
|
|
131
|
-
# If .puml is already in the output dir, no copy needed.
|
|
132
|
-
# Otherwise move the svg to the output dir.
|
|
133
|
-
svg_dst = output_dir / svg_path.name
|
|
134
|
-
if svg_path.resolve() != svg_dst.resolve():
|
|
135
|
-
shutil.copy2(svg_path, svg_dst)
|
|
136
|
-
svg_path.unlink(missing_ok=True)
|
|
137
|
-
svg_path = svg_dst
|
|
138
|
-
|
|
139
|
-
svg_text = svg_path.read_text(encoding="utf-8", errors="ignore")
|
|
140
|
-
if any(
|
|
141
|
-
x in svg_text
|
|
142
|
-
for x in ("Cannot find group", "Syntax Error", "contains errors")
|
|
143
|
-
):
|
|
144
|
-
return f"Rendered with error content: {svg_path.name}"
|
|
145
|
-
if proc.returncode != 0:
|
|
146
|
-
return f"PlantUML exit={proc.returncode} for {puml_path.name}"
|
|
147
|
-
return None
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def main() -> int:
|
|
151
|
-
args = parse_args()
|
|
152
|
-
|
|
153
|
-
feature_key = args.feature_key.strip()
|
|
154
|
-
if not feature_key:
|
|
155
|
-
print("[ERROR] --feature-key is empty", file=sys.stderr)
|
|
156
|
-
return 1
|
|
157
|
-
|
|
158
|
-
feature_snake = normalize_feature_snake(feature_key)
|
|
159
|
-
layout_path = Path(args.design_layout)
|
|
160
|
-
if not layout_path.exists():
|
|
161
|
-
print(f"[ERROR] Design layout not found: {layout_path}", file=sys.stderr)
|
|
162
|
-
return 1
|
|
163
|
-
|
|
164
|
-
if args.output_dir:
|
|
165
|
-
output_dir = Path(args.output_dir)
|
|
166
|
-
else:
|
|
167
|
-
output_dir = Path(f"docs/specs/assets/{feature_snake}/screens")
|
|
168
|
-
|
|
169
|
-
output_dir.mkdir(parents=True, exist_ok=True)
|
|
170
|
-
|
|
171
|
-
text = layout_path.read_text(encoding="utf-8")
|
|
172
|
-
screens = extract_screens(text)
|
|
173
|
-
|
|
174
|
-
if not screens:
|
|
175
|
-
print("[WARN] No screen sections with @startsalt blocks found.")
|
|
176
|
-
print("[OK] Nothing to render.")
|
|
177
|
-
return 0
|
|
178
|
-
|
|
179
|
-
print(f"[OK] Found {len(screens)} screen(s) with SALT wireframes.")
|
|
180
|
-
|
|
181
|
-
numbering_warnings: List[str] = []
|
|
182
|
-
for screen_id, salt_block in screens:
|
|
183
|
-
marker_count = count_visible_item_markers(salt_block)
|
|
184
|
-
legacy_marker_count = count_legacy_item_markers(salt_block)
|
|
185
|
-
if legacy_marker_count > 0:
|
|
186
|
-
numbering_warnings.append(
|
|
187
|
-
f"{screen_id}: legacy `(N)` markers detected; prefer circled-number markers to avoid SALT ambiguity."
|
|
188
|
-
)
|
|
189
|
-
elif marker_count == 0:
|
|
190
|
-
numbering_warnings.append(
|
|
191
|
-
f"{screen_id}: no visible wireframe item markers found."
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
# Write .puml files
|
|
195
|
-
puml_files: List[Path] = []
|
|
196
|
-
for screen_id, salt_block in screens:
|
|
197
|
-
puml_name = f"{screen_id}.puml"
|
|
198
|
-
puml_path = output_dir / puml_name
|
|
199
|
-
puml_path.write_text(salt_block + "\n", encoding="utf-8")
|
|
200
|
-
puml_files.append(puml_path)
|
|
201
|
-
|
|
202
|
-
if args.skip_render:
|
|
203
|
-
print(f"[OK] Wrote {len(puml_files)} .puml file(s). Render skipped (--skip-render).")
|
|
204
|
-
if numbering_warnings:
|
|
205
|
-
print("[WARN] Wireframe numbering issues:")
|
|
206
|
-
for item in numbering_warnings:
|
|
207
|
-
print(f" - {item}")
|
|
208
|
-
return 0
|
|
209
|
-
|
|
210
|
-
# Find PlantUML
|
|
211
|
-
jar = find_plantuml_jar(args.plantuml_jar)
|
|
212
|
-
if not jar:
|
|
213
|
-
print("[WARN] PlantUML jar not found. SVG rendering skipped.")
|
|
214
|
-
print(" Use --plantuml-jar or install VSCode PlantUML extension.")
|
|
215
|
-
print(f"[OK] Wrote {len(puml_files)} .puml file(s) without SVG rendering.")
|
|
216
|
-
return 0
|
|
217
|
-
|
|
218
|
-
# Render SVGs
|
|
219
|
-
errors: List[str] = []
|
|
220
|
-
rendered = 0
|
|
221
|
-
for puml_path in puml_files:
|
|
222
|
-
err = render_svg(jar, puml_path, output_dir)
|
|
223
|
-
if err:
|
|
224
|
-
errors.append(err)
|
|
225
|
-
else:
|
|
226
|
-
rendered += 1
|
|
227
|
-
|
|
228
|
-
print(f"[OK] Rendered {rendered}/{len(puml_files)} screen image(s) to: {output_dir}")
|
|
229
|
-
if errors:
|
|
230
|
-
print("[WARN] Render issues:")
|
|
231
|
-
for item in errors:
|
|
232
|
-
print(f" - {item}")
|
|
233
|
-
if numbering_warnings:
|
|
234
|
-
print("[WARN] Wireframe numbering issues:")
|
|
235
|
-
for item in numbering_warnings:
|
|
236
|
-
print(f" - {item}")
|
|
237
|
-
|
|
238
|
-
return 0
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if __name__ == "__main__":
|
|
242
|
-
try:
|
|
243
|
-
raise SystemExit(main())
|
|
244
|
-
except Exception as exc:
|
|
245
|
-
print(f"[ERROR] {exc}", file=sys.stderr)
|
|
246
|
-
raise
|