"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createLinkCommand = createLinkCommand;
const link_disposition_crud_1 = require("../link-disposition-crud");
const link_disposition_apply_1 = require("../link-disposition-apply");
const link_disposition_preview_1 = require("../link-disposition-preview");
const link_materialize_1 = require("../link-materialize");
const registration_1 = require("../registration");
async function createLinkCommand() {
    const { Command } = await import("commander");
    const command = new Command("link");
    const disposition = new Command("disposition")
        .description("Manage trace-link lifecycle disposition records.")
        .addHelpText("after", [
        "",
        "Boundaries:",
        "  Read-only: list, show, and preview inspect disposition storage and planning trace fields without writing files.",
        "  Write-capable: add, update, delete, and apply are explicit mutation commands.",
        "  Apply supports migrated dispositions only; validation may recommend preview/apply commands but never repairs links or infers replacement targets."
    ].join("\n"));
    for (const crudCommand of await (0, link_disposition_crud_1.createLinkDispositionCrudCommands)()) {
        (0, registration_1.registerCommand)(disposition, crudCommand);
    }
    (0, registration_1.registerCommand)(disposition, await (0, link_disposition_preview_1.createLinkDispositionPreviewCommand)());
    (0, registration_1.registerCommand)(disposition, await (0, link_disposition_apply_1.createLinkDispositionApplyCommand)());
    command.addCommand(disposition);
    (0, registration_1.registerCommand)(command, await (0, link_materialize_1.createLinkMaterializeCommand)());
    command.description("Trace-link lifecycle management commands.");
    return command;
}
