"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TRACE_LINK_HIERARCHY_RULES = exports.TRACE_LINK_RESOLUTION_RULES = exports.TRACE_LINK_TRAVERSAL_BOUNDARIES = exports.TRACEABLE_ARTIFACT_COVERAGE = void 0;
exports.TRACEABLE_ARTIFACT_COVERAGE = [
    {
        family: "specification",
        artifactType: "specification",
        traceFields: [
            {
                field: "source.ref",
                source: "front-matter",
                requirement: "required",
                valueShape: "source-reference",
                relationship: "specification-to-source",
                notes: "Covered only as an explicit specification source reference; remote availability is not checked locally."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions"
        ]
    },
    {
        family: "spec_index_entry",
        traceFields: [
            {
                field: "spec_path",
                source: "spec-index-entry",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "spec-index-entry-to-specification",
                notes: "Repository-relative specification path from .day-shift/specs/index.json."
            },
            {
                field: "source.ref",
                source: "spec-index-entry",
                requirement: "required",
                valueShape: "source-reference",
                relationship: "spec-index-entry-to-source",
                notes: "Source reference is explicit index metadata and remains separate from specification front matter."
            },
            {
                field: "linked_slice.path",
                source: "spec-index-entry",
                requirement: "optional",
                valueShape: "single-local-path",
                relationship: "spec-index-entry-to-slice-overview",
                notes: "Missing linked_slice metadata is not a broken local trace link."
            }
        ],
        unsupportedReferences: [
            "legacy linked_slice.id without an explicit path",
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions"
        ]
    },
    {
        family: "slice_overview",
        artifactType: "slice_overview",
        traceFields: [
            {
                field: "upstream.specs",
                source: "front-matter",
                requirement: "required",
                valueShape: "multi-spec-list",
                relationship: "slice-overview-to-specifications",
                notes: "Preserves the multi-spec shape; do not collapse into one inferred source reference."
            },
            {
                field: "body.Navigation",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "slice-overview-navigation-links",
                notes: "Visible navigation references can be materialized as Markdown links without changing front matter metadata."
            },
            {
                field: "body.Phases",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "slice-overview-to-phase-overviews",
                notes: "Declared phase slugs are local child-planning evidence and can be materialized to canonical phase overview links."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions"
        ]
    },
    {
        family: "phase_overview",
        artifactType: "phase_overview",
        traceFields: [
            {
                field: "upstream.specs",
                source: "front-matter",
                requirement: "required",
                valueShape: "multi-spec-list",
                relationship: "phase-overview-to-specifications",
                notes: "Preserves the multi-spec shape; do not collapse into one inferred source reference."
            },
            {
                field: "upstream.slice_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "phase-overview-to-slice-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "body.Navigation",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "phase-overview-navigation-links",
                notes: "Visible parent navigation references can be materialized as Markdown links without changing front matter metadata."
            },
            {
                field: "body.Milestones",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "phase-overview-to-milestone-overviews",
                notes: "Declared milestone slugs are local child-planning evidence and can be materialized to canonical milestone overview links."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions"
        ]
    },
    {
        family: "milestone_overview",
        artifactType: "milestone_overview",
        traceFields: [
            {
                field: "upstream.specs",
                source: "front-matter",
                requirement: "required",
                valueShape: "multi-spec-list",
                relationship: "milestone-overview-to-specifications",
                notes: "Preserves the multi-spec shape; do not collapse into one inferred source reference."
            },
            {
                field: "upstream.slice_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "milestone-overview-to-slice-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.phase_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "milestone-overview-to-phase-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "body.Navigation",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "milestone-overview-navigation-links",
                notes: "Visible parent navigation references can be materialized as Markdown links without changing front matter metadata."
            },
            {
                field: "body.Tasks",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "milestone-overview-to-task-definitions",
                notes: "Declared task slugs are local child-planning evidence and can be materialized to canonical task definition links."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions"
        ]
    },
    {
        family: "task_definition",
        artifactType: "task_definition",
        traceFields: [
            {
                field: "upstream.specs",
                source: "front-matter",
                requirement: "required",
                valueShape: "multi-spec-list",
                relationship: "task-definition-to-specifications",
                notes: "Preserves the multi-spec shape; do not collapse into one inferred source reference."
            },
            {
                field: "upstream.slice_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "task-definition-to-slice-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.phase_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "task-definition-to-phase-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.milestone_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "task-definition-to-milestone-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "body.Navigation",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "task-definition-navigation-links",
                notes: "Visible parent navigation references can be materialized as Markdown links without changing front matter metadata."
            },
            {
                field: "body.Upstream Context",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "task-definition-review-evidence",
                notes: "Intentionally cited source artifacts support review evidence but missing optional body citations are not broken-link findings."
            },
            {
                field: "body.Implementation Target Paths",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "task-definition-target-path-evidence",
                notes: "Implementation target paths are local review evidence and can be materialized as Markdown links without changing target ownership semantics."
            },
            {
                field: "body.Dependencies",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "task-definition-dependency-evidence",
                notes: "Artifact dependency bullets are review evidence and remain plain repository-relative path bullets; do not materialize this field to Markdown links."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions outside explicit evidence sections"
        ]
    },
    {
        family: "implementation_summary",
        artifactType: "implementation_summary",
        traceFields: [
            {
                field: "upstream.specs",
                source: "front-matter",
                requirement: "required",
                valueShape: "multi-spec-list",
                relationship: "implementation-summary-to-specifications",
                notes: "Preserves the multi-spec shape; do not collapse into one inferred source reference."
            },
            {
                field: "upstream.slice_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "implementation-summary-to-slice-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.phase_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "implementation-summary-to-phase-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.milestone_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "implementation-summary-to-milestone-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.task_definition",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "implementation-summary-to-task-definition",
                notes: "Explicit paired task link."
            },
            {
                field: "body.Changed Paths",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "implementation-summary-changed-path-evidence",
                notes: "Changed-path evidence is review evidence and does not widen required trace coverage; keep entries as plain repository-relative path bullets."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions outside explicit evidence sections"
        ]
    },
    {
        family: "reconciliation",
        artifactType: "reconciliation",
        traceFields: [
            {
                field: "upstream.specs",
                source: "front-matter",
                requirement: "required",
                valueShape: "multi-spec-list",
                relationship: "reconciliation-to-specifications",
                notes: "Preserves the multi-spec shape; do not collapse into one inferred source reference."
            },
            {
                field: "upstream.slice_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "reconciliation-to-slice-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.phase_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "reconciliation-to-phase-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "upstream.milestone_overview",
                source: "front-matter",
                requirement: "required",
                valueShape: "single-local-path",
                relationship: "reconciliation-to-milestone-overview",
                notes: "Explicit parent overview link."
            },
            {
                field: "body.Completed Task Summaries",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "reconciliation-to-implementation-summary-evidence",
                notes: "Milestone rollup citations are evidence-only until later resolver work classifies them further."
            },
            {
                field: "body.Acceptance Criteria Review",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "reconciliation-to-acceptance-criteria-evidence",
                notes: "Acceptance criteria review citations are local evidence available for review and can be materialized without changing reconciliation status."
            },
            {
                field: "body.Validation Review",
                source: "body-section",
                requirement: "evidence-only",
                valueShape: "body-reference-list",
                relationship: "reconciliation-to-validation-evidence",
                notes: "Validation review citations are local evidence available for review and can be materialized without changing validation outcomes."
            }
        ],
        unsupportedReferences: [
            "external URLs",
            "remote provider availability",
            "package registry identifiers",
            "free-form prose mentions outside explicit evidence sections"
        ]
    }
];
exports.TRACE_LINK_TRAVERSAL_BOUNDARIES = [
    ".day-shift/specs",
    ".day-shift/specs/index.json",
    ".day-shift/planning",
    "src",
    "tests",
    "tests_v2",
    "."
];
exports.TRACE_LINK_RESOLUTION_RULES = [
    {
        status: "malformed-local-link",
        meaning: "The value is intended to be local but fails the shared repository-relative path parser, including empty, absolute, or '..' traversal values.",
        localOnly: true,
        storesOriginalValue: true,
        usesNormalizedPathForComparison: false,
        authorizesRepair: false
    },
    {
        status: "missing-local-target",
        meaning: "The value is a well-formed repository-relative path inside the local repository, but the target file does not exist.",
        localOnly: true,
        storesOriginalValue: true,
        usesNormalizedPathForComparison: true,
        authorizesRepair: false
    },
    {
        status: "unsupported-external-reference",
        meaning: "The value is external or remote-provider-like and is outside local links-check coverage.",
        localOnly: false,
        storesOriginalValue: true,
        usesNormalizedPathForComparison: false,
        authorizesRepair: false
    },
    {
        status: "outside-traversal-boundary",
        meaning: "The value is a well-formed repository-relative path, but it is outside caller-provided local trace traversal roots.",
        localOnly: true,
        storesOriginalValue: true,
        usesNormalizedPathForComparison: true,
        authorizesRepair: false
    },
    {
        status: "resolved-local-target",
        meaning: "The value is a well-formed repository-relative path inside the local repository and the target exists locally.",
        localOnly: true,
        storesOriginalValue: true,
        usesNormalizedPathForComparison: true,
        authorizesRepair: false
    }
];
exports.TRACE_LINK_HIERARCHY_RULES = [
    {
        relationship: "phase-overview-to-slice-overview",
        sourceFamily: "phase_overview",
        sourceField: "upstream.slice_overview",
        targetFamily: "slice_overview",
        expectedTarget: "explicit-upstream-field",
        mismatchStatus: "hierarchy-mismatch",
        notes: "Compare the explicit parent link against the selected slice overview; do not infer a replacement from directory layout."
    },
    {
        relationship: "milestone-overview-to-phase-overview",
        sourceFamily: "milestone_overview",
        sourceField: "upstream.phase_overview",
        targetFamily: "phase_overview",
        expectedTarget: "explicit-upstream-field",
        mismatchStatus: "hierarchy-mismatch",
        notes: "Compare the explicit parent link against the selected phase overview; do not infer a replacement from directory layout."
    },
    {
        relationship: "task-definition-to-milestone-overview",
        sourceFamily: "task_definition",
        sourceField: "upstream.milestone_overview",
        targetFamily: "milestone_overview",
        expectedTarget: "explicit-upstream-field",
        mismatchStatus: "hierarchy-mismatch",
        notes: "Task hierarchy uses declared upstream metadata, not guessed path ancestry."
    },
    {
        relationship: "implementation-summary-to-task-definition",
        sourceFamily: "implementation_summary",
        sourceField: "upstream.task_definition",
        targetFamily: "task_definition",
        expectedTarget: "paired-artifact-path",
        mismatchStatus: "stale-link",
        notes: "Compare the explicit summary task link against the canonical paired task-definition path."
    },
    {
        relationship: "reconciliation-to-milestone-overview",
        sourceFamily: "reconciliation",
        sourceField: "upstream.milestone_overview",
        targetFamily: "milestone_overview",
        expectedTarget: "paired-artifact-path",
        mismatchStatus: "stale-link",
        notes: "Compare the explicit reconciliation parent link against the canonical paired milestone overview path."
    },
    {
        relationship: "spec-index-entry-to-specification",
        sourceFamily: "spec_index_entry",
        sourceField: "spec_path",
        targetFamily: "specification",
        expectedTarget: "spec-index-entry-path",
        mismatchStatus: "stale-link",
        notes: "Spec index entries compare explicit spec_path values to known spec artifacts without remote provider checks."
    }
];
