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,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Apply professional design system for websites, apps, UI/UX, components, and business documents
|
|
3
|
+
argument-hint: "[website|app|dashboard|landing-page|component|document] [description or URL]"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- AskUserQuestion
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<objective>
|
|
15
|
+
Design and build professionally styled interfaces, components, and documents using a comprehensive design system. Uses the `frontend-master` skill for consistent visual hierarchy, spacing, color tokens, and modern design patterns.
|
|
16
|
+
|
|
17
|
+
**Supported contexts:**
|
|
18
|
+
- **Websites & Landing Pages** — Hero sections, feature grids, pricing tables, testimonials, CTAs, footers
|
|
19
|
+
- **Web Apps & Dashboards** — Sidebar nav, stat cards, data tables, charts, activity feeds, filters
|
|
20
|
+
- **UI Components** — Buttons, forms, cards, modals, navigation, tables, toasts, dropdowns
|
|
21
|
+
- **Mobile & Responsive** — Bottom nav, touch targets, responsive breakpoints, mobile-first layouts
|
|
22
|
+
- **Business Documents** — Contracts, proposals, SOWs, NDAs, invoices, reports (docx/PDF output)
|
|
23
|
+
|
|
24
|
+
**What it does:**
|
|
25
|
+
- Applies design tokens: colors (light/dark mode), typography scale, 8px spacing grid
|
|
26
|
+
- Implements component patterns with proper states (hover, focus, active, disabled, loading, error)
|
|
27
|
+
- Ensures WCAG AA accessibility (contrast, keyboard nav, screen reader, touch targets)
|
|
28
|
+
- Uses responsive breakpoints (640px → 1536px+) with mobile-first approach
|
|
29
|
+
- Structures layouts using CSS Grid/Flexbox with proper max-widths
|
|
30
|
+
- Outputs as HTML/React/JSX for interfaces, or .docx/.pdf for documents
|
|
31
|
+
</objective>
|
|
32
|
+
|
|
33
|
+
<process>
|
|
34
|
+
1. Read the `frontend-master` skill from `skills/frontend-master/SKILL.md`
|
|
35
|
+
2. Determine the design context from $ARGUMENTS:
|
|
36
|
+
- **Interface/component**: Identify what's being built (page, component, full app)
|
|
37
|
+
- **Document**: Identify document type (contract, proposal, invoice, etc.)
|
|
38
|
+
3. If redesigning existing work, read/screenshot it and identify improvements
|
|
39
|
+
4. If creating from scratch:
|
|
40
|
+
- Ask for key details (purpose, audience, features, brand preferences)
|
|
41
|
+
- Select appropriate layout pattern from the skill
|
|
42
|
+
- Choose color palette (or use defaults with primary accent)
|
|
43
|
+
5. Build with the design system:
|
|
44
|
+
- Apply color tokens, typography scale, spacing grid
|
|
45
|
+
- Implement proper component patterns with all interaction states
|
|
46
|
+
- Ensure responsive behavior at all breakpoints
|
|
47
|
+
- Add accessibility features (contrast, focus indicators, ARIA)
|
|
48
|
+
6. Run through the design checklist (visual, interactive, responsive, performance)
|
|
49
|
+
7. Output the appropriate format:
|
|
50
|
+
- HTML/React/JSX for web interfaces
|
|
51
|
+
- .docx or .pdf for business documents
|
|
52
|
+
- Code snippets for individual components
|
|
53
|
+
</process>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Quick Supabase database operation (query, migration, RLS)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Perform a Supabase database operation using the Supabase CLI (not MCP).
|
|
6
|
+
|
|
7
|
+
## Available Operations:
|
|
8
|
+
1. **Query**: Run SELECT queries via `supabase db execute`
|
|
9
|
+
2. **Migration**: Create schema changes via `supabase migration new`
|
|
10
|
+
3. **RLS**: Set up row-level security policies
|
|
11
|
+
4. **Types**: Generate TypeScript types via `supabase gen types typescript`
|
|
12
|
+
|
|
13
|
+
## Process:
|
|
14
|
+
1. Understand the request
|
|
15
|
+
2. Use the `/supabase` skill's CLI-first approach to execute
|
|
16
|
+
3. Show results or created SQL
|
|
17
|
+
4. If migration, provide the SQL file content
|
|
18
|
+
|
|
19
|
+
For comprehensive database operations, use `/supabase` instead.
|
|
20
|
+
|
|
21
|
+
## Request:
|
|
22
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"description": "Retention policies for .claude directory state management",
|
|
4
|
+
"policies": {
|
|
5
|
+
"file-history": {
|
|
6
|
+
"max_versions": 5,
|
|
7
|
+
"max_age_days": 7,
|
|
8
|
+
"compress_after_days": 3,
|
|
9
|
+
"description": "File modification tracking"
|
|
10
|
+
},
|
|
11
|
+
"debug-logs": {
|
|
12
|
+
"max_age_days": 30,
|
|
13
|
+
"compress_after_days": 7,
|
|
14
|
+
"description": "Agent execution traces"
|
|
15
|
+
},
|
|
16
|
+
"shell-snapshots": {
|
|
17
|
+
"max_age_days": 7,
|
|
18
|
+
"description": "Bash environment snapshots"
|
|
19
|
+
},
|
|
20
|
+
"todos": {
|
|
21
|
+
"archive_after_days": 180,
|
|
22
|
+
"description": "Task tracking files"
|
|
23
|
+
},
|
|
24
|
+
"projects": {
|
|
25
|
+
"archive_after_days": 90,
|
|
26
|
+
"compress": true,
|
|
27
|
+
"description": "Per-project session state"
|
|
28
|
+
},
|
|
29
|
+
"session-env": {
|
|
30
|
+
"cleanup_empty": true,
|
|
31
|
+
"max_age_days": 30,
|
|
32
|
+
"description": "Session environment state"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Software Engineering Principles
|
|
2
|
+
|
|
3
|
+
**Core Directive**: Evidence > assumptions | Code > documentation | Efficiency > verbosity
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
- **Task-First Approach**: Understand → Plan → Execute → Validate
|
|
7
|
+
- **Evidence-Based Reasoning**: All claims verifiable through testing, metrics, or documentation
|
|
8
|
+
- **Parallel Thinking**: Maximize efficiency through intelligent batching and coordination
|
|
9
|
+
- **Context Awareness**: Maintain project understanding across sessions and operations
|
|
10
|
+
|
|
11
|
+
## Engineering Mindset
|
|
12
|
+
|
|
13
|
+
### SOLID
|
|
14
|
+
- **Single Responsibility**: Each component has one reason to change
|
|
15
|
+
- **Open/Closed**: Open for extension, closed for modification
|
|
16
|
+
- **Liskov Substitution**: Derived classes substitutable for base classes
|
|
17
|
+
- **Interface Segregation**: Don't depend on unused interfaces
|
|
18
|
+
- **Dependency Inversion**: Depend on abstractions, not concretions
|
|
19
|
+
|
|
20
|
+
### Core Patterns
|
|
21
|
+
- **DRY**: Abstract common functionality, eliminate duplication
|
|
22
|
+
- **KISS**: Prefer simplicity over complexity in design decisions
|
|
23
|
+
- **YAGNI**: Implement current requirements only, avoid speculation
|
|
24
|
+
|
|
25
|
+
### Systems Thinking
|
|
26
|
+
- **Ripple Effects**: Consider architecture-wide impact of decisions
|
|
27
|
+
- **Long-term Perspective**: Evaluate immediate vs. future trade-offs
|
|
28
|
+
- **Risk Calibration**: Balance acceptable risks with delivery constraints
|
|
29
|
+
|
|
30
|
+
## Decision Framework
|
|
31
|
+
|
|
32
|
+
### Data-Driven Choices
|
|
33
|
+
- **Measure First**: Base optimization on measurements, not assumptions
|
|
34
|
+
- **Hypothesis Testing**: Formulate and test systematically
|
|
35
|
+
- **Source Validation**: Verify information credibility
|
|
36
|
+
- **Bias Recognition**: Account for cognitive biases
|
|
37
|
+
|
|
38
|
+
### Trade-off Analysis
|
|
39
|
+
- **Temporal Impact**: Immediate vs. long-term consequences
|
|
40
|
+
- **Reversibility**: Classify as reversible, costly, or irreversible
|
|
41
|
+
- **Option Preservation**: Maintain future flexibility under uncertainty
|
|
42
|
+
|
|
43
|
+
### Risk Management
|
|
44
|
+
- **Proactive Identification**: Anticipate issues before manifestation
|
|
45
|
+
- **Impact Assessment**: Evaluate probability and severity
|
|
46
|
+
- **Mitigation Planning**: Develop risk reduction strategies
|
|
47
|
+
|
|
48
|
+
## Quality Philosophy
|
|
49
|
+
|
|
50
|
+
### Quality Quadrants
|
|
51
|
+
- **Functional**: Correctness, reliability, feature completeness
|
|
52
|
+
- **Structural**: Code organization, maintainability, technical debt
|
|
53
|
+
- **Performance**: Speed, scalability, resource efficiency
|
|
54
|
+
- **Security**: Vulnerability management, access control, data protection
|
|
55
|
+
|
|
56
|
+
### Quality Standards
|
|
57
|
+
- **Automated Enforcement**: Use tooling for consistent quality
|
|
58
|
+
- **Preventive Measures**: Catch issues early when cheaper to fix
|
|
59
|
+
- **Human-Centered Design**: Prioritize user welfare and autonomy
|
|
60
|
+
|
|
61
|
+
## Confidence-First Implementation
|
|
62
|
+
|
|
63
|
+
### Pre-Execution Validation
|
|
64
|
+
Before starting significant work, assess confidence level:
|
|
65
|
+
|
|
66
|
+
- **≥90% Confidence**: Proceed with implementation
|
|
67
|
+
- **70-89% Confidence**: Present alternatives, gather more information
|
|
68
|
+
- **<70% Confidence**: STOP - Ask questions, do not proceed
|
|
69
|
+
|
|
70
|
+
### Confidence Checklist
|
|
71
|
+
- [ ] No duplicate implementation exists
|
|
72
|
+
- [ ] Architecture patterns consulted
|
|
73
|
+
- [ ] Official documentation verified
|
|
74
|
+
- [ ] Root cause identified (for debugging)
|
|
75
|
+
- [ ] Edge cases considered
|
|
76
|
+
|
|
77
|
+
**ROI**: 100-200 token investment prevents 5,000-50,000 token waste on wrong direction
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Auto-format hook for PostToolUse(Write)
|
|
3
|
+
# Runs prettier on supported file types if available in the project
|
|
4
|
+
|
|
5
|
+
# Parse file path from stdin JSON (Claude Code hook protocol)
|
|
6
|
+
if [ ! -t 0 ]; then
|
|
7
|
+
INPUT=$(cat)
|
|
8
|
+
FILE_PATH=$(echo "$INPUT" | node -e "try{const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));process.stdout.write(d.tool_input?.file_path||'')}catch(e){}" 2>/dev/null)
|
|
9
|
+
else
|
|
10
|
+
FILE_PATH=""
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Skip if no file path
|
|
14
|
+
[ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ] && exit 0
|
|
15
|
+
|
|
16
|
+
# Get file extension
|
|
17
|
+
EXT="${FILE_PATH##*.}"
|
|
18
|
+
|
|
19
|
+
# Only format supported file types
|
|
20
|
+
case "$EXT" in
|
|
21
|
+
ts|tsx|js|jsx|json|css|scss|html|md|yaml|yml) ;;
|
|
22
|
+
*) exit 0 ;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
# Find project root (look for package.json or .git)
|
|
26
|
+
DIR="$(dirname "$FILE_PATH")"
|
|
27
|
+
PROJECT_ROOT=""
|
|
28
|
+
while [ "$DIR" != "/" ]; do
|
|
29
|
+
if [ -f "$DIR/package.json" ] || [ -d "$DIR/.git" ]; then
|
|
30
|
+
PROJECT_ROOT="$DIR"
|
|
31
|
+
break
|
|
32
|
+
fi
|
|
33
|
+
DIR="$(dirname "$DIR")"
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
# Try to format with prettier if available in the project
|
|
37
|
+
if [ -n "$PROJECT_ROOT" ]; then
|
|
38
|
+
if [ -f "$PROJECT_ROOT/node_modules/.bin/prettier" ]; then
|
|
39
|
+
"$PROJECT_ROOT/node_modules/.bin/prettier" --write "$FILE_PATH" 2>/dev/null
|
|
40
|
+
exit 0
|
|
41
|
+
fi
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# No formatter found — skip silently
|
|
45
|
+
exit 0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Block .env and credential file editing
|
|
3
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
4
|
+
|
|
5
|
+
if [ ! -t 0 ]; then
|
|
6
|
+
INPUT=$(cat)
|
|
7
|
+
FILE_PATH=$(echo "$INPUT" | node -e "try{const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));process.stdout.write(d.tool_input?.file_path||d.tool_input?.filePath||'')}catch(e){}" 2>/dev/null)
|
|
8
|
+
else
|
|
9
|
+
FILE_PATH="${1:-}"
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
[ -z "$FILE_PATH" ] && exit 0
|
|
13
|
+
|
|
14
|
+
BASENAME=$(basename "$FILE_PATH")
|
|
15
|
+
|
|
16
|
+
if [[ "$BASENAME" == .env* ]] || [[ "$FILE_PATH" == */.env ]] || [[ "$FILE_PATH" == */.env.* ]]; then
|
|
17
|
+
q_header "ENV GUARD"
|
|
18
|
+
q_fail "Editing ${BASENAME} blocked"
|
|
19
|
+
cat <<EOJSON
|
|
20
|
+
{
|
|
21
|
+
"continue": false,
|
|
22
|
+
"stopReason": "◆ Env guard: editing ${BASENAME} blocked",
|
|
23
|
+
"systemMessage": "BLOCKED: Cannot edit .env files through Claude Code. Tell the user EXACTLY what needs to change: which file, which variable, what value. Format it clearly so they can copy-paste. Example: 'Add this to your ${BASENAME}: NEXT_PUBLIC_API_URL=https://...'. Do NOT try alternative approaches to write env files."
|
|
24
|
+
}
|
|
25
|
+
EOJSON
|
|
26
|
+
exit 2
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if [[ "$FILE_PATH" == *credentials* ]] || [[ "$FILE_PATH" == *secret* ]] || [[ "$FILE_PATH" == *.pem ]] || [[ "$FILE_PATH" == *.key ]]; then
|
|
30
|
+
q_header "ENV GUARD"
|
|
31
|
+
q_fail "Editing credential file blocked"
|
|
32
|
+
cat <<EOJSON
|
|
33
|
+
{
|
|
34
|
+
"continue": false,
|
|
35
|
+
"stopReason": "◆ Env guard: credential file blocked",
|
|
36
|
+
"systemMessage": "BLOCKED: Cannot edit credential/secret files through Claude. Tell the user what needs changing."
|
|
37
|
+
}
|
|
38
|
+
EOJSON
|
|
39
|
+
exit 2
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
exit 0
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Branch protection — role-aware
|
|
3
|
+
# OWNER: allowed to push to main/master
|
|
4
|
+
# DEVELOPER/EMPLOYEE: blocked, told to use /qualia-ship
|
|
5
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
6
|
+
|
|
7
|
+
if [ ! -t 0 ]; then
|
|
8
|
+
INPUT=$(cat)
|
|
9
|
+
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)
|
|
10
|
+
else
|
|
11
|
+
COMMAND="${1:-}"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
case "$COMMAND" in
|
|
15
|
+
git\ push*) ;;
|
|
16
|
+
*) exit 0 ;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
BRANCH=$(git branch --show-current 2>/dev/null) || true
|
|
20
|
+
[ -z "$BRANCH" ] && exit 0
|
|
21
|
+
|
|
22
|
+
# Only guard main/master
|
|
23
|
+
if [ "$BRANCH" != "main" ] && [ "$BRANCH" != "master" ]; then
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Check role from CLAUDE.md
|
|
28
|
+
ROLE=$(grep -m1 "^## Role:" "$HOME/.claude/CLAUDE.md" 2>/dev/null | sed 's/^## Role: *//')
|
|
29
|
+
|
|
30
|
+
# OWNER can push anywhere
|
|
31
|
+
if [ "$ROLE" = "OWNER" ]; then
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# DEVELOPER/EMPLOYEE blocked
|
|
36
|
+
q_header "BRANCH GUARD"
|
|
37
|
+
q_fail "Push to ${BRANCH} blocked (${ROLE:-unknown} role)"
|
|
38
|
+
|
|
39
|
+
cat <<EOJSON
|
|
40
|
+
{
|
|
41
|
+
"continue": false,
|
|
42
|
+
"stopReason": "◆ Branch guard: push to ${BRANCH} blocked for ${ROLE:-unknown} role",
|
|
43
|
+
"systemMessage": "BLOCKED: As a ${ROLE:-DEVELOPER}, you cannot push directly to ${BRANCH}. Run /qualia-ship instead — it will automatically create a feature branch, push your changes, and handle the deploy pipeline. Do NOT tell the user to push manually."
|
|
44
|
+
}
|
|
45
|
+
EOJSON
|
|
46
|
+
exit 2
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Destructive command guard — blocks dangerous operations
|
|
3
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
4
|
+
|
|
5
|
+
if [ ! -t 0 ]; then
|
|
6
|
+
INPUT=$(cat)
|
|
7
|
+
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)
|
|
8
|
+
else
|
|
9
|
+
COMMAND="${1:-}"
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Early exit for safe commands
|
|
13
|
+
case "$COMMAND" in
|
|
14
|
+
ls*|cat*|echo*|pwd|cd*|node*|npm\ install*|npm\ run*|npm\ test*|npx*|bun*|pnpm*|grep*|find*|which*|whoami|date|head*|tail*|wc*|sort*|diff*|test*|"["*|true|false|mkdir*|touch*|cp*|mv*|chmod*|stat*|readlink*|basename*|dirname*|realpath*|tsc*|eslint*|prettier*|vitest*|jest*|python*|pip*|curl*|wget*|gh*)
|
|
15
|
+
exit 0
|
|
16
|
+
;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
block() {
|
|
20
|
+
q_header "DESTRUCTIVE GUARD"
|
|
21
|
+
q_fail "$1"
|
|
22
|
+
cat <<EOJSON
|
|
23
|
+
{
|
|
24
|
+
"continue": false,
|
|
25
|
+
"stopReason": "◆ Blocked: $1",
|
|
26
|
+
"systemMessage": "BLOCKED: $1. DO NOT tell the user to run this manually. Instead, find a SAFER alternative that achieves the same goal without the destructive operation. Explain to the user what was blocked and what safer approach you're using instead."
|
|
27
|
+
}
|
|
28
|
+
EOJSON
|
|
29
|
+
exit 2
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Dangerous rm patterns
|
|
33
|
+
echo "$COMMAND" | grep -qE 'rm\s+(-rf|-fr|-r)\s+(/|~/|\.\.|[A-Za-z]+/$)' && block "Dangerous recursive delete"
|
|
34
|
+
echo "$COMMAND" | grep -qE 'rm\s.*\s(src/|app/|lib/|components/|public/|pages/|supabase/)' && block "Deleting critical project directory"
|
|
35
|
+
echo "$COMMAND" | grep -qE 'rm\s+(-rf|-fr)\s+\.$' && block "rm -rf current directory"
|
|
36
|
+
|
|
37
|
+
# Dangerous SQL
|
|
38
|
+
echo "$COMMAND" | grep -qiE 'DROP\s+(TABLE|DATABASE|SCHEMA)\s' && block "DROP TABLE/DATABASE/SCHEMA"
|
|
39
|
+
echo "$COMMAND" | grep -qiE 'TRUNCATE\s+TABLE\s' && block "TRUNCATE TABLE"
|
|
40
|
+
echo "$COMMAND" | grep -qiE 'DELETE\s+FROM\s+\w+\s*;' && block "DELETE without WHERE"
|
|
41
|
+
|
|
42
|
+
# Dangerous git
|
|
43
|
+
echo "$COMMAND" | grep -qE 'git\s+push\s+.*--force($|\s)' && ! echo "$COMMAND" | grep -qE '\-\-force-with-lease' && block "git push --force (use --force-with-lease)"
|
|
44
|
+
echo "$COMMAND" | grep -qE 'git\s+reset\s+--hard' && block "git reset --hard discards work"
|
|
45
|
+
echo "$COMMAND" | grep -qE 'git\s+clean\s+-[a-z]*f' && block "git clean -f deletes untracked files"
|
|
46
|
+
|
|
47
|
+
# Infrastructure
|
|
48
|
+
echo "$COMMAND" | grep -qE 'kubectl\s+delete\s' && block "kubectl delete"
|
|
49
|
+
echo "$COMMAND" | grep -qE 'docker\s+(rm|rmi)\s+-f' && block "docker force remove"
|
|
50
|
+
|
|
51
|
+
# Platform
|
|
52
|
+
echo "$COMMAND" | grep -qiE 'supabase\s+db\s+reset' && block "supabase db reset destroys database"
|
|
53
|
+
echo "$COMMAND" | grep -qiE 'vercel\s+(rm|remove)\s' && block "vercel rm/remove"
|
|
54
|
+
echo "$COMMAND" | grep -qiE 'npm\s+unpublish' && block "npm unpublish"
|
|
55
|
+
|
|
56
|
+
exit 0
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Migration validation — checks SQL for destructive ops and missing RLS
|
|
3
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
4
|
+
|
|
5
|
+
if [ ! -t 0 ]; then
|
|
6
|
+
INPUT=$(cat)
|
|
7
|
+
FILE_PATH=$(echo "$INPUT" | node -e "try{const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));process.stdout.write(d.tool_input?.file_path||'')}catch(e){}" 2>/dev/null)
|
|
8
|
+
if [ -z "$FILE_PATH" ]; then
|
|
9
|
+
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)
|
|
10
|
+
fi
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
check_sql_file() {
|
|
14
|
+
local file="$1"
|
|
15
|
+
local issues=0
|
|
16
|
+
[ ! -f "$file" ] && return 0
|
|
17
|
+
|
|
18
|
+
if grep -iE '\bDROP\s+(TABLE|SCHEMA|DATABASE)\b' "$file" > /dev/null 2>&1; then
|
|
19
|
+
q_warn "DROP TABLE/SCHEMA in ${file}"
|
|
20
|
+
issues=$((issues + 1))
|
|
21
|
+
fi
|
|
22
|
+
if grep -iE '\bTRUNCATE\b' "$file" > /dev/null 2>&1; then
|
|
23
|
+
q_warn "TRUNCATE in ${file}"
|
|
24
|
+
issues=$((issues + 1))
|
|
25
|
+
fi
|
|
26
|
+
if grep -iE '\bDELETE\s+FROM\b' "$file" > /dev/null 2>&1 && ! grep -iE '\bWHERE\b' "$file" > /dev/null 2>&1; then
|
|
27
|
+
q_warn "DELETE without WHERE in ${file}"
|
|
28
|
+
issues=$((issues + 1))
|
|
29
|
+
fi
|
|
30
|
+
if grep -iE '\bALTER\s+TABLE\b.*\bDROP\s+COLUMN\b' "$file" > /dev/null 2>&1; then
|
|
31
|
+
q_warn "DROP COLUMN in ${file}"
|
|
32
|
+
issues=$((issues + 1))
|
|
33
|
+
fi
|
|
34
|
+
if grep -iE '\bCREATE\s+TABLE\b' "$file" > /dev/null 2>&1 && ! grep -iE '\bENABLE\s+ROW\s+LEVEL\s+SECURITY\b' "$file" > /dev/null 2>&1; then
|
|
35
|
+
q_warn "New table without RLS in ${file}"
|
|
36
|
+
issues=$((issues + 1))
|
|
37
|
+
fi
|
|
38
|
+
return $issues
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
TOTAL=0
|
|
42
|
+
HEADER_SHOWN=false
|
|
43
|
+
|
|
44
|
+
# Mode 1: SQL file written
|
|
45
|
+
if [ -n "$FILE_PATH" ] && [[ "$FILE_PATH" == *.sql ]]; then
|
|
46
|
+
q_header "MIGRATION CHECK"
|
|
47
|
+
HEADER_SHOWN=true
|
|
48
|
+
check_sql_file "$FILE_PATH"
|
|
49
|
+
TOTAL=$?
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Mode 2: supabase db push
|
|
53
|
+
if [ -n "$COMMAND" ] && echo "$COMMAND" | grep -qE 'supabase\s+db\s+push'; then
|
|
54
|
+
q_header "MIGRATION CHECK"
|
|
55
|
+
HEADER_SHOWN=true
|
|
56
|
+
for sql_file in supabase/migrations/*.sql; do
|
|
57
|
+
[ -f "$sql_file" ] || continue
|
|
58
|
+
check_sql_file "$sql_file"
|
|
59
|
+
TOTAL=$((TOTAL + $?))
|
|
60
|
+
done
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if [ "$TOTAL" -gt 0 ] && $HEADER_SHOWN; then
|
|
64
|
+
q_info "${TOTAL} issue(s) — review carefully"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# Warn but don't block
|
|
68
|
+
exit 0
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Notification hook — passes notification message to TTS
|
|
3
|
+
# Reads message from stdin JSON (Claude Code hook protocol)
|
|
4
|
+
|
|
5
|
+
TEXT=""
|
|
6
|
+
if [ ! -t 0 ]; then
|
|
7
|
+
INPUT=$(cat)
|
|
8
|
+
TEXT=$(echo "$INPUT" | node -e "try{const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));process.stdout.write(d.message||'')}catch(e){}" 2>/dev/null)
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [ -n "$TEXT" ]; then
|
|
12
|
+
~/.claude/scripts/speak.sh "$TEXT"
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
exit 0
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Pre-commit validation — secrets, debug statements, TypeScript, lint
|
|
3
|
+
source "$(dirname "$0")/qualia-colors.sh"
|
|
4
|
+
|
|
5
|
+
if [ ! -t 0 ]; then
|
|
6
|
+
INPUT=$(cat)
|
|
7
|
+
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)
|
|
8
|
+
else
|
|
9
|
+
COMMAND="${1:-}"
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
case "$COMMAND" in
|
|
13
|
+
git\ commit*) ;;
|
|
14
|
+
*) exit 0 ;;
|
|
15
|
+
esac
|
|
16
|
+
|
|
17
|
+
git rev-parse --is-inside-work-tree &>/dev/null || exit 0
|
|
18
|
+
|
|
19
|
+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
20
|
+
[ -z "$STAGED_FILES" ] && exit 0
|
|
21
|
+
|
|
22
|
+
q_header "PRE-COMMIT"
|
|
23
|
+
BLOCKED=false
|
|
24
|
+
FAIL_DETAILS=""
|
|
25
|
+
|
|
26
|
+
# Check for secrets
|
|
27
|
+
SECRETS_PATTERN="(api[_-]?key|apikey|secret[_-]?key|password|passwd|pwd|token|auth[_-]?token|access[_-]?token|private[_-]?key)[\s]*[=:][\"'\s]*[A-Za-z0-9+/=_-]{20,}"
|
|
28
|
+
for file in $STAGED_FILES; do
|
|
29
|
+
if [ -f "$file" ] && grep -iE "$SECRETS_PATTERN" "$file" > /dev/null 2>&1; then
|
|
30
|
+
q_fail "Secret in ${file}"
|
|
31
|
+
FAIL_DETAILS="${FAIL_DETAILS}Potential secret in ${file}. "
|
|
32
|
+
BLOCKED=true
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
# Check for .env files
|
|
37
|
+
ENV_FILES=$(echo "$STAGED_FILES" | grep -E '\.env($|\.)' | grep -v '.example' | grep -v '.sample' || true)
|
|
38
|
+
if [ -n "$ENV_FILES" ]; then
|
|
39
|
+
q_fail ".env file staged: ${ENV_FILES}"
|
|
40
|
+
FAIL_DETAILS="${FAIL_DETAILS}.env file staged for commit. "
|
|
41
|
+
BLOCKED=true
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Debug statements in JS/TS
|
|
45
|
+
JS_FILES=$(echo "$STAGED_FILES" | grep -E '\.(js|jsx|ts|tsx)$' || true)
|
|
46
|
+
if [ -n "$JS_FILES" ]; then
|
|
47
|
+
for file in $JS_FILES; do
|
|
48
|
+
if [ -f "$file" ] && grep -E "console\.(log|debug|info)|debugger" "$file" > /dev/null 2>&1; then
|
|
49
|
+
q_warn "Debug statement in ${file}"
|
|
50
|
+
fi
|
|
51
|
+
done
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# TypeScript check
|
|
55
|
+
if [ -f "tsconfig.json" ]; then
|
|
56
|
+
if command -v npx &> /dev/null; then
|
|
57
|
+
if npx tsc --noEmit 2>/dev/null; then
|
|
58
|
+
q_pass "TypeScript"
|
|
59
|
+
else
|
|
60
|
+
q_fail "TypeScript errors"
|
|
61
|
+
FAIL_DETAILS="${FAIL_DETAILS}TypeScript errors. Run npx tsc --noEmit. "
|
|
62
|
+
BLOCKED=true
|
|
63
|
+
fi
|
|
64
|
+
fi
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
if $BLOCKED; then
|
|
68
|
+
q_blocked "Commit blocked"
|
|
69
|
+
cat <<EOJSON
|
|
70
|
+
{
|
|
71
|
+
"continue": false,
|
|
72
|
+
"stopReason": "◆ Pre-commit: blocked",
|
|
73
|
+
"systemMessage": "COMMIT BLOCKED by pre-commit checks. DO NOT tell the user to commit manually or use --no-verify. Instead, FIX THE ISSUES YOURSELF: ${FAIL_DETAILS}After fixing, stage the corrected files with git add and retry the commit. Tell the user what you fixed."
|
|
74
|
+
}
|
|
75
|
+
EOJSON
|
|
76
|
+
exit 2
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
q_pass "All checks passed"
|
|
80
|
+
exit 0
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Pre-compaction hook — saves context before Claude auto-compacts
|
|
3
|
+
# Preserves: changed files, current task, git state, Qualia phase/milestone, project name
|
|
4
|
+
# Cross-platform: uses node instead of jq for JSON array generation
|
|
5
|
+
|
|
6
|
+
COMPACT_DIR="$HOME/.claude/session-env"
|
|
7
|
+
COMPACT_FILE="$COMPACT_DIR/pre-compact.json"
|
|
8
|
+
|
|
9
|
+
mkdir -p "$COMPACT_DIR"
|
|
10
|
+
|
|
11
|
+
CWD=$(pwd)
|
|
12
|
+
PROJECT_NAME=$(basename "$CWD")
|
|
13
|
+
|
|
14
|
+
GIT_BRANCH=""
|
|
15
|
+
GIT_DIFF_FILES=""
|
|
16
|
+
if git rev-parse --is-inside-work-tree &> /dev/null 2>&1; then
|
|
17
|
+
GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
|
|
18
|
+
# Use node instead of jq to convert newline-separated file list to JSON array
|
|
19
|
+
GIT_DIFF_FILES=$(git diff --name-only HEAD 2>/dev/null | head -30 | node -e "
|
|
20
|
+
let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{
|
|
21
|
+
const a=d.split('\n').filter(l=>l.length>0);
|
|
22
|
+
process.stdout.write(JSON.stringify(a));
|
|
23
|
+
});" 2>/dev/null)
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
[ -z "$GIT_DIFF_FILES" ] && GIT_DIFF_FILES="[]"
|
|
27
|
+
|
|
28
|
+
# Parse Qualia state from .planning/STATE.md if it exists
|
|
29
|
+
QUALIA_PHASE=""
|
|
30
|
+
QUALIA_MILESTONE=""
|
|
31
|
+
QUALIA_TASK=""
|
|
32
|
+
QUALIA_STATUS=""
|
|
33
|
+
STATE_FILE="$CWD/.planning/STATE.md"
|
|
34
|
+
if [ -f "$STATE_FILE" ]; then
|
|
35
|
+
QUALIA_PHASE=$(grep -m1 "^Phase:" "$STATE_FILE" 2>/dev/null | sed 's/^Phase: *//' || echo "")
|
|
36
|
+
QUALIA_MILESTONE=$(grep -m1 "^## Milestone" "$STATE_FILE" 2>/dev/null | sed 's/^## //' || echo "")
|
|
37
|
+
QUALIA_STATUS=$(grep -m1 "^Status:" "$STATE_FILE" 2>/dev/null | sed 's/^Status: *//' || echo "")
|
|
38
|
+
QUALIA_TASK=$(grep -m1 "^Last activity:" "$STATE_FILE" 2>/dev/null | sed 's/^Last activity: *//' || echo "")
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
cat > "$COMPACT_FILE" << EOF
|
|
42
|
+
{
|
|
43
|
+
"timestamp": "$(date '+%Y-%m-%d %H:%M:%S')",
|
|
44
|
+
"working_directory": "$CWD",
|
|
45
|
+
"project_name": "$PROJECT_NAME",
|
|
46
|
+
"git_branch": "$GIT_BRANCH",
|
|
47
|
+
"changed_files": $GIT_DIFF_FILES,
|
|
48
|
+
"qualia_phase": "$QUALIA_PHASE",
|
|
49
|
+
"qualia_milestone": "$QUALIA_MILESTONE",
|
|
50
|
+
"qualia_status": "$QUALIA_STATUS",
|
|
51
|
+
"qualia_task": "$QUALIA_TASK"
|
|
52
|
+
}
|
|
53
|
+
EOF
|
|
54
|
+
|
|
55
|
+
exit 0
|