import { createRequire } from "node:module";
import { Command } from "commander";
import { loginCommand } from "./commands/login.js";
import { logoutCommand } from "./commands/logout.js";
import { startCommand } from "./commands/start.js";
import { stopCommand } from "./commands/stop.js";
import { statusCommand } from "./commands/status.js";
import { addCommand } from "./commands/add.js";
import { removeCommand } from "./commands/remove.js";
import { projectsCommand } from "./commands/projects.js";
import { logsCommand } from "./commands/logs.js";
import { machineLabelCommand } from "./commands/machine.js";
import { enableAutostartCommand, disableAutostartCommand, autostartStatusCommand, } from "./commands/autostart.js";
const require = createRequire(import.meta.url);
const pkg = require("../../package.json");
/**
 * Create the main CLI program with all subcommands registered.
 */
export function createProgram() {
    const program = new Command();
    program
        .name("pocketcoder")
        .description("PocketCoder daemon - bridge Claude Code with mobile clients")
        .version(pkg.version, "-v, --version");
    program
        .command("login")
        .description("Authenticate with GitHub (opens browser)")
        .action(loginCommand);
    program.command("logout").description("Delete stored credentials").action(logoutCommand);
    program
        .command("start")
        .description("Start the daemon (daemonizes by default)")
        .option("--foreground", "Run in foreground (for debug)")
        .action(startCommand);
    program.command("stop").description("Stop the daemon gracefully").action(stopCommand);
    program.command("status").description("Show daemon status").action(statusCommand);
    program.command("add <path>").description("Register a folder as a project").action(addCommand);
    program.command("remove <projectId>").description("Unregister a project").action(removeCommand);
    program.command("projects").description("List registered projects").action(projectsCommand);
    program
        .command("enable-autostart")
        .description("Configure automatic startup on login")
        .action(enableAutostartCommand);
    program
        .command("disable-autostart")
        .description("Remove autostart configuration")
        .action(disableAutostartCommand);
    program
        .command("autostart-status")
        .description("Check autostart configuration status")
        .action(autostartStatusCommand);
    program
        .command("logs")
        .description("View daemon logs")
        .option("-n, --tail <lines>", "Number of lines to show", "50")
        .option("-f, --follow", "Follow log file")
        .option("-p, --pretty", "Pretty print logs with colors")
        .action(logsCommand);
    const machine = program.command("machine").description("Machine management commands");
    machine
        .command("label [text]")
        .description("Set label for this machine")
        .option("--show", "Show current label")
        .action(machineLabelCommand);
    return program;
}
//# sourceMappingURL=program.js.map