id3-cli 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.ja-JP.md +769 -0
  2. package/README.ko-KR.md +769 -0
  3. package/README.md +769 -0
  4. package/README.tr-TR.md +769 -0
  5. package/README.zh-CN.md +769 -0
  6. package/dist/bin/cli.d.ts +2 -0
  7. package/dist/bin/cli.js +40 -0
  8. package/dist/bin/cli.js.map +1 -0
  9. package/dist/scripts/build-hooks.d.ts +1 -0
  10. package/dist/scripts/build-hooks.js +58 -0
  11. package/dist/scripts/build-hooks.js.map +1 -0
  12. package/dist/src/hooks/auto-audit.d.ts +4 -0
  13. package/dist/src/hooks/auto-audit.js +47 -0
  14. package/dist/src/hooks/auto-audit.js.map +1 -0
  15. package/dist/src/hooks/claude-pretool-entry.d.ts +1 -0
  16. package/dist/src/hooks/claude-pretool-entry.js +36 -0
  17. package/dist/src/hooks/claude-pretool-entry.js.map +1 -0
  18. package/dist/src/hooks/claude-stop-entry.d.ts +1 -0
  19. package/dist/src/hooks/claude-stop-entry.js +7 -0
  20. package/dist/src/hooks/claude-stop-entry.js.map +1 -0
  21. package/dist/src/hooks/post-commit-entry.d.ts +1 -0
  22. package/dist/src/hooks/post-commit-entry.js +7 -0
  23. package/dist/src/hooks/post-commit-entry.js.map +1 -0
  24. package/dist/src/hooks/pre-commit-entry.d.ts +1 -0
  25. package/dist/src/hooks/pre-commit-entry.js +16 -0
  26. package/dist/src/hooks/pre-commit-entry.js.map +1 -0
  27. package/dist/src/hooks/rule-check.d.ts +8 -0
  28. package/dist/src/hooks/rule-check.js +101 -0
  29. package/dist/src/hooks/rule-check.js.map +1 -0
  30. package/dist/src/hooks/schema-drift.d.ts +17 -0
  31. package/dist/src/hooks/schema-drift.js +151 -0
  32. package/dist/src/hooks/schema-drift.js.map +1 -0
  33. package/dist/src/hooks/shared.d.ts +43 -0
  34. package/dist/src/hooks/shared.js +98 -0
  35. package/dist/src/hooks/shared.js.map +1 -0
  36. package/dist/src/init.d.ts +20 -0
  37. package/dist/src/init.js +193 -0
  38. package/dist/src/init.js.map +1 -0
  39. package/dist/src/preview/mockup-generator.d.ts +56 -0
  40. package/dist/src/preview/mockup-generator.js +402 -0
  41. package/dist/src/preview/mockup-generator.js.map +1 -0
  42. package/dist/src/preview/renderer.d.ts +30 -0
  43. package/dist/src/preview/renderer.js +145 -0
  44. package/dist/src/preview/renderer.js.map +1 -0
  45. package/dist/src/preview/server.d.ts +9 -0
  46. package/dist/src/preview/server.js +55 -0
  47. package/dist/src/preview/server.js.map +1 -0
  48. package/dist/src/preview/ui-auditor.d.ts +27 -0
  49. package/dist/src/preview/ui-auditor.js +141 -0
  50. package/dist/src/preview/ui-auditor.js.map +1 -0
  51. package/dist/src/preview/ui-gate.d.ts +66 -0
  52. package/dist/src/preview/ui-gate.js +210 -0
  53. package/dist/src/preview/ui-gate.js.map +1 -0
  54. package/dist/src/utils/ascii.d.ts +7 -0
  55. package/dist/src/utils/ascii.js +41 -0
  56. package/dist/src/utils/ascii.js.map +1 -0
  57. package/dist/src/utils/fs.d.ts +6 -0
  58. package/dist/src/utils/fs.js +39 -0
  59. package/dist/src/utils/fs.js.map +1 -0
  60. package/dist/templates/hooks/iddd-auto-audit.js +121 -0
  61. package/dist/templates/hooks/iddd-schema-drift.js +279 -0
  62. package/dist/templates/hooks/post-commit +121 -0
  63. package/dist/templates/hooks/pre-commit +348 -0
  64. package/package.json +37 -0
  65. package/templates/.agents/skills/.gitkeep +0 -0
  66. package/templates/.claude/hooks/.gitkeep +0 -0
  67. package/templates/.claude/hooks/hook-config.json +34 -0
  68. package/templates/.claude/skills/.gitkeep +0 -0
  69. package/templates/.codex/.gitkeep +0 -0
  70. package/templates/.codex/hooks.json +40 -0
  71. package/templates/.iddd/commit-count +1 -0
  72. package/templates/.iddd/preview/.gitkeep +0 -0
  73. package/templates/AGENTS.md +204 -0
  74. package/templates/CLAUDE.md +215 -0
  75. package/templates/README.md +476 -0
  76. package/templates/docs/.gitkeep +0 -0
  77. package/templates/docs/business-rules.md +14 -0
  78. package/templates/docs/domain-glossary.md +8 -0
  79. package/templates/docs/info-debt.md +17 -0
  80. package/templates/docs/model-changelog.md +12 -0
  81. package/templates/hooks/.gitkeep +0 -0
  82. package/templates/hooks/iddd-auto-audit.js +121 -0
  83. package/templates/hooks/iddd-schema-drift.js +279 -0
  84. package/templates/hooks/post-commit +121 -0
  85. package/templates/hooks/pre-commit +348 -0
  86. package/templates/skills/id3-design-information/SKILL.md +170 -0
  87. package/templates/skills/id3-design-information/references/phase2-procedure.md +241 -0
  88. package/templates/skills/id3-design-ui/.gitkeep +0 -0
  89. package/templates/skills/id3-design-ui/SKILL.md +200 -0
  90. package/templates/skills/id3-design-ui/references/.gitkeep +0 -0
  91. package/templates/skills/id3-design-ui/references/step1-structure-derivation.md +177 -0
  92. package/templates/skills/id3-design-ui/references/step2-visual-contract.md +257 -0
  93. package/templates/skills/id3-design-ui/references/step3-gate-and-mockup.md +177 -0
  94. package/templates/skills/id3-design-ui/references/step4-implementation.md +244 -0
  95. package/templates/skills/id3-identify-entities/SKILL.md +239 -0
  96. package/templates/skills/id3-identify-entities/references/.gitkeep +0 -0
  97. package/templates/skills/id3-identify-entities/references/phase0-brownfield.md +377 -0
  98. package/templates/skills/id3-identify-entities/references/phase1-greenfield.md +319 -0
  99. package/templates/skills/id3-info-audit/.gitkeep +0 -0
  100. package/templates/skills/id3-info-audit/SKILL.md +191 -0
  101. package/templates/skills/id3-preview/.gitkeep +0 -0
  102. package/templates/skills/id3-preview/SKILL.md +168 -0
  103. package/templates/skills/id3-spawn-team/.gitkeep +0 -0
  104. package/templates/skills/id3-spawn-team/SKILL.md +213 -0
  105. package/templates/specs/.gitkeep +0 -0
  106. package/templates/specs/data-model.md +26 -0
  107. package/templates/specs/entity-catalog.md +22 -0
  108. package/templates/specs/ui-design-contract.md +54 -0
  109. package/templates/specs/ui-inventory.md +24 -0
  110. package/templates/specs/ui-structure.md +32 -0
  111. package/templates/src/.gitkeep +0 -0
  112. package/templates/steering/.gitkeep +0 -0
  113. package/templates/steering/data-conventions.md +42 -0
  114. package/templates/steering/product.md +38 -0
@@ -0,0 +1,257 @@
1
+ # Step 2: Visual Design Contract
2
+
3
+ This reference details how to detect the frontend stack and establish design tokens. The lead agent executes this step conversationally with the user.
4
+
5
+ ---
6
+
7
+ ## Inputs
8
+
9
+ | File | Purpose |
10
+ |------|---------|
11
+ | `specs/ui-structure.md` | Finalized screen inventory from Step 1 |
12
+ | `specs/entity-catalog.md` | Entity attributes for widget-to-token mapping |
13
+ | `docs/business-rules.md` | BR-xxx rules for validation message templates |
14
+
15
+ ---
16
+
17
+ ## Framework Detection
18
+
19
+ Scan the project root to detect the existing frontend stack. Check each indicator in order:
20
+
21
+ | Detect Target | File Patterns | Result |
22
+ |--------------|---------------|--------|
23
+ | React | `package.json` contains `react`, `*.jsx`/`*.tsx` files | React detected |
24
+ | Vue | `package.json` contains `vue`, `*.vue` files | Vue detected |
25
+ | Svelte | `package.json` contains `svelte`, `*.svelte` files | Svelte detected |
26
+ | Next.js | `next.config.*`, `app/` or `pages/` directory | Next.js detected |
27
+ | Nuxt | `nuxt.config.*` | Nuxt detected |
28
+ | Tailwind CSS | `tailwind.config.*` | Tailwind detected |
29
+ | shadcn/ui | `components.json`, `@/components/ui/` directory | shadcn detected |
30
+ | Radix UI | `@radix-ui/*` in package.json dependencies | Radix detected |
31
+ | MUI | `@mui/*` in package.json dependencies | MUI detected |
32
+ | None | No frontend files found | Greenfield |
33
+
34
+ ### User Confirmation
35
+
36
+ After detection, confirm with the user:
37
+ - **Detected stack:** "React + Tailwind + shadcn/ui detected. Proceed with this stack?"
38
+ - **Greenfield:** "No frontend stack detected. Please choose: (A) React + Tailwind + shadcn/ui, (B) Vue + Tailwind, (C) Svelte + Tailwind, (D) Specify your own"
39
+
40
+ Record the confirmed stack in the contract.
41
+
42
+ ---
43
+
44
+ ## 5 Design Token Areas
45
+
46
+ ### 1. Spacing Scale
47
+
48
+ Default proposal: **8-point grid**
49
+
50
+ | Token | Value | Usage |
51
+ |-------|-------|-------|
52
+ | space-0.5 | 2px | Hairline gaps |
53
+ | space-1 | 4px | Inline padding, icon gaps |
54
+ | space-2 | 8px | Input padding, small gaps |
55
+ | space-3 | 12px | Card padding (compact) |
56
+ | space-4 | 16px | Section gaps, form field margins |
57
+ | space-6 | 24px | Card padding (standard) |
58
+ | space-8 | 32px | Section separators |
59
+ | space-12 | 48px | Page section gaps |
60
+ | space-16 | 64px | Major layout gaps |
61
+
62
+ **Rule:** All spacing values in the project MUST be multiples of the base unit (4px). Arbitrary pixel values are rejected by the 7-Pillar gate.
63
+
64
+ ### 2. Typography Scale
65
+
66
+ Default proposal: **4-level hierarchy** with maximum 2 font weights.
67
+
68
+ | Token | Size | Weight | Line Height | Usage |
69
+ |-------|------|--------|-------------|-------|
70
+ | display | 36px | 700 | 1.2 | Page titles, hero headings |
71
+ | heading | 24px | 600 | 1.3 | Section headings, card titles |
72
+ | body | 16px | 400 | 1.5 | Body text, form labels, table cells |
73
+ | caption | 14px | 400 | 1.4 | Help text, timestamps, metadata |
74
+ | mono | 14px | 400 | 1.4 | Code snippets, IDs, technical values |
75
+
76
+ **Rule:** Do not exceed 4 sizes and 2 weights. Additional variation creates visual noise. If more levels are needed, ask the user to justify.
77
+
78
+ ### 3. Color System
79
+
80
+ Default proposal: **60/30/10 ratio**
81
+
82
+ | Token | Light Mode | Dark Mode | Ratio | Usage |
83
+ |-------|-----------|-----------|-------|-------|
84
+ | surface | #ffffff | #0a0a0b | 60% | Page backgrounds, card backgrounds |
85
+ | secondary | #6b7280 | #9ca3af | 30% | Borders, inactive text, dividers |
86
+ | accent | _(user choice)_ | _(user choice)_ | 10% | CTAs, active states, links, focus rings |
87
+
88
+ **Semantic Colors** (fixed):
89
+
90
+ | Token | Light | Dark | Usage |
91
+ |-------|-------|------|-------|
92
+ | success | #22c55e | #4ade80 | Confirmation, completed states |
93
+ | warning | #eab308 | #facc15 | Caution, pending states |
94
+ | error | #ef4444 | #f87171 | Validation errors, destructive actions |
95
+ | info | #3b82f6 | #60a5fa | Informational messages, tips |
96
+
97
+ **Rule:** Only one accent color. Using multiple accent colors dilutes focus. The 7-Pillar gate blocks contracts with more than 1 accent.
98
+
99
+ ### 4. Copywriting Standards
100
+
101
+ Define text patterns for all common UI scenarios. Every user-facing string follows a template.
102
+
103
+ | Pattern | Template | Example |
104
+ |---------|----------|---------|
105
+ | CTA Primary | "Create [Entity]" | "Create User" |
106
+ | CTA Secondary | "Save [Entity]" | "Save User" |
107
+ | CTA Destructive | "Delete [Entity]" | "Delete User" |
108
+ | Empty State | "No [entities] yet. Create your first [entity]." | "No users yet. Create your first user." |
109
+ | Error Required | "[Field] is required." | "Email is required." |
110
+ | Error Format | "[Field] must be a valid [type]." | "Email must be a valid email address." |
111
+ | Error Unique | "[Field] already exists." | "Email already exists." |
112
+ | Danger Confirm | "This will permanently delete [entity]. This cannot be undone." | "This will permanently delete this user. This cannot be undone." |
113
+ | Success | "[Entity] [action] successfully." | "User created successfully." |
114
+ | Loading | "Loading [entities]..." | "Loading users..." |
115
+
116
+ **Tone:** Confirm with user -- Professional (formal), Friendly (casual), or Terse (minimal).
117
+
118
+ **Rule:** Generic labels like "Submit", "Click here", or "OK" are rejected by the 7-Pillar gate. Every CTA must use a specific verb + entity name.
119
+
120
+ ### 5. Component Registry
121
+
122
+ Map each widget type (from Step 1's attribute-to-widget mapping) to a concrete framework component.
123
+
124
+ **Example (shadcn/ui):**
125
+
126
+ | Widget | Component | Import Path |
127
+ |--------|-----------|-------------|
128
+ | Text Input | `<Input />` | `@/components/ui/input` |
129
+ | Textarea | `<Textarea />` | `@/components/ui/textarea` |
130
+ | Select Dropdown | `<Select />` | `@/components/ui/select` |
131
+ | Toggle/Checkbox | `<Switch />` | `@/components/ui/switch` |
132
+ | Number Input | `<Input type="number" />` | `@/components/ui/input` |
133
+ | Date Picker | `<DatePicker />` | `@/components/ui/date-picker` |
134
+ | DateTime Picker | `<DateTimePicker />` | `@/components/ui/datetime-picker` |
135
+ | Autocomplete | `<Combobox />` | `@/components/ui/combobox` |
136
+ | Hidden/Read-only | _(not rendered)_ | -- |
137
+ | File Upload | `<FileUpload />` | `@/components/ui/file-upload` |
138
+ | Specialized Input | `<Input type="email" />` | `@/components/ui/input` |
139
+ | JSON Editor | `<Textarea />` or custom | `@/components/ui/textarea` |
140
+
141
+ **Example (MUI):**
142
+
143
+ | Widget | Component | Import Path |
144
+ |--------|-----------|-------------|
145
+ | Text Input | `<TextField />` | `@mui/material/TextField` |
146
+ | Select Dropdown | `<Select />` | `@mui/material/Select` |
147
+ | Toggle/Checkbox | `<Switch />` | `@mui/material/Switch` |
148
+ | ... | ... | ... |
149
+
150
+ **Example (plain HTML + Tailwind):**
151
+
152
+ | Widget | Component | CSS Classes |
153
+ |--------|-----------|-------------|
154
+ | Text Input | `<input type="text" />` | `border rounded px-3 py-2` |
155
+ | Textarea | `<textarea />` | `border rounded px-3 py-2 min-h-24` |
156
+ | ... | ... | ... |
157
+
158
+ **Rule:** Every widget from the attribute-to-widget mapping MUST have a corresponding component entry. Unmapped widgets are rejected by the 7-Pillar gate.
159
+
160
+ ---
161
+
162
+ ## Entity Attribute to Design Token Connection (IDDD Differentiator)
163
+
164
+ For each attribute in every entity, trace the full chain from information model to visual representation. This is what makes IDDD unique -- every visual decision is justified by the data model.
165
+
166
+ ```
167
+ Entity: User
168
+ Attribute: email (VARCHAR, NOT NULL, UNIQUE)
169
+ -> Widget: Specialized Input (email type) [from Attribute-to-Widget rule #12]
170
+ -> Component: <Input type="email" /> [from Component Registry]
171
+ -> Validation: required + unique check [from NOT NULL + UNIQUE constraints]
172
+ -> BR-003: "Email must be unique" [from business-rules.md]
173
+ -> Spacing: mb-16px (token: space-4) [from Spacing Scale]
174
+ -> Typography: Body (16px/400) [from Typography Scale]
175
+ -> Error Messages:
176
+ - "Email is required." [from Copywriting: Error Required]
177
+ - "Email already exists." [from Copywriting: Error Unique]
178
+ - "Email must be a valid email address." [from Copywriting: Error Format]
179
+ ```
180
+
181
+ Document this chain for every attribute in the Per-Screen Design Spec section of the contract.
182
+
183
+ ---
184
+
185
+ ## Output: `specs/ui-design-contract.md`
186
+
187
+ Write the finalized design contract using this format:
188
+
189
+ ```markdown
190
+ ---
191
+ version: "1.0"
192
+ framework: "React + Next.js"
193
+ ui_library: "shadcn/ui"
194
+ css: "Tailwind CSS"
195
+ derived_from: "ui-structure.md v1.0"
196
+ ---
197
+
198
+ # UI Design Contract
199
+
200
+ ## Tech Stack
201
+ - **Framework:** React 19 + Next.js 15 (App Router)
202
+ - **UI Library:** shadcn/ui (Radix primitives)
203
+ - **Styling:** Tailwind CSS v4
204
+ - **Icons:** Lucide React
205
+
206
+ ## Design Tokens
207
+
208
+ ### Spacing
209
+ | Token | Value | Usage |
210
+ |-------|-------|-------|
211
+ | space-1 | 4px | Inline padding, icon gaps |
212
+ | space-2 | 8px | Input padding, small gaps |
213
+ | ...
214
+
215
+ ### Typography
216
+ | Token | Size | Weight | Line Height | Usage |
217
+ |-------|------|--------|-------------|-------|
218
+ | display | 36px | 700 | 1.2 | Page titles |
219
+ | ...
220
+
221
+ ### Colors
222
+ | Token | Light | Dark | Usage |
223
+ |-------|-------|------|-------|
224
+ | surface | #ffffff | #0a0a0b | Backgrounds |
225
+ | accent | #3b82f6 | #60a5fa | CTAs, active states |
226
+ | ...
227
+
228
+ ### Copywriting
229
+ | Pattern | Template | Example |
230
+ |---------|----------|---------|
231
+ | CTA Primary | "Create [Entity]" | "Create User" |
232
+ | ...
233
+
234
+ ## Component Mapping
235
+ | Widget | Component | Import |
236
+ |--------|-----------|--------|
237
+ | Text Input | <Input /> | @/components/ui/input |
238
+ | ...
239
+
240
+ ## Per-Screen Design Spec
241
+
242
+ ### User List (/users)
243
+ | Attribute | Widget | Component | Tokens | Validation |
244
+ |-----------|--------|-----------|--------|------------|
245
+ | name | Text Input | <Input /> | body, space-4 | required |
246
+ | email | Specialized Input | <Input type="email" /> | body, space-4 | required, unique, BR-003 |
247
+ | ...
248
+ ```
249
+
250
+ ### Completeness Check
251
+
252
+ Before writing the file, verify:
253
+ - [ ] Tech stack is confirmed with user
254
+ - [ ] All 5 design token areas are populated
255
+ - [ ] Every widget from ui-structure.md has a component mapping
256
+ - [ ] Per-screen design spec covers all screens from ui-structure.md
257
+ - [ ] Entity-attribute-to-token chain is documented for every visible attribute
@@ -0,0 +1,177 @@
1
+ # Step 3: Pre-Implementation Gate + Visual Mockup Review
2
+
3
+ This reference details the 7-Pillar quality gate, HTML mockup generation, and user approval process. The lead agent executes the gate automatically, then presents mockups for user review.
4
+
5
+ ---
6
+
7
+ ## Inputs
8
+
9
+ | File | Purpose |
10
+ |------|---------|
11
+ | `specs/ui-structure.md` | Screen inventory and traceability matrix |
12
+ | `specs/ui-design-contract.md` | Design tokens, component mapping, copywriting |
13
+ | `specs/entity-catalog.md` | Entity list for coverage verification |
14
+
15
+ ---
16
+
17
+ ## 7-Pillar Verification
18
+
19
+ Run each pillar check against the design artifacts. ALL pillars must PASS before mockup generation proceeds.
20
+
21
+ | # | Pillar | Source Document | PASS Condition | BLOCKED Condition |
22
+ |---|--------|----------------|----------------|-------------------|
23
+ | 1 | Structure Completeness | ui-structure.md | Every entity in entity-catalog.md has at least 1 screen mapped. Entity coverage = 100%. | Entity coverage < 100% |
24
+ | 2 | Spacing | ui-design-contract.md | All spacing values are multiples of the base unit (default: 4px in an 8-point grid). | Any arbitrary value not in the spacing scale |
25
+ | 3 | Typography | ui-design-contract.md | 4 or fewer font sizes defined. 2 or fewer font weights defined. | More than 4 sizes or more than 2 weights |
26
+ | 4 | Color | ui-design-contract.md | Exactly 1 accent color with usage documented. All 4 semantic colors (success, warning, error, info) defined. | Accent undefined, or more than 1 accent, or missing semantic colors |
27
+ | 5 | Copywriting | ui-design-contract.md | CTA, empty state, error, and danger patterns defined. No generic text ("Submit", "Click here", "OK"). | Missing patterns or generic text found |
28
+ | 6 | Component Registry | ui-design-contract.md | Every widget type from ui-structure.md has a mapped component with import path or CSS classes. | Any widget without a component mapping |
29
+ | 7 | Traceability | Both documents | Every screen in ui-structure.md has an entity source. Every widget in the per-screen spec has an attribute source. | Any screen or widget without traceable origin |
30
+
31
+ ### Gate Result Format
32
+
33
+ Write the gate result to `.iddd/ui-gate-result.md`:
34
+
35
+ ```markdown
36
+ ---
37
+ timestamp: "YYYY-MM-DDTHH:MM:SS"
38
+ verdict: "PASS" # or "BLOCKED"
39
+ ---
40
+
41
+ # UI Gate Result
42
+
43
+ | # | Pillar | Status | Details |
44
+ |---|--------|--------|---------|
45
+ | 1 | Structure Completeness | PASS | 12/12 entities covered (100%) |
46
+ | 2 | Spacing | PASS | All values on 8-point grid |
47
+ | 3 | Typography | PASS | 4 sizes, 2 weights |
48
+ | 4 | Color | PASS | 1 accent (#3b82f6), 4 semantic colors |
49
+ | 5 | Copywriting | PASS | 4 patterns defined, no generic text |
50
+ | 6 | Component Registry | PASS | 12/12 widgets mapped |
51
+ | 7 | Traceability | PASS | 15/15 screens traced, 48/48 widgets traced |
52
+
53
+ **Verdict: PASS** -- Proceed to mockup generation.
54
+ ```
55
+
56
+ If BLOCKED, list the specific violations under each failing pillar and fix them before re-running the gate.
57
+
58
+ ---
59
+
60
+ ## Mockup Generation
61
+
62
+ After the 7-Pillar gate passes, generate HTML mockup files from `ui-structure.md` and `ui-design-contract.md`.
63
+
64
+ ### Generation Principle
65
+
66
+ ```
67
+ Entity: User
68
+ ui-structure.md -> List View, Detail View, Create Form, Edit Form
69
+ ui-design-contract.md -> shadcn Table, Card, Input + spacing 8pt + accent blue
70
+
71
+ -> mockup-users.html:
72
+ - List View: styled Table with actual column headers from entity attributes
73
+ - Detail View: Card layout with attribute grouping + relationship tabs
74
+ - Create Form: Input/Select/Toggle with validation message placeholders
75
+ - All views apply design tokens (colors, spacing, typography)
76
+ ```
77
+
78
+ ### 3 Fidelity Levels
79
+
80
+ Each entity mockup file contains 3 switchable tabs:
81
+
82
+ | Level | Content | Purpose |
83
+ |-------|---------|---------|
84
+ | **Wireframe** | Layout structure only -- gray boxes, monospace labels, no color | Verify screen structure and field ordering |
85
+ | **Styled** | Design tokens applied -- accent colors, typography scale, spacing grid | Verify visual design contract compliance |
86
+ | **Interactive** | Sample data populated + state transitions simulated | Verify data presentation and user flow |
87
+
88
+ Users switch between levels using tabs at the top of each mockup page.
89
+
90
+ ### Sample Data Auto-Generation
91
+
92
+ Populate the Interactive tab with realistic sample data based on attribute types:
93
+
94
+ | Attribute Type | Sample Data Examples |
95
+ |---------------|---------------------|
96
+ | VARCHAR (name) | "Alice Johnson", "Bob Smith", "Carol Williams" |
97
+ | Email | "alice@example.com", "bob@example.com" |
98
+ | ENUM (status) | "Active", "Inactive", "Pending" (from enum values) |
99
+ | TIMESTAMP | "2026-04-05 14:30", "2026-03-28 09:15" |
100
+ | INTEGER (count) | 42, 128, 7 |
101
+ | DECIMAL (price) | 19.99, 149.50, 9.95 |
102
+ | FK (organization_id) | "Acme Corp", "Globex Inc", "Initech" |
103
+ | BOOLEAN | Toggle ON/OFF states |
104
+ | DATE | "2026-04-05", "2026-03-28" |
105
+ | UUID (PK) | Hidden from display |
106
+
107
+ Generate at least 3 sample rows for list views and 1 complete record for detail/form views.
108
+
109
+ ### Mockup File Structure
110
+
111
+ | File | Content |
112
+ |------|---------|
113
+ | `.iddd/preview/mockup-index.html` | Index page with left navigation listing all screens grouped by entity. Links to per-entity mockups. |
114
+ | `.iddd/preview/mockup-{entity}.html` | Per-entity mockup with 3 fidelity tabs. Includes all screen patterns for that entity (list, detail, create, edit, dashboard, etc.). |
115
+
116
+ ### Preview Server UI Layout
117
+
118
+ The mockup preview provides a specific layout optimized for design review:
119
+
120
+ - **Left panel:** Screen navigation grouped by entity. Click to navigate between entity mockups.
121
+ - **Center panel:** Active mockup with 3 fidelity tabs (Wireframe / Styled / Interactive).
122
+ - **Bottom panel:** Traceability information showing:
123
+ - Entity and Attribute source for each UI element
124
+ - Design token values applied (spacing, typography, color)
125
+ - BR-xxx rule references for validation logic
126
+ - Widget-to-Component mapping used
127
+
128
+ This bottom traceability panel is the IDDD differentiator. It makes visible why each UI element exists and how it is styled -- all traceable to the information model.
129
+
130
+ ---
131
+
132
+ ## User Approval Process
133
+
134
+ ### Presenting for Review
135
+
136
+ 1. Start the preview server: files are served from `.iddd/preview/`.
137
+ 2. Display the preview URL in the terminal.
138
+ 3. Announce: "Mockup preview is ready at [URL]. Please review all screens across 3 fidelity levels. The traceability panel shows the Entity/Attribute source for each element."
139
+
140
+ ### Collecting Feedback
141
+
142
+ The user responds with one of:
143
+
144
+ - **`approve`** -- All mockups are acceptable. Proceed to Step 4 (Implementation).
145
+ - **`reject`** + specific feedback -- The user describes what needs to change. Examples:
146
+ - "Move the status filter above the table in User List"
147
+ - "Add a confirmation dialog before delete"
148
+ - "Change the dashboard layout to 2-column grid"
149
+ - "The Create Form should group personal info and contact info separately"
150
+
151
+ ### Handling Rejection
152
+
153
+ When the user rejects with feedback:
154
+
155
+ 1. **Analyze the feedback** against ui-structure.md and ui-design-contract.md.
156
+ 2. **Update the relevant spec file:**
157
+ - Screen structure changes -> update ui-structure.md
158
+ - Design token changes -> update ui-design-contract.md
159
+ - New screens -> add to ui-structure.md with Source = "User-requested"
160
+ 3. **Re-run the 7-Pillar gate** to verify changes maintain compliance.
161
+ 4. **Regenerate mockups** for affected entities.
162
+ 5. **Present again** for approval.
163
+
164
+ Repeat until the user approves.
165
+
166
+ ### Approval Record
167
+
168
+ When approved, update `.iddd/ui-gate-result.md`:
169
+
170
+ ```markdown
171
+ ## User Approval
172
+
173
+ - **Status:** Approved
174
+ - **Timestamp:** YYYY-MM-DDTHH:MM:SS
175
+ - **Review rounds:** N
176
+ - **Changes from review:** [summary of changes made during rejection cycles]
177
+ ```
@@ -0,0 +1,244 @@
1
+ # Step 4: Implementation + Post-Audit
2
+
3
+ This reference details the Agent Teams implementation strategy and post-implementation visual audit. The lead agent orchestrates team members and performs the final audit.
4
+
5
+ ---
6
+
7
+ ## Inputs
8
+
9
+ | File | Purpose |
10
+ |------|---------|
11
+ | `specs/ui-structure.md` | Screen inventory and navigation structure |
12
+ | `specs/ui-design-contract.md` | Design tokens, component mapping, per-screen specs |
13
+ | `specs/entity-catalog.md` | Entity definitions and relationships |
14
+ | `specs/data-model.md` | ERD for FK dependency ordering |
15
+ | `docs/business-rules.md` | BR-xxx rules for validation implementation |
16
+ | `.iddd/ui-gate-result.md` | Approved gate result with user sign-off |
17
+
18
+ ---
19
+
20
+ ## Agent Teams Composition
21
+
22
+ The lead agent spawns a team with these roles after the user approves mockups in Step 3:
23
+
24
+ | Role | Count | Responsibility | Reference Files |
25
+ |------|-------|---------------|----------------|
26
+ | ui-implementer-N | 1 per entity group (1-3 entities) | Implement screen code for assigned entities | ui-structure.md, ui-design-contract.md, entity-catalog.md, data-model.md, business-rules.md |
27
+ | ui-reviewer | 1 | Verify design token consistency and traceability across ALL screens | ui-design-contract.md, ui-gate-result.md |
28
+
29
+ ### Team Member Context Files
30
+
31
+ When spawning each team member, provide these files:
32
+
33
+ 1. `specs/entity-catalog.md`
34
+ 2. `specs/data-model.md`
35
+ 3. `specs/ui-structure.md`
36
+ 4. `specs/ui-design-contract.md`
37
+ 5. `docs/business-rules.md`
38
+ 6. `steering/data-conventions.md`
39
+ 7. `CLAUDE.md`
40
+
41
+ ---
42
+
43
+ ## Task Division Rules
44
+
45
+ ### Entity-Based Splitting
46
+
47
+ Each ui-implementer handles all screens for 1-3 entities. An entity's screens (List, Detail, Create, Edit, Dashboard, Child Tab) are never split across team members.
48
+
49
+ ### FK Dependency Ordering
50
+
51
+ 1. Read the ERD from `specs/data-model.md` to build a dependency graph.
52
+ 2. **Independent entities** (no FK to other project entities) can be implemented in parallel.
53
+ 3. **Dependent entities** wait for their parent entity's screens to be complete.
54
+ 4. Within each dependency wave, assign entity groups to team members for parallel execution.
55
+
56
+ ### Common Layout First
57
+
58
+ The **first ui-implementer** (assigned the most-connected or root entity) is responsible for creating shared layout components before their entity screens:
59
+
60
+ 1. Root layout (HTML shell, global CSS, font loading)
61
+ 2. Navigation component (sidebar/header matching the navigation structure from ui-structure.md)
62
+ 3. Shared UI primitives (if not using a component library)
63
+
64
+ Other implementers wait for the common layout to be committed before starting.
65
+
66
+ ### Example Task Assignment
67
+
68
+ ```
69
+ Entity dependency graph:
70
+ Organization (root, no FK)
71
+ User (FK -> Organization)
72
+ Post (FK -> User)
73
+ Comment (FK -> Post, FK -> User)
74
+ Tag (no FK)
75
+ PostTag (FK -> Post, FK -> Tag)
76
+
77
+ Wave 1 (parallel):
78
+ ui-implementer-1: Organization (+ common layout) + Tag
79
+ ui-implementer-2: (waits for layout from implementer-1)
80
+
81
+ Wave 2 (parallel, after Organization + Tag):
82
+ ui-implementer-2: User
83
+ ui-implementer-3: Post
84
+
85
+ Wave 3 (parallel, after User + Post):
86
+ ui-implementer-2: Comment
87
+ ui-implementer-3: PostTag
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Implementation Principles (5 Rules)
93
+
94
+ Every ui-implementer MUST follow these rules:
95
+
96
+ ### 1. Follow the Component Mapping Exactly
97
+
98
+ Use the exact component and import path specified in ui-design-contract.md's Component Mapping table. Do not substitute alternative components without lead agent approval.
99
+
100
+ ### 2. Apply Design Tokens Directly
101
+
102
+ Translate design tokens to code:
103
+ - **Tailwind:** Use utility classes that map to token values (e.g., `mb-4` for space-4 = 16px)
104
+ - **CSS Variables:** Define tokens as CSS custom properties and reference them
105
+ - **Inline styles:** Only as a last resort, and only using token values
106
+
107
+ Never use arbitrary pixel values. Every spacing, font size, and color MUST come from the design token table.
108
+
109
+ ### 3. Add Traceability Comments
110
+
111
+ For each major UI section, add a comment linking to the information model:
112
+
113
+ ```tsx
114
+ {/* Entity: User | Attribute: email | Widget: Specialized Input | BR-003 */}
115
+ <Input type="email" placeholder="Email" required />
116
+ ```
117
+
118
+ These comments enable post-audit traceability verification.
119
+
120
+ ### 4. Implement BR-xxx Validation
121
+
122
+ For each business rule referenced in the per-screen design spec:
123
+ - Add client-side validation matching the rule description
124
+ - Use the copywriting templates from the design contract for error messages
125
+ - Reference the BR-xxx identifier in a code comment
126
+
127
+ ```tsx
128
+ // BR-003: Email must be unique
129
+ const validateEmail = async (email: string) => {
130
+ if (!email) return "Email is required."; // Copywriting: Error Required
131
+ const exists = await checkEmailExists(email);
132
+ if (exists) return "Email already exists."; // Copywriting: Error Unique
133
+ return null;
134
+ };
135
+ ```
136
+
137
+ ### 5. Atomic Commits Per Entity
138
+
139
+ Each entity's screen group is committed as a single atomic unit:
140
+ - Commit message: `feat(ui): implement {Entity} screens (list/detail/create/edit)`
141
+ - Include all files for that entity: components, routes, validation, styles
142
+ - Do NOT commit partial screen implementations
143
+
144
+ ---
145
+
146
+ ## Implementation Order (Within Each Entity)
147
+
148
+ Each ui-implementer follows this sequence for their assigned entity:
149
+
150
+ 1. **Layout + Routing:** Set up the route/page structure for all screens of this entity.
151
+ 2. **Data Fetching:** Connect to API endpoints or create mock data providers.
152
+ 3. **UI Component Placement:** Build the screen layout using components from the registry, applying design tokens.
153
+ 4. **Validation:** Implement BR-xxx rules with copywriting-compliant error messages.
154
+ 5. **State Transitions:** If the entity has state transitions, implement status change UI (buttons, confirmations, status badges).
155
+ 6. **Responsive Handling:** Ensure screens work on mobile (stack layout) and desktop (side-by-side).
156
+
157
+ ---
158
+
159
+ ## Post-Implementation Audit
160
+
161
+ After ALL ui-implementers have committed their work and the ui-reviewer has verified consistency, the lead agent performs a visual audit.
162
+
163
+ ### Audit Procedure
164
+
165
+ 1. **Start the development server** (e.g., `npm run dev`).
166
+ 2. **Navigate to each implemented screen** in the browser.
167
+ 3. **Compare actual rendering against the mockup HTML** from Step 3.
168
+ 4. **Score each pillar on a 1-4 scale** per the criteria below.
169
+
170
+ ### Audit Scoring Criteria
171
+
172
+ | Pillar | 4 (Excellent) | 3 (Good) | 2 (Fair) | 1 (Poor) |
173
+ |--------|---------------|----------|----------|----------|
174
+ | Structure | 100% of screens implemented | >90% implemented | >70% implemented | <70% implemented |
175
+ | Spacing | All values match design tokens | 1-2 violations | 3-5 violations | >5 violations |
176
+ | Typography | Exact match with contract | 1 deviation | 2 deviations | >2 deviations |
177
+ | Color | All colors correct | 1 misuse | 2-3 misuses | >3 misuses |
178
+ | Copywriting | All text matches templates | 1-2 generic labels | 3-5 generic labels | >5 generic labels |
179
+ | Component Registry | All specified components used | 1-2 substitutions | 3-5 substitutions | >5 substitutions |
180
+ | Traceability | All elements have source comments | >80% traced | >50% traced | <50% traced |
181
+
182
+ ### Audit Result: Top 3 Priority Fixes
183
+
184
+ After scoring, identify the **3 most impactful fixes** based on:
185
+ 1. **User visibility:** Issues on frequently visited screens rank higher
186
+ 2. **Severity:** Structural issues > visual issues > comment issues
187
+ 3. **Fix effort:** Quick fixes are prioritized for immediate resolution
188
+
189
+ Format each fix as:
190
+
191
+ ```markdown
192
+ ### Fix 1: [Description]
193
+ - **Pillar:** [affected pillar]
194
+ - **Screen:** [affected screen URL]
195
+ - **Current:** [what is wrong]
196
+ - **Expected:** [what the contract specifies]
197
+ - **Action:** [specific steps to fix]
198
+ ```
199
+
200
+ ### Audit Verdict
201
+
202
+ | Average Score | Verdict | Action |
203
+ |--------------|---------|--------|
204
+ | >= 3.0 | **PASS** | "UI implementation complete. Proceed to Phase 3-5." |
205
+ | < 3.0 | **NEEDS FIXES** | Apply Top 3 fixes, then re-audit. |
206
+
207
+ ### Re-Audit Process
208
+
209
+ If the average score is below 3.0:
210
+
211
+ 1. The lead agent assigns the Top 3 fixes to the appropriate ui-implementer(s).
212
+ 2. Implementers apply fixes and commit.
213
+ 3. The lead agent re-audits only the affected screens.
214
+ 4. Repeat until average >= 3.0.
215
+
216
+ ---
217
+
218
+ ## Audit Report Output
219
+
220
+ Write the audit report to `.iddd/preview/ui-audit.html` as an interactive dashboard:
221
+
222
+ - **Header:** Overall score (average across all pillars) with pass/fail badge
223
+ - **Pillar Cards:** One card per pillar showing score (1-4), status indicator, and specific findings
224
+ - **Screen-by-Screen Breakdown:** Each implemented screen with its individual pillar scores
225
+ - **Top 3 Fixes:** Highlighted section with the priority fixes described above
226
+ - **Comparison View:** Side-by-side panels showing mockup screenshot vs actual rendering (if available)
227
+
228
+ Also update `specs/ui-structure.md` YAML frontmatter:
229
+
230
+ ```yaml
231
+ audit_status: "clean" # or "needs-fixes"
232
+ audit_score: "3.5"
233
+ audit_date: "YYYY-MM-DD"
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Completion
239
+
240
+ When the audit passes (average >= 3.0):
241
+
242
+ 1. Update `specs/ui-structure.md` frontmatter with `audit_status: "clean"`.
243
+ 2. Add entry to `docs/model-changelog.md`.
244
+ 3. The lead agent announces: "UI implementation complete. N screens implemented, audit score X.X/4.0. Proceed to Phase 3-5 (/id3-spawn-team) for backend implementation."