@zelari/core 0.7.10 → 0.7.12

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.
@@ -1,17 +1,17 @@
1
1
  import { registerCodingSkill } from '../../skills.js';
2
- const CLARIFICATION_PROTOCOL = `
3
-
4
- WHEN TO ASK THE USER (clarification):
5
- If a single missing fact would materially change your output (target platform, scope, a binary design choice with significant trade-offs, a constraint you cannot safely assume), pause and ask the user by appending EXACTLY this block at the end of your message:
6
-
7
- ---QUESTION---
8
- { "question": "One focused question", "choices": ["Option A", "Option B", "Option C"], "context": "Why this matters" }
9
- ---END---
10
-
11
- Rules for clarifications:
12
- - Ask AT MOST ONE question per turn, and only when genuinely blocked.
13
- - Prefer a small set of concrete "choices" (2-4). The user can still type a custom answer.
14
- - Do NOT ask for information that could be reasonably assumed or already in shared context.
2
+ const CLARIFICATION_PROTOCOL = `
3
+
4
+ WHEN TO ASK THE USER (clarification):
5
+ If a single missing fact would materially change your output (target platform, scope, a binary design choice with significant trade-offs, a constraint you cannot safely assume), pause and ask the user by appending EXACTLY this block at the end of your message:
6
+
7
+ ---QUESTION---
8
+ { "question": "One focused question", "choices": ["Option A", "Option B", "Option C"], "context": "Why this matters" }
9
+ ---END---
10
+
11
+ Rules for clarifications:
12
+ - Ask AT MOST ONE question per turn, and only when genuinely blocked.
13
+ - Prefer a small set of concrete "choices" (2-4). The user can still type a custom answer.
14
+ - Do NOT ask for information that could be reasonably assumed or already in shared context.
15
15
  - If you can proceed with a sound documented assumption, DO SO instead of asking.`;
16
16
  const extractReusable = {
17
17
  id: 'extract-reusable',
@@ -74,27 +74,27 @@ const extractReusable = {
74
74
  },
75
75
  ],
76
76
  outputSchema: '{ duplication: { callSites: Array<{ file: string; function: string; line: number }>; differences: string[] }; proposedModule: { path: string; api: string; variants: Array<{ style: string; example: string }> }; migration: Array<{ step: string; linesToChange: number }>; benefits: string[] }',
77
- systemPromptFragment: `You are finding duplicated logic and extracting a reusable module.
78
-
79
- ## Methodology
80
- 1. Use grep/semantic search to find candidate duplication (3+ similar implementations).
81
- 2. Read each call site to understand the VARIATIONS (not just the common pattern).
82
- 3. Design an API that accommodates ALL variations (use options pattern, not multiple functions).
83
- 4. Specify the new module path + function signature + behavior table.
84
- 5. List migration steps: which file + which lines change to use the new module.
85
-
86
- ## Extraction principles
87
- - **Variations via options, not forks**: prefer formatDuration(ms, opts) over formatDurationCompact()/Full()
88
- - **Pure functions**: extracted modules should have no hidden state, no I/O
89
- - **Tests first**: write the test suite for the new module BEFORE migrating call sites
90
- - **Single responsibility**: extracted module does ONE thing well
91
-
92
- ## Output format (JSON-typed)
93
- - duplication: { callSites: [{file, function, line}], differences[] }
94
- - proposedModule: { path, api (TS signature), variants: [{style, example}] }
95
- - migration: [{step, linesToChange}]
96
- - benefits: string[] (3-5 bullet points)
97
-
77
+ systemPromptFragment: `You are finding duplicated logic and extracting a reusable module.
78
+
79
+ ## Methodology
80
+ 1. Use grep/semantic search to find candidate duplication (3+ similar implementations).
81
+ 2. Read each call site to understand the VARIATIONS (not just the common pattern).
82
+ 3. Design an API that accommodates ALL variations (use options pattern, not multiple functions).
83
+ 4. Specify the new module path + function signature + behavior table.
84
+ 5. List migration steps: which file + which lines change to use the new module.
85
+
86
+ ## Extraction principles
87
+ - **Variations via options, not forks**: prefer formatDuration(ms, opts) over formatDurationCompact()/Full()
88
+ - **Pure functions**: extracted modules should have no hidden state, no I/O
89
+ - **Tests first**: write the test suite for the new module BEFORE migrating call sites
90
+ - **Single responsibility**: extracted module does ONE thing well
91
+
92
+ ## Output format (JSON-typed)
93
+ - duplication: { callSites: [{file, function, line}], differences[] }
94
+ - proposedModule: { path, api (TS signature), variants: [{style, example}] }
95
+ - migration: [{step, linesToChange}]
96
+ - benefits: string[] (3-5 bullet points)
97
+
98
98
  Stay under 500 words.${CLARIFICATION_PROTOCOL}`,
99
99
  };
100
100
  const simplifyConditionals = {
@@ -129,11 +129,11 @@ const simplifyConditionals = {
129
129
  output: {
130
130
  before: { lines: 9, cyclomaticComplexity: 5 },
131
131
  after: { lines: 6, cyclomaticComplexity: 1 },
132
- refactored: `function canUserEdit(user, doc) {
133
- if (user.isAdmin) return true;
134
- if (doc.ownerId === user.id) return true;
135
- if (doc.collaborators.includes(user.id) && !doc.locked) return true;
136
- return false;
132
+ refactored: `function canUserEdit(user, doc) {
133
+ if (user.isAdmin) return true;
134
+ if (doc.ownerId === user.id) return true;
135
+ if (doc.collaborators.includes(user.id) && !doc.locked) return true;
136
+ return false;
137
137
  }`,
138
138
  explanation: 'Extracted guard clauses (early returns). Eliminated 3 levels of nesting. Cyclomatic complexity dropped from 5 to 1. Logic preserved exactly.',
139
139
  },
@@ -143,34 +143,34 @@ const simplifyConditionals = {
143
143
  output: {
144
144
  before: { lines: 7, cyclomaticComplexity: 5 },
145
145
  after: { lines: 7, cyclomaticComplexity: 1 },
146
- refactored: `const DISCOUNT_BY_TIER = { bronze: 0.05, silver: 0.10, gold: 0.15, platinum: 0.20 } as const;
147
- function getDiscount(tier: DiscountTier): number {
148
- return DISCOUNT_BY_TIER[tier] ?? 0;
146
+ refactored: `const DISCOUNT_BY_TIER = { bronze: 0.05, silver: 0.10, gold: 0.15, platinum: 0.20 } as const;
147
+ function getDiscount(tier: DiscountTier): number {
148
+ return DISCOUNT_BY_TIER[tier] ?? 0;
149
149
  }`,
150
150
  explanation: 'Replaced if-else chain with const lookup table. Adding a new tier = one line in the table, no function edit. Type-safe via `as const`. Default 0 via nullish coalescing.',
151
151
  },
152
152
  },
153
153
  ],
154
154
  outputSchema: '{ before: { lines: number; cyclomaticComplexity: number }; after: { lines: number; cyclomaticComplexity: number }; refactored: string; explanation: string }',
155
- systemPromptFragment: `You are reducing the complexity of conditional code.
156
-
157
- ## Common patterns to apply
158
- 1. **Guard clauses**: replace \`if (cond) { ...big block... } else { return false; }\` with \`if (!cond) return false; ...big block...\`
159
- 2. **Lookup tables**: replace \`if/else if/else if/...\` chains with \`const TABLE = { ... } as const; return TABLE[key] ?? default\`
160
- 3. **Boolean simplification**: apply De Morgan's laws (\`!(A && B)\` → \`!A || !B\`), extract complex predicates into named booleans
161
- 4. **Polymorphism**: replace type-checking conditionals (\`if (type === 'A') ... else if (type === 'B') ...\`) with method dispatch
162
-
163
- ## Output format (JSON-typed)
164
- - before: { lines, cyclomaticComplexity }
165
- - after: { lines, cyclomaticComplexity }
166
- - refactored: string (the new code)
167
- - explanation: string (1-2 sentences on what changed and why)
168
-
169
- ## What NOT to do
170
- - Don't change behavior — only structure
171
- - Don't introduce new abstractions for one-off conditionals
172
- - Don't sacrifice readability for fewer lines (e.g. overly clever ternary chains)
173
-
155
+ systemPromptFragment: `You are reducing the complexity of conditional code.
156
+
157
+ ## Common patterns to apply
158
+ 1. **Guard clauses**: replace \`if (cond) { ...big block... } else { return false; }\` with \`if (!cond) return false; ...big block...\`
159
+ 2. **Lookup tables**: replace \`if/else if/else if/...\` chains with \`const TABLE = { ... } as const; return TABLE[key] ?? default\`
160
+ 3. **Boolean simplification**: apply De Morgan's laws (\`!(A && B)\` → \`!A || !B\`), extract complex predicates into named booleans
161
+ 4. **Polymorphism**: replace type-checking conditionals (\`if (type === 'A') ... else if (type === 'B') ...\`) with method dispatch
162
+
163
+ ## Output format (JSON-typed)
164
+ - before: { lines, cyclomaticComplexity }
165
+ - after: { lines, cyclomaticComplexity }
166
+ - refactored: string (the new code)
167
+ - explanation: string (1-2 sentences on what changed and why)
168
+
169
+ ## What NOT to do
170
+ - Don't change behavior — only structure
171
+ - Don't introduce new abstractions for one-off conditionals
172
+ - Don't sacrifice readability for fewer lines (e.g. overly clever ternary chains)
173
+
174
174
  Stay under 400 words.${CLARIFICATION_PROTOCOL}`,
175
175
  };
176
176
  const refactorMonolith = {
@@ -229,28 +229,28 @@ const refactorMonolith = {
229
229
  },
230
230
  ],
231
231
  outputSchema: '{ currentState: { file: string; totalLines: number; responsibilities: string[] }; proposedModules: Array<{ name: string; responsibility: string; estimatedLines: number; dependsOn: string[] }>; migrationPhases: Array<{ phase: number; name: string; exitCriterion: string; durationDays: number }>; risks: Array<{ risk: string; mitigation: string }> }',
232
- systemPromptFragment: `You are planning a multi-perspective decomposition of a large file.
233
-
234
- ## Methodology
235
- 1. Identify the file's CURRENT responsibilities (read the source if needed).
236
- 2. Search prior split decisions with the retrieval tool listed in your AVAILABLE TOOLS (searchDocuments or searchRAG — never call one that is not listed), query: "<file-name-keyword>"
237
- 3. Propose 4-8 NEW modules, each with ONE clear responsibility.
238
- 4. Map existing functions/sections to new modules (with line numbers).
239
- 5. Validate NO circular dependencies between proposed modules.
240
- 6. Plan 3-5 migration phases, each independently shippable with all tests passing.
241
-
242
- ## Module split principles
243
- - **One job per module**: if you can't describe a module's purpose in ONE sentence, split further
244
- - **No circular deps**: A imports B, B imports C is fine; A imports B, B imports A is not
245
- - **Stable abstractions**: the new module boundaries should match NATURAL responsibility seams (state vs UI vs I/O), not arbitrary line counts
246
- - **Testability first**: each module should be unit-testable in isolation
247
-
248
- ## Output format (JSON-typed)
249
- - currentState: { file, totalLines, responsibilities[] }
250
- - proposedModules: Array<{ name, responsibility, estimatedLines, dependsOn[] }>
251
- - migrationPhases: Array<{ phase, name, exitCriterion, durationDays }>
252
- - risks: Array<{ risk, mitigation }>
253
-
232
+ systemPromptFragment: `You are planning a multi-perspective decomposition of a large file.
233
+
234
+ ## Methodology
235
+ 1. Identify the file's CURRENT responsibilities (read the source if needed).
236
+ 2. Search prior split decisions with the retrieval tool listed in your AVAILABLE TOOLS (searchDocuments or searchRAG — never call one that is not listed), query: "<file-name-keyword>"
237
+ 3. Propose 4-8 NEW modules, each with ONE clear responsibility.
238
+ 4. Map existing functions/sections to new modules (with line numbers).
239
+ 5. Validate NO circular dependencies between proposed modules.
240
+ 6. Plan 3-5 migration phases, each independently shippable with all tests passing.
241
+
242
+ ## Module split principles
243
+ - **One job per module**: if you can't describe a module's purpose in ONE sentence, split further
244
+ - **No circular deps**: A imports B, B imports C is fine; A imports B, B imports A is not
245
+ - **Stable abstractions**: the new module boundaries should match NATURAL responsibility seams (state vs UI vs I/O), not arbitrary line counts
246
+ - **Testability first**: each module should be unit-testable in isolation
247
+
248
+ ## Output format (JSON-typed)
249
+ - currentState: { file, totalLines, responsibilities[] }
250
+ - proposedModules: Array<{ name, responsibility, estimatedLines, dependsOn[] }>
251
+ - migrationPhases: Array<{ phase, name, exitCriterion, durationDays }>
252
+ - risks: Array<{ risk, mitigation }>
253
+
254
254
  Stay under 600 words. Be decisive about module boundaries — pick ONE natural split, don't present 3 equally valid options.${CLARIFICATION_PROTOCOL}`,
255
255
  };
256
256
  // Register all 3 skills at module load time in topological dependency order.
@@ -1,17 +1,17 @@
1
1
  import * as skillsModule from '../../skills.js';
2
- const CLARIFICATION_PROTOCOL = `
3
-
4
- WHEN TO ASK THE USER (clarification):
5
- If a single missing fact would materially change your output (target platform, scope, a binary design choice with significant trade-offs, a constraint you cannot safely assume), pause and ask the user by appending EXACTLY this block at the end of your message:
6
-
7
- ---QUESTION---
8
- { "question": "One focused question", "choices": ["Option A", "Option B", "Option C"], "context": "Why this matters" }
9
- ---END---
10
-
11
- Rules for clarifications:
12
- - Ask AT MOST ONE question per turn, and only when genuinely blocked.
13
- - Prefer a small set of concrete "choices" (2-4). The user can still type a wave-in response.
14
- - Do NOT ask for information that could be reasonably assumed or already in shared context.
2
+ const CLARIFICATION_PROTOCOL = `
3
+
4
+ WHEN TO ASK THE USER (clarification):
5
+ If a single missing fact would materially change your output (target platform, scope, a binary design choice with significant trade-offs, a constraint you cannot safely assume), pause and ask the user by appending EXACTLY this block at the end of your message:
6
+
7
+ ---QUESTION---
8
+ { "question": "One focused question", "choices": ["Option A", "Option B", "Option C"], "context": "Why this matters" }
9
+ ---END---
10
+
11
+ Rules for clarifications:
12
+ - Ask AT MOST ONE question per turn, and only when genuinely blocked.
13
+ - Prefer a small set of concrete "choices" (2-4). The user can still type a wave-in response.
14
+ - Do NOT ask for information that could be reasonably assumed or already in shared context.
15
15
  - If you can proceed with a sound documented assumption, DO SO instead of asking.`;
16
16
  const securityAudit = {
17
17
  id: 'security-audit',
@@ -60,34 +60,34 @@ const securityAudit = {
60
60
  },
61
61
  ],
62
62
  outputSchema: '{ owaspFindings: Array<{ category: string; severity: string; file: string; line: number; issue: string }>; cveCheck: string; secretsScan: string; priorityOrder: string[] }',
63
- systemPromptFragment: `You are auditing the codebase for security vulnerabilities.
64
-
65
- ## OWASP Top 10 (2021) — check each
66
- 1. **A01 Broken Access Control**: missing role checks, IDOR vulnerabilities
67
- 2. **A02 Cryptographic Failures**: weak hashing (MD5/SHA-1/SHA-256 for passwords), missing TLS
68
- 3. **A03 Injection**: SQL injection, command injection, XSS (especially via unsafe dangerouslySetInnerHTML)
69
- 4. **A04 Insecure Design**: missing rate limiting on auth endpoints
70
- 5. **A05 Security Misconfiguration**: default credentials, exposed debug endpoints
71
- 6. **A06 Vulnerable Components**: outdated dependencies with known CVEs (run npm audit)
72
- 7. **A07 Identification & Auth Failures**: missing MFA, weak password policies
73
- 8. **A08 Software & Data Integrity Failures**: missing signature verification on updates
74
- 9. **A09 Logging & Monitoring Failures**: no audit log on sensitive operations
75
- 10. **A10 SSRF**: user-controlled URLs fetched server-side without allowlist
76
-
77
- ## CVE check
78
- - Run npm audit (or pip-audit, cargo audit, etc. depending on the stack)
79
- - Cross-reference with the GitHub Advisory Database
80
-
81
- ## Secrets scan
82
- - grep for common patterns: API_KEY, SECRET, TOKEN, PASSWORD, BEGIN PRIVATE KEY
83
- - Check .env files are gitignored
84
-
85
- ## Output format (JSON-typed)
86
- - owaspFindings: Array<{ category, severity, file, line, issue }>
87
- - cveCheck: string (results of dependency scan)
88
- - secretsScan: string (results of hardcoded secrets scan)
89
- - priorityOrder: string[] (numbered list, CRITICAL first)
90
-
63
+ systemPromptFragment: `You are auditing the codebase for security vulnerabilities.
64
+
65
+ ## OWASP Top 10 (2021) — check each
66
+ 1. **A01 Broken Access Control**: missing role checks, IDOR vulnerabilities
67
+ 2. **A02 Cryptographic Failures**: weak hashing (MD5/SHA-1/SHA-256 for passwords), missing TLS
68
+ 3. **A03 Injection**: SQL injection, command injection, XSS (especially via unsafe dangerouslySetInnerHTML)
69
+ 4. **A04 Insecure Design**: missing rate limiting on auth endpoints
70
+ 5. **A05 Security Misconfiguration**: default credentials, exposed debug endpoints
71
+ 6. **A06 Vulnerable Components**: outdated dependencies with known CVEs (run npm audit)
72
+ 7. **A07 Identification & Auth Failures**: missing MFA, weak password policies
73
+ 8. **A08 Software & Data Integrity Failures**: missing signature verification on updates
74
+ 9. **A09 Logging & Monitoring Failures**: no audit log on sensitive operations
75
+ 10. **A10 SSRF**: user-controlled URLs fetched server-side without allowlist
76
+
77
+ ## CVE check
78
+ - Run npm audit (or pip-audit, cargo audit, etc. depending on the stack)
79
+ - Cross-reference with the GitHub Advisory Database
80
+
81
+ ## Secrets scan
82
+ - grep for common patterns: API_KEY, SECRET, TOKEN, PASSWORD, BEGIN PRIVATE KEY
83
+ - Check .env files are gitignored
84
+
85
+ ## Output format (JSON-typed)
86
+ - owaspFindings: Array<{ category, severity, file, line, issue }>
87
+ - cveCheck: string (results of dependency scan)
88
+ - secretsScan: string (results of hardcoded secrets scan)
89
+ - priorityOrder: string[] (numbered list, CRITICAL first)
90
+
91
91
  Stay under 500 words.${CLARIFICATION_PROTOCOL}`,
92
92
  };
93
93
  const performanceReview = {
@@ -132,27 +132,27 @@ const performanceReview = {
132
132
  },
133
133
  ],
134
134
  outputSchema: '{ findings: Array<{ type: string; severity: string; file: string; line: number; issue: string; fix: string }>; bigO: string; expectedSpeedup: string }',
135
- systemPromptFragment: `You are reviewing code for performance issues.
136
-
137
- ## Common patterns to detect
138
- 1. **N+1 queries**: loop with a DB call inside (fetch all data upfront with a JOIN)
139
- 2. **Allocation in hot loops**: \`new SomeClass()\` inside \`for (...)\` (hoist outside)
140
- 3. **Missing index**: SQL filter on unindexed column (add index, EXPLAIN ANALYZE)
141
- 4. **No caching**: identical computation repeated (LRU cache, memoize)
142
- 5. **Blocking I/O in async**: \`await fs.readFileSync(...)\` (use async readFile)
143
- 6. **Quadratic loops**: nested loops over the same array (use hash map for O(n) lookup)
144
- 7. **Synchronous XHR/fetch**: blocking the main thread (use async/await or worker)
145
-
146
- ## Output format (JSON-typed)
147
- - findings: Array<{ type, severity, file, line, issue, fix }>
148
- - bigO: string (the complexity change after fixes)
149
- - expectedSpeedup: string (estimated speedup magnitude)
150
-
151
- ## Anti-patterns to avoid
152
- - **Don't propose premature optimizations** (caching for a function called once)
153
- - **Don't change behavior for performance** unless explicitly asked
154
- - **Profile first** — don't guess where the hot path is
155
-
135
+ systemPromptFragment: `You are reviewing code for performance issues.
136
+
137
+ ## Common patterns to detect
138
+ 1. **N+1 queries**: loop with a DB call inside (fetch all data upfront with a JOIN)
139
+ 2. **Allocation in hot loops**: \`new SomeClass()\` inside \`for (...)\` (hoist outside)
140
+ 3. **Missing index**: SQL filter on unindexed column (add index, EXPLAIN ANALYZE)
141
+ 4. **No caching**: identical computation repeated (LRU cache, memoize)
142
+ 5. **Blocking I/O in async**: \`await fs.readFileSync(...)\` (use async readFile)
143
+ 6. **Quadratic loops**: nested loops over the same array (use hash map for O(n) lookup)
144
+ 7. **Synchronous XHR/fetch**: blocking the main thread (use async/await or worker)
145
+
146
+ ## Output format (JSON-typed)
147
+ - findings: Array<{ type, severity, file, line, issue, fix }>
148
+ - bigO: string (the complexity change after fixes)
149
+ - expectedSpeedup: string (estimated speedup magnitude)
150
+
151
+ ## Anti-patterns to avoid
152
+ - **Don't propose premature optimizations** (caching for a function called once)
153
+ - **Don't change behavior for performance** unless explicitly asked
154
+ - **Profile first** — don't guess where the hot path is
155
+
156
156
  Stay under 500 words.${CLARIFICATION_PROTOCOL}`,
157
157
  };
158
158
  const testCoverageAnalysis = {
@@ -200,26 +200,26 @@ const testCoverageAnalysis = {
200
200
  },
201
201
  ],
202
202
  outputSchema: '{ untestedBranches: Array<{ branch: string; file: string; line: number; suggestedTest: string }>; edgeCases: string[]; priorityOrder: string[] }',
203
- systemPromptFragment: `You are identifying untested code branches.
204
-
205
- ## Methodology
206
- 1. **Read each branch** in the source file (if/else, switch cases, try/catch).
207
- 2. **Identify untested branches** by reading the corresponding test file.
208
- 3. **Suggest a SPECIFIC test** (not "add a test for X" — write the actual assertion).
209
- 4. **Prioritize edge cases**: NaN, null, undefined, empty array, max int, negative numbers.
210
- 5. **Prioritize error paths**: what happens when validation fails, network drops, etc.?
211
-
212
- ## Output format (JSON-typed)
213
- - untestedBranches: Array<{ branch, file, line, suggestedTest }>
214
- - edgeCases: string[] (3-7 cases)
215
- - priorityOrder: string[] (numbered list)
216
-
217
- ## Test quality principles
218
- - **One assertion per test** — easier to debug
219
- - **Specific assertion** — not \`expect(result).toBeTruthy()\` but \`expect(result).toBe('1h 23m')\`
220
- - **Test the boundary** — \`n=0\`, \`n=1\`, \`n=MAX_INT\`
221
- - **Test the failure path** — invalid input, network errors, partial data
222
-
203
+ systemPromptFragment: `You are identifying untested code branches.
204
+
205
+ ## Methodology
206
+ 1. **Read each branch** in the source file (if/else, switch cases, try/catch).
207
+ 2. **Identify untested branches** by reading the corresponding test file.
208
+ 3. **Suggest a SPECIFIC test** (not "add a test for X" — write the actual assertion).
209
+ 4. **Prioritize edge cases**: NaN, null, undefined, empty array, max int, negative numbers.
210
+ 5. **Prioritize error paths**: what happens when validation fails, network drops, etc.?
211
+
212
+ ## Output format (JSON-typed)
213
+ - untestedBranches: Array<{ branch, file, line, suggestedTest }>
214
+ - edgeCases: string[] (3-7 cases)
215
+ - priorityOrder: string[] (numbered list)
216
+
217
+ ## Test quality principles
218
+ - **One assertion per test** — easier to debug
219
+ - **Specific assertion** — not \`expect(result).toBeTruthy()\` but \`expect(result).toBe('1h 23m')\`
220
+ - **Test the boundary** — \`n=0\`, \`n=1\`, \`n=MAX_INT\`
221
+ - **Test the failure path** — invalid input, network errors, partial data
222
+
223
223
  Stay under 400 words.${CLARIFICATION_PROTOCOL}`,
224
224
  };
225
225
  const codeReview = {
@@ -265,32 +265,32 @@ const codeReview = {
265
265
  },
266
266
  ],
267
267
  outputSchema: '{ findings: Array<{ role: string; severity: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW"; line: number; issue: string; file: string }>; consensus: string; mergeVerdict: "APPROVE" | "REQUEST_CHANGES" | "BLOCK" }',
268
- systemPromptFragment: `You are conducting a multi-role code review.
269
-
270
- ## Review roles
271
- - **oracle (correctness)**: bugs, race conditions, edge cases, error handling
272
- - **atlas (performance)**: O(n²) algorithms, N+1 queries, unnecessary allocations, missing caching
273
- - **oracle (security)**: injection, auth bypass, secrets in code, unsafe deserialization (overlaps with security-audit skill — run that first)
274
- - **atlas (accessibility)**: ARIA labels, keyboard nav, color contrast
275
- - **chairman (synthesis)**: aggregates all findings, emits verdict (APPROVE / REQUEST_CHANGES / BLOCK)
276
-
277
- ## Severity levels
278
- - **CRITICAL**: must fix before merge (security, data loss, crash)
279
- - **HIGH**: should fix before merge (correctness bug, performance regression)
280
- - **MEDIUM**: nice to fix (code smell, minor perf)
281
- - **LOW**: nitpick (style, naming)
282
-
283
- ## Output format (JSON-typed)
284
- - findings: Array<{ role, severity, line, issue, file }>
285
- - consensus: string (chairman's synthesis)
286
- - mergeVerdict: 'APPROVE' | 'REQUEST_CHANGES' | 'BLOCK'
287
-
288
- ## Review principles
289
- - **Be specific**: cite file + line numbers
290
- - **Be actionable**: each finding has a concrete fix
291
- - **Don't bikeshed style** — note as LOW or skip
292
- - **Trust the author** — don't require changes that are preference, not correctness
293
-
268
+ systemPromptFragment: `You are conducting a multi-role code review.
269
+
270
+ ## Review roles
271
+ - **oracle (correctness)**: bugs, race conditions, edge cases, error handling
272
+ - **atlas (performance)**: O(n²) algorithms, N+1 queries, unnecessary allocations, missing caching
273
+ - **oracle (security)**: injection, auth bypass, secrets in code, unsafe deserialization (overlaps with security-audit skill — run that first)
274
+ - **atlas (accessibility)**: ARIA labels, keyboard nav, color contrast
275
+ - **chairman (synthesis)**: aggregates all findings, emits verdict (APPROVE / REQUEST_CHANGES / BLOCK)
276
+
277
+ ## Severity levels
278
+ - **CRITICAL**: must fix before merge (security, data loss, crash)
279
+ - **HIGH**: should fix before merge (correctness bug, performance regression)
280
+ - **MEDIUM**: nice to fix (code smell, minor perf)
281
+ - **LOW**: nitpick (style, naming)
282
+
283
+ ## Output format (JSON-typed)
284
+ - findings: Array<{ role, severity, line, issue, file }>
285
+ - consensus: string (chairman's synthesis)
286
+ - mergeVerdict: 'APPROVE' | 'REQUEST_CHANGES' | 'BLOCK'
287
+
288
+ ## Review principles
289
+ - **Be specific**: cite file + line numbers
290
+ - **Be actionable**: each finding has a concrete fix
291
+ - **Don't bikeshed style** — note as LOW or skip
292
+ - **Trust the author** — don't require changes that are preference, not correctness
293
+
294
294
  Stay under 600 words.${CLARIFICATION_PROTOCOL}`,
295
295
  };
296
296
  // prettier-ignore