(program: Command)
| 17 | * reasons back out of history. |
| 18 | */ |
| 19 | export function registerAndonCommands(program: Command): void { |
| 20 | const andonProgram = program |
| 21 | .command("andon") |
| 22 | .description("Raise or clear the tree-wide Andon spawn pause."); |
| 23 | |
| 24 | andonProgram |
| 25 | .command("raise") |
| 26 | .requiredOption( |
| 27 | "--reason <text>", |
| 28 | "Posted to the run thread so the tree sees why orchestration paused." |
| 29 | ) |
| 30 | .option( |
| 31 | "--workspace <path>", |
| 32 | "Workspace containing plan.json with slackKickoffRef" |
| 33 | ) |
| 34 | .option( |
| 35 | "--sender <name>", |
| 36 | "Label for the reason message (defaults to $USER, else 'operator')", |
| 37 | defaultSender() |
| 38 | ) |
| 39 | .option( |
| 40 | "--agent-id <id>", |
| 41 | "Cloud agent id for the footer link back to cursor.com (omit for operator-issued raises)." |
| 42 | ) |
| 43 | .description( |
| 44 | "Post the reason in the run thread and add :rotating_light: to the kickoff message." |
| 45 | ) |
| 46 | .action( |
| 47 | async (opts: { |
| 48 | reason: string; |
| 49 | workspace?: string; |
| 50 | sender: string; |
| 51 | agentId?: string; |
| 52 | }) => { |
| 53 | try { |
| 54 | const { slack, ref } = loadAndonTargetOrBail(opts); |
| 55 | const head = `${ANDON_RAISED_PREFIX} by ${opts.sender}: ${opts.reason}`; |
| 56 | await slack.postCommentInThread({ |
| 57 | threadTs: ref.ts, |
| 58 | text: appendAgentFooter(head, opts.agentId), |
| 59 | username: "orchestrate", |
| 60 | }); |
| 61 | await slack.addReaction({ ...ref, name: "rotating_light" }); |
| 62 | } catch (err) { |
| 63 | console.error(`andon raise failed: ${errorMessage(err)}`); |
| 64 | process.exit(1); |
| 65 | } |
| 66 | } |
| 67 | ); |
| 68 | |
| 69 | andonProgram |
| 70 | .command("clear") |
| 71 | .option( |
| 72 | "--workspace <path>", |
| 73 | "Workspace containing plan.json with slackKickoffRef" |
| 74 | ) |
| 75 | .option( |
| 76 | "--note <text>", |
no test coverage detected