@swmansion/argent 0.14.1-next.15 → 0.14.1-next.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.
- package/dist/cli-cmds.mjs +13 -8
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -7365,6 +7365,7 @@ function parseJsonOrThrow(raw, label) {
|
|
|
7365
7365
|
}
|
|
7366
7366
|
function parseFlags(argv, schema) {
|
|
7367
7367
|
const properties = schema?.properties ?? {};
|
|
7368
|
+
const argsHatchHint = properties.args === void 0 ? " or --args '<json>'" : "";
|
|
7368
7369
|
const args = {};
|
|
7369
7370
|
const positional = [];
|
|
7370
7371
|
let helpRequested = false;
|
|
@@ -7400,7 +7401,7 @@ function parseFlags(argv, schema) {
|
|
|
7400
7401
|
} else {
|
|
7401
7402
|
flag = tok.slice(2);
|
|
7402
7403
|
}
|
|
7403
|
-
if (flag === "args") {
|
|
7404
|
+
if (flag === "args" && properties.args === void 0) {
|
|
7404
7405
|
const { value: value2, nextIndex: nextIndex2 } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, "args");
|
|
7405
7406
|
rawArgs = value2;
|
|
7406
7407
|
i2 = nextIndex2;
|
|
@@ -7411,7 +7412,7 @@ function parseFlags(argv, schema) {
|
|
|
7411
7412
|
const { value: value2, nextIndex: nextIndex2 } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, flag);
|
|
7412
7413
|
if (seenArrayFields.has(fieldName)) {
|
|
7413
7414
|
throw new FlagParseException(
|
|
7414
|
-
`--${fieldName} and --${flag} cannot be mixed for the same field; pass it entirely as --${flag} '<json>'
|
|
7415
|
+
`--${fieldName} and --${flag} cannot be mixed for the same field; pass it entirely as --${flag} '<json>'${argsHatchHint}`
|
|
7415
7416
|
);
|
|
7416
7417
|
}
|
|
7417
7418
|
args[fieldName] = parseJsonOrThrow(value2, `--${flag}`);
|
|
@@ -7443,13 +7444,13 @@ function parseFlags(argv, schema) {
|
|
|
7443
7444
|
const itemType = propSchema.items?.type;
|
|
7444
7445
|
if (!isScalarType(itemType)) {
|
|
7445
7446
|
throw new FlagParseException(
|
|
7446
|
-
`--${flag} is an array of objects; pass it as --${flag}-json '<json>'
|
|
7447
|
+
`--${flag} is an array of objects; pass it as --${flag}-json '<json>'${argsHatchHint}`
|
|
7447
7448
|
);
|
|
7448
7449
|
}
|
|
7449
7450
|
const { value: value2, nextIndex: nextIndex2 } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, flag);
|
|
7450
7451
|
if (jsonFields.has(flag)) {
|
|
7451
7452
|
throw new FlagParseException(
|
|
7452
|
-
`--${flag} and --${flag}-json cannot be mixed for the same field; pass it entirely as --${flag}-json '<json>'
|
|
7453
|
+
`--${flag} and --${flag}-json cannot be mixed for the same field; pass it entirely as --${flag}-json '<json>'${argsHatchHint}`
|
|
7453
7454
|
);
|
|
7454
7455
|
}
|
|
7455
7456
|
const coerced = coerceScalar(value2, itemType, flag);
|
|
@@ -7464,7 +7465,7 @@ function parseFlags(argv, schema) {
|
|
|
7464
7465
|
}
|
|
7465
7466
|
if (propSchema?.type === "object") {
|
|
7466
7467
|
throw new FlagParseException(
|
|
7467
|
-
`--${flag} is an object; pass it as --${flag}-json '<json>'
|
|
7468
|
+
`--${flag} is an object; pass it as --${flag}-json '<json>'${argsHatchHint}`
|
|
7468
7469
|
);
|
|
7469
7470
|
}
|
|
7470
7471
|
const { value, nextIndex } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, flag);
|
|
@@ -7551,15 +7552,19 @@ async function readStdin() {
|
|
|
7551
7552
|
}
|
|
7552
7553
|
function printToolHelp(meta) {
|
|
7553
7554
|
const description = meta.description?.trim() ?? "";
|
|
7555
|
+
const schema = meta.inputSchema;
|
|
7556
|
+
const hasOwnArgsField = schema?.properties?.args !== void 0;
|
|
7554
7557
|
console.log(`argent run ${meta.name} [flags]`);
|
|
7555
7558
|
if (description) console.log(`
|
|
7556
7559
|
${description}
|
|
7557
7560
|
`);
|
|
7558
7561
|
console.log("Flags:");
|
|
7559
|
-
console.log(formatSchemaUsage(
|
|
7562
|
+
console.log(formatSchemaUsage(schema));
|
|
7560
7563
|
console.log("\nGlobal flags:");
|
|
7561
|
-
|
|
7562
|
-
|
|
7564
|
+
if (!hasOwnArgsField) {
|
|
7565
|
+
console.log(" --args <json> Pass the entire payload as JSON (overrides flags)");
|
|
7566
|
+
console.log(" --args - Read the entire payload as JSON from stdin");
|
|
7567
|
+
}
|
|
7563
7568
|
console.log(" --<field>-json <json> Pass a single field as JSON (objects/nested arrays)");
|
|
7564
7569
|
console.log(" --json Print the raw JSON result");
|
|
7565
7570
|
console.log(" --out <path> For image results, save to <path> instead of fetching URL");
|