@soleri/cli 1.7.0 → 1.8.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/dist/commands/create.js +6 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/extend.d.ts +2 -0
- package/dist/commands/extend.js +167 -0
- package/dist/commands/extend.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/prompts/archetypes.d.ts +21 -0
- package/dist/prompts/archetypes.js +153 -0
- package/dist/prompts/archetypes.js.map +1 -0
- package/dist/prompts/create-wizard.d.ts +1 -1
- package/dist/prompts/create-wizard.js +299 -76
- package/dist/prompts/create-wizard.js.map +1 -1
- package/dist/prompts/playbook.d.ts +63 -0
- package/dist/prompts/playbook.js +154 -0
- package/dist/prompts/playbook.js.map +1 -0
- package/package.json +1 -1
- package/src/commands/create.ts +6 -0
- package/src/commands/extend.ts +197 -0
- package/src/main.ts +2 -0
- package/src/prompts/archetypes.ts +212 -0
- package/src/prompts/create-wizard.ts +345 -69
- package/src/prompts/playbook.ts +301 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playbook data for the guided wizard.
|
|
3
|
+
* Provides curated options with self-explanatory hints,
|
|
4
|
+
* organized by category. Each list also supports a "custom" escape hatch
|
|
5
|
+
* with examples and anti-examples so the user is never staring at a blank cursor.
|
|
6
|
+
*/
|
|
7
|
+
export const DOMAIN_OPTIONS = [
|
|
8
|
+
{ value: 'security', label: 'security', hint: 'Vulnerability scanning, threat modeling, secrets detection' },
|
|
9
|
+
{ value: 'code-review', label: 'code-review', hint: 'Pattern enforcement, anti-pattern detection, PR review' },
|
|
10
|
+
{ value: 'testing', label: 'testing', hint: 'Test generation, coverage analysis, mutation testing' },
|
|
11
|
+
{ value: 'api-design', label: 'api-design', hint: 'REST/GraphQL contracts, versioning, error handling' },
|
|
12
|
+
{ value: 'performance', label: 'performance', hint: 'Budgets, profiling, bundle size, query optimization' },
|
|
13
|
+
{ value: 'accessibility', label: 'accessibility', hint: 'WCAG compliance, screen readers, keyboard navigation' },
|
|
14
|
+
{ value: 'architecture', label: 'architecture', hint: 'System design, boundaries, dependency management' },
|
|
15
|
+
{ value: 'database', label: 'database', hint: 'Schema design, migrations, indexing, query tuning' },
|
|
16
|
+
{ value: 'documentation', label: 'documentation', hint: 'API docs, READMEs, changelogs, code comments' },
|
|
17
|
+
{ value: 'devops', label: 'devops', hint: 'CI/CD pipelines, infrastructure as code, deployment' },
|
|
18
|
+
];
|
|
19
|
+
export const CUSTOM_DOMAIN_GUIDANCE = {
|
|
20
|
+
instruction: 'Define a custom domain (kebab-case)',
|
|
21
|
+
examples: [
|
|
22
|
+
'graphql-federation — Schema stitching, subgraph validation, entity resolution',
|
|
23
|
+
'data-pipeline — ETL jobs, stream processing, data quality checks',
|
|
24
|
+
'mobile-ux — Touch targets, gesture handling, responsive layouts',
|
|
25
|
+
],
|
|
26
|
+
antiExamples: [
|
|
27
|
+
'stuff — too vague, what kind of stuff?',
|
|
28
|
+
'MyDomain — must be kebab-case, not camelCase',
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
export const PRINCIPLE_CATEGORIES = [
|
|
32
|
+
{
|
|
33
|
+
label: 'Quality',
|
|
34
|
+
options: [
|
|
35
|
+
{ value: 'Simplicity over cleverness', label: 'Simplicity over cleverness' },
|
|
36
|
+
{ value: 'Convention over configuration', label: 'Convention over configuration' },
|
|
37
|
+
{ value: 'Test everything that can break', label: 'Test everything that can break' },
|
|
38
|
+
{ value: 'Respect existing patterns', label: 'Respect existing patterns' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Safety',
|
|
43
|
+
options: [
|
|
44
|
+
{ value: 'Security first', label: 'Security first' },
|
|
45
|
+
{ value: 'Fail closed, not open', label: 'Fail closed, not open' },
|
|
46
|
+
{ value: 'Zero trust by default', label: 'Zero trust by default' },
|
|
47
|
+
{ value: 'Least privilege always', label: 'Least privilege always' },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'Developer Experience',
|
|
52
|
+
options: [
|
|
53
|
+
{ value: 'Actionable feedback only', label: 'Actionable feedback only' },
|
|
54
|
+
{ value: 'Explain the why, not just the what', label: 'Explain the why, not just the what' },
|
|
55
|
+
{ value: 'Every comment includes a fix suggestion', label: 'Every comment includes a fix suggestion' },
|
|
56
|
+
{ value: 'Design for the consumer, not the implementer', label: 'Design for the consumer, not the implementer' },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: 'Reliability',
|
|
61
|
+
options: [
|
|
62
|
+
{ value: 'Graceful degradation over hard failures', label: 'Graceful degradation over hard failures' },
|
|
63
|
+
{ value: 'Automate everything repeatable', label: 'Automate everything repeatable' },
|
|
64
|
+
{ value: 'Observability built in from day one', label: 'Observability built in from day one' },
|
|
65
|
+
{ value: 'Every migration must be reversible', label: 'Every migration must be reversible' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
export const CUSTOM_PRINCIPLE_GUIDANCE = {
|
|
70
|
+
instruction: 'Write a custom principle',
|
|
71
|
+
examples: [
|
|
72
|
+
'Never suggest any in production without a feature flag',
|
|
73
|
+
'Prefer composition over inheritance',
|
|
74
|
+
'Every public API must have a deprecation path before removal',
|
|
75
|
+
],
|
|
76
|
+
antiExamples: [
|
|
77
|
+
'Write good code — too vague, what does "good" mean?',
|
|
78
|
+
'Follow best practices — which ones? Be specific.',
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
// ─── Skills ─────────────────────────────────────────────────
|
|
82
|
+
/** Core skills — always included, never shown in picker. */
|
|
83
|
+
export const CORE_SKILLS = [
|
|
84
|
+
'brainstorming',
|
|
85
|
+
'systematic-debugging',
|
|
86
|
+
'verification-before-completion',
|
|
87
|
+
'health-check',
|
|
88
|
+
'context-resume',
|
|
89
|
+
];
|
|
90
|
+
export const SKILL_CATEGORIES = [
|
|
91
|
+
{
|
|
92
|
+
label: 'Planning & Execution',
|
|
93
|
+
options: [
|
|
94
|
+
{ value: 'writing-plans', label: 'writing-plans', hint: 'Structured multi-step planning before code changes' },
|
|
95
|
+
{ value: 'executing-plans', label: 'executing-plans', hint: 'Execute approved plans with review checkpoints' },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: 'Knowledge & Learning',
|
|
100
|
+
options: [
|
|
101
|
+
{ value: 'vault-navigator', label: 'vault-navigator', hint: 'Deep-dive vault search and exploration' },
|
|
102
|
+
{ value: 'vault-capture', label: 'vault-capture', hint: 'Persist lessons learned to the knowledge vault' },
|
|
103
|
+
{ value: 'knowledge-harvest', label: 'knowledge-harvest', hint: 'Extract patterns from completed work' },
|
|
104
|
+
{ value: 'brain-debrief', label: 'brain-debrief', hint: 'Post-task intelligence summary and debriefing' },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: 'Code Quality',
|
|
109
|
+
options: [
|
|
110
|
+
{ value: 'code-patrol', label: 'code-patrol', hint: 'Scan for anti-patterns and code violations' },
|
|
111
|
+
{ value: 'test-driven-development', label: 'test-driven-development', hint: 'TDD workflow: red, green, refactor' },
|
|
112
|
+
{ value: 'fix-and-learn', label: 'fix-and-learn', hint: 'Fix bugs and capture the lesson for next time' },
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: 'Team & Process',
|
|
117
|
+
options: [
|
|
118
|
+
{ value: 'retrospective', label: 'retrospective', hint: 'End-of-session retrospective and reflection' },
|
|
119
|
+
{ value: 'second-opinion', label: 'second-opinion', hint: 'Get a fresh perspective on tough decisions' },
|
|
120
|
+
{ value: 'onboard-me', label: 'onboard-me', hint: 'Guided codebase onboarding for new team members' },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
/** Flat list of all optional skill values. */
|
|
125
|
+
export const ALL_OPTIONAL_SKILLS = SKILL_CATEGORIES.flatMap((c) => c.options.map((o) => o.value));
|
|
126
|
+
export const TONE_OPTIONS = [
|
|
127
|
+
{ value: 'precise', label: 'Precise', hint: 'Direct, factual, minimal commentary' },
|
|
128
|
+
{ value: 'mentor', label: 'Mentor', hint: 'Educational, explains the "why" behind suggestions' },
|
|
129
|
+
{ value: 'pragmatic', label: 'Pragmatic', hint: 'Balanced, focuses on actionable outcomes' },
|
|
130
|
+
];
|
|
131
|
+
// ─── Custom field guidance (role, description, greeting) ────
|
|
132
|
+
export const CUSTOM_ROLE_GUIDANCE = {
|
|
133
|
+
instruction: 'Describe what your agent does (one sentence)',
|
|
134
|
+
examples: [
|
|
135
|
+
'Enforces accessibility standards across React components',
|
|
136
|
+
'Generates and maintains API documentation from code',
|
|
137
|
+
'Monitors performance budgets and flags regressions',
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
export const CUSTOM_DESCRIPTION_GUIDANCE = {
|
|
141
|
+
instruction: 'Describe your agent in detail (10-500 characters)',
|
|
142
|
+
examples: [
|
|
143
|
+
'This agent validates GraphQL schemas against federation rules, checks for breaking changes, and ensures consistent naming conventions across subgraphs.',
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
export const CUSTOM_GREETING_GUIDANCE = {
|
|
147
|
+
instruction: 'Write a custom greeting (first thing users see)',
|
|
148
|
+
examples: [
|
|
149
|
+
"Hola! I'm Salvador — your design system guardian.",
|
|
150
|
+
'Ready to review. Drop a PR link or describe the issue.',
|
|
151
|
+
"Hey! Let's make sure your APIs are rock solid.",
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=playbook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbook.js","sourceRoot":"","sources":["../../src/prompts/playbook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,EAAE,KAAK,EAAE,UAAU,EAAE,K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D;IAC9D,QAAQ,EAAE;QACR,mDAAmD;QACnD,wDAAwD;QACxD,gDAAgD;KACjD;CACF,CAAC"}
|
package/package.json
CHANGED
package/src/commands/create.ts
CHANGED
|
@@ -84,6 +84,12 @@ export function registerCreate(program: Command): void {
|
|
|
84
84
|
p.log.info(`Will create ${preview.files.length} files in ${preview.agentDir}`);
|
|
85
85
|
p.log.info(`Facades: ${preview.facades.map((f) => f.name).join(', ')}`);
|
|
86
86
|
p.log.info(`Domains: ${preview.domains.join(', ')}`);
|
|
87
|
+
if (config.tone) {
|
|
88
|
+
p.log.info(`Tone: ${config.tone}`);
|
|
89
|
+
}
|
|
90
|
+
if (config.skills?.length) {
|
|
91
|
+
p.log.info(`Skills: ${config.skills.length} selected`);
|
|
92
|
+
}
|
|
87
93
|
if (selectedPacks.length > 0) {
|
|
88
94
|
p.log.info(`Hook packs: ${selectedPacks.join(', ')}`);
|
|
89
95
|
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import * as p from '@clack/prompts';
|
|
3
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { detectAgent } from '../utils/agent-context.js';
|
|
6
|
+
|
|
7
|
+
export function registerExtend(program: Command): void {
|
|
8
|
+
const extend = program
|
|
9
|
+
.command('extend')
|
|
10
|
+
.description('Manage agent extensions — custom ops, facades, middleware');
|
|
11
|
+
|
|
12
|
+
extend
|
|
13
|
+
.command('init')
|
|
14
|
+
.description('Initialize the extensions directory (if not already present)')
|
|
15
|
+
.action(async () => {
|
|
16
|
+
const ctx = detectAgent();
|
|
17
|
+
if (!ctx) {
|
|
18
|
+
p.log.error('No agent project detected. Run this from an agent root.');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const extDir = join(ctx.agentPath, 'src', 'extensions');
|
|
23
|
+
if (existsSync(join(extDir, 'index.ts'))) {
|
|
24
|
+
p.log.info('Extensions directory already exists.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const dirs = ['', 'ops', 'facades', 'middleware'];
|
|
29
|
+
for (const d of dirs) {
|
|
30
|
+
mkdirSync(join(extDir, d), { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { generateExtensionsIndex, generateExampleOp } = await import('@soleri/forge/lib');
|
|
34
|
+
const config = { id: ctx.agentId, name: ctx.agentId } as Parameters<
|
|
35
|
+
typeof generateExtensionsIndex
|
|
36
|
+
>[0];
|
|
37
|
+
writeFileSync(join(extDir, 'index.ts'), generateExtensionsIndex(config), 'utf-8');
|
|
38
|
+
writeFileSync(join(extDir, 'ops', 'example.ts'), generateExampleOp(config), 'utf-8');
|
|
39
|
+
|
|
40
|
+
p.log.success('Extensions directory created at src/extensions/');
|
|
41
|
+
p.log.info(
|
|
42
|
+
'Edit src/extensions/index.ts to register your custom ops, facades, and middleware.',
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
extend
|
|
47
|
+
.command('add-op')
|
|
48
|
+
.argument('<name>', 'Operation name in snake_case (e.g., "summarize_pr")')
|
|
49
|
+
.description('Scaffold a new custom op')
|
|
50
|
+
.action(async (name: string) => {
|
|
51
|
+
const ctx = detectAgent();
|
|
52
|
+
if (!ctx) {
|
|
53
|
+
p.log.error('No agent project detected. Run this from an agent root.');
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const opsDir = join(ctx.agentPath, 'src', 'extensions', 'ops');
|
|
58
|
+
mkdirSync(opsDir, { recursive: true });
|
|
59
|
+
|
|
60
|
+
const fileName = name.replace(/_/g, '-');
|
|
61
|
+
const filePath = join(opsDir, `${fileName}.ts`);
|
|
62
|
+
|
|
63
|
+
if (existsSync(filePath)) {
|
|
64
|
+
p.log.error(`File already exists: src/extensions/ops/${fileName}.ts`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const fnName =
|
|
69
|
+
'create' +
|
|
70
|
+
name
|
|
71
|
+
.split('_')
|
|
72
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
73
|
+
.join('') +
|
|
74
|
+
'Op';
|
|
75
|
+
|
|
76
|
+
const content = `import { z } from 'zod';
|
|
77
|
+
import type { OpDefinition, AgentRuntime } from '@soleri/core';
|
|
78
|
+
|
|
79
|
+
export function ${fnName}(runtime: AgentRuntime): OpDefinition {
|
|
80
|
+
return {
|
|
81
|
+
name: '${name}',
|
|
82
|
+
description: 'TODO: describe what this op does',
|
|
83
|
+
auth: 'read',
|
|
84
|
+
schema: z.object({
|
|
85
|
+
// TODO: define your parameters
|
|
86
|
+
}),
|
|
87
|
+
handler: async (params) => {
|
|
88
|
+
// TODO: implement your logic
|
|
89
|
+
// You have access to runtime.vault, runtime.brain, runtime.planner, etc.
|
|
90
|
+
return { status: 'ok' };
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
writeFileSync(filePath, content, 'utf-8');
|
|
97
|
+
p.log.success(`Created src/extensions/ops/${fileName}.ts`);
|
|
98
|
+
p.log.info(`Import ${fnName} in src/extensions/index.ts and add it to the ops array.`);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
extend
|
|
102
|
+
.command('add-facade')
|
|
103
|
+
.argument('<name>', 'Facade name in kebab-case (e.g., "github")')
|
|
104
|
+
.description('Scaffold a new custom facade')
|
|
105
|
+
.action(async (name: string) => {
|
|
106
|
+
const ctx = detectAgent();
|
|
107
|
+
if (!ctx) {
|
|
108
|
+
p.log.error('No agent project detected. Run this from an agent root.');
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const facadesDir = join(ctx.agentPath, 'src', 'extensions', 'facades');
|
|
113
|
+
mkdirSync(facadesDir, { recursive: true });
|
|
114
|
+
|
|
115
|
+
const filePath = join(facadesDir, `${name}.ts`);
|
|
116
|
+
if (existsSync(filePath)) {
|
|
117
|
+
p.log.error(`File already exists: src/extensions/facades/${name}.ts`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const facadeName = `${ctx.agentId}_${name.replace(/-/g, '_')}`;
|
|
122
|
+
const className = name
|
|
123
|
+
.split('-')
|
|
124
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
125
|
+
.join('');
|
|
126
|
+
|
|
127
|
+
const content = `import { z } from 'zod';
|
|
128
|
+
import type { FacadeConfig, AgentRuntime } from '@soleri/core';
|
|
129
|
+
|
|
130
|
+
export function create${className}Facade(runtime: AgentRuntime): FacadeConfig {
|
|
131
|
+
return {
|
|
132
|
+
name: '${facadeName}',
|
|
133
|
+
description: 'TODO: describe this facade',
|
|
134
|
+
ops: [
|
|
135
|
+
{
|
|
136
|
+
name: 'status',
|
|
137
|
+
description: 'TODO: describe this op',
|
|
138
|
+
auth: 'read',
|
|
139
|
+
schema: z.object({}),
|
|
140
|
+
handler: async () => {
|
|
141
|
+
return { status: 'ok' };
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
|
|
149
|
+
writeFileSync(filePath, content, 'utf-8');
|
|
150
|
+
p.log.success(`Created src/extensions/facades/${name}.ts`);
|
|
151
|
+
p.log.info(`Import and add the facade to src/extensions/index.ts facades array.`);
|
|
152
|
+
p.log.info(`This will register as MCP tool: ${facadeName}`);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
extend
|
|
156
|
+
.command('add-middleware')
|
|
157
|
+
.argument('<name>', 'Middleware name in kebab-case (e.g., "audit-logger")')
|
|
158
|
+
.description('Scaffold a new middleware')
|
|
159
|
+
.action(async (name: string) => {
|
|
160
|
+
const ctx = detectAgent();
|
|
161
|
+
if (!ctx) {
|
|
162
|
+
p.log.error('No agent project detected. Run this from an agent root.');
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const mwDir = join(ctx.agentPath, 'src', 'extensions', 'middleware');
|
|
167
|
+
mkdirSync(mwDir, { recursive: true });
|
|
168
|
+
|
|
169
|
+
const filePath = join(mwDir, `${name}.ts`);
|
|
170
|
+
if (existsSync(filePath)) {
|
|
171
|
+
p.log.error(`File already exists: src/extensions/middleware/${name}.ts`);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const varName = name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
176
|
+
|
|
177
|
+
const content = `import type { OpMiddleware } from '@soleri/core';
|
|
178
|
+
|
|
179
|
+
export const ${varName}: OpMiddleware = {
|
|
180
|
+
name: '${name}',
|
|
181
|
+
before: async (ctx) => {
|
|
182
|
+
// Runs before every op. Return modified params or throw to reject.
|
|
183
|
+
// console.error(\`[\${ctx.facade}.\${ctx.op}] called\`);
|
|
184
|
+
return ctx.params;
|
|
185
|
+
},
|
|
186
|
+
after: async (ctx) => {
|
|
187
|
+
// Runs after every op. Return modified result or throw.
|
|
188
|
+
return ctx.result;
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
writeFileSync(filePath, content, 'utf-8');
|
|
194
|
+
p.log.success(`Created src/extensions/middleware/${name}.ts`);
|
|
195
|
+
p.log.info('Import and add to src/extensions/index.ts middleware array.');
|
|
196
|
+
});
|
|
197
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { registerHooks } from './commands/hooks.js';
|
|
|
12
12
|
import { registerGovernance } from './commands/governance.js';
|
|
13
13
|
import { registerTest } from './commands/test.js';
|
|
14
14
|
import { registerUpgrade } from './commands/upgrade.js';
|
|
15
|
+
import { registerExtend } from './commands/extend.js';
|
|
15
16
|
|
|
16
17
|
const require = createRequire(import.meta.url);
|
|
17
18
|
const { version } = require('../package.json');
|
|
@@ -33,5 +34,6 @@ registerHooks(program);
|
|
|
33
34
|
registerGovernance(program);
|
|
34
35
|
registerTest(program);
|
|
35
36
|
registerUpgrade(program);
|
|
37
|
+
registerExtend(program);
|
|
36
38
|
|
|
37
39
|
program.parse();
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-built agent archetypes that pre-fill the wizard.
|
|
3
|
+
* Each archetype provides sensible defaults for role, description,
|
|
4
|
+
* domains, principles, skills, and greeting — so the user can
|
|
5
|
+
* scaffold a full agent with minimal typing.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface Archetype {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
hint: string;
|
|
12
|
+
defaults: {
|
|
13
|
+
role: string;
|
|
14
|
+
description: string;
|
|
15
|
+
domains: string[];
|
|
16
|
+
principles: string[];
|
|
17
|
+
skills: string[];
|
|
18
|
+
tone: 'precise' | 'mentor' | 'pragmatic';
|
|
19
|
+
greetingTemplate: (name: string) => string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ARCHETYPES: Archetype[] = [
|
|
24
|
+
{
|
|
25
|
+
value: 'code-reviewer',
|
|
26
|
+
label: 'Code Reviewer',
|
|
27
|
+
hint: 'Catches bugs, enforces patterns, reviews PRs before merge',
|
|
28
|
+
defaults: {
|
|
29
|
+
role: 'Catches bugs, enforces code patterns, and reviews pull requests before merge',
|
|
30
|
+
description:
|
|
31
|
+
'This agent reviews code for quality issues, anti-patterns, naming conventions, test coverage gaps, and architectural violations. It provides actionable feedback with concrete fix suggestions.',
|
|
32
|
+
domains: ['code-review', 'architecture'],
|
|
33
|
+
principles: [
|
|
34
|
+
'Actionable feedback only',
|
|
35
|
+
'Respect existing patterns',
|
|
36
|
+
'Simplicity over cleverness',
|
|
37
|
+
],
|
|
38
|
+
skills: [
|
|
39
|
+
'writing-plans',
|
|
40
|
+
'executing-plans',
|
|
41
|
+
'code-patrol',
|
|
42
|
+
'fix-and-learn',
|
|
43
|
+
'second-opinion',
|
|
44
|
+
],
|
|
45
|
+
tone: 'pragmatic',
|
|
46
|
+
greetingTemplate: (name) =>
|
|
47
|
+
`Hello! I'm ${name}. Drop a PR link or paste code — I'll review it for bugs, patterns, and quality.`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: 'security-auditor',
|
|
52
|
+
label: 'Security Auditor',
|
|
53
|
+
hint: 'OWASP Top 10, dependency scanning, secrets detection',
|
|
54
|
+
defaults: {
|
|
55
|
+
role: 'Identifies vulnerabilities and enforces secure coding practices',
|
|
56
|
+
description:
|
|
57
|
+
'This agent scans code for security issues including OWASP Top 10, dependency vulnerabilities, secrets exposure, injection risks, and insecure configurations. It provides remediation guidance with severity ratings.',
|
|
58
|
+
domains: ['security', 'code-review'],
|
|
59
|
+
principles: [
|
|
60
|
+
'Security first',
|
|
61
|
+
'Fail closed, not open',
|
|
62
|
+
'Zero trust by default',
|
|
63
|
+
'Least privilege always',
|
|
64
|
+
],
|
|
65
|
+
skills: [
|
|
66
|
+
'writing-plans',
|
|
67
|
+
'executing-plans',
|
|
68
|
+
'code-patrol',
|
|
69
|
+
'fix-and-learn',
|
|
70
|
+
'vault-navigator',
|
|
71
|
+
],
|
|
72
|
+
tone: 'precise',
|
|
73
|
+
greetingTemplate: (name) =>
|
|
74
|
+
`Hello! I'm ${name}. I help identify vulnerabilities and enforce secure coding practices across your codebase.`,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: 'api-architect',
|
|
79
|
+
label: 'API Architect',
|
|
80
|
+
hint: 'REST/GraphQL design, contract validation, versioning',
|
|
81
|
+
defaults: {
|
|
82
|
+
role: 'Designs and validates APIs for consistency, usability, and correctness',
|
|
83
|
+
description:
|
|
84
|
+
'This agent reviews API designs for RESTful conventions, GraphQL best practices, versioning strategy, error handling, pagination patterns, and contract consistency. It catches breaking changes before they ship.',
|
|
85
|
+
domains: ['api-design', 'architecture'],
|
|
86
|
+
principles: [
|
|
87
|
+
'Convention over configuration',
|
|
88
|
+
'Design for the consumer, not the implementer',
|
|
89
|
+
'Respect existing patterns',
|
|
90
|
+
'Every migration must be reversible',
|
|
91
|
+
],
|
|
92
|
+
skills: [
|
|
93
|
+
'writing-plans',
|
|
94
|
+
'executing-plans',
|
|
95
|
+
'vault-navigator',
|
|
96
|
+
'vault-capture',
|
|
97
|
+
'second-opinion',
|
|
98
|
+
],
|
|
99
|
+
tone: 'mentor',
|
|
100
|
+
greetingTemplate: (name) =>
|
|
101
|
+
`Hello! I'm ${name}. Share your API design or schema — I'll review it for consistency, usability, and best practices.`,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: 'test-engineer',
|
|
106
|
+
label: 'Test Engineer',
|
|
107
|
+
hint: 'Test generation, coverage analysis, TDD workflow',
|
|
108
|
+
defaults: {
|
|
109
|
+
role: 'Generates tests, analyzes coverage, and enforces test-driven development',
|
|
110
|
+
description:
|
|
111
|
+
'This agent helps write comprehensive test suites, identifies coverage gaps, suggests edge cases, and guides TDD workflows. It supports unit, integration, and end-to-end testing strategies.',
|
|
112
|
+
domains: ['testing', 'code-review'],
|
|
113
|
+
principles: [
|
|
114
|
+
'Test everything that can break',
|
|
115
|
+
'Simplicity over cleverness',
|
|
116
|
+
'Actionable feedback only',
|
|
117
|
+
'Respect existing patterns',
|
|
118
|
+
],
|
|
119
|
+
skills: [
|
|
120
|
+
'writing-plans',
|
|
121
|
+
'executing-plans',
|
|
122
|
+
'test-driven-development',
|
|
123
|
+
'fix-and-learn',
|
|
124
|
+
'code-patrol',
|
|
125
|
+
],
|
|
126
|
+
tone: 'pragmatic',
|
|
127
|
+
greetingTemplate: (name) =>
|
|
128
|
+
`Hello! I'm ${name}. Point me at code that needs tests — I'll generate comprehensive suites and identify coverage gaps.`,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
value: 'devops-pilot',
|
|
133
|
+
label: 'DevOps Pilot',
|
|
134
|
+
hint: 'CI/CD pipelines, infrastructure, deployment automation',
|
|
135
|
+
defaults: {
|
|
136
|
+
role: 'Manages CI/CD pipelines, infrastructure, and deployment automation',
|
|
137
|
+
description:
|
|
138
|
+
'This agent helps design and maintain CI/CD pipelines, Docker configurations, infrastructure as code, monitoring setup, and deployment strategies. It follows reliability engineering best practices.',
|
|
139
|
+
domains: ['devops', 'architecture'],
|
|
140
|
+
principles: [
|
|
141
|
+
'Automate everything repeatable',
|
|
142
|
+
'Graceful degradation over hard failures',
|
|
143
|
+
'Observability built in from day one',
|
|
144
|
+
'Convention over configuration',
|
|
145
|
+
],
|
|
146
|
+
skills: [
|
|
147
|
+
'writing-plans',
|
|
148
|
+
'executing-plans',
|
|
149
|
+
'vault-navigator',
|
|
150
|
+
'fix-and-learn',
|
|
151
|
+
'knowledge-harvest',
|
|
152
|
+
],
|
|
153
|
+
tone: 'pragmatic',
|
|
154
|
+
greetingTemplate: (name) =>
|
|
155
|
+
`Hello! I'm ${name}. I help with CI/CD, infrastructure, and deployment — describe your setup or issue.`,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: 'database-architect',
|
|
160
|
+
label: 'Database Architect',
|
|
161
|
+
hint: 'Schema design, migrations, query optimization',
|
|
162
|
+
defaults: {
|
|
163
|
+
role: 'Designs database schemas, manages migrations, and optimizes queries',
|
|
164
|
+
description:
|
|
165
|
+
'This agent reviews database designs for normalization, indexing strategy, migration safety, query performance, and data integrity. It supports SQL and NoSQL patterns.',
|
|
166
|
+
domains: ['database', 'performance'],
|
|
167
|
+
principles: [
|
|
168
|
+
'Every migration must be reversible',
|
|
169
|
+
'Convention over configuration',
|
|
170
|
+
'Test everything that can break',
|
|
171
|
+
'Simplicity over cleverness',
|
|
172
|
+
],
|
|
173
|
+
skills: [
|
|
174
|
+
'writing-plans',
|
|
175
|
+
'executing-plans',
|
|
176
|
+
'vault-navigator',
|
|
177
|
+
'vault-capture',
|
|
178
|
+
'knowledge-harvest',
|
|
179
|
+
],
|
|
180
|
+
tone: 'precise',
|
|
181
|
+
greetingTemplate: (name) =>
|
|
182
|
+
`Hello! I'm ${name}. Share your schema, migration, or query — I'll review it for correctness and performance.`,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
value: 'full-stack',
|
|
187
|
+
label: 'Full-Stack Assistant',
|
|
188
|
+
hint: 'General-purpose dev helper across the entire stack',
|
|
189
|
+
defaults: {
|
|
190
|
+
role: 'A general-purpose development assistant across the full stack',
|
|
191
|
+
description:
|
|
192
|
+
'This agent helps with frontend, backend, database, testing, and deployment tasks. It provides balanced guidance across the entire stack without deep specialization in any single area.',
|
|
193
|
+
domains: ['code-review', 'testing', 'architecture'],
|
|
194
|
+
principles: [
|
|
195
|
+
'Simplicity over cleverness',
|
|
196
|
+
'Test everything that can break',
|
|
197
|
+
'Respect existing patterns',
|
|
198
|
+
],
|
|
199
|
+
skills: [
|
|
200
|
+
'writing-plans',
|
|
201
|
+
'executing-plans',
|
|
202
|
+
'test-driven-development',
|
|
203
|
+
'code-patrol',
|
|
204
|
+
'fix-and-learn',
|
|
205
|
+
'vault-navigator',
|
|
206
|
+
],
|
|
207
|
+
tone: 'mentor',
|
|
208
|
+
greetingTemplate: (name) =>
|
|
209
|
+
`Hello! I'm ${name}. I help across the full stack — frontend, backend, testing, deployment. What are you working on?`,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
];
|