Skip to content

Commit 6c8c3ec

Browse files
committed
add init
1 parent 11d3b51 commit 6c8c3ec

File tree

3 files changed

+205
-3
lines changed

3 files changed

+205
-3
lines changed

actions/init.js

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
const chalk = require('chalk');
2+
const axios = require('axios');
3+
const fs = require('fs');
4+
const path = require('path');
5+
const yaml = require('js-yaml');
6+
const inquirer = require('inquirer');
7+
8+
const { checkUserAuth, getUserData } = require('./userData');
9+
10+
const init = async () => {
11+
try {
12+
console.log(chalk.blue('🚀 Initializing Codebolt Agent...\n'));
13+
14+
// Prompt for basic details
15+
const questions = [
16+
{
17+
type: 'input',
18+
name: 'title',
19+
message: 'Enter agent title:',
20+
default: 'My Codebolt Agent'
21+
},
22+
{
23+
type: 'input',
24+
name: 'unique_id',
25+
message: 'Enter unique identifier (no spaces, lowercase):',
26+
default: 'mycodeboltagent',
27+
validate: (input) => {
28+
if (input.includes(' ')) {
29+
return 'Unique ID cannot contain spaces';
30+
}
31+
return true;
32+
}
33+
},
34+
{
35+
type: 'input',
36+
name: 'description',
37+
message: 'Enter agent description:',
38+
default: 'A custom Codebolt agent'
39+
},
40+
{
41+
type: 'input',
42+
name: 'initial_message',
43+
message: 'Enter initial greeting message:',
44+
default: 'Hello! I\'m your AI assistant. How can I help you today?'
45+
},
46+
{
47+
type: 'input',
48+
name: 'author',
49+
message: 'Enter author name:',
50+
default: 'codebolt'
51+
},
52+
{
53+
type: 'input',
54+
name: 'version',
55+
message: 'Enter version:',
56+
default: '1.0.0'
57+
}
58+
];
59+
60+
const answers = await inquirer.prompt(questions);
61+
62+
// Create the YAML content
63+
const agentConfig = {
64+
title: answers.title,
65+
unique_id: answers.unique_id,
66+
initial_message: answers.initial_message,
67+
description: answers.description,
68+
tags: [
69+
'custom-agent',
70+
'codebolt-agent'
71+
],
72+
longDescription: `A custom agent created for the Codebolt platform with the following capabilities: ${answers.description}`,
73+
avatarSrc: 'https://placehold.co/200x200',
74+
avatarFallback: 'CA',
75+
metadata: {
76+
agent_routing: {
77+
worksonblankcode: true,
78+
worksonexistingcode: true,
79+
supportedlanguages: [
80+
'all',
81+
'javascript',
82+
'typescript',
83+
'python',
84+
'go',
85+
'ruby'
86+
],
87+
supportedframeworks: [
88+
'all',
89+
'nextjs',
90+
'reactjs',
91+
'nodejs',
92+
'express',
93+
'django'
94+
]
95+
},
96+
defaultagentllm: {
97+
strict: true,
98+
modelorder: [
99+
'ollama2'
100+
]
101+
},
102+
sdlc_steps_managed: [
103+
{
104+
name: 'codegeneration',
105+
example_instructions: [
106+
'Generate a new React component',
107+
'Create a new API endpoint'
108+
]
109+
},
110+
{
111+
name: 'deployment',
112+
example_instructions: [
113+
'deploy this file to cloudflare',
114+
'deploy this file to firebase'
115+
]
116+
}
117+
],
118+
llm_role: [
119+
{
120+
name: 'documentationllm',
121+
description: 'LLM to be used for advanced Documentation. Please select a model that excels in documentation tasks.',
122+
strict: true,
123+
modelorder: [
124+
'gpt-4-turbo',
125+
'gpt-3.5-turbo',
126+
'mistral7b.perplexity',
127+
'mistral7b.any',
128+
'llama2-70b',
129+
'llama2-15b',
130+
'group.documentationmodels'
131+
]
132+
},
133+
{
134+
name: 'testingllm',
135+
description: 'LLM to be used for advanced Testing. Please select a model that excels in testing tasks.',
136+
strict: true,
137+
modelorder: [
138+
'gpt-4-turbo',
139+
'gpt-3.5-turbo',
140+
'mistral7b.perplexity',
141+
'mistral7b.any',
142+
'llama2-70b',
143+
'llama2-15b',
144+
'group.testingmodels'
145+
]
146+
},
147+
{
148+
name: 'actionllm',
149+
description: 'LLM to be used for executing advanced actions.',
150+
strict: true,
151+
modelorder: [
152+
'gpt-4-turbo',
153+
'gpt-3.5-turbo',
154+
'mistral7b.perplexity',
155+
'mistral7b.any',
156+
'llama2-70b',
157+
'llama2-15b',
158+
'group.actionmodels'
159+
]
160+
}
161+
]
162+
},
163+
actions: [
164+
{
165+
name: 'Execute',
166+
description: 'Executes the given task.',
167+
detailDescription: 'more detailed description',
168+
actionPrompt: 'Please run this code'
169+
}
170+
],
171+
author: answers.author,
172+
version: answers.version
173+
};
174+
175+
// Convert to YAML
176+
const yamlContent = yaml.dump(agentConfig, {
177+
indent: 2,
178+
lineWidth: -1,
179+
noRefs: true
180+
});
181+
182+
// Write to current directory
183+
const outputPath = path.join(process.cwd(), 'codeboltagent.yaml');
184+
fs.writeFileSync(outputPath, yamlContent, 'utf8');
185+
186+
console.log(chalk.green('✅ Successfully created codeboltagent.yaml at:'), chalk.cyan(outputPath));
187+
console.log(chalk.yellow('\n📝 You can now customize the configuration file as needed.'));
188+
189+
} catch (error) {
190+
console.error(chalk.red('❌ Error initializing Codebolt Agent:'), error);
191+
}
192+
};
193+
194+
module.exports = { init };

codebolt.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const { listTools } = require('./actions/listTools');
1818
const { runTool, inspectTool } = require('./actions/toolCommands');
1919
const { spawn } = require('child_process');
2020
const { cloneAgent } = require('./actions/cloneAgent');
21+
const { init } = require('./actions/init');
2122

2223
program.version('1.0.1');
2324

@@ -76,6 +77,8 @@ program
7677
.description('Pull the latest MCP tool configuration from server')
7778
.action(pullTool);
7879

80+
81+
7982
program
8083
.command('createtool')
8184
.description('Create a new Codebolt Tool')
@@ -139,5 +142,10 @@ program
139142
cloneAgent(unique_id, targetDir);
140143
});
141144

145+
program
146+
.command('init')
147+
.description('Initialize the Codebolt CLI')
148+
.action(init);
149+
142150
program.parse(process.argv);
143151

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "codebolt-cli",
3-
"version": "1.1.42",
4-
"description": "A CLI tool for version checking and folder uploads",
3+
"version": "1.1.43",
4+
"description": "A CLI tool for Codebolt",
55
"main": "codebolt.js",
66
"bin": {
77
"codebolt-cli": "./codebolt.js"
88
},
9-
"author": "",
9+
"author": "Codebolt",
1010
"license": "ISC",
1111
"dependencies": {
1212
"@modelcontextprotocol/inspector": "^0.10.2",

0 commit comments

Comments
 (0)