@tailor-platform/erp-kit 0.0.1 → 0.1.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 (213) hide show
  1. package/README.md +196 -28
  2. package/dist/cli.js +894 -0
  3. package/package.json +65 -8
  4. package/rules/app-compose/backend/auth.md +78 -0
  5. package/rules/app-compose/frontend/auth.md +55 -0
  6. package/rules/app-compose/frontend/component.md +55 -0
  7. package/rules/app-compose/frontend/page.md +86 -0
  8. package/rules/app-compose/frontend/screen-detailview.md +112 -0
  9. package/rules/app-compose/frontend/screen-form.md +145 -0
  10. package/rules/app-compose/frontend/screen-listview.md +159 -0
  11. package/rules/app-compose/structure.md +32 -0
  12. package/rules/module-development/commands.md +54 -0
  13. package/rules/module-development/cross-module-type-injection.md +28 -0
  14. package/rules/module-development/dependency-modules.md +24 -0
  15. package/rules/module-development/errors.md +12 -0
  16. package/rules/module-development/executors.md +67 -0
  17. package/rules/module-development/exports.md +13 -0
  18. package/rules/module-development/models.md +34 -0
  19. package/rules/module-development/structure.md +27 -0
  20. package/rules/module-development/sync-vs-async-operations.md +83 -0
  21. package/rules/module-development/testing.md +43 -0
  22. package/rules/sdk-best-practices/db-relations.md +74 -0
  23. package/rules/sdk-best-practices/sdk-docs.md +14 -0
  24. package/schemas/app-compose/actors.yml +34 -0
  25. package/schemas/app-compose/business-flow.yml +50 -0
  26. package/schemas/app-compose/requirements.yml +33 -0
  27. package/schemas/app-compose/resolver.yml +47 -0
  28. package/schemas/app-compose/screen.yml +81 -0
  29. package/schemas/app-compose/story.yml +67 -0
  30. package/schemas/module/command.yml +52 -0
  31. package/schemas/module/feature.yml +58 -0
  32. package/schemas/module/model.yml +70 -0
  33. package/schemas/module/module.yml +50 -0
  34. package/skills/1-module-docs/SKILL.md +107 -0
  35. package/skills/2-module-feature-breakdown/SKILL.md +66 -0
  36. package/skills/3-module-doc-review/SKILL.md +230 -0
  37. package/skills/4-module-tdd-implementation/SKILL.md +56 -0
  38. package/skills/5-module-implementation-review/SKILL.md +400 -0
  39. package/skills/app-compose-1-requirement-analysis/SKILL.md +85 -0
  40. package/skills/app-compose-2-requirements-breakdown/SKILL.md +88 -0
  41. package/skills/app-compose-3-doc-review/SKILL.md +112 -0
  42. package/skills/app-compose-4-design-mock/SKILL.md +248 -0
  43. package/skills/app-compose-5-design-mock-review/SKILL.md +283 -0
  44. package/skills/app-compose-6-implementation-spec/SKILL.md +122 -0
  45. package/skills/mock-scenario/SKILL.md +118 -0
  46. package/src/app.ts +1 -0
  47. package/src/cli.ts +120 -0
  48. package/src/commands/check.test.ts +30 -0
  49. package/src/commands/check.ts +66 -0
  50. package/src/commands/init.test.ts +77 -0
  51. package/src/commands/init.ts +87 -0
  52. package/src/commands/mock/index.ts +53 -0
  53. package/src/commands/mock/start.ts +179 -0
  54. package/src/commands/mock/validate.test.ts +185 -0
  55. package/src/commands/mock/validate.ts +198 -0
  56. package/src/commands/scaffold.test.ts +76 -0
  57. package/src/commands/scaffold.ts +119 -0
  58. package/src/commands/sync-check.test.ts +125 -0
  59. package/src/commands/sync-check.ts +182 -0
  60. package/src/integration.test.ts +63 -0
  61. package/src/mdschema.ts +48 -0
  62. package/src/mockServer.ts +55 -0
  63. package/src/module.ts +86 -0
  64. package/src/modules/accounting/.gitkeep +0 -0
  65. package/src/modules/coa-management/.gitkeep +0 -0
  66. package/src/modules/inventory/.gitkeep +0 -0
  67. package/src/modules/manufacturing/.gitkeep +0 -0
  68. package/src/modules/primitives/README.md +39 -0
  69. package/src/modules/primitives/command/activateCategory.test.ts +75 -0
  70. package/src/modules/primitives/command/activateCategory.ts +50 -0
  71. package/src/modules/primitives/command/activateCurrency.test.ts +70 -0
  72. package/src/modules/primitives/command/activateCurrency.ts +50 -0
  73. package/src/modules/primitives/command/activateUnit.test.ts +53 -0
  74. package/src/modules/primitives/command/activateUnit.ts +50 -0
  75. package/src/modules/primitives/command/convertAmount.test.ts +275 -0
  76. package/src/modules/primitives/command/convertAmount.ts +126 -0
  77. package/src/modules/primitives/command/convertQuantity.test.ts +219 -0
  78. package/src/modules/primitives/command/convertQuantity.ts +73 -0
  79. package/src/modules/primitives/command/createCategory.test.ts +126 -0
  80. package/src/modules/primitives/command/createCategory.ts +89 -0
  81. package/src/modules/primitives/command/createCurrency.test.ts +191 -0
  82. package/src/modules/primitives/command/createCurrency.ts +77 -0
  83. package/src/modules/primitives/command/createExchangeRate.test.ts +216 -0
  84. package/src/modules/primitives/command/createExchangeRate.ts +91 -0
  85. package/src/modules/primitives/command/createUnit.test.ts +214 -0
  86. package/src/modules/primitives/command/createUnit.ts +88 -0
  87. package/src/modules/primitives/command/deactivateCategory.test.ts +97 -0
  88. package/src/modules/primitives/command/deactivateCategory.ts +62 -0
  89. package/src/modules/primitives/command/deactivateCurrency.test.ts +85 -0
  90. package/src/modules/primitives/command/deactivateCurrency.ts +55 -0
  91. package/src/modules/primitives/command/deactivateUnit.test.ts +78 -0
  92. package/src/modules/primitives/command/deactivateUnit.ts +62 -0
  93. package/src/modules/primitives/command/setBaseCurrency.test.ts +98 -0
  94. package/src/modules/primitives/command/setBaseCurrency.ts +74 -0
  95. package/src/modules/primitives/command/setReferenceUnit.test.ts +108 -0
  96. package/src/modules/primitives/command/setReferenceUnit.ts +84 -0
  97. package/src/modules/primitives/db/currency.ts +30 -0
  98. package/src/modules/primitives/db/exchangeRate.ts +28 -0
  99. package/src/modules/primitives/db/unit.ts +32 -0
  100. package/src/modules/primitives/db/uomCategory.ts +32 -0
  101. package/src/modules/primitives/docs/commands/ActivateCategory.md +34 -0
  102. package/src/modules/primitives/docs/commands/ActivateCurrency.md +33 -0
  103. package/src/modules/primitives/docs/commands/ActivateUnit.md +34 -0
  104. package/src/modules/primitives/docs/commands/ConvertAmount.md +50 -0
  105. package/src/modules/primitives/docs/commands/ConvertQuantity.md +43 -0
  106. package/src/modules/primitives/docs/commands/CreateCategory.md +44 -0
  107. package/src/modules/primitives/docs/commands/CreateCurrency.md +47 -0
  108. package/src/modules/primitives/docs/commands/CreateExchangeRate.md +48 -0
  109. package/src/modules/primitives/docs/commands/CreateUnit.md +48 -0
  110. package/src/modules/primitives/docs/commands/DeactivateCategory.md +38 -0
  111. package/src/modules/primitives/docs/commands/DeactivateCurrency.md +38 -0
  112. package/src/modules/primitives/docs/commands/DeactivateUnit.md +38 -0
  113. package/src/modules/primitives/docs/commands/SetBaseCurrency.md +39 -0
  114. package/src/modules/primitives/docs/commands/SetReferenceUnit.md +43 -0
  115. package/src/modules/primitives/docs/features/currency-definitions.md +55 -0
  116. package/src/modules/primitives/docs/features/exchange-rates.md +61 -0
  117. package/src/modules/primitives/docs/features/unit-conversion.md +66 -0
  118. package/src/modules/primitives/docs/features/uom-categories.md +52 -0
  119. package/src/modules/primitives/docs/models/Currency.md +45 -0
  120. package/src/modules/primitives/docs/models/ExchangeRate.md +33 -0
  121. package/src/modules/primitives/docs/models/Unit.md +46 -0
  122. package/src/modules/primitives/docs/models/UoMCategory.md +44 -0
  123. package/src/modules/primitives/generated/kysely-tailordb.ts +95 -0
  124. package/src/modules/primitives/index.ts +40 -0
  125. package/src/modules/primitives/lib/errors.ts +138 -0
  126. package/src/modules/primitives/lib/types.ts +20 -0
  127. package/src/modules/primitives/module.ts +66 -0
  128. package/src/modules/primitives/permissions.ts +18 -0
  129. package/src/modules/primitives/tailor.config.ts +11 -0
  130. package/src/modules/primitives/testing/fixtures.ts +161 -0
  131. package/src/modules/product-management/.gitkeep +0 -0
  132. package/src/modules/purchase/.gitkeep +0 -0
  133. package/src/modules/sales/.gitkeep +0 -0
  134. package/src/modules/shared/createContext.test.ts +39 -0
  135. package/src/modules/shared/createContext.ts +15 -0
  136. package/src/modules/shared/defineCommand.test.ts +42 -0
  137. package/src/modules/shared/defineCommand.ts +19 -0
  138. package/src/modules/shared/definePermissions.test.ts +146 -0
  139. package/src/modules/shared/definePermissions.ts +94 -0
  140. package/src/modules/shared/entityTypes.ts +15 -0
  141. package/src/modules/shared/errors.ts +22 -0
  142. package/src/modules/shared/index.ts +1 -0
  143. package/src/modules/shared/internal.ts +13 -0
  144. package/src/modules/shared/requirePermission.test.ts +47 -0
  145. package/src/modules/shared/requirePermission.ts +8 -0
  146. package/src/modules/shared/types.ts +4 -0
  147. package/src/modules/supplier-management/.gitkeep +0 -0
  148. package/src/modules/supplier-portal/.gitkeep +0 -0
  149. package/src/modules/testing/index.ts +120 -0
  150. package/src/modules/user-management/README.md +38 -0
  151. package/src/modules/user-management/command/activateUser.test.ts +112 -0
  152. package/src/modules/user-management/command/activateUser.ts +67 -0
  153. package/src/modules/user-management/command/assignPermissionToRole.test.ts +119 -0
  154. package/src/modules/user-management/command/assignPermissionToRole.ts +87 -0
  155. package/src/modules/user-management/command/assignRoleToUser.test.ts +162 -0
  156. package/src/modules/user-management/command/assignRoleToUser.ts +93 -0
  157. package/src/modules/user-management/command/createPermission.test.ts +143 -0
  158. package/src/modules/user-management/command/createPermission.ts +66 -0
  159. package/src/modules/user-management/command/createRole.test.ts +115 -0
  160. package/src/modules/user-management/command/createRole.ts +52 -0
  161. package/src/modules/user-management/command/createUser.test.ts +198 -0
  162. package/src/modules/user-management/command/createUser.ts +85 -0
  163. package/src/modules/user-management/command/deactivateUser.test.ts +112 -0
  164. package/src/modules/user-management/command/deactivateUser.ts +67 -0
  165. package/src/modules/user-management/command/logAuditEvent.test.ts +179 -0
  166. package/src/modules/user-management/command/logAuditEvent.ts +59 -0
  167. package/src/modules/user-management/command/reactivateUser.test.ts +115 -0
  168. package/src/modules/user-management/command/reactivateUser.ts +67 -0
  169. package/src/modules/user-management/command/revokePermissionFromRole.test.ts +112 -0
  170. package/src/modules/user-management/command/revokePermissionFromRole.ts +81 -0
  171. package/src/modules/user-management/command/revokeRoleFromUser.test.ts +112 -0
  172. package/src/modules/user-management/command/revokeRoleFromUser.ts +81 -0
  173. package/src/modules/user-management/db/auditEvent.ts +47 -0
  174. package/src/modules/user-management/db/permission.ts +31 -0
  175. package/src/modules/user-management/db/role.ts +28 -0
  176. package/src/modules/user-management/db/rolePermission.ts +44 -0
  177. package/src/modules/user-management/db/user.ts +38 -0
  178. package/src/modules/user-management/db/userRole.ts +44 -0
  179. package/src/modules/user-management/docs/commands/ActivateUser.md +36 -0
  180. package/src/modules/user-management/docs/commands/AssignPermissionToRole.md +39 -0
  181. package/src/modules/user-management/docs/commands/AssignRoleToUser.md +43 -0
  182. package/src/modules/user-management/docs/commands/CreatePermission.md +35 -0
  183. package/src/modules/user-management/docs/commands/CreateRole.md +35 -0
  184. package/src/modules/user-management/docs/commands/CreateUser.md +41 -0
  185. package/src/modules/user-management/docs/commands/DeactivateUser.md +38 -0
  186. package/src/modules/user-management/docs/commands/LogAuditEvent.md +37 -0
  187. package/src/modules/user-management/docs/commands/ReactivateUser.md +37 -0
  188. package/src/modules/user-management/docs/commands/RevokePermissionFromRole.md +40 -0
  189. package/src/modules/user-management/docs/commands/RevokeRoleFromUser.md +40 -0
  190. package/src/modules/user-management/docs/features/audit-trail.md +80 -0
  191. package/src/modules/user-management/docs/features/role-based-access-control.md +76 -0
  192. package/src/modules/user-management/docs/features/user-account-management.md +64 -0
  193. package/src/modules/user-management/docs/models/AuditEvent.md +34 -0
  194. package/src/modules/user-management/docs/models/Permission.md +31 -0
  195. package/src/modules/user-management/docs/models/Role.md +31 -0
  196. package/src/modules/user-management/docs/models/RolePermission.md +33 -0
  197. package/src/modules/user-management/docs/models/User.md +47 -0
  198. package/src/modules/user-management/docs/models/UserRole.md +34 -0
  199. package/src/modules/user-management/docs/plans/2026-01-30-flattened-permissions-design.md +52 -0
  200. package/src/modules/user-management/executor/recomputeOnRolePermissionChange.ts +61 -0
  201. package/src/modules/user-management/generated/enums.ts +24 -0
  202. package/src/modules/user-management/generated/kysely-tailordb.ts +112 -0
  203. package/src/modules/user-management/index.ts +32 -0
  204. package/src/modules/user-management/lib/errors.ts +81 -0
  205. package/src/modules/user-management/lib/recomputeUserPermissions.ts +53 -0
  206. package/src/modules/user-management/lib/types.ts +31 -0
  207. package/src/modules/user-management/module.ts +77 -0
  208. package/src/modules/user-management/permissions.ts +15 -0
  209. package/src/modules/user-management/tailor.config.ts +11 -0
  210. package/src/modules/user-management/testing/fixtures.ts +98 -0
  211. package/src/schemas.ts +25 -0
  212. package/src/testing.ts +10 -0
  213. package/src/util.ts +3 -0
@@ -0,0 +1,248 @@
1
+ ---
2
+ name: app-compose-4-design-mock
3
+ description: Create design mockups from screen specifications using .pen files. Use after completing documentation review with app-compose-3-doc-review. Generates visual UI mockups with shadcn components.
4
+ ---
5
+
6
+ # Design Mockup Workflow
7
+
8
+ Create visual UI mockups from Tier 3 screen documentation using .pen design files and shadcn components.
9
+
10
+ ## Prerequisites
11
+
12
+ Tier 3 documentation must exist:
13
+
14
+ - `docs/screen/*.md` (screen specifications)
15
+ - Design system source file (contains reusable shadcn components)
16
+
17
+ ## Workflow Phases
18
+
19
+ ```
20
+ SETUP → ANALYZE → DESIGN → VALIDATE
21
+ ```
22
+
23
+ ### Phase 1: Setup
24
+
25
+ Ensure the design system file exists at the application's `docs/design.pen`.
26
+
27
+ This provides access to 87+ shadcn reusable components including:
28
+
29
+ - **Layout**: Sidebar, Card, Table, Data Table
30
+ - **Form**: Input, Textarea, Select, Checkbox, Radio
31
+ - **Navigation**: Breadcrumb, Pagination, Tabs
32
+ - **Feedback**: Badge, Alert, Dialog
33
+ - **Actions**: Button (Default, Secondary, Outline, Ghost, Destructive)
34
+
35
+ ### Phase 2: Analyze
36
+
37
+ 1. **Read** all screen documentation in `docs/screen/*.md`
38
+ 2. **Identify** screen types: ListView, DetailView, Form
39
+ 3. **Map** UI requirements to available components
40
+ 4. **Plan** layout hierarchy based on sidebar navigation
41
+
42
+ ### Phase 3: Design
43
+
44
+ Create mockups using Pencil MCP tools.
45
+
46
+ #### 3.1 Get Editor State
47
+
48
+ ```
49
+ mcp__pencil__get_editor_state(include_schema: true)
50
+ mcp__pencil__open_document(filePathOrTemplate: "docs/design.pen")
51
+ ```
52
+
53
+ #### 3.2 Discover Components
54
+
55
+ Search for reusable components:
56
+
57
+ ```
58
+ mcp__pencil__batch_get(
59
+ filePath: "docs/design.pen",
60
+ patterns: [{ "reusable": true }],
61
+ searchDepth: 3
62
+ )
63
+ ```
64
+
65
+ Key component patterns to search:
66
+
67
+ | Component Type | Search Pattern |
68
+ | -------------- | ----------------------- |
69
+ | Sidebar | `{ "name": "Sidebar" }` |
70
+ | Card | `{ "name": "Card" }` |
71
+ | Table | `{ "name": "Table" }` |
72
+ | Input | `{ "name": "Input" }` |
73
+ | Button | `{ "name": "Button" }` |
74
+ | Badge | `{ "name": "Badge" }` |
75
+
76
+ #### 3.3 Create Screen Frames
77
+
78
+ Use `batch_design` to create screens. Standard pattern:
79
+
80
+ ```javascript
81
+ // Create screen frame
82
+ screen = I("document", {
83
+ type: "frame",
84
+ name: "{screen-name}",
85
+ x: { x },
86
+ y: { y },
87
+ width: 1280,
88
+ height: 800,
89
+ fill: "$--background",
90
+ layout: "horizontal",
91
+ });
92
+
93
+ // Add sidebar
94
+ sidebar = I(screen, {
95
+ type: "ref",
96
+ ref: "{sidebar-component-id}",
97
+ height: "fill_container",
98
+ });
99
+ U(sidebar + "/{title-id}", { content: "{app-name}" });
100
+
101
+ // Add main content area
102
+ mainContent = I(screen, {
103
+ type: "frame",
104
+ layout: "vertical",
105
+ gap: 24,
106
+ padding: 32,
107
+ width: "fill_container",
108
+ height: "fill_container",
109
+ });
110
+ ```
111
+
112
+ #### 3.4 Layout Organization
113
+
114
+ Arrange screens by navigation hierarchy:
115
+
116
+ | Row | Y Position | Screens |
117
+ | --- | ---------- | ------------------------- |
118
+ | 0 | 0 | Dashboard (Home) |
119
+ | 1 | 1000 | Primary feature screens |
120
+ | 2 | 2000 | Secondary feature screens |
121
+ | 3 | 3000 | Tertiary feature screens |
122
+ | N | N\*1000 | Settings/Admin screens |
123
+
124
+ Flow within rows: List → Detail → Create/Edit Form
125
+
126
+ #### 3.5 Component Patterns by Screen Type
127
+
128
+ **ListView Pattern:**
129
+
130
+ ```javascript
131
+ // Header with title and action button
132
+ header = I(mainContent, {
133
+ type: "frame",
134
+ justifyContent: "space_between",
135
+ alignItems: "center",
136
+ width: "fill_container",
137
+ });
138
+ title = I(header, {
139
+ type: "text",
140
+ content: "{page-title}",
141
+ fontSize: 24,
142
+ fontWeight: "600",
143
+ fill: "$--foreground",
144
+ });
145
+ actionBtn = I(header, { type: "ref", ref: "{button-component-id}" });
146
+
147
+ // Filter row
148
+ filterRow = I(mainContent, { type: "frame", gap: 12, alignItems: "center" });
149
+
150
+ // Data table in card
151
+ tableCard = I(mainContent, {
152
+ type: "ref",
153
+ ref: "{card-component-id}",
154
+ width: "fill_container",
155
+ });
156
+ ```
157
+
158
+ **Form Pattern:**
159
+
160
+ ```javascript
161
+ // Card with header
162
+ formCard = I(mainContent, {
163
+ type: "ref",
164
+ ref: "{card-component-id}",
165
+ width: "fill_container",
166
+ });
167
+ cardTitle = I(formCard + "/{header-slot-id}", {
168
+ type: "text",
169
+ content: "{form-title}",
170
+ fontSize: 18,
171
+ fontWeight: "600",
172
+ });
173
+
174
+ // Form fields in content slot
175
+ formContent = I(formCard + "/{content-slot-id}", {
176
+ type: "frame",
177
+ layout: "vertical",
178
+ gap: 16,
179
+ width: "fill_container",
180
+ });
181
+ inputField = I(formContent, {
182
+ type: "ref",
183
+ ref: "{input-component-id}",
184
+ width: "fill_container",
185
+ });
186
+ U(inputField + "/{label-id}", { content: "{field-label}" });
187
+
188
+ // Action buttons in footer slot
189
+ btnRow = I(formCard + "/{footer-slot-id}", {
190
+ type: "frame",
191
+ gap: 12,
192
+ justifyContent: "flex_end",
193
+ });
194
+ ```
195
+
196
+ **DetailView Pattern:**
197
+
198
+ ```javascript
199
+ // Breadcrumb navigation
200
+ bcRow = I(mainContent, { type: "frame", gap: 4, alignItems: "center" });
201
+
202
+ // Info cards
203
+ infoCard = I(mainContent, {
204
+ type: "ref",
205
+ ref: "{card-component-id}",
206
+ width: "fill_container",
207
+ });
208
+
209
+ // Action section
210
+ actionRow = I(mainContent, { type: "frame", gap: 12 });
211
+ ```
212
+
213
+ ### Phase 4: Validate
214
+
215
+ Take screenshots to verify each screen:
216
+
217
+ ```
218
+ mcp__pencil__get_screenshot(filePath: "docs/design.pen", nodeId: "{frame-id}")
219
+ ```
220
+
221
+ Check for:
222
+
223
+ - Consistent sidebar navigation across screens
224
+ - Proper alignment and spacing
225
+ - Correct component usage
226
+ - Readable text and labels
227
+
228
+ ## Tips
229
+
230
+ - Always check component structure with `batch_get` before using `U()` updates
231
+ - Use `find_empty_space_on_canvas` for positioning new screens
232
+ - Sidebar navigation should highlight the current screen's menu item
233
+ - Keep operations under 25 per `batch_design` call
234
+ - Use consistent user profile in sidebar footer across all screens
235
+
236
+ ## Validation Commands
237
+
238
+ ```
239
+ # Check layout structure
240
+ mcp__pencil__snapshot_layout(filePath: "docs/design.pen", maxDepth: 0)
241
+
242
+ # Verify screen screenshot
243
+ mcp__pencil__get_screenshot(filePath: "docs/design.pen", nodeId: "{frame-id}")
244
+ ```
245
+
246
+ ## Next Step
247
+
248
+ After completing design mockups, use `/app-compose-5-design-mock-review` to review and validate the mockups against screen specifications.
@@ -0,0 +1,283 @@
1
+ ---
2
+ name: app-compose-5-design-mock-review
3
+ description: Review design mockups (.pen files) against screen specifications. Use after completing design mockups with app-compose-4-design-mock. Validates visual consistency, detects regressions, and fixes layout issues.
4
+ ---
5
+
6
+ # Design Mockup Review Workflow
7
+
8
+ Review visual design mockups against Tier 3 screen documentation. Detect and fix regressions, layout issues, and specification mismatches.
9
+
10
+ ## Prerequisites
11
+
12
+ - `docs/screen/*.md` (screen specifications)
13
+ - `docs/design.pen` (design mockups from app-compose-4-design-mock)
14
+
15
+ ## Workflow Phases
16
+
17
+ ```
18
+ INVENTORY → PARITY CHECK → VISUAL REVIEW → REGRESSION FIX → VALIDATE
19
+ ```
20
+
21
+ ### Phase 1: Inventory
22
+
23
+ #### 1.1 Open Design File
24
+
25
+ ```
26
+ mcp__pencil__get_editor_state(include_schema: false)
27
+ mcp__pencil__open_document(filePathOrTemplate: "docs/design.pen")
28
+ ```
29
+
30
+ #### 1.2 List Design Screens
31
+
32
+ Extract top-level frames (screens) from design.pen:
33
+
34
+ ```
35
+ mcp__pencil__batch_get(
36
+ filePath: "docs/design.pen",
37
+ readDepth: 1
38
+ )
39
+ ```
40
+
41
+ Filter for screen frames (exclude design system components frame).
42
+
43
+ #### 1.3 List Screen Specifications
44
+
45
+ ```bash
46
+ ls docs/screen/*.md
47
+ ```
48
+
49
+ ### Phase 2: Parity Check
50
+
51
+ #### Screen Count Validation
52
+
53
+ | Check | Question |
54
+ | --------------- | ------------------------------------------------------------ |
55
+ | Count match | Does design.pen have same number of screens as screen/\*.md? |
56
+ | Name match | Does each screen in design.pen correspond to a spec file? |
57
+ | Missing screens | Any spec files without corresponding design frames? |
58
+
59
+ Create mapping table:
60
+
61
+ ```markdown
62
+ | Screen Spec | Design Frame | Status |
63
+ | ---------------- | -------------------------- | ---------- |
64
+ | {screen-name}.md | {Screen Name} ({frame-id}) | ✅ |
65
+ | {screen-name}.md | - | ❌ Missing |
66
+ ```
67
+
68
+ ### Phase 3: Visual Review
69
+
70
+ For each screen, perform detailed review:
71
+
72
+ #### 3.1 Screenshot Capture
73
+
74
+ ```
75
+ mcp__pencil__get_screenshot(filePath: "docs/design.pen", nodeId: "{frame-id}")
76
+ ```
77
+
78
+ #### 3.2 Specification Comparison
79
+
80
+ **For ListView screens:**
81
+
82
+ | Check | How to Verify |
83
+ | ---------------------- | ---------------------------------------------------- |
84
+ | Required columns exist | Compare spec table columns with design table headers |
85
+ | Column properties | Sortable/Filterable indicators if applicable |
86
+ | Action buttons | Create/Edit/Delete buttons per spec |
87
+ | Pagination | Present if list can be long |
88
+
89
+ **For Form screens:**
90
+
91
+ | Check | How to Verify |
92
+ | ---------------------- | ------------------------------------------------ |
93
+ | All input fields exist | Match spec field list with form fields |
94
+ | Field types correct | Text/Dropdown/Radio/Checkbox/FileUpload per spec |
95
+ | Required indicators | Required fields marked appropriately |
96
+ | Action buttons | Submit/Cancel buttons present |
97
+
98
+ **For DetailView screens:**
99
+
100
+ | Check | How to Verify |
101
+ | ----------------- | ---------------------------- |
102
+ | Displayed fields | All spec fields visible |
103
+ | Action buttons | Available actions per spec |
104
+ | Status indicators | Badges/Timeline if specified |
105
+
106
+ #### 3.3 Layout Problem Detection
107
+
108
+ ```
109
+ mcp__pencil__snapshot_layout(
110
+ filePath: "docs/design.pen",
111
+ parentId: "{frame-id}",
112
+ problemsOnly: true,
113
+ maxDepth: 10
114
+ )
115
+ ```
116
+
117
+ Common problems:
118
+
119
+ - `partially clipped` - Content overflows container
120
+ - `fully clipped` - Element completely hidden
121
+ - Negative coordinates - Mispositioned elements
122
+
123
+ ### Phase 4: Regression Fix
124
+
125
+ #### 4.1 Layout Issues
126
+
127
+ **Fixed height causing overflow:**
128
+
129
+ ```javascript
130
+ // Change fixed height to fit_content
131
+ U("{container-id}", { height: "fit_content", justifyContent: "start" });
132
+ ```
133
+
134
+ **Element positioning:**
135
+
136
+ ```javascript
137
+ // Reset position
138
+ U("{element-id}", { x: 0, y: 0 });
139
+ ```
140
+
141
+ #### 4.2 Style Inconsistencies
142
+
143
+ **Background color mismatch:**
144
+
145
+ ```javascript
146
+ // Use design token instead of hardcoded color
147
+ U("{frame-id}", { fill: "$--background" });
148
+ ```
149
+
150
+ **Missing icon:**
151
+
152
+ ```javascript
153
+ // Add icon to sidebar item
154
+ U("{frame-id}/{sidebar-id}/{menu-item-id}/{icon-id}", { iconFontName: "{icon-name}" });
155
+ ```
156
+
157
+ **Text not visible (missing fill):**
158
+
159
+ ```javascript
160
+ // Add fill color to text
161
+ U("{text-id}", { fill: "$--foreground" });
162
+ ```
163
+
164
+ #### 4.3 Missing Fields
165
+
166
+ **Add missing form field:**
167
+
168
+ ```javascript
169
+ newField = I("{form-container-id}", {
170
+ type: "ref",
171
+ ref: "{input-component-id}",
172
+ width: "fill_container",
173
+ descendants: {
174
+ "{label-id}": { content: "{field-label}" },
175
+ "{input-id}": { content: "{placeholder}" },
176
+ },
177
+ });
178
+ ```
179
+
180
+ #### 4.4 Common Component Fixes
181
+
182
+ | Issue | Fix Pattern |
183
+ | ----------------------- | ------------------------------------------------ |
184
+ | Card content overflow | Set `height: "fit_content"` on Card Content slot |
185
+ | Sidebar icons missing | Update `iconFontName` on menu item icon element |
186
+ | Text invisible | Add `fill: "$--foreground"` to text element |
187
+ | Inconsistent background | Use `$--background` instead of hex colors |
188
+
189
+ ### Phase 5: Validate
190
+
191
+ After fixes, re-verify each screen:
192
+
193
+ ```
194
+ mcp__pencil__get_screenshot(filePath: "docs/design.pen", nodeId: "{frame-id}")
195
+ ```
196
+
197
+ Check:
198
+
199
+ - Layout renders correctly
200
+ - All text visible
201
+ - Consistent styling
202
+ - No clipped elements
203
+
204
+ ## Review Report Template
205
+
206
+ ```markdown
207
+ ## Design Mockup Review Report
208
+
209
+ **Application:** {app-name}
210
+ **Design File:** docs/design.pen
211
+
212
+ ### Screen Inventory
213
+
214
+ | Screen | Spec File | Design Frame | Status |
215
+ | ------------- | ---------------- | ------------ | ------ |
216
+ | {screen-name} | {screen-name}.md | {frame-id} | ✅ |
217
+
218
+ ### Issues Found & Fixed
219
+
220
+ #### 1. [{screen-name}] - {issue-description}
221
+
222
+ - **Problem:** {description}
223
+ - **Root Cause:** {cause}
224
+ - **Fix Applied:** {fix}
225
+
226
+ ### Remaining Issues
227
+
228
+ - [ ] {issue-description}
229
+
230
+ ### Summary
231
+
232
+ | Category | Count |
233
+ | ---------------- | ------- |
234
+ | Screens Reviewed | {count} |
235
+ | Issues Found | {count} |
236
+ | Issues Fixed | {count} |
237
+ | Remaining | {count} |
238
+ ```
239
+
240
+ ## Design Token Reference
241
+
242
+ Retrieve available design tokens dynamically:
243
+
244
+ ```
245
+ mcp__pencil__get_variables(filePath: "docs/design.pen")
246
+ ```
247
+
248
+ Common token patterns:
249
+
250
+ - `$--background` / `$--foreground` - Base colors
251
+ - `$--card` / `$--border` - Card styling
252
+ - `$--primary` / `$--secondary` - Action colors
253
+ - `$--sidebar-*` - Sidebar-specific tokens
254
+ - `$--muted-*` - Subdued variants
255
+
256
+ ## Sidebar Component Reference
257
+
258
+ Retrieve sidebar component structure to find icon element paths:
259
+
260
+ ```
261
+ mcp__pencil__batch_get(
262
+ filePath: "docs/design.pen",
263
+ patterns: [{"reusable": true, "name": "Sidebar"}],
264
+ readDepth: 4
265
+ )
266
+ ```
267
+
268
+ To find icon names used in an existing screen's sidebar:
269
+
270
+ ```
271
+ mcp__pencil__batch_get(
272
+ filePath: "docs/design.pen",
273
+ nodeIds: ["{frame-id}/{sidebar-id}"],
274
+ readDepth: 5,
275
+ resolveInstances: true
276
+ )
277
+ ```
278
+
279
+ Look for `iconFontName` property in sidebar menu items. Icons use Lucide icon font family.
280
+
281
+ ## Next Step
282
+
283
+ After completing design review, use `/app-compose-6-implementation-spec` to create Tier 4 documentation (resolvers).
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: app-compose-6-implementation-spec
3
+ description: Create Tier 4 documentation (resolvers) for GraphQL operations. Use after completing design review with app-compose-5-design-mock-review.
4
+ ---
5
+
6
+ # Implementation Spec Workflow
7
+
8
+ Create Tier 4 documentation: GraphQL Resolvers (mutations and queries).
9
+
10
+ ## Prerequisites
11
+
12
+ Tier 1-3 documentation and design mockups must exist:
13
+
14
+ - `README.md` (requirements)
15
+ - `docs/actors/*.md` (actors)
16
+ - `docs/business-flow/*/README.md` (flows)
17
+ - `docs/business-flow/*/story/*.md` (stories)
18
+ - `docs/screen/*.md` (screens)
19
+ - `docs/design.pen` (UI mockups)
20
+
21
+ ## Workflow Phases
22
+
23
+ ```
24
+ ANALYZE → IDENTIFY → CHECK MODULES → CREATE → VALIDATE
25
+ ```
26
+
27
+ ### Phase 1: Analyze
28
+
29
+ Read all story files and identify:
30
+
31
+ 1. **Operations** that modify data → mutations
32
+ 2. **Operations** that retrieve data → queries
33
+ 3. **Error scenarios** for each operation
34
+
35
+ ### Phase 2: Identify
36
+
37
+ Map stories to resolvers:
38
+
39
+ | Story Element | Resolver Type |
40
+ | -------------------- | ------------- |
41
+ | Create/Update/Delete | Mutation |
42
+ | View/List/Search | Query |
43
+ | Real-time updates | Subscription |
44
+
45
+ **Naming:** Use action-verb names: `create-`, `update-`, `delete-`, `submit-`, `approve-`
46
+
47
+ ### Phase 3: Check Module Dependencies
48
+
49
+ Resolvers reference module commands. Before creating resolver docs, verify required modules exist.
50
+
51
+ **Check existing modules:**
52
+
53
+ ```bash
54
+ ls modules/
55
+ ```
56
+
57
+ **Check module commands:**
58
+
59
+ ```bash
60
+ ls modules/<module-name>/docs/commands/
61
+ ```
62
+
63
+ **Map resolvers to modules:**
64
+
65
+ | Resolver Operation | Typical Module |
66
+ | ------------------ | --------------------- |
67
+ | User invite/roles | `user-management` |
68
+ | Supplier CRUD | `supplier-management` |
69
+ | Document handling | `document-management` |
70
+ | Task workflows | `task-management` |
71
+
72
+ **If modules don't exist:**
73
+
74
+ 1. **Identify needed modules** - Group resolver operations by domain
75
+ 2. **Create module docs first** - Use `1-module-docs` skill
76
+ 3. **Return to Tier 4** - After modules have documented commands
77
+
78
+ ```
79
+ Tier 4 blocked → Create modules → Return to Tier 4
80
+ ```
81
+
82
+ **Only reference existing module commands** in resolver documentation. Never reference modules or commands that don't exist.
83
+
84
+ ### Phase 4: Create
85
+
86
+ Generate documentation using `erp-kit` CLI:
87
+
88
+ ```bash
89
+ erp-kit scaffold --app-root examples resolver <app> <resolver-name>
90
+ ```
91
+
92
+ **Naming conventions:**
93
+
94
+ - Filename must match H1 heading exactly (kebab-case)
95
+ - Action-focused names: `create-supplier-invitation.md`
96
+
97
+ ### Phase 5: Validate
98
+
99
+ ```bash
100
+ pnpm run app:doc:check
101
+ ```
102
+
103
+ ## Schema Reference
104
+
105
+ | Schema | Tier | Output Path |
106
+ | -------------- | ---- | ------------------------- |
107
+ | `resolver.yml` | 4 | `docs/resolver/<name>.md` |
108
+
109
+ ## Tips
110
+
111
+ - One story may require 1-3 resolvers
112
+ - Group related operations logically
113
+ - Document all error scenarios
114
+
115
+ ## Completion
116
+
117
+ After Tier 4, the application specification is complete:
118
+
119
+ - **Tier 1**: Application overview
120
+ - **Tier 2**: Actors and business workflows
121
+ - **Tier 3**: User stories and screens
122
+ - **Tier 4**: Implementation specifications