@koda-sl/baker-cli 0.343.0-dev.4845130c3 → 0.343.0-dev.69293e822
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/README.md +3 -5
- package/dist/cli.js +4 -65
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,14 +118,12 @@ Use `--output` to change format:
|
|
|
118
118
|
|
|
119
119
|
| Format | Description | Best for | Available on |
|
|
120
120
|
|---------|------------------------------------|--------------------|--------------|
|
|
121
|
-
| `json` | Structured JSON envelope (default) | AI agents | every command
|
|
122
|
-
| `files` | Tab-separated, one row per result | Piping / shell |
|
|
123
|
-
| `md` | Markdown table | Human reading |
|
|
121
|
+
| `json` | Structured JSON envelope (default) | AI agents | every command |
|
|
122
|
+
| `files` | Tab-separated, one row per result | Piping / shell | every command |
|
|
123
|
+
| `md` | Markdown table | Human reading | every command |
|
|
124
124
|
| `csv` | RFC 4180 comma-separated values | Analysis tools | `baker research …` only |
|
|
125
125
|
| `jsonl` | One JSON object per line | Streaming/appending | `baker research …` only |
|
|
126
126
|
|
|
127
|
-
`--output json` is accepted even by a command that declares no `--output`: the envelope is already what it prints, and on a command whose default is a readable view (`baker tags list`, the `draft` commands) it becomes that command's `--json`. The few commands that print only text — `baker analytics sending-events`, `baker canvas run` and `rerun` — refuse it, as a command without its own `--output` refuses `md` and `files`.
|
|
128
|
-
|
|
129
127
|
`csv` and `jsonl` are implemented by the research family alone. Asking any other command for them — or for a format that does not exist — falls back to the JSON envelope and says so on stderr, rather than printing nothing and exiting 0.
|
|
130
128
|
|
|
131
129
|
`files` and `md` print rows and nothing else, so any `hints` or data-quality note the envelope carries is written to **stderr** instead. Reading stdout alone still gives you clean, parseable rows.
|
package/dist/cli.js
CHANGED
|
@@ -17045,7 +17045,7 @@ import { defineCommand as defineCommand31 } from "citty";
|
|
|
17045
17045
|
|
|
17046
17046
|
// src/commands/ads/google/ad-copy-flags.ts
|
|
17047
17047
|
var AD_COPY_LIST_FLAGS = ["headlines", "descriptions", "long-headlines"];
|
|
17048
|
-
var AD_COPY_LIST_USAGE = `repeat the flag once per item, or pass one comma-separated list and wrap an item that contains a comma in double quotes: '"Fast, free quotes",Book today'
|
|
17048
|
+
var AD_COPY_LIST_USAGE = `repeat the flag once per item (safe for copy with commas), or pass one comma-separated list and wrap an item that contains a comma in double quotes: '"Fast, free quotes",Book today'`;
|
|
17049
17049
|
function skipBlanks(value, at) {
|
|
17050
17050
|
let i = at;
|
|
17051
17051
|
while (value[i] === " " || value[i] === " ") i++;
|
|
@@ -17114,21 +17114,9 @@ function parseCopyList(value, flag) {
|
|
|
17114
17114
|
function copyListFlag(value, flag) {
|
|
17115
17115
|
return parseCopyList(value, flag)?.map((item) => item.text);
|
|
17116
17116
|
}
|
|
17117
|
-
function refuseDashLedValue(rawArgs, flag) {
|
|
17118
|
-
for (let i = 0; i < rawArgs.length - 1; i++) {
|
|
17119
|
-
if (rawArgs[i] === "--") return;
|
|
17120
|
-
const value = rawArgs[i + 1];
|
|
17121
|
-
if (rawArgs[i] === `--${flag}` && value?.startsWith("-")) {
|
|
17122
|
-
failWriteValidation(
|
|
17123
|
-
`--${flag} is followed by "${value}", which starts with a dash and is read as another flag, not as copy. Join copy that starts with a dash to its flag with =: --${flag}="${value}"`
|
|
17124
|
-
);
|
|
17125
|
-
}
|
|
17126
|
-
}
|
|
17127
|
-
}
|
|
17128
17117
|
function withRepeatedCopyFlags(args5, rawArgs) {
|
|
17129
17118
|
const out = { ...args5 };
|
|
17130
17119
|
for (const flag of AD_COPY_LIST_FLAGS) {
|
|
17131
|
-
refuseDashLedValue(rawArgs ?? [], flag);
|
|
17132
17120
|
const values = repeatedFlagValues(rawArgs ?? [], flag);
|
|
17133
17121
|
if (values.length > 1) {
|
|
17134
17122
|
out[flag] = values;
|
|
@@ -17143,7 +17131,7 @@ function copyListSplitHints(args5) {
|
|
|
17143
17131
|
const fragments = items.filter((item, index) => index > 0 && item.splitAtComma && new RegExp("^\\p{Ll}", "u").test(item.text));
|
|
17144
17132
|
if (fragments.length > 0) {
|
|
17145
17133
|
hints2.push(
|
|
17146
|
-
`--${flag}: ${fragments.map((f) => `"${f.text}"`).join(", ")} starts in lowercase \u2014 it looks like the end of one item cut at a comma. Check the staged copy; if it was one item,
|
|
17134
|
+
`--${flag}: ${fragments.map((f) => `"${f.text}"`).join(", ")} starts in lowercase \u2014 it looks like the end of one item cut at a comma. Check the staged copy; if it was one item, re-stage and ${AD_COPY_LIST_USAGE}.`
|
|
17147
17135
|
);
|
|
17148
17136
|
}
|
|
17149
17137
|
}
|
|
@@ -67693,7 +67681,6 @@ function commandFor(root, argv) {
|
|
|
67693
67681
|
const { command, resolved } = resolveCommand2(root, argv);
|
|
67694
67682
|
return resolved ? command : null;
|
|
67695
67683
|
}
|
|
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. ";
|
|
67697
67684
|
function unknownFlagEnvelope(unknown, commandPath, suggestion, hasSchema) {
|
|
67698
67685
|
const list = unknown.join(", ");
|
|
67699
67686
|
return {
|
|
@@ -67703,7 +67690,7 @@ function unknownFlagEnvelope(unknown, commandPath, suggestion, hasSchema) {
|
|
|
67703
67690
|
message: `${list} ${unknown.length > 1 ? "are not options" : "is not an option"} of \`baker ${commandPath}\`.`,
|
|
67704
67691
|
fix: {
|
|
67705
67692
|
action: hasSchema ? "check_schema" : "check_help",
|
|
67706
|
-
explanation: (
|
|
67693
|
+
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.`
|
|
67707
67694
|
},
|
|
67708
67695
|
retryable: false
|
|
67709
67696
|
}
|
|
@@ -67742,53 +67729,6 @@ function refuseUnknownFlags(root, argv) {
|
|
|
67742
67729
|
process.exit(1);
|
|
67743
67730
|
}
|
|
67744
67731
|
|
|
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"]);
|
|
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
|
-
|
|
67792
67732
|
// src/version.ts
|
|
67793
67733
|
import { readFileSync as readFileSync21 } from "fs";
|
|
67794
67734
|
function packageJsonUrl() {
|
|
@@ -67815,7 +67755,7 @@ var main = defineCommand245({
|
|
|
67815
67755
|
Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
|
|
67816
67756
|
Chat: Set BAKER_CHAT_ID for action and scheduled-action commands that stage changes against a chat.
|
|
67817
67757
|
Output: All commands return JSON envelopes: { ok: true, data: ... } or { ok: false, error: { code, message } }.
|
|
67818
|
-
Formats: --output json
|
|
67758
|
+
Formats: Use --output json|files|md to control output format. Default: json. (The research commands additionally accept csv and jsonl.)
|
|
67819
67759
|
Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
67820
67760
|
},
|
|
67821
67761
|
subCommands: {
|
|
@@ -67853,7 +67793,6 @@ process.argv = [...process.argv.slice(0, 2), ...normalizeCacheFlag(process.argv.
|
|
|
67853
67793
|
installStreamTaps();
|
|
67854
67794
|
logInvocation(process.argv.slice(2));
|
|
67855
67795
|
installExitRecord();
|
|
67856
|
-
process.argv = [...process.argv.slice(0, 2), ...outputFlagForCommand(main, process.argv.slice(2))];
|
|
67857
67796
|
refuseUnknownFlags(main, process.argv.slice(2));
|
|
67858
67797
|
process.argv = [...process.argv.slice(0, 2), ...cacheFlagForParser(process.argv.slice(2))];
|
|
67859
67798
|
runMain(main);
|