qualia-framework 2.1.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 +50 -0
- package/bin/cli.js +519 -0
- package/framework/agents/architecture-strategist.md +53 -0
- package/framework/agents/backend-agent.md +150 -0
- package/framework/agents/code-simplicity-reviewer.md +86 -0
- package/framework/agents/frontend-agent.md +111 -0
- package/framework/agents/kieran-typescript-reviewer.md +96 -0
- package/framework/agents/performance-oracle.md +111 -0
- package/framework/agents/qualia-codebase-mapper.md +760 -0
- package/framework/agents/qualia-debugger.md +1203 -0
- package/framework/agents/qualia-executor.md +881 -0
- package/framework/agents/qualia-integration-checker.md +423 -0
- package/framework/agents/qualia-phase-researcher.md +453 -0
- package/framework/agents/qualia-plan-checker.md +699 -0
- package/framework/agents/qualia-planner.md +1241 -0
- package/framework/agents/qualia-project-researcher.md +602 -0
- package/framework/agents/qualia-research-synthesizer.md +236 -0
- package/framework/agents/qualia-roadmapper.md +605 -0
- package/framework/agents/qualia-verifier.md +685 -0
- package/framework/agents/team-orchestrator.md +228 -0
- package/framework/agents/teams/full-stack-team.md +48 -0
- package/framework/agents/teams/optimize-team.md +53 -0
- package/framework/agents/teams/review-team.md +62 -0
- package/framework/agents/teams/ship-team.md +86 -0
- package/framework/agents/test-agent.md +182 -0
- package/framework/askpass.sh +2 -0
- package/framework/commands/design.md +53 -0
- package/framework/commands/quick-db.md +22 -0
- package/framework/config/retention.json +35 -0
- package/framework/core/PRINCIPLES.md +77 -0
- package/framework/hooks/auto-format.sh +45 -0
- package/framework/hooks/block-env-edit.sh +42 -0
- package/framework/hooks/branch-guard.sh +46 -0
- package/framework/hooks/confirm-delete.sh +56 -0
- package/framework/hooks/migration-validate.sh +68 -0
- package/framework/hooks/notification-speak.sh +15 -0
- package/framework/hooks/pre-commit.sh +80 -0
- package/framework/hooks/pre-compact.sh +55 -0
- package/framework/hooks/pre-deploy-gate.sh +151 -0
- package/framework/hooks/qualia-colors.sh +32 -0
- package/framework/hooks/retention-cleanup.sh +43 -0
- package/framework/hooks/save-session-state.sh +153 -0
- package/framework/hooks/session-context-loader.sh +28 -0
- package/framework/hooks/session-learn.sh +30 -0
- package/framework/knowledge/claudecode-bible.md +1384 -0
- package/framework/knowledge/client-prefs.md +22 -0
- package/framework/knowledge/common-fixes.md +25 -0
- package/framework/knowledge/deployment-map.md +35 -0
- package/framework/knowledge/email-signature.html +1 -0
- package/framework/knowledge/employees.md +8 -0
- package/framework/knowledge/learned-patterns.md +51 -0
- package/framework/knowledge/optimization-research-2026.md +137 -0
- package/framework/knowledge/qualia-context.md +67 -0
- package/framework/knowledge/supabase-patterns.md +50 -0
- package/framework/knowledge/voice-agent-patterns.md +46 -0
- package/framework/qualia-engine/VERSION +1 -0
- package/framework/qualia-engine/bin/qualia-tools.js +2160 -0
- package/framework/qualia-engine/bin/qualia-tools.test.js +1054 -0
- package/framework/qualia-engine/references/checkpoints.md +775 -0
- package/framework/qualia-engine/references/continuation-format.md +249 -0
- package/framework/qualia-engine/references/decimal-phase-calculation.md +65 -0
- package/framework/qualia-engine/references/design-quality.md +56 -0
- package/framework/qualia-engine/references/git-integration.md +254 -0
- package/framework/qualia-engine/references/git-planning-commit.md +50 -0
- package/framework/qualia-engine/references/model-profile-resolution.md +32 -0
- package/framework/qualia-engine/references/model-profiles.md +73 -0
- package/framework/qualia-engine/references/phase-argument-parsing.md +61 -0
- package/framework/qualia-engine/references/planning-config.md +195 -0
- package/framework/qualia-engine/references/questioning.md +141 -0
- package/framework/qualia-engine/references/tdd.md +263 -0
- package/framework/qualia-engine/references/ui-brand.md +160 -0
- package/framework/qualia-engine/references/verification-patterns.md +612 -0
- package/framework/qualia-engine/templates/DEBUG.md +159 -0
- package/framework/qualia-engine/templates/DESIGN.md +81 -0
- package/framework/qualia-engine/templates/UAT.md +247 -0
- package/framework/qualia-engine/templates/codebase/architecture.md +255 -0
- package/framework/qualia-engine/templates/codebase/concerns.md +310 -0
- package/framework/qualia-engine/templates/codebase/conventions.md +307 -0
- package/framework/qualia-engine/templates/codebase/integrations.md +280 -0
- package/framework/qualia-engine/templates/codebase/stack.md +186 -0
- package/framework/qualia-engine/templates/codebase/structure.md +285 -0
- package/framework/qualia-engine/templates/codebase/testing.md +480 -0
- package/framework/qualia-engine/templates/config.json +35 -0
- package/framework/qualia-engine/templates/context.md +283 -0
- package/framework/qualia-engine/templates/continue-here.md +78 -0
- package/framework/qualia-engine/templates/debug-subagent-prompt.md +91 -0
- package/framework/qualia-engine/templates/discovery.md +146 -0
- package/framework/qualia-engine/templates/milestone-archive.md +123 -0
- package/framework/qualia-engine/templates/milestone.md +115 -0
- package/framework/qualia-engine/templates/phase-prompt.md +567 -0
- package/framework/qualia-engine/templates/planner-subagent-prompt.md +117 -0
- package/framework/qualia-engine/templates/project.md +184 -0
- package/framework/qualia-engine/templates/projects/ai-agent.md +156 -0
- package/framework/qualia-engine/templates/projects/mobile-app.md +181 -0
- package/framework/qualia-engine/templates/projects/voice-agent.md +134 -0
- package/framework/qualia-engine/templates/projects/website.md +137 -0
- package/framework/qualia-engine/templates/requirements.md +231 -0
- package/framework/qualia-engine/templates/research-project/ARCHITECTURE.md +204 -0
- package/framework/qualia-engine/templates/research-project/FEATURES.md +147 -0
- package/framework/qualia-engine/templates/research-project/PITFALLS.md +200 -0
- package/framework/qualia-engine/templates/research-project/STACK.md +120 -0
- package/framework/qualia-engine/templates/research-project/SUMMARY.md +170 -0
- package/framework/qualia-engine/templates/research.md +552 -0
- package/framework/qualia-engine/templates/roadmap.md +202 -0
- package/framework/qualia-engine/templates/state.md +176 -0
- package/framework/qualia-engine/templates/summary-complex.md +59 -0
- package/framework/qualia-engine/templates/summary-minimal.md +41 -0
- package/framework/qualia-engine/templates/summary-standard.md +48 -0
- package/framework/qualia-engine/templates/summary.md +246 -0
- package/framework/qualia-engine/templates/user-setup.md +311 -0
- package/framework/qualia-engine/templates/verification-report.md +322 -0
- package/framework/qualia-engine/workflows/add-phase.md +179 -0
- package/framework/qualia-engine/workflows/add-todo.md +157 -0
- package/framework/qualia-engine/workflows/audit-milestone.md +241 -0
- package/framework/qualia-engine/workflows/check-todos.md +176 -0
- package/framework/qualia-engine/workflows/complete-milestone.md +858 -0
- package/framework/qualia-engine/workflows/diagnose-issues.md +219 -0
- package/framework/qualia-engine/workflows/discovery-phase.md +289 -0
- package/framework/qualia-engine/workflows/discuss-phase.md +534 -0
- package/framework/qualia-engine/workflows/execute-phase.md +559 -0
- package/framework/qualia-engine/workflows/execute-plan.md +438 -0
- package/framework/qualia-engine/workflows/help.md +470 -0
- package/framework/qualia-engine/workflows/insert-phase.md +220 -0
- package/framework/qualia-engine/workflows/list-phase-assumptions.md +178 -0
- package/framework/qualia-engine/workflows/map-codebase.md +327 -0
- package/framework/qualia-engine/workflows/new-milestone.md +363 -0
- package/framework/qualia-engine/workflows/new-project.md +1037 -0
- package/framework/qualia-engine/workflows/pause-work.md +122 -0
- package/framework/qualia-engine/workflows/plan-milestone-gaps.md +256 -0
- package/framework/qualia-engine/workflows/plan-phase.md +422 -0
- package/framework/qualia-engine/workflows/progress.md +354 -0
- package/framework/qualia-engine/workflows/quick.md +252 -0
- package/framework/qualia-engine/workflows/remove-phase.md +326 -0
- package/framework/qualia-engine/workflows/research-phase.md +74 -0
- package/framework/qualia-engine/workflows/resume-project.md +306 -0
- package/framework/qualia-engine/workflows/set-profile.md +80 -0
- package/framework/qualia-engine/workflows/settings.md +145 -0
- package/framework/qualia-engine/workflows/transition.md +556 -0
- package/framework/qualia-engine/workflows/update.md +197 -0
- package/framework/qualia-engine/workflows/verify-phase.md +195 -0
- package/framework/qualia-engine/workflows/verify-work.md +625 -0
- package/framework/rules/context7.md +11 -0
- package/framework/rules/deployment.md +29 -0
- package/framework/rules/frontend.md +33 -0
- package/framework/rules/security.md +12 -0
- package/framework/rules/speed.md +20 -0
- package/framework/scripts/__pycache__/say.cpython-314.pyc +0 -0
- package/framework/scripts/apply-retention.sh +120 -0
- package/framework/scripts/bootstrap-pop-os.sh +354 -0
- package/framework/scripts/claude-voice +13 -0
- package/framework/scripts/cleanup.sh +131 -0
- package/framework/scripts/cowork-mode.sh +141 -0
- package/framework/scripts/generate-project-claude-md.sh +153 -0
- package/framework/scripts/load-test-webhook.js +172 -0
- package/framework/scripts/say.py +236 -0
- package/framework/scripts/showcase-video-recorder/ffmpeg-builder.js +167 -0
- package/framework/scripts/showcase-video-recorder/playwright-helpers.js +216 -0
- package/framework/scripts/speak.py +55 -0
- package/framework/scripts/speak.sh +18 -0
- package/framework/scripts/status.sh +138 -0
- package/framework/scripts/sync-to-framework.sh +65 -0
- package/framework/scripts/voice-hotkey.py +227 -0
- package/framework/scripts/voice-input.sh +51 -0
- package/framework/skills/animate/SKILL.md +202 -0
- package/framework/skills/bolder/SKILL.md +144 -0
- package/framework/skills/browser-qa/SKILL.md +536 -0
- package/framework/skills/clarify/SKILL.md +179 -0
- package/framework/skills/colorize/SKILL.md +170 -0
- package/framework/skills/critique/SKILL.md +126 -0
- package/framework/skills/deep-research/SKILL.md +271 -0
- package/framework/skills/delight/SKILL.md +329 -0
- package/framework/skills/deploy/SKILL.md +261 -0
- package/framework/skills/deploy-verify/SKILL.md +377 -0
- package/framework/skills/deploy-verify/scripts/canary-check.sh +206 -0
- package/framework/skills/deploy-verify/scripts/check-console-errors.js +147 -0
- package/framework/skills/deploy-verify/scripts/check-cwv.js +139 -0
- package/framework/skills/deploy-verify/scripts/project-detect.sh +84 -0
- package/framework/skills/deploy-verify/scripts/verify.sh +548 -0
- package/framework/skills/design-quieter/SKILL.md +130 -0
- package/framework/skills/distill/SKILL.md +149 -0
- package/framework/skills/docs-lookup/SKILL.md +78 -0
- package/framework/skills/fcm-notifications/SKILL.md +125 -0
- package/framework/skills/financial-ledger/SKILL.md +1039 -0
- package/framework/skills/frontend-master/NOTICE.md +4 -0
- package/framework/skills/frontend-master/SKILL.md +127 -0
- package/framework/skills/frontend-master/reference/color-and-contrast.md +132 -0
- package/framework/skills/frontend-master/reference/interaction-design.md +123 -0
- package/framework/skills/frontend-master/reference/motion-design.md +99 -0
- package/framework/skills/frontend-master/reference/responsive-design.md +114 -0
- package/framework/skills/frontend-master/reference/spatial-design.md +100 -0
- package/framework/skills/frontend-master/reference/typography.md +131 -0
- package/framework/skills/frontend-master/reference/ux-writing.md +107 -0
- package/framework/skills/harden/SKILL.md +357 -0
- package/framework/skills/i18n-rtl/SKILL.md +752 -0
- package/framework/skills/learn/SKILL.md +71 -0
- package/framework/skills/memory/SKILL.md +50 -0
- package/framework/skills/mobile-expo/SKILL.md +864 -0
- package/framework/skills/mobile-expo/references/store-checklist.md +550 -0
- package/framework/skills/nestjs-backend/README.md +73 -0
- package/framework/skills/nestjs-backend/SKILL.md +446 -0
- package/framework/skills/nestjs-backend/references/templates.md +1173 -0
- package/framework/skills/normalize/SKILL.md +79 -0
- package/framework/skills/onboard/SKILL.md +242 -0
- package/framework/skills/polish/SKILL.md +209 -0
- package/framework/skills/pr/SKILL.md +66 -0
- package/framework/skills/qualia/SKILL.md +153 -0
- package/framework/skills/qualia-add-todo/SKILL.md +68 -0
- package/framework/skills/qualia-audit-milestone/SKILL.md +92 -0
- package/framework/skills/qualia-check-todos/SKILL.md +55 -0
- package/framework/skills/qualia-complete-milestone/SKILL.md +108 -0
- package/framework/skills/qualia-debug/SKILL.md +149 -0
- package/framework/skills/qualia-design/SKILL.md +203 -0
- package/framework/skills/qualia-discuss-phase/SKILL.md +72 -0
- package/framework/skills/qualia-execute-phase/SKILL.md +86 -0
- package/framework/skills/qualia-help/SKILL.md +67 -0
- package/framework/skills/qualia-idk/SKILL.md +352 -0
- package/framework/skills/qualia-list-phase-assumptions/SKILL.md +67 -0
- package/framework/skills/qualia-new-milestone/SKILL.md +72 -0
- package/framework/skills/qualia-new-project/SKILL.md +92 -0
- package/framework/skills/qualia-optimize/SKILL.md +417 -0
- package/framework/skills/qualia-pause-work/SKILL.md +96 -0
- package/framework/skills/qualia-plan-milestone-gaps/SKILL.md +57 -0
- package/framework/skills/qualia-plan-phase/SKILL.md +101 -0
- package/framework/skills/qualia-progress/SKILL.md +53 -0
- package/framework/skills/qualia-quick/SKILL.md +89 -0
- package/framework/skills/qualia-research-phase/SKILL.md +88 -0
- package/framework/skills/qualia-resume-work/SKILL.md +62 -0
- package/framework/skills/qualia-review/SKILL.md +263 -0
- package/framework/skills/qualia-start/SKILL.md +182 -0
- package/framework/skills/qualia-verify-work/SKILL.md +105 -0
- package/framework/skills/qualia-workflow/SKILL.md +130 -0
- package/framework/skills/rag/SKILL.md +750 -0
- package/framework/skills/responsive/SKILL.md +231 -0
- package/framework/skills/retro/SKILL.md +284 -0
- package/framework/skills/sakani-conventions/SKILL.md +136 -0
- package/framework/skills/sakani-conventions/evals/evals.json +23 -0
- package/framework/skills/sakani-conventions/references/entities.md +365 -0
- package/framework/skills/sakani-conventions/references/error-codes.md +95 -0
- package/framework/skills/seo-master/SKILL.md +490 -0
- package/framework/skills/seo-master/references/checklist.md +199 -0
- package/framework/skills/seo-master/references/structured-data.md +609 -0
- package/framework/skills/ship/SKILL.md +202 -0
- package/framework/skills/stack-researcher/SKILL.md +215 -0
- package/framework/skills/status/SKILL.md +154 -0
- package/framework/skills/status/scripts/health-check.sh +562 -0
- package/framework/skills/subscription-payments/SKILL.md +250 -0
- package/framework/skills/supabase/SKILL.md +973 -0
- package/framework/skills/supabase/references/templates.md +159 -0
- package/framework/skills/team/SKILL.md +67 -0
- package/framework/skills/test-runner/SKILL.md +202 -0
- package/framework/skills/voice-agent/SKILL.md +407 -0
- package/framework/skills/zoho-workflow/SKILL.md +51 -0
- package/framework/statusline-command.sh +117 -0
- package/package.json +24 -0
- package/profiles/fawzi.json +16 -0
- package/profiles/hasan.json +16 -0
- package/profiles/moayad.json +16 -0
- package/templates/CLAUDE-owner.md +52 -0
- package/templates/CLAUDE.md.hbs +58 -0
- package/templates/env.claude.template +12 -0
- package/templates/settings.json +141 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Pre-deploy gate — blocks `vercel --prod` if checks fail
|
|
3
|
+
# Teal-branded output to stderr, JSON systemMessage to stdout
|
|
4
|
+
# Exit 0 = allow, Exit 2 = block
|
|
5
|
+
|
|
6
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
7
|
+
|
|
8
|
+
# Parse command from stdin JSON
|
|
9
|
+
if [ ! -t 0 ]; then
|
|
10
|
+
INPUT=$(cat)
|
|
11
|
+
COMMAND=$(echo "$INPUT" | node -e "try{const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));process.stdout.write(d.tool_input?.command||d.tool_input||'')}catch(e){}" 2>/dev/null)
|
|
12
|
+
else
|
|
13
|
+
COMMAND=""
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Only gate production deploys
|
|
17
|
+
if ! echo "$COMMAND" | grep -qE 'vercel\s+.*--prod|vercel\s+--prod'; then
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Skip if gate was passed recently (within 5 minutes)
|
|
22
|
+
STAMP="/tmp/.deploy-gate-$(echo "$PWD" | md5sum | cut -c1-8)"
|
|
23
|
+
if [ -f "$STAMP" ]; then
|
|
24
|
+
AGE=$(( $(date +%s) - $(stat -c %Y "$STAMP" 2>/dev/null || echo 0) ))
|
|
25
|
+
if [ "$AGE" -lt 300 ]; then
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
q_header "PRE-DEPLOY GATE"
|
|
31
|
+
|
|
32
|
+
FAILURES=0
|
|
33
|
+
WARNINGS=0
|
|
34
|
+
FAIL_DETAILS=""
|
|
35
|
+
|
|
36
|
+
# ─── Check 1: TypeScript ───
|
|
37
|
+
if [ -f "tsconfig.json" ]; then
|
|
38
|
+
if npx tsc --noEmit 2>/tmp/tsc-gate.txt; then
|
|
39
|
+
q_pass "TypeScript"
|
|
40
|
+
else
|
|
41
|
+
q_fail "TypeScript errors"
|
|
42
|
+
FAIL_DETAILS="${FAIL_DETAILS}TypeScript errors found. Run npx tsc --noEmit to see details. "
|
|
43
|
+
FAILURES=$((FAILURES + 1))
|
|
44
|
+
fi
|
|
45
|
+
else
|
|
46
|
+
q_skip "TypeScript"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# ─── Check 2: ESLint ───
|
|
50
|
+
if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ] || [ -f "eslint.config.mjs" ]; then
|
|
51
|
+
if npx eslint . --max-warnings=-1 --quiet 2>/dev/null; then
|
|
52
|
+
q_pass "Lint"
|
|
53
|
+
else
|
|
54
|
+
q_fail "Lint errors"
|
|
55
|
+
FAIL_DETAILS="${FAIL_DETAILS}ESLint errors found. Run npx eslint . to see details. "
|
|
56
|
+
FAILURES=$((FAILURES + 1))
|
|
57
|
+
fi
|
|
58
|
+
else
|
|
59
|
+
q_skip "Lint"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# ─── Check 3: Tests ───
|
|
63
|
+
if [ -f "package.json" ]; then
|
|
64
|
+
TEST_SCRIPT=$(node -e "try{console.log(require('./package.json').scripts?.test||'')}catch(e){console.log('')}" 2>/dev/null)
|
|
65
|
+
if [ -n "$TEST_SCRIPT" ] && [ "$TEST_SCRIPT" != 'echo "Error: no test specified" && exit 1' ]; then
|
|
66
|
+
if npm test -- --passWithNoTests 2>/tmp/test-gate.txt 1>/dev/null; then
|
|
67
|
+
q_pass "Tests"
|
|
68
|
+
else
|
|
69
|
+
q_fail "Tests failed"
|
|
70
|
+
FAIL_DETAILS="${FAIL_DETAILS}Tests failed. Run npm test to see details. "
|
|
71
|
+
FAILURES=$((FAILURES + 1))
|
|
72
|
+
fi
|
|
73
|
+
else
|
|
74
|
+
q_skip "Tests"
|
|
75
|
+
fi
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# ─── Check 4: Build ───
|
|
79
|
+
if [ -f "package.json" ]; then
|
|
80
|
+
BUILD_SCRIPT=$(node -e "try{console.log(require('./package.json').scripts?.build||'')}catch(e){console.log('')}" 2>/dev/null)
|
|
81
|
+
if [ -n "$BUILD_SCRIPT" ]; then
|
|
82
|
+
if npm run build 2>/tmp/build-gate.txt 1>/dev/null; then
|
|
83
|
+
q_pass "Build"
|
|
84
|
+
else
|
|
85
|
+
q_fail "Build failed"
|
|
86
|
+
FAIL_DETAILS="${FAIL_DETAILS}Build failed. Run npm run build to see errors. "
|
|
87
|
+
FAILURES=$((FAILURES + 1))
|
|
88
|
+
fi
|
|
89
|
+
else
|
|
90
|
+
q_skip "Build"
|
|
91
|
+
fi
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# ─── Check 5: Environment ───
|
|
95
|
+
if [ -f ".env.example" ] && [ ! -f ".env.local" ] && [ ! -f ".env" ]; then
|
|
96
|
+
q_warn "Missing .env.local"
|
|
97
|
+
WARNINGS=$((WARNINGS + 1))
|
|
98
|
+
else
|
|
99
|
+
q_pass "Environment"
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# ─── Check 6: REVIEW.md ───
|
|
103
|
+
REVIEW_FILE=""
|
|
104
|
+
[ -f ".planning/REVIEW.md" ] && REVIEW_FILE=".planning/REVIEW.md"
|
|
105
|
+
[ -z "$REVIEW_FILE" ] && [ -f ".review/REVIEW.md" ] && REVIEW_FILE=".review/REVIEW.md"
|
|
106
|
+
|
|
107
|
+
if [ -z "$REVIEW_FILE" ]; then
|
|
108
|
+
q_fail "No REVIEW.md"
|
|
109
|
+
FAIL_DETAILS="${FAIL_DETAILS}No code review found. Run /qualia-review to generate REVIEW.md. "
|
|
110
|
+
FAILURES=$((FAILURES + 1))
|
|
111
|
+
else
|
|
112
|
+
REVIEW_MTIME=$(stat -c %Y "$REVIEW_FILE" 2>/dev/null || echo 0)
|
|
113
|
+
LATEST_CODE_MTIME=0
|
|
114
|
+
for DIR in src app pages lib components; do
|
|
115
|
+
if [ -d "$DIR" ]; then
|
|
116
|
+
DIR_LATEST=$(find "$DIR" -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) -printf '%T@\n' 2>/dev/null | sort -rn | head -1 | cut -d. -f1)
|
|
117
|
+
[ -n "$DIR_LATEST" ] && [ "$DIR_LATEST" -gt "$LATEST_CODE_MTIME" ] && LATEST_CODE_MTIME=$DIR_LATEST
|
|
118
|
+
fi
|
|
119
|
+
done
|
|
120
|
+
if [ "$LATEST_CODE_MTIME" -gt 0 ] && [ "$REVIEW_MTIME" -lt "$LATEST_CODE_MTIME" ]; then
|
|
121
|
+
q_fail "REVIEW.md stale"
|
|
122
|
+
FAIL_DETAILS="${FAIL_DETAILS}REVIEW.md is stale. Run /qualia-review to update. "
|
|
123
|
+
FAILURES=$((FAILURES + 1))
|
|
124
|
+
else
|
|
125
|
+
q_pass "Review"
|
|
126
|
+
fi
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# ─── Verdict ───
|
|
130
|
+
if [ "$FAILURES" -gt 0 ]; then
|
|
131
|
+
q_blocked "${FAILURES} check(s) failed"
|
|
132
|
+
|
|
133
|
+
cat <<EOJSON
|
|
134
|
+
{
|
|
135
|
+
"continue": false,
|
|
136
|
+
"stopReason": "◆ Deploy gate: ${FAILURES} check(s) failed",
|
|
137
|
+
"systemMessage": "DEPLOY BLOCKED by pre-deploy gate. DO NOT ask the user to deploy manually or bypass the gate. Instead, fix the failing checks and retry vercel --prod. Failures: ${FAIL_DETAILS}After fixing, retry the deploy command."
|
|
138
|
+
}
|
|
139
|
+
EOJSON
|
|
140
|
+
exit 2
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
if [ "$WARNINGS" -gt 0 ]; then
|
|
144
|
+
q_warn "${WARNINGS} warning(s) — proceeding"
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
q_approved
|
|
148
|
+
|
|
149
|
+
# Stamp success
|
|
150
|
+
touch "$STAMP"
|
|
151
|
+
exit 0
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Qualia teal brand palette — source this in all hooks
|
|
2
|
+
# Usage: source "$(dirname "$0")/qualia-colors.sh"
|
|
3
|
+
|
|
4
|
+
Q_TEAL='\033[38;2;0;188;175m'
|
|
5
|
+
Q_BRIGHT='\033[38;2;45;226;210m'
|
|
6
|
+
Q_DIM='\033[38;2;0;120;112m'
|
|
7
|
+
Q_WHITE='\033[38;2;220;225;230m'
|
|
8
|
+
Q_PASS='\033[38;2;52;211;153m'
|
|
9
|
+
Q_WARN='\033[38;2;234;179;8m'
|
|
10
|
+
Q_FAIL='\033[38;2;239;68;68m'
|
|
11
|
+
Q_GRAY='\033[38;2;70;78;88m'
|
|
12
|
+
Q_RESET='\033[0m'
|
|
13
|
+
Q_MARK="${Q_BRIGHT}◆${Q_RESET}"
|
|
14
|
+
|
|
15
|
+
# Print a Qualia-branded header line to stderr
|
|
16
|
+
# Usage: q_header "PRE-DEPLOY GATE"
|
|
17
|
+
q_header() {
|
|
18
|
+
printf "${Q_TEAL}━━━${Q_RESET} ${Q_BRIGHT}◆${Q_RESET} ${Q_TEAL}%s${Q_RESET}\n" "$1" >&2
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Print a pass/fail/warn/skip line to stderr
|
|
22
|
+
# Usage: q_pass "TypeScript" | q_fail "Build" | q_warn "Env" | q_skip "Tests"
|
|
23
|
+
q_pass() { printf " ${Q_PASS}✓${Q_RESET} ${Q_WHITE}%s${Q_RESET}\n" "$1" >&2; }
|
|
24
|
+
q_fail() { printf " ${Q_FAIL}✗${Q_RESET} ${Q_WHITE}%s${Q_RESET}\n" "$1" >&2; }
|
|
25
|
+
q_warn() { printf " ${Q_WARN}▲${Q_RESET} ${Q_WHITE}%s${Q_RESET}\n" "$1" >&2; }
|
|
26
|
+
q_skip() { printf " ${Q_GRAY}·${Q_RESET} ${Q_GRAY}%s${Q_RESET}\n" "$1" >&2; }
|
|
27
|
+
q_info() { printf " ${Q_DIM}%s${Q_RESET}\n" "$1" >&2; }
|
|
28
|
+
|
|
29
|
+
# Print verdict line to stderr
|
|
30
|
+
# Usage: q_blocked "2 checks failed" | q_approved
|
|
31
|
+
q_blocked() { printf "\n${Q_FAIL}✗${Q_RESET} ${Q_BRIGHT}BLOCKED${Q_RESET} ${Q_DIM}—${Q_RESET} ${Q_WHITE}%s${Q_RESET}\n" "$1" >&2; }
|
|
32
|
+
q_approved(){ printf "\n${Q_PASS}✓${Q_RESET} ${Q_BRIGHT}APPROVED${Q_RESET}\n" >&2; }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Retention cleanup — runs on SessionStart to enforce retention policies
|
|
3
|
+
# Keeps .claude/ lean by pruning stale data automatically
|
|
4
|
+
|
|
5
|
+
CLAUDE_DIR="$HOME/.claude"
|
|
6
|
+
|
|
7
|
+
# (debug/ and context-states/ removed — directories don't exist)
|
|
8
|
+
|
|
9
|
+
# file-history/ — keep 7 days max
|
|
10
|
+
find "$CLAUDE_DIR/file-history/" -type f -mtime +7 -delete 2>/dev/null
|
|
11
|
+
find "$CLAUDE_DIR/file-history/" -type d -empty -delete 2>/dev/null
|
|
12
|
+
|
|
13
|
+
# session-env/ — keep last 10 UUID dirs (sorted by modification time)
|
|
14
|
+
ls -dt "$CLAUDE_DIR/session-env"/*-*-*-*-* 2>/dev/null | tail -n +11 | while IFS= read -r d; do
|
|
15
|
+
rm -rf "$d"
|
|
16
|
+
done
|
|
17
|
+
|
|
18
|
+
# backups/ — keep 3 days
|
|
19
|
+
find "$CLAUDE_DIR/backups/" -type f -mtime +3 -delete 2>/dev/null
|
|
20
|
+
|
|
21
|
+
# paste-cache/ — keep 3 days
|
|
22
|
+
find "$CLAUDE_DIR/paste-cache/" -type f -mtime +3 -delete 2>/dev/null
|
|
23
|
+
|
|
24
|
+
# shell-snapshots/ — keep 3 days
|
|
25
|
+
find "$CLAUDE_DIR/shell-snapshots/" -type f -mtime +3 -delete 2>/dev/null
|
|
26
|
+
|
|
27
|
+
# projects/ session transcripts — keep 7 days (allows --continue on recent sessions)
|
|
28
|
+
find "$CLAUDE_DIR/projects/" -name "*.jsonl" -mtime +7 -delete 2>/dev/null
|
|
29
|
+
find "$CLAUDE_DIR/projects/" -type d -empty -delete 2>/dev/null
|
|
30
|
+
|
|
31
|
+
# tasks/ — keep 3 days (stale task files from old sessions)
|
|
32
|
+
find "$CLAUDE_DIR/tasks/" -type f -mtime +3 -delete 2>/dev/null
|
|
33
|
+
find "$CLAUDE_DIR/tasks/" -type d -empty -delete 2>/dev/null
|
|
34
|
+
|
|
35
|
+
# plans/ — keep 7 days (old Claude Code plan mode files)
|
|
36
|
+
find "$CLAUDE_DIR/plans/" -type f -mtime +7 -delete 2>/dev/null
|
|
37
|
+
|
|
38
|
+
# session-env/ session_*.json — keep last 50 (matches save-session-state.sh)
|
|
39
|
+
ls -t "$CLAUDE_DIR/session-env"/session_*.json 2>/dev/null | tail -n +51 | while IFS= read -r f; do
|
|
40
|
+
rm -f "$f"
|
|
41
|
+
done
|
|
42
|
+
|
|
43
|
+
exit 0
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SessionEnd hook — saves session state + updates rolling digest + auto-handoff
|
|
3
|
+
# Enhanced: cross-project session digest, auto .continue-here.md for significant work
|
|
4
|
+
|
|
5
|
+
SESSION_DIR="$HOME/.claude/session-env"
|
|
6
|
+
KNOWLEDGE_DIR="$HOME/.claude/knowledge"
|
|
7
|
+
DIGEST_FILE="$KNOWLEDGE_DIR/session-digest.md"
|
|
8
|
+
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
9
|
+
SESSION_FILE="$SESSION_DIR/session_$TIMESTAMP.json"
|
|
10
|
+
|
|
11
|
+
mkdir -p "$SESSION_DIR"
|
|
12
|
+
mkdir -p "$KNOWLEDGE_DIR"
|
|
13
|
+
|
|
14
|
+
CWD=$(pwd)
|
|
15
|
+
PROJECT_NAME=$(basename "$CWD")
|
|
16
|
+
|
|
17
|
+
# --- Git info ---
|
|
18
|
+
GIT_BRANCH=""
|
|
19
|
+
GIT_STATUS=""
|
|
20
|
+
FILES_CHANGED=0
|
|
21
|
+
LAST_COMMIT_MSG=""
|
|
22
|
+
if git rev-parse --is-inside-work-tree &> /dev/null 2>&1; then
|
|
23
|
+
GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
|
|
24
|
+
GIT_STATUS=$(git status --porcelain 2>/dev/null | head -20 || echo "")
|
|
25
|
+
# Count ALL files changed: committed in last 2 hours + uncommitted + staged
|
|
26
|
+
COMMITTED=$(git diff --name-only "$(git log --since='2 hours ago' --format=%H | tail -1 2>/dev/null || echo HEAD)" HEAD 2>/dev/null | wc -l || echo 0)
|
|
27
|
+
UNCOMMITTED=$(git diff --name-only 2>/dev/null | wc -l || echo 0)
|
|
28
|
+
STAGED=$(git diff --cached --name-only 2>/dev/null | wc -l || echo 0)
|
|
29
|
+
FILES_CHANGED=$((COMMITTED + UNCOMMITTED + STAGED))
|
|
30
|
+
LAST_COMMIT_MSG=$(git log --oneline -1 --format="%s" 2>/dev/null || echo "")
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# --- Summary line (from last commit or branch name) ---
|
|
34
|
+
SUMMARY=""
|
|
35
|
+
if [ -n "$LAST_COMMIT_MSG" ]; then
|
|
36
|
+
SUMMARY="$LAST_COMMIT_MSG"
|
|
37
|
+
elif [ -n "$GIT_BRANCH" ]; then
|
|
38
|
+
SUMMARY="Working on $GIT_BRANCH"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# --- Save session JSON ---
|
|
42
|
+
cat > "$SESSION_FILE" << EOF
|
|
43
|
+
{
|
|
44
|
+
"timestamp": "$TIMESTAMP",
|
|
45
|
+
"working_directory": "$CWD",
|
|
46
|
+
"project": "$PROJECT_NAME",
|
|
47
|
+
"git": {
|
|
48
|
+
"branch": "$GIT_BRANCH",
|
|
49
|
+
"has_changes": $([ -n "$GIT_STATUS" ] && echo "true" || echo "false"),
|
|
50
|
+
"files_changed": $FILES_CHANGED
|
|
51
|
+
},
|
|
52
|
+
"summary": "$(echo "$SUMMARY" | sed 's/"/\\"/g')",
|
|
53
|
+
"ended_at": "$(date '+%Y-%m-%d %H:%M:%S')"
|
|
54
|
+
}
|
|
55
|
+
EOF
|
|
56
|
+
|
|
57
|
+
# --- Update rolling session digest (cross-project awareness) ---
|
|
58
|
+
if [ ! -f "$DIGEST_FILE" ]; then
|
|
59
|
+
cat > "$DIGEST_FILE" << 'HEADER'
|
|
60
|
+
# Session Digest — Rolling Log
|
|
61
|
+
> Auto-updated by save-session-state.sh. Last 20 sessions across all projects.
|
|
62
|
+
|
|
63
|
+
HEADER
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Prepend new entry (most recent first, after header)
|
|
67
|
+
# Skip noise: sessions in .claude, Projects root, or with 0 files and no summary
|
|
68
|
+
if [ "$PROJECT_NAME" != ".claude" ] && [ "$PROJECT_NAME" != "Projects" ] && { [ "$FILES_CHANGED" -gt 0 ] || [ -n "$SUMMARY" ]; }; then
|
|
69
|
+
DATE_SHORT=$(date '+%m-%d %H:%M')
|
|
70
|
+
ENTRY="| ${DATE_SHORT} | ${PROJECT_NAME} | ${GIT_BRANCH:-—} | ${FILES_CHANGED} | ${SUMMARY:-—} |"
|
|
71
|
+
|
|
72
|
+
# Read existing entries (skip header — first 3 lines), keep last 19
|
|
73
|
+
EXISTING=$(tail -n +4 "$DIGEST_FILE" | head -19)
|
|
74
|
+
|
|
75
|
+
cat > "$DIGEST_FILE" << HEADER
|
|
76
|
+
# Session Digest — Rolling Log
|
|
77
|
+
> Auto-updated by save-session-state.sh. Last 20 sessions across all projects.
|
|
78
|
+
|
|
79
|
+
${ENTRY}
|
|
80
|
+
${EXISTING}
|
|
81
|
+
HEADER
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# --- Auto-handoff for significant sessions (>5 files changed) ---
|
|
85
|
+
if [ "$FILES_CHANGED" -gt 5 ] && [ "$PROJECT_NAME" != ".claude" ]; then
|
|
86
|
+
HANDOFF_FILE="$CWD/.continue-here.md"
|
|
87
|
+
# Only create if one doesn't already exist (don't overwrite manual handoffs)
|
|
88
|
+
if [ ! -f "$HANDOFF_FILE" ]; then
|
|
89
|
+
RECENT_COMMITS=$(git log --oneline -5 2>/dev/null || echo "none")
|
|
90
|
+
UNCOMMITTED_FILES=$(git diff --name-only 2>/dev/null | head -10 || echo "none")
|
|
91
|
+
STAGED_FILES=$(git diff --cached --name-only 2>/dev/null | head -10 || echo "none")
|
|
92
|
+
|
|
93
|
+
# Dead-ends: reverts, stashes, and abandoned branches from this session
|
|
94
|
+
REVERTS=$(git log --oneline -20 2>/dev/null | grep -i "revert\|undo\|rollback" | head -5 || echo "none")
|
|
95
|
+
STASHES=$(git stash list 2>/dev/null | head -5 || echo "none")
|
|
96
|
+
|
|
97
|
+
cat > "$HANDOFF_FILE" << HANDOFF
|
|
98
|
+
# Auto-Handoff — $(date '+%Y-%m-%d %H:%M')
|
|
99
|
+
|
|
100
|
+
## What was done
|
|
101
|
+
Branch: ${GIT_BRANCH}
|
|
102
|
+
Files changed: ${FILES_CHANGED}
|
|
103
|
+
|
|
104
|
+
Recent commits:
|
|
105
|
+
\`\`\`
|
|
106
|
+
${RECENT_COMMITS}
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
## Uncommitted work
|
|
110
|
+
\`\`\`
|
|
111
|
+
${UNCOMMITTED_FILES}
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
## Staged (not committed)
|
|
115
|
+
\`\`\`
|
|
116
|
+
${STAGED_FILES}
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
## Dead-ends (don't repeat these)
|
|
120
|
+
Reverted/undone work:
|
|
121
|
+
\`\`\`
|
|
122
|
+
${REVERTS}
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
Stashed work (may be abandoned):
|
|
126
|
+
\`\`\`
|
|
127
|
+
${STASHES}
|
|
128
|
+
\`\`\`
|
|
129
|
+
|
|
130
|
+
## Next steps
|
|
131
|
+
Review the recent commits and continue from where this session left off.
|
|
132
|
+
Do NOT retry approaches listed in dead-ends above.
|
|
133
|
+
HANDOFF
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
# --- Push to portal (non-blocking, fire-and-forget) ---
|
|
138
|
+
PORTAL_API_KEY="${CLAUDE_PORTAL_API_KEY:-}"
|
|
139
|
+
if [ -n "$PORTAL_API_KEY" ] && [ "$PROJECT_NAME" != ".claude" ]; then
|
|
140
|
+
curl -s -X POST "https://portal.qualiasolutions.net/api/claude/session-log" \
|
|
141
|
+
-H "X-API-Key: $PORTAL_API_KEY" \
|
|
142
|
+
-H "Content-Type: application/json" \
|
|
143
|
+
-d @"$SESSION_FILE" \
|
|
144
|
+
--max-time 5 \
|
|
145
|
+
> /dev/null 2>&1 &
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
# --- Cleanup old session files (keep last 50 for retrospective analytics — RETR-04) ---
|
|
149
|
+
ls -t "$SESSION_DIR"/session_*.json 2>/dev/null | tail -n +51 | while IFS= read -r f; do
|
|
150
|
+
rm -f "$f"
|
|
151
|
+
done
|
|
152
|
+
|
|
153
|
+
exit 0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SessionStart hook — provides context for qualia-start skill
|
|
3
|
+
# CLAUDE.md instructs Claude to invoke /qualia-start on every session start
|
|
4
|
+
# This hook just passes along any resume hints
|
|
5
|
+
|
|
6
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
7
|
+
|
|
8
|
+
CWD=$(pwd)
|
|
9
|
+
SESSION_DIR="$HOME/.claude/session-env"
|
|
10
|
+
COMPACT_FILE="$SESSION_DIR/pre-compact.json"
|
|
11
|
+
HINTS=""
|
|
12
|
+
|
|
13
|
+
# Check for handoff file
|
|
14
|
+
[ -f "$CWD/.continue-here.md" ] && HINTS="Handoff file exists — read .continue-here.md. "
|
|
15
|
+
|
|
16
|
+
# Check last session
|
|
17
|
+
if [ -f "$COMPACT_FILE" ]; then
|
|
18
|
+
LAST_PROJECT=$(node -e "try{const d=JSON.parse(require('fs').readFileSync('$COMPACT_FILE','utf8'));process.stdout.write(d.project_name||'')}catch(e){}" 2>/dev/null)
|
|
19
|
+
[ -n "$LAST_PROJECT" ] && [ "$LAST_PROJECT" != ".claude" ] && HINTS="${HINTS}Last session: ${LAST_PROJECT}. "
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
if [ -n "$HINTS" ]; then
|
|
23
|
+
printf '{"continue":true,"systemMessage":"%s"}' "$HINTS"
|
|
24
|
+
else
|
|
25
|
+
printf '{"continue":true}'
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
exit 0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SessionEnd hook: prompt for lessons learned if significant work was done
|
|
3
|
+
# "Significant" = more than 3 files modified in the session
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
LEARNED_FILE="$HOME/.claude/knowledge/learned-patterns.md"
|
|
8
|
+
|
|
9
|
+
# Count files modified: committed in last 2 hours + uncommitted
|
|
10
|
+
COMMITTED=$(git diff --name-only "$(git log --since='2 hours ago' --format=%H | tail -1 2>/dev/null || echo HEAD)" HEAD 2>/dev/null | wc -l || echo 0)
|
|
11
|
+
UNCOMMITTED=$(git diff --name-only 2>/dev/null | wc -l || echo 0)
|
|
12
|
+
MODIFIED_COUNT=$((COMMITTED + UNCOMMITTED))
|
|
13
|
+
|
|
14
|
+
# Only trigger if significant work was done
|
|
15
|
+
if [ "$MODIFIED_COUNT" -le 3 ]; then
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Initialize learned-patterns.md if it doesn't exist
|
|
20
|
+
if [ ! -f "$LEARNED_FILE" ]; then
|
|
21
|
+
echo "# Learned Patterns" > "$LEARNED_FILE"
|
|
22
|
+
echo "" >> "$LEARNED_FILE"
|
|
23
|
+
echo "Lessons captured from development sessions." >> "$LEARNED_FILE"
|
|
24
|
+
echo "" >> "$LEARNED_FILE"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Output reminder (shown to Claude in session context)
|
|
28
|
+
echo "SESSION_LEARN: $MODIFIED_COUNT files changed this session. Consider running /learn to capture any lessons."
|
|
29
|
+
|
|
30
|
+
exit 0
|