@naturali/cli 0.127.10 → 0.127.11

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.mjs +18 -2
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
14
14
  };
15
15
  //#endregion
16
16
  //#region package.json
17
- var version = "0.127.10";
17
+ var version = "0.127.11";
18
18
  //#endregion
19
19
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
20
20
  const serializeFormDataPair = (data, key, value) => {
@@ -5103,6 +5103,21 @@ const parseFlagValue = (value) => {
5103
5103
  return value;
5104
5104
  };
5105
5105
  /**
5106
+ * Parses a value for a flag the manifest declares `string`.
5107
+ *
5108
+ * `@ttoss/openapi-codegen` reports a schema with no `type` as `string`, so the
5109
+ * manifest cannot tell a real string from a union — `tool_choice` takes
5110
+ * `"auto"` or `{ "type": "tool", … }` and arrives here as `string`. An object
5111
+ * or array literal is therefore still parsed, while a scalar is left as
5112
+ * written: a digit-only phone number or external id must not become a number.
5113
+ * TriangulosTecnologia/naturali.ai#214
5114
+ */
5115
+ const parseStringFlagValue = (value) => {
5116
+ const trimmed = value.trim();
5117
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) return parseFlagValue(value);
5118
+ return value;
5119
+ };
5120
+ /**
5106
5121
  * Builds the value for an array-typed flag. Repeated occurrences
5107
5122
  * (`--capabilities a --capabilities b`) collect into a list; a single JSON
5108
5123
  * array literal (`--capabilities '["a","b"]'`) passes through unwrapped; a
@@ -5182,7 +5197,8 @@ const placeFlags = (args) => {
5182
5197
  }));
5183
5198
  for (const [flagKey, rawValue] of Object.entries(parsedFlags.single)) {
5184
5199
  const canonical = toCanonical(flagKey);
5185
- const value = typeByCanonical.get(canonical) === "array" ? buildArrayFlagValue(parsedFlags.repeated[flagKey] ?? [rawValue]) : parseFlagValue(rawValue);
5200
+ const declaredType = typeByCanonical.get(canonical);
5201
+ const value = declaredType === "array" ? buildArrayFlagValue(parsedFlags.repeated[flagKey] ?? [rawValue]) : declaredType === "string" ? parseStringFlagValue(rawValue) : parseFlagValue(rawValue);
5186
5202
  const pathParam = route.pathParams.find((param) => {
5187
5203
  return toCanonical(param) === canonical;
5188
5204
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.127.10",
3
+ "version": "0.127.11",
4
4
  "description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "commander": "^15.0.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@naturali/sdk": "0.127.10",
27
+ "@naturali/sdk": "0.127.11",
28
28
  "@ttoss/openapi-codegen": "^0.3.0",
29
29
  "@types/node": "^26.5.1",
30
30
  "tsdown": "^0.23.0",