@koda-sl/baker-cli 0.92.0 → 0.93.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
@@ -2322,6 +2322,8 @@ baker actions release <action-id>
2322
2322
 
2323
2323
  baker actions create --name "Build hero" --description "..."
2324
2324
  # → returns { ok, data: { tempId }, hints: [...] } — check hints for dependencies/description reminders
2325
+ baker actions create --name "Pull data" --description "..." --mission <ref> --order 0
2326
+ # → creates the action AND attaches it to the mission as a step in one atomic op (no loose-action flicker)
2325
2327
  baker actions update <action-id> --name "Better name"
2326
2328
  baker actions complete <action-id-or-tempId> --note "What was done" # stages — applies on chat publish
2327
2329
  baker actions discard <action-id> --reason "obsolete"
@@ -2368,10 +2370,17 @@ A **Mission** groups an ordered set of actions (its "steps") under one goal, wit
2368
2370
  Mission write ops stage on the **same chat draft as actions** and apply atomically on the existing publish — there is no separate apply. `BAKER_CHAT_ID` must be set for every command except `list`/`get`.
2369
2371
 
2370
2372
  ```bash
2371
- # Open a mission (returns { ok, data: { missionTempId }, hints })
2373
+ # 1. Open the mission FIRST with the detailed plan (the overview is the point).
2374
+ # Returns { ok, data: { missionTempId }, hints }.
2372
2375
  baker missions create --title "Audit Google Ads" --overview "## Phase 1 — Pull data\n..."
2373
2376
 
2374
- # Create the action steps in order, then attach each by 0-based --order.
2377
+ # 2. Create each step already attached to the mission, in order. This is the
2378
+ # preferred path: create+attach is one atomic op, so a step never appears as
2379
+ # a loose action between create and attach.
2380
+ baker actions create --name "Pull data" --description "..." --mission <missionTempId> --order 0
2381
+ baker actions create --name "Analyze" --description "..." --mission <missionTempId> --order 1
2382
+
2383
+ # Attach an already-existing action to a mission (when it wasn't created with --mission).
2375
2384
  # Both --mission and --action accept a real id or a temp_* ref from the same draft.
2376
2385
  baker missions add-action --mission <id-or-missionTempId> --action <id-or-tempId> --order 0
2377
2386
 
package/dist/cli.js CHANGED
@@ -547,7 +547,7 @@ var completeCommand = defineCommand2({
547
547
  import { defineCommand as defineCommand3 } from "citty";
548
548
  registerSchema({
549
549
  command: "actions.create",
550
- description: "Stage creation of a new action (applies when the chat is published). Returns a tempId you can use to link in the same draft. After creating, check if this action blocks or is blocked by other actions and wire dependencies with `baker actions link`.",
550
+ description: "Stage creation of a new action (applies when the chat is published). Returns a tempId you can use to link in the same draft. After creating, check if this action blocks or is blocked by other actions and wire dependencies with `baker actions link`. To make this action a mission step, pass --mission and --order \u2014 it attaches atomically, so the step never flickers as a loose action.",
551
551
  args: {
552
552
  name: { type: "string", description: "Action name (short, action-verb, \u22646 words)", required: true },
553
553
  description: {
@@ -555,7 +555,17 @@ registerSchema({
555
555
  description: "Context-complete description: what / why / where / done-when",
556
556
  required: false
557
557
  },
558
- "temp-id": { type: "string", description: "Custom tempId (auto-generated if omitted)", required: false }
558
+ "temp-id": { type: "string", description: "Custom tempId (auto-generated if omitted)", required: false },
559
+ mission: {
560
+ type: "string",
561
+ description: "Attach the new action to this mission (id or missionTempId) as a step, in one atomic op",
562
+ required: false
563
+ },
564
+ order: {
565
+ type: "string",
566
+ description: "0-based position of the step within the mission (required when --mission is set)",
567
+ required: false
568
+ }
559
569
  }
560
570
  });
561
571
  var createCommand = defineCommand3({
@@ -566,7 +576,9 @@ var createCommand = defineCommand3({
566
576
  args: {
567
577
  name: { type: "string", description: "Action name", required: false },
568
578
  description: { type: "string", description: "Description", required: false, default: "" },
569
- "temp-id": { type: "string", description: "Optional custom tempId", required: false }
579
+ "temp-id": { type: "string", description: "Optional custom tempId", required: false },
580
+ mission: { type: "string", description: "Mission ref to attach this step to", required: false },
581
+ order: { type: "string", description: "0-based step position (required with --mission)", required: false }
570
582
  },
571
583
  run: async ({ args }) => {
572
584
  try {
@@ -574,19 +586,31 @@ var createCommand = defineCommand3({
574
586
  if (!name || name.trim().length === 0) {
575
587
  failValidation("--name is required.");
576
588
  }
589
+ const mission = args.mission;
590
+ let order;
591
+ if (mission) {
592
+ order = Number.parseInt(args.order ?? "", 10);
593
+ if (Number.isNaN(order) || order < 0) {
594
+ failValidation("--order must be a non-negative integer when --mission is set.");
595
+ }
596
+ }
577
597
  const chatId = requireChatId();
578
598
  const tempId = args["temp-id"] || generateTempId();
579
599
  const response = await apiPost("/api/actions/create", {
580
600
  chatId,
581
601
  tempId,
582
602
  name,
583
- description: args.description ?? ""
603
+ description: args.description ?? "",
604
+ ...mission ? { missionRef: mission, order } : {}
584
605
  });
585
606
  const hints = [];
586
607
  hints.push(`Link dependencies: baker actions link --blocker <id> --blocked ${tempId}`);
587
608
  if (!args.description) {
588
609
  hints.push("Add description: baker actions update <tempId> --description '...' (what/why/where/done-when)");
589
610
  }
611
+ if (mission) {
612
+ hints.push(`Attached to mission ${mission} at order ${order}.`);
613
+ }
590
614
  writeJson({ ...response, hints });
591
615
  } catch (err) {
592
616
  failApi(err);