qualia-framework 3.1.0 → 3.2.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.
- package/CLAUDE.md +4 -3
- package/README.md +5 -10
- package/agents/planner.md +0 -52
- package/agents/verifier.md +32 -180
- package/bin/cli.js +9 -403
- package/bin/install.js +61 -113
- package/bin/qualia-ui.js +15 -0
- package/bin/state.js +6 -200
- package/bin/statusline.js +4 -4
- package/hooks/auto-update.js +30 -8
- package/hooks/branch-guard.js +2 -23
- package/hooks/migration-guard.js +0 -23
- package/hooks/pre-compact.js +0 -20
- package/hooks/pre-deploy-gate.js +0 -39
- package/hooks/pre-push.js +0 -20
- package/hooks/session-start.js +44 -0
- package/package.json +4 -5
- package/skills/qualia/SKILL.md +0 -1
- package/skills/qualia-build/SKILL.md +0 -18
- package/skills/qualia-design/SKILL.md +8 -14
- package/skills/qualia-learn/SKILL.md +4 -27
- package/skills/qualia-optimize/SKILL.md +417 -0
- package/skills/qualia-polish/SKILL.md +117 -167
- package/skills/qualia-report/SKILL.md +8 -17
- package/skills/qualia-review/SKILL.md +41 -126
- package/skills/qualia-verify/SKILL.md +1 -1
- package/templates/DESIGN.md +102 -440
- package/templates/plan.md +0 -14
- package/tests/bin.test.sh +6 -20
- package/tests/hooks.test.sh +7 -76
- package/tests/state.test.sh +11 -189
- package/docs/erp-contract.md +0 -161
- package/hooks/block-env-edit.js +0 -52
- package/rules/infrastructure.md +0 -87
- package/skills/qualia-help/SKILL.md +0 -60
- package/skills/qualia-test/SKILL.md +0 -134
- package/templates/help.html +0 -476
- package/tests/runner.js +0 -1956
package/rules/infrastructure.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
globs: ["*.env*", "vercel.json", "next.config.*", "supabase/**", "railway.*"]
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Infrastructure & Services
|
|
6
|
-
|
|
7
|
-
Standard services across all Qualia projects. Use these unless the project explicitly specifies otherwise.
|
|
8
|
-
|
|
9
|
-
## Database: Supabase (every project)
|
|
10
|
-
- Every project uses Supabase for auth, database, and storage
|
|
11
|
-
- **CLI:** `npx supabase` — migrations, type generation, local dev
|
|
12
|
-
- **MCP:** Supabase MCP server is available in Claude Code for direct database operations
|
|
13
|
-
- Always enable RLS on every table (see `rules/security.md`)
|
|
14
|
-
- Use `lib/supabase/server.ts` for server-side, `lib/supabase/client.ts` for client-side
|
|
15
|
-
- Run `npx supabase gen types` after schema changes
|
|
16
|
-
- Migrations go in `supabase/migrations/` — never edit production directly
|
|
17
|
-
|
|
18
|
-
## AI Models: OpenRouter (every project)
|
|
19
|
-
- Use OpenRouter API for all LLM calls — it routes to the best-suited model per task
|
|
20
|
-
- API key env var: `OPENROUTER_API_KEY`
|
|
21
|
-
- Don't have a key? Ask Fawzi for one
|
|
22
|
-
- Never hardcode a specific model provider (OpenAI, Anthropic, etc.) directly — always go through OpenRouter
|
|
23
|
-
- Exception: if a client specifically requires a direct provider integration
|
|
24
|
-
|
|
25
|
-
## Voice AI: Retell AI + ElevenLabs
|
|
26
|
-
- **Retell AI** — primary voice agent platform. API key: `RETELL_API_KEY`
|
|
27
|
-
- **ElevenLabs** — voice synthesis, cloning, streaming. API key: `ELEVENLABS_API_KEY`
|
|
28
|
-
- **Telnyx** — telephony/SIP for voice agent phone numbers. API key: `TELNYX_API_KEY`
|
|
29
|
-
- For new voice projects, default to Retell AI + ElevenLabs unless client specifies otherwise
|
|
30
|
-
|
|
31
|
-
## Compute: Vercel + Railway
|
|
32
|
-
- **Vercel** — primary hosting for all Next.js projects. Deploy via CLI only (see below)
|
|
33
|
-
- **Railway** — secondary compute for long-running agents, background jobs, and agentic workloads that exceed Vercel's function timeout
|
|
34
|
-
- **Railway CLI:** `railway` — deploy, logs, env management
|
|
35
|
-
- **Railway MCP:** Railway MCP server is available in Claude Code for project management
|
|
36
|
-
- Railway projects use Nixpacks (auto-detected) — check for `railway.json` or `railway.toml`
|
|
37
|
-
|
|
38
|
-
## MCP Servers (available in Claude Code)
|
|
39
|
-
- **Supabase MCP** — database queries, table management, migrations from within Claude Code
|
|
40
|
-
- **Railway MCP** — project deployment, logs, environment variables from within Claude Code
|
|
41
|
-
- **next-devtools MCP** — runtime error visibility for Next.js 16+ dev servers (optional, added by framework install)
|
|
42
|
-
|
|
43
|
-
## CLIs (must be installed)
|
|
44
|
-
- `npx supabase` — Supabase CLI (database, migrations, types)
|
|
45
|
-
- `railway` — Railway CLI (deploy, logs, env)
|
|
46
|
-
- `vercel` — Vercel CLI (deploy, env, link)
|
|
47
|
-
- `gh` — GitHub CLI (PRs, issues, repos)
|
|
48
|
-
|
|
49
|
-
## GitHub Organizations
|
|
50
|
-
- **QualiasolutionsCY** — primary org for all Qualia Solutions projects
|
|
51
|
-
- **SakaniQualia** — org for Sakani-related projects (real estate platform)
|
|
52
|
-
- All repos are private by default
|
|
53
|
-
- Branch protection: main/master require PR reviews (enforced by framework guards)
|
|
54
|
-
|
|
55
|
-
## Vercel Teams (admin knowledge)
|
|
56
|
-
- Qualia operates across **3 Vercel teams** — projects are distributed across them
|
|
57
|
-
- Check which team a project belongs to before deploying: `vercel whoami` and `vercel link`
|
|
58
|
-
- If a project isn't linked, link it first: `vercel link`
|
|
59
|
-
|
|
60
|
-
## Deployment Rules
|
|
61
|
-
- **NO auto-deploys from GitHub pushes** — all Vercel projects have GitHub integration auto-deploy DISABLED
|
|
62
|
-
- Deploys happen ONLY via `vercel --prod` through the CLI (or `/qualia-ship`)
|
|
63
|
-
- This is intentional — we control when things go live, not git push triggers
|
|
64
|
-
- If you find a project with auto-deploy enabled, disable it: Vercel Dashboard → Project Settings → Git → Disable "Automatic Deployments"
|
|
65
|
-
|
|
66
|
-
## Required Environment Variables (typical project)
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
# Supabase (every project)
|
|
70
|
-
NEXT_PUBLIC_SUPABASE_URL=
|
|
71
|
-
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
|
|
72
|
-
SUPABASE_SERVICE_ROLE_KEY= # NEVER in client code
|
|
73
|
-
|
|
74
|
-
# AI (if applicable)
|
|
75
|
-
OPENROUTER_API_KEY= # ask Fawzi if you don't have one
|
|
76
|
-
|
|
77
|
-
# Voice (if applicable)
|
|
78
|
-
RETELL_API_KEY=
|
|
79
|
-
ELEVENLABS_API_KEY=
|
|
80
|
-
TELNYX_API_KEY=
|
|
81
|
-
|
|
82
|
-
# Deployment
|
|
83
|
-
VERCEL_ORG_ID= # from vercel link
|
|
84
|
-
VERCEL_PROJECT_ID= # from vercel link
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Always use `vercel env pull` to sync env vars locally. Never create `.env` manually from scratch.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: qualia-help
|
|
3
|
-
description: "Open the Qualia Framework reference guide in the browser. A beautiful themed HTML page with all commands, rules, services, and the road. Trigger on 'help', 'how does this work', 'show me the commands', 'qualia help', 'reference'."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /qualia-help — Framework Reference
|
|
7
|
-
|
|
8
|
-
Opens a Qualia-themed HTML reference guide in your default browser.
|
|
9
|
-
|
|
10
|
-
## Process
|
|
11
|
-
|
|
12
|
-
### 1. Generate the HTML
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Read the template and inject the current version
|
|
16
|
-
VERSION=$(node -e "console.log(require(require('os').homedir() + '/.claude/.qualia-config.json').version || 'v3')" 2>/dev/null || echo "v3")
|
|
17
|
-
TEMPLATE="$HOME/.claude/qualia-templates/help.html"
|
|
18
|
-
OUTPUT="/tmp/qualia-help.html"
|
|
19
|
-
|
|
20
|
-
# If template doesn't exist, check the framework install
|
|
21
|
-
if [ ! -f "$TEMPLATE" ]; then
|
|
22
|
-
TEMPLATE="$(dirname "$(dirname "$(which qualia-framework 2>/dev/null || echo '')")")/templates/help.html"
|
|
23
|
-
fi
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### 2. Inject version and open
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
# Replace {{VERSION}} placeholder with actual version
|
|
30
|
-
sed "s/{{VERSION}}/$VERSION/g" "$TEMPLATE" > "$OUTPUT"
|
|
31
|
-
|
|
32
|
-
# Open in default browser (cross-platform)
|
|
33
|
-
if command -v xdg-open &>/dev/null; then
|
|
34
|
-
xdg-open "$OUTPUT" # Linux
|
|
35
|
-
elif command -v open &>/dev/null; then
|
|
36
|
-
open "$OUTPUT" # macOS
|
|
37
|
-
elif command -v start &>/dev/null; then
|
|
38
|
-
start "$OUTPUT" # Windows (Git Bash)
|
|
39
|
-
else
|
|
40
|
-
echo "Open this file in your browser: $OUTPUT"
|
|
41
|
-
fi
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### 3. Confirm
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
node ~/.claude/bin/qualia-ui.js banner router
|
|
48
|
-
node ~/.claude/bin/qualia-ui.js ok "Reference guide opened in browser"
|
|
49
|
-
node ~/.claude/bin/qualia-ui.js info "File: /tmp/qualia-help.html"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
If the browser does not open automatically, tell the user the file path so they can open it manually.
|
|
53
|
-
|
|
54
|
-
## Notes
|
|
55
|
-
|
|
56
|
-
- The HTML file is self-contained — no external dependencies except Google Fonts
|
|
57
|
-
- Works offline after first load (fonts cache)
|
|
58
|
-
- Qualia-themed: dark background, teal accents, Outfit + Inter fonts
|
|
59
|
-
- Shows: The Road, all commands grouped, verification scoring, rules, stack, GitHub orgs
|
|
60
|
-
- Version is injected dynamically from .qualia-config.json
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: qualia-test
|
|
3
|
-
description: "Generate or run tests for client projects. Trigger on 'write tests', 'add tests', 'test this', 'run tests', 'test coverage', 'need tests for'."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /qualia-test — Test Generator
|
|
7
|
-
|
|
8
|
-
Generate tests for client project code. Detect framework, classify targets, write tests, run them.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
- `/qualia-test` — Generate tests for recently changed files
|
|
13
|
-
- `/qualia-test {file}` — Generate tests for a specific file
|
|
14
|
-
- `/qualia-test --run` — Run existing tests and report
|
|
15
|
-
- `/qualia-test --coverage` — Run with coverage report
|
|
16
|
-
|
|
17
|
-
## Process
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
node ~/.claude/bin/qualia-ui.js banner test
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### 1. Detect Test Framework
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
node -e "
|
|
27
|
-
const p=JSON.parse(require('fs').readFileSync('package.json','utf8'));
|
|
28
|
-
const d={...p.dependencies,...p.devDependencies};
|
|
29
|
-
console.log(JSON.stringify({
|
|
30
|
-
vitest: !!d.vitest,
|
|
31
|
-
jest: !!d.jest,
|
|
32
|
-
playwright: !!d['@playwright/test'],
|
|
33
|
-
testing_library: !!d['@testing-library/react']
|
|
34
|
-
}))
|
|
35
|
-
"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If no test framework found, install vitest (lighter than jest for Next.js/Vite):
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install -D vitest @testing-library/react @testing-library/jest-dom jsdom
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Add to `vitest.config.ts` if it doesn't exist:
|
|
45
|
-
```typescript
|
|
46
|
-
import { defineConfig } from 'vitest/config'
|
|
47
|
-
import react from '@vitejs/plugin-react'
|
|
48
|
-
|
|
49
|
-
export default defineConfig({
|
|
50
|
-
plugins: [react()],
|
|
51
|
-
test: {
|
|
52
|
-
environment: 'jsdom',
|
|
53
|
-
setupFiles: ['./vitest.setup.ts'],
|
|
54
|
-
},
|
|
55
|
-
})
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 2. Find Targets
|
|
59
|
-
|
|
60
|
-
If specific file given → use that.
|
|
61
|
-
If `--run` → skip to step 4.
|
|
62
|
-
Otherwise find recently changed untested files:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
# Files changed in last 5 commits that don't have tests
|
|
66
|
-
git diff --name-only HEAD~5 --diff-filter=AM -- '*.ts' '*.tsx' 2>/dev/null | grep -v "test\|spec\|__test__\|\.d\.ts" | head -10
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### 3. Generate Tests
|
|
70
|
-
|
|
71
|
-
For each target file, classify it and generate the appropriate test:
|
|
72
|
-
|
|
73
|
-
**API route** (`app/api/**/route.ts`):
|
|
74
|
-
- Test each exported handler (GET, POST, PUT, DELETE)
|
|
75
|
-
- Test with valid input → expected response
|
|
76
|
-
- Test with invalid input → 400 error
|
|
77
|
-
- Test without auth → 401 (if auth is required)
|
|
78
|
-
|
|
79
|
-
**Server action** (has `"use server"`):
|
|
80
|
-
- Test each exported function
|
|
81
|
-
- Test with valid args → expected result
|
|
82
|
-
- Test with invalid args → error handling
|
|
83
|
-
|
|
84
|
-
**React component** (`*.tsx` with JSX):
|
|
85
|
-
- Test rendering without crashing
|
|
86
|
-
- Test interactive elements (clicks, form submissions)
|
|
87
|
-
- Test loading, error, and empty states if they exist
|
|
88
|
-
- Test accessibility (role, aria-label presence)
|
|
89
|
-
|
|
90
|
-
**Utility function** (`lib/*.ts`, `utils/*.ts`):
|
|
91
|
-
- Test each exported function with normal input
|
|
92
|
-
- Test edge cases: empty, null, undefined, boundary values
|
|
93
|
-
- Test error cases: invalid input, missing data
|
|
94
|
-
|
|
95
|
-
Write test file next to the source: `{file}.test.ts` or `{file}.test.tsx`.
|
|
96
|
-
|
|
97
|
-
### 4. Run Tests
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# Vitest
|
|
101
|
-
npx vitest run --reporter=verbose 2>&1 | tail -30
|
|
102
|
-
|
|
103
|
-
# Or Jest
|
|
104
|
-
npx jest --verbose 2>&1 | tail -30
|
|
105
|
-
|
|
106
|
-
# Coverage (if --coverage flag)
|
|
107
|
-
npx vitest run --coverage 2>&1 | tail -30
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 5. Report
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
node ~/.claude/bin/qualia-ui.js divider
|
|
114
|
-
node ~/.claude/bin/qualia-ui.js info "Files tested: {N}"
|
|
115
|
-
node ~/.claude/bin/qualia-ui.js ok "Passing: {pass}/{total}"
|
|
116
|
-
node ~/.claude/bin/qualia-ui.js end "TESTS DONE"
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
If any tests fail, show the failures and offer to fix them.
|
|
120
|
-
|
|
121
|
-
### 6. Commit
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
git add {test files}
|
|
125
|
-
git commit -m "test: add tests for {files}"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Rules
|
|
129
|
-
|
|
130
|
-
1. **Test behavior, not implementation.** Don't test internal state — test what the user/caller sees.
|
|
131
|
-
2. **No snapshot tests.** They're brittle and meaningless.
|
|
132
|
-
3. **No mocking unless necessary.** Test real behavior. Mock only external services (APIs, databases).
|
|
133
|
-
4. **Each test file is self-contained.** No shared mutable state between tests.
|
|
134
|
-
5. **Name tests as sentences.** `it("returns 401 when user is not authenticated")` not `it("test auth")`.
|