specialist-agent 2.10.0 → 2.11.1

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 (104) hide show
  1. package/.claude-plugin/marketplace.json +5 -5
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.cursor-plugin/marketplace.json +1 -1
  4. package/.cursor-plugin/plugin.json +2 -2
  5. package/README.md +128 -250
  6. package/agents/analyst.md +1 -0
  7. package/agents/api.md +4 -4
  8. package/agents/architect-lite.md +2 -2
  9. package/agents/architect.md +6 -6
  10. package/agents/cloud-lite.md +1 -1
  11. package/agents/cloud.md +4 -4
  12. package/agents/data-lite.md +1 -1
  13. package/agents/data.md +4 -4
  14. package/agents/debugger.md +1 -0
  15. package/agents/deps.md +4 -4
  16. package/agents/designer-lite.md +1 -1
  17. package/agents/designer.md +4 -4
  18. package/agents/devops-lite.md +1 -1
  19. package/agents/devops.md +4 -4
  20. package/agents/docs.md +4 -4
  21. package/agents/executor.md +95 -0
  22. package/agents/explorer-lite.md +1 -1
  23. package/agents/explorer.md +4 -4
  24. package/agents/finance-lite.md +1 -1
  25. package/agents/finance.md +4 -4
  26. package/agents/i18n.md +4 -4
  27. package/agents/legal-lite.md +1 -1
  28. package/agents/legal.md +4 -4
  29. package/agents/marketing-lite.md +25 -0
  30. package/agents/marketing.md +179 -0
  31. package/agents/memory.md +13 -12
  32. package/agents/orchestrator.md +102 -0
  33. package/agents/pair.md +1 -0
  34. package/agents/perf.md +4 -4
  35. package/agents/planner.md +1 -0
  36. package/agents/product-lite.md +25 -0
  37. package/agents/product.md +186 -0
  38. package/agents/refactor.md +4 -4
  39. package/agents/ripple.md +1 -0
  40. package/agents/scout.md +1 -0
  41. package/agents/security-lite.md +1 -1
  42. package/agents/security.md +4 -4
  43. package/agents/sentry-triage-lite.md +54 -0
  44. package/agents/sentry-triage.md +214 -0
  45. package/agents/starter-lite.md +4 -4
  46. package/agents/starter.md +8 -8
  47. package/agents/support-lite.md +24 -0
  48. package/agents/support.md +190 -0
  49. package/agents/tdd.md +1 -0
  50. package/agents/tester-lite.md +1 -1
  51. package/agents/tester.md +43 -10
  52. package/cli/index.mjs +466 -343
  53. package/hooks/native/auto-dispatch.mjs +19 -26
  54. package/hooks/native/auto-format.mjs +5 -25
  55. package/hooks/native/mcp-discovery.mjs +168 -0
  56. package/hooks/native/security-config.json +4 -0
  57. package/hooks/native/security-guard.mjs +37 -24
  58. package/hooks/native/session-context.mjs +61 -18
  59. package/hooks/native/settings-template.json +9 -0
  60. package/package.json +1 -1
  61. package/packs/angular/agents/builder.md +10 -54
  62. package/packs/angular/agents/doctor.md +7 -61
  63. package/packs/angular/agents/migrator.md +7 -101
  64. package/packs/angular/agents/reviewer.md +22 -33
  65. package/packs/angular/skills/review-check-architecture/SKILL.md +7 -7
  66. package/packs/angular/skills/review-review/SKILL.md +1 -0
  67. package/packs/astro/agents/builder.md +10 -79
  68. package/packs/astro/agents/doctor.md +7 -61
  69. package/packs/astro/agents/migrator.md +7 -111
  70. package/packs/astro/agents/reviewer.md +22 -32
  71. package/packs/astro/skills/review-check-architecture/SKILL.md +9 -9
  72. package/packs/astro/skills/review-review/SKILL.md +1 -0
  73. package/packs/nextjs/agents/builder.md +11 -108
  74. package/packs/nextjs/agents/doctor.md +7 -62
  75. package/packs/nextjs/agents/migrator.md +6 -194
  76. package/packs/nextjs/agents/reviewer.md +22 -76
  77. package/packs/nextjs/skills/review-check-architecture/SKILL.md +15 -15
  78. package/packs/nextjs/skills/review-review/SKILL.md +1 -0
  79. package/packs/nuxt/agents/builder.md +10 -55
  80. package/packs/nuxt/agents/doctor.md +7 -61
  81. package/packs/nuxt/agents/migrator.md +7 -109
  82. package/packs/nuxt/agents/reviewer.md +22 -42
  83. package/packs/nuxt/skills/review-check-architecture/SKILL.md +11 -11
  84. package/packs/nuxt/skills/review-review/SKILL.md +1 -0
  85. package/packs/react/agents/builder.md +10 -55
  86. package/packs/react/agents/doctor.md +7 -61
  87. package/packs/react/agents/migrator.md +7 -106
  88. package/packs/react/agents/reviewer.md +22 -55
  89. package/packs/react/skills/review-check-architecture/SKILL.md +10 -10
  90. package/packs/react/skills/review-review/SKILL.md +1 -0
  91. package/packs/svelte/agents/builder.md +10 -58
  92. package/packs/svelte/agents/doctor.md +7 -60
  93. package/packs/svelte/agents/migrator.md +7 -118
  94. package/packs/svelte/agents/reviewer.md +22 -42
  95. package/packs/svelte/skills/review-check-architecture/SKILL.md +12 -12
  96. package/packs/svelte/skills/review-review/SKILL.md +1 -0
  97. package/packs/vue/agents/builder.md +10 -55
  98. package/packs/vue/agents/doctor.md +7 -61
  99. package/packs/vue/agents/migrator.md +7 -93
  100. package/packs/vue/agents/reviewer.md +20 -32
  101. package/packs/vue/skills/review-check-architecture/SKILL.md +10 -10
  102. package/packs/vue/skills/review-review/SKILL.md +1 -0
  103. package/skills/autofix/SKILL.md +166 -0
  104. package/skills/discovery/SKILL.md +218 -0
@@ -13,6 +13,7 @@
13
13
 
14
14
  import { resolve } from 'path';
15
15
  import { fileURLToPath } from 'url';
16
+ import { readStdin, outputJson } from './utils.mjs';
16
17
 
17
18
  const __filename = fileURLToPath(import.meta.url);
18
19
 
@@ -53,6 +54,14 @@ const INTENT_MAP = {
53
54
  designer: { phrases: ['design system', 'component library', 'accessibility audit'], keywords: ['design system', 'accessibility', 'a11y', 'ui library', 'theme'], weight: 1.5 },
54
55
  tester: { phrases: ['test strategy', 'test coverage', 'e2e tests', 'testing plan'], keywords: ['test strategy', 'coverage', 'e2e', 'testing'], weight: 1 },
55
56
 
57
+ // Business agents
58
+ marketing: { phrases: ['landing page', 'marketing copy', 'seo optimization', 'growth strategy', 'social media'], keywords: ['marketing', 'seo', 'copy', 'landing', 'growth', 'conversion', 'funnel'], weight: 1.5 },
59
+ product: { phrases: ['product strategy', 'user story', 'product roadmap', 'feature prioritization', 'product requirement'], keywords: ['product', 'roadmap', 'prd', 'user story', 'prioritization', 'backlog'], weight: 1.5 },
60
+ support: { phrases: ['knowledge base', 'runbook', 'changelog', 'support docs', 'faq'], keywords: ['support', 'runbook', 'changelog', 'faq', 'knowledge base', 'help docs'], weight: 1.5 },
61
+
62
+ // Automation agents
63
+ 'sentry-triage': { phrases: ['sentry error', 'triage errors', 'sentry issue', 'error triage', 'fix sentry'], keywords: ['sentry', 'triage', 'error tracking', 'alert'], weight: 2 },
64
+
56
65
  // Support agents
57
66
  scout: { phrases: ['analyze project', 'project analysis', 'quick scan'], keywords: ['analyze', 'scan', 'overview', 'analysis'], weight: 1 },
58
67
  explorer: { phrases: ['explore codebase', 'understand code', 'how does this work'], keywords: ['explore', 'understand', 'codebase', 'how does'], weight: 1 },
@@ -94,6 +103,10 @@ const AGENT_DESCRIPTIONS = {
94
103
  memory: 'saves and recalls decisions across sessions',
95
104
  architect: 'designs and migrates full system architecture (hexagonal, DDD, CQRS, microservices)',
96
105
  ripple: 'analyzes cascading impact of changes across the codebase',
106
+ marketing: 'creates landing pages, marketing copy, SEO optimization, and growth strategies',
107
+ product: 'defines product strategy, user stories, roadmaps, and feature prioritization',
108
+ support: 'generates knowledge base articles, runbooks, changelogs, and FAQs',
109
+ 'sentry-triage': 'triages Sentry errors, prioritizes by impact, and auto-creates fix PRs',
97
110
  };
98
111
 
99
112
  // ── Intent Matching Engine (exported for testing) ───────────
@@ -158,24 +171,7 @@ export function matchIntent(prompt) {
158
171
  // ── Main Execution ──────────────────────────────────────────
159
172
 
160
173
  async function main() {
161
- let input = null;
162
-
163
- try {
164
- const data = await new Promise((resolve) => {
165
- let buf = '';
166
- const timeout = setTimeout(() => resolve(buf), 3000);
167
- process.stdin.setEncoding('utf-8');
168
- process.stdin.on('data', (chunk) => { buf += chunk; });
169
- process.stdin.on('end', () => { clearTimeout(timeout); resolve(buf); });
170
- process.stdin.on('error', () => { clearTimeout(timeout); resolve(''); });
171
- process.stdin.resume();
172
- });
173
-
174
- input = data ? JSON.parse(data) : null;
175
- } catch {
176
- // Can't parse input - silently allow (this hook is advisory, not blocking)
177
- process.exit(0);
178
- }
174
+ const input = await readStdin();
179
175
 
180
176
  const prompt = input?.prompt || '';
181
177
 
@@ -186,16 +182,13 @@ async function main() {
186
182
  const match = matchIntent(prompt);
187
183
 
188
184
  if (match) {
189
- const output = {
185
+ outputJson({
190
186
  additionalContext: `Specialist Agent suggests: @${match.agent} — ${match.description}. Mention @${match.agent} in your prompt to activate it. Agents provide domain expertise, structured workflows, and verification — always prefer them over generic prompts.`,
191
- };
192
- process.stdout.write(JSON.stringify(output));
187
+ });
193
188
  } else {
194
- // Reinforce agent usage even when no specific match is found
195
- const output = {
196
- additionalContext: 'Tip: Specialist Agent has 27+ agents for this project. Use @builder to create, @reviewer to review, @doctor to debug, @planner to plan, @tdd for test-driven development. Agents deliver better results than generic prompts.',
197
- };
198
- process.stdout.write(JSON.stringify(output));
189
+ outputJson({
190
+ additionalContext: 'Tip: Specialist Agent has 35 agents for this project. Use @builder to create, @reviewer to review, @doctor to debug, @planner to plan, @tdd for test-driven development. Agents deliver better results than generic prompts.',
191
+ });
199
192
  }
200
193
 
201
194
  process.exit(0);
@@ -14,8 +14,9 @@
14
14
 
15
15
  import { execFileSync } from 'child_process';
16
16
  import { existsSync } from 'fs';
17
- import { resolve, extname, normalize, join, relative, isAbsolute } from 'path';
17
+ import { resolve, extname, join, relative, isAbsolute } from 'path';
18
18
  import { fileURLToPath } from 'url';
19
+ import { readStdin, readJsonFile } from './utils.mjs';
19
20
 
20
21
  const __filename = fileURLToPath(import.meta.url);
21
22
 
@@ -64,12 +65,8 @@ export function detectFormatter(cwd) {
64
65
  }
65
66
 
66
67
  // Check package.json for prettier key
67
- try {
68
- const pkg = JSON.parse(require('fs').readFileSync(join(cwd, 'package.json'), 'utf-8'));
69
- if (pkg.prettier) return 'prettier';
70
- } catch {
71
- // ignore
72
- }
68
+ const pkg = readJsonFile(join(cwd, 'package.json'));
69
+ if (pkg?.prettier) return 'prettier';
73
70
 
74
71
  // Check biome
75
72
  for (const config of BIOME_CONFIGS) {
@@ -139,24 +136,7 @@ export function formatFile(filePath, formatter, cwd) {
139
136
  // ── Main Execution ──────────────────────────────────────────
140
137
 
141
138
  async function main() {
142
- let input = null;
143
-
144
- try {
145
- const data = await new Promise((resolve) => {
146
- let buf = '';
147
- const timeout = setTimeout(() => resolve(buf), 3000);
148
- process.stdin.setEncoding('utf-8');
149
- process.stdin.on('data', (chunk) => { buf += chunk; });
150
- process.stdin.on('end', () => { clearTimeout(timeout); resolve(buf); });
151
- process.stdin.on('error', () => { clearTimeout(timeout); resolve(''); });
152
- process.stdin.resume();
153
- });
154
-
155
- input = data ? JSON.parse(data) : null;
156
- } catch {
157
- process.exit(0);
158
- }
159
-
139
+ const input = await readStdin();
160
140
  const filePath = input?.tool_input?.file_path;
161
141
 
162
142
  if (!filePath) {
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * MCP Discovery - SessionStart Hook
5
+ *
6
+ * Detects configured MCP servers and injects availability context
7
+ * so agents know which external tools they can leverage.
8
+ * All operations are read-only. Errors are silently ignored.
9
+ *
10
+ * Claude Code event: SessionStart
11
+ * Output: { "additionalContext": "MCP availability summary..." }
12
+ */
13
+
14
+ import { join, resolve } from 'path';
15
+ import { fileURLToPath } from 'url';
16
+ import { outputJson, readJsonFile } from './utils.mjs';
17
+
18
+ const __filename = fileURLToPath(import.meta.url);
19
+
20
+ // ── MCP Registry ────────────────────────────────────────────
21
+ // Maps MCP server names to the agents/skills that benefit from them.
22
+
23
+ const MCP_AGENT_MAP = {
24
+ context7: {
25
+ description: 'Library documentation lookups',
26
+ agents: ['@builder', '@doctor', '@migrator', '@deps'],
27
+ skills: ['/tdd', '/debug'],
28
+ hint: 'Agents can fetch up-to-date API docs instead of relying on training data.',
29
+ },
30
+ azion: {
31
+ description: 'Edge deployment & configuration',
32
+ agents: ['@starter', '@cloud'],
33
+ skills: [],
34
+ hint: 'Enables edge deploy, Rules Engine config generation, and Terraform resources.',
35
+ },
36
+ playwright: {
37
+ description: 'Browser automation & testing',
38
+ agents: ['@tester', '@doctor', '@debugger', '@perf'],
39
+ skills: ['/verify', '/debug'],
40
+ hint: 'Agents can interact with the browser — take screenshots, run e2e tests, inspect DOM.',
41
+ },
42
+ github: {
43
+ description: 'GitHub issues, PRs & CI',
44
+ agents: ['@sentry-triage', '@reviewer', '@ripple', '@deps', '@devops'],
45
+ skills: ['/autofix', '/finish', '/codereview'],
46
+ hint: 'Agents can create issues/PRs, read CI status, and manage releases.',
47
+ },
48
+ sentry: {
49
+ description: 'Error tracking & triage',
50
+ agents: ['@sentry-triage', '@doctor', '@debugger'],
51
+ skills: ['/autofix', '/debug'],
52
+ hint: 'Agents can fetch Sentry errors directly instead of requiring CLI or curl.',
53
+ },
54
+ linear: {
55
+ description: 'Issue tracking & project management',
56
+ agents: ['@planner', '@analyst', '@product', '@orchestrator'],
57
+ skills: ['/plan'],
58
+ hint: 'Agents can read/create Linear issues and link tasks to code changes.',
59
+ },
60
+ jira: {
61
+ description: 'Issue tracking & project management',
62
+ agents: ['@planner', '@analyst', '@product', '@orchestrator'],
63
+ skills: ['/plan'],
64
+ hint: 'Agents can read/create Jira issues and link tasks to code changes.',
65
+ },
66
+ supabase: {
67
+ description: 'Database & auth management',
68
+ agents: ['@data', '@builder', '@security'],
69
+ skills: [],
70
+ hint: 'Agents can read schemas, manage migrations, and configure auth rules.',
71
+ },
72
+ postgres: {
73
+ description: 'PostgreSQL database access',
74
+ agents: ['@data', '@builder'],
75
+ skills: [],
76
+ hint: 'Agents can read live schemas and validate queries.',
77
+ },
78
+ slack: {
79
+ description: 'Team notifications',
80
+ agents: ['@orchestrator', '@support'],
81
+ skills: ['/finish'],
82
+ hint: 'Agents can send notifications on review completion, deploys, and errors.',
83
+ },
84
+ filesystem: {
85
+ description: 'Extended file system access',
86
+ agents: ['@explorer', '@scout'],
87
+ skills: ['/onboard'],
88
+ hint: 'Extended file system capabilities for deep codebase exploration.',
89
+ },
90
+ };
91
+
92
+ // ── Discovery Logic (exported for testing) ──────────────────
93
+
94
+ /**
95
+ * Discover configured MCP servers and map them to agent capabilities.
96
+ * @param {string} cwd - Project root directory
97
+ * @returns {{ configured: string[], agentCapabilities: Record<string, string[]>, suggestions: string[] }}
98
+ */
99
+ export function discoverMCPs(cwd) {
100
+ const mcpConfig = readJsonFile(join(cwd, '.mcp.json'));
101
+ const configured = mcpConfig?.mcpServers ? Object.keys(mcpConfig.mcpServers) : [];
102
+
103
+ // Map configured MCPs to agent capabilities
104
+ const agentCapabilities = {};
105
+ for (const mcpName of configured) {
106
+ const mapping = MCP_AGENT_MAP[mcpName];
107
+ if (!mapping) continue;
108
+
109
+ for (const agent of mapping.agents) {
110
+ if (!agentCapabilities[agent]) agentCapabilities[agent] = [];
111
+ agentCapabilities[agent].push(mcpName);
112
+ }
113
+ }
114
+
115
+ // Suggest MCPs that would benefit current agents but aren't configured
116
+ const suggestions = [];
117
+ for (const [mcpName, mapping] of Object.entries(MCP_AGENT_MAP)) {
118
+ if (configured.includes(mcpName)) continue;
119
+ // Only suggest if user has relevant agents installed
120
+ suggestions.push(`${mcpName}: ${mapping.description} → benefits ${mapping.agents.join(', ')}`);
121
+ }
122
+
123
+ return { configured, agentCapabilities, suggestions };
124
+ }
125
+
126
+ /**
127
+ * Build MCP context string for session injection.
128
+ * @param {string} cwd - Project root directory
129
+ * @returns {string} MCP context or empty string
130
+ */
131
+ export function buildMCPContext(cwd) {
132
+ const { configured, agentCapabilities } = discoverMCPs(cwd);
133
+
134
+ if (configured.length === 0) return '';
135
+
136
+ const parts = [`MCPs available: ${configured.join(', ')}`];
137
+
138
+ // Add agent-specific hints
139
+ const enhancedAgents = Object.entries(agentCapabilities)
140
+ .map(([agent, mcps]) => `${agent}(+${mcps.join(',')})`)
141
+ .join(' ');
142
+
143
+ if (enhancedAgents) {
144
+ parts.push(`Enhanced agents: ${enhancedAgents}`);
145
+ }
146
+
147
+ return parts.join(' | ');
148
+ }
149
+
150
+ // ── Main Execution ──────────────────────────────────────────
151
+
152
+ async function main() {
153
+ const cwd = process.cwd();
154
+ const context = buildMCPContext(cwd);
155
+
156
+ if (context) {
157
+ outputJson({ additionalContext: `[MCP Discovery] ${context}` });
158
+ }
159
+
160
+ process.exit(0);
161
+ }
162
+
163
+ if (process.argv[1] && resolve(process.argv[1]) === resolve(__filename)) {
164
+ main().catch(() => {
165
+ // Advisory hook - never block on error
166
+ process.exit(0);
167
+ });
168
+ }
@@ -12,6 +12,10 @@
12
12
  "sql-destructive": { "enabled": true, "severity": "HIGH" },
13
13
  "pipe-to-shell": { "enabled": true, "severity": "HIGH" },
14
14
  "chmod-777": { "enabled": true, "severity": "HIGH" },
15
+ "git-branch-force-delete": { "enabled": true, "severity": "HIGH" },
16
+ "npm-publish-no-dry-run": { "enabled": true, "severity": "HIGH" },
17
+ "docker-system-prune": { "enabled": true, "severity": "HIGH" },
18
+ "kubectl-delete-namespace": { "enabled": true, "severity": "HIGH" },
15
19
  "env-file-read": { "enabled": true, "severity": "MEDIUM" },
16
20
  "ssh-key-access": { "enabled": true, "severity": "MEDIUM" },
17
21
  "aws-credentials": { "enabled": true, "severity": "MEDIUM" },
@@ -12,9 +12,9 @@
12
12
  * Allow: exit 0 (silent)
13
13
  */
14
14
 
15
- import { readFileSync } from 'fs';
16
- import { join, dirname, resolve } from 'path';
15
+ import { dirname, resolve } from 'path';
17
16
  import { fileURLToPath } from 'url';
17
+ import { readStdin, readJsonFile } from './utils.mjs';
18
18
 
19
19
  const __filename = fileURLToPath(import.meta.url);
20
20
  const __dirname = dirname(__filename);
@@ -123,6 +123,37 @@ const RULES = [
123
123
  test: (cmd) => /\bchmod\b.*\b777\b/.test(cmd),
124
124
  message: 'BLOCKED [HIGH]: chmod 777 makes files world-readable/writable/executable.\nUse specific permissions instead: chmod 755 (directories), chmod 644 (files), chmod 600 (secrets).'
125
125
  },
126
+ {
127
+ id: 'git-branch-force-delete',
128
+ severity: 'HIGH',
129
+ test: (cmd) => {
130
+ if (!/\bgit\s+branch\b/.test(cmd)) return false;
131
+ return /-D\b/.test(cmd);
132
+ },
133
+ message: 'BLOCKED [HIGH]: git branch -D force-deletes a branch even if not fully merged.\nUse git branch -d (lowercase) for safe deletion — it warns if the branch has unmerged changes.'
134
+ },
135
+ {
136
+ id: 'npm-publish-no-dry-run',
137
+ severity: 'HIGH',
138
+ test: (cmd) => {
139
+ if (!/\bnpm\s+publish\b/.test(cmd)) return false;
140
+ if (/--dry-run/.test(cmd)) return false;
141
+ return true;
142
+ },
143
+ message: 'BLOCKED [HIGH]: npm publish without --dry-run detected.\nPublishing to npm is irreversible (versions cannot be overwritten).\nRun with --dry-run first to verify, then publish manually in your terminal.'
144
+ },
145
+ {
146
+ id: 'docker-system-prune',
147
+ severity: 'HIGH',
148
+ test: (cmd) => /\bdocker\s+system\s+prune\b/.test(cmd) && /-a\b/.test(cmd),
149
+ message: 'BLOCKED [HIGH]: docker system prune -a removes ALL unused images, containers, networks, and volumes.\nUse targeted cleanup: docker image prune, docker container prune, or docker volume prune.'
150
+ },
151
+ {
152
+ id: 'kubectl-delete-namespace',
153
+ severity: 'HIGH',
154
+ test: (cmd) => /\bkubectl\s+delete\s+(namespace|ns)\b/.test(cmd),
155
+ message: 'BLOCKED [HIGH]: kubectl delete namespace destroys ALL resources within the namespace.\nThis is a cascading delete that removes deployments, services, pods, secrets, and more.\nVerify the namespace and run this command manually in your terminal.'
156
+ },
126
157
 
127
158
  // MEDIUM - block access to sensitive files
128
159
  {
@@ -248,22 +279,9 @@ export function evaluateCommand(command, config = {}) {
248
279
  // ── Main Execution ──────────────────────────────────────────
249
280
 
250
281
  async function main() {
251
- let input = null;
252
-
253
- try {
254
- // Read stdin
255
- const data = await new Promise((resolve) => {
256
- let buf = '';
257
- const timeout = setTimeout(() => resolve(buf), 3000);
258
- process.stdin.setEncoding('utf-8');
259
- process.stdin.on('data', (chunk) => { buf += chunk; });
260
- process.stdin.on('end', () => { clearTimeout(timeout); resolve(buf); });
261
- process.stdin.on('error', () => { clearTimeout(timeout); resolve(''); });
262
- process.stdin.resume();
263
- });
282
+ const input = await readStdin();
264
283
 
265
- input = data ? JSON.parse(data) : null;
266
- } catch {
284
+ if (!input) {
267
285
  // Fail-closed: if we can't parse input, block
268
286
  process.stderr.write('Security Guard: Failed to parse input. Blocking as precaution.');
269
287
  process.exit(2);
@@ -277,13 +295,8 @@ async function main() {
277
295
  const command = input.tool_input.command;
278
296
 
279
297
  // Load config
280
- let config = {};
281
- try {
282
- const configPath = join(__dirname, 'security-config.json');
283
- config = JSON.parse(readFileSync(configPath, 'utf-8'));
284
- } catch {
285
- // No config = use defaults (all rules enabled)
286
- }
298
+ const configPath = resolve(__dirname, 'security-config.json');
299
+ const config = readJsonFile(configPath) || {};
287
300
 
288
301
  if (config.enabled === false) {
289
302
  process.exit(0);
@@ -11,9 +11,10 @@
11
11
  */
12
12
 
13
13
  import { execSync } from 'child_process';
14
- import { readFileSync, readdirSync, existsSync } from 'fs';
14
+ import { readdirSync, existsSync } from 'fs';
15
15
  import { join, resolve } from 'path';
16
16
  import { fileURLToPath } from 'url';
17
+ import { outputJson, readJsonFile } from './utils.mjs';
17
18
 
18
19
  const __filename = fileURLToPath(import.meta.url);
19
20
 
@@ -52,25 +53,49 @@ function getSkillCount(cwd) {
52
53
  }
53
54
 
54
55
  function getMemoryDecisions(cwd) {
55
- try {
56
- const memoryPath = join(cwd, '.claude', 'session-memory.json');
57
- if (!existsSync(memoryPath)) return 0;
58
- const memory = JSON.parse(readFileSync(memoryPath, 'utf-8'));
59
- return Array.isArray(memory.decisions) ? memory.decisions.length : 0;
60
- } catch {
61
- return 0;
62
- }
56
+ const memoryPath = join(cwd, '.claude', 'session-memory.json');
57
+ const memory = readJsonFile(memoryPath);
58
+ if (!memory) return 0;
59
+ return Array.isArray(memory.decisions) ? memory.decisions.length : 0;
63
60
  }
64
61
 
65
62
  function getActiveProfile(cwd) {
66
- try {
67
- const configPath = join(cwd, '.claude', 'config.json');
68
- if (!existsSync(configPath)) return null;
69
- const config = JSON.parse(readFileSync(configPath, 'utf-8'));
70
- return config.profile || null;
71
- } catch {
72
- return null;
73
- }
63
+ const configPath = join(cwd, '.claude', 'config.json');
64
+ const config = readJsonFile(configPath);
65
+ return config?.profile || null;
66
+ }
67
+
68
+ function detectFramework(cwd) {
69
+ const pkg = readJsonFile(join(cwd, 'package.json'));
70
+ if (!pkg) return null;
71
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
72
+ if (deps['nuxt']) return 'Nuxt';
73
+ if (deps['next']) return 'Next.js';
74
+ if (deps['@sveltejs/kit']) return 'SvelteKit';
75
+ if (deps['@angular/core']) return 'Angular';
76
+ if (deps['astro']) return 'Astro';
77
+ if (deps['vue']) return 'Vue';
78
+ if (deps['react']) return 'React';
79
+ return null;
80
+ }
81
+
82
+ function detectProjectFeatures(cwd) {
83
+ const features = [];
84
+ const pkg = readJsonFile(join(cwd, 'package.json'));
85
+ const deps = { ...pkg?.dependencies, ...pkg?.devDependencies };
86
+
87
+ if (existsSync(join(cwd, 'tsconfig.json'))) features.push('TypeScript');
88
+ if (deps?.['vitest'] || deps?.['jest'] || deps?.['mocha']) features.push('Tests');
89
+ if (existsSync(join(cwd, 'docs', 'ARCHITECTURE.md')) || existsSync(join(cwd, 'ARCHITECTURE.md'))) features.push('ARCHITECTURE.md');
90
+ if (existsSync(join(cwd, '.mcp.json'))) features.push('MCP configured');
91
+
92
+ return features;
93
+ }
94
+
95
+ function getAvailableMCPs(cwd) {
96
+ const mcpConfig = readJsonFile(join(cwd, '.mcp.json'));
97
+ if (!mcpConfig?.mcpServers) return [];
98
+ return Object.keys(mcpConfig.mcpServers);
74
99
  }
75
100
 
76
101
  // ── Context Builder (exported for testing) ──────────────────
@@ -93,6 +118,18 @@ export function buildContext(cwd) {
93
118
  parts.push(`Last commit: ${git.lastCommit}`);
94
119
  }
95
120
 
121
+ // Framework
122
+ const framework = detectFramework(cwd);
123
+ if (framework) {
124
+ parts.push(`Framework: ${framework}`);
125
+ }
126
+
127
+ // Project features
128
+ const features = detectProjectFeatures(cwd);
129
+ if (features.length > 0) {
130
+ parts.push(`Features: ${features.join(', ')}`);
131
+ }
132
+
96
133
  // Agents & skills
97
134
  const agents = getAgentCount(cwd);
98
135
  const skills = getSkillCount(cwd);
@@ -100,6 +137,12 @@ export function buildContext(cwd) {
100
137
  parts.push(`Installed: ${agents} agents, ${skills} skills`);
101
138
  }
102
139
 
140
+ // MCPs
141
+ const mcps = getAvailableMCPs(cwd);
142
+ if (mcps.length > 0) {
143
+ parts.push(`MCPs: ${mcps.join(', ')}`);
144
+ }
145
+
103
146
  // Memory
104
147
  const decisions = getMemoryDecisions(cwd);
105
148
  if (decisions > 0) {
@@ -122,7 +165,7 @@ async function main() {
122
165
  const context = buildContext(cwd);
123
166
 
124
167
  if (context) {
125
- process.stdout.write(JSON.stringify({ additionalContext: context }));
168
+ outputJson({ additionalContext: context });
126
169
  }
127
170
 
128
171
  process.exit(0);
@@ -32,6 +32,15 @@
32
32
  "timeout": 10
33
33
  }
34
34
  ]
35
+ },
36
+ {
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "node .specialist-agent/hooks/native/mcp-discovery.mjs",
41
+ "timeout": 5
42
+ }
43
+ ]
35
44
  }
36
45
  ],
37
46
  "PostToolUse": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specialist-agent",
3
- "version": "2.10.0",
3
+ "version": "2.11.1",
4
4
  "type": "module",
5
5
  "description": "AI agents for Claude Code — any framework, any stack",
6
6
  "bin": {
@@ -14,28 +14,11 @@ Read `docs/ARCHITECTURE.md`.
14
14
 
15
15
  ## Core Principles
16
16
 
17
- ### Security First (Mandatory)
18
- - NEVER trust user input - validate and sanitize ALL inputs on server side
19
- - ALWAYS use parameterized queries - never string concatenation for SQL/NoSQL
20
- - NEVER expose sensitive data (tokens, passwords, PII) in logs, URLs, or error messages
21
- - ALWAYS implement rate limiting on public endpoints
22
- - Use HTTPS everywhere, set secure headers (CSP, HSTS, X-Frame-Options)
23
- - Follow OWASP Top 10 - prevent XSS, CSRF, injection, broken auth, etc.
24
- - Secrets in environment variables only - never hardcode
25
-
26
- ### Performance First (Mandatory)
27
- - ALWAYS use OnPush change detection for components
28
- - Use Angular Signals (signal, computed, effect) for reactive state
29
- - Lazy load routes and feature modules
30
- - Use trackBy with @for to minimize DOM operations
31
- - Avoid unnecessary subscriptions - prefer signals over RxJS where possible
32
- - Use HttpClient with proper typing - no inline transformations
33
- - Avoid N+1 queries - batch requests, use proper data loading patterns
34
-
35
- ### Code Language (Mandatory)
36
- - ALWAYS write code (variables, functions, comments, commits) in English
37
- - Only use other languages if explicitly requested by the user
38
- - User-facing text (UI labels, messages) should match project's i18n strategy
17
+ Refer to the pack CLAUDE.md for full stack details and key patterns.
18
+
19
+ - **Security**: Validate all inputs server-side, parameterized queries only, no secrets in code, OWASP Top 10
20
+ - **Performance**: Use the framework's recommended server state caching, lazy load routes and components, no N+1 queries
21
+ - **Code Language**: All code in English. User-facing text follows project i18n strategy
39
22
 
40
23
  ## Scope Detection
41
24
  - **Module**: user wants a full feature (CRUD, page, multiple endpoints) -> Module mode
@@ -47,46 +30,19 @@ Read `docs/ARCHITECTURE.md`.
47
30
  ---
48
31
 
49
32
  ## Module Mode
50
- 1. Ask: resource name, endpoints, UI type (list/detail/CRUD), client state needs
51
- 2. Scaffold `src/modules/[kebab-name]/` with: components/, services/, adapters/, stores/, types/, pages/, __tests__/, index.ts
52
- 3. Create bottom-up:
53
- - `types/[name].types.ts` -- exact API response (snake_case)
54
- - `types/[name].contracts.ts` -- app contract (camelCase, Date objects)
55
- - `adapters/[name].adapter.ts` -- pure functions: inbound (API->App) + outbound (App->API)
56
- - `services/[name].service.ts` -- HttpClient only: `list, getById, create, update, delete`. No try/catch, no transformation. inject(HttpClient)
57
- - `stores/[name].store.ts` -- client state only (filters, UI). Signal-based, private WritableSignal, public asReadonly()
58
- - Components -- standalone, input()/output() signals, OnPush, < 200 lines
59
- - Page -- compose components with content projection, provide context
60
- 4. Register lazy route in app.routes.ts using loadComponent
61
- 5. Create barrel export (index.ts): pages + contracts only
62
- 6. Validate: `npx tsc --noEmit`
33
+ Run `/dev-create-module $NAME`. This skill contains the full scaffold workflow -- do NOT duplicate it here.
63
34
 
64
35
  ## Component Mode
65
- 1. Determine placement: feature -> `src/modules/[feature]/components/`, shared -> `src/shared/components/`
66
- 2. Use standalone component template: @Component decorator -> class with inject() -> input()/output() signals -> local signals -> computed -> handlers
67
- 3. Rules: < 200 lines, kebab-case.component.ts, no prop drilling (use content projection + shared injectable), handle loading/error/empty states, OnPush change detection
68
- 4. Extract logic > 20 lines to a service or injectable
36
+ Run `/dev-create-component $NAME`. This skill contains the full scaffold workflow -- do NOT duplicate it here.
69
37
 
70
38
  ## Service Mode
71
- 1. Ask: endpoint URL, HTTP method, response format (ask for JSON example)
72
- 2. Create 4 files:
73
- - `types/[name].types.ts` -- exact API (snake_case, string dates)
74
- - `types/[name].contracts.ts` -- app contract (camelCase, Date, computed booleans)
75
- - `adapters/[name].adapter.ts` -- pure functions, bidirectional. Rename snake->camel, convert string->Date, cents->currency
76
- - `services/[name].service.ts` -- HttpClient only. No try/catch, no transformation, no logic. inject(HttpClient), @Injectable({ providedIn: 'root' })
77
- 3. Validate: `npx tsc --noEmit`
39
+ Run `/dev-create-service $NAME`. This skill contains the full scaffold workflow -- do NOT duplicate it here.
78
40
 
79
41
  ## Injectable Mode
80
- 1. **Signal store** (client state): @Injectable with private WritableSignal, public asReadonly(), computed for derived. Actions as methods that call .set() or .update()
81
- 2. **Utility service** (shared logic, no UI): @Injectable with inject() for deps, typed methods
82
- 3. **Data orchestrator** (API + adapter): @Injectable that injects Service, applies adapter, exposes data via signals or Observables
83
- 4. Rules: @Injectable({ providedIn: 'root' }) or scoped to component, inject() for all deps, no constructor DI
42
+ Run `/dev-create-injectable $NAME`. This skill contains the full scaffold workflow -- do NOT duplicate it here.
84
43
 
85
44
  ## Test Mode
86
- 1. Read the target file
87
- 2. Priority: adapters (pure functions, easy) > services (mock HttpClient, HttpClientTestingModule) > components (Angular Testing Library)
88
- 3. Create in `__tests__/[original-name].spec.ts`
89
- 4. Run: `npx jest --testPathPattern=[file]` or `npx vitest run [file]`
45
+ Run `/dev-create-test $NAME`. This skill contains the full scaffold workflow -- do NOT duplicate it here.
90
46
 
91
47
  ## Verification Protocol
92
48