Skip to main content
Version: v0.0.3

Function: validateCommand()

validateCommand(args, deps, posture?): Promise<RunResult>

Run the validate command.

Parameters

args

string[]

The arguments after the validate subcommand token.

deps

RunDeps

Injected input readers (RunDeps).

posture?

PhiPosture = VALUE_FREE

The resolved PhiPosture (governs only the opt-in unsafe excerpt on a parse-failure diagnostic; a validation verdict is always value-free).

Returns

Promise<RunResult>

A RunResult whose exit code carries the verdict (0 valid / 1 invalid / 65 unparseable / 66 no input / 2 usage). Value-free findings on stderr, or value-free JSON on stdout under --json.

Throws

Never CliError; may propagate a truly unexpected error for the dispatcher to map.

Example

import { validateCommand } from "@cosyte/cli";

const deps = {
readFile: async () => new TextEncoder().encode('{"resourceType":"Patient","gender":"male"}'),
readStdin: async () => new Uint8Array(),
};
(await validateCommand(["patient.json"], deps)).exit; // => 0