specialist-agent 1.6.0 → 2.0.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 (176) hide show
  1. package/.claude-plugin/marketplace.json +77 -0
  2. package/.claude-plugin/plugin.json +43 -0
  3. package/.codex/INSTALL.md +113 -0
  4. package/.cursor-plugin/marketplace.json +9 -0
  5. package/.cursor-plugin/plugin.json +35 -0
  6. package/.opencode/INSTALL.md +123 -0
  7. package/README.md +204 -263
  8. package/agents/analyst-lite.md +48 -0
  9. package/agents/analyst.md +391 -0
  10. package/agents/api-lite.md +43 -0
  11. package/agents/api.md +145 -0
  12. package/agents/cloud-lite.md +1 -1
  13. package/agents/cloud.md +1 -1
  14. package/agents/data-lite.md +1 -1
  15. package/agents/data.md +1 -1
  16. package/agents/debugger-lite.md +46 -0
  17. package/agents/debugger.md +406 -0
  18. package/agents/deps-lite.md +41 -0
  19. package/agents/deps.md +206 -0
  20. package/agents/designer-lite.md +1 -1
  21. package/agents/designer.md +1 -1
  22. package/agents/devops-lite.md +1 -1
  23. package/agents/devops.md +1 -1
  24. package/agents/docs-lite.md +42 -0
  25. package/agents/docs.md +197 -0
  26. package/agents/executor-lite.md +61 -0
  27. package/agents/executor.md +456 -0
  28. package/agents/explorer-lite.md +1 -1
  29. package/agents/explorer.md +1 -1
  30. package/agents/finance-lite.md +1 -1
  31. package/agents/finance.md +1 -1
  32. package/agents/i18n-lite.md +44 -0
  33. package/agents/i18n.md +198 -0
  34. package/agents/legal-lite.md +1 -1
  35. package/agents/legal.md +1 -1
  36. package/agents/memory.md +240 -0
  37. package/agents/orchestrator-lite.md +40 -0
  38. package/agents/orchestrator.md +387 -0
  39. package/agents/pair-lite.md +38 -0
  40. package/agents/pair.md +308 -0
  41. package/agents/perf-lite.md +42 -0
  42. package/agents/perf.md +141 -0
  43. package/agents/planner-lite.md +59 -0
  44. package/agents/planner.md +265 -0
  45. package/agents/refactor-lite.md +42 -0
  46. package/agents/refactor.md +178 -0
  47. package/agents/scout-lite.md +37 -0
  48. package/agents/scout.md +222 -0
  49. package/agents/security-lite.md +1 -1
  50. package/agents/security.md +1 -1
  51. package/agents/starter-lite.md +1 -1
  52. package/agents/starter.md +1 -1
  53. package/agents/tdd-lite.md +43 -0
  54. package/agents/tdd.md +317 -0
  55. package/agents/tester-lite.md +1 -1
  56. package/agents/tester.md +1 -1
  57. package/cli/index.mjs +636 -15
  58. package/hooks/after-review.mjs +130 -0
  59. package/hooks/after-task.mjs +117 -0
  60. package/hooks/before-plan.mjs +155 -0
  61. package/hooks/before-review.mjs +139 -0
  62. package/hooks/hooks.json +81 -0
  63. package/hooks/native/auto-dispatch.mjs +197 -0
  64. package/hooks/native/auto-format.mjs +193 -0
  65. package/hooks/native/security-config.json +31 -0
  66. package/hooks/native/security-guard.mjs +267 -0
  67. package/hooks/native/session-context.mjs +136 -0
  68. package/hooks/native/settings-template.json +50 -0
  69. package/hooks/native/utils.mjs +62 -0
  70. package/hooks/on-error.mjs +129 -0
  71. package/hooks/session-end.mjs +185 -0
  72. package/hooks/session-start.mjs +154 -0
  73. package/package.json +16 -3
  74. package/packs/nextjs/agents/builder.md +24 -1
  75. package/packs/nextjs/agents/doctor.md +70 -4
  76. package/packs/nextjs/agents/migrator.md +24 -1
  77. package/packs/nextjs/agents/reviewer.md +93 -3
  78. package/packs/nextjs/agents-lite/builder.md +1 -1
  79. package/packs/nextjs/agents-lite/doctor.md +1 -1
  80. package/packs/nextjs/agents-lite/migrator.md +1 -1
  81. package/packs/nextjs/agents-lite/reviewer.md +1 -1
  82. package/packs/nextjs/skills/dev-create-component/SKILL.md +1 -1
  83. package/packs/nextjs/skills/dev-create-hook/SKILL.md +1 -1
  84. package/packs/nextjs/skills/dev-create-module/SKILL.md +1 -1
  85. package/packs/nextjs/skills/dev-create-service/SKILL.md +1 -1
  86. package/packs/nextjs/skills/dev-create-test/SKILL.md +1 -1
  87. package/packs/nextjs/skills/dev-generate-types/SKILL.md +1 -1
  88. package/packs/nextjs/skills/docs-onboard/SKILL.md +1 -1
  89. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +1 -1
  90. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +1 -1
  91. package/packs/nextjs/skills/review-check-architecture/SKILL.md +1 -1
  92. package/packs/nextjs/skills/review-fix-violations/SKILL.md +1 -1
  93. package/packs/nextjs/skills/review-review/SKILL.md +1 -1
  94. package/packs/react/agents/builder.md +24 -1
  95. package/packs/react/agents/doctor.md +107 -13
  96. package/packs/react/agents/migrator.md +24 -1
  97. package/packs/react/agents/reviewer.md +113 -9
  98. package/packs/react/agents-lite/builder.md +1 -1
  99. package/packs/react/agents-lite/doctor.md +1 -1
  100. package/packs/react/agents-lite/migrator.md +1 -1
  101. package/packs/react/agents-lite/reviewer.md +1 -1
  102. package/packs/react/skills/dev-create-component/SKILL.md +1 -1
  103. package/packs/react/skills/dev-create-hook/SKILL.md +1 -1
  104. package/packs/react/skills/dev-create-module/SKILL.md +1 -1
  105. package/packs/react/skills/dev-create-service/SKILL.md +1 -1
  106. package/packs/react/skills/dev-create-test/SKILL.md +1 -1
  107. package/packs/react/skills/dev-generate-types/SKILL.md +1 -1
  108. package/packs/react/skills/docs-onboard/SKILL.md +1 -1
  109. package/packs/react/skills/migration-migrate-component/SKILL.md +1 -1
  110. package/packs/react/skills/migration-migrate-module/SKILL.md +1 -1
  111. package/packs/react/skills/review-check-architecture/SKILL.md +1 -1
  112. package/packs/react/skills/review-fix-violations/SKILL.md +1 -1
  113. package/packs/react/skills/review-review/SKILL.md +1 -1
  114. package/packs/svelte/agents/builder.md +24 -1
  115. package/packs/svelte/agents/doctor.md +70 -4
  116. package/packs/svelte/agents/migrator.md +24 -1
  117. package/packs/svelte/agents/reviewer.md +93 -3
  118. package/packs/svelte/agents-lite/builder.md +1 -1
  119. package/packs/svelte/agents-lite/doctor.md +1 -1
  120. package/packs/svelte/agents-lite/migrator.md +1 -1
  121. package/packs/svelte/agents-lite/reviewer.md +1 -1
  122. package/packs/svelte/skills/dev-create-component/SKILL.md +1 -1
  123. package/packs/svelte/skills/dev-create-module/SKILL.md +1 -1
  124. package/packs/svelte/skills/dev-create-service/SKILL.md +1 -1
  125. package/packs/svelte/skills/dev-create-store/SKILL.md +1 -1
  126. package/packs/svelte/skills/dev-create-test/SKILL.md +1 -1
  127. package/packs/svelte/skills/dev-generate-types/SKILL.md +1 -1
  128. package/packs/svelte/skills/docs-onboard/SKILL.md +1 -1
  129. package/packs/svelte/skills/migration-migrate-component/SKILL.md +1 -1
  130. package/packs/svelte/skills/migration-migrate-module/SKILL.md +1 -1
  131. package/packs/svelte/skills/review-check-architecture/SKILL.md +1 -1
  132. package/packs/svelte/skills/review-fix-violations/SKILL.md +1 -1
  133. package/packs/svelte/skills/review-review/SKILL.md +1 -1
  134. package/packs/vue/agents/builder.md +24 -1
  135. package/packs/vue/agents/doctor.md +107 -13
  136. package/packs/vue/agents/migrator.md +24 -1
  137. package/packs/vue/agents/reviewer.md +113 -9
  138. package/packs/vue/agents-lite/builder.md +1 -1
  139. package/packs/vue/agents-lite/doctor.md +1 -1
  140. package/packs/vue/agents-lite/migrator.md +1 -1
  141. package/packs/vue/agents-lite/reviewer.md +1 -1
  142. package/packs/vue/skills/dev-create-component/SKILL.md +1 -1
  143. package/packs/vue/skills/dev-create-composable/SKILL.md +1 -1
  144. package/packs/vue/skills/dev-create-module/SKILL.md +1 -1
  145. package/packs/vue/skills/dev-create-service/SKILL.md +1 -1
  146. package/packs/vue/skills/dev-create-test/SKILL.md +1 -1
  147. package/packs/vue/skills/dev-generate-types/SKILL.md +1 -1
  148. package/packs/vue/skills/docs-onboard/SKILL.md +1 -1
  149. package/packs/vue/skills/migration-migrate-component/SKILL.md +1 -1
  150. package/packs/vue/skills/migration-migrate-module/SKILL.md +1 -1
  151. package/packs/vue/skills/review-check-architecture/SKILL.md +1 -1
  152. package/packs/vue/skills/review-fix-violations/SKILL.md +1 -1
  153. package/packs/vue/skills/review-review/SKILL.md +1 -1
  154. package/skills/audit/SKILL.md +169 -0
  155. package/skills/brainstorm/SKILL.md +245 -0
  156. package/skills/checkpoint/SKILL.md +209 -0
  157. package/skills/debug/SKILL.md +210 -0
  158. package/skills/estimate/SKILL.md +145 -0
  159. package/skills/finish/SKILL.md +211 -0
  160. package/skills/health/SKILL.md +242 -0
  161. package/skills/learn/SKILL.md +260 -0
  162. package/skills/migrate-framework/SKILL.md +172 -0
  163. package/skills/onboard/SKILL.md +168 -0
  164. package/skills/plan/SKILL.md +132 -0
  165. package/skills/recall/SKILL.md +150 -0
  166. package/skills/remember/SKILL.md +158 -0
  167. package/skills/tdd/SKILL.md +156 -0
  168. package/skills/tutorial/SKILL.md +346 -0
  169. package/skills/verify/SKILL.md +168 -0
  170. package/skills/worktree/SKILL.md +168 -0
  171. package/skills/write-skill/SKILL.md +213 -0
  172. package/templates/industry/ecommerce.md +127 -0
  173. package/templates/industry/fintech.md +161 -0
  174. package/templates/industry/saas.md +134 -0
  175. package/templates/session-memory.json +48 -0
  176. package/templates/skill-template/SKILL.md +90 -0
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * After Review Hook
5
+ *
6
+ * Runs after @reviewer completes a code review.
7
+ *
8
+ * Actions:
9
+ * - Records review results in metrics
10
+ * - Logs review summary
11
+ * - Tracks violations and trends
12
+ * - Suggests next actions
13
+ */
14
+
15
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
16
+
17
+ const SESSION_FILE = '.claude/metrics/current-session.json';
18
+ const REVIEWS_DIR = '.claude/metrics/reviews';
19
+
20
+ // Review data passed via environment or args
21
+ const reviewData = {
22
+ scope: process.env.REVIEW_SCOPE || process.argv[2] || 'unknown',
23
+ verdict: process.env.REVIEW_VERDICT || process.argv[3] || 'unknown',
24
+ violations: parseInt(process.env.REVIEW_VIOLATIONS || process.argv[4] || '0', 10),
25
+ warnings: parseInt(process.env.REVIEW_WARNINGS || process.argv[5] || '0', 10),
26
+ highlights: parseInt(process.env.REVIEW_HIGHLIGHTS || process.argv[6] || '0', 10),
27
+ agent: '@reviewer',
28
+ timestamp: new Date().toISOString()
29
+ };
30
+
31
+ async function main() {
32
+ console.log(`\n──── Review Complete: ${reviewData.scope} ────`);
33
+
34
+ // 1. Log review summary
35
+ logSummary();
36
+
37
+ // 2. Update session metrics
38
+ updateSessionMetrics();
39
+
40
+ // 3. Save review record
41
+ saveReviewRecord();
42
+
43
+ // 4. Suggest next actions
44
+ suggestNextActions();
45
+ }
46
+
47
+ function logSummary() {
48
+ const verdictIcon = {
49
+ approved: '✓ Approved',
50
+ caveats: '⚠ Approved with Caveats',
51
+ rejected: '✗ Requires Changes',
52
+ unknown: '? Unknown'
53
+ };
54
+
55
+ console.log(`Verdict: ${verdictIcon[reviewData.verdict] || verdictIcon.unknown}`);
56
+
57
+ if (reviewData.violations > 0) {
58
+ console.log(`Violations: ${reviewData.violations}`);
59
+ }
60
+ if (reviewData.warnings > 0) {
61
+ console.log(`Warnings: ${reviewData.warnings}`);
62
+ }
63
+ if (reviewData.highlights > 0) {
64
+ console.log(`Highlights: ${reviewData.highlights}`);
65
+ }
66
+
67
+ // Quality score (simple heuristic)
68
+ const score = Math.max(0, 100 - (reviewData.violations * 15) - (reviewData.warnings * 5));
69
+ console.log(`Quality score: ${score}/100`);
70
+ }
71
+
72
+ function updateSessionMetrics() {
73
+ if (!existsSync(SESSION_FILE)) {
74
+ return;
75
+ }
76
+
77
+ try {
78
+ const session = JSON.parse(readFileSync(SESSION_FILE, 'utf-8'));
79
+
80
+ if (!session.reviews) {
81
+ session.reviews = [];
82
+ }
83
+
84
+ session.reviews.push({
85
+ scope: reviewData.scope,
86
+ verdict: reviewData.verdict,
87
+ violations: reviewData.violations,
88
+ warnings: reviewData.warnings,
89
+ highlights: reviewData.highlights,
90
+ timestamp: reviewData.timestamp
91
+ });
92
+
93
+ writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
94
+ console.log('\n✓ Metrics updated');
95
+ } catch (err) {
96
+ console.log(`ℹ Could not update metrics: ${err.message}`);
97
+ }
98
+ }
99
+
100
+ function saveReviewRecord() {
101
+ try {
102
+ mkdirSync(REVIEWS_DIR, { recursive: true });
103
+
104
+ const date = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
105
+ const filename = `${REVIEWS_DIR}/review-${date}.json`;
106
+
107
+ writeFileSync(filename, JSON.stringify(reviewData, null, 2));
108
+ } catch {
109
+ // Non-critical, ignore
110
+ }
111
+ }
112
+
113
+ function suggestNextActions() {
114
+ console.log('\n──── Suggested Actions ────');
115
+
116
+ if (reviewData.verdict === 'rejected' || reviewData.violations > 0) {
117
+ console.log(' 1. Fix violations listed in the review');
118
+ console.log(' 2. Run /checkpoint create before-fixes');
119
+ console.log(' 3. Re-run @reviewer after fixes');
120
+ } else if (reviewData.verdict === 'caveats') {
121
+ console.log(' 1. Address warnings if time permits');
122
+ console.log(' 2. Proceed with merge (caveats are non-blocking)');
123
+ } else {
124
+ console.log(' 1. Ready to merge');
125
+ console.log(' 2. Run /finish to finalize branch');
126
+ }
127
+ }
128
+
129
+ // Run
130
+ main().catch(console.error);
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * After Task Hook
5
+ *
6
+ * Runs after each task completes (from @executor or manual work).
7
+ *
8
+ * Actions:
9
+ * - Records task completion in metrics
10
+ * - Creates checkpoint if enabled
11
+ * - Updates token tracking
12
+ * - Logs progress
13
+ */
14
+
15
+ import { existsSync, readFileSync, writeFileSync } from 'fs';
16
+
17
+ const SESSION_FILE = '.claude/metrics/current-session.json';
18
+
19
+ // Task data passed via environment or args
20
+ const taskData = {
21
+ taskId: process.env.TASK_ID || process.argv[2] || 'unknown',
22
+ description: process.env.TASK_DESC || process.argv[3] || 'Task completed',
23
+ tokens: parseInt(process.env.TASK_TOKENS || process.argv[4] || '0', 10),
24
+ duration: process.env.TASK_DURATION || process.argv[5] || '0s',
25
+ agent: process.env.TASK_AGENT || process.argv[6] || 'manual',
26
+ status: process.env.TASK_STATUS || process.argv[7] || 'completed',
27
+ files: {
28
+ created: (process.env.FILES_CREATED || '').split(',').filter(Boolean),
29
+ modified: (process.env.FILES_MODIFIED || '').split(',').filter(Boolean)
30
+ }
31
+ };
32
+
33
+ async function main() {
34
+ console.log(`\n──── Task Complete: ${taskData.taskId} ────`);
35
+
36
+ // 1. Update session metrics
37
+ updateMetrics(taskData);
38
+
39
+ // 2. Log task summary
40
+ logTaskSummary(taskData);
41
+
42
+ // 3. Show running totals
43
+ showRunningTotals();
44
+ }
45
+
46
+ function updateMetrics(task) {
47
+ if (!existsSync(SESSION_FILE)) {
48
+ console.log('ℹ No active session');
49
+ return;
50
+ }
51
+
52
+ try {
53
+ const session = JSON.parse(readFileSync(SESSION_FILE, 'utf-8'));
54
+
55
+ // Add task to list
56
+ session.tasks.push({
57
+ id: task.taskId,
58
+ description: task.description,
59
+ agent: task.agent,
60
+ status: task.status,
61
+ tokens: task.tokens,
62
+ duration: task.duration,
63
+ completedAt: new Date().toISOString()
64
+ });
65
+
66
+ // Update token totals
67
+ session.tokens.estimated += task.tokens;
68
+
69
+ // Update file tracking
70
+ session.files.created.push(...task.files.created);
71
+ session.files.modified.push(...task.files.modified);
72
+
73
+ // Update agent usage
74
+ if (task.agent && !session.agents.includes(task.agent)) {
75
+ session.agents.push(task.agent);
76
+ }
77
+
78
+ writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
79
+ } catch (err) {
80
+ console.log('ℹ Could not update metrics:', err.message);
81
+ }
82
+ }
83
+
84
+ function logTaskSummary(task) {
85
+ console.log(`Status: ${task.status === 'completed' ? '✓' : '✗'} ${task.status}`);
86
+ console.log(`Agent: ${task.agent}`);
87
+ console.log(`Tokens: ~${task.tokens.toLocaleString()}`);
88
+ console.log(`Duration: ${task.duration}`);
89
+
90
+ if (task.files.created.length > 0) {
91
+ console.log(`Files created: ${task.files.created.length}`);
92
+ }
93
+ if (task.files.modified.length > 0) {
94
+ console.log(`Files modified: ${task.files.modified.length}`);
95
+ }
96
+ }
97
+
98
+ function showRunningTotals() {
99
+ if (!existsSync(SESSION_FILE)) {
100
+ return;
101
+ }
102
+
103
+ try {
104
+ const session = JSON.parse(readFileSync(SESSION_FILE, 'utf-8'));
105
+
106
+ console.log('\n──── Session Progress ────');
107
+ console.log(`Tasks completed: ${session.tasks.length}`);
108
+ console.log(`Total tokens: ~${session.tokens.estimated.toLocaleString()}`);
109
+ console.log(`Estimated cost: ~$${(session.tokens.estimated * 0.000015).toFixed(2)}`);
110
+ console.log(`Agents used: ${session.agents.join(', ') || 'none'}`);
111
+ } catch {
112
+ // Ignore errors
113
+ }
114
+ }
115
+
116
+ // Run
117
+ main().catch(console.error);
@@ -0,0 +1,155 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Before Plan Hook
5
+ *
6
+ * Runs before @planner creates an implementation plan.
7
+ *
8
+ * Actions:
9
+ * - Validates project structure
10
+ * - Checks for ARCHITECTURE.md
11
+ * - Detects uncommitted changes
12
+ * - Summarizes project state for planner context
13
+ */
14
+
15
+ import { execSync } from 'child_process';
16
+ import { existsSync, readFileSync } from 'fs';
17
+
18
+ const feature = process.env.PLAN_FEATURE || process.argv[2] || '';
19
+
20
+ async function main() {
21
+ console.log('──── Pre-Plan Checks ────\n');
22
+
23
+ // 1. Check architecture file
24
+ checkArchitecture();
25
+
26
+ // 2. Check git state
27
+ checkGitState();
28
+
29
+ // 3. Detect framework
30
+ detectFramework();
31
+
32
+ // 4. Scan project size
33
+ scanProjectSize();
34
+
35
+ console.log('\n──── Ready for Planning ────');
36
+ }
37
+
38
+ function checkArchitecture() {
39
+ const paths = [
40
+ 'docs/ARCHITECTURE.md',
41
+ 'ARCHITECTURE.md',
42
+ '.claude/ARCHITECTURE.md'
43
+ ];
44
+
45
+ const found = paths.find(p => existsSync(p));
46
+
47
+ if (found) {
48
+ console.log(` ✓ Architecture file: ${found}`);
49
+
50
+ try {
51
+ const content = readFileSync(found, 'utf-8');
52
+ const lines = content.split('\n').length;
53
+ console.log(` ${lines} lines of architecture patterns`);
54
+ } catch {
55
+ // Ignore read errors
56
+ }
57
+ } else {
58
+ console.log(' ⚠ No ARCHITECTURE.md found');
59
+ console.log(' @planner will use generic patterns');
60
+ }
61
+ }
62
+
63
+ function checkGitState() {
64
+ console.log('Checking git state...');
65
+ try {
66
+ execSync('git rev-parse --git-dir', { stdio: 'pipe' });
67
+
68
+ // Current branch
69
+ const branch = execSync('git branch --show-current', { encoding: 'utf-8' }).trim();
70
+ console.log(` Branch: ${branch}`);
71
+
72
+ // Uncommitted changes
73
+ const status = execSync('git status --porcelain', { encoding: 'utf-8' }).trim();
74
+ const changedFiles = status.split('\n').filter(Boolean);
75
+
76
+ if (changedFiles.length > 0) {
77
+ console.log(` ⚠ Uncommitted changes: ${changedFiles.length} files`);
78
+ console.log(' Consider committing or stashing before planning');
79
+ } else {
80
+ console.log(' ✓ Working tree clean');
81
+ }
82
+
83
+ // Recent commits for context
84
+ const recentCommits = execSync('git log --oneline -5', { encoding: 'utf-8' }).trim();
85
+ if (recentCommits) {
86
+ console.log(' Recent commits:');
87
+ recentCommits.split('\n').forEach(c => console.log(` ${c}`));
88
+ }
89
+ } catch {
90
+ console.log(' ℹ Not a git repository');
91
+ }
92
+ }
93
+
94
+ function detectFramework() {
95
+ console.log('Detecting framework...');
96
+
97
+ if (!existsSync('package.json')) {
98
+ console.log(' ℹ No package.json found');
99
+ return;
100
+ }
101
+
102
+ try {
103
+ const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
104
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
105
+
106
+ const frameworks = [];
107
+ if (deps['next']) frameworks.push(`Next.js ${deps['next']}`);
108
+ if (deps['react'] && !deps['next']) frameworks.push(`React ${deps['react']}`);
109
+ if (deps['vue']) frameworks.push(`Vue ${deps['vue']}`);
110
+ if (deps['svelte'] || deps['@sveltejs/kit']) frameworks.push('SvelteKit');
111
+
112
+ if (frameworks.length > 0) {
113
+ console.log(` ✓ Framework: ${frameworks.join(', ')}`);
114
+ } else {
115
+ console.log(' ℹ No recognized framework');
116
+ }
117
+
118
+ // Check for TypeScript
119
+ if (deps['typescript'] || existsSync('tsconfig.json')) {
120
+ console.log(' ✓ TypeScript enabled');
121
+ }
122
+
123
+ // Check for test framework
124
+ if (deps['vitest']) console.log(' ✓ Test runner: Vitest');
125
+ else if (deps['jest']) console.log(' ✓ Test runner: Jest');
126
+ } catch {
127
+ console.log(' ℹ Could not parse package.json');
128
+ }
129
+ }
130
+
131
+ function scanProjectSize() {
132
+ console.log('Scanning project...');
133
+ try {
134
+ // Count source files (excluding node_modules, dist, .next, etc.)
135
+ const result = execSync(
136
+ 'find . -type f \\( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -o -name "*.vue" -o -name "*.svelte" \\) ' +
137
+ '-not -path "*/node_modules/*" -not -path "*/.next/*" -not -path "*/dist/*" -not -path "*/.nuxt/*" 2>/dev/null | wc -l',
138
+ { encoding: 'utf-8' }
139
+ ).trim();
140
+
141
+ const fileCount = parseInt(result, 10);
142
+ if (fileCount > 0) {
143
+ console.log(` Source files: ${fileCount}`);
144
+
145
+ if (fileCount < 20) console.log(' Scale: Small project');
146
+ else if (fileCount < 100) console.log(' Scale: Medium project');
147
+ else console.log(' Scale: Large project');
148
+ }
149
+ } catch {
150
+ console.log(' ℹ Could not scan project');
151
+ }
152
+ }
153
+
154
+ // Run
155
+ main().catch(console.error);
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Before Review Hook
5
+ *
6
+ * Runs before @reviewer starts a code review.
7
+ *
8
+ * Actions:
9
+ * - Runs automated checks (lint, types)
10
+ * - Identifies files to review
11
+ * - Prepares context for reviewer
12
+ */
13
+
14
+ import { execSync } from 'child_process';
15
+ import { existsSync } from 'fs';
16
+
17
+ const reviewScope = process.env.REVIEW_SCOPE || process.argv[2] || '.';
18
+
19
+ async function main() {
20
+ console.log('──── Pre-Review Checks ────\n');
21
+
22
+ // 1. Run linter
23
+ runLint();
24
+
25
+ // 2. Run TypeScript check
26
+ runTypeCheck();
27
+
28
+ // 3. Identify changed files
29
+ identifyChanges();
30
+
31
+ // 4. Quick test run (if fast)
32
+ runQuickTests();
33
+
34
+ console.log('\n──── Ready for Review ────');
35
+ }
36
+
37
+ function runLint() {
38
+ console.log('Running lint...');
39
+ try {
40
+ execSync('npm run lint 2>&1 || true', { encoding: 'utf-8', stdio: 'pipe' });
41
+ console.log(' ✓ Lint passed');
42
+ } catch (err) {
43
+ const output = err.stdout || err.message;
44
+ if (output.includes('error')) {
45
+ console.log(' ⚠ Lint warnings/errors found');
46
+ console.log(' Run "npm run lint" for details');
47
+ } else {
48
+ console.log(' ✓ Lint passed');
49
+ }
50
+ }
51
+ }
52
+
53
+ function runTypeCheck() {
54
+ console.log('Running TypeScript check...');
55
+ try {
56
+ execSync('npx tsc --noEmit 2>&1', { encoding: 'utf-8', stdio: 'pipe' });
57
+ console.log(' ✓ TypeScript passed');
58
+ } catch (err) {
59
+ const output = err.stdout || err.message;
60
+ if (output.includes('error')) {
61
+ const errorCount = (output.match(/error TS/g) || []).length;
62
+ console.log(` ✗ TypeScript errors: ${errorCount}`);
63
+ console.log(' Run "npx tsc --noEmit" for details');
64
+ } else {
65
+ console.log(' ✓ TypeScript passed');
66
+ }
67
+ }
68
+ }
69
+
70
+ function identifyChanges() {
71
+ console.log('Identifying changes...');
72
+ try {
73
+ // Check if in git repo
74
+ execSync('git rev-parse --git-dir', { stdio: 'pipe' });
75
+
76
+ // Get changed files
77
+ const staged = execSync('git diff --cached --name-only', { encoding: 'utf-8' }).trim();
78
+ const unstaged = execSync('git diff --name-only', { encoding: 'utf-8' }).trim();
79
+
80
+ const stagedFiles = staged.split('\n').filter(Boolean);
81
+ const unstagedFiles = unstaged.split('\n').filter(Boolean);
82
+
83
+ if (stagedFiles.length > 0) {
84
+ console.log(` Staged files: ${stagedFiles.length}`);
85
+ stagedFiles.slice(0, 5).forEach(f => console.log(` • ${f}`));
86
+ if (stagedFiles.length > 5) {
87
+ console.log(` ... and ${stagedFiles.length - 5} more`);
88
+ }
89
+ }
90
+
91
+ if (unstagedFiles.length > 0) {
92
+ console.log(` Unstaged files: ${unstagedFiles.length}`);
93
+ }
94
+
95
+ if (stagedFiles.length === 0 && unstagedFiles.length === 0) {
96
+ // Check against main branch
97
+ const branchDiff = execSync('git diff main --name-only 2>/dev/null || git diff master --name-only 2>/dev/null || true', {
98
+ encoding: 'utf-8'
99
+ }).trim();
100
+
101
+ const branchFiles = branchDiff.split('\n').filter(Boolean);
102
+ if (branchFiles.length > 0) {
103
+ console.log(` Files changed vs main: ${branchFiles.length}`);
104
+ branchFiles.slice(0, 5).forEach(f => console.log(` • ${f}`));
105
+ if (branchFiles.length > 5) {
106
+ console.log(` ... and ${branchFiles.length - 5} more`);
107
+ }
108
+ }
109
+ }
110
+ } catch {
111
+ console.log(' ℹ Not a git repository or no changes');
112
+ }
113
+ }
114
+
115
+ function runQuickTests() {
116
+ // Only run if tests are fast (< 30s typically)
117
+ if (!existsSync('package.json')) {
118
+ return;
119
+ }
120
+
121
+ console.log('Running quick test check...');
122
+ try {
123
+ // Just check if tests exist and can start
124
+ const result = execSync('npm test -- --listTests 2>&1 || true', {
125
+ encoding: 'utf-8',
126
+ timeout: 10000
127
+ });
128
+
129
+ const testCount = (result.match(/test/gi) || []).length;
130
+ if (testCount > 0) {
131
+ console.log(` ✓ Test suite ready (${testCount} test files)`);
132
+ }
133
+ } catch {
134
+ console.log(' ℹ Tests not configured or timed out');
135
+ }
136
+ }
137
+
138
+ // Run
139
+ main().catch(console.error);
@@ -0,0 +1,81 @@
1
+ {
2
+ "$schema": "https://specialist-agent.dev/schemas/hooks-v1.json",
3
+ "version": "1.0.0",
4
+ "description": "Specialist Agent hooks configuration",
5
+ "hooks": {
6
+ "session-start": {
7
+ "description": "Runs when a new Claude Code session starts",
8
+ "scripts": [
9
+ "./hooks/session-start.mjs"
10
+ ],
11
+ "enabled": true
12
+ },
13
+ "before-plan": {
14
+ "description": "Runs before @planner creates a plan",
15
+ "scripts": [
16
+ "./hooks/before-plan.mjs"
17
+ ],
18
+ "enabled": true
19
+ },
20
+ "after-task": {
21
+ "description": "Runs after each task completes (from @executor)",
22
+ "scripts": [
23
+ "./hooks/after-task.mjs"
24
+ ],
25
+ "enabled": true
26
+ },
27
+ "on-error": {
28
+ "description": "Runs when an agent encounters an error",
29
+ "scripts": [
30
+ "./hooks/on-error.mjs"
31
+ ],
32
+ "enabled": true
33
+ },
34
+ "before-review": {
35
+ "description": "Runs before @reviewer starts review",
36
+ "scripts": [
37
+ "./hooks/before-review.mjs"
38
+ ],
39
+ "enabled": true
40
+ },
41
+ "after-review": {
42
+ "description": "Runs after @reviewer completes review",
43
+ "scripts": [
44
+ "./hooks/after-review.mjs"
45
+ ],
46
+ "enabled": true
47
+ },
48
+ "session-end": {
49
+ "description": "Runs when session ends (if detectable)",
50
+ "scripts": [
51
+ "./hooks/session-end.mjs"
52
+ ],
53
+ "enabled": true
54
+ }
55
+ },
56
+ "metrics": {
57
+ "enabled": true,
58
+ "outputDir": ".claude/metrics",
59
+ "track": {
60
+ "tokens": true,
61
+ "duration": true,
62
+ "agents": true,
63
+ "skills": true,
64
+ "files": true,
65
+ "checkpoints": true
66
+ }
67
+ },
68
+ "notifications": {
69
+ "enabled": false,
70
+ "channels": {
71
+ "slack": {
72
+ "webhook": "",
73
+ "events": ["on-error", "session-end"]
74
+ },
75
+ "discord": {
76
+ "webhook": "",
77
+ "events": ["on-error"]
78
+ }
79
+ }
80
+ }
81
+ }