@koda-sl/baker-cli 0.232.1 → 0.233.0-dev.bfa5a91e4
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 +5 -1
- package/dist/{chunk-EKLAHWSF.js → chunk-CMPAHYLB.js} +4 -4
- package/dist/chunk-CMPAHYLB.js.map +1 -0
- package/dist/cli.js +67 -10
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-EKLAHWSF.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
ulid,
|
|
59
59
|
validateCanvasDeep,
|
|
60
60
|
ytDlpBlockSignal
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-CMPAHYLB.js";
|
|
62
62
|
import {
|
|
63
63
|
csvOrJson,
|
|
64
64
|
daysAgoIso,
|
|
@@ -43316,8 +43316,8 @@ import { defineCommand as defineCommand178 } from "citty";
|
|
|
43316
43316
|
// src/commands/scheduled-actions/shared.ts
|
|
43317
43317
|
var TEMP_SCHEDULED_ACTION_PREFIX = "temp_sched_";
|
|
43318
43318
|
var TEMP_ID_PREFIX = "temp_";
|
|
43319
|
-
function writeOk2(data) {
|
|
43320
|
-
writeJson({ ok: true, data: data ?? null });
|
|
43319
|
+
function writeOk2(data, hints) {
|
|
43320
|
+
writeJson({ ok: true, data: data ?? null, ...hints && hints.length > 0 ? { hints } : {} });
|
|
43321
43321
|
}
|
|
43322
43322
|
function failValidation4(message) {
|
|
43323
43323
|
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message } });
|
|
@@ -43358,10 +43358,41 @@ function isPromptWithoutAgent(args, agentDisabled) {
|
|
|
43358
43358
|
function failIfPromptWithoutAgent(args, agentDisabled) {
|
|
43359
43359
|
if (isPromptWithoutAgent(args, agentDisabled)) {
|
|
43360
43360
|
failValidation4(
|
|
43361
|
-
"--prompt only applies when
|
|
43361
|
+
"--prompt only applies when a run does the work; it has no effect with --mode remind, --no-spawn-agent or --spawn-agent false."
|
|
43362
43362
|
);
|
|
43363
43363
|
}
|
|
43364
43364
|
}
|
|
43365
|
+
function isModeAndSpawnAgentBothSet(args, mode) {
|
|
43366
|
+
const spawnAgentGiven = args["spawn-agent"] !== void 0 || args["no-spawn-agent"] === true || args.noSpawnAgent === true;
|
|
43367
|
+
return mode !== void 0 && spawnAgentGiven;
|
|
43368
|
+
}
|
|
43369
|
+
function failIfModeAndSpawnAgent(args, mode) {
|
|
43370
|
+
if (isModeAndSpawnAgentBothSet(args, mode)) {
|
|
43371
|
+
failValidation4("--mode and --spawn-agent/--no-spawn-agent set the same thing. Use --mode on its own.");
|
|
43372
|
+
}
|
|
43373
|
+
}
|
|
43374
|
+
var TASK_MODES = [
|
|
43375
|
+
{ id: "remind", does: "Opens the Task on schedule and leaves it. Nothing runs." },
|
|
43376
|
+
{ id: "recommend", does: "Opens a Task with what it would change and why. Touches nothing itself." },
|
|
43377
|
+
{ id: "propose", does: "Does the work and leaves it for the user to review, then publish." },
|
|
43378
|
+
{ id: "publish", does: "Does the work and publishes it as soon as it finishes \u2014 nobody reviews it first." }
|
|
43379
|
+
];
|
|
43380
|
+
var TASK_MODE_IDS = TASK_MODES.map((mode) => mode.id);
|
|
43381
|
+
var TASK_MODE_ARG_DESCRIPTION = `How far a run of this task goes on its own. ${TASK_MODES.map(
|
|
43382
|
+
(mode) => `${mode.id}: ${mode.does}`
|
|
43383
|
+
).join(" ")} Only set publish when the user asked for it outright \u2014 those runs go live unreviewed and can spend money.`;
|
|
43384
|
+
function isKnownTaskMode(raw) {
|
|
43385
|
+
return typeof raw === "string" && TASK_MODE_IDS.some((id) => id === raw);
|
|
43386
|
+
}
|
|
43387
|
+
function parseModeFlag(raw) {
|
|
43388
|
+
if (raw === void 0) {
|
|
43389
|
+
return void 0;
|
|
43390
|
+
}
|
|
43391
|
+
if (!isKnownTaskMode(raw)) {
|
|
43392
|
+
failValidation4(`--mode must be one of: ${TASK_MODE_IDS.join(", ")}.`);
|
|
43393
|
+
}
|
|
43394
|
+
return raw;
|
|
43395
|
+
}
|
|
43365
43396
|
function parseBooleanFlag(raw, flagName) {
|
|
43366
43397
|
if (raw === void 0) {
|
|
43367
43398
|
return void 0;
|
|
@@ -43417,6 +43448,12 @@ registerSchema({
|
|
|
43417
43448
|
},
|
|
43418
43449
|
timezone: { type: "string", description: "IANA timezone override; defaults to Company Timezone", required: false },
|
|
43419
43450
|
disabled: { type: "boolean", description: "Create disabled", required: false, default: false },
|
|
43451
|
+
mode: {
|
|
43452
|
+
type: "string",
|
|
43453
|
+
description: `${TASK_MODE_ARG_DESCRIPTION} Defaults to propose, or to the template's own mode with --template.`,
|
|
43454
|
+
required: false,
|
|
43455
|
+
enum: TASK_MODE_IDS
|
|
43456
|
+
},
|
|
43420
43457
|
"no-spawn-agent": {
|
|
43421
43458
|
type: "boolean",
|
|
43422
43459
|
description: "Do not spawn an agent when this scheduled action fires",
|
|
@@ -43443,6 +43480,7 @@ var createCommand3 = defineCommand178({
|
|
|
43443
43480
|
"run-at": { type: "string", description: "ISO UTC timestamp ending in Z", required: false },
|
|
43444
43481
|
timezone: { type: "string", description: "IANA timezone override", required: false },
|
|
43445
43482
|
disabled: { type: "boolean", description: "Create disabled", required: false, default: false },
|
|
43483
|
+
mode: { type: "string", description: `One of: ${TASK_MODE_IDS.join(", ")}`, required: false },
|
|
43446
43484
|
"no-spawn-agent": { type: "boolean", description: "Disable agent spawning", required: false, default: false },
|
|
43447
43485
|
prompt: { type: "string", description: "Additional spawned-agent instructions", required: false },
|
|
43448
43486
|
template: { type: "string", description: "Template id to run on this schedule", required: false }
|
|
@@ -43460,7 +43498,9 @@ var createCommand3 = defineCommand178({
|
|
|
43460
43498
|
const schedule = buildScheduleBody(args, { required: true });
|
|
43461
43499
|
const chatId = requireChatId();
|
|
43462
43500
|
const noSpawnAgent = isNoSpawnAgentFlagSet(args);
|
|
43463
|
-
|
|
43501
|
+
const mode = parseModeFlag(args.mode);
|
|
43502
|
+
failIfModeAndSpawnAgent(args, mode);
|
|
43503
|
+
failIfPromptWithoutAgent(args, noSpawnAgent || mode === "remind");
|
|
43464
43504
|
const body = {
|
|
43465
43505
|
chatId,
|
|
43466
43506
|
name,
|
|
@@ -43469,6 +43509,9 @@ var createCommand3 = defineCommand178({
|
|
|
43469
43509
|
spawnAgent: !noSpawnAgent,
|
|
43470
43510
|
...schedule
|
|
43471
43511
|
};
|
|
43512
|
+
if (mode !== void 0) {
|
|
43513
|
+
body.mode = mode;
|
|
43514
|
+
}
|
|
43472
43515
|
if (typeof args.prompt === "string") {
|
|
43473
43516
|
body.agentPrompt = args.prompt;
|
|
43474
43517
|
}
|
|
@@ -43810,6 +43853,12 @@ registerSchema({
|
|
|
43810
43853
|
},
|
|
43811
43854
|
timezone: { type: "string", description: "IANA timezone override", required: false },
|
|
43812
43855
|
enabled: { type: "string", description: "Replacement enabled state", required: false, enum: ["true", "false"] },
|
|
43856
|
+
mode: {
|
|
43857
|
+
type: "string",
|
|
43858
|
+
description: TASK_MODE_ARG_DESCRIPTION,
|
|
43859
|
+
required: false,
|
|
43860
|
+
enum: TASK_MODE_IDS
|
|
43861
|
+
},
|
|
43813
43862
|
"spawn-agent": {
|
|
43814
43863
|
type: "string",
|
|
43815
43864
|
description: "Replacement spawn-agent state",
|
|
@@ -43822,7 +43871,7 @@ registerSchema({
|
|
|
43822
43871
|
var updateCommand3 = defineCommand184({
|
|
43823
43872
|
meta: {
|
|
43824
43873
|
name: "update",
|
|
43825
|
-
description: "Stage a scheduled action update.
|
|
43874
|
+
description: "Stage a scheduled action update. Examples: baker scheduled-actions update <id> --enabled false | baker scheduled-actions update <id> --mode publish"
|
|
43826
43875
|
},
|
|
43827
43876
|
args: {
|
|
43828
43877
|
id: { type: "positional", description: "Scheduled action ID or temp_sched_* draft ID", required: false },
|
|
@@ -43837,6 +43886,7 @@ var updateCommand3 = defineCommand184({
|
|
|
43837
43886
|
"run-at": { type: "string", description: "ISO UTC timestamp ending in Z", required: false },
|
|
43838
43887
|
timezone: { type: "string", description: "IANA timezone override", required: false },
|
|
43839
43888
|
enabled: { type: "string", description: "true|false", required: false },
|
|
43889
|
+
mode: { type: "string", description: `One of: ${TASK_MODE_IDS.join(", ")}`, required: false },
|
|
43840
43890
|
"spawn-agent": { type: "string", description: "true|false", required: false },
|
|
43841
43891
|
prompt: { type: "string", description: "Replacement additional spawned-agent instructions", required: false }
|
|
43842
43892
|
},
|
|
@@ -43865,24 +43915,30 @@ var updateCommand3 = defineCommand184({
|
|
|
43865
43915
|
body.enabled = enabled;
|
|
43866
43916
|
hasPatch = true;
|
|
43867
43917
|
}
|
|
43918
|
+
const mode = parseModeFlag(args.mode);
|
|
43919
|
+
failIfModeAndSpawnAgent(args, mode);
|
|
43920
|
+
if (mode !== void 0) {
|
|
43921
|
+
body.mode = mode;
|
|
43922
|
+
hasPatch = true;
|
|
43923
|
+
}
|
|
43868
43924
|
const spawnAgent = parseBooleanFlag(args["spawn-agent"], "--spawn-agent");
|
|
43869
43925
|
if (spawnAgent !== void 0) {
|
|
43870
43926
|
body.spawnAgent = spawnAgent;
|
|
43871
43927
|
hasPatch = true;
|
|
43872
43928
|
}
|
|
43873
|
-
failIfPromptWithoutAgent(args, spawnAgent === false);
|
|
43929
|
+
failIfPromptWithoutAgent(args, spawnAgent === false || mode === "remind");
|
|
43874
43930
|
if (typeof args.prompt === "string") {
|
|
43875
43931
|
body.agentPrompt = args.prompt;
|
|
43876
43932
|
hasPatch = true;
|
|
43877
43933
|
}
|
|
43878
43934
|
if (!hasPatch) {
|
|
43879
43935
|
failValidation4(
|
|
43880
|
-
"Provide at least one of --name, --description, --cron, --run-at, --timezone, --enabled, --spawn-agent, --prompt."
|
|
43936
|
+
"Provide at least one of --name, --description, --cron, --run-at, --timezone, --enabled, --mode, --spawn-agent, --prompt."
|
|
43881
43937
|
);
|
|
43882
43938
|
}
|
|
43883
43939
|
body.chatId = requireChatId();
|
|
43884
|
-
await apiPost("/api/scheduled-actions/update", body);
|
|
43885
|
-
writeOk2();
|
|
43940
|
+
const response = await apiPost("/api/scheduled-actions/update", body);
|
|
43941
|
+
writeOk2(null, response.hints);
|
|
43886
43942
|
} catch (err) {
|
|
43887
43943
|
failApi2(err);
|
|
43888
43944
|
}
|
|
@@ -43902,6 +43958,7 @@ Examples:
|
|
|
43902
43958
|
baker scheduled-actions get <id-or-temp_sched_id>
|
|
43903
43959
|
baker scheduled-actions create --name "Weekly report" --description "Prepare weekly report" --cron "0 9 * * MON"
|
|
43904
43960
|
baker scheduled-actions update <id-or-temp_sched_id> --enabled false
|
|
43961
|
+
baker scheduled-actions update <id-or-temp_sched_id> --mode publish # what a run does on its own: remind|recommend|propose|publish
|
|
43905
43962
|
baker scheduled-actions delete <id-or-temp_sched_id>
|
|
43906
43963
|
baker scheduled-actions trigger <id>
|
|
43907
43964
|
Full guide: __tooling__/docs/tools/baker/scheduled-actions.md`
|