claude-code-superkit 0.0.0-stage → 1.5.3
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/LICENSE +21 -0
- package/README.md +374 -2
- package/bin/cli.js +153 -0
- package/bin/inject-tokens.js +224 -0
- package/bin/measure-tokens.js +17 -0
- package/bin/superkit-counts-verify.sh +30 -0
- package/lib/codex.js +246 -0
- package/lib/docs-scaffold.js +147 -0
- package/lib/installer.js +499 -0
- package/lib/prompts.js +51 -0
- package/lib/settings-builder.js +51 -0
- package/lib/superpowers.js +99 -0
- package/lib/utils.js +117 -0
- package/lib/validator.js +84 -0
- package/package.json +49 -4
- package/packages/codex/AGENTS.md +396 -0
- package/packages/codex/INSTALL.md +342 -0
- package/packages/codex/config.toml +22 -0
- package/packages/codex/hooks/superkit.mjs +203 -0
- package/packages/codex/hooks.json +30 -0
- package/packages/codex/legacy-baseline.json +88 -0
- package/packages/codex/native-skills.txt +65 -0
- package/packages/codex/rules/default.rules +565 -0
- package/packages/codex/skills/ai-slop-cleaner/SKILL.md +44 -0
- package/packages/codex/skills/api-contract-sync/SKILL.md +96 -0
- package/packages/codex/skills/architect/SKILL.md +49 -0
- package/packages/codex/skills/audit-backend/SKILL.md +80 -0
- package/packages/codex/skills/audit-frontend/SKILL.md +82 -0
- package/packages/codex/skills/audit-infra/SKILL.md +87 -0
- package/packages/codex/skills/audit-orchestrator/SKILL.md +114 -0
- package/packages/codex/skills/behavioral-nudge-engine/SKILL.md +110 -0
- package/packages/codex/skills/benchmark/SKILL.md +49 -0
- package/packages/codex/skills/bot-reviewer/SKILL.md +94 -0
- package/packages/codex/skills/code-reviewer/SKILL.md +67 -0
- package/packages/codex/skills/codebase-onboarding-engineer/SKILL.md +46 -0
- package/packages/codex/skills/comment-rot-analyzer/SKILL.md +75 -0
- package/packages/codex/skills/commit-helper/SKILL.md +101 -0
- package/packages/codex/skills/critic/SKILL.md +56 -0
- package/packages/codex/skills/database-reviewer/SKILL.md +79 -0
- package/packages/codex/skills/debug-observer/SKILL.md +107 -0
- package/packages/codex/skills/dependency-checker/SKILL.md +69 -0
- package/packages/codex/skills/design-system-reviewer/SKILL.md +121 -0
- package/packages/codex/skills/dev-orchestrator/SKILL.md +304 -0
- package/packages/codex/skills/docs-reviewer/SKILL.md +86 -0
- package/packages/codex/skills/drizzle-orm-expert/SKILL.md +246 -0
- package/packages/codex/skills/e2e-test-generator/SKILL.md +95 -0
- package/packages/codex/skills/evaluator/SKILL.md +63 -0
- package/packages/codex/skills/frontend-perf-reviewer/SKILL.md +95 -0
- package/packages/codex/skills/frontend-ui-color-reviewer/SKILL.md +68 -0
- package/packages/codex/skills/frontend-ui-design-critic/SKILL.md +99 -0
- package/packages/codex/skills/frontend-ui-interaction-reviewer/SKILL.md +102 -0
- package/packages/codex/skills/frontend-ui-motion-reviewer/SKILL.md +85 -0
- package/packages/codex/skills/frontend-ui-reviewer/SKILL.md +81 -0
- package/packages/codex/skills/frontend-ui-typography-reviewer/SKILL.md +62 -0
- package/packages/codex/skills/gltf-debugging/SKILL.md +128 -0
- package/packages/codex/skills/go-benchmark/SKILL.md +217 -0
- package/packages/codex/skills/go-concurrency-reviewer/SKILL.md +113 -0
- package/packages/codex/skills/go-error-reviewer/SKILL.md +107 -0
- package/packages/codex/skills/go-grpc-patterns/SKILL.md +285 -0
- package/packages/codex/skills/go-modernizer/SKILL.md +111 -0
- package/packages/codex/skills/go-observability-reviewer/SKILL.md +121 -0
- package/packages/codex/skills/go-performance-reviewer/SKILL.md +112 -0
- package/packages/codex/skills/go-reviewer/SKILL.md +109 -0
- package/packages/codex/skills/go-samber-do/SKILL.md +158 -0
- package/packages/codex/skills/go-samber-lo/SKILL.md +178 -0
- package/packages/codex/skills/go-samber-oops/SKILL.md +174 -0
- package/packages/codex/skills/goal-verifier/SKILL.md +53 -0
- package/packages/codex/skills/health-checker/SKILL.md +109 -0
- package/packages/codex/skills/html-to-3d-texture/SKILL.md +153 -0
- package/packages/codex/skills/impeccable-craft/SKILL.md +101 -0
- package/packages/codex/skills/lint-runner/SKILL.md +85 -0
- package/packages/codex/skills/migrate/SKILL.md +60 -0
- package/packages/codex/skills/migration-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/minimal-change-engineer/SKILL.md +44 -0
- package/packages/codex/skills/new-migration/SKILL.md +59 -0
- package/packages/codex/skills/nextjs-supabase-auth/SKILL.md +227 -0
- package/packages/codex/skills/output-enforcement/SKILL.md +71 -0
- package/packages/codex/skills/plan-checker/SKILL.md +53 -0
- package/packages/codex/skills/postgresql-optimization/SKILL.md +159 -0
- package/packages/codex/skills/pre-deploy-validator/SKILL.md +111 -0
- package/packages/codex/skills/presentation-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/product-3d-lighting/SKILL.md +137 -0
- package/packages/codex/skills/project-architecture/SKILL.md +52 -0
- package/packages/codex/skills/py-reviewer/SKILL.md +100 -0
- package/packages/codex/skills/r3f-scene-reviewer/SKILL.md +88 -0
- package/packages/codex/skills/r3f-scroll-driven-3d/SKILL.md +162 -0
- package/packages/codex/skills/reality-checker/SKILL.md +61 -0
- package/packages/codex/skills/redis-patterns/SKILL.md +260 -0
- package/packages/codex/skills/review-orchestrator/SKILL.md +151 -0
- package/packages/codex/skills/rs-reviewer/SKILL.md +98 -0
- package/packages/codex/skills/ru-text/SKILL.md +132 -0
- package/packages/codex/skills/scaffold-endpoint/SKILL.md +44 -0
- package/packages/codex/skills/security-scanner/SKILL.md +94 -0
- package/packages/codex/skills/silent-failure-hunter/SKILL.md +176 -0
- package/packages/codex/skills/telegram-bot-builder/SKILL.md +120 -0
- package/packages/codex/skills/test-generator/SKILL.md +79 -0
- package/packages/codex/skills/test-runner/SKILL.md +101 -0
- package/packages/codex/skills/threejs-color-management/SKILL.md +97 -0
- package/packages/codex/skills/tree-generator/SKILL.md +63 -0
- package/packages/codex/skills/ts-reviewer/SKILL.md +90 -0
- package/packages/codex/skills/ui-design-reviewer/SKILL.md +89 -0
- package/packages/codex/skills/ui-reviewer/SKILL.md +103 -0
- package/packages/codex/skills/visual-reviewer/SKILL.md +85 -0
- package/packages/codex/skills/writing-agents/SKILL.md +165 -0
- package/packages/codex/skills/writing-commands/SKILL.md +173 -0
- package/packages/core/CLAUDE.md +118 -0
- package/packages/core/INTERNAL-FILES +16 -0
- package/packages/core/agents/ai-slop-cleaner.md +187 -0
- package/packages/core/agents/api-contract-sync.md +127 -0
- package/packages/core/agents/architect.md +205 -0
- package/packages/core/agents/audit-backend.md +137 -0
- package/packages/core/agents/audit-frontend.md +129 -0
- package/packages/core/agents/audit-infra.md +182 -0
- package/packages/core/agents/behavioral-nudge-engine.md +170 -0
- package/packages/core/agents/code-reviewer.md +195 -0
- package/packages/core/agents/codebase-onboarding-engineer.md +172 -0
- package/packages/core/agents/comment-rot-analyzer.md +115 -0
- package/packages/core/agents/critic.md +172 -0
- package/packages/core/agents/database-reviewer.md +201 -0
- package/packages/core/agents/debug-observer.md +261 -0
- package/packages/core/agents/dependency-checker.md +199 -0
- package/packages/core/agents/docs-reviewer.md +206 -0
- package/packages/core/agents/e2e-test-generator.md +261 -0
- package/packages/core/agents/evaluator.md +141 -0
- package/packages/core/agents/goal-verifier.md +130 -0
- package/packages/core/agents/health-checker.md +194 -0
- package/packages/core/agents/migration-reviewer.md +161 -0
- package/packages/core/agents/minimal-change-engineer.md +219 -0
- package/packages/core/agents/plan-checker.md +139 -0
- package/packages/core/agents/pre-deploy-validator.md +189 -0
- package/packages/core/agents/reality-checker.md +175 -0
- package/packages/core/agents/scaffold-endpoint.md +162 -0
- package/packages/core/agents/security-scanner.md +236 -0
- package/packages/core/agents/silent-failure-hunter.md +276 -0
- package/packages/core/agents/test-generator.md +146 -0
- package/packages/core/agents/tree-generator.md +141 -0
- package/packages/core/agents/ui-reviewer.md +172 -0
- package/packages/core/agents/visual-reviewer.md +211 -0
- package/packages/core/commands/audit.md +166 -0
- package/packages/core/commands/benchmark.md +130 -0
- package/packages/core/commands/commit.md +148 -0
- package/packages/core/commands/dev.md +302 -0
- package/packages/core/commands/docs-init.md +75 -0
- package/packages/core/commands/lint.md +137 -0
- package/packages/core/commands/migrate.md +146 -0
- package/packages/core/commands/new-migration.md +182 -0
- package/packages/core/commands/pair.md +209 -0
- package/packages/core/commands/review.md +195 -0
- package/packages/core/commands/security-scan.md +142 -0
- package/packages/core/commands/superkit-evolve.md +231 -0
- package/packages/core/commands/superkit-init.md +274 -0
- package/packages/core/commands/test.md +108 -0
- package/packages/core/commands/workflow.md +150 -0
- package/packages/core/docs/guide/01-getting-started.md +41 -0
- package/packages/core/docs-templates/README.md +33 -0
- package/packages/core/docs-templates/adr-template.md +62 -0
- package/packages/core/docs-templates/architecture/api-contracts.md +26 -0
- package/packages/core/docs-templates/architecture/api-reference.md +48 -0
- package/packages/core/docs-templates/architecture/auth-and-sessions.md +38 -0
- package/packages/core/docs-templates/architecture/backend-layers.md +42 -0
- package/packages/core/docs-templates/architecture/data-flow.md +26 -0
- package/packages/core/docs-templates/architecture/database-schema.md +51 -0
- package/packages/core/docs-templates/architecture/deployment.md +41 -0
- package/packages/core/docs-templates/architecture/frontend-state.md +46 -0
- package/packages/core/helpers/statusline.cjs +370 -0
- package/packages/core/hooks/CHAIN-SEMANTICS.md +84 -0
- package/packages/core/hooks/audit-settings-source.sh +98 -0
- package/packages/core/hooks/audit-trail.sh +120 -0
- package/packages/core/hooks/block-dangerous-git.sh +189 -0
- package/packages/core/hooks/bundle-import-check.sh +64 -0
- package/packages/core/hooks/compact-state-inject.sh +84 -0
- package/packages/core/hooks/config-protection.sh +68 -0
- package/packages/core/hooks/console-log-warning.sh +28 -0
- package/packages/core/hooks/context-monitor.sh +35 -0
- package/packages/core/hooks/dev-edit-counter.sh +59 -0
- package/packages/core/hooks/dev-marker-set.sh +55 -0
- package/packages/core/hooks/dev-required-on-commit.sh +426 -0
- package/packages/core/hooks/doc-check-on-commit.sh +396 -0
- package/packages/core/hooks/edit-streak-check.sh +63 -0
- package/packages/core/hooks/evolve-check.sh +78 -0
- package/packages/core/hooks/gateguard-pre-edit.sh +154 -0
- package/packages/core/hooks/gateguard-record-facts.sh +37 -0
- package/packages/core/hooks/intake-classifier.py +449 -0
- package/packages/core/hooks/lib/profile.sh +141 -0
- package/packages/core/hooks/loop-guard.sh +75 -0
- package/packages/core/hooks/migration-safety.sh +56 -0
- package/packages/core/hooks/plan-completion-gate.sh +61 -0
- package/packages/core/hooks/pre-compact-save.sh +89 -0
- package/packages/core/hooks/security-patterns.sh +119 -0
- package/packages/core/hooks/session-context-restore.sh +76 -0
- package/packages/core/hooks/subagent-stop-validate.sh +73 -0
- package/packages/core/hooks/superkit-counts-verify.sh +346 -0
- package/packages/core/hooks/superkit-update.sh +367 -0
- package/packages/core/hooks/tests/README.md +42 -0
- package/packages/core/hooks/tests/audit-trail-chain_test.sh +62 -0
- package/packages/core/hooks/tests/block-dangerous-git_test.sh +144 -0
- package/packages/core/hooks/tests/chain-semantics/h1.sh +11 -0
- package/packages/core/hooks/tests/chain-semantics/h2.sh +9 -0
- package/packages/core/hooks/tests/chain-semantics/h3.sh +11 -0
- package/packages/core/hooks/tests/chain-semantics/run-experiment.sh +65 -0
- package/packages/core/hooks/tests/chain-semantics/settings-experiment.json +15 -0
- package/packages/core/hooks/tests/counts-verify_test.sh +118 -0
- package/packages/core/hooks/tests/dev-required-on-commit_test.sh +207 -0
- package/packages/core/hooks/tests/dev-required-wip-on-main_test.sh +20 -0
- package/packages/core/hooks/tests/doc-check-on-commit_test.sh +122 -0
- package/packages/core/hooks/tests/edit-streak-check_test.sh +106 -0
- package/packages/core/hooks/tests/internal-manifest_test.sh +130 -0
- package/packages/core/hooks/tests/json-path_test.sh +108 -0
- package/packages/core/hooks/tests/mirror-invariants_test.sh +139 -0
- package/packages/core/hooks/tests/nudge-throttle_test.sh +95 -0
- package/packages/core/hooks/tests/profile-helper_test.sh +21 -0
- package/packages/core/hooks/tests/run-all.sh +47 -0
- package/packages/core/hooks/tests/session-key-helper_test.sh +17 -0
- package/packages/core/hooks/tests/superkit-update_test.sh +311 -0
- package/packages/core/hooks/tests/warn-visibility_test.sh +59 -0
- package/packages/core/hooks/user-intent-detect.sh +44 -0
- package/packages/core/hooks/verify-hooks.sh +69 -0
- package/packages/core/rules/auto-commands.md +124 -0
- package/packages/core/rules/coding-style.md +68 -0
- package/packages/core/rules/dev-workflow.md +77 -0
- package/packages/core/rules/documentation.md +106 -0
- package/packages/core/rules/frontend-aesthetics.md +53 -0
- package/packages/core/rules/git-workflow.md +14 -0
- package/packages/core/rules/security.md +29 -0
- package/packages/core/rules/superkit-integrity.md +114 -0
- package/packages/core/settings.json +229 -0
- package/packages/core/skills/drizzle-orm-expert/SKILL.md +260 -0
- package/packages/core/skills/nextjs-supabase-auth/SKILL.md +259 -0
- package/packages/core/skills/postgresql-optimization/SKILL.md +150 -0
- package/packages/core/skills/project-architecture/SKILL.md +31 -0
- package/packages/core/skills/project-scanner/SKILL.md +132 -0
- package/packages/core/skills/redis-patterns/SKILL.md +261 -0
- package/packages/core/skills/ru-text/SKILL.md +156 -0
- package/packages/core/skills/telegram-bot-builder/SKILL.md +145 -0
- package/packages/core/skills/writing-agents/SKILL.md +220 -0
- package/packages/core/skills/writing-commands/SKILL.md +176 -0
- package/packages/core/skills/writing-hooks/SKILL.md +335 -0
- package/packages/extras/bot-reviewer.md +279 -0
- package/packages/extras/design-system-reviewer.md +234 -0
- package/packages/extras/red-blue-auditor/README.md +117 -0
- package/packages/extras/red-blue-auditor/agent.md +128 -0
- package/packages/extras/red-blue-auditor/patterns/agent-config.txt +4 -0
- package/packages/extras/red-blue-auditor/patterns/hook-injection.txt +8 -0
- package/packages/extras/red-blue-auditor/patterns/mcp-risk.txt +5 -0
- package/packages/extras/red-blue-auditor/patterns/permission-abuse.txt +6 -0
- package/packages/extras/red-blue-auditor/patterns/secrets.txt +17 -0
- package/packages/extras/red-blue-auditor/scan.sh +88 -0
- package/packages/extras/skillsmp-search/SKILL.md +134 -0
- package/packages/frontend-3d/README.md +62 -0
- package/packages/frontend-3d/agents/frontend-perf-reviewer.md +164 -0
- package/packages/frontend-3d/agents/presentation-reviewer.md +146 -0
- package/packages/frontend-3d/agents/r3f-scene-reviewer.md +128 -0
- package/packages/frontend-3d/agents/ui-design-reviewer.md +169 -0
- package/packages/frontend-3d/commands/capture-screen.md +166 -0
- package/packages/frontend-3d/hooks/bundle-size-warn.sh +93 -0
- package/packages/frontend-3d/hooks/gsap-pattern-check.sh +74 -0
- package/packages/frontend-3d/hooks/r3f-color-check.sh +76 -0
- package/packages/frontend-3d/hooks/tailwind-version-guard.sh +98 -0
- package/packages/frontend-3d/rules/frontend-aesthetics-3d.md +81 -0
- package/packages/frontend-3d/rules/gsap-conventions.md +129 -0
- package/packages/frontend-3d/rules/threejs-conventions.md +116 -0
- package/packages/frontend-3d/skills/gltf-debugging/SKILL.md +145 -0
- package/packages/frontend-3d/skills/html-to-3d-texture/SKILL.md +183 -0
- package/packages/frontend-3d/skills/output-enforcement/SKILL.md +79 -0
- package/packages/frontend-3d/skills/product-3d-lighting/SKILL.md +166 -0
- package/packages/frontend-3d/skills/r3f-scroll-driven-3d/SKILL.md +209 -0
- package/packages/frontend-3d/skills/threejs-color-management/SKILL.md +111 -0
- package/packages/frontend-ui/NOTICE.md +99 -0
- package/packages/frontend-ui/README.md +59 -0
- package/packages/frontend-ui/agents/ui-color-reviewer.md +174 -0
- package/packages/frontend-ui/agents/ui-design-critic.md +198 -0
- package/packages/frontend-ui/agents/ui-interaction-reviewer.md +259 -0
- package/packages/frontend-ui/agents/ui-motion-reviewer.md +266 -0
- package/packages/frontend-ui/agents/ui-reviewer.md +251 -0
- package/packages/frontend-ui/agents/ui-typography-reviewer.md +222 -0
- package/packages/frontend-ui/hooks/tests/ui-animation-easing-check_test.sh +78 -0
- package/packages/frontend-ui/hooks/tests/ui-banned-fonts-check_test.sh +77 -0
- package/packages/frontend-ui/hooks/tests/ui-color-check_test.sh +75 -0
- package/packages/frontend-ui/hooks/ui-animation-easing-check.sh +86 -0
- package/packages/frontend-ui/hooks/ui-banned-fonts-check.sh +90 -0
- package/packages/frontend-ui/hooks/ui-color-check.sh +102 -0
- package/packages/frontend-ui/rules/color-and-contrast.md +230 -0
- package/packages/frontend-ui/rules/frontend-design-aesthetics.md +124 -0
- package/packages/frontend-ui/rules/interaction-polish.md +335 -0
- package/packages/frontend-ui/rules/motion-and-animation.md +283 -0
- package/packages/frontend-ui/rules/spatial-and-layout.md +212 -0
- package/packages/frontend-ui/rules/typography-guidelines.md +185 -0
- package/packages/frontend-ui/rules/ui-anti-patterns.md +309 -0
- package/packages/frontend-ui/settings.json +24 -0
- package/packages/frontend-ui/skills/impeccable-craft/SKILL.md +187 -0
- package/packages/gan/README.md +232 -0
- package/packages/gan/agents/gan-evaluator.md +214 -0
- package/packages/gan/agents/gan-generator.md +171 -0
- package/packages/gan/agents/gan-planner.md +206 -0
- package/packages/gan/rubrics/functionality.md +66 -0
- package/packages/gan/rubrics/ui-quality.md +77 -0
- package/packages/gan/skills/gan-evaluator/SKILL.md +91 -0
- package/packages/gan/skills/gan-generator/SKILL.md +72 -0
- package/packages/gan/skills/gan-planner/SKILL.md +93 -0
- package/packages/stack-agents/go/go-concurrency-reviewer.md +210 -0
- package/packages/stack-agents/go/go-error-reviewer.md +187 -0
- package/packages/stack-agents/go/go-modernizer.md +160 -0
- package/packages/stack-agents/go/go-observability-reviewer.md +185 -0
- package/packages/stack-agents/go/go-performance-reviewer.md +160 -0
- package/packages/stack-agents/go/go-reviewer.md +277 -0
- package/packages/stack-agents/go/references/benchmark-methodology.md +280 -0
- package/packages/stack-agents/go/references/channel-patterns.md +384 -0
- package/packages/stack-agents/go/references/cli-cobra-viper.md +190 -0
- package/packages/stack-agents/go/references/code-style.md +262 -0
- package/packages/stack-agents/go/references/context-propagation.md +317 -0
- package/packages/stack-agents/go/references/data-structures.md +315 -0
- package/packages/stack-agents/go/references/database-patterns.md +334 -0
- package/packages/stack-agents/go/references/design-patterns.md +411 -0
- package/packages/stack-agents/go/references/di-frameworks.md +146 -0
- package/packages/stack-agents/go/references/error-creation.md +251 -0
- package/packages/stack-agents/go/references/error-inspection.md +348 -0
- package/packages/stack-agents/go/references/error-wrapping.md +230 -0
- package/packages/stack-agents/go/references/gopls-driving.md +62 -0
- package/packages/stack-agents/go/references/goroutine-lifecycle.md +351 -0
- package/packages/stack-agents/go/references/graphql-patterns.md +221 -0
- package/packages/stack-agents/go/references/grpc-patterns.md +373 -0
- package/packages/stack-agents/go/references/modernize-guide.md +522 -0
- package/packages/stack-agents/go/references/module-management.md +191 -0
- package/packages/stack-agents/go/references/naming-conventions.md +176 -0
- package/packages/stack-agents/go/references/observability-pipeline.md +352 -0
- package/packages/stack-agents/go/references/performance-profiling.md +250 -0
- package/packages/stack-agents/go/references/refactoring-mechanics.md +127 -0
- package/packages/stack-agents/go/references/rest-openapi-patterns.md +160 -0
- package/packages/stack-agents/go/references/samber-do.md +201 -0
- package/packages/stack-agents/go/references/samber-libraries.md +363 -0
- package/packages/stack-agents/go/references/samber-lo.md +260 -0
- package/packages/stack-agents/go/references/samber-oops.md +200 -0
- package/packages/stack-agents/go/references/security-checklist.md +441 -0
- package/packages/stack-agents/go/references/standard-stdlib-now.md +181 -0
- package/packages/stack-agents/go/references/stay-updated.md +147 -0
- package/packages/stack-agents/go/references/structs-interfaces.md +312 -0
- package/packages/stack-agents/go/references/sync-primitives.md +395 -0
- package/packages/stack-agents/go/references/testing-patterns.md +483 -0
- package/packages/stack-agents/go/references/troubleshooting.md +98 -0
- package/packages/stack-agents/python/py-reviewer.md +194 -0
- package/packages/stack-agents/rust/rs-reviewer.md +188 -0
- package/packages/stack-agents/typescript/ts-reviewer.md +135 -0
- package/packages/stack-hooks/go/go-context-check-on-edit.sh +56 -0
- package/packages/stack-hooks/go/go-error-check-on-edit.sh +54 -0
- package/packages/stack-hooks/go/go-format-on-edit.sh +32 -0
- package/packages/stack-hooks/go/go-safety-check-on-edit.sh +54 -0
- package/packages/stack-hooks/go/go-vet-on-edit.sh +61 -0
- package/packages/stack-hooks/go/golangci-lint-on-edit.sh +54 -0
- package/packages/stack-hooks/python/ruff-on-edit.sh +67 -0
- package/packages/stack-hooks/rust/cargo-check-on-edit.sh +64 -0
- package/packages/stack-hooks/typescript/typecheck-on-edit.sh +76 -0
- package/packages/stack-rules/go/go-conventions.md +44 -0
- package/packages/stack-rules/go/go-safety.md +35 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# superkit-update_test.sh — acceptance suite for the pristine-preserve auto-updater
|
|
3
|
+
# (packages/core/hooks/superkit-update.sh, the D1 root-defect fix).
|
|
4
|
+
#
|
|
5
|
+
# Everything runs inside a throwaway mktemp workspace: a FAKE kit git repo (three
|
|
6
|
+
# tags v0.0.1/v0.0.2/v0.0.3) and FAKE consumer .claude/ trees. This suite NEVER
|
|
7
|
+
# points at the real clone or at any real consumer — the SUPERKIT_SOURCE the
|
|
8
|
+
# updater sees is always the fixture repo.
|
|
9
|
+
#
|
|
10
|
+
# Assertions (per the D1 acceptance contract):
|
|
11
|
+
# (a) pristine-at-baseline file → overwritten with the new version's content
|
|
12
|
+
# (b) customized file (no tag match) → preserved byte-identical AND reported
|
|
13
|
+
# (c) stale file matching an OLDER released tag → overwritten (second-chance walk)
|
|
14
|
+
# (d) internal manifest file → never overwritten AND never newly copied
|
|
15
|
+
# (e) file absent in consumer → created (incl. NEW coverage: references, hooks/lib, stack-rules)
|
|
16
|
+
# (f) meta baseline tag missing → fail-safe: no-match files preserved, tag-matches still sync
|
|
17
|
+
# plus: self-bootstrap replaces a differing installed copy before syncing.
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
|
|
20
|
+
REPO_ROOT="$(cd "$(dirname "$0")/../../../.." && pwd)"
|
|
21
|
+
NEW_UPDATER="$REPO_ROOT/packages/core/hooks/superkit-update.sh"
|
|
22
|
+
|
|
23
|
+
PASS=0; FAIL=0
|
|
24
|
+
pass() { echo "PASS: $1"; PASS=$((PASS + 1)); }
|
|
25
|
+
fail() { echo "FAIL: $1"; FAIL=$((FAIL + 1)); }
|
|
26
|
+
# chk <label> <file> <expected-content>
|
|
27
|
+
chk() {
|
|
28
|
+
if [ -f "$2" ] && [ "$(cat "$2" 2>/dev/null)" = "$3" ]; then
|
|
29
|
+
pass "$1"
|
|
30
|
+
else
|
|
31
|
+
fail "$1 (got: $(cat "$2" 2>/dev/null || echo '<MISSING>'))"
|
|
32
|
+
fi
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
WORK=$(mktemp -d 2>/dev/null) || { echo "FAIL: mktemp"; exit 1; }
|
|
36
|
+
trap 'rm -rf "$WORK"' EXIT
|
|
37
|
+
|
|
38
|
+
SRC="$WORK/kit" # fake kit repo → SUPERKIT_SOURCE
|
|
39
|
+
export HOME="$WORK/home"; mkdir -p "$HOME/.claude" # isolate rate-limit file
|
|
40
|
+
|
|
41
|
+
wf() { mkdir -p "$(dirname "$1")"; printf '%s\n' "$2" > "$1"; }
|
|
42
|
+
|
|
43
|
+
# ── Build the fake kit git repo ──────────────────────────────────────
|
|
44
|
+
mkdir -p "$SRC"
|
|
45
|
+
git -C "$SRC" init -q
|
|
46
|
+
git -C "$SRC" config user.email t@example.com
|
|
47
|
+
git -C "$SRC" config user.name test
|
|
48
|
+
git -C "$SRC" config commit.gpgsign false
|
|
49
|
+
|
|
50
|
+
P="$SRC/packages"
|
|
51
|
+
cp "$NEW_UPDATER" "$P/core/hooks/superkit-update.sh" 2>/dev/null || { mkdir -p "$P/core/hooks"; cp "$NEW_UPDATER" "$P/core/hooks/superkit-update.sh"; }
|
|
52
|
+
chmod +x "$P/core/hooks/superkit-update.sh"
|
|
53
|
+
|
|
54
|
+
# manifest + the three repo-only internal files it names
|
|
55
|
+
wf "$P/core/INTERNAL-FILES" "$(printf '# fixture manifest\nhooks/superkit-counts-verify.sh\nhooks/verify-hooks.sh\nrules/superkit-integrity.md')"
|
|
56
|
+
wf "$P/core/hooks/superkit-counts-verify.sh" "internal-counts"
|
|
57
|
+
wf "$P/core/hooks/verify-hooks.sh" "internal-verify"
|
|
58
|
+
wf "$P/core/rules/superkit-integrity.md" "internal-rule"
|
|
59
|
+
|
|
60
|
+
# static files (unchanged across tags) — exercise the NEW coverage surfaces
|
|
61
|
+
wf "$P/core/agents/newfile.md" "NEWFILE-CONTENT" # (e) absent → created
|
|
62
|
+
wf "$P/core/hooks/lib/profile.sh" "LIBPROFILE" # hooks/lib coverage
|
|
63
|
+
wf "$P/core/skills/demo/SKILL.md" "SKILL-BODY"
|
|
64
|
+
wf "$P/stack-agents/go/goagent.md" "GOAGENT"
|
|
65
|
+
wf "$P/stack-agents/go/references/ref.md" "REF-DOC" # references coverage
|
|
66
|
+
wf "$P/stack-rules/go/gosafe.md" "GOSAFE" # stack-rules coverage
|
|
67
|
+
wf "$P/stack-hooks/go/gohook.sh" "GOHOOK"
|
|
68
|
+
wf "$P/core/docs-templates/adr-template.md" "ADR-TEMPLATE-BODY" # project-root ADR template (create-if-missing)
|
|
69
|
+
wf "$P/core/helpers/statusline.cjs" "STATUSLINE-V3" # (i) synced under the pristine rule
|
|
70
|
+
|
|
71
|
+
# versioned files: pristine.md, ahook.sh, custom.md change every release
|
|
72
|
+
write_v() {
|
|
73
|
+
wf "$P/core/agents/pristine.md" "P$1"
|
|
74
|
+
wf "$P/core/hooks/ahook.sh" "S$1"
|
|
75
|
+
wf "$P/core/rules/custom.md" "R$1"
|
|
76
|
+
}
|
|
77
|
+
commit_tag() { echo "$1" > "$SRC/VERSION"; write_v "$2"; git -C "$SRC" add -A; git -C "$SRC" commit -qm "$1"; git -C "$SRC" tag "v$1"; }
|
|
78
|
+
commit_tag 0.0.1 1
|
|
79
|
+
commit_tag 0.0.2 2
|
|
80
|
+
commit_tag 0.0.3 3 # HEAD / working tree → source VERSION 0.0.3
|
|
81
|
+
|
|
82
|
+
# ── Build a fresh fake consumer ──────────────────────────────────────
|
|
83
|
+
build_consumer() { # $1 = consumer root, $2 = meta baseline version
|
|
84
|
+
local C="$1" ver="$2"
|
|
85
|
+
rm -rf "$C"
|
|
86
|
+
mkdir -p "$C/.claude/scripts/hooks/lib" "$C/.claude/agents/references" \
|
|
87
|
+
"$C/.claude/rules" "$C/.claude/commands" "$C/.claude/skills"
|
|
88
|
+
cat > "$C/.claude/.superkit-meta" <<EOF
|
|
89
|
+
SUPERKIT_SOURCE="$SRC"
|
|
90
|
+
SUPERKIT_VERSION="$ver"
|
|
91
|
+
SUPERKIT_STACKS="go"
|
|
92
|
+
SUPERKIT_EXTRAS=""
|
|
93
|
+
SUPERKIT_PROFILE="standard"
|
|
94
|
+
EOF
|
|
95
|
+
# Installed updater = the fixed script PLUS a marker → differs from source →
|
|
96
|
+
# forces the self-bootstrap path (as a real stale install would).
|
|
97
|
+
cp "$NEW_UPDATER" "$C/.claude/scripts/hooks/superkit-update.sh"
|
|
98
|
+
printf '# LOCAL-STUB-MARKER\n' >> "$C/.claude/scripts/hooks/superkit-update.sh"
|
|
99
|
+
chmod +x "$C/.claude/scripts/hooks/superkit-update.sh"
|
|
100
|
+
# planted consumer files
|
|
101
|
+
wf "$C/.claude/agents/pristine.md" "P2" # (a) pristine @ v0.0.2
|
|
102
|
+
wf "$C/.claude/scripts/hooks/ahook.sh" "S1" # (c) matches older tag v0.0.1
|
|
103
|
+
wf "$C/.claude/rules/custom.md" "LOCAL-EDIT" # (b) customized
|
|
104
|
+
wf "$C/.claude/scripts/hooks/superkit-counts-verify.sh" "PLANTED" # (d) internal planted
|
|
105
|
+
# newfile.md / references/ref.md / lib/profile.sh / gosafe.md / gohook.sh / skills → absent (e)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
run_updater() { # $1 = consumer root ; echoes combined stdout+stderr
|
|
109
|
+
CLAUDE_PROJECT_DIR="$1" bash "$1/.claude/scripts/hooks/superkit-update.sh" 2>&1
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
113
|
+
# MAIN RUN — baseline meta 0.0.2 (tag exists), source 0.0.3
|
|
114
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
115
|
+
echo "── main run: meta baseline v0.0.2 → source 0.0.3"
|
|
116
|
+
CONSUMER="$WORK/consumer"
|
|
117
|
+
build_consumer "$CONSUMER" 0.0.2
|
|
118
|
+
OUT="$(run_updater "$CONSUMER")"
|
|
119
|
+
echo "$OUT" | sed 's/^/ [out] /'
|
|
120
|
+
|
|
121
|
+
chk "(a) pristine@v0.0.2 → overwritten to new (P3)" "$CONSUMER/.claude/agents/pristine.md" "P3"
|
|
122
|
+
chk "(c) stale matching older tag v0.0.1 → overwritten (S3)" "$CONSUMER/.claude/scripts/hooks/ahook.sh" "S3"
|
|
123
|
+
chk "(b) customized (no tag match) → preserved byte-identical" "$CONSUMER/.claude/rules/custom.md" "LOCAL-EDIT"
|
|
124
|
+
if echo "$OUT" | grep -qF "$CONSUMER/.claude/rules/custom.md"; then
|
|
125
|
+
pass "(b) customized file named in the report"
|
|
126
|
+
else
|
|
127
|
+
fail "(b) customized file NOT named in report"
|
|
128
|
+
fi
|
|
129
|
+
chk "(d) internal file planted in consumer → NOT overwritten" "$CONSUMER/.claude/scripts/hooks/superkit-counts-verify.sh" "PLANTED"
|
|
130
|
+
if [ ! -e "$CONSUMER/.claude/scripts/hooks/verify-hooks.sh" ]; then
|
|
131
|
+
pass "(d) internal verify-hooks.sh absent → never newly copied"
|
|
132
|
+
else
|
|
133
|
+
fail "(d) internal verify-hooks.sh was copied into consumer"
|
|
134
|
+
fi
|
|
135
|
+
if [ ! -e "$CONSUMER/.claude/rules/superkit-integrity.md" ]; then
|
|
136
|
+
pass "(d) internal superkit-integrity.md absent → never newly copied"
|
|
137
|
+
else
|
|
138
|
+
fail "(d) internal superkit-integrity.md was copied into consumer"
|
|
139
|
+
fi
|
|
140
|
+
chk "(e) absent core agent → created" "$CONSUMER/.claude/agents/newfile.md" "NEWFILE-CONTENT"
|
|
141
|
+
chk "(e) absent reference doc → created" "$CONSUMER/.claude/agents/references/ref.md" "REF-DOC"
|
|
142
|
+
chk "(e) absent hooks/lib file → created" "$CONSUMER/.claude/scripts/hooks/lib/profile.sh" "LIBPROFILE"
|
|
143
|
+
chk "(e) absent stack-rule → created" "$CONSUMER/.claude/rules/gosafe.md" "GOSAFE"
|
|
144
|
+
chk "(e) absent stack-hook → created" "$CONSUMER/.claude/scripts/hooks/gohook.sh" "GOHOOK"
|
|
145
|
+
chk "(e) absent skill file → created" "$CONSUMER/.claude/skills/demo/SKILL.md" "SKILL-BODY"
|
|
146
|
+
chk "(e) absent ADR template → created at project root" "$CONSUMER/docs-templates/adr-template.md" "ADR-TEMPLATE-BODY"
|
|
147
|
+
chk "(i) absent statusline → created at .claude/scripts/" "$CONSUMER/.claude/scripts/statusline.cjs" "STATUSLINE-V3"
|
|
148
|
+
|
|
149
|
+
# self-bootstrap: the installed copy must have been replaced by the source copy
|
|
150
|
+
if grep -qF 'LOCAL-STUB-MARKER' "$CONSUMER/.claude/scripts/hooks/superkit-update.sh"; then
|
|
151
|
+
fail "bootstrap: installed updater still carries the stub marker (not replaced)"
|
|
152
|
+
else
|
|
153
|
+
pass "bootstrap: installed updater replaced by source copy before sync"
|
|
154
|
+
fi
|
|
155
|
+
# report line shape + K skipped == 3 internal
|
|
156
|
+
if echo "$OUT" | grep -qE '^superkit-update: [0-9]+ synced · [0-9]+ preserved .* · 3 skipped \(internal\)'; then
|
|
157
|
+
pass "report: compact summary line with 3 internal skipped"
|
|
158
|
+
else
|
|
159
|
+
fail "report: summary line missing/malformed"
|
|
160
|
+
fi
|
|
161
|
+
# meta version bumped to the new source version
|
|
162
|
+
if grep -q 'SUPERKIT_VERSION="0.0.3"' "$CONSUMER/.claude/.superkit-meta"; then
|
|
163
|
+
pass "meta version bumped 0.0.2 → 0.0.3"
|
|
164
|
+
else
|
|
165
|
+
fail "meta version not bumped"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
169
|
+
# (f) MISSING BASELINE TAG — meta 0.0.9 (no v0.0.9 tag in the fixture)
|
|
170
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
171
|
+
echo ""
|
|
172
|
+
echo "── (f) run: meta baseline v0.0.9 MISSING → source 0.0.3"
|
|
173
|
+
CONSUMER_F="$WORK/consumer_f"
|
|
174
|
+
build_consumer "$CONSUMER_F" 0.0.9
|
|
175
|
+
OUT_F="$(run_updater "$CONSUMER_F")"
|
|
176
|
+
echo "$OUT_F" | sed 's/^/ [out] /'
|
|
177
|
+
|
|
178
|
+
chk "(f) missing baseline: customized file preserved (fail-safe)" "$CONSUMER_F/.claude/rules/custom.md" "LOCAL-EDIT"
|
|
179
|
+
if echo "$OUT_F" | grep -qF "$CONSUMER_F/.claude/rules/custom.md"; then
|
|
180
|
+
pass "(f) preserved file reported"
|
|
181
|
+
else
|
|
182
|
+
fail "(f) preserved file not reported"
|
|
183
|
+
fi
|
|
184
|
+
chk "(f) missing baseline: file matching walked tag v0.0.1 still synced" "$CONSUMER_F/.claude/scripts/hooks/ahook.sh" "S3"
|
|
185
|
+
|
|
186
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
187
|
+
# (g) ADR TEMPLATE — project-root, create-if-missing, never clobber/report
|
|
188
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
189
|
+
echo ""
|
|
190
|
+
echo "── (g) run: pre-existing ADR template stays untouched & unreported"
|
|
191
|
+
CONSUMER_G="$WORK/consumer_g"
|
|
192
|
+
build_consumer "$CONSUMER_G" 0.0.2
|
|
193
|
+
# Plant a locally-edited ADR template at the PROJECT root (not .claude/)
|
|
194
|
+
wf "$CONSUMER_G/docs-templates/adr-template.md" "MY-CUSTOM-ADR"
|
|
195
|
+
OUT_G="$(run_updater "$CONSUMER_G")"
|
|
196
|
+
echo "$OUT_G" | sed 's/^/ [out] /'
|
|
197
|
+
|
|
198
|
+
chk "(g) pre-existing ADR template → left untouched" "$CONSUMER_G/docs-templates/adr-template.md" "MY-CUSTOM-ADR"
|
|
199
|
+
if echo "$OUT_G" | grep -qF "$CONSUMER_G/docs-templates/adr-template.md"; then
|
|
200
|
+
fail "(g) customized ADR template wrongly named in preserved report"
|
|
201
|
+
else
|
|
202
|
+
pass "(g) ADR template NOT reported (doc template — silence is correct)"
|
|
203
|
+
fi
|
|
204
|
+
|
|
205
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
206
|
+
# (i-fork) FORKED statusline.cjs → preserved (consumers legitimately fork it)
|
|
207
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
208
|
+
echo ""
|
|
209
|
+
echo "── (i-fork) run: a forked statusline is preserved, not clobbered"
|
|
210
|
+
CONSUMER_I="$WORK/consumer_i"
|
|
211
|
+
build_consumer "$CONSUMER_I" 0.0.2
|
|
212
|
+
wf "$CONSUMER_I/.claude/scripts/statusline.cjs" "MY-FORKED-STATUSLINE"
|
|
213
|
+
OUT_I="$(run_updater "$CONSUMER_I")"
|
|
214
|
+
echo "$OUT_I" | sed 's/^/ [out] /'
|
|
215
|
+
chk "(i-fork) forked statusline → preserved byte-identical" "$CONSUMER_I/.claude/scripts/statusline.cjs" "MY-FORKED-STATUSLINE"
|
|
216
|
+
if echo "$OUT_I" | grep -qF "$CONSUMER_I/.claude/scripts/statusline.cjs"; then
|
|
217
|
+
pass "(i-fork) forked statusline named in the preserved report"
|
|
218
|
+
else
|
|
219
|
+
fail "(i-fork) forked statusline NOT reported"
|
|
220
|
+
fi
|
|
221
|
+
|
|
222
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
223
|
+
# (h) MANIFEST FALLBACK — must be PER CATEGORY (v1.5.2 fix)
|
|
224
|
+
# A manifest that loses just one category's lines must still protect that
|
|
225
|
+
# category via the hard-coded fallback; the healthy category keeps reading
|
|
226
|
+
# from the manifest. Manifest mutations below are working-tree-only.
|
|
227
|
+
# ─────────────────────────────────────────────────────────────────────
|
|
228
|
+
echo ""
|
|
229
|
+
echo "── (h) manifest fallback variants"
|
|
230
|
+
MANIFEST="$P/core/INTERNAL-FILES"
|
|
231
|
+
MANIFEST_BAK="$WORK/manifest.bak"
|
|
232
|
+
cp "$MANIFEST" "$MANIFEST_BAK"
|
|
233
|
+
|
|
234
|
+
# (h1) hooks-only manifest → rules category empty → rules MUST fall back
|
|
235
|
+
printf 'hooks/superkit-counts-verify.sh\nhooks/verify-hooks.sh\n' > "$MANIFEST"
|
|
236
|
+
C_H1="$WORK/consumer_h1"; build_consumer "$C_H1" 0.0.2
|
|
237
|
+
OUT_H1="$(run_updater "$C_H1")"
|
|
238
|
+
if [ ! -e "$C_H1/.claude/rules/superkit-integrity.md" ]; then
|
|
239
|
+
pass "(h1) hooks-only manifest: superkit-integrity.md still NOT copied (rules fallback)"
|
|
240
|
+
else
|
|
241
|
+
fail "(h1) hooks-only manifest: superkit-integrity.md LEAKED into consumer"
|
|
242
|
+
fi
|
|
243
|
+
if [ ! -e "$C_H1/.claude/scripts/hooks/verify-hooks.sh" ]; then
|
|
244
|
+
pass "(h1) hooks-only manifest: hooks still skipped (from manifest)"
|
|
245
|
+
else
|
|
246
|
+
fail "(h1) hooks-only manifest: verify-hooks.sh copied"
|
|
247
|
+
fi
|
|
248
|
+
if echo "$OUT_H1" | grep -q "no 'rules/' entries"; then
|
|
249
|
+
pass "(h1) empty category warned on stderr"
|
|
250
|
+
else
|
|
251
|
+
fail "(h1) no stderr warning for the empty rules category"
|
|
252
|
+
fi
|
|
253
|
+
|
|
254
|
+
# (h2) rules-only manifest → hooks category empty → hooks MUST fall back
|
|
255
|
+
printf 'rules/superkit-integrity.md\n' > "$MANIFEST"
|
|
256
|
+
C_H2="$WORK/consumer_h2"; build_consumer "$C_H2" 0.0.2
|
|
257
|
+
OUT_H2="$(run_updater "$C_H2")"
|
|
258
|
+
if [ ! -e "$C_H2/.claude/scripts/hooks/verify-hooks.sh" ]; then
|
|
259
|
+
pass "(h2) rules-only manifest: verify-hooks.sh still NOT copied (hooks fallback)"
|
|
260
|
+
else
|
|
261
|
+
fail "(h2) rules-only manifest: verify-hooks.sh LEAKED into consumer"
|
|
262
|
+
fi
|
|
263
|
+
if [ ! -e "$C_H2/.claude/rules/superkit-integrity.md" ]; then
|
|
264
|
+
pass "(h2) rules-only manifest: rules still skipped (from manifest)"
|
|
265
|
+
else
|
|
266
|
+
fail "(h2) rules-only manifest: superkit-integrity.md copied"
|
|
267
|
+
fi
|
|
268
|
+
|
|
269
|
+
# (h3) manifest present but ALL lines commented → both categories fall back
|
|
270
|
+
printf '# nothing here\n# hooks/superkit-counts-verify.sh\n' > "$MANIFEST"
|
|
271
|
+
C_H3="$WORK/consumer_h3"; build_consumer "$C_H3" 0.0.2
|
|
272
|
+
OUT_H3="$(run_updater "$C_H3")"
|
|
273
|
+
if [ ! -e "$C_H3/.claude/rules/superkit-integrity.md" ] && [ ! -e "$C_H3/.claude/scripts/hooks/verify-hooks.sh" ]; then
|
|
274
|
+
pass "(h3) all-commented manifest: both categories fall back, nothing leaked"
|
|
275
|
+
else
|
|
276
|
+
fail "(h3) all-commented manifest: an internal file leaked"
|
|
277
|
+
fi
|
|
278
|
+
|
|
279
|
+
# (h4) manifest MISSING entirely → both fall back, silently (pre-manifest clones)
|
|
280
|
+
rm -f "$MANIFEST"
|
|
281
|
+
C_H4="$WORK/consumer_h4"; build_consumer "$C_H4" 0.0.2
|
|
282
|
+
OUT_H4="$(run_updater "$C_H4")"
|
|
283
|
+
if [ ! -e "$C_H4/.claude/rules/superkit-integrity.md" ] && [ ! -e "$C_H4/.claude/scripts/hooks/verify-hooks.sh" ]; then
|
|
284
|
+
pass "(h4) missing manifest: both categories fall back, nothing leaked"
|
|
285
|
+
else
|
|
286
|
+
fail "(h4) missing manifest: an internal file leaked"
|
|
287
|
+
fi
|
|
288
|
+
if echo "$OUT_H4" | grep -q "entries"; then
|
|
289
|
+
fail "(h4) missing manifest warned (should be silent — benign for pre-manifest clones)"
|
|
290
|
+
else
|
|
291
|
+
pass "(h4) missing manifest stays silent"
|
|
292
|
+
fi
|
|
293
|
+
|
|
294
|
+
# (h5) complete manifest restored → all three skipped again (from the manifest)
|
|
295
|
+
cp "$MANIFEST_BAK" "$MANIFEST"
|
|
296
|
+
C_H5="$WORK/consumer_h5"; build_consumer "$C_H5" 0.0.2
|
|
297
|
+
OUT_H5="$(run_updater "$C_H5")"
|
|
298
|
+
if echo "$OUT_H5" | grep -qE '· 3 skipped \(internal\)' && [ ! -e "$C_H5/.claude/rules/superkit-integrity.md" ]; then
|
|
299
|
+
pass "(h5) complete manifest: 3 internal skipped, no fallback needed"
|
|
300
|
+
else
|
|
301
|
+
fail "(h5) complete manifest: skip accounting wrong"
|
|
302
|
+
fi
|
|
303
|
+
|
|
304
|
+
# ── Summary ──────────────────────────────────────────────────────────
|
|
305
|
+
echo ""
|
|
306
|
+
TOTAL=$((PASS + FAIL))
|
|
307
|
+
if [ "$FAIL" -gt 0 ]; then
|
|
308
|
+
echo "SUPERKIT-UPDATE TESTS FAILED ($FAIL/$TOTAL failed)"
|
|
309
|
+
exit 1
|
|
310
|
+
fi
|
|
311
|
+
echo "ALL SUPERKIT-UPDATE TESTS PASSED ($PASS/$TOTAL)"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# warn-visibility_test.sh — regression test for superkit_advise (Task 17)
|
|
3
|
+
#
|
|
4
|
+
# Verifies that warn-only PreToolUse advisories are surfaced as valid JSON
|
|
5
|
+
# `hookSpecificOutput.additionalContext` on stdout (Claude Code can swallow
|
|
6
|
+
# non-blocking PreToolUse stderr). Asserts both validity and correct escaping.
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
LIB="$(cd "$(dirname "$0")/.." && pwd)/lib/profile.sh"
|
|
10
|
+
[ -f "$LIB" ] || { echo "FAIL: lib not found at $LIB"; exit 1; }
|
|
11
|
+
# shellcheck source=/dev/null
|
|
12
|
+
source "$LIB"
|
|
13
|
+
|
|
14
|
+
command -v superkit_advise >/dev/null 2>&1 || { echo "FAIL: superkit_advise not exported by profile.sh"; exit 1; }
|
|
15
|
+
|
|
16
|
+
# Test 1: valid JSON + correct escaping of embedded double-quotes
|
|
17
|
+
OUT=$(superkit_advise 'hello "world"')
|
|
18
|
+
if ! printf '%s' "$OUT" | jq -e '.hookSpecificOutput.additionalContext == "hello \"world\""' >/dev/null; then
|
|
19
|
+
echo "FAIL: additionalContext did not round-trip with escaped quotes"
|
|
20
|
+
echo " got: $OUT"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
echo "PASS: escaped-quote message round-trips as valid JSON"
|
|
24
|
+
|
|
25
|
+
# Test 2: hookEventName is PreToolUse
|
|
26
|
+
if ! printf '%s' "$OUT" | jq -e '.hookSpecificOutput.hookEventName == "PreToolUse"' >/dev/null; then
|
|
27
|
+
echo "FAIL: hookEventName should be PreToolUse"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
echo "PASS: hookEventName == PreToolUse"
|
|
31
|
+
|
|
32
|
+
# Test 3: backslashes and plain text survive
|
|
33
|
+
OUT2=$(superkit_advise 'path C:\temp and a plain sentence.')
|
|
34
|
+
if ! printf '%s' "$OUT2" | jq -e '.hookSpecificOutput.additionalContext == "path C:\\temp and a plain sentence."' >/dev/null; then
|
|
35
|
+
echo "FAIL: backslash message did not round-trip"
|
|
36
|
+
echo " got: $OUT2"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
echo "PASS: backslash + plain text round-trips"
|
|
40
|
+
|
|
41
|
+
# Test 4: gateguard-pre-edit advisory path emits additionalContext on stdout.
|
|
42
|
+
# No prior Grep/Read state → advisory branch fires; assert stdout carries
|
|
43
|
+
# valid hookSpecificOutput JSON (stderr is allowed but not relied upon).
|
|
44
|
+
HOOK="$(cd "$(dirname "$0")/.." && pwd)/gateguard-pre-edit.sh"
|
|
45
|
+
[ -x "$HOOK" ] || { echo "FAIL: gateguard hook not executable at $HOOK"; exit 1; }
|
|
46
|
+
GG_STATE="${TMPDIR:-/tmp}/superkit-gateguard-warnvis-$$"
|
|
47
|
+
rm -f "$GG_STATE"
|
|
48
|
+
STDOUT=$(echo '{"hook_event_name":"PreToolUse","tool_name":"Edit","tool_input":{"file_path":"/tmp/fake.txt"}}' \
|
|
49
|
+
| CLAUDE_GATEGUARD_STATE="$GG_STATE" bash "$HOOK" 2>/dev/null || true)
|
|
50
|
+
rm -f "$GG_STATE"
|
|
51
|
+
if ! printf '%s' "$STDOUT" | jq -e '.hookSpecificOutput.hookEventName == "PreToolUse" and (.hookSpecificOutput.additionalContext | test("GateGuard"))' >/dev/null; then
|
|
52
|
+
echo "FAIL: gateguard advisory did not surface additionalContext on stdout"
|
|
53
|
+
echo " stdout was: $STDOUT"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
echo "PASS: gateguard advisory surfaces additionalContext on stdout"
|
|
57
|
+
|
|
58
|
+
echo ""
|
|
59
|
+
echo "ALL WARN-VISIBILITY TESTS PASSED (4/4)"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# user-intent-detect.sh — identify user-initiated quick-work intent
|
|
3
|
+
# Triggers on: UserPromptSubmit
|
|
4
|
+
# Profile: standard, strict
|
|
5
|
+
#
|
|
6
|
+
# When the user explicitly asks for a quick/small change, we mark the
|
|
7
|
+
# session. `dev-required-on-commit.sh` then allows `[quick]` WITHOUT
|
|
8
|
+
# the ≥15 char rationale — the user explicitly took responsibility.
|
|
9
|
+
# When Claude autonomously picks `[quick]` without a matching user
|
|
10
|
+
# signal, the override counts DOUBLE against the Task 12 budget
|
|
11
|
+
# (not implemented here — see Task 15 follow-up in the plan).
|
|
12
|
+
#
|
|
13
|
+
# Marker: ${TMPDIR:-/tmp}/claude-user-said-quick-<session>
|
|
14
|
+
# Opt-out: CLAUDE_DISABLE_INTENT_DETECT=1
|
|
15
|
+
|
|
16
|
+
# Unified profile + disable check
|
|
17
|
+
SUPERKIT_PROFILE_LIB="$(dirname "$0")/lib/profile.sh"
|
|
18
|
+
[ -f "$SUPERKIT_PROFILE_LIB" ] || SUPERKIT_PROFILE_LIB="$(dirname "$0")/../lib/profile.sh"
|
|
19
|
+
# shellcheck source=/dev/null
|
|
20
|
+
[ -f "$SUPERKIT_PROFILE_LIB" ] && source "$SUPERKIT_PROFILE_LIB" && should_skip_hook "$(basename "$0" .sh)" && exit 0
|
|
21
|
+
|
|
22
|
+
PROFILE="${CLAUDE_HOOK_PROFILE:-standard}"
|
|
23
|
+
if [ "$PROFILE" = "fast" ] || [ "${CLAUDE_DISABLE_INTENT_DETECT:-}" = "1" ]; then
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
INPUT=$(cat 2>/dev/null || echo '{}')
|
|
28
|
+
EVENT=$(echo "$INPUT" | jq -r '.hook_event_name // empty' 2>/dev/null)
|
|
29
|
+
[ "$EVENT" = "UserPromptSubmit" ] || exit 0
|
|
30
|
+
|
|
31
|
+
PROMPT=$(echo "$INPUT" | jq -r '.prompt // empty' 2>/dev/null)
|
|
32
|
+
[ -z "$PROMPT" ] && exit 0
|
|
33
|
+
|
|
34
|
+
# Match explicit user signals for quick / small work. Keep these narrow
|
|
35
|
+
# so a user typing "the quick brown fox" doesn't false-trigger.
|
|
36
|
+
if ! printf '%s' "$PROMPT" | grep -qiE '(^|[[:space:]])(quick fix|small tweak|tiny change|just fix|fast fix|hotfix|small fix|quick change|небольшой фикс|быстрый фикс)([[:space:]]|[.,!?:;]|$)'; then
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
|
|
41
|
+
SESSION_KEY="${SESSION_ID:-${CLAUDE_HOOK_PID:-$PPID}}"
|
|
42
|
+
MARKER="${TMPDIR:-/tmp}/claude-user-said-quick-${SESSION_KEY}"
|
|
43
|
+
touch "$MARKER"
|
|
44
|
+
exit 0
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# verify-hooks.sh — Check that hook scripts are tracked in git and executable
|
|
3
|
+
# Run: bash .claude/scripts/hooks/verify-hooks.sh
|
|
4
|
+
|
|
5
|
+
# Note: no set -e — hooks must fail-open
|
|
6
|
+
|
|
7
|
+
HOOKS_DIR=".claude/scripts/hooks"
|
|
8
|
+
ISSUES=0
|
|
9
|
+
|
|
10
|
+
# Check hooks directory exists
|
|
11
|
+
if [ ! -d "$HOOKS_DIR" ]; then
|
|
12
|
+
echo "❌ Hooks directory not found: $HOOKS_DIR"
|
|
13
|
+
echo " Run the superkit installer to set up hooks."
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Check .gitignore doesn't block hooks
|
|
18
|
+
if [ -f ".gitignore" ]; then
|
|
19
|
+
if grep -qE '^\s*\.claude/scripts/?$|^\s*\.claude/scripts/\*' .gitignore 2>/dev/null; then
|
|
20
|
+
echo "❌ CRITICAL: .gitignore blocks hook scripts!"
|
|
21
|
+
echo " Line found: $(grep -E '\.claude/scripts' .gitignore)"
|
|
22
|
+
echo " Remove this line — hooks MUST be tracked in git for enforcement to work."
|
|
23
|
+
echo " Other users who clone this repo will get NO hook enforcement."
|
|
24
|
+
ISSUES=$((ISSUES + 1))
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Check hooks are executable
|
|
29
|
+
for hook in "$HOOKS_DIR"/*.sh; do
|
|
30
|
+
[ -f "$hook" ] || continue
|
|
31
|
+
if [ ! -x "$hook" ]; then
|
|
32
|
+
echo "⚠️ Not executable: $hook"
|
|
33
|
+
echo " Fix: chmod +x $hook"
|
|
34
|
+
ISSUES=$((ISSUES + 1))
|
|
35
|
+
fi
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
# Check hooks are tracked in git
|
|
39
|
+
if command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
40
|
+
for hook in "$HOOKS_DIR"/*.sh; do
|
|
41
|
+
[ -f "$hook" ] || continue
|
|
42
|
+
if git check-ignore -q "$hook" 2>/dev/null; then
|
|
43
|
+
echo "❌ Git-ignored: $hook"
|
|
44
|
+
echo " This hook won't be available to anyone who clones the repo."
|
|
45
|
+
ISSUES=$((ISSUES + 1))
|
|
46
|
+
fi
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
UNTRACKED=$(git ls-files --others --exclude-standard "$HOOKS_DIR" 2>/dev/null | wc -l | tr -d ' ')
|
|
50
|
+
if [ "$UNTRACKED" -gt 0 ]; then
|
|
51
|
+
echo "⚠️ $UNTRACKED hook(s) not committed to git:"
|
|
52
|
+
git ls-files --others --exclude-standard "$HOOKS_DIR" 2>/dev/null | while read -r f; do
|
|
53
|
+
echo " $f"
|
|
54
|
+
done
|
|
55
|
+
echo " Run: git add $HOOKS_DIR/ && git commit"
|
|
56
|
+
ISSUES=$((ISSUES + 1))
|
|
57
|
+
fi
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
if [ "$ISSUES" -eq 0 ]; then
|
|
61
|
+
HOOK_COUNT=$(find "$HOOKS_DIR" -name '*.sh' 2>/dev/null | wc -l | tr -d ' ')
|
|
62
|
+
echo "✅ All $HOOK_COUNT hooks are properly configured and tracked in git."
|
|
63
|
+
else
|
|
64
|
+
echo ""
|
|
65
|
+
echo "Found $ISSUES issue(s). Fix them to ensure enforcement works for all team members."
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
exit 0
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
tokens: 1483
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Auto Command Triggers
|
|
7
|
+
|
|
8
|
+
Commands Claude MUST invoke automatically when a condition below matches — without the user asking. Complements `dev-workflow.md` (which owns `/dev` auto-triggers).
|
|
9
|
+
|
|
10
|
+
## Hard Rules
|
|
11
|
+
|
|
12
|
+
1. **Docs before commit — highest priority, NEVER skip.** Before EVERY `git commit` that includes code changes, verify docs are staged alongside code (see Documentation section below).
|
|
13
|
+
2. **No double-runs.** A command that already ran for this task — via `/dev` or an explicit user call — is not run again.
|
|
14
|
+
3. **Silent execution.** Run auto-triggered commands without announcing or asking permission; report findings in 1–3 lines, not full verbose output.
|
|
15
|
+
4. **Never auto-fix security findings.** `/security-scan` results always go to the user first.
|
|
16
|
+
5. **User override.** If the user says "skip review" / "don't test", skip that command for the current task.
|
|
17
|
+
|
|
18
|
+
## /review — Auto Code Review
|
|
19
|
+
|
|
20
|
+
| Trigger | Condition |
|
|
21
|
+
|---------|-----------|
|
|
22
|
+
| Post-implementation | After completing work on **3+ files** in one task |
|
|
23
|
+
| Pre-commit | Before user-requested `git commit` if **5+ files** changed |
|
|
24
|
+
| Security-sensitive | After modifying auth, session, permission, or crypto-related code |
|
|
25
|
+
|
|
26
|
+
**Behavior:**
|
|
27
|
+
- Run right after finishing implementation — do not ask "should I review?"
|
|
28
|
+
- Use `--comment` only when the user is working on a PR
|
|
29
|
+
- Skip if `/dev` already ran — its Review phase covers this
|
|
30
|
+
|
|
31
|
+
## /test — Auto Test Run
|
|
32
|
+
|
|
33
|
+
| Trigger | Condition |
|
|
34
|
+
|---------|-----------|
|
|
35
|
+
| After feature implementation | New endpoint, service, handler, or component created |
|
|
36
|
+
| After bug fix | Any fix that touches logic (not just typos/config) |
|
|
37
|
+
| After refactor | Structural changes to existing code |
|
|
38
|
+
| Test file edited | When test files are directly modified — verify they pass |
|
|
39
|
+
|
|
40
|
+
**Behavior:**
|
|
41
|
+
- Auto-detect stack and run the matching test command
|
|
42
|
+
- Run the test scope covering the changed files (same package/module/directory); run the full suite only when that mapping is unclear or **10+ files** changed
|
|
43
|
+
- If tests fail — report and suggest fixes, do NOT silently proceed
|
|
44
|
+
- Skip if `/dev` already ran — its Test phase covers this
|
|
45
|
+
|
|
46
|
+
## /lint — Auto Lint Check
|
|
47
|
+
|
|
48
|
+
| Trigger | Condition |
|
|
49
|
+
|---------|-----------|
|
|
50
|
+
| Pre-commit | Before any `git commit` with code changes (not docs-only) |
|
|
51
|
+
| Multi-file edit | After editing **5+ code files** in one task |
|
|
52
|
+
|
|
53
|
+
**Behavior:**
|
|
54
|
+
- Run full lint (single-file hooks catch only basics)
|
|
55
|
+
- Auto-fix safe issues (formatting, import sorting) without asking
|
|
56
|
+
- Report unfixable issues to the user
|
|
57
|
+
- Skip if stack hooks already cover everything (e.g., strict profile with go-vet + typecheck)
|
|
58
|
+
|
|
59
|
+
## /audit --health — Auto Health Check
|
|
60
|
+
|
|
61
|
+
| Trigger | Condition |
|
|
62
|
+
|---------|-----------|
|
|
63
|
+
| Session start (long task) | When the user requests a task that will take **10+ file changes** |
|
|
64
|
+
| Post-major-refactor | After refactoring that touches **10+ files** |
|
|
65
|
+
|
|
66
|
+
**Behavior:**
|
|
67
|
+
- Use `--health` (quick mode, ~30s) — never full `/audit` automatically
|
|
68
|
+
- Report critical findings only, suppress suggestions
|
|
69
|
+
- Launch it in the background and continue the main task; if background execution is unavailable, run it last, after all other auto-triggers
|
|
70
|
+
|
|
71
|
+
## /security-scan — Auto Security Check
|
|
72
|
+
|
|
73
|
+
`/security-scan` audits `.claude/` configuration (AgentShield) — its triggers therefore fire on configuration changes, not on application code:
|
|
74
|
+
|
|
75
|
+
| Trigger | Condition |
|
|
76
|
+
|---------|-----------|
|
|
77
|
+
| Claude config changed | Any file under `.claude/` edited: `settings*.json`, `agents/*`, `hooks/*`, `commands/*`, `rules/*` |
|
|
78
|
+
| MCP wiring changed | `.mcp.json` or `mcpServers` blocks edited |
|
|
79
|
+
| Kit install/update ran | After `npx claude-code-superkit` or `setup.sh` completes |
|
|
80
|
+
|
|
81
|
+
For application-code security (auth files, new dependencies, CI/CD configs), rely on **security-scanner** — /review and the /dev Review phase auto-dispatch it for exactly those changes.
|
|
82
|
+
|
|
83
|
+
**Behavior:**
|
|
84
|
+
- Auto-triggered scans use the plain scan — no `--fix`, no `--opus`
|
|
85
|
+
- AgentShield grades on its own `critical / high / medium / low` scale — relay it verbatim, never remap to the kit's CRITICAL / WARNING / SUGGESTION
|
|
86
|
+
- For auto-triggered scans, report only `critical` and `high` findings
|
|
87
|
+
- Do NOT auto-fix security issues — always report to the user first (Hard Rule 4)
|
|
88
|
+
|
|
89
|
+
## Documentation — Auto Verify Before Commit
|
|
90
|
+
|
|
91
|
+
Highest-priority auto-trigger (Hard Rule 1).
|
|
92
|
+
|
|
93
|
+
| Trigger | Condition |
|
|
94
|
+
|---------|-----------|
|
|
95
|
+
| Pre-commit | Before EVERY `git commit` that includes code changes (.go, .ts, .tsx, .sql, .py, .rs) |
|
|
96
|
+
|
|
97
|
+
**Behavior:**
|
|
98
|
+
- Before committing, verify corresponding docs are staged alongside code:
|
|
99
|
+
- **Migration staged** → database schema docs updated
|
|
100
|
+
- **Handler/endpoint changed** → API reference docs updated
|
|
101
|
+
- **Frontend behavior changed** → frontend state/architecture docs updated
|
|
102
|
+
- Docs missing → update them BEFORE committing, not after
|
|
103
|
+
- The `doc-check-on-commit` hook BLOCKS commits with missing docs — fix the docs, never bypass the hook
|
|
104
|
+
|
|
105
|
+
## When NOT to auto-trigger
|
|
106
|
+
|
|
107
|
+
| Situation | Why skip |
|
|
108
|
+
|-----------|----------|
|
|
109
|
+
| Already inside `/dev` workflow | its Verify, Test, and Review phases cover this |
|
|
110
|
+
| User explicitly said "just do X" / "quick fix" | respect user intent for speed |
|
|
111
|
+
| Docs-only or config-only changes | no logic to test/review/scan |
|
|
112
|
+
| User is exploring / asking questions | no code changes to validate |
|
|
113
|
+
| Single file, < 50 lines changed | overhead not justified |
|
|
114
|
+
|
|
115
|
+
## Priority
|
|
116
|
+
|
|
117
|
+
When multiple auto-triggers fire, run in this order:
|
|
118
|
+
1. `/lint` (fastest, catches obvious issues)
|
|
119
|
+
2. `/test` (catches logic errors)
|
|
120
|
+
3. `/review` (catches design issues)
|
|
121
|
+
4. `/security-scan` (catches vulnerabilities)
|
|
122
|
+
5. `/audit --health` (overall health, lowest priority)
|
|
123
|
+
|
|
124
|
+
Early stop: if **fewer than 3 files** changed AND every command already run in this order reported zero issues → skip the remaining lower-priority commands. Exception: a command whose own trigger condition matched still runs (e.g., `/security-scan` after a `.claude/` config edit).
|