sdtk-kit 0.3.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.
Files changed (75) hide show
  1. package/README.md +131 -0
  2. package/assets/manifest/toolkit-bundle.manifest.json +303 -0
  3. package/assets/manifest/toolkit-bundle.sha256.txt +59 -0
  4. package/assets/toolkit/toolkit/AGENTS.md +103 -0
  5. package/assets/toolkit/toolkit/install.ps1 +155 -0
  6. package/assets/toolkit/toolkit/runtimes/claude/CLAUDE_TEMPLATE.md +32 -0
  7. package/assets/toolkit/toolkit/runtimes/codex/CODEX_TEMPLATE.md +32 -0
  8. package/assets/toolkit/toolkit/scripts/init-feature.ps1 +253 -0
  9. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +181 -0
  10. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +116 -0
  11. package/assets/toolkit/toolkit/sdtk.config.json +28 -0
  12. package/assets/toolkit/toolkit/sdtk.config.profiles.example.json +50 -0
  13. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +78 -0
  14. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +212 -0
  15. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +397 -0
  16. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +565 -0
  17. package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +36 -0
  18. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +397 -0
  19. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +43 -0
  20. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +212 -0
  21. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +397 -0
  22. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +136 -0
  23. package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +24 -0
  24. package/assets/toolkit/toolkit/skills/sdtk-design-layout/SKILL.md +21 -0
  25. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +20 -0
  26. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +17 -0
  27. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +15 -0
  28. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +44 -0
  29. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +26 -0
  30. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +22 -0
  31. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/SKILL.md +59 -0
  32. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +136 -0
  33. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +51 -0
  34. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +54 -0
  35. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/numbering-rules.md +76 -0
  36. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/renumber_flow_action_spec_global.py +136 -0
  37. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/scripts/validate_flow_action_spec_numbering.py +249 -0
  38. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/SKILL.md +65 -0
  39. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/references/TEST_CASE_CREATION_RULES.md +129 -0
  40. package/assets/toolkit/toolkit/skills/sdtk-test-case-spec/scripts/validate_test_case_spec.py +97 -0
  41. package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +124 -0
  42. package/assets/toolkit/toolkit/templates/README.md +56 -0
  43. package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +80 -0
  44. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +212 -0
  45. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +62 -0
  46. package/assets/toolkit/toolkit/templates/docs/api/API_ENDPOINTS_TEMPLATE.md +229 -0
  47. package/assets/toolkit/toolkit/templates/docs/api/FEATURE_API_TEMPLATE.yaml +20 -0
  48. package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +397 -0
  49. package/assets/toolkit/toolkit/templates/docs/api/feature_api_flow_list_TEMPLATE.txt +12 -0
  50. package/assets/toolkit/toolkit/templates/docs/architecture/ARCH_DESIGN_TEMPLATE.md +109 -0
  51. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +175 -0
  52. package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +49 -0
  53. package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +73 -0
  54. package/assets/toolkit/toolkit/templates/docs/product/BACKLOG_TEMPLATE.md +50 -0
  55. package/assets/toolkit/toolkit/templates/docs/product/PRD_TEMPLATE.md +66 -0
  56. package/assets/toolkit/toolkit/templates/docs/product/PROJECT_INITIATION_TEMPLATE.md +98 -0
  57. package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +61 -0
  58. package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_CREATION_RULES.md +129 -0
  59. package/assets/toolkit/toolkit/templates/docs/qa/TEST_CASE_TEMPLATE.md +104 -0
  60. package/assets/toolkit/toolkit/templates/docs/specs/BA_SPEC_TEMPLATE.md +139 -0
  61. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +136 -0
  62. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_TEMPLATE.md +160 -0
  63. package/bin/sdtk.js +15 -0
  64. package/package.json +47 -0
  65. package/src/commands/auth.js +85 -0
  66. package/src/commands/generate.js +177 -0
  67. package/src/commands/help.js +69 -0
  68. package/src/commands/init.js +73 -0
  69. package/src/index.js +56 -0
  70. package/src/lib/args.js +116 -0
  71. package/src/lib/errors.js +41 -0
  72. package/src/lib/github-access.js +68 -0
  73. package/src/lib/powershell.js +85 -0
  74. package/src/lib/state.js +83 -0
  75. package/src/lib/toolkit-payload.js +99 -0
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: sdtk-pm
3
+ description: Product Manager + meta-orchestrator workflow for SDTK. Use when you need to start a new feature (Phase 1) or produce PM planning artifacts (PRD + BACKLOG) and update SHARED_PLANNING.md / QUALITY_CHECKLIST.md with correct phase handoffs.
4
+ ---
5
+
6
+ # SDTK PM (Entry Point + Planning)
7
+
8
+ ## Outputs
9
+ - Phase 1: `docs/product/PROJECT_INITIATION_[FEATURE_KEY].md`
10
+ - Phase 2+ (after BA spec): `docs/product/PRD_[FEATURE_KEY].md` + `docs/product/BACKLOG_[FEATURE_KEY].md`
11
+
12
+ ## Process
13
+ 1. Confirm `FEATURE_KEY` + `FEATURE_NAME` + Phase-1 scope in/out.
14
+ 2. Create/update PM artifact(s) using `toolkit/templates/docs/product/*` as structure.
15
+ 3. Ensure REQ-xx list is clear and testable.
16
+ 4. If requirements are provided in VI/JP: keep the original text in an appendix and add an EN translation (literal) for traceability.
17
+ 5. Update `SHARED_PLANNING.md` + `QUALITY_CHECKLIST.md`.
18
+ 6. Handoff:
19
+ - After Project Initiation -> `@ba please analyze ...`
20
+ - After PRD/Backlog -> `@arch please design ...`
21
+
22
+ ## Clarification And Decisions (PM responsibility)
23
+ - Collect OQ-xx items raised by BA/ARCH/DEV/QA in their respective artifacts.
24
+ - Try to resolve OQ-xx using existing docs and reasonable product/tech decisions.
25
+ - If still missing information from the original input: ask the user (final stakeholder) and record the answer as the resolution.
26
+ - Record decisions in PRD `Decision Log` and update OQ-xx `Resolution` fields in the originating docs.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: sdtk-qa
3
+ description: QA workflow for SDTK. Use when you need to validate an implemented feature against BA/PRD/Backlog, run quality gates, document defects, and produce a QA_RELEASE_REPORT with a release decision.
4
+ ---
5
+
6
+ # SDTK QA (Testing + Release Decision)
7
+
8
+ ## Output
9
+ - `docs/qa/QA_RELEASE_REPORT_[FEATURE_KEY].md`
10
+ - Optional (when detailed test design spec is requested):
11
+ - `docs/qa/[FEATURE_KEY]_TEST_CASE.md` via `sdtk-test-case-spec`
12
+
13
+ ## Process
14
+ 1. Validate prerequisites: DEV phase completed + code review PASS.
15
+ 2. Create test strategy mapped to UC/AC.
16
+ 3. If test-case specification artifact is required, invoke `sdtk-test-case-spec` and align counts/coverage with release testing scope.
17
+ 4. If acceptance criteria / expected behavior is unclear: record OQ-xx in QA report and escalate to `@pm` (PM asks the user if still missing info).
18
+ 5. Execute/record results (unit/integration/e2e as applicable).
19
+ 6. Record defects with severity and status.
20
+ 7. Decide: APPROVED vs REJECTED (with reasons).
21
+ 8. Update shared state + Phase 5 checklist.
22
+ 9. Handoff: `@pm please finalize release status ...` if approved.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: sdtk-screen-design-spec
3
+ description: Create/update screen flow-action specifications from requirement sources (Excel/Figma/spec docs), including screen flow PlantUML, UI item/action tables, API mapping tables, and screen-to-API traceability.
4
+ ---
5
+
6
+ # SDTK Screen Flow Action Spec
7
+
8
+ ## Outputs
9
+ - `docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md`
10
+ - Optional supporting docs:
11
+ - `docs/specs/[FEATURE_KEY]_FIGMA_LAYOUT.md`
12
+ - `docs/specs/[FEATURE_KEY]_DESIGN_SPEC_FROM_EXCEL.md`
13
+ - `docs/specs/assets/[feature_snake]/screens/*`
14
+
15
+ ## Required Inputs
16
+ - Feature key/name
17
+ - Primary requirement sources (BA spec, architecture, customer design docs)
18
+ - Screen source references (Figma URLs and/or requirement screenshots)
19
+ - API endpoint source (`docs/api/[FEATURE_KEY]_ENDPOINTS.md`) when available
20
+
21
+ ## Process
22
+ 1. Read requirement sources and identify in-scope screens, dialogs, and transitions.
23
+ 2. Read and apply rules from `./references/FLOW_ACTION_SPEC_CREATION_RULES.md`.
24
+ 3. Build/update section `Feature overview` and `Screen flow action` (PlantUML).
25
+ 4. For each screen/dialog:
26
+ - Add metadata (screen ID, source link)
27
+ - Add screen image reference
28
+ - Add UI item/action table with `No` column
29
+ - Add API mapping table (trigger -> API -> data usage)
30
+ 5. Build/update `System processing flow` from use-case and process sources.
31
+ 6. Build/update `Open questions` for unresolved behavior/API/data points.
32
+ 7. Build/update `Screen - API Mapping` summary section.
33
+ 8. Validate:
34
+ - global numbering consistency (no screen-level reset)
35
+ - no broken image paths
36
+ - PlantUML renderability
37
+ - consistency with API endpoints spec
38
+ - EN artifact hygiene (no VI leftovers, no mojibake, no merged heading lines)
39
+ - for legacy specs with per-screen reset numbering: run renumber migration first
40
+ 9. Update document history and handoff to ARCH/DEV.
41
+
42
+ ## Rule References
43
+ - Core rules: `./references/FLOW_ACTION_SPEC_CREATION_RULES.md`
44
+ - Numbering reference: `./references/numbering-rules.md`
45
+ - Figma reference: `./references/figma-mcp.md`
46
+ - Excel image export reference: `./references/excel-image-export.md`
47
+
48
+ ## Validation Script
49
+ - `scripts/validate_flow_action_spec_numbering.py`
50
+ - Checks duplicate/resetted numbering in action tables.
51
+ - Checks encoding/markdown hygiene.
52
+ - For EN artifacts, run with `--en-check`:
53
+ - `python "toolkit/skills/sdtk-screen-design-spec/scripts/validate_flow_action_spec_numbering.py" --spec "docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md" --en-check`
54
+ - `scripts/renumber_flow_action_spec_global.py`
55
+ - Auto-migrates action table `No` fields to global numbering.
56
+ - Dry-run:
57
+ - `python "toolkit/skills/sdtk-screen-design-spec/scripts/renumber_flow_action_spec_global.py" --spec "docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md"`
58
+ - Apply:
59
+ - `python "toolkit/skills/sdtk-screen-design-spec/scripts/renumber_flow_action_spec_global.py" --spec "docs/specs/[FEATURE_KEY]_FLOW_ACTION_SPEC.md" --write`
@@ -0,0 +1,136 @@
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. `Screen flow action` (with PlantUML)
23
+ 4. `Screen layout spec by flow action`
24
+ 5. `System processing flow`
25
+ 6. `Open questions`
26
+ 7. `Screen - API mapping`
27
+ 8. `Document history`
28
+
29
+ If a section is not in scope, keep the section and mark explicitly as `N/A` with reason.
30
+
31
+ ## 3. Table Standards
32
+
33
+ - Every table must include a `No` column (sequential numbering).
34
+ - Use stable headers for action tables:
35
+ - `No | JP Item Name | Item Name | Item Type | Attribute | DB Column | Size | Default Value | Action | Description | Note`
36
+ - Use stable headers for API mapping tables:
37
+ - `No | Trigger/When | UI item (No / JP Item Name) | API to call | Data usage / Notes`
38
+ - Use stable headers for screen mapping:
39
+ - `No | Screen (section) | Screen ID | Read/Search APIs | Write APIs | Notes / Q&A refs`
40
+ - Table rows must keep column count consistent with the header (no broken or merged rows).
41
+ - Avoid single-line merged content that collapses multiple logical items into one table row.
42
+
43
+ ### 3.1 Language and Encoding Standards (EN Artifacts)
44
+
45
+ - For EN artifacts (`docs/en/**` or explicitly requested EN version), narrative text must be English.
46
+ - JP labels can remain only in JP-specific fields/columns (`JP Item Name`, `項目名`, source captions).
47
+ - Do not leave mixed-language fragments in one sentence/cell (for example VI+EN mixed text).
48
+ - If original VI/JP text is required for traceability, keep it in a clearly marked appendix block (`Original Text`), then provide EN translation.
49
+ - Save files as UTF-8 and avoid mojibake/broken glyphs (`�`, `ↁE`, garbled sequences).
50
+ - Keep canonical terminology stable across documents (for example: `bukken`, `sagyo`, `customer employee`).
51
+
52
+ ### 3.2 Markdown Structure Hygiene
53
+
54
+ - Keep each heading on its own line; do not concatenate multiple headings/sections on one line.
55
+ - Keep metadata blocks (`Information`, `Note`, `Behavior notes`) as structured bullet blocks, not single compressed lines.
56
+ - Keep image, table, and separator (`---`) boundaries explicit to preserve parser/render stability.
57
+
58
+ ## 4. Item Numbering and Duplication Rules
59
+
60
+ - Use one numbering mode only: `global across document`.
61
+ - Number values must increase across all action tables in the document.
62
+ - Avoid duplicate item descriptions for the same UI control across screens unless behavior differs.
63
+ - If duplicate number is intentional (rare), annotate reason in `Note`.
64
+
65
+ ## 5. Screen Section Rules
66
+
67
+ For each screen section:
68
+
69
+ - Provide metadata:
70
+ - official screen name
71
+ - Screen ID
72
+ - design source URL (for example Figma)
73
+ - Embed one representative image per screen.
74
+ - Provide one action table.
75
+ - Provide one API mapping table.
76
+ - If a screen has dialogs, create explicit dialog sub-sections with their own tables and API mapping.
77
+
78
+ ## 6. API Traceability Rules
79
+
80
+ - Every actionable UI event that changes state must map to a write API.
81
+ - Every data-loading UI event must map to a read/search API.
82
+ - If one endpoint serves multiple actions (initial load, search, refresh), state this explicitly.
83
+ - If no API is called for an action, state `No API` and explain why.
84
+
85
+ ## 7. PlantUML Rules for Screen Flow
86
+
87
+ - Use valid PlantUML syntax and renderability checks before handoff.
88
+ - Use `\\n` for multi-line labels in nodes.
89
+ - Keep diagram at navigation/action level (not low-level SQL or backend internals).
90
+ - Ensure screen names in PlantUML match section names in layout spec.
91
+
92
+ ## 8. Data Source and Asset Rules
93
+
94
+ - Prioritize source order:
95
+ 1. Confirmed design source (for example Figma)
96
+ 2. Confirmed requirement files (Excel/spec)
97
+ 3. User-provided screenshots
98
+ - Store images in repository-relative paths.
99
+ - Do not keep temporary local absolute paths in markdown.
100
+
101
+ ## 9. Consistency with Other Specs
102
+
103
+ - Align terms with:
104
+ - BA spec glossary
105
+ - API endpoints spec
106
+ - Database spec
107
+ - If terminology differs across docs, raise an open question and add a temporary mapping note.
108
+ - Keep endpoint paths in flow-action spec consistent with API endpoint spec.
109
+
110
+ ## 10. Open Questions and Uncertainty Handling
111
+
112
+ - Capture unresolved items in `Open questions` table.
113
+ - Do not invent UI behavior or API contracts when source is ambiguous.
114
+ - Mark uncertain mappings as `Draft` and include impacted files/sections.
115
+
116
+ ## 11. Change Management
117
+
118
+ - On each update:
119
+ - update impacted screen sections
120
+ - update API mapping tables
121
+ - update screen-to-API mapping summary
122
+ - append one row in document history
123
+ - Never overwrite past history rows.
124
+
125
+ ## 12. Final Checklist Before Handoff
126
+
127
+ - PlantUML renders successfully.
128
+ - All mandatory sections exist.
129
+ - All tables include `No`.
130
+ - Numbering is global across the document (no resets).
131
+ - No broken image links.
132
+ - Screen/API mappings are consistent with `*_ENDPOINTS.md`.
133
+ - Open questions are explicit and traceable.
134
+ - For EN artifact: no leftover VI text outside allowed `Original Text` appendix blocks.
135
+ - No mojibake/encoding corruption markers.
136
+ - Headings/tables are structurally clean (no merged lines that break readability/traceability).
@@ -0,0 +1,51 @@
1
+ # Export anh tu Excel (sheet co hinh/shape) - tranh vo layout & loi anh trang
2
+
3
+ ## Khi nao can
4
+
5
+ - Sheet `画面遷移` hoac `画面|...` chua hinh (picture/shape) thay vi text trong cell.
6
+ - Can anh de embed vao markdown hoac overlay so.
7
+
8
+ ## Loi da gap & nguyen nhan
9
+
10
+ 1) `Chart.Export()` ra PNG trang (~1.3KB)
11
+ - Nguyen nhan: Excel COM export chart/picture khong on dinh voi group/picture phuc tap.
12
+
13
+ 2) Sai duong dan thu muc anh khi SaveAs HTML
14
+ - Excel tao folder anh theo quy uoc: `<basename>.files`
15
+ - Vi du: `export.html` -> folder `export.files` (khong phai `export.html.files`).
16
+
17
+ 3) Excel COM crash / OLE error `0x800a01a8`
18
+ - Nguyen nhan pho bien: goi `Quit()` nham instance Excel dang duoc attach boi COM (dac biet khi dung `Dispatch`).
19
+
20
+ 4) Marker 2 chu so bi mat digit (10 hien thi nhu 1)
21
+ - Nguyen nhan: oval qua nho + wrap/align khong chuan.
22
+
23
+ ## Cach lam khuyen nghi (tu dong)
24
+
25
+ Dung script trong repo, vi du:
26
+ `Requirements/_generate_numbered_screen_images.py`
27
+
28
+ Script nen dam bao:
29
+ - Flatten group + SaveAs HTML de lay PNG that (tranh PNG trang).
30
+ - Dung `DispatchEx` khi mo Excel rieng de overlay len PNG (tranh crash do Quit nham instance).
31
+ - Tang size oval + tat WordWrap de hien thi du 2-3 chu so.
32
+ - Su dung dung quy uoc `.files` folder khi export HTML.
33
+
34
+ Chay (vi du, tai project root):
35
+ ```powershell
36
+ python Requirements\_generate_numbered_screen_images.py
37
+ ```
38
+
39
+ ## Cach lam thu cong (fallback)
40
+
41
+ 1) Mo Excel -> chon vung UI can export (picture/group) -> Copy as Picture.
42
+ 2) Paste sang sheet trong hoac workbook moi.
43
+ 3) Save As -> "Web Page (*.htm; *.html)".
44
+ 4) Vao folder `<basename>.files` -> chon file `imageXXX.png` co kich thuoc phu hop nhat.
45
+ 5) Copy sang `docs/specs/assets/[feature_snake]/screens/` va dat ten theo convention.
46
+
47
+ ## Luu y khi script fail do ten Picture thay doi
48
+
49
+ Neu script tham chieu theo `picture_name` (vd: `Picture 4`, `Picture 7`), khi Excel doi ten:
50
+ - Mo Excel -> chon picture -> xem/doi ten trong Selection Pane, hoac
51
+ - Cap nhat lai `picture_name` trong script.
@@ -0,0 +1,54 @@
1
+ # Figma MCP: lay layout/style/tokens + export anh
2
+
3
+ ## Parse URL Figma
4
+
5
+ Mau URL:
6
+ `https://www.figma.com/design/<fileKey>/<fileName>?node-id=<nodeId>&m=dev&t=...`
7
+
8
+ - `fileKey` = segment sau `/design/`.
9
+ - `nodeId`:
10
+ - query param `node-id=1-2695`
11
+ - chuyen sang format API: `1:2695` (thay `-` bang `:`).
12
+
13
+ ## Lay du lieu layout/style (uu tien)
14
+
15
+ Dung MCP:
16
+ - `mcp__figma__get_figma_data`
17
+ - Input: `fileKey`, `nodeId`
18
+ - Goi y: thu `depth=2` hoac `depth=3` (tang dan neu thieu thong tin).
19
+
20
+ Khi tong hop vao `docs/specs/[FEATURE_KEY]_FIGMA_LAYOUT.md`, giu khung:
21
+ - Design Structure: frame dimensions, components/instances, key layers, variants/properties.
22
+ - Styling Data: color (Hex/RGB), typography (font/size/weight/line-height), shadow/opacity/border.
23
+ - Layout Information: padding/gap/alignment, width/height, border radius.
24
+ - Design Tokens: color/typography/spacing tokens neu co ten style (vd: `style_...`).
25
+
26
+ ## Rate-limit 429 / du lieu thieu
27
+
28
+ Neu gap `429 Too Many Requests`:
29
+ 1) Giam `depth` va thu lai.
30
+ 2) Cho va retry (backoff 20s -> 40s -> 80s).
31
+ 3) Neu van fail: de trong cac muc khong lay duoc va ghi note ro ly do 429.
32
+
33
+ Khong tu bịa mau/typography/token khi khong co du lieu.
34
+
35
+ ## Export anh man hinh
36
+
37
+ Dung MCP:
38
+ - `mcp__figma__download_figma_images`
39
+ - Input: `fileKey`, danh sach `nodes` (nodeId), `fileName` (png), `pngScale` (thuong 2).
40
+
41
+ Luu y ve `localPath`:
42
+ - Mot so moi truong chan duong dan tuyet doi.
43
+ - Dung thu muc tuong doi trong repo (vd: `Requirements/_tmp/figma_downloads`) roi copy anh ve:
44
+ - `docs/specs/assets/[feature_snake]/screens/`
45
+
46
+ ## Quy uoc dat ten file anh
47
+
48
+ Khuyen nghi dat ten on dinh de embed lau dai, vi du:
49
+ - `screen_3_1_main.png`
50
+ - `screen_3_2_search.png`
51
+ - `screen_3_3_dialog.png`
52
+ - `screen_3_3_dialog_numbered.png`
53
+
54
+ Neu dung anh tu Excel thay the, van giu cung naming de tranh sua nhieu link trong markdown.
@@ -0,0 +1,76 @@
1
+ # Quy tắc đánh số UI item (Flow Action Spec)
2
+
3
+ ## Mục tiêu
4
+
5
+ - Gắn số lên ảnh màn hình để người đọc map nhanh sang bảng action.
6
+ - Đánh số **toàn cục**, tăng dần theo thứ tự màn hình trong flow.
7
+ - **Không trùng số** giữa các item mới.
8
+ - **Không lặp mô tả** item đã xuất hiện ở màn hình trước.
9
+
10
+ ## Quy ước “item đã xuất hiện”
11
+
12
+ Xem item là “đã xuất hiện” nếu:
13
+ - Cùng ý nghĩa chức năng và cùng vị trí/khu vực UI (dù ở chế độ view khác).
14
+ - Đã được đánh số trong một màn hình trước đó.
15
+
16
+ Hệ quả:
17
+ - Màn hình sau **không thêm dòng mới** vào bảng action cho item này.
18
+ - Nếu cần người đọc định vị, vẫn có thể giữ số trên ảnh (để đối chiếu), nhưng ghi chú trong section: “Đã mô tả ở màn X (No Y)”.
19
+
20
+ ## Cách làm chuẩn (không đoán khi thiếu dữ liệu)
21
+
22
+ 1) Xác định thứ tự màn hình trong flow (mặc định theo danh sách Figma + luồng `画面遷移`).
23
+ 2) Tạo “sổ tay đánh số” (mapping) dạng:
24
+ - `key` (tên/nhãn JP + loại control + khu vực)
25
+ - `value` (số No)
26
+ 3) Với từng màn hình:
27
+ - Liệt kê item tương tác cần mô tả (button/link/selectbox/checkbox…).
28
+ - Nếu item mới: cấp số tiếp theo và thêm vào mapping.
29
+ - Nếu item cũ: không cấp số mới, không lặp mô tả.
30
+ 4) Nếu **chưa xác định được vị trí đặt số trên ảnh**:
31
+ - Yêu cầu user cung cấp ảnh có đánh dấu hoặc chỉ rõ vị trí (tỷ lệ/tọa độ/ô Excel).
32
+ - Không tự suy đoán vị trí.
33
+
34
+ ## Nguồn dữ liệu tham khảo
35
+
36
+ - Excel: sheet `画面|作業員割付` (bảng mô tả + cột BK thường chứa ký hiệu số tròn ㉕/㉖…)
37
+ - Ví dụ:
38
+ - `BK205`: `㉕リスト表示切替ボタン`
39
+ - `BK245`: `㉖マグネット表示切替ボタン`
40
+ - Ảnh/screenshot đã được user đánh số (nguồn xác thực tốt nhất).
41
+ - Ảnh export từ Figma/Excel để overlay số.
42
+
43
+ ## Case lỗi đã gặp & cách tránh
44
+
45
+ ### 1) Trùng số “1” trong màn Search / Edit
46
+
47
+ Nguyên nhân thường gặp:
48
+ - Overlay tool chỉ đọc được “1” khi marker là 2 chữ số (10,11,12…).
49
+
50
+ Cách tránh:
51
+ - Khi tạo marker (oval) cho 2+ chữ số, tăng kích thước tối thiểu (>= 32px) và tắt WordWrap.
52
+ - Nếu lấy marker từ Excel, đảm bảo marker trong Excel hiển thị đúng 2 chữ số trước khi export.
53
+
54
+ ### 2) Excel spec bị “duplicate numbering” (ví dụ ㉑ xuất hiện 2 lần)
55
+
56
+ Nguyên nhân:
57
+ - Dữ liệu Excel gốc bị trùng ký hiệu số.
58
+
59
+ Cách xử lý:
60
+ - Ưu tiên theo logic UI + screenshot user xác nhận.
61
+ - Renumber phần bị duplicate theo số tiếp theo (vd: 21 bị trùng → “đóng/xoá/search” thành 22/23/24 theo thứ tự thao tác).
62
+ - Ghi chú rõ “Excel có duplicate; đã chuẩn hoá lại theo sequence toàn cục”.
63
+
64
+ ### 3) Item đã mô tả ở màn trước vẫn bị lặp trong bảng màn sau
65
+
66
+ Cách tránh:
67
+ - Trước khi thêm dòng vào bảng, đối chiếu mapping toàn cục.
68
+ - Nếu cần nhắc lại, chỉ thêm bullet note “đã mô tả ở …”, không thêm dòng mới trong bảng.
69
+
70
+ ## Ví dụ theo dự án tham chiếu
71
+
72
+ - Màn 3.1 (Bukken View): đã đánh số 1–9.
73
+ - Màn 3.2 (Search): tiếp tục 10–24.
74
+ - Màn 3.3 (Bukken Magnet): chỉ đánh số 25 cho nút chuyển List.
75
+ - Màn 3.4 (Bukken List): chỉ đánh số 26 cho nút chuyển Magnet.
76
+ - Màn 3.7 (Worker Magnet): chỉ đánh số các item mới theo yêu cầu (vd: selectbox 物件名, nút 検索, checkbox 複数日登録モード).
@@ -0,0 +1,136 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import re
5
+ import sys
6
+ from pathlib import Path
7
+
8
+
9
+ TABLE_ROW_RE = re.compile(r"^\|.*\|\s*$")
10
+ TABLE_SEP_RE = re.compile(r"^\|\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|\s*$")
11
+
12
+
13
+ def _split_table_row(line: str) -> list[str]:
14
+ return [p.strip() for p in line.strip().strip("|").split("|")]
15
+
16
+
17
+ def _read_text(path: Path) -> tuple[str, str]:
18
+ for enc in ("utf-8-sig", "utf-8", "cp1252"):
19
+ try:
20
+ return path.read_text(encoding=enc), enc
21
+ except UnicodeDecodeError:
22
+ continue
23
+ return path.read_text(errors="replace"), "utf-8"
24
+
25
+
26
+ def _make_row(cells: list[str]) -> str:
27
+ return "| " + " | ".join(cells) + " |"
28
+
29
+
30
+ def renumber_action_tables(md_text: str) -> tuple[str, int, int]:
31
+ lines = md_text.splitlines()
32
+ out = lines[:]
33
+
34
+ expected_no = 1
35
+ touched = 0
36
+ rows = 0
37
+
38
+ i = 0
39
+ while i < len(lines):
40
+ line = lines[i]
41
+ if i + 1 < len(lines) and TABLE_ROW_RE.match(line) and TABLE_ROW_RE.match(lines[i + 1]):
42
+ header = _split_table_row(line)
43
+ if not TABLE_SEP_RE.match(lines[i + 1]):
44
+ i += 1
45
+ continue
46
+
47
+ lowered = [h.lower() for h in header]
48
+ if "action" not in lowered or "description" not in lowered:
49
+ i += 1
50
+ continue
51
+ if "no" in lowered:
52
+ no_index = lowered.index("no")
53
+ elif "no." in lowered:
54
+ no_index = lowered.index("no.")
55
+ else:
56
+ i += 1
57
+ continue
58
+
59
+ j = i + 2
60
+ while j < len(lines) and TABLE_ROW_RE.match(lines[j]):
61
+ row = _split_table_row(lines[j])
62
+ if len(row) <= no_index:
63
+ j += 1
64
+ continue
65
+
66
+ try:
67
+ current_no = int(row[no_index])
68
+ except ValueError:
69
+ j += 1
70
+ continue
71
+
72
+ rows += 1
73
+ if current_no != expected_no:
74
+ row[no_index] = str(expected_no)
75
+ out[j] = _make_row(row)
76
+ touched += 1
77
+ expected_no += 1
78
+ j += 1
79
+
80
+ i = j
81
+ continue
82
+
83
+ i += 1
84
+
85
+ return "\n".join(out) + "\n", rows, touched
86
+
87
+
88
+ def main() -> int:
89
+ parser = argparse.ArgumentParser(
90
+ description="Renumber action table `No` fields globally in *_FLOW_ACTION_SPEC.md"
91
+ )
92
+ parser.add_argument("--spec", required=True, help="Path to *_FLOW_ACTION_SPEC.md")
93
+ parser.add_argument(
94
+ "--write",
95
+ action="store_true",
96
+ help="Write changes to file. Without this flag, runs in dry-run mode.",
97
+ )
98
+ args = parser.parse_args()
99
+
100
+ try:
101
+ sys.stdout.reconfigure(encoding="utf-8") # type: ignore[attr-defined]
102
+ sys.stderr.reconfigure(encoding="utf-8") # type: ignore[attr-defined]
103
+ except Exception:
104
+ pass
105
+
106
+ spec_path = Path(args.spec)
107
+ if not spec_path.exists():
108
+ print(f"[ERROR] Not found: {spec_path}", file=sys.stderr)
109
+ return 2
110
+
111
+ text, enc = _read_text(spec_path)
112
+ new_text, rows, touched = renumber_action_tables(text)
113
+
114
+ print(f"Checked: {spec_path}")
115
+ print(f"- Numbered action rows: {rows}")
116
+ print(f"- Rows changed: {touched}")
117
+ print(f"- Mode: {'write' if args.write else 'dry-run'}")
118
+
119
+ if touched == 0:
120
+ print("[OK] Already globally numbered.")
121
+ return 0
122
+
123
+ if not args.write:
124
+ print("[INFO] Re-run with --write to apply changes.")
125
+ return 1
126
+
127
+ if enc not in ("utf-8", "utf-8-sig"):
128
+ enc = "utf-8"
129
+ spec_path.write_text(new_text, encoding=enc)
130
+ print("[OK] Updated file with global numbering.")
131
+ return 0
132
+
133
+
134
+ if __name__ == "__main__":
135
+ raise SystemExit(main())
136
+