@inkeep/agents-cli 0.34.0 → 0.34.1

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.
Files changed (2) hide show
  1. package/dist/index.js +56 -30
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -242406,10 +242406,15 @@ async function addCommand(options) {
242406
242406
  const projectTemplates = await getAvailableTemplates("template-projects", options.localPrefix);
242407
242407
  const mcpTemplates = await getAvailableTemplates("template-mcps", options.localPrefix);
242408
242408
  if (!options.project && !options.mcp) {
242409
+ console.log(chalk.cyan("\nUsage:\n"));
242410
+ console.log(chalk.white("Add a project with: inkeep add --project <project-template>"));
242411
+ console.log(chalk.gray(" Example: inkeep add --project docs-assistant\n"));
242409
242412
  console.log(chalk.yellow("Available project templates:"));
242410
242413
  for (const template of projectTemplates) {
242411
242414
  console.log(chalk.gray(` \u2022 ${template}`));
242412
242415
  }
242416
+ console.log(chalk.white("\nAdd an MCP server with: inkeep add --mcp <mcp-template>"));
242417
+ console.log(chalk.gray(" Example: inkeep add --mcp slack\n"));
242413
242418
  console.log(chalk.yellow("Available MCP templates:"));
242414
242419
  for (const template of mcpTemplates) {
242415
242420
  console.log(chalk.gray(` \u2022 ${template}`));
@@ -242424,31 +242429,53 @@ async function addCommand(options) {
242424
242429
  console.error(`\u274C MCP template "${options.mcp}" not found`);
242425
242430
  process.exit(1);
242426
242431
  }
242427
- const s4 = p4.spinner();
242428
- s4.start("Adding template...");
242429
242432
  if (options.project) {
242430
- await addProjectTemplate(options.project, options.targetPath, options.localPrefix);
242431
- s4.stop();
242433
+ await addProjectTemplate(
242434
+ projectTemplates,
242435
+ options.project,
242436
+ options.targetPath,
242437
+ options.localPrefix
242438
+ );
242432
242439
  }
242433
242440
  if (options.mcp) {
242434
- await addMcpTemplate(options.mcp, options.targetPath, s4, options.localPrefix);
242441
+ await addMcpTemplate(mcpTemplates, options.mcp, options.targetPath, options.localPrefix);
242435
242442
  }
242436
242443
  return;
242437
242444
  }
242438
242445
  }
242439
- async function addProjectTemplate(template, targetPath, localPrefix) {
242440
- const templates = await getAvailableTemplates("template-projects", localPrefix);
242446
+ async function checkTemplateDir(templateDir, commandType) {
242447
+ const s4 = p4.spinner();
242448
+ if (await fs4.pathExists(templateDir)) {
242449
+ const overwrite = await p4.confirm({
242450
+ message: `Directory "${templateDir}" already exists. Do you want to overwrite it?`
242451
+ });
242452
+ if (!overwrite) {
242453
+ p4.cancel(
242454
+ `You can specify a different target path like: \`inkeep add --${commandType} <${commandType}-template> --target-path <path>\``
242455
+ );
242456
+ process.exit(0);
242457
+ }
242458
+ s4.start("Cleaning existing directory...");
242459
+ await fs4.emptyDir(templateDir);
242460
+ s4.stop();
242461
+ }
242462
+ }
242463
+ function buildTemplateUrl(templateType, templateName) {
242464
+ return `https://github.com/inkeep/agents/agents-cookbook/${templateType}/${templateName}`;
242465
+ }
242466
+ async function addProjectTemplate(availableTemplates, template, targetPath, localPrefix) {
242441
242467
  if (!template) {
242442
242468
  console.log(chalk.yellow("Available templates:"));
242443
- for (const template2 of templates) {
242469
+ for (const template2 of availableTemplates) {
242444
242470
  console.log(chalk.gray(` \u2022 ${template2}`));
242445
242471
  }
242446
242472
  process.exit(0);
242447
242473
  } else {
242448
- if (!templates.includes(template)) {
242474
+ if (!availableTemplates.includes(template)) {
242449
242475
  console.error(`\u274C Template "${template}" not found`);
242450
242476
  process.exit(1);
242451
242477
  }
242478
+ const s4 = p4.spinner();
242452
242479
  const anthropicKey = process.env.ANTHROPIC_API_KEY;
242453
242480
  const openAiKey = process.env.OPENAI_API_KEY;
242454
242481
  const googleKey = process.env.GOOGLE_GENERATIVE_AI_API_KEY;
@@ -242473,12 +242500,10 @@ async function addProjectTemplate(template, targetPath, localPrefix) {
242473
242500
  "\u274C No AI provider key found in environment variables. Please set one of: ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_GENERATIVE_AI_API_KEY"
242474
242501
  );
242475
242502
  }
242476
- const baseDir = targetPath || process.cwd();
242477
- const templateDir = `${baseDir}/${template}`;
242478
- if (await fs4.pathExists(templateDir)) {
242479
- console.error(`\u274C Directory "${templateDir}" already exists`);
242480
- process.exit(1);
242481
- }
242503
+ const projectDirectory = await findAppDirectory("project");
242504
+ const baseDir = targetPath || projectDirectory;
242505
+ const templateDir = path4.join(baseDir, template);
242506
+ await checkTemplateDir(templateDir, "project");
242482
242507
  if (targetPath && !await fs4.pathExists(baseDir)) {
242483
242508
  try {
242484
242509
  await fs4.mkdir(baseDir, { recursive: true });
@@ -242489,45 +242514,47 @@ async function addProjectTemplate(template, targetPath, localPrefix) {
242489
242514
  process.exit(1);
242490
242515
  }
242491
242516
  }
242492
- const s4 = p4.spinner();
242493
242517
  s4.start("Adding template...");
242494
242518
  if (localPrefix && localPrefix.length > 0) {
242495
242519
  const fullTemplatePath = path4.join(localPrefix, "template-projects", template);
242496
242520
  await cloneTemplateLocal(fullTemplatePath, templateDir, contentReplacements);
242497
242521
  } else {
242498
- const fullTemplatePath = `https://github.com/inkeep/agents/agents-cookbook/template-projects/${template}`;
242522
+ const fullTemplatePath = buildTemplateUrl("template-projects", template);
242499
242523
  await cloneTemplate(fullTemplatePath, templateDir, contentReplacements);
242500
242524
  }
242501
242525
  s4.stop(`Template "${template}" added to ${templateDir}`);
242502
242526
  return;
242503
242527
  }
242504
242528
  }
242505
- async function addMcpTemplate(template, targetPath, spinner8, localPrefix) {
242506
- const templates = await getAvailableTemplates("template-mcps", localPrefix);
242529
+ async function addMcpTemplate(availableTemplates, template, targetPath, localPrefix) {
242507
242530
  if (!template) {
242508
242531
  console.log(chalk.yellow("Available templates:"));
242509
- for (const template2 of templates) {
242532
+ for (const template2 of availableTemplates) {
242510
242533
  console.log(chalk.gray(` \u2022 ${template2}`));
242511
242534
  }
242512
242535
  process.exit(0);
242513
242536
  }
242514
242537
  if (!targetPath) {
242515
- const foundPath = await findAppDirectory();
242516
- targetPath = `${foundPath}/${template}`;
242538
+ const foundPath = await findAppDirectory("mcp");
242539
+ targetPath = path4.join(foundPath, template);
242517
242540
  }
242541
+ await checkTemplateDir(targetPath, "mcp");
242542
+ const s4 = p4.spinner();
242543
+ s4.start("Adding template...");
242518
242544
  if (localPrefix && localPrefix.length > 0) {
242519
242545
  const fullTemplatePath = path4.join(localPrefix, "template-mcps", template);
242520
242546
  await cloneTemplateLocal(fullTemplatePath, targetPath);
242521
242547
  } else {
242522
- const fullTemplatePath = `https://github.com/inkeep/agents/agents-cookbook/template-mcps/${template}`;
242548
+ const fullTemplatePath = buildTemplateUrl("template-mcps", template);
242523
242549
  await cloneTemplate(fullTemplatePath, targetPath);
242524
242550
  }
242525
- spinner8.stop(`MCP template "${template}" added to ${targetPath}`);
242551
+ s4.stop(`MCP template "${template}" added to ${targetPath}`);
242526
242552
  }
242527
- async function findAppDirectory() {
242528
- const appDirectory = await findUp("apps/mcp/app", { type: "directory" });
242529
- if (!appDirectory || !appDirectory.includes("apps/mcp/app")) {
242530
- console.log(chalk.yellow(`\u26A0\uFE0F No app directory found.`));
242553
+ async function findAppDirectory(type) {
242554
+ const searchPath = type === "project" ? "src/projects" : "apps/mcp/app";
242555
+ const directory = await findUp(searchPath, { type: "directory" });
242556
+ if (!directory || !directory.includes(searchPath)) {
242557
+ console.log(chalk.yellow(`\u26A0\uFE0F No ${type} directory found.`));
242531
242558
  const continueAnyway = await p4.confirm({
242532
242559
  message: `Do you want to add to ${process.cwd()} instead?`
242533
242560
  });
@@ -242535,9 +242562,8 @@ async function findAppDirectory() {
242535
242562
  p4.cancel("Operation cancelled");
242536
242563
  process.exit(0);
242537
242564
  }
242538
- return process.cwd();
242539
242565
  }
242540
- return appDirectory;
242566
+ return directory || process.cwd();
242541
242567
  }
242542
242568
 
242543
242569
  // src/commands/config.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-cli",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "Inkeep CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,8 +49,8 @@
49
49
  "ts-morph": "^26.0.0",
50
50
  "tsx": "^4.20.5",
51
51
  "open": "^10.2.0",
52
- "@inkeep/agents-core": "^0.34.0",
53
- "@inkeep/agents-sdk": "^0.34.0"
52
+ "@inkeep/agents-core": "^0.34.1",
53
+ "@inkeep/agents-sdk": "^0.34.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/degit": "^2.8.6",