"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VALIDATION_COMMAND_SURFACE_CONTRACT = void 0;
exports.getValidationCommandSurfaceContract = getValidationCommandSurfaceContract;
exports.createValidationCommand = createValidationCommand;
const validation_checkpoint_1 = require("../validation-checkpoint");
const validation_links_check_1 = require("../validation-links-check");
const validation_rollup_1 = require("../validation-rollup");
const validation_smoke_1 = require("../validation-smoke");
const registration_1 = require("../registration");
const REPOSITORY_INPUT_LANE = {
    name: "repository",
    option: null,
    required: false,
    supportedValues: ["current repository root"],
    notes: "Default execution lane; resolves from the current local repository without requiring remote availability."
};
const ARTIFACT_INPUT_LANE = {
    name: "artifact",
    option: "--artifact <path>",
    required: false,
    supportedValues: ["repository-relative planning artifact path"],
    notes: "Optional focus lane for artifact-specific validation guidance or trace-link evidence."
};
const PLANNING_SCOPE_INPUT_LANE = {
    name: "scope",
    option: "--scope <scope>",
    required: false,
    supportedValues: ["planning"],
    notes: "Only the local planning scope is supported for this command family."
};
const FORMAT_INPUT_LANE = {
    name: "format",
    option: "--format <format>",
    required: false,
    supportedValues: ["text", "json"],
    notes: "Uses the shared Day Shift output format selector."
};
const CHANGED_PATH_INPUT_LANE = {
    name: "changed-path",
    option: "--changed-path <path>",
    required: true,
    supportedValues: ["explicit canonical repository-relative changed path"],
    notes: "Caller-provided changed-path input only; this lane does not discover changed files from Git status, staged files, commits, diffs, or remotes."
};
exports.VALIDATION_COMMAND_SURFACE_CONTRACT = {
    commandFamily: "day-shift validation",
    rejectsTopLevelValidateReplacement: true,
    supportedScope: "planning",
    outputFormats: ["text", "json"],
    networkPolicy: "Validation command execution is local-only; read-only validation surfaces must not require network access, remote provider lookup, remote provider availability checks, package registry lookup, remote source availability checks, Git remote inspection, or network-dependent completeness claims.",
    surfaces: [
        {
            name: "smoke",
            command: "day-shift validation smoke",
            implementationState: "existing",
            responsibility: "Concise read-only planning validation summary and advisory safe-next-step report.",
            acceptedInputs: [REPOSITORY_INPUT_LANE, ARTIFACT_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: true,
            writeCapable: false,
            noWriteBoundary: "Does not repair metadata, synchronize links, mutate status, write checkpoints, or generate planning artifacts."
        },
        {
            name: "checkpoint",
            command: "day-shift validation checkpoint",
            implementationState: "existing",
            responsibility: "Forward-only planning validation baseline writer for current repo-wide smoke findings.",
            acceptedInputs: [REPOSITORY_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: false,
            writeCapable: true,
            noWriteBoundary: "Checkpoint is the only write-capable surface in this validation command family; it writes only the forward-only baseline."
        },
        {
            name: "rollup",
            command: "day-shift validation rollup",
            implementationState: "existing",
            responsibility: "Future repository validation rollup over supported local planning evidence lanes.",
            acceptedInputs: [REPOSITORY_INPUT_LANE, ARTIFACT_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: true,
            writeCapable: false,
            noWriteBoundary: "Reports rollup evidence only; must not repair links, synchronize metadata, write checkpoints, mutate status, or generate planning artifacts."
        },
        {
            name: "links-check",
            command: "day-shift validation links-check",
            implementationState: "existing",
            responsibility: "Registered read-only links-check command surface for local trace-link resolution, hierarchy, and taxonomy validation over repository-relative planning links.",
            acceptedInputs: [REPOSITORY_INPUT_LANE, ARTIFACT_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: true,
            writeCapable: false,
            noWriteBoundary: "Reports trace-link evidence only; must not repair links, rewrite parent references, synchronize metadata, write checkpoints, mutate status, or generate planning artifacts."
        },
        {
            name: "scope-guard",
            command: "day-shift validation scope-guard",
            implementationState: "reserved",
            responsibility: "Future read-only comparison of normalized requested implementation paths against declared task or milestone target-path evidence, reporting evidence and recovery guidance only.",
            acceptedInputs: [REPOSITORY_INPUT_LANE, ARTIFACT_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: true,
            writeCapable: false,
            noWriteBoundary: "Reports scope-guard findings and recovery guidance only; must not repair artifacts, update metadata, rewrite task or milestone scope, regenerate planning artifacts, create tasks, capture backlog entries, capture emergent specs, write checkpoints, apply recovery copies, inspect Git status for undisclosed changed files, stage files, revert files, fetch remotes, or perform impact analysis.",
            userDirectedFollowUpCommandFamilies: [
                "planning commands",
                "emergent-intake planning",
                "metadata update commands",
                "validation checkpoint",
                "task execution"
            ]
        },
        {
            name: "diff-check",
            command: "day-shift validation diff-check",
            implementationState: "reserved",
            responsibility: "Future read-only classification of explicit caller-provided changed paths against declared planning scope, reporting evidence and recovery guidance only.",
            acceptedInputs: [REPOSITORY_INPUT_LANE, CHANGED_PATH_INPUT_LANE, ARTIFACT_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: true,
            writeCapable: false,
            noWriteBoundary: "Reports diff-check changed-path findings and recovery guidance only; must not infer changed paths from Git status, staged files, commits, diffs, or remotes, repair artifacts, update metadata, rewrite task or milestone scope, regenerate planning artifacts, create tasks, capture backlog entries, capture emergent specs, write checkpoints, apply recovery copies, stage files, revert files, fetch remotes, or perform impact analysis.",
            userDirectedFollowUpCommandFamilies: [
                "planning commands",
                "emergent-intake planning",
                "metadata update commands",
                "validation checkpoint",
                "task execution"
            ]
        },
        {
            name: "impact-analysis",
            command: "day-shift validation impact-analysis",
            implementationState: "reserved",
            responsibility: "Future read-only local impact analysis over bounded planning artifact inputs, consumed validation evidence, and explicit caller-provided changed-path evidence, emitted through the shared validation finding envelope.",
            consumesEvidenceFrom: ["scope-guard", "diff-check", "links-check", "rollup"],
            preservesIndependentReportingFor: ["scope-guard", "diff-check", "links-check", "rollup"],
            excludedResponsibilities: [
                "declared-scope approval decisions",
                "changed-path diff classification ownership",
                "trace-link repair",
                "hierarchy repair",
                "validation checkpoint writing",
                "repository-wide rollup replacement"
            ],
            acceptedInputs: [REPOSITORY_INPUT_LANE, CHANGED_PATH_INPUT_LANE, ARTIFACT_INPUT_LANE, PLANNING_SCOPE_INPUT_LANE, FORMAT_INPUT_LANE],
            localOnly: true,
            readOnly: true,
            writeCapable: false,
            noWriteBoundary: "Reports impact-analysis findings and input evidence only; blocking findings require no-write recovery and must not authorize partial writes, guessed repairs, metadata mutation, artifact generation, planning artifact generation, backlog capture, task creation, scope expansion, status updates, trace synchronization, checkpoint writes, staging, reverting, Git changed-file discovery, Git remote inspection, remote fetches, provider availability checks, package registry lookup, or scope-guard approval decisions.",
            userDirectedFollowUpCommandFamilies: [
                "planning commands",
                "validation scope-guard",
                "validation diff-check",
                "metadata update commands",
                "task execution"
            ]
        }
    ]
};
function getValidationCommandSurfaceContract() {
    return {
        ...exports.VALIDATION_COMMAND_SURFACE_CONTRACT,
        outputFormats: [...exports.VALIDATION_COMMAND_SURFACE_CONTRACT.outputFormats],
        surfaces: exports.VALIDATION_COMMAND_SURFACE_CONTRACT.surfaces.map((surface) => ({
            ...surface,
            consumesEvidenceFrom: surface.consumesEvidenceFrom === undefined
                ? undefined
                : [...surface.consumesEvidenceFrom],
            preservesIndependentReportingFor: surface.preservesIndependentReportingFor === undefined
                ? undefined
                : [...surface.preservesIndependentReportingFor],
            excludedResponsibilities: surface.excludedResponsibilities === undefined
                ? undefined
                : [...surface.excludedResponsibilities],
            acceptedInputs: surface.acceptedInputs.map((input) => ({
                ...input,
                supportedValues: [...input.supportedValues]
            }))
        }))
    };
}
async function createValidationCommand() {
    const { Command } = await import("commander");
    const command = new Command("validation");
    command.description("Run validation guidance and manage forward-only validation checkpoints over supported Day Shift workflow surfaces.");
    (0, registration_1.registerCommand)(command, await (0, validation_checkpoint_1.createValidationCheckpointCommand)());
    (0, registration_1.registerCommand)(command, await (0, validation_links_check_1.createValidationLinksCheckCommand)());
    (0, registration_1.registerCommand)(command, await (0, validation_rollup_1.createValidationRollupCommand)());
    (0, registration_1.registerCommand)(command, await (0, validation_smoke_1.createValidationSmokeCommand)());
    return command;
}
