recoder-code 2.4.6 → 2.5.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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Agent creation command - Create custom agents from templates
3
+ */
4
+ export declare function createAgent(): Promise<void>;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Agent creation command - Create custom agents from templates
3
+ */
4
+ import inquirer from 'inquirer';
5
+ import fs from 'fs';
6
+ import path from 'path';
7
+ import os from 'os';
8
+ import chalk from 'chalk';
9
+ const AGENTS_DIR_PROJECT = '.recoder/agents';
10
+ const AGENTS_DIR_USER = path.join(os.homedir(), '.recoder-code', 'agents');
11
+ const AGENT_TEMPLATES = [
12
+ {
13
+ name: 'explorer',
14
+ description: 'Code discovery & research specialist',
15
+ systemPrompt: `You are an expert code explorer and researcher. Your role is to:
16
+ - Search and analyze codebases to understand structure and patterns
17
+ - Find relevant code examples and implementations
18
+ - Identify dependencies and relationships between components
19
+ - Discover best practices and conventions used in the project
20
+ - Provide comprehensive reports on code organization
21
+
22
+ Always be thorough and cite specific file paths and line numbers.`,
23
+ },
24
+ {
25
+ name: 'coder',
26
+ description: 'Implementation specialist',
27
+ systemPrompt: `You are an expert software engineer focused on implementation. Your role is to:
28
+ - Write clean, production-ready code following best practices
29
+ - Implement features with proper error handling and edge cases
30
+ - Follow the project's existing patterns and conventions
31
+ - Write self-documenting code with clear variable names
32
+ - Consider performance and maintainability
33
+
34
+ Always write complete, working implementations - no placeholders or TODOs.`,
35
+ },
36
+ {
37
+ name: 'reviewer',
38
+ description: 'Code quality & security specialist',
39
+ systemPrompt: `You are an expert code reviewer focused on quality and security. Your role is to:
40
+ - Review code for bugs, security vulnerabilities, and performance issues
41
+ - Check adherence to best practices and design patterns
42
+ - Identify potential edge cases and error scenarios
43
+ - Suggest improvements for readability and maintainability
44
+ - Verify proper error handling and input validation
45
+
46
+ Provide specific, actionable feedback with examples.`,
47
+ },
48
+ {
49
+ name: 'tester',
50
+ description: 'Test creation specialist',
51
+ systemPrompt: `You are an expert test engineer. Your role is to:
52
+ - Write comprehensive unit, integration, and e2e tests
53
+ - Cover edge cases and error scenarios
54
+ - Follow testing best practices (AAA pattern, clear assertions)
55
+ - Create meaningful test descriptions
56
+ - Ensure high code coverage
57
+
58
+ Write tests that are maintainable and serve as documentation.`,
59
+ },
60
+ {
61
+ name: 'documenter',
62
+ description: 'Documentation specialist',
63
+ systemPrompt: `You are an expert technical writer. Your role is to:
64
+ - Create clear, comprehensive documentation
65
+ - Write API documentation with examples
66
+ - Document architecture and design decisions
67
+ - Create user guides and tutorials
68
+ - Maintain README files and changelogs
69
+
70
+ Write documentation that is accessible to both beginners and experts.`,
71
+ },
72
+ {
73
+ name: 'custom',
74
+ description: 'Start from scratch',
75
+ systemPrompt: `You are a helpful AI assistant. Customize this prompt for your specific needs.`,
76
+ },
77
+ ];
78
+ export async function createAgent() {
79
+ console.log(chalk.bold.cyan('\nšŸ¤– Create Custom Agent\n'));
80
+ const answers = await inquirer.prompt([
81
+ {
82
+ type: 'list',
83
+ name: 'template',
84
+ message: 'Choose a template:',
85
+ choices: AGENT_TEMPLATES.map(t => ({
86
+ name: `${t.name} - ${t.description}`,
87
+ value: t.name,
88
+ })),
89
+ },
90
+ {
91
+ type: 'input',
92
+ name: 'name',
93
+ message: 'Agent name:',
94
+ validate: (input) => {
95
+ if (!input)
96
+ return 'Name is required';
97
+ if (!/^[a-z0-9-]+$/.test(input))
98
+ return 'Use lowercase letters, numbers, and hyphens only';
99
+ return true;
100
+ },
101
+ },
102
+ {
103
+ type: 'input',
104
+ name: 'description',
105
+ message: 'Description:',
106
+ default: (answers) => {
107
+ const template = AGENT_TEMPLATES.find(t => t.name === answers.template);
108
+ return template?.description || '';
109
+ },
110
+ },
111
+ {
112
+ type: 'list',
113
+ name: 'location',
114
+ message: 'Save location:',
115
+ choices: [
116
+ { name: 'Project (.recoder/agents/) - Available in this project only', value: 'project' },
117
+ { name: 'User (~/.recoder-code/agents/) - Available globally', value: 'user' },
118
+ ],
119
+ default: 'project',
120
+ },
121
+ {
122
+ type: 'confirm',
123
+ name: 'customize',
124
+ message: 'Customize system prompt now?',
125
+ default: false,
126
+ },
127
+ ]);
128
+ const template = AGENT_TEMPLATES.find(t => t.name === answers.template);
129
+ let systemPrompt = template?.systemPrompt || '';
130
+ if (answers.customize) {
131
+ const { prompt } = await inquirer.prompt([
132
+ {
133
+ type: 'editor',
134
+ name: 'prompt',
135
+ message: 'Edit system prompt:',
136
+ default: systemPrompt,
137
+ },
138
+ ]);
139
+ systemPrompt = prompt;
140
+ }
141
+ const dir = answers.location === 'project' ? AGENTS_DIR_PROJECT : AGENTS_DIR_USER;
142
+ if (!fs.existsSync(dir)) {
143
+ fs.mkdirSync(dir, { recursive: true });
144
+ }
145
+ const filePath = path.join(dir, `${answers.name}.md`);
146
+ if (fs.existsSync(filePath)) {
147
+ const { overwrite } = await inquirer.prompt([
148
+ {
149
+ type: 'confirm',
150
+ name: 'overwrite',
151
+ message: `Agent "${answers.name}" already exists. Overwrite?`,
152
+ default: false,
153
+ },
154
+ ]);
155
+ if (!overwrite) {
156
+ console.log(chalk.yellow('\nāŒ Cancelled'));
157
+ return;
158
+ }
159
+ }
160
+ const content = `---
161
+ name: ${answers.name}
162
+ description: ${answers.description}
163
+ template: ${answers.template}
164
+ ---
165
+
166
+ ${systemPrompt}
167
+ `;
168
+ fs.writeFileSync(filePath, content, 'utf-8');
169
+ console.log(chalk.green(`\nāœ… Agent "${answers.name}" created successfully!`));
170
+ console.log(chalk.gray(` Location: ${filePath}`));
171
+ console.log(chalk.cyan('\nšŸ’” Usage:'));
172
+ console.log(chalk.gray(` In chat: "Let the ${answers.name} agent help with this"`));
173
+ console.log(chalk.gray(` Edit: ${filePath}`));
174
+ console.log();
175
+ }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import chalk from 'chalk';
5
5
  import { listAgents, createAgentFromTemplate } from './agents/list.js';
6
+ import { createAgent } from './agents/create.js';
6
7
  const listCommand = {
7
8
  command: 'list',
8
9
  describe: 'List all available agents',
@@ -11,6 +12,14 @@ const listCommand = {
11
12
  process.exit(0);
12
13
  },
13
14
  };
15
+ const createInteractiveCommand = {
16
+ command: 'new',
17
+ describe: 'Create a custom agent interactively',
18
+ handler: async () => {
19
+ await createAgent();
20
+ process.exit(0);
21
+ },
22
+ };
14
23
  const createCommand = {
15
24
  command: 'create <name>',
16
25
  describe: 'Create a new agent from template',
@@ -47,7 +56,12 @@ const createCommand = {
47
56
  export const agentsCommand = {
48
57
  command: 'agents',
49
58
  describe: 'Manage AI agents (built-in and custom)',
50
- builder: (yargs) => yargs.command(listCommand).command(createCommand).demandCommand(0).version(false),
59
+ builder: (yargs) => yargs
60
+ .command(listCommand)
61
+ .command(createInteractiveCommand)
62
+ .command(createCommand)
63
+ .demandCommand(0)
64
+ .version(false),
51
65
  handler: async () => {
52
66
  await listAgents();
53
67
  process.exit(0);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Connect command module - Add custom providers interactively
3
+ */
4
+ import type { CommandModule } from 'yargs';
5
+ export declare const connectCommand: CommandModule;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Connect command module - Add custom providers interactively
3
+ */
4
+ import { connectProvider } from './connect.js';
5
+ export const connectCommand = {
6
+ command: 'connect',
7
+ describe: 'Add a custom AI provider (LM Studio, vLLM, etc.)',
8
+ handler: async () => {
9
+ await connectProvider();
10
+ process.exit(0);
11
+ },
12
+ };
@@ -1,7 +1,4 @@
1
1
  /**
2
- * /connect command - Interactive provider setup and health check
2
+ * Interactive provider configuration command
3
3
  */
4
- /**
5
- * Interactive connect command
6
- */
7
- export declare function connectCommand(args?: string[]): Promise<void>;
4
+ export declare function connectProvider(): Promise<void>;