baldart 3.6.2

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 (230) hide show
  1. package/CHANGELOG.md +599 -0
  2. package/README.md +566 -0
  3. package/VERSION +1 -0
  4. package/bin/baldart.js +143 -0
  5. package/framework/.claude/agents/REGISTRY.md +169 -0
  6. package/framework/.claude/agents/api-perf-cost-auditor.md +291 -0
  7. package/framework/.claude/agents/code-reviewer.md +350 -0
  8. package/framework/.claude/agents/codebase-architect.md +391 -0
  9. package/framework/.claude/agents/coder.md +291 -0
  10. package/framework/.claude/agents/deep-human-insight.md +198 -0
  11. package/framework/.claude/agents/doc-reviewer.md +440 -0
  12. package/framework/.claude/agents/email-deliverability-architect.md +193 -0
  13. package/framework/.claude/agents/hybrid-ml-architect.md +285 -0
  14. package/framework/.claude/agents/hyper-gamification-designer.md +149 -0
  15. package/framework/.claude/agents/legal-counsel-gdpr.md +179 -0
  16. package/framework/.claude/agents/marketing-conversion-strategist.md +162 -0
  17. package/framework/.claude/agents/motion-expert.md +108 -0
  18. package/framework/.claude/agents/onboarding-architect-lead.md +230 -0
  19. package/framework/.claude/agents/plan-auditor.md +546 -0
  20. package/framework/.claude/agents/prd-card-writer.md +372 -0
  21. package/framework/.claude/agents/prd.md +744 -0
  22. package/framework/.claude/agents/qa-sentinel.md +305 -0
  23. package/framework/.claude/agents/remotion-animator-orchestrator.md +218 -0
  24. package/framework/.claude/agents/security-reviewer.md +276 -0
  25. package/framework/.claude/agents/senior-researcher.md +175 -0
  26. package/framework/.claude/agents/seo-analytics-strategist.md +156 -0
  27. package/framework/.claude/agents/skill-improver.md +61 -0
  28. package/framework/.claude/agents/ui-expert.md +191 -0
  29. package/framework/.claude/agents/visual-designer.md +190 -0
  30. package/framework/.claude/agents/website-orchestrator.md +118 -0
  31. package/framework/.claude/agents/wiki-curator.md +145 -0
  32. package/framework/.claude/commands/baldart-push.md +15 -0
  33. package/framework/.claude/commands/check.md +237 -0
  34. package/framework/.claude/commands/codexreview.md +203 -0
  35. package/framework/.claude/commands/design-review.md +11 -0
  36. package/framework/.claude/commands/issue-review.md +34 -0
  37. package/framework/.claude/commands/new.md +331 -0
  38. package/framework/.claude/commands/qa.md +257 -0
  39. package/framework/.claude/hooks/framework-edit-gate.js +208 -0
  40. package/framework/.claude/hooks/lint-before-commit.sh.template +66 -0
  41. package/framework/.claude/settings.local.json.example +32 -0
  42. package/framework/.claude/skills/api-design-principles/SKILL.md +567 -0
  43. package/framework/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  44. package/framework/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
  45. package/framework/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  46. package/framework/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
  47. package/framework/.claude/skills/baldart-push/SKILL.md +222 -0
  48. package/framework/.claude/skills/bug/SKILL.md +200 -0
  49. package/framework/.claude/skills/bug/references/logging-patterns.md +174 -0
  50. package/framework/.claude/skills/capture/SKILL.md +125 -0
  51. package/framework/.claude/skills/capture/references/synthesis-template.md +42 -0
  52. package/framework/.claude/skills/context-primer/SKILL.md +189 -0
  53. package/framework/.claude/skills/copywriting/SKILL.md +273 -0
  54. package/framework/.claude/skills/copywriting/references/copy-frameworks.md +338 -0
  55. package/framework/.claude/skills/copywriting/references/natural-transitions.md +252 -0
  56. package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +119 -0
  57. package/framework/.claude/skills/doc-writing-for-rag/references/before-after-examples.md +291 -0
  58. package/framework/.claude/skills/doc-writing-for-rag/references/compact-templates.md +183 -0
  59. package/framework/.claude/skills/doc-writing-for-rag/references/frontmatter-minimal.md +112 -0
  60. package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +110 -0
  61. package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +129 -0
  62. package/framework/.claude/skills/find-skills/SKILL.md +133 -0
  63. package/framework/.claude/skills/frontend-design/LICENSE.txt +177 -0
  64. package/framework/.claude/skills/frontend-design/SKILL.md +84 -0
  65. package/framework/.claude/skills/gamification-design/SKILL.md +130 -0
  66. package/framework/.claude/skills/issue-review/SKILL.md +45 -0
  67. package/framework/.claude/skills/kie-ai/SKILL.md +262 -0
  68. package/framework/.claude/skills/kie-ai/references/models-catalog.md +272 -0
  69. package/framework/.claude/skills/kie-ai/scripts/kie_api.sh +209 -0
  70. package/framework/.claude/skills/kie-ai/scripts/remove_greenscreen.py +69 -0
  71. package/framework/.claude/skills/kie-ai/scripts/setup_api_key.sh +77 -0
  72. package/framework/.claude/skills/motion-design/LICENSE +21 -0
  73. package/framework/.claude/skills/motion-design/README.md +82 -0
  74. package/framework/.claude/skills/motion-design/SKILL.md +336 -0
  75. package/framework/.claude/skills/motion-design/director/choreography.md +93 -0
  76. package/framework/.claude/skills/motion-design/director/context-adaptation.md +83 -0
  77. package/framework/.claude/skills/motion-design/director/core-philosophy.md +53 -0
  78. package/framework/.claude/skills/motion-design/director/decision-framework.md +91 -0
  79. package/framework/.claude/skills/motion-design/director/disney-principles.md +102 -0
  80. package/framework/.claude/skills/motion-design/director/emotion-mapping.md +71 -0
  81. package/framework/.claude/skills/motion-design/director/motion-personality.md +89 -0
  82. package/framework/.claude/skills/motion-design/director/narrative-structure.md +62 -0
  83. package/framework/.claude/skills/motion-design/patterns/ambient-continuous.md +81 -0
  84. package/framework/.claude/skills/motion-design/patterns/entrance-exit.md +82 -0
  85. package/framework/.claude/skills/motion-design/patterns/multi-element.md +69 -0
  86. package/framework/.claude/skills/motion-design/patterns/state-feedback.md +96 -0
  87. package/framework/.claude/skills/motion-design/reference/property-selection.md +95 -0
  88. package/framework/.claude/skills/motion-design/reference/quality-checklist.md +67 -0
  89. package/framework/.claude/skills/motion-design/reference/timing-easing-tables.md +106 -0
  90. package/framework/.claude/skills/motion-design/reference/troubleshooting.md +73 -0
  91. package/framework/.claude/skills/new/SKILL.md +1687 -0
  92. package/framework/.claude/skills/playwright-skill/API_REFERENCE.md +652 -0
  93. package/framework/.claude/skills/playwright-skill/SKILL.md +157 -0
  94. package/framework/.claude/skills/playwright-skill/package.json +26 -0
  95. package/framework/.claude/skills/prd/SKILL.md +228 -0
  96. package/framework/.claude/skills/prd/assets/card-template.yml +232 -0
  97. package/framework/.claude/skills/prd/assets/epic-template.yml +190 -0
  98. package/framework/.claude/skills/prd/assets/prd-template.md +230 -0
  99. package/framework/.claude/skills/prd/assets/state-template.md +78 -0
  100. package/framework/.claude/skills/prd/references/api-perf-gate.md +152 -0
  101. package/framework/.claude/skills/prd/references/audit-phase.md +478 -0
  102. package/framework/.claude/skills/prd/references/backlog-phase.md +145 -0
  103. package/framework/.claude/skills/prd/references/discovery-phase.md +359 -0
  104. package/framework/.claude/skills/prd/references/impact-analysis.md +233 -0
  105. package/framework/.claude/skills/prd/references/prd-add-phase.md +214 -0
  106. package/framework/.claude/skills/prd/references/prd-writing-phase.md +145 -0
  107. package/framework/.claude/skills/prd/references/research-phase.md +216 -0
  108. package/framework/.claude/skills/prd/references/ui-design-phase.md +61 -0
  109. package/framework/.claude/skills/prd/references/validation-phase.md +72 -0
  110. package/framework/.claude/skills/prd-add/SKILL.md +222 -0
  111. package/framework/.claude/skills/prd-add/references/impact-analysis.md +233 -0
  112. package/framework/.claude/skills/remotion-best-practices/SKILL.md +48 -0
  113. package/framework/.claude/skills/remotion-best-practices/rules/3d.md +86 -0
  114. package/framework/.claude/skills/remotion-best-practices/rules/animations.md +29 -0
  115. package/framework/.claude/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
  116. package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
  117. package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
  118. package/framework/.claude/skills/remotion-best-practices/rules/assets.md +78 -0
  119. package/framework/.claude/skills/remotion-best-practices/rules/audio.md +169 -0
  120. package/framework/.claude/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
  121. package/framework/.claude/skills/remotion-best-practices/rules/can-decode.md +75 -0
  122. package/framework/.claude/skills/remotion-best-practices/rules/charts.md +58 -0
  123. package/framework/.claude/skills/remotion-best-practices/rules/compositions.md +141 -0
  124. package/framework/.claude/skills/remotion-best-practices/rules/display-captions.md +184 -0
  125. package/framework/.claude/skills/remotion-best-practices/rules/extract-frames.md +229 -0
  126. package/framework/.claude/skills/remotion-best-practices/rules/fonts.md +152 -0
  127. package/framework/.claude/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
  128. package/framework/.claude/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
  129. package/framework/.claude/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
  130. package/framework/.claude/skills/remotion-best-practices/rules/gifs.md +141 -0
  131. package/framework/.claude/skills/remotion-best-practices/rules/images.md +130 -0
  132. package/framework/.claude/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
  133. package/framework/.claude/skills/remotion-best-practices/rules/light-leaks.md +73 -0
  134. package/framework/.claude/skills/remotion-best-practices/rules/lottie.md +67 -0
  135. package/framework/.claude/skills/remotion-best-practices/rules/maps.md +401 -0
  136. package/framework/.claude/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
  137. package/framework/.claude/skills/remotion-best-practices/rules/measuring-text.md +143 -0
  138. package/framework/.claude/skills/remotion-best-practices/rules/parameters.md +98 -0
  139. package/framework/.claude/skills/remotion-best-practices/rules/sequencing.md +118 -0
  140. package/framework/.claude/skills/remotion-best-practices/rules/subtitles.md +36 -0
  141. package/framework/.claude/skills/remotion-best-practices/rules/tailwind.md +11 -0
  142. package/framework/.claude/skills/remotion-best-practices/rules/text-animations.md +20 -0
  143. package/framework/.claude/skills/remotion-best-practices/rules/timing.md +179 -0
  144. package/framework/.claude/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
  145. package/framework/.claude/skills/remotion-best-practices/rules/transitions.md +197 -0
  146. package/framework/.claude/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
  147. package/framework/.claude/skills/remotion-best-practices/rules/trimming.md +52 -0
  148. package/framework/.claude/skills/remotion-best-practices/rules/videos.md +171 -0
  149. package/framework/.claude/skills/seo-audit/SKILL.md +394 -0
  150. package/framework/.claude/skills/seo-audit/references/aeo-geo-patterns.md +279 -0
  151. package/framework/.claude/skills/seo-audit/references/ai-writing-detection.md +190 -0
  152. package/framework/.claude/skills/simplify/SKILL.md +137 -0
  153. package/framework/.claude/skills/skill-creator/LICENSE.txt +202 -0
  154. package/framework/.claude/skills/skill-creator/SKILL.md +356 -0
  155. package/framework/.claude/skills/skill-creator/references/output-patterns.md +82 -0
  156. package/framework/.claude/skills/skill-creator/references/workflows.md +28 -0
  157. package/framework/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  158. package/framework/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  159. package/framework/.claude/skills/skill-creator/scripts/quick_validate.py +95 -0
  160. package/framework/.claude/skills/ui-design/SKILL.md +199 -0
  161. package/framework/.claude/skills/ui-design/references/component-discovery.md +54 -0
  162. package/framework/.claude/skills/ui-design/references/evaluation.md +171 -0
  163. package/framework/.claude/skills/ui-design/references/generation.md +109 -0
  164. package/framework/.claude/skills/ui-design/references/inventory.md +59 -0
  165. package/framework/.claude/skills/webapp-testing/LICENSE.txt +202 -0
  166. package/framework/.claude/skills/webapp-testing/SKILL.md +123 -0
  167. package/framework/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
  168. package/framework/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
  169. package/framework/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
  170. package/framework/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
  171. package/framework/.claude/skills/worktree-manager/SKILL.md +680 -0
  172. package/framework/AGENTS.md +240 -0
  173. package/framework/agents/api-contracts.md +137 -0
  174. package/framework/agents/architecture.md +145 -0
  175. package/framework/agents/coding-standards.md +148 -0
  176. package/framework/agents/data-model.md +110 -0
  177. package/framework/agents/deployment-protocol.md +232 -0
  178. package/framework/agents/design-review.md +172 -0
  179. package/framework/agents/env-reference.md +171 -0
  180. package/framework/agents/github-issue-subagent.md +252 -0
  181. package/framework/agents/index.md +261 -0
  182. package/framework/agents/llm-wiki-methodology.md +216 -0
  183. package/framework/agents/maintenance-protocol.md +305 -0
  184. package/framework/agents/observability.md +162 -0
  185. package/framework/agents/performance.md +155 -0
  186. package/framework/agents/project-context.md +145 -0
  187. package/framework/agents/runbook.md +208 -0
  188. package/framework/agents/security.md +168 -0
  189. package/framework/agents/skills-mapping.md +286 -0
  190. package/framework/agents/testing.md +111 -0
  191. package/framework/agents/workflows.md +215 -0
  192. package/framework/docs/PROJECT-CONFIGURATION.md +336 -0
  193. package/framework/docs/references/brand-guidelines.md +170 -0
  194. package/framework/docs/references/ui-guidelines.template.md +182 -0
  195. package/framework/routines/code-review.routine.yml +46 -0
  196. package/framework/routines/doc-review.routine.yml +45 -0
  197. package/framework/routines/ds-drift.routine.yml +52 -0
  198. package/framework/routines/full-sweep.routine.yml +51 -0
  199. package/framework/routines/index.yml +70 -0
  200. package/framework/routines/skill-improve.routine.yml +50 -0
  201. package/framework/routines/wiki-review.routine.yml +45 -0
  202. package/framework/templates/baldart.config.template.yml +113 -0
  203. package/framework/templates/breaking-change-checklist.md +484 -0
  204. package/framework/templates/feature-card.template.yml +125 -0
  205. package/framework/templates/overlays/README.md +44 -0
  206. package/framework/templates/overlays/copywriting.fidelity-example.md +62 -0
  207. package/framework/templates/overlays/ui-design.fidelity-example.md +75 -0
  208. package/framework/templates/skill-project-context.snippet.md +19 -0
  209. package/framework/templates/spec.template.md +208 -0
  210. package/package.json +51 -0
  211. package/src/commands/add.js +229 -0
  212. package/src/commands/configure.js +385 -0
  213. package/src/commands/doctor.js +486 -0
  214. package/src/commands/migrate.js +185 -0
  215. package/src/commands/push.js +0 -0
  216. package/src/commands/routines.js +269 -0
  217. package/src/commands/status.js +130 -0
  218. package/src/commands/update.js +419 -0
  219. package/src/commands/version.js +88 -0
  220. package/src/utils/contamination.js +400 -0
  221. package/src/utils/git.js +181 -0
  222. package/src/utils/hooks.js +152 -0
  223. package/src/utils/routine-adapters/claude-code-cloud.js +78 -0
  224. package/src/utils/routine-adapters/cron.js +138 -0
  225. package/src/utils/routine-adapters/github-actions.js +141 -0
  226. package/src/utils/routine-adapters/index.js +21 -0
  227. package/src/utils/routines.js +166 -0
  228. package/src/utils/state.js +143 -0
  229. package/src/utils/symlinks.js +425 -0
  230. package/src/utils/ui.js +133 -0
@@ -0,0 +1,291 @@
1
+ # Before/After Examples — Wave 1+2+3 Compression
2
+
3
+ Casi concreti validati sul corpus reale. Per ogni esempio: prima, dopo, tecnica applicata.
4
+
5
+ ## Example 1 — API Endpoint (booking.md)
6
+
7
+ ### Before (Wave 0) — 150+ linee per endpoint
8
+
9
+ ```markdown
10
+ #### POST /api/v1/merchant/booking/rooms
11
+
12
+ Create a new booking room. This endpoint creates a new room in the store's
13
+ booking system. The room will be used to group tables together.
14
+
15
+ **Authentication**: This endpoint requires authentication via `withAuthNoParams`.
16
+ The session must have a valid merchantUserId with MERCHANT role. ADMIN users
17
+ can also access this endpoint on behalf of any merchant.
18
+
19
+ **Store Access Control**: The request must include a `storeId` query parameter
20
+ that identifies the target store. The system verifies that the authenticated
21
+ user has access to this store. Admin users have access to all stores.
22
+ Merchant users only have access to stores belonging to their merchant.
23
+
24
+ **Request Body**:
25
+ ```json
26
+ {
27
+ "storeId": "uuid-string",
28
+ "name": "Sala Principale",
29
+ "capacity": 50,
30
+ "order": 1
31
+ }
32
+ ```
33
+
34
+ **Request Body Fields**:
35
+ - `storeId` (string, required): The UUID of the store
36
+ - `name` (string, required): The display name, max 80 characters
37
+ - `capacity` (number, required): Maximum capacity, must be positive
38
+ - `order` (number, optional): Display order
39
+
40
+ **Response 201 Created**:
41
+ ```json
42
+ {
43
+ "id": "room-uuid",
44
+ "storeId": "store-uuid",
45
+ "name": "Sala Principale",
46
+ "capacity": 50,
47
+ "order": 1,
48
+ "createdAt": "2026-04-05T10:30:00Z",
49
+ "updatedAt": "2026-04-05T10:30:00Z"
50
+ }
51
+ ```
52
+
53
+ **Response Fields**:
54
+ [Field list repeated...]
55
+
56
+ **Errors**:
57
+ - 400 "Nome sala obbligatorio" — if name is empty
58
+ - 400 "Capacità non valida" — if capacity < 1
59
+ - 409 "Sala duplicata" — if name exists
60
+ [etc]
61
+ ```
62
+
63
+ ### After (Wave 1) — 12 linee per endpoint
64
+
65
+ ```markdown
66
+ ### POST /api/v1/merchant/booking/rooms
67
+
68
+ **Auth**: withAuthNoParams | **Access**: ADMIN + MERCHANT (see §Store Access Control)
69
+
70
+ **Body**:
71
+ | Field | Type | Required | Desc |
72
+ |-------|------|----------|------|
73
+ | storeId | string | yes | Store UUID |
74
+ | name | string | yes | 1-80 chars |
75
+ | capacity | number | yes | >0 |
76
+ | order | number | no | Display sort |
77
+
78
+ **Returns**: [BookingRoom](./schemas.md#bookingroom)
79
+ **Errors**: NAME_REQUIRED, INVALID_CAPACITY, ROOM_DUPLICATE ([errors.md](../errors.md#booking---rooms))
80
+ ```
81
+
82
+ **Saving**: 138 linee per endpoint × 26 endpoints = ~3600 linee. Total booking.md: 4201→1833 (-56%).
83
+
84
+ ### Tecniche applicate
85
+
86
+ 1. Store Access Control spiegato UNA VOLTA in intro, poi `see §Store Access Control`
87
+ 2. Request body: tabella compatta invece di narrative + JSON example
88
+ 3. Response: link a schema invece di JSON inline
89
+ 4. Errors: codes invece di stringhe italiane + link alla sezione errors.md
90
+
91
+ ## Example 2 — UI Reference (ui/merchant.md)
92
+
93
+ ### Before — repetizioni su ogni pagina
94
+
95
+ ```markdown
96
+ ### /merchant/bookings/planner
97
+
98
+ **Purpose**: Drag-drop table reservations planner
99
+ **Protection**: This page requires authentication. Session must have
100
+ merchantUserId with MERCHANT role. ADMIN users can access any merchant's
101
+ pages by impersonating the merchant.
102
+ **Layout**: Uses MerchantResponsiveLayout which provides the standard
103
+ sidebar navigation, top bar with store switcher, and responsive container.
104
+ **Store switching**: Supports CT-0067 multi-store. When merchant has
105
+ multiple stores, user can switch via top bar dropdown. Current store
106
+ persisted in sessionStorage with Safari ITP fallback.
107
+ **Styling**: Neo-Brutalism design system (bold borders, amber accents,
108
+ Press Start 2P titles). Follows ui-guidelines.md §3.
109
+ **Disabled modules**: If merchant's license doesn't include this module,
110
+ the page is completely hidden from navigation.
111
+
112
+ [Content per planner...]
113
+ ```
114
+
115
+ ### After — Conventions block top + minimal per-page
116
+
117
+ ```markdown
118
+ ## Conventions (apply to all pages below)
119
+
120
+ - **Auth**: merchantUserId + MERCHANT role (ADMIN via impersonation)
121
+ - **Layout**: MerchantResponsiveLayout
122
+ - **Store switching**: CT-0067 multi-store, sessionStorage persist
123
+ - **Styling**: Neo-Brutalism (see ui-guidelines.md §3)
124
+ - **License gating**: disabled modules hidden from navigation
125
+
126
+ ---
127
+
128
+ ### /merchant/bookings/planner
129
+
130
+ **Purpose**: Drag-drop table reservations planner
131
+
132
+ [Content per planner...]
133
+ ```
134
+
135
+ **Saving**: ~200 linee duplicate × 1 block = eliminate una volta = ~200 linee risparmio. Total merchant.md: 2780→1265 (-54%).
136
+
137
+ ### Tecnica
138
+
139
+ Tutte le convenzioni che valgono per OGNI pagina → blocco Conventions all'inizio. Ogni pagina elenca SOLO cosa è specifico.
140
+
141
+ ## Example 3 — Schema Reuse (menu.md)
142
+
143
+ ### Before — schema inline per ogni endpoint
144
+
145
+ ```markdown
146
+ #### POST /api/v1/merchant/menu/items
147
+
148
+ **Response**:
149
+ ```json
150
+ {
151
+ "id": "item-uuid",
152
+ "categoryId": "cat-uuid",
153
+ "name": "Margherita",
154
+ "description": "Pizza tradizionale...",
155
+ "basePrice": 9.50,
156
+ "imageUrl": "https://...",
157
+ "allergens": ["gluten", "dairy"],
158
+ "nutritionalInfo": {
159
+ "calories": 800,
160
+ "carbs": 90,
161
+ "protein": 30,
162
+ "fat": 25
163
+ },
164
+ "variants": [...],
165
+ "createdAt": "...",
166
+ "updatedAt": "..."
167
+ }
168
+ ```
169
+
170
+ #### GET /api/v1/merchant/menu/items/[id]
171
+
172
+ **Response**:
173
+ ```json
174
+ {
175
+ "id": "item-uuid",
176
+ "categoryId": "cat-uuid",
177
+ [same structure repeated]
178
+ }
179
+ ```
180
+
181
+ [repeat 10x for each item endpoint]
182
+ ```
183
+
184
+ ### After — schema centrale + references
185
+
186
+ In `schemas.md`:
187
+ ```markdown
188
+ ## MenuItem
189
+ | Field | Type | Notes |
190
+ |-------|------|-------|
191
+ | id | string | UUID |
192
+ | categoryId | string | FK MenuCategory |
193
+ | name | string | 1-120 chars |
194
+ | description | string | 0-500 chars |
195
+ | basePrice | number | €, 2 decimals |
196
+ | imageUrl | string \| null | |
197
+ | allergens | string[] | CEE 1169/2011 list |
198
+ | nutritionalInfo | NutritionalInfo | nested |
199
+ | variants | MenuVariant[] | |
200
+
201
+ ## NutritionalInfo
202
+ | Field | Type | Notes |
203
+ |-------|------|-------|
204
+ | calories | number | kcal per serving |
205
+ | carbs | number | g |
206
+ | protein | number | g |
207
+ | fat | number | g |
208
+ ```
209
+
210
+ In `menu.md`:
211
+ ```markdown
212
+ ### POST /api/v1/merchant/menu/items
213
+
214
+ **Returns**: [MenuItem](./schemas.md#menuitem)
215
+
216
+ ### GET /api/v1/merchant/menu/items/[id]
217
+
218
+ **Returns**: [MenuItem](./schemas.md#menuitem)
219
+ ```
220
+
221
+ **Saving**: 20-30 linee JSON per endpoint × 10 endpoints = 250+ linee eliminate. Total menu.md: 1910→719 (-62%).
222
+
223
+ ### Tecnica
224
+
225
+ Schemi riusati 2+ volte → sposta in `schemas.md`. Ogni endpoint linka invece di ripetere.
226
+
227
+ ## Example 4 — Error Codes Enum (generic)
228
+
229
+ ### Before — stringhe italiane hardcoded
230
+
231
+ ```markdown
232
+ **Errors**:
233
+ - 400 "Nome sala obbligatorio"
234
+ - 400 "La capacità deve essere maggiore di zero"
235
+ - 404 "Sala non trovata"
236
+ - 409 "Esiste già una sala con questo nome"
237
+ - 403 "Non hai i permessi per questa operazione"
238
+ ```
239
+
240
+ ### After — error codes + central enum
241
+
242
+ In `errors.md`:
243
+ ```markdown
244
+ ## Booking — Rooms
245
+
246
+ | Code | HTTP | IT Message | Context |
247
+ |------|------|------------|---------|
248
+ | NAME_REQUIRED | 400 | Nome sala obbligatorio | POST/PATCH |
249
+ | INVALID_CAPACITY | 400 | Capacità non valida (deve essere >0) | POST/PATCH |
250
+ | ROOM_NOT_FOUND | 404 | Sala non trovata | GET/PATCH/DELETE |
251
+ | ROOM_DUPLICATE | 409 | Sala già esistente (nome duplicato) | POST/PATCH |
252
+ | FORBIDDEN | 403 | Permessi insufficienti | Any |
253
+ ```
254
+
255
+ In `booking.md`:
256
+ ```markdown
257
+ **Errors**: NAME_REQUIRED, INVALID_CAPACITY, ROOM_NOT_FOUND, ROOM_DUPLICATE, FORBIDDEN
258
+ ```
259
+
260
+ ### Tecnica
261
+
262
+ Error codes enum centralizzato + IT message → endpoint usa solo i codes. Vantaggi:
263
+ 1. API consumers parsano codes stabili, non stringhe traducibili
264
+ 2. Docs rimangono concise
265
+ 3. Refactor error messages in UN SOLO POSTO
266
+
267
+ ## Example 5 — PRD Compression (PRD-closedtable.md)
268
+
269
+ ### Pattern: tabelle > narrative per requisiti
270
+
271
+ **Before**: "The system shall allow merchants to create booking rooms. Rooms represent physical areas of the restaurant. Each room has a name, capacity, and display order. The name must be unique within the store. The capacity must be positive..."
272
+
273
+ **After**:
274
+ ```markdown
275
+ ## Functional Requirements
276
+
277
+ | ID | Component | Requirement |
278
+ |----|-----------|-------------|
279
+ | FR-01 | BookingRoom | Merchant può creare room con name, capacity, order |
280
+ | FR-02 | BookingRoom | name unique per store |
281
+ | FR-03 | BookingRoom | capacity must be >0 |
282
+ ```
283
+
284
+ Saving: 3-5 linee narrative → 1 linea tabella per requirement.
285
+
286
+ ## Quando NON comprimere
287
+
288
+ - Sezioni con logic critica (es. state machine transitions, race condition handling): meglio prose che tabelle
289
+ - Esempi UX con dialog flow: tabella non rende
290
+ - Discussion Log / decision rationale: se compresso perde contesto
291
+ - Codice critico in code blocks: mantieni verbatim
@@ -0,0 +1,183 @@
1
+ # Compact Templates
2
+
3
+ Template validati su 45 file in 3 wave di compressione. Ogni template include: before/after, line count, note critiche.
4
+
5
+ ## API Endpoint Template
6
+
7
+ ### Standard (80% dei casi)
8
+
9
+ ```markdown
10
+ ### POST /api/v1/domain/resource
11
+
12
+ **Auth**: withAuthNoParams | **Access**: ADMIN + MERCHANT
13
+
14
+ **Body**:
15
+ | Field | Type | Required | Desc |
16
+ |-------|------|----------|------|
17
+ | storeId | string | yes | Store UUID |
18
+ | name | string | yes | Display name, 1-120 chars |
19
+
20
+ **Returns**: [ResourceResponse](./schemas.md#resourceresponse)
21
+ **Errors**: NAME_REQUIRED, STORE_NOT_FOUND ([errors.md](../errors.md#domain-domain))
22
+ ```
23
+
24
+ **Dimensione**: 10-15 linee per endpoint. Target: 30+ endpoint = ~400 linee totali.
25
+
26
+ ### Varianti
27
+
28
+ **GET con query params**:
29
+ ```markdown
30
+ **Query**:
31
+ | Param | Type | Required | Desc |
32
+ |-------|------|----------|------|
33
+ | storeId | string | yes | FK Store |
34
+ | limit | number | no | Default 50, max 200 |
35
+ ```
36
+
37
+ **Path params embedded**:
38
+ ```markdown
39
+ ### PATCH /api/v1/domain/resource/[resourceId]
40
+ ```
41
+ Non serve tabella separata per path param (è nell'URL pattern).
42
+
43
+ **Public endpoint (no auth)**:
44
+ ```markdown
45
+ **Auth**: public | **Access**: anonymous
46
+ ```
47
+
48
+ **Cron endpoint**:
49
+ ```markdown
50
+ **Auth**: cron secret | **Schedule**: daily 03:00 UTC
51
+ ```
52
+
53
+ ### Cosa NON includere
54
+
55
+ - ❌ JSON response inline (vai a schemas.md)
56
+ - ❌ Stringhe errore italiane hardcoded (usa error codes → errors.md)
57
+ - ❌ "Store Access Control" spiegato per ogni endpoint (vedi §Cross-reference)
58
+ - ❌ Esempi curl/fetch ridondanti (1 per dominio è sufficiente)
59
+
60
+ ## PRD Template
61
+
62
+ ### Struttura compatta
63
+
64
+ ```markdown
65
+ ---
66
+ doc_type: prd
67
+ domain: booking
68
+ canonicality: canonical-source
69
+ status: in_progress
70
+ last_updated: 2026-04-05
71
+ ---
72
+
73
+ # PRD — Feature Name
74
+
75
+ ## Context & Problem
76
+ [3-5 paragrafi focalizzati]
77
+
78
+ ## User Stories
79
+ | ID | Story | Priority |
80
+ |----|-------|----------|
81
+ | MS-01 | As merchant I can... | P0 |
82
+
83
+ ## Functional Requirements
84
+ | ID | Requirement | Component |
85
+ |----|-------------|-----------|
86
+ | FR-01 | System must... | booking-service |
87
+
88
+ ## Acceptance Criteria
89
+ | ID | Given | When | Then |
90
+ |----|-------|------|------|
91
+ | AC-01 | ... | ... | ... |
92
+
93
+ ## Data Model
94
+ [reference to schemas or inline if new]
95
+
96
+ ## API Surface
97
+ [link a endpoint docs esistenti o nuovi]
98
+
99
+ ## Edge Cases
100
+ | ID | Case | Handling |
101
+ |----|------|----------|
102
+ | EC-01 | ... | ... |
103
+ ```
104
+
105
+ **Dimensione target**: max 1500 linee. Se supera, split in sub-PRD per capitolo.
106
+
107
+ ### Cosa comprimere rispetto a PRD verbosi
108
+
109
+ - ASCII tree/box diagrams → tabelle o prosa compatta
110
+ - Code blocks TypeScript long-form → prosa descrittiva (preserva logica)
111
+ - Esempi JSON multipli → 1 esempio + schema reference
112
+ - "Discussion Log" 200 linee → key bullets per decisione
113
+ - Validation rules narrative → tabella | Field | Rule | Error code |
114
+
115
+ ## UI Reference Template
116
+
117
+ ### Pattern "Conventions block + Pages"
118
+
119
+ ```markdown
120
+ ---
121
+ doc_type: reference
122
+ domain: ui
123
+ canonicality: canonical-source
124
+ last_updated: 2026-04-05
125
+ ---
126
+
127
+ # Merchant UI Reference
128
+
129
+ ## Conventions (applies to all pages below)
130
+
131
+ - **Auth**: merchantUserId + MERCHANT role
132
+ - **Layout**: MerchantResponsiveLayout
133
+ - **Store switching**: CT-0067 multi-store support
134
+ - **Styling**: Neo-Brutalism design system
135
+ - **Hidden modules**: disabled via license gating
136
+
137
+ ## License Gating System (FEAT-0128)
138
+
139
+ | Module | License tier | Gated route | Behavior |
140
+ |--------|--------------|-------------|----------|
141
+ | booking | Pro | /merchant/bookings/* | 302 → /merchant/dashboard |
142
+ | crm | Starter | /merchant/crm/* | 404 |
143
+
144
+ ## Pages
145
+
146
+ ### /merchant/bookings/planner
147
+
148
+ **Purpose**: Drag-drop table reservations
149
+ **Auth**: MERCHANT
150
+ **Key features**: [concise bullet list]
151
+ **Data sources**: GET /api/v1/merchant/booking/reservations
152
+ ```
153
+
154
+ **Dimensione**: 15-25 linee per pagina. Target: 30 pagine = ~600 linee.
155
+
156
+ ## Collections / Data Model Template
157
+
158
+ ```markdown
159
+ ## Collection: bookingRooms
160
+
161
+ Path: `merchants/{mid}/stores/{sid}/bookingRooms/{rid}`
162
+
163
+ **Fields**:
164
+ | Field | Type | Req | Notes |
165
+ |-------|------|-----|-------|
166
+ | name | string | yes | 1-80 chars, unique per store |
167
+ | capacity | number | yes | >0 |
168
+ | order | number | no | Display sort |
169
+
170
+ **Composite indexes**:
171
+ | Fields | Query |
172
+ |--------|-------|
173
+ | storeId + order | Sort rooms by display order |
174
+ ```
175
+
176
+ Bullet lists SHORT se preferibile a tabelle per collezioni con pochi campi.
177
+
178
+ ## Rules of thumb
179
+
180
+ 1. **Prima scegli la struttura**, poi scrivi (outline first)
181
+ 2. **Grep before write**: verifica se schema/error code/concept esiste già
182
+ 3. **Test mentale**: se un lettore AI riesce a rispondere al 100% delle domande legittime con le info date, è completo
183
+ 4. **Dense ≠ criptico**: comprimi verbosità, non chiarezza
@@ -0,0 +1,112 @@
1
+ # Frontmatter Minimal — 4-Field Standard
2
+
3
+ Protocollo frontmatter validato su 45 file riscritti. **Solo 4 campi obbligatori**; tutto il resto è derivabile da git / tooling.
4
+
5
+ ## Standard template
6
+
7
+ ```yaml
8
+ ---
9
+ doc_type: reference
10
+ domain: booking
11
+ canonicality: canonical-source
12
+ last_updated: 2026-04-05
13
+ ---
14
+ ```
15
+
16
+ ## Campi obbligatori (4)
17
+
18
+ | Campo | Valori ammessi | Esempi |
19
+ |-------|----------------|--------|
20
+ | `doc_type` | `reference`, `adr`, `prd`, `guide`, `spec`, `runbook`, `index` | `reference` |
21
+ | `domain` | dominio funzionale (snake-case) | `booking`, `menu`, `dio`, `customer`, `admin` |
22
+ | `canonicality` | `canonical-source`, `derived`, `index`, `deprecated` | `canonical-source` |
23
+ | `last_updated` | ISO date YYYY-MM-DD | `2026-04-05` |
24
+
25
+ ## Campi OPZIONALI (solo se servono)
26
+
27
+ | Campo | Quando usare |
28
+ |-------|--------------|
29
+ | `status` | Solo per PRD: `draft`, `in_progress`, `approved`, `done` |
30
+ | `related_code_paths` | Solo se drift-detection hook lo richiede |
31
+ | `last_verified_from_code` | Solo se c'è automated verification |
32
+
33
+ ## Campi DA RIMUOVERE (dal legacy frontmatter)
34
+
35
+ Questi erano presenti nei file pre-compressione ma **NON servono**:
36
+
37
+ | Campo | Perché rimuovere |
38
+ |-------|------------------|
39
+ | `owner` | Derivabile da git blame |
40
+ | `audit_notes` | Drift tracking dinamico → git commits |
41
+ | `freshness_status` | Calcolabile da last_updated vs oggi |
42
+ | `stale_since` | Legacy drift marker, dinamico |
43
+ | `stale_triggered_by` | Legacy drift marker, dinamico |
44
+ | `stale_reason` | Legacy drift marker, dinamico |
45
+ | `diataxis_type` | Derivabile da doc_type |
46
+ | `hub_role` | Legacy, non usato da tooling attivo |
47
+ | `verification_scope` | Legacy |
48
+
49
+ ## Esempi per doc_type
50
+
51
+ ### Reference doc (API, UI, data-model)
52
+ ```yaml
53
+ ---
54
+ doc_type: reference
55
+ domain: booking
56
+ canonicality: canonical-source
57
+ last_updated: 2026-04-05
58
+ ---
59
+ ```
60
+
61
+ ### PRD
62
+ ```yaml
63
+ ---
64
+ doc_type: prd
65
+ domain: booking
66
+ canonicality: canonical-source
67
+ status: in_progress
68
+ last_updated: 2026-04-05
69
+ ---
70
+ ```
71
+
72
+ ### ADR
73
+ ```yaml
74
+ ---
75
+ doc_type: adr
76
+ domain: booking
77
+ canonicality: canonical-source
78
+ last_updated: 2026-04-05
79
+ ---
80
+ ```
81
+
82
+ ### Index/registry
83
+ ```yaml
84
+ ---
85
+ doc_type: index
86
+ domain: platform
87
+ canonicality: index
88
+ last_updated: 2026-04-05
89
+ ---
90
+ ```
91
+
92
+ ## Perché 4 campi e basta
93
+
94
+ **Signal/noise**: ogni campo frontmatter costa token al reindex LLM. Un frontmatter da 17 linee su 200 linee di doc = **8.5% overhead**. Con 4 linee → **2%**.
95
+
96
+ **Derivabilità**: `owner`, `last_verified_*`, `stale_*` sono **dinamici**. Salvati nel file diventano immediatamente stale. Meglio calcolarli on-demand da git.
97
+
98
+ **Chiarezza**: un frontmatter breve è facilmente leggibile. Quello lungo nasconde le info importanti.
99
+
100
+ ## Se devo aggiungere nuovi campi
101
+
102
+ **STOP** e chiediti:
103
+ 1. È davvero canonico o è derivabile?
104
+ 2. Verrà mai aggiornato manualmente?
105
+ 3. Serve a un tool esistente (quale?)?
106
+
107
+ Se le risposte sono "derivabile" o "no" → **non aggiungerlo**.
108
+
109
+ Se serve davvero a un tool:
110
+ - Documenta il tool nel frontmatter-guide
111
+ - Aggiungi il campo solo ai file che quel tool scansiona
112
+ - Non propagarlo a tutti i file
@@ -0,0 +1,110 @@
1
+ # Line Count Targets — Dense Documentation Sizing
2
+
3
+ Soglie validate su 45 file riscritti. Obiettivo: mantenere chunks LightRAG gestibili e signal/noise alto.
4
+
5
+ > File path examples below (`docs/references/api/booking.md`, ecc.) are taken
6
+ > from a sample project (multi-merchant fidelity platform) and are kept as
7
+ > concrete illustrations. Sostituisci con le tue path effettive
8
+ > (`${paths.references_dir}/...`) e i tuoi domini. Le soglie numeriche e le
9
+ > regole di split valgono indipendentemente dal dominio.
10
+
11
+ ## Target per doc type
12
+
13
+ | Doc type | Max linee | Sweet spot | Azione se supera |
14
+ |----------|-----------|------------|------------------|
15
+ | **API ref singolo** | 1500 | 400-900 | Split in sub-files per sub-domain |
16
+ | **PRD** | 1500 | 600-1200 | Split per capitoli/fasi |
17
+ | **UI ref** | 1500 | 500-1000 | Split per area applicativa |
18
+ | **Collections doc** | 1000 | 400-700 | Split per collection family |
19
+ | **ADR** | 200 | 60-150 | NON superare; se serve più, crea follow-up ADR |
20
+ | **Index/registry** | 500 | 100-300 | Solo pointer+summary, niente contenuto sostanziale |
21
+ | **Guide/runbook** | 800 | 200-500 | Split per workflow/fase |
22
+
23
+ ## Motivazioni tecniche
24
+
25
+ ### LightRAG chunking
26
+ - Chunk size: 100-6000 caratteri (~150-1000 token)
27
+ - File >1500 linee producono 30+ chunks → dilution semantic similarity
28
+ - Chunk boundary su heading boundaries → struttura gerarchica chiara aiuta
29
+
30
+ ### Token budget per LLM entity extraction
31
+ - Ogni chunk × ~2-5 chiamate LLM (entity+relationship extraction)
32
+ - File gigante = molti chunk = costi esponenziali durante reindex
33
+ - File 1500 linee × 30 chunk × 3 LLM calls = 90 calls (gestibile)
34
+ - File 4000 linee × 80 chunk × 3 LLM calls = 240 calls (lento)
35
+
36
+ ### Signal/noise
37
+ - File piccoli (<500 linee) hanno tipicamente S/N >80%
38
+ - File medi (500-1500) S/N 70-80%
39
+ - File grandi (>1500) S/N 50-65% — verbosità cumulativa
40
+ - Target generale: **>75% S/N ratio**
41
+
42
+ ## Regola empirica scanning
43
+
44
+ Se un reviewer umano scorre velocemente il file:
45
+ - **<1500 linee**: può tenere il contesto in mente
46
+ - **1500-2500**: serve TOC o grep mirato
47
+ - **>2500**: si perde, va splittato
48
+
49
+ Stessa cosa per LLM context window utility.
50
+
51
+ ## Quando splittare
52
+
53
+ ### Criterio 1: linee supera soglia
54
+ File >1500 linee (reference/PRD/UI) → candidate per split.
55
+
56
+ ### Criterio 2: multiple sub-domains
57
+ Un file `api/booking.md` che contiene:
58
+ - Rooms CRUD
59
+ - Tables CRUD
60
+ - Reservations
61
+ - Availability
62
+ - Tags
63
+ - ...
64
+
65
+ → Split in `api/booking/rooms-tables-combos.md`, `api/booking/reservations.md`, etc.
66
+
67
+ ### Criterio 3: differente audience
68
+ Se parte del file è per MERCHANT e parte per ADMIN → considerare split.
69
+
70
+ ## Struttura post-split
71
+
72
+ ### Option A: sub-folder + parent index
73
+
74
+ ```
75
+ docs/references/api/booking.md # parent/index, ~500 linee
76
+ docs/references/api/booking/
77
+ ├── rooms-tables-combos.md # detail
78
+ ├── reservations.md # detail
79
+ └── policies-availability.md # detail
80
+ ```
81
+
82
+ Parent `booking.md` ha solo: intro dominio + index per sub-files + endpoint shared (ping, health).
83
+
84
+ ### Option B: sibling files
85
+
86
+ ```
87
+ docs/references/api/booking-rooms.md
88
+ docs/references/api/booking-reservations.md
89
+ docs/references/api/booking-tags.md
90
+ ```
91
+
92
+ Meno gerarchico, più semplice per navigazione.
93
+
94
+ ## Anti-pattern
95
+
96
+ ❌ **Split forzato** di file ben bilanciati (<1500 linee) solo per rispettare target.
97
+ ❌ **Eliminare contenuto semantico** per rispettare target → preferire split.
98
+ ❌ **Tabelle mega-width** (>8 colonne) — si comprimere orizzontalmente ma illeggibile.
99
+ ❌ **Micro-file** (<100 linee) per ogni endpoint — overhead metadata + chunk sovrapposizione.
100
+
101
+ ## Quick check durante scrittura
102
+
103
+ ```bash
104
+ wc -l docs/references/api/my-new-file.md
105
+ ```
106
+
107
+ - >1500 linee → pianifica split PRIMA di finire
108
+ - 1000-1500 → è al limite, verifica se c'è compressione possibile
109
+ - 400-900 → dimensione ottimale
110
+ - <300 → considera merge con file correlato se ha poco contenuto