@inkeep/create-agents 0.34.0 → 0.35.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/__tests__/e2e/quickstart.test.js +1 -0
- package/dist/__tests__/utils.test.js +4 -0
- package/dist/index.js +2 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +158 -6
- package/package.json +2 -2
|
@@ -33,6 +33,7 @@ describe('create-agents quickstart e2e', () => {
|
|
|
33
33
|
'--local-templates-prefix',
|
|
34
34
|
projectTemplatesPrefix,
|
|
35
35
|
'--skip-inkeep-cli',
|
|
36
|
+
'--skip-inkeep-mcp',
|
|
36
37
|
], testDir);
|
|
37
38
|
// Verify the CLI completed successfully
|
|
38
39
|
expect(result.exitCode, `CLI failed with exit code ${result.exitCode}\nstdout: ${result.stdout}\nstderr: ${result.stderr}`).toBe(0);
|
|
@@ -46,6 +46,8 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
46
46
|
vi.mocked(fs.pathExists).mockResolvedValue(false);
|
|
47
47
|
vi.mocked(fs.ensureDir).mockResolvedValue(undefined);
|
|
48
48
|
vi.mocked(fs.writeFile).mockResolvedValue(undefined);
|
|
49
|
+
vi.mocked(fs.writeJson).mockResolvedValue(undefined);
|
|
50
|
+
vi.mocked(fs.readJson).mockResolvedValue({});
|
|
49
51
|
vi.mocked(fs.mkdir).mockResolvedValue(undefined);
|
|
50
52
|
vi.mocked(fs.remove).mockResolvedValue(undefined);
|
|
51
53
|
// Mock templates
|
|
@@ -327,6 +329,8 @@ function setupDefaultMocks() {
|
|
|
327
329
|
vi.mocked(fs.pathExists).mockResolvedValue(false);
|
|
328
330
|
vi.mocked(fs.ensureDir).mockResolvedValue(undefined);
|
|
329
331
|
vi.mocked(fs.writeFile).mockResolvedValue(undefined);
|
|
332
|
+
vi.mocked(fs.writeJson).mockResolvedValue(undefined);
|
|
333
|
+
vi.mocked(fs.readJson).mockResolvedValue({});
|
|
330
334
|
vi.mocked(getAvailableTemplates).mockResolvedValue(['event-planner', 'chatbot', 'data-analysis']);
|
|
331
335
|
vi.mocked(cloneTemplate).mockResolvedValue(undefined);
|
|
332
336
|
vi.mocked(cloneTemplateLocal).mockResolvedValue(undefined);
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ program
|
|
|
14
14
|
.option('--local-agents-prefix <local-agents-prefix>', 'Local prefix for create-agents-template')
|
|
15
15
|
.option('--local-templates-prefix <local-templates-prefix>', 'Local prefix for project templates')
|
|
16
16
|
.option('--skip-inkeep-cli', 'Skip installing Inkeep CLI globally')
|
|
17
|
+
.option('--skip-inkeep-mcp', 'Skip installing Inkeep MCP server')
|
|
17
18
|
.parse();
|
|
18
19
|
async function main() {
|
|
19
20
|
const options = program.opts();
|
|
@@ -29,6 +30,7 @@ async function main() {
|
|
|
29
30
|
localAgentsPrefix: options.localAgentsPrefix,
|
|
30
31
|
localTemplatesPrefix: options.localTemplatesPrefix,
|
|
31
32
|
skipInkeepCli: options.skipInkeepCli,
|
|
33
|
+
skipInkeepMcp: options.skipInkeepMcp,
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
catch (error) {
|
package/dist/utils.d.ts
CHANGED
|
@@ -43,5 +43,7 @@ export declare const createAgents: (args?: {
|
|
|
43
43
|
localAgentsPrefix?: string;
|
|
44
44
|
localTemplatesPrefix?: string;
|
|
45
45
|
skipInkeepCli?: boolean;
|
|
46
|
+
skipInkeepMcp?: boolean;
|
|
46
47
|
}) => Promise<void>;
|
|
47
48
|
export declare function createCommand(dirName?: string, options?: any): Promise<void>;
|
|
49
|
+
export declare function addInkeepMcp(): Promise<void>;
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { exec } from 'node:child_process';
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
|
+
import os from 'node:os';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import { promisify } from 'node:util';
|
|
5
6
|
import * as p from '@clack/prompts';
|
|
@@ -67,7 +68,7 @@ export const defaultAnthropicModelConfigurations = {
|
|
|
67
68
|
},
|
|
68
69
|
};
|
|
69
70
|
export const createAgents = async (args = {}) => {
|
|
70
|
-
let { dirName, openAiKey, anthropicKey, googleKey, template, customProjectId, disableGit, localAgentsPrefix, localTemplatesPrefix, skipInkeepCli, } = args;
|
|
71
|
+
let { dirName, openAiKey, anthropicKey, googleKey, template, customProjectId, disableGit, localAgentsPrefix, localTemplatesPrefix, skipInkeepCli, skipInkeepMcp, } = args;
|
|
71
72
|
console.log('skipInkeepCli', skipInkeepCli);
|
|
72
73
|
const tenantId = 'default';
|
|
73
74
|
let projectId;
|
|
@@ -257,12 +258,32 @@ export const createAgents = async (args = {}) => {
|
|
|
257
258
|
await checkPortsAvailability();
|
|
258
259
|
s.stop();
|
|
259
260
|
if (!skipInkeepCli) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
let isGloballyInstalled = false;
|
|
262
|
+
try {
|
|
263
|
+
const { stdout } = await execAsync('pnpm list -g @inkeep/agents-cli --json');
|
|
264
|
+
const result = JSON.parse(stdout);
|
|
265
|
+
isGloballyInstalled = result?.[0]?.dependencies?.['@inkeep/agents-cli'] !== undefined;
|
|
266
|
+
}
|
|
267
|
+
catch (_error) {
|
|
268
|
+
try {
|
|
269
|
+
await execAsync('npm list -g @inkeep/agents-cli');
|
|
270
|
+
isGloballyInstalled = true;
|
|
271
|
+
}
|
|
272
|
+
catch (_npmError) {
|
|
273
|
+
isGloballyInstalled = false;
|
|
274
|
+
}
|
|
265
275
|
}
|
|
276
|
+
if (!isGloballyInstalled) {
|
|
277
|
+
const installInkeepCLIResponse = await p.confirm({
|
|
278
|
+
message: 'Would you like to install the Inkeep CLI globally?',
|
|
279
|
+
});
|
|
280
|
+
if (!p.isCancel(installInkeepCLIResponse) && installInkeepCLIResponse) {
|
|
281
|
+
await installInkeepCLIGlobally();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (!skipInkeepMcp) {
|
|
286
|
+
await addInkeepMcp();
|
|
266
287
|
}
|
|
267
288
|
p.note(`${color.green('✓')} Workspace created at: ${color.cyan(directoryPath)}\n\n` +
|
|
268
289
|
`${color.yellow('Next steps:')}\n` +
|
|
@@ -290,6 +311,7 @@ async function createWorkspaceStructure() {
|
|
|
290
311
|
async function createEnvironmentFiles(config) {
|
|
291
312
|
// Convert to forward slashes for cross-platform SQLite URI compatibility
|
|
292
313
|
const jwtSigningSecret = crypto.randomBytes(32).toString('hex');
|
|
314
|
+
const betterAuthSecret = crypto.randomBytes(32).toString('hex');
|
|
293
315
|
const envContent = `# Environment
|
|
294
316
|
ENVIRONMENT=development
|
|
295
317
|
|
|
@@ -326,6 +348,13 @@ INKEEP_AGENTS_JWT_SIGNING_SECRET=${jwtSigningSecret}
|
|
|
326
348
|
|
|
327
349
|
# initial project information
|
|
328
350
|
DEFAULT_PROJECT_ID=${config.projectId}
|
|
351
|
+
|
|
352
|
+
# Auth Configuration
|
|
353
|
+
# INKEEP_AGENTS_MANAGE_UI_USERNAME=admin@example.com
|
|
354
|
+
# INKEEP_AGENTS_MANAGE_UI_PASSWORD=adminADMIN!@12
|
|
355
|
+
BETTER_AUTH_SECRET=${betterAuthSecret}
|
|
356
|
+
DISABLE_AUTH=true
|
|
357
|
+
|
|
329
358
|
`;
|
|
330
359
|
await fs.writeFile('.env', envContent);
|
|
331
360
|
}
|
|
@@ -491,3 +520,126 @@ export async function createCommand(dirName, options) {
|
|
|
491
520
|
...options,
|
|
492
521
|
});
|
|
493
522
|
}
|
|
523
|
+
export async function addInkeepMcp() {
|
|
524
|
+
const editorChoice = await p.select({
|
|
525
|
+
message: 'Give your IDE access to Inkeep docs and types? (Adds Inkeep MCP)',
|
|
526
|
+
options: [
|
|
527
|
+
{ value: 'cursor-project', label: 'Cursor (project only)' },
|
|
528
|
+
{ value: 'cursor-global', label: 'Cursor (global, all projects)' },
|
|
529
|
+
{ value: 'windsurf', label: 'Windsurf' },
|
|
530
|
+
{ value: 'vscode', label: 'VSCode' },
|
|
531
|
+
],
|
|
532
|
+
initialValue: 'cursor-project',
|
|
533
|
+
});
|
|
534
|
+
if (p.isCancel(editorChoice)) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
if (!editorChoice) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
const s = p.spinner();
|
|
541
|
+
try {
|
|
542
|
+
const mcpConfig = {
|
|
543
|
+
mcpServers: {
|
|
544
|
+
inkeep: {
|
|
545
|
+
type: 'mcp',
|
|
546
|
+
url: 'https://agents.inkeep.com/mcp',
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
};
|
|
550
|
+
const homeDir = os.homedir();
|
|
551
|
+
switch (editorChoice) {
|
|
552
|
+
case 'cursor-project': {
|
|
553
|
+
s.start('Adding Inkeep MCP to Cursor (project)...');
|
|
554
|
+
const cursorDir = path.join(process.cwd(), '.cursor');
|
|
555
|
+
const configPath = path.join(cursorDir, 'mcp.json');
|
|
556
|
+
await fs.ensureDir(cursorDir);
|
|
557
|
+
let existingConfig = {};
|
|
558
|
+
if (await fs.pathExists(configPath)) {
|
|
559
|
+
existingConfig = await fs.readJson(configPath);
|
|
560
|
+
}
|
|
561
|
+
const mergedConfig = {
|
|
562
|
+
...existingConfig,
|
|
563
|
+
mcpServers: {
|
|
564
|
+
...existingConfig.mcpServers,
|
|
565
|
+
...mcpConfig.mcpServers,
|
|
566
|
+
},
|
|
567
|
+
};
|
|
568
|
+
await fs.writeJson(configPath, mergedConfig, { spaces: 2 });
|
|
569
|
+
s.stop(`${color.green('✓')} Inkeep MCP added to .cursor/mcp.json`);
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
case 'cursor-global': {
|
|
573
|
+
s.start('Adding Inkeep MCP to Cursor (global)...');
|
|
574
|
+
const configPath = path.join(homeDir, '.cursor', 'mcp.json');
|
|
575
|
+
await fs.ensureDir(path.dirname(configPath));
|
|
576
|
+
let existingConfig = {};
|
|
577
|
+
if (await fs.pathExists(configPath)) {
|
|
578
|
+
existingConfig = await fs.readJson(configPath);
|
|
579
|
+
}
|
|
580
|
+
const mergedConfig = {
|
|
581
|
+
...existingConfig,
|
|
582
|
+
mcpServers: {
|
|
583
|
+
...existingConfig.mcpServers,
|
|
584
|
+
...mcpConfig.mcpServers,
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
await fs.writeJson(configPath, mergedConfig, { spaces: 2 });
|
|
588
|
+
s.stop(`${color.green('✓')} Inkeep MCP added to global Cursor settings`);
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
case 'windsurf': {
|
|
592
|
+
s.start('Adding Inkeep MCP to Windsurf...');
|
|
593
|
+
const configPath = path.join(homeDir, '.codeium', 'windsurf', 'mcp_config.json');
|
|
594
|
+
await fs.ensureDir(path.dirname(configPath));
|
|
595
|
+
let existingConfig = {};
|
|
596
|
+
if (await fs.pathExists(configPath)) {
|
|
597
|
+
existingConfig = await fs.readJson(configPath);
|
|
598
|
+
}
|
|
599
|
+
const mergedConfig = {
|
|
600
|
+
...existingConfig,
|
|
601
|
+
mcpServers: {
|
|
602
|
+
...existingConfig.mcpServers,
|
|
603
|
+
...mcpConfig.mcpServers,
|
|
604
|
+
},
|
|
605
|
+
};
|
|
606
|
+
await fs.writeJson(configPath, mergedConfig, { spaces: 2 });
|
|
607
|
+
s.stop(`${color.green('✓')} Inkeep MCP added to Windsurf settings`);
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
case 'vscode': {
|
|
611
|
+
s.start('Adding Inkeep MCP to VSCode...');
|
|
612
|
+
let configPath;
|
|
613
|
+
if (process.platform === 'darwin') {
|
|
614
|
+
configPath = path.join(homeDir, 'Library', 'Application Support', 'Code', 'User', 'mcp.json');
|
|
615
|
+
}
|
|
616
|
+
else if (process.platform === 'win32') {
|
|
617
|
+
configPath = path.join(homeDir, 'AppData', 'Roaming', 'Code', 'User', 'mcp.json');
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
configPath = path.join(homeDir, '.config', 'Code', 'User', 'mcp.json');
|
|
621
|
+
}
|
|
622
|
+
await fs.ensureDir(path.dirname(configPath));
|
|
623
|
+
let existingConfig = {};
|
|
624
|
+
if (await fs.pathExists(configPath)) {
|
|
625
|
+
existingConfig = await fs.readJson(configPath);
|
|
626
|
+
}
|
|
627
|
+
const mergedConfig = {
|
|
628
|
+
...existingConfig,
|
|
629
|
+
servers: {
|
|
630
|
+
...existingConfig.servers,
|
|
631
|
+
...mcpConfig.mcpServers,
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
await fs.writeJson(configPath, mergedConfig, { spaces: 2 });
|
|
635
|
+
s.stop(`${color.green('✓')} Inkeep MCP added to VSCode settings\n\n${color.yellow('Next steps:')}\n` +
|
|
636
|
+
` start the MCP by going to ${configPath} and clicking start`);
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
s.stop();
|
|
643
|
+
console.error(`${color.yellow('⚠')} Could not automatically configure MCP server: ${error}`);
|
|
644
|
+
}
|
|
645
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/create-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.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.35.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/degit": "^2.8.6",
|