@botpress/adk-cli 1.7.15 → 1.7.16

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/cli.js +163 -12
  2. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -346924,7 +346924,7 @@ var init_internal = __esm(() => {
346924
346924
  });
346925
346925
  init_define_PACKAGE_VERSIONS = __esm2({
346926
346926
  "<define:__PACKAGE_VERSIONS__>"() {
346927
- define_PACKAGE_VERSIONS_default = { runtime: "1.7.15", adk: "1.7.15", sdk: "4.19.0", llmz: "0.0.31", zai: "2.5.0", cognitive: "0.2.0" };
346927
+ define_PACKAGE_VERSIONS_default = { runtime: "1.7.16", adk: "1.7.16", sdk: "4.19.0", llmz: "0.0.31", zai: "2.5.0", cognitive: "0.2.0" };
346928
346928
  }
346929
346929
  });
346930
346930
  init_globalThis = __esm2({
@@ -627106,7 +627106,7 @@ class AgentProjectGenerator {
627106
627106
  deploy: "adk deploy"
627107
627107
  },
627108
627108
  dependencies: {
627109
- "@botpress/runtime": "^1.7.15"
627109
+ "@botpress/runtime": "^1.7.16"
627110
627110
  },
627111
627111
  devDependencies: {
627112
627112
  typescript: "^5.9.3"
@@ -630057,7 +630057,7 @@ var import_ts_morph, __defProp9, __commonJS5 = (cb4, mod) => () => (mod || cb4((
630057
630057
  `));
630058
630058
  return code;
630059
630059
  }
630060
- }, ADK_VERSION = "1.7.15", relative2 = (from, to3) => {
630060
+ }, ADK_VERSION = "1.7.16", relative2 = (from, to3) => {
630061
630061
  const fromDir = path10.dirname(from);
630062
630062
  const relative32 = path10.relative(fromDir, to3);
630063
630063
  return relative32.startsWith(".") ? relative32 : `./${relative32}`;
@@ -630255,7 +630255,7 @@ var init_dist15 = __esm(() => {
630255
630255
  require_package3 = __commonJS5((exports, module) => {
630256
630256
  module.exports = {
630257
630257
  name: "@botpress/adk",
630258
- version: "1.7.15",
630258
+ version: "1.7.16",
630259
630259
  description: "Core ADK library for building AI agents on Botpress",
630260
630260
  type: "module",
630261
630261
  main: "dist/index.js",
@@ -630302,7 +630302,7 @@ var init_dist15 = __esm(() => {
630302
630302
  "@botpress/cli": "^4.23",
630303
630303
  "@botpress/client": "^1.27.0",
630304
630304
  "@botpress/cognitive": "^0.2.0",
630305
- "@botpress/runtime": "^1.7.15",
630305
+ "@botpress/runtime": "^1.7.16",
630306
630306
  "@botpress/sdk": "^4.18.1",
630307
630307
  "@bpinternal/yargs-extra": "^0.0.21",
630308
630308
  "@parcel/watcher": "^2.5.1",
@@ -636781,7 +636781,7 @@ var init_Separator = __esm(async () => {
636781
636781
  var require_package4 = __commonJS((exports, module) => {
636782
636782
  module.exports = {
636783
636783
  name: "@botpress/adk",
636784
- version: "1.7.15",
636784
+ version: "1.7.16",
636785
636785
  description: "Core ADK library for building AI agents on Botpress",
636786
636786
  type: "module",
636787
636787
  main: "dist/index.js",
@@ -636828,7 +636828,7 @@ var require_package4 = __commonJS((exports, module) => {
636828
636828
  "@botpress/cli": "^4.23",
636829
636829
  "@botpress/client": "^1.27.0",
636830
636830
  "@botpress/cognitive": "^0.2.0",
636831
- "@botpress/runtime": "^1.7.15",
636831
+ "@botpress/runtime": "^1.7.16",
636832
636832
  "@botpress/sdk": "^4.18.1",
636833
636833
  "@bpinternal/yargs-extra": "^0.0.21",
636834
636834
  "@parcel/watcher": "^2.5.1",
@@ -638304,7 +638304,7 @@ function checkRuntimeVersion(agentRoot) {
638304
638304
  `));
638305
638305
  }
638306
638306
  }
638307
- var semver2, EXPECTED_RUNTIME_VERSION = "1.7.15";
638307
+ var semver2, EXPECTED_RUNTIME_VERSION = "1.7.16";
638308
638308
  var init_runtime_version_check = __esm(() => {
638309
638309
  init_source();
638310
638310
  semver2 = __toESM(require_semver2(), 1);
@@ -654225,6 +654225,33 @@ function formatHelp(cmd, version) {
654225
654225
  return sections.join(`
654226
654226
  `);
654227
654227
  }
654228
+ function formatCommandHelp(cmd) {
654229
+ const theme = defaultTheme;
654230
+ const sections = [];
654231
+ sections.push("");
654232
+ sections.push(source_default.hex(theme.text.primary).bold(cmd.name()));
654233
+ sections.push(source_default.hex(theme.text.secondary)(cmd.description()));
654234
+ sections.push("");
654235
+ sections.push(source_default.hex(theme.text.primary).bold("Usage"));
654236
+ const usage = cmd.usage();
654237
+ sections.push(` ${source_default.hex(theme.text.dim)("$")} ${source_default.hex(theme.accent.cyan)("adk")} ${source_default.hex(theme.accent.cyan)(cmd.name())} ${source_default.hex(theme.text.dim)(usage)}`);
654238
+ sections.push("");
654239
+ const options = cmd.options;
654240
+ if (options.length > 0) {
654241
+ sections.push(source_default.hex(theme.text.primary).bold("Options"));
654242
+ for (const option of options) {
654243
+ const flags = option.flags;
654244
+ const description = option.description;
654245
+ const flagsDisplay = source_default.hex(theme.accent.yellow)(flags);
654246
+ const flagsPadded = flagsDisplay.padEnd(30);
654247
+ const descriptionText = source_default.hex(theme.text.secondary)(description);
654248
+ sections.push(` ${flagsPadded} ${descriptionText}`);
654249
+ }
654250
+ sections.push("");
654251
+ }
654252
+ return sections.join(`
654253
+ `);
654254
+ }
654228
654255
  function formatWelcome(version) {
654229
654256
  const theme = defaultTheme;
654230
654257
  const logoLine1 = source_default.hex(theme.accent.purple)(" \u2584\u2580\u2588 \u2588\u2580\u2584 \u2588\u2584\u2580");
@@ -654274,11 +654301,114 @@ function formatWelcome(version) {
654274
654301
  // src/cli.ts
654275
654302
  init_node_version_check();
654276
654303
  init_agent_root();
654304
+
654305
+ // src/utils/string-similarity.ts
654306
+ function calculateLevenshteinDistance(str1, str2) {
654307
+ const len1 = str1.length;
654308
+ const len2 = str2.length;
654309
+ const matrix = [];
654310
+ for (let i = 0;i <= len1; i++) {
654311
+ matrix[i] = [i];
654312
+ }
654313
+ for (let j = 0;j <= len2; j++) {
654314
+ matrix[0][j] = j;
654315
+ }
654316
+ for (let i = 1;i <= len1; i++) {
654317
+ for (let j = 1;j <= len2; j++) {
654318
+ if (str1[i - 1] === str2[j - 1]) {
654319
+ matrix[i][j] = matrix[i - 1][j - 1];
654320
+ } else {
654321
+ matrix[i][j] = Math.min(matrix[i - 1][j] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j - 1] + 1);
654322
+ }
654323
+ }
654324
+ }
654325
+ return matrix[len1][len2];
654326
+ }
654327
+ function calculateSimilarityScore(str1, str2) {
654328
+ const len1 = str1.length;
654329
+ const len2 = str2.length;
654330
+ const maxLen = Math.max(len1, len2);
654331
+ const minLen = Math.min(len1, len2);
654332
+ if (maxLen === 0)
654333
+ return 1;
654334
+ const distance = calculateLevenshteinDistance(str1, str2);
654335
+ let score = 1 - distance / maxLen;
654336
+ const lengthDiff = Math.abs(len1 - len2);
654337
+ if (lengthDiff > 2) {
654338
+ score *= 0.5;
654339
+ } else if (lengthDiff > 1) {
654340
+ score *= 0.75;
654341
+ }
654342
+ if (str1[0] === str2[0]) {
654343
+ score *= 1.1;
654344
+ const prefixLen = Math.min(3, minLen);
654345
+ if (str1.slice(0, prefixLen) === str2.slice(0, prefixLen)) {
654346
+ score *= 1.15;
654347
+ }
654348
+ }
654349
+ return Math.min(1, score);
654350
+ }
654351
+
654352
+ // src/utils/command-suggestions.ts
654353
+ function findSimilarCommands(unknownCommand, allCommands) {
654354
+ const commandNames = [];
654355
+ for (const cmd of allCommands) {
654356
+ const cmdName = cmd.name();
654357
+ const aliases = cmd.aliases();
654358
+ const mainScore = calculateSimilarityScore(unknownCommand.toLowerCase(), cmdName.toLowerCase());
654359
+ commandNames.push({ command: cmd, name: cmdName, score: mainScore });
654360
+ for (const alias of aliases) {
654361
+ const aliasScore = calculateSimilarityScore(unknownCommand.toLowerCase(), alias.toLowerCase());
654362
+ commandNames.push({ command: cmd, name: alias, score: aliasScore });
654363
+ }
654364
+ }
654365
+ commandNames.sort((a, b) => b.score - a.score);
654366
+ const filtered = commandNames.filter((item) => {
654367
+ if (item.name.toLowerCase() === unknownCommand.toLowerCase()) {
654368
+ return false;
654369
+ }
654370
+ if (item.score < 0.5) {
654371
+ return false;
654372
+ }
654373
+ const lengthDiff = Math.abs(unknownCommand.length - item.name.length);
654374
+ if (lengthDiff > 3 && item.score < 0.65) {
654375
+ return false;
654376
+ }
654377
+ return true;
654378
+ });
654379
+ const seen = new Set;
654380
+ const unique = [];
654381
+ for (const item of filtered) {
654382
+ if (!seen.has(item.command)) {
654383
+ seen.add(item.command);
654384
+ unique.push(item.command);
654385
+ if (unique.length >= 3)
654386
+ break;
654387
+ }
654388
+ }
654389
+ return unique;
654390
+ }
654391
+ function formatSuggestion(unknownCommand, suggestions) {
654392
+ if (suggestions.length === 0) {
654393
+ return "";
654394
+ }
654395
+ if (suggestions.length === 1) {
654396
+ return `Did you mean ${suggestions[0].name()}?`;
654397
+ }
654398
+ const names = suggestions.map((cmd) => cmd.name());
654399
+ if (suggestions.length === 2) {
654400
+ return `Did you mean ${names[0]} or ${names[1]}?`;
654401
+ }
654402
+ return `Did you mean ${names.slice(0, -1).join(", ")}, or ${names[names.length - 1]}?`;
654403
+ }
654404
+
654405
+ // src/cli.ts
654406
+ init_source();
654277
654407
  if (!checkNodeVersion(true)) {
654278
654408
  checkNodeVersion(false);
654279
654409
  process.exit(1);
654280
654410
  }
654281
- var CLI_VERSION = "1.7.15";
654411
+ var CLI_VERSION = "1.7.16";
654282
654412
 
654283
654413
  program.name("adk").description("Botpress Agent Development Kit (ADK) - CLI for building AI agents").version(CLI_VERSION).option("--no-cache", "Disable caching for integration lookups").configureHelp({
654284
654414
  formatHelp: () => formatHelp(program, CLI_VERSION)
@@ -654484,10 +654614,31 @@ assets.command("pull").description("Download remote assets to local directory").
654484
654614
  process.exit(1);
654485
654615
  }
654486
654616
  });
654617
+ function configureAllCommandsHelp() {
654618
+ function configureHelpRecursive(cmd) {
654619
+ cmd.configureHelp({
654620
+ formatHelp: () => formatCommandHelp(cmd)
654621
+ });
654622
+ cmd.commands.forEach((subcmd) => {
654623
+ configureHelpRecursive(subcmd);
654624
+ });
654625
+ }
654626
+ program.commands.forEach((cmd) => {
654627
+ configureHelpRecursive(cmd);
654628
+ });
654629
+ }
654630
+ configureAllCommandsHelp();
654487
654631
  program.on("command:*", function(operands) {
654488
- console.error(`
654489
- Error: Unknown command '${operands[0]}'
654490
- `);
654632
+ const unknownCommand = operands[0];
654633
+ const allCommands = Array.from(program.commands);
654634
+ const suggestions = findSimilarCommands(unknownCommand, allCommands);
654635
+ const suggestionText = formatSuggestion(unknownCommand, suggestions);
654636
+ console.error(source_default.red(`adk: "${unknownCommand}" is not an adk command. See 'adk help'.
654637
+ `));
654638
+ if (suggestionText) {
654639
+ console.error(source_default.yellow(`\uD83D\uDCA1 ${suggestionText}
654640
+ `));
654641
+ }
654491
654642
  program.help();
654492
654643
  });
654493
654644
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/adk-cli",
3
- "version": "1.7.15",
3
+ "version": "1.7.16",
4
4
  "description": "Command-line interface for the Botpress Agent Development Kit (ADK)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,9 +40,9 @@
40
40
  "url": "https://github.com/botpress/adk"
41
41
  },
42
42
  "dependencies": {
43
- "@botpress/adk": "^1.7.15",
43
+ "@botpress/adk": "^1.7.16",
44
44
  "@botpress/cli": "^4.23",
45
- "@botpress/runtime": "^1.7.15",
45
+ "@botpress/runtime": "^1.7.16",
46
46
  "adm-zip": "^0.5.16",
47
47
  "chalk": "^5.4.1",
48
48
  "clipboardy": "^4.0.0",