qualia-framework 4.3.0 → 4.5.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 (42) hide show
  1. package/CLAUDE.md +13 -1
  2. package/README.md +16 -13
  3. package/agents/builder.md +12 -20
  4. package/agents/plan-checker.md +18 -0
  5. package/agents/planner.md +9 -0
  6. package/agents/verifier.md +62 -0
  7. package/bin/agent-runs.js +233 -0
  8. package/bin/cli.js +225 -21
  9. package/bin/install.js +25 -5
  10. package/bin/plan-contract.js +220 -0
  11. package/bin/slop-detect.mjs +357 -0
  12. package/bin/state.js +199 -10
  13. package/docs/agent-runs.md +273 -0
  14. package/docs/erp-contract.md +5 -0
  15. package/docs/plan-contract.md +321 -0
  16. package/hooks/auto-update.js +3 -7
  17. package/hooks/pre-compact.js +22 -11
  18. package/hooks/pre-deploy-gate.js +16 -2
  19. package/hooks/pre-push.js +22 -2
  20. package/hooks/stop-session-log.js +1 -1
  21. package/package.json +8 -2
  22. package/rules/design-brand.md +110 -0
  23. package/rules/design-laws.md +144 -0
  24. package/rules/design-product.md +110 -0
  25. package/rules/design-rubric.md +153 -0
  26. package/skills/qualia-build/SKILL.md +5 -5
  27. package/skills/qualia-flush/SKILL.md +1 -1
  28. package/skills/qualia-new/SKILL.md +40 -3
  29. package/skills/qualia-polish/SKILL.md +180 -136
  30. package/skills/qualia-quick/SKILL.md +1 -1
  31. package/skills/qualia-report/SKILL.md +25 -5
  32. package/skills/qualia-ship/SKILL.md +12 -10
  33. package/skills/zoho-workflow/SKILL.md +64 -0
  34. package/templates/DESIGN.md +229 -435
  35. package/templates/PRODUCT.md +95 -0
  36. package/templates/help.html +13 -7
  37. package/tests/bin.test.sh +6 -3
  38. package/tests/hooks.test.sh +9 -20
  39. package/tests/lib.test.sh +217 -0
  40. package/tests/runner.js +96 -75
  41. package/tests/state.test.sh +4 -3
  42. package/skills/qualia-design/SKILL.md +0 -169
@@ -788,7 +788,7 @@ echo "close-milestone:"
788
788
 
789
789
  # 44. close-milestone increments counters and bumps milestone number
790
790
  TMP=$(make_project)
791
- OUT=$(cd "$TMP" && $NODE "$STATE_JS" close-milestone 2>&1)
791
+ OUT=$(cd "$TMP" && $NODE "$STATE_JS" close-milestone --force 2>&1)
792
792
  EXIT=$?
793
793
  if [ "$EXIT" -eq 0 ] \
794
794
  && echo "$OUT" | grep -q '"action": "close-milestone"' \
@@ -803,7 +803,7 @@ fi
803
803
 
804
804
  # 45. close-milestone adds total_phases to lifetime.total_phases
805
805
  TMP=$(make_project)
806
- (cd "$TMP" && $NODE "$STATE_JS" close-milestone >/dev/null 2>&1)
806
+ (cd "$TMP" && $NODE "$STATE_JS" close-milestone --force >/dev/null 2>&1)
807
807
  # Project had 2 phases. lifetime.total_phases should now be 2.
808
808
  if grep -q '"total_phases": 2' "$TMP/.planning/tracking.json" | head -1; then
809
809
  # More precise check with node
@@ -829,11 +829,12 @@ touch "$TMP/.planning/phase-1-verification.md"
829
829
  (cd "$TMP" && $NODE "$STATE_JS" transition --to built --tasks-done 4 --tasks-total 4 >/dev/null 2>&1)
830
830
  (cd "$TMP" && $NODE "$STATE_JS" transition --to verified --verification pass >/dev/null 2>&1)
831
831
  # Now close milestone
832
- (cd "$TMP" && $NODE "$STATE_JS" close-milestone >/dev/null 2>&1)
832
+ (cd "$TMP" && $NODE "$STATE_JS" close-milestone --force >/dev/null 2>&1)
833
833
  # Re-init with new phases
834
834
  (cd "$TMP" && $NODE "$STATE_JS" init \
835
835
  --project "TestProject" \
836
836
  --phases '[{"name":"M2P1","goal":"G1"}]' \
837
+ --force \
837
838
  >/dev/null 2>&1)
838
839
  # Verify: milestone=2, lifetime preserved, current phase reset
839
840
  RESULT=$($NODE -e "
@@ -1,169 +0,0 @@
1
- ---
2
- name: qualia-design
3
- description: "One-shot design transformation — critiques, fixes, polishes, hardens, makes responsive. No reports, no choices, just makes it professional. Trigger on 'fix the design', 'make it look better', 'redesign', 'design pass', 'make it modern', 'it looks ugly', 'fix the UI'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - Grep
10
- - Glob
11
- - Agent
12
- ---
13
-
14
- # /qualia-design — One-Shot Design Transformation
15
-
16
- Read the code, understand what's wrong, fix everything, move on. No reports, no choices.
17
-
18
- ## Usage
19
-
20
- - `/qualia-design` — Full transformation on all frontend files
21
- - `/qualia-design app/page.tsx` — Specific file(s)
22
- - `/qualia-design --scope=dashboard` — Transform a section
23
-
24
- ## Process
25
-
26
- ```bash
27
- node ~/.claude/bin/qualia-ui.js banner design
28
- ```
29
-
30
- ### 1. Read Brand Context
31
-
32
- ```bash
33
- cat .planning/DESIGN.md 2>/dev/null || echo "NO_DESIGN"
34
- ```
35
-
36
- If DESIGN.md exists → it is law. Use exact values from sections 1-9 (Visual Theme, Color Palette, Typography, Components, Layout, Depth, Do's/Don'ts, Responsive, Agent Prompt Guide). If not → use Qualia defaults from `rules/frontend.md`: distinctive fonts, sharp accents, layered backgrounds, no card grids, no blue-purple gradients, full-width layouts.
37
-
38
- ### 2. Find Target Files
39
-
40
- - If specific files given: use those
41
- - If `--scope`: grep for matching files in `app/` and `components/`
42
- - If none: find all `page.tsx`, `layout.tsx`, and component files
43
-
44
- Count them. If ≤ 5, process in main context (step 3a). If > 5, fan out to parallel agents (step 3b).
45
-
46
- ### 3a. Small File Set (≤ 5 files) — main context
47
-
48
- Read EVERY target file before modifying. Critique internally using the structured rubric below, then fix everything (step 4).
49
-
50
- **Critique rubric (required — produces the findings you then fix):**
51
-
52
- | File | Dimension | Issue | Line | Severity |
53
- |------|-----------|-------|------|----------|
54
- | {path} | Typography/Color/Spacing/States/Responsive/A11y/Motion/Microcopy | {specific problem with quote} | {N} | CRITICAL/HIGH/MEDIUM/LOW |
55
-
56
- Apply fixes to every HIGH and CRITICAL item. MEDIUM items fixed if cheap (same file, same category).
57
-
58
- ### 3b. Large File Set (> 5 files) — parallel fan-out
59
-
60
- Split target files into batches of 5. Spawn one Agent per batch IN THE SAME RESPONSE TURN (parallel execution). Each agent receives DESIGN.md inlined + its 5 files + the Design Quality Rubric from `rules/grounding.md`. Agents return their batch's critique table + the actual edits applied. The skill orchestrator fans in the results and runs the final verification (step 5).
61
-
62
- **Forked subagents (v4.2.0+):** if the current conversation already contains
63
- design taste discussion (font choices, palette discussion, motion preferences,
64
- or any color/typography critique threaded across multiple turns) AND
65
- `CLAUDE_AGENT_FORK_ENABLED=1` is set in `~/.claude/settings.json` (the v4.2.0
66
- default), prefer **forked subagents** over blank-context fan-out. Forks
67
- inherit the entire conversation history + share the prompt cache, so the
68
- batch agents see the 50k tokens of accumulated taste instead of a 2k-token
69
- compression. Anthropic shipped this in 2026-04 specifically to solve the
70
- "design subagent loses nuance" failure mode (NotebookLM 2026-04-25 source).
71
- Tell Claude explicitly: "spawn forked subagents to handle these batches in
72
- parallel." For variation-generation work (3 alternative homepage designs)
73
- forks are almost always the right call. For mechanical anti-pattern fixes
74
- (rip out `outline:none`, swap font tokens) blank context is fine — no
75
- nuance to inherit. When in doubt, fork — the cost is the same prompt cache.
76
-
77
- ```
78
- Agent(prompt="
79
- Read your role: builder for design transformation.
80
- Grounding + rubrics: @~/.claude/rules/grounding.md
81
-
82
- <design_system>
83
- {inlined DESIGN.md}
84
- </design_system>
85
-
86
- <target_files>
87
- {5 file paths + their contents}
88
- </target_files>
89
-
90
- Apply the Design Quality Rubric to each file. Fix every dimension scoring below 4. Make the literal edits with the Edit tool. Do NOT change logic — only styling.
91
-
92
- Return:
93
- - Critique table (File | Dimension | Issue | Line | Before-score | After-score)
94
- - List of files modified
95
- - Any anti-pattern greps that remain (report, don't fix beyond scope)
96
- ", subagent_type="general-purpose", description="Design batch {N}")
97
- ```
98
-
99
- Do not process files serially in main context — that's what wastes a context window.
100
-
101
- ### 4. Fix Everything (applies to step 3a OR to each agent in 3b)
102
-
103
- Use exact values from DESIGN.md when available. Sections map to fixes:
104
-
105
- **Typography (§3):** Apply fonts from hierarchy table. Replace any generic fonts (Inter, Arial) with project fonts. Use exact weights, sizes, letter-spacing from the table. Body line-height 1.5-1.7.
106
-
107
- **Color (§2):** Apply palette from CSS variables. Replace scattered hex values with `var(--color-*)`. Verify contrast ratios listed in DESIGN.md.
108
-
109
- **Components (§4):** Match button, card, input, badge specs exactly — padding, radius, shadow, hover states.
110
-
111
- **Layout (§5):** Full-width with fluid padding `clamp(1rem, 5vw, 4rem)`. Apply spacing scale. NO hardcoded max-width caps. Prose gets `max-width: 65ch`.
112
-
113
- **Depth (§6):** Apply shadow levels from elevation table. Use brand-tinted shadows, not neutral gray.
114
-
115
- **Motion (§Motion):** CSS transitions 200-300ms on hover/focus. Staggered entrance animations. `prefers-reduced-motion` respected.
116
-
117
- **States:** Loading skeleton/spinner on async ops. Error states on data fetches. Empty states on lists. Hover/focus/active/disabled on every interactive element.
118
-
119
- **Responsive (§8):** Apply collapsing strategy from table. Mobile-first. Touch targets 44x44px min. No horizontal scroll.
120
-
121
- **Anti-Slop (§12):** Run grep patterns from the detection table. Every match = mandatory fix.
122
-
123
- **Kill:** Card grids → varied layouts. Generic heroes → distinctive. Blue-purple gradients → brand colors. Static pages → purposeful motion. Fixed widths → fluid.
124
-
125
- ### 5. Verify
126
-
127
- Parallel batch — run these in a single response turn:
128
-
129
- ```bash
130
- # TypeScript still compiles?
131
- npx tsc --noEmit 2>&1 | head -20
132
-
133
- # Reverted anti-patterns (any match = regression)
134
- grep -rn "outline.*none\|outline-none" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null | grep -v "focus-visible\|focus:"
135
- grep -rn "font-family.*Inter\|font-family.*Arial\|font-family.*system-ui\|Space Grotesk" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null
136
- grep -rn "max-w-\[1200\|max-w-\[1280\|max-width.*1200\|max-w-7xl" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null
137
- grep -rn "<img " --include="*.tsx" app/ components/ src/ 2>/dev/null | grep -v "alt="
138
- grep -rn "from-blue.*to-purple\|from-purple.*to-blue" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null
139
- ```
140
-
141
- Fix any TypeScript errors before committing. If any anti-pattern grep returned matches, re-fix those files — the transformation is not complete until these greps return empty.
142
-
143
- ### 6. Commit
144
-
145
- ```bash
146
- git add {modified files}
147
- git commit -m "style: design transformation"
148
- ```
149
-
150
- ```
151
- ⬢ Design Transformation Complete
152
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
153
- Files: {N}
154
- Changes:
155
- - {key change 1}
156
- - {key change 2}
157
- - {key change 3}
158
-
159
- Next: /qualia-polish (final pass) · /qualia-review (scored audit)
160
- ```
161
-
162
- ## Rules
163
-
164
- - Read before write — understand every file before changing it
165
- - Don't ask — just fix
166
- - Respect DESIGN.md decisions
167
- - Don't break functionality — only change styling, never logic
168
- - TypeScript must pass after changes
169
- - All anti-pattern greps in step 5 must return empty before commit