Topics

UTTORI ASM ยท IN DEVELOPMENT

Programmatic CLI use

Run programmatic cli use from the command line with documented inputs and outputs.

The package exports parseCliArguments(), runCli(), the CliArguments interface, and the generated usage text:

import { runCli } from "@uttori/asm-cli";

process.exitCode = await runCli(["main.asm", "output.bin"]);

parseCliArguments(argv) parses tokens without file I/O or plugin loading and throws Error for invalid arguments. Paths remain unresolved, list fields and the outer plugin-option map are shallow-frozen. Required input / ROM presence is checked during execution so --help can stand alone.

runCli(argv = process.argv.slice(2)) uses the process working directory, filesystem, and console. It returns 0 or 1 and attempts session and plugin disposal before settling, including when cleanup itself fails. It neither calls process.exit() nor changes process.exitCode, the executable wrapper sets the status. Plugins are trusted in-process code. Serialize calls when changing the process working directory or intercepting console output. There is no graceful-cancellation API.

Use @uttori/asm-core directly when the host needs structured results and owns file handling.