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,359 @@
1
+ # Discovery Phase (Steps 0-2)
2
+
3
+ ## Step 0 — Context Recovery
4
+
5
+ Run BEFORE any other step.
6
+
7
+ 1. Check if `${paths.prd_dir}/sessions/` contains a state file for the current feature.
8
+ 2. If found: read it, identify last completed step, resume from next pending step.
9
+ 3. If not found: fresh session, proceed to Step 1.
10
+
11
+ Triggers: session start, context compression, re-invocation of `/prd`.
12
+
13
+ ## Step 1 — Kickoff
14
+
15
+ **Precondition:** user has described the feature.
16
+
17
+ 1. Derive `<slug>`: kebab-case, lowercase, max 40 chars, no special chars.
18
+ Example: "Nutritional info on menu" -> `menu-nutritional-info`
19
+ 2. **Obsidian spec detection:** scan the user's message for Obsidian note references:
20
+ - Wikilink pattern: `[[Note Name]]` or `[[Note Name|Alias]]`
21
+ - If found: extract the note name and save it in the state file under
22
+ `## Obsidian Spec Note: [[Note Name]]`. This will be added to Canonical Sources in the PRD.
23
+ - Read the note content from the vault path in memory (`reference_obsidian_vault.md`)
24
+ to pre-populate discovery dimensions where possible — treat it as a user-provided spec.
25
+ 3. Create state file: `${paths.prd_dir}/sessions/YYYY-MM-DD-<slug>-state.md`
26
+ using template from `assets/state-template.md`.
27
+ 3. Create 5 macro-tasks via TaskCreate:
28
+ - `[PRD] Discovery & comprensione feature`
29
+ - `[PRD] Design UI & approvazione`
30
+ - `[PRD] Conferma specifiche complete`
31
+ - `[PRD] Creazione backlog cards`
32
+ - `[PRD] Validazione e commit`
33
+ 4. Mark task 1 as `in_progress`.
34
+ 5. **Context Loading (MANDATORY):** invoke the context-primer skill (`/cont`) with
35
+ 2-4 keywords extracted from the user's feature description. This launches
36
+ `codebase-architect` which searches the Obsidian-first LightRAG MCP index,
37
+ docs, backlog, source code, and git history. The returned context informs all
38
+ subsequent discovery dimensions. Additionally, run `search_docs` MCP with `mode: "hybrid"` for the
39
+ feature domain. Use Obsidian hits for concept context, then verify
40
+ implementation and stateful claims against repo docs/code before carrying
41
+ them into the PRD.
42
+ 6. Mark clearly irrelevant dimensions as "N/A" with reason
43
+ (e.g., backend-only -> UI impact = N/A).
44
+ If UI impact is N/A, immediately mark task 2 as `completed` ("Skipped — no UI").
45
+ 7. **Business Rationale Extraction (MANDATORY):** Before entering the discovery loop,
46
+ evaluate the user's initial feature description for business rationale signals:
47
+ - WHY is this feature needed? (business motivation)
48
+ - What customer/market signal triggered it?
49
+ - What is the expected business impact?
50
+ - How does it align with the product strategy?
51
+
52
+ If the user's description already covers these clearly, capture them in the state
53
+ file under `## Business Rationale` and mark the dimension as covered
54
+ (source: "user-provided").
55
+
56
+ If the description is purely functional (WHAT, not WHY), leave the dimension
57
+ uncovered — it will be the FIRST question in the discovery loop (Dimension 0).
58
+
59
+ **Output:**
60
+
61
+ ```
62
+ Ho creato la sessione PRD per **<slug>**.
63
+
64
+ Descrizione: <user's description>
65
+ Contesto caricato: <one-line summary from context-primer>
66
+
67
+ Ora comincio la fase di **Discovery** — ti faro delle domande per capire bene
68
+ la feature prima di scrivere qualsiasi documento.
69
+
70
+ <Progress Bar>
71
+ ```
72
+
73
+ **Gate:** state file exists on disk AND all tasks created AND context loaded.
74
+
75
+ **Immediately proceed to Step 2** — do NOT stop here. Show the kickoff message
76
+ and continue to the discovery loop in the same turn.
77
+
78
+ ## Step 2 — Discovery Question Loop
79
+
80
+ Multi-turn loop. Each iteration covers ONE uncovered dimension.
81
+ Repeats until ALL relevant dimensions are covered.
82
+
83
+ **CRITICAL:** ONE question, then STOP. User answers. Process answer,
84
+ update state, send NEXT question, STOP again.
85
+
86
+ ### Dimension 0 — Business Rationale (ALWAYS FIRST)
87
+
88
+ If already covered in Step 1.7, skip to dimension 1.
89
+
90
+ Otherwise, present this question:
91
+
92
+ > ### Domanda — Motivazione di business
93
+ >
94
+ > Capisco COSA vuoi costruire. Ora ho bisogno di capire il **PERCHE** — questa
95
+ > informazione viene documentata permanentemente per il team e per gli agenti futuri.
96
+ >
97
+ > 1. **Perché adesso?** Cosa rende questa feature urgente/importante in questo momento?
98
+ > 2. **Quale segnale** l'ha innescata? (feedback clienti, dati d'uso, pressione competitiva, requisito normativo, altro)
99
+ > 3. **Quale impatto** ti aspetti? (ricavi, retention, efficienza operativa, riduzione rischio)
100
+ > 4. **Come si inserisce** nella visione del prodotto?
101
+ > 5. **Alternative considerate?** Hai valutato altre strade e perché le hai scartate?
102
+ >
103
+ > Anche risposte brevi vanno bene — l'importante è che il "perché" resti documentato.
104
+
105
+ **STOP.** Wait for user response.
106
+
107
+ When user responds: record in Discovery Log AND populate `## Business Rationale`
108
+ section of the state file. Mark dimension as covered.
109
+
110
+ ### Per-iteration sequence (dimensions 1-10)
111
+
112
+ **Precondition:** at least one dimension has status `-` (uncovered).
113
+
114
+ 1. Select next uncovered dimension (in checklist order).
115
+ 2. **Use the context already loaded by context-primer (Step 1.5)** to check if
116
+ the codebase already answers this dimension. The context-primer output includes
117
+ key docs, key code paths, status, and gotchas — use these to evaluate.
118
+ If more specific detail is needed beyond what context-primer provided,
119
+ invoke `codebase-architect` agent (foreground) with a targeted question:
120
+ ```
121
+ For feature `<slug>`: regarding the dimension `<dimension>`, does the codebase
122
+ already answer this? Specifically check: existing collections, routes, components,
123
+ permissions, and patterns. Report what you find with file references.
124
+ ```
125
+ Avoid launching codebase-architect when the context-primer output already
126
+ provides sufficient information for the dimension.
127
+ 3. **If the loaded context (or codebase-architect) provides a COMPLETE answer (no ambiguity):**
128
+ - Mark dimension as covered (source: "codebase", with file refs)
129
+ - Log: `**Auto-risolto:** dal contesto caricato [details]`
130
+ - Show user: `Dimensione **<dimension>**: risolta automaticamente dal codice.
131
+ [1-line summary]. Passo alla prossima.`
132
+ - Continue to next dimension in SAME message (no user input needed).
133
+ - If ALL remaining auto-resolved: show them all, display Progress Bar,
134
+ proceed to next phase.
135
+
136
+ 4. **If user input is needed:**
137
+ Present ONE question with:
138
+
139
+ ```
140
+ ### Domanda N — <dimension>
141
+
142
+ [Question]
143
+
144
+ **Raccomandazione**: **[Option]** (Confidenza: ALTA/MEDIA/BASSA)
145
+ > [Brief rationale]
146
+
147
+ **Perche e importante**: [one line]
148
+
149
+ **Alternative**:
150
+ - **A)** [Recommended] <- consigliato
151
+ - **B)** [Alternative]
152
+ - **C)** [Alternative if relevant]
153
+ ```
154
+
155
+ **STOP.** Display Progress Bar and wait.
156
+
157
+ 5. **When user responds:**
158
+ - Record in Discovery Log: question, recommendation, user answer, source
159
+ - Update checklist: mark dimension with source and detail
160
+ - Recalculate comprehension: `covered / relevant * 100`
161
+ - **Scope Expansion Check** (mandatory on every user answer):
162
+ Scan the user's answer for NEW entities not in the original feature description:
163
+ new endpoints, new collections, new pages, new roles, new flows, new integrations.
164
+ If detected:
165
+ - Inform: `Ho rilevato un possibile ampliamento di scope: **<entity>**.
166
+ Questo sembra una nuova funzionalita non coperta dalla descrizione originale.
167
+ Vuoi che avvii un'analisi di impatto (/prd-add) per integrarla nel PRD,
168
+ oppure la notiamo come out-of-scope?`
169
+ - **STOP.** Wait for user response.
170
+ - If user confirms: read [prd-add-phase.md](prd-add-phase.md) and execute
171
+ the Change Request flow. After it completes, resume discovery from the
172
+ next uncovered dimension.
173
+ - If user says out-of-scope: note in Discovery Log and continue.
174
+ - Update state file
175
+ - Proceed to next uncovered dimension (back to action 1)
176
+
177
+ ### Dimension 9 — Integration Surface Analysis (ISA)
178
+
179
+ This dimension uses **automated codebase scan** — do NOT ask the user a generic question.
180
+ Instead, run the ISA scan and present findings for validation.
181
+
182
+ **ISA Scan Procedure:**
183
+
184
+ 1. Invoke `codebase-architect` agent with this specific prompt:
185
+
186
+ ```
187
+ For feature `<slug>`: perform an Integration Surface Analysis (ISA).
188
+ Find ALL existing code that should reference, link to, or interact with this
189
+ new feature. Scan these categories systematically:
190
+
191
+ - NAVIGATION: sidebar links, menu items, breadcrumbs, tab bars, footer links
192
+ - PERMISSIONS: permission type enums/constants, role-check lists, guard clauses,
193
+ permission management UI
194
+ - SETTINGS/CONFIG: settings pages, feature flag lists, config files, env vars
195
+ - SEARCH/DISCOVERY: search indexes, filter dropdowns, autocomplete sources,
196
+ listing pages that should include this entity
197
+ - NOTIFICATIONS: notification type enums, handlers, templates, push configs
198
+ - DASHBOARD/OVERVIEW: summary pages, widgets, counters, activity feeds,
199
+ recent-items lists
200
+ - API CONSUMERS: existing client code that calls related APIs, shared API
201
+ utilities, API route indexes
202
+ - SHARED STATE: stores, contexts, providers that manage related data,
203
+ session/cache keys
204
+
205
+ For each touchpoint found, report:
206
+ - Category (from above)
207
+ - File path and line number
208
+ - What action is needed (add link, add entry, add handler, etc.)
209
+ - Risk if omitted (e.g., "page unreachable", "no access control", "data invisible")
210
+
211
+ Also check: are there existing features that do something similar? How are THEY
212
+ integrated? Use those as a pattern reference.
213
+ ```
214
+
215
+ 2. **Process findings:**
216
+ - Build the ISA table from codebase-architect results.
217
+ - Assign sequential ISA-N IDs to each touchpoint.
218
+ - Classify each by risk: HIGH (feature broken/unreachable), MEDIUM (degraded UX),
219
+ LOW (nice-to-have completeness).
220
+
221
+ 3. **Auto-resolve (no user confirmation needed):**
222
+ - Record final ISA table in state file under `## Integration Surface Map`.
223
+ - Mark dimension as covered (source: "codebase-scan").
224
+ - Show a brief summary inline (do NOT stop):
225
+
226
+ ```
227
+ **Auto-risolto:** ISA scan completato — N touchpoint trovati
228
+ (X HIGH, Y MEDIUM, Z LOW). Dettagli nel state file.
229
+ ```
230
+
231
+ - Continue to next dimension in the SAME message.
232
+
233
+ **If codebase-architect finds 0 touchpoints** (rare — e.g., completely standalone utility):
234
+ - Mark dimension as "N/A — standalone feature, no integration surface detected"
235
+ - Log inline: `**Auto-risolto:** nessun punto di integrazione trovato — feature standalone.`
236
+ - Continue to next dimension (no user confirmation needed).
237
+
238
+ ### Dimension 10 — Test Strategy & Credentials (special handling)
239
+
240
+ This dimension has **built-in evaluation logic** — do NOT ask the user a generic question.
241
+ Instead, run the E2E Evaluation Decision Tree and present the result.
242
+
243
+ **E2E Evaluation Decision Tree:**
244
+
245
+ ```
246
+ 1. Does the feature have UI impact? (check dimension "UI impact")
247
+ → N/A or no UI → E2E: NOT NEEDED (reason: "no UI impact")
248
+ → Yes → continue to 2
249
+
250
+ 2. Is it a multi-step flow? (booking, onboarding, checkout, wizard, multi-form)
251
+ → Yes → E2E: REQUIRED
252
+ → No → continue to 3
253
+
254
+ 3. Is it on a critical path? (auth, payment, booking, permissions, transaction)
255
+ → Yes → E2E: REQUIRED
256
+ → No → continue to 4
257
+
258
+ 4. Does it have >3 UI acceptance criteria?
259
+ → Yes → E2E: RECOMMENDED
260
+ → No → continue to 5
261
+
262
+ 5. Is it a simple display/component with no complex interaction?
263
+ → Yes → E2E: NOT NEEDED (reason: "simple display, no complex interaction")
264
+ → No → E2E: RECOMMENDED
265
+ ```
266
+
267
+ **Result categories:**
268
+ - **NOT NEEDED**: auto-resolve — log reason, mark dimension covered, show inline
269
+ summary, continue to next dimension (no STOP, no user confirmation needed).
270
+ - **RECOMMENDED**: auto-accept (default: yes) — proceed to credential gathering
271
+ without asking. Show inline: `E2E: RECOMMENDED — accettato automaticamente.`
272
+ - **REQUIRED**: E2E tests MUST be planned. Proceed to credential gathering.
273
+
274
+ **When E2E is REQUIRED or user accepts RECOMMENDED:**
275
+
276
+ 1. Identify test scenarios from user stories and acceptance criteria (2-5 scenarios max).
277
+ 2. Determine test persona:
278
+
279
+ **Consumer feature** (target users include CUSTOMER):
280
+ - Auto-set credentials: `phone: 3486417303, auth: OTP (manual input by user during test)`
281
+ - Inform user: `Credenziali test consumer: 3486417303 (OTP manuale durante il test).`
282
+ - No question needed.
283
+
284
+ **Merchant feature** (target users include MERCHANT or MERCHANT_STAFF):
285
+ - ASK the user:
286
+ ```
287
+ ### Domanda — Credenziali test merchant
288
+
289
+ Questa feature richiede test E2E come merchant.
290
+ Su quale merchant e store vuoi testare?
291
+ Servono le credenziali di login (username/password).
292
+
293
+ Esempio: antonio.baldassarre2336 / bRkS2bzqyesK su store "Bar Roma"
294
+ ```
295
+ - **STOP.** Wait for user response. Store credentials in state file under `## Test Plan`.
296
+
297
+ **Super Admin feature** (target users include SUPER_ADMIN):
298
+ - ASK the user for admin credentials (same pattern as merchant).
299
+
300
+ **Mixed personas**: gather credentials for each persona that needs E2E.
301
+
302
+ 3. After credentials are gathered, summarize the test plan:
303
+ ```
304
+ ### Test Plan Summary
305
+
306
+ E2E: REQUIRED | RECOMMENDED (accettato)
307
+ Scenari: N test scenarios
308
+ Persona: [Consumer | Merchant | Super Admin | Mixed]
309
+ Credenziali: [summary]
310
+
311
+ Scenari pianificati:
312
+ 1. [scenario description — maps to US-X / AC-X]
313
+ 2. [scenario description — maps to US-X / AC-X]
314
+ ```
315
+
316
+ 4. Mark dimension as covered. Update state file `## Test Plan` section.
317
+
318
+ ### Research Trigger (evaluated at ~75% comprehension)
319
+
320
+ When 6+ non-test dimensions are covered, evaluate complexity signals from
321
+ discovery answers and codebase-architect findings. Read
322
+ [research-phase.md](research-phase.md) for full signal list and logic.
323
+
324
+ **Quick decision:**
325
+ - **2+ signals OR regulatory (S2) OR user uncertainty (S5)** → HIGH confidence
326
+ → launch `senior-researcher` in **background immediately**, continue discovery.
327
+ Update progress bar: `Ricerca: 🔍 in corso (background)`.
328
+ - **1 non-critical signal** → MEDIUM confidence → note for later (ask at exit).
329
+ - **No signals** → skip research. Update progress bar: `Ricerca: ⏭️ non necessaria`.
330
+
331
+ If research launched in background: it runs in parallel with remaining questions.
332
+
333
+ ### Exit condition
334
+
335
+ Comprehension >= 99% OR user explicitly says to proceed.
336
+
337
+ **Before exiting, check research status** (read [research-phase.md](research-phase.md)):
338
+ 1. **HIGH confidence, researcher returned** → process findings, ask follow-up
339
+ questions if gaps found, then exit.
340
+ 2. **HIGH confidence, researcher still running** → inform user, wait for result.
341
+ 3. **MEDIUM confidence (not yet asked)** → ask user if they want research.
342
+ If yes, launch in foreground and process. If no, mark skipped.
343
+ 4. **No research needed** → exit normally.
344
+
345
+ When loop exits: mark task 1 as `completed`. Update state file status to
346
+ `ui-design` (or `specs-confirmed` if UI is N/A).
347
+
348
+ **Output:**
349
+
350
+ ```
351
+ Discovery completata! Tutte le dimensioni sono coperte.
352
+
353
+ [Brief summary of key decisions made]
354
+ [If research: brief summary of key findings]
355
+
356
+ Passo alla fase successiva: [UI Design / Scrittura PRD]
357
+
358
+ <Progress Bar>
359
+ ```
@@ -0,0 +1,233 @@
1
+ # ICIAS Impact Analysis Protocol
2
+
3
+ Full protocol for Change Impact Analysis on PRD sessions.
4
+ Based on ProReFiCIA (Etezadi et al. 2025), CodePlan (Bairi et al. 2023),
5
+ and FMEA-adapted scoring.
6
+
7
+ ---
8
+
9
+ ## Phase 1 — Semantic Scan
10
+
11
+ Evaluate each dimension against the change request description.
12
+
13
+ ### Procedure
14
+
15
+ For each of the 10 dimensions, determine:
16
+ - **Is there a direct impact?** (yes/no)
17
+ - **Impact depth** (I):
18
+ - 0 = no impact
19
+ - 1 = cosmetic (labels, copy, minor display)
20
+ - 2 = logic (new conditions, validation, flow branches)
21
+ - 3 = structural (new entities, schemas, endpoints, pages)
22
+
23
+ ### Refinement pass (mandatory)
24
+
25
+ After initial scan, re-read the change request and check dimensions 4-7
26
+ again (the "middle" of the list — LLMs tend to under-evaluate items in
27
+ the middle of lists, per "lost-in-the-middle" research). Adjust any
28
+ dimension that was initially scored 0 but deserves >= 1 on second look.
29
+
30
+ ---
31
+
32
+ ## Phase 2 — Structural Propagation (Coupling Matrix)
33
+
34
+ Apply the coupling matrix to find transitive (cascade) impacts.
35
+
36
+ ### Rules
37
+
38
+ 1. Start from all dimensions with direct impact (I > 0 from Phase 1).
39
+ 2. For each directly impacted dimension, check outgoing edges in the matrix.
40
+ 3. If edge strength >= 2 AND target dimension has I = 0: mark as cascade impact.
41
+ - Cascade I = max(1, source_I - 1) (degrades by hop)
42
+ - Cascade C = source_C - 1 (min 1) (confidence degrades)
43
+ 4. Max hop depth = 2. Do NOT propagate beyond 2 hops.
44
+ 5. If a dimension is reached by both direct and cascade: use direct (higher confidence).
45
+
46
+ ### Coupling Matrix (10x10)
47
+
48
+ Rows = source dimension, Columns = target dimension.
49
+ Values: 0 = independent, 1 = weak, 2 = moderate, 3 = strong (almost always co-impacted).
50
+
51
+ ```
52
+ D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
53
+ D1 U - 1 0 0 1 1 0 0 0 0
54
+ D2 J 0 - 1 1 3 0 2 0 1 1
55
+ D3 DM 0 0 - 3 0 0 1 3 1 2
56
+ D4 API 0 1 3 - 1 1 1 0 3 3
57
+ D5 UI 0 2 0 0 - 0 1 0 1 2
58
+ D6 P 0 0 0 1 1 - 1 0 1 3
59
+ D7 EC 0 0 0 0 0 0 - 0 0 1
60
+ D8 RM 0 0 1 0 0 0 1 - 0 1
61
+ D9 IS 0 0 0 1 0 0 0 0 - 1
62
+ D10 TS 0 0 0 0 0 0 0 0 0 -
63
+ ```
64
+
65
+ **Key:**
66
+ - D1=Users, D2=Journey, D3=Data Model, D4=API, D5=UI
67
+ - D6=Permissions, D7=Edge Cases, D8=Rollout/Migration
68
+ - D9=Integration Surface, D10=Test Strategy
69
+
70
+ ### High-coupling pairs (strength=3, rationale)
71
+
72
+ | Source → Target | Why |
73
+ |-----------------|-----|
74
+ | D2 Journey → D5 UI | New flow = new interface almost always |
75
+ | D3 Data → D4 API | Schema change = API contract change |
76
+ | D3 Data → D8 Rollout | Schema change = migration needed |
77
+ | D4 API → D3 Data | New endpoint often needs new/modified schema |
78
+ | D4 API → D9 Integration | New endpoint = new touchpoints in existing code |
79
+ | D4 API → D10 Tests | New endpoint = new test scenarios |
80
+ | D6 Perms → D10 Tests | Permission change = critical test update |
81
+
82
+ ---
83
+
84
+ ## Phase 3 — ICIAS Scoring
85
+
86
+ For each dimension with I > 0 (direct or cascade):
87
+
88
+ ### Score = I x C x A
89
+
90
+ **I = Impact Depth** (from Phase 1/2):
91
+ | Value | Meaning | Examples |
92
+ |-------|---------|----------|
93
+ | 1 | Cosmetic | Label, copy, minor display change |
94
+ | 2 | Logic | New condition, validation, flow branch, field |
95
+ | 3 | Structural | New entity, endpoint, page, collection, role |
96
+
97
+ **C = Confidence** (how certain the impact is):
98
+ | Value | Meaning | When to use |
99
+ |-------|---------|-------------|
100
+ | 1 | Inferred | Cascade-only, no direct evidence |
101
+ | 2 | Probable | Logical deduction, codebase pattern suggests it |
102
+ | 3 | Certain | Explicitly stated in CR, or direct code dependency |
103
+
104
+ **A = Artifact Stakes** (pre-assigned, fixed per dimension):
105
+ | A=3 (High stakes) | A=2 (Medium stakes) | A=1 (Low stakes) |
106
+ |-------------------|---------------------|-------------------|
107
+ | D3 Data Model | D2 User Journey | D1 Target Users |
108
+ | D4 API | D5 UI | D7 Edge Cases |
109
+ | D9 Integration Surface | D6 Permissions | D8 Rollout/Migration |
110
+ | | D10 Test Strategy | |
111
+
112
+ ### Verdict thresholds
113
+
114
+ | Score Range | Verdict | Meaning |
115
+ |-------------|---------|---------|
116
+ | 0 | SKIP | No impact detected |
117
+ | 1–3 | SKIP | Negligible impact, no revision needed |
118
+ | 4–9 | PATCH | Moderate impact, surgical update to affected sections |
119
+ | 10–27 | REDO | Major impact, phase must be substantially re-executed |
120
+
121
+ ### Bias rule
122
+
123
+ **False negatives are worse than false positives.** When uncertain:
124
+ - Round C up, not down
125
+ - Prefer PATCH over SKIP when on the boundary (score = 3)
126
+ - Prefer REDO over PATCH only when I = 3 (structural)
127
+
128
+ ---
129
+
130
+ ## Phase Mapping
131
+
132
+ After scoring all dimensions, map to PRD phases:
133
+
134
+ ### Discovery phase impact
135
+ - ANY dimension with PATCH/REDO → Discovery needs delta update
136
+ - PATCH: update state file checklist, run codebase-architect on affected dims
137
+ - REDO: re-run discovery question loop for affected dims
138
+
139
+ ### UI Design phase impact
140
+ - D2 Journey REDO OR D5 UI REDO → UI Design REDO
141
+ - D5 UI PATCH → UI Design PATCH (update existing design)
142
+ - Otherwise → UI Design SKIP
143
+
144
+ ### PRD document impact
145
+ - ANY dimension with PATCH/REDO → PRD needs update
146
+ - Map dimensions to PRD sections:
147
+
148
+ | Dimension | PRD Sections Affected |
149
+ |-----------|----------------------|
150
+ | D1 Users | 3 (Personas) |
151
+ | D2 Journey | 4 (User Stories), 7 (UI Specs) |
152
+ | D3 Data | 5 (Data Model), 12 (Dependencies) |
153
+ | D4 API | 6 (API Contract), 14 (Pipeline) |
154
+ | D5 UI | 7 (UI Specs), 8 (i18n) |
155
+ | D6 Perms | 9 (Acceptance Criteria) |
156
+ | D7 Edge Cases | 10 (Edge Cases) |
157
+ | D8 Rollout | 12 (Dependencies) |
158
+ | D9 Integration | 15 (ISA) |
159
+ | D10 Tests | 13 (Test Plan) |
160
+
161
+ ### Backlog Cards impact
162
+ - New structural entities (I=3) → new cards needed
163
+ - Changed acceptance criteria → update existing cards
164
+ - Changed dependencies → update `depends_on` fields
165
+
166
+ ---
167
+
168
+ ## Worked Example
169
+
170
+ **CR: "Add POST /api/v1/merchant/reservations/bulk-confirm for batch confirmation"**
171
+
172
+ Change type: Addition (new endpoint)
173
+
174
+ ### Phase 1 — Semantic Scan
175
+
176
+ | Dim | Direct? | I | Rationale |
177
+ |-----|---------|---|-----------|
178
+ | D1 Users | no | 0 | Same users (merchant staff) |
179
+ | D2 Journey | yes | 2 | New batch flow alongside single confirm |
180
+ | D3 Data | no | 0 | Same reservation schema |
181
+ | D4 API | yes | 3 | New endpoint, new payload, new validation |
182
+ | D5 UI | yes | 2 | Need selection mode + bulk button |
183
+ | D6 Perms | no | 0 | Same permission (manage_reservations) |
184
+ | D7 Edge | yes | 2 | Partial failure in batch, max batch size |
185
+ | D8 Rollout | no | 0 | No migration needed |
186
+ | D9 Integration | no | 0 | (check in Phase 2) |
187
+ | D10 Tests | no | 0 | (check in Phase 2) |
188
+
189
+ ### Phase 2 — Structural Propagation
190
+
191
+ From D4 (API, I=3):
192
+ - D4→D3 (strength=3): cascade. D3 I=max(1, 3-1)=2, C=2 → but wait,
193
+ CR says "same schema" → override to I=0. No cascade (semantic override).
194
+ - D4→D9 (strength=3): cascade. D9 I=2, C=2
195
+ - D4→D10 (strength=3): cascade. D10 I=2, C=2
196
+
197
+ ### Phase 3 — ICIAS Score
198
+
199
+ | Dim | I | C | A | Score | Verdict |
200
+ |-----|---|---|---|-------|---------|
201
+ | D1 | 0 | - | 1 | 0 | SKIP |
202
+ | D2 | 2 | 3 | 2 | 12 | REDO |
203
+ | D3 | 0 | - | 3 | 0 | SKIP |
204
+ | D4 | 3 | 3 | 3 | 27 | REDO |
205
+ | D5 | 2 | 3 | 2 | 12 | REDO |
206
+ | D6 | 0 | - | 2 | 0 | SKIP |
207
+ | D7 | 2 | 3 | 1 | 6 | PATCH |
208
+ | D8 | 0 | - | 1 | 0 | SKIP |
209
+ | D9 | 2 | 2 | 3 | 12 | REDO |
210
+ | D10 | 2 | 2 | 2 | 8 | PATCH |
211
+
212
+ ### Phase mapping result
213
+
214
+ | Phase | Verdict | Scope |
215
+ |-------|---------|-------|
216
+ | Discovery | PATCH | Update D2, D4, D5, D7, D9, D10 in checklist |
217
+ | UI Design | REDO | New batch selection flow |
218
+ | PRD | REDO | Sections 4, 6, 7, 10, 13, 15 |
219
+ | Backlog Cards | PATCH | New cards for bulk endpoint + UI; update deps |
220
+
221
+ ---
222
+
223
+ ## Calibration Notes
224
+
225
+ These thresholds are FMEA-adapted heuristics, not empirically validated
226
+ for PRD CIA. After 10-15 real change requests, review:
227
+
228
+ 1. Were any SKIPs that should have been PATCHes? → Lower threshold.
229
+ 2. Were any REDOs that could have been PATCHes? → Raise threshold.
230
+ 3. Did the coupling matrix miss any real cascades? → Add/strengthen edges.
231
+ 4. Did the coupling matrix produce false cascades? → Weaken/remove edges.
232
+
233
+ Track calibration data in state file `## Change Requests` section.