"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.COMMAND_CAPABILITY_REGISTRY = exports.COMMAND_DESCRIPTOR_REGISTRY = exports.PLANNING_ADVANCEMENT_INTENT_PHRASES = exports.SOURCE_SPEC_REVIEW_REFINEMENT_INTENT_PHRASES = exports.SOURCE_SPEC_ONLY_INTENT_PHRASES = exports.NO_WRITE_EVIDENCE_SEVERITIES = exports.LIFECYCLE_RUN_CAPTURE_GLOBAL_OPTIONS = exports.COMMAND_CAPABILITY_TOKENS = void 0;
exports.normalizeCommandCapability = normalizeCommandCapability;
exports.normalizeCommandCapabilityRegistry = normalizeCommandCapabilityRegistry;
exports.findCommandCapability = findCommandCapability;
exports.getCommandDescriptorRegistry = getCommandDescriptorRegistry;
exports.getRegisteredCommandDescriptor = getRegisteredCommandDescriptor;
exports.getCommandCapabilityRegistry = getCommandCapabilityRegistry;
exports.getRegisteredCommandCapability = getRegisteredCommandCapability;
exports.createNoWriteBoundaryEvidence = createNoWriteBoundaryEvidence;
exports.createNoWriteRecommendation = createNoWriteRecommendation;
exports.createNoWriteFindingEvidenceDetails = createNoWriteFindingEvidenceDetails;
exports.classifySourceSpecLifecycleIntent = classifySourceSpecLifecycleIntent;
exports.createSourceSpecLifecycleGateEvidenceDetails = createSourceSpecLifecycleGateEvidenceDetails;
const command_descriptors_1 = require("./command-descriptors");
const command_descriptor_projections_1 = require("./command-descriptor-projections");
const command_availability_1 = require("./command-availability");
const cli_constants_1 = require("../config/cli-constants");
const command_capability_evidence_1 = require("./command-capability-evidence");
exports.COMMAND_CAPABILITY_TOKENS = [
    "read",
    "validation",
    "review",
    "navigation",
    "list",
    "inspection",
    "scaffold",
    "update",
    "build",
    "sync",
    "migration",
    "install",
    "materialize",
    "release",
    "cleanup"
];
exports.LIFECYCLE_RUN_CAPTURE_GLOBAL_OPTIONS = [
    "--run-directory",
    "--run-gate",
    "--run-artifact"
];
exports.NO_WRITE_EVIDENCE_SEVERITIES = ["blocker", "warning", "informational"];
exports.SOURCE_SPEC_ONLY_INTENT_PHRASES = [
    "create spec",
    "capture spec",
    "draft spec",
    "revise spec",
    "update spec"
];
exports.SOURCE_SPEC_REVIEW_REFINEMENT_INTENT_PHRASES = [
    "review",
    "navigation",
    "second pass",
    "harden",
    "hardening",
    "improve",
    "improvement",
    "completeness"
];
exports.PLANNING_ADVANCEMENT_INTENT_PHRASES = [
    "plan from spec",
    "create slice",
    "start planning",
    "create next planning layer",
    "scaffold slice"
];
const READ_ONLY_BOUNDARY = "Reports local command evidence only and writes no files.";
function readCommand(command, capability, artifactFamily, summary, noWriteBoundary = READ_ONLY_BOUNDARY) {
    return (0, command_descriptors_1.defineCommandDescriptor)({
        command,
        capability,
        summary,
        writeCapable: false,
        artifactFamily,
        noWriteBoundary
    });
}
function writeCommand(command, capability, artifactFamily, destinationPosture, targetPathPosture, coordinationScope, mutationPosture, summary) {
    return (0, command_descriptors_1.defineCommandDescriptor)({
        command,
        capability,
        summary,
        writeCapable: true,
        artifactFamily,
        destinationPosture,
        targetPathPosture,
        coordinationScope,
        mutationPosture
    });
}
function withInvocation(descriptor, inputs, argv) {
    return {
        ...descriptor,
        inputs,
        examples: [{ description: descriptor.summary, argv }]
    };
}
const BASE_COMMAND_DESCRIPTOR_REGISTRATIONS = [
    readCommand("agent", "read", "agent-orientation", "Reports automation-agent orientation, command boundaries, and lifecycle guidance."),
    readCommand("agent orient", "read", "agent-orientation", "Runs the full agent orientation alias."),
    readCommand("agent remind", "read", "agent-orientation", "Runs the correction-focused agent reminder alias."),
    withInvocation({
        ...readCommand("agent context", "navigation", "agent-orientation", "Returns bounded context for one explicit specification/planning artifact or stored planning selection."),
        coordinationScope: "selected-artifact",
        selectionRequired: true
    }, [
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional existing repository-relative specification or planning artifact." },
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local selection session name." },
        { kind: "option", name: "intent", required: false, variadic: false, defaultValue: null, validation: "Optional printable intent up to 256 characters." },
        { kind: "option", name: "includeContextPack", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean flag enabling the default-capped relevance-ranked context pack." },
        { kind: "option", name: "contextPackBudget", valueType: "integer", required: false, variadic: false, defaultValue: null, validation: "Integer from 1024 to 65536; requires includeContextPack." }
    ], ["day-shift", "agent", "context", "--artifact", ".day-shift/planning/example/task-definition.md", "--format", "json", "--detail", "compact"]),
    readCommand("about", "inspection", "configuration", "Reports runtime and package context."),
    withInvocation(writeCommand("apply", "update", "planning", "selected-existing-artifact", "exact repository-local mutation plan receipt intended paths plus receipt-consumption evidence", "workspace", "applies-transaction", "Explicitly applies one digest-bound, revision-checked mutation plan receipt without retranscribing its mutation arguments."), [
        { kind: "option", name: "receipt", required: true, variadic: false, defaultValue: null, validation: "Repository-relative .day-shift/runs/run-*/...json mutation plan receipt." },
        { kind: "option", name: "expectCommand", required: true, variadic: false, defaultValue: null, validation: "Exact originating command identity expected in the digest-bound receipt." },
        { kind: "option", name: "appliedAt", required: false, variadic: false, defaultValue: null, validation: "Optional explicit ISO-8601 apply time used for deterministic evidence." }
    ], ["day-shift", "apply", "--receipt", ".day-shift/runs/run-example/plans/plan.json", "--expect-command", "task close", "--format", "json"]),
    readCommand("completion", "inspection", "completion", "Prints shell completion setup guidance."),
    readCommand("completion complete", "inspection", "completion", "Resolves shell completion candidates without executing target commands."),
    writeCommand("completion install", "install", "completion", "local-install-target", "shell completion integration file", "local-installation", "installs-local-files", "Installs Day Shift-managed shell completion integration."),
    readCommand("completion script", "inspection", "completion", "Prints a sourceable shell completion script."),
    writeCommand("completion uninstall", "cleanup", "completion", "local-install-target", "shell completion integration file", "local-installation", "prunes-generated-output", "Removes Day Shift-managed shell completion integration."),
    readCommand("commands", "inspection", "configuration", "Groups command inventory and command-surface metadata reports."),
    readCommand("commands inventory", "inspection", "configuration", "Reports callable command inventory merged with command capability metadata."),
    {
        ...readCommand("commands search", "navigation", "configuration", "Searches authoritative command descriptors with bounded deterministic results."),
        inputs: [
            { kind: "argument", name: "query", required: false, variadic: false, defaultValue: null, validation: "Shell query is optional at parse time; shell or structured input must supply a non-empty query." },
            { kind: "option", name: "maxResults", required: false, variadic: false, defaultValue: 10, validation: "Integer from 1 to 50." },
            { kind: "option", name: "includeNoncallable", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean inspection flag for descriptors outside the executable intersection." }
        ],
        examples: [{ description: "Search command descriptors by intent or posture.", argv: ["day-shift", "commands", "search", "planning", "--format", "json"] }]
    },
    {
        ...readCommand("commands describe", "inspection", "configuration", "Describes one exact authoritative command descriptor."),
        inputs: [{ kind: "argument", name: "command", required: false, variadic: true, defaultValue: null, validation: "Shell command path is optional at parse time; shell or structured input must supply an exact registered command." }],
        examples: [{ description: "Describe one command descriptor.", argv: ["day-shift", "commands", "describe", "task", "update", "--format", "json"] }]
    },
    {
        ...readCommand("commands manifest", "inspection", "configuration", "Generates native tool descriptors from the authoritative command registry."),
        inputs: [
            { kind: "argument", name: "command", required: false, variadic: true, defaultValue: null, validation: "Optional exact registered command path." },
            { kind: "option", name: "includeNoncallable", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean inspection flag for descriptors outside the executable intersection." }
        ],
        examples: [{ description: "Generate one native tool descriptor.", argv: ["day-shift", "commands", "manifest", "task", "update", "--format", "json"] }]
    },
    readCommand("commands validate", "validation", "configuration", "Validates authoritative descriptors against the live command tree and generated tool manifest."),
    {
        ...readCommand("commands repair", "inspection", "configuration", "Returns bounded descriptor-native command corrections without invoking a proposed command.", "Inspects authoritative descriptors and bounded repository-local path evidence only; it never invokes a proposal or writes files."),
        inputs: [
            { kind: "argument", name: "argv", required: false, variadic: true, defaultValue: null, validation: "Rejected command argv supplied after --; shell or structured input must provide at least one token." }
        ],
        examples: [{
                description: "Repair rejected command argv without invoking the proposed command.",
                argv: ["day-shift", "commands", "repair", "--", "commands", "search", "--query", "planning", "--format", "json"]
            }]
    },
    readCommand("config", "inspection", "configuration", "Reports resolved Day Shift configuration."),
    withInvocation(readCommand("config get", "inspection", "configuration", "Shows resolved configuration values."), [
        { kind: "argument", name: "selector", required: false, variadic: false, defaultValue: null, validation: "Optional exact config key or supported config family." },
        { kind: "option", name: "project", required: false, variadic: false, defaultValue: null, validation: "Optional declared monorepo project id; explicit selection overrides current-directory inference." }
    ], ["day-shift", "config", "get", "workflow", "--project", "app", "--format", "json"]),
    withInvocation(readCommand("config inventory", "inspection", "configuration", "Reports catalog-backed configuration inventory without writing files."), [
        { kind: "option", name: "licenseFile", required: false, variadic: false, defaultValue: null, validation: "Optional repository-relative license evidence path for this read-only run." },
        { kind: "option", name: "project", required: false, variadic: false, defaultValue: null, validation: "Optional declared monorepo project id; explicit selection overrides current-directory inference." }
    ], ["day-shift", "config", "inventory", "--project", "app", "--format", "json"]),
    writeCommand("config set", "update", "configuration", "workspace-metadata", ".day-shift local configuration", "workspace", "updates-selected-artifact", "Sets writable configuration values."),
    withInvocation(readCommand("doctor", "inspection", "doctor", "Reports repository-wide or explicitly scoped read-only workspace health findings."), [
        { kind: "option", name: "runtimeOnly", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Mutually exclusive runtime/setup-only scope selector." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Mutually exclusive existing repository-relative specification or planning Markdown artifact." },
        { kind: "option", name: "planningDirectory", required: false, variadic: false, defaultValue: null, validation: "Mutually exclusive existing repository-relative directory inside the configured planning root." },
        { kind: "option", name: "scanSurface", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Mutually exclusive bounded read-only workspace scan-surface selector." },
        { kind: "option", name: "scanPath", required: false, variadic: false, defaultValue: null, validation: "Existing repository-relative directory; requires scanSurface." },
        { kind: "option", name: "repositoryAudit", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit repository-wide audit selector; also the default when no selector is supplied, or a deeper budget modifier for --scan-surface." },
        { kind: "option", name: "action", required: false, variadic: false, defaultValue: null, validation: "Optional exact authoritative command descriptor identity used to classify current-action blockers." }
    ], ["day-shift", "doctor", "--runtime-only", "--format", "json"]),
    writeCommand("ignore", "install", "ignore", "local-install-target", ".gitignore or local ignore destination", "local-installation", "installs-local-files", "Installs Day Shift ignore rules."),
    writeCommand("ignore install", "install", "ignore", "local-install-target", ".gitignore or local ignore destination", "local-installation", "installs-local-files", "Installs canonical Day Shift local-only ignore entries."),
    withInvocation(readCommand("ignore explain", "inspection", "ignore", "Explains the canonical ignore-policy decision and winning evidence for one workspace-relative path."), [
        { kind: "argument", name: "path", required: true, variadic: false, defaultValue: null, validation: "Workspace-relative path that must remain inside the effective workspace." },
        { kind: "option", name: "include", required: false, variadic: true, defaultValue: [], validation: "Repeatable highest-precedence inclusion override pattern." },
        { kind: "option", name: "exclude", required: false, variadic: true, defaultValue: [], validation: "Repeatable highest-precedence exclusion override pattern." },
        { kind: "option", name: "ignoreFile", required: false, variadic: false, defaultValue: null, validation: "Optional workspace-relative ignore-file evidence path." }
    ], ["day-shift", "ignore", "explain", "src/index.ts", "--format", "json"]),
    readCommand("ignore integration", "inspection", "ignore", "Groups target-specific ignore integration preview and explicit apply actions."),
    withInvocation(readCommand("ignore integration preview", "inspection", "ignore", "Previews exact target-specific ignore mutations without writing editor settings or Day Shift state."), [
        { kind: "option", name: "target", required: true, variadic: false, defaultValue: null, validation: "Supported target token: vscode." }
    ], ["day-shift", "ignore", "integration", "preview", "--target", "vscode", "--format", "json"]),
    withInvocation(writeCommand("ignore integration apply", "update", "ignore", "selected-existing-artifact", ".vscode/settings.json", "selected-artifact", "updates-selected-artifact", "Applies previewed target-specific ignore mutations with explicit preconditions and recovery evidence."), [
        { kind: "option", name: "target", required: true, variadic: false, defaultValue: null, validation: "Supported target token: vscode." },
        { kind: "option", name: "policyId", required: true, variadic: false, defaultValue: null, validation: "Exact policy identity from preview." },
        { kind: "option", name: "preconditionSha256", required: true, variadic: false, defaultValue: null, validation: "Exact lowercase SHA-256 from preview." },
        { kind: "option", name: "preconditionBytes", required: true, variadic: false, defaultValue: null, validation: "Exact target byte length from preview." },
        { kind: "option", name: "preconditionExists", required: true, variadic: false, defaultValue: null, validation: "Exact target existence boolean from preview." }
    ], ["day-shift", "ignore", "integration", "apply", "--target", "vscode", "--policy-id", "ignore-policy-v1", "--precondition-sha256", "<sha256>", "--precondition-bytes", "<bytes>", "--precondition-exists", "<boolean>", "--format", "json"]),
    writeCommand("init", "scaffold", "configuration", "canonical-artifact", ".day-shift/ workspace scaffold", "workspace", "creates-artifacts", "Initializes a Day Shift workspace."),
    readCommand("license", "inspection", "license", "Groups license install, status, and reminder cleanup surfaces."),
    writeCommand("license cleanup-reminders", "cleanup", "license", "derived-state", "license reminder state", "workspace", "prunes-generated-output", "Cleans obsolete license reminder state."),
    writeCommand("license install", "install", "license", "local-install-target", "local license file", "local-installation", "installs-local-files", "Installs a Day Shift license locally."),
    readCommand("license status", "inspection", "license", "Inspects local license status and guidance."),
    readCommand("link", "inspection", "validation", "Groups trace-link lifecycle disposition management surfaces."),
    readCommand("link disposition", "inspection", "validation", "Groups trace-link disposition read and write surfaces."),
    writeCommand("link disposition add", "update", "validation", "derived-state", ".day-shift/state/trace-link-dispositions.json", "workspace", "updates-derived-state", "Creates trace-link lifecycle disposition records."),
    writeCommand("link disposition apply", "migration", "validation", "workspace-metadata", "planning trace fields and disposition storage", "workspace", "applies-migration", "Applies migrated trace-link disposition updates."),
    writeCommand("link disposition delete", "update", "validation", "derived-state", ".day-shift/state/trace-link-dispositions.json", "workspace", "updates-derived-state", "Deletes trace-link lifecycle disposition records."),
    readCommand("link disposition list", "inspection", "validation", "Lists trace-link disposition records without writing files."),
    readCommand("link disposition preview", "validation", "validation", "Previews affected planning trace links for recorded dispositions without writing files."),
    readCommand("link disposition show", "inspection", "validation", "Shows one trace-link disposition record without writing files."),
    writeCommand("link disposition update", "update", "validation", "derived-state", ".day-shift/state/trace-link-dispositions.json", "workspace", "updates-derived-state", "Updates trace-link lifecycle disposition records."),
    withInvocation(writeCommand("link materialize", "materialize", "planning", "selected-existing-artifact", "selected slice, phase, milestone, task, summary, reconciliation, or planning directory Markdown body references", "selected-artifact", "updates-selected-artifact", "Materializes validated local Markdown body references as clickable navigation links."), [
        { kind: "option", name: "scope", required: false, variadic: false, defaultValue: "planning", validation: "Currently planning." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional repository-relative selected Markdown artifact or directory; required for write execution." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Preview candidates without writing." },
        { kind: "option", name: "write", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Apply safe selected-artifact materialization." },
        { kind: "option", name: "validationEvidenceId", required: false, variadic: false, defaultValue: null, validation: "Exact revision-bound validation evidence identity required for candidate writes." },
        { kind: "option", name: "format", required: false, variadic: false, defaultValue: "text", validation: "text or json." }
    ], ["day-shift", "link", "materialize", "--dry-run", "--artifact", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    readCommand("spec", "inspection", "spec-registry", "Groups spec registry read and write surfaces."),
    readCommand("spec source", "inspection", "spec-registry", "Groups append-only spec source transition surfaces."),
    withInvocation({
        ...writeCommand("spec source add", "update", "spec-registry", "selected-existing-artifact", cli_constants_1.CLI_SPEC_INDEX_PATH, "selected-family", "updates-selected-artifact", "Appends the current source to history and atomically installs a new source reference."),
        semantics: {
            conditionalInputs: [],
            dependentInputs: [],
            conflictingInputs: [],
            mutableFields: ["source.ref", "source_history", "updated_at"],
            genericGuards: [{
                    id: "append-only-source-reference",
                    description: "The previous source is appended to chronological history before the current ref changes."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [],
            exactExamples: [[
                    "day-shift", "spec", "source", "add", "--id", "spec-registry-commands",
                    "--ref", "revised-spec.md", "--reason", "Replace superseded source reference"
                ]]
        }
    }, [
        { kind: "option", name: "id", required: true, variadic: false, defaultValue: null, validation: "Existing spec registry entry id." },
        { kind: "option", name: "ref", required: true, variadic: false, defaultValue: null, validation: "New non-empty source reference." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Reviewable non-empty transition reason." }
    ], [
        "day-shift", "spec", "source", "add", "--id", "spec-registry-commands",
        "--ref", "revised-spec.md", "--reason", "Replace superseded source reference"
    ]),
    writeCommand("spec add", "update", "spec-registry", "selected-existing-artifact", cli_constants_1.CLI_SPEC_INDEX_PATH, "selected-family", "updates-selected-artifact", "Adds a spec registry entry."),
    writeCommand("spec archive", "update", "spec-registry", "selected-existing-artifact", cli_constants_1.CLI_SPEC_INDEX_PATH, "selected-family", "updates-selected-artifact", "Archives a spec registry entry."),
    withInvocation({
        ...writeCommand("spec unlink", "update", "spec-registry", "selected-existing-artifact", cli_constants_1.CLI_SPEC_INDEX_PATH, "selected-family", "updates-selected-artifact", "Removes stale optional linked-slice metadata while preserving spec and planning history."),
        semantics: {
            conditionalInputs: [],
            dependentInputs: [],
            conflictingInputs: [],
            mutableFields: ["linked_slice", "updated_at"],
            genericGuards: [{
                    id: "optional-link-only",
                    description: "Removes only optional linked_slice metadata while preserving spec identity, source history, lifecycle status, and planning artifacts."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [],
            exactExamples: [["day-shift", "spec", "unlink", "emergent-example"]]
        }
    }, [
        { kind: "argument", name: "id", required: true, variadic: false, defaultValue: null, validation: "Registered spec id with existing linked_slice metadata." }
    ], ["day-shift", "spec", "unlink", "emergent-example"]),
    withInvocation(writeCommand("spec create", "scaffold", "spec-registry", "canonical-artifact", `.day-shift/specs/<implementation-order>-<id>/<id>.md and ${cli_constants_1.CLI_SPEC_INDEX_PATH}`, "selected-family", "creates-artifacts", "Previews or creates a numbered canonical planning-optional draft specification and registry entry."), [
        { kind: "option", name: "title", required: false, variadic: false, defaultValue: null, validation: "Required for flag authoring; optional import override." },
        { kind: "option", name: "specId", required: false, variadic: false, defaultValue: null, validation: "Optional lowercase hyphen-separated identity." },
        { kind: "option", name: "implementationOrder", required: true, variadic: false, defaultValue: null, validation: "Required positive order rendered with at least two digits, or 'next' for the lowest unused order." },
        { kind: "option", name: "source", required: false, variadic: true, defaultValue: [], validation: "Repeatable source reference." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews identity and writes without mutation." },
        { kind: "option", name: "markdownFile", required: false, variadic: false, defaultValue: null, validation: "Complete Markdown input; conflicts with other authoring modes." },
        { kind: "option", name: "inputFile", required: false, variadic: false, defaultValue: null, validation: "Structured JSON or bounded YAML; conflicts with other authoring modes." },
        { kind: "option", name: "stdin", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Reads Markdown, JSON, or bounded YAML from stdin." },
        { kind: "option", name: "interactive", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Text-only bounded TTY prompts for title and purpose." },
        { kind: "option", name: "purpose", required: false, variadic: false, defaultValue: null, validation: "Canonical Purpose narrative." },
        { kind: "option", name: "problemStatement", required: false, variadic: false, defaultValue: null, validation: "Canonical Problem Statement narrative." },
        { kind: "option", name: "desiredOutcome", required: false, variadic: true, defaultValue: [], validation: "Repeatable canonical Desired Outcome item." },
        { kind: "option", name: "nonGoal", required: false, variadic: true, defaultValue: [], validation: "Repeatable canonical Non-Goal item." },
        { kind: "option", name: "scope", required: false, variadic: true, defaultValue: [], validation: "Repeatable canonical Scope item." },
        { kind: "option", name: "constraint", required: false, variadic: true, defaultValue: [], validation: "Repeatable canonical Constraint item." },
        { kind: "option", name: "successCriterion", required: false, variadic: true, defaultValue: [], validation: "Repeatable canonical Success Criterion item." },
        { kind: "option", name: "openQuestion", required: false, variadic: true, defaultValue: [], validation: "Repeatable canonical Open Questions item; use an explicit none marker when resolved." },
        { kind: "option", name: "summary", required: false, variadic: false, defaultValue: null, validation: "Deprecated Day Shift 0.2.0 compatibility alias for purpose." },
        { kind: "option", name: "problem", required: false, variadic: false, defaultValue: null, validation: "Deprecated Day Shift 0.2.0 compatibility alias for problemStatement." },
        { kind: "option", name: "goal", required: false, variadic: true, defaultValue: [], validation: "Deprecated Day Shift 0.2.0 repeatable compatibility alias for desiredOutcome." },
        { kind: "option", name: "risk", required: false, variadic: true, defaultValue: [], validation: "Deprecated Day Shift 0.2.0 repeatable compatibility input retained under Constraints." }
    ], ["day-shift", "spec", "create", "--implementation-order", "next", "--title", "Example specification", "--purpose", "Define one canonical specification contract.", "--problem-statement", "Specification surfaces can drift.", "--desired-outcome", "Align authoring and review.", "--non-goal", "Create downstream work.", "--scope", "Specification lifecycle surfaces.", "--constraint", "Preserve supported compatibility inputs.", "--success-criterion", "Review recommends ready.", "--open-question", "None currently.", "--dry-run", "--format", "json"]),
    withInvocation(writeCommand("spec disposition", "update", "spec-registry", "canonical-artifact", "specification sibling planning-readiness.md and reviews/<review-id>.json", "selected-family", "updates-selected-artifact", "Previews or applies explicit revision-bound specification planning-readiness evidence."), [
        { kind: "option", name: "spec", required: true, variadic: false, defaultValue: null, validation: "Existing repository-relative canonical path registered in the spec index." },
        { kind: "option", name: "planningReadiness", required: true, variadic: false, defaultValue: null, validation: "One of ready, waived, or revoked." },
        { kind: "option", name: "reviewResult", required: false, variadic: false, defaultValue: null, validation: "Complete repository-local UTF-8 JSON review result; required only for ready." },
        { kind: "option", name: "reviewDigest", required: false, variadic: false, defaultValue: null, validation: "Optional expected canonical SHA-256 review digest; valid only for ready." },
        { kind: "option", name: "reason", required: false, variadic: false, defaultValue: null, validation: "Required for waived and revoked; optional for ready." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty disposition actor and waiver actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 disposition time and waiver time." },
        { kind: "option", name: "waiverId", required: false, variadic: false, defaultValue: null, validation: "Stable waiver identity; required only for waived." },
        { kind: "option", name: "waiverSubject", required: false, variadic: false, defaultValue: null, validation: "Selected specification identity; required only for waived." },
        { kind: "option", name: "waiverStatus", required: false, variadic: false, defaultValue: null, validation: "A new waived disposition requires active." },
        { kind: "option", name: "waiverExpiresAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 waiver expiry." },
        { kind: "option", name: "waiverAuthorityReference", required: false, variadic: false, defaultValue: null, validation: "Optional waiver authority reference." },
        { kind: "option", name: "waiverAttemptId", required: false, variadic: false, defaultValue: null, validation: "Optional waiver attempt identity." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews canonical writes and expected conditions without mutation; omission applies." }
    ], ["day-shift", "spec", "disposition", "--spec", ".day-shift/specs/example/example.md", "--planning-readiness", "ready", "--review-result", "review.json", "--recorded-by", "operator", "--recorded-at", "2026-07-22T12:00:00Z", "--dry-run", "--format", "json"]),
    withInvocation(readCommand("spec list", "list", "spec-registry", "Lists registered specs with lifecycle-transparent filtering."), [
        { kind: "option", name: "status", required: false, variadic: true, defaultValue: [], validation: "Optional repeatable lifecycle status; values are trimmed, lowercased, and deduplicated." },
        { kind: "option", name: "includeArchived", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Adds archived entries to default or explicitly requested statuses." }
    ], ["day-shift", "spec", "list", "--status", "draft", "--status", "active", "--include-archived", "--format", "json"]),
    withInvocation(readCommand("spec review", "review", "spec-registry", "Returns complete revision-bound specification findings and advisory planning/workflow recommendations.", "Reads only the registered specification and registry; writes no files, persists no readiness or review evidence, and assigns no workflow or work identity."), [
        { kind: "option", name: "spec", required: true, variadic: false, defaultValue: null, validation: "Existing repository-relative canonical path registered in the spec index." },
        { kind: "option", name: "reviewedAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 time for deterministic review evidence." },
        { kind: "option", name: "reviewedBy", required: false, variadic: false, defaultValue: null, validation: "Optional non-empty actor for deterministic review evidence." }
    ], ["day-shift", "spec", "review", "--spec", ".day-shift/specs/example/example.md", "--format", "json"]),
    withInvocation(readCommand("spec search", "navigation", "spec-registry", "Searches registered specs with lifecycle-transparent filtering and omission evidence."), [
        { kind: "argument", name: "query", required: false, variadic: false, defaultValue: null, validation: "Optional case-insensitive substring query across canonical searchable fields." },
        { kind: "option", name: "status", required: false, variadic: true, defaultValue: [], validation: "Optional repeatable lifecycle status; values are trimmed, lowercased, and deduplicated." },
        { kind: "option", name: "includeArchived", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Adds archived entries to default or explicitly requested statuses." }
    ], ["day-shift", "spec", "search", "emergent-agent-inference-burn-and-workflow-reliability", "--status", "draft", "--format", "json"]),
    withInvocation({
        ...writeCommand("spec update", "update", "spec-registry", "selected-existing-artifact", cli_constants_1.CLI_SPEC_INDEX_PATH, "selected-family", "updates-selected-artifact", "Updates mutable spec registry fields."),
        semantics: {
            conditionalInputs: [],
            dependentInputs: [],
            conflictingInputs: [],
            mutableFields: [
                "title", "depth", "status", "implementation_order", "registered_at", "updated_at",
                "archived_at", "linked_slice.slice", "linked_slice.path"
            ],
            genericGuards: [{
                    id: "append-only-source-reference",
                    description: "source.ref is append-only and may be changed only through spec source add."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [{
                    command: "spec source add",
                    requiredInputs: ["id", "ref", "reason"],
                    callableWhen: "all-required-inputs-present",
                    availability: "callable"
                }],
            exactExamples: [[
                    "day-shift", "spec", "update", "--spec-id", "spec-registry-commands",
                    "--field", "title=Updated spec title"
                ]]
        }
    }, [
        { kind: "option", name: "specId", required: true, variadic: false, defaultValue: null, validation: "Existing spec registry entry id." },
        { kind: "option", name: "field", required: true, variadic: true, defaultValue: null, validation: "One or more supported mutable <key=value> assignments; source.ref is excluded." }
    ], [
        "day-shift", "spec", "update", "--spec-id", "spec-registry-commands",
        "--field", "title=Updated spec title"
    ]),
    readCommand("slice", "inspection", "planning", "Groups slice scaffold, update, and review surfaces."),
    withInvocation({
        ...writeCommand("slice new", "scaffold", "planning", "canonical-artifact", "Governed slice overview, companion directories, and linked spec-registry entries", "planning-layer", "creates-artifacts", "Creates one canonical Governed slice scaffold and atomically links every contributing spec."),
        semantics: {
            conditionalInputs: [],
            dependentInputs: [],
            conflictingInputs: [{ inputs: ["spec-id", "slice-id"] }],
            mutableFields: ["depth", "destination", "linked_slice.slice", "linked_slice.path"],
            genericGuards: [{
                    id: "exactly-one-slice-selector",
                    description: "Exactly one of specId or sliceId is required."
                }, {
                    id: "canonical-governed-destination",
                    description: "New slices are written only beneath .day-shift/planning/governed/<implementation-order>-<slice-slug>/."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [],
            exactExamples: [[
                    "day-shift", "slice", "new", "--spec-id", "spec-registry-commands", "--dry-run"
                ]]
        }
    }, [
        { kind: "option", name: "specId", required: false, variadic: false, defaultValue: null, validation: "Registered spec id; exactly one selector is required." },
        { kind: "option", name: "sliceId", required: false, variadic: false, defaultValue: null, validation: "Existing linked_slice.slice id; exactly one selector is required." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews exact scaffold and registry writes without mutation." }
    ], ["day-shift", "slice", "new", "--spec-id", "spec-registry-commands", "--dry-run"]),
    writeCommand("slice update", "update", "planning", "selected-existing-artifact", "selected slice overview", "selected-artifact", "updates-selected-artifact", "Updates slice overview metadata."),
    readCommand("slice review", "review", "planning", "Reviews slice planning evidence."),
    readCommand("phase", "inspection", "planning", "Groups phase scaffold, update, and review surfaces."),
    withInvocation({
        ...writeCommand("phase new", "scaffold", "planning", "canonical-artifact", "Governed phase overview", "planning-layer", "creates-artifacts", "Creates one declared phase or the declared full set beneath a canonical Governed slice."),
        semantics: {
            conditionalInputs: [{ input: "phase-slug", whenInput: "full-set", equals: false }],
            dependentInputs: [],
            conflictingInputs: [
                { inputs: ["phase-slug", "full-set"] },
                { inputs: ["phase-title", "full-set"] }
            ],
            mutableFields: [],
            genericGuards: [{
                    id: "declared-phase-only",
                    description: "The selected phase slug must already be declared by the canonical Governed slice parent."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [],
            exactExamples: [[
                    "day-shift", "phase", "new", "--slice-overview",
                    ".day-shift/planning/governed/05-planning-artifacts/slice-overview.md",
                    "--full-set"
                ]]
        }
    }, [
        { kind: "option", name: "sliceOverview", required: true, variadic: false, defaultValue: null, validation: "Canonical Governed parent slice-overview.md path." },
        { kind: "option", name: "phaseSlug", required: false, variadic: false, defaultValue: null, validation: "Declared ordered phase slug unless fullSet is true." },
        { kind: "option", name: "fullSet", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Create every declared phase in one scaffold transaction." },
        { kind: "option", name: "phaseTitle", required: false, variadic: false, defaultValue: null, validation: "Optional explicit H1 title for single-phase creation." }
    ], [
        "day-shift", "phase", "new", "--slice-overview",
        ".day-shift/planning/governed/05-planning-artifacts/slice-overview.md",
        "--full-set"
    ]),
    withInvocation(writeCommand("phase update", "update", "planning", "selected-existing-artifact", "selected phase overview", "selected-artifact", "updates-selected-artifact", "Updates phase overview metadata."), [
        { kind: "option", name: "phaseOverview", required: true, variadic: false, defaultValue: null, validation: "Repository-relative phase-overview.md path." },
        { kind: "option", name: "activeArtifact", required: false, variadic: false, defaultValue: null, validation: "Optional matching active-artifact guard." },
        { kind: "option", name: "runDirectory", required: false, variadic: false, defaultValue: null, validation: "Optional lifecycle run directory whose active artifact, gate, freshness, and metadata posture constrain this write." },
        { kind: "option", name: "field", required: false, variadic: true, defaultValue: null, validation: "Adapter requires one or more direct key=value metadata updates before execution." }
    ], ["day-shift", "phase", "update", "--phase-overview", ".day-shift/planning/example/phase-overview.md", "--field", "status=completed"]),
    withInvocation(readCommand("phase review", "review", "planning", "Reviews phase planning evidence."), [
        { kind: "option", name: "phaseOverview", required: true, variadic: false, defaultValue: null, validation: "Repository-relative phase-overview.md path." },
        { kind: "option", name: "metadataPosture", required: false, variadic: false, defaultValue: "read-only", validation: "read-only or sync-on-clean-review; records review context and grants no write authority." },
        { kind: "option", name: "reviewedAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 review time; defaults to command time." },
        { kind: "option", name: "reviewMode", required: false, variadic: false, defaultValue: "auto", validation: "Review selection: auto or readiness." }
    ], ["day-shift", "phase", "review", "--phase-overview", ".day-shift/planning/example/phase-overview.md", "--metadata-posture", "read-only", "--format", "json"]),
    withInvocation({
        ...writeCommand("phase scaffold-migrate", "migration", "planning", "selected-existing-artifact", "recognized legacy phase and materialized child scaffolds", "selected-family", "updates-selected-artifact", "Previews or atomically backfills scoped milestone evidence and rebinds recognized legacy child projection stamps while preserving authored bodies and lifecycle evidence."),
        noWriteBoundary: "Unrecognized stamps, non-refinement drift, stale plan digests, incomplete evidence, and changed parent evidence that differs from preserved child bodies fail before any planning artifact write."
    }, [
        { kind: "option", name: "phaseOverview", required: true, variadic: false, defaultValue: null, validation: "Repository-relative governed phase-overview.md path." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit no-write migration preview." },
        { kind: "option", name: "apply", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit atomic migration apply mode." },
        { kind: "option", name: "expectedPlanDigest", required: false, variadic: false, defaultValue: null, validation: "Exact sha256 digest from the current dry-run; required with apply." }
    ], ["day-shift", "phase", "scaffold-migrate", "--phase-overview", ".day-shift/planning/governed/example/phases/01-contract/phase-overview.md", "--dry-run", "--format", "json"]),
    readCommand("milestone", "inspection", "planning", "Groups milestone scaffold, update, and review surfaces."),
    withInvocation({
        ...writeCommand("milestone new", "scaffold", "planning", "canonical-artifact", "Governed milestone overview and reconciliation placeholder", "planning-layer", "creates-artifacts", "Creates one declared milestone or the declared full set beneath a canonical Governed phase, or explicitly recovers an untouched generated scaffold pair."),
        semantics: {
            conditionalInputs: [{ input: "milestone-slug", whenInput: "full-set", equals: false }],
            dependentInputs: [{ input: "phase-review-result", requires: ["full-set"] }],
            conflictingInputs: [
                { inputs: ["milestone-slug", "full-set"] },
                { inputs: ["milestone-title", "full-set"] },
                { inputs: ["milestone-title", "recover-scaffold"] }
            ],
            mutableFields: [],
            genericGuards: [{
                    id: "paired-milestone-scaffold",
                    description: "Milestone overview and reconciliation are validated and created as one pair."
                }, {
                    id: "recover-untouched-milestone-scaffold",
                    description: "Recovery replaces only an untouched CLI-generated draft overview paired with its default pending reconciliation and no task workspace."
                }, {
                    id: "phase-authoring-readiness-receipt",
                    description: "A full-set invocation that would create a missing milestone requires the exact current zero-blocker phase authoring readiness receipt; a fully materialized canonical no-op does not."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [],
            exactExamples: [[
                    "day-shift", "milestone", "new", "--phase-overview",
                    ".day-shift/planning/governed/05-planning-artifacts/phases/01-contract/phase-overview.md",
                    "--full-set", "--phase-review-result", ".day-shift/runs/run-example/phase-review.json"
                ]]
        }
    }, [
        { kind: "option", name: "phaseOverview", required: true, variadic: false, defaultValue: null, validation: "Repository-relative parent phase overview." },
        { kind: "option", name: "milestoneSlug", required: false, variadic: false, defaultValue: null, validation: "Declared ordered milestone slug unless fullSet is true." },
        { kind: "option", name: "fullSet", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Create every declared milestone." },
        { kind: "option", name: "phaseReviewResult", required: false, variadic: false, defaultValue: null, validation: "Repository-local complete JSON phase review result required when full-set creation would materialize a missing milestone." },
        { kind: "option", name: "milestoneTitle", required: false, variadic: false, defaultValue: null, validation: "Optional explicit H1 title." },
        { kind: "option", name: "recoverScaffold", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicitly replace only an untouched generated draft pair after exact eligibility and revision checks." }
    ], [
        "day-shift", "milestone", "new", "--phase-overview",
        ".day-shift/planning/governed/05-planning-artifacts/phases/01-contract/phase-overview.md",
        "--full-set", "--phase-review-result", ".day-shift/runs/run-example/phase-review.json"
    ]),
    withInvocation(writeCommand("milestone update", "update", "planning", "selected-existing-artifact", "selected milestone overview", "selected-artifact", "updates-selected-artifact", "Updates milestone overview metadata."), [
        { kind: "option", name: "milestoneOverview", required: true, variadic: false, defaultValue: null, validation: "Repository-relative milestone-overview.md path." },
        { kind: "option", name: "activeArtifact", required: false, variadic: false, defaultValue: null, validation: "Optional matching active-artifact guard." },
        { kind: "option", name: "runDirectory", required: false, variadic: false, defaultValue: null, validation: "Optional lifecycle run directory whose active artifact, gate, freshness, and metadata posture constrain this write." },
        { kind: "option", name: "field", required: false, variadic: true, defaultValue: null, validation: "Adapter requires one or more direct key=value metadata updates before execution." }
    ], ["day-shift", "milestone", "update", "--milestone-overview", ".day-shift/planning/example/milestone-overview.md", "--field", "status=completed"]),
    readCommand("milestone review", "review", "planning", "Reviews milestone planning and reconciliation evidence."),
    readCommand("task", "inspection", "planning", "Groups task scaffold, promote, update, readiness, and review surfaces."),
    withInvocation(writeCommand("task attempt-open", "update", "planning", "selected-existing-artifact", "selected task pair", "selected-family", "updates-selected-artifact", "Previews or transactionally opens one readiness-bound canonical implementation attempt."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Stable canonical attempt_id using 3-128 machine-safe identity characters." },
        { kind: "option", name: "openedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 opening time with explicit timezone." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "attempt-open", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--opened-at", "2026-01-01T00:00:00.000Z", "--dry-run"]),
    withInvocation(writeCommand("task attempt-abort", "update", "planning", "selected-existing-artifact", "selected task definition and paired implementation-summary current attempt", "selected-family", "updates-selected-artifact", "Previews or atomically archives and resets one revision-bound invalid no-evidence current attempt while preserving its audit history."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Exact current attempt identity to abort." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact 64-character task revision observed before abort." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty attempt-abort actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 attempt-abort time with explicit timezone." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty audit reason for aborting the invalid attempt." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "attempt-abort", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-invalid-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--reason", "Reset an invalid no-evidence attempt.", "--dry-run"]),
    withInvocation(writeCommand("task attempt-supersede", "update", "planning", "selected-existing-artifact", "selected task definition and paired implementation-summary baseline-only current attempt", "selected-family", "updates-selected-artifact", "Previews or atomically archives a stale-authorization baseline-only attempt as superseded after an authorized contract revision, preserves its attribution evidence, and resets readiness for a separately authorized successor; verified Git target inspection is required, and inspection unavailability is a typed no-write dependency failure rather than an observed implementation delta."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Exact open current baseline-only attempt identity to supersede." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact current 64-character task revision after the authorized planning-contract revision." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty attempt-supersession actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 attempt-supersession time with explicit timezone." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty reason for the authorized planning-contract revision." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag exposing exact pair revisions, intended paths, baseline identity, and transaction preconditions." }
    ], ["day-shift", "task", "attempt-supersede", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--reason", "Authorized same-run planning-contract revision after baseline capture.", "--dry-run"]),
    withInvocation({
        ...writeCommand("task attempt-contract-revise", "update", "planning", "selected-existing-artifact", "fresh full-cycle-strict run, latest accepted task-readiness contract-revision checkpoint, and selected evidence-bearing task attempt", "selected-family", "updates-selected-artifact", "Previews or atomically preserves an evidence-bearing stale attempt as contract_gap, binds exact run/checkpoint and old/new task revisions, resets readiness, and leaves successor authorization and baseline capture to the ordinary lifecycle spine."),
        noWriteBoundary: "Baseline-only, stale, ambiguous, mismatched, incomplete, or conflicting run, checkpoint, pair, attempt, and revision evidence fails with no task-pair or lifecycle-run mutation."
    }, [
        { kind: "option", name: "revisionRunDirectory", required: true, variadic: false, defaultValue: null, validation: "Fresh full-cycle-strict run containing the latest accepted task-readiness contract revision; distinct from the global runDirectory lifecycle-capture binding." },
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Exact open evidence-bearing current attempt identity." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact current 64-character task revision after contract revision." },
        { kind: "option", name: "checkpointId", required: true, variadic: false, defaultValue: null, validation: "Exact latest accepted contract-revision checkpoint identity." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty recovery actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 recovery time with explicit timezone." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty reason for preserving the predecessor as contract_gap." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview exposing exact run, checkpoint, task-pair, evidence, and transaction preconditions." }
    ], ["day-shift", "task", "attempt-contract-revise", "--revision-run-directory", ".day-shift/runs/run-example", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--checkpoint-id", "lifecycle-contract-revision-example", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--reason", "Preserve evidence after the accepted task contract revision.", "--dry-run"]),
    withInvocation({
        ...writeCommand("task attempt-chronology-recover", "update", "planning", "selected-existing-artifact", "hash-verified full-cycle-strict run evidence and selected evidence-bearing task attempt", "selected-family", "updates-selected-artifact", "Previews or atomically preserves one legacy evidence-bearing attempt with invalid opening or baseline chronology as invalid_chronology, resets readiness, and leaves fresh authorization, chronology_repair successor opening, baseline capture, and validation to the ordinary lifecycle spine."),
        noWriteBoundary: "Missing, stale, incomplete, hash-mismatched, non-chronological, no-evidence, or conflicting run, task-pair, attempt, and recovery evidence fails without rewriting the task pair or immutable lifecycle-run evidence."
    }, [
        { kind: "option", name: "chronologyRunDirectory", required: true, variadic: false, defaultValue: null, validation: "Complete full-cycle-strict source run containing immutable evidence recorded before the stored attempt opening or baseline capture time; distinct from the global runDirectory lifecycle-capture binding." },
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path matching the source run active artifact." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Exact open evidence-bearing current attempt identity with invalid chronology." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact current 64-character task-definition SHA-256 revision." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty chronology-recovery actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 recovery time with explicit timezone." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty reason for preserving the predecessor as invalid_chronology." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview exposing exact source evidence, pair revisions, chronology proof, and transaction preconditions." }
    ], ["day-shift", "task", "attempt-chronology-recover", "--chronology-run-directory", ".day-shift/runs/run-example", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--reason", "Preserve legacy evidence with invalid chronology.", "--dry-run"]),
    withInvocation({
        ...writeCommand("task scope-recover", "update", "planning", "selected-existing-artifact", "fresh full-cycle-strict run, selected task pair, current attempt baseline, task revision, and schema v2 contract-impact fingerprint", "selected-family", "updates-selected-artifact", "Previews or atomically recovers one complete posture-authorized additive path and validation closure in the same run. Untouched additions amend the current attempt with a supplemental baseline; already changed additions close the predecessor as contract_gap and open an attribution-preserving successor."),
        noWriteBoundary: "Read-only, frozen, unknown, materially ineligible, incomplete, stale, or conflicting additions are classified as typed no-write blockers and never authorize objective, acceptance, ownership, external-authority, or destructive-boundary changes."
    }, [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing fresh full-cycle-strict lifecycle run bound to the selected task." },
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Exact open current attempt owning preserved attribution evidence." },
        { kind: "option", name: "successorAttemptId", required: false, variadic: false, defaultValue: null, validation: "Required fresh identity when any deterministic addition is already changed." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact current 64-character task revision before recovery." },
        { kind: "option", name: "baselineId", required: true, variadic: false, defaultValue: null, validation: "Exact immutable current-attempt runtime baseline identity." },
        { kind: "option", name: "contractImpactFingerprint", required: true, variadic: false, defaultValue: null, validation: "Exact current schema v2 posture-aware contract-impact fingerprint." },
        { kind: "option", name: "addPath", required: false, variadic: true, defaultValue: null, validation: "Repeatable exact path addition; omission derives the complete deterministic closure." },
        { kind: "option", name: "addValidation", required: false, variadic: true, defaultValue: null, validation: "Repeatable exact validation addition; omission derives the complete deterministic closure." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty scope-recovery actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 recovery time with explicit timezone." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty bounded additive-recovery reason." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write classification and pair-mutation preview." }
    ], ["day-shift", "task", "scope-recover", "--run-directory", ".day-shift/runs/run-example", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--baseline-id", "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--contract-impact-fingerprint", "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--reason", "Recover the exact required additive contract-impact closure.", "--dry-run"]),
    withInvocation({
        ...writeCommand("task baseline", "update", "planning", "selected-existing-artifact", "selected task definition", "selected-artifact", "updates-selected-artifact", "Plans or captures one post-readiness, pre-write runtime-attribution baseline where task-cycle-id equals the current attempt_id and checkpoint-id equals that attempt readiness_review_id; --plan is strictly read-only, actor/time are conditional only for new capture, --resume preserves stored identities, and incomplete recovery is emitted as a non-callable skeleton."),
        noWriteBoundary: "When --plan is selected, impact, target, and predecessor eligibility inspection is byte-for-byte read-only and emits no callable argv until required impact and dirty-target ownership evidence are explicit."
    }, [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative task-definition.md path for a ready runtime or hybrid task." },
        { kind: "option", name: "taskCycleId", required: true, variadic: false, defaultValue: null, validation: "task-cycle-id equals the current attempt_id; the identity uses 3-128 allowed characters." },
        { kind: "option", name: "checkpointId", required: true, variadic: false, defaultValue: null, validation: "checkpoint-id equals that attempt readiness_review_id; the identity uses 3-128 allowed characters." },
        { kind: "option", name: "capturedBy", required: false, variadic: false, defaultValue: null, validation: "Required actor for a new schema-2 attempt-owned baseline." },
        { kind: "option", name: "capturedAt", required: false, variadic: false, defaultValue: null, validation: "Required ISO-8601 capture time for a new schema-2 attempt-owned baseline." },
        { kind: "option", name: "contractImpactFingerprint", required: false, variadic: false, defaultValue: null, validation: "Exact current SHA-256 fingerprint from task readiness-review; required whenever .day-shift/contract-impact.json is valid and present." },
        { kind: "option", name: "resume", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Reuses only an existing baseline whose task-cycle and checkpoint identities exactly match." },
        { kind: "option", name: "plan", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Strictly read-only deterministic eligibility report with bounded target digests, predecessor candidates, blockers, and exact ordinary baseline argv only when callable." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." },
        { kind: "option", name: "adopt", required: false, variadic: true, defaultValue: null, validation: "Repeatable declared-path::concrete-rationale adoption evidence for dirty pre-staged targets." }
    ], ["day-shift", "task", "baseline", "--task-definition", ".day-shift/planning/example/task-definition.md", "--task-cycle-id", "attempt-001", "--checkpoint-id", "task-readiness-review-001", "--captured-by", "operator", "--captured-at", "2026-01-01T00:00:00.000Z", "--plan"]),
    withInvocation({
        ...writeCommand("task validation-set", "update", "planning", "selected-existing-artifact", "current task revision's declared Validation Commands and open attempt", "selected-family", "updates-selected-artifact", "Dry-run projects deterministic shell-free argv, identities, evidence paths, retry selectors, and preconditions without spawning. Apply records each declared command independently in order and stops at the first required failed, timed-out, spawn-restricted, stale, or unrecordable result."),
        noWriteBoundary: "The command rejects caller-supplied argv and shell evaluation. --dry-run never spawns or writes; stale revisions and invalid selectors fail before execution."
    }, [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Owning open current attempt identity." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact current 64-character task-definition SHA-256 revision." },
        { kind: "option", name: "validationId", required: false, variadic: false, defaultValue: null, validation: "Exact unrecorded validation identity projected by the current declared set; mutually exclusive with retryValidationId." },
        { kind: "option", name: "retryValidationId", required: false, variadic: false, defaultValue: null, validation: "Exact effective failed command-owned validation identity to supersede; mutually exclusive with validationId and never reconstructed from metadata." },
        { kind: "option", name: "timeoutMs", required: false, variadic: false, defaultValue: "900000", validation: "Per-command integer timeout from 1 through 86400000 milliseconds." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Non-executing no-write preview of the current declared set and exact selectors." }
    ], ["day-shift", "task", "validation-set", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--dry-run"]),
    withInvocation({
        ...writeCommand("task validation-record", "update", "planning", "selected-existing-artifact", "paired implementation-summary named attempt plus task-definition revision guard", "selected-family", "updates-selected-artifact", "Dry-run returns a deterministic non-executing plan; apply executes exact argv once, while spawn or permission restrictions return typed environment-execution no-write failures and never append a validation result."),
        noWriteBoundary: "With --dry-run, command-owned validation argv and explicit --expect-json assertions are validated and reported but the child is never launched; imported and evidence-only preview semantics remain read-only."
    }, [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "validationId", required: true, variadic: false, defaultValue: null, validation: "Stable append-only validation result identity." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Owning open current or explicitly backfilled closed attempt identity." },
        { kind: "option", name: "name", required: true, variadic: false, defaultValue: null, validation: "Human-readable validation name." },
        { kind: "option", name: "command", required: false, variadic: false, defaultValue: null, validation: "Intended command text for non-execution or imported evidence; compatible inline JSON execution contracts remain supported." },
        { kind: "option", name: "executionContract", required: false, variadic: false, defaultValue: null, validation: "Repository-relative bounded regular schemaVersion 1 execution-contract JSON file." },
        { kind: "option", name: "timeoutMs", required: false, variadic: false, defaultValue: null, validation: "Optional command-owned execution timeout from 1 through 86400000 milliseconds; timeouts append failed evidence with bounded output and timing." },
        { kind: "option", name: "expectJson", required: false, variadic: true, defaultValue: null, validation: "Repeatable <json-pointer>=<JSON-literal> equality assertion over exactly one bounded JSON stdout document; malformed pointers and literals fail before execution, while parse, resolution, truncation, or equality failures derive failed validation evidence." },
        { kind: "option", name: "supersedesValidationId", required: false, variadic: false, defaultValue: null, validation: "Optional prior validation identity replaced by this result." },
        { kind: "option", name: "required", required: true, variadic: false, defaultValue: null, validation: "Boolean token true or false." },
        { kind: "option", name: "status", required: false, variadic: false, defaultValue: null, validation: "passed, failed, not_run, waived, blocked, or not_applicable; command-owned execution derives passed or failed." },
        { kind: "option", name: "exitCode", required: false, variadic: false, defaultValue: null, validation: "Optional claimed exit code; successful evidence derives exitCode 0 from command-owned execution or a verified result contract and rejects mismatches." },
        { kind: "option", name: "summary", required: true, variadic: false, defaultValue: null, validation: "Concise validation result summary." },
        { kind: "option", name: "outputReference", required: false, variadic: false, defaultValue: null, validation: "CI/imported passed evidence requires a repository-relative schemaVersion 1 verified-result JSON contract with exact identities, command, argv, status, exitCode, bounded output, and optional supersedesValidationId; otherwise an optional bounded output reference." },
        { kind: "option", name: "sourceReference", required: false, variadic: false, defaultValue: null, validation: "Required reference for ci or imported evidence." },
        { kind: "option", name: "recordedAt", required: false, variadic: false, defaultValue: null, validation: "ISO-8601 record time with explicit timezone; command-owned execution derives it." },
        { kind: "option", name: "source", required: false, variadic: false, defaultValue: "manual", validation: "manual, ci, or imported." },
        { kind: "option", name: "dependencyMode", required: true, variadic: false, defaultValue: null, validation: "repository, declared, or unknown." },
        { kind: "option", name: "scopePath", required: false, variadic: true, defaultValue: null, validation: "Repeatable explicitly validated path." },
        { kind: "option", name: "dependency", required: false, variadic: true, defaultValue: null, validation: "Repeatable explicit dependency path." },
        { kind: "option", name: "waiverId", required: false, variadic: false, defaultValue: null, validation: "Optional explicit waiver identity reference." },
        { kind: "option", name: "closedAttemptBackfill", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit preservation-only imported backfill for a closed runtime-attribution opt-out attempt." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Non-executing no-write preview flag for exact argv, validation identity, and pair preconditions." },
        { kind: "argument", name: "argv", required: false, variadic: true, defaultValue: null, validation: "Exact newline-free command argv supplied after '--'; mutually exclusive with --execution-contract and launched at most once by apply without shell interpolation." }
    ], ["day-shift", "task", "validation-record", "--task-definition", ".day-shift/planning/example/task-definition.md", "--validation-id", "validation-001", "--attempt-id", "attempt-001", "--name", "focused-tests", "--required", "true", "--summary", "Focused tests executed once.", "--dependency-mode", "declared", "--scope-path", "src/example.ts", "--", "node", "--test", "tests_v2/example.test.js"]),
    readCommand("task waiver", "inspection", "planning", "Groups explicit task waiver record and revocation writes."),
    withInvocation(writeCommand("task waiver record", "update", "planning", "selected-existing-artifact", "selected task pair waiver owner", "selected-family", "updates-selected-artifact", "Previews or transactionally records one typed task waiver."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "waiverId", required: true, variadic: false, defaultValue: null, validation: "Stable append-only waiver identity." },
        { kind: "option", name: "waiverType", required: true, variadic: false, defaultValue: null, validation: "readiness, validation, review, scope_deviation, or administrative." },
        { kind: "option", name: "subjectId", required: true, variadic: false, defaultValue: null, validation: "Exact subject identity." },
        { kind: "option", name: "attemptId", required: false, variadic: false, defaultValue: null, validation: "Owning current attempt; omitted only for readiness transition evidence." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Concrete waiver reason." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Waiver actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 record time." },
        { kind: "option", name: "expiresAt", required: false, variadic: false, defaultValue: null, validation: "Optional exclusive expiry time." },
        { kind: "option", name: "authorityReference", required: false, variadic: false, defaultValue: null, validation: "Required authority for readiness, review, and administrative waivers." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "waiver", "record", "--task-definition", ".day-shift/planning/example/task-definition.md", "--waiver-id", "waiver-001", "--waiver-type", "validation", "--subject-id", "validation-001", "--attempt-id", "attempt-001", "--reason", "External validation unavailable.", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--dry-run"]),
    withInvocation(writeCommand("task waiver revoke", "update", "planning", "selected-existing-artifact", "selected task pair waiver owner", "selected-family", "updates-selected-artifact", "Previews or transactionally revokes one active task waiver."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "waiverId", required: true, variadic: false, defaultValue: null, validation: "Existing active waiver identity." },
        { kind: "option", name: "revokedBy", required: true, variadic: false, defaultValue: null, validation: "Revocation actor." },
        { kind: "option", name: "revokedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 revocation time." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Concrete revocation reason." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "waiver", "revoke", "--task-definition", ".day-shift/planning/example/task-definition.md", "--waiver-id", "waiver-001", "--revoked-by", "operator", "--revoked-at", "2026-01-02T00:00:00.000Z", "--reason", "Requirement restored.", "--dry-run"]),
    withInvocation(writeCommand("task retry-authorize", "update", "planning", "selected-existing-artifact", "selected task pair", "selected-family", "updates-selected-artifact", "Atomically replaces clean readiness evidence and appends a changes-requested successor."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path reset to needs_more_evidence." },
        { kind: "option", name: "reviewResult", required: true, variadic: false, defaultValue: null, validation: "Repository-local complete readiness-review JSON result." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Stable successor attempt identity." },
        { kind: "option", name: "openedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 successor opening time." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "retry-authorize", "--task-definition", ".day-shift/planning/example/task-definition.md", "--review-result", "readiness-review.json", "--attempt-id", "attempt-002", "--opened-at", "2026-01-02T00:00:00.000Z", "--dry-run"]),
    withInvocation({
        ...writeCommand("task new", "scaffold", "planning", "canonical-artifact", "task directory with task definition and implementation summary", "planning-layer", "creates-artifacts", "Creates a paired task scaffold from a canonical Governed milestone or a supported lightweight slice."),
        semantics: {
            conditionalInputs: [
                { input: "milestone-overview", whenInput: "lightweight", equals: false },
                { input: "slice-overview", whenInput: "lightweight", equals: true },
                { input: "task-slug", whenInput: "full-set", equals: false }
            ],
            dependentInputs: [
                { input: "slice-overview", requires: ["lightweight"] }
            ],
            conflictingInputs: [
                { inputs: ["milestone-overview", "slice-overview"] },
                { inputs: ["lightweight", "milestone-overview"] },
                { inputs: ["lightweight", "full-set"] },
                { inputs: ["lightweight", "recover-scaffold"] },
                { inputs: ["task-slug", "full-set"] },
                { inputs: ["task-title", "full-set"] },
                { inputs: ["task-title", "recover-scaffold"] }
            ],
            mutableFields: [],
            genericGuards: [{
                    id: "paired-task-scaffold",
                    description: "Task definition and implementation summary are validated and created as one pair."
                }, {
                    id: "recover-untouched-task-scaffold",
                    description: "Recovery replaces only an untouched CLI-generated draft task definition paired with its default pending no-attempt implementation summary."
                }],
            failureTaxonomy: {
                missingRequiredInput: "invalid-input",
                invalidField: "invalid-input",
                invalidRepositoryState: "invalid-config"
            },
            recoveries: [],
            exactExamples: [[
                    "day-shift", "task", "new", "--milestone-overview",
                    ".day-shift/planning/governed/05-planning-artifacts/phases/01-contract/milestones/01-runtime/milestone-overview.md",
                    "--full-set"
                ]]
        }
    }, [
        { kind: "option", name: "milestoneOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative parent milestone overview." },
        { kind: "option", name: "sliceOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative lightweight parent slice overview." },
        { kind: "option", name: "lightweight", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Create a lightweight direct task." },
        { kind: "option", name: "taskSlug", required: false, variadic: false, defaultValue: null, validation: "Declared ordered task slug unless fullSet is true." },
        { kind: "option", name: "fullSet", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Create every declared task." },
        { kind: "option", name: "taskTitle", required: false, variadic: false, defaultValue: null, validation: "Optional explicit H1 title." },
        { kind: "option", name: "recoverScaffold", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicitly replace only an untouched generated draft pair after exact eligibility and revision checks." }
    ], [
        "day-shift", "task", "new", "--milestone-overview",
        ".day-shift/planning/governed/05-planning-artifacts/phases/01-contract/milestones/01-runtime/milestone-overview.md",
        "--full-set"
    ]),
    withInvocation(writeCommand("task promote", "update", "planning", "canonical-artifact", "planned destination parents plus selected Basic task pair or exact retained promotion transaction", "workspace", "applies-transaction", "Builds a read-only plan by default, reports destinationImplementationOrder, destinationImplementationOrderSource, rootInventoryFingerprint, and direct Structured task sequence fields, applies only an exact revision-bound Basic promotion, or explicitly recovers one exact inspected promotion transaction."), [
        { kind: "option", name: "taskDefinition", required: false, variadic: false, defaultValue: null, validation: "Required canonical Basic task-definition.md path in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "to", required: false, variadic: false, defaultValue: null, validation: "Required structured or governed target in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "workId", required: false, variadic: false, defaultValue: null, validation: "Required Structured destination work identity in planning/apply mode; forbidden for Governed destinations and in recovery mode." },
        { kind: "option", name: "spec", required: false, variadic: true, defaultValue: [], validation: "At least one canonical planning-ready specification is required by planner validation." },
        { kind: "option", name: "implementationOrder", required: false, variadic: false, defaultValue: null, validation: "In planning/apply mode Structured accepts a positive root order of at least two digits or next and Governed requires an ordered slice prefix; forbidden in recovery mode." },
        { kind: "option", name: "sliceId", required: false, variadic: false, defaultValue: null, validation: "Optional explicit '<ordered-prefix>-<slice-slug>' Governed identity in planning/apply mode; forbidden for Structured destinations and in recovery mode." },
        { kind: "option", name: "slice", required: false, variadic: false, defaultValue: null, validation: "Required ordered Governed destination slice when target is governed." },
        { kind: "option", name: "phase", required: false, variadic: false, defaultValue: null, validation: "Required ordered Governed destination phase when target is governed." },
        { kind: "option", name: "milestone", required: false, variadic: false, defaultValue: null, validation: "Required ordered Governed destination milestone when target is governed." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit no-write preview flag; incompatible with --apply." },
        { kind: "option", name: "apply", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicitly applies the exact revision-bound plan." },
        { kind: "option", name: "planId", required: false, variadic: false, defaultValue: null, validation: "Required exact preview plan id when --apply is selected." },
        { kind: "option", name: "actor", required: false, variadic: false, defaultValue: null, validation: "Required non-empty audit actor in apply or recovery mode." },
        { kind: "option", name: "reason", required: false, variadic: false, defaultValue: null, validation: "Required non-empty audit reason in apply or recovery mode." },
        { kind: "option", name: "appliedAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 application time; requires --apply and is forbidden in recovery mode." },
        { kind: "option", name: "recover", required: false, variadic: false, defaultValue: null, validation: "Selects the mutually exclusive exact-evidence recovery lane: roll-forward or restore." },
        { kind: "option", name: "transactionId", required: false, variadic: false, defaultValue: null, validation: "Required retained promotion transaction identity in recovery mode." },
        { kind: "option", name: "evidenceFingerprint", required: false, variadic: false, defaultValue: null, validation: "Required exact current inspection SHA-256 fingerprint in recovery mode." },
        { kind: "option", name: "recoveredAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 recovery time; requires --recover." }
    ], ["day-shift", "task", "promote", "--task-definition", ".day-shift/planning/basic/tasks/01-example/task-definition.md", "--to", "structured", "--work-id", "example", "--implementation-order", "next", "--spec", ".day-shift/specs/example/example.md", "--format", "json"]),
    withInvocation(readCommand("task readiness-review", "review", "planning", "Returns deterministic protocol-v1 readiness evidence with authored readiness, exact contract-impact lanes and fingerprint, authorization applicability, current-attempt state, and stable recovery routing bound to exact task bytes, canonical path, reviewer, and review time without writing."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "reviewedBy", required: true, variadic: false, defaultValue: null, validation: "Explicit non-empty reviewer identity." },
        { kind: "option", name: "reviewedAt", required: true, variadic: false, defaultValue: null, validation: "Explicit ISO-8601 review time." }
    ], ["day-shift", "task", "readiness-review", "--task-definition", ".day-shift/planning/example/task-definition.md", "--reviewed-by", "reviewer", "--reviewed-at", "2026-01-01T00:00:00.000Z", "--format", "json"]),
    withInvocation(writeCommand("task readiness-authorize", "update", "planning", "selected-existing-artifact", "selected task definition plus paired implementation-summary revision guard", "selected-family", "updates-selected-artifact", "Previews or applies verified revision-bound readiness authorization, including fresh replacement of stale authorization only when no attempt evidence exists."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "reviewResult", required: true, variadic: false, defaultValue: null, validation: "Explicitly selected bounded regular UTF-8 JSON readiness-review result; canonical external paths are supported." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "readiness-authorize", "--task-definition", ".day-shift/planning/example/task-definition.md", "--review-result", "readiness-review.json", "--dry-run"]),
    withInvocation(writeCommand("task review-repair", "update", "planning", "selected-existing-artifact", "completed task pair plus accepted predecessor and fresh readiness-review revision guard", "selected-family", "updates-selected-artifact", "Previews or atomically appends an audited review-repair successor after accepted closeout."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical completed task-definition.md path." },
        { kind: "option", name: "reviewResult", required: true, variadic: false, defaultValue: null, validation: "Explicitly selected bounded regular UTF-8 JSON readiness-review result, including canonical external paths, bound to exact completed task bytes." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Stable unique repair successor attempt identity." },
        { kind: "option", name: "openedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 successor opening time after predecessor close and repair review." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty repair rationale." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "review-repair", "--task-definition", ".day-shift/planning/example/task-definition.md", "--review-result", "repair-readiness-review.json", "--attempt-id", "attempt-repair-002", "--opened-at", "2026-01-02T00:00:00.000Z", "--reason", "Correct a post-close review defect.", "--dry-run"]),
    withInvocation(writeCommand("task disposition", "update", "planning", "selected-existing-artifact", "paired implementation-summary current attempt plus exact task/summary review receipt guard", "selected-family", "updates-selected-artifact", "Previews or applies an explicit current-attempt review disposition without closing the task."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "reviewResult", required: false, variadic: false, defaultValue: null, validation: "Required for accepted dispositions; bounded UTF-8 implementation-summary review JSON with a fresh zero-blocker receipt." },
        { kind: "option", name: "disposition", required: true, variadic: false, defaultValue: null, validation: "changes_requested, accepted, or accepted_with_follow_up." },
        { kind: "option", name: "reason", required: false, variadic: false, defaultValue: null, validation: "Required for changes_requested and accepted_with_follow_up." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty disposition actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 disposition time." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "disposition", "--task-definition", ".day-shift/planning/example/task-definition.md", "--review-result", "implementation-summary-review.json", "--disposition", "accepted", "--recorded-by", "reviewer", "--recorded-at", "2026-01-01T00:00:00.000Z", "--dry-run"]),
    withInvocation(writeCommand("task implementation-complete", "update", "planning", "selected-existing-artifact", "paired implementation-summary current attempt plus task-definition revision guard", "selected-family", "updates-selected-artifact", "Previews or atomically completes only the implementation dimension of one revision-bound current attempt without accepting review or closing the task."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "attemptId", required: true, variadic: false, defaultValue: null, validation: "Exact active implementation attempt identity." },
        { kind: "option", name: "taskRevision", required: true, variadic: false, defaultValue: null, validation: "Exact lowercase 64-character task revision." },
        { kind: "option", name: "completedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty completion actor." },
        { kind: "option", name: "completedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 completion time with explicit timezone." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "implementation-complete", "--task-definition", ".day-shift/planning/example/task-definition.md", "--attempt-id", "attempt-001", "--task-revision", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "--completed-by", "implementer", "--completed-at", "2026-01-01T00:00:00.000Z", "--dry-run"]),
    withInvocation(writeCommand("task block", "update", "planning", "selected-existing-artifact", "paired implementation-summary current attempt plus task-definition revision guard", "selected-family", "updates-selected-artifact", "Previews or applies blocker reason and next-decision evidence to the open current attempt."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "dimension", required: true, variadic: false, defaultValue: null, validation: "Independent blocked dimension: implementation or review." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty blocker reason." },
        { kind: "option", name: "nextDecision", required: true, variadic: false, defaultValue: null, validation: "Required next decision or dependency." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty blocker actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 blocker time." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "block", "--task-definition", ".day-shift/planning/example/task-definition.md", "--dimension", "implementation", "--reason", "dependency unavailable", "--next-decision", "restore dependency", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--dry-run"]),
    withInvocation(writeCommand("task cancel", "update", "planning", "selected-existing-artifact", "selected task definition and paired implementation-summary current attempt", "selected-family", "updates-selected-artifact", "Previews or atomically applies current-attempt cancellation evidence and task cancellation."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty cancellation reason." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Non-empty cancellation actor." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 cancellation time." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "cancel", "--task-definition", ".day-shift/planning/example/task-definition.md", "--reason", "work no longer required", "--recorded-by", "operator", "--recorded-at", "2026-01-01T00:00:00.000Z", "--dry-run"]),
    withInvocation(writeCommand("task close", "update", "planning", "selected-existing-artifact", "canonical task/summary terminal pair plus exact current implementation-summary review receipt", "selected-family", "updates-selected-artifact", "Previews or atomically applies explicit canonical pair closure after valid authorized completed-and-accepted evidence."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical task-definition.md path." },
        { kind: "option", name: "reviewResult", required: true, variadic: false, defaultValue: null, validation: "Bounded UTF-8 implementation-summary review JSON with a fresh zero-blocker receipt for the exact current task, summary, and attempt." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "task", "close", "--task-definition", ".day-shift/planning/example/task-definition.md", "--review-result", "implementation-summary-review.json", "--dry-run"]),
    readCommand("task review", "review", "planning", "Reviews task closeout evidence without writing."),
    withInvocation(writeCommand("task update", "update", "planning", "selected-existing-artifact", "selected task definition", "selected-artifact", "updates-selected-artifact", "Updates task definition metadata."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative task-definition.md path." },
        { kind: "option", name: "activeArtifact", required: false, variadic: false, defaultValue: null, validation: "Optional matching active-artifact guard." },
        { kind: "option", name: "field", required: false, variadic: true, defaultValue: null, validation: "Adapter requires one or more direct key=value metadata updates; runtime_acceptance accepts only one complete JSON object." }
    ], ["day-shift", "task", "update", "--task-definition", ".day-shift/planning/example/task-definition.md", "--field", "runtime_acceptance={\"required\":true,\"criterion_ids\":[\"TASK-AC-01\"]}"]),
    readCommand("implementation-summary", "inspection", "planning", "Groups implementation summary build, review, and update surfaces."),
    withInvocation(writeCommand("implementation-summary build", "build", "planning", "canonical-artifact", "paired implementation-summary.md", "selected-artifact", "updates-selected-artifact", "Builds or refreshes paired implementation summary artifacts."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative owning task-definition.md path." }
    ], ["day-shift", "implementation-summary", "build", "--task-definition", ".day-shift/planning/example/task-definition.md"]),
    withInvocation(readCommand("implementation-summary review", "review", "planning", "Reviews implementation summary closeout evidence and exposes the exact manifest-owned result path when run-bound."), [
        { kind: "option", name: "taskDefinition", required: true, variadic: false, defaultValue: null, validation: "Repository-relative owning task-definition.md path." },
        { kind: "option", name: "reviewResultPath", required: false, variadic: false, defaultValue: null, validation: "Unbound caller-managed JSON path used only for descriptor-derived lifecycle argv; run-bound review overrides it with the exact manifest-owned caller-consumable evidence path and creates no loose duplicate." }
    ], ["day-shift", "implementation-summary", "review", "--task-definition", ".day-shift/planning/example/task-definition.md", "--format", "json"]),
    writeCommand("implementation-summary update", "update", "planning", "selected-existing-artifact", "selected implementation summary", "selected-artifact", "updates-selected-artifact", "Updates implementation summary metadata."),
    readCommand("reconciliation", "inspection", "planning", "Groups reconciliation build, review, explicit acceptance, and update surfaces."),
    withInvocation(writeCommand("reconciliation build", "build", "planning", "canonical-artifact", "milestone reconciliation.md", "planning-layer", "updates-selected-artifact", "Builds or refreshes milestone reconciliation artifacts."), [
        { kind: "option", name: "milestoneOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative owning milestone overview." },
        { kind: "option", name: "taskDefinition", required: false, variadic: false, defaultValue: null, validation: "Explicit task-level exception owner." },
        { kind: "option", name: "rationale", required: false, variadic: false, defaultValue: null, validation: "Required for task-level reconciliation." }
    ], ["day-shift", "reconciliation", "build", "--milestone-overview", ".day-shift/planning/example/milestone-overview.md"]),
    withInvocation(readCommand("reconciliation review", "review", "planning", "Reviews milestone reconciliation evidence."), [
        { kind: "option", name: "milestoneOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative owning milestone overview." },
        { kind: "option", name: "taskDefinition", required: false, variadic: false, defaultValue: null, validation: "Explicit task-level exception owner." },
        { kind: "option", name: "rationale", required: false, variadic: false, defaultValue: null, validation: "Required for task-level reconciliation." }
    ], ["day-shift", "reconciliation", "review", "--milestone-overview", ".day-shift/planning/example/milestone-overview.md", "--format", "json"]),
    withInvocation(writeCommand("reconciliation accept", "update", "planning", "selected-existing-artifact", "paired reconciliation completion metadata and command-owned Review Status marker plus current source and task-summary review evidence", "selected-family", "updates-selected-artifact", "Previews or applies explicit zero-blocker receipt-bound reconciliation acceptance while preserving authored evidence sections."), [
        { kind: "option", name: "milestoneOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative owning milestone overview." },
        { kind: "option", name: "taskDefinition", required: false, variadic: false, defaultValue: null, validation: "Explicit task-level exception owner." },
        { kind: "option", name: "rationale", required: false, variadic: false, defaultValue: null, validation: "Required for task-level reconciliation." },
        { kind: "option", name: "reviewResult", required: true, variadic: false, defaultValue: null, validation: "Repository-local bounded UTF-8 reconciliation review JSON with the exact current zero-blocker receipt." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Boolean no-write preview flag." }
    ], ["day-shift", "reconciliation", "accept", "--milestone-overview", ".day-shift/planning/example/milestone-overview.md", "--review-result", "reconciliation-review.json", "--dry-run"]),
    writeCommand("reconciliation update", "update", "planning", "selected-existing-artifact", "selected reconciliation artifact", "selected-artifact", "updates-selected-artifact", "Updates reconciliation metadata."),
    readCommand("planning", "navigation", "planning", "Groups planning navigation surfaces."),
    withInvocation(readCommand("planning inventory", "navigation", "planning", "Reports planning hierarchy inventory."), [
        { kind: "option", name: "root", required: false, variadic: false, defaultValue: ".day-shift/planning", validation: "Repository-relative planning root or subdirectory." },
        { kind: "option", name: "project", required: false, variadic: false, defaultValue: null, validation: "Optional declared monorepo project id; explicit selection overrides current-directory inference." }
    ], ["day-shift", "planning", "inventory", "--root", ".day-shift/planning", "--project", "app", "--format", "json"]),
    withInvocation(readCommand("planning gap-report", "navigation", "planning", "Reports missing or incomplete planning artifacts."), [
        { kind: "option", name: "scope", required: false, variadic: false, defaultValue: ".day-shift/planning", validation: "Repository-relative planning artifact or directory." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Alias for scope." }
    ], ["day-shift", "planning", "gap-report", "--scope", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    withInvocation(readCommand("planning next-action", "navigation", "planning", "Reports the next likely planning action."), [{ kind: "option", name: "artifact", required: true, variadic: false, defaultValue: null, validation: "Repository-relative selected planning artifact." }], ["day-shift", "planning", "next-action", "--artifact", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    readCommand("work", "navigation", "planning", "Groups explicit planning-work candidate and selection surfaces."),
    withInvocation(readCommand("work candidates", "navigation", "planning", "Reports bounded advisory planning-work candidates without writing selection state."), [
        { kind: "option", name: "root", required: false, variadic: false, defaultValue: ".day-shift/planning", validation: "Repository-relative planning root or subdirectory." },
        { kind: "option", name: "project", required: false, variadic: false, defaultValue: null, validation: "Optional declared monorepo project id; explicit selection overrides current-directory inference." },
        { kind: "option", name: "maxResults", required: false, variadic: false, defaultValue: 10, validation: "Integer from 1 to 50." }
    ], ["day-shift", "work", "candidates", "--root", ".day-shift/planning", "--max-results", "10", "--format", "json"]),
    withInvocation(writeCommand("work create", "scaffold", "planning", "canonical-artifact", ".day-shift/planning/structured/<NN>-<work-id>/overview.md, .day-shift/planning/governed/<NN>-<slice-slug>/slice-overview.md, or .day-shift/planning/basic/tasks/<NN>-<task-id>/{task-definition.md,implementation-summary.md}", "selected-family", "creates-artifacts", "Previews or creates one numbered work root; missing specification planning readiness fails before writes with a callable spec review action and an explicit review-result-to-disposition handoff contract."), [
        { kind: "option", name: "spec", required: false, variadic: true, defaultValue: [], validation: "Repeatable repository-relative canonical specification path for Structured or Governed creation." },
        { kind: "option", name: "level", required: false, variadic: false, defaultValue: null, validation: "Optional workflow level: basic, structured, or governed." },
        { kind: "option", name: "workId", required: false, variadic: false, defaultValue: null, validation: "Optional for one Structured source specification, which derives its semantic spec id; required for multiple source specifications." },
        { kind: "option", name: "implementationOrder", required: false, variadic: false, defaultValue: null, validation: "Basic or Structured positive level-local root order of at least two digits, or next for the lowest available order; reflected as implementation_order metadata without changing semantic identity." },
        { kind: "option", name: "sliceId", required: false, variadic: false, defaultValue: null, validation: "Optional ordered Governed slice identity with a prefix of at least two digits." },
        { kind: "option", name: "initiativeId", required: false, variadic: false, defaultValue: null, validation: "Optional non-hierarchical Governed initiative identity." },
        { kind: "option", name: "task", required: false, variadic: false, defaultValue: null, validation: "Complete Basic task JSON object." },
        { kind: "option", name: "taskId", required: false, variadic: false, defaultValue: null, validation: "Basic task identity for direct input." },
        { kind: "option", name: "title", required: false, variadic: false, defaultValue: null, validation: "Optional Basic task title." },
        { kind: "option", name: "objective", required: false, variadic: false, defaultValue: null, validation: "Basic task objective." },
        { kind: "option", name: "targetPath", required: false, variadic: true, defaultValue: [], validation: "Repeatable Basic implementation target." },
        { kind: "option", name: "currentBehavior", required: false, variadic: false, defaultValue: null, validation: "Optional observed Basic behavior." },
        { kind: "option", name: "desiredBehavior", required: false, variadic: false, defaultValue: null, validation: "Required Basic desired behavior." },
        { kind: "option", name: "acceptanceCriterion", required: false, variadic: true, defaultValue: [], validation: "Repeatable Basic acceptance criterion." },
        { kind: "option", name: "validationCommand", required: false, variadic: true, defaultValue: [], validation: "Repeatable Basic validation command." },
        { kind: "option", name: "rollbackRecovery", required: false, variadic: false, defaultValue: null, validation: "Basic rollback and recovery guidance." },
        { kind: "option", name: "dependency", required: false, variadic: true, defaultValue: [], validation: "Repeatable Basic dependency." },
        { kind: "option", name: "constraint", required: false, variadic: true, defaultValue: [], validation: "Repeatable Basic constraint." },
        { kind: "option", name: "inputFile", required: false, variadic: false, defaultValue: null, validation: "Basic JSON input file." },
        { kind: "option", name: "stdin", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Read one Basic JSON contract from stdin." },
        { kind: "option", name: "interactive", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Use bounded attached-TTY Basic prompts." },
        { kind: "option", name: "agentMode", required: false, variadic: false, defaultValue: null, validation: "Optional autonomous, guided, or interactive default." },
        { kind: "option", name: "evidenceProfile", required: false, variadic: false, defaultValue: null, validation: "Optional runtime, contract, or hybrid default." },
        { kind: "option", name: "confirmIndependent", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit assertion required before a second Basic pair is created." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews identity, traceability, policy, and write preconditions without mutation." }
    ], ["day-shift", "work", "create", "--spec", ".day-shift/specs/example/example.md", "--level", "structured", "--implementation-order", "next", "--dry-run", "--format", "json"]),
    withInvocation(writeCommand("work promote", "update", "planning", "canonical-artifact", "planned Governed parents plus every direct Structured task pair or exact retained promotion transaction", "workspace", "applies-transaction", "Builds a read-only plan by default, applies only an exact Structured-to-Governed promotion, or explicitly recovers one exact inspected promotion transaction."), [
        { kind: "option", name: "overview", required: false, variadic: false, defaultValue: null, validation: "Required canonical Structured overview.md path in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "to", required: false, variadic: false, defaultValue: null, validation: "Required governed target in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "implementationOrder", required: false, variadic: false, defaultValue: null, validation: "Required positive Governed implementation order of at least two digits in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "sliceId", required: false, variadic: false, defaultValue: null, validation: "Optional explicit '<ordered-prefix>-<slice-slug>' Governed identity in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "slice", required: false, variadic: false, defaultValue: null, validation: "Required ordered Governed slice in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "phase", required: false, variadic: false, defaultValue: null, validation: "Required ordered Governed phase in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "taskMapping", required: false, variadic: true, defaultValue: [], validation: "Required complete task-to-milestone mapping set in planning/apply mode; forbidden in recovery mode." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicit no-write preview flag; incompatible with --apply." },
        { kind: "option", name: "apply", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Explicitly applies the exact revision-bound plan." },
        { kind: "option", name: "planId", required: false, variadic: false, defaultValue: null, validation: "Required exact preview plan id when --apply is selected." },
        { kind: "option", name: "actor", required: false, variadic: false, defaultValue: null, validation: "Required non-empty audit actor in apply or recovery mode." },
        { kind: "option", name: "reason", required: false, variadic: false, defaultValue: null, validation: "Required non-empty audit reason in apply or recovery mode." },
        { kind: "option", name: "appliedAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 application time; requires --apply and is forbidden in recovery mode." },
        { kind: "option", name: "recover", required: false, variadic: false, defaultValue: null, validation: "Selects the mutually exclusive exact-evidence recovery lane: roll-forward or restore." },
        { kind: "option", name: "transactionId", required: false, variadic: false, defaultValue: null, validation: "Required retained promotion transaction identity in recovery mode." },
        { kind: "option", name: "evidenceFingerprint", required: false, variadic: false, defaultValue: null, validation: "Required exact current inspection SHA-256 fingerprint in recovery mode." },
        { kind: "option", name: "recoveredAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 recovery time; requires --recover." }
    ], ["day-shift", "work", "promote", "--overview", ".day-shift/planning/structured/01-example/overview.md", "--to", "governed", "--implementation-order", "01", "--slice", "example", "--slice-id", "01-example", "--phase", "01-example", "--task-mapping", "example-task=01-example", "--format", "json"]),
    readCommand("work task", "inspection", "planning", "Groups direct Structured child-task creation surfaces."),
    withInvocation(writeCommand("work task create", "scaffold", "planning", "canonical-artifact", ".day-shift/planning/structured/<NN>-<work-id>/tasks/<NN>-<task-id>/{task-definition.md,implementation-summary.md}", "selected-family", "creates-artifacts", "Previews or creates parent-local sequence-numbered direct Structured task pairs and reports sequence, sequencePrefix, orderedTaskRootName, and taskInventoryFingerprint."), [
        { kind: "option", name: "overview", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative Structured work overview path." },
        { kind: "option", name: "task", required: false, variadic: true, defaultValue: [], validation: "Repeatable JSON object containing one complete task contract in dependency order; task ids stay unprefixed while parent-local sequence allocation supplies the numbered directory." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews the ordered pair set and revision/destination preconditions without mutation." }
    ], ["day-shift", "work", "task", "create", "--overview", ".day-shift/planning/structured/01-example/overview.md", "--task", "{\"taskId\":\"implement-example\",\"objective\":\"Implement the example.\",\"targetPaths\":[\"src/example.ts\"],\"desiredBehavior\":\"The example runs.\",\"acceptanceCriteria\":[\"The example passes.\"],\"validationCommands\":[\"pnpm test\"],\"rollbackRecovery\":\"Revert src/example.ts.\"}", "--dry-run", "--format", "json"]),
    withInvocation(readCommand("work status", "inspection", "planning", "Aggregates one Structured work overview or Governed numbered slice overview and its task/reconciliation evidence without writing canonical or derived state."), [
        { kind: "option", name: "overview", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative Structured overview.md or Governed slice-overview.md path." }
    ], ["day-shift", "work", "status", "--overview", ".day-shift/planning/structured/01-example/overview.md", "--format", "json"]),
    withInvocation(readCommand("work review", "review", "planning", "Reviews Structured work or Governed numbered-slice specification coverage and closeout evidence without persisting review or lifecycle changes."), [
        { kind: "option", name: "overview", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative Structured overview.md or Governed slice-overview.md path." }
    ], ["day-shift", "work", "review", "--overview", ".day-shift/planning/structured/01-example/overview.md", "--format", "json"]),
    readCommand("work project-review", "inspection", "planning", "Groups explicit Structured work or Governed numbered-slice project-review persistence surfaces."),
    withInvocation(writeCommand("work project-review create", "update", "planning", "canonical-artifact", ".day-shift/planning/structured/<NN>-<work-id>/project-review.md or .day-shift/planning/governed/<NN>-<slice-slug>/project-review.md", "selected-family", "creates-artifacts", "Previews or persists one canonical revision-bound Structured work or Governed numbered-slice project review."), [
        { kind: "option", name: "overview", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative Structured overview.md or Governed slice-overview.md path." },
        { kind: "option", name: "disposition", required: true, variadic: false, defaultValue: null, validation: "accepted, accepted_with_follow_up, changes_requested, or blocked." },
        { kind: "option", name: "reviewer", required: true, variadic: false, defaultValue: null, validation: "Non-empty reviewer identity." },
        { kind: "option", name: "summary", required: true, variadic: false, defaultValue: null, validation: "Non-empty authored review summary." },
        { kind: "option", name: "followUp", required: false, variadic: true, defaultValue: [], validation: "Complete JSON follow-up task contract; repeat in dependency order." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews reviewed evidence and write preconditions without mutation." }
    ], ["day-shift", "work", "project-review", "create", "--overview", ".day-shift/planning/structured/01-example/overview.md", "--disposition", "accepted", "--reviewer", "reviewer", "--summary", "Accepted.", "--dry-run", "--format", "json"]),
    readCommand("work follow-up", "inspection", "planning", "Groups explicit review-declared Structured follow-up creation surfaces."),
    withInvocation(writeCommand("work follow-up create", "scaffold", "planning", "canonical-artifact", ".day-shift/planning/structured/<NN>-<work-id>/tasks/<NN>-<task-id>/{task-definition.md,implementation-summary.md}", "selected-family", "creates-artifacts", "Previews or creates only review-declared Structured follow-up pairs with parent-local sequence allocation and reports sequence, sequencePrefix, orderedTaskRootName, and taskInventoryFingerprint."), [
        { kind: "option", name: "projectReview", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative Structured project-review path." },
        { kind: "option", name: "taskId", required: false, variadic: true, defaultValue: [], validation: "At least one review-declared follow-up task id is required by command validation; repeat in dependency order." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews task-pair paths and review-bound preconditions without mutation." }
    ], ["day-shift", "work", "follow-up", "create", "--project-review", ".day-shift/planning/structured/01-example/project-review.md", "--task-id", "follow-up-example", "--dry-run", "--format", "json"]),
    withInvocation(writeCommand("work close", "update", "planning", "selected-existing-artifact", ".day-shift/planning/structured/<NN>-<work-id>/overview.md or .day-shift/planning/governed/<NN>-<slice-slug>/slice-overview.md", "selected-artifact", "updates-selected-artifact", "Previews or explicitly closes only a currently reviewed Structured work or Governed numbered-slice overview."), [
        { kind: "option", name: "overview", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative Structured overview.md or Governed slice-overview.md path." },
        { kind: "option", name: "projectReview", required: true, variadic: false, defaultValue: null, validation: "Matching canonical repository-relative Structured work or Governed numbered-slice project-review path." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Previews current evidence and the overview-only status write without mutation." }
    ], ["day-shift", "work", "close", "--overview", ".day-shift/planning/structured/01-example/overview.md", "--project-review", ".day-shift/planning/structured/01-example/project-review.md", "--dry-run", "--format", "json"]),
    withInvocation({ ...writeCommand("work select", "update", "planning", "derived-state", "user-local work selection state", "workspace", "updates-derived-state", "Selects one planning artifact in a named user-local session."), authorization: "host-write" }, [
        { kind: "option", name: "artifact", required: true, variadic: false, defaultValue: null, validation: "Existing repository-relative planning artifact." },
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." },
        { kind: "option", name: "intent", required: false, variadic: false, defaultValue: null, validation: "Optional printable provenance up to 256 characters." },
        { kind: "option", name: "ifMatch", required: false, variadic: false, defaultValue: null, validation: "Opaque token from work current; required to replace existing session state." }
    ], ["day-shift", "work", "select", "--artifact", ".day-shift/planning/example/task-definition.md"]),
    withInvocation(readCommand("work current", "inspection", "planning", "Inspects one named user-local work selection and freshness."), [
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." }
    ], ["day-shift", "work", "current", "--session", "default", "--format", "json"]),
    withInvocation(readCommand("work next", "navigation", "planning", "Resolves explicit or stored selection and reports its next action."), [
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional existing repository-relative planning artifact." },
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." }
    ], ["day-shift", "work", "next", "--artifact", ".day-shift/planning/example/task-definition.md", "--format", "json"]),
    withInvocation({ ...writeCommand("work clear", "cleanup", "planning", "derived-state", "user-local work selection state", "workspace", "updates-derived-state", "Clears one named user-local work selection session."), authorization: "host-write" }, [
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." },
        { kind: "option", name: "ifMatch", required: false, variadic: false, defaultValue: null, validation: "Opaque token from work current; required when session state exists." }
    ], ["day-shift", "work", "clear", "--session", "default"]),
    withInvocation({ ...writeCommand("work cleanup", "cleanup", "planning", "derived-state", "user-local work selection state", "workspace", "updates-derived-state", "Clears stale named selection state while preserving fresh or absent state."), authorization: "host-write" }, [
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." },
        { kind: "option", name: "ifMatch", required: false, variadic: false, defaultValue: null, validation: "Opaque token from work current; required to clear stale state." }
    ], ["day-shift", "work", "cleanup", "--session", "default", "--if-match", "<token>"]),
    readCommand("resume", "inspection", "planning", "Groups evidence-backed local resume capsule lifecycle surfaces."),
    withInvocation({ ...writeCommand("resume create", "update", "planning", "derived-state", "user-local resume capsule state", "workspace", "updates-derived-state", "Creates or replaces one evidence-backed resume capsule."), authorization: "host-write" }, [
        { kind: "option", name: "artifact", required: true, variadic: false, defaultValue: null, validation: "Existing repository-relative planning artifact." },
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." },
        { kind: "option", name: "ifMatch", required: false, variadic: false, defaultValue: null, validation: "Opaque token from resume inspect; required to replace existing state." },
        { kind: "option", name: "completedAction", required: false, variadic: true, defaultValue: [], validation: "Historical completed action identifiers." },
        { kind: "option", name: "evidence", required: false, variadic: true, defaultValue: [], validation: "Repository-relative evidence paths to hash." },
        { kind: "option", name: "postcondition", required: false, variadic: true, defaultValue: [], validation: "Repository-relative postcondition evidence paths to hash." },
        { kind: "option", name: "blocker", required: false, variadic: true, defaultValue: [], validation: "Unresolved blocker evidence to preserve." },
        { kind: "option", name: "expiresInHours", required: false, variadic: false, defaultValue: 24, validation: "Positive expiry duration in hours." }
    ], ["day-shift", "resume", "create", "--artifact", ".day-shift/planning/example/task-definition.md"]),
    withInvocation(readCommand("resume inspect", "inspection", "planning", "Inspects capsule freshness and conflicts without writing state."), [
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit artifact identity." },
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." }
    ], ["day-shift", "resume", "inspect", "--session", "default", "--format", "json"]),
    withInvocation(readCommand("resume resume", "navigation", "planning", "Revalidates a fresh capsule and reports current action legality without writes."), [
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit artifact identity; conflicts fail closed." },
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." }
    ], ["day-shift", "resume", "resume", "--session", "default", "--format", "json"]),
    withInvocation({ ...writeCommand("resume clear", "cleanup", "planning", "derived-state", "user-local resume capsule state", "workspace", "updates-derived-state", "Clears one named resume capsule."), authorization: "host-write" }, [
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." },
        { kind: "option", name: "ifMatch", required: false, variadic: false, defaultValue: null, validation: "Opaque token from resume inspect; required when state exists." }
    ], ["day-shift", "resume", "clear", "--session", "default", "--if-match", "<token>"]),
    withInvocation({ ...writeCommand("resume cleanup", "cleanup", "planning", "derived-state", "user-local resume capsule state", "workspace", "updates-derived-state", "Clears stale or expired capsule state while preserving fresh or absent state."), authorization: "host-write" }, [
        { kind: "option", name: "session", required: false, variadic: false, defaultValue: "default", validation: "Validated local session name." },
        { kind: "option", name: "ifMatch", required: false, variadic: false, defaultValue: null, validation: "Opaque token from resume inspect; required to clear stale state." }
    ], ["day-shift", "resume", "cleanup", "--session", "default", "--if-match", "<token>"]),
    withInvocation(writeCommand("resume run open", "update", "planning", "derived-state", "selected .day-shift/runs/run-<run-id>/run-context.json", "workspace", "updates-derived-state", "Creates the managed run directory when absent and opens one bounded repository-local lifecycle run manifest without executing lifecycle commands."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Canonical repository-relative .day-shift/runs/run-<run-id> directory; created when absent." },
        { kind: "option", name: "phase", required: true, variadic: false, defaultValue: null, validation: "Existing repository-relative selected phase overview, or selected task definition for an explicit direct phase-less run anchor." },
        { kind: "option", name: "profile", required: true, variadic: false, defaultValue: null, validation: "Bounded lifecycle profile context." },
        { kind: "option", name: "metadataPosture", required: true, variadic: false, defaultValue: null, validation: "Closed posture vocabulary: read-only or sync-on-clean-review; context alone does not grant write authority." },
        { kind: "option", name: "actor", required: true, variadic: false, defaultValue: null, validation: "Bounded run-opening actor." },
        { kind: "option", name: "activeArtifact", required: true, variadic: false, defaultValue: null, validation: "Existing repository-relative active lifecycle artifact." },
        { kind: "option", name: "activeGate", required: true, variadic: false, defaultValue: null, validation: "Machine-safe active lifecycle gate identity." },
        { kind: "option", name: "openedAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 opening time; defaults to command time." }
    ], ["day-shift", "resume", "run", "open", "--run-directory", ".day-shift/runs/run-example", "--phase", ".day-shift/planning/example/phase-overview.md", "--profile", "strict-full-cycle", "--metadata-posture", "read-only", "--actor", "operator", "--active-artifact", ".day-shift/planning/example/task-definition.md", "--active-gate", "task-readiness"]),
    withInvocation(writeCommand("resume run record", "update", "planning", "derived-state", "selected lifecycle run manifest plus deterministic evidence file", "workspace", "updates-derived-state", "Records one bounded non-empty structured success or error result without executing its command."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "result", required: true, variadic: false, defaultValue: null, validation: "Repository-relative non-empty bounded structured command-result JSON file." },
        { kind: "option", name: "command", required: false, variadic: false, defaultValue: null, validation: "Optional exact command identity; must match the structured result when both are present." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional existing repository-relative active artifact; defaults to manifest state." },
        { kind: "option", name: "gate", required: true, variadic: false, defaultValue: null, validation: "Machine-safe lifecycle gate identity." },
        { kind: "option", name: "writeOutcome", required: false, variadic: false, defaultValue: null, validation: "Optional bounded write outcome when absent from the structured result." },
        { kind: "option", name: "receiptId", required: false, variadic: true, defaultValue: [], validation: "Repeatable machine-safe receipt identity." },
        { kind: "option", name: "supersedesEntryId", required: false, variadic: false, defaultValue: null, validation: "Optional prior manifest entry identity replaced by this result." },
        { kind: "option", name: "recordedAt", required: false, variadic: false, defaultValue: null, validation: "Optional ISO-8601 record time; defaults to command time." }
    ], ["day-shift", "resume", "run", "record", "--run-directory", ".day-shift/runs/run-example", "--result", ".day-shift/runs/run-example/source-result.json", "--gate", "task-readiness"]),
    withInvocation(writeCommand("resume run revise-contract", "update", "planning", "derived-state", "selected lifecycle run manifest plus deterministic indexed authoritative-review evidence", "workspace", "applies-transaction", "Previews categorized transitive contract impact, enforces provenance-bearing entry and evidence-byte budgets, atomically checkpoints an explicitly authorized bounded selected-phase and/or active-planning-artifact revision or direct Basic/Structured task revision, and preserves immutable history."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "reviewResult", required: true, variadic: false, defaultValue: null, validation: "Repository-relative current clean phase review or equivalent current phase authoring readiness result that covers the revised phase digest; a direct Basic or Structured task anchor instead requires its exact current task readiness-review with no unrelated blocker, allowing only the canonical stale-attempt supersession or evidence-recovery blocker." },
        { kind: "option", name: "activeArtifact", required: true, variadic: false, defaultValue: null, validation: "Exact existing repository-relative active planning artifact already selected by the run." },
        { kind: "option", name: "recordedBy", required: true, variadic: false, defaultValue: null, validation: "Bounded actor explicitly authorizing the contract revision." },
        { kind: "option", name: "recordedAt", required: true, variadic: false, defaultValue: null, validation: "ISO-8601 authorization time with an explicit timezone." },
        { kind: "option", name: "reason", required: true, variadic: false, defaultValue: null, validation: "Non-empty bounded reason for revising the run contract." },
        { kind: "option", name: "rollbackGate", required: true, variadic: false, defaultValue: null, validation: "Closed rollback vocabulary: phase-authoring-review, milestone-scaffold, or task-readiness." },
        { kind: "option", name: "project", required: false, variadic: false, defaultValue: null, validation: "Optional validated monorepo project identity whose impact-budget overrides apply." },
        { kind: "option", name: "maxInvalidatedEntries", required: false, variadic: false, defaultValue: null, validation: "Optional explicit non-negative safe-integer limit with precedence over project and repository policy." },
        { kind: "option", name: "maxEvidenceBytes", required: false, variadic: false, defaultValue: null, validation: "Optional explicit non-negative safe-integer evidence-byte limit with precedence over project and repository policy." },
        { kind: "option", name: "impactAcknowledgement", required: false, variadic: false, defaultValue: null, validation: "Exact digest-bound acknowledgement identity emitted by the current over-budget no-write preview; stale identities never authorize writes." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Validates current review, digests, manifest completeness, transitive impact, resolved budgets, acknowledgement binding, and exact preconditions without mutation." }
    ], ["day-shift", "resume", "run", "revise-contract", "--run-directory", ".day-shift/runs/run-example", "--review-result", ".day-shift/runs/run-example/phase-review.json", "--active-artifact", ".day-shift/planning/example/task-definition.md", "--recorded-by", "operator", "--recorded-at", "2026-08-02T18:30:00.000Z", "--reason", "Accept reviewed planning contract revision.", "--rollback-gate", "task-readiness", "--max-invalidated-entries", "25", "--dry-run", "--format", "json"]),
    withInvocation(writeCommand("resume run migrate", "migration", "planning", "derived-state", "new .day-shift/runs/run-<run-id> directory copied from one verified legacy root run", "workspace", "applies-transaction", "Previews or atomically publishes one canonical managed lifecycle run while preserving every legacy source byte for explicit cleanup."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing legacy repository-relative sandbox/run-<run-id> source directory." },
        { kind: "option", name: "expectedSourceSnapshot", required: false, variadic: false, defaultValue: null, validation: "Required only for apply: exact SHA-256 source snapshot emitted by the current dry-run." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Exactly one mode is required; verifies the complete legacy source and previews the managed destination without writes." },
        { kind: "option", name: "apply", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Exactly one mode is required; atomically publishes the snapshot-bound managed destination and leaves the source unchanged." }
    ], ["day-shift", "resume", "run", "migrate", "--run-directory", "sandbox/run-example", "--dry-run", "--format", "json"]),
    withInvocation(writeCommand("resume run pack", "materialize", "planning", "derived-state", "explicit new repository-local lifecycle pack directory", "workspace", "applies-transaction", "Verifies a lifecycle run and previews content-addressed savings by default mode contract, atomically publishes only an explicitly source-snapshot-bound destination in apply mode, or verifies an existing immutable pack without changing source evidence."), [
        { kind: "option", name: "runDirectory", required: false, variadic: false, defaultValue: null, validation: "Required for dry-run and apply: existing canonical repository-relative source .day-shift/runs/run-<run-id> directory; forbidden for verify." },
        { kind: "option", name: "destination", required: true, variadic: false, defaultValue: null, validation: "Explicit repository-local .day-shift/runs destination; must be absent for dry-run/apply and an existing non-symbolic pack directory for verify." },
        { kind: "option", name: "expectedSourceSnapshot", required: false, variadic: false, defaultValue: null, validation: "Required only for apply: exact canonical SHA-256 source snapshot emitted by the current dry-run." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Exactly one mode is required; verifies manifest and evidence bytes and reports deterministic packing metrics without writes." },
        { kind: "option", name: "apply", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Exactly one mode is required; revalidates the source snapshot and absent destination before one atomic directory publication." },
        { kind: "option", name: "verify", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Exactly one mode is required; rejects missing, altered, oversized, non-regular, symlinked, path-escaping, duplicate, or inconsistent pack objects without writes." }
    ], ["day-shift", "resume", "run", "pack", "--run-directory", ".day-shift/runs/run-example", "--destination", ".day-shift/runs/run-example-pack", "--dry-run", "--format", "json"]),
    withInvocation(readCommand("resume run status", "inspection", "planning", "Revalidates one lifecycle run and returns a bounded compact decision projection by default while preserving full-detail manifest audit history on explicit request."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit active artifact identity for conflict checking." }
    ], ["day-shift", "resume", "run", "status", "--run-directory", ".day-shift/runs/run-example", "--format", "json"]),
    withInvocation(readCommand("resume run resume", "navigation", "planning", "Revalidates canonical run evidence and derives current action legality without executing or authorizing manifest history."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit active artifact identity; conflicts fail closed." }
    ], ["day-shift", "resume", "run", "resume", "--run-directory", ".day-shift/runs/run-example", "--format", "json"]),
    withInvocation(readCommand("resume run explain", "inspection", "planning", "Selects one immutable run entry, gate, or finding code and reports only manifest- or evidence-supported divergence, invariant, invalidation, and recovery conclusions."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit active artifact identity; mismatch is returned as a typed read-only conflict." },
        { kind: "option", name: "entry", required: false, variadic: false, defaultValue: null, validation: "Exactly one selector is required: a machine-safe immutable manifest entry identity." },
        { kind: "option", name: "gate", required: false, variadic: false, defaultValue: null, validation: "Exactly one selector is required: a machine-safe manifest gate identity." },
        { kind: "option", name: "findingCode", required: false, variadic: false, defaultValue: null, validation: "Exactly one selector is required: a stable structured error or finding code." }
    ], ["day-shift", "resume", "run", "explain", "--run-directory", ".day-shift/runs/run-example", "--gate", "task-readiness", "--format", "json"]),
    withInvocation(readCommand("resume run friction-report", "inspection", "planning", "Separates CLI errors from nested validation outcomes and reports bounded retry, repair, revision, supersession, recovery, evidence-byte, and output-pressure metrics."), [
        { kind: "option", name: "runDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit active artifact identity; mismatch is returned as a typed read-only conflict." }
    ], ["day-shift", "resume", "run", "friction-report", "--run-directory", ".day-shift/runs/run-example", "--format", "json"]),
    withInvocation(readCommand("resume run compare", "inspection", "planning", "Normalizes two independently verified lifecycle runs and reports stable deltas while labeling schema, profile, scope, and terminal-state differences as non-comparable."), [
        { kind: "option", name: "leftRunDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative left .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "rightRunDirectory", required: true, variadic: false, defaultValue: null, validation: "Existing canonical repository-relative right .day-shift/runs/run-<run-id> directory." },
        { kind: "option", name: "leftArtifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit left active artifact identity for typed conflict reporting." },
        { kind: "option", name: "rightArtifact", required: false, variadic: false, defaultValue: null, validation: "Optional explicit right active artifact identity for typed conflict reporting." }
    ], ["day-shift", "resume", "run", "compare", "--left-run-directory", ".day-shift/runs/run-left", "--right-run-directory", ".day-shift/runs/run-right", "--format", "json"]),
    readCommand("workflow", "navigation", "planning", "Groups workflow explanation surfaces."),
    withInvocation({
        ...readCommand("workflow compile", "navigation", "planning", "Compiles a named authoritative lifecycle profile and canonical phase artifact into a registry-validated, revision-bound gate graph with current executability and unresolved inputs kept non-callable.", "Reads canonical workflow prose, selected artifact, command descriptors, and optional run evidence only; performs no gate, write, selection, or authorization."),
        coordinationScope: "selected-artifact",
        selectionRequired: true
    }, [
        { kind: "option", name: "profile", required: true, variadic: false, defaultValue: null, validation: "Exact named profile registered by the authoritative lifecycle guide; currently full-cycle-strict." },
        { kind: "option", name: "artifact", required: true, variadic: false, defaultValue: null, validation: "Repository-relative canonical phase-overview.md selected for compilation." },
        { kind: "option", name: "runDirectory", required: false, variadic: false, defaultValue: null, validation: "Optional canonical .day-shift/runs/run-<run-id> manifest for current gate-state projection." },
        { kind: "option", name: "actor", required: false, variadic: false, defaultValue: null, validation: "Optional observed actor used only to resolve conditional command skeleton inputs." },
        { kind: "option", name: "at", required: false, variadic: false, defaultValue: null, validation: "Optional observed ISO-8601 time used only to resolve conditional command skeleton inputs." },
        { kind: "option", name: "metadataPosture", required: false, variadic: false, defaultValue: null, validation: "Optional observed posture: read-only or sync-on-clean-review." },
        { kind: "option", name: "authorization", required: false, variadic: false, defaultValue: null, validation: "Optional observed state: authorized or not-authorized; compilation never grants authority." },
        { kind: "option", name: "expectedPlanRevision", required: false, variadic: false, defaultValue: null, validation: "Optional prior sha256 plan revision that must match every current canonical input." }
    ], ["day-shift", "workflow", "compile", "--profile", "full-cycle-strict", "--artifact", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    withInvocation(readCommand("workflow explain", "navigation", "planning", "Explains the workflow and prompt for a selected artifact."), [{ kind: "option", name: "artifact", required: true, variadic: false, defaultValue: null, validation: "Repository-relative selected planning artifact." }], ["day-shift", "workflow", "explain", "--artifact", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    readCommand("validation", "validation", "validation", "Groups validation report and checkpoint surfaces."),
    withInvocation(readCommand("validation smoke", "validation", "validation", "Reports planning validation smoke findings."), [
        { kind: "option", name: "scope", required: false, variadic: false, defaultValue: "planning", validation: "Currently planning." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional repository-relative selected planning artifact." },
        { kind: "option", name: "action", required: false, variadic: false, defaultValue: null, validation: "Exact authoritative command descriptor id; requires artifact." }
    ], ["day-shift", "validation", "smoke", "--scope", "planning", "--artifact", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    writeCommand("validation checkpoint", "sync", "validation", "derived-state", ".day-shift/state validation baseline", "workspace", "updates-derived-state", "Writes a forward-only validation baseline."),
    readCommand("validation rollup", "validation", "validation", "Reports validation rollup evidence."),
    withInvocation(readCommand("validation links-check", "validation", "validation", "Reports local trace-link evidence."), [
        { kind: "option", name: "scope", required: false, variadic: false, defaultValue: "planning", validation: "Currently planning." },
        { kind: "option", name: "format", required: false, variadic: false, defaultValue: "text", validation: "text or json." },
        { kind: "option", name: "artifact", required: false, variadic: false, defaultValue: null, validation: "Optional repository-relative planning artifact or directory." }
    ], ["day-shift", "validation", "links-check", "--scope", "planning", "--artifact", ".day-shift/planning/example/phase-overview.md", "--format", "json"]),
    readCommand("validation scope-guard", "validation", "validation", "Reserved scope-guard validation report surface."),
    readCommand("validation diff-check", "validation", "validation", "Reserved diff-check validation report surface."),
    readCommand("validation impact-analysis", "validation", "validation", "Reserved impact-analysis validation report surface."),
    readCommand("metadata", "inspection", "metadata", "Groups metadata inventory, validation, update, and sync surfaces."),
    readCommand("metadata inventory", "inspection", "metadata", "Reports metadata-bearing artifact inventory."),
    writeCommand("metadata update", "update", "metadata", "selected-existing-artifact", "selected metadata-bearing artifact", "selected-artifact", "updates-selected-artifact", "Updates metadata fields through shared helpers."),
    readCommand("metadata validate-update", "validation", "metadata", "Validates metadata update requests without writing."),
    withInvocation(writeCommand("metadata sync-status-from-review", "sync", "metadata", "selected-existing-artifact", "selected planning artifact", "selected-artifact", "updates-selected-artifact", "Synchronizes lifecycle status from completed review evidence; phase scope requires one complete revision-bound review and commits all eligible overview updates together."), [
        { kind: "option", name: "taskDefinition", required: false, variadic: false, defaultValue: null, validation: "Repository-relative task-definition.md selector; conflicts with overview selectors and phase-only inputs." },
        { kind: "option", name: "milestoneOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative milestone-overview.md selector; conflicts with other selectors and phase-only inputs." },
        { kind: "option", name: "phaseOverview", required: false, variadic: false, defaultValue: null, validation: "Repository-relative phase-overview.md selector; requires reviewResult and metadataPosture." },
        { kind: "option", name: "activeArtifact", required: false, variadic: false, defaultValue: null, validation: "Optional exact active-artifact guard." },
        { kind: "option", name: "reviewResult", required: false, variadic: false, defaultValue: null, validation: "Bounded complete phase-review JSON; phase scope requires current receipt and artifact revisions." },
        { kind: "option", name: "metadataPosture", required: false, variadic: false, defaultValue: null, validation: "Phase scope requires sync-on-clean-review; read-only never authorizes apply." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Preview exact phase and milestone transitions plus revision preconditions without writes." }
    ], ["day-shift", "metadata", "sync-status-from-review", "--phase-overview", ".day-shift/planning/example/phase-overview.md", "--review-result", "phase-review.json", "--metadata-posture", "sync-on-clean-review", "--dry-run", "--format", "json"]),
    readCommand("manifest", "inspection", "manifest", "Groups manifest update surfaces."),
    writeCommand("manifest update", "update", "manifest", "selected-existing-artifact", "selected prompt or template manifest", "selected-artifact", "updates-selected-artifact", "Updates prompt or template manifest metadata."),
    readCommand("prompt", "inspection", "prompt", "Groups prompt init, edit, update, and reconciliation surfaces."),
    readCommand("prompt show", "inspection", "prompt", "Reserved prompt rendering contract that has no runtime action yet."),
    writeCommand("prompt init", "scaffold", "prompt", "canonical-artifact", ".day-shift/prompts/ assets", "selected-family", "creates-artifacts", "Initializes prompt assets."),
    writeCommand("prompt edit", "update", "prompt", "selected-existing-artifact", "selected prompt markdown", "selected-artifact", "updates-selected-artifact", "Edits prompt markdown."),
    writeCommand("prompt update", "update", "prompt", "selected-existing-artifact", "selected prompt front matter", "selected-artifact", "updates-selected-artifact", "Updates prompt metadata."),
    readCommand("prompt reconcile", "inspection", "prompt", "Groups prompt reconciliation preview and apply surfaces."),
    withInvocation(readCommand("prompt reconcile preview", "inspection", "prompt", "Previews three-way prompt drift without writing."), [
        { kind: "option", name: "prompt", required: true, variadic: false, defaultValue: null, validation: "Repository-relative prompt path." }
    ], ["day-shift", "prompt", "reconcile", "preview", "--prompt", ".day-shift/prompts/user/task.next.md", "--format", "json"]),
    withInvocation(writeCommand("prompt reconcile apply", "update", "prompt", "selected-existing-artifact", "selected user-layer prompt and prompt materialization state", "selected-artifact", "updates-selected-artifact", "Applies an explicit preview-bound prompt reconciliation decision."), [
        { kind: "option", name: "prompt", required: true, variadic: false, defaultValue: null, validation: "Repository-relative prompt path." },
        { kind: "option", name: "decision", required: true, variadic: false, defaultValue: null, validation: "preserve or replace." },
        { kind: "option", name: "previewHash", required: true, variadic: false, defaultValue: null, validation: "Exact hash returned by prompt reconcile preview." }
    ], ["day-shift", "prompt", "reconcile", "apply", "--prompt", ".day-shift/prompts/user/task.next.md", "--decision", "preserve", "--preview-hash", "<sha256>", "--format", "json"]),
    readCommand("template", "inspection", "template", "Groups template materialization, update, and reconciliation surfaces."),
    writeCommand("template materialize", "materialize", "template", "canonical-artifact", "template destination path", "selected-artifact", "materializes-assets", "Materializes a template to its destination."),
    writeCommand("template update", "update", "template", "selected-existing-artifact", "selected template front matter", "selected-artifact", "updates-selected-artifact", "Updates template metadata."),
    readCommand("template reconcile", "inspection", "template", "Groups packaged-template reconciliation preview and apply surfaces."),
    withInvocation(readCommand("template reconcile preview", "inspection", "template", "Previews one workspace template against its packaged source without writing."), [
        { kind: "option", name: "template", required: true, variadic: false, defaultValue: null, validation: "Repository-relative packaged workspace template path." }
    ], ["day-shift", "template", "reconcile", "preview", "--template", ".day-shift/templates/phase-overview.md", "--format", "json"]),
    withInvocation(writeCommand("template reconcile apply", "update", "template", "selected-existing-artifact", "selected packaged workspace template", "selected-artifact", "updates-selected-artifact", "Applies an explicit preview-bound template reconciliation decision."), [
        { kind: "option", name: "template", required: true, variadic: false, defaultValue: null, validation: "Repository-relative packaged workspace template path." },
        { kind: "option", name: "decision", required: true, variadic: false, defaultValue: null, validation: "preserve or replace." },
        { kind: "option", name: "previewHash", required: true, variadic: false, defaultValue: null, validation: "Exact hash returned by template reconcile preview." }
    ], ["day-shift", "template", "reconcile", "apply", "--template", ".day-shift/templates/phase-overview.md", "--decision", "replace", "--preview-hash", "<sha256>", "--format", "json"]),
    readCommand("templates", "list", "template", "Lists available templates."),
    readCommand("templates list", "list", "template", "Lists available template inventory."),
    readCommand("structural-pressure", "inspection", "structural-pressure", "Groups structural-pressure report and sync surfaces."),
    readCommand("structural-pressure report", "review", "structural-pressure", "Reports structural pressure evidence."),
    writeCommand("structural-pressure sync", "sync", "structural-pressure", "derived-state", ".day-shift/state/structural-pressure.json", "workspace", "updates-derived-state", "Synchronizes structural-pressure derived state."),
    readCommand("workspace", "inspection", "workspace", "Groups workspace inspection, migration, and content-upgrade surfaces."),
    withInvocation(writeCommand("workspace migrate", "migration", "workspace", "workspace-metadata", "numbered Basic/Structured roots, direct Structured task pairs, rewritten references, metadata, revision rebindings, and transaction evidence", "workspace", "applies-migration", "Checks, previews, applies, or recovers explicit workspace migrations; structural results expose root/task ordering, moves, rewrites, metadataInsertions, revisionRebindings, recoveryActions, and the exact planDigest."), [
        { kind: "option", name: "targetSchemaVersion", required: false, variadic: false, defaultValue: null, validation: "Supported workspace metadata schema version; separate from structural migration lanes." },
        { kind: "option", name: "dryRun", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Read-only schema migration preview." },
        { kind: "option", name: "check", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Read-only structural actionability check." },
        { kind: "option", name: "plan", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Read-only complete structural migration plan." },
        { kind: "option", name: "apply", valueType: "boolean", required: false, variadic: false, defaultValue: false, validation: "Apply only the exact current structural plan digest through the repository transaction boundary." },
        { kind: "option", name: "mapping", required: false, variadic: true, defaultValue: [], validation: "Repeatable <work-unit-id>=<basic|structured|governed> selection." },
        { kind: "option", name: "rootOrder", required: false, variadic: true, defaultValue: [], validation: "Repeatable selected Basic/Structured <work-unit-id>=<order> root-order conflict resolution; orders use at least two digits." },
        { kind: "option", name: "taskSequence", required: false, variadic: true, defaultValue: [], validation: "Repeatable selected Structured <work-unit-id>:<task-id>=<1..99> parent-local sequence conflict resolution." },
        { kind: "option", name: "expectedPlanDigest", required: false, variadic: false, defaultValue: null, validation: "Exact current structural plan digest required for apply." },
        { kind: "option", name: "confirm", required: false, variadic: false, defaultValue: null, validation: "Required write token apply-workspace-migration." },
        { kind: "option", name: "recover", required: false, variadic: false, defaultValue: null, validation: "Explicit exact-evidence roll-forward or restore lane." },
        { kind: "option", name: "transactionId", required: false, variadic: false, defaultValue: null, validation: "Exact interrupted migration transaction identity." },
        { kind: "option", name: "evidenceFingerprint", required: false, variadic: false, defaultValue: null, validation: "Exact current operational recovery fingerprint." },
        { kind: "option", name: "actor", required: false, variadic: false, defaultValue: null, validation: "Bounded recovery audit actor." },
        { kind: "option", name: "reason", required: false, variadic: false, defaultValue: null, validation: "Bounded recovery reason." },
        { kind: "option", name: "recoveredAt", required: false, variadic: false, defaultValue: null, validation: "Optional recovery timestamp." },
        { kind: "option", name: "family", required: false, variadic: false, defaultValue: null, validation: "Only full workspace migration is supported." },
        { kind: "option", name: "field", required: false, variadic: false, defaultValue: null, validation: "Partial field migration is rejected." }
    ], ["day-shift", "workspace", "migrate", "--plan", "--mapping", "legacy-work=structured", "--root-order", "legacy-work=01", "--task-sequence", "legacy-work:example-task=1", "--format", "json"]),
    readCommand("workspace upgrade", "inspection", "workspace", "Groups workspace content-upgrade preview and apply surfaces."),
    withInvocation(readCommand("workspace upgrade preview", "inspection", "workspace", "Previews latest-layer prompt delivery without writing."), [
        { kind: "option", name: "latestMode", required: false, variadic: false, defaultValue: "materialize", validation: "materialize, disabled, or legacy-not-materialized." }
    ], ["day-shift", "workspace", "upgrade", "preview", "--latest-mode", "materialize", "--format", "json"]),
    withInvocation(writeCommand("workspace upgrade apply", "migration", "workspace", "workspace-metadata", ".day-shift/prompts/latest and prompt materialization state", "workspace", "applies-migration", "Applies a preview-bound latest-layer prompt upgrade without writing user prompts."), [
        { kind: "option", name: "latestMode", required: false, variadic: false, defaultValue: "materialize", validation: "materialize, disabled, or legacy-not-materialized." },
        { kind: "option", name: "previewHash", required: true, variadic: false, defaultValue: null, validation: "Exact hash returned by workspace upgrade preview." },
        { kind: "option", name: "confirm", required: true, variadic: false, defaultValue: null, validation: `${cli_constants_1.CLI_WORKSPACE_UPGRADE_CONFIRMATION}.` }
    ], ["day-shift", "workspace", "upgrade", "apply", "--latest-mode", "materialize", "--preview-hash", "<sha256>", "--confirm", cli_constants_1.CLI_WORKSPACE_UPGRADE_CONFIRMATION, "--format", "json"]),
    readCommand("version", "inspection", "release", "Groups installed Day Shift version manager surfaces."),
    writeCommand("version alias", "update", "release", "derived-state", "version-manager alias metadata", "local-installation", "updates-derived-state", "Groups version-manager alias update surfaces."),
    readCommand("version alias list", "list", "release", "Lists version-manager aliases."),
    writeCommand("version alias set", "update", "release", "derived-state", "version-manager alias metadata", "local-installation", "updates-derived-state", "Sets a version-manager alias."),
    readCommand("version check", "validation", "release", "Checks version availability without installing."),
    readCommand("version current", "inspection", "release", "Reports the currently selected managed version."),
    readCommand("version doctor", "inspection", "release", "Reports version-manager diagnostics."),
    writeCommand("version install", "install", "release", "local-install-target", "version-manager package state", "local-installation", "installs-local-files", "Installs a local Day Shift package source into version-manager state."),
    readCommand("version list", "list", "release", "Lists installed managed versions."),
    writeCommand("version pin", "update", "release", "derived-state", "version-manager selection metadata", "local-installation", "updates-derived-state", "Pins managed version selection."),
    writeCommand("version uninstall", "cleanup", "release", "local-install-target", "version-manager package state", "local-installation", "prunes-generated-output", "Uninstalls managed versions from local state."),
    writeCommand("version use", "update", "release", "derived-state", "version-manager selection metadata", "local-installation", "updates-derived-state", "Selects a managed version for current use."),
    readCommand("release", "inspection", "release", "Groups release validation and generated-output surfaces."),
    writeCommand("release build", "release", "release", "generated-output", "release/<version>/", "release-output", "materializes-assets", "Builds local release output."),
    readCommand("release check", "validation", "release", "Checks local release inputs and staged outputs."),
    writeCommand("release manifest", "release", "release", "generated-output", "release manifest", "release-output", "materializes-assets", "Generates release manifest output."),
    writeCommand("release archive", "release", "release", "generated-output", "release archives", "release-output", "materializes-assets", "Generates release archives."),
    writeCommand("release checksum", "release", "release", "generated-output", "release checksums", "release-output", "materializes-assets", "Generates release checksums."),
    writeCommand("release installer", "release", "release", "generated-output", "release installer assets", "release-output", "materializes-assets", "Generates release installer assets."),
    writeCommand("release notes", "release", "release", "generated-output", "release notes draft", "release-output", "materializes-assets", "Generates release notes draft output."),
    writeCommand("release retention", "cleanup", "release", "generated-output", "release output retention targets", "release-output", "prunes-generated-output", "Prunes old release output according to retention policy."),
    writeCommand("release cleanup", "cleanup", "release", "generated-output", "release output directory", "release-output", "prunes-generated-output", "Cleans generated release output.")
];
// Legacy adapters remain authoritative for command-specific and cross-field
// validation. This catalog makes their invocation surface available to native
// tool consumers while those adapters converge on shared structured parsing.
const LEGACY_COMMAND_INPUTS = Object.freeze({
    "agent": ["b:verbose"], "agent orient": ["b:verbose"],
    "completion complete": ["!o:shell", "!o:line", "!o:cursor"], "completion install": ["!o:shell", "b:dryRun", "b:force"],
    "completion script": ["!o:shell"], "completion uninstall": ["!o:shell", "b:dryRun"],
    "config get": ["a:selector"], "config inventory": ["o:licenseFile"], "config set": ["!a:key", "!a:value"],
    "ignore install": ["b:yes"], "implementation-summary update": ["!o:summary", "o:activeArtifact", "o:field"],
    "init": ["b:noAgent", "b:withoutTemplates", "b:dryRun", "b:force", "o:directory", "o:sandboxRunId"],
    "license cleanup-reminders": ["o:licenseFile", "b:dryRun"], "license install": ["!a:license-file"], "license status": ["o:licenseFile"],
    "link disposition add": ["!o:status", "!o:target", "o:replacementTarget", "o:sourceArtifact", "o:traceField", "o:scope", "o:reason", "o:format"],
    "link disposition apply": ["o:id", "o:target", "b:allMigrated", "o:artifact", "b:includeBodyReferences", "b:dryRun", "o:format"],
    "link disposition delete": ["o:id", "o:target", "o:format"], "link disposition list": ["o:status", "o:format"],
    "link disposition preview": ["o:id", "o:target", "o:artifact", "o:format"], "link disposition show": ["o:id", "o:target", "o:format"],
    "link disposition update": ["o:id", "o:target", "o:status", "o:replacementTarget", "b:clearReplacementTarget", "o:sourceArtifact", "o:traceField", "o:scope", "o:reason", "b:clearReason", "o:format"],
    "manifest update": ["!o:manifest", "o:field"], "metadata inventory": ["o:root"],
    "metadata sync-status-from-review": ["o:taskDefinition", "o:milestoneOverview", "o:phaseOverview", "o:activeArtifact", "o:reviewResult", "o:metadataPosture", "b:dryRun"],
    "metadata update": ["!o:artifact", "o:activeArtifact", "o:field"], "metadata validate-update": ["!o:artifact", "o:activeArtifact", "o:field"],
    "milestone review": ["!o:milestoneOverview"], "phase new": ["!o:sliceOverview", "o:phaseSlug", "b:fullSet", "o:phaseTitle"],
    "prompt edit": ["!o:prompt"], "prompt init": ["!o:prompt", "b:force"], "prompt update": ["!o:prompt", "o:field"],
    "prompt reconcile preview": ["!o:prompt"], "prompt reconcile apply": ["!o:prompt", "!o:decision", "!o:previewHash"],
    "reconciliation update": ["!o:reconciliation", "o:activeArtifact", "o:field"],
    "release archive": ["o:releaseVersion", "o:outputDir", "b:dryRun"],
    "release build": ["o:releaseVersion", "o:commandName", "o:outputDir", "b:dryRun", "b:dirty"],
    "release check": ["o:releaseVersion", "o:commandName", "o:outputDir"], "release checksum": ["o:releaseVersion", "o:outputDir", "b:dryRun"],
    "release cleanup": ["o:outputDir", "b:confirm", "b:dryRun"], "release installer": ["o:releaseVersion", "o:commandName", "o:outputDir", "b:dryRun"],
    "release manifest": ["o:releaseVersion", "o:commandName", "o:outputDir", "b:dryRun"], "release notes": ["o:releaseVersion", "o:commandName", "o:outputDir", "b:dryRun"],
    "release retention": ["o:releaseVersion", "o:outputDir", "o:keep", "b:dryRun"],
    "slice new": ["o:specId", "o:sliceId", "b:dryRun"], "slice update": ["!o:sliceOverview", "o:activeArtifact", "o:field"],
    "spec add": ["o:entryJson", "o:entryFile"], "spec archive": ["!a:id"], "spec unlink": ["!a:id"],
    "structural-pressure report": ["o:path"], "structural-pressure sync": ["!o:milestoneReconciliation"],
    "task promote": ["o:taskDefinition", "o:to", "o:workId", "o:spec", "o:implementationOrder", "o:sliceId", "o:slice", "o:phase", "o:milestone", "b:dryRun", "b:apply", "o:planId", "o:actor", "o:reason", "o:appliedAt", "o:recover", "o:transactionId", "o:evidenceFingerprint", "o:recoveredAt"], "task readiness-review": ["!o:taskDefinition", "!o:reviewedBy", "!o:reviewedAt"], "task review": ["!o:taskDefinition"],
    "template materialize": ["!o:template", "!o:mode", "o:destination", "b:manifestDestination", "o:placeholder", "b:dryRun", "b:force"],
    "template update": ["!o:template", "o:field"],
    "template reconcile preview": ["!o:template"], "template reconcile apply": ["!o:template", "!o:decision", "!o:previewHash"],
    "validation checkpoint": ["o:scope"], "validation rollup": ["o:scope", "o:format", "o:artifact"],
    "version alias set": ["!a:name", "!a:version"], "version check": ["a:version", "b:network"],
    "version install": ["o:from", "o:assertVersion"], "version pin": ["!a:version"],
    "version uninstall": ["a:version", "o:replaceWith", "b:confirmSelectedRemoval"], "version use": ["!a:version"],
    "workspace migrate": ["o:targetSchemaVersion", "b:dryRun", "b:check", "b:plan", "b:apply", "o:mapping", "o:rootOrder", "o:taskSequence", "o:expectedPlanDigest", "o:confirm", "o:recover", "o:transactionId", "o:evidenceFingerprint", "o:actor", "o:reason", "o:recoveredAt", "o:family", "o:field"],
    "work promote": ["o:overview", "o:to", "o:implementationOrder", "o:sliceId", "o:slice", "o:phase", "o:taskMapping", "b:dryRun", "b:apply", "o:planId", "o:actor", "o:reason", "o:appliedAt", "o:recover", "o:transactionId", "o:evidenceFingerprint", "o:recoveredAt"],
    "workspace upgrade preview": ["o:latestMode"], "workspace upgrade apply": ["o:latestMode", "!o:previewHash", "!o:confirm"]
});
const VARIADIC_LEGACY_INPUTS = new Set(["field", "placeholder"]);
function addLegacyInvocationInputs(descriptor) {
    if (descriptor.inputs.length > 0)
        return descriptor;
    const tokens = LEGACY_COMMAND_INPUTS[descriptor.command];
    if (tokens === undefined)
        return descriptor;
    return {
        ...descriptor,
        inputs: tokens.map((token) => {
            const separator = token.indexOf(":");
            const prefix = token.slice(0, separator);
            const name = token.slice(separator + 1);
            return {
                kind: prefix.endsWith("a") ? "argument" : "option",
                name,
                valueType: prefix === "b" ? "boolean" : "string",
                required: prefix.startsWith("!"),
                variadic: name === "mapping" ||
                    (VARIADIC_LEGACY_INPUTS.has(name) && descriptor.command !== "workspace migrate"),
                defaultValue: prefix === "b" ? false : null,
                validation: "Validated by the command adapter; descriptor/runtime input-name drift is enforced globally."
            };
        })
    };
}
const RESERVED_COMMAND_FAMILY_CONTAINERS = new Set([
    "completion",
    "commands",
    "config",
    "ignore",
    "ignore integration",
    "implementation-summary",
    "license",
    "link",
    "link disposition",
    "metadata",
    "manifest",
    "milestone",
    "phase",
    "planning",
    "prompt",
    "prompt reconcile",
    "release",
    "resume",
    "reconciliation",
    "slice",
    "spec",
    "spec source",
    "structural-pressure",
    "task",
    "task waiver",
    "template",
    "template reconcile",
    "templates",
    "validation",
    "version",
    "workflow",
    "work",
    "work follow-up",
    "work project-review",
    "work task",
    "workspace",
    "workspace upgrade"
]);
const PLANNED_COMMAND_DESCRIPTORS = new Set([
    "prompt show",
    "slice review",
    "validation scope-guard",
    "validation diff-check",
    "validation impact-analysis"
]);
const COMMAND_DESCRIPTOR_REGISTRATIONS = BASE_COMMAND_DESCRIPTOR_REGISTRATIONS
    .map(applyAuthoredCommandAvailability)
    .map(addLegacyInvocationInputs);
function applyAuthoredCommandAvailability(registration) {
    const availability = PLANNED_COMMAND_DESCRIPTORS.has(registration.command)
        ? "planned"
        : RESERVED_COMMAND_FAMILY_CONTAINERS.has(registration.command)
            ? "reserved"
            : "callable";
    if (availability === "callable") {
        return { ...registration, availability };
    }
    return {
        ...registration,
        availability,
        examples: []
    };
}
function normalizeCommandCapability(registration) {
    return (0, command_capability_evidence_1.normalizeCommandCapabilityWithTokens)(registration, command_availability_1.COMMAND_AVAILABILITY_TOKENS, exports.COMMAND_CAPABILITY_TOKENS);
}
function normalizeCommandCapabilityRegistry(registrations) {
    return (0, command_capability_evidence_1.normalizeCommandCapabilityRegistryWith)(registrations, normalizeCommandCapability);
}
function findCommandCapability(registry, command) {
    return (0, command_capability_evidence_1.findCommandCapabilityInRegistry)(registry, command);
}
exports.COMMAND_DESCRIPTOR_REGISTRY = (0, command_descriptors_1.normalizeCommandDescriptorRegistry)(COMMAND_DESCRIPTOR_REGISTRATIONS, normalizeCommandCapability);
exports.COMMAND_CAPABILITY_REGISTRY = exports.COMMAND_DESCRIPTOR_REGISTRY;
function getCommandDescriptorRegistry() {
    return exports.COMMAND_DESCRIPTOR_REGISTRY.map(command_descriptor_projections_1.cloneCommandDescriptor);
}
function getRegisteredCommandDescriptor(command) {
    return (0, command_descriptors_1.findCommandDescriptor)(exports.COMMAND_DESCRIPTOR_REGISTRY, command);
}
function getCommandCapabilityRegistry() {
    return exports.COMMAND_CAPABILITY_REGISTRY.map((entry) => ({ ...entry }));
}
function getRegisteredCommandCapability(command) {
    return findCommandCapability(exports.COMMAND_CAPABILITY_REGISTRY, command);
}
function commandCapabilityEvidenceOperations() {
    return {
        defaultRegistry: exports.COMMAND_CAPABILITY_REGISTRY,
        noWriteEvidenceSeverities: exports.NO_WRITE_EVIDENCE_SEVERITIES,
        sourceSpecOnlyIntentPhrases: exports.SOURCE_SPEC_ONLY_INTENT_PHRASES,
        sourceSpecReviewRefinementIntentPhrases: exports.SOURCE_SPEC_REVIEW_REFINEMENT_INTENT_PHRASES,
        planningAdvancementIntentPhrases: exports.PLANNING_ADVANCEMENT_INTENT_PHRASES,
        findCommandCapability
    };
}
function createNoWriteBoundaryEvidence(commandOrCapability, options = {}) {
    return (0, command_capability_evidence_1.createNoWriteBoundaryEvidenceWithOperations)(commandOrCapability, options, commandCapabilityEvidenceOperations());
}
function createNoWriteRecommendation(command, options = {}) {
    return (0, command_capability_evidence_1.createNoWriteRecommendationWithOperations)(command, options, commandCapabilityEvidenceOperations());
}
function createNoWriteFindingEvidenceDetails(commandOrCapability, options = {}) {
    return (0, command_capability_evidence_1.createNoWriteFindingEvidenceDetailsWithOperations)(commandOrCapability, options, commandCapabilityEvidenceOperations());
}
function classifySourceSpecLifecycleIntent(input, selectedSourceSpecSurface = cli_constants_1.CLI_DEFAULT_SOURCE_SPEC_SURFACE) {
    return (0, command_capability_evidence_1.classifySourceSpecLifecycleIntentWithOperations)(input, selectedSourceSpecSurface, commandCapabilityEvidenceOperations());
}
function createSourceSpecLifecycleGateEvidenceDetails(input, options = {}) {
    return (0, command_capability_evidence_1.createSourceSpecLifecycleGateEvidenceDetailsWithOperations)(input, options, commandCapabilityEvidenceOperations());
}
