specialist-agent 2.13.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +33 -207
  3. package/dist/catalog.json +15529 -0
  4. package/dist/hw-worker.mjs +254 -0
  5. package/dist/icones/icone.ico +0 -0
  6. package/dist/icones/icone.png +0 -0
  7. package/dist/interface/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
  8. package/dist/interface/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
  9. package/dist/interface/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
  10. package/dist/interface/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
  11. package/dist/interface/assets/figtree-latin-ext-400-normal-CXAzuTZb.woff2 +0 -0
  12. package/dist/interface/assets/figtree-latin-ext-500-normal-Du0rIuHj.woff2 +0 -0
  13. package/dist/interface/assets/figtree-latin-ext-600-normal-DJlfifZj.woff2 +0 -0
  14. package/dist/interface/assets/figtree-latin-ext-700-normal-CS4sQkGV.woff2 +0 -0
  15. package/dist/interface/assets/index-BIyqZkro.css +1 -0
  16. package/dist/interface/assets/index-zAegy908.js +13 -0
  17. package/dist/interface/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  18. package/dist/interface/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  19. package/dist/interface/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  20. package/dist/interface/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  21. package/dist/interface/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  22. package/dist/interface/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  23. package/dist/interface/assets/unbounded-latin-500-normal-4slEIF53.woff2 +0 -0
  24. package/dist/interface/assets/unbounded-latin-700-normal-CaoNriVp.woff2 +0 -0
  25. package/dist/interface/assets/unbounded-latin-ext-500-normal-BTIpesyw.woff2 +0 -0
  26. package/dist/interface/assets/unbounded-latin-ext-700-normal-BLzWLLjG.woff2 +0 -0
  27. package/dist/interface/icones/apple-touch-icon.png +0 -0
  28. package/dist/interface/icones/favicon-32.png +0 -0
  29. package/dist/interface/icones/icone-192.png +0 -0
  30. package/dist/interface/icones/icone-512.png +0 -0
  31. package/dist/interface/icones/icone-mascara-512.png +0 -0
  32. package/dist/interface/index.html +19 -0
  33. package/dist/interface/manifest.webmanifest +19 -0
  34. package/dist/interface/sw.js +63 -0
  35. package/dist/specialist-agent.mjs +6919 -0
  36. package/dist/usage-worker.mjs +174 -0
  37. package/package.json +32 -57
  38. package/.claude-plugin/marketplace.json +0 -52
  39. package/.claude-plugin/plugin.json +0 -37
  40. package/.codex/INSTALL.md +0 -145
  41. package/.cursor-plugin/marketplace.json +0 -52
  42. package/.cursor-plugin/plugin.json +0 -37
  43. package/.opencode/INSTALL.md +0 -127
  44. package/.opencode/opencode.json +0 -186
  45. package/agents/analyst-lite.md +0 -48
  46. package/agents/analyst.md +0 -396
  47. package/agents/api-lite.md +0 -43
  48. package/agents/api.md +0 -427
  49. package/agents/architect-lite.md +0 -104
  50. package/agents/architect.md +0 -571
  51. package/agents/autopilot-lite.md +0 -46
  52. package/agents/autopilot.md +0 -196
  53. package/agents/cloud-lite.md +0 -75
  54. package/agents/cloud.md +0 -213
  55. package/agents/data-lite.md +0 -67
  56. package/agents/data.md +0 -306
  57. package/agents/debugger-lite.md +0 -46
  58. package/agents/debugger.md +0 -410
  59. package/agents/deps-lite.md +0 -41
  60. package/agents/deps.md +0 -363
  61. package/agents/designer-lite.md +0 -67
  62. package/agents/designer.md +0 -195
  63. package/agents/devops-lite.md +0 -67
  64. package/agents/devops.md +0 -205
  65. package/agents/docs-lite.md +0 -42
  66. package/agents/docs.md +0 -454
  67. package/agents/executor-lite.md +0 -61
  68. package/agents/executor.md +0 -695
  69. package/agents/explorer-lite.md +0 -55
  70. package/agents/explorer.md +0 -152
  71. package/agents/finance-lite.md +0 -66
  72. package/agents/finance.md +0 -255
  73. package/agents/i18n-lite.md +0 -44
  74. package/agents/i18n.md +0 -594
  75. package/agents/legal-lite.md +0 -113
  76. package/agents/legal.md +0 -302
  77. package/agents/marketing-lite.md +0 -25
  78. package/agents/marketing.md +0 -188
  79. package/agents/memory.md +0 -166
  80. package/agents/orchestrator-lite.md +0 -40
  81. package/agents/orchestrator.md +0 -512
  82. package/agents/pair-lite.md +0 -38
  83. package/agents/pair.md +0 -310
  84. package/agents/perf-lite.md +0 -42
  85. package/agents/perf.md +0 -320
  86. package/agents/planner-lite.md +0 -59
  87. package/agents/planner.md +0 -272
  88. package/agents/product-lite.md +0 -25
  89. package/agents/product.md +0 -195
  90. package/agents/refactor-lite.md +0 -42
  91. package/agents/refactor.md +0 -467
  92. package/agents/ripple-lite.md +0 -106
  93. package/agents/ripple.md +0 -166
  94. package/agents/scout-lite.md +0 -37
  95. package/agents/scout.md +0 -224
  96. package/agents/security-lite.md +0 -66
  97. package/agents/security.md +0 -252
  98. package/agents/sentry-triage-lite.md +0 -54
  99. package/agents/sentry-triage.md +0 -217
  100. package/agents/starter-lite.md +0 -80
  101. package/agents/starter.md +0 -300
  102. package/agents/support-lite.md +0 -24
  103. package/agents/support.md +0 -191
  104. package/agents/tdd-lite.md +0 -43
  105. package/agents/tdd.md +0 -329
  106. package/agents/tester-lite.md +0 -71
  107. package/agents/tester.md +0 -237
  108. package/cli/architectures.mjs +0 -713
  109. package/cli/detect-architecture.mjs +0 -752
  110. package/cli/generate-architecture.mjs +0 -1096
  111. package/cli/index.mjs +0 -1217
  112. package/cli/recommend-architecture.mjs +0 -870
  113. package/hooks/after-review.mjs +0 -130
  114. package/hooks/after-task.mjs +0 -117
  115. package/hooks/before-plan.mjs +0 -155
  116. package/hooks/before-review.mjs +0 -139
  117. package/hooks/hooks.json +0 -66
  118. package/hooks/lifecycle.json +0 -91
  119. package/hooks/native/auto-dispatch.mjs +0 -207
  120. package/hooks/native/auto-format.mjs +0 -176
  121. package/hooks/native/mcp-discovery.mjs +0 -168
  122. package/hooks/native/security-config.json +0 -38
  123. package/hooks/native/security-guard.mjs +0 -323
  124. package/hooks/native/session-context.mjs +0 -179
  125. package/hooks/native/session-end.mjs +0 -42
  126. package/hooks/native/utils.mjs +0 -62
  127. package/hooks/on-error.mjs +0 -129
  128. package/hooks/session-end.mjs +0 -185
  129. package/hooks/session-start.mjs +0 -154
  130. package/packs/angular/ARCHITECTURE.md +0 -814
  131. package/packs/angular/CLAUDE.md +0 -105
  132. package/packs/angular/agents/builder.md +0 -113
  133. package/packs/angular/agents/doctor.md +0 -187
  134. package/packs/angular/agents/migrator.md +0 -101
  135. package/packs/angular/agents/reviewer.md +0 -252
  136. package/packs/angular/agents-lite/builder.md +0 -65
  137. package/packs/angular/agents-lite/doctor.md +0 -64
  138. package/packs/angular/agents-lite/migrator.md +0 -75
  139. package/packs/angular/agents-lite/reviewer.md +0 -69
  140. package/packs/angular/skills/dev-create-component/SKILL.md +0 -56
  141. package/packs/angular/skills/dev-create-injectable/SKILL.md +0 -60
  142. package/packs/angular/skills/dev-create-module/SKILL.md +0 -49
  143. package/packs/angular/skills/dev-create-service/SKILL.md +0 -34
  144. package/packs/angular/skills/dev-create-test/SKILL.md +0 -78
  145. package/packs/angular/skills/dev-generate-types/SKILL.md +0 -37
  146. package/packs/angular/skills/docs-onboard/SKILL.md +0 -42
  147. package/packs/angular/skills/migration-migrate-component/SKILL.md +0 -42
  148. package/packs/angular/skills/migration-migrate-module/SKILL.md +0 -25
  149. package/packs/angular/skills/review-check-architecture/SKILL.md +0 -67
  150. package/packs/angular/skills/review-fix-violations/SKILL.md +0 -43
  151. package/packs/angular/skills/review-review/SKILL.md +0 -43
  152. package/packs/astro/ARCHITECTURE.md +0 -718
  153. package/packs/astro/CLAUDE.md +0 -106
  154. package/packs/astro/agents/builder.md +0 -123
  155. package/packs/astro/agents/doctor.md +0 -200
  156. package/packs/astro/agents/migrator.md +0 -105
  157. package/packs/astro/agents/reviewer.md +0 -253
  158. package/packs/astro/agents-lite/builder.md +0 -71
  159. package/packs/astro/agents-lite/doctor.md +0 -66
  160. package/packs/astro/agents-lite/migrator.md +0 -71
  161. package/packs/astro/agents-lite/reviewer.md +0 -70
  162. package/packs/astro/skills/dev-create-component/SKILL.md +0 -50
  163. package/packs/astro/skills/dev-create-island/SKILL.md +0 -63
  164. package/packs/astro/skills/dev-create-module/SKILL.md +0 -49
  165. package/packs/astro/skills/dev-create-service/SKILL.md +0 -34
  166. package/packs/astro/skills/dev-create-test/SKILL.md +0 -76
  167. package/packs/astro/skills/dev-generate-types/SKILL.md +0 -37
  168. package/packs/astro/skills/docs-onboard/SKILL.md +0 -51
  169. package/packs/astro/skills/migration-migrate-component/SKILL.md +0 -48
  170. package/packs/astro/skills/migration-migrate-module/SKILL.md +0 -25
  171. package/packs/astro/skills/review-check-architecture/SKILL.md +0 -72
  172. package/packs/astro/skills/review-fix-violations/SKILL.md +0 -43
  173. package/packs/astro/skills/review-review/SKILL.md +0 -45
  174. package/packs/nextjs/ARCHITECTURE.md +0 -1033
  175. package/packs/nextjs/CLAUDE.md +0 -106
  176. package/packs/nextjs/agents/builder.md +0 -132
  177. package/packs/nextjs/agents/doctor.md +0 -226
  178. package/packs/nextjs/agents/migrator.md +0 -101
  179. package/packs/nextjs/agents/reviewer.md +0 -243
  180. package/packs/nextjs/agents-lite/builder.md +0 -74
  181. package/packs/nextjs/agents-lite/doctor.md +0 -74
  182. package/packs/nextjs/agents-lite/migrator.md +0 -75
  183. package/packs/nextjs/agents-lite/reviewer.md +0 -73
  184. package/packs/nextjs/skills/dev-create-component/SKILL.md +0 -82
  185. package/packs/nextjs/skills/dev-create-hook/SKILL.md +0 -90
  186. package/packs/nextjs/skills/dev-create-module/SKILL.md +0 -63
  187. package/packs/nextjs/skills/dev-create-service/SKILL.md +0 -35
  188. package/packs/nextjs/skills/dev-create-test/SKILL.md +0 -106
  189. package/packs/nextjs/skills/dev-generate-types/SKILL.md +0 -37
  190. package/packs/nextjs/skills/docs-onboard/SKILL.md +0 -55
  191. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +0 -58
  192. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +0 -25
  193. package/packs/nextjs/skills/review-check-architecture/SKILL.md +0 -101
  194. package/packs/nextjs/skills/review-fix-violations/SKILL.md +0 -48
  195. package/packs/nextjs/skills/review-review/SKILL.md +0 -47
  196. package/packs/nuxt/ARCHITECTURE.md +0 -831
  197. package/packs/nuxt/CLAUDE.md +0 -111
  198. package/packs/nuxt/agents/builder.md +0 -120
  199. package/packs/nuxt/agents/doctor.md +0 -198
  200. package/packs/nuxt/agents/migrator.md +0 -101
  201. package/packs/nuxt/agents/reviewer.md +0 -255
  202. package/packs/nuxt/agents-lite/builder.md +0 -67
  203. package/packs/nuxt/agents-lite/doctor.md +0 -67
  204. package/packs/nuxt/agents-lite/migrator.md +0 -80
  205. package/packs/nuxt/agents-lite/reviewer.md +0 -71
  206. package/packs/nuxt/skills/dev-create-component/SKILL.md +0 -60
  207. package/packs/nuxt/skills/dev-create-composable/SKILL.md +0 -33
  208. package/packs/nuxt/skills/dev-create-module/SKILL.md +0 -49
  209. package/packs/nuxt/skills/dev-create-service/SKILL.md +0 -34
  210. package/packs/nuxt/skills/dev-create-test/SKILL.md +0 -61
  211. package/packs/nuxt/skills/dev-generate-types/SKILL.md +0 -37
  212. package/packs/nuxt/skills/docs-onboard/SKILL.md +0 -49
  213. package/packs/nuxt/skills/migration-migrate-component/SKILL.md +0 -48
  214. package/packs/nuxt/skills/migration-migrate-module/SKILL.md +0 -25
  215. package/packs/nuxt/skills/review-check-architecture/SKILL.md +0 -71
  216. package/packs/nuxt/skills/review-fix-violations/SKILL.md +0 -43
  217. package/packs/nuxt/skills/review-review/SKILL.md +0 -45
  218. package/packs/react/ARCHITECTURE.md +0 -991
  219. package/packs/react/CLAUDE.md +0 -102
  220. package/packs/react/agents/builder.md +0 -113
  221. package/packs/react/agents/doctor.md +0 -203
  222. package/packs/react/agents/migrator.md +0 -101
  223. package/packs/react/agents/reviewer.md +0 -252
  224. package/packs/react/agents-lite/builder.md +0 -65
  225. package/packs/react/agents-lite/doctor.md +0 -64
  226. package/packs/react/agents-lite/migrator.md +0 -74
  227. package/packs/react/agents-lite/reviewer.md +0 -69
  228. package/packs/react/skills/dev-create-component/SKILL.md +0 -53
  229. package/packs/react/skills/dev-create-hook/SKILL.md +0 -78
  230. package/packs/react/skills/dev-create-module/SKILL.md +0 -51
  231. package/packs/react/skills/dev-create-service/SKILL.md +0 -34
  232. package/packs/react/skills/dev-create-test/SKILL.md +0 -92
  233. package/packs/react/skills/dev-generate-types/SKILL.md +0 -37
  234. package/packs/react/skills/docs-onboard/SKILL.md +0 -42
  235. package/packs/react/skills/migration-migrate-component/SKILL.md +0 -44
  236. package/packs/react/skills/migration-migrate-module/SKILL.md +0 -25
  237. package/packs/react/skills/review-check-architecture/SKILL.md +0 -73
  238. package/packs/react/skills/review-fix-violations/SKILL.md +0 -45
  239. package/packs/react/skills/review-review/SKILL.md +0 -44
  240. package/packs/svelte/ARCHITECTURE.md +0 -975
  241. package/packs/svelte/CLAUDE.md +0 -102
  242. package/packs/svelte/agents/builder.md +0 -114
  243. package/packs/svelte/agents/doctor.md +0 -174
  244. package/packs/svelte/agents/migrator.md +0 -101
  245. package/packs/svelte/agents/reviewer.md +0 -238
  246. package/packs/svelte/agents-lite/builder.md +0 -66
  247. package/packs/svelte/agents-lite/doctor.md +0 -67
  248. package/packs/svelte/agents-lite/migrator.md +0 -82
  249. package/packs/svelte/agents-lite/reviewer.md +0 -70
  250. package/packs/svelte/skills/dev-create-component/SKILL.md +0 -77
  251. package/packs/svelte/skills/dev-create-module/SKILL.md +0 -59
  252. package/packs/svelte/skills/dev-create-service/SKILL.md +0 -35
  253. package/packs/svelte/skills/dev-create-store/SKILL.md +0 -94
  254. package/packs/svelte/skills/dev-create-test/SKILL.md +0 -98
  255. package/packs/svelte/skills/dev-generate-types/SKILL.md +0 -37
  256. package/packs/svelte/skills/docs-onboard/SKILL.md +0 -47
  257. package/packs/svelte/skills/migration-migrate-component/SKILL.md +0 -51
  258. package/packs/svelte/skills/migration-migrate-module/SKILL.md +0 -25
  259. package/packs/svelte/skills/review-check-architecture/SKILL.md +0 -79
  260. package/packs/svelte/skills/review-fix-violations/SKILL.md +0 -47
  261. package/packs/svelte/skills/review-review/SKILL.md +0 -45
  262. package/packs/vue/ARCHITECTURE.md +0 -798
  263. package/packs/vue/CLAUDE.md +0 -102
  264. package/packs/vue/agents/builder.md +0 -112
  265. package/packs/vue/agents/doctor.md +0 -185
  266. package/packs/vue/agents/migrator.md +0 -101
  267. package/packs/vue/agents/reviewer.md +0 -249
  268. package/packs/vue/agents-lite/builder.md +0 -65
  269. package/packs/vue/agents-lite/doctor.md +0 -63
  270. package/packs/vue/agents-lite/migrator.md +0 -73
  271. package/packs/vue/agents-lite/reviewer.md +0 -68
  272. package/packs/vue/skills/dev-create-component/SKILL.md +0 -58
  273. package/packs/vue/skills/dev-create-composable/SKILL.md +0 -31
  274. package/packs/vue/skills/dev-create-module/SKILL.md +0 -50
  275. package/packs/vue/skills/dev-create-service/SKILL.md +0 -34
  276. package/packs/vue/skills/dev-create-test/SKILL.md +0 -62
  277. package/packs/vue/skills/dev-generate-types/SKILL.md +0 -37
  278. package/packs/vue/skills/docs-onboard/SKILL.md +0 -42
  279. package/packs/vue/skills/migration-migrate-component/SKILL.md +0 -41
  280. package/packs/vue/skills/migration-migrate-module/SKILL.md +0 -25
  281. package/packs/vue/skills/review-check-architecture/SKILL.md +0 -73
  282. package/packs/vue/skills/review-fix-violations/SKILL.md +0 -42
  283. package/packs/vue/skills/review-review/SKILL.md +0 -43
  284. package/skills/audit/SKILL.md +0 -231
  285. package/skills/autofix/SKILL.md +0 -166
  286. package/skills/autopilot/SKILL.md +0 -286
  287. package/skills/brainstorm/SKILL.md +0 -298
  288. package/skills/checkpoint/SKILL.md +0 -217
  289. package/skills/codereview/SKILL.md +0 -268
  290. package/skills/commit/SKILL.md +0 -150
  291. package/skills/copywriting/SKILL.md +0 -218
  292. package/skills/cro/SKILL.md +0 -234
  293. package/skills/debug/SKILL.md +0 -210
  294. package/skills/design-review/SKILL.md +0 -217
  295. package/skills/discovery/SKILL.md +0 -218
  296. package/skills/estimate/SKILL.md +0 -154
  297. package/skills/finish/SKILL.md +0 -220
  298. package/skills/grill/SKILL.md +0 -270
  299. package/skills/health/SKILL.md +0 -251
  300. package/skills/improve-architecture/SKILL.md +0 -205
  301. package/skills/learn/SKILL.md +0 -260
  302. package/skills/lint/SKILL.md +0 -126
  303. package/skills/migrate-architecture/SKILL.md +0 -242
  304. package/skills/migrate-framework/SKILL.md +0 -172
  305. package/skills/onboard/SKILL.md +0 -168
  306. package/skills/plan/SKILL.md +0 -141
  307. package/skills/prd/SKILL.md +0 -241
  308. package/skills/recall/SKILL.md +0 -112
  309. package/skills/remember/SKILL.md +0 -108
  310. package/skills/seo-audit/SKILL.md +0 -240
  311. package/skills/tdd/SKILL.md +0 -201
  312. package/skills/tutorial/SKILL.md +0 -346
  313. package/skills/verify/SKILL.md +0 -168
  314. package/skills/worktree/SKILL.md +0 -168
  315. package/skills/write-skill/SKILL.md +0 -225
  316. package/templates/autopilot/PROMPT.md +0 -39
  317. package/templates/autopilot/README.md +0 -122
  318. package/templates/autopilot/devcontainer.json +0 -21
  319. package/templates/industry/ecommerce.md +0 -127
  320. package/templates/industry/fintech.md +0 -161
  321. package/templates/industry/saas.md +0 -134
  322. package/templates/session-memory.json +0 -48
  323. package/templates/skill-template/SKILL.md +0 -90
@@ -1,129 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * On Error Hook
5
- *
6
- * Runs when an agent encounters an error.
7
- *
8
- * Actions:
9
- * - Logs error to metrics
10
- * - Suggests recovery options
11
- * - Optionally notifies external services
12
- */
13
-
14
- import { existsSync, readFileSync, writeFileSync } from 'fs';
15
- import { execSync } from 'child_process';
16
-
17
- const SESSION_FILE = '.claude/metrics/current-session.json';
18
-
19
- // Error data passed via environment or args
20
- const errorData = {
21
- agent: process.env.ERROR_AGENT || process.argv[2] || 'unknown',
22
- message: process.env.ERROR_MESSAGE || process.argv[3] || 'Unknown error',
23
- file: process.env.ERROR_FILE || process.argv[4] || '',
24
- line: process.env.ERROR_LINE || process.argv[5] || '',
25
- task: process.env.ERROR_TASK || process.argv[6] || '',
26
- stack: process.env.ERROR_STACK || ''
27
- };
28
-
29
- async function main() {
30
- console.log('\n──── Error Detected ────');
31
- console.log(`Agent: ${errorData.agent}`);
32
- console.log(`Message: ${errorData.message}`);
33
-
34
- if (errorData.file) {
35
- console.log(`Location: ${errorData.file}${errorData.line ? ':' + errorData.line : ''}`);
36
- }
37
-
38
- // 1. Log to metrics
39
- logErrorToMetrics(errorData);
40
-
41
- // 2. Check for checkpoints
42
- suggestRecovery();
43
-
44
- // 3. Provide guidance
45
- provideGuidance(errorData);
46
- }
47
-
48
- function logErrorToMetrics(error) {
49
- if (!existsSync(SESSION_FILE)) {
50
- return;
51
- }
52
-
53
- try {
54
- const session = JSON.parse(readFileSync(SESSION_FILE, 'utf-8'));
55
-
56
- session.errors.push({
57
- agent: error.agent,
58
- message: error.message,
59
- file: error.file,
60
- line: error.line,
61
- task: error.task,
62
- timestamp: new Date().toISOString()
63
- });
64
-
65
- writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
66
- console.log('\n✓ Error logged to session metrics');
67
- } catch {
68
- // Ignore logging errors
69
- }
70
- }
71
-
72
- function suggestRecovery() {
73
- try {
74
- // Check for checkpoints
75
- const checkpoints = execSync('git tag -l "checkpoint/*" 2>/dev/null || true', {
76
- encoding: 'utf-8'
77
- }).trim().split('\n').filter(Boolean);
78
-
79
- if (checkpoints.length > 0) {
80
- console.log('\n──── Recovery Options ────');
81
- console.log('Available checkpoints:');
82
- checkpoints.slice(-3).forEach(cp => {
83
- console.log(` • ${cp}`);
84
- });
85
- console.log('\nTo rollback:');
86
- console.log(` git reset --hard ${checkpoints[checkpoints.length - 1]}`);
87
- }
88
-
89
- // Check for restore points
90
- const restorePoints = execSync('git tag -l "restore-point/*" 2>/dev/null || true', {
91
- encoding: 'utf-8'
92
- }).trim().split('\n').filter(Boolean);
93
-
94
- if (restorePoints.length > 0) {
95
- console.log('\nFull session rollback:');
96
- console.log(` git reset --hard ${restorePoints[restorePoints.length - 1]}`);
97
- }
98
- } catch {
99
- console.log('\nℹ Git checkpoints not available');
100
- }
101
- }
102
-
103
- function provideGuidance(error) {
104
- console.log('\n──── Suggestions ────');
105
-
106
- // Error-specific guidance
107
- if (error.message.includes('TypeScript') || error.message.includes('tsc')) {
108
- console.log('• Run "npx tsc --noEmit" to see all type errors');
109
- console.log('• Check imports and type definitions');
110
- } else if (error.message.includes('test') || error.message.includes('jest')) {
111
- console.log('• Run "npm test" to see full test output');
112
- console.log('• Check test assertions and mocks');
113
- } else if (error.message.includes('syntax') || error.message.includes('parse')) {
114
- console.log('• Check for missing brackets or semicolons');
115
- console.log('• Validate JSON/YAML files');
116
- } else if (error.message.includes('module') || error.message.includes('import')) {
117
- console.log('• Run "npm install" to ensure dependencies');
118
- console.log('• Check import paths and exports');
119
- }
120
-
121
- // General suggestions
122
- console.log('\nGeneral:');
123
- console.log('• Use @debugger for systematic investigation');
124
- console.log('• Use /checkpoint restore [name] to rollback');
125
- console.log('• Check recent changes: git diff HEAD~1');
126
- }
127
-
128
- // Run
129
- main().catch(console.error);
@@ -1,185 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Session End Hook
5
- *
6
- * Runs when a session ends (manually triggered or detected).
7
- *
8
- * Actions:
9
- * - Generates session summary
10
- * - Saves metrics to history
11
- * - Cleans up temporary data
12
- * - Updates session memory
13
- */
14
-
15
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
16
- import { join } from 'path';
17
-
18
- const SESSION_FILE = '.claude/metrics/current-session.json';
19
- const HISTORY_DIR = '.claude/metrics/history';
20
- const MEMORY_FILE = '.claude/session-memory.json';
21
-
22
- async function main() {
23
- console.log('\n════════════════════════════════════════');
24
- console.log(' SESSION SUMMARY ');
25
- console.log('════════════════════════════════════════\n');
26
-
27
- // 1. Load session data
28
- const session = loadSession();
29
- if (!session) {
30
- console.log('No active session to summarize.');
31
- return;
32
- }
33
-
34
- // 2. Calculate final metrics
35
- const metrics = calculateMetrics(session);
36
-
37
- // 3. Display summary
38
- displaySummary(session, metrics);
39
-
40
- // 4. Compare with competitors
41
- displayComparison(metrics);
42
-
43
- // 5. Save to history
44
- saveToHistory(session, metrics);
45
-
46
- // 6. Clean up
47
- cleanup();
48
-
49
- console.log('\n════════════════════════════════════════\n');
50
- }
51
-
52
- function loadSession() {
53
- if (!existsSync(SESSION_FILE)) {
54
- return null;
55
- }
56
-
57
- try {
58
- const session = JSON.parse(readFileSync(SESSION_FILE, 'utf-8'));
59
- session.endTime = new Date().toISOString();
60
- return session;
61
- } catch {
62
- return null;
63
- }
64
- }
65
-
66
- function calculateMetrics(session) {
67
- const startTime = new Date(session.startTime);
68
- const endTime = new Date(session.endTime);
69
- const durationMs = endTime - startTime;
70
-
71
- return {
72
- duration: formatDuration(durationMs),
73
- durationMs,
74
- tasksCompleted: session.tasks.length,
75
- tasksFailed: session.errors.length,
76
- totalTokens: session.tokens.estimated,
77
- estimatedCost: session.tokens.estimated * 0.000015, // ~Sonnet pricing
78
- filesCreated: [...new Set(session.files.created)].length,
79
- filesModified: [...new Set(session.files.modified)].length,
80
- agentsUsed: session.agents.length,
81
- skillsUsed: session.skills.length,
82
- checkpointsCreated: session.checkpoints.length,
83
- tokensPerTask: session.tasks.length > 0
84
- ? Math.round(session.tokens.estimated / session.tasks.length)
85
- : 0
86
- };
87
- }
88
-
89
- function formatDuration(ms) {
90
- const seconds = Math.floor(ms / 1000);
91
- const minutes = Math.floor(seconds / 60);
92
- const hours = Math.floor(minutes / 60);
93
-
94
- if (hours > 0) {
95
- return `${hours}h ${minutes % 60}m`;
96
- } else if (minutes > 0) {
97
- return `${minutes}m ${seconds % 60}s`;
98
- } else {
99
- return `${seconds}s`;
100
- }
101
- }
102
-
103
- function displaySummary(session, metrics) {
104
- console.log('──── Overview ────');
105
- console.log(`Session ID: ${session.sessionId}`);
106
- console.log(`Duration: ${metrics.duration}`);
107
- console.log(`Status: ${metrics.tasksFailed > 0 ? '⚠ Completed with errors' : '✓ Completed successfully'}`);
108
-
109
- console.log('\n──── Tasks ────');
110
- console.log(`Completed: ${metrics.tasksCompleted}`);
111
- console.log(`Errors: ${metrics.tasksFailed}`);
112
-
113
- console.log('\n──── Files ────');
114
- console.log(`Created: ${metrics.filesCreated}`);
115
- console.log(`Modified: ${metrics.filesModified}`);
116
-
117
- console.log('\n──── Token Usage ────');
118
- console.log(`Total tokens: ~${metrics.totalTokens.toLocaleString()}`);
119
- console.log(`Per task avg: ~${metrics.tokensPerTask.toLocaleString()}`);
120
- console.log(`Estimated cost: ~$${metrics.estimatedCost.toFixed(2)}`);
121
-
122
- console.log('\n──── Agents & Skills ────');
123
- if (session.agents.length > 0) {
124
- console.log(`Agents: ${session.agents.join(', ')}`);
125
- }
126
- if (session.skills.length > 0) {
127
- console.log(`Skills: ${session.skills.join(', ')}`);
128
- }
129
-
130
- if (session.checkpoints.length > 0) {
131
- console.log(`\nCheckpoints: ${session.checkpoints.length} created`);
132
- }
133
-
134
- if (session.errors.length > 0) {
135
- console.log('\n──── Errors ────');
136
- session.errors.forEach((err, i) => {
137
- console.log(`${i + 1}. [${err.agent}] ${err.message}`);
138
- });
139
- }
140
- }
141
-
142
- function displayComparison(metrics) {
143
- // Estimate what Superpowers would cost for same work
144
- // They use O(n²) scaling, we use linear
145
- const superpowersEstimate = metrics.tasksCompleted > 1
146
- ? metrics.estimatedCost * Math.pow(metrics.tasksCompleted, 1.5)
147
- : metrics.estimatedCost * 1.5;
148
-
149
- const savings = ((superpowersEstimate - metrics.estimatedCost) / superpowersEstimate * 100).toFixed(0);
150
-
151
- console.log('\n──── Cost Comparison ────');
152
- console.log(`Specialist Agent: ~$${metrics.estimatedCost.toFixed(2)}`);
153
- console.log(`Superpowers (est): ~$${superpowersEstimate.toFixed(2)}`);
154
- console.log(`Savings: ~${savings}%`);
155
- }
156
-
157
- function saveToHistory(session, metrics) {
158
- if (!existsSync(HISTORY_DIR)) {
159
- mkdirSync(HISTORY_DIR, { recursive: true });
160
- }
161
-
162
- const historyFile = join(HISTORY_DIR, `${session.sessionId}.json`);
163
- const historyData = {
164
- ...session,
165
- metrics
166
- };
167
-
168
- writeFileSync(historyFile, JSON.stringify(historyData, null, 2));
169
- console.log(`\n✓ Session saved to ${historyFile}`);
170
- }
171
-
172
- function cleanup() {
173
- // Remove current session file
174
- try {
175
- if (existsSync(SESSION_FILE)) {
176
- // Keep it for now, can be deleted manually
177
- console.log('ℹ Session file preserved for review');
178
- }
179
- } catch {
180
- // Ignore cleanup errors
181
- }
182
- }
183
-
184
- // Run
185
- main().catch(console.error);
@@ -1,154 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Session Start Hook
5
- *
6
- * Runs when a new Claude Code session starts.
7
- *
8
- * Actions:
9
- * - Validates project setup
10
- * - Initializes metrics tracking
11
- * - Creates session restore point
12
- * - Loads session memory (if enabled)
13
- */
14
-
15
- import { execSync } from 'child_process';
16
- import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
17
- import { join } from 'path';
18
-
19
- const METRICS_DIR = '.claude/metrics';
20
- const SESSION_FILE = '.claude/metrics/current-session.json';
21
-
22
- async function main() {
23
- const startTime = new Date().toISOString();
24
- const sessionId = `session-${Date.now()}`;
25
-
26
- console.log('──── Session Start ────');
27
-
28
- // 1. Validate project setup
29
- validateSetup();
30
-
31
- // 2. Initialize metrics directory
32
- initializeMetrics(sessionId, startTime);
33
-
34
- // 3. Create session restore point
35
- createRestorePoint(sessionId);
36
-
37
- // 4. Load previous session memory (if exists)
38
- loadSessionMemory();
39
-
40
- // 5. Display session info
41
- displaySessionInfo(sessionId, startTime);
42
- }
43
-
44
- function validateSetup() {
45
- const checks = [
46
- { path: '.claude', name: 'Claude directory' },
47
- { path: 'CLAUDE.md', name: 'CLAUDE.md config' },
48
- ];
49
-
50
- let allValid = true;
51
-
52
- for (const check of checks) {
53
- if (existsSync(check.path)) {
54
- console.log(`✓ ${check.name}`);
55
- } else {
56
- console.log(`✗ ${check.name} missing`);
57
- allValid = false;
58
- }
59
- }
60
-
61
- if (!allValid) {
62
- console.log('\nRun "npx specialist-agent init" to set up.');
63
- }
64
- }
65
-
66
- function initializeMetrics(sessionId, startTime) {
67
- if (!existsSync(METRICS_DIR)) {
68
- mkdirSync(METRICS_DIR, { recursive: true });
69
- }
70
-
71
- const sessionData = {
72
- sessionId,
73
- startTime,
74
- endTime: null,
75
- duration: null,
76
- agents: [],
77
- skills: [],
78
- tasks: [],
79
- tokens: {
80
- estimated: 0,
81
- input: 0,
82
- output: 0
83
- },
84
- files: {
85
- created: [],
86
- modified: [],
87
- deleted: []
88
- },
89
- checkpoints: [],
90
- errors: []
91
- };
92
-
93
- writeFileSync(SESSION_FILE, JSON.stringify(sessionData, null, 2));
94
- console.log(`✓ Metrics initialized`);
95
- }
96
-
97
- function createRestorePoint(sessionId) {
98
- try {
99
- // Check if in git repo
100
- execSync('git rev-parse --git-dir', { stdio: 'pipe' });
101
-
102
- // Check for uncommitted changes
103
- const status = execSync('git status --porcelain', { encoding: 'utf-8' });
104
-
105
- if (status.trim()) {
106
- console.log('⚠ Uncommitted changes detected');
107
- console.log(' Consider committing before major changes');
108
- }
109
-
110
- // Create restore point tag
111
- const tagName = `restore-point/${sessionId}`;
112
- try {
113
- execSync(`git tag ${tagName}`, { stdio: 'pipe' });
114
- console.log(`✓ Restore point: ${tagName}`);
115
- } catch {
116
- // Tag might already exist or no commits yet
117
- console.log('ℹ Restore point not created (no commits or already exists)');
118
- }
119
- } catch {
120
- console.log('ℹ Not a git repository');
121
- }
122
- }
123
-
124
- function loadSessionMemory() {
125
- const memoryFile = '.claude/session-memory.json';
126
-
127
- if (existsSync(memoryFile)) {
128
- try {
129
- const memory = JSON.parse(readFileSync(memoryFile, 'utf-8'));
130
- const decisions = memory.decisions || [];
131
-
132
- if (decisions.length > 0) {
133
- console.log(`\n📝 Session Memory (${decisions.length} decisions):`);
134
- // Show last 3 decisions
135
- decisions.slice(-3).forEach(d => {
136
- console.log(` • ${d.topic}: ${d.decision}`);
137
- });
138
- }
139
- } catch {
140
- // Invalid memory file, ignore
141
- }
142
- }
143
- }
144
-
145
- function displaySessionInfo(sessionId, startTime) {
146
- console.log('\n──── Ready ────');
147
- console.log(`Session: ${sessionId}`);
148
- console.log(`Started: ${new Date(startTime).toLocaleString()}`);
149
- console.log('\nAvailable agents: @planner @builder @reviewer @tdd @debugger');
150
- console.log('Available skills: /plan /tdd /debug /checkpoint /estimate /finish');
151
- }
152
-
153
- // Run
154
- main().catch(console.error);