@koda-sl/baker-cli 0.232.1 → 0.233.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 CHANGED
@@ -2858,6 +2858,8 @@ baker scheduled-actions create --name "Spend review" --description "Review spend
2858
2858
 
2859
2859
  baker scheduled-actions update <id-or-temp_sched_id> --enabled false
2860
2860
  baker scheduled-actions update <id-or-temp_sched_id> --run-at "2026-09-02T07:00:00Z" --spawn-agent true --prompt "Use the launch checklist"
2861
+ baker scheduled-actions update <id-or-temp_sched_id> --mode publish # runs go live unreviewed
2862
+ baker scheduled-actions update <id-or-temp_sched_id> --mode recommend # runs advise and change nothing
2861
2863
  baker scheduled-actions delete <id-or-temp_sched_id>
2862
2864
 
2863
2865
  baker scheduled-actions trigger <id>
@@ -2875,9 +2877,11 @@ Rules:
2875
2877
  - Staged commands require `BAKER_CHAT_ID` to point to an `in_progress` chat.
2876
2878
  - `trigger` rejects `temp_sched_*` and only accepts published scheduled-action ids.
2877
2879
  - Company Timezone is the default; `--timezone` is an explicit IANA override.
2880
+ - `--mode` sets how far a run goes on its own: `remind` (opens the Task, runs nothing), `recommend` (writes up what it would change, touches nothing), `propose` (does the work, waits to be published — the default), `publish` (does the work and publishes it unreviewed). It applies when the chat is published, on the authority of whoever published it; a chat completed with no person behind it lands a `publish` task on `propose` instead.
2881
+ - `--mode` supersedes `--spawn-agent`/`--no-spawn-agent`, which can only reach `remind` and `propose`. Passing both is rejected.
2878
2882
  - Scheduled actions spawn agents by default; create with `--no-spawn-agent` or update with `--spawn-agent false` to disable it.
2879
2883
  - `--prompt` maps to the scheduled action's additional spawned-agent instructions (`agentPrompt`), not a replacement for Baker's automatic spawned Work Action reference.
2880
- - `--prompt` requires an agent: it is rejected alongside `--no-spawn-agent` (create) or `--spawn-agent false` (update), since a bypassed agent never reads it.
2884
+ - `--prompt` requires a run that does the work: it is rejected alongside `--mode remind`, `--no-spawn-agent` (create) or `--spawn-agent false` (update), since a bypassed agent never reads it.
2881
2885
  - `--template <id>` binds the schedule to a marketplace recipe instead of a prompt you wrote. The row stores the id alone: name, brief and prompt resolve at fire time, so the job improves when the recipe does. `--description` carries what is true of this company. One row per recipe per company; a second `create` for the same id is refused.
2882
2886
 
2883
2887
  #### Marketplace recipes (`templates`)
package/dist/cli.js CHANGED
@@ -5617,6 +5617,33 @@ var researchFetchResponseSchema = z17.object({
5617
5617
  provider: z17.literal("firecrawl")
5618
5618
  });
5619
5619
 
5620
+ // ../api/src/scheduledTaskModes.ts
5621
+ var TASK_MODES = {
5622
+ remind: {
5623
+ label: "Just reminds you",
5624
+ description: "Opens the Task on schedule and leaves it for you. Nothing runs."
5625
+ },
5626
+ recommend: {
5627
+ label: "Recommends",
5628
+ description: "Opens a Task with what it would change and why. Touches nothing itself."
5629
+ },
5630
+ propose: {
5631
+ label: "Prepares for review",
5632
+ description: "Does the work and leaves it for you to review, then publish."
5633
+ },
5634
+ publish: {
5635
+ label: "Publishes on its own",
5636
+ description: "Does the work and publishes it as soon as it finishes \u2014 nobody reviews it first."
5637
+ }
5638
+ };
5639
+ var TASK_MODE_IDS = Object.keys(TASK_MODES);
5640
+ function modeDescription(mode) {
5641
+ return TASK_MODES[mode].description;
5642
+ }
5643
+ function isTaskMode(value) {
5644
+ return TASK_MODE_IDS.some((id) => id === value);
5645
+ }
5646
+
5620
5647
  // ../api/src/studio.ts
5621
5648
  import { z as z18 } from "zod";
5622
5649
  var studioGenerationStatusSchema = z18.enum(["running", "completed", "partial", "failed"]);
@@ -43316,8 +43343,8 @@ import { defineCommand as defineCommand178 } from "citty";
43316
43343
  // src/commands/scheduled-actions/shared.ts
43317
43344
  var TEMP_SCHEDULED_ACTION_PREFIX = "temp_sched_";
43318
43345
  var TEMP_ID_PREFIX = "temp_";
43319
- function writeOk2(data) {
43320
- writeJson({ ok: true, data: data ?? null });
43346
+ function writeOk2(data, hints) {
43347
+ writeJson({ ok: true, data: data ?? null, ...hints && hints.length > 0 ? { hints } : {} });
43321
43348
  }
43322
43349
  function failValidation4(message) {
43323
43350
  writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message } });
@@ -43358,10 +43385,31 @@ function isPromptWithoutAgent(args, agentDisabled) {
43358
43385
  function failIfPromptWithoutAgent(args, agentDisabled) {
43359
43386
  if (isPromptWithoutAgent(args, agentDisabled)) {
43360
43387
  failValidation4(
43361
- "--prompt only applies when an agent is spawned; it has no effect with --no-spawn-agent or --spawn-agent false."
43388
+ "--prompt only applies when a run does the work; it has no effect with --mode remind, --no-spawn-agent or --spawn-agent false."
43362
43389
  );
43363
43390
  }
43364
43391
  }
43392
+ function isModeAndSpawnAgentBothSet(args, mode) {
43393
+ const spawnAgentGiven = args["spawn-agent"] !== void 0 || args["no-spawn-agent"] === true || args.noSpawnAgent === true;
43394
+ return mode !== void 0 && spawnAgentGiven;
43395
+ }
43396
+ function failIfModeAndSpawnAgent(args, mode) {
43397
+ if (isModeAndSpawnAgentBothSet(args, mode)) {
43398
+ failValidation4("--mode and --spawn-agent/--no-spawn-agent set the same thing. Use --mode on its own.");
43399
+ }
43400
+ }
43401
+ var TASK_MODE_ARG_DESCRIPTION = `How far a run of this task goes on its own. ${TASK_MODE_IDS.map(
43402
+ (id) => `${id}: ${modeDescription(id)}`
43403
+ ).join(" ")} Only set publish when the user asked for it outright \u2014 those runs go live unreviewed and can spend money.`;
43404
+ function parseModeFlag(raw) {
43405
+ if (raw === void 0) {
43406
+ return void 0;
43407
+ }
43408
+ if (!isTaskMode(raw)) {
43409
+ failValidation4(`--mode must be one of: ${TASK_MODE_IDS.join(", ")}.`);
43410
+ }
43411
+ return raw;
43412
+ }
43365
43413
  function parseBooleanFlag(raw, flagName) {
43366
43414
  if (raw === void 0) {
43367
43415
  return void 0;
@@ -43417,6 +43465,12 @@ registerSchema({
43417
43465
  },
43418
43466
  timezone: { type: "string", description: "IANA timezone override; defaults to Company Timezone", required: false },
43419
43467
  disabled: { type: "boolean", description: "Create disabled", required: false, default: false },
43468
+ mode: {
43469
+ type: "string",
43470
+ description: `${TASK_MODE_ARG_DESCRIPTION} Defaults to propose, or to the template's own mode with --template.`,
43471
+ required: false,
43472
+ enum: [...TASK_MODE_IDS]
43473
+ },
43420
43474
  "no-spawn-agent": {
43421
43475
  type: "boolean",
43422
43476
  description: "Do not spawn an agent when this scheduled action fires",
@@ -43443,6 +43497,7 @@ var createCommand3 = defineCommand178({
43443
43497
  "run-at": { type: "string", description: "ISO UTC timestamp ending in Z", required: false },
43444
43498
  timezone: { type: "string", description: "IANA timezone override", required: false },
43445
43499
  disabled: { type: "boolean", description: "Create disabled", required: false, default: false },
43500
+ mode: { type: "string", description: `One of: ${TASK_MODE_IDS.join(", ")}`, required: false },
43446
43501
  "no-spawn-agent": { type: "boolean", description: "Disable agent spawning", required: false, default: false },
43447
43502
  prompt: { type: "string", description: "Additional spawned-agent instructions", required: false },
43448
43503
  template: { type: "string", description: "Template id to run on this schedule", required: false }
@@ -43460,7 +43515,9 @@ var createCommand3 = defineCommand178({
43460
43515
  const schedule = buildScheduleBody(args, { required: true });
43461
43516
  const chatId = requireChatId();
43462
43517
  const noSpawnAgent = isNoSpawnAgentFlagSet(args);
43463
- failIfPromptWithoutAgent(args, noSpawnAgent);
43518
+ const mode = parseModeFlag(args.mode);
43519
+ failIfModeAndSpawnAgent(args, mode);
43520
+ failIfPromptWithoutAgent(args, noSpawnAgent || mode === "remind");
43464
43521
  const body = {
43465
43522
  chatId,
43466
43523
  name,
@@ -43469,6 +43526,9 @@ var createCommand3 = defineCommand178({
43469
43526
  spawnAgent: !noSpawnAgent,
43470
43527
  ...schedule
43471
43528
  };
43529
+ if (mode !== void 0) {
43530
+ body.mode = mode;
43531
+ }
43472
43532
  if (typeof args.prompt === "string") {
43473
43533
  body.agentPrompt = args.prompt;
43474
43534
  }
@@ -43810,6 +43870,12 @@ registerSchema({
43810
43870
  },
43811
43871
  timezone: { type: "string", description: "IANA timezone override", required: false },
43812
43872
  enabled: { type: "string", description: "Replacement enabled state", required: false, enum: ["true", "false"] },
43873
+ mode: {
43874
+ type: "string",
43875
+ description: TASK_MODE_ARG_DESCRIPTION,
43876
+ required: false,
43877
+ enum: [...TASK_MODE_IDS]
43878
+ },
43813
43879
  "spawn-agent": {
43814
43880
  type: "string",
43815
43881
  description: "Replacement spawn-agent state",
@@ -43822,7 +43888,7 @@ registerSchema({
43822
43888
  var updateCommand3 = defineCommand184({
43823
43889
  meta: {
43824
43890
  name: "update",
43825
- description: "Stage a scheduled action update. Example: baker scheduled-actions update <id> --enabled false"
43891
+ description: "Stage a scheduled action update. Examples: baker scheduled-actions update <id> --enabled false | baker scheduled-actions update <id> --mode publish"
43826
43892
  },
43827
43893
  args: {
43828
43894
  id: { type: "positional", description: "Scheduled action ID or temp_sched_* draft ID", required: false },
@@ -43837,6 +43903,7 @@ var updateCommand3 = defineCommand184({
43837
43903
  "run-at": { type: "string", description: "ISO UTC timestamp ending in Z", required: false },
43838
43904
  timezone: { type: "string", description: "IANA timezone override", required: false },
43839
43905
  enabled: { type: "string", description: "true|false", required: false },
43906
+ mode: { type: "string", description: `One of: ${TASK_MODE_IDS.join(", ")}`, required: false },
43840
43907
  "spawn-agent": { type: "string", description: "true|false", required: false },
43841
43908
  prompt: { type: "string", description: "Replacement additional spawned-agent instructions", required: false }
43842
43909
  },
@@ -43865,24 +43932,30 @@ var updateCommand3 = defineCommand184({
43865
43932
  body.enabled = enabled;
43866
43933
  hasPatch = true;
43867
43934
  }
43935
+ const mode = parseModeFlag(args.mode);
43936
+ failIfModeAndSpawnAgent(args, mode);
43937
+ if (mode !== void 0) {
43938
+ body.mode = mode;
43939
+ hasPatch = true;
43940
+ }
43868
43941
  const spawnAgent = parseBooleanFlag(args["spawn-agent"], "--spawn-agent");
43869
43942
  if (spawnAgent !== void 0) {
43870
43943
  body.spawnAgent = spawnAgent;
43871
43944
  hasPatch = true;
43872
43945
  }
43873
- failIfPromptWithoutAgent(args, spawnAgent === false);
43946
+ failIfPromptWithoutAgent(args, spawnAgent === false || mode === "remind");
43874
43947
  if (typeof args.prompt === "string") {
43875
43948
  body.agentPrompt = args.prompt;
43876
43949
  hasPatch = true;
43877
43950
  }
43878
43951
  if (!hasPatch) {
43879
43952
  failValidation4(
43880
- "Provide at least one of --name, --description, --cron, --run-at, --timezone, --enabled, --spawn-agent, --prompt."
43953
+ "Provide at least one of --name, --description, --cron, --run-at, --timezone, --enabled, --mode, --spawn-agent, --prompt."
43881
43954
  );
43882
43955
  }
43883
43956
  body.chatId = requireChatId();
43884
- await apiPost("/api/scheduled-actions/update", body);
43885
- writeOk2();
43957
+ const response = await apiPost("/api/scheduled-actions/update", body);
43958
+ writeOk2(null, response.hints);
43886
43959
  } catch (err) {
43887
43960
  failApi2(err);
43888
43961
  }
@@ -43902,6 +43975,7 @@ Examples:
43902
43975
  baker scheduled-actions get <id-or-temp_sched_id>
43903
43976
  baker scheduled-actions create --name "Weekly report" --description "Prepare weekly report" --cron "0 9 * * MON"
43904
43977
  baker scheduled-actions update <id-or-temp_sched_id> --enabled false
43978
+ baker scheduled-actions update <id-or-temp_sched_id> --mode publish # what a run does on its own: remind|recommend|propose|publish
43905
43979
  baker scheduled-actions delete <id-or-temp_sched_id>
43906
43980
  baker scheduled-actions trigger <id>
43907
43981
  Full guide: __tooling__/docs/tools/baker/scheduled-actions.md`