chore: 初始化仓库

This commit is contained in:
Lydanne
2026-02-15 22:02:21 +08:00
commit 08d011d63f
381 changed files with 87202 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import { Command, CommandRunner, Option } from "nest-commander";
import { t } from "@spaceflow/core";
import { CiShellService } from "./ci-shell.service";
export interface CiShellOptions {
dryRun: boolean;
}
@Command({
name: "ci-shell",
description: t("ci-shell:description"),
arguments: "<command>",
argsDescription: {
command: t("ci-shell:argsDescription.command"),
},
})
export class CiShellCommand extends CommandRunner {
constructor(protected readonly ciShellService: CiShellService) {
super();
}
async run(passedParams: string[], options: CiShellOptions): Promise<void> {
const command = passedParams.join(" ");
if (!command) {
console.error(t("ci-shell:noCommand"));
process.exit(1);
}
console.log(`DRY-RUN mode: ${options.dryRun ? "enabled" : "disabled"}`);
try {
const context = this.ciShellService.getContextFromEnv(options);
await this.ciShellService.execute(context, command);
} catch (error) {
console.error(
t("common.executionFailed", { error: error instanceof Error ? error.message : error }),
);
process.exit(1);
}
}
@Option({
flags: "-d, --dry-run",
description: t("common.options.dryRun"),
})
parseDryRun(val: boolean): boolean {
return val;
}
}