Files
hose-use/src/cli/commands/platform/index.ts
T
gitea ad771e92e0 feat(workflow & platform): optimize complex workflow orchestration, code node debug summary, MVEL simulation and entity/feetype helpers
- feat(feetype): add --subtree and --ids-only flags to listFeeTypes for direct array export
- feat(platform): add platform gen-props command to generate MVEL/JS entity field constants and templates
- feat(workflow): show code node return value summaries in workflow test and job first screen
- feat(workflow): add workflow node map sub-command and --mapping-file for deep declarative field mutations
- feat(workflow): add executeMvelSandbox for local offline simulation of MVEL code nodes
- test: add comprehensive test cases across feetype, platform gen-props, node map, and MVEL sandbox

Closes #140
2026-10-23 13:06:32 +08:00

59 lines
2.2 KiB
TypeScript

import { booleanOption } from "../../parser.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { handleList, handleGet, handleEntities, handleSchema, handlePermissions, handleImports, handleGenProps } from "./app-info.js";
import { handleRecords, handleAudit } from "./records.js";
import { handleRecordAction } from "./record-actions.js";
export async function handlePlatformCommand(parsed: CliParsedArgs, runtime: CliRuntime): Promise<CliResult> {
if (!runtime.selectedCorp) {
return { stdout: "", stderr: "未选中企业,请先通过 hose-use corps switch 或 --corp 指定企业\n", exitCode: 1 };
}
const action = parsed.action || "list";
const isWorkbench = action === "workbench" || booleanOption(parsed.options, ["workbench", "w"], false);
if (isWorkbench) {
const { handleAppCommand } = await import("./../app.js");
return handleAppCommand(parsed, runtime);
}
switch (action) {
case "list":
case "ls":
case "apps": return handleList(parsed, runtime);
case "get":
case "show": return handleGet(parsed, runtime);
case "entities":
case "objects": return handleEntities(parsed, runtime);
case "schema":
case "fields": return handleSchema(parsed, runtime);
case "records":
case "data":
case "search":
case "stats":
case "profile": return handleRecords(parsed, runtime);
case "audit":
case "check":
case "health": return handleAudit(parsed, runtime);
case "record":
case "record-get":
case "record-toggle":
case "record-edit":
case "record-batch-edit":
case "batch-edit":
case "record-update":
case "update":
case "batch-update":
case "record-recompute": return handleRecordAction(parsed, runtime);
case "permissions":
case "permission":
case "auth": return handlePermissions(parsed, runtime);
case "gen-props":
case "gen-mvel-props":
case "props": return handleGenProps(parsed, runtime);
case "imports":
case "import-jobs": return handleImports(parsed, runtime);
default:
return { stdout: "", stderr: `未知 platform 子命令: ${action}。支持: list, get, entities, schema, records, audit, record, gen-props, permissions, imports\n`, exitCode: 1 };
}
}