Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108#!/usr/bin/env node/** CLI entry point for vmsync. Parses argv, dispatches to the appropriate command handler. @module */
// TODO: deprecate Optiqueimport { message, } from '@optique/core/message';// TODO: deprecate Optiqueimport { runSync, } from '@optique/run';
import { bootVm, } from './boot.ts';import { updateConfig, } from './config-cmd.ts';import { importImage, } from './import.ts';import { parser, } from './index-parsers.ts';import { printVmList, } from './list.ts';import { showStatus, } from './status.ts';import { syncVm, } from './sync.ts';
//region Verbose flag: stripped before parsing; logger detects it from raw process.argv at import time
/** Flags consumed by infrastructure (logger) rather than the argument parser. Stripped from tokens before `--` so that guest commands are not affected. @example ```ts INFRA_FLAGS.has('--verbose'); // true ``` */const INFRA_FLAGS: ReadonlySet<string> = new Set(['--verbose',],);
/** Raw args after the script name. */const rawArgs = process.argv .slice(2,);
/** Index of the `--` separator, or end-of-args when absent. Infrastructure flags are only stripped before this boundary. */const doubleDashIndex = rawArgs.indexOf('--',);
/** Boundary past which tokens must not be touched. */const boundary = (doubleDashIndex === (-1)) ? rawArgs.length : doubleDashIndex;
/** TODO: deprecate Optique Process argv with infrastructure flags removed only from the vmsync-owned prefix. The logger caches its own `process.argv` check at module load time (before this runs), so stripping here only affects the \@optique parser. */const filteredArgs = rawArgs.filter(function keepNonInfraArgs( arg, i,) { return (i >= boundary) || (!INFRA_FLAGS.has(arg,));},);
//endregion Verbose flag
//region Dispatch: parse argv and route to the appropriate handler
/** TODO: deprecate Optique Parsed CLI result from process.argv. */const args = runSync( parser, { programName: 'vmsync', args: filteredArgs, help: 'option', aboveError: 'help', brief: message`vmsync - multi-hypervisor VM image manager with incremental sync`, footer: message`Pass --verbose before the subcommand to enable debug logging.`, },);
if (args.cmd === 'import') { await importImage(args,);}else if (args.cmd === 'boot') await bootVm(args.name,);else if (args.cmd === 'sync') await syncVm(args.name,);else if (args.cmd === 'status') await showStatus(args.name,);else if (args.cmd === 'list') await printVmList();else { await updateConfig(args,);}
//endregion Dispatch