@inkeep/agents-cli 0.22.3 → 0.22.5
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 +646 -383
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -84,9 +84,9 @@ var init_models = __esm({
|
|
|
84
84
|
CLAUDE_SONNET_4_5_20250929: "anthropic/claude-sonnet-4-5-20250929",
|
|
85
85
|
CLAUDE_SONNET_4: "anthropic/claude-sonnet-4-0",
|
|
86
86
|
CLAUDE_SONNET_4_20250514: "anthropic/claude-sonnet-4-20250514",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
CLAUDE_3_5_HAIKU: "anthropic/claude-3-5-haiku",
|
|
87
|
+
CLAUDE_HAIKU_4_5: "anthropic/claude-haiku-4-5",
|
|
88
|
+
CLAUDE_HAIKU_4_5_20251001: "anthropic/claude-haiku-4-5-20251001",
|
|
89
|
+
CLAUDE_3_5_HAIKU: "anthropic/claude-3-5-haiku-latest",
|
|
90
90
|
CLAUDE_3_5_HAIKU_20241022: "anthropic/claude-3-5-haiku-20241022"
|
|
91
91
|
};
|
|
92
92
|
OPENAI_MODELS = {
|
|
@@ -5025,7 +5025,7 @@ var require_util = __commonJS({
|
|
|
5025
5025
|
return path4;
|
|
5026
5026
|
}
|
|
5027
5027
|
exports.normalize = normalize;
|
|
5028
|
-
function
|
|
5028
|
+
function join14(aRoot, aPath) {
|
|
5029
5029
|
if (aRoot === "") {
|
|
5030
5030
|
aRoot = ".";
|
|
5031
5031
|
}
|
|
@@ -5057,7 +5057,7 @@ var require_util = __commonJS({
|
|
|
5057
5057
|
}
|
|
5058
5058
|
return joined;
|
|
5059
5059
|
}
|
|
5060
|
-
exports.join =
|
|
5060
|
+
exports.join = join14;
|
|
5061
5061
|
exports.isAbsolute = function(aPath) {
|
|
5062
5062
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
5063
5063
|
};
|
|
@@ -5230,7 +5230,7 @@ var require_util = __commonJS({
|
|
|
5230
5230
|
parsed.path = parsed.path.substring(0, index2 + 1);
|
|
5231
5231
|
}
|
|
5232
5232
|
}
|
|
5233
|
-
sourceURL =
|
|
5233
|
+
sourceURL = join14(urlGenerate(parsed), sourceURL);
|
|
5234
5234
|
}
|
|
5235
5235
|
return normalize(sourceURL);
|
|
5236
5236
|
}
|
|
@@ -234313,10 +234313,24 @@ ${errorText}`);
|
|
|
234313
234313
|
if (response.status === 404) {
|
|
234314
234314
|
throw new Error(`Project "${projectId}" not found`);
|
|
234315
234315
|
}
|
|
234316
|
-
if (response.status === 401) {
|
|
234317
|
-
|
|
234316
|
+
if (response.status === 401 || response.status === 403) {
|
|
234317
|
+
const errorText2 = await response.text().catch(() => "");
|
|
234318
|
+
let errorMessage = "Authentication failed - check your API key configuration\n\n";
|
|
234319
|
+
errorMessage += "Common issues:\n";
|
|
234320
|
+
errorMessage += " \u2022 Missing or invalid API key in inkeep.config.ts\n";
|
|
234321
|
+
errorMessage += " \u2022 API key does not have access to this tenant/project\n";
|
|
234322
|
+
errorMessage += " \u2022 For local development, ensure INKEEP_AGENTS_MANAGE_API_BYPASS_SECRET is set\n";
|
|
234323
|
+
if (errorText2) {
|
|
234324
|
+
errorMessage += `
|
|
234325
|
+
Server response: ${errorText2}`;
|
|
234326
|
+
}
|
|
234327
|
+
throw new Error(errorMessage);
|
|
234318
234328
|
}
|
|
234319
|
-
|
|
234329
|
+
const errorText = await response.text().catch(() => "");
|
|
234330
|
+
throw new Error(
|
|
234331
|
+
`Failed to fetch project: ${response.statusText}${errorText ? `
|
|
234332
|
+
${errorText}` : ""}`
|
|
234333
|
+
);
|
|
234320
234334
|
}
|
|
234321
234335
|
const responseData = await response.json();
|
|
234322
234336
|
return responseData.data;
|
|
@@ -234345,7 +234359,7 @@ ${errorText}`);
|
|
|
234345
234359
|
...emitOperations && { "x-emit-operations": "true" }
|
|
234346
234360
|
},
|
|
234347
234361
|
body: JSON.stringify({
|
|
234348
|
-
model: OPENAI_MODELS.
|
|
234362
|
+
model: OPENAI_MODELS.GPT_4_1_MINI,
|
|
234349
234363
|
// Required but will be overridden by graph config
|
|
234350
234364
|
messages: messages2,
|
|
234351
234365
|
conversationId,
|
|
@@ -234612,18 +234626,18 @@ __export(pull_llm_generate_exports, {
|
|
|
234612
234626
|
generateTypeScriptFileWithLLM: () => generateTypeScriptFileWithLLM,
|
|
234613
234627
|
getTypeDefinitions: () => getTypeDefinitions
|
|
234614
234628
|
});
|
|
234615
|
-
import { readFileSync as
|
|
234629
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
234616
234630
|
import { createRequire as createRequire2 } from "module";
|
|
234617
|
-
import { join as
|
|
234631
|
+
import { join as join7 } from "path";
|
|
234618
234632
|
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
|
|
234619
234633
|
import { createOpenAI, openai } from "@ai-sdk/openai";
|
|
234620
234634
|
import { generateText } from "ai";
|
|
234621
234635
|
function getTypeDefinitions() {
|
|
234622
234636
|
try {
|
|
234623
234637
|
const sdkPackagePath = require3.resolve("@inkeep/agents-sdk/package.json");
|
|
234624
|
-
const sdkPackageDir =
|
|
234625
|
-
const sdkDtsPath =
|
|
234626
|
-
const dtsContent =
|
|
234638
|
+
const sdkPackageDir = join7(sdkPackagePath, "..");
|
|
234639
|
+
const sdkDtsPath = join7(sdkPackageDir, "dist/index.d.ts");
|
|
234640
|
+
const dtsContent = readFileSync3(sdkDtsPath, "utf-8");
|
|
234627
234641
|
return `
|
|
234628
234642
|
TYPESCRIPT TYPE DEFINITIONS (from @inkeep/agents-sdk):
|
|
234629
234643
|
|
|
@@ -235294,16 +235308,16 @@ export const ${environment} = registerEnvironmentSettings({
|
|
|
235294
235308
|
credentials: {${credentialsCode}}
|
|
235295
235309
|
});
|
|
235296
235310
|
`;
|
|
235297
|
-
writeFileSync3(
|
|
235311
|
+
writeFileSync3(join7(environmentsDir, `${environment}.env.ts`), envContent);
|
|
235298
235312
|
await updateEnvironmentIndex(environmentsDir, environment);
|
|
235299
235313
|
}
|
|
235300
235314
|
async function updateEnvironmentIndex(environmentsDir, environment) {
|
|
235301
|
-
const indexPath =
|
|
235302
|
-
const { readFileSync:
|
|
235315
|
+
const indexPath = join7(environmentsDir, "index.ts");
|
|
235316
|
+
const { readFileSync: readFileSync8, existsSync: existsSync12 } = await import("fs");
|
|
235303
235317
|
const existingEnvironments = [];
|
|
235304
235318
|
let existingContent = "";
|
|
235305
|
-
if (
|
|
235306
|
-
existingContent =
|
|
235319
|
+
if (existsSync12(indexPath)) {
|
|
235320
|
+
existingContent = readFileSync8(indexPath, "utf-8");
|
|
235307
235321
|
const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
|
|
235308
235322
|
let match;
|
|
235309
235323
|
while ((match = importRegex.exec(existingContent)) !== null) {
|
|
@@ -235484,21 +235498,21 @@ var init_pull_llm_generate = __esm({
|
|
|
235484
235498
|
"description": "test test",
|
|
235485
235499
|
"models": {
|
|
235486
235500
|
"base": {
|
|
235487
|
-
"model": "${ANTHROPIC_MODELS.
|
|
235501
|
+
"model": "${ANTHROPIC_MODELS.CLAUDE_OPUS_4_1}",
|
|
235488
235502
|
"providerOptions": {
|
|
235489
235503
|
"temperature": 0.7,
|
|
235490
235504
|
"maxTokens": 2096
|
|
235491
235505
|
}
|
|
235492
235506
|
},
|
|
235493
235507
|
"structuredOutput": {
|
|
235494
|
-
"model": "${OPENAI_MODELS.
|
|
235508
|
+
"model": "${OPENAI_MODELS.GPT_4_1_MINI}",
|
|
235495
235509
|
"providerOptions": {
|
|
235496
235510
|
"temperature": 0.4,
|
|
235497
235511
|
"maxTokens": 2048
|
|
235498
235512
|
}
|
|
235499
235513
|
},
|
|
235500
235514
|
"summarizer": {
|
|
235501
|
-
"model": "${OPENAI_MODELS.
|
|
235515
|
+
"model": "${OPENAI_MODELS.GPT_5_NANO}",
|
|
235502
235516
|
"providerOptions": {
|
|
235503
235517
|
"temperature": 0.8,
|
|
235504
235518
|
"maxTokens": 1024
|
|
@@ -235558,7 +235572,7 @@ var init_pull_llm_generate = __esm({
|
|
|
235558
235572
|
"updatedAt": "2025-10-05T16:43:26.813Z",
|
|
235559
235573
|
"models": {
|
|
235560
235574
|
"base": {
|
|
235561
|
-
"model": "${ANTHROPIC_MODELS.
|
|
235575
|
+
"model": "${ANTHROPIC_MODELS.CLAUDE_SONNET_4_5}",
|
|
235562
235576
|
"providerOptions": {
|
|
235563
235577
|
"temperature": 0.5
|
|
235564
235578
|
}
|
|
@@ -235899,11 +235913,11 @@ var pattern_analyzer_exports = {};
|
|
|
235899
235913
|
__export(pattern_analyzer_exports, {
|
|
235900
235914
|
analyzeExistingPatterns: () => analyzeExistingPatterns
|
|
235901
235915
|
});
|
|
235902
|
-
import { existsSync as
|
|
235903
|
-
import { join as
|
|
235916
|
+
import { existsSync as existsSync7, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync } from "fs";
|
|
235917
|
+
import { join as join8 } from "path";
|
|
235904
235918
|
async function analyzeExistingPatterns(projectDir) {
|
|
235905
|
-
const indexPath =
|
|
235906
|
-
if (!
|
|
235919
|
+
const indexPath = join8(projectDir, "index.ts");
|
|
235920
|
+
if (!existsSync7(indexPath)) {
|
|
235907
235921
|
return null;
|
|
235908
235922
|
}
|
|
235909
235923
|
const fileStructure = analyzeFileStructure(projectDir);
|
|
@@ -235923,18 +235937,18 @@ async function analyzeExistingPatterns(projectDir) {
|
|
|
235923
235937
|
};
|
|
235924
235938
|
}
|
|
235925
235939
|
function analyzeFileStructure(projectDir) {
|
|
235926
|
-
const hasAgentsDirectory =
|
|
235927
|
-
const hasToolsDirectory =
|
|
235928
|
-
const hasDataComponentsDirectory =
|
|
235929
|
-
const hasArtifactComponentsDirectory =
|
|
235930
|
-
const hasEnvironmentsDirectory =
|
|
235940
|
+
const hasAgentsDirectory = existsSync7(join8(projectDir, "agents"));
|
|
235941
|
+
const hasToolsDirectory = existsSync7(join8(projectDir, "tools"));
|
|
235942
|
+
const hasDataComponentsDirectory = existsSync7(join8(projectDir, "data-components"));
|
|
235943
|
+
const hasArtifactComponentsDirectory = existsSync7(join8(projectDir, "artifact-components"));
|
|
235944
|
+
const hasEnvironmentsDirectory = existsSync7(join8(projectDir, "environments"));
|
|
235931
235945
|
let toolsLocation = "unknown";
|
|
235932
235946
|
if (hasToolsDirectory) {
|
|
235933
235947
|
toolsLocation = "separate";
|
|
235934
235948
|
} else if (hasAgentsDirectory) {
|
|
235935
|
-
const agentFiles = getFilesInDirectory(
|
|
235949
|
+
const agentFiles = getFilesInDirectory(join8(projectDir, "agents"), ".ts");
|
|
235936
235950
|
const hasInlineTools = agentFiles.some((file) => {
|
|
235937
|
-
const content =
|
|
235951
|
+
const content = readFileSync4(file, "utf-8");
|
|
235938
235952
|
return content.includes("functionTool(");
|
|
235939
235953
|
});
|
|
235940
235954
|
toolsLocation = hasInlineTools ? "inline" : "unknown";
|
|
@@ -235942,8 +235956,8 @@ function analyzeFileStructure(projectDir) {
|
|
|
235942
235956
|
const agentsLocation = hasAgentsDirectory ? "flat" : "unknown";
|
|
235943
235957
|
const allFiles = [
|
|
235944
235958
|
...getFilesInDirectory(projectDir, ".ts"),
|
|
235945
|
-
...hasAgentsDirectory ? getFilesInDirectory(
|
|
235946
|
-
...hasToolsDirectory ? getFilesInDirectory(
|
|
235959
|
+
...hasAgentsDirectory ? getFilesInDirectory(join8(projectDir, "agents"), ".ts") : [],
|
|
235960
|
+
...hasToolsDirectory ? getFilesInDirectory(join8(projectDir, "tools"), ".ts") : []
|
|
235947
235961
|
];
|
|
235948
235962
|
const preferredFileNaming = detectFileNamingConvention(allFiles);
|
|
235949
235963
|
return {
|
|
@@ -235988,10 +236002,10 @@ function collectCodeExamples(projectDir, fileStructure) {
|
|
|
235988
236002
|
mappings: []
|
|
235989
236003
|
};
|
|
235990
236004
|
if (fileStructure.hasAgentsDirectory) {
|
|
235991
|
-
const agentDir =
|
|
236005
|
+
const agentDir = join8(projectDir, "agents");
|
|
235992
236006
|
const agentFiles = getFilesInDirectory(agentDir, ".ts");
|
|
235993
236007
|
for (const file of agentFiles.slice(0, 3)) {
|
|
235994
|
-
const content =
|
|
236008
|
+
const content = readFileSync4(file, "utf-8");
|
|
235995
236009
|
examples.agentFiles.push({ path: file, content });
|
|
235996
236010
|
const imports = extractImports(content);
|
|
235997
236011
|
examples.imports.push(...imports);
|
|
@@ -236000,18 +236014,18 @@ function collectCodeExamples(projectDir, fileStructure) {
|
|
|
236000
236014
|
}
|
|
236001
236015
|
}
|
|
236002
236016
|
if (fileStructure.hasToolsDirectory) {
|
|
236003
|
-
const toolsDir =
|
|
236017
|
+
const toolsDir = join8(projectDir, "tools");
|
|
236004
236018
|
const toolFiles = getFilesInDirectory(toolsDir, ".ts");
|
|
236005
236019
|
for (const file of toolFiles.slice(0, 3)) {
|
|
236006
|
-
const content =
|
|
236020
|
+
const content = readFileSync4(file, "utf-8");
|
|
236007
236021
|
examples.toolFiles.push({ path: file, content });
|
|
236008
236022
|
const mappings = extractVariableMappings(content, file);
|
|
236009
236023
|
examples.mappings.push(...mappings);
|
|
236010
236024
|
}
|
|
236011
236025
|
}
|
|
236012
|
-
const indexPath =
|
|
236013
|
-
if (
|
|
236014
|
-
const content =
|
|
236026
|
+
const indexPath = join8(projectDir, "index.ts");
|
|
236027
|
+
if (existsSync7(indexPath)) {
|
|
236028
|
+
const content = readFileSync4(indexPath, "utf-8");
|
|
236015
236029
|
const imports = extractImports(content);
|
|
236016
236030
|
examples.imports.push(...imports);
|
|
236017
236031
|
}
|
|
@@ -236140,13 +236154,13 @@ function mostCommon(arr) {
|
|
|
236140
236154
|
return mostCommonItem;
|
|
236141
236155
|
}
|
|
236142
236156
|
function getFilesInDirectory(dir, extension) {
|
|
236143
|
-
if (!
|
|
236157
|
+
if (!existsSync7(dir)) {
|
|
236144
236158
|
return [];
|
|
236145
236159
|
}
|
|
236146
236160
|
const files = [];
|
|
236147
236161
|
const entries = readdirSync2(dir);
|
|
236148
236162
|
for (const entry of entries) {
|
|
236149
|
-
const fullPath =
|
|
236163
|
+
const fullPath = join8(dir, entry);
|
|
236150
236164
|
const stat = statSync(fullPath);
|
|
236151
236165
|
if (stat.isDirectory()) {
|
|
236152
236166
|
files.push(...getFilesInDirectory(fullPath, extension));
|
|
@@ -236175,23 +236189,23 @@ __export(display_utils_exports, {
|
|
|
236175
236189
|
displayPlanSummary: () => displayPlanSummary,
|
|
236176
236190
|
displayRecommendedPattern: () => displayRecommendedPattern
|
|
236177
236191
|
});
|
|
236178
|
-
import
|
|
236192
|
+
import chalk8 from "chalk";
|
|
236179
236193
|
function displayPlanSummary(plan) {
|
|
236180
|
-
console.log(
|
|
236181
|
-
console.log(
|
|
236182
|
-
console.log(
|
|
236183
|
-
console.log(
|
|
236194
|
+
console.log(chalk8.cyan("\n\u{1F4CB} Generation Plan:"));
|
|
236195
|
+
console.log(chalk8.gray(` \u2022 Total files: ${plan.metadata.totalFiles}`));
|
|
236196
|
+
console.log(chalk8.gray(` \u2022 New files: ${plan.metadata.newFiles}`));
|
|
236197
|
+
console.log(chalk8.gray(` \u2022 Updated files: ${plan.metadata.updatedFiles}`));
|
|
236184
236198
|
if (plan.metadata.conflicts && plan.metadata.conflicts.length > 0) {
|
|
236185
|
-
console.log(
|
|
236199
|
+
console.log(chalk8.yellow("\n\u26A0\uFE0F Variable Name Conflicts Resolved:"));
|
|
236186
236200
|
for (const conflict of plan.metadata.conflicts) {
|
|
236187
|
-
console.log(
|
|
236188
|
-
console.log(
|
|
236201
|
+
console.log(chalk8.gray(` \u2022 ID "${conflict.id}" used by ${conflict.types.join(", ")}`));
|
|
236202
|
+
console.log(chalk8.gray(" Resolved to:"));
|
|
236189
236203
|
for (const [type, name] of Object.entries(conflict.resolvedNames)) {
|
|
236190
|
-
console.log(
|
|
236204
|
+
console.log(chalk8.gray(` - ${type}: ${name}`));
|
|
236191
236205
|
}
|
|
236192
236206
|
}
|
|
236193
236207
|
}
|
|
236194
|
-
console.log(
|
|
236208
|
+
console.log(chalk8.cyan("\n\u{1F4C4} Files to generate:"));
|
|
236195
236209
|
const filesByType = {
|
|
236196
236210
|
index: [],
|
|
236197
236211
|
agent: [],
|
|
@@ -236208,130 +236222,130 @@ function displayPlanSummary(plan) {
|
|
|
236208
236222
|
filesByType[file.type].push(file);
|
|
236209
236223
|
}
|
|
236210
236224
|
if (filesByType.index.length > 0) {
|
|
236211
|
-
console.log(
|
|
236225
|
+
console.log(chalk8.gray("\n Index:"));
|
|
236212
236226
|
for (const file of filesByType.index) {
|
|
236213
|
-
console.log(
|
|
236227
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236214
236228
|
}
|
|
236215
236229
|
}
|
|
236216
236230
|
if (filesByType.agent.length > 0) {
|
|
236217
|
-
console.log(
|
|
236231
|
+
console.log(chalk8.gray("\n Agents:"));
|
|
236218
236232
|
for (const file of filesByType.agent) {
|
|
236219
|
-
console.log(
|
|
236233
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236220
236234
|
for (const entity of file.entities) {
|
|
236221
236235
|
const badge = entity.id !== entity.variableName ? ` (id: "${entity.id}")` : "";
|
|
236222
|
-
console.log(
|
|
236236
|
+
console.log(chalk8.gray(` - ${entity.variableName}${badge}`));
|
|
236223
236237
|
}
|
|
236224
236238
|
}
|
|
236225
236239
|
}
|
|
236226
236240
|
if (filesByType.tool.length > 0) {
|
|
236227
|
-
console.log(
|
|
236241
|
+
console.log(chalk8.gray("\n Tools:"));
|
|
236228
236242
|
for (const file of filesByType.tool) {
|
|
236229
|
-
console.log(
|
|
236243
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236230
236244
|
for (const entity of file.entities) {
|
|
236231
236245
|
const badge = entity.id !== entity.variableName ? ` (id: "${entity.id}")` : "";
|
|
236232
|
-
console.log(
|
|
236246
|
+
console.log(chalk8.gray(` - ${entity.variableName}${badge}`));
|
|
236233
236247
|
}
|
|
236234
236248
|
}
|
|
236235
236249
|
}
|
|
236236
236250
|
if (filesByType.dataComponent.length > 0) {
|
|
236237
|
-
console.log(
|
|
236251
|
+
console.log(chalk8.gray("\n Data Components:"));
|
|
236238
236252
|
for (const file of filesByType.dataComponent) {
|
|
236239
|
-
console.log(
|
|
236253
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236240
236254
|
for (const entity of file.entities) {
|
|
236241
|
-
console.log(
|
|
236255
|
+
console.log(chalk8.gray(` - ${entity.variableName}`));
|
|
236242
236256
|
}
|
|
236243
236257
|
}
|
|
236244
236258
|
}
|
|
236245
236259
|
if (filesByType.artifactComponent.length > 0) {
|
|
236246
|
-
console.log(
|
|
236260
|
+
console.log(chalk8.gray("\n Artifact Components:"));
|
|
236247
236261
|
for (const file of filesByType.artifactComponent) {
|
|
236248
|
-
console.log(
|
|
236262
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236249
236263
|
for (const entity of file.entities) {
|
|
236250
|
-
console.log(
|
|
236264
|
+
console.log(chalk8.gray(` - ${entity.variableName}`));
|
|
236251
236265
|
}
|
|
236252
236266
|
}
|
|
236253
236267
|
}
|
|
236254
236268
|
if (filesByType.statusComponent.length > 0) {
|
|
236255
|
-
console.log(
|
|
236269
|
+
console.log(chalk8.gray("\n Status Components:"));
|
|
236256
236270
|
for (const file of filesByType.statusComponent) {
|
|
236257
|
-
console.log(
|
|
236271
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236258
236272
|
for (const entity of file.entities) {
|
|
236259
|
-
console.log(
|
|
236273
|
+
console.log(chalk8.gray(` - ${entity.variableName}`));
|
|
236260
236274
|
}
|
|
236261
236275
|
}
|
|
236262
236276
|
}
|
|
236263
236277
|
if (filesByType.environment.length > 0) {
|
|
236264
|
-
console.log(
|
|
236278
|
+
console.log(chalk8.gray("\n Environments:"));
|
|
236265
236279
|
for (const file of filesByType.environment) {
|
|
236266
|
-
console.log(
|
|
236280
|
+
console.log(chalk8.gray(` \u2022 ${file.path}`));
|
|
236267
236281
|
}
|
|
236268
236282
|
}
|
|
236269
236283
|
}
|
|
236270
236284
|
function displayPatternSummary(patterns) {
|
|
236271
|
-
console.log(
|
|
236272
|
-
console.log(
|
|
236273
|
-
console.log(
|
|
236274
|
-
console.log(
|
|
236275
|
-
console.log(
|
|
236276
|
-
console.log(
|
|
236277
|
-
console.log(
|
|
236278
|
-
console.log(
|
|
236279
|
-
console.log(
|
|
236280
|
-
console.log(
|
|
236281
|
-
console.log(
|
|
236282
|
-
console.log(
|
|
236285
|
+
console.log(chalk8.cyan("\n\u{1F50D} Detected Patterns:"));
|
|
236286
|
+
console.log(chalk8.gray(" File Structure:"));
|
|
236287
|
+
console.log(chalk8.gray(` \u2022 Tools: ${patterns.fileStructure.toolsLocation}`));
|
|
236288
|
+
console.log(chalk8.gray(` \u2022 Agents: ${patterns.fileStructure.agentsLocation}`));
|
|
236289
|
+
console.log(chalk8.gray(` \u2022 File naming: ${patterns.fileStructure.preferredFileNaming}`));
|
|
236290
|
+
console.log(chalk8.gray(" Code Style:"));
|
|
236291
|
+
console.log(chalk8.gray(` \u2022 Exports: ${patterns.codeStyle.exportNaming}`));
|
|
236292
|
+
console.log(chalk8.gray(` \u2022 Multi-line strings: ${patterns.codeStyle.multiLineStrings}`));
|
|
236293
|
+
console.log(chalk8.gray(` \u2022 Imports: ${patterns.codeStyle.importStyle}`));
|
|
236294
|
+
console.log(chalk8.gray(" Naming Conventions:"));
|
|
236295
|
+
console.log(chalk8.gray(` \u2022 Agent suffix: "${patterns.namingConventions.agentSuffix}"`));
|
|
236296
|
+
console.log(chalk8.gray(` \u2022 SubAgent suffix: "${patterns.namingConventions.subAgentSuffix}"`));
|
|
236283
236297
|
if (patterns.examples.mappings && patterns.examples.mappings.length > 0) {
|
|
236284
236298
|
console.log(
|
|
236285
|
-
|
|
236299
|
+
chalk8.gray(` Found ${patterns.examples.mappings.length} existing variable mappings`)
|
|
236286
236300
|
);
|
|
236287
236301
|
}
|
|
236288
236302
|
}
|
|
236289
236303
|
function displayRecommendedPattern() {
|
|
236290
|
-
console.log(
|
|
236291
|
-
console.log(
|
|
236292
|
-
console.log(
|
|
236293
|
-
console.log(
|
|
236294
|
-
console.log(
|
|
236295
|
-
console.log(
|
|
236296
|
-
console.log(
|
|
236297
|
-
console.log(
|
|
236298
|
-
console.log(
|
|
236299
|
-
console.log(
|
|
236300
|
-
console.log(
|
|
236301
|
-
console.log(
|
|
236304
|
+
console.log(chalk8.cyan("\n\u{1F4DD} Using Recommended Pattern:"));
|
|
236305
|
+
console.log(chalk8.gray(" File Structure:"));
|
|
236306
|
+
console.log(chalk8.gray(" \u2022 Tools: separate (tools/ directory)"));
|
|
236307
|
+
console.log(chalk8.gray(" \u2022 Agents: flat (agents/ directory)"));
|
|
236308
|
+
console.log(chalk8.gray(" \u2022 File naming: kebab-case"));
|
|
236309
|
+
console.log(chalk8.gray(" Code Style:"));
|
|
236310
|
+
console.log(chalk8.gray(" \u2022 Exports: camelCase"));
|
|
236311
|
+
console.log(chalk8.gray(" \u2022 Multi-line strings: template-literals"));
|
|
236312
|
+
console.log(chalk8.gray(" \u2022 Imports: named"));
|
|
236313
|
+
console.log(chalk8.gray(" Naming:"));
|
|
236314
|
+
console.log(chalk8.gray(' \u2022 Agent suffix: "Agent"'));
|
|
236315
|
+
console.log(chalk8.gray(' \u2022 SubAgent suffix: "SubAgent"'));
|
|
236302
236316
|
}
|
|
236303
236317
|
function displayGenerationProgress(current, total, fileName) {
|
|
236304
236318
|
const percentage = Math.round(current / total * 100);
|
|
236305
|
-
console.log(
|
|
236319
|
+
console.log(chalk8.gray(` [${current}/${total}] ${percentage}% - ${fileName}`));
|
|
236306
236320
|
}
|
|
236307
236321
|
function displayGenerationComplete(plan, duration) {
|
|
236308
|
-
console.log(
|
|
236309
|
-
console.log(
|
|
236310
|
-
console.log(
|
|
236322
|
+
console.log(chalk8.green("\n\u2728 Files generated successfully!"));
|
|
236323
|
+
console.log(chalk8.gray(` \u2022 Duration: ${(duration / 1e3).toFixed(2)}s`));
|
|
236324
|
+
console.log(chalk8.gray(` \u2022 Files: ${plan.metadata.totalFiles}`));
|
|
236311
236325
|
const avgPerFile = duration / plan.metadata.totalFiles;
|
|
236312
|
-
console.log(
|
|
236326
|
+
console.log(chalk8.gray(` \u2022 Average: ${(avgPerFile / 1e3).toFixed(2)}s per file`));
|
|
236313
236327
|
}
|
|
236314
236328
|
function displayConflictWarning(conflicts) {
|
|
236315
236329
|
if (!conflicts || conflicts.length === 0) {
|
|
236316
236330
|
return;
|
|
236317
236331
|
}
|
|
236318
|
-
console.log(
|
|
236319
|
-
console.log(
|
|
236332
|
+
console.log(chalk8.yellow("\n\u26A0\uFE0F Variable Name Conflicts:"));
|
|
236333
|
+
console.log(chalk8.yellow("The following IDs are used by multiple entity types:"));
|
|
236320
236334
|
for (const conflict of conflicts) {
|
|
236321
|
-
console.log(
|
|
236335
|
+
console.log(chalk8.yellow(`
|
|
236322
236336
|
ID: "${conflict.id}"`));
|
|
236323
|
-
console.log(
|
|
236324
|
-
console.log(
|
|
236337
|
+
console.log(chalk8.gray(` Used by: ${conflict.types.join(", ")}`));
|
|
236338
|
+
console.log(chalk8.gray(" Variable names assigned:"));
|
|
236325
236339
|
for (const [type, name] of Object.entries(conflict.resolvedNames)) {
|
|
236326
|
-
console.log(
|
|
236340
|
+
console.log(chalk8.gray(` - ${type}: ${name}`));
|
|
236327
236341
|
}
|
|
236328
236342
|
}
|
|
236329
|
-
console.log(
|
|
236330
|
-
console.log(
|
|
236343
|
+
console.log(chalk8.yellow("\nThese conflicts have been automatically resolved with suffixes."));
|
|
236344
|
+
console.log(chalk8.gray("This is normal and ensures TypeScript compilation succeeds.\n"));
|
|
236331
236345
|
}
|
|
236332
236346
|
function displayFileStructureTree(plan, projectRoot) {
|
|
236333
|
-
console.log(
|
|
236334
|
-
console.log(
|
|
236347
|
+
console.log(chalk8.cyan("\n\u{1F4C1} Generated structure:"));
|
|
236348
|
+
console.log(chalk8.gray(` ${projectRoot}/`));
|
|
236335
236349
|
const byDirectory = {};
|
|
236336
236350
|
for (const file of plan.files) {
|
|
236337
236351
|
const parts = file.path.split("/");
|
|
@@ -236349,16 +236363,16 @@ function displayFileStructureTree(plan, projectRoot) {
|
|
|
236349
236363
|
const isLast = i2 === dirs.length - 1;
|
|
236350
236364
|
if (dir === ".") {
|
|
236351
236365
|
for (const file of files) {
|
|
236352
|
-
console.log(
|
|
236366
|
+
console.log(chalk8.gray(` \u251C\u2500\u2500 ${file}`));
|
|
236353
236367
|
}
|
|
236354
236368
|
} else {
|
|
236355
|
-
console.log(
|
|
236369
|
+
console.log(chalk8.gray(` \u251C\u2500\u2500 ${dir}/`));
|
|
236356
236370
|
for (let j2 = 0; j2 < files.length; j2++) {
|
|
236357
236371
|
const file = files[j2];
|
|
236358
236372
|
const isLastFile = j2 === files.length - 1;
|
|
236359
236373
|
const prefix = isLast ? " " : " \u2502 ";
|
|
236360
236374
|
const branch = isLastFile ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500";
|
|
236361
|
-
console.log(
|
|
236375
|
+
console.log(chalk8.gray(`${prefix}${branch} ${file}`));
|
|
236362
236376
|
}
|
|
236363
236377
|
}
|
|
236364
236378
|
}
|
|
@@ -237260,11 +237274,11 @@ __export(plan_storage_exports, {
|
|
|
237260
237274
|
planExists: () => planExists,
|
|
237261
237275
|
savePlan: () => savePlan
|
|
237262
237276
|
});
|
|
237263
|
-
import { existsSync as
|
|
237264
|
-
import { join as
|
|
237277
|
+
import { existsSync as existsSync8, mkdirSync, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
237278
|
+
import { join as join9 } from "path";
|
|
237265
237279
|
function savePlan(projectRoot, plan) {
|
|
237266
|
-
const inkeepDir =
|
|
237267
|
-
if (!
|
|
237280
|
+
const inkeepDir = join9(projectRoot, ".inkeep");
|
|
237281
|
+
if (!existsSync8(inkeepDir)) {
|
|
237268
237282
|
mkdirSync(inkeepDir, { recursive: true });
|
|
237269
237283
|
}
|
|
237270
237284
|
const gitCommit = getGitCommit(projectRoot);
|
|
@@ -237277,19 +237291,19 @@ function savePlan(projectRoot, plan) {
|
|
|
237277
237291
|
},
|
|
237278
237292
|
plan
|
|
237279
237293
|
};
|
|
237280
|
-
const planPath =
|
|
237294
|
+
const planPath = join9(inkeepDir, "generation-plan.json");
|
|
237281
237295
|
writeFileSync5(planPath, JSON.stringify(storedPlan, null, 2));
|
|
237282
|
-
const backupPath =
|
|
237296
|
+
const backupPath = join9(inkeepDir, `generation-plan-${Date.now()}.json`);
|
|
237283
237297
|
writeFileSync5(backupPath, JSON.stringify(storedPlan, null, 2));
|
|
237284
237298
|
cleanupOldBackups(inkeepDir);
|
|
237285
237299
|
}
|
|
237286
237300
|
function loadPlan(projectRoot) {
|
|
237287
|
-
const planPath =
|
|
237288
|
-
if (!
|
|
237301
|
+
const planPath = join9(projectRoot, ".inkeep", "generation-plan.json");
|
|
237302
|
+
if (!existsSync8(planPath)) {
|
|
237289
237303
|
return null;
|
|
237290
237304
|
}
|
|
237291
237305
|
try {
|
|
237292
|
-
const content =
|
|
237306
|
+
const content = readFileSync5(planPath, "utf-8");
|
|
237293
237307
|
return JSON.parse(content);
|
|
237294
237308
|
} catch (error) {
|
|
237295
237309
|
console.error("Failed to load generation plan:", error);
|
|
@@ -237297,8 +237311,8 @@ function loadPlan(projectRoot) {
|
|
|
237297
237311
|
}
|
|
237298
237312
|
}
|
|
237299
237313
|
function planExists(projectRoot) {
|
|
237300
|
-
const planPath =
|
|
237301
|
-
return
|
|
237314
|
+
const planPath = join9(projectRoot, ".inkeep", "generation-plan.json");
|
|
237315
|
+
return existsSync8(planPath);
|
|
237302
237316
|
}
|
|
237303
237317
|
function getGitCommit(projectRoot) {
|
|
237304
237318
|
try {
|
|
@@ -237317,8 +237331,8 @@ function cleanupOldBackups(inkeepDir) {
|
|
|
237317
237331
|
const { readdirSync: readdirSync3, unlinkSync, statSync: statSync2 } = __require("fs");
|
|
237318
237332
|
const files = readdirSync3(inkeepDir).filter((f) => f.startsWith("generation-plan-") && f.endsWith(".json")).map((f) => ({
|
|
237319
237333
|
name: f,
|
|
237320
|
-
path:
|
|
237321
|
-
mtime: statSync2(
|
|
237334
|
+
path: join9(inkeepDir, f),
|
|
237335
|
+
mtime: statSync2(join9(inkeepDir, f)).mtime.getTime()
|
|
237322
237336
|
})).sort((a, b2) => b2.mtime - a.mtime);
|
|
237323
237337
|
for (let i2 = 5; i2 < files.length; i2++) {
|
|
237324
237338
|
unlinkSync(files[i2].path);
|
|
@@ -237393,44 +237407,44 @@ function comparePatterns(oldPatterns, newPatterns, diff) {
|
|
|
237393
237407
|
}
|
|
237394
237408
|
}
|
|
237395
237409
|
function displayPlanDiff(diff) {
|
|
237396
|
-
const
|
|
237410
|
+
const chalk13 = __require("chalk");
|
|
237397
237411
|
if (diff.filesAdded.length === 0 && diff.filesRemoved.length === 0 && diff.registryChanges.length === 0 && diff.patternChanges.length === 0) {
|
|
237398
|
-
console.log(
|
|
237412
|
+
console.log(chalk13.green("No changes detected"));
|
|
237399
237413
|
return;
|
|
237400
237414
|
}
|
|
237401
|
-
console.log(
|
|
237415
|
+
console.log(chalk13.cyan("\n\u{1F4DD} Changes since last pull:"));
|
|
237402
237416
|
if (diff.filesAdded.length > 0) {
|
|
237403
|
-
console.log(
|
|
237417
|
+
console.log(chalk13.green("\n Files added:"));
|
|
237404
237418
|
for (const file of diff.filesAdded) {
|
|
237405
|
-
console.log(
|
|
237419
|
+
console.log(chalk13.green(` + ${file}`));
|
|
237406
237420
|
}
|
|
237407
237421
|
}
|
|
237408
237422
|
if (diff.filesRemoved.length > 0) {
|
|
237409
|
-
console.log(
|
|
237423
|
+
console.log(chalk13.red("\n Files removed:"));
|
|
237410
237424
|
for (const file of diff.filesRemoved) {
|
|
237411
|
-
console.log(
|
|
237425
|
+
console.log(chalk13.red(` - ${file}`));
|
|
237412
237426
|
}
|
|
237413
237427
|
}
|
|
237414
237428
|
if (diff.registryChanges.length > 0) {
|
|
237415
|
-
console.log(
|
|
237429
|
+
console.log(chalk13.yellow("\n Variable name changes:"));
|
|
237416
237430
|
for (const change of diff.registryChanges) {
|
|
237417
|
-
console.log(
|
|
237418
|
-
console.log(
|
|
237431
|
+
console.log(chalk13.yellow(` \u2022 ${change.type}.${change.id}:`));
|
|
237432
|
+
console.log(chalk13.gray(` ${change.oldName} \u2192 ${change.newName}`));
|
|
237419
237433
|
}
|
|
237420
237434
|
}
|
|
237421
237435
|
if (diff.patternChanges.length > 0) {
|
|
237422
|
-
console.log(
|
|
237436
|
+
console.log(chalk13.yellow("\n Pattern changes:"));
|
|
237423
237437
|
for (const change of diff.patternChanges) {
|
|
237424
|
-
console.log(
|
|
237425
|
-
console.log(
|
|
237438
|
+
console.log(chalk13.yellow(` \u2022 ${change.field}:`));
|
|
237439
|
+
console.log(chalk13.gray(` ${change.oldValue} \u2192 ${change.newValue}`));
|
|
237426
237440
|
}
|
|
237427
237441
|
}
|
|
237428
237442
|
}
|
|
237429
237443
|
function ensureGitignore(projectRoot) {
|
|
237430
|
-
const gitignorePath =
|
|
237444
|
+
const gitignorePath = join9(projectRoot, ".gitignore");
|
|
237431
237445
|
let content = "";
|
|
237432
|
-
if (
|
|
237433
|
-
content =
|
|
237446
|
+
if (existsSync8(gitignorePath)) {
|
|
237447
|
+
content = readFileSync5(gitignorePath, "utf-8");
|
|
237434
237448
|
}
|
|
237435
237449
|
if (content.includes(".inkeep")) {
|
|
237436
237450
|
return;
|
|
@@ -237451,11 +237465,11 @@ __export(chat_enhanced_exports, {
|
|
|
237451
237465
|
chatCommandEnhanced: () => chatCommandEnhanced
|
|
237452
237466
|
});
|
|
237453
237467
|
import * as readline from "readline";
|
|
237454
|
-
import
|
|
237468
|
+
import chalk12 from "chalk";
|
|
237455
237469
|
import inquirer2 from "inquirer";
|
|
237456
|
-
import
|
|
237470
|
+
import ora8 from "ora";
|
|
237457
237471
|
async function chatCommandEnhanced(agentIdInput, options) {
|
|
237458
|
-
console.log(
|
|
237472
|
+
console.log(chalk12.cyan("\u{1F916} Inkeep Chat Interface\n"));
|
|
237459
237473
|
const configPath = options?.config || options?.configFilePath;
|
|
237460
237474
|
const { config } = await initializeCommand({
|
|
237461
237475
|
configPath,
|
|
@@ -237475,18 +237489,18 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237475
237489
|
);
|
|
237476
237490
|
let agentId = agentIdInput;
|
|
237477
237491
|
if (!agentId) {
|
|
237478
|
-
const spinner2 =
|
|
237492
|
+
const spinner2 = ora8("Fetching available agent...").start();
|
|
237479
237493
|
try {
|
|
237480
237494
|
const agent = await managementApi.listAgents();
|
|
237481
237495
|
spinner2.stop();
|
|
237482
237496
|
if (agent.length === 0) {
|
|
237483
237497
|
console.error(
|
|
237484
|
-
|
|
237498
|
+
chalk12.red("No agent available. Define agent in your project and run: inkeep push")
|
|
237485
237499
|
);
|
|
237486
237500
|
process.exit(1);
|
|
237487
237501
|
}
|
|
237488
237502
|
const agentChoices = agent.map((g) => ({
|
|
237489
|
-
name: `${
|
|
237503
|
+
name: `${chalk12.cyan(g.id)} - ${g.name || "Unnamed Agent"}`,
|
|
237490
237504
|
value: g.id,
|
|
237491
237505
|
short: g.id,
|
|
237492
237506
|
searchText: `${g.id} ${g.name || ""}`.toLowerCase()
|
|
@@ -237503,11 +237517,11 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237503
237517
|
agentId = answer.agentId;
|
|
237504
237518
|
} catch (error) {
|
|
237505
237519
|
spinner2.fail("Failed to fetch agent");
|
|
237506
|
-
console.error(
|
|
237520
|
+
console.error(chalk12.red("Error:"), error instanceof Error ? error.message : error);
|
|
237507
237521
|
process.exit(1);
|
|
237508
237522
|
}
|
|
237509
237523
|
}
|
|
237510
|
-
const spinner =
|
|
237524
|
+
const spinner = ora8("Connecting to agent...").start();
|
|
237511
237525
|
try {
|
|
237512
237526
|
if (!agentId) {
|
|
237513
237527
|
throw new Error("No agent selected");
|
|
@@ -237517,38 +237531,38 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237517
237531
|
spinner.fail(`Agent "${agentId}" not found`);
|
|
237518
237532
|
const agent2 = await managementApi.listAgents();
|
|
237519
237533
|
if (agent2.length > 0) {
|
|
237520
|
-
console.log(
|
|
237534
|
+
console.log(chalk12.yellow("\nAvailable agent:"));
|
|
237521
237535
|
agent2.forEach((g) => {
|
|
237522
|
-
console.log(
|
|
237536
|
+
console.log(chalk12.gray(` \u2022 ${g.id} - ${g.name || "Unnamed"}`));
|
|
237523
237537
|
});
|
|
237524
|
-
console.log(
|
|
237538
|
+
console.log(chalk12.gray('\nRun "inkeep chat" without arguments for interactive selection'));
|
|
237525
237539
|
} else {
|
|
237526
|
-
console.log(
|
|
237540
|
+
console.log(chalk12.yellow("\nNo agent found. Please define agent and push your project."));
|
|
237527
237541
|
}
|
|
237528
237542
|
process.exit(1);
|
|
237529
237543
|
}
|
|
237530
|
-
spinner.succeed(`Connected to agent: ${
|
|
237544
|
+
spinner.succeed(`Connected to agent: ${chalk12.green(agent.name || agentId)}`);
|
|
237531
237545
|
if (agent.description) {
|
|
237532
|
-
console.log(
|
|
237546
|
+
console.log(chalk12.gray(`Description: ${agent.description}`));
|
|
237533
237547
|
}
|
|
237534
237548
|
if (agent.defaultSubAgentId) {
|
|
237535
|
-
console.log(
|
|
237549
|
+
console.log(chalk12.gray(`Default Agent: ${agent.defaultSubAgentId}`));
|
|
237536
237550
|
}
|
|
237537
237551
|
} catch (error) {
|
|
237538
237552
|
spinner.fail("Failed to connect to agent");
|
|
237539
|
-
console.error(
|
|
237553
|
+
console.error(chalk12.red("Error:"), error instanceof Error ? error.message : error);
|
|
237540
237554
|
process.exit(1);
|
|
237541
237555
|
}
|
|
237542
237556
|
const rl = readline.createInterface({
|
|
237543
237557
|
input: process.stdin,
|
|
237544
237558
|
output: process.stdout,
|
|
237545
|
-
prompt:
|
|
237559
|
+
prompt: chalk12.cyan("You> ")
|
|
237546
237560
|
});
|
|
237547
237561
|
const conversationId = `cli-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
237548
237562
|
const messages2 = [];
|
|
237549
237563
|
let emitOperations = false;
|
|
237550
|
-
console.log(
|
|
237551
|
-
console.log(
|
|
237564
|
+
console.log(chalk12.gray('\n\u{1F4AC} Chat session started. Type "exit" or press Ctrl+C to quit.'));
|
|
237565
|
+
console.log(chalk12.gray("Commands: help, clear, history, reset, operations\n"));
|
|
237552
237566
|
async function handleStreamingResponse(stream, showDebug = false) {
|
|
237553
237567
|
const decoder = new TextDecoder();
|
|
237554
237568
|
const reader = stream.getReader();
|
|
@@ -237615,12 +237629,12 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237615
237629
|
if (opType === "completion" && hasStartedResponse) {
|
|
237616
237630
|
console.log("");
|
|
237617
237631
|
}
|
|
237618
|
-
console.log(
|
|
237632
|
+
console.log(chalk12.gray(` [${opType}] ${displayText}`));
|
|
237619
237633
|
}
|
|
237620
237634
|
currentPos = jsonEnd;
|
|
237621
237635
|
} catch {
|
|
237622
237636
|
if (!hasStartedResponse) {
|
|
237623
|
-
process.stdout.write(
|
|
237637
|
+
process.stdout.write(chalk12.green("Assistant> "));
|
|
237624
237638
|
hasStartedResponse = true;
|
|
237625
237639
|
}
|
|
237626
237640
|
process.stdout.write(content[currentPos]);
|
|
@@ -237629,7 +237643,7 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237629
237643
|
}
|
|
237630
237644
|
} else {
|
|
237631
237645
|
if (!hasStartedResponse) {
|
|
237632
|
-
process.stdout.write(
|
|
237646
|
+
process.stdout.write(chalk12.green("Assistant> "));
|
|
237633
237647
|
hasStartedResponse = true;
|
|
237634
237648
|
}
|
|
237635
237649
|
process.stdout.write(content[currentPos]);
|
|
@@ -237649,7 +237663,7 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237649
237663
|
if (hasStartedResponse) {
|
|
237650
237664
|
console.log("\n");
|
|
237651
237665
|
} else {
|
|
237652
|
-
console.log(`${
|
|
237666
|
+
console.log(`${chalk12.green("Assistant> ") + chalk12.gray("(no response)")}
|
|
237653
237667
|
`);
|
|
237654
237668
|
}
|
|
237655
237669
|
return responseContent;
|
|
@@ -237658,49 +237672,49 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237658
237672
|
const trimmedInput = input.trim();
|
|
237659
237673
|
const command = trimmedInput.toLowerCase().replace(/^\//, "");
|
|
237660
237674
|
if (command === "exit") {
|
|
237661
|
-
console.log(
|
|
237675
|
+
console.log(chalk12.gray("Goodbye! \u{1F44B}"));
|
|
237662
237676
|
rl.close();
|
|
237663
237677
|
process.exit(0);
|
|
237664
237678
|
}
|
|
237665
237679
|
if (command === "clear") {
|
|
237666
237680
|
console.clear();
|
|
237667
|
-
console.log(
|
|
237681
|
+
console.log(chalk12.gray("Screen cleared. Conversation context preserved.\n"));
|
|
237668
237682
|
rl.prompt();
|
|
237669
237683
|
return;
|
|
237670
237684
|
}
|
|
237671
237685
|
if (command === "help") {
|
|
237672
|
-
console.log(
|
|
237673
|
-
console.log(
|
|
237674
|
-
console.log(
|
|
237675
|
-
console.log(
|
|
237676
|
-
console.log(
|
|
237686
|
+
console.log(chalk12.cyan("\n\u{1F4DA} Available commands:"));
|
|
237687
|
+
console.log(chalk12.gray(" \u2022 exit - End the chat session"));
|
|
237688
|
+
console.log(chalk12.gray(" \u2022 clear - Clear the screen (preserves context)"));
|
|
237689
|
+
console.log(chalk12.gray(" \u2022 history - Show conversation history"));
|
|
237690
|
+
console.log(chalk12.gray(" \u2022 reset - Reset conversation context"));
|
|
237677
237691
|
console.log(
|
|
237678
|
-
|
|
237692
|
+
chalk12.gray(" \u2022 operations - Toggle emit operations (show/hide data operations)")
|
|
237679
237693
|
);
|
|
237680
|
-
console.log(
|
|
237681
|
-
console.log(
|
|
237694
|
+
console.log(chalk12.gray(" \u2022 help - Show this help message"));
|
|
237695
|
+
console.log(chalk12.gray("\n Commands can be prefixed with / (e.g., /help)\n"));
|
|
237682
237696
|
rl.prompt();
|
|
237683
237697
|
return;
|
|
237684
237698
|
}
|
|
237685
237699
|
if (command === "operations") {
|
|
237686
237700
|
emitOperations = !emitOperations;
|
|
237687
|
-
console.log(
|
|
237701
|
+
console.log(chalk12.yellow(`
|
|
237688
237702
|
\u{1F527} Data operations: ${emitOperations ? "ON" : "OFF"}`));
|
|
237689
237703
|
if (emitOperations) {
|
|
237690
|
-
console.log(
|
|
237704
|
+
console.log(chalk12.gray("Data operations will be shown during responses.\n"));
|
|
237691
237705
|
} else {
|
|
237692
|
-
console.log(
|
|
237706
|
+
console.log(chalk12.gray("Data operations are hidden.\n"));
|
|
237693
237707
|
}
|
|
237694
237708
|
rl.prompt();
|
|
237695
237709
|
return;
|
|
237696
237710
|
}
|
|
237697
237711
|
if (command === "history") {
|
|
237698
|
-
console.log(
|
|
237712
|
+
console.log(chalk12.cyan("\n\u{1F4DC} Conversation History:"));
|
|
237699
237713
|
if (messages2.length === 0) {
|
|
237700
|
-
console.log(
|
|
237714
|
+
console.log(chalk12.gray(" (No messages yet)\n"));
|
|
237701
237715
|
} else {
|
|
237702
237716
|
messages2.forEach((msg, idx) => {
|
|
237703
|
-
const role = msg.role === "user" ?
|
|
237717
|
+
const role = msg.role === "user" ? chalk12.blue("You") : chalk12.green("Assistant");
|
|
237704
237718
|
const preview = msg.content.substring(0, 100);
|
|
237705
237719
|
const suffix = msg.content.length > 100 ? "..." : "";
|
|
237706
237720
|
console.log(` ${idx + 1}. ${role}: ${preview}${suffix}`);
|
|
@@ -237712,7 +237726,7 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237712
237726
|
}
|
|
237713
237727
|
if (command === "reset") {
|
|
237714
237728
|
messages2.length = 0;
|
|
237715
|
-
console.log(
|
|
237729
|
+
console.log(chalk12.yellow("\u26A0\uFE0F Conversation context has been reset.\n"));
|
|
237716
237730
|
rl.prompt();
|
|
237717
237731
|
return;
|
|
237718
237732
|
}
|
|
@@ -237731,23 +237745,23 @@ async function chatCommandEnhanced(agentIdInput, options) {
|
|
|
237731
237745
|
);
|
|
237732
237746
|
let assistantResponse;
|
|
237733
237747
|
if (typeof response === "string") {
|
|
237734
|
-
console.log(
|
|
237748
|
+
console.log(chalk12.green("Assistant>"), response);
|
|
237735
237749
|
assistantResponse = response;
|
|
237736
237750
|
} else {
|
|
237737
237751
|
assistantResponse = await handleStreamingResponse(response, emitOperations);
|
|
237738
237752
|
}
|
|
237739
237753
|
messages2.push({ role: "assistant", content: assistantResponse });
|
|
237740
237754
|
} catch (error) {
|
|
237741
|
-
console.error(
|
|
237755
|
+
console.error(chalk12.red("Error:"), error instanceof Error ? error.message : error);
|
|
237742
237756
|
}
|
|
237743
237757
|
rl.prompt();
|
|
237744
237758
|
});
|
|
237745
237759
|
rl.on("close", () => {
|
|
237746
|
-
console.log(
|
|
237747
|
-
console.log(
|
|
237748
|
-
console.log(
|
|
237749
|
-
console.log(
|
|
237750
|
-
console.log(
|
|
237760
|
+
console.log(chalk12.gray("\n\u{1F4CA} Session Summary:"));
|
|
237761
|
+
console.log(chalk12.gray(` \u2022 Agent: ${agentId}`));
|
|
237762
|
+
console.log(chalk12.gray(` \u2022 Messages: ${messages2.length}`));
|
|
237763
|
+
console.log(chalk12.gray(` \u2022 Duration: ${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`));
|
|
237764
|
+
console.log(chalk12.gray("\nChat session ended."));
|
|
237751
237765
|
process.exit(0);
|
|
237752
237766
|
});
|
|
237753
237767
|
rl.prompt();
|
|
@@ -237792,9 +237806,9 @@ ${error.message}`
|
|
|
237792
237806
|
var env2 = parseEnv2();
|
|
237793
237807
|
|
|
237794
237808
|
// src/index.ts
|
|
237795
|
-
import { readFileSync as
|
|
237796
|
-
import { dirname as
|
|
237797
|
-
import { fileURLToPath as
|
|
237809
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
237810
|
+
import { dirname as dirname6, join as join13 } from "path";
|
|
237811
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
237798
237812
|
import { Command } from "commander";
|
|
237799
237813
|
|
|
237800
237814
|
// src/commands/add.ts
|
|
@@ -237998,24 +238012,24 @@ var defaultGoogleModelConfigurations = {
|
|
|
237998
238012
|
};
|
|
237999
238013
|
var defaultOpenaiModelConfigurations = {
|
|
238000
238014
|
base: {
|
|
238001
|
-
model: OPENAI_MODELS.
|
|
238015
|
+
model: OPENAI_MODELS.GPT_4_1
|
|
238002
238016
|
},
|
|
238003
238017
|
structuredOutput: {
|
|
238004
|
-
model: OPENAI_MODELS.
|
|
238018
|
+
model: OPENAI_MODELS.GPT_4_1_MINI
|
|
238005
238019
|
},
|
|
238006
238020
|
summarizer: {
|
|
238007
|
-
model: OPENAI_MODELS.
|
|
238021
|
+
model: OPENAI_MODELS.GPT_4_1_NANO
|
|
238008
238022
|
}
|
|
238009
238023
|
};
|
|
238010
238024
|
var defaultAnthropicModelConfigurations = {
|
|
238011
238025
|
base: {
|
|
238012
|
-
model: ANTHROPIC_MODELS.
|
|
238026
|
+
model: ANTHROPIC_MODELS.CLAUDE_SONNET_4_5
|
|
238013
238027
|
},
|
|
238014
238028
|
structuredOutput: {
|
|
238015
|
-
model: ANTHROPIC_MODELS.
|
|
238029
|
+
model: ANTHROPIC_MODELS.CLAUDE_SONNET_4_5
|
|
238016
238030
|
},
|
|
238017
238031
|
summarizer: {
|
|
238018
|
-
model: ANTHROPIC_MODELS.
|
|
238032
|
+
model: ANTHROPIC_MODELS.CLAUDE_SONNET_4_5
|
|
238019
238033
|
}
|
|
238020
238034
|
};
|
|
238021
238035
|
async function addCommand(options) {
|
|
@@ -238643,9 +238657,9 @@ ${table.toString()}`);
|
|
|
238643
238657
|
init_esm_shims();
|
|
238644
238658
|
init_src();
|
|
238645
238659
|
init_api();
|
|
238646
|
-
import { existsSync as
|
|
238647
|
-
import { dirname as
|
|
238648
|
-
import
|
|
238660
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
238661
|
+
import { dirname as dirname5, join as join10, resolve as resolve4 } from "path";
|
|
238662
|
+
import chalk9 from "chalk";
|
|
238649
238663
|
import ora5 from "ora";
|
|
238650
238664
|
import prompts from "prompts";
|
|
238651
238665
|
init_config();
|
|
@@ -238685,29 +238699,117 @@ async function findProjectDirectory(projectId, configPath) {
|
|
|
238685
238699
|
|
|
238686
238700
|
// src/commands/pull.ts
|
|
238687
238701
|
init_tsx_loader();
|
|
238702
|
+
|
|
238703
|
+
// src/utils/background-version-check.ts
|
|
238704
|
+
init_esm_shims();
|
|
238705
|
+
import chalk7 from "chalk";
|
|
238706
|
+
|
|
238707
|
+
// src/utils/version-check.ts
|
|
238708
|
+
init_esm_shims();
|
|
238709
|
+
import { existsSync as existsSync6, readFileSync as readFileSync2 } from "fs";
|
|
238710
|
+
import { dirname as dirname4, join as join6 } from "path";
|
|
238711
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
238712
|
+
var __filename2 = fileURLToPath2(import.meta.url);
|
|
238713
|
+
var __dirname2 = dirname4(__filename2);
|
|
238714
|
+
var DEFAULT_PACKAGE_NAME = "@inkeep/agents-cli";
|
|
238715
|
+
function getCurrentVersion() {
|
|
238716
|
+
let packageJsonPath2 = join6(__dirname2, "..", "package.json");
|
|
238717
|
+
if (!existsSync6(packageJsonPath2)) {
|
|
238718
|
+
packageJsonPath2 = join6(__dirname2, "..", "..", "package.json");
|
|
238719
|
+
}
|
|
238720
|
+
const packageJson2 = JSON.parse(readFileSync2(packageJsonPath2, "utf-8"));
|
|
238721
|
+
return packageJson2.version;
|
|
238722
|
+
}
|
|
238723
|
+
async function getLatestVersion(packageName = DEFAULT_PACKAGE_NAME) {
|
|
238724
|
+
const controller = new AbortController();
|
|
238725
|
+
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
238726
|
+
try {
|
|
238727
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
|
|
238728
|
+
signal: controller.signal
|
|
238729
|
+
});
|
|
238730
|
+
if (!response.ok) {
|
|
238731
|
+
throw new Error(`Failed to fetch latest version: ${response.statusText}`);
|
|
238732
|
+
}
|
|
238733
|
+
const data = await response.json();
|
|
238734
|
+
return data.version;
|
|
238735
|
+
} catch (error) {
|
|
238736
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
238737
|
+
throw new Error("Unable to check for updates: Request timed out after 10 seconds");
|
|
238738
|
+
}
|
|
238739
|
+
throw new Error(
|
|
238740
|
+
`Unable to check for updates: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
238741
|
+
);
|
|
238742
|
+
} finally {
|
|
238743
|
+
clearTimeout(timeoutId);
|
|
238744
|
+
}
|
|
238745
|
+
}
|
|
238746
|
+
function compareVersions(v1, v2) {
|
|
238747
|
+
const cleanV1 = v1.split("-")[0].split("+")[0];
|
|
238748
|
+
const cleanV2 = v2.split("-")[0].split("+")[0];
|
|
238749
|
+
const parts1 = cleanV1.split(".").map(Number);
|
|
238750
|
+
const parts2 = cleanV2.split(".").map(Number);
|
|
238751
|
+
for (let i2 = 0; i2 < Math.max(parts1.length, parts2.length); i2++) {
|
|
238752
|
+
const part1 = parts1[i2] || 0;
|
|
238753
|
+
const part2 = parts2[i2] || 0;
|
|
238754
|
+
if (part1 < part2) return -1;
|
|
238755
|
+
if (part1 > part2) return 1;
|
|
238756
|
+
}
|
|
238757
|
+
return 0;
|
|
238758
|
+
}
|
|
238759
|
+
async function checkForUpdate() {
|
|
238760
|
+
const current = getCurrentVersion();
|
|
238761
|
+
const latest = await getLatestVersion();
|
|
238762
|
+
const needsUpdate = compareVersions(current, latest) < 0;
|
|
238763
|
+
return {
|
|
238764
|
+
current,
|
|
238765
|
+
latest,
|
|
238766
|
+
needsUpdate
|
|
238767
|
+
};
|
|
238768
|
+
}
|
|
238769
|
+
function getChangelogUrl() {
|
|
238770
|
+
return `https://github.com/inkeep/agents/blob/main/agents-cli/CHANGELOG.md`;
|
|
238771
|
+
}
|
|
238772
|
+
|
|
238773
|
+
// src/utils/background-version-check.ts
|
|
238774
|
+
function performBackgroundVersionCheck() {
|
|
238775
|
+
checkForUpdate().then((versionInfo) => {
|
|
238776
|
+
if (versionInfo.needsUpdate) {
|
|
238777
|
+
console.log(
|
|
238778
|
+
chalk7.yellow(
|
|
238779
|
+
`
|
|
238780
|
+
\u26A0\uFE0F A new version of @inkeep/agents-cli is available: ${versionInfo.latest} (current: ${versionInfo.current})`
|
|
238781
|
+
)
|
|
238782
|
+
);
|
|
238783
|
+
console.log(chalk7.gray(" Run `inkeep update` to upgrade to the latest version\n"));
|
|
238784
|
+
}
|
|
238785
|
+
}).catch(() => {
|
|
238786
|
+
});
|
|
238787
|
+
}
|
|
238788
|
+
|
|
238789
|
+
// src/commands/pull.ts
|
|
238688
238790
|
init_pull_llm_generate();
|
|
238689
238791
|
async function detectCurrentProject(debug = false) {
|
|
238690
|
-
const indexPath =
|
|
238792
|
+
const indexPath = join10(process.cwd(), "index.ts");
|
|
238691
238793
|
if (debug) {
|
|
238692
|
-
console.log(
|
|
238794
|
+
console.log(chalk9.gray(`
|
|
238693
238795
|
[DEBUG] Detecting project in current directory...`));
|
|
238694
|
-
console.log(
|
|
238695
|
-
console.log(
|
|
238796
|
+
console.log(chalk9.gray(` \u2022 Current directory: ${process.cwd()}`));
|
|
238797
|
+
console.log(chalk9.gray(` \u2022 Looking for: ${indexPath}`));
|
|
238696
238798
|
}
|
|
238697
|
-
if (!
|
|
238799
|
+
if (!existsSync9(indexPath)) {
|
|
238698
238800
|
if (debug) {
|
|
238699
|
-
console.log(
|
|
238801
|
+
console.log(chalk9.gray(` \u2022 index.ts not found`));
|
|
238700
238802
|
}
|
|
238701
238803
|
return null;
|
|
238702
238804
|
}
|
|
238703
238805
|
if (debug) {
|
|
238704
|
-
console.log(
|
|
238806
|
+
console.log(chalk9.gray(` \u2022 index.ts found, attempting to import...`));
|
|
238705
238807
|
}
|
|
238706
238808
|
try {
|
|
238707
238809
|
const module = await importWithTypeScriptSupport(indexPath);
|
|
238708
238810
|
if (debug) {
|
|
238709
|
-
console.log(
|
|
238710
|
-
console.log(
|
|
238811
|
+
console.log(chalk9.gray(` \u2022 Module imported successfully`));
|
|
238812
|
+
console.log(chalk9.gray(` \u2022 Exports found: ${Object.keys(module).join(", ")}`));
|
|
238711
238813
|
}
|
|
238712
238814
|
const exports = Object.keys(module);
|
|
238713
238815
|
for (const exportKey of exports) {
|
|
@@ -238717,7 +238819,7 @@ async function detectCurrentProject(debug = false) {
|
|
|
238717
238819
|
const projectId = value.getId();
|
|
238718
238820
|
if (debug) {
|
|
238719
238821
|
console.log(
|
|
238720
|
-
|
|
238822
|
+
chalk9.gray(` \u2022 Project detected: ${projectId} (from export: ${exportKey})`)
|
|
238721
238823
|
);
|
|
238722
238824
|
}
|
|
238723
238825
|
return projectId;
|
|
@@ -238725,31 +238827,31 @@ async function detectCurrentProject(debug = false) {
|
|
|
238725
238827
|
}
|
|
238726
238828
|
}
|
|
238727
238829
|
if (debug) {
|
|
238728
|
-
console.log(
|
|
238830
|
+
console.log(chalk9.gray(` \u2022 No project export found in module`));
|
|
238729
238831
|
}
|
|
238730
238832
|
return null;
|
|
238731
238833
|
} catch (error) {
|
|
238732
238834
|
if (debug) {
|
|
238733
|
-
console.log(
|
|
238734
|
-
console.log(
|
|
238835
|
+
console.log(chalk9.gray(` \u2022 Failed to import: ${error.message}`));
|
|
238836
|
+
console.log(chalk9.gray(` \u2022 Falling back to static file parsing...`));
|
|
238735
238837
|
}
|
|
238736
238838
|
try {
|
|
238737
|
-
const content =
|
|
238839
|
+
const content = readFileSync6(indexPath, "utf-8");
|
|
238738
238840
|
const projectIdMatch = content.match(/project\s*\(\s*\{\s*id\s*:\s*['"]([^'"]+)['"]/);
|
|
238739
238841
|
if (projectIdMatch?.[1]) {
|
|
238740
238842
|
const projectId = projectIdMatch[1];
|
|
238741
238843
|
if (debug) {
|
|
238742
|
-
console.log(
|
|
238844
|
+
console.log(chalk9.gray(` \u2022 Project ID extracted from static parse: ${projectId}`));
|
|
238743
238845
|
}
|
|
238744
238846
|
return projectId;
|
|
238745
238847
|
}
|
|
238746
238848
|
if (debug) {
|
|
238747
|
-
console.log(
|
|
238849
|
+
console.log(chalk9.gray(` \u2022 Could not find project ID in file content`));
|
|
238748
238850
|
}
|
|
238749
238851
|
return null;
|
|
238750
238852
|
} catch (parseError) {
|
|
238751
238853
|
if (debug) {
|
|
238752
|
-
console.log(
|
|
238854
|
+
console.log(chalk9.gray(` \u2022 Static parsing failed: ${parseError.message}`));
|
|
238753
238855
|
}
|
|
238754
238856
|
return null;
|
|
238755
238857
|
}
|
|
@@ -238759,12 +238861,12 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
238759
238861
|
const errors = [];
|
|
238760
238862
|
const warnings = [];
|
|
238761
238863
|
try {
|
|
238762
|
-
const indexPath =
|
|
238763
|
-
if (!
|
|
238864
|
+
const indexPath = join10(projectDir, "index.ts");
|
|
238865
|
+
if (!existsSync9(indexPath)) {
|
|
238764
238866
|
errors.push("Generated index.ts file not found");
|
|
238765
238867
|
return { success: false, errors, warnings };
|
|
238766
238868
|
}
|
|
238767
|
-
const indexContent =
|
|
238869
|
+
const indexContent = readFileSync6(indexPath, "utf-8");
|
|
238768
238870
|
if (!indexContent.includes("project(")) {
|
|
238769
238871
|
errors.push("index.ts does not contain a project() call");
|
|
238770
238872
|
}
|
|
@@ -238777,78 +238879,78 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
238777
238879
|
);
|
|
238778
238880
|
}
|
|
238779
238881
|
if (debug) {
|
|
238780
|
-
console.log(
|
|
238882
|
+
console.log(chalk9.gray(`
|
|
238781
238883
|
\u2713 Project ID verified: ${extractedProjectId}`));
|
|
238782
238884
|
}
|
|
238783
238885
|
} else {
|
|
238784
238886
|
warnings.push("Could not extract project ID from index.ts");
|
|
238785
238887
|
}
|
|
238786
|
-
const agentsDir =
|
|
238888
|
+
const agentsDir = join10(projectDir, "agents");
|
|
238787
238889
|
const expectedAgents = Object.keys(originalProjectData.agents || {});
|
|
238788
238890
|
for (const agentId of expectedAgents) {
|
|
238789
238891
|
const kebabCaseId = agentId.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
238790
|
-
const agentPath =
|
|
238791
|
-
if (!
|
|
238892
|
+
const agentPath = join10(agentsDir, `${kebabCaseId}.ts`);
|
|
238893
|
+
if (!existsSync9(agentPath)) {
|
|
238792
238894
|
errors.push(`Agent file not found: agents/${kebabCaseId}.ts`);
|
|
238793
238895
|
} else if (debug) {
|
|
238794
|
-
console.log(
|
|
238896
|
+
console.log(chalk9.gray(` \u2713 Agent file exists: agents/${kebabCaseId}.ts`));
|
|
238795
238897
|
}
|
|
238796
238898
|
}
|
|
238797
|
-
const toolsDir =
|
|
238899
|
+
const toolsDir = join10(projectDir, "tools");
|
|
238798
238900
|
const expectedTools = Object.keys(originalProjectData.tools || {});
|
|
238799
238901
|
for (const toolId of expectedTools) {
|
|
238800
238902
|
const kebabCaseId = toolId.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
238801
|
-
const toolPath =
|
|
238802
|
-
if (!
|
|
238903
|
+
const toolPath = join10(toolsDir, `${kebabCaseId}.ts`);
|
|
238904
|
+
if (!existsSync9(toolPath)) {
|
|
238803
238905
|
errors.push(`Tool file not found: tools/${kebabCaseId}.ts`);
|
|
238804
238906
|
} else if (debug) {
|
|
238805
|
-
console.log(
|
|
238907
|
+
console.log(chalk9.gray(` \u2713 Tool file exists: tools/${kebabCaseId}.ts`));
|
|
238806
238908
|
}
|
|
238807
238909
|
}
|
|
238808
|
-
const dataComponentsDir =
|
|
238910
|
+
const dataComponentsDir = join10(projectDir, "data-components");
|
|
238809
238911
|
const expectedDataComponents = Object.keys(originalProjectData.dataComponents || {});
|
|
238810
238912
|
for (const componentId of expectedDataComponents) {
|
|
238811
238913
|
const kebabCaseId = componentId.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
238812
|
-
const componentPath =
|
|
238813
|
-
if (!
|
|
238914
|
+
const componentPath = join10(dataComponentsDir, `${kebabCaseId}.ts`);
|
|
238915
|
+
if (!existsSync9(componentPath)) {
|
|
238814
238916
|
errors.push(`Data component file not found: data-components/${kebabCaseId}.ts`);
|
|
238815
238917
|
} else if (debug) {
|
|
238816
238918
|
console.log(
|
|
238817
|
-
|
|
238919
|
+
chalk9.gray(` \u2713 Data component file exists: data-components/${kebabCaseId}.ts`)
|
|
238818
238920
|
);
|
|
238819
238921
|
}
|
|
238820
238922
|
}
|
|
238821
|
-
const environmentsDir =
|
|
238923
|
+
const environmentsDir = join10(projectDir, "environments");
|
|
238822
238924
|
const hasCredentials = Object.keys(originalProjectData.credentialReferences || {}).length > 0;
|
|
238823
|
-
if (!
|
|
238925
|
+
if (!existsSync9(environmentsDir)) {
|
|
238824
238926
|
if (hasCredentials) {
|
|
238825
238927
|
errors.push("Environments directory not found (expected with credentials)");
|
|
238826
238928
|
} else {
|
|
238827
238929
|
warnings.push("Environments directory not found (no credentials defined)");
|
|
238828
238930
|
}
|
|
238829
238931
|
} else {
|
|
238830
|
-
const envIndexPath =
|
|
238831
|
-
if (!
|
|
238932
|
+
const envIndexPath = join10(environmentsDir, "index.ts");
|
|
238933
|
+
if (!existsSync9(envIndexPath)) {
|
|
238832
238934
|
if (hasCredentials) {
|
|
238833
238935
|
errors.push("Environment index.ts not found (expected with credentials)");
|
|
238834
238936
|
} else {
|
|
238835
238937
|
if (debug) {
|
|
238836
|
-
console.log(
|
|
238938
|
+
console.log(chalk9.gray(` \u2022 Environments directory exists but empty (no credentials)`));
|
|
238837
238939
|
}
|
|
238838
238940
|
}
|
|
238839
238941
|
}
|
|
238840
238942
|
}
|
|
238841
238943
|
if (debug) {
|
|
238842
|
-
console.log(
|
|
238843
|
-
console.log(
|
|
238944
|
+
console.log(chalk9.gray("\n\u{1F50D} Verification Summary:"));
|
|
238945
|
+
console.log(chalk9.gray(` \u2022 index.ts: ${existsSync9(indexPath) ? "\u2713" : "\u2717"}`));
|
|
238844
238946
|
console.log(
|
|
238845
|
-
|
|
238947
|
+
chalk9.gray(` \u2022 Agent files: ${expectedAgents.length}/${expectedAgents.length} found`)
|
|
238846
238948
|
);
|
|
238847
238949
|
console.log(
|
|
238848
|
-
|
|
238950
|
+
chalk9.gray(` \u2022 Tool files: ${expectedTools.length}/${expectedTools.length} found`)
|
|
238849
238951
|
);
|
|
238850
238952
|
console.log(
|
|
238851
|
-
|
|
238953
|
+
chalk9.gray(
|
|
238852
238954
|
` \u2022 Data component files: ${expectedDataComponents.length}/${expectedDataComponents.length} found`
|
|
238853
238955
|
)
|
|
238854
238956
|
);
|
|
@@ -238860,8 +238962,8 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
238860
238962
|
}
|
|
238861
238963
|
}
|
|
238862
238964
|
async function loadProjectConfig(projectDir, configPathOverride) {
|
|
238863
|
-
const configPath = configPathOverride ? resolve4(process.cwd(), configPathOverride) :
|
|
238864
|
-
if (!
|
|
238965
|
+
const configPath = configPathOverride ? resolve4(process.cwd(), configPathOverride) : join10(projectDir, "inkeep.config.ts");
|
|
238966
|
+
if (!existsSync9(configPath)) {
|
|
238865
238967
|
throw new Error(`Configuration file not found: ${configPath}`);
|
|
238866
238968
|
}
|
|
238867
238969
|
try {
|
|
@@ -238886,7 +238988,7 @@ async function loadProjectConfig(projectDir, configPathOverride) {
|
|
|
238886
238988
|
}
|
|
238887
238989
|
}
|
|
238888
238990
|
function ensureDirectoryExists(dirPath) {
|
|
238889
|
-
if (!
|
|
238991
|
+
if (!existsSync9(dirPath)) {
|
|
238890
238992
|
mkdirSync2(dirPath, { recursive: true });
|
|
238891
238993
|
}
|
|
238892
238994
|
}
|
|
@@ -238896,14 +238998,14 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
|
|
|
238896
238998
|
projectRoot = projectDir;
|
|
238897
238999
|
} else {
|
|
238898
239000
|
const dirName = projectDir.split("/").pop() || projectDir;
|
|
238899
|
-
projectRoot = dirName === projectId ? projectDir :
|
|
239001
|
+
projectRoot = dirName === projectId ? projectDir : join10(projectDir, projectId);
|
|
238900
239002
|
}
|
|
238901
|
-
const agentsDir =
|
|
238902
|
-
const toolsDir =
|
|
238903
|
-
const dataComponentsDir =
|
|
238904
|
-
const artifactComponentsDir =
|
|
238905
|
-
const statusComponentsDir =
|
|
238906
|
-
const environmentsDir =
|
|
239003
|
+
const agentsDir = join10(projectRoot, "agents");
|
|
239004
|
+
const toolsDir = join10(projectRoot, "tools");
|
|
239005
|
+
const dataComponentsDir = join10(projectRoot, "data-components");
|
|
239006
|
+
const artifactComponentsDir = join10(projectRoot, "artifact-components");
|
|
239007
|
+
const statusComponentsDir = join10(projectRoot, "status-components");
|
|
239008
|
+
const environmentsDir = join10(projectRoot, "environments");
|
|
238907
239009
|
ensureDirectoryExists(projectRoot);
|
|
238908
239010
|
ensureDirectoryExists(agentsDir);
|
|
238909
239011
|
ensureDirectoryExists(toolsDir);
|
|
@@ -238922,13 +239024,25 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
|
|
|
238922
239024
|
};
|
|
238923
239025
|
}
|
|
238924
239026
|
async function pullProjectCommand(options) {
|
|
238925
|
-
|
|
239027
|
+
performBackgroundVersionCheck();
|
|
239028
|
+
const anthropicKey = env2.ANTHROPIC_API_KEY?.trim();
|
|
239029
|
+
if (!anthropicKey) {
|
|
239030
|
+
console.error(
|
|
239031
|
+
chalk9.red("\n\u274C Error: ANTHROPIC_API_KEY is required for the pull command")
|
|
239032
|
+
);
|
|
238926
239033
|
console.error(
|
|
238927
|
-
|
|
239034
|
+
chalk9.yellow(
|
|
239035
|
+
"\nThe pull command uses AI to generate TypeScript files from your project configuration."
|
|
239036
|
+
)
|
|
238928
239037
|
);
|
|
238929
|
-
console.error(
|
|
238930
|
-
console.error(
|
|
238931
|
-
console.error(
|
|
239038
|
+
console.error(chalk9.yellow("This requires a valid Anthropic API key.\n"));
|
|
239039
|
+
console.error(chalk9.cyan("How to fix:"));
|
|
239040
|
+
console.error(chalk9.gray(" 1. Get an API key from: https://console.anthropic.com/"));
|
|
239041
|
+
console.error(chalk9.gray(" 2. Set it in your environment:"));
|
|
239042
|
+
console.error(chalk9.gray(" export ANTHROPIC_API_KEY=your_api_key_here"));
|
|
239043
|
+
console.error(chalk9.gray(" 3. Or add it to your .env file:"));
|
|
239044
|
+
console.error(chalk9.gray(" ANTHROPIC_API_KEY=your_api_key_here\n"));
|
|
239045
|
+
console.error(chalk9.yellow("\u{1F4A1} Note: Make sure the value is not empty or whitespace-only"));
|
|
238932
239046
|
process.exit(1);
|
|
238933
239047
|
}
|
|
238934
239048
|
const spinner = ora5("Loading configuration...").start();
|
|
@@ -238939,15 +239053,15 @@ async function pullProjectCommand(options) {
|
|
|
238939
239053
|
const searchDir = process.cwd();
|
|
238940
239054
|
if (options.config) {
|
|
238941
239055
|
const configPath = resolve4(process.cwd(), options.config);
|
|
238942
|
-
if (
|
|
239056
|
+
if (existsSync9(configPath)) {
|
|
238943
239057
|
try {
|
|
238944
|
-
config = await loadProjectConfig(
|
|
239058
|
+
config = await loadProjectConfig(dirname5(configPath), options.config);
|
|
238945
239059
|
configFound = true;
|
|
238946
239060
|
configLocation = configPath;
|
|
238947
239061
|
} catch (error) {
|
|
238948
239062
|
spinner.fail("Failed to load specified configuration file");
|
|
238949
239063
|
console.error(
|
|
238950
|
-
|
|
239064
|
+
chalk9.red(`Error: ${error instanceof Error ? error.message : String(error)}`)
|
|
238951
239065
|
);
|
|
238952
239066
|
process.exit(1);
|
|
238953
239067
|
}
|
|
@@ -238957,8 +239071,8 @@ async function pullProjectCommand(options) {
|
|
|
238957
239071
|
}
|
|
238958
239072
|
}
|
|
238959
239073
|
if (!configFound) {
|
|
238960
|
-
const currentConfigPath =
|
|
238961
|
-
if (
|
|
239074
|
+
const currentConfigPath = join10(searchDir, "inkeep.config.ts");
|
|
239075
|
+
if (existsSync9(currentConfigPath)) {
|
|
238962
239076
|
try {
|
|
238963
239077
|
config = await loadProjectConfig(searchDir);
|
|
238964
239078
|
configFound = true;
|
|
@@ -238968,10 +239082,10 @@ async function pullProjectCommand(options) {
|
|
|
238968
239082
|
}
|
|
238969
239083
|
}
|
|
238970
239084
|
if (!configFound) {
|
|
238971
|
-
const parentConfigPath =
|
|
238972
|
-
if (
|
|
239085
|
+
const parentConfigPath = join10(searchDir, "..", "inkeep.config.ts");
|
|
239086
|
+
if (existsSync9(parentConfigPath)) {
|
|
238973
239087
|
try {
|
|
238974
|
-
config = await loadProjectConfig(
|
|
239088
|
+
config = await loadProjectConfig(join10(searchDir, ".."));
|
|
238975
239089
|
configFound = true;
|
|
238976
239090
|
configLocation = parentConfigPath;
|
|
238977
239091
|
} catch (_error) {
|
|
@@ -238984,7 +239098,7 @@ async function pullProjectCommand(options) {
|
|
|
238984
239098
|
const foundConfigPath = await findUp2("inkeep.config.ts", { cwd: searchDir });
|
|
238985
239099
|
if (foundConfigPath) {
|
|
238986
239100
|
try {
|
|
238987
|
-
config = await loadProjectConfig(
|
|
239101
|
+
config = await loadProjectConfig(dirname5(foundConfigPath));
|
|
238988
239102
|
configFound = true;
|
|
238989
239103
|
configLocation = foundConfigPath;
|
|
238990
239104
|
} catch (_error) {
|
|
@@ -238995,14 +239109,14 @@ async function pullProjectCommand(options) {
|
|
|
238995
239109
|
}
|
|
238996
239110
|
if (!configFound || !config) {
|
|
238997
239111
|
spinner.fail("No inkeep.config.ts found");
|
|
238998
|
-
console.error(
|
|
239112
|
+
console.error(chalk9.red("Configuration file is required for pull command"));
|
|
238999
239113
|
console.log(
|
|
239000
|
-
|
|
239114
|
+
chalk9.yellow("Please create an inkeep.config.ts file with your tenantId and API settings")
|
|
239001
239115
|
);
|
|
239002
|
-
console.log(
|
|
239003
|
-
console.log(
|
|
239004
|
-
console.log(
|
|
239005
|
-
console.log(
|
|
239116
|
+
console.log(chalk9.gray("Searched in:"));
|
|
239117
|
+
console.log(chalk9.gray(` \u2022 Current directory: ${searchDir}`));
|
|
239118
|
+
console.log(chalk9.gray(` \u2022 Parent directory: ${join10(searchDir, "..")}`));
|
|
239119
|
+
console.log(chalk9.gray(` \u2022 Parent directories up to root`));
|
|
239006
239120
|
process.exit(1);
|
|
239007
239121
|
}
|
|
239008
239122
|
spinner.succeed(`Configuration loaded from ${configLocation}`);
|
|
@@ -239015,8 +239129,8 @@ async function pullProjectCommand(options) {
|
|
|
239015
239129
|
} else {
|
|
239016
239130
|
const projectRoot = await findProjectDirectory();
|
|
239017
239131
|
if (projectRoot) {
|
|
239018
|
-
const srcPath =
|
|
239019
|
-
baseDir =
|
|
239132
|
+
const srcPath = join10(projectRoot, "src");
|
|
239133
|
+
baseDir = existsSync9(srcPath) ? srcPath : projectRoot;
|
|
239020
239134
|
} else {
|
|
239021
239135
|
baseDir = process.cwd();
|
|
239022
239136
|
}
|
|
@@ -239036,14 +239150,14 @@ async function pullProjectCommand(options) {
|
|
|
239036
239150
|
if (currentProjectId) {
|
|
239037
239151
|
spinner.fail("Conflicting project specification");
|
|
239038
239152
|
console.error(
|
|
239039
|
-
|
|
239153
|
+
chalk9.red("Error: Cannot specify --project argument when in a project directory")
|
|
239040
239154
|
);
|
|
239041
|
-
console.error(
|
|
239042
|
-
console.error(
|
|
239043
|
-
console.error(
|
|
239044
|
-
console.error(
|
|
239155
|
+
console.error(chalk9.yellow(` \u2022 Current directory project: ${currentProjectId}`));
|
|
239156
|
+
console.error(chalk9.yellow(` \u2022 Specified project argument: ${options.project}`));
|
|
239157
|
+
console.error(chalk9.gray("\nTo pull to this directory, run without --project argument:"));
|
|
239158
|
+
console.error(chalk9.gray(" inkeep pull"));
|
|
239045
239159
|
console.error(
|
|
239046
|
-
|
|
239160
|
+
chalk9.gray("\nTo pull a different project, run from a non-project directory.")
|
|
239047
239161
|
);
|
|
239048
239162
|
process.exit(1);
|
|
239049
239163
|
}
|
|
@@ -239054,7 +239168,7 @@ async function pullProjectCommand(options) {
|
|
|
239054
239168
|
useCurrentDirectory = true;
|
|
239055
239169
|
baseDir = process.cwd();
|
|
239056
239170
|
spinner.succeed(`Detected project in current directory: ${currentProjectId}`);
|
|
239057
|
-
console.log(
|
|
239171
|
+
console.log(chalk9.gray(` \u2022 Will pull to current directory (directory-aware mode)`));
|
|
239058
239172
|
} else {
|
|
239059
239173
|
spinner.stop();
|
|
239060
239174
|
const response = await prompts({
|
|
@@ -239064,17 +239178,17 @@ async function pullProjectCommand(options) {
|
|
|
239064
239178
|
validate: (value) => value ? true : "Project ID is required"
|
|
239065
239179
|
});
|
|
239066
239180
|
if (!response.projectId) {
|
|
239067
|
-
console.error(
|
|
239181
|
+
console.error(chalk9.red("Project ID is required"));
|
|
239068
239182
|
process.exit(1);
|
|
239069
239183
|
}
|
|
239070
239184
|
finalConfig.projectId = response.projectId;
|
|
239071
239185
|
spinner.start("Configuration loaded");
|
|
239072
239186
|
}
|
|
239073
239187
|
spinner.succeed("Configuration loaded");
|
|
239074
|
-
console.log(
|
|
239075
|
-
console.log(
|
|
239076
|
-
console.log(
|
|
239077
|
-
console.log(
|
|
239188
|
+
console.log(chalk9.gray("Configuration:"));
|
|
239189
|
+
console.log(chalk9.gray(` \u2022 Tenant ID: ${finalConfig.tenantId}`));
|
|
239190
|
+
console.log(chalk9.gray(` \u2022 Project ID: ${finalConfig.projectId}`));
|
|
239191
|
+
console.log(chalk9.gray(` \u2022 API URL: ${finalConfig.agentsManageApiUrl}`));
|
|
239078
239192
|
spinner.start("Fetching project data from backend...");
|
|
239079
239193
|
const apiClient = await ManagementApiClient.create(
|
|
239080
239194
|
finalConfig.agentsManageApiUrl,
|
|
@@ -239099,30 +239213,30 @@ async function pullProjectCommand(options) {
|
|
|
239099
239213
|
const statusComponents = agentObj.statusUpdates?.statusComponents || [];
|
|
239100
239214
|
return total + statusComponents.length;
|
|
239101
239215
|
}, 0);
|
|
239102
|
-
console.log(
|
|
239103
|
-
console.log(
|
|
239104
|
-
console.log(
|
|
239105
|
-
console.log(
|
|
239106
|
-
console.log(
|
|
239107
|
-
console.log(
|
|
239216
|
+
console.log(chalk9.cyan("\n\u{1F4CA} Project Summary:"));
|
|
239217
|
+
console.log(chalk9.gray(` \u2022 Name: ${projectData.name}`));
|
|
239218
|
+
console.log(chalk9.gray(` \u2022 Description: ${projectData.description || "No description"}`));
|
|
239219
|
+
console.log(chalk9.gray(` \u2022 Agents: ${agentCount}`));
|
|
239220
|
+
console.log(chalk9.gray(` \u2022 Tools: ${toolCount}`));
|
|
239221
|
+
console.log(chalk9.gray(` \u2022 SubAgents: ${subAgentCount}`));
|
|
239108
239222
|
if (dataComponentCount > 0) {
|
|
239109
|
-
console.log(
|
|
239223
|
+
console.log(chalk9.gray(` \u2022 Data Components: ${dataComponentCount}`));
|
|
239110
239224
|
}
|
|
239111
239225
|
if (artifactComponentCount > 0) {
|
|
239112
|
-
console.log(
|
|
239226
|
+
console.log(chalk9.gray(` \u2022 Artifact Components: ${artifactComponentCount}`));
|
|
239113
239227
|
}
|
|
239114
239228
|
if (statusComponentCount > 0) {
|
|
239115
|
-
console.log(
|
|
239229
|
+
console.log(chalk9.gray(` \u2022 Status Components: ${statusComponentCount}`));
|
|
239116
239230
|
}
|
|
239117
239231
|
const credentialReferences2 = projectData.credentialReferences || {};
|
|
239118
239232
|
const credentialCount = Object.keys(credentialReferences2).length;
|
|
239119
239233
|
if (credentialCount > 0) {
|
|
239120
|
-
console.log(
|
|
239121
|
-
console.log(
|
|
239234
|
+
console.log(chalk9.cyan("\n\u{1F510} Credentials Found:"));
|
|
239235
|
+
console.log(chalk9.gray(` \u2022 Total credentials: ${credentialCount}`));
|
|
239122
239236
|
for (const [credId, credData] of Object.entries(credentialReferences2)) {
|
|
239123
239237
|
const credType = credData.type || "unknown";
|
|
239124
239238
|
const storeId = credData.credentialStoreId || "unknown";
|
|
239125
|
-
console.log(
|
|
239239
|
+
console.log(chalk9.gray(` \u2022 ${credId} (${credType}, store: ${storeId})`));
|
|
239126
239240
|
const usageInfo = credData.usedBy;
|
|
239127
239241
|
if (usageInfo && Array.isArray(usageInfo) && usageInfo.length > 0) {
|
|
239128
239242
|
const usageByType = {};
|
|
@@ -239130,11 +239244,11 @@ async function pullProjectCommand(options) {
|
|
|
239130
239244
|
usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
|
|
239131
239245
|
}
|
|
239132
239246
|
const usageSummary = Object.entries(usageByType).map(([type, count16]) => `${count16} ${type}${count16 > 1 ? "s" : ""}`).join(", ");
|
|
239133
|
-
console.log(
|
|
239247
|
+
console.log(chalk9.gray(` Used by: ${usageSummary}`));
|
|
239134
239248
|
}
|
|
239135
239249
|
}
|
|
239136
239250
|
console.log(
|
|
239137
|
-
|
|
239251
|
+
chalk9.yellow(
|
|
239138
239252
|
` \u26A0\uFE0F Environment file (${options.env || "development"}.env.ts) will be generated with credential references`
|
|
239139
239253
|
)
|
|
239140
239254
|
);
|
|
@@ -239143,10 +239257,10 @@ async function pullProjectCommand(options) {
|
|
|
239143
239257
|
const dirs = createProjectStructure(baseDir, finalConfig.projectId, useCurrentDirectory);
|
|
239144
239258
|
spinner.succeed("Project structure created");
|
|
239145
239259
|
if (options.json) {
|
|
239146
|
-
const jsonFilePath =
|
|
239260
|
+
const jsonFilePath = join10(dirs.projectRoot, `${finalConfig.projectId}.json`);
|
|
239147
239261
|
writeFileSync6(jsonFilePath, JSON.stringify(projectData, null, 2));
|
|
239148
239262
|
spinner.succeed(`Project data saved to ${jsonFilePath}`);
|
|
239149
|
-
console.log(
|
|
239263
|
+
console.log(chalk9.green(`\u2705 JSON file created: ${jsonFilePath}`));
|
|
239150
239264
|
}
|
|
239151
239265
|
spinner.start("Analyzing existing code patterns...");
|
|
239152
239266
|
const { analyzeExistingPatterns: analyzeExistingPatterns2 } = await Promise.resolve().then(() => (init_pattern_analyzer(), pattern_analyzer_exports));
|
|
@@ -239191,7 +239305,7 @@ async function pullProjectCommand(options) {
|
|
|
239191
239305
|
const { generatePlan: generatePlan2 } = await Promise.resolve().then(() => (init_plan_builder(), plan_builder_exports));
|
|
239192
239306
|
const { createModel: createModel2 } = await Promise.resolve().then(() => (init_pull_llm_generate(), pull_llm_generate_exports));
|
|
239193
239307
|
const modelSettings = {
|
|
239194
|
-
model: ANTHROPIC_MODELS.
|
|
239308
|
+
model: ANTHROPIC_MODELS.CLAUDE_SONNET_4_5
|
|
239195
239309
|
};
|
|
239196
239310
|
const plan = await generatePlan2(projectData, patterns, modelSettings, createModel2);
|
|
239197
239311
|
spinner.succeed("Generation plan created");
|
|
@@ -239210,7 +239324,7 @@ async function pullProjectCommand(options) {
|
|
|
239210
239324
|
savePlan2(dirs.projectRoot, plan);
|
|
239211
239325
|
ensureGitignore2(dirs.projectRoot);
|
|
239212
239326
|
if (options.debug) {
|
|
239213
|
-
console.log(
|
|
239327
|
+
console.log(chalk9.gray("\n\u{1F4CD} Plan saved to .inkeep/generation-plan.json"));
|
|
239214
239328
|
}
|
|
239215
239329
|
const statusComponentsCount = Object.values(projectData.agents || {}).reduce((total, agent) => {
|
|
239216
239330
|
const agentObj = agent;
|
|
@@ -239236,86 +239350,86 @@ async function pullProjectCommand(options) {
|
|
|
239236
239350
|
if (verificationResult.success) {
|
|
239237
239351
|
spinner.succeed("Generated files verified successfully");
|
|
239238
239352
|
if (options.debug && verificationResult.warnings.length > 0) {
|
|
239239
|
-
console.log(
|
|
239353
|
+
console.log(chalk9.yellow("\n\u26A0\uFE0F Verification warnings:"));
|
|
239240
239354
|
verificationResult.warnings.forEach((warning) => {
|
|
239241
|
-
console.log(
|
|
239355
|
+
console.log(chalk9.gray(` \u2022 ${warning}`));
|
|
239242
239356
|
});
|
|
239243
239357
|
}
|
|
239244
239358
|
} else {
|
|
239245
239359
|
spinner.fail("Generated files verification failed");
|
|
239246
|
-
console.error(
|
|
239360
|
+
console.error(chalk9.red("\n\u274C Verification errors:"));
|
|
239247
239361
|
verificationResult.errors.forEach((error) => {
|
|
239248
|
-
console.error(
|
|
239362
|
+
console.error(chalk9.red(` \u2022 ${error}`));
|
|
239249
239363
|
});
|
|
239250
239364
|
if (verificationResult.warnings.length > 0) {
|
|
239251
|
-
console.log(
|
|
239365
|
+
console.log(chalk9.yellow("\n\u26A0\uFE0F Verification warnings:"));
|
|
239252
239366
|
verificationResult.warnings.forEach((warning) => {
|
|
239253
|
-
console.log(
|
|
239367
|
+
console.log(chalk9.gray(` \u2022 ${warning}`));
|
|
239254
239368
|
});
|
|
239255
239369
|
}
|
|
239256
239370
|
console.log(
|
|
239257
|
-
|
|
239371
|
+
chalk9.gray("\nThe generated files may not accurately represent the pulled project.")
|
|
239258
239372
|
);
|
|
239259
239373
|
console.log(
|
|
239260
|
-
|
|
239374
|
+
chalk9.gray("This could indicate an issue with the LLM generation or schema mappings.")
|
|
239261
239375
|
);
|
|
239262
239376
|
}
|
|
239263
239377
|
} catch (error) {
|
|
239264
239378
|
spinner.fail("Verification failed");
|
|
239265
|
-
console.error(
|
|
239266
|
-
console.log(
|
|
239379
|
+
console.error(chalk9.red("Verification error:"), error.message);
|
|
239380
|
+
console.log(chalk9.gray("Proceeding without verification..."));
|
|
239267
239381
|
}
|
|
239268
|
-
console.log(
|
|
239269
|
-
console.log(
|
|
239270
|
-
console.log(
|
|
239271
|
-
console.log(
|
|
239382
|
+
console.log(chalk9.green("\n\u2728 Project pulled successfully!"));
|
|
239383
|
+
console.log(chalk9.cyan("\n\u{1F4C1} Generated structure:"));
|
|
239384
|
+
console.log(chalk9.gray(` ${dirs.projectRoot}/`));
|
|
239385
|
+
console.log(chalk9.gray(` \u251C\u2500\u2500 index.ts`));
|
|
239272
239386
|
if (fileCount.agents > 0) {
|
|
239273
|
-
console.log(
|
|
239387
|
+
console.log(chalk9.gray(` \u251C\u2500\u2500 agents/ (${fileCount.agents} files)`));
|
|
239274
239388
|
}
|
|
239275
239389
|
if (fileCount.tools > 0) {
|
|
239276
|
-
console.log(
|
|
239390
|
+
console.log(chalk9.gray(` \u251C\u2500\u2500 tools/ (${fileCount.tools} files)`));
|
|
239277
239391
|
}
|
|
239278
239392
|
if (fileCount.dataComponents > 0) {
|
|
239279
|
-
console.log(
|
|
239393
|
+
console.log(chalk9.gray(` \u251C\u2500\u2500 data-components/ (${fileCount.dataComponents} files)`));
|
|
239280
239394
|
}
|
|
239281
239395
|
if (fileCount.artifactComponents > 0) {
|
|
239282
|
-
console.log(
|
|
239396
|
+
console.log(chalk9.gray(` \u251C\u2500\u2500 artifact-components/ (${fileCount.artifactComponents} files)`));
|
|
239283
239397
|
}
|
|
239284
239398
|
if (fileCount.statusComponents > 0) {
|
|
239285
|
-
console.log(
|
|
239399
|
+
console.log(chalk9.gray(` \u251C\u2500\u2500 status-components/ (${fileCount.statusComponents} files)`));
|
|
239286
239400
|
}
|
|
239287
|
-
console.log(
|
|
239288
|
-
console.log(
|
|
239289
|
-
console.log(
|
|
239290
|
-
console.log(
|
|
239291
|
-
console.log(
|
|
239401
|
+
console.log(chalk9.gray(" \u2514\u2500\u2500 environments/ (4 files)"));
|
|
239402
|
+
console.log(chalk9.cyan("\n\u{1F4DD} Next steps:"));
|
|
239403
|
+
console.log(chalk9.gray(` \u2022 cd ${dirs.projectRoot}`));
|
|
239404
|
+
console.log(chalk9.gray(" \u2022 Review the generated files"));
|
|
239405
|
+
console.log(chalk9.gray(" \u2022 Test locally: inkeep push"));
|
|
239292
239406
|
console.log(
|
|
239293
|
-
|
|
239407
|
+
chalk9.gray(' \u2022 Commit changes: git add . && git commit -m "Add project from pull"')
|
|
239294
239408
|
);
|
|
239295
239409
|
} catch (error) {
|
|
239296
239410
|
spinner.fail("Failed to pull project");
|
|
239297
|
-
console.error(
|
|
239411
|
+
console.error(chalk9.red("Error:"), error.message);
|
|
239298
239412
|
process.exit(1);
|
|
239299
239413
|
}
|
|
239300
239414
|
}
|
|
239301
239415
|
|
|
239302
239416
|
// src/commands/push.ts
|
|
239303
239417
|
init_esm_shims();
|
|
239304
|
-
import { existsSync as
|
|
239305
|
-
import { join as
|
|
239306
|
-
import
|
|
239418
|
+
import { existsSync as existsSync11 } from "fs";
|
|
239419
|
+
import { join as join12, resolve as resolve5 } from "path";
|
|
239420
|
+
import chalk10 from "chalk";
|
|
239307
239421
|
import ora6 from "ora";
|
|
239308
239422
|
init_cli_pipeline();
|
|
239309
239423
|
|
|
239310
239424
|
// src/utils/environment-loader.ts
|
|
239311
239425
|
init_esm_shims();
|
|
239312
239426
|
init_tsx_loader();
|
|
239313
|
-
import { existsSync as
|
|
239314
|
-
import { join as
|
|
239427
|
+
import { existsSync as existsSync10 } from "fs";
|
|
239428
|
+
import { join as join11 } from "path";
|
|
239315
239429
|
async function loadEnvironmentCredentials(projectDir, env3) {
|
|
239316
|
-
const environmentsDir =
|
|
239317
|
-
const envFilePath =
|
|
239318
|
-
if (!
|
|
239430
|
+
const environmentsDir = join11(projectDir, "environments");
|
|
239431
|
+
const envFilePath = join11(environmentsDir, `${env3}.env.ts`);
|
|
239432
|
+
if (!existsSync10(envFilePath)) {
|
|
239319
239433
|
throw new Error(
|
|
239320
239434
|
`Environment file not found: ${envFilePath}
|
|
239321
239435
|
Make sure you have a ${env3}.env.ts file in the environments directory.`
|
|
@@ -239343,8 +239457,8 @@ Make sure you have a ${env3}.env.ts file in the environments directory.`
|
|
|
239343
239457
|
// src/commands/push.ts
|
|
239344
239458
|
init_tsx_loader();
|
|
239345
239459
|
async function loadProject(projectDir) {
|
|
239346
|
-
const indexPath =
|
|
239347
|
-
if (!
|
|
239460
|
+
const indexPath = join12(projectDir, "index.ts");
|
|
239461
|
+
if (!existsSync11(indexPath)) {
|
|
239348
239462
|
throw new Error(`index.ts not found in project directory: ${projectDir}`);
|
|
239349
239463
|
}
|
|
239350
239464
|
const module = await importWithTypeScriptSupport(indexPath);
|
|
@@ -239360,6 +239474,7 @@ async function loadProject(projectDir) {
|
|
|
239360
239474
|
);
|
|
239361
239475
|
}
|
|
239362
239476
|
async function pushCommand(options) {
|
|
239477
|
+
performBackgroundVersionCheck();
|
|
239363
239478
|
const { config } = await initializeCommand({
|
|
239364
239479
|
configPath: options.config,
|
|
239365
239480
|
showSpinner: true,
|
|
@@ -239372,18 +239487,18 @@ async function pushCommand(options) {
|
|
|
239372
239487
|
let projectDir;
|
|
239373
239488
|
if (options.project) {
|
|
239374
239489
|
projectDir = resolve5(process.cwd(), options.project);
|
|
239375
|
-
if (!
|
|
239490
|
+
if (!existsSync11(join12(projectDir, "index.ts"))) {
|
|
239376
239491
|
spinner.fail(`No index.ts found in specified project directory: ${projectDir}`);
|
|
239377
239492
|
process.exit(1);
|
|
239378
239493
|
}
|
|
239379
239494
|
} else {
|
|
239380
239495
|
const currentDir = process.cwd();
|
|
239381
|
-
if (
|
|
239496
|
+
if (existsSync11(join12(currentDir, "index.ts"))) {
|
|
239382
239497
|
projectDir = currentDir;
|
|
239383
239498
|
} else {
|
|
239384
239499
|
spinner.fail("No index.ts found in current directory");
|
|
239385
239500
|
console.error(
|
|
239386
|
-
|
|
239501
|
+
chalk10.yellow(
|
|
239387
239502
|
"Please run this command from a directory containing index.ts or use --project <path>"
|
|
239388
239503
|
)
|
|
239389
239504
|
);
|
|
@@ -239427,11 +239542,11 @@ async function pushCommand(options) {
|
|
|
239427
239542
|
const credentials = await loadEnvironmentCredentials(projectDir, options.env);
|
|
239428
239543
|
project.setCredentials(credentials);
|
|
239429
239544
|
spinner.text = "Project loaded with credentials";
|
|
239430
|
-
console.log(
|
|
239431
|
-
console.log(
|
|
239545
|
+
console.log(chalk10.gray(` \u2022 Environment: ${options.env}`));
|
|
239546
|
+
console.log(chalk10.gray(` \u2022 Credentials loaded: ${Object.keys(credentials).length}`));
|
|
239432
239547
|
} catch (error) {
|
|
239433
239548
|
spinner.fail("Failed to load environment credentials");
|
|
239434
|
-
console.error(
|
|
239549
|
+
console.error(chalk10.red("Error:"), error.message);
|
|
239435
239550
|
process.exit(1);
|
|
239436
239551
|
}
|
|
239437
239552
|
}
|
|
@@ -239439,12 +239554,12 @@ async function pushCommand(options) {
|
|
|
239439
239554
|
spinner.text = "Generating project data JSON...";
|
|
239440
239555
|
try {
|
|
239441
239556
|
const projectDefinition = await project.getFullDefinition();
|
|
239442
|
-
const jsonFilePath =
|
|
239557
|
+
const jsonFilePath = join12(projectDir, `project.json`);
|
|
239443
239558
|
const fs5 = await import("fs/promises");
|
|
239444
239559
|
await fs5.writeFile(jsonFilePath, JSON.stringify(projectDefinition, null, 2));
|
|
239445
239560
|
spinner.succeed(`Project data saved to ${jsonFilePath}`);
|
|
239446
|
-
console.log(
|
|
239447
|
-
console.log(
|
|
239561
|
+
console.log(chalk10.gray(` \u2022 File: ${jsonFilePath}`));
|
|
239562
|
+
console.log(chalk10.gray(` \u2022 Size: ${JSON.stringify(projectDefinition).length} bytes`));
|
|
239448
239563
|
const agentCount = Object.keys(projectDefinition.agents || {}).length;
|
|
239449
239564
|
const toolCount = Object.keys(projectDefinition.tools || {}).length;
|
|
239450
239565
|
const subAgentCount = Object.values(projectDefinition.agents || {}).reduce(
|
|
@@ -239453,15 +239568,15 @@ async function pushCommand(options) {
|
|
|
239453
239568
|
},
|
|
239454
239569
|
0
|
|
239455
239570
|
);
|
|
239456
|
-
console.log(
|
|
239457
|
-
console.log(
|
|
239458
|
-
console.log(
|
|
239459
|
-
console.log(
|
|
239460
|
-
console.log(
|
|
239571
|
+
console.log(chalk10.cyan("\n\u{1F4CA} Project Data Summary:"));
|
|
239572
|
+
console.log(chalk10.gray(` \u2022 Agent: ${agentCount}`));
|
|
239573
|
+
console.log(chalk10.gray(` \u2022 Tools: ${toolCount}`));
|
|
239574
|
+
console.log(chalk10.gray(` \u2022 SubAgent: ${subAgentCount}`));
|
|
239575
|
+
console.log(chalk10.green("\n\u2728 JSON file generated successfully!"));
|
|
239461
239576
|
process.exit(0);
|
|
239462
239577
|
} catch (error) {
|
|
239463
239578
|
spinner.fail("Failed to generate JSON file");
|
|
239464
|
-
console.error(
|
|
239579
|
+
console.error(chalk10.red("Error:"), error.message);
|
|
239465
239580
|
process.exit(1);
|
|
239466
239581
|
}
|
|
239467
239582
|
}
|
|
@@ -239471,18 +239586,18 @@ async function pushCommand(options) {
|
|
|
239471
239586
|
const projectName = project.getName();
|
|
239472
239587
|
const stats = project.getStats();
|
|
239473
239588
|
spinner.succeed(`Project "${projectName}" (${projectId}) pushed successfully`);
|
|
239474
|
-
console.log(
|
|
239475
|
-
console.log(
|
|
239476
|
-
console.log(
|
|
239477
|
-
console.log(
|
|
239478
|
-
console.log(
|
|
239589
|
+
console.log(chalk10.cyan("\n\u{1F4CA} Project Summary:"));
|
|
239590
|
+
console.log(chalk10.gray(` \u2022 Project ID: ${projectId}`));
|
|
239591
|
+
console.log(chalk10.gray(` \u2022 Name: ${projectName}`));
|
|
239592
|
+
console.log(chalk10.gray(` \u2022 Agent: ${stats.agentCount}`));
|
|
239593
|
+
console.log(chalk10.gray(` \u2022 Tenant: ${stats.tenantId}`));
|
|
239479
239594
|
const agents2 = project.getAgents();
|
|
239480
239595
|
if (agents2.length > 0) {
|
|
239481
|
-
console.log(
|
|
239596
|
+
console.log(chalk10.cyan("\n\u{1F4CA} Agent Details:"));
|
|
239482
239597
|
for (const agent of agents2) {
|
|
239483
239598
|
const agentStats = agent.getStats();
|
|
239484
239599
|
console.log(
|
|
239485
|
-
|
|
239600
|
+
chalk10.gray(` \u2022 ${agent.getName()} (${agent.getId()}): ${agentStats.agentCount} agents`)
|
|
239486
239601
|
);
|
|
239487
239602
|
}
|
|
239488
239603
|
}
|
|
@@ -239490,50 +239605,195 @@ async function pushCommand(options) {
|
|
|
239490
239605
|
const credentialTracking = await project.getCredentialTracking();
|
|
239491
239606
|
const credentialCount = Object.keys(credentialTracking.credentials).length;
|
|
239492
239607
|
if (credentialCount > 0) {
|
|
239493
|
-
console.log(
|
|
239494
|
-
console.log(
|
|
239608
|
+
console.log(chalk10.cyan("\n\u{1F510} Credentials:"));
|
|
239609
|
+
console.log(chalk10.gray(` \u2022 Total credentials: ${credentialCount}`));
|
|
239495
239610
|
for (const [credId, credData] of Object.entries(credentialTracking.credentials)) {
|
|
239496
239611
|
const usageInfo = credentialTracking.usage[credId] || [];
|
|
239497
239612
|
const credType = credData.type || "unknown";
|
|
239498
239613
|
const storeId = credData.credentialStoreId || "unknown";
|
|
239499
|
-
console.log(
|
|
239614
|
+
console.log(chalk10.gray(` \u2022 ${credId} (${credType}, store: ${storeId})`));
|
|
239500
239615
|
if (usageInfo.length > 0) {
|
|
239501
239616
|
const usageByType = {};
|
|
239502
239617
|
for (const usage of usageInfo) {
|
|
239503
239618
|
usageByType[usage.type] = (usageByType[usage.type] || 0) + 1;
|
|
239504
239619
|
}
|
|
239505
239620
|
const usageSummary = Object.entries(usageByType).map(([type, count16]) => `${count16} ${type}${count16 > 1 ? "s" : ""}`).join(", ");
|
|
239506
|
-
console.log(
|
|
239621
|
+
console.log(chalk10.gray(` Used by: ${usageSummary}`));
|
|
239507
239622
|
}
|
|
239508
239623
|
}
|
|
239509
239624
|
}
|
|
239510
239625
|
} catch (_error) {
|
|
239511
239626
|
if (env2.DEBUG) {
|
|
239512
|
-
console.error(
|
|
239627
|
+
console.error(chalk10.yellow("Could not retrieve credential tracking information"));
|
|
239513
239628
|
}
|
|
239514
239629
|
}
|
|
239515
|
-
console.log(
|
|
239516
|
-
console.log(
|
|
239517
|
-
console.log(
|
|
239630
|
+
console.log(chalk10.green("\n\u2728 Next steps:"));
|
|
239631
|
+
console.log(chalk10.gray(` \u2022 Test your project: inkeep chat`));
|
|
239632
|
+
console.log(chalk10.gray(` \u2022 View all agent: inkeep list-agent`));
|
|
239518
239633
|
process.exit(0);
|
|
239519
239634
|
} catch (_error) {
|
|
239520
239635
|
if (spinner) {
|
|
239521
239636
|
spinner.fail("Failed to push project");
|
|
239522
239637
|
}
|
|
239523
239638
|
const error = _error;
|
|
239524
|
-
console.error(
|
|
239639
|
+
console.error(chalk10.red("Error:"), error.message);
|
|
239525
239640
|
if (error.stack && env2.DEBUG) {
|
|
239526
|
-
console.error(
|
|
239641
|
+
console.error(chalk10.gray(error.stack));
|
|
239642
|
+
}
|
|
239643
|
+
process.exit(1);
|
|
239644
|
+
}
|
|
239645
|
+
}
|
|
239646
|
+
|
|
239647
|
+
// src/commands/update.ts
|
|
239648
|
+
init_esm_shims();
|
|
239649
|
+
import chalk11 from "chalk";
|
|
239650
|
+
import ora7 from "ora";
|
|
239651
|
+
import prompts2 from "prompts";
|
|
239652
|
+
|
|
239653
|
+
// src/utils/package-manager.ts
|
|
239654
|
+
init_esm_shims();
|
|
239655
|
+
import { exec } from "child_process";
|
|
239656
|
+
import { promisify as promisify2 } from "util";
|
|
239657
|
+
var execAsync = promisify2(exec);
|
|
239658
|
+
async function detectPackageManager() {
|
|
239659
|
+
const managers = ["pnpm", "bun", "npm", "yarn"];
|
|
239660
|
+
for (const manager of managers) {
|
|
239661
|
+
try {
|
|
239662
|
+
if (manager === "npm") {
|
|
239663
|
+
const { stdout } = await execAsync(`npm list -g ${DEFAULT_PACKAGE_NAME} --depth=0`);
|
|
239664
|
+
if (stdout.includes(DEFAULT_PACKAGE_NAME)) {
|
|
239665
|
+
return "npm";
|
|
239666
|
+
}
|
|
239667
|
+
} else if (manager === "pnpm") {
|
|
239668
|
+
const { stdout } = await execAsync(`pnpm list -g ${DEFAULT_PACKAGE_NAME} --depth=0`);
|
|
239669
|
+
if (stdout.includes(DEFAULT_PACKAGE_NAME)) {
|
|
239670
|
+
return "pnpm";
|
|
239671
|
+
}
|
|
239672
|
+
} else if (manager === "bun") {
|
|
239673
|
+
const { stdout } = await execAsync("bun pm ls -g");
|
|
239674
|
+
if (stdout.includes(DEFAULT_PACKAGE_NAME)) {
|
|
239675
|
+
return "bun";
|
|
239676
|
+
}
|
|
239677
|
+
} else if (manager === "yarn") {
|
|
239678
|
+
const { stdout } = await execAsync("yarn global list");
|
|
239679
|
+
if (stdout.includes(DEFAULT_PACKAGE_NAME)) {
|
|
239680
|
+
return "yarn";
|
|
239681
|
+
}
|
|
239682
|
+
}
|
|
239683
|
+
} catch {
|
|
239684
|
+
}
|
|
239685
|
+
}
|
|
239686
|
+
return null;
|
|
239687
|
+
}
|
|
239688
|
+
function getUpdateCommand(manager, packageName = DEFAULT_PACKAGE_NAME) {
|
|
239689
|
+
switch (manager) {
|
|
239690
|
+
case "npm":
|
|
239691
|
+
return `npm install -g ${packageName}@latest`;
|
|
239692
|
+
case "pnpm":
|
|
239693
|
+
return `pnpm add -g ${packageName}@latest`;
|
|
239694
|
+
case "bun":
|
|
239695
|
+
return `bun add -g ${packageName}@latest`;
|
|
239696
|
+
case "yarn":
|
|
239697
|
+
return `yarn global add ${packageName}@latest`;
|
|
239698
|
+
}
|
|
239699
|
+
}
|
|
239700
|
+
async function executeUpdate(manager) {
|
|
239701
|
+
const allowedManagers = ["npm", "pnpm", "bun", "yarn"];
|
|
239702
|
+
if (!allowedManagers.includes(manager)) {
|
|
239703
|
+
throw new Error(`Unsupported package manager: ${manager}`);
|
|
239704
|
+
}
|
|
239705
|
+
const command = getUpdateCommand(manager);
|
|
239706
|
+
await execAsync(command);
|
|
239707
|
+
}
|
|
239708
|
+
|
|
239709
|
+
// src/commands/update.ts
|
|
239710
|
+
async function updateCommand(options = {}) {
|
|
239711
|
+
const spinner = ora7("Checking for updates...").start();
|
|
239712
|
+
try {
|
|
239713
|
+
const versionInfo = await checkForUpdate();
|
|
239714
|
+
spinner.stop();
|
|
239715
|
+
console.log(chalk11.cyan("\n\u{1F4E6} Version Information:"));
|
|
239716
|
+
console.log(chalk11.gray(` \u2022 Current version: ${versionInfo.current}`));
|
|
239717
|
+
console.log(chalk11.gray(` \u2022 Latest version: ${versionInfo.latest}`));
|
|
239718
|
+
if (options.check) {
|
|
239719
|
+
if (versionInfo.needsUpdate) {
|
|
239720
|
+
console.log(chalk11.yellow("\n\u26A0\uFE0F An update is available!"));
|
|
239721
|
+
console.log(chalk11.gray(` \u2022 Run ${chalk11.cyan("inkeep update")} to update`));
|
|
239722
|
+
} else {
|
|
239723
|
+
console.log(chalk11.green("\n\u2705 You are on the latest version"));
|
|
239724
|
+
}
|
|
239725
|
+
return;
|
|
239726
|
+
}
|
|
239727
|
+
if (!versionInfo.needsUpdate && !options.force) {
|
|
239728
|
+
console.log(chalk11.green("\n\u2705 You are already on the latest version"));
|
|
239729
|
+
return;
|
|
239730
|
+
}
|
|
239731
|
+
if (!versionInfo.needsUpdate && options.force) {
|
|
239732
|
+
console.log(chalk11.yellow("\n\u26A0\uFE0F Forcing reinstall of current version..."));
|
|
239733
|
+
}
|
|
239734
|
+
console.log(chalk11.cyan("\n\u{1F4D6} Changelog:"));
|
|
239735
|
+
console.log(chalk11.gray(` \u2022 ${getChangelogUrl()}`));
|
|
239736
|
+
spinner.start("Detecting package manager...");
|
|
239737
|
+
const detectedManager = await detectPackageManager();
|
|
239738
|
+
spinner.stop();
|
|
239739
|
+
let packageManager;
|
|
239740
|
+
if (!detectedManager) {
|
|
239741
|
+
console.log(chalk11.yellow("\n\u26A0\uFE0F Could not auto-detect package manager"));
|
|
239742
|
+
const response = await prompts2({
|
|
239743
|
+
type: "select",
|
|
239744
|
+
name: "manager",
|
|
239745
|
+
message: "Which package manager did you use to install the CLI?",
|
|
239746
|
+
choices: [
|
|
239747
|
+
{ title: "npm", value: "npm" },
|
|
239748
|
+
{ title: "pnpm", value: "pnpm" },
|
|
239749
|
+
{ title: "bun", value: "bun" },
|
|
239750
|
+
{ title: "yarn", value: "yarn" }
|
|
239751
|
+
]
|
|
239752
|
+
});
|
|
239753
|
+
if (!response.manager) {
|
|
239754
|
+
console.log(chalk11.red("\n\u274C Update cancelled"));
|
|
239755
|
+
process.exit(1);
|
|
239756
|
+
}
|
|
239757
|
+
packageManager = response.manager;
|
|
239758
|
+
} else {
|
|
239759
|
+
packageManager = detectedManager;
|
|
239760
|
+
console.log(chalk11.gray(`
|
|
239761
|
+
\u{1F50D} Detected package manager: ${chalk11.cyan(packageManager)}`));
|
|
239762
|
+
}
|
|
239763
|
+
if (!options.force) {
|
|
239764
|
+
const response = await prompts2({
|
|
239765
|
+
type: "confirm",
|
|
239766
|
+
name: "confirm",
|
|
239767
|
+
message: `Update @inkeep/agents-cli from ${versionInfo.current} to ${versionInfo.latest}?`,
|
|
239768
|
+
initial: true
|
|
239769
|
+
});
|
|
239770
|
+
if (!response.confirm) {
|
|
239771
|
+
console.log(chalk11.red("\n\u274C Update cancelled"));
|
|
239772
|
+
process.exit(1);
|
|
239773
|
+
}
|
|
239774
|
+
}
|
|
239775
|
+
spinner.start(`Updating @inkeep/agents-cli to ${versionInfo.latest}...`);
|
|
239776
|
+
await executeUpdate(packageManager);
|
|
239777
|
+
spinner.succeed(`Updated to version ${versionInfo.latest}`);
|
|
239778
|
+
console.log(chalk11.green("\n\u2728 Update completed successfully!"));
|
|
239779
|
+
console.log(chalk11.gray(` \u2022 New version: ${versionInfo.latest}`));
|
|
239780
|
+
console.log(chalk11.gray(` \u2022 Package manager: ${packageManager}`));
|
|
239781
|
+
} catch (error) {
|
|
239782
|
+
spinner.fail("Update failed");
|
|
239783
|
+
console.error(chalk11.red("\n\u274C Error:"), error.message);
|
|
239784
|
+
if (error.message.includes("EACCES") || error.message.includes("permission")) {
|
|
239785
|
+
console.log(chalk11.yellow("\n\u{1F4A1} Tip: Try running the command with elevated permissions:"));
|
|
239786
|
+
console.log(chalk11.gray(" \u2022 sudo inkeep update"));
|
|
239527
239787
|
}
|
|
239528
239788
|
process.exit(1);
|
|
239529
239789
|
}
|
|
239530
239790
|
}
|
|
239531
239791
|
|
|
239532
239792
|
// src/index.ts
|
|
239533
|
-
var
|
|
239534
|
-
var
|
|
239535
|
-
var packageJsonPath =
|
|
239536
|
-
var packageJson = JSON.parse(
|
|
239793
|
+
var __filename3 = fileURLToPath3(import.meta.url);
|
|
239794
|
+
var __dirname3 = dirname6(__filename3);
|
|
239795
|
+
var packageJsonPath = join13(__dirname3, "..", "package.json");
|
|
239796
|
+
var packageJson = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
|
|
239537
239797
|
var program = new Command();
|
|
239538
239798
|
program.name("inkeep").description("CLI tool for Inkeep Agent Framework").version(packageJson.version);
|
|
239539
239799
|
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) => {
|
|
@@ -239588,6 +239848,9 @@ program.command("dev").description("Start the Inkeep dashboard server").option("
|
|
|
239588
239848
|
export: options.export
|
|
239589
239849
|
});
|
|
239590
239850
|
});
|
|
239851
|
+
program.command("update").description("Update @inkeep/agents-cli to the latest version").option("--check", "Check for updates without installing").option("--force", "Force update even if already on latest version").action(async (options) => {
|
|
239852
|
+
await updateCommand(options);
|
|
239853
|
+
});
|
|
239591
239854
|
program.parse();
|
|
239592
239855
|
/*! Bundled license information:
|
|
239593
239856
|
|