(opts: { workspace?: string })
| 549 | } |
| 550 | |
| 551 | export function loadAndonTargetOrBail(opts: { workspace?: string }): { |
| 552 | slack: SlackAdapter; |
| 553 | ref: { channel: string; ts: string }; |
| 554 | } { |
| 555 | if (!opts.workspace) { |
| 556 | throw new PlanValidationError("pass --workspace"); |
| 557 | } |
| 558 | const planPath = join(resolve(opts.workspace), "plan.json"); |
| 559 | const plan = parsePlanJson(readFileSync(planPath, "utf8"), planPath); |
| 560 | if (!plan.slackKickoffRef) { |
| 561 | throw new PlanValidationError( |
| 562 | `${planPath} has no slackKickoffRef; run the workspace once so Slack visibility is initialized` |
| 563 | ); |
| 564 | } |
| 565 | const slack = createSlackAdapter(plan.slackKickoffRef.channel); |
| 566 | if (!slack) { |
| 567 | throw new PlanValidationError( |
| 568 | "set SLACK_BOT_TOKEN before running andon commands" |
| 569 | ); |
| 570 | } |
| 571 | return { slack, ref: plan.slackKickoffRef }; |
| 572 | } |
| 573 | |
| 574 | export async function loadOrBail( |
| 575 | workspace: string, |
no test coverage detected