@brainst0rm/cli 0.13.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.
- package/README.md +32 -0
- package/dist/App-DPXJYXKH.js +2794 -0
- package/dist/App-DPXJYXKH.js.map +1 -0
- package/dist/App-SSKWB7CT.js +2795 -0
- package/dist/App-SSKWB7CT.js.map +1 -0
- package/dist/brainstorm.js +4636 -0
- package/dist/brainstorm.js.map +1 -0
- package/dist/chunk-2CHZHDIM.js +391 -0
- package/dist/chunk-2CHZHDIM.js.map +1 -0
- package/dist/chunk-55ITCWZZ.js +1307 -0
- package/dist/chunk-55ITCWZZ.js.map +1 -0
- package/dist/chunk-5NA3GH6X.js +1308 -0
- package/dist/chunk-5NA3GH6X.js.map +1 -0
- package/dist/chunk-7D4SUZUM.js +38 -0
- package/dist/chunk-7D4SUZUM.js.map +1 -0
- package/dist/chunk-D474E47D.js +148 -0
- package/dist/chunk-D474E47D.js.map +1 -0
- package/dist/chunk-GJXEX2A3.js +146 -0
- package/dist/chunk-GJXEX2A3.js.map +1 -0
- package/dist/chunk-OVGL3NJQ.js +307 -0
- package/dist/chunk-OVGL3NJQ.js.map +1 -0
- package/dist/chunk-VY6MPJXL.js +389 -0
- package/dist/chunk-VY6MPJXL.js.map +1 -0
- package/dist/chunk-YWXOPUDW.js +305 -0
- package/dist/chunk-YWXOPUDW.js.map +1 -0
- package/dist/chunk-ZWE3DS7E.js +39 -0
- package/dist/chunk-ZWE3DS7E.js.map +1 -0
- package/dist/dist-DUDO3RDM.js +9573 -0
- package/dist/dist-DUDO3RDM.js.map +1 -0
- package/dist/dist-GNHTH2DH.js +292 -0
- package/dist/dist-GNHTH2DH.js.map +1 -0
- package/dist/dist-JUDVPE7G.js +293 -0
- package/dist/dist-JUDVPE7G.js.map +1 -0
- package/dist/dist-V5DTSTKJ.js +9572 -0
- package/dist/dist-V5DTSTKJ.js.map +1 -0
- package/dist/dist-WLTQTLFO.js +14 -0
- package/dist/dist-WLTQTLFO.js.map +1 -0
- package/dist/dist-YIGU37Q2.js +15 -0
- package/dist/dist-YIGU37Q2.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4635 -0
- package/dist/index.js.map +1 -0
- package/dist/recorder-D6ILEOZP.js +67 -0
- package/dist/recorder-D6ILEOZP.js.map +1 -0
- package/dist/recorder-SPYYF4DL.js +66 -0
- package/dist/recorder-SPYYF4DL.js.map +1 -0
- package/dist/roles-2DGF4PZU.js +16 -0
- package/dist/roles-2DGF4PZU.js.map +1 -0
- package/dist/roles-UIPX7GBC.js +17 -0
- package/dist/roles-UIPX7GBC.js.map +1 -0
- package/dist/slash-PDWKCZOQ.js +13 -0
- package/dist/slash-PDWKCZOQ.js.map +1 -0
- package/dist/slash-ZDC4DKL4.js +14 -0
- package/dist/slash-ZDC4DKL4.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// src/commands/roles.ts
|
|
2
|
+
import {
|
|
3
|
+
getPersona,
|
|
4
|
+
composePersonaPrompt
|
|
5
|
+
} from "@brainst0rm/core";
|
|
6
|
+
var ARCHITECT_PROMPT = `You are a senior software architect. Your job is to DESIGN, not implement.
|
|
7
|
+
|
|
8
|
+
# Core Behaviors
|
|
9
|
+
1. Explore the codebase deeply before proposing anything. Read files, search patterns, understand structure.
|
|
10
|
+
2. Design with component boundaries, data flow diagrams, and interface contracts.
|
|
11
|
+
3. Present structured plans with specific files to modify, new files to create, and dependencies to add.
|
|
12
|
+
4. Consider trade-offs: performance vs maintainability, simplicity vs flexibility, consistency vs innovation.
|
|
13
|
+
5. Do NOT write implementation code. Design it. Show interfaces, type definitions, and pseudocode at most.
|
|
14
|
+
6. When uncertain, explore more. Better to spend time understanding than to design from assumptions.
|
|
15
|
+
|
|
16
|
+
# Output Format
|
|
17
|
+
Structure your response as:
|
|
18
|
+
- **Problem Analysis**: What are we solving and why
|
|
19
|
+
- **Proposed Architecture**: Components, boundaries, data flow
|
|
20
|
+
- **Key Interfaces**: TypeScript interfaces or type definitions
|
|
21
|
+
- **Implementation Plan**: Ordered steps with file paths
|
|
22
|
+
- **Risks & Trade-offs**: What could go wrong, alternatives considered`;
|
|
23
|
+
var PM_PROMPT = `You are a product manager helping define requirements and scope for a software project.
|
|
24
|
+
|
|
25
|
+
# Core Behaviors
|
|
26
|
+
1. Ask clarifying questions to understand the user's goals and constraints.
|
|
27
|
+
2. Write user stories with acceptance criteria in Given/When/Then format.
|
|
28
|
+
3. Identify edge cases, error scenarios, and potential scope creep early.
|
|
29
|
+
4. Explore the codebase to understand feasibility and existing patterns.
|
|
30
|
+
5. Prioritize features by impact and effort (MoSCoW or similar).
|
|
31
|
+
6. Never assume \u2014 validate requirements against the actual codebase.
|
|
32
|
+
|
|
33
|
+
# Output Format
|
|
34
|
+
- **User Stories**: As a [user], I want [feature] so that [benefit]
|
|
35
|
+
- **Acceptance Criteria**: Given/When/Then scenarios
|
|
36
|
+
- **Edge Cases**: What could go wrong
|
|
37
|
+
- **Scope Risks**: Where scope might expand
|
|
38
|
+
- **Priority**: Must have / Should have / Could have / Won't have`;
|
|
39
|
+
var SR_DEV_PROMPT = `You are a senior software developer. Write production-quality code.
|
|
40
|
+
|
|
41
|
+
# Core Behaviors
|
|
42
|
+
1. Read existing code before writing. Match established patterns exactly.
|
|
43
|
+
2. Implement with proper error handling, edge cases, and type safety.
|
|
44
|
+
3. Review your own code before presenting it \u2014 catch bugs before the user does.
|
|
45
|
+
4. Run build commands to verify compilation. Fix issues before moving on.
|
|
46
|
+
5. Write concise, focused code. No over-engineering or speculative features.
|
|
47
|
+
6. Consider performance, security, and maintainability in every change.
|
|
48
|
+
7. Self-verify: after making changes, run tests and builds to confirm nothing broke.
|
|
49
|
+
|
|
50
|
+
# Anti-patterns to Avoid
|
|
51
|
+
- Don't add features beyond what was asked
|
|
52
|
+
- Don't refactor surrounding code unless it's broken
|
|
53
|
+
- Don't add comments to code you didn't change
|
|
54
|
+
- Don't create abstractions for one-time operations`;
|
|
55
|
+
var JR_DEV_PROMPT = `You are a junior developer. Implement tasks quickly and follow patterns exactly.
|
|
56
|
+
|
|
57
|
+
# Core Behaviors
|
|
58
|
+
1. Follow existing patterns in the codebase precisely. Don't invent new patterns.
|
|
59
|
+
2. Implement the simplest solution that satisfies the requirement.
|
|
60
|
+
3. When uncertain about anything, ask for clarification before proceeding.
|
|
61
|
+
4. Focus on getting the task done \u2014 speed over perfection.
|
|
62
|
+
5. If you see code that looks wrong, flag it but don't fix it unless asked.
|
|
63
|
+
6. Run the build command after every change.`;
|
|
64
|
+
var QA_PROMPT = `You are a QA engineer. Find bugs, plan tests, and verify quality.
|
|
65
|
+
|
|
66
|
+
# Core Behaviors
|
|
67
|
+
1. Think adversarially \u2014 what inputs would break this? What edge cases were missed?
|
|
68
|
+
2. Read the code deeply to understand logic before testing.
|
|
69
|
+
3. Plan test coverage: unit tests, integration tests, edge cases, error paths.
|
|
70
|
+
4. Generate test matrices for complex features (input combinations \xD7 expected outcomes).
|
|
71
|
+
5. Run existing tests and report results. Suggest new tests for uncovered paths.
|
|
72
|
+
6. Look for security issues: injection, auth bypass, data leaks, race conditions.
|
|
73
|
+
7. Check for regressions: does the change break anything that was working before?
|
|
74
|
+
|
|
75
|
+
# Output Format
|
|
76
|
+
- **Test Plan**: What to test, in priority order
|
|
77
|
+
- **Test Matrix**: Input combinations \xD7 expected outcomes (table format)
|
|
78
|
+
- **Findings**: Issues found with severity (Critical/High/Medium/Low)
|
|
79
|
+
- **Coverage Gaps**: What's not tested and should be`;
|
|
80
|
+
var ROLES = {
|
|
81
|
+
architect: {
|
|
82
|
+
id: "architect",
|
|
83
|
+
displayName: "Architect",
|
|
84
|
+
icon: "\u{1F3D7}",
|
|
85
|
+
color: "magenta",
|
|
86
|
+
description: "Deep thinking, system design, read-only exploration",
|
|
87
|
+
modelChoices: [
|
|
88
|
+
{
|
|
89
|
+
modelId: "anthropic/claude-opus-4-6",
|
|
90
|
+
label: "Claude Opus 4.6",
|
|
91
|
+
cost: "$15/$75",
|
|
92
|
+
default: true
|
|
93
|
+
},
|
|
94
|
+
{ modelId: "openai/gpt-5.4", label: "GPT-5.4", cost: "$2.50/$10" },
|
|
95
|
+
{
|
|
96
|
+
modelId: "google/gemini-3.1-pro",
|
|
97
|
+
label: "Gemini 3.1 Pro",
|
|
98
|
+
cost: "$1.25/$5"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
modelId: "anthropic/claude-sonnet-4-6",
|
|
102
|
+
label: "Claude Sonnet 4.6",
|
|
103
|
+
cost: "$3/$15"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
systemPrompt: ARCHITECT_PROMPT,
|
|
107
|
+
personaId: "architect",
|
|
108
|
+
outputStyle: "detailed",
|
|
109
|
+
permissionMode: "plan",
|
|
110
|
+
routingStrategy: "quality-first",
|
|
111
|
+
blockedTools: [
|
|
112
|
+
"file_write",
|
|
113
|
+
"file_edit",
|
|
114
|
+
"multi_edit",
|
|
115
|
+
"batch_edit",
|
|
116
|
+
"shell",
|
|
117
|
+
"git_commit"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"product-manager": {
|
|
121
|
+
id: "product-manager",
|
|
122
|
+
displayName: "Product Manager",
|
|
123
|
+
icon: "\u{1F4CB}",
|
|
124
|
+
color: "blue",
|
|
125
|
+
description: "Requirements, user stories, acceptance criteria",
|
|
126
|
+
modelChoices: [
|
|
127
|
+
{
|
|
128
|
+
modelId: "anthropic/claude-opus-4-6",
|
|
129
|
+
label: "Claude Opus 4.6",
|
|
130
|
+
cost: "$15/$75",
|
|
131
|
+
default: true
|
|
132
|
+
},
|
|
133
|
+
{ modelId: "openai/gpt-5.4", label: "GPT-5.4", cost: "$2.50/$10" },
|
|
134
|
+
{
|
|
135
|
+
modelId: "google/gemini-3.1-pro",
|
|
136
|
+
label: "Gemini 3.1 Pro",
|
|
137
|
+
cost: "$1.25/$5"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
systemPrompt: PM_PROMPT,
|
|
141
|
+
personaId: "product-manager",
|
|
142
|
+
outputStyle: "detailed",
|
|
143
|
+
permissionMode: "plan",
|
|
144
|
+
routingStrategy: "quality-first"
|
|
145
|
+
},
|
|
146
|
+
"sr-developer": {
|
|
147
|
+
id: "sr-developer",
|
|
148
|
+
displayName: "Sr. Developer",
|
|
149
|
+
icon: "\u{1F468}\u200D\u{1F4BB}",
|
|
150
|
+
color: "green",
|
|
151
|
+
description: "Quality implementation with best models",
|
|
152
|
+
modelChoices: [
|
|
153
|
+
{
|
|
154
|
+
modelId: "anthropic/claude-sonnet-4-6",
|
|
155
|
+
label: "Claude Sonnet 4.6",
|
|
156
|
+
cost: "$3/$15",
|
|
157
|
+
default: true
|
|
158
|
+
},
|
|
159
|
+
{ modelId: "openai/gpt-5.4", label: "GPT-5.4", cost: "$2.50/$10" },
|
|
160
|
+
{
|
|
161
|
+
modelId: "deepseek/deepseek-chat",
|
|
162
|
+
label: "DeepSeek V3",
|
|
163
|
+
cost: "$0.27/$1.10"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
modelId: "google/gemini-3.1-pro",
|
|
167
|
+
label: "Gemini 3.1 Pro",
|
|
168
|
+
cost: "$1.25/$5"
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
systemPrompt: SR_DEV_PROMPT,
|
|
172
|
+
personaId: "sr-developer",
|
|
173
|
+
outputStyle: "concise",
|
|
174
|
+
permissionMode: "confirm",
|
|
175
|
+
routingStrategy: "quality-first"
|
|
176
|
+
},
|
|
177
|
+
"jr-developer": {
|
|
178
|
+
id: "jr-developer",
|
|
179
|
+
displayName: "Jr. Developer",
|
|
180
|
+
icon: "\u{1F9D1}\u200D\u{1F4BB}",
|
|
181
|
+
color: "yellow",
|
|
182
|
+
description: "Fast, cheap implementation for well-specified tasks",
|
|
183
|
+
modelChoices: [
|
|
184
|
+
{
|
|
185
|
+
modelId: "anthropic/claude-haiku-4-5-20251001",
|
|
186
|
+
label: "Claude Haiku 4.5",
|
|
187
|
+
cost: "$0.80/$4",
|
|
188
|
+
default: true
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
modelId: "openai/gpt-4.1-mini",
|
|
192
|
+
label: "GPT-4.1 Mini",
|
|
193
|
+
cost: "$0.40/$1.60"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
modelId: "google/gemini-3.1-flash",
|
|
197
|
+
label: "Gemini 3.1 Flash",
|
|
198
|
+
cost: "$0.15/$0.60"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
modelId: "deepseek/deepseek-chat",
|
|
202
|
+
label: "DeepSeek V3",
|
|
203
|
+
cost: "$0.27/$1.10"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
systemPrompt: JR_DEV_PROMPT,
|
|
207
|
+
personaId: "jr-developer",
|
|
208
|
+
outputStyle: "concise",
|
|
209
|
+
permissionMode: "confirm",
|
|
210
|
+
routingStrategy: "cost-first",
|
|
211
|
+
blockedTools: ["git_commit", "git_branch", "process_spawn"]
|
|
212
|
+
},
|
|
213
|
+
qa: {
|
|
214
|
+
id: "qa",
|
|
215
|
+
displayName: "QA Engineer",
|
|
216
|
+
icon: "\u{1F50D}",
|
|
217
|
+
color: "red",
|
|
218
|
+
description: "Testing, code review, edge case discovery",
|
|
219
|
+
modelChoices: [
|
|
220
|
+
{
|
|
221
|
+
modelId: "anthropic/claude-sonnet-4-6",
|
|
222
|
+
label: "Claude Sonnet 4.6",
|
|
223
|
+
cost: "$3/$15",
|
|
224
|
+
default: true
|
|
225
|
+
},
|
|
226
|
+
{ modelId: "openai/gpt-5.4", label: "GPT-5.4", cost: "$2.50/$10" },
|
|
227
|
+
{
|
|
228
|
+
modelId: "google/gemini-3.1-pro",
|
|
229
|
+
label: "Gemini 3.1 Pro",
|
|
230
|
+
cost: "$1.25/$5"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
modelId: "anthropic/claude-opus-4-6",
|
|
234
|
+
label: "Claude Opus 4.6",
|
|
235
|
+
cost: "$15/$75"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
systemPrompt: QA_PROMPT,
|
|
239
|
+
personaId: "qa",
|
|
240
|
+
outputStyle: "detailed",
|
|
241
|
+
permissionMode: "plan",
|
|
242
|
+
routingStrategy: "quality-first",
|
|
243
|
+
allowedTools: [
|
|
244
|
+
"file_read",
|
|
245
|
+
"grep",
|
|
246
|
+
"glob",
|
|
247
|
+
"shell",
|
|
248
|
+
"git_status",
|
|
249
|
+
"git_diff"
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
function getRolePrompt(roleId, modelId) {
|
|
254
|
+
const role = ROLES[roleId];
|
|
255
|
+
if (!role) return "";
|
|
256
|
+
if (role.personaId) {
|
|
257
|
+
const persona = getPersona(role.personaId);
|
|
258
|
+
if (persona) {
|
|
259
|
+
return composePersonaPrompt(persona, modelId);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return role.systemPrompt;
|
|
263
|
+
}
|
|
264
|
+
function formatModelMenu(roleId) {
|
|
265
|
+
const role = ROLES[roleId];
|
|
266
|
+
if (!role) return `Unknown role: ${roleId}`;
|
|
267
|
+
const header = `${role.icon} ${role.displayName} Mode \u2014 select model:`;
|
|
268
|
+
const choices = role.modelChoices.map((m, i) => {
|
|
269
|
+
const num = String(i + 1);
|
|
270
|
+
const def = m.default ? " \u2190 default" : "";
|
|
271
|
+
return ` ${num}. ${m.label.padEnd(22)} (${m.cost} per 1M)${def}`;
|
|
272
|
+
});
|
|
273
|
+
return `
|
|
274
|
+
${header}
|
|
275
|
+
${choices.join("\n")}
|
|
276
|
+
|
|
277
|
+
Use: /${roleId} 1 (or 2, 3, etc.)`;
|
|
278
|
+
}
|
|
279
|
+
function getModelForRole(roleId, index) {
|
|
280
|
+
const role = ROLES[roleId];
|
|
281
|
+
if (!role) return "brainstormrouter/auto";
|
|
282
|
+
if (index >= 1 && index <= role.modelChoices.length) {
|
|
283
|
+
return role.modelChoices[index - 1].modelId;
|
|
284
|
+
}
|
|
285
|
+
const defaultChoice = role.modelChoices.find((m) => m.default) ?? role.modelChoices[0];
|
|
286
|
+
return defaultChoice.modelId;
|
|
287
|
+
}
|
|
288
|
+
function formatRoleConfirmation(roleId, modelId) {
|
|
289
|
+
const role = ROLES[roleId];
|
|
290
|
+
if (!role) return "Role applied.";
|
|
291
|
+
const model = role.modelChoices.find((m) => m.modelId === modelId);
|
|
292
|
+
const modelName = model?.label ?? modelId;
|
|
293
|
+
const toolsLabel = role.permissionMode === "plan" ? "read-only" : "all";
|
|
294
|
+
return `${role.icon} ${role.displayName} mode active
|
|
295
|
+
Model: ${modelName} \u2502 Tools: ${toolsLabel} \u2502 Style: ${role.outputStyle}`;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export {
|
|
299
|
+
ROLES,
|
|
300
|
+
getRolePrompt,
|
|
301
|
+
formatModelMenu,
|
|
302
|
+
getModelForRole,
|
|
303
|
+
formatRoleConfirmation
|
|
304
|
+
};
|
|
305
|
+
//# sourceMappingURL=chunk-YWXOPUDW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/roles.ts"],"sourcesContent":["/**\n * Role-Based Workflow System — session presets that configure\n * model, system prompt, tools, output style, and routing strategy.\n *\n * Each role is like a team member: /architect thinks deeply in read-only mode,\n * /sr-developer codes with quality models, /jr-developer codes fast and cheap.\n */\n\nimport {\n type OutputStyle,\n getPersona,\n composePersonaPrompt,\n} from \"@brainst0rm/core\";\n\nexport type RoleId =\n | \"architect\"\n | \"product-manager\"\n | \"sr-developer\"\n | \"jr-developer\"\n | \"qa\";\n\nexport interface ModelChoice {\n modelId: string;\n label: string;\n cost: string;\n default?: boolean;\n}\n\nexport interface RoleDefinition {\n id: RoleId;\n displayName: string;\n icon: string;\n color: string;\n description: string;\n modelChoices: ModelChoice[];\n /** Static system prompt (fallback if no persona found) */\n systemPrompt: string;\n /** Persona ID for expert playbook (overrides systemPrompt when available) */\n personaId?: string;\n outputStyle: OutputStyle;\n permissionMode: \"auto\" | \"confirm\" | \"plan\";\n routingStrategy: string;\n /** If set, only these tools are allowed (whitelist) */\n allowedTools?: string[];\n /** If set, these tools are blocked (blacklist) */\n blockedTools?: string[];\n}\n\nconst ARCHITECT_PROMPT = `You are a senior software architect. Your job is to DESIGN, not implement.\n\n# Core Behaviors\n1. Explore the codebase deeply before proposing anything. Read files, search patterns, understand structure.\n2. Design with component boundaries, data flow diagrams, and interface contracts.\n3. Present structured plans with specific files to modify, new files to create, and dependencies to add.\n4. Consider trade-offs: performance vs maintainability, simplicity vs flexibility, consistency vs innovation.\n5. Do NOT write implementation code. Design it. Show interfaces, type definitions, and pseudocode at most.\n6. When uncertain, explore more. Better to spend time understanding than to design from assumptions.\n\n# Output Format\nStructure your response as:\n- **Problem Analysis**: What are we solving and why\n- **Proposed Architecture**: Components, boundaries, data flow\n- **Key Interfaces**: TypeScript interfaces or type definitions\n- **Implementation Plan**: Ordered steps with file paths\n- **Risks & Trade-offs**: What could go wrong, alternatives considered`;\n\nconst PM_PROMPT = `You are a product manager helping define requirements and scope for a software project.\n\n# Core Behaviors\n1. Ask clarifying questions to understand the user's goals and constraints.\n2. Write user stories with acceptance criteria in Given/When/Then format.\n3. Identify edge cases, error scenarios, and potential scope creep early.\n4. Explore the codebase to understand feasibility and existing patterns.\n5. Prioritize features by impact and effort (MoSCoW or similar).\n6. Never assume — validate requirements against the actual codebase.\n\n# Output Format\n- **User Stories**: As a [user], I want [feature] so that [benefit]\n- **Acceptance Criteria**: Given/When/Then scenarios\n- **Edge Cases**: What could go wrong\n- **Scope Risks**: Where scope might expand\n- **Priority**: Must have / Should have / Could have / Won't have`;\n\nconst SR_DEV_PROMPT = `You are a senior software developer. Write production-quality code.\n\n# Core Behaviors\n1. Read existing code before writing. Match established patterns exactly.\n2. Implement with proper error handling, edge cases, and type safety.\n3. Review your own code before presenting it — catch bugs before the user does.\n4. Run build commands to verify compilation. Fix issues before moving on.\n5. Write concise, focused code. No over-engineering or speculative features.\n6. Consider performance, security, and maintainability in every change.\n7. Self-verify: after making changes, run tests and builds to confirm nothing broke.\n\n# Anti-patterns to Avoid\n- Don't add features beyond what was asked\n- Don't refactor surrounding code unless it's broken\n- Don't add comments to code you didn't change\n- Don't create abstractions for one-time operations`;\n\nconst JR_DEV_PROMPT = `You are a junior developer. Implement tasks quickly and follow patterns exactly.\n\n# Core Behaviors\n1. Follow existing patterns in the codebase precisely. Don't invent new patterns.\n2. Implement the simplest solution that satisfies the requirement.\n3. When uncertain about anything, ask for clarification before proceeding.\n4. Focus on getting the task done — speed over perfection.\n5. If you see code that looks wrong, flag it but don't fix it unless asked.\n6. Run the build command after every change.`;\n\nconst QA_PROMPT = `You are a QA engineer. Find bugs, plan tests, and verify quality.\n\n# Core Behaviors\n1. Think adversarially — what inputs would break this? What edge cases were missed?\n2. Read the code deeply to understand logic before testing.\n3. Plan test coverage: unit tests, integration tests, edge cases, error paths.\n4. Generate test matrices for complex features (input combinations × expected outcomes).\n5. Run existing tests and report results. Suggest new tests for uncovered paths.\n6. Look for security issues: injection, auth bypass, data leaks, race conditions.\n7. Check for regressions: does the change break anything that was working before?\n\n# Output Format\n- **Test Plan**: What to test, in priority order\n- **Test Matrix**: Input combinations × expected outcomes (table format)\n- **Findings**: Issues found with severity (Critical/High/Medium/Low)\n- **Coverage Gaps**: What's not tested and should be`;\n\nexport const ROLES: Record<RoleId, RoleDefinition> = {\n architect: {\n id: \"architect\",\n displayName: \"Architect\",\n icon: \"🏗\",\n color: \"magenta\",\n description: \"Deep thinking, system design, read-only exploration\",\n modelChoices: [\n {\n modelId: \"anthropic/claude-opus-4-6\",\n label: \"Claude Opus 4.6\",\n cost: \"$15/$75\",\n default: true,\n },\n { modelId: \"openai/gpt-5.4\", label: \"GPT-5.4\", cost: \"$2.50/$10\" },\n {\n modelId: \"google/gemini-3.1-pro\",\n label: \"Gemini 3.1 Pro\",\n cost: \"$1.25/$5\",\n },\n {\n modelId: \"anthropic/claude-sonnet-4-6\",\n label: \"Claude Sonnet 4.6\",\n cost: \"$3/$15\",\n },\n ],\n systemPrompt: ARCHITECT_PROMPT,\n personaId: \"architect\",\n outputStyle: \"detailed\",\n permissionMode: \"plan\",\n routingStrategy: \"quality-first\",\n blockedTools: [\n \"file_write\",\n \"file_edit\",\n \"multi_edit\",\n \"batch_edit\",\n \"shell\",\n \"git_commit\",\n ],\n },\n \"product-manager\": {\n id: \"product-manager\",\n displayName: \"Product Manager\",\n icon: \"📋\",\n color: \"blue\",\n description: \"Requirements, user stories, acceptance criteria\",\n modelChoices: [\n {\n modelId: \"anthropic/claude-opus-4-6\",\n label: \"Claude Opus 4.6\",\n cost: \"$15/$75\",\n default: true,\n },\n { modelId: \"openai/gpt-5.4\", label: \"GPT-5.4\", cost: \"$2.50/$10\" },\n {\n modelId: \"google/gemini-3.1-pro\",\n label: \"Gemini 3.1 Pro\",\n cost: \"$1.25/$5\",\n },\n ],\n systemPrompt: PM_PROMPT,\n personaId: \"product-manager\",\n outputStyle: \"detailed\",\n permissionMode: \"plan\",\n routingStrategy: \"quality-first\",\n },\n \"sr-developer\": {\n id: \"sr-developer\",\n displayName: \"Sr. Developer\",\n icon: \"👨💻\",\n color: \"green\",\n description: \"Quality implementation with best models\",\n modelChoices: [\n {\n modelId: \"anthropic/claude-sonnet-4-6\",\n label: \"Claude Sonnet 4.6\",\n cost: \"$3/$15\",\n default: true,\n },\n { modelId: \"openai/gpt-5.4\", label: \"GPT-5.4\", cost: \"$2.50/$10\" },\n {\n modelId: \"deepseek/deepseek-chat\",\n label: \"DeepSeek V3\",\n cost: \"$0.27/$1.10\",\n },\n {\n modelId: \"google/gemini-3.1-pro\",\n label: \"Gemini 3.1 Pro\",\n cost: \"$1.25/$5\",\n },\n ],\n systemPrompt: SR_DEV_PROMPT,\n personaId: \"sr-developer\",\n outputStyle: \"concise\",\n permissionMode: \"confirm\",\n routingStrategy: \"quality-first\",\n },\n \"jr-developer\": {\n id: \"jr-developer\",\n displayName: \"Jr. Developer\",\n icon: \"🧑💻\",\n color: \"yellow\",\n description: \"Fast, cheap implementation for well-specified tasks\",\n modelChoices: [\n {\n modelId: \"anthropic/claude-haiku-4-5-20251001\",\n label: \"Claude Haiku 4.5\",\n cost: \"$0.80/$4\",\n default: true,\n },\n {\n modelId: \"openai/gpt-4.1-mini\",\n label: \"GPT-4.1 Mini\",\n cost: \"$0.40/$1.60\",\n },\n {\n modelId: \"google/gemini-3.1-flash\",\n label: \"Gemini 3.1 Flash\",\n cost: \"$0.15/$0.60\",\n },\n {\n modelId: \"deepseek/deepseek-chat\",\n label: \"DeepSeek V3\",\n cost: \"$0.27/$1.10\",\n },\n ],\n systemPrompt: JR_DEV_PROMPT,\n personaId: \"jr-developer\",\n outputStyle: \"concise\",\n permissionMode: \"confirm\",\n routingStrategy: \"cost-first\",\n blockedTools: [\"git_commit\", \"git_branch\", \"process_spawn\"],\n },\n qa: {\n id: \"qa\",\n displayName: \"QA Engineer\",\n icon: \"🔍\",\n color: \"red\",\n description: \"Testing, code review, edge case discovery\",\n modelChoices: [\n {\n modelId: \"anthropic/claude-sonnet-4-6\",\n label: \"Claude Sonnet 4.6\",\n cost: \"$3/$15\",\n default: true,\n },\n { modelId: \"openai/gpt-5.4\", label: \"GPT-5.4\", cost: \"$2.50/$10\" },\n {\n modelId: \"google/gemini-3.1-pro\",\n label: \"Gemini 3.1 Pro\",\n cost: \"$1.25/$5\",\n },\n {\n modelId: \"anthropic/claude-opus-4-6\",\n label: \"Claude Opus 4.6\",\n cost: \"$15/$75\",\n },\n ],\n systemPrompt: QA_PROMPT,\n personaId: \"qa\",\n outputStyle: \"detailed\",\n permissionMode: \"plan\",\n routingStrategy: \"quality-first\",\n allowedTools: [\n \"file_read\",\n \"grep\",\n \"glob\",\n \"shell\",\n \"git_status\",\n \"git_diff\",\n ],\n },\n};\n\n/**\n * Get the system prompt for a role, composed from expert persona when available.\n * Falls back to the static systemPrompt if no persona is registered.\n */\nexport function getRolePrompt(roleId: RoleId, modelId?: string): string {\n const role = ROLES[roleId];\n if (!role) return \"\";\n\n // Try persona-based composition (model-tuned expert playbook)\n if (role.personaId) {\n const persona = getPersona(role.personaId);\n if (persona) {\n return composePersonaPrompt(persona, modelId);\n }\n }\n\n // Fallback to static prompt\n return role.systemPrompt;\n}\n\n/**\n * Format the model selection menu for a role.\n */\nexport function formatModelMenu(roleId: RoleId): string {\n const role = ROLES[roleId];\n if (!role) return `Unknown role: ${roleId}`;\n\n const header = `${role.icon} ${role.displayName} Mode — select model:`;\n const choices = role.modelChoices.map((m, i) => {\n const num = String(i + 1);\n const def = m.default ? \" ← default\" : \"\";\n return ` ${num}. ${m.label.padEnd(22)} (${m.cost} per 1M)${def}`;\n });\n\n return `\\n${header}\\n${choices.join(\"\\n\")}\\n\\nUse: /${roleId} 1 (or 2, 3, etc.)`;\n}\n\n/**\n * Get the model ID for a role given a selection index (1-based).\n * Returns default if index is 0 or out of range.\n */\nexport function getModelForRole(roleId: RoleId, index: number): string {\n const role = ROLES[roleId];\n if (!role) return \"brainstormrouter/auto\";\n\n if (index >= 1 && index <= role.modelChoices.length) {\n return role.modelChoices[index - 1].modelId;\n }\n const defaultChoice =\n role.modelChoices.find((m) => m.default) ?? role.modelChoices[0];\n return defaultChoice.modelId;\n}\n\n/**\n * Format the confirmation message after a role is applied.\n */\nexport function formatRoleConfirmation(\n roleId: RoleId,\n modelId: string,\n): string {\n const role = ROLES[roleId];\n if (!role) return \"Role applied.\";\n\n const model = role.modelChoices.find((m) => m.modelId === modelId);\n const modelName = model?.label ?? modelId;\n const toolsLabel = role.permissionMode === \"plan\" ? \"read-only\" : \"all\";\n\n return `${role.icon} ${role.displayName} mode active\\n Model: ${modelName} │ Tools: ${toolsLabel} │ Style: ${role.outputStyle}`;\n}\n"],"mappings":";AAQA;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAoCP,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AAW;AAC/C,QAAM,UAAU,KAAK,aAAa,IAAI,CAAC,GAAG,MAAM;AAC9C,UAAM,MAAM,OAAO,IAAI,CAAC;AACxB,UAAM,MAAM,EAAE,UAAU,qBAAgB;AACxC,WAAO,KAAK,GAAG,KAAK,EAAE,MAAM,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,WAAW,GAAG;AAAA,EACjE,CAAC;AAED,SAAO;AAAA,EAAK,MAAM;AAAA,EAAK,QAAQ,KAAK,IAAI,CAAC;AAAA;AAAA,QAAa,MAAM;AAC9D;AAMO,SAAS,gBAAgB,QAAgB,OAAuB;AACrE,QAAM,OAAO,MAAM,MAAM;AACzB,MAAI,CAAC,KAAM,QAAO;AAElB,MAAI,SAAS,KAAK,SAAS,KAAK,aAAa,QAAQ;AACnD,WAAO,KAAK,aAAa,QAAQ,CAAC,EAAE;AAAA,EACtC;AACA,QAAM,gBACJ,KAAK,aAAa,KAAK,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,aAAa,CAAC;AACjE,SAAO,cAAc;AACvB;AAKO,SAAS,uBACd,QACA,SACQ;AACR,QAAM,OAAO,MAAM,MAAM;AACzB,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,QAAQ,KAAK,aAAa,KAAK,CAAC,MAAM,EAAE,YAAY,OAAO;AACjE,QAAM,YAAY,OAAO,SAAS;AAClC,QAAM,aAAa,KAAK,mBAAmB,SAAS,cAAc;AAElE,SAAO,GAAG,KAAK,IAAI,IAAI,KAAK,WAAW;AAAA,WAA0B,SAAS,kBAAa,UAAU,kBAAa,KAAK,WAAW;AAChI;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
__require,
|
|
36
|
+
__commonJS,
|
|
37
|
+
__toESM
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-ZWE3DS7E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|