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.
Files changed (353) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +374 -2
  3. package/bin/cli.js +153 -0
  4. package/bin/inject-tokens.js +224 -0
  5. package/bin/measure-tokens.js +17 -0
  6. package/bin/superkit-counts-verify.sh +30 -0
  7. package/lib/codex.js +246 -0
  8. package/lib/docs-scaffold.js +147 -0
  9. package/lib/installer.js +499 -0
  10. package/lib/prompts.js +51 -0
  11. package/lib/settings-builder.js +51 -0
  12. package/lib/superpowers.js +99 -0
  13. package/lib/utils.js +117 -0
  14. package/lib/validator.js +84 -0
  15. package/package.json +49 -4
  16. package/packages/codex/AGENTS.md +396 -0
  17. package/packages/codex/INSTALL.md +342 -0
  18. package/packages/codex/config.toml +22 -0
  19. package/packages/codex/hooks/superkit.mjs +203 -0
  20. package/packages/codex/hooks.json +30 -0
  21. package/packages/codex/legacy-baseline.json +88 -0
  22. package/packages/codex/native-skills.txt +65 -0
  23. package/packages/codex/rules/default.rules +565 -0
  24. package/packages/codex/skills/ai-slop-cleaner/SKILL.md +44 -0
  25. package/packages/codex/skills/api-contract-sync/SKILL.md +96 -0
  26. package/packages/codex/skills/architect/SKILL.md +49 -0
  27. package/packages/codex/skills/audit-backend/SKILL.md +80 -0
  28. package/packages/codex/skills/audit-frontend/SKILL.md +82 -0
  29. package/packages/codex/skills/audit-infra/SKILL.md +87 -0
  30. package/packages/codex/skills/audit-orchestrator/SKILL.md +114 -0
  31. package/packages/codex/skills/behavioral-nudge-engine/SKILL.md +110 -0
  32. package/packages/codex/skills/benchmark/SKILL.md +49 -0
  33. package/packages/codex/skills/bot-reviewer/SKILL.md +94 -0
  34. package/packages/codex/skills/code-reviewer/SKILL.md +67 -0
  35. package/packages/codex/skills/codebase-onboarding-engineer/SKILL.md +46 -0
  36. package/packages/codex/skills/comment-rot-analyzer/SKILL.md +75 -0
  37. package/packages/codex/skills/commit-helper/SKILL.md +101 -0
  38. package/packages/codex/skills/critic/SKILL.md +56 -0
  39. package/packages/codex/skills/database-reviewer/SKILL.md +79 -0
  40. package/packages/codex/skills/debug-observer/SKILL.md +107 -0
  41. package/packages/codex/skills/dependency-checker/SKILL.md +69 -0
  42. package/packages/codex/skills/design-system-reviewer/SKILL.md +121 -0
  43. package/packages/codex/skills/dev-orchestrator/SKILL.md +304 -0
  44. package/packages/codex/skills/docs-reviewer/SKILL.md +86 -0
  45. package/packages/codex/skills/drizzle-orm-expert/SKILL.md +246 -0
  46. package/packages/codex/skills/e2e-test-generator/SKILL.md +95 -0
  47. package/packages/codex/skills/evaluator/SKILL.md +63 -0
  48. package/packages/codex/skills/frontend-perf-reviewer/SKILL.md +95 -0
  49. package/packages/codex/skills/frontend-ui-color-reviewer/SKILL.md +68 -0
  50. package/packages/codex/skills/frontend-ui-design-critic/SKILL.md +99 -0
  51. package/packages/codex/skills/frontend-ui-interaction-reviewer/SKILL.md +102 -0
  52. package/packages/codex/skills/frontend-ui-motion-reviewer/SKILL.md +85 -0
  53. package/packages/codex/skills/frontend-ui-reviewer/SKILL.md +81 -0
  54. package/packages/codex/skills/frontend-ui-typography-reviewer/SKILL.md +62 -0
  55. package/packages/codex/skills/gltf-debugging/SKILL.md +128 -0
  56. package/packages/codex/skills/go-benchmark/SKILL.md +217 -0
  57. package/packages/codex/skills/go-concurrency-reviewer/SKILL.md +113 -0
  58. package/packages/codex/skills/go-error-reviewer/SKILL.md +107 -0
  59. package/packages/codex/skills/go-grpc-patterns/SKILL.md +285 -0
  60. package/packages/codex/skills/go-modernizer/SKILL.md +111 -0
  61. package/packages/codex/skills/go-observability-reviewer/SKILL.md +121 -0
  62. package/packages/codex/skills/go-performance-reviewer/SKILL.md +112 -0
  63. package/packages/codex/skills/go-reviewer/SKILL.md +109 -0
  64. package/packages/codex/skills/go-samber-do/SKILL.md +158 -0
  65. package/packages/codex/skills/go-samber-lo/SKILL.md +178 -0
  66. package/packages/codex/skills/go-samber-oops/SKILL.md +174 -0
  67. package/packages/codex/skills/goal-verifier/SKILL.md +53 -0
  68. package/packages/codex/skills/health-checker/SKILL.md +109 -0
  69. package/packages/codex/skills/html-to-3d-texture/SKILL.md +153 -0
  70. package/packages/codex/skills/impeccable-craft/SKILL.md +101 -0
  71. package/packages/codex/skills/lint-runner/SKILL.md +85 -0
  72. package/packages/codex/skills/migrate/SKILL.md +60 -0
  73. package/packages/codex/skills/migration-reviewer/SKILL.md +88 -0
  74. package/packages/codex/skills/minimal-change-engineer/SKILL.md +44 -0
  75. package/packages/codex/skills/new-migration/SKILL.md +59 -0
  76. package/packages/codex/skills/nextjs-supabase-auth/SKILL.md +227 -0
  77. package/packages/codex/skills/output-enforcement/SKILL.md +71 -0
  78. package/packages/codex/skills/plan-checker/SKILL.md +53 -0
  79. package/packages/codex/skills/postgresql-optimization/SKILL.md +159 -0
  80. package/packages/codex/skills/pre-deploy-validator/SKILL.md +111 -0
  81. package/packages/codex/skills/presentation-reviewer/SKILL.md +88 -0
  82. package/packages/codex/skills/product-3d-lighting/SKILL.md +137 -0
  83. package/packages/codex/skills/project-architecture/SKILL.md +52 -0
  84. package/packages/codex/skills/py-reviewer/SKILL.md +100 -0
  85. package/packages/codex/skills/r3f-scene-reviewer/SKILL.md +88 -0
  86. package/packages/codex/skills/r3f-scroll-driven-3d/SKILL.md +162 -0
  87. package/packages/codex/skills/reality-checker/SKILL.md +61 -0
  88. package/packages/codex/skills/redis-patterns/SKILL.md +260 -0
  89. package/packages/codex/skills/review-orchestrator/SKILL.md +151 -0
  90. package/packages/codex/skills/rs-reviewer/SKILL.md +98 -0
  91. package/packages/codex/skills/ru-text/SKILL.md +132 -0
  92. package/packages/codex/skills/scaffold-endpoint/SKILL.md +44 -0
  93. package/packages/codex/skills/security-scanner/SKILL.md +94 -0
  94. package/packages/codex/skills/silent-failure-hunter/SKILL.md +176 -0
  95. package/packages/codex/skills/telegram-bot-builder/SKILL.md +120 -0
  96. package/packages/codex/skills/test-generator/SKILL.md +79 -0
  97. package/packages/codex/skills/test-runner/SKILL.md +101 -0
  98. package/packages/codex/skills/threejs-color-management/SKILL.md +97 -0
  99. package/packages/codex/skills/tree-generator/SKILL.md +63 -0
  100. package/packages/codex/skills/ts-reviewer/SKILL.md +90 -0
  101. package/packages/codex/skills/ui-design-reviewer/SKILL.md +89 -0
  102. package/packages/codex/skills/ui-reviewer/SKILL.md +103 -0
  103. package/packages/codex/skills/visual-reviewer/SKILL.md +85 -0
  104. package/packages/codex/skills/writing-agents/SKILL.md +165 -0
  105. package/packages/codex/skills/writing-commands/SKILL.md +173 -0
  106. package/packages/core/CLAUDE.md +118 -0
  107. package/packages/core/INTERNAL-FILES +16 -0
  108. package/packages/core/agents/ai-slop-cleaner.md +187 -0
  109. package/packages/core/agents/api-contract-sync.md +127 -0
  110. package/packages/core/agents/architect.md +205 -0
  111. package/packages/core/agents/audit-backend.md +137 -0
  112. package/packages/core/agents/audit-frontend.md +129 -0
  113. package/packages/core/agents/audit-infra.md +182 -0
  114. package/packages/core/agents/behavioral-nudge-engine.md +170 -0
  115. package/packages/core/agents/code-reviewer.md +195 -0
  116. package/packages/core/agents/codebase-onboarding-engineer.md +172 -0
  117. package/packages/core/agents/comment-rot-analyzer.md +115 -0
  118. package/packages/core/agents/critic.md +172 -0
  119. package/packages/core/agents/database-reviewer.md +201 -0
  120. package/packages/core/agents/debug-observer.md +261 -0
  121. package/packages/core/agents/dependency-checker.md +199 -0
  122. package/packages/core/agents/docs-reviewer.md +206 -0
  123. package/packages/core/agents/e2e-test-generator.md +261 -0
  124. package/packages/core/agents/evaluator.md +141 -0
  125. package/packages/core/agents/goal-verifier.md +130 -0
  126. package/packages/core/agents/health-checker.md +194 -0
  127. package/packages/core/agents/migration-reviewer.md +161 -0
  128. package/packages/core/agents/minimal-change-engineer.md +219 -0
  129. package/packages/core/agents/plan-checker.md +139 -0
  130. package/packages/core/agents/pre-deploy-validator.md +189 -0
  131. package/packages/core/agents/reality-checker.md +175 -0
  132. package/packages/core/agents/scaffold-endpoint.md +162 -0
  133. package/packages/core/agents/security-scanner.md +236 -0
  134. package/packages/core/agents/silent-failure-hunter.md +276 -0
  135. package/packages/core/agents/test-generator.md +146 -0
  136. package/packages/core/agents/tree-generator.md +141 -0
  137. package/packages/core/agents/ui-reviewer.md +172 -0
  138. package/packages/core/agents/visual-reviewer.md +211 -0
  139. package/packages/core/commands/audit.md +166 -0
  140. package/packages/core/commands/benchmark.md +130 -0
  141. package/packages/core/commands/commit.md +148 -0
  142. package/packages/core/commands/dev.md +302 -0
  143. package/packages/core/commands/docs-init.md +75 -0
  144. package/packages/core/commands/lint.md +137 -0
  145. package/packages/core/commands/migrate.md +146 -0
  146. package/packages/core/commands/new-migration.md +182 -0
  147. package/packages/core/commands/pair.md +209 -0
  148. package/packages/core/commands/review.md +195 -0
  149. package/packages/core/commands/security-scan.md +142 -0
  150. package/packages/core/commands/superkit-evolve.md +231 -0
  151. package/packages/core/commands/superkit-init.md +274 -0
  152. package/packages/core/commands/test.md +108 -0
  153. package/packages/core/commands/workflow.md +150 -0
  154. package/packages/core/docs/guide/01-getting-started.md +41 -0
  155. package/packages/core/docs-templates/README.md +33 -0
  156. package/packages/core/docs-templates/adr-template.md +62 -0
  157. package/packages/core/docs-templates/architecture/api-contracts.md +26 -0
  158. package/packages/core/docs-templates/architecture/api-reference.md +48 -0
  159. package/packages/core/docs-templates/architecture/auth-and-sessions.md +38 -0
  160. package/packages/core/docs-templates/architecture/backend-layers.md +42 -0
  161. package/packages/core/docs-templates/architecture/data-flow.md +26 -0
  162. package/packages/core/docs-templates/architecture/database-schema.md +51 -0
  163. package/packages/core/docs-templates/architecture/deployment.md +41 -0
  164. package/packages/core/docs-templates/architecture/frontend-state.md +46 -0
  165. package/packages/core/helpers/statusline.cjs +370 -0
  166. package/packages/core/hooks/CHAIN-SEMANTICS.md +84 -0
  167. package/packages/core/hooks/audit-settings-source.sh +98 -0
  168. package/packages/core/hooks/audit-trail.sh +120 -0
  169. package/packages/core/hooks/block-dangerous-git.sh +189 -0
  170. package/packages/core/hooks/bundle-import-check.sh +64 -0
  171. package/packages/core/hooks/compact-state-inject.sh +84 -0
  172. package/packages/core/hooks/config-protection.sh +68 -0
  173. package/packages/core/hooks/console-log-warning.sh +28 -0
  174. package/packages/core/hooks/context-monitor.sh +35 -0
  175. package/packages/core/hooks/dev-edit-counter.sh +59 -0
  176. package/packages/core/hooks/dev-marker-set.sh +55 -0
  177. package/packages/core/hooks/dev-required-on-commit.sh +426 -0
  178. package/packages/core/hooks/doc-check-on-commit.sh +396 -0
  179. package/packages/core/hooks/edit-streak-check.sh +63 -0
  180. package/packages/core/hooks/evolve-check.sh +78 -0
  181. package/packages/core/hooks/gateguard-pre-edit.sh +154 -0
  182. package/packages/core/hooks/gateguard-record-facts.sh +37 -0
  183. package/packages/core/hooks/intake-classifier.py +449 -0
  184. package/packages/core/hooks/lib/profile.sh +141 -0
  185. package/packages/core/hooks/loop-guard.sh +75 -0
  186. package/packages/core/hooks/migration-safety.sh +56 -0
  187. package/packages/core/hooks/plan-completion-gate.sh +61 -0
  188. package/packages/core/hooks/pre-compact-save.sh +89 -0
  189. package/packages/core/hooks/security-patterns.sh +119 -0
  190. package/packages/core/hooks/session-context-restore.sh +76 -0
  191. package/packages/core/hooks/subagent-stop-validate.sh +73 -0
  192. package/packages/core/hooks/superkit-counts-verify.sh +346 -0
  193. package/packages/core/hooks/superkit-update.sh +367 -0
  194. package/packages/core/hooks/tests/README.md +42 -0
  195. package/packages/core/hooks/tests/audit-trail-chain_test.sh +62 -0
  196. package/packages/core/hooks/tests/block-dangerous-git_test.sh +144 -0
  197. package/packages/core/hooks/tests/chain-semantics/h1.sh +11 -0
  198. package/packages/core/hooks/tests/chain-semantics/h2.sh +9 -0
  199. package/packages/core/hooks/tests/chain-semantics/h3.sh +11 -0
  200. package/packages/core/hooks/tests/chain-semantics/run-experiment.sh +65 -0
  201. package/packages/core/hooks/tests/chain-semantics/settings-experiment.json +15 -0
  202. package/packages/core/hooks/tests/counts-verify_test.sh +118 -0
  203. package/packages/core/hooks/tests/dev-required-on-commit_test.sh +207 -0
  204. package/packages/core/hooks/tests/dev-required-wip-on-main_test.sh +20 -0
  205. package/packages/core/hooks/tests/doc-check-on-commit_test.sh +122 -0
  206. package/packages/core/hooks/tests/edit-streak-check_test.sh +106 -0
  207. package/packages/core/hooks/tests/internal-manifest_test.sh +130 -0
  208. package/packages/core/hooks/tests/json-path_test.sh +108 -0
  209. package/packages/core/hooks/tests/mirror-invariants_test.sh +139 -0
  210. package/packages/core/hooks/tests/nudge-throttle_test.sh +95 -0
  211. package/packages/core/hooks/tests/profile-helper_test.sh +21 -0
  212. package/packages/core/hooks/tests/run-all.sh +47 -0
  213. package/packages/core/hooks/tests/session-key-helper_test.sh +17 -0
  214. package/packages/core/hooks/tests/superkit-update_test.sh +311 -0
  215. package/packages/core/hooks/tests/warn-visibility_test.sh +59 -0
  216. package/packages/core/hooks/user-intent-detect.sh +44 -0
  217. package/packages/core/hooks/verify-hooks.sh +69 -0
  218. package/packages/core/rules/auto-commands.md +124 -0
  219. package/packages/core/rules/coding-style.md +68 -0
  220. package/packages/core/rules/dev-workflow.md +77 -0
  221. package/packages/core/rules/documentation.md +106 -0
  222. package/packages/core/rules/frontend-aesthetics.md +53 -0
  223. package/packages/core/rules/git-workflow.md +14 -0
  224. package/packages/core/rules/security.md +29 -0
  225. package/packages/core/rules/superkit-integrity.md +114 -0
  226. package/packages/core/settings.json +229 -0
  227. package/packages/core/skills/drizzle-orm-expert/SKILL.md +260 -0
  228. package/packages/core/skills/nextjs-supabase-auth/SKILL.md +259 -0
  229. package/packages/core/skills/postgresql-optimization/SKILL.md +150 -0
  230. package/packages/core/skills/project-architecture/SKILL.md +31 -0
  231. package/packages/core/skills/project-scanner/SKILL.md +132 -0
  232. package/packages/core/skills/redis-patterns/SKILL.md +261 -0
  233. package/packages/core/skills/ru-text/SKILL.md +156 -0
  234. package/packages/core/skills/telegram-bot-builder/SKILL.md +145 -0
  235. package/packages/core/skills/writing-agents/SKILL.md +220 -0
  236. package/packages/core/skills/writing-commands/SKILL.md +176 -0
  237. package/packages/core/skills/writing-hooks/SKILL.md +335 -0
  238. package/packages/extras/bot-reviewer.md +279 -0
  239. package/packages/extras/design-system-reviewer.md +234 -0
  240. package/packages/extras/red-blue-auditor/README.md +117 -0
  241. package/packages/extras/red-blue-auditor/agent.md +128 -0
  242. package/packages/extras/red-blue-auditor/patterns/agent-config.txt +4 -0
  243. package/packages/extras/red-blue-auditor/patterns/hook-injection.txt +8 -0
  244. package/packages/extras/red-blue-auditor/patterns/mcp-risk.txt +5 -0
  245. package/packages/extras/red-blue-auditor/patterns/permission-abuse.txt +6 -0
  246. package/packages/extras/red-blue-auditor/patterns/secrets.txt +17 -0
  247. package/packages/extras/red-blue-auditor/scan.sh +88 -0
  248. package/packages/extras/skillsmp-search/SKILL.md +134 -0
  249. package/packages/frontend-3d/README.md +62 -0
  250. package/packages/frontend-3d/agents/frontend-perf-reviewer.md +164 -0
  251. package/packages/frontend-3d/agents/presentation-reviewer.md +146 -0
  252. package/packages/frontend-3d/agents/r3f-scene-reviewer.md +128 -0
  253. package/packages/frontend-3d/agents/ui-design-reviewer.md +169 -0
  254. package/packages/frontend-3d/commands/capture-screen.md +166 -0
  255. package/packages/frontend-3d/hooks/bundle-size-warn.sh +93 -0
  256. package/packages/frontend-3d/hooks/gsap-pattern-check.sh +74 -0
  257. package/packages/frontend-3d/hooks/r3f-color-check.sh +76 -0
  258. package/packages/frontend-3d/hooks/tailwind-version-guard.sh +98 -0
  259. package/packages/frontend-3d/rules/frontend-aesthetics-3d.md +81 -0
  260. package/packages/frontend-3d/rules/gsap-conventions.md +129 -0
  261. package/packages/frontend-3d/rules/threejs-conventions.md +116 -0
  262. package/packages/frontend-3d/skills/gltf-debugging/SKILL.md +145 -0
  263. package/packages/frontend-3d/skills/html-to-3d-texture/SKILL.md +183 -0
  264. package/packages/frontend-3d/skills/output-enforcement/SKILL.md +79 -0
  265. package/packages/frontend-3d/skills/product-3d-lighting/SKILL.md +166 -0
  266. package/packages/frontend-3d/skills/r3f-scroll-driven-3d/SKILL.md +209 -0
  267. package/packages/frontend-3d/skills/threejs-color-management/SKILL.md +111 -0
  268. package/packages/frontend-ui/NOTICE.md +99 -0
  269. package/packages/frontend-ui/README.md +59 -0
  270. package/packages/frontend-ui/agents/ui-color-reviewer.md +174 -0
  271. package/packages/frontend-ui/agents/ui-design-critic.md +198 -0
  272. package/packages/frontend-ui/agents/ui-interaction-reviewer.md +259 -0
  273. package/packages/frontend-ui/agents/ui-motion-reviewer.md +266 -0
  274. package/packages/frontend-ui/agents/ui-reviewer.md +251 -0
  275. package/packages/frontend-ui/agents/ui-typography-reviewer.md +222 -0
  276. package/packages/frontend-ui/hooks/tests/ui-animation-easing-check_test.sh +78 -0
  277. package/packages/frontend-ui/hooks/tests/ui-banned-fonts-check_test.sh +77 -0
  278. package/packages/frontend-ui/hooks/tests/ui-color-check_test.sh +75 -0
  279. package/packages/frontend-ui/hooks/ui-animation-easing-check.sh +86 -0
  280. package/packages/frontend-ui/hooks/ui-banned-fonts-check.sh +90 -0
  281. package/packages/frontend-ui/hooks/ui-color-check.sh +102 -0
  282. package/packages/frontend-ui/rules/color-and-contrast.md +230 -0
  283. package/packages/frontend-ui/rules/frontend-design-aesthetics.md +124 -0
  284. package/packages/frontend-ui/rules/interaction-polish.md +335 -0
  285. package/packages/frontend-ui/rules/motion-and-animation.md +283 -0
  286. package/packages/frontend-ui/rules/spatial-and-layout.md +212 -0
  287. package/packages/frontend-ui/rules/typography-guidelines.md +185 -0
  288. package/packages/frontend-ui/rules/ui-anti-patterns.md +309 -0
  289. package/packages/frontend-ui/settings.json +24 -0
  290. package/packages/frontend-ui/skills/impeccable-craft/SKILL.md +187 -0
  291. package/packages/gan/README.md +232 -0
  292. package/packages/gan/agents/gan-evaluator.md +214 -0
  293. package/packages/gan/agents/gan-generator.md +171 -0
  294. package/packages/gan/agents/gan-planner.md +206 -0
  295. package/packages/gan/rubrics/functionality.md +66 -0
  296. package/packages/gan/rubrics/ui-quality.md +77 -0
  297. package/packages/gan/skills/gan-evaluator/SKILL.md +91 -0
  298. package/packages/gan/skills/gan-generator/SKILL.md +72 -0
  299. package/packages/gan/skills/gan-planner/SKILL.md +93 -0
  300. package/packages/stack-agents/go/go-concurrency-reviewer.md +210 -0
  301. package/packages/stack-agents/go/go-error-reviewer.md +187 -0
  302. package/packages/stack-agents/go/go-modernizer.md +160 -0
  303. package/packages/stack-agents/go/go-observability-reviewer.md +185 -0
  304. package/packages/stack-agents/go/go-performance-reviewer.md +160 -0
  305. package/packages/stack-agents/go/go-reviewer.md +277 -0
  306. package/packages/stack-agents/go/references/benchmark-methodology.md +280 -0
  307. package/packages/stack-agents/go/references/channel-patterns.md +384 -0
  308. package/packages/stack-agents/go/references/cli-cobra-viper.md +190 -0
  309. package/packages/stack-agents/go/references/code-style.md +262 -0
  310. package/packages/stack-agents/go/references/context-propagation.md +317 -0
  311. package/packages/stack-agents/go/references/data-structures.md +315 -0
  312. package/packages/stack-agents/go/references/database-patterns.md +334 -0
  313. package/packages/stack-agents/go/references/design-patterns.md +411 -0
  314. package/packages/stack-agents/go/references/di-frameworks.md +146 -0
  315. package/packages/stack-agents/go/references/error-creation.md +251 -0
  316. package/packages/stack-agents/go/references/error-inspection.md +348 -0
  317. package/packages/stack-agents/go/references/error-wrapping.md +230 -0
  318. package/packages/stack-agents/go/references/gopls-driving.md +62 -0
  319. package/packages/stack-agents/go/references/goroutine-lifecycle.md +351 -0
  320. package/packages/stack-agents/go/references/graphql-patterns.md +221 -0
  321. package/packages/stack-agents/go/references/grpc-patterns.md +373 -0
  322. package/packages/stack-agents/go/references/modernize-guide.md +522 -0
  323. package/packages/stack-agents/go/references/module-management.md +191 -0
  324. package/packages/stack-agents/go/references/naming-conventions.md +176 -0
  325. package/packages/stack-agents/go/references/observability-pipeline.md +352 -0
  326. package/packages/stack-agents/go/references/performance-profiling.md +250 -0
  327. package/packages/stack-agents/go/references/refactoring-mechanics.md +127 -0
  328. package/packages/stack-agents/go/references/rest-openapi-patterns.md +160 -0
  329. package/packages/stack-agents/go/references/samber-do.md +201 -0
  330. package/packages/stack-agents/go/references/samber-libraries.md +363 -0
  331. package/packages/stack-agents/go/references/samber-lo.md +260 -0
  332. package/packages/stack-agents/go/references/samber-oops.md +200 -0
  333. package/packages/stack-agents/go/references/security-checklist.md +441 -0
  334. package/packages/stack-agents/go/references/standard-stdlib-now.md +181 -0
  335. package/packages/stack-agents/go/references/stay-updated.md +147 -0
  336. package/packages/stack-agents/go/references/structs-interfaces.md +312 -0
  337. package/packages/stack-agents/go/references/sync-primitives.md +395 -0
  338. package/packages/stack-agents/go/references/testing-patterns.md +483 -0
  339. package/packages/stack-agents/go/references/troubleshooting.md +98 -0
  340. package/packages/stack-agents/python/py-reviewer.md +194 -0
  341. package/packages/stack-agents/rust/rs-reviewer.md +188 -0
  342. package/packages/stack-agents/typescript/ts-reviewer.md +135 -0
  343. package/packages/stack-hooks/go/go-context-check-on-edit.sh +56 -0
  344. package/packages/stack-hooks/go/go-error-check-on-edit.sh +54 -0
  345. package/packages/stack-hooks/go/go-format-on-edit.sh +32 -0
  346. package/packages/stack-hooks/go/go-safety-check-on-edit.sh +54 -0
  347. package/packages/stack-hooks/go/go-vet-on-edit.sh +61 -0
  348. package/packages/stack-hooks/go/golangci-lint-on-edit.sh +54 -0
  349. package/packages/stack-hooks/python/ruff-on-edit.sh +67 -0
  350. package/packages/stack-hooks/rust/cargo-check-on-edit.sh +64 -0
  351. package/packages/stack-hooks/typescript/typecheck-on-edit.sh +76 -0
  352. package/packages/stack-rules/go/go-conventions.md +44 -0
  353. package/packages/stack-rules/go/go-safety.md +35 -0
@@ -0,0 +1,396 @@
1
+ #!/bin/bash
2
+ # doc-check-on-commit.sh — BLOCK commits when code changes lack doc updates
3
+ # NOTE: bash case doesn't support ** globs — use in_dir() helper for any-depth matching
4
+
5
+ # Helper: check if file is under a directory at ANY depth (no level limit)
6
+ # Usage: in_dir "$file" "dirname"
7
+
8
+ # Unified profile + disable check
9
+ SUPERKIT_PROFILE_LIB="$(dirname "$0")/lib/profile.sh"
10
+ [ -f "$SUPERKIT_PROFILE_LIB" ] || SUPERKIT_PROFILE_LIB="$(dirname "$0")/../lib/profile.sh"
11
+ # shellcheck source=/dev/null
12
+ [ -f "$SUPERKIT_PROFILE_LIB" ] && source "$SUPERKIT_PROFILE_LIB" && should_skip_hook "$(basename "$0" .sh)" && exit 0
13
+
14
+ in_dir() { echo "$1" | grep -q "/$2/"; }
15
+ # Triggers on: PreToolUse(Bash) when command contains "git commit"
16
+ # Profile: standard, strict
17
+ #
18
+ # Smart file-to-doc mapping: analyzes staged files and determines exactly
19
+ # which documentation files must also be staged.
20
+ #
21
+ # EXIT CODES:
22
+ # 0 = allow (docs present or no code changes requiring docs)
23
+ # 2 = BLOCK (code changed, required docs missing)
24
+
25
+ PROFILE="${CLAUDE_HOOK_PROFILE:-standard}"
26
+ if [ "$PROFILE" = "fast" ]; then
27
+ exit 0
28
+ fi
29
+
30
+ # Read the tool input — Claude Code PreToolUse payload is:
31
+ # { "hook_event_name": "PreToolUse", "tool_name": "Bash",
32
+ # "tool_input": { "command": "…", "description": "…" } }
33
+ # Historical bug: older versions read `.command` which is always null on
34
+ # Bash PreToolUse, so the hook silently exited 0 and NEVER blocked any
35
+ # commit. Accept both shapes for defence-in-depth.
36
+ INPUT=$(cat)
37
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // .command // empty' 2>/dev/null)
38
+
39
+ # Only trigger on git commit commands.
40
+ # Also match `git -C <path> commit` — without this, the hook would run
41
+ # `git diff --cached` in the wrong directory and see an empty STAGED,
42
+ # silently exiting 0 while the real commit lands elsewhere.
43
+ if ! echo "$COMMAND" | grep -qE 'git(\s+-[cC]\s+\S+)*\s+commit'; then
44
+ exit 0
45
+ fi
46
+
47
+ # Extract `-C <path>` target if present so we check staged files in the
48
+ # actual target repo, not the shell cwd.
49
+ GIT_TARGET_DIR=$(echo "$COMMAND" | sed -nE 's/.*git[[:space:]]+(-[cC][[:space:]]+([^[:space:]]+)).*/\2/p' | head -n1)
50
+ if [ -n "$GIT_TARGET_DIR" ] && [ -d "$GIT_TARGET_DIR" ]; then
51
+ GIT_CMD_PREFIX="git -C $GIT_TARGET_DIR"
52
+ else
53
+ GIT_CMD_PREFIX="git"
54
+ fi
55
+
56
+ # Get staged files (from the correct repo)
57
+ STAGED=$($GIT_CMD_PREFIX diff --cached --name-only 2>/dev/null)
58
+ if [ -z "$STAGED" ]; then
59
+ # Match `-a` / `--all` only as standalone flags — not as part of longer
60
+ # option names like `--allow-empty` or `--author`.
61
+ if echo "$COMMAND" | grep -qE '(^|[[:space:]])(-a|--all)([[:space:]]|$)'; then
62
+ STAGED=$($GIT_CMD_PREFIX diff --name-only 2>/dev/null)
63
+ fi
64
+ fi
65
+
66
+ if [ -z "$STAGED" ]; then
67
+ exit 0
68
+ fi
69
+
70
+ # ── Classify staged files ─────────────────────────────────────────────
71
+
72
+ HAS_CODE=false
73
+ ONLY_EXEMPT=true # tests, configs, .claude/ files, docs
74
+
75
+ # Track which doc categories are REQUIRED based on code changes
76
+ NEED_DB_SCHEMA=false
77
+ NEED_API_REF=false
78
+ NEED_FRONTEND_DOCS=false
79
+ NEED_BOT_DOCS=false
80
+ NEED_MODERATION_DOCS=false
81
+ NEED_AUTH_DOCS=false
82
+ NEED_TREE_DOCS=false
83
+ NEED_CLAUDE_MD=false
84
+ NEED_PHOTO_DOCS=false
85
+ NEED_FEED_DOCS=false
86
+ NEED_ENTITLEMENTS_DOCS=false
87
+ NEED_NOTIFICATION_DOCS=false
88
+ NEED_BACKEND_LAYERS=false
89
+ NEED_README=false
90
+
91
+ # Track which docs ARE staged
92
+ HAS_DB_SCHEMA=false
93
+ HAS_API_REF=false
94
+ HAS_OPENAPI=false
95
+ HAS_FRONTEND_STATE=false
96
+ HAS_FRONTEND_ONBOARDING=false
97
+ HAS_BOT_MOD=false
98
+ HAS_BOT_SUPPORT=false
99
+ HAS_MODERATION=false
100
+ HAS_AUTH=false
101
+ HAS_TREE_DOCS=false
102
+ HAS_CLAUDE_MD=false
103
+ HAS_PHOTO_DOCS=false
104
+ HAS_FEED_DOCS=false
105
+ HAS_ENTITLEMENTS_DOCS=false
106
+ HAS_NOTIFICATION_DOCS=false
107
+ HAS_BACKEND_LAYERS=false
108
+ HAS_README=false
109
+
110
+ # Advisory warnings (non-blocking)
111
+ ADVISORIES=""
112
+
113
+ # Check for newly added files
114
+ NEW_FILES=$(git diff --cached --diff-filter=A --name-only 2>/dev/null)
115
+ if [ -n "$NEW_FILES" ]; then
116
+ # New files that aren't tests/configs/docs require tree updates
117
+ NON_TRIVIAL_NEW=$(echo "$NEW_FILES" | grep -E '\.(go|ts|tsx|sql|py|rs|js|jsx)$' | grep -v '_test\.\|\.test\.\|\.spec\.' || true)
118
+ if [ -n "$NON_TRIVIAL_NEW" ]; then
119
+ NEED_TREE_DOCS=true
120
+ fi
121
+ fi
122
+
123
+ while IFS= read -r file; do
124
+ # ── Non-architectural markdown — CANNOT satisfy architecture-doc requirements ──
125
+ # These files are meta-work (plans, memory, changelogs) and must NEVER be
126
+ # counted as evidence that architecture docs were updated. We continue early
127
+ # WITHOUT setting any HAS_* flag. Must be checked BEFORE the generic
128
+ # `docs/*|*.md` fallthrough below or the HAS_* pattern-name matches.
129
+ case "$file" in
130
+ docs/superpowers/plans/*|*/docs/superpowers/plans/*)
131
+ continue ;;
132
+ docs/superpowers/specs/*|*/docs/superpowers/specs/*)
133
+ continue ;;
134
+ docs/superpowers/research/*|*/docs/superpowers/research/*)
135
+ continue ;;
136
+ memory/*|*/memory/*)
137
+ continue ;;
138
+ CHANGELOG*|*/CHANGELOG*|*/HISTORY.md|HISTORY.md)
139
+ continue ;;
140
+ docs/active-plans-archive.md|*/docs/active-plans-archive.md)
141
+ continue ;;
142
+ esac
143
+
144
+ # ── Exempt file types (don't require docs) ──
145
+ case "$file" in
146
+ *_test.go|*test_*|*.test.ts|*.test.tsx|*.spec.ts|*.spec.tsx)
147
+ continue ;;
148
+ # Dependency files — check if NEW deps were added (not just version bumps)
149
+ go.mod|*/go.mod)
150
+ if git diff --cached -- "$file" 2>/dev/null | grep -qE '^\+\t[a-z].*v[0-9]' ; then
151
+ NEED_README=true
152
+ NEED_CLAUDE_MD=true
153
+ fi
154
+ continue ;;
155
+ package.json|*/package.json)
156
+ if git diff --cached -- "$file" 2>/dev/null | grep -qE '^\+.*"(dependencies|devDependencies)"' || \
157
+ git diff --cached -- "$file" 2>/dev/null | grep -qE '^\+\s+"[a-z@].*":' ; then
158
+ NEED_README=true
159
+ fi
160
+ continue ;;
161
+ # Config examples — README should document config changes
162
+ *config.example*|*config.sample*|*.env.example)
163
+ NEED_README=true
164
+ continue ;;
165
+ *.env*|*.json|*.yaml|*.yml|*.toml|*.cfg|*.ini)
166
+ # Exception: openapi.yaml counts as a doc
167
+ case "$file" in
168
+ *openapi*|*swagger*) HAS_OPENAPI=true ;;
169
+ esac
170
+ continue ;;
171
+ .claude/agents/*|.claude/rules/*|.claude/commands/*|.claude/hooks/*|.claude/skills/*|.claude/scripts/*)
172
+ ADVISORIES="${ADVISORIES}\n [advisory] .claude/ config changed — consider syncing across repos if applicable"
173
+ continue ;;
174
+ # Detect staged doc files (generic glob patterns)
175
+ *database-schema*|*database_schema*) HAS_DB_SCHEMA=true; continue ;;
176
+ *api-reference*|*api_reference*|*backend-api*) HAS_API_REF=true; continue ;;
177
+ *frontend-state*|*frontend_state*) HAS_FRONTEND_STATE=true; continue ;;
178
+ *frontend-onboarding*|*frontend_onboarding*) HAS_FRONTEND_ONBOARDING=true; continue ;;
179
+ *bot-moderator*|*bot_moderator*) HAS_BOT_MOD=true; continue ;;
180
+ *bot-support*|*bot_support*) HAS_BOT_SUPPORT=true; continue ;;
181
+ *moderation-pipeline*|*moderation_pipeline*) HAS_MODERATION=true; continue ;;
182
+ *auth-and-sessions*|*auth_and_sessions*|*auth-sessions*) HAS_AUTH=true; continue ;;
183
+ *photo-pipeline*|*photo_pipeline*) HAS_PHOTO_DOCS=true; continue ;;
184
+ *feed-and-antiabuse*|*feed_antiabuse*|*feed-antiabuse*) HAS_FEED_DOCS=true; continue ;;
185
+ *entitlements-and-store*|*entitlements_store*|*entitlements-store*) HAS_ENTITLEMENTS_DOCS=true; continue ;;
186
+ *notification-system*|*notification_system*) HAS_NOTIFICATION_DOCS=true; continue ;;
187
+ *backend-layers*|*backend_layers*|*backend-arch*) HAS_BACKEND_LAYERS=true; continue ;;
188
+ docs/trees/*) HAS_TREE_DOCS=true; continue ;;
189
+ CLAUDE.md) HAS_CLAUDE_MD=true; continue ;;
190
+ README*|*/README*) HAS_README=true; continue ;;
191
+ docs/*|*.md|*openapi*|*swagger*) continue ;;
192
+ esac
193
+
194
+ # ── Code files — determine which docs are required ──
195
+ # Step 1: classify by extension (is it code at all?)
196
+ IS_CODE=false
197
+ case "$file" in
198
+ *.go|*.ts|*.tsx|*.js|*.jsx|*.py|*.rs|*.sql) IS_CODE=true ;;
199
+ esac
200
+
201
+ if [ "$IS_CODE" = false ]; then
202
+ continue
203
+ fi
204
+
205
+ HAS_CODE=true
206
+ ONLY_EXEMPT=false
207
+
208
+ # Step 2: determine doc requirements using grep-based in_dir() for any-depth matching
209
+ case "$file" in
210
+ # Migrations → database-schema docs + CLAUDE.md
211
+ */migrations/*.sql|*/migrate/*.sql|*/db/migrate/*)
212
+ NEED_DB_SCHEMA=true
213
+ NEED_CLAUDE_MD=true
214
+ ;;
215
+ *.sql) ;; # other SQL — no specific doc requirement
216
+ esac
217
+
218
+ case "$file" in
219
+ # HTTP handlers → API reference
220
+ */handlers/*.go|*/routes*.go|*/router*.go)
221
+ NEED_API_REF=true
222
+ ;;
223
+ esac
224
+
225
+ # Service-to-doc mappings (grep handles any nesting depth)
226
+ case "$file" in *.go)
227
+ if in_dir "$file" "services/moderation" || in_dir "$file" "service/moderation"; then
228
+ NEED_MODERATION_DOCS=true
229
+ elif in_dir "$file" "services/auth" || in_dir "$file" "service/auth"; then
230
+ NEED_AUTH_DOCS=true
231
+ elif in_dir "$file" "services/media" || in_dir "$file" "service/media"; then
232
+ NEED_PHOTO_DOCS=true
233
+ elif in_dir "$file" "services/feed" || in_dir "$file" "services/antiabuse" || in_dir "$file" "service/feed"; then
234
+ NEED_FEED_DOCS=true
235
+ elif in_dir "$file" "services/entitlements" || in_dir "$file" "services/store" || in_dir "$file" "services/payments"; then
236
+ NEED_ENTITLEMENTS_DOCS=true
237
+ elif in_dir "$file" "services/notifications" || in_dir "$file" "services/notification"; then
238
+ NEED_NOTIFICATION_DOCS=true
239
+ fi
240
+
241
+ # App wiring / middleware / background jobs / entry points → backend-layers docs.
242
+ # Tree docs only required if the file is NEW (added) — modifying existing
243
+ # middleware.go does not change the tree, so don't demand a tree update.
244
+ if in_dir "$file" "app" || echo "$file" | grep -q '/middleware' || \
245
+ in_dir "$file" "jobs" || in_dir "$file" "workers" || \
246
+ in_dir "$file" "cmd"; then
247
+ NEED_BACKEND_LAYERS=true
248
+ if echo "$NEW_FILES" | grep -qxF "$file"; then
249
+ NEED_TREE_DOCS=true
250
+ fi
251
+ fi
252
+
253
+ # New storage backend under */repo/** → tree docs (only for NEW files)
254
+ if in_dir "$file" "repo"; then
255
+ if echo "$NEW_FILES" | grep -qxF "$file"; then
256
+ NEED_TREE_DOCS=true
257
+ fi
258
+ fi
259
+
260
+ # Telegram bots → bot docs
261
+ if in_dir "$file" "bot_moderator" || in_dir "$file" "bot_support" || \
262
+ in_dir "$file" "tgbots" || in_dir "$file" "bots"; then
263
+ NEED_BOT_DOCS=true
264
+ fi
265
+ ;;
266
+ esac
267
+
268
+ # Frontend → frontend docs (any .ts/.tsx under src/ or onboarding paths)
269
+ case "$file" in *.ts|*.tsx)
270
+ if in_dir "$file" "src" || in_dir "$file" "pages/onboarding" || \
271
+ in_dir "$file" "app/flow" || echo "$file" | grep -q '/app/App\.tsx$'; then
272
+ NEED_FRONTEND_DOCS=true
273
+ fi
274
+ ;;
275
+ esac
276
+ done <<< "$STAGED"
277
+
278
+ # ── Skip if only exempt files (tests, configs, docs, .claude/) ─────
279
+ if [ "$ONLY_EXEMPT" = true ] || [ "$HAS_CODE" = false ]; then
280
+ # Still print advisories if any
281
+ if [ -n "$ADVISORIES" ]; then
282
+ echo -e "$ADVISORIES"
283
+ fi
284
+ exit 0
285
+ fi
286
+
287
+ # ── Check each required doc category ──────────────────────────────────
288
+
289
+ MISSING=""
290
+
291
+ # Task 14: plan completion gate.
292
+ # plan-completion-gate.sh places a marker when a superpowers plan skill
293
+ # finishes. The next commit touching code MUST either stage
294
+ # docs/architecture/* OR carry a [plan-docs-deferred: <id>: <reason>]
295
+ # override. HAS_CODE is already true (we exited on line 272 otherwise).
296
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
297
+ SESSION_KEY="${SESSION_ID:-${CLAUDE_HOOK_PID:-$PPID}}"
298
+ PLAN_MARKER="${TMPDIR:-/tmp}/claude-plan-docs-pending-${SESSION_KEY}"
299
+ if [ -f "$PLAN_MARKER" ]; then
300
+ HAS_ARCH_DOC=false
301
+ while IFS= read -r f; do
302
+ case "$f" in
303
+ docs/architecture/*|*/docs/architecture/*) HAS_ARCH_DOC=true ;;
304
+ esac
305
+ done <<< "$STAGED"
306
+ HAS_DEFERRAL=$(echo "$COMMAND" | grep -oiE '\[plan-docs-deferred:[^]]{15,}\]' | head -1)
307
+
308
+ if [ "$HAS_ARCH_DOC" = false ] && [ -z "$HAS_DEFERRAL" ]; then
309
+ MISSING="${MISSING}\n - Plan completion marker set but no docs/architecture/* file staged. Either stage an updated arch doc OR add [plan-docs-deferred: <plan-id>: <reason ≥15 chars>] to the commit message."
310
+ else
311
+ # marker satisfied — clear it so subsequent commits don't re-fire
312
+ rm -f "$PLAN_MARKER"
313
+ fi
314
+ fi
315
+
316
+ if [ "$NEED_DB_SCHEMA" = true ] && [ "$HAS_DB_SCHEMA" = false ]; then
317
+ MISSING="${MISSING}\n - Migration staged but database schema docs NOT updated"
318
+ fi
319
+
320
+ if [ "$NEED_CLAUDE_MD" = true ] && [ "$HAS_CLAUDE_MD" = false ]; then
321
+ MISSING="${MISSING}\n - Migration staged but CLAUDE.md NOT updated (migration counter)"
322
+ fi
323
+
324
+ if [ "$NEED_API_REF" = true ] && [ "$HAS_API_REF" = false ] && [ "$HAS_OPENAPI" = false ]; then
325
+ MISSING="${MISSING}\n - Handler/route changed but neither API reference docs NOR OpenAPI spec updated"
326
+ fi
327
+
328
+ if [ "$NEED_FRONTEND_DOCS" = true ] && [ "$HAS_FRONTEND_STATE" = false ] && [ "$HAS_FRONTEND_ONBOARDING" = false ] && [ "$HAS_CLAUDE_MD" = false ]; then
329
+ MISSING="${MISSING}\n - Frontend code changed but none of: frontend-state docs, frontend-onboarding docs, CLAUDE.md updated"
330
+ fi
331
+
332
+ if [ "$NEED_BOT_DOCS" = true ] && [ "$HAS_BOT_MOD" = false ] && [ "$HAS_BOT_SUPPORT" = false ] && [ "$HAS_CLAUDE_MD" = false ]; then
333
+ MISSING="${MISSING}\n - Bot code changed but none of: bot-moderator docs, bot-support docs, CLAUDE.md updated"
334
+ fi
335
+
336
+ if [ "$NEED_MODERATION_DOCS" = true ] && [ "$HAS_MODERATION" = false ]; then
337
+ MISSING="${MISSING}\n - Moderation service changed but moderation-pipeline docs NOT updated"
338
+ fi
339
+
340
+ if [ "$NEED_AUTH_DOCS" = true ] && [ "$HAS_AUTH" = false ]; then
341
+ MISSING="${MISSING}\n - Auth service changed but auth-and-sessions docs NOT updated"
342
+ fi
343
+
344
+ if [ "$NEED_PHOTO_DOCS" = true ] && [ "$HAS_PHOTO_DOCS" = false ]; then
345
+ MISSING="${MISSING}\n - Media service changed but photo-pipeline docs NOT updated"
346
+ fi
347
+
348
+ if [ "$NEED_FEED_DOCS" = true ] && [ "$HAS_FEED_DOCS" = false ]; then
349
+ MISSING="${MISSING}\n - Feed/antiabuse service changed but feed-and-antiabuse docs NOT updated"
350
+ fi
351
+
352
+ if [ "$NEED_ENTITLEMENTS_DOCS" = true ] && [ "$HAS_ENTITLEMENTS_DOCS" = false ]; then
353
+ MISSING="${MISSING}\n - Entitlements/store/payments service changed but entitlements-and-store docs NOT updated"
354
+ fi
355
+
356
+ if [ "$NEED_NOTIFICATION_DOCS" = true ] && [ "$HAS_NOTIFICATION_DOCS" = false ]; then
357
+ MISSING="${MISSING}\n - Notifications service changed but notification-system docs NOT updated"
358
+ fi
359
+
360
+ if [ "$NEED_BACKEND_LAYERS" = true ] && [ "$HAS_BACKEND_LAYERS" = false ]; then
361
+ MISSING="${MISSING}\n - App wiring/routes/middleware changed but backend-layers docs NOT updated"
362
+ fi
363
+
364
+ if [ "$NEED_TREE_DOCS" = true ] && [ "$HAS_TREE_DOCS" = false ]; then
365
+ MISSING="${MISSING}\n - New files added but docs/trees/ NOT updated"
366
+ fi
367
+
368
+ if [ "$NEED_README" = true ] && [ "$HAS_README" = false ] && [ "$HAS_CLAUDE_MD" = false ]; then
369
+ MISSING="${MISSING}\n - Dependencies or config changed but no README or CLAUDE.md updated (tech stack / project structure)"
370
+ fi
371
+
372
+ # ── Output result ─────────────────────────────────────────────────────
373
+
374
+ if [ -n "$MISSING" ]; then
375
+ echo "" >&2
376
+ echo "BLOCKED: Required documentation not staged" >&2
377
+ echo "" >&2
378
+ echo -e " Missing docs:${MISSING}" >&2
379
+ echo "" >&2
380
+ echo " Fix: update the listed doc files and stage them before committing." >&2
381
+ echo " If the change is a pure refactor with NO behavior change, stage" >&2
382
+ echo " CLAUDE.md or a relevant .md file to acknowledge the check." >&2
383
+ echo "" >&2
384
+ if [ -n "$ADVISORIES" ]; then
385
+ echo -e "$ADVISORIES" >&2
386
+ echo "" >&2
387
+ fi
388
+ exit 2
389
+ fi
390
+
391
+ # Print advisories even on success (non-blocking warnings — still route to stderr so Claude Code surfaces them)
392
+ if [ -n "$ADVISORIES" ]; then
393
+ echo -e "$ADVISORIES" >&2
394
+ fi
395
+
396
+ exit 0
@@ -0,0 +1,63 @@
1
+ #!/bin/bash
2
+ # edit-streak-check.sh — detect 5+ edits without a verification run
3
+ # Triggers on: PostToolUse(Edit|Write|MultiEdit|Bash)
4
+ # Profile: standard, strict
5
+ #
6
+ # Pattern caught: Claude edits 5+ files in a row without running tests,
7
+ # linters, or any Bash command between edits — a classic "progress stall"
8
+ # signal where changes accumulate without verification.
9
+ #
10
+ # Advisory only (exit 0 with stderr warning). Reset on any Bash call.
11
+ # Opt-out: CLAUDE_DISABLE_EDIT_STREAK=1
12
+
13
+ # Unified profile + disable check
14
+ SUPERKIT_PROFILE_LIB="$(dirname "$0")/lib/profile.sh"
15
+ [ -f "$SUPERKIT_PROFILE_LIB" ] || SUPERKIT_PROFILE_LIB="$(dirname "$0")/../lib/profile.sh"
16
+ # shellcheck source=/dev/null
17
+ [ -f "$SUPERKIT_PROFILE_LIB" ] && source "$SUPERKIT_PROFILE_LIB" && should_skip_hook "$(basename "$0" .sh)" && exit 0
18
+
19
+ [ "${CLAUDE_DISABLE_EDIT_STREAK:-}" = "1" ] && exit 0
20
+
21
+ PROFILE="${CLAUDE_HOOK_PROFILE:-standard}"
22
+ if [ "$PROFILE" = "fast" ]; then
23
+ exit 0
24
+ fi
25
+
26
+ INPUT=$(cat)
27
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
28
+ [ -z "$TOOL_NAME" ] && exit 0
29
+
30
+ SESSION_KEY=$(command -v superkit_session_key >/dev/null 2>&1 && superkit_session_key || printf '%s' "${SESSION_ID:-${CLAUDE_HOOK_PID:-$PPID}}")
31
+ STREAK_FILE="${CLAUDE_EDIT_STREAK_FILE:-${TMPDIR:-/tmp}/claude-edit-streak-${SESSION_KEY}}"
32
+
33
+ case "$TOOL_NAME" in
34
+ Bash)
35
+ # Any Bash call resets the streak — it counts as verification
36
+ rm -f "$STREAK_FILE"
37
+ exit 0
38
+ ;;
39
+ Edit|Write|MultiEdit)
40
+ count=$(cat "$STREAK_FILE" 2>/dev/null || echo 0)
41
+ count=$((count + 1))
42
+ echo "$count" > "$STREAK_FILE"
43
+
44
+ if [ "$count" -ge 5 ]; then
45
+ # Per-session throttle (Opus 4.8 self-flags). Key on a stable string
46
+ # (NOT the changing $count) so the same nudge isn't repeated every edit
47
+ # within the window. CLAUDE_NUDGE_WINDOW_MIN=0 disables throttling.
48
+ EMIT=1
49
+ if command -v superkit_should_emit_advisory >/dev/null 2>&1; then
50
+ superkit_should_emit_advisory "edit-streak-check: consecutive edits without verification" || EMIT=0
51
+ fi
52
+ if [ "$EMIT" = "1" ]; then
53
+ echo "" >&2
54
+ echo "⚠️ WARNING: edit streak — $count consecutive edits without a verification run." >&2
55
+ echo " Consider running: tests, lint, build, or any Bash command." >&2
56
+ echo " Set CLAUDE_DISABLE_EDIT_STREAK=1 to silence." >&2
57
+ echo "" >&2
58
+ fi
59
+ fi
60
+ ;;
61
+ esac
62
+
63
+ exit 0
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # evolve-check.sh — advisory check for documentation drift at session start
3
+ # Triggers on: SessionStart
4
+ # Profile: standard, strict
5
+
6
+ # Unified profile + disable check
7
+ SUPERKIT_PROFILE_LIB="$(dirname "$0")/lib/profile.sh"
8
+ [ -f "$SUPERKIT_PROFILE_LIB" ] || SUPERKIT_PROFILE_LIB="$(dirname "$0")/../lib/profile.sh"
9
+ # shellcheck source=/dev/null
10
+ [ -f "$SUPERKIT_PROFILE_LIB" ] && source "$SUPERKIT_PROFILE_LIB" && should_skip_hook "$(basename "$0" .sh)" && exit 0
11
+
12
+ PROFILE="${CLAUDE_HOOK_PROFILE:-standard}"
13
+ if [ "$PROFILE" = "fast" ]; then
14
+ exit 0
15
+ fi
16
+
17
+ # Only check if superkit is installed
18
+ if [ ! -f ".claude/commands/superkit-evolve.md" ] 2>/dev/null; then
19
+ exit 0
20
+ fi
21
+
22
+ # Rate limit: check at most once per 24h
23
+ LAST_CHECK_FILE="$HOME/.claude/.superkit-evolve-last-check"
24
+ NOW=$(date +%s)
25
+ LAST=$(cat "$LAST_CHECK_FILE" 2>/dev/null || echo "0")
26
+ DIFF=$((NOW - LAST))
27
+
28
+ if [ "$DIFF" -lt 86400 ]; then
29
+ exit 0
30
+ fi
31
+
32
+ echo "$NOW" > "$LAST_CHECK_FILE"
33
+
34
+ ISSUES=()
35
+
36
+ # Check 1: Migration counter drift
37
+ if [ -f "CLAUDE.md" ]; then
38
+ ACTUAL_MIGRATIONS=$(find . -path "*/migrations/*.up.sql" 2>/dev/null | wc -l | tr -d ' ')
39
+ if [ "$ACTUAL_MIGRATIONS" -gt 0 ]; then
40
+ CLAIMED=$(grep -oE '000001\.\.[0-9]+' CLAUDE.md 2>/dev/null | grep -oE '[0-9]+$' | tr -d '0' | head -1)
41
+ if [ -n "$CLAIMED" ] && [ "$ACTUAL_MIGRATIONS" != "$CLAIMED" ]; then
42
+ ISSUES+=("Migration counter drift (CLAUDE.md: $CLAIMED, actual: $ACTUAL_MIGRATIONS)")
43
+ fi
44
+ fi
45
+ fi
46
+
47
+ # Check 2: Tree freshness (>20 new files since tree generation)
48
+ if [ -d "docs/trees" ]; then
49
+ NEWEST_TREE=$(find docs/trees -name "*.md" -newer docs/trees -print -quit 2>/dev/null)
50
+ NEW_FILES=$(find . \( -name "*.go" -o -name "*.ts" -o -name "*.py" -o -name "*.rs" \) -newer docs/trees/ 2>/dev/null | grep -v node_modules | grep -v vendor | wc -l | tr -d ' ')
51
+ if [ "$NEW_FILES" -gt 20 ]; then
52
+ ISSUES+=("$NEW_FILES new code files since last tree generation")
53
+ fi
54
+ fi
55
+
56
+ # Check 3: Missing docs for detected components
57
+ for dir in backend frontend adminpanel workers bots services; do
58
+ if [ -d "$dir" ] && [ ! -f "docs/architecture/${dir}-layers.md" ] && [ ! -f "docs/architecture/${dir}.md" ]; then
59
+ FILE_COUNT=$(find "$dir" \( -name "*.go" -o -name "*.ts" -o -name "*.py" \) 2>/dev/null | wc -l | tr -d ' ')
60
+ if [ "$FILE_COUNT" -gt 5 ]; then
61
+ ISSUES+=("$dir/ has $FILE_COUNT code files but no architecture doc")
62
+ fi
63
+ fi
64
+ done
65
+
66
+ # Report
67
+ if [ ${#ISSUES[@]} -gt 0 ]; then
68
+ echo ""
69
+ echo "⚠ superkit-evolve: detected ${#ISSUES[@]} documentation issues:"
70
+ for issue in "${ISSUES[@]}"; do
71
+ echo " · $issue"
72
+ done
73
+ echo ""
74
+ echo " Run /superkit-evolve to fix, or ignore if not needed."
75
+ echo ""
76
+ fi
77
+
78
+ exit 0