Skip to main content

commands

Stdin/stdout utilities for MOD command scripts. @hmcs/sdk/commands is a separate entry point that provides structured input parsing and output helpers for MOD commands declared in your MOD's package.json under "bin".

warning

Do not import @hmcs/sdk/commands from a MOD's main script or from browser-side code. It uses process.stdin and other Node.js APIs that are only available in MOD command script contexts.

Import

import { input, output } from "@hmcs/sdk/commands";

Functions

Input

FunctionDescription
input.parseRead JSON from stdin and validate against a Zod schema
input.parseMenuParse menu command stdin and return a Vrm instance
input.readRead all of stdin as a raw UTF-8 string

Output

FunctionDescription
output.succeedWrite a JSON result to stdout and exit with code 0
output.failWrite a structured error to stderr and exit the process
output.writeWrite a JSON result to stdout without exiting
output.writeErrorWrite a structured error to stderr without exiting