qualia-framework 2.6.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.
Files changed (321) hide show
  1. package/CLAUDE.md +64 -0
  2. package/README.md +103 -30
  3. package/agents/builder.md +110 -0
  4. package/agents/planner.md +134 -0
  5. package/agents/qa-browser.md +186 -0
  6. package/agents/verifier.md +221 -0
  7. package/bin/cli.js +336 -531
  8. package/bin/install.js +570 -0
  9. package/bin/qualia-ui.js +299 -0
  10. package/bin/state.js +630 -0
  11. package/bin/statusline.js +252 -0
  12. package/guide.md +63 -0
  13. package/hooks/auto-update.js +139 -0
  14. package/hooks/branch-guard.js +47 -0
  15. package/hooks/migration-guard.js +60 -0
  16. package/hooks/pre-compact.js +32 -0
  17. package/hooks/pre-deploy-gate.js +110 -0
  18. package/hooks/pre-push.js +33 -0
  19. package/hooks/session-start.js +170 -0
  20. package/package.json +29 -20
  21. package/rules/design-reference.md +179 -0
  22. package/rules/frontend.md +126 -0
  23. package/skills/qualia/SKILL.md +87 -0
  24. package/skills/qualia-build/SKILL.md +97 -0
  25. package/skills/qualia-debug/SKILL.md +87 -0
  26. package/skills/qualia-design/SKILL.md +93 -0
  27. package/skills/qualia-handoff/SKILL.md +66 -0
  28. package/skills/qualia-idk/SKILL.md +8 -0
  29. package/skills/qualia-learn/SKILL.md +88 -0
  30. package/skills/qualia-new/SKILL.md +323 -0
  31. package/{framework/skills → skills}/qualia-optimize/SKILL.md +1 -1
  32. package/skills/qualia-pause/SKILL.md +63 -0
  33. package/skills/qualia-plan/SKILL.md +101 -0
  34. package/skills/qualia-polish/SKILL.md +157 -0
  35. package/skills/qualia-quick/SKILL.md +37 -0
  36. package/skills/qualia-report/SKILL.md +105 -0
  37. package/skills/qualia-resume/SKILL.md +49 -0
  38. package/skills/qualia-review/SKILL.md +76 -0
  39. package/skills/qualia-ship/SKILL.md +90 -0
  40. package/skills/qualia-skill-new/SKILL.md +167 -0
  41. package/skills/qualia-task/SKILL.md +91 -0
  42. package/skills/qualia-verify/SKILL.md +113 -0
  43. package/templates/DESIGN.md +137 -0
  44. package/templates/plan.md +28 -0
  45. package/templates/project.md +22 -0
  46. package/templates/state.md +27 -0
  47. package/templates/tracking.json +20 -0
  48. package/tests/bin.test.sh +673 -0
  49. package/tests/hooks.test.sh +315 -0
  50. package/tests/state.test.sh +535 -0
  51. package/tests/statusline.test.sh +243 -0
  52. package/bin/collect-metrics.sh +0 -62
  53. package/framework/.claudeignore +0 -51
  54. package/framework/CLAUDE.md +0 -51
  55. package/framework/MCP_SETUP.md +0 -229
  56. package/framework/agents/architecture-strategist.md +0 -53
  57. package/framework/agents/backend-agent.md +0 -150
  58. package/framework/agents/code-simplicity-reviewer.md +0 -86
  59. package/framework/agents/frontend-agent.md +0 -111
  60. package/framework/agents/kieran-typescript-reviewer.md +0 -96
  61. package/framework/agents/performance-oracle.md +0 -111
  62. package/framework/agents/qualia-codebase-mapper.md +0 -761
  63. package/framework/agents/qualia-debugger.md +0 -1204
  64. package/framework/agents/qualia-executor.md +0 -882
  65. package/framework/agents/qualia-integration-checker.md +0 -424
  66. package/framework/agents/qualia-phase-researcher.md +0 -457
  67. package/framework/agents/qualia-plan-checker.md +0 -700
  68. package/framework/agents/qualia-planner.md +0 -1245
  69. package/framework/agents/qualia-project-researcher.md +0 -603
  70. package/framework/agents/qualia-research-synthesizer.md +0 -200
  71. package/framework/agents/qualia-roadmapper.md +0 -606
  72. package/framework/agents/qualia-verifier.md +0 -686
  73. package/framework/agents/red-team-qa.md +0 -130
  74. package/framework/agents/security-auditor.md +0 -72
  75. package/framework/agents/team-orchestrator.md +0 -229
  76. package/framework/agents/teams/framework-audit-team.md +0 -66
  77. package/framework/agents/teams/full-stack-team.md +0 -48
  78. package/framework/agents/teams/optimize-team.md +0 -53
  79. package/framework/agents/teams/review-team.md +0 -70
  80. package/framework/agents/teams/ship-team.md +0 -86
  81. package/framework/agents/test-agent.md +0 -182
  82. package/framework/hooks/auto-format.sh +0 -54
  83. package/framework/hooks/block-env-edit.sh +0 -42
  84. package/framework/hooks/branch-guard.sh +0 -43
  85. package/framework/hooks/confirm-delete.sh +0 -59
  86. package/framework/hooks/migration-validate.sh +0 -77
  87. package/framework/hooks/notification-speak.sh +0 -16
  88. package/framework/hooks/pre-commit.sh +0 -100
  89. package/framework/hooks/pre-compact.sh +0 -56
  90. package/framework/hooks/pre-deploy-gate.sh +0 -160
  91. package/framework/hooks/qualia-colors.sh +0 -32
  92. package/framework/hooks/retention-cleanup.sh +0 -62
  93. package/framework/hooks/save-session-state.sh +0 -185
  94. package/framework/hooks/session-context-loader.sh +0 -96
  95. package/framework/hooks/session-learn.sh +0 -32
  96. package/framework/hooks/skill-announce.sh +0 -123
  97. package/framework/hooks/tool-error-announce.sh +0 -27
  98. package/framework/install.ps1 +0 -323
  99. package/framework/install.sh +0 -313
  100. package/framework/qualia-framework/VERSION +0 -1
  101. package/framework/qualia-framework/assets/qualia-logo.png +0 -0
  102. package/framework/qualia-framework/bin/collect-metrics.sh +0 -67
  103. package/framework/qualia-framework/bin/generate-report-docx.py +0 -429
  104. package/framework/qualia-framework/bin/qualia-tools.js +0 -2201
  105. package/framework/qualia-framework/bin/qualia-tools.test.js +0 -1054
  106. package/framework/qualia-framework/references/checkpoints.md +0 -775
  107. package/framework/qualia-framework/references/completion-checklists.md +0 -359
  108. package/framework/qualia-framework/references/continuation-format.md +0 -249
  109. package/framework/qualia-framework/references/continuation-prompt.md +0 -97
  110. package/framework/qualia-framework/references/decimal-phase-calculation.md +0 -65
  111. package/framework/qualia-framework/references/design-quality.md +0 -56
  112. package/framework/qualia-framework/references/employee-guide.md +0 -167
  113. package/framework/qualia-framework/references/git-integration.md +0 -254
  114. package/framework/qualia-framework/references/git-planning-commit.md +0 -50
  115. package/framework/qualia-framework/references/model-profile-resolution.md +0 -32
  116. package/framework/qualia-framework/references/model-profiles.md +0 -73
  117. package/framework/qualia-framework/references/phase-argument-parsing.md +0 -61
  118. package/framework/qualia-framework/references/planning-config.md +0 -195
  119. package/framework/qualia-framework/references/questioning.md +0 -141
  120. package/framework/qualia-framework/references/tdd.md +0 -263
  121. package/framework/qualia-framework/references/ui-brand.md +0 -160
  122. package/framework/qualia-framework/references/verification-patterns.md +0 -612
  123. package/framework/qualia-framework/templates/DEBUG.md +0 -159
  124. package/framework/qualia-framework/templates/DESIGN.md +0 -81
  125. package/framework/qualia-framework/templates/UAT.md +0 -247
  126. package/framework/qualia-framework/templates/codebase/architecture.md +0 -255
  127. package/framework/qualia-framework/templates/codebase/concerns.md +0 -310
  128. package/framework/qualia-framework/templates/codebase/conventions.md +0 -307
  129. package/framework/qualia-framework/templates/codebase/integrations.md +0 -280
  130. package/framework/qualia-framework/templates/codebase/stack.md +0 -186
  131. package/framework/qualia-framework/templates/codebase/structure.md +0 -285
  132. package/framework/qualia-framework/templates/codebase/testing.md +0 -480
  133. package/framework/qualia-framework/templates/config.json +0 -35
  134. package/framework/qualia-framework/templates/context.md +0 -283
  135. package/framework/qualia-framework/templates/continue-here.md +0 -78
  136. package/framework/qualia-framework/templates/debug-subagent-prompt.md +0 -91
  137. package/framework/qualia-framework/templates/discovery.md +0 -146
  138. package/framework/qualia-framework/templates/lab-notes.md +0 -16
  139. package/framework/qualia-framework/templates/milestone-archive.md +0 -123
  140. package/framework/qualia-framework/templates/milestone.md +0 -115
  141. package/framework/qualia-framework/templates/phase-prompt.md +0 -567
  142. package/framework/qualia-framework/templates/planner-subagent-prompt.md +0 -117
  143. package/framework/qualia-framework/templates/project.md +0 -184
  144. package/framework/qualia-framework/templates/projects/ai-agent.md +0 -156
  145. package/framework/qualia-framework/templates/projects/mobile-app.md +0 -181
  146. package/framework/qualia-framework/templates/projects/voice-agent.md +0 -134
  147. package/framework/qualia-framework/templates/projects/website.md +0 -137
  148. package/framework/qualia-framework/templates/requirements.md +0 -231
  149. package/framework/qualia-framework/templates/research-project/ARCHITECTURE.md +0 -204
  150. package/framework/qualia-framework/templates/research-project/FEATURES.md +0 -147
  151. package/framework/qualia-framework/templates/research-project/PITFALLS.md +0 -200
  152. package/framework/qualia-framework/templates/research-project/STACK.md +0 -120
  153. package/framework/qualia-framework/templates/research-project/SUMMARY.md +0 -170
  154. package/framework/qualia-framework/templates/research.md +0 -552
  155. package/framework/qualia-framework/templates/roadmap.md +0 -206
  156. package/framework/qualia-framework/templates/state.md +0 -179
  157. package/framework/qualia-framework/templates/summary-complex.md +0 -59
  158. package/framework/qualia-framework/templates/summary-minimal.md +0 -41
  159. package/framework/qualia-framework/templates/summary-standard.md +0 -48
  160. package/framework/qualia-framework/templates/summary.md +0 -246
  161. package/framework/qualia-framework/templates/user-setup.md +0 -311
  162. package/framework/qualia-framework/templates/verification-report.md +0 -322
  163. package/framework/qualia-framework/workflows/add-phase.md +0 -179
  164. package/framework/qualia-framework/workflows/add-todo.md +0 -157
  165. package/framework/qualia-framework/workflows/audit-milestone.md +0 -241
  166. package/framework/qualia-framework/workflows/check-todos.md +0 -176
  167. package/framework/qualia-framework/workflows/complete-milestone.md +0 -858
  168. package/framework/qualia-framework/workflows/diagnose-issues.md +0 -219
  169. package/framework/qualia-framework/workflows/discovery-phase.md +0 -289
  170. package/framework/qualia-framework/workflows/discuss-phase.md +0 -534
  171. package/framework/qualia-framework/workflows/execute-phase.md +0 -559
  172. package/framework/qualia-framework/workflows/execute-plan.md +0 -438
  173. package/framework/qualia-framework/workflows/help.md +0 -470
  174. package/framework/qualia-framework/workflows/insert-phase.md +0 -220
  175. package/framework/qualia-framework/workflows/list-phase-assumptions.md +0 -178
  176. package/framework/qualia-framework/workflows/map-codebase.md +0 -327
  177. package/framework/qualia-framework/workflows/new-milestone.md +0 -363
  178. package/framework/qualia-framework/workflows/new-project.md +0 -982
  179. package/framework/qualia-framework/workflows/pause-work.md +0 -122
  180. package/framework/qualia-framework/workflows/plan-milestone-gaps.md +0 -256
  181. package/framework/qualia-framework/workflows/plan-phase.md +0 -422
  182. package/framework/qualia-framework/workflows/progress.md +0 -389
  183. package/framework/qualia-framework/workflows/quick.md +0 -252
  184. package/framework/qualia-framework/workflows/remove-phase.md +0 -326
  185. package/framework/qualia-framework/workflows/research-phase.md +0 -74
  186. package/framework/qualia-framework/workflows/resume-project.md +0 -306
  187. package/framework/qualia-framework/workflows/set-profile.md +0 -80
  188. package/framework/qualia-framework/workflows/settings.md +0 -145
  189. package/framework/qualia-framework/workflows/transition.md +0 -556
  190. package/framework/qualia-framework/workflows/update.md +0 -197
  191. package/framework/qualia-framework/workflows/verify-phase.md +0 -195
  192. package/framework/qualia-framework/workflows/verify-work.md +0 -625
  193. package/framework/rules/context7.md +0 -14
  194. package/framework/rules/frontend.md +0 -33
  195. package/framework/rules/speed.md +0 -23
  196. package/framework/scripts/__pycache__/say.cpython-314.pyc +0 -0
  197. package/framework/scripts/apply-retention.sh +0 -120
  198. package/framework/scripts/bootstrap-pop-os.sh +0 -354
  199. package/framework/scripts/claude-voice +0 -13
  200. package/framework/scripts/cleanup.sh +0 -131
  201. package/framework/scripts/cowork-mode.sh +0 -141
  202. package/framework/scripts/generate-project-claude-md.sh +0 -153
  203. package/framework/scripts/load-test-webhook.js +0 -172
  204. package/framework/scripts/say.py +0 -236
  205. package/framework/scripts/showcase-video-recorder/ffmpeg-builder.js +0 -167
  206. package/framework/scripts/showcase-video-recorder/playwright-helpers.js +0 -216
  207. package/framework/scripts/speak.py +0 -55
  208. package/framework/scripts/speak.sh +0 -18
  209. package/framework/scripts/status.sh +0 -138
  210. package/framework/scripts/sync-to-framework.sh +0 -65
  211. package/framework/scripts/voice-hotkey.py +0 -227
  212. package/framework/scripts/voice-input.sh +0 -51
  213. package/framework/skills/animate/SKILL.md +0 -202
  214. package/framework/skills/bolder/SKILL.md +0 -144
  215. package/framework/skills/browser-qa/SKILL.md +0 -536
  216. package/framework/skills/clarify/SKILL.md +0 -179
  217. package/framework/skills/client-handoff/SKILL.md +0 -135
  218. package/framework/skills/collab-onboard/SKILL.md +0 -111
  219. package/framework/skills/colorize/SKILL.md +0 -170
  220. package/framework/skills/critique/SKILL.md +0 -126
  221. package/framework/skills/deep-research/SKILL.md +0 -240
  222. package/framework/skills/delight/SKILL.md +0 -329
  223. package/framework/skills/deploy/SKILL.md +0 -261
  224. package/framework/skills/deploy-verify/SKILL.md +0 -377
  225. package/framework/skills/deploy-verify/scripts/canary-check.sh +0 -206
  226. package/framework/skills/deploy-verify/scripts/check-console-errors.js +0 -147
  227. package/framework/skills/deploy-verify/scripts/check-cwv.js +0 -139
  228. package/framework/skills/deploy-verify/scripts/project-detect.sh +0 -84
  229. package/framework/skills/deploy-verify/scripts/verify.sh +0 -548
  230. package/framework/skills/design-quieter/SKILL.md +0 -130
  231. package/framework/skills/distill/SKILL.md +0 -149
  232. package/framework/skills/docs-lookup/SKILL.md +0 -79
  233. package/framework/skills/fcm-notifications/SKILL.md +0 -125
  234. package/framework/skills/financial-ledger/SKILL.md +0 -1039
  235. package/framework/skills/frontend-master/NOTICE.md +0 -4
  236. package/framework/skills/frontend-master/SKILL.md +0 -127
  237. package/framework/skills/frontend-master/reference/color-and-contrast.md +0 -132
  238. package/framework/skills/frontend-master/reference/interaction-design.md +0 -123
  239. package/framework/skills/frontend-master/reference/motion-design.md +0 -99
  240. package/framework/skills/frontend-master/reference/responsive-design.md +0 -114
  241. package/framework/skills/frontend-master/reference/spatial-design.md +0 -100
  242. package/framework/skills/frontend-master/reference/typography.md +0 -131
  243. package/framework/skills/frontend-master/reference/ux-writing.md +0 -107
  244. package/framework/skills/harden/SKILL.md +0 -357
  245. package/framework/skills/i18n-rtl/SKILL.md +0 -752
  246. package/framework/skills/learn/SKILL.md +0 -95
  247. package/framework/skills/memory/SKILL.md +0 -50
  248. package/framework/skills/mobile-expo/SKILL.md +0 -977
  249. package/framework/skills/mobile-expo/references/store-checklist.md +0 -550
  250. package/framework/skills/nestjs-backend/README.md +0 -73
  251. package/framework/skills/nestjs-backend/SKILL.md +0 -446
  252. package/framework/skills/nestjs-backend/references/templates.md +0 -1173
  253. package/framework/skills/normalize/SKILL.md +0 -79
  254. package/framework/skills/onboard/SKILL.md +0 -242
  255. package/framework/skills/openrouter-agent/SKILL.md +0 -922
  256. package/framework/skills/polish/SKILL.md +0 -209
  257. package/framework/skills/pr/SKILL.md +0 -66
  258. package/framework/skills/qualia/SKILL.md +0 -199
  259. package/framework/skills/qualia-add-todo/SKILL.md +0 -68
  260. package/framework/skills/qualia-audit-milestone/SKILL.md +0 -95
  261. package/framework/skills/qualia-check-todos/SKILL.md +0 -55
  262. package/framework/skills/qualia-complete-milestone/SKILL.md +0 -134
  263. package/framework/skills/qualia-debug/SKILL.md +0 -149
  264. package/framework/skills/qualia-design/SKILL.md +0 -203
  265. package/framework/skills/qualia-discuss-phase/SKILL.md +0 -72
  266. package/framework/skills/qualia-evolve/SKILL.md +0 -200
  267. package/framework/skills/qualia-execute-phase/SKILL.md +0 -89
  268. package/framework/skills/qualia-framework-audit/SKILL.md +0 -604
  269. package/framework/skills/qualia-guide/SKILL.md +0 -32
  270. package/framework/skills/qualia-help/SKILL.md +0 -114
  271. package/framework/skills/qualia-idk/SKILL.md +0 -352
  272. package/framework/skills/qualia-list-phase-assumptions/SKILL.md +0 -67
  273. package/framework/skills/qualia-new-milestone/SKILL.md +0 -72
  274. package/framework/skills/qualia-new-project/SKILL.md +0 -232
  275. package/framework/skills/qualia-pause-work/SKILL.md +0 -96
  276. package/framework/skills/qualia-plan-milestone-gaps/SKILL.md +0 -57
  277. package/framework/skills/qualia-plan-phase/SKILL.md +0 -104
  278. package/framework/skills/qualia-production-check/SKILL.md +0 -0
  279. package/framework/skills/qualia-progress/SKILL.md +0 -53
  280. package/framework/skills/qualia-quick/SKILL.md +0 -89
  281. package/framework/skills/qualia-report/SKILL.md +0 -166
  282. package/framework/skills/qualia-research-phase/SKILL.md +0 -88
  283. package/framework/skills/qualia-resume-work/SKILL.md +0 -62
  284. package/framework/skills/qualia-review/SKILL.md +0 -263
  285. package/framework/skills/qualia-start/SKILL.md +0 -161
  286. package/framework/skills/qualia-verify-work/SKILL.md +0 -132
  287. package/framework/skills/rag/SKILL.md +0 -750
  288. package/framework/skills/responsive/SKILL.md +0 -231
  289. package/framework/skills/retro/SKILL.md +0 -284
  290. package/framework/skills/sakani-conventions/SKILL.md +0 -136
  291. package/framework/skills/sakani-conventions/evals/evals.json +0 -23
  292. package/framework/skills/sakani-conventions/references/entities.md +0 -365
  293. package/framework/skills/sakani-conventions/references/error-codes.md +0 -95
  294. package/framework/skills/seo-master/SKILL.md +0 -490
  295. package/framework/skills/seo-master/references/checklist.md +0 -199
  296. package/framework/skills/seo-master/references/structured-data.md +0 -609
  297. package/framework/skills/ship/SKILL.md +0 -239
  298. package/framework/skills/stack-researcher/SKILL.md +0 -215
  299. package/framework/skills/status/SKILL.md +0 -154
  300. package/framework/skills/status/scripts/health-check.sh +0 -562
  301. package/framework/skills/subscription-payments/SKILL.md +0 -250
  302. package/framework/skills/supabase/SKILL.md +0 -973
  303. package/framework/skills/supabase/references/templates.md +0 -159
  304. package/framework/skills/team/SKILL.md +0 -67
  305. package/framework/skills/test-runner/SKILL.md +0 -202
  306. package/framework/skills/voice-agent/SKILL.md +0 -1312
  307. package/framework/skills/zoho-workflow/SKILL.md +0 -51
  308. package/framework/statusline-command.sh +0 -117
  309. package/framework/teams/default/inboxes/plan-04.json +0 -9
  310. package/framework/teams/review-team.md +0 -75
  311. package/framework/teams/ship-team.md +0 -86
  312. package/profiles/fawzi.json +0 -16
  313. package/profiles/hasan.json +0 -16
  314. package/profiles/moayad.json +0 -16
  315. package/templates/CLAUDE-owner.md +0 -52
  316. package/templates/CLAUDE.md.hbs +0 -58
  317. package/templates/env.claude.template +0 -12
  318. package/templates/settings.json +0 -172
  319. package/uninstall.sh +0 -90
  320. /package/{framework/rules → rules}/deployment.md +0 -0
  321. /package/{framework/rules → rules}/security.md +0 -0
@@ -1,206 +0,0 @@
1
- #!/bin/bash
2
- # canary-check.sh — Post-deploy canary health check
3
- # Compares live metrics against stored baseline, flags regressions
4
- # after 2 consecutive failures.
5
- #
6
- # Usage: canary-check.sh <URL> [--project-dir /path] [--update-baseline]
7
-
8
- set -euo pipefail
9
-
10
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
-
12
- # ─── Parse args ──────────────────────────────────────────────
13
- URL=""
14
- PROJECT_DIR=""
15
- UPDATE_BASELINE=false
16
-
17
- while [[ $# -gt 0 ]]; do
18
- case "$1" in
19
- --project-dir) PROJECT_DIR="$2"; shift 2 ;;
20
- --update-baseline) UPDATE_BASELINE=true; shift ;;
21
- -*) echo "Unknown option: $1"; exit 1 ;;
22
- *) URL="${1%/}"; shift ;;
23
- esac
24
- done
25
-
26
- if [[ -z "$URL" ]]; then
27
- echo '{"status":"FAIL","detail":"No URL provided"}'
28
- exit 1
29
- fi
30
-
31
- PROJECT_DIR="${PROJECT_DIR:-$(pwd)}"
32
- BASELINE_FILE="$PROJECT_DIR/.planning/canary-baseline.json"
33
-
34
- # Failure tracking file keyed by URL hash
35
- URL_HASH=$(echo -n "$URL" | md5sum | cut -d' ' -f1)
36
- FAILURE_FILE="/tmp/.canary-failures-${URL_HASH}"
37
-
38
- # ─── Colors ──────────────────────────────────────────────────
39
- C_RESET="\033[0m"
40
- C_GREEN="\033[32m"
41
- C_YELLOW="\033[33m"
42
- C_RED="\033[31m"
43
- C_BOLD="\033[1m"
44
- C_DIM="\033[2m"
45
-
46
- # ─── Collect current metrics ────────────────────────────────
47
- # Metric 1: HTTP status
48
- CURRENT_HTTP=$(curl -sL -o /dev/null -w "%{http_code}" --max-time 15 "$URL" 2>/dev/null || echo "000")
49
-
50
- # Metric 2: Page load time (median of 3 measurements, in ms)
51
- LOAD_TIMES=()
52
- for i in 1 2 3; do
53
- t=$(curl -sL -o /dev/null -w "%{time_total}" --max-time 15 "$URL" 2>/dev/null || echo "99")
54
- ms=$(echo "$t * 1000" | bc 2>/dev/null | cut -d. -f1)
55
- LOAD_TIMES+=("${ms:-9999}")
56
- done
57
- IFS=$'\n' SORTED_TIMES=($(sort -n <<<"${LOAD_TIMES[*]}")); unset IFS
58
- CURRENT_LOAD_MS=${SORTED_TIMES[1]}
59
-
60
- # Metric 3: Console error count (reuse existing check-console-errors.js)
61
- CONSOLE_RESULT=$(node "$SCRIPT_DIR/check-console-errors.js" "$URL" 2>/dev/null || echo '{"status":"SKIP","errors":[]}')
62
- CURRENT_CONSOLE_ERRORS=$(echo "$CONSOLE_RESULT" | jq '.errors | length' 2>/dev/null || echo "0")
63
-
64
- # ─── Update baseline mode ───────────────────────────────────
65
- if $UPDATE_BASELINE; then
66
- mkdir -p "$(dirname "$BASELINE_FILE")"
67
- cat > "$BASELINE_FILE" <<BEOF
68
- {
69
- "url": "$URL",
70
- "captured_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
71
- "http_status": $CURRENT_HTTP,
72
- "console_error_count": $CURRENT_CONSOLE_ERRORS,
73
- "load_time_ms": $CURRENT_LOAD_MS,
74
- "consecutive_failures": 0
75
- }
76
- BEOF
77
- echo -e "${C_GREEN}Canary baseline saved to $BASELINE_FILE${C_RESET}"
78
- echo -e " HTTP: $CURRENT_HTTP | Load: ${CURRENT_LOAD_MS}ms | Console errors: $CURRENT_CONSOLE_ERRORS"
79
- # Reset failure counter
80
- rm -f "$FAILURE_FILE"
81
- exit 0
82
- fi
83
-
84
- # ─── Load baseline ──────────────────────────────────────────
85
- if [[ ! -f "$BASELINE_FILE" ]]; then
86
- echo -e "${C_YELLOW}No canary baseline found at $BASELINE_FILE${C_RESET}"
87
- echo -e "${C_YELLOW}Creating initial baseline from current metrics...${C_RESET}"
88
- # Auto-create baseline on first run
89
- mkdir -p "$(dirname "$BASELINE_FILE")"
90
- cat > "$BASELINE_FILE" <<BEOF
91
- {
92
- "url": "$URL",
93
- "captured_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
94
- "http_status": $CURRENT_HTTP,
95
- "console_error_count": $CURRENT_CONSOLE_ERRORS,
96
- "load_time_ms": $CURRENT_LOAD_MS,
97
- "consecutive_failures": 0
98
- }
99
- BEOF
100
- echo -e "${C_GREEN}Baseline created. Next canary run will compare against this.${C_RESET}"
101
- rm -f "$FAILURE_FILE"
102
- exit 0
103
- fi
104
-
105
- BASELINE_HTTP=$(jq -r '.http_status' "$BASELINE_FILE")
106
- BASELINE_CONSOLE=$(jq -r '.console_error_count' "$BASELINE_FILE")
107
- BASELINE_LOAD=$(jq -r '.load_time_ms' "$BASELINE_FILE")
108
-
109
- # ─── Compare against baseline (relative thresholds) ─────────
110
- REGRESSIONS=()
111
- LOAD_THRESHOLD=$((BASELINE_LOAD * 2))
112
-
113
- # Check 1: HTTP status mismatch
114
- if [[ "$CURRENT_HTTP" != "$BASELINE_HTTP" ]]; then
115
- REGRESSIONS+=("HTTP status: baseline=${BASELINE_HTTP}, current=${CURRENT_HTTP}")
116
- fi
117
-
118
- # Check 2: Console errors increased (any new errors vs baseline count)
119
- if [[ "$CURRENT_CONSOLE_ERRORS" -gt "$BASELINE_CONSOLE" ]]; then
120
- NEW_ERRORS=$((CURRENT_CONSOLE_ERRORS - BASELINE_CONSOLE))
121
- REGRESSIONS+=("Console errors: baseline=${BASELINE_CONSOLE}, current=${CURRENT_CONSOLE_ERRORS} (+${NEW_ERRORS} new)")
122
- fi
123
-
124
- # Check 3: Load time exceeds 2x baseline
125
- if [[ "$CURRENT_LOAD_MS" -gt "$LOAD_THRESHOLD" ]]; then
126
- REGRESSIONS+=("Load time: baseline=${BASELINE_LOAD}ms, current=${CURRENT_LOAD_MS}ms (threshold: ${LOAD_THRESHOLD}ms)")
127
- fi
128
-
129
- # ─── Consecutive failure tracking ────────────────────────────
130
- PREV_FAILURES=0
131
- if [[ -f "$FAILURE_FILE" ]]; then
132
- PREV_FAILURES=$(cat "$FAILURE_FILE" 2>/dev/null || echo "0")
133
- fi
134
-
135
- # ─── Output ──────────────────────────────────────────────────
136
- echo ""
137
- echo -e "${C_BOLD}──────────────────────────────────────────────────────${C_RESET}"
138
- echo -e " ${C_BOLD}CANARY CHECK${C_RESET} — T+2min post-deploy"
139
- echo -e " URL: ${URL}"
140
- echo -e " Baseline: $(jq -r '.captured_at' "$BASELINE_FILE")"
141
- echo -e "${C_BOLD}──────────────────────────────────────────────────────${C_RESET}"
142
- echo ""
143
-
144
- # Metric comparison table
145
- printf " %-20s %-12s %-12s %-12s\n" "Metric" "Baseline" "Current" "Status"
146
- printf " %-20s %-12s %-12s %-12s\n" "────────────────────" "────────────" "────────────" "────────────"
147
-
148
- # HTTP row
149
- if [[ "$CURRENT_HTTP" == "$BASELINE_HTTP" ]]; then
150
- printf " %-20s %-12s %-12s ${C_GREEN}%-12s${C_RESET}\n" "HTTP Status" "$BASELINE_HTTP" "$CURRENT_HTTP" "OK"
151
- else
152
- printf " %-20s %-12s %-12s ${C_RED}%-12s${C_RESET}\n" "HTTP Status" "$BASELINE_HTTP" "$CURRENT_HTTP" "REGRESSION"
153
- fi
154
-
155
- # Console errors row
156
- if [[ "$CURRENT_CONSOLE_ERRORS" -le "$BASELINE_CONSOLE" ]]; then
157
- printf " %-20s %-12s %-12s ${C_GREEN}%-12s${C_RESET}\n" "Console Errors" "$BASELINE_CONSOLE" "$CURRENT_CONSOLE_ERRORS" "OK"
158
- else
159
- printf " %-20s %-12s %-12s ${C_RED}%-12s${C_RESET}\n" "Console Errors" "$BASELINE_CONSOLE" "$CURRENT_CONSOLE_ERRORS" "REGRESSION"
160
- fi
161
-
162
- # Load time row
163
- if [[ "$CURRENT_LOAD_MS" -le "$LOAD_THRESHOLD" ]]; then
164
- printf " %-20s %-12s %-12s ${C_GREEN}%-12s${C_RESET}\n" "Load Time (ms)" "$BASELINE_LOAD" "$CURRENT_LOAD_MS" "OK (<${LOAD_THRESHOLD}ms)"
165
- else
166
- printf " %-20s %-12s %-12s ${C_RED}%-12s${C_RESET}\n" "Load Time (ms)" "$BASELINE_LOAD" "$CURRENT_LOAD_MS" "REGRESSION (>${LOAD_THRESHOLD}ms)"
167
- fi
168
-
169
- echo ""
170
-
171
- if [[ ${#REGRESSIONS[@]} -eq 0 ]]; then
172
- # All good — reset failure counter
173
- echo "0" > "$FAILURE_FILE"
174
- echo -e " ${C_GREEN}CANARY PASS${C_RESET} — All metrics within baseline thresholds"
175
- echo ""
176
- exit 0
177
- fi
178
-
179
- # Regressions detected — increment failure counter
180
- CONSECUTIVE=$((PREV_FAILURES + 1))
181
- echo "$CONSECUTIVE" > "$FAILURE_FILE"
182
-
183
- if [[ "$CONSECUTIVE" -ge 2 ]]; then
184
- # 2+ consecutive failures — FLAG REGRESSION
185
- echo -e " ${C_RED}${C_BOLD}CANARY ALERT — REGRESSION DETECTED${C_RESET}"
186
- echo -e " ${C_RED}Consecutive failures: ${CONSECUTIVE}${C_RESET}"
187
- echo ""
188
- for reg in "${REGRESSIONS[@]}"; do
189
- echo -e " ${C_RED} - ${reg}${C_RESET}"
190
- done
191
- echo ""
192
- echo -e " ${C_DIM}Action: Investigate regressions. If false alarm, update baseline:${C_RESET}"
193
- echo -e " ${C_DIM} bash $SCRIPT_DIR/canary-check.sh $URL --update-baseline${C_RESET}"
194
- echo ""
195
- exit 1
196
- else
197
- # First failure — note but do NOT alert
198
- echo -e " ${C_YELLOW}CANARY WARN — Regression detected (1st occurrence, not alerting)${C_RESET}"
199
- echo -e " ${C_YELLOW}Will alert if next canary also fails.${C_RESET}"
200
- echo ""
201
- for reg in "${REGRESSIONS[@]}"; do
202
- echo -e " ${C_YELLOW} - ${reg}${C_RESET}"
203
- done
204
- echo ""
205
- exit 0
206
- fi
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env node
2
- // check-console-errors.js — Detect client-side JS errors via Playwright headless browser
3
- // Usage: node check-console-errors.js <URL>
4
- // Output: JSON { "status": "PASS|WARN|FAIL", "errors": [...], "detail": "..." }
5
-
6
- const url = process.argv[2];
7
- if (!url) {
8
- console.log(JSON.stringify({ status: "FAIL", errors: [], detail: "No URL provided" }));
9
- process.exit(1);
10
- }
11
-
12
- // Known benign error patterns (third-party, browser extensions, etc.)
13
- const BENIGN_PATTERNS = [
14
- /third.?party/i,
15
- /gtag/i,
16
- /analytics/i,
17
- /fbq/i,
18
- /hotjar/i,
19
- /intercom/i,
20
- /clarity/i,
21
- /sentry/i,
22
- /Failed to load resource.*favicon/i,
23
- /ERR_BLOCKED_BY_CLIENT/i, // ad blockers
24
- /net::ERR_FAILED.*chrome-extension/i,
25
- /ResizeObserver loop/i,
26
- /Loading chunk.*failed/i, // sometimes transient
27
- ];
28
-
29
- // Critical error patterns — these always mean FAIL
30
- const CRITICAL_PATTERNS = [
31
- /TypeError/,
32
- /ReferenceError/,
33
- /SyntaxError/,
34
- /ChunkLoadError/,
35
- /Unhandled/i,
36
- /NEXT_/,
37
- /Internal Server Error/i,
38
- /500/,
39
- /Cannot read propert/i,
40
- /is not defined/i,
41
- /is not a function/i,
42
- /Hydration/i,
43
- ];
44
-
45
- async function run() {
46
- let chromium;
47
- try {
48
- // Try to import playwright
49
- const pw = require('playwright');
50
- chromium = pw.chromium;
51
- } catch {
52
- try {
53
- const pw = require('playwright-core');
54
- chromium = pw.chromium;
55
- } catch {
56
- console.log(JSON.stringify({
57
- status: "SKIP",
58
- errors: [],
59
- detail: "Playwright not available — install with: npm i -g playwright"
60
- }));
61
- process.exit(0);
62
- }
63
- }
64
-
65
- const errors = [];
66
- const warnings = [];
67
- let browser;
68
-
69
- try {
70
- browser = await chromium.launch({
71
- headless: true,
72
- args: ['--no-sandbox', '--disable-setuid-sandbox'],
73
- });
74
- const page = await browser.newPage();
75
-
76
- // Collect console errors
77
- page.on('console', msg => {
78
- if (msg.type() === 'error') {
79
- errors.push(msg.text());
80
- }
81
- });
82
-
83
- // Collect page-level errors (uncaught exceptions)
84
- page.on('pageerror', err => {
85
- errors.push(err.message || String(err));
86
- });
87
-
88
- // Navigate with timeout
89
- await page.goto(url, {
90
- waitUntil: 'networkidle',
91
- timeout: 30000,
92
- });
93
-
94
- // Give a brief extra moment for any late errors
95
- await page.waitForTimeout(2000);
96
-
97
- await browser.close();
98
- browser = null;
99
-
100
- // Classify errors
101
- const criticalErrors = [];
102
- const benignErrors = [];
103
-
104
- for (const err of errors) {
105
- const isBenign = BENIGN_PATTERNS.some(p => p.test(err));
106
- const isCritical = CRITICAL_PATTERNS.some(p => p.test(err));
107
-
108
- if (isCritical && !isBenign) {
109
- criticalErrors.push(err);
110
- } else {
111
- benignErrors.push(err);
112
- }
113
- }
114
-
115
- if (criticalErrors.length > 0) {
116
- console.log(JSON.stringify({
117
- status: "FAIL",
118
- errors: criticalErrors,
119
- benign: benignErrors.length,
120
- detail: `${criticalErrors.length} critical error(s): ${criticalErrors[0].substring(0, 120)}`,
121
- }));
122
- } else if (benignErrors.length > 0) {
123
- console.log(JSON.stringify({
124
- status: "WARN",
125
- errors: benignErrors,
126
- benign: benignErrors.length,
127
- detail: `${benignErrors.length} non-critical error(s) (third-party/benign)`,
128
- }));
129
- } else {
130
- console.log(JSON.stringify({
131
- status: "PASS",
132
- errors: [],
133
- detail: "No console errors detected",
134
- }));
135
- }
136
- } catch (err) {
137
- if (browser) await browser.close().catch(() => {});
138
- console.log(JSON.stringify({
139
- status: "FAIL",
140
- errors: [err.message],
141
- detail: `Browser check failed: ${err.message.substring(0, 120)}`,
142
- }));
143
- process.exit(1);
144
- }
145
- }
146
-
147
- run();
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env node
2
- // check-cwv.js — Core Web Vitals via Google PageSpeed Insights API
3
- // Usage: node check-cwv.js <URL>
4
- // Output: JSON { "status": "PASS|WARN|FAIL|SKIP", "metrics": {...}, "detail": "..." }
5
- //
6
- // Thresholds (Google standards):
7
- // LCP: < 2.5s PASS, 2.5-4s WARN, > 4s FAIL
8
- // CLS: < 0.1 PASS, 0.1-0.25 WARN, > 0.25 FAIL
9
- // INP: < 200ms PASS, 200-500ms WARN, > 500ms FAIL
10
-
11
- const url = process.argv[2];
12
- if (!url) {
13
- console.log(JSON.stringify({ status: "FAIL", metrics: {}, detail: "No URL provided" }));
14
- process.exit(1);
15
- }
16
-
17
- const THRESHOLDS = {
18
- LCP: { good: 2500, poor: 4000, unit: "ms", label: "Largest Contentful Paint" },
19
- CLS: { good: 0.1, poor: 0.25, unit: "", label: "Cumulative Layout Shift" },
20
- INP: { good: 200, poor: 500, unit: "ms", label: "Interaction to Next Paint" },
21
- };
22
-
23
- function classify(metric, value) {
24
- const t = THRESHOLDS[metric];
25
- if (value <= t.good) return "PASS";
26
- if (value <= t.poor) return "WARN";
27
- return "FAIL";
28
- }
29
-
30
- function formatValue(metric, value) {
31
- const t = THRESHOLDS[metric];
32
- if (metric === "CLS") return value.toFixed(2);
33
- if (metric === "LCP") return `${(value / 1000).toFixed(1)}s`;
34
- return `${Math.round(value)}${t.unit}`;
35
- }
36
-
37
- async function run() {
38
- const apiUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${encodeURIComponent(url)}&strategy=mobile&category=performance`;
39
-
40
- try {
41
- const response = await fetch(apiUrl, { signal: AbortSignal.timeout(60000) });
42
-
43
- if (!response.ok) {
44
- console.log(JSON.stringify({
45
- status: "SKIP",
46
- metrics: {},
47
- detail: `PageSpeed API returned ${response.status} — skipping CWV check`,
48
- }));
49
- process.exit(0);
50
- }
51
-
52
- const data = await response.json();
53
-
54
- // Extract metrics from field data (CrUX) first, fall back to lab data
55
- const metrics = {};
56
- let worstStatus = "PASS";
57
-
58
- // Try CrUX (field) data first — more representative of real users
59
- const fieldMetrics = data.loadingExperience?.metrics || {};
60
-
61
- // LCP
62
- if (fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS) {
63
- metrics.LCP = fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS.percentile;
64
- } else {
65
- // Fall back to Lighthouse lab data
66
- const lcpAudit = data.lighthouseResult?.audits?.['largest-contentful-paint'];
67
- if (lcpAudit) metrics.LCP = lcpAudit.numericValue;
68
- }
69
-
70
- // CLS
71
- if (fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE) {
72
- metrics.CLS = fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile / 100;
73
- } else {
74
- const clsAudit = data.lighthouseResult?.audits?.['cumulative-layout-shift'];
75
- if (clsAudit) metrics.CLS = clsAudit.numericValue;
76
- }
77
-
78
- // INP
79
- if (fieldMetrics.INTERACTION_TO_NEXT_PAINT) {
80
- metrics.INP = fieldMetrics.INTERACTION_TO_NEXT_PAINT.percentile;
81
- } else if (fieldMetrics.EXPERIMENTAL_INTERACTION_TO_NEXT_PAINT) {
82
- metrics.INP = fieldMetrics.EXPERIMENTAL_INTERACTION_TO_NEXT_PAINT.percentile;
83
- }
84
- // INP has no Lighthouse lab equivalent — skip if no field data
85
-
86
- // Build result
87
- const results = {};
88
- const parts = [];
89
-
90
- for (const [metric, value] of Object.entries(metrics)) {
91
- const status = classify(metric, value);
92
- const formatted = formatValue(metric, value);
93
- const icon = status === "PASS" ? "✓" : status === "WARN" ? "⚠" : "✗";
94
- results[metric] = { value, formatted, status };
95
- parts.push(`${metric}: ${formatted} ${icon}`);
96
-
97
- // Track worst status
98
- if (status === "FAIL") worstStatus = "FAIL";
99
- else if (status === "WARN" && worstStatus !== "FAIL") worstStatus = "WARN";
100
- }
101
-
102
- if (Object.keys(metrics).length === 0) {
103
- console.log(JSON.stringify({
104
- status: "SKIP",
105
- metrics: {},
106
- detail: "No CWV data available (site may lack sufficient traffic for CrUX data)",
107
- }));
108
- } else {
109
- // Also include overall performance score
110
- const perfScore = data.lighthouseResult?.categories?.performance?.score;
111
- if (perfScore !== undefined) {
112
- results.performanceScore = Math.round(perfScore * 100);
113
- parts.push(`Score: ${results.performanceScore}`);
114
- }
115
-
116
- console.log(JSON.stringify({
117
- status: worstStatus,
118
- metrics: results,
119
- detail: parts.join(" "),
120
- }));
121
- }
122
- } catch (err) {
123
- if (err.name === 'TimeoutError' || err.code === 'ABORT_ERR') {
124
- console.log(JSON.stringify({
125
- status: "SKIP",
126
- metrics: {},
127
- detail: "PageSpeed API timed out (60s) — skipping CWV check",
128
- }));
129
- } else {
130
- console.log(JSON.stringify({
131
- status: "SKIP",
132
- metrics: {},
133
- detail: `PageSpeed API error: ${err.message?.substring(0, 100)}`,
134
- }));
135
- }
136
- }
137
- }
138
-
139
- run();
@@ -1,84 +0,0 @@
1
- #!/bin/bash
2
- # project-detect.sh — Auto-detect project from current directory
3
- # Returns JSON: {"name":"...","supabase_ref":"...","hosting":"..."}
4
- #
5
- # Usage: source project-detect.sh (sets PROJECT_NAME, SUPABASE_REF, HOSTING)
6
- # or: bash project-detect.sh (prints JSON)
7
-
8
- CONTEXT_FILE="$HOME/.claude/knowledge/qualia-context.md"
9
- CWD="${1:-$(pwd)}"
10
- DIR_NAME=$(basename "$CWD")
11
-
12
- # Normalize common directory structures
13
- # ~/Projects/Live-Projects/vero → vero
14
- # ~/Projects/aiagents/sofiatesting → sofiatesting
15
- # ~/Projects/voice/under → under
16
- # ~/Projects/websites/qualia → qualia (ERP)
17
- PROJECT_NAME="$DIR_NAME"
18
-
19
- # Known project → Supabase ref mapping (from qualia-context.md)
20
- declare -A SUPABASE_REFS=(
21
- ["aquador"]="hznpuxplqgszbacxzbhv"
22
- ["maud"]="vspyxscitcuwnrhchskl"
23
- ["vero"]="zskfdlqyzhkzefafqkpx"
24
- ["aibossbrainz"]="esymbjpzjjkffpfqukxw"
25
- ["mpm"]="llherorsfgbdyqkrrlpc"
26
- ["Zaid"]="uoqiwidqlsoamtugioik"
27
- ["dababneh"]="toovladeybmlyzblqtbl"
28
- ["faris"]="lrgwxcqqnhxvvrruepcv"
29
- ["Hammah"]="ctcikdcjhxxqogwvtzrc"
30
- ["sofiatesting"]="vceeheaxcrhmpqueudqx"
31
- ["timo"]="qgaqvkmqterlljbegniu"
32
- ["under"]="vvppyijxpgeeijiozlve"
33
- )
34
-
35
- # Known project → hosting mapping
36
- declare -A HOSTING_MAP=(
37
- ["armenius"]="cloudflare"
38
- )
39
-
40
- SUPABASE_REF="${SUPABASE_REFS[$PROJECT_NAME]:-}"
41
- HOSTING="${HOSTING_MAP[$PROJECT_NAME]:-vercel}"
42
-
43
- # Also try to read from .env.local if no hardcoded ref
44
- if [[ -z "$SUPABASE_REF" ]]; then
45
- for env_file in "$CWD/.env.local" "$CWD/.env"; do
46
- if [[ -f "$env_file" ]]; then
47
- # Extract ref from NEXT_PUBLIC_SUPABASE_URL=https://XXX.supabase.co
48
- ref=$(grep -oP 'NEXT_PUBLIC_SUPABASE_URL=https://\K[^.]+' "$env_file" 2>/dev/null)
49
- if [[ -n "$ref" ]]; then
50
- SUPABASE_REF="$ref"
51
- break
52
- fi
53
- fi
54
- done
55
- fi
56
-
57
- # Detect external dependencies from env files
58
- DEPS=""
59
- for env_file in "$CWD/.env.local" "$CWD/.env"; do
60
- if [[ -f "$env_file" ]]; then
61
- # Read variable names only (not values) — security safe
62
- grep -oP '^[A-Z_]+(?==)' "$env_file" 2>/dev/null | while read -r var; do
63
- case "$var" in
64
- VAPI_*|NEXT_PUBLIC_VAPI_*) echo "vapi" ;;
65
- OPENROUTER_*) echo "openrouter" ;;
66
- ELEVEN_LABS_*|ELEVENLABS_*) echo "elevenlabs" ;;
67
- RETELL_*) echo "retell" ;;
68
- STRIPE_*|NEXT_PUBLIC_STRIPE_*) echo "stripe" ;;
69
- TELNYX_*) echo "telnyx" ;;
70
- esac
71
- done | sort -u
72
- break
73
- fi
74
- done > /tmp/deploy-verify-deps 2>/dev/null
75
- DEPS=$(cat /tmp/deploy-verify-deps 2>/dev/null | tr '\n' ',' | sed 's/,$//')
76
- rm -f /tmp/deploy-verify-deps
77
-
78
- # If sourced, export variables
79
- if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
80
- export PROJECT_NAME SUPABASE_REF HOSTING DEPS
81
- else
82
- # If run directly, print JSON
83
- echo "{\"name\":\"$PROJECT_NAME\",\"supabase_ref\":\"$SUPABASE_REF\",\"hosting\":\"$HOSTING\",\"deps\":\"$DEPS\"}"
84
- fi