// SPEC: PJ2026-01060703 CI/CD branch follower and GH-1548/GH-1560 Gitea PaC migration. // Responsibility: thin CI/CD top-level route entry; subcommand logic lives in responsibility modules. import type { UniDeskConfig } from "./config"; import { renderMachine } from "./cicd-render"; import type { RenderedCliResult } from "./output"; import { cicdHelp as branchFollowerHelp, runCicdCommand as runBranchFollowerCommand } from "./cicd-branch-follower"; import { cicdGiteaActionsPocHelp, runGiteaActionsPocCommand } from "./cicd-gitea-actions-poc"; export function cicdHelp(): unknown { return { command: "cicd gitea-actions-poc|branch-follower", output: "text by default for subcommands; top-level help is json", migration: { issue: "https://github.com/pikasTech/unidesk/issues/1560", primary: "platform-infra pipelines-as-code", primaryStatus: "bun scripts/cli.ts platform-infra pipelines-as-code status --target JD01", primaryHistory: "bun scripts/cli.ts platform-infra pipelines-as-code history --target JD01 --limit 10", archived: "cicd gitea-actions-poc", deprecated: "cicd branch-follower", note: "JD01 CI/CD source/trigger authority is Gitea mirror -> Pipelines-as-Code -> Tekton -> Argo/k8s runtime. Gitea Actions POC and branch-follower are historical or migration-only surfaces.", }, subcommands: [ cicdGiteaActionsPocHelp(), branchFollowerHelp(), ], }; } export async function runCicdCommand(config: UniDeskConfig | null, args: string[]): Promise { const top = args[0]; if (top === undefined || top === "help" || top === "--help" || top === "-h") return renderMachine("cicd", cicdHelp(), "json"); if (top === "branch-follower") return await runBranchFollowerCommand(config, args); if (top === "gitea-actions-poc" || top === "gitea-builder-poc") return await runGiteaActionsPocCommand(config, args.slice(1), top); throw new Error("cicd usage: cicd gitea-actions-poc|branch-follower"); }