@inkeep/create-agents 0.31.6 → 0.32.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 +1 -1
- package/dist/__tests__/e2e/quickstart.test.js +1 -1
- package/dist/utils.js +7 -112
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ describe('create-agents quickstart e2e', () => {
|
|
|
56
56
|
await verifyFile(path.join(projectDir, '.env'), [
|
|
57
57
|
/ENVIRONMENT=development/,
|
|
58
58
|
/OPENAI_API_KEY=test-openai-key/,
|
|
59
|
-
/
|
|
59
|
+
/DATABASE_URL=postgresql:\/\/appuser:password@localhost:5432\/inkeep_agents/,
|
|
60
60
|
/INKEEP_AGENTS_MANAGE_API_URL="http:\/\/localhost:3002"/,
|
|
61
61
|
/INKEEP_AGENTS_RUN_API_URL="http:\/\/localhost:3003"/,
|
|
62
62
|
/INKEEP_AGENTS_JWT_SIGNING_SECRET=\w+/, // Random secret should be generated
|
package/dist/utils.js
CHANGED
|
@@ -253,19 +253,12 @@ export const createAgents = async (args = {}) => {
|
|
|
253
253
|
if (!config.disableGit) {
|
|
254
254
|
await initializeGit();
|
|
255
255
|
}
|
|
256
|
-
|
|
257
|
-
await setupDatabase();
|
|
258
|
-
s.message('Pushing project...');
|
|
259
|
-
await setupProjectInDatabase(config);
|
|
260
|
-
s.message('Project setup complete!');
|
|
256
|
+
await checkPortsAvailability();
|
|
261
257
|
s.stop();
|
|
262
|
-
p.note(`${color.green('✓')}
|
|
263
|
-
`${color.yellow('Ready to go!')}\n\n` +
|
|
264
|
-
`${color.green('✓')} Project created in file system\n` +
|
|
265
|
-
`${color.green('✓')} Database configured\n` +
|
|
266
|
-
`${color.green('✓')} Project added to database\n\n` +
|
|
258
|
+
p.note(`${color.green('✓')} Workspace created at: ${color.cyan(directoryPath)}\n\n` +
|
|
267
259
|
`${color.yellow('Next steps:')}\n` +
|
|
268
260
|
` cd ${dirName}\n` +
|
|
261
|
+
` pnpm setup # Setup project in database\n` +
|
|
269
262
|
` pnpm dev # Start development servers\n\n` +
|
|
270
263
|
`${color.yellow('Available services:')}\n` +
|
|
271
264
|
` • Manage API: http://localhost:3002\n` +
|
|
@@ -287,13 +280,12 @@ async function createWorkspaceStructure() {
|
|
|
287
280
|
}
|
|
288
281
|
async function createEnvironmentFiles(config) {
|
|
289
282
|
// Convert to forward slashes for cross-platform SQLite URI compatibility
|
|
290
|
-
const dbPath = process.cwd().replace(/\\/g, '/');
|
|
291
283
|
const jwtSigningSecret = crypto.randomBytes(32).toString('hex');
|
|
292
284
|
const envContent = `# Environment
|
|
293
285
|
ENVIRONMENT=development
|
|
294
286
|
|
|
295
287
|
# Database
|
|
296
|
-
|
|
288
|
+
DATABASE_URL=postgresql://appuser:password@localhost:5432/inkeep_agents
|
|
297
289
|
|
|
298
290
|
# AI Provider Keys
|
|
299
291
|
ANTHROPIC_API_KEY=${config.anthropicKey || 'your-anthropic-key-here'}
|
|
@@ -317,6 +309,9 @@ NANGO_SECRET_KEY=
|
|
|
317
309
|
|
|
318
310
|
# JWT Signing Secret
|
|
319
311
|
INKEEP_AGENTS_JWT_SIGNING_SECRET=${jwtSigningSecret}
|
|
312
|
+
|
|
313
|
+
# initial project information
|
|
314
|
+
DEFAULT_PROJECT_ID=${config.projectId}
|
|
320
315
|
`;
|
|
321
316
|
await fs.writeFile('.env', envContent);
|
|
322
317
|
}
|
|
@@ -418,106 +413,6 @@ async function checkPortsAvailability() {
|
|
|
418
413
|
});
|
|
419
414
|
}
|
|
420
415
|
}
|
|
421
|
-
/**
|
|
422
|
-
* Wait for a server to be ready by polling a health endpoint
|
|
423
|
-
*/
|
|
424
|
-
async function waitForServerReady(url, timeout) {
|
|
425
|
-
const start = Date.now();
|
|
426
|
-
while (Date.now() - start < timeout) {
|
|
427
|
-
try {
|
|
428
|
-
const response = await fetch(url);
|
|
429
|
-
if (response.ok) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
catch {
|
|
434
|
-
// Server not ready yet, continue polling
|
|
435
|
-
}
|
|
436
|
-
await new Promise((resolve) => setTimeout(resolve, 1000)); // Check every second
|
|
437
|
-
}
|
|
438
|
-
throw new Error(`Server not ready at ${url} after ${timeout}ms`);
|
|
439
|
-
}
|
|
440
|
-
async function setupProjectInDatabase(config) {
|
|
441
|
-
// Proactively check if ports are available BEFORE starting servers
|
|
442
|
-
await checkPortsAvailability();
|
|
443
|
-
// Start development servers in background
|
|
444
|
-
const { spawn } = await import('node:child_process');
|
|
445
|
-
const devProcess = spawn('pnpm', ['dev:apis'], {
|
|
446
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
447
|
-
detached: true,
|
|
448
|
-
cwd: process.cwd(),
|
|
449
|
-
shell: true,
|
|
450
|
-
windowsHide: true,
|
|
451
|
-
});
|
|
452
|
-
// Track if port errors occur during startup (as a safety fallback)
|
|
453
|
-
const portErrors = { runApi: false, manageApi: false };
|
|
454
|
-
// Regex patterns for detecting port errors in output
|
|
455
|
-
const portErrorPatterns = {
|
|
456
|
-
runApi: new RegExp(`(EADDRINUSE.*:${runApiPort}|port ${runApiPort}.*already|Port ${runApiPort}.*already|run-api.*Error.*Port)`, 'i'),
|
|
457
|
-
manageApi: new RegExp(`(EADDRINUSE.*:${manageApiPort}|port ${manageApiPort}.*already|Port ${manageApiPort}.*already|manage-api.*Error.*Port)`, 'i'),
|
|
458
|
-
};
|
|
459
|
-
// Monitor output for port errors (fallback in case ports become unavailable between check and start)
|
|
460
|
-
const checkForPortErrors = (data) => {
|
|
461
|
-
const output = data.toString();
|
|
462
|
-
if (portErrorPatterns.runApi.test(output)) {
|
|
463
|
-
portErrors.runApi = true;
|
|
464
|
-
}
|
|
465
|
-
if (portErrorPatterns.manageApi.test(output)) {
|
|
466
|
-
portErrors.manageApi = true;
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
devProcess.stdout.on('data', checkForPortErrors);
|
|
470
|
-
// Wait for servers to be ready
|
|
471
|
-
try {
|
|
472
|
-
await waitForServerReady(`http://localhost:${manageApiPort}/health`, 60000);
|
|
473
|
-
await waitForServerReady(`http://localhost:${runApiPort}/health`, 60000);
|
|
474
|
-
}
|
|
475
|
-
catch (error) {
|
|
476
|
-
// If servers don't start, we'll still try push but it will likely fail
|
|
477
|
-
console.warn('Warning: Servers may not be fully ready:', error instanceof Error ? error.message : String(error));
|
|
478
|
-
}
|
|
479
|
-
// Check if any port errors occurred during startup
|
|
480
|
-
if (portErrors.runApi || portErrors.manageApi) {
|
|
481
|
-
displayPortConflictError(portErrors);
|
|
482
|
-
}
|
|
483
|
-
// Run inkeep push
|
|
484
|
-
try {
|
|
485
|
-
await execAsync(`pnpm inkeep push --project src/projects/${config.projectId} --config src/inkeep.config.ts`);
|
|
486
|
-
}
|
|
487
|
-
catch (_error) {
|
|
488
|
-
}
|
|
489
|
-
finally {
|
|
490
|
-
if (devProcess.pid) {
|
|
491
|
-
try {
|
|
492
|
-
if (process.platform === 'win32') {
|
|
493
|
-
// Windows: Use taskkill to kill process tree
|
|
494
|
-
await execAsync(`taskkill /pid ${devProcess.pid} /T /F`);
|
|
495
|
-
}
|
|
496
|
-
else {
|
|
497
|
-
// Unix: Use negative PID to kill process group
|
|
498
|
-
process.kill(-devProcess.pid, 'SIGTERM');
|
|
499
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
500
|
-
try {
|
|
501
|
-
process.kill(-devProcess.pid, 'SIGKILL');
|
|
502
|
-
}
|
|
503
|
-
catch { }
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
catch (_error) {
|
|
507
|
-
console.log('Note: Dev servers may still be running in background');
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
async function setupDatabase() {
|
|
513
|
-
try {
|
|
514
|
-
await execAsync('pnpm db:migrate');
|
|
515
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
516
|
-
}
|
|
517
|
-
catch (error) {
|
|
518
|
-
throw new Error(`Failed to setup database: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
416
|
async function cloneTemplateHelper(options) {
|
|
522
417
|
const { targetPath, templateName, localPrefix, replacements } = options;
|
|
523
418
|
// If local prefix is provided, use it to clone the template. This is useful for local development and testing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/create-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Create an Inkeep Agent Framework project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"drizzle-kit": "^0.31.5",
|
|
35
35
|
"fs-extra": "^11.0.0",
|
|
36
36
|
"picocolors": "^1.0.0",
|
|
37
|
-
"@inkeep/agents-core": "0.
|
|
37
|
+
"@inkeep/agents-core": "0.32.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/degit": "^2.8.6",
|