@inkeep/create-agents 0.0.0-dev-20251014155922 → 0.0.0-dev-20251014185355
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/utils.js +3 -40
- package/package.json +2 -2
package/dist/utils.js
CHANGED
|
@@ -47,14 +47,11 @@ export const createAgents = async (args = {}) => {
|
|
|
47
47
|
const runApiPort = '3003';
|
|
48
48
|
let projectId;
|
|
49
49
|
let templateName;
|
|
50
|
-
// Determine project ID and template based on user input
|
|
51
50
|
if (customProjectId) {
|
|
52
|
-
// User provided custom project ID - use it as-is, no template needed
|
|
53
51
|
projectId = customProjectId;
|
|
54
|
-
templateName = '';
|
|
52
|
+
templateName = '';
|
|
55
53
|
}
|
|
56
54
|
else if (template) {
|
|
57
|
-
// User provided template - validate it exists and use template name as project ID
|
|
58
55
|
const availableTemplates = await getAvailableTemplates();
|
|
59
56
|
if (!availableTemplates.includes(template)) {
|
|
60
57
|
p.cancel(`${color.red('✗')} Template "${template}" not found\n\n` +
|
|
@@ -66,12 +63,10 @@ export const createAgents = async (args = {}) => {
|
|
|
66
63
|
templateName = template;
|
|
67
64
|
}
|
|
68
65
|
else {
|
|
69
|
-
// No template or custom project ID provided - use defaults
|
|
70
66
|
projectId = 'weather-project';
|
|
71
67
|
templateName = 'weather-project';
|
|
72
68
|
}
|
|
73
69
|
p.intro(color.inverse(' Create Agents Directory '));
|
|
74
|
-
// Prompt for directory name if not provided
|
|
75
70
|
if (!dirName) {
|
|
76
71
|
const dirResponse = await p.text({
|
|
77
72
|
message: 'What do you want to name your agents directory?',
|
|
@@ -90,8 +85,6 @@ export const createAgents = async (args = {}) => {
|
|
|
90
85
|
}
|
|
91
86
|
dirName = dirResponse;
|
|
92
87
|
}
|
|
93
|
-
// Project ID is already determined above based on template/customProjectId logic
|
|
94
|
-
// If keys aren't provided via CLI args, prompt for provider selection and keys
|
|
95
88
|
if (!anthropicKey && !openAiKey && !googleKey) {
|
|
96
89
|
const providerChoice = await p.select({
|
|
97
90
|
message: 'Which AI provider would you like to use?',
|
|
@@ -105,7 +98,6 @@ export const createAgents = async (args = {}) => {
|
|
|
105
98
|
p.cancel('Operation cancelled');
|
|
106
99
|
process.exit(0);
|
|
107
100
|
}
|
|
108
|
-
// Prompt for keys based on selection
|
|
109
101
|
if (providerChoice === 'anthropic') {
|
|
110
102
|
const anthropicKeyResponse = await p.text({
|
|
111
103
|
message: 'Enter your Anthropic API key:',
|
|
@@ -168,7 +160,6 @@ export const createAgents = async (args = {}) => {
|
|
|
168
160
|
else if (googleKey) {
|
|
169
161
|
defaultModelSettings = defaultGoogleModelConfigurations;
|
|
170
162
|
}
|
|
171
|
-
// Ensure models are always configured - fail if none were set
|
|
172
163
|
if (Object.keys(defaultModelSettings).length === 0) {
|
|
173
164
|
p.cancel('Cannot continue without a model configuration for project. Please provide an API key for at least one AI provider.');
|
|
174
165
|
process.exit(1);
|
|
@@ -181,7 +172,6 @@ export const createAgents = async (args = {}) => {
|
|
|
181
172
|
? `https://github.com/inkeep/agents-cookbook/template-projects/${templateName}`
|
|
182
173
|
: null;
|
|
183
174
|
const directoryPath = path.resolve(process.cwd(), dirName);
|
|
184
|
-
// Check if directory already exists
|
|
185
175
|
if (await fs.pathExists(directoryPath)) {
|
|
186
176
|
s.stop();
|
|
187
177
|
const overwrite = await p.confirm({
|
|
@@ -194,10 +184,8 @@ export const createAgents = async (args = {}) => {
|
|
|
194
184
|
s.start('Cleaning existing directory...');
|
|
195
185
|
await fs.emptyDir(directoryPath);
|
|
196
186
|
}
|
|
197
|
-
// Clone the template repository
|
|
198
187
|
s.message('Building template...');
|
|
199
188
|
await cloneTemplate(agentsTemplateRepo, directoryPath);
|
|
200
|
-
// Change to the project directory
|
|
201
189
|
process.chdir(directoryPath);
|
|
202
190
|
const config = {
|
|
203
191
|
dirName,
|
|
@@ -211,17 +199,13 @@ export const createAgents = async (args = {}) => {
|
|
|
211
199
|
modelSettings: defaultModelSettings,
|
|
212
200
|
customProject: !!customProjectId,
|
|
213
201
|
};
|
|
214
|
-
// Create workspace structure for project-specific files
|
|
215
202
|
s.message('Setting up project structure...');
|
|
216
203
|
await createWorkspaceStructure();
|
|
217
|
-
// Create environment files
|
|
218
204
|
s.message('Setting up environment files...');
|
|
219
205
|
await createEnvironmentFiles(config);
|
|
220
|
-
// Create project template folder (only if template is specified)
|
|
221
206
|
if (projectTemplateRepo) {
|
|
222
207
|
s.message('Creating project template folder...');
|
|
223
208
|
const templateTargetPath = `src/${projectId}`;
|
|
224
|
-
// Prepare content replacements for model settings
|
|
225
209
|
const contentReplacements = [
|
|
226
210
|
{
|
|
227
211
|
filePath: 'index.ts',
|
|
@@ -236,21 +220,16 @@ export const createAgents = async (args = {}) => {
|
|
|
236
220
|
s.message('Creating empty project folder...');
|
|
237
221
|
await fs.ensureDir(`src/${projectId}`);
|
|
238
222
|
}
|
|
239
|
-
// create or overwrite inkeep.config.ts
|
|
240
223
|
s.message('Creating inkeep.config.ts...');
|
|
241
224
|
await createInkeepConfig(config);
|
|
242
|
-
// Install dependencies
|
|
243
225
|
s.message('Installing dependencies (this may take a while)...');
|
|
244
226
|
await installDependencies();
|
|
245
|
-
// Setup database
|
|
246
227
|
s.message('Setting up database...');
|
|
247
228
|
await setupDatabase();
|
|
248
|
-
// Setup project in database
|
|
249
229
|
s.message('Pushing project...');
|
|
250
230
|
await setupProjectInDatabase(config);
|
|
251
231
|
s.message('Project setup complete!');
|
|
252
232
|
s.stop();
|
|
253
|
-
// Success message with next steps
|
|
254
233
|
p.note(`${color.green('✓')} Project created at: ${color.cyan(directoryPath)}\n\n` +
|
|
255
234
|
`${color.yellow('Ready to go!')}\n\n` +
|
|
256
235
|
`${color.green('✓')} Project created in file system\n` +
|
|
@@ -276,11 +255,9 @@ export const createAgents = async (args = {}) => {
|
|
|
276
255
|
}
|
|
277
256
|
};
|
|
278
257
|
async function createWorkspaceStructure() {
|
|
279
|
-
// Create the workspace directory structure
|
|
280
258
|
await fs.ensureDir(`src`);
|
|
281
259
|
}
|
|
282
260
|
async function createEnvironmentFiles(config) {
|
|
283
|
-
// Root .env file
|
|
284
261
|
const envContent = `# Environment
|
|
285
262
|
ENVIRONMENT=development
|
|
286
263
|
|
|
@@ -337,41 +314,29 @@ async function installDependencies() {
|
|
|
337
314
|
await execAsync('pnpm install');
|
|
338
315
|
}
|
|
339
316
|
async function setupProjectInDatabase(config) {
|
|
340
|
-
// Start development servers in background
|
|
341
317
|
const { spawn } = await import('node:child_process');
|
|
342
318
|
const devProcess = spawn('pnpm', ['dev:apis'], {
|
|
343
319
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
344
|
-
detached: true,
|
|
320
|
+
detached: true,
|
|
345
321
|
cwd: process.cwd(),
|
|
346
322
|
});
|
|
347
|
-
// Give servers time to start
|
|
348
323
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
349
|
-
// Run inkeep push
|
|
350
324
|
try {
|
|
351
|
-
// Suppress all output
|
|
352
325
|
await execAsync(`pnpm inkeep push --project src/${config.projectId} --config src/inkeep.config.ts`);
|
|
353
326
|
}
|
|
354
327
|
catch (_error) {
|
|
355
|
-
//Continue despite error - user can setup project manually
|
|
356
328
|
}
|
|
357
329
|
finally {
|
|
358
|
-
// Kill the dev servers and their child processes
|
|
359
330
|
if (devProcess.pid) {
|
|
360
331
|
try {
|
|
361
|
-
// Kill the entire process group
|
|
362
332
|
process.kill(-devProcess.pid, 'SIGTERM');
|
|
363
|
-
// Wait a moment for graceful shutdown
|
|
364
333
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
365
|
-
// Force kill if still running
|
|
366
334
|
try {
|
|
367
335
|
process.kill(-devProcess.pid, 'SIGKILL');
|
|
368
336
|
}
|
|
369
|
-
catch {
|
|
370
|
-
// Process already terminated
|
|
371
|
-
}
|
|
337
|
+
catch { }
|
|
372
338
|
}
|
|
373
339
|
catch (_error) {
|
|
374
|
-
// Process might already be dead, that's fine
|
|
375
340
|
console.log('Note: Dev servers may still be running in background');
|
|
376
341
|
}
|
|
377
342
|
}
|
|
@@ -379,7 +344,6 @@ async function setupProjectInDatabase(config) {
|
|
|
379
344
|
}
|
|
380
345
|
async function setupDatabase() {
|
|
381
346
|
try {
|
|
382
|
-
// Run drizzle-kit migrate to apply migrations to database
|
|
383
347
|
await execAsync('pnpm db:migrate');
|
|
384
348
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
385
349
|
}
|
|
@@ -387,7 +351,6 @@ async function setupDatabase() {
|
|
|
387
351
|
throw new Error(`Failed to setup database: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
388
352
|
}
|
|
389
353
|
}
|
|
390
|
-
// Export the command function for the CLI
|
|
391
354
|
export async function createCommand(dirName, options) {
|
|
392
355
|
await createAgents({
|
|
393
356
|
dirName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/create-agents",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20251014185355",
|
|
4
4
|
"description": "Create an Inkeep Agent Framework project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"fs-extra": "^11.0.0",
|
|
35
35
|
"picocolors": "^1.0.0",
|
|
36
36
|
"drizzle-kit": "^0.31.5",
|
|
37
|
-
"@inkeep/agents-core": "0.0.0-dev-
|
|
37
|
+
"@inkeep/agents-core": "0.0.0-dev-20251014185355"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/degit": "^2.8.6",
|