@koda-sl/baker-cli 0.343.0 → 0.344.0-dev.1f4f1c4b7
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.js
CHANGED
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
validateCanvasDeep,
|
|
68
68
|
withoutCastName,
|
|
69
69
|
ytDlpBlockSignal
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-D5P4COPD.js";
|
|
71
71
|
import {
|
|
72
72
|
csvOrJson,
|
|
73
73
|
daysAgoIso,
|
|
@@ -67693,6 +67693,7 @@ function commandFor(root, argv) {
|
|
|
67693
67693
|
const { command, resolved } = resolveCommand2(root, argv);
|
|
67694
67694
|
return resolved ? command : null;
|
|
67695
67695
|
}
|
|
67696
|
+
var OUTPUT_EXPLANATION = "This command has no --output option: `--output json` is accepted by every command that prints the JSON envelope, and md or files only where `baker schema` lists `output`. Drop the option and read the default output. ";
|
|
67696
67697
|
function unknownFlagEnvelope(unknown, commandPath, suggestion, hasSchema) {
|
|
67697
67698
|
const list = unknown.join(", ");
|
|
67698
67699
|
return {
|
|
@@ -67702,7 +67703,7 @@ function unknownFlagEnvelope(unknown, commandPath, suggestion, hasSchema) {
|
|
|
67702
67703
|
message: `${list} ${unknown.length > 1 ? "are not options" : "is not an option"} of \`baker ${commandPath}\`.`,
|
|
67703
67704
|
fix: {
|
|
67704
67705
|
action: hasSchema ? "check_schema" : "check_help",
|
|
67705
|
-
explanation: (suggestion ? `Did you mean ${suggestion}? ` : "") + `Run \`${hasSchema ? `baker schema ${commandPath}` : `baker ${commandPath} --help`}\` to see every option this command takes. Do not re-run the same call: until this version an unrecognised option was accepted and ignored, so a command that looked like it had filtered or narrowed the result was in fact answering the unfiltered question.`
|
|
67706
|
+
explanation: (unknown.some((flag) => flag === "--output" || flag.startsWith("--output=")) ? OUTPUT_EXPLANATION : "") + (suggestion ? `Did you mean ${suggestion}? ` : "") + `Run \`${hasSchema ? `baker schema ${commandPath}` : `baker ${commandPath} --help`}\` to see every option this command takes. Do not re-run the same call: until this version an unrecognised option was accepted and ignored, so a command that looked like it had filtered or narrowed the result was in fact answering the unfiltered question.`
|
|
67706
67707
|
},
|
|
67707
67708
|
retryable: false
|
|
67708
67709
|
}
|
|
@@ -67741,6 +67742,53 @@ function refuseUnknownFlags(root, argv) {
|
|
|
67741
67742
|
process.exit(1);
|
|
67742
67743
|
}
|
|
67743
67744
|
|
|
67745
|
+
// src/output-flag.ts
|
|
67746
|
+
var FLAG = "--output";
|
|
67747
|
+
var ENVELOPE = "json";
|
|
67748
|
+
var PRINTS_NO_ENVELOPE = /* @__PURE__ */ new Set(["analytics sending-events", "canvas run", "canvas rerun", "canvas sync-definition"]);
|
|
67749
|
+
function declaredArg(command, name) {
|
|
67750
|
+
const args5 = command.args;
|
|
67751
|
+
if (!args5 || typeof args5 !== "object" || !(name in args5)) {
|
|
67752
|
+
return null;
|
|
67753
|
+
}
|
|
67754
|
+
const def = args5[name];
|
|
67755
|
+
return def && typeof def === "object" ? def : {};
|
|
67756
|
+
}
|
|
67757
|
+
function envelopeRequests(argv) {
|
|
67758
|
+
const end = argv.indexOf("--");
|
|
67759
|
+
const limit = end === -1 ? argv.length : end;
|
|
67760
|
+
const found = [];
|
|
67761
|
+
for (let index = 0; index < limit; index++) {
|
|
67762
|
+
const token = argv[index];
|
|
67763
|
+
if (token === `${FLAG}=${ENVELOPE}`) {
|
|
67764
|
+
found.push({ index, length: 1 });
|
|
67765
|
+
} else if (token === FLAG && argv[index + 1] === ENVELOPE && index + 1 < limit) {
|
|
67766
|
+
found.push({ index, length: 2 });
|
|
67767
|
+
index++;
|
|
67768
|
+
}
|
|
67769
|
+
}
|
|
67770
|
+
return found;
|
|
67771
|
+
}
|
|
67772
|
+
function outputFlagForCommand(root, argv) {
|
|
67773
|
+
const requests = envelopeRequests(argv);
|
|
67774
|
+
if (requests.length === 0) {
|
|
67775
|
+
return argv;
|
|
67776
|
+
}
|
|
67777
|
+
const command = commandFor(root, argv);
|
|
67778
|
+
if (!command || declaredArg(command, "output") || PRINTS_NO_ENVELOPE.has(commandPathOf(root, argv))) {
|
|
67779
|
+
return argv;
|
|
67780
|
+
}
|
|
67781
|
+
const jsonSwitch = declaredArg(command, "json")?.type === "boolean";
|
|
67782
|
+
const dropped = new Set(requests.flatMap(({ index, length }) => length === 2 ? [index, index + 1] : [index]));
|
|
67783
|
+
const first = requests[0]?.index;
|
|
67784
|
+
return argv.flatMap((token, index) => {
|
|
67785
|
+
if (!dropped.has(index)) {
|
|
67786
|
+
return [token];
|
|
67787
|
+
}
|
|
67788
|
+
return jsonSwitch && index === first ? ["--json"] : [];
|
|
67789
|
+
});
|
|
67790
|
+
}
|
|
67791
|
+
|
|
67744
67792
|
// src/version.ts
|
|
67745
67793
|
import { readFileSync as readFileSync21 } from "fs";
|
|
67746
67794
|
function packageJsonUrl() {
|
|
@@ -67767,7 +67815,7 @@ var main = defineCommand245({
|
|
|
67767
67815
|
Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
|
|
67768
67816
|
Chat: Set BAKER_CHAT_ID for action and scheduled-action commands that stage changes against a chat.
|
|
67769
67817
|
Output: All commands return JSON envelopes: { ok: true, data: ... } or { ok: false, error: { code, message } }.
|
|
67770
|
-
Formats:
|
|
67818
|
+
Formats: --output json works on every command that prints the envelope. --output md|files only where 'baker schema <command>' lists output. (The research commands additionally accept csv and jsonl.)
|
|
67771
67819
|
Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
67772
67820
|
},
|
|
67773
67821
|
subCommands: {
|
|
@@ -67805,6 +67853,7 @@ process.argv = [...process.argv.slice(0, 2), ...normalizeCacheFlag(process.argv.
|
|
|
67805
67853
|
installStreamTaps();
|
|
67806
67854
|
logInvocation(process.argv.slice(2));
|
|
67807
67855
|
installExitRecord();
|
|
67856
|
+
process.argv = [...process.argv.slice(0, 2), ...outputFlagForCommand(main, process.argv.slice(2))];
|
|
67808
67857
|
refuseUnknownFlags(main, process.argv.slice(2));
|
|
67809
67858
|
process.argv = [...process.argv.slice(0, 2), ...cacheFlagForParser(process.argv.slice(2))];
|
|
67810
67859
|
runMain(main);
|