QM's CLI startup code (cli/src/manifest.ts and cli/src/cli.ts) loads and validates immutable image references, parses a custom argument syntax, and resolves deployment configuration from filesystem or flags. Boolean flags are enumerated in BOOLEAN_FLAGS; several multi-valued options (--target, --model-provider, --email-transport) are validated against allowed sets, and --config with optional --sandbox-dir establish the deployment context.
cli/src/manifest.ts reads manifest.json with a sibling-directory fallback: it first tries the path adjacent to the current module file, then tries one level up (../manifest.json).[1] Every image reference in manifest.json (service or sandbox base) must be digest-pinned to a sha256:<64-hex-char> digest; cli/src/manifest.ts enforces this via immutableRef(), throwing an error on any non-pinned ref.[1] manifestRef(service) throws if manifest.json contains no entry for the requested service name, and delegates to immutableRef() for the pin check if an entry is found.[1] cliVersion() reads the CLI version from package.json at runtime, keeping the in-binary version always consistent with the published package version.[1]
cli/src/cli.ts defines a minimal custom argument parser that distinguishes boolean flags — enumerated in BOOLEAN_FLAGS (e.g. build-only, ci, dry-run, follow, json, live, purge, static, yes) — from value-taking flags, collecting everything else as positionals.[2] The --follow and -f flags are treated as synonyms for log tailing: followFlag() returns true if either boolean is set.[2]
The --target flag is validated against the list of known hosting-provider IDs; an invalid value throws a CliError listing the allowed choices.[2] The --model-provider flag is validated against MODEL_PROVIDERS; an invalid value throws a CliError with clause cli.invocation.[2] The --email-transport flag is validated against EMAIL_TRANSPORTS; an invalid value likewise throws a CliError with clause cli.invocation.[2]
deployContext() resolves the deployment config from --config <path> if supplied, otherwise searches the specified or current working directory; sandboxDir defaults to sandbox/ inside the config directory but can be overridden with --sandbox-dir.[2]
Sources