@inkeep/agents-cli 0.51.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/agents-cli/package.js +6 -0
  2. package/dist/commands/config.js +1 -1
  3. package/dist/commands/dev.js +1 -1
  4. package/dist/commands/init.js +1 -1
  5. package/dist/commands/{pull-v3 → pull-v4}/component-parser.js +6 -12
  6. package/dist/commands/{pull-v3/utils → pull-v4}/component-registry.js +1 -1
  7. package/dist/commands/pull-v4/generators/agent-generator.js +258 -0
  8. package/dist/commands/pull-v4/generators/artifact-component-generator.js +69 -0
  9. package/dist/commands/pull-v4/generators/context-config-generator.js +264 -0
  10. package/dist/commands/pull-v4/generators/credential-generator.js +30 -0
  11. package/dist/commands/pull-v4/generators/data-component-generator.js +50 -0
  12. package/dist/commands/pull-v4/generators/environment-generator.js +123 -0
  13. package/dist/commands/pull-v4/generators/external-agent-generator.js +56 -0
  14. package/dist/commands/pull-v4/generators/function-tool-generator.js +48 -0
  15. package/dist/commands/pull-v4/generators/mcp-tool-generator.js +91 -0
  16. package/dist/commands/pull-v4/generators/project-generator.js +125 -0
  17. package/dist/commands/{pull-v3/components → pull-v4/generators}/skill-generator.js +1 -1
  18. package/dist/commands/pull-v4/generators/status-component-generator.js +35 -0
  19. package/dist/commands/pull-v4/generators/sub-agent-generator.js +269 -0
  20. package/dist/commands/pull-v4/generators/trigger-generator.js +58 -0
  21. package/dist/commands/pull-v4/introspect/index.js +365 -0
  22. package/dist/commands/pull-v4/introspect/test-helpers.js +143 -0
  23. package/dist/commands/pull-v4/introspect-generator.js +706 -0
  24. package/dist/commands/pull-v4/module-merge.js +405 -0
  25. package/dist/commands/pull-v4/utils.js +235 -0
  26. package/dist/commands/push.js +1 -1
  27. package/dist/commands/update.js +2 -2
  28. package/dist/index.js +18 -44
  29. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js +18 -0
  30. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js +180 -0
  31. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js +8 -0
  32. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/css.js +12 -0
  33. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/json.js +60 -0
  34. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/line.js +37 -0
  35. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/sentence.js +31 -0
  36. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/word.js +118 -0
  37. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/index.js +11 -0
  38. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js +141 -0
  39. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js +63 -0
  40. package/dist/utils/ci-environment.js +1 -1
  41. package/dist/utils/config.js +1 -1
  42. package/dist/utils/environment-loader.js +1 -1
  43. package/dist/utils/file-finder.js +1 -1
  44. package/dist/utils/mcp-runner.js +1 -1
  45. package/dist/utils/profile-config.js +1 -1
  46. package/dist/utils/profiles/profile-manager.js +1 -1
  47. package/dist/utils/project-directory.js +1 -1
  48. package/dist/utils/project-loader.js +1 -1
  49. package/dist/utils/version-check.js +6 -15
  50. package/package.json +5 -7
  51. package/dist/commands/pull-v3/component-updater.js +0 -768
  52. package/dist/commands/pull-v3/components/agent-generator.js +0 -255
  53. package/dist/commands/pull-v3/components/artifact-component-generator.js +0 -143
  54. package/dist/commands/pull-v3/components/context-config-generator.js +0 -190
  55. package/dist/commands/pull-v3/components/credential-generator.js +0 -89
  56. package/dist/commands/pull-v3/components/data-component-generator.js +0 -102
  57. package/dist/commands/pull-v3/components/environment-generator.js +0 -173
  58. package/dist/commands/pull-v3/components/external-agent-generator.js +0 -75
  59. package/dist/commands/pull-v3/components/function-tool-generator.js +0 -92
  60. package/dist/commands/pull-v3/components/mcp-tool-generator.js +0 -86
  61. package/dist/commands/pull-v3/components/project-generator.js +0 -157
  62. package/dist/commands/pull-v3/components/status-component-generator.js +0 -92
  63. package/dist/commands/pull-v3/components/sub-agent-generator.js +0 -295
  64. package/dist/commands/pull-v3/components/trigger-generator.js +0 -185
  65. package/dist/commands/pull-v3/index.js +0 -510
  66. package/dist/commands/pull-v3/introspect-generator.js +0 -286
  67. package/dist/commands/pull-v3/llm-content-merger.js +0 -192
  68. package/dist/commands/pull-v3/new-component-generator.js +0 -279
  69. package/dist/commands/pull-v3/project-comparator.js +0 -914
  70. package/dist/commands/pull-v3/project-index-generator.js +0 -32
  71. package/dist/commands/pull-v3/project-validator.js +0 -358
  72. package/dist/commands/pull-v3/targeted-typescript-placeholders.js +0 -173
  73. package/dist/commands/pull-v3/utils/component-tracker.js +0 -165
  74. package/dist/commands/pull-v3/utils/generator-utils.js +0 -146
  75. package/dist/commands/pull-v3/utils/model-provider-detector.js +0 -50
  76. package/dist/utils/url.js +0 -26
@@ -0,0 +1,141 @@
1
+ import { diffLines } from "../diff/line.js";
2
+
3
+ //#region ../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js
4
+ const INCLUDE_HEADERS = {
5
+ includeIndex: true,
6
+ includeUnderline: true,
7
+ includeFileHeaders: true
8
+ };
9
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
10
+ let optionsObj;
11
+ if (!options) optionsObj = {};
12
+ else if (typeof options === "function") optionsObj = { callback: options };
13
+ else optionsObj = options;
14
+ if (typeof optionsObj.context === "undefined") optionsObj.context = 4;
15
+ const context = optionsObj.context;
16
+ if (optionsObj.newlineIsToken) throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
17
+ if (!optionsObj.callback) return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
18
+ else {
19
+ const { callback } = optionsObj;
20
+ diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff) => {
21
+ callback(diffLinesResultToPatch(diff));
22
+ } }));
23
+ }
24
+ function diffLinesResultToPatch(diff) {
25
+ if (!diff) return;
26
+ diff.push({
27
+ value: "",
28
+ lines: []
29
+ });
30
+ function contextLines(lines) {
31
+ return lines.map(function(entry) {
32
+ return " " + entry;
33
+ });
34
+ }
35
+ const hunks = [];
36
+ let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
37
+ for (let i = 0; i < diff.length; i++) {
38
+ const current = diff[i], lines = current.lines || splitLines(current.value);
39
+ current.lines = lines;
40
+ if (current.added || current.removed) {
41
+ if (!oldRangeStart) {
42
+ const prev = diff[i - 1];
43
+ oldRangeStart = oldLine;
44
+ newRangeStart = newLine;
45
+ if (prev) {
46
+ curRange = context > 0 ? contextLines(prev.lines.slice(-context)) : [];
47
+ oldRangeStart -= curRange.length;
48
+ newRangeStart -= curRange.length;
49
+ }
50
+ }
51
+ for (const line of lines) curRange.push((current.added ? "+" : "-") + line);
52
+ if (current.added) newLine += lines.length;
53
+ else oldLine += lines.length;
54
+ } else {
55
+ if (oldRangeStart) if (lines.length <= context * 2 && i < diff.length - 2) for (const line of contextLines(lines)) curRange.push(line);
56
+ else {
57
+ const contextSize = Math.min(lines.length, context);
58
+ for (const line of contextLines(lines.slice(0, contextSize))) curRange.push(line);
59
+ const hunk = {
60
+ oldStart: oldRangeStart,
61
+ oldLines: oldLine - oldRangeStart + contextSize,
62
+ newStart: newRangeStart,
63
+ newLines: newLine - newRangeStart + contextSize,
64
+ lines: curRange
65
+ };
66
+ hunks.push(hunk);
67
+ oldRangeStart = 0;
68
+ newRangeStart = 0;
69
+ curRange = [];
70
+ }
71
+ oldLine += lines.length;
72
+ newLine += lines.length;
73
+ }
74
+ }
75
+ for (const hunk of hunks) for (let i = 0; i < hunk.lines.length; i++) if (hunk.lines[i].endsWith("\n")) hunk.lines[i] = hunk.lines[i].slice(0, -1);
76
+ else {
77
+ hunk.lines.splice(i + 1, 0, "\");
78
+ i++;
79
+ }
80
+ return {
81
+ oldFileName,
82
+ newFileName,
83
+ oldHeader,
84
+ newHeader,
85
+ hunks
86
+ };
87
+ }
88
+ }
89
+ /**
90
+ * creates a unified diff patch.
91
+ * @param patch either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`)
92
+ */
93
+ function formatPatch(patch, headerOptions) {
94
+ if (!headerOptions) headerOptions = INCLUDE_HEADERS;
95
+ if (Array.isArray(patch)) {
96
+ if (patch.length > 1 && !headerOptions.includeFileHeaders) throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");
97
+ return patch.map((p) => formatPatch(p, headerOptions)).join("\n");
98
+ }
99
+ const ret = [];
100
+ if (headerOptions.includeIndex && patch.oldFileName == patch.newFileName) ret.push("Index: " + patch.oldFileName);
101
+ if (headerOptions.includeUnderline) ret.push("===================================================================");
102
+ if (headerOptions.includeFileHeaders) {
103
+ ret.push("--- " + patch.oldFileName + (typeof patch.oldHeader === "undefined" ? "" : " " + patch.oldHeader));
104
+ ret.push("+++ " + patch.newFileName + (typeof patch.newHeader === "undefined" ? "" : " " + patch.newHeader));
105
+ }
106
+ for (let i = 0; i < patch.hunks.length; i++) {
107
+ const hunk = patch.hunks[i];
108
+ if (hunk.oldLines === 0) hunk.oldStart -= 1;
109
+ if (hunk.newLines === 0) hunk.newStart -= 1;
110
+ ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
111
+ for (const line of hunk.lines) ret.push(line);
112
+ }
113
+ return ret.join("\n") + "\n";
114
+ }
115
+ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
116
+ if (typeof options === "function") options = { callback: options };
117
+ if (!(options === null || options === void 0 ? void 0 : options.callback)) {
118
+ const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
119
+ if (!patchObj) return;
120
+ return formatPatch(patchObj, options === null || options === void 0 ? void 0 : options.headerOptions);
121
+ } else {
122
+ const { callback } = options;
123
+ structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options), { callback: (patchObj) => {
124
+ if (!patchObj) callback(void 0);
125
+ else callback(formatPatch(patchObj, options.headerOptions));
126
+ } }));
127
+ }
128
+ }
129
+ /**
130
+ * Split `text` into an array of lines, including the trailing newline character (where present)
131
+ */
132
+ function splitLines(text) {
133
+ const hasTrailingNl = text.endsWith("\n");
134
+ const result = text.split("\n").map((line) => line + "\n");
135
+ if (hasTrailingNl) result.pop();
136
+ else result.push(result.pop().slice(0, -1));
137
+ return result;
138
+ }
139
+
140
+ //#endregion
141
+ export { INCLUDE_HEADERS, createTwoFilesPatch, formatPatch, structuredPatch };
@@ -0,0 +1,63 @@
1
+ //#region ../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js
2
+ function longestCommonPrefix(str1, str2) {
3
+ let i;
4
+ for (i = 0; i < str1.length && i < str2.length; i++) if (str1[i] != str2[i]) return str1.slice(0, i);
5
+ return str1.slice(0, i);
6
+ }
7
+ function longestCommonSuffix(str1, str2) {
8
+ let i;
9
+ if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) return "";
10
+ for (i = 0; i < str1.length && i < str2.length; i++) if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) return str1.slice(-i);
11
+ return str1.slice(-i);
12
+ }
13
+ function replacePrefix(string, oldPrefix, newPrefix) {
14
+ if (string.slice(0, oldPrefix.length) != oldPrefix) throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
15
+ return newPrefix + string.slice(oldPrefix.length);
16
+ }
17
+ function replaceSuffix(string, oldSuffix, newSuffix) {
18
+ if (!oldSuffix) return string + newSuffix;
19
+ if (string.slice(-oldSuffix.length) != oldSuffix) throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
20
+ return string.slice(0, -oldSuffix.length) + newSuffix;
21
+ }
22
+ function removePrefix(string, oldPrefix) {
23
+ return replacePrefix(string, oldPrefix, "");
24
+ }
25
+ function removeSuffix(string, oldSuffix) {
26
+ return replaceSuffix(string, oldSuffix, "");
27
+ }
28
+ function maximumOverlap(string1, string2) {
29
+ return string2.slice(0, overlapCount(string1, string2));
30
+ }
31
+ function overlapCount(a, b) {
32
+ let startA = 0;
33
+ if (a.length > b.length) startA = a.length - b.length;
34
+ let endB = b.length;
35
+ if (a.length < b.length) endB = a.length;
36
+ const map = Array(endB);
37
+ let k = 0;
38
+ map[0] = 0;
39
+ for (let j = 1; j < endB; j++) {
40
+ if (b[j] == b[k]) map[j] = map[k];
41
+ else map[j] = k;
42
+ while (k > 0 && b[j] != b[k]) k = map[k];
43
+ if (b[j] == b[k]) k++;
44
+ }
45
+ k = 0;
46
+ for (let i = startA; i < a.length; i++) {
47
+ while (k > 0 && a[i] != b[k]) k = map[k];
48
+ if (a[i] == b[k]) k++;
49
+ }
50
+ return k;
51
+ }
52
+ function trailingWs(string) {
53
+ let i;
54
+ for (i = string.length - 1; i >= 0; i--) if (!string[i].match(/\s/)) break;
55
+ return string.substring(i + 1);
56
+ }
57
+ function leadingWs(string) {
58
+ const match = string.match(/^\s*/);
59
+ return match ? match[0] : "";
60
+ }
61
+
62
+ //#endregion
63
+ export { leadingWs, longestCommonPrefix, longestCommonSuffix, maximumOverlap, removePrefix, removeSuffix, replacePrefix, replaceSuffix, trailingWs };
@@ -1,7 +1,7 @@
1
1
  import { checkKeychainAvailability } from "./credentials.js";
2
- import { existsSync } from "node:fs";
3
2
  import { join } from "node:path";
4
3
  import chalk from "chalk";
4
+ import { existsSync } from "node:fs";
5
5
  import { homedir } from "node:os";
6
6
 
7
7
  //#region src/utils/ci-environment.ts
@@ -3,8 +3,8 @@ import { LOCAL_REMOTE } from "./profiles/types.js";
3
3
  import "./profiles/index.js";
4
4
  import { importWithTypeScriptSupport } from "./tsx-loader.js";
5
5
  import { getLogger } from "@inkeep/agents-core";
6
- import { existsSync, readdirSync, statSync } from "node:fs";
7
6
  import { dirname, join, relative, resolve } from "node:path";
7
+ import { existsSync, readdirSync, statSync } from "node:fs";
8
8
 
9
9
  //#region src/utils/config.ts
10
10
  const logger = getLogger("config");
@@ -1,6 +1,6 @@
1
1
  import { importWithTypeScriptSupport } from "./tsx-loader.js";
2
- import { existsSync } from "node:fs";
3
2
  import { join } from "node:path";
3
+ import { existsSync } from "node:fs";
4
4
 
5
5
  //#region src/utils/environment-loader.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { existsSync, readdirSync, statSync } from "node:fs";
2
1
  import { join, relative } from "node:path";
2
+ import { existsSync, readdirSync, statSync } from "node:fs";
3
3
 
4
4
  //#region src/utils/file-finder.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
2
  import { join } from "node:path";
3
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
4
4
  import { homedir } from "node:os";
5
5
  import http from "node:http";
6
6
 
@@ -2,9 +2,9 @@ import { getCredentialExpiryInfo, loadCredentials } from "./credentials.js";
2
2
  import { LOCAL_REMOTE } from "./profiles/types.js";
3
3
  import { ProfileManager } from "./profiles/profile-manager.js";
4
4
  import "./profiles/index.js";
5
- import { existsSync } from "node:fs";
6
5
  import { join } from "node:path";
7
6
  import chalk from "chalk";
7
+ import { existsSync } from "node:fs";
8
8
  import dotenv from "dotenv";
9
9
 
10
10
  //#region src/utils/profile-config.ts
@@ -1,8 +1,8 @@
1
1
  import { __require } from "../../_virtual/rolldown_runtime.js";
2
2
  import { CLOUD_REMOTE, DEFAULT_PROFILES_CONFIG, profileNameSchema, profilesConfigSchema } from "./types.js";
3
3
  import { getLogger } from "@inkeep/agents-core";
4
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
4
  import { join } from "node:path";
5
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
6
  import { homedir, tmpdir } from "node:os";
7
7
  import * as yaml from "yaml";
8
8
 
@@ -1,6 +1,6 @@
1
- import { existsSync } from "node:fs";
2
1
  import { join, resolve } from "node:path";
3
2
  import { findUp } from "find-up";
3
+ import { existsSync } from "node:fs";
4
4
 
5
5
  //#region src/utils/project-directory.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { importWithTypeScriptSupport } from "./tsx-loader.js";
2
- import { existsSync } from "node:fs";
3
2
  import { join } from "node:path";
3
+ import { existsSync } from "node:fs";
4
4
 
5
5
  //#region src/utils/project-loader.ts
6
6
  /**
@@ -1,21 +1,14 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
1
+ import { name, version } from "../agents-cli/package.js";
4
2
 
5
3
  //#region src/utils/version-check.ts
6
- const __dirname = dirname(fileURLToPath(import.meta.url));
7
4
  /**
8
5
  * The default package name for version checks and updates
9
6
  */
10
- const DEFAULT_PACKAGE_NAME = "@inkeep/agents-cli";
7
+ const DEFAULT_PACKAGE_NAME = name;
11
8
  /**
12
9
  * Get the current installed version from package.json
13
10
  */
14
- function getCurrentVersion() {
15
- let packageJsonPath = join(__dirname, "..", "package.json");
16
- if (!existsSync(packageJsonPath)) packageJsonPath = join(__dirname, "..", "..", "package.json");
17
- return JSON.parse(readFileSync(packageJsonPath, "utf-8")).version;
18
- }
11
+ const PACKAGE_VERSION = version;
19
12
  /**
20
13
  * Fetch the latest version from npm registry
21
14
  */
@@ -60,7 +53,7 @@ function compareVersions(v1, v2) {
60
53
  * Check if an update is available
61
54
  */
62
55
  async function checkForUpdate() {
63
- const current = getCurrentVersion();
56
+ const current = PACKAGE_VERSION;
64
57
  const latest = await getLatestVersion();
65
58
  return {
66
59
  current,
@@ -71,9 +64,7 @@ async function checkForUpdate() {
71
64
  /**
72
65
  * Get the changelog URL for the package
73
66
  */
74
- function getChangelogUrl() {
75
- return `https://github.com/inkeep/agents/blob/main/agents-cli/CHANGELOG.md`;
76
- }
67
+ const PACKAGE_CHANGELOG = "https://github.com/inkeep/agents/blob/main/agents-cli/CHANGELOG.md";
77
68
 
78
69
  //#endregion
79
- export { DEFAULT_PACKAGE_NAME, checkForUpdate, compareVersions, getChangelogUrl, getCurrentVersion, getLatestVersion };
70
+ export { DEFAULT_PACKAGE_NAME, PACKAGE_CHANGELOG, PACKAGE_VERSION, checkForUpdate, compareVersions, getLatestVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-cli",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
4
4
  "description": "Inkeep CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,9 +20,6 @@
20
20
  "author": "Inkeep <support@inkeep.com>",
21
21
  "license": "SEE LICENSE IN LICENSE.md",
22
22
  "dependencies": {
23
- "@ai-sdk/anthropic": "3.0.7",
24
- "@ai-sdk/google": "3.0.4",
25
- "@ai-sdk/openai": "3.0.7",
26
23
  "@clack/prompts": "^0.11.0",
27
24
  "@vercel/otel": "^2.0.1",
28
25
  "ai": "6.0.14",
@@ -40,13 +37,14 @@
40
37
  "tsx": "^4.20.5",
41
38
  "yaml": "^2.7.0",
42
39
  "zod": "^4.3.6",
43
- "@inkeep/agents-sdk": "^0.51.0",
44
- "@inkeep/agents-core": "^0.51.0"
40
+ "@inkeep/agents-sdk": "^0.53.0",
41
+ "@inkeep/agents-core": "^0.53.0"
45
42
  },
46
43
  "devDependencies": {
44
+ "diff": "^8.0.3",
47
45
  "@types/degit": "^2.8.6",
48
46
  "@types/fs-extra": "^11.0.4",
49
- "@types/node": "^20.10.0",
47
+ "@types/node": "^22",
50
48
  "@vitest/coverage-v8": "^3.2.4",
51
49
  "typescript": "^5.9.2",
52
50
  "vitest": "^3.2.4"