refactor(src): split oversized modules

This commit is contained in:
Peter Steinberger
2026-01-14 01:08:15 +00:00
parent b2179de839
commit bcbfb357be
675 changed files with 91476 additions and 73453 deletions

View File

@@ -0,0 +1,123 @@
import type { Command } from "commander";
import { dashboardCommand } from "../../commands/dashboard.js";
import { doctorCommand } from "../../commands/doctor.js";
import { resetCommand } from "../../commands/reset.js";
import { uninstallCommand } from "../../commands/uninstall.js";
import { defaultRuntime } from "../../runtime.js";
export function registerMaintenanceCommands(program: Command) {
program
.command("doctor")
.description("Health checks + quick fixes for the gateway and channels")
.option(
"--no-workspace-suggestions",
"Disable workspace memory system suggestions",
false,
)
.option("--yes", "Accept defaults without prompting", false)
.option("--repair", "Apply recommended repairs without prompting", false)
.option(
"--force",
"Apply aggressive repairs (overwrites custom service config)",
false,
)
.option(
"--non-interactive",
"Run without prompts (safe migrations only)",
false,
)
.option(
"--generate-gateway-token",
"Generate and configure a gateway token",
false,
)
.option("--deep", "Scan system services for extra gateway installs", false)
.action(async (opts) => {
try {
await doctorCommand(defaultRuntime, {
workspaceSuggestions: opts.workspaceSuggestions,
yes: Boolean(opts.yes),
repair: Boolean(opts.repair),
force: Boolean(opts.force),
nonInteractive: Boolean(opts.nonInteractive),
generateGatewayToken: Boolean(opts.generateGatewayToken),
deep: Boolean(opts.deep),
});
} catch (err) {
defaultRuntime.error(String(err));
defaultRuntime.exit(1);
}
});
program
.command("dashboard")
.description("Open the Control UI with your current token")
.option("--no-open", "Print URL but do not launch a browser", false)
.action(async (opts) => {
try {
await dashboardCommand(defaultRuntime, {
noOpen: Boolean(opts.noOpen),
});
} catch (err) {
defaultRuntime.error(String(err));
defaultRuntime.exit(1);
}
});
program
.command("reset")
.description("Reset local config/state (keeps the CLI installed)")
.option(
"--scope <scope>",
"config|config+creds+sessions|full (default: interactive prompt)",
)
.option("--yes", "Skip confirmation prompts", false)
.option(
"--non-interactive",
"Disable prompts (requires --scope + --yes)",
false,
)
.option("--dry-run", "Print actions without removing files", false)
.action(async (opts) => {
try {
await resetCommand(defaultRuntime, {
scope: opts.scope,
yes: Boolean(opts.yes),
nonInteractive: Boolean(opts.nonInteractive),
dryRun: Boolean(opts.dryRun),
});
} catch (err) {
defaultRuntime.error(String(err));
defaultRuntime.exit(1);
}
});
program
.command("uninstall")
.description("Uninstall the gateway service + local data (CLI remains)")
.option("--service", "Remove the gateway service", false)
.option("--state", "Remove state + config", false)
.option("--workspace", "Remove workspace dirs", false)
.option("--app", "Remove the macOS app", false)
.option("--all", "Remove service + state + workspace + app", false)
.option("--yes", "Skip confirmation prompts", false)
.option("--non-interactive", "Disable prompts (requires --yes)", false)
.option("--dry-run", "Print actions without removing files", false)
.action(async (opts) => {
try {
await uninstallCommand(defaultRuntime, {
service: Boolean(opts.service),
state: Boolean(opts.state),
workspace: Boolean(opts.workspace),
app: Boolean(opts.app),
all: Boolean(opts.all),
yes: Boolean(opts.yes),
nonInteractive: Boolean(opts.nonInteractive),
dryRun: Boolean(opts.dryRun),
});
} catch (err) {
defaultRuntime.error(String(err));
defaultRuntime.exit(1);
}
});
}