/**
 * CLEO exit codes — canonical definitions shared across all layers.
 *
 * Ranges: 0 = success, 1-99 = errors, 100+ = special (non-error) states.
 *
 * @epic T4454
 * @task T4456
 * @task T5710
 */
export var ExitCode;
(function (ExitCode) {
    // === SUCCESS (0) ===
    ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
    // === GENERAL ERRORS (1-9) ===
    ExitCode[ExitCode["GENERAL_ERROR"] = 1] = "GENERAL_ERROR";
    ExitCode[ExitCode["INVALID_INPUT"] = 2] = "INVALID_INPUT";
    ExitCode[ExitCode["FILE_ERROR"] = 3] = "FILE_ERROR";
    ExitCode[ExitCode["NOT_FOUND"] = 4] = "NOT_FOUND";
    ExitCode[ExitCode["DEPENDENCY_ERROR"] = 5] = "DEPENDENCY_ERROR";
    ExitCode[ExitCode["VALIDATION_ERROR"] = 6] = "VALIDATION_ERROR";
    ExitCode[ExitCode["LOCK_TIMEOUT"] = 7] = "LOCK_TIMEOUT";
    ExitCode[ExitCode["CONFIG_ERROR"] = 8] = "CONFIG_ERROR";
    // === HIERARCHY ERRORS (10-19) ===
    ExitCode[ExitCode["PARENT_NOT_FOUND"] = 10] = "PARENT_NOT_FOUND";
    ExitCode[ExitCode["DEPTH_EXCEEDED"] = 11] = "DEPTH_EXCEEDED";
    ExitCode[ExitCode["SIBLING_LIMIT"] = 12] = "SIBLING_LIMIT";
    ExitCode[ExitCode["INVALID_PARENT_TYPE"] = 13] = "INVALID_PARENT_TYPE";
    ExitCode[ExitCode["CIRCULAR_REFERENCE"] = 14] = "CIRCULAR_REFERENCE";
    ExitCode[ExitCode["ORPHAN_DETECTED"] = 15] = "ORPHAN_DETECTED";
    ExitCode[ExitCode["HAS_CHILDREN"] = 16] = "HAS_CHILDREN";
    ExitCode[ExitCode["TASK_COMPLETED"] = 17] = "TASK_COMPLETED";
    ExitCode[ExitCode["CASCADE_FAILED"] = 18] = "CASCADE_FAILED";
    ExitCode[ExitCode["HAS_DEPENDENTS"] = 19] = "HAS_DEPENDENTS";
    // === CONCURRENCY ERRORS (20-29) ===
    ExitCode[ExitCode["CHECKSUM_MISMATCH"] = 20] = "CHECKSUM_MISMATCH";
    ExitCode[ExitCode["CONCURRENT_MODIFICATION"] = 21] = "CONCURRENT_MODIFICATION";
    ExitCode[ExitCode["ID_COLLISION"] = 22] = "ID_COLLISION";
    // === SESSION ERRORS (30-39) ===
    ExitCode[ExitCode["SESSION_EXISTS"] = 30] = "SESSION_EXISTS";
    ExitCode[ExitCode["SESSION_NOT_FOUND"] = 31] = "SESSION_NOT_FOUND";
    ExitCode[ExitCode["SCOPE_CONFLICT"] = 32] = "SCOPE_CONFLICT";
    ExitCode[ExitCode["SCOPE_INVALID"] = 33] = "SCOPE_INVALID";
    ExitCode[ExitCode["TASK_NOT_IN_SCOPE"] = 34] = "TASK_NOT_IN_SCOPE";
    ExitCode[ExitCode["TASK_CLAIMED"] = 35] = "TASK_CLAIMED";
    ExitCode[ExitCode["SESSION_REQUIRED"] = 36] = "SESSION_REQUIRED";
    ExitCode[ExitCode["SESSION_CLOSE_BLOCKED"] = 37] = "SESSION_CLOSE_BLOCKED";
    ExitCode[ExitCode["ACTIVE_TASK_REQUIRED"] = 38] = "ACTIVE_TASK_REQUIRED";
    ExitCode[ExitCode["NOTES_REQUIRED"] = 39] = "NOTES_REQUIRED";
    // === VERIFICATION ERRORS (40-47) ===
    ExitCode[ExitCode["VERIFICATION_INIT_FAILED"] = 40] = "VERIFICATION_INIT_FAILED";
    ExitCode[ExitCode["GATE_UPDATE_FAILED"] = 41] = "GATE_UPDATE_FAILED";
    ExitCode[ExitCode["INVALID_GATE"] = 42] = "INVALID_GATE";
    ExitCode[ExitCode["INVALID_AGENT"] = 43] = "INVALID_AGENT";
    ExitCode[ExitCode["MAX_ROUNDS_EXCEEDED"] = 44] = "MAX_ROUNDS_EXCEEDED";
    ExitCode[ExitCode["GATE_DEPENDENCY"] = 45] = "GATE_DEPENDENCY";
    ExitCode[ExitCode["VERIFICATION_LOCKED"] = 46] = "VERIFICATION_LOCKED";
    ExitCode[ExitCode["ROUND_MISMATCH"] = 47] = "ROUND_MISMATCH";
    /**
     * E_AC_LOCKED — Acceptance criteria are locked because the task has
     * advanced into (or past) the implementation pipeline stage.
     *
     * Reframing AC after work has begun is an anti-pattern (the
     * "T-THIN-WRAPPER feature-complete" failure mode where AC was
     * silently rewritten to match what shipped). To override the lock,
     * the operator MUST supply an explicit `--reason "<text>"` which is
     * appended to `.cleo/audit/ac-changes.jsonl`.
     *
     * Locked stages: implementation, validation, testing, release, contribution.
     *
     * @epic T1586 Foundation Lockdown
     * @task T1590 AC-immutability guard
     */
    ExitCode[ExitCode["AC_LOCKED"] = 48] = "AC_LOCKED";
    /**
     * E_EPIC_HAS_PENDING_CHILDREN — `cleo complete <epicId>` was called while
     * the epic still has one or more children in `pending` or `active` status.
     *
     * Prevents the T1467+T1603 premature-close bug class: epics may not be
     * marked done while children remain in-flight. Pass `--override-reason`
     * to bypass (audited to `.cleo/audit/premature-close.jsonl`).
     *
     * @epic T1627
     * @task T1632
     */
    ExitCode[ExitCode["EPIC_HAS_PENDING_CHILDREN"] = 49] = "EPIC_HAS_PENDING_CHILDREN";
    // === CONTEXT SAFEGUARD (50-54) ===
    ExitCode[ExitCode["CONTEXT_WARNING"] = 50] = "CONTEXT_WARNING";
    ExitCode[ExitCode["CONTEXT_CAUTION"] = 51] = "CONTEXT_CAUTION";
    ExitCode[ExitCode["CONTEXT_CRITICAL"] = 52] = "CONTEXT_CRITICAL";
    ExitCode[ExitCode["CONTEXT_EMERGENCY"] = 53] = "CONTEXT_EMERGENCY";
    ExitCode[ExitCode["CONTEXT_STALE"] = 54] = "CONTEXT_STALE";
    // === ORCHESTRATOR ERRORS (60-68) ===
    ExitCode[ExitCode["PROTOCOL_MISSING"] = 60] = "PROTOCOL_MISSING";
    ExitCode[ExitCode["INVALID_RETURN_MESSAGE"] = 61] = "INVALID_RETURN_MESSAGE";
    ExitCode[ExitCode["MANIFEST_ENTRY_MISSING"] = 62] = "MANIFEST_ENTRY_MISSING";
    ExitCode[ExitCode["SPAWN_VALIDATION_FAILED"] = 63] = "SPAWN_VALIDATION_FAILED";
    ExitCode[ExitCode["AUTONOMOUS_BOUNDARY"] = 64] = "AUTONOMOUS_BOUNDARY";
    ExitCode[ExitCode["HANDOFF_REQUIRED"] = 65] = "HANDOFF_REQUIRED";
    ExitCode[ExitCode["RESUME_FAILED"] = 66] = "RESUME_FAILED";
    ExitCode[ExitCode["CONCURRENT_SESSION"] = 67] = "CONCURRENT_SESSION";
    /**
     * E_THIN_AGENT_VIOLATION — A worker or lead agent attempted to spawn another
     * agent, violating the thin-agent inversion-of-control rule (ORC-012).
     * Only orchestrators may spawn subagents; non-orchestrator roles must
     * escalate via the playbook approval gate.
     *
     * @task T889 Orchestration Coherence v3
     * @task T907 Thin-agent enforcement
     */
    ExitCode[ExitCode["THIN_AGENT_VIOLATION"] = 68] = "THIN_AGENT_VIOLATION";
    /**
     * E_ATOMICITY_VIOLATION — A worker-role spawn was attempted for a task that
     * exceeds the atomicity budget (more than {@link MAX_WORKER_FILES} files) or
     * lacks an explicit file-scope declaration on its acceptance criteria.
     *
     * Workers MUST remain atomic (≤ 3 files with declared AC.files). Violations
     * should be split into child tasks or promoted to a lead role.
     *
     * @task T889 Orchestration Coherence v3
     * @task T894 Atomicity guard (W3-3)
     */
    ExitCode[ExitCode["ATOMICITY_VIOLATION"] = 69] = "ATOMICITY_VIOLATION";
    // === NEXUS ERRORS (70-79) ===
    ExitCode[ExitCode["NEXUS_NOT_INITIALIZED"] = 70] = "NEXUS_NOT_INITIALIZED";
    ExitCode[ExitCode["NEXUS_PROJECT_NOT_FOUND"] = 71] = "NEXUS_PROJECT_NOT_FOUND";
    ExitCode[ExitCode["NEXUS_PERMISSION_DENIED"] = 72] = "NEXUS_PERMISSION_DENIED";
    ExitCode[ExitCode["NEXUS_INVALID_SYNTAX"] = 73] = "NEXUS_INVALID_SYNTAX";
    ExitCode[ExitCode["NEXUS_SYNC_FAILED"] = 74] = "NEXUS_SYNC_FAILED";
    ExitCode[ExitCode["NEXUS_REGISTRY_CORRUPT"] = 75] = "NEXUS_REGISTRY_CORRUPT";
    ExitCode[ExitCode["NEXUS_PROJECT_EXISTS"] = 76] = "NEXUS_PROJECT_EXISTS";
    ExitCode[ExitCode["NEXUS_QUERY_FAILED"] = 77] = "NEXUS_QUERY_FAILED";
    ExitCode[ExitCode["NEXUS_GRAPH_ERROR"] = 78] = "NEXUS_GRAPH_ERROR";
    ExitCode[ExitCode["NEXUS_IMPACT_CRITICAL"] = 79] = "NEXUS_IMPACT_CRITICAL";
    // === LIFECYCLE ENFORCEMENT (80-84) ===
    ExitCode[ExitCode["LIFECYCLE_GATE_FAILED"] = 80] = "LIFECYCLE_GATE_FAILED";
    ExitCode[ExitCode["AUDIT_MISSING"] = 81] = "AUDIT_MISSING";
    ExitCode[ExitCode["CIRCULAR_VALIDATION"] = 82] = "CIRCULAR_VALIDATION";
    ExitCode[ExitCode["LIFECYCLE_TRANSITION_INVALID"] = 83] = "LIFECYCLE_TRANSITION_INVALID";
    ExitCode[ExitCode["PROVENANCE_REQUIRED"] = 84] = "PROVENANCE_REQUIRED";
    // === ARTIFACT PUBLISH (85-89) ===
    ExitCode[ExitCode["ARTIFACT_TYPE_UNKNOWN"] = 85] = "ARTIFACT_TYPE_UNKNOWN";
    ExitCode[ExitCode["ARTIFACT_VALIDATION_FAILED"] = 86] = "ARTIFACT_VALIDATION_FAILED";
    ExitCode[ExitCode["ARTIFACT_BUILD_FAILED"] = 87] = "ARTIFACT_BUILD_FAILED";
    ExitCode[ExitCode["ARTIFACT_PUBLISH_FAILED"] = 88] = "ARTIFACT_PUBLISH_FAILED";
    ExitCode[ExitCode["ARTIFACT_ROLLBACK_FAILED"] = 89] = "ARTIFACT_ROLLBACK_FAILED";
    // === PROVENANCE (90-94) ===
    ExitCode[ExitCode["PROVENANCE_CONFIG_INVALID"] = 90] = "PROVENANCE_CONFIG_INVALID";
    ExitCode[ExitCode["SIGNING_KEY_MISSING"] = 91] = "SIGNING_KEY_MISSING";
    ExitCode[ExitCode["SIGNATURE_INVALID"] = 92] = "SIGNATURE_INVALID";
    ExitCode[ExitCode["DIGEST_MISMATCH"] = 93] = "DIGEST_MISMATCH";
    ExitCode[ExitCode["ATTESTATION_INVALID"] = 94] = "ATTESTATION_INVALID";
    // === ADAPTER ERRORS (95-99) ===
    ExitCode[ExitCode["ADAPTER_NOT_FOUND"] = 95] = "ADAPTER_NOT_FOUND";
    ExitCode[ExitCode["ADAPTER_INIT_FAILED"] = 96] = "ADAPTER_INIT_FAILED";
    ExitCode[ExitCode["ADAPTER_HOOK_FAILED"] = 97] = "ADAPTER_HOOK_FAILED";
    ExitCode[ExitCode["ADAPTER_SPAWN_FAILED"] = 98] = "ADAPTER_SPAWN_FAILED";
    ExitCode[ExitCode["ADAPTER_INSTALL_FAILED"] = 99] = "ADAPTER_INSTALL_FAILED";
    // === SPECIAL CODES (100+) - NOT errors ===
    ExitCode[ExitCode["NO_DATA"] = 100] = "NO_DATA";
    ExitCode[ExitCode["ALREADY_EXISTS"] = 101] = "ALREADY_EXISTS";
    ExitCode[ExitCode["NO_CHANGE"] = 102] = "NO_CHANGE";
    ExitCode[ExitCode["TESTS_SKIPPED"] = 103] = "TESTS_SKIPPED";
    /**
     * E_DUPLICATE_TASK_LIKELY — `cleo add` was rejected because the new task's
     * title and description are semantically very similar (score >= 0.92) to one
     * or more active tasks detected by BRAIN-powered duplicate detection.
     *
     * Pass `--force-duplicate` to bypass; the bypass is audited to
     * `.cleo/audit/duplicate-bypass.jsonl` (ADR-051 pattern).
     *
     * @epic T1627
     * @task T1633
     */
    ExitCode[ExitCode["DUPLICATE_TASK_LIKELY"] = 105] = "DUPLICATE_TASK_LIKELY";
    // === LAFS ENVELOPE VALIDATION (Phase 6) ===
    /**
     * E_LAFS_VIOLATION — CLI output did not conform to the LAFS envelope
     * schema. Emitted by the CLI renderer middleware when `zod.parse()` on
     * the emitted envelope fails. This is an INTERNAL failure: CLEO itself
     * produced a malformed envelope.
     *
     * @task Phase 6 — LAFS formalization + schema consolidation
     */
    ExitCode[ExitCode["LAFS_VIOLATION"] = 104] = "LAFS_VIOLATION";
    // === DECISION VALIDATOR (106) ===
    /**
     * E_DECISION_VALIDATOR_FAILED — An ADR-typed decision write was rejected
     * by the LLM conflict-validator hook because the overall confidence score
     * fell below the configured threshold (`decisions.validatorConfidenceThreshold`,
     * default 0.7).
     *
     * The validator checks for collision, contradiction, and supersession-graph
     * integrity before allowing the write to proceed.  Callers should inspect
     * the error message for the specific violation details and either:
     *   (a) revise the decision / rationale to resolve conflicts, or
     *   (b) explicitly supersede the conflicting entry via `supersedes:` param.
     *
     * @task T1828
     */
    ExitCode[ExitCode["DECISION_VALIDATOR_FAILED"] = 106] = "DECISION_VALIDATOR_FAILED";
    /**
     * Lead session attempted to end without delegating any work — `delegate_task_count=0`
     * with `tasks_completed > 0`. Leads MUST fan out to Workers (T9230 / ADR-070).
     * @codeName E_LEAD_BYPASS_DETECTED
     * @task T9230
     */
    ExitCode[ExitCode["LEAD_BYPASS_DETECTED"] = 107] = "LEAD_BYPASS_DETECTED";
    /**
     * `cleo complete <tid>` was rejected because one or more acceptance criteria
     * on the task have no `evidence_ac_bindings` rows pointing at them. The
     * coverage gate is the load-bearing IVTR closure piece — every AC the task
     * declared MUST be backed by a `direct`, `satisfies`, or `coverage` binding
     * before completion is allowed.
     *
     * `error.details.unsatisfied` carries the list of offending ACs (each row
     * has `acId`, `alias` (`AC<n>`), and `text`). Recovery options:
     *   1. Add programmatic evidence that resolves the AC via `cleo verify` so
     *      a binding row is written.
     *   2. Pass `--waive-ac "<csv>" --waive-reason "<text>"` on `cleo complete`
     *      to record an audited waiver (`.cleo/audit/ac-waiver.jsonl`).
     *   3. Set `CLEO_OWNER_OVERRIDE=1` + `CLEO_OWNER_OVERRIDE_REASON=<text>` for
     *      a full bypass (logged to `.cleo/audit/force-bypass.jsonl`).
     *
     * @codeName E_AC_COVERAGE_INCOMPLETE
     * @task T10509
     * @saga T10377 (SG-IVTR-AC-BINDING)
     * @adr ADR-079-r4
     */
    ExitCode[ExitCode["AC_COVERAGE_INCOMPLETE"] = 108] = "AC_COVERAGE_INCOMPLETE";
    /**
     * E_CANCELLED_CHILD_NO_WAIVER — `cleo complete <parentId>` was rejected
     * because the parent has one or more `cancelled` children that have NOT been
     * waived or replaced. A cancelled child represents work that was NOT done;
     * silently treating it as satisfied lets a parent complete as if cancelled
     * work had shipped (PM-Core V2 design-point 4 — agent-trust completion).
     *
     * `error.details.cancelledChildIds` lists the offending children. Recovery:
     *   1. Record an audited waiver for the cancelled children via
     *      `cleo complete <parentId> --waive-cancelled-children "<reason>"`
     *      (logged to `.cleo/audit/cancelled-child-waiver.jsonl`).
     *   2. Re-open and finish the work (the child stops being cancelled).
     *   3. Replace the cancelled work with a new done child and waive the
     *      original, citing the replacement task id in the reason.
     *
     * @codeName E_CANCELLED_CHILD_NO_WAIVER
     * @saga T10538 (PM-Core V2 agent-trust)
     */
    ExitCode[ExitCode["CANCELLED_CHILD_NO_WAIVER"] = 109] = "CANCELLED_CHILD_NO_WAIVER";
})(ExitCode || (ExitCode = {}));
// ---------------------------------------------------------------------------
// Release pipeline v2 error code names (SPEC-T9345 §4.7)
//
// String-valued error codes emitted by the new release verbs (plan, open,
// reconcile, rollback). These are the `code` field of EngineErrorPayload;
// the numeric exit code is the bucket the verb resolves to (per SPEC §4.7).
//
// @task T9525
// @epic T9492
// @spec .cleo/rcasd/T9345/research/SPEC-T9345-release-pipeline-v2.md §4.7
// ---------------------------------------------------------------------------
/** Dirty version files block `cleo release plan` (R-020). Exit code 13. */
export const E_DIRTY_TREE = 'E_DIRTY_TREE';
/** Epic referenced by `--epic` has zero children (R-021). Exit code 4. */
export const E_EPIC_EMPTY = 'E_EPIC_EMPTY';
/** Epic referenced by `--epic` does not exist (R-021). Exit code 10. */
export const E_EPIC_NOT_FOUND = 'E_EPIC_NOT_FOUND';
/**
 * Leaf-Epic-as-Task ship (`--epic <id>` where the Epic has zero non-cancelled
 * child tasks) was attempted but the Epic itself carries zero ADR-051 evidence
 * atoms. Per ADR-073 the leaf-Epic-as-PR pattern is canonical for atomic ships,
 * but the Epic still needs evidence (commit:sha, files, pr:<num>, etc.) to
 * be promoted into a release. Exit code 83. `error.details.epicId` reports
 * the offending Epic. `error.details.fix` points at `cleo verify`.
 *
 * @task T9838
 */
export const E_EPIC_EMPTY_LEAF_NO_EVIDENCE = 'E_EPIC_EMPTY_LEAF_NO_EVIDENCE';
/** Channel + version scheme are incompatible (R-022). Exit code 6. */
export const E_CHANNEL_MISMATCH = 'E_CHANNEL_MISMATCH';
/**
 * One or more tasks in the plan are missing required ADR-051 evidence atoms
 * (R-301 / R-310). Exit code 83. `error.details.tasks[]` lists offenders.
 */
export const E_EVIDENCE_INSUFFICIENT = 'E_EVIDENCE_INSUFFICIENT';
/** Plan file at `.cleo/release/<version>.plan.json` is absent. Exit code 4. */
export const E_PLAN_NOT_FOUND = 'E_PLAN_NOT_FOUND';
/** Generic release-plan validation failure (e.g. schema). Exit code 6. */
export const E_RELEASE_PLAN_INVALID = 'E_RELEASE_PLAN_INVALID';
/**
 * `cleo release plan` (or the lint script) encountered a `.changeset/*.md`
 * file whose YAML frontmatter cannot be parsed. Exit code 6 (VALIDATION_ERROR).
 *
 * Replaces the pre-T10105 silent-skip that caused the v2026.5.100 ship to
 * lose v5.100/v5.101/v5.103 CHANGELOG entries when a single changeset had
 * an unquoted colon in `summary:`.
 *
 * @task T10105
 * @epic E-RELEASE-PLAN-CHANGELOG
 * @saga T10099
 */
export const E_CHANGESET_YAML_INVALID = 'E_CHANGESET_YAML_INVALID';
/**
 * Release row exists but is not in the status FSM state required by the
 * caller (R-051 — `cleo release open` requires status='planned'). Exit code 6.
 * `error.details.currentStatus` MUST report the actual status; `error.details.expectedStatus`
 * SHOULD list the accepted state(s).
 *
 * @task T9530
 */
export const E_INVALID_STATE = 'E_INVALID_STATE';
/**
 * `gh auth status` exited non-zero (R-052). The GitHub CLI is either not
 * installed or not authenticated for the active hostname. Exit code 5.
 *
 * @task T9530
 */
export const E_GH_NOT_AUTHENTICATED = 'E_GH_NOT_AUTHENTICATED';
/**
 * The expected GitHub Actions workflow file is missing under `.github/workflows/`
 * (R-053). Without it, `gh workflow run` would fail with a non-recoverable error.
 * Exit code 4.
 *
 * @task T9530
 */
export const E_WORKFLOW_NOT_FOUND = 'E_WORKFLOW_NOT_FOUND';
/**
 * E_WRITE_CONTENTION — Persistent SQLITE_BUSY after exhausting application-level
 * retry. Emitted by {@link withWriteRetry} (in `@cleocode/core`'s
 * `store/with-retry.ts`) when a SQLite write transaction fails 4 consecutive
 * attempts with `SQLITE_BUSY: database is locked` despite the engine-level
 * `busy_timeout=30000ms` pragma.
 *
 * **Recovery**: retry the operation after a brief delay (the contended writer
 * usually commits within 1-2 seconds). If the error reoccurs reliably, suspect
 * a long-running writer holding a RESERVED lock — inspect with
 * `sqlite3 .cleo/tasks.db "PRAGMA wal_checkpoint(FULL); SELECT * FROM sqlite_lock;"`.
 *
 * Maps to {@link ExitCode.LOCK_TIMEOUT} (7) at the CLI boundary.
 *
 * @bug gh-391 — parallel `cleo update --add-labels` losing ~50% of writes.
 * @task T9839
 */
export const E_WRITE_CONTENTION = 'E_WRITE_CONTENTION';
/**
 * E_INVALID_SEVERITY_VALUE — `--severity` was passed a value that is not one
 * of the canonical {@link TASK_SEVERITIES} members (`P0|P1|P2|P3`).
 *
 * Returned by the `cleo add` and `cleo update` CLI commands at the dispatch
 * boundary BEFORE the request reaches the database. Replaces the previous
 * late-stage failure mode where SQLite surfaced a cryptic
 * `CHECK constraint failed: severity` error after the write attempt.
 *
 * Maps to {@link ExitCode.VALIDATION_ERROR} (6) at the CLI boundary.
 *
 * @task T10341
 * @epic T10327
 * @saga T10326
 */
export const E_INVALID_SEVERITY_VALUE = 'E_INVALID_SEVERITY_VALUE';
/**
 * E_INVALID_PIPELINE_STAGE — `--pipeline-stage` was passed a value that
 * either (a) is not a recognised stage name in the canonical RCASD-IVTR+C
 * pipeline (`research|consensus|architecture_decision|specification|`
 * `decomposition|implementation|validation|testing|release|contribution|`
 * `cancelled`), or (b) would move the task BACKWARD relative to its
 * current stage. Pipeline stages are forward-only.
 *
 * Returned by the `cleo update` CLI command at the dispatch boundary BEFORE
 * the request reaches the database. Replaces the previous late-stage
 * failure mode where SQLite surfaced a cryptic
 * `CHECK constraint failed: pipeline_stage` error or the core engine threw
 * an opaque {@link CleoError} after a partial round-trip.
 *
 * Maps to {@link ExitCode.VALIDATION_ERROR} (6) at the CLI boundary.
 *
 * @task T10341
 * @epic T10327
 * @saga T10326
 */
export const E_INVALID_PIPELINE_STAGE = 'E_INVALID_PIPELINE_STAGE';
/**
 * E_AC_COVERAGE_INCOMPLETE — `cleo complete <tid>` was rejected because at
 * least one acceptance criterion on the task has no `evidence_ac_bindings`
 * row. The coverage gate is the load-bearing IVTR closure piece — every AC
 * the task declared MUST be backed by a binding (`direct`, `satisfies`, or
 * `coverage`) before completion is allowed.
 *
 * `error.details.unsatisfied` carries the offending ACs (each entry has
 * `acId`, `alias`, and `text`). Recovery options live on the {@link ExitCode.AC_COVERAGE_INCOMPLETE}
 * JSDoc.
 *
 * Maps to {@link ExitCode.AC_COVERAGE_INCOMPLETE} (108) at the CLI boundary.
 *
 * @task T10509
 * @saga T10377 (SG-IVTR-AC-BINDING)
 * @adr ADR-079-r4
 */
export const E_AC_COVERAGE_INCOMPLETE = 'E_AC_COVERAGE_INCOMPLETE';
/**
 * E_CWD_WALKUP_FORBIDDEN — `getCleoDirAbsolute(cwd)` was called while
 * `CLEO_PATHS_STRICT=1` is set. The caller MUST migrate to
 * `resolveProjectByCwd(cwd)` + `resolveCanonicalCleoDir(projectId)`
 * instead of relying on CWD-walk-up path resolution.
 *
 * This is the enforcement mechanism for the T10297 migration — once all
 * callers are migrated, the strict gate will be made the default and
 * `getCleoDirAbsolute` will be removed entirely.
 *
 * `error.details.fix` carries the exact migration commands.
 *
 * Maps to {@link ExitCode.CONFIG_ERROR} (8) at the CLI boundary.
 *
 * @task T11022
 * @epic T10296
 * @saga T10295
 */
export const E_CWD_WALKUP_FORBIDDEN = 'E_CWD_WALKUP_FORBIDDEN';
/** Check if an exit code represents an error (1-99). */
export function isErrorCode(code) {
    return code >= 1 && code < 100;
}
/** Check if an exit code represents success (0 or 100+). */
export function isSuccessCode(code) {
    return code === 0 || code >= 100;
}
/** Check if an exit code indicates no change (idempotent operation). */
export function isNoChangeCode(code) {
    return code === ExitCode.NO_CHANGE;
}
/** Check if an exit code is recoverable (retry may succeed). */
export function isRecoverableCode(code) {
    const nonRecoverable = new Set([
        ExitCode.FILE_ERROR,
        ExitCode.DEPENDENCY_ERROR,
        ExitCode.CIRCULAR_REFERENCE,
        ExitCode.CASCADE_FAILED,
        ExitCode.SESSION_CLOSE_BLOCKED,
        ExitCode.VERIFICATION_LOCKED,
        ExitCode.CONTEXT_WARNING,
        ExitCode.CONTEXT_CAUTION,
        ExitCode.CONTEXT_CRITICAL,
        ExitCode.CONTEXT_EMERGENCY,
        ExitCode.CONTEXT_STALE,
        ExitCode.AUTONOMOUS_BOUNDARY,
        ExitCode.HANDOFF_REQUIRED,
        ExitCode.NEXUS_PERMISSION_DENIED,
        ExitCode.NEXUS_REGISTRY_CORRUPT,
        ExitCode.CIRCULAR_VALIDATION,
        ExitCode.LIFECYCLE_TRANSITION_INVALID,
        ExitCode.ARTIFACT_TYPE_UNKNOWN,
        ExitCode.ARTIFACT_ROLLBACK_FAILED,
        ExitCode.DIGEST_MISMATCH,
    ]);
    if (!isErrorCode(code))
        return false;
    return !nonRecoverable.has(code);
}
/** Human-readable name for an exit code. */
export function getExitCodeName(code) {
    return ExitCode[code] ?? 'UNKNOWN';
}
//# sourceMappingURL=exit-codes.js.map