@aident-ai/cli 0.0.5 → 0.0.6

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.mjs +29 -4
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -402,7 +402,7 @@ function escapeHtml(s) {
402
402
  }
403
403
 
404
404
  // src/version.ts
405
- var VERSION = "0.0.5";
405
+ var VERSION = "0.0.6";
406
406
 
407
407
  // src/client.ts
408
408
  class CliClient {
@@ -676,6 +676,30 @@ function coerce(val) {
676
676
  }
677
677
  return val;
678
678
  }
679
+ function coerceArgsToSchema(args, schema) {
680
+ const props = schema?.properties;
681
+ if (!props)
682
+ return args;
683
+ const out = { ...args };
684
+ for (const [key, prop] of Object.entries(props)) {
685
+ if (!(key in out))
686
+ continue;
687
+ const value = out[key];
688
+ const types = Array.isArray(prop.type) ? prop.type : prop.type ? [prop.type] : [];
689
+ if (types.includes("array") && !Array.isArray(value)) {
690
+ if (value === undefined || value === null || value === "") {
691
+ out[key] = [];
692
+ } else if (typeof value === "string" && value.includes(",")) {
693
+ out[key] = value.split(",").map((s) => s.trim()).filter(Boolean);
694
+ } else {
695
+ out[key] = [value];
696
+ }
697
+ } else if (types.includes("string") && !types.includes("number") && typeof value === "number") {
698
+ out[key] = String(value);
699
+ }
700
+ }
701
+ return out;
702
+ }
679
703
  function resolveCommand(positional, knownCommands) {
680
704
  if (positional.length === 0)
681
705
  return null;
@@ -837,7 +861,7 @@ async function runWhoami(format) {
837
861
  process.exitCode = 1;
838
862
  return;
839
863
  }
840
- const result = await callWithRefresh(client, (c) => c.exec("user", "me", {}));
864
+ const result = await callWithRefresh(client, (c) => c.exec("account", "auth status", {}));
841
865
  if (format === "json") {
842
866
  logInfo(JSON.stringify(result.body));
843
867
  if (!result.body.success)
@@ -1042,12 +1066,12 @@ async function runCommand(parsed) {
1042
1066
  logInfo(renderCommandHelp(catalog, resolved.domain, resolved.command));
1043
1067
  return;
1044
1068
  }
1045
- const args = { ...parsed.flags };
1069
+ let args = { ...parsed.flags };
1046
1070
  for (const reserved of RESERVED_CLI_FLAGS) {
1047
1071
  delete args[reserved];
1048
1072
  }
1073
+ const schema = cmdInfo.inputSchema;
1049
1074
  if (resolved.remaining.length > 0) {
1050
- const schema = cmdInfo.inputSchema;
1051
1075
  const required = new Set(schema?.required ?? []);
1052
1076
  const props = schema?.properties ?? {};
1053
1077
  for (const key of Object.keys(props)) {
@@ -1060,6 +1084,7 @@ async function runCommand(parsed) {
1060
1084
  args[key] = resolved.remaining.shift();
1061
1085
  }
1062
1086
  }
1087
+ args = coerceArgsToSchema(args, schema);
1063
1088
  const result = await callWithRefresh(client, (c) => c.exec(resolved.domain, resolved.command, args));
1064
1089
  emitResult(result, parsed.format, resolved);
1065
1090
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aident-ai/cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Aident CLI — agent-friendly access to 1000+ integrations, playbooks, and the Aident automation platform.",
5
5
  "homepage": "https://aident.ai",
6
6
  "repository": {