refactor(cli): split commands/workflow.ts into directory form (list/lifecycle/draft/history/job/check/analyze)

Verbatim code moves; drops dead WORKFLOW_STATE_DIR const that was
declared but never read. No behavior change: tsc clean, 316 tests pass.
This commit is contained in:
gitea committed 2026-10-04 14:09:34 +08:00
1 parent 52342a9b8e
commit 6f1f2623a3
11 files changed
+1034 -983

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { listAllWorkflows } from "../../../domains/platform/services.js";
import { stringOption } from "../../parser.js";
import { createClientsForCorp, createPiperClientForCorp } from "../../helpers.js";
import type { CliParsedArgs, CliRuntime } from "../../types.js";
export const PLATFORM_ID_OPTION_KEYS = ["platform-id", "platformId", "app-id", "appId"];
export async function createWorkflowDetailClient(
parsed: CliParsedArgs,
runtime: CliRuntime,
pipelineId: string,
): Promise<{
client: Awaited<ReturnType<typeof createPiperClientForCorp>>;
clients: Awaited<ReturnType<typeof createClientsForCorp>>;
}> {
const clients = await createClientsForCorp(runtime.selectedCorp!);
const explicit = stringOption(parsed.options, PLATFORM_ID_OPTION_KEYS);
let platformId = explicit;
if (!platformId) {
const all = await listAllWorkflows(clients, { page: 1, pageSize: 100 });
platformId = all.workflows.find((workflow) => workflow.id === pipelineId)?.platformId;
}
return {
client: platformId ? await createPiperClientForCorp(runtime.selectedCorp!, platformId) : clients.easoClient,
clients,
};
}