@inkeep/agents-cli 0.24.0 → 0.24.2
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/index.js +89 -21
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -237837,9 +237837,10 @@ import { Command } from "commander";
|
|
|
237837
237837
|
// src/commands/add.ts
|
|
237838
237838
|
init_esm_shims();
|
|
237839
237839
|
init_src();
|
|
237840
|
+
import * as p2 from "@clack/prompts";
|
|
237840
237841
|
import chalk from "chalk";
|
|
237842
|
+
import { findUp } from "find-up";
|
|
237841
237843
|
import fs3 from "fs-extra";
|
|
237842
|
-
import * as p2 from "@clack/prompts";
|
|
237843
237844
|
|
|
237844
237845
|
// src/utils/templates.ts
|
|
237845
237846
|
init_esm_shims();
|
|
@@ -237856,6 +237857,7 @@ async function cloneTemplate(templatePath, targetPath, replacements) {
|
|
|
237856
237857
|
await replaceContentInFiles(targetPath, replacements);
|
|
237857
237858
|
}
|
|
237858
237859
|
} catch (_error) {
|
|
237860
|
+
console.log(`\u274C Error cloning template: ${_error}`);
|
|
237859
237861
|
process.exit(1);
|
|
237860
237862
|
}
|
|
237861
237863
|
}
|
|
@@ -238013,9 +238015,9 @@ function injectPropertyIntoObject(content, propertyPath, replacement) {
|
|
|
238013
238015
|
console.warn(`Could not inject property "${propertyPath}" - no suitable object found in content`);
|
|
238014
238016
|
return content;
|
|
238015
238017
|
}
|
|
238016
|
-
async function getAvailableTemplates() {
|
|
238018
|
+
async function getAvailableTemplates(templatePath = "template-projects") {
|
|
238017
238019
|
const response = await fetch(
|
|
238018
|
-
|
|
238020
|
+
`https://api.github.com/repos/inkeep/agents-cookbook/contents/${templatePath}`
|
|
238019
238021
|
);
|
|
238020
238022
|
const contents = await response.json();
|
|
238021
238023
|
return contents.filter((item) => item.type === "dir").map((item) => item.name);
|
|
@@ -238056,21 +238058,55 @@ var defaultAnthropicModelConfigurations = {
|
|
|
238056
238058
|
}
|
|
238057
238059
|
};
|
|
238058
238060
|
async function addCommand(options) {
|
|
238061
|
+
const projectTemplates = await getAvailableTemplates("template-projects");
|
|
238062
|
+
const mcpTemplates = await getAvailableTemplates("template-mcps");
|
|
238063
|
+
if (!options.project && !options.mcp) {
|
|
238064
|
+
console.log(chalk.yellow("Available project templates:"));
|
|
238065
|
+
for (const template of projectTemplates) {
|
|
238066
|
+
console.log(chalk.gray(` \u2022 ${template}`));
|
|
238067
|
+
}
|
|
238068
|
+
console.log(chalk.yellow("Available MCP templates:"));
|
|
238069
|
+
for (const template of mcpTemplates) {
|
|
238070
|
+
console.log(chalk.gray(` \u2022 ${template}`));
|
|
238071
|
+
}
|
|
238072
|
+
process.exit(0);
|
|
238073
|
+
} else {
|
|
238074
|
+
if (options.project && !projectTemplates.includes(options.project)) {
|
|
238075
|
+
console.error(`\u274C Project template "${options.project}" not found`);
|
|
238076
|
+
process.exit(1);
|
|
238077
|
+
}
|
|
238078
|
+
if (options.mcp && !mcpTemplates.includes(options.mcp)) {
|
|
238079
|
+
console.error(`\u274C MCP template "${options.mcp}" not found`);
|
|
238080
|
+
process.exit(1);
|
|
238081
|
+
}
|
|
238082
|
+
const s2 = p2.spinner();
|
|
238083
|
+
s2.start("Adding template...");
|
|
238084
|
+
if (options.project) {
|
|
238085
|
+
await addProjectTemplate(options.project, options.targetPath);
|
|
238086
|
+
s2.stop(`Project template "${options.project}" added to ${options.targetPath}`);
|
|
238087
|
+
}
|
|
238088
|
+
if (options.mcp) {
|
|
238089
|
+
await addMcpTemplate(options.mcp, options.targetPath, s2);
|
|
238090
|
+
}
|
|
238091
|
+
return;
|
|
238092
|
+
}
|
|
238093
|
+
}
|
|
238094
|
+
async function addProjectTemplate(template, targetPath) {
|
|
238059
238095
|
const templates = await getAvailableTemplates();
|
|
238060
|
-
if (!
|
|
238096
|
+
if (!template) {
|
|
238061
238097
|
console.log(chalk.yellow("Available templates:"));
|
|
238062
|
-
for (const
|
|
238063
|
-
console.log(chalk.gray(` \u2022 ${
|
|
238098
|
+
for (const template2 of templates) {
|
|
238099
|
+
console.log(chalk.gray(` \u2022 ${template2}`));
|
|
238064
238100
|
}
|
|
238065
238101
|
process.exit(0);
|
|
238066
238102
|
} else {
|
|
238067
|
-
if (!templates.includes(
|
|
238068
|
-
console.error(`\u274C Template "${
|
|
238103
|
+
if (!templates.includes(template)) {
|
|
238104
|
+
console.error(`\u274C Template "${template}" not found`);
|
|
238069
238105
|
process.exit(1);
|
|
238070
238106
|
}
|
|
238071
238107
|
const anthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
238072
238108
|
const openAiKey = process.env.OPENAI_API_KEY;
|
|
238073
|
-
const googleKey = process.env.
|
|
238109
|
+
const googleKey = process.env.GOOGLE_GENERATIVE_AI_API_KEY;
|
|
238074
238110
|
let defaultModelSettings = {};
|
|
238075
238111
|
if (anthropicKey) {
|
|
238076
238112
|
defaultModelSettings = defaultAnthropicModelConfigurations;
|
|
@@ -238092,13 +238128,13 @@ async function addCommand(options) {
|
|
|
238092
238128
|
"\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"
|
|
238093
238129
|
);
|
|
238094
238130
|
}
|
|
238095
|
-
const baseDir =
|
|
238096
|
-
const templateDir = `${baseDir}/${
|
|
238131
|
+
const baseDir = targetPath || process.cwd();
|
|
238132
|
+
const templateDir = `${baseDir}/${template}`;
|
|
238097
238133
|
if (await fs3.pathExists(templateDir)) {
|
|
238098
238134
|
console.error(`\u274C Directory "${templateDir}" already exists`);
|
|
238099
238135
|
process.exit(1);
|
|
238100
238136
|
}
|
|
238101
|
-
if (
|
|
238137
|
+
if (targetPath && !await fs3.pathExists(baseDir)) {
|
|
238102
238138
|
try {
|
|
238103
238139
|
await fs3.mkdir(baseDir, { recursive: true });
|
|
238104
238140
|
} catch (error) {
|
|
@@ -238110,12 +238146,44 @@ async function addCommand(options) {
|
|
|
238110
238146
|
}
|
|
238111
238147
|
const s2 = p2.spinner();
|
|
238112
238148
|
s2.start("Adding template...");
|
|
238113
|
-
const fullTemplatePath = `https://github.com/inkeep/agents-cookbook/template-projects/${
|
|
238149
|
+
const fullTemplatePath = `https://github.com/inkeep/agents-cookbook/template-projects/${template}`;
|
|
238114
238150
|
await cloneTemplate(fullTemplatePath, templateDir, contentReplacements);
|
|
238115
|
-
s2.stop(`Template "${
|
|
238151
|
+
s2.stop(`Template "${template}" added to ${templateDir}`);
|
|
238116
238152
|
return;
|
|
238117
238153
|
}
|
|
238118
238154
|
}
|
|
238155
|
+
async function addMcpTemplate(template, targetPath, s2) {
|
|
238156
|
+
const templates = await getAvailableTemplates("template-mcps");
|
|
238157
|
+
if (!template) {
|
|
238158
|
+
console.log(chalk.yellow("Available templates:"));
|
|
238159
|
+
for (const template2 of templates) {
|
|
238160
|
+
console.log(chalk.gray(` \u2022 ${template2}`));
|
|
238161
|
+
}
|
|
238162
|
+
process.exit(0);
|
|
238163
|
+
}
|
|
238164
|
+
if (!targetPath) {
|
|
238165
|
+
const foundPath = await findAppDirectory();
|
|
238166
|
+
targetPath = `${foundPath}/${template}`;
|
|
238167
|
+
}
|
|
238168
|
+
const fullTemplatePath = `https://github.com/inkeep/agents-cookbook/template-mcps/${template}`;
|
|
238169
|
+
await cloneTemplate(fullTemplatePath, targetPath);
|
|
238170
|
+
s2.stop(`MCP template "${template}" added to ${targetPath}`);
|
|
238171
|
+
}
|
|
238172
|
+
async function findAppDirectory() {
|
|
238173
|
+
const appDirectory = await findUp("apps/mcp/app", { type: "directory" });
|
|
238174
|
+
if (!appDirectory || !appDirectory.includes("apps/mcp/app")) {
|
|
238175
|
+
console.log(chalk.yellow(`\u26A0\uFE0F No app directory found.`));
|
|
238176
|
+
const continueAnyway = await p2.confirm({
|
|
238177
|
+
message: `Do you want to add to ${process.cwd()} instead?`
|
|
238178
|
+
});
|
|
238179
|
+
if (!continueAnyway) {
|
|
238180
|
+
p2.cancel("Operation cancelled");
|
|
238181
|
+
process.exit(0);
|
|
238182
|
+
}
|
|
238183
|
+
return process.cwd();
|
|
238184
|
+
}
|
|
238185
|
+
return appDirectory;
|
|
238186
|
+
}
|
|
238119
238187
|
|
|
238120
238188
|
// src/commands/config.ts
|
|
238121
238189
|
init_esm_shims();
|
|
@@ -238886,7 +238954,7 @@ init_config();
|
|
|
238886
238954
|
init_esm_shims();
|
|
238887
238955
|
import { existsSync as existsSync5 } from "fs";
|
|
238888
238956
|
import { join as join5, resolve as resolve3 } from "path";
|
|
238889
|
-
import { findUp } from "find-up";
|
|
238957
|
+
import { findUp as findUp2 } from "find-up";
|
|
238890
238958
|
async function findProjectDirectory(projectId, configPath) {
|
|
238891
238959
|
if (configPath) {
|
|
238892
238960
|
const absoluteConfigPath = resolve3(process.cwd(), configPath);
|
|
@@ -238908,7 +238976,7 @@ async function findProjectDirectory(projectId, configPath) {
|
|
|
238908
238976
|
}
|
|
238909
238977
|
return null;
|
|
238910
238978
|
}
|
|
238911
|
-
const foundConfigPath = await
|
|
238979
|
+
const foundConfigPath = await findUp2("inkeep.config.ts");
|
|
238912
238980
|
if (foundConfigPath) {
|
|
238913
238981
|
return resolve3(foundConfigPath, "..");
|
|
238914
238982
|
}
|
|
@@ -239321,8 +239389,8 @@ async function pullProjectCommand(options) {
|
|
|
239321
239389
|
}
|
|
239322
239390
|
}
|
|
239323
239391
|
if (!configFound) {
|
|
239324
|
-
const { findUp:
|
|
239325
|
-
const foundConfigPath = await
|
|
239392
|
+
const { findUp: findUp3 } = await import("find-up");
|
|
239393
|
+
const foundConfigPath = await findUp3("inkeep.config.ts", { cwd: searchDir });
|
|
239326
239394
|
if (foundConfigPath) {
|
|
239327
239395
|
try {
|
|
239328
239396
|
config = await loadProjectConfig(dirname5(foundConfigPath));
|
|
@@ -240002,11 +240070,11 @@ async function updateCommand(options = {}) {
|
|
|
240002
240070
|
\u{1F50D} Detected package manager: ${chalk11.cyan(packageManager)}`));
|
|
240003
240071
|
}
|
|
240004
240072
|
if (!options.force) {
|
|
240005
|
-
const
|
|
240073
|
+
const confirm4 = await p9.confirm({
|
|
240006
240074
|
message: `Update @inkeep/agents-cli from ${versionInfo.current} to ${versionInfo.latest}?`,
|
|
240007
240075
|
initialValue: true
|
|
240008
240076
|
});
|
|
240009
|
-
if (p9.isCancel(
|
|
240077
|
+
if (p9.isCancel(confirm4) || !confirm4) {
|
|
240010
240078
|
p9.cancel("Update cancelled");
|
|
240011
240079
|
process.exit(1);
|
|
240012
240080
|
}
|
|
@@ -240035,7 +240103,7 @@ var packageJsonPath = join13(__dirname3, "..", "package.json");
|
|
|
240035
240103
|
var packageJson = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
|
|
240036
240104
|
var program = new Command();
|
|
240037
240105
|
program.name("inkeep").description("CLI tool for Inkeep Agent Framework").version(packageJson.version);
|
|
240038
|
-
program.command("add [template]").description("Add a new template to the project").option("--target-path <path>", "Target path to add the template to").option("--config <path>", "Path to configuration file").action(async (template, options) => {
|
|
240106
|
+
program.command("add [template]").description("Add a new template to the project").option("--project <template>", "Project template to add").option("--mcp <template>", "MCP template to add").option("--target-path <path>", "Target path to add the template to").option("--config <path>", "Path to configuration file").action(async (template, options) => {
|
|
240039
240107
|
await addCommand({ template, ...options });
|
|
240040
240108
|
});
|
|
240041
240109
|
program.command("init [path]").description("Initialize a new Inkeep configuration file").option("--no-interactive", "Skip interactive path selection").option("--config <path>", "Path to use as template for new configuration").action(async (path4, options) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"recast": "^0.23.0",
|
|
49
49
|
"ts-morph": "^26.0.0",
|
|
50
50
|
"tsx": "^4.20.5",
|
|
51
|
-
"@inkeep/agents-core": "^0.24.
|
|
52
|
-
"@inkeep/agents-sdk": "^0.24.
|
|
51
|
+
"@inkeep/agents-core": "^0.24.2",
|
|
52
|
+
"@inkeep/agents-sdk": "^0.24.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/degit": "^2.8.6",
|