/** * `unblock` — clear an issue's blocked and failed labels and restore its queue label so the next tick can claim it again. * * Moved out of cli.ts's switch by the per-verb module split (#462); * only the case wrapper, the injected `ctx` lookups and the imports * changed from the original bodies. */ import type { CommandContext } from "./context.ts"; import { findProject, loadConfig, resolveCaps } from "../config.ts"; import { dbPath, openStore } from "../store.ts"; import { makeTracker } from "../tracker/github.ts"; import { formatUnblock, unblockIssue } from "../unblock.ts"; export async function unblockCommand(ctx: CommandContext): Promise { const issue = ctx.issueArg("unblock", ctx.argv[1]); const cfg = loadConfig(); const project = findProject(cfg, ctx.projectFlag); const store = openStore(dbPath()); try { const caps = resolveCaps(project, cfg.defaults); const outcome = await unblockIssue( project, makeTracker(project), store, issue, { force: ctx.argv.includes("--force"), requeue: !ctx.argv.includes("--no-requeue"), }, caps, ); process.stdout.write(`${formatUnblock(issue, outcome, project, caps)}\n`); // A refusal must not read as success to a script or a board keypress. if (outcome.refused !== undefined) process.exitCode = 3; } finally { store.close(); } }