feat: add remote main server cli passthrough

This commit is contained in:
Codex
2026-05-05 01:56:42 +00:00
parent eb6df3ba92
commit cc1533c02f
7 changed files with 150 additions and 2 deletions
+9 -1
View File
@@ -6,8 +6,10 @@ import { emitError, emitJson } from "./src/output";
import { jobWithTail, listJobs, readJob, runJob } from "./src/jobs";
import { runChecks } from "./src/check";
import { runSsh } from "./src/ssh";
import { extractRemoteCliOptions, runRemoteCli } from "./src/remote";
const args = process.argv.slice(2);
const remoteOptions = extractRemoteCliOptions(process.argv.slice(2));
const args = remoteOptions.args;
const commandName = args.join(" ") || "help";
function help(): unknown {
@@ -16,6 +18,7 @@ function help(): unknown {
output: "json",
commands: [
{ command: "help", description: "List supported commands." },
{ command: "--main-server-ip <ip> [--main-server-user root] [--main-server-key path] <command>", description: "Pass the command through SSH and execute this CLI on the main server." },
{ command: "config show", description: "Validate and print config.json as the single source of truth." },
{ command: "check", description: "Run config, TypeScript, file presence, and docker-compose config checks." },
{ command: "server start", description: "Fire-and-forget build/start for database, backend-core, frontend, and provider gateway." },
@@ -84,6 +87,11 @@ function latestJobId(): string {
}
async function main(): Promise<void> {
if (remoteOptions.host !== null) {
process.exitCode = await runRemoteCli(remoteOptions);
return;
}
const [top, sub, third, fourth] = args;
if (top === undefined || top === "help" || top === "--help" || top === "-h") {
emitJson(commandName, help());