@inkeep/agents-cli 0.22.3 → 0.22.4

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