baldart 3.14.1 → 3.16.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 (27) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/VERSION +1 -1
  3. package/framework/.claude/agents/REGISTRY.md +10 -0
  4. package/framework/.claude/agents/api-perf-cost-auditor.md +47 -10
  5. package/framework/.claude/agents/coder.md +61 -10
  6. package/framework/.claude/agents/prd-card-writer.md +92 -19
  7. package/framework/.claude/agents/security-reviewer.md +1 -1
  8. package/framework/.claude/skills/bug/references/logging-patterns.md +45 -8
  9. package/framework/.claude/skills/new/SKILL.md +319 -87
  10. package/framework/.claude/skills/prd/SKILL.md +30 -2
  11. package/framework/.claude/skills/prd/assets/card-template.yml +59 -27
  12. package/framework/.claude/skills/prd/assets/epic-template.yml +11 -3
  13. package/framework/.claude/skills/prd/assets/prd-template.md +90 -14
  14. package/framework/.claude/skills/prd/assets/state-template.md +18 -0
  15. package/framework/.claude/skills/prd/references/api-perf-gate.md +102 -52
  16. package/framework/.claude/skills/prd/references/audit-phase.md +13 -13
  17. package/framework/.claude/skills/prd/references/backlog-phase.md +81 -0
  18. package/framework/.claude/skills/prd/references/discovery-phase.md +214 -28
  19. package/framework/.claude/skills/prd/references/prd-writing-phase.md +65 -23
  20. package/framework/.claude/skills/prd/references/research-phase.md +22 -4
  21. package/framework/.claude/skills/prd/references/ui-design-phase.md +115 -3
  22. package/framework/.claude/skills/prd/references/validation-phase.md +22 -2
  23. package/framework/docs/PROJECT-CONFIGURATION.md +41 -1
  24. package/framework/templates/baldart.config.template.yml +25 -0
  25. package/package.json +1 -1
  26. package/src/commands/configure.js +72 -0
  27. package/src/commands/update.js +13 -1
@@ -28,6 +28,7 @@ message. You ask questions, wait for answers, and iterate.
28
28
  |------|-------|-----------|
29
29
  | 0 | Context Recovery | [discovery-phase.md](references/discovery-phase.md) |
30
30
  | 1 | Kickoff | [discovery-phase.md](references/discovery-phase.md) |
31
+ | 1.6 | Mockup Intake | [discovery-phase.md](references/discovery-phase.md) |
31
32
  | 2 | Discovery Question Loop | [discovery-phase.md](references/discovery-phase.md) |
32
33
  | 2→CR | Change Request (auto/manual) | [prd-add-phase.md](references/prd-add-phase.md) |
33
34
  | 2.5 | Research (opzionale) | [research-phase.md](references/research-phase.md) |
@@ -88,6 +89,17 @@ message. You ask questions, wait for answers, and iterate.
88
89
  **Canonical examples**: `FEAT-0875-00..08` (Survey Analytics Redesign),
89
90
  `FEAT-0876-00..11` (Menu TIPS). See `assets/epic-template.yml` for the epic
90
91
  structure and `assets/card-template.yml` for child structure.
92
+ 16. **Mockup Intake (MANDATORY).** Subito dopo Kickoff (Step 1) e prima di entrare in
93
+ Discovery (Step 2), esegui Step 1.6 — chiedi all'utente se ha mockup a disposizione.
94
+ Se **sì**: chiedi formato (immagini in chat / path locali), **STOP**, attendi. Sull'arrivo:
95
+ copia i path locali in `${paths.prd_dir}/<slug>/mockups/`, analizza in dettaglio (vedi
96
+ [discovery-phase.md](references/discovery-phase.md) § "Mockup analysis schema"), popola
97
+ `## UI Design` nello state, poi entra in Discovery. Se **no**: marca
98
+ `mockups.status: none` e procedi col flow standard. Il decision tree di Step 3 (UI Design)
99
+ consuma `mockups.status` + `screens_in_scope[]` per scegliere ramo Full / Hybrid / Skip
100
+ senza ulteriore intervento. Le ambiguità rilevate dall'analisi mockup
101
+ (`mockup_analysis.screens[].gaps[]`) DEVONO diventare domande mirate in Discovery o
102
+ essere esplicitamente waivate.
91
103
 
92
104
  ---
93
105
 
@@ -122,6 +134,7 @@ At the END of every message (after all text, before stopping), display:
122
134
  | # | Fase | Stato |
123
135
  |---|------|-------|
124
136
  | 1 | Discovery & comprensione | ⬜/🔄/✅ |
137
+ | 1.6 | Mockup intake | ⬜/🔄/✅/⏭️ |
125
138
  | 1.5 | Ricerca best practice | ⬜/🔄/✅/⏭️ |
126
139
  | 2 | Design UI & approvazione | ⬜/🔄/✅/⏭️ |
127
140
  | 3 | Conferma specifiche | ⬜/🔄/✅ |
@@ -129,7 +142,9 @@ At the END of every message (after all text, before stopping), display:
129
142
  | 5 | Validazione e commit | ⬜/🔄/✅ |
130
143
 
131
144
  Comprensione: X% (N/M dimensioni coperte) — ISA: N punti identificati
145
+ Mockup: ⬜ non chiesto / 🔄 in attesa / ✅ N mockup / ⏭️ nessuno
132
146
  Ricerca: ⬜ non valutata / 🔍 in corso (background) / ✅ completata / ⏭️ non necessaria
147
+ Step 3 mode: full / hybrid / skipped (impostato dopo Step 1.6 e refinementato a Step 3)
133
148
  Prossimo passo: <what happens next>
134
149
  ```
135
150
 
@@ -183,6 +198,16 @@ Dimensions 1-8 can be resolved by: context-primer context (auto), targeted codeb
183
198
  Dimension 9 uses automated codebase scan + user validation (see discovery-phase.md).
184
199
  Dimension 10 uses a built-in evaluation tree (see discovery-phase.md).
185
200
 
201
+ **Mockup-driven pre-population (when Step 1.6 produced `mockups.status: provided`):**
202
+ - Dimension 5 (UI impact) is largely pre-resolved from `mockup_analysis.screens[]`
203
+ — log as covered with source `mockup-analysis`. Only ask UI questions for
204
+ ambiguities in `mockup_analysis.screens[].gaps[]` or for screens NOT in the mockups.
205
+ - Dimension 2 (User journey) is partially pre-resolved from `mockup_analysis.user_flow`
206
+ — ask only for the connective steps that aren't visible from the mockup sequence
207
+ (entry point, exit, error branches).
208
+ - All other dimensions follow the normal flow — mockups do not pre-resolve data
209
+ model, API contract, permissions, edge cases, rollout, ISA, or test strategy.
210
+
186
211
  ---
187
212
 
188
213
  ## COMPLETED PROGRESS BAR (for final message)
@@ -194,6 +219,7 @@ Dimension 10 uses a built-in evaluation tree (see discovery-phase.md).
194
219
  | # | Fase | Stato |
195
220
  |---|------|-------|
196
221
  | 1 | Discovery & comprensione | ✅ |
222
+ | 1.6 | Mockup intake | ✅/⏭️ |
197
223
  | 1.5 | Ricerca best practice | ✅/⏭️ |
198
224
  | 2 | Design UI & approvazione | ✅/⏭️ |
199
225
  | 3 | Conferma specifiche | ✅ |
@@ -201,7 +227,9 @@ Dimension 10 uses a built-in evaluation tree (see discovery-phase.md).
201
227
  | 5 | Validazione e commit | ✅ |
202
228
 
203
229
  Comprensione: 100%
230
+ Mockup: ✅ N mockup analizzati / ⏭️ nessuno fornito
204
231
  Ricerca: ✅ completata / ⏭️ non necessaria
232
+ Step 3 mode: full / hybrid / skipped
205
233
  **Pronto per l'implementazione.**
206
234
  ```
207
235
 
@@ -218,13 +246,13 @@ After cards are created and committed, log this PRD run to `docs/metrics/skill-r
218
246
  - `ac_coverage_ratio`: total acceptance_criteria count / total user_stories count across all cards
219
247
  - `isa_count`: number of ISA items identified (from the progress bar "ISA: N punti")
220
248
  - `has_test_plan_pct`: % of cards that have a `test_plan` field (even if `e2e_required: false`)
221
- - `has_firestore_indexes_pct`: % of cards that have a `firestore_indexes` field
249
+ - `has_db_indexes_pct`: % of cards that have a `db_indexes` field (covers any persistence layer; legacy `firestore_indexes` cards count too)
222
250
  - `discovery_iterations`: approximate number of Q&A rounds with the user (count AskUserQuestion calls in this session, default 1 if unknown)
223
251
 
224
252
  2. Write ONE JSON line (append) to `docs/metrics/skill-runs.jsonl`:
225
253
 
226
254
  ```json
227
- {"ts":"<ISO-8601-UTC>","skill":"prd","run_id":"prd-<slug>","prd_slug":"<slug>","cards_created":0,"ac_coverage_ratio":0.0,"isa_count":0,"has_test_plan_pct":0.0,"has_firestore_indexes_pct":0.0,"discovery_iterations":1,"prd_path":"${paths.prd_dir}/<slug>/PRD.md"}
255
+ {"ts":"<ISO-8601-UTC>","skill":"prd","run_id":"prd-<slug>","prd_slug":"<slug>","cards_created":0,"ac_coverage_ratio":0.0,"isa_count":0,"has_test_plan_pct":0.0,"has_db_indexes_pct":0.0,"discovery_iterations":1,"prd_path":"${paths.prd_dir}/<slug>/PRD.md"}
228
256
  ```
229
257
 
230
258
  **This step is NON-BLOCKING** — if it fails, do not abort. Log "Metrics Log: SKIPPED" in the progress bar.
@@ -6,7 +6,16 @@ id: {{FEAT-ID}}
6
6
  title: "{{Full descriptive title}}"
7
7
  status: TODO
8
8
  priority: {{HIGH|MEDIUM|LOW}}
9
- owner_agent: claude
9
+
10
+ # owner_agent — REQUIRED, no implicit default. One of:
11
+ # coder → backend / logic / state / data layer / scripts
12
+ # ui-expert → UI implementation (mockup → code, registry-first); UI-ONLY scope
13
+ # plan → planning-only card (no code edits)
14
+ # visual-designer → static visual assets (illustrations, icons, hero images)
15
+ # motion-expert → animation specs (timing, easing, micro-interactions)
16
+ # The /new orchestrator dispatches by this field (see new/SKILL.md § Agent Routing).
17
+ # Validation phase BLOCKS commit if value is missing or outside this enum.
18
+ owner_agent: <REQUIRED — coder | ui-expert | plan | visual-designer | motion-expert>
10
19
  execution_mode: local
11
20
 
12
21
  group:
@@ -29,9 +38,18 @@ business_rationale: |
29
38
  Aiuta gli agenti implementatori a comprendere l'intento strategico.}}
30
39
 
31
40
  scope:
41
+ # UI-only constraint (when owner_agent: ui-expert):
42
+ # The scope MUST cover ONLY graphical concerns — components, layout, styling,
43
+ # token usage, motion, accessibility. It MUST NOT bundle business logic, API
44
+ # integration, data fetching, state management, form validation, or backend
45
+ # changes. If the step involves both UI and logic, split into two cards
46
+ # (ui-expert + coder) and wire them via `depends_on:` / `blocks:`.
32
47
  summary: |
33
48
  {{What this card delivers in 2-3 lines.}}
34
- users: [{{CUSTOMER|MERCHANT|SUPER_ADMIN}}]
49
+ # Drawn from identity.audience_segments[] in baldart.config.yml.
50
+ # Use the project's own persona labels (e.g. ["customer","merchant"] or
51
+ # ["admin","editor","viewer"] or ["tenant","support","ops"]).
52
+ users: [{{persona1, persona2}}]
35
53
  value: {{Business value in one line.}}
36
54
 
37
55
  # --- Scope Boundaries (OPTIONAL — include when card is part of a multi-card epic) ---
@@ -122,13 +140,16 @@ test_plan:
122
140
  maps_to: "US-{{N}} / AC-{{N}}"
123
141
  priority: {{HIGH|MEDIUM}}
124
142
  test_credentials:
125
- persona: {{CUSTOMER|MERCHANT|SUPER_ADMIN}}
126
- auth_method: "{{OTP|password}}"
127
- credentials: "{{phone: 3486417303 | username/password}}"
128
- store: "{{store name if merchant}}"
129
- notes: "{{e.g., OTP inserito manualmente dall'utente}}"
143
+ # Persona names come from identity.audience_segments[] in baldart.config.yml.
144
+ # Credential REFERENCES (not real secrets) live in .baldart/overlays/prd.md
145
+ # § Test Credentials. Never paste secrets in committed YAML.
146
+ persona: "{{from identity.audience_segments[]}}"
147
+ auth_method: "{{OTP | password | magic-link | api-token}}"
148
+ credentials_ref: "{{secret-manager://path | .env.test:VAR_NAME | overlay-reference}}"
149
+ context: "{{tenant / workspace / store / org — if applicable}}"
150
+ notes: "{{e.g., OTP entered manually during test}}"
130
151
  test_data_prerequisites:
131
- - "{{any Firestore data needed before tests}}"
152
+ - "{{any data that must exist in the persistence layer before tests run}}"
132
153
 
133
154
  integration_points:
134
155
  - id: ISA-{{N}}
@@ -169,15 +190,17 @@ reuse_analysis:
169
190
  # --- Data Sources (MANDATORY — compile for EVERY card; use [] only for pure docs/config cards) ---
170
191
  # High-level overview of every data source or destination touched by this card.
171
192
  # Rules:
172
- # type: firestore collection name in `path`; field-level detail goes in data_fields below.
193
+ # type: db {entity} name in `path` (collection/table/index per stack.database); field-level detail in data_fields below.
173
194
  # type: file → repo-relative path, operations (READ|WRITE|APPEND|CREATE|DELETE), format.
174
195
  # type: api → URL or endpoint pattern; READ=GET, WRITE=POST/PUT/PATCH, DELETE=DELETE.
175
196
  # type: env → env var name; operations always [READ].
176
197
  # [] → explicit empty list for cards that read/write NO data (docs, config stubs).
177
198
  # NEVER omit this field silently — an empty [] signals the writer verified there are no sources.
199
+ # Legacy "firestore" type is still accepted; prefer "db" + db_dialect.
178
200
  data_sources:
179
- - type: "{{firestore|file|api|env}}"
180
- path: "{{collection name | repo-relative file path | API endpoint | env var name}}"
201
+ - type: "{{db|file|api|env}}"
202
+ db_dialect: "{{firestore|postgres|supabase|mysql|mongodb|dynamodb|sqlite}}" # only when type: db
203
+ path: "{{entity name | repo-relative file path | API endpoint | env var name}}"
181
204
  operations: [{{READ|WRITE|APPEND|CREATE|DELETE}}]
182
205
  # format: "{{JSONL|YAML|JSON|markdown|binary}}" # include for file type only
183
206
  # note: "{{optional: data shape, why this source}}"
@@ -194,32 +217,41 @@ env_vars:
194
217
  feature_card: "{{nome feature / ID card, es. SPU / ADR-2026-04-24}}"
195
218
  note: "{{a cosa serve}}"
196
219
 
197
- # --- Data Fields (MANDATORY for cards that read/write Firestore — omit for UI/docs/config only) ---
220
+ # --- Data Fields (MANDATORY for cards that read/write the persistence layer — omit for UI/docs/config only) ---
198
221
  # Structured field-name registry for mechanical validation (pre-commit hook + Quality Audit).
199
- # Field Grounding Rule: EVERY field here MUST be verified via Grep on field-registry.json
200
- # BEFORE ts_verified is set to true. See prd-card-writer.md Field Grounding Rule.
201
- # Fields id, createdAt, updatedAt are universal — do NOT include them here.
222
+ # Field Grounding Rule: EVERY field here MUST be verified via Grep on the schema registry
223
+ # (path resolved per .baldart/overlays/prd.md § Schema Registry — common defaults:
224
+ # ${paths.references_dir}/field-registry.json for Firestore-style projects,
225
+ # ${paths.references_dir}/schema.md for SQL, prisma/schema.prisma for Prisma).
226
+ # Fields id, createdAt, updatedAt (or their snake_case equivalents) are universal — do NOT include here.
202
227
  data_fields:
203
- - collection: "{{collectionName}}" # exact key in ${paths.references_dir}/field-registry.json
204
- field: "{{fieldName}}" # exact field name (verified via Grep)
205
- type: "{{TypeScript type}}" # e.g. "string", "OccasionType", "boolean"
228
+ - entity: "{{collection or table name}}" # exact key in the project schema registry
229
+ field: "{{fieldName or column_name}}" # exact identifier (verified via Grep)
230
+ type: "{{language-native type}}" # e.g. "string", "OccasionType", "boolean", "varchar(64)", "JSONB"
206
231
  status: "{{existing|new|modified|deprecated_removed}}"
207
232
  ts_verified: {{true|false}} # true = Grep confirmed field in registry
208
- source: "{{src/types/booking.ts}}" # TypeScript file where interface is defined
233
+ source: "{{src/types/booking.ts | prisma/schema.prisma:42 | migrations/2024_..._create.sql}}"
209
234
  # schema_ref: "PRD.md#schema-verification" # ONLY for status: new fields
210
235
 
211
- firestore_indexes:
212
- - collection: "{{collection name}}"
236
+ db_indexes:
237
+ - entity: "{{collection or table name}}"
238
+ dialect: "{{firestore|postgres|supabase|mysql|mongodb|dynamodb|sqlite}}"
213
239
  fields:
214
- - field: "{{field1}}"
215
- order: "{{ASC|DESC}}"
216
- - field: "{{field2}}"
240
+ - field: "{{field1 or column1}}"
241
+ order: "{{ASC|DESC}}" # firestore/sql; for mongo use {field1: 1|-1}
242
+ - field: "{{field2 or column2}}"
217
243
  order: "{{ASC|DESC}}"
244
+ kind: "{{composite|covering|partial|GIN|GSI|LSI|unique|fulltext}}" # pick what matches dialect
218
245
  query_location: "{{file path where the query lives}}"
219
246
  prd_ref: "IDX-{{N}}"
220
- # Omit this section entirely if the card has no compound Firestore queries.
221
- # If present, the coder MUST add these indexes to firestore.indexes.json
222
- # in the same commit as the query code.
247
+ # Omit this section entirely if the card has no compound queries / multi-column indexes.
248
+ # If present, the coder MUST ship the index in the same commit as the query —
249
+ # firestore.indexes.json (Firestore), migration file (SQL), createIndex call (Mongo),
250
+ # CDK/Terraform table definition (DynamoDB).
251
+
252
+ # Legacy field name kept for backwards-compat with pre-3.15.0 cards. The validator
253
+ # accepts either name; the writer should prefer db_indexes for new cards.
254
+ firestore_indexes: [] # DEPRECATED in v3.15.0 — use db_indexes instead
223
255
 
224
256
  documentation_impact:
225
257
  - "{{doc path}} — {{what to update}}"
@@ -11,7 +11,7 @@
11
11
  # The epic is a TRACKER, not implementation work:
12
12
  # - NO files_likely_touched pointing to code (only docs allowed)
13
13
  # - NO validation_commands, existing_patterns, anti_patterns
14
- # - NO data_fields, firestore_indexes
14
+ # - NO data_fields, db_indexes (firestore_indexes legacy too)
15
15
  # - NO test_plan with scenarios (test scenarios live on children)
16
16
  # - data_sources: [] (always empty)
17
17
  #
@@ -26,7 +26,14 @@ id: {{FEAT-XXXX-00}}
26
26
  title: "Epic: {{Feature Name}} — {{short tagline}}"
27
27
  status: TODO
28
28
  priority: {{HIGH|MEDIUM|LOW}}
29
- owner_agent: claude
29
+
30
+ # Epics are tracker-only — no implementation work, no dispatcher routing.
31
+ # The /new orchestrator skips epics (it only operates on child cards) and the
32
+ # PRD validation-phase enum-check skips them too. Keep this as an empty
33
+ # string to signal "no specialist assigned"; do NOT use one of the child
34
+ # enum values (coder | ui-expert | plan | visual-designer | motion-expert)
35
+ # on an epic — that would falsely imply the epic carries implementation work.
36
+ owner_agent: ""
30
37
  execution_mode: cloud
31
38
 
32
39
  # Epic's group.parent is the PRD slug (string), NOT a FEAT-ID.
@@ -65,7 +72,8 @@ scope:
65
72
  summary: |
66
73
  Coordinamento delle {{N}} sub-card che implementano l'epic:
67
74
  {{breve descrizione di ogni sub-card in 1 riga ciascuna}}
68
- users: [{{CUSTOMER|MERCHANT|SUPER_ADMIN}}]
75
+ # Drawn from identity.audience_segments[] in baldart.config.yml.
76
+ users: [{{persona1, persona2}}]
69
77
  value: "{{one-line business value}}"
70
78
 
71
79
  scope_boundaries:
@@ -44,6 +44,40 @@ Backlog cards to be created after PRD approval.
44
44
  |----------|--------|
45
45
  | {{doc path}} | {{what to update}} |
46
46
 
47
+ ## Design Reference & Mockup Inventory
48
+
49
+ > Omit this entire section only if UI impact is N/A. Otherwise include with
50
+ > `Mockup status: none` when the user did not provide mockups in Step 1.6.
51
+
52
+ **Mockup status:** {{provided | partial | none | n/a}}
53
+ **Step 3 mode:** {{full | hybrid | skipped}}
54
+ **Design entry point:** {{`docs/prd/<slug>/design.html` | `docs/prd/<slug>/mockups/` | both}}
55
+
56
+ ### Screen inventory
57
+
58
+ | Schermata | User story | Mockup path | Origine | Note |
59
+ |-----------|------------|-------------|---------|------|
60
+ | {{Lista ordini}} | US-1 | `mockups/lista.png` | mockup utente | tokens align: ✅ |
61
+ | {{Onboarding}} | US-4 | `design.html#onboarding` | generato Step 3b | option scelta: B |
62
+
63
+ ### Mapping schermata → componenti registry
64
+
65
+ > Populate only when `features.has_design_system: true`. Otherwise remove this
66
+ > subsection.
67
+
68
+ | Schermata | Componenti riusati | Componenti nuovi | Token violations |
69
+ |-----------|---------------------|------------------|------------------|
70
+ | {{Lista ordini}} | DataTable, Pagination | — | — |
71
+ | {{Dettaglio ordine}} | Card, StatusBadge | OrderTimeline (nuovo — vedi spec) | shadow `0 2px 8px` → `--shadow-card-elevated` |
72
+
73
+ ### Source files originali
74
+
75
+ Per i mockup forniti come path locali, riportare il percorso utente pre-copia
76
+ (traceability). Per immagini in chat, scrivere `chat://image-N`.
77
+
78
+ - `{{~/Desktop/orders-mockup.png}}` → `mockups/orders-mockup.png`
79
+ - `chat://image-1` → analizzata inline, non copiata su disco
80
+
47
81
  ---
48
82
 
49
83
  ## 1. Problem Statement
@@ -99,22 +133,55 @@ Backlog cards to be created after PRD approval.
99
133
 
100
134
  ## 5. Data Model
101
135
 
102
- {{TypeScript interfaces, Firestore schema changes, validation rules.}}
136
+ {{Type definitions (TypeScript interfaces / Python dataclasses / SQL schema /
137
+ schema validators), persistence-layer schema changes, validation rules.}}
138
+
139
+ ### Database Indexes & Query Optimization
103
140
 
104
- ### Firestore Composite Indexes
141
+ > **Stack-specific variant** — populate the variant matching `stack.database`
142
+ > from `baldart.config.yml`. Remove the variants that do not apply. If
143
+ > `stack.database: ""` (unset), the PRD writer SHOULD ask the user which
144
+ > database is in use before completing this section.
105
145
 
106
- Every query that combines `where()` on one field with `orderBy()` on a different field,
107
- or multiple `where()` on different fields, REQUIRES a composite index. Missing indexes
108
- cause runtime `FAILED_PRECONDITION` errors (500s in production).
146
+ **Variant A Firestore** (`stack.database: firestore`)
147
+
148
+ Every query that combines `where()` on one field with `orderBy()` on a different
149
+ field, or multiple `where()` on different fields, REQUIRES a composite index.
150
+ Missing indexes cause runtime `FAILED_PRECONDITION` errors (500s in production).
109
151
 
110
152
  | # | Collection | Fields | Order | Query Location | Status |
111
153
  |---|-----------|--------|-------|----------------|--------|
112
154
  | IDX-1 | `{{collection}}` | `{{field1}}` ASC, `{{field2}}` DESC | {{ASC/DESC}} | `{{file:function}}` | NEW / EXISTS |
113
155
 
114
- **Rules:**
115
- - Every API endpoint or server action that reads from Firestore with compound queries MUST have its indexes listed here.
116
- - The `firestore.indexes.json` file MUST be updated in the same commit as the query code.
117
- - If no compound queries are needed: state "Nessun indice composito richiesto — tutte le query usano un singolo campo."
156
+ Rules: every endpoint that reads with compound queries MUST list its indexes
157
+ here; `firestore.indexes.json` MUST be updated in the same commit; if no
158
+ compound queries: "Nessun indice composito richiesto".
159
+
160
+ **Variant B — Relational (Postgres / Supabase / MySQL / SQLite)**
161
+
162
+ | # | Table | Columns | Type | Used by | Migration |
163
+ |---|-------|---------|------|---------|-----------|
164
+ | IDX-1 | `{{table}}` | `{{col1}}, {{col2}}` | B-tree / GIN / partial | `{{query location}}` | `{{migration file}}` |
165
+
166
+ Rules: indexes ship in the same migration as the query; for Supabase, RLS
167
+ policies live alongside in `### Row-Level Security` below; queries on >100k
168
+ rows without a matching index → CRITICAL finding in api-perf-gate.
169
+
170
+ **Variant C — MongoDB**
171
+
172
+ | # | Collection | Fields | Type | Used by | Notes |
173
+ |---|-----------|--------|------|---------|-------|
174
+ | IDX-1 | `{{collection}}` | `{{field1}}: 1, {{field2}}: -1}` | compound / text / 2dsphere | `{{aggregation pipeline}}` | TTL / partial / sparse if applicable |
175
+
176
+ **Variant D — DynamoDB**
177
+
178
+ | # | Table | PK / SK | GSI / LSI | Access Pattern | Notes |
179
+ |---|-------|---------|-----------|----------------|-------|
180
+ | GSI-1 | `{{table}}` | `{{pk}} / {{sk}}` | GSI: {{name}} on {{attrs}} | {{query pattern}} | provisioned / on-demand |
181
+
182
+ **Variant E — None / no DB / N/A**
183
+
184
+ State explicitly: "Feature is stateless / does not touch the persistence layer".
118
185
 
119
186
  ---
120
187
 
@@ -126,7 +193,12 @@ cause runtime `FAILED_PRECONDITION` errors (500s in production).
126
193
 
127
194
  ## 7. UI Specifications
128
195
 
129
- {{Layout, components, styling, responsive behavior, a11y.}}
196
+ > Canonical visual reference: **Design Reference & Mockup Inventory** section above.
197
+ > This section describes specs that are NOT obvious from the mockups themselves
198
+ > (behavioral, responsive breakpoints, a11y, motion, copy variants by locale).
199
+ > Do NOT duplicate the screen list or component table — link to them above.
200
+
201
+ {{Layout details not visible in mockups, responsive behavior, a11y, motion, copy variants.}}
130
202
 
131
203
  ---
132
204
 
@@ -191,10 +263,14 @@ cause runtime `FAILED_PRECONDITION` errors (500s in production).
191
263
 
192
264
  ### Test Credentials
193
265
 
194
- | Persona | Auth Method | Credentials | Notes |
195
- |---------|------------|-------------|-------|
196
- | {{Consumer}} | OTP | phone: 3486417303 | OTP inserito manualmente dall'utente durante il test |
197
- | {{Merchant}} | password | {{username}} / {{password}} | Store: {{store name}} |
266
+ > Personas drawn from `identity.audience_segments[]`. Credential values come
267
+ > from `.baldart/overlays/prd.md § Test Credentials` (preferred), or were asked
268
+ > to the user during discovery. **Do NOT paste real secrets here** use
269
+ > references to a secret manager / `.env.test` / 1Password item.
270
+
271
+ | Persona | Auth Method | Credentials Reference | Notes |
272
+ |---------|-------------|-----------------------|-------|
273
+ | {{audience_segments[0]}} | {{OTP / password / magic link / token}} | {{secret-manager://path or .env.test:VAR}} | {{notes about context, tenant, store, etc.}} |
198
274
 
199
275
  ### Test Data Prerequisites
200
276
 
@@ -67,6 +67,24 @@ Scenarios: pending
67
67
 
68
68
  ## UI Design
69
69
 
70
+ mockups.status: pending # none | requested | provided | partial
71
+ mockups.format: pending # chat-images | local-paths | mixed
72
+ mockups.original_paths: [] # user-provided paths or chat://image-N
73
+ mockups.canonical_paths: [] # mockups/<file> after copy
74
+
75
+ mockup_analysis.screens: [] # see discovery-phase.md § Mockup analysis schema
76
+ mockup_analysis.user_flow: []
77
+ mockup_analysis.design_system_alignment:
78
+ status: pending # aligned | violations | not-applicable
79
+ violations: []
80
+
81
+ step_3_mode: pending # full | hybrid | skipped
82
+ design.html_path: pending # path | n/a (mockup-only)
83
+
84
+ screens_in_scope: [] # [{ name, covered_by_mockups: bool, generated_in_step_3b: bool }]
85
+
86
+ ui_inventory: [] # populated by Step 3d
87
+
70
88
  ## Confirmed Specs
71
89
 
72
90
  ## Backlog Cards