qualia-framework-v2 2.1.2 → 2.4.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/README.md CHANGED
@@ -12,6 +12,12 @@ npx qualia-framework-v2 install
12
12
 
13
13
  Enter your team code when prompted. Get your code from Fawzi.
14
14
 
15
+ **Other commands:**
16
+ ```bash
17
+ npx qualia-framework-v2 version # Check installed version + updates
18
+ npx qualia-framework-v2 update # Update to latest (remembers your code)
19
+ ```
20
+
15
21
  ## Usage
16
22
 
17
23
  Open Claude Code in any project directory:
@@ -19,18 +25,29 @@ Open Claude Code in any project directory:
19
25
  ```
20
26
  /qualia-new # Set up a new project
21
27
  /qualia # What should I do next?
28
+ /qualia-idk # I'm stuck — smart advisor
22
29
  /qualia-plan # Plan the current phase
23
- /qualia-build # Build it
24
- /qualia-verify # Verify it works
25
- /qualia-ship # Deploy
26
- /qualia-report # Log your work
30
+ /qualia-build # Build it (parallel tasks)
31
+ /qualia-verify # Verify it actually works
32
+ /qualia-design # One-shot design transformation
33
+ /qualia-debug # Structured debugging
34
+ /qualia-review # Production audit
35
+ /qualia-quick # Skip planning, just do it
36
+ /qualia-task # Build one thing properly
37
+ /qualia-polish # Design and UX pass
38
+ /qualia-ship # Deploy to production
39
+ /qualia-handoff # Deliver to client
40
+ /qualia-pause # Save session, continue later
41
+ /qualia-resume # Pick up where you left off
42
+ /qualia-learn # Save a pattern, fix, or client pref
43
+ /qualia-report # Log your work (mandatory)
27
44
  ```
28
45
 
29
46
  See `guide.md` for the full developer guide.
30
47
 
31
48
  ## What's Inside
32
49
 
33
- - **11 skills** — slash commands that guide you from setup to handoff
50
+ - **18 skills** — slash commands from setup to handoff, plus debugging, design, review, knowledge, and session management
34
51
  - **3 agents** — planner, builder, verifier (each in fresh context)
35
52
  - **7 hooks** — branch guard, pre-push tracking sync, env protection, migration guard, deploy gate, pre-compact state save, session start
36
53
  - **3 rules** — security, frontend, deployment
@@ -56,6 +73,10 @@ The `settings.json` hooks are real ops engineering, not theoretical:
56
73
  - **Env block** — Prevents Claude from touching `.env` files
57
74
  - **Pre-compact** — Saves state before context compression
58
75
 
76
+ ### Enforced State Machine
77
+
78
+ Every workflow step calls `state.js` — a Node.js state machine that validates preconditions, updates both STATE.md and tracking.json atomically, and tracks gap-closure cycles. You can't build without planning, can't verify without building, and can't loop on gap-closure more than twice before escalating.
79
+
59
80
  ### Wave-Based Parallelization
60
81
 
61
82
  Plans are grouped into waves for parallel execution. No fancy DAG solver — the planner assigns wave numbers, the orchestrator spawns agents per wave. Pragmatic over clever.
@@ -71,9 +92,11 @@ npx qualia-framework-v2 install
71
92
  |
72
93
  v
73
94
  ~/.claude/
74
- ├── skills/ 11 slash commands
95
+ ├── skills/ 18 slash commands
75
96
  ├── agents/ planner.md, builder.md, verifier.md
76
97
  ├── hooks/ 7 shell scripts (branch, env, migration, deploy, push, compact, session)
98
+ ├── bin/ state.js (state machine with precondition enforcement)
99
+ ├── knowledge/ learned-patterns.md, common-fixes.md, client-prefs.md
77
100
  ├── rules/ security.md, frontend.md, deployment.md
78
101
  ├── qualia-templates/ tracking.json, state.md, project.md, plan.md
79
102
  ├── CLAUDE.md global instructions (role-configured per team member)
package/bin/cli.js CHANGED
@@ -1,20 +1,148 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const { execSync } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
3
7
  const TEAL = "\x1b[38;2;0;206;209m";
8
+ const TG = "\x1b[38;2;0;170;175m";
4
9
  const DIM = "\x1b[38;2;80;90;100m";
10
+ const GREEN = "\x1b[38;2;52;211;153m";
5
11
  const WHITE = "\x1b[38;2;220;225;230m";
12
+ const YELLOW = "\x1b[38;2;234;179;8m";
13
+ const RED = "\x1b[38;2;239;68;68m";
6
14
  const RESET = "\x1b[0m";
15
+ const BOLD = "\x1b[1m";
7
16
 
8
- const cmd = process.argv[2];
17
+ const CLAUDE_DIR = path.join(require("os").homedir(), ".claude");
18
+ const PKG = require("../package.json");
19
+ const CONFIG_FILE = path.join(CLAUDE_DIR, ".qualia-config.json");
20
+
21
+ function readConfig() {
22
+ try {
23
+ return JSON.parse(fs.readFileSync(CONFIG_FILE, "utf8"));
24
+ } catch {
25
+ return {};
26
+ }
27
+ }
28
+
29
+ function writeConfig(cfg) {
30
+ if (!fs.existsSync(CLAUDE_DIR)) fs.mkdirSync(CLAUDE_DIR, { recursive: true });
31
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2) + "\n");
32
+ }
33
+
34
+ function banner() {
35
+ console.log("");
36
+ console.log(` ${TEAL}${BOLD}◆${RESET} ${WHITE}${BOLD}Qualia Framework${RESET} ${DIM}v${PKG.version}${RESET}`);
37
+ console.log(` ${DIM}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}`);
38
+ }
9
39
 
10
- if (cmd === "install") {
40
+ // ─── Commands ────────────────────────────────────────────
41
+
42
+ function cmdInstall() {
11
43
  require("./install.js");
12
- } else {
44
+ }
45
+
46
+ function cmdVersion() {
47
+ banner();
48
+ const cfg = readConfig();
49
+
50
+ console.log(` ${DIM}Installed:${RESET} ${WHITE}${PKG.version}${RESET}`);
51
+ if (cfg.installed_by) {
52
+ console.log(` ${DIM}User:${RESET} ${WHITE}${cfg.installed_by}${RESET} ${DIM}(${cfg.role})${RESET}`);
53
+ }
54
+ if (cfg.installed_at) {
55
+ console.log(` ${DIM}Date:${RESET} ${WHITE}${cfg.installed_at}${RESET}`);
56
+ }
57
+
58
+ // Check for updates
59
+ try {
60
+ const latest = execSync("npm view qualia-framework-v2 version 2>/dev/null", {
61
+ encoding: "utf8",
62
+ timeout: 5000,
63
+ }).trim();
64
+ const semverGt = (a, b) => {
65
+ const pa = a.split(".").map(Number), pb = b.split(".").map(Number);
66
+ for (let i = 0; i < 3; i++) { if (pa[i] > pb[i]) return true; if (pa[i] < pb[i]) return false; }
67
+ return false;
68
+ };
69
+ if (latest && semverGt(latest, PKG.version)) {
70
+ console.log("");
71
+ console.log(` ${YELLOW}Update available:${RESET} ${WHITE}${latest}${RESET}`);
72
+ console.log(` ${DIM}Run:${RESET} npx qualia-framework-v2 update`);
73
+ } else if (latest) {
74
+ console.log(` ${DIM}Latest:${RESET} ${GREEN}${latest} ✓${RESET} ${DIM}(up to date)${RESET}`);
75
+ }
76
+ } catch {
77
+ console.log(` ${DIM}Latest:${RESET} ${DIM}(offline — couldn't check)${RESET}`);
78
+ }
13
79
  console.log("");
14
- console.log(`${TEAL} ◆ Qualia Framework v2${RESET}`);
15
- console.log(`${DIM} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}`);
80
+ }
81
+
82
+ function cmdUpdate() {
83
+ banner();
84
+ const cfg = readConfig();
85
+
86
+ if (!cfg.code) {
87
+ console.log(` ${RED}✗${RESET} No install code saved. Run ${TEAL}install${RESET} first.`);
88
+ console.log("");
89
+ process.exit(1);
90
+ }
91
+
92
+ console.log(` ${DIM}Current:${RESET} ${WHITE}${PKG.version}${RESET}`);
93
+ console.log(` ${DIM}Updating...${RESET}`);
16
94
  console.log("");
17
- console.log(` ${WHITE}Usage:${RESET}`);
18
- console.log(` npx qualia-framework-v2 ${TEAL}install${RESET} Install the framework`);
95
+
96
+ try {
97
+ // Pull latest and reinstall with saved code
98
+ execSync(
99
+ `npx qualia-framework-v2@latest install <<< "${cfg.code}"`,
100
+ { stdio: "inherit", shell: true, timeout: 60000 }
101
+ );
102
+ } catch (e) {
103
+ console.log(` ${RED}✗${RESET} Update failed. Run manually: npx qualia-framework-v2@latest install`);
104
+ process.exit(1);
105
+ }
106
+ }
107
+
108
+ function cmdHelp() {
109
+ banner();
19
110
  console.log("");
111
+ console.log(` ${WHITE}Commands:${RESET}`);
112
+ console.log(` npx qualia-framework-v2 ${TEAL}install${RESET} Install or reinstall the framework`);
113
+ console.log(` npx qualia-framework-v2 ${TEAL}update${RESET} Update to the latest version`);
114
+ console.log(` npx qualia-framework-v2 ${TEAL}version${RESET} Show installed version + check for updates`);
115
+ console.log("");
116
+ console.log(` ${WHITE}After install:${RESET}`);
117
+ console.log(` ${TG}/qualia${RESET} What should I do next?`);
118
+ console.log(` ${TG}/qualia-new${RESET} Set up a new project`);
119
+ console.log(` ${TG}/qualia-plan${RESET} Plan a phase`);
120
+ console.log(` ${TG}/qualia-build${RESET} Build it (parallel tasks)`);
121
+ console.log(` ${TG}/qualia-verify${RESET} Verify it works`);
122
+ console.log(` ${TG}/qualia-design${RESET} One-shot design fix`);
123
+ console.log(` ${TG}/qualia-debug${RESET} Structured debugging`);
124
+ console.log(` ${TG}/qualia-review${RESET} Production audit`);
125
+ console.log(` ${TG}/qualia-ship${RESET} Deploy to production`);
126
+ console.log(` ${TG}/qualia-report${RESET} Log your work`);
127
+ console.log("");
128
+ }
129
+
130
+ // ─── Main ────────────────────────────────────────────────
131
+ const cmd = process.argv[2];
132
+
133
+ switch (cmd) {
134
+ case "install":
135
+ cmdInstall();
136
+ break;
137
+ case "version":
138
+ case "-v":
139
+ case "--version":
140
+ cmdVersion();
141
+ break;
142
+ case "update":
143
+ case "upgrade":
144
+ cmdUpdate();
145
+ break;
146
+ default:
147
+ cmdHelp();
20
148
  }
package/bin/install.js CHANGED
@@ -198,6 +198,20 @@ async function main() {
198
198
  warn(`CLAUDE.md — ${e.message}`);
199
199
  }
200
200
 
201
+ // ─── Scripts ─────────────────────────────────────────────
202
+ log(`${WHITE}Scripts${RESET}`);
203
+ try {
204
+ const binDest = path.join(CLAUDE_DIR, "bin");
205
+ if (!fs.existsSync(binDest)) fs.mkdirSync(binDest, { recursive: true });
206
+ copy(
207
+ path.join(FRAMEWORK_DIR, "bin", "state.js"),
208
+ path.join(binDest, "state.js")
209
+ );
210
+ ok("state.js (state machine)");
211
+ } catch (e) {
212
+ warn(`state.js — ${e.message}`);
213
+ }
214
+
201
215
  // ─── Guide ─────────────────────────────────────────────
202
216
  try {
203
217
  copy(
@@ -209,6 +223,36 @@ async function main() {
209
223
  warn(`guide.md — ${e.message}`);
210
224
  }
211
225
 
226
+ // ─── Knowledge directory ─────────────────────────────────
227
+ log(`${WHITE}Knowledge${RESET}`);
228
+ const knowledgeDir = path.join(CLAUDE_DIR, "knowledge");
229
+ if (!fs.existsSync(knowledgeDir)) fs.mkdirSync(knowledgeDir, { recursive: true });
230
+ const knowledgeFiles = {
231
+ "learned-patterns.md": "# Learned Patterns\n\nPatterns discovered across projects. Updated by `/qualia-evolve` and manual notes.\n",
232
+ "common-fixes.md": "# Common Fixes\n\nRecurring issues and their solutions.\n",
233
+ "client-prefs.md": "# Client Preferences\n\nClient-specific preferences, design choices, and requirements.\n",
234
+ };
235
+ for (const [name, defaultContent] of Object.entries(knowledgeFiles)) {
236
+ const dest = path.join(knowledgeDir, name);
237
+ if (!fs.existsSync(dest)) {
238
+ fs.writeFileSync(dest, defaultContent);
239
+ ok(`${name} (created)`);
240
+ } else {
241
+ ok(`${name} (exists)`);
242
+ }
243
+ }
244
+
245
+ // ─── Save config (for update command) ──────────────────
246
+ const configFile = path.join(CLAUDE_DIR, ".qualia-config.json");
247
+ const config = {
248
+ code,
249
+ installed_by: member.name,
250
+ role: member.role,
251
+ version: require("../package.json").version,
252
+ installed_at: new Date().toISOString().split("T")[0],
253
+ };
254
+ fs.writeFileSync(configFile, JSON.stringify(config, null, 2) + "\n");
255
+
212
256
  // ─── Configure settings.json ───────────────────────────
213
257
  console.log("");
214
258
  log(`${WHITE}Configuring settings.json...${RESET}`);
@@ -383,6 +427,8 @@ async function main() {
383
427
  console.log(` Agents: ${WHITE}3${RESET} ${DIM}(planner, builder, verifier)${RESET}`);
384
428
  console.log(` Hooks: ${WHITE}6${RESET} ${DIM}(branch-guard, pre-push, env-block, migration-guard, deploy-gate, pre-compact)${RESET}`);
385
429
  console.log(` Rules: ${WHITE}3${RESET} ${DIM}(security, frontend, deployment)${RESET}`);
430
+ console.log(` Scripts: ${WHITE}1${RESET} ${DIM}(state.js — state machine)${RESET}`);
431
+ console.log(` Knowledge: ${WHITE}3${RESET} ${DIM}(patterns, fixes, client prefs)${RESET}`);
386
432
  console.log(` Templates: ${WHITE}4${RESET}`);
387
433
  console.log(` Status line: ${GREEN}✓${RESET}`);
388
434
  console.log(` CLAUDE.md: ${GREEN}✓${RESET} ${DIM}(${member.role})${RESET}`);