/** * Shared scaffolding for `scai content version *` tasks. * * Each verb (set-validity, set-never-publish, inspect) follows the * same pattern: resolve `(itemId or path, language, version?)` → load * the current version snapshot → apply the verb-specific logic → * audit. The boilerplate around env resolution, path → id resolution, * tier gating and the dry-run / `--allow-write` / `--confirm-token` * dance is identical, so it lives here. */ import type { EnvironmentConfiguration } from "../../config/types.js"; import { Logger } from "../../shared/logger.js"; import { computeScopeHash } from "../../shared/publish-consent.js"; import type { PublishAuditScope } from "../../shared/publish-audit.js"; import { type VersionFieldsSnapshot } from "../../content/api/version-fields.js"; export interface CommonContentVersionOptions { config?: string; environmentName?: string; itemId?: string; path?: string; language: string; /** Specific version (1-indexed). Undefined → latest. */ version?: number; whatIf?: boolean; allowWrite?: boolean; confirmToken?: string; yes?: boolean; verbose?: boolean; trace?: boolean; quiet?: boolean; json?: boolean; logFile?: string; nonInteractive?: boolean; } export declare const buildLogger: (options: CommonContentVersionOptions) => Logger; /** * Resolve `--item-id` or `--path` into a canonical itemId. Errors if * neither (or both) are supplied — the verbs are single-item by * design, so an unambiguous target is a pre-condition. */ export declare const resolveTargetItemId: (environment: EnvironmentConfiguration, options: { itemId?: string; path?: string; }) => Promise; /** * Read the current version snapshot. Resolves the request-time * "latest" (`version` undefined) into the concrete version number on * the returned snapshot, so subsequent writes can pin the exact * version they intended. Audit log carries the concrete version for * the same reason. */ export declare const loadVersionSnapshot: (environment: EnvironmentConfiguration, itemId: string, language: string, version?: number) => Promise; export interface SafetyGateInput { envName: string; environment: EnvironmentConfiguration; scope: PublishAuditScope; /** Friendly label printed in dry-run / prompt output ("set-validity", * "set-never-publish", etc.). */ operationLabel: string; options: Pick; logger: Logger; /** Optional renderer for any verb-specific dry-run lines (e.g. "would * set __Never publish: true"). Invoked before the scope-token * printout. */ describeChange?: () => void; } export type SafetyGateResult = { proceed: false; } | { proceed: true; whatIf: false; }; /** * Apply the standard dry-run / allow-write / confirm-token / prompt * cascade. Returns `proceed: true` only when the caller should * actually issue the write. Mirrors the layering used in * `runPublishItem`. * * The `describeChange` hook lets each verb print its specific intended * mutation (e.g. "would write `__Never publish` from `false` → `true`") * before the shared "Scope token" footer. */ export declare const runSafetyGate: (input: SafetyGateInput) => Promise; /** Re-exported so verb tasks don't have to know which helper module * hosts the canonical hash function. */ export { computeScopeHash };