@koda-sl/baker-cli 0.371.0 → 0.372.0
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 +16 -0
- package/dist/{chunk-L4QXAYIC.js → chunk-4ACU7GBN.js} +4 -4
- package/dist/{chunk-3NIBJ3GL.js → chunk-FGHMWBUD.js} +3 -3
- package/dist/{chunk-2OKSJNLA.js → chunk-HJEMOSPH.js} +439 -2
- package/dist/chunk-HJEMOSPH.js.map +1 -0
- package/dist/{chunk-MZQC4LII.js → chunk-MF7YA62W.js} +3 -3
- package/dist/{chunk-XWHHYHKQ.js → chunk-VZEDAFAR.js} +2 -2
- package/dist/{chunk-FXVELNAS.js → chunk-ZI7TPBXB.js} +3 -3
- package/dist/cli.js +28 -293
- package/dist/cli.js.map +1 -1
- package/dist/{client-3DGBQ2H3.js → client-GR6YL3YX.js} +4 -4
- package/dist/engine/index.js +3 -3
- package/dist/{env-BSG7TY5Y.js → env-4P5HOGNA.js} +2 -2
- package/dist/{output-AT5SRVH7.js → output-KMEPFOFT.js} +5 -5
- package/dist/{shared-HZ44PY2F.js → shared-26NWGQ5G.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-2OKSJNLA.js.map +0 -1
- /package/dist/{chunk-L4QXAYIC.js.map → chunk-4ACU7GBN.js.map} +0 -0
- /package/dist/{chunk-3NIBJ3GL.js.map → chunk-FGHMWBUD.js.map} +0 -0
- /package/dist/{chunk-MZQC4LII.js.map → chunk-MF7YA62W.js.map} +0 -0
- /package/dist/{chunk-XWHHYHKQ.js.map → chunk-VZEDAFAR.js.map} +0 -0
- /package/dist/{chunk-FXVELNAS.js.map → chunk-ZI7TPBXB.js.map} +0 -0
- /package/dist/{client-3DGBQ2H3.js.map → client-GR6YL3YX.js.map} +0 -0
- /package/dist/{env-BSG7TY5Y.js.map → env-4P5HOGNA.js.map} +0 -0
- /package/dist/{output-AT5SRVH7.js.map → output-KMEPFOFT.js.map} +0 -0
- /package/dist/{shared-HZ44PY2F.js.map → shared-26NWGQ5G.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
validateCanvasDeep,
|
|
71
71
|
withoutCastName,
|
|
72
72
|
ytDlpBlockSignal
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-FGHMWBUD.js";
|
|
74
74
|
import {
|
|
75
75
|
csvOrJson,
|
|
76
76
|
daysAgoIso,
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
resolveEffectiveStatus,
|
|
81
81
|
statusFilterHints,
|
|
82
82
|
todayIso
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-4ACU7GBN.js";
|
|
84
84
|
import {
|
|
85
85
|
buildQueryCacheKey,
|
|
86
86
|
cacheGet,
|
|
@@ -96,42 +96,50 @@ import {
|
|
|
96
96
|
writeAdsJson,
|
|
97
97
|
writeAdsOutput,
|
|
98
98
|
writeJsonEnvelope
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-ZI7TPBXB.js";
|
|
100
100
|
import {
|
|
101
101
|
ApiError,
|
|
102
102
|
apiGet,
|
|
103
103
|
apiGetWithHeaders,
|
|
104
104
|
apiPost,
|
|
105
105
|
validateConvexId
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-MF7YA62W.js";
|
|
107
107
|
import {
|
|
108
108
|
installExitRecord,
|
|
109
109
|
installStreamTaps,
|
|
110
110
|
logInvocation
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-VZEDAFAR.js";
|
|
112
112
|
import {
|
|
113
113
|
adContentNormalizer,
|
|
114
114
|
captureBudgetMs,
|
|
115
115
|
captureProxyCredentials,
|
|
116
116
|
captureVimeoCookie,
|
|
117
|
+
commandPathOf,
|
|
117
118
|
compactImage,
|
|
118
119
|
compactVideo,
|
|
120
|
+
findSchema,
|
|
119
121
|
getEnv,
|
|
120
122
|
hasOpenRouterKey,
|
|
123
|
+
installFieldMask,
|
|
121
124
|
isProxyFailure,
|
|
125
|
+
listSchemas,
|
|
122
126
|
openRouterKey,
|
|
123
127
|
optionalChatId,
|
|
128
|
+
outputFlagForCommand,
|
|
124
129
|
plannedRoutes,
|
|
125
130
|
refuseNonPublicUrl,
|
|
131
|
+
refuseUnknownFlags,
|
|
132
|
+
registerSchema,
|
|
126
133
|
requireChatId,
|
|
127
134
|
resolveChatId,
|
|
128
135
|
shouldEscalate,
|
|
136
|
+
takeFieldsFlag,
|
|
129
137
|
testimonialNormalizer,
|
|
130
138
|
videoNormalizer,
|
|
131
139
|
winningAdNormalizer,
|
|
132
140
|
writeJson,
|
|
133
141
|
writeOutput
|
|
134
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-HJEMOSPH.js";
|
|
135
143
|
|
|
136
144
|
// src/cli.ts
|
|
137
145
|
import { defineCommand as defineCommand248, runMain } from "citty";
|
|
@@ -172,30 +180,6 @@ import { defineCommand as defineCommand18 } from "citty";
|
|
|
172
180
|
// src/commands/actions/claim.ts
|
|
173
181
|
import { defineCommand } from "citty";
|
|
174
182
|
|
|
175
|
-
// src/schemas.ts
|
|
176
|
-
var registry = /* @__PURE__ */ new Map();
|
|
177
|
-
function registerSchema(schema) {
|
|
178
|
-
registry.set(schema.command, schema);
|
|
179
|
-
}
|
|
180
|
-
function listSchemas() {
|
|
181
|
-
return [...registry.keys()];
|
|
182
|
-
}
|
|
183
|
-
function spellingKey(name) {
|
|
184
|
-
return name.toLowerCase().replaceAll("-", "");
|
|
185
|
-
}
|
|
186
|
-
function resolveSchemaName(words2, names) {
|
|
187
|
-
const joined = words2.join(".");
|
|
188
|
-
if (names.includes(joined)) {
|
|
189
|
-
return joined;
|
|
190
|
-
}
|
|
191
|
-
const matches = names.filter((name) => spellingKey(name) === spellingKey(joined));
|
|
192
|
-
return matches.length === 1 ? matches[0] : void 0;
|
|
193
|
-
}
|
|
194
|
-
function findSchema(words2) {
|
|
195
|
-
const name = resolveSchemaName(words2, listSchemas());
|
|
196
|
-
return name === void 0 ? void 0 : registry.get(name);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
183
|
// ../api/src/actions.ts
|
|
200
184
|
import { z } from "zod";
|
|
201
185
|
var actionStatusSchema = z.enum(["pending", "in_progress", "completed", "discarded"]);
|
|
@@ -26580,10 +26564,10 @@ Example: baker ads meta ads retag 120252158038400247 --url-tags "utm_source={{si
|
|
|
26580
26564
|
}
|
|
26581
26565
|
},
|
|
26582
26566
|
run: async ({ args: args5 }) => {
|
|
26583
|
-
const { apiPost: apiPost2 } = await import("./client-
|
|
26584
|
-
const { requireChatId: requireChatId2 } = await import("./env-
|
|
26585
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
26586
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26567
|
+
const { apiPost: apiPost2 } = await import("./client-GR6YL3YX.js");
|
|
26568
|
+
const { requireChatId: requireChatId2 } = await import("./env-4P5HOGNA.js");
|
|
26569
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-KMEPFOFT.js");
|
|
26570
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-26NWGQ5G.js");
|
|
26587
26571
|
try {
|
|
26588
26572
|
const accountId = bareAccountId2(args5);
|
|
26589
26573
|
const urlTags = typeof args5["url-tags"] === "string" ? args5["url-tags"] : void 0;
|
|
@@ -26728,10 +26712,10 @@ function duplicateCommand2(entity, label) {
|
|
|
26728
26712
|
replace: { type: "boolean", description: "Pause the original once the copy publishes" }
|
|
26729
26713
|
},
|
|
26730
26714
|
run: async ({ args: args5 }) => {
|
|
26731
|
-
const { apiPost: apiPost2 } = await import("./client-
|
|
26732
|
-
const { requireChatId: requireChatId2 } = await import("./env-
|
|
26733
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
26734
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26715
|
+
const { apiPost: apiPost2 } = await import("./client-GR6YL3YX.js");
|
|
26716
|
+
const { requireChatId: requireChatId2 } = await import("./env-4P5HOGNA.js");
|
|
26717
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-KMEPFOFT.js");
|
|
26718
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-26NWGQ5G.js");
|
|
26735
26719
|
try {
|
|
26736
26720
|
const accountId = bareAccountId2(args5);
|
|
26737
26721
|
const chatId = requireChatId2();
|
|
@@ -69383,261 +69367,6 @@ Full guide: __tooling__/docs/tools/baker/winning-ads.md`
|
|
|
69383
69367
|
}
|
|
69384
69368
|
});
|
|
69385
69369
|
|
|
69386
|
-
// src/unknown-flags.ts
|
|
69387
|
-
var ALWAYS_ACCEPTED = /* @__PURE__ */ new Set(["help", "h", "version"]);
|
|
69388
|
-
function subCommandsOf(command) {
|
|
69389
|
-
const sub = command.subCommands;
|
|
69390
|
-
return sub && typeof sub === "object" ? sub : null;
|
|
69391
|
-
}
|
|
69392
|
-
function argsOf(command) {
|
|
69393
|
-
const args5 = command.args;
|
|
69394
|
-
return args5 && typeof args5 === "object" ? args5 : null;
|
|
69395
|
-
}
|
|
69396
|
-
function resolveCommand2(root, argv) {
|
|
69397
|
-
let command = root;
|
|
69398
|
-
for (const token of argv) {
|
|
69399
|
-
if (token === "--" || token.startsWith("-")) {
|
|
69400
|
-
break;
|
|
69401
|
-
}
|
|
69402
|
-
const subCommands = subCommandsOf(command);
|
|
69403
|
-
if (!subCommands) {
|
|
69404
|
-
break;
|
|
69405
|
-
}
|
|
69406
|
-
const next = subCommands[token];
|
|
69407
|
-
if (next === void 0) {
|
|
69408
|
-
break;
|
|
69409
|
-
}
|
|
69410
|
-
if (typeof next !== "object") {
|
|
69411
|
-
return { command, resolved: false };
|
|
69412
|
-
}
|
|
69413
|
-
command = next;
|
|
69414
|
-
}
|
|
69415
|
-
return { command, resolved: true };
|
|
69416
|
-
}
|
|
69417
|
-
function typeOf(def) {
|
|
69418
|
-
return def && typeof def === "object" ? def.type : void 0;
|
|
69419
|
-
}
|
|
69420
|
-
function acceptedNames(command) {
|
|
69421
|
-
const args5 = argsOf(command);
|
|
69422
|
-
if (!args5) {
|
|
69423
|
-
return null;
|
|
69424
|
-
}
|
|
69425
|
-
const names = new Set(ALWAYS_ACCEPTED);
|
|
69426
|
-
for (const [name, def] of Object.entries(args5)) {
|
|
69427
|
-
if (typeOf(def) === "positional") {
|
|
69428
|
-
continue;
|
|
69429
|
-
}
|
|
69430
|
-
for (const spelling of [name, kebab(name), camel(name)]) {
|
|
69431
|
-
names.add(spelling);
|
|
69432
|
-
if (typeOf(def) === "boolean") {
|
|
69433
|
-
names.add(`no-${spelling}`);
|
|
69434
|
-
}
|
|
69435
|
-
}
|
|
69436
|
-
}
|
|
69437
|
-
return names;
|
|
69438
|
-
}
|
|
69439
|
-
function kebab(name) {
|
|
69440
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
69441
|
-
}
|
|
69442
|
-
function camel(name) {
|
|
69443
|
-
return name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
69444
|
-
}
|
|
69445
|
-
function findUnknownFlags(root, argv) {
|
|
69446
|
-
const { command, resolved } = resolveCommand2(root, argv);
|
|
69447
|
-
if (!resolved) {
|
|
69448
|
-
return [];
|
|
69449
|
-
}
|
|
69450
|
-
const accepted = acceptedNames(command);
|
|
69451
|
-
if (!accepted) {
|
|
69452
|
-
return [];
|
|
69453
|
-
}
|
|
69454
|
-
const unknown = [];
|
|
69455
|
-
for (const token of argv) {
|
|
69456
|
-
if (token === "--") {
|
|
69457
|
-
break;
|
|
69458
|
-
}
|
|
69459
|
-
if (!token.startsWith("--")) {
|
|
69460
|
-
continue;
|
|
69461
|
-
}
|
|
69462
|
-
const name = token.slice(2).split("=")[0] ?? "";
|
|
69463
|
-
if (name.length > 0 && !accepted.has(name) && !unknown.includes(token)) {
|
|
69464
|
-
unknown.push(token);
|
|
69465
|
-
}
|
|
69466
|
-
}
|
|
69467
|
-
return unknown;
|
|
69468
|
-
}
|
|
69469
|
-
var SYNONYMS = {
|
|
69470
|
-
from: ["start-date", "start", "since"],
|
|
69471
|
-
since: ["start-date", "start"],
|
|
69472
|
-
start: ["start-date", "since"],
|
|
69473
|
-
to: ["end-date", "end", "until"],
|
|
69474
|
-
until: ["end-date", "end"],
|
|
69475
|
-
end: ["end-date", "until"],
|
|
69476
|
-
path: ["landing"],
|
|
69477
|
-
url: ["landing"]
|
|
69478
|
-
};
|
|
69479
|
-
function closestFlag(unknown, command) {
|
|
69480
|
-
const accepted = acceptedNames(command);
|
|
69481
|
-
if (!accepted) {
|
|
69482
|
-
return null;
|
|
69483
|
-
}
|
|
69484
|
-
const name = unknown.replace(/^--/, "").split("=")[0] ?? "";
|
|
69485
|
-
const synonym = SYNONYMS[name]?.find((candidate) => accepted.has(candidate));
|
|
69486
|
-
if (synonym) {
|
|
69487
|
-
return `--${synonym}`;
|
|
69488
|
-
}
|
|
69489
|
-
const scored = [...accepted].filter((candidate) => !ALWAYS_ACCEPTED.has(candidate)).map((candidate) => ({
|
|
69490
|
-
candidate,
|
|
69491
|
-
prefix: sharedPrefix(name, candidate),
|
|
69492
|
-
distance: editDistance(name, candidate)
|
|
69493
|
-
})).filter(({ prefix, distance }) => prefix >= 4 || distance <= typoBudget(name)).sort((a, b) => b.prefix - a.prefix || a.distance - b.distance);
|
|
69494
|
-
return scored[0] ? `--${scored[0].candidate}` : null;
|
|
69495
|
-
}
|
|
69496
|
-
function typoBudget(name) {
|
|
69497
|
-
return Math.max(1, Math.floor(name.length / 3));
|
|
69498
|
-
}
|
|
69499
|
-
function sharedPrefix(a, b) {
|
|
69500
|
-
let i = 0;
|
|
69501
|
-
while (i < a.length && i < b.length && a[i] === b[i]) {
|
|
69502
|
-
i++;
|
|
69503
|
-
}
|
|
69504
|
-
return i;
|
|
69505
|
-
}
|
|
69506
|
-
function editDistance(a, b) {
|
|
69507
|
-
let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
69508
|
-
for (let i = 1; i <= a.length; i++) {
|
|
69509
|
-
const current = [i];
|
|
69510
|
-
for (let j = 1; j <= b.length; j++) {
|
|
69511
|
-
const substitution = (previous[j - 1] ?? 0) + (a[i - 1] === b[j - 1] ? 0 : 1);
|
|
69512
|
-
current.push(Math.min((previous[j] ?? 0) + 1, (current[j - 1] ?? 0) + 1, substitution));
|
|
69513
|
-
}
|
|
69514
|
-
previous = current;
|
|
69515
|
-
}
|
|
69516
|
-
return previous[b.length] ?? 0;
|
|
69517
|
-
}
|
|
69518
|
-
function commandFor(root, argv) {
|
|
69519
|
-
const { command, resolved } = resolveCommand2(root, argv);
|
|
69520
|
-
return resolved ? command : null;
|
|
69521
|
-
}
|
|
69522
|
-
function suggestFlag(unknown, command) {
|
|
69523
|
-
const flag = closestFlag(unknown, command);
|
|
69524
|
-
if (!flag) {
|
|
69525
|
-
return null;
|
|
69526
|
-
}
|
|
69527
|
-
const args5 = argsOf(command) ?? {};
|
|
69528
|
-
const name = flag.slice(2);
|
|
69529
|
-
const def = args5[name] ?? args5[camel(name)];
|
|
69530
|
-
const described = def && typeof def === "object" ? def.description : void 0;
|
|
69531
|
-
const description = typeof described === "string" ? described.split(/(?<!\b(?:e\.g|i\.e|vs))\.\s/)[0]?.trim().replace(/\.$/, "") : "";
|
|
69532
|
-
return description ? { flag, description } : { flag };
|
|
69533
|
-
}
|
|
69534
|
-
function suggestionText(suggestion) {
|
|
69535
|
-
if (!suggestion) {
|
|
69536
|
-
return "";
|
|
69537
|
-
}
|
|
69538
|
-
return suggestion.description ? `Did you mean ${suggestion.flag}? It is described as: ${suggestion.description}. ` : `Did you mean ${suggestion.flag}? `;
|
|
69539
|
-
}
|
|
69540
|
-
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. ";
|
|
69541
|
-
function unknownFlagEnvelope(unknown, commandPath, suggestion, hasSchema) {
|
|
69542
|
-
const list = unknown.join(", ");
|
|
69543
|
-
return {
|
|
69544
|
-
ok: false,
|
|
69545
|
-
error: {
|
|
69546
|
-
code: "UNKNOWN_ARGUMENT",
|
|
69547
|
-
message: `${list} ${unknown.length > 1 ? "are not options" : "is not an option"} of \`baker ${commandPath}\`.`,
|
|
69548
|
-
fix: {
|
|
69549
|
-
action: hasSchema ? "check_schema" : "check_help",
|
|
69550
|
-
explanation: (unknown.some((flag) => flag === "--output" || flag.startsWith("--output=")) ? OUTPUT_EXPLANATION : "") + suggestionText(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.`
|
|
69551
|
-
},
|
|
69552
|
-
retryable: false
|
|
69553
|
-
}
|
|
69554
|
-
};
|
|
69555
|
-
}
|
|
69556
|
-
function commandPathOf(root, argv) {
|
|
69557
|
-
const path48 = [];
|
|
69558
|
-
let command = root;
|
|
69559
|
-
for (const token of argv) {
|
|
69560
|
-
if (token === "--" || token.startsWith("-")) {
|
|
69561
|
-
break;
|
|
69562
|
-
}
|
|
69563
|
-
const subCommands = subCommandsOf(command);
|
|
69564
|
-
const next = subCommands?.[token];
|
|
69565
|
-
if (next === void 0 || typeof next !== "object") {
|
|
69566
|
-
break;
|
|
69567
|
-
}
|
|
69568
|
-
path48.push(token);
|
|
69569
|
-
command = next;
|
|
69570
|
-
}
|
|
69571
|
-
return path48.join(" ");
|
|
69572
|
-
}
|
|
69573
|
-
function refuseUnknownFlags(root, argv) {
|
|
69574
|
-
const unknown = findUnknownFlags(root, argv);
|
|
69575
|
-
if (unknown.length === 0) {
|
|
69576
|
-
return;
|
|
69577
|
-
}
|
|
69578
|
-
const command = commandFor(root, argv);
|
|
69579
|
-
const first = unknown[0];
|
|
69580
|
-
const suggestion = command && first ? suggestFlag(first, command) : null;
|
|
69581
|
-
const path48 = commandPathOf(root, argv);
|
|
69582
|
-
process.stdout.write(
|
|
69583
|
-
`${JSON.stringify(unknownFlagEnvelope(unknown, path48, suggestion, findSchema(path48.split(" ")) !== void 0), null, 2)}
|
|
69584
|
-
`
|
|
69585
|
-
);
|
|
69586
|
-
process.exit(1);
|
|
69587
|
-
}
|
|
69588
|
-
|
|
69589
|
-
// src/output-flag.ts
|
|
69590
|
-
var FLAG = "--output";
|
|
69591
|
-
var ENVELOPE = "json";
|
|
69592
|
-
var PRINTS_NO_ENVELOPE = /* @__PURE__ */ new Set([
|
|
69593
|
-
"analytics sending-events",
|
|
69594
|
-
"canvas run",
|
|
69595
|
-
"canvas rerun",
|
|
69596
|
-
"canvas sync-definition"
|
|
69597
|
-
]);
|
|
69598
|
-
function declaredArg(command, name) {
|
|
69599
|
-
const args5 = command.args;
|
|
69600
|
-
if (!args5 || typeof args5 !== "object" || !(name in args5)) {
|
|
69601
|
-
return null;
|
|
69602
|
-
}
|
|
69603
|
-
const def = args5[name];
|
|
69604
|
-
return def && typeof def === "object" ? def : {};
|
|
69605
|
-
}
|
|
69606
|
-
function envelopeRequests(argv) {
|
|
69607
|
-
const end = argv.indexOf("--");
|
|
69608
|
-
const limit = end === -1 ? argv.length : end;
|
|
69609
|
-
const found = [];
|
|
69610
|
-
for (let index = 0; index < limit; index++) {
|
|
69611
|
-
const token = argv[index];
|
|
69612
|
-
if (token === `${FLAG}=${ENVELOPE}`) {
|
|
69613
|
-
found.push({ index, length: 1 });
|
|
69614
|
-
} else if (token === FLAG && argv[index + 1] === ENVELOPE && index + 1 < limit) {
|
|
69615
|
-
found.push({ index, length: 2 });
|
|
69616
|
-
index++;
|
|
69617
|
-
}
|
|
69618
|
-
}
|
|
69619
|
-
return found;
|
|
69620
|
-
}
|
|
69621
|
-
function outputFlagForCommand(root, argv) {
|
|
69622
|
-
const requests = envelopeRequests(argv);
|
|
69623
|
-
if (requests.length === 0) {
|
|
69624
|
-
return argv;
|
|
69625
|
-
}
|
|
69626
|
-
const command = commandFor(root, argv);
|
|
69627
|
-
if (!command || declaredArg(command, "output") || PRINTS_NO_ENVELOPE.has(commandPathOf(root, argv))) {
|
|
69628
|
-
return argv;
|
|
69629
|
-
}
|
|
69630
|
-
const jsonSwitch = declaredArg(command, "json")?.type === "boolean";
|
|
69631
|
-
const dropped = new Set(requests.flatMap(({ index, length }) => length === 2 ? [index, index + 1] : [index]));
|
|
69632
|
-
const first = requests[0]?.index;
|
|
69633
|
-
return argv.flatMap((token, index) => {
|
|
69634
|
-
if (!dropped.has(index)) {
|
|
69635
|
-
return [token];
|
|
69636
|
-
}
|
|
69637
|
-
return jsonSwitch && index === first ? ["--json"] : [];
|
|
69638
|
-
});
|
|
69639
|
-
}
|
|
69640
|
-
|
|
69641
69370
|
// src/version.ts
|
|
69642
69371
|
import { readFileSync as readFileSync21 } from "fs";
|
|
69643
69372
|
function packageJsonUrl() {
|
|
@@ -69664,6 +69393,7 @@ var main = defineCommand248({
|
|
|
69664
69393
|
Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
|
|
69665
69394
|
Chat: Set BAKER_CHAT_ID for action and scheduled-agent commands that stage changes against a chat.
|
|
69666
69395
|
Output: All commands return JSON envelopes: { ok: true, data: ... } or { ok: false, error: { code, message } }.
|
|
69396
|
+
Fields: --fields a,b,c keeps only those keys of each record in data, on every command that prints the envelope.
|
|
69667
69397
|
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.)
|
|
69668
69398
|
Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
69669
69399
|
},
|
|
@@ -69703,6 +69433,11 @@ installStreamTaps();
|
|
|
69703
69433
|
logInvocation(process.argv.slice(2));
|
|
69704
69434
|
installExitRecord();
|
|
69705
69435
|
process.argv = [...process.argv.slice(0, 2), ...outputFlagForCommand(main, process.argv.slice(2))];
|
|
69436
|
+
var fieldsFlag = takeFieldsFlag(main, process.argv.slice(2));
|
|
69437
|
+
if (fieldsFlag.fields) {
|
|
69438
|
+
process.argv = [...process.argv.slice(0, 2), ...fieldsFlag.argv];
|
|
69439
|
+
installFieldMask(fieldsFlag.fields, commandPathOf(main, fieldsFlag.argv));
|
|
69440
|
+
}
|
|
69706
69441
|
refuseUnknownFlags(main, process.argv.slice(2));
|
|
69707
69442
|
process.argv = [...process.argv.slice(0, 2), ...cacheFlagForParser(process.argv.slice(2))];
|
|
69708
69443
|
runMain(main);
|