baldart 3.41.0 → 4.0.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 (49) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/VERSION +1 -1
  3. package/framework/.claude/agents/REGISTRY.md +72 -24
  4. package/framework/.claude/agents/api-perf-cost-auditor.md +12 -5
  5. package/framework/.claude/agents/code-reviewer.md +30 -23
  6. package/framework/.claude/agents/codebase-architect.md +47 -43
  7. package/framework/.claude/agents/coder.md +29 -18
  8. package/framework/.claude/agents/doc-reviewer.md +55 -28
  9. package/framework/.claude/agents/plan-auditor.md +77 -12
  10. package/framework/.claude/agents/prd-card-writer.md +43 -13
  11. package/framework/.claude/agents/prd.md +22 -3
  12. package/framework/.claude/agents/qa-sentinel.md +33 -15
  13. package/framework/.claude/agents/security-reviewer.md +65 -10
  14. package/framework/.claude/agents/senior-researcher.md +8 -1
  15. package/framework/.claude/agents/ui-expert.md +22 -7
  16. package/framework/.claude/commands/check.md +31 -11
  17. package/framework/.claude/commands/codexreview.md +48 -29
  18. package/framework/.claude/commands/new.md +29 -330
  19. package/framework/.claude/commands/qa.md +57 -37
  20. package/framework/.claude/skills/context-primer/SKILL.md +29 -8
  21. package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +36 -36
  22. package/framework/.claude/skills/frontend-design/SKILL.md +10 -8
  23. package/framework/.claude/skills/new/SKILL.md +409 -302
  24. package/framework/.claude/skills/prd/SKILL.md +67 -38
  25. package/framework/.claude/skills/prd/assets/card-template.yml +22 -26
  26. package/framework/.claude/skills/prd/assets/epic-template.yml +5 -5
  27. package/framework/.claude/skills/prd/assets/state-template.md +25 -3
  28. package/framework/.claude/skills/prd/references/api-perf-gate.md +143 -33
  29. package/framework/.claude/skills/prd/references/audit-phase.md +48 -34
  30. package/framework/.claude/skills/prd/references/backlog-phase.md +38 -11
  31. package/framework/.claude/skills/prd/references/discovery-phase.md +121 -44
  32. package/framework/.claude/skills/prd/references/impact-analysis.md +127 -23
  33. package/framework/.claude/skills/prd/references/prd-add-phase.md +18 -214
  34. package/framework/.claude/skills/prd/references/prd-writing-phase.md +52 -42
  35. package/framework/.claude/skills/prd/references/research-phase.md +105 -19
  36. package/framework/.claude/skills/prd/references/ui-design-phase.md +20 -8
  37. package/framework/.claude/skills/prd/references/validation-phase.md +97 -72
  38. package/framework/.claude/skills/prd-add/SKILL.md +70 -20
  39. package/framework/.claude/skills/simplify/SKILL.md +22 -12
  40. package/framework/.claude/skills/ui-design/SKILL.md +26 -7
  41. package/framework/.claude/skills/webapp-testing/SKILL.md +6 -4
  42. package/framework/.claude/skills/worktree-manager/SKILL.md +206 -143
  43. package/framework/agents/coding-standards.md +85 -0
  44. package/framework/agents/skills-mapping.md +85 -82
  45. package/framework/agents/testing.md +6 -4
  46. package/framework/templates/baldart.config.template.yml +29 -7
  47. package/package.json +1 -1
  48. package/src/commands/configure.js +43 -9
  49. package/framework/.claude/skills/prd-add/references/impact-analysis.md +0 -233
@@ -65,11 +65,12 @@ Review the same changes for hacky patterns:
65
65
  6. **Unnecessary JSX nesting**: wrapper Boxes/elements that add no layout value — check if inner component props (flexShrink, alignItems, etc.) already provide the needed behavior
66
66
  7. **Unnecessary comments**: comments explaining WHAT the code does (well-named identifiers already do that), narrating the change, or referencing the task/caller — delete; keep only non-obvious WHY (hidden constraints, subtle invariants, workarounds)
67
67
 
68
- ### Agent 2b: Design System SSOT Compliance (MANDATORY for UI refactors)
68
+ #### Agent 2 Design System SSOT Compliance sub-checklist (MANDATORY for UI refactors)
69
69
 
70
- When the diff includes files under `src/components/`, `src/app/**/*.tsx`, or any
71
- `.css`/`.module.css`, the simplify pass MUST NOT introduce hardcoded design values while
72
- refactoring. Run this as part of the quality review:
70
+ This is part of Agent 2's single task (NOT a separate fourth parallel agent — the three agents in
71
+ Step 2 are Agents 1, 2, 3). When the diff includes files under `${paths.components_root}/`,
72
+ `${paths.components_root}/**/*.tsx`, or any `.css`/`.module.css`, the simplify pass MUST NOT introduce
73
+ hardcoded design values while refactoring. Agent 2 runs this as part of its quality review:
73
74
 
74
75
  1. Read `${paths.design_system}/INDEX.md` (component index + Canonical Authority Matrix + Quick
75
76
  rules MUST) before rewriting any component.
@@ -112,23 +113,32 @@ If no issues are found, say so and stop. Do not invent problems.
112
113
  For each finding, apply the fix directly:
113
114
 
114
115
  - **Exact duplicates**: Delete the new code, import the existing version, update all references.
115
- - **Near duplicates**: Extract a shared function/component/hook to the appropriate shared directory (`src/lib/`, `src/hooks/`, `src/components/shared/`). Update all call sites to use the shared version.
116
+ - **Near duplicates**: Extract a shared function/component/hook to the project's shared directory resolved from `baldart.config.yml` (see "When extracting shared code" below). Update all call sites to use the shared version.
116
117
  - **Inline reimplementations**: Replace inline code with calls to the existing utility. Add imports.
117
118
  - **Quality issues**: Apply the fix inline (remove redundant state, simplify JSX nesting, replace string literals with constants, etc.).
118
119
  - **Efficiency issues**: Apply the fix inline (parallelize independent calls, add change-detection guards, batch reads, etc.).
119
120
 
120
- When extracting shared code:
121
- - Place utilities in `src/lib/` (whichever module is closest in domain)
122
- - Place shared components in `src/components/shared/` or `src/components/ui/`
123
- - Place shared hooks in `src/hooks/`
124
- - Do not create new directories if equivalent ones already exist
121
+ When extracting shared code, write to the SAME `${paths.*}` keys the review phase (Step 2) reads from `baldart.config.yml` — never hardcode a fallback that bypasses config. A consumer whose utilities live under `packages/shared/utils/` must get the extracted file there, not in a baked-in `src/lib/`:
122
+ - Place shared components under `${paths.components_root}/shared/` (or `${paths.components_primitives}/` for a primitive).
123
+ - Place utilities and hooks under the project's utility/hook roots as declared in the project overlay (`.baldart/overlays/simplify.md` lists `paths.lib_dir` / `paths.hooks_dir` or the project's equivalents).
124
+ - If the relevant key is missing or empty, ASK the user where the shared code should live — do not assume `src/lib/` / `src/hooks/` / `src/components/shared/`. See `framework/agents/project-context.md` § 3.
125
+ - Do not create new directories if equivalent ones already exist.
125
126
 
126
127
  ## Step 5: Verify
127
128
 
128
- Run the linter and type checker:
129
+ These static checks run AFTER Step 4 has mutated code — a pre-fix pass would not cover the post-fix
130
+ code, so re-running them here is mandatory whenever Step 4 changed anything.
131
+
132
+ Run the linter (use the project's lint command):
129
133
 
130
134
  ```
131
135
  npm run lint
136
+ ```
137
+
138
+ Run the type checker as its own blocking step ONLY when `stack.language` includes `typescript`
139
+ (skip otherwise — `tsc` is meaningless on a non-TS project):
140
+
141
+ ```
132
142
  npx tsc --noEmit
133
143
  ```
134
144
 
@@ -138,6 +148,6 @@ Run the project's test suite (if tests exist):
138
148
  npm test
139
149
  ```
140
150
 
141
- If tests or lint fail, fix the issues. The codebase must be in a passing state when you're done.
151
+ If tests, lint, or (where applicable) tsc fail, fix the issues. The codebase must be in a passing state when you're done.
142
152
 
143
153
  When done, briefly summarize what was fixed (or confirm the code was already clean).
@@ -11,7 +11,8 @@ design with a structured UI Element Inventory.
11
11
 
12
12
  **Architecture principle:** The generator never evaluates its own output.
13
13
  Evaluation is always performed by a separate agent with fresh context.
14
- (Ref: Anthropic "Harness Design for Long-Running Apps")
14
+ [DESIGN-CHOICE: a fresh-context evaluator avoids the generator rationalizing its
15
+ own mockups — separating generation from scoring keeps the quality gate honest.]
15
16
 
16
17
  ## Project Context
17
18
 
@@ -106,7 +107,14 @@ Read [references/generation.md](references/generation.md) § Context Capture.
106
107
 
107
108
  Read [references/generation.md](references/generation.md).
108
109
 
109
- **MANDATORY:** invoke the `huashu-design` skill before generating any HTML. It provides the HTML prototype engine (React+Babel or vanilla+Tailwind CDN, Tweaks panel, App Prototype shell with AppPhone state manager, Playwright click validation, animated output). Follow its rules for the prototype type in scope.
110
+ **OPTIONAL (graceful degradation):** `huashu-design` is a user-installed skill, NOT shipped with the
111
+ framework. If it is installed, invoke it before generating any HTML — it provides the HTML prototype
112
+ engine (React+Babel or vanilla+Tailwind CDN, Tweaks panel, App Prototype shell with AppPhone state
113
+ manager, Playwright click validation, animated output); follow its rules for the prototype type in
114
+ scope. If it is NOT installed, proceed without it: emit a one-line notice ("huashu-design not
115
+ installed — generating HTML mockups directly") and have `ui-expert` produce the HTML mockups using
116
+ the generation rules in `references/generation.md` plus a Tailwind CDN scaffold. Never block the
117
+ design run on huashu-design's absence.
110
118
 
111
119
  **Filesystem rule (ABSOLUTE):** every HTML file MUST be written to disk with the `Write` tool at `/tmp/prd-design-<slug>/option-X.html` BEFORE opening in a browser. Outputting inline code blocks is not sufficient.
112
120
 
@@ -116,7 +124,7 @@ Invoke `ui-expert` agent with:
116
124
  - Codebase-architect findings
117
125
  - 21st.dev catalog categories
118
126
  - Full generation rules from the reference
119
- - `huashu-design` prototype rules loaded above
127
+ - `huashu-design` prototype rules loaded above (only if the skill is installed; otherwise omit)
120
128
  - `identity.design_philosophy` and `identity.language` to drive aesthetic and copy register
121
129
 
122
130
  Output: 3 HTML files written to `/tmp/prd-design-<slug>/` via `Write` tool.
@@ -125,10 +133,14 @@ Output: 3 HTML files written to `/tmp/prd-design-<slug>/` via `Write` tool.
125
133
 
126
134
  Read [references/evaluation.md](references/evaluation.md).
127
135
 
128
- Invoke a **separate** `code-reviewer` agent (NOT the same agent that generated):
136
+ Invoke a **separate, fresh-context `ui-expert` agent** (a NEW instance — NOT the `ui-expert` that
137
+ generated in Step C). `ui-expert` is the right evaluator because the rubric scores design-quality
138
+ criteria (visual hierarchy, information density, mobile-first layout) — a code-quality reviewer would
139
+ apply a code-correctness lens and miss the design criteria entirely. The GAN separation is preserved
140
+ by using a distinct instance with no memory of the generation pass.
129
141
  - Pass the 3 HTML files
130
142
  - Pass the context screenshots as reference
131
- - Pass the evaluation rubric (7 criteria, scoring 1-5, hard thresholds)
143
+ - Pass the evaluation rubric from [references/evaluation.md](references/evaluation.md) (7 criteria, scoring 1-5, hard thresholds) — the evaluator must read that reference, it does not know the rubric natively
132
144
  - Request: produce evaluation report at `/tmp/prd-design-<slug>/evaluation-report.md`
133
145
 
134
146
  **If any option FAIL:** send feedback to generator, re-generate, re-evaluate. Max 5 iterations per option.
@@ -161,7 +173,14 @@ Invoke a **separate** `code-reviewer` agent (NOT the same agent that generated):
161
173
 
162
174
  Read [references/inventory.md](references/inventory.md).
163
175
 
164
- 1. Copy approved HTML to `${paths.prd_dir}/<slug>/design.html` (if `features.has_prd_workflow: true`; otherwise ask the user where to persist the design). **When invoked from `/prd` (since v3.22.0), prefix this with `WORKING_DIRECTORY` — see the "Working Directory" section near the top of this file.** Concrete absolute target: `<WORKING_DIRECTORY>/<paths.prd_dir>/<slug>/design.html`.
176
+ 1. Copy approved HTML to a deterministic canonical path so downstream steps can find it without asking:
177
+ - `features.has_prd_workflow: true` → `${paths.prd_dir}/<slug>/design.html`.
178
+ - `features.has_prd_workflow: false` → the framework default `.baldart/designs/<slug>/design.html`
179
+ (create the directory if missing). Do NOT ask the user for an arbitrary runtime location — a
180
+ non-recorded path breaks any downstream `/prd` / `/new` step that expects the design at a known
181
+ location. (The user may override via an overlay-declared `paths.designs_dir`, but the default is
182
+ deterministic.)
183
+ **When invoked from `/prd` (since v3.22.0), prefix the chosen relative path with `WORKING_DIRECTORY` — see the "Working Directory" section near the top of this file.** Concrete absolute target (prd-workflow case): `<WORKING_DIRECTORY>/<paths.prd_dir>/<slug>/design.html`.
165
184
  2. Extract UI Element Inventory (sprint contract).
166
185
  3. Update state file with chosen option, design decisions, component lists.
167
186
  4. Clean up `/tmp/prd-design-<slug>/`.
@@ -255,7 +274,7 @@ Provide: triggering action, affected element, desired feedback, accessibility re
255
274
 
256
275
  | Skill | When |
257
276
  |-------|------|
258
- | `huashu-design` | **MANDATORY in Step C** — HTML prototype engine, App Prototype shell, Tweaks, Playwright validation, MP4/GIF export |
277
+ | `huashu-design` | **OPTIONAL in Step C** (user-installed, not shipped) — HTML prototype engine, App Prototype shell, Tweaks, Playwright validation, MP4/GIF export. If installed, use it; else generate HTML mockups directly with a notice |
259
278
  | `ui-ux-pro-max` | Before substantial design for design intelligence |
260
279
  | `frontend-design` | To translate design into production code |
261
280
  | `webapp-testing` | For browser verification with Playwright |
@@ -123,12 +123,14 @@ System SSOT is a first-class test dimension:
123
123
  2. Write assertions that reflect component doc expectations — variant-specific classes,
124
124
  required props, accessibility attributes. Example: a "primary" button test should assert
125
125
  the tokens / classes the component doc defines for that variant.
126
- 3. For merchant-themed surfaces, validate token pairs from
127
- `the project's theming pattern doc (listed in `.baldart/overlays/ui-design.md`)` (bg + matching text token) rather than
126
+ 3. For themed surfaces (when `features.multi_tenant_theming: true`), validate token pairs from the
127
+ project's theming pattern doc `${paths.design_system}/patterns/<theme>.md` (the exact filename is
128
+ declared in `.baldart/overlays/ui-design.md`) — asserting bg + matching text token rather than
128
129
  specific hex.
129
130
  4. Motion-sensitive screens MUST include a reduced-motion pass (emulate via
130
- `page.emulate_media(reduced_motion='reduce')`) per
131
- `the project's motion pattern doc (listed in `.baldart/overlays/ui-design.md`)`.
131
+ `page.emulate_media(reduced_motion='reduce')`) per the project's motion pattern doc —
132
+ `${paths.design_system}/patterns/animations.md` (or the motion doc declared in
133
+ `.baldart/overlays/ui-design.md`).
132
134
 
133
135
  ## Best Practices
134
136