publish_gate.ts

Pure decision logic for the gitops_publish task's interactive gating.

Extracted from gitops_publish.task.ts so the gating table is unit-testable without driving readline or process.exit. The task keeps the IO — prompt, exit, logging — at its edge and consults these for every branch.

view source

Declarations
#

4 declarations

decide_publish_gate
#

publish_gate.ts view source

(options: PublishGateOptions): PublishGate import {decide_publish_gate} from '@fuzdev/fuz_gitops/publish_gate.js';

Decides whether a publish run must block, prompt for confirmation, or proceed without prompting, from the pre-execution inputs.

  • blocked: a real publish whose plan has errors — fail loud before prompting. The executor enforces this too, so --no-plan can't bypass the gate; this branch only avoids prompting for (and printing the "this will publish" banner of) a plan that can't run.
  • confirm: a real publish that shows its plan — the user must confirm interactively.
  • proceed: a dry run, or a --no-plan real publish — no prompt.

options

returns

PublishGate

publish_run_failed
#

publish_gate.ts view source

(result: Pick<PublishingResult, "ok">, fatal_error: Error | null): boolean import {publish_run_failed} from '@fuzdev/fuz_gitops/publish_gate.js';

Whether a finished run should exit non-zero: an unsuccessful result, or a fatal error thrown out of the executor.

result

type Pick<PublishingResult, "ok">

fatal_error

type Error | null

returns

boolean

PublishGate
#

publish_gate.ts view source

PublishGate import type {PublishGate} from '@fuzdev/fuz_gitops/publish_gate.js';

What the task should do with a generated plan before executing the cascade.

PublishGateOptions
#

publish_gate.ts view source

PublishGateOptions import type {PublishGateOptions} from '@fuzdev/fuz_gitops/publish_gate.js';

wetrun

A real publish (--wetrun); a dry run never prompts.

type boolean

show_plan

Show the plan and confirm (plan); --no-plan skips the prompt.

type boolean

plan

type Pick<PublishingPlan, 'errors'>

Depends on
#

Imported by
#