Skip to main content
Version: v0.0.4

cosyte command reference

A man-page-style reference for every cosyte command, its arguments, and its flags. This mirrors cosyte --help; the API Reference documents the programmatic (. subpath) surface. Every command reads a <file> argument or - for stdin, autodetects the format by content unless --format overrides it, and resolves to a code in the exit-code contract.

Synopsis

cosyte <command> [options]
cosyte-mcp # the stdio MCP server (also: cosyte mcp)

Global options

FlagEffect
-h, --helpPrint help and exit 0.
-V, --versionPrint the CLI version and exit 0.
--unsafe-show-valuesPermit a bounded input excerpt in a failure diagnostic on stderr. PHI-exposing; off by default; the single door to a value on a secondary surface.

Common options (parse / validate / inspect / fmt)

FlagEffect
--format <fmt>Override autodetection: hl7 | fhir | dicom | x12 | ccda | ncpdp | astm | mllp. Support is per (format, operation): see Limitations.
--jsonMachine-readable JSON output.
--quietSuppress value-free notes on stderr (the exit code becomes the whole signal).
--no-colorDisable ANSI colour.

Commands

cosyte parse <file\|->

Parse a healthcare message to typed JSON on stdout (the data channel). Autodetects the format. --ndjson treats each non-empty input line as a record and emits NDJSON; an MLLP stream is parsed one record per frame with per-record isolation (a failed record becomes a value-free { record, error } line and the stream continues; any failure → exit 65).

cosyte parse adt.hl7
cat adt.hl7 | cosyte parse -
cosyte parse --ndjson bulk.ndjson | jq .

cosyte validate <file\|-> [--profile <name>]

Validate a message; the exit code carries the verdict: 0 valid, 1 invalid (parseable but non-conformant), 65 unparseable. Findings are value-free (a code + a positional location). --profile is reserved but gated to CLI_NOT_IMPLEMENTED (exit 69), no profiles are bundled.

cosyte validate patient.json && echo "valid" # branches on exit 0/1

cosyte inspect <file\|->

Print a value-free structural summary: the message/resource type, segment/entry counts, and a warning/issue count. Never emits a field value on either channel.

cosyte fmt <file\|->

Canonically re-serialize via the wrapped library's spec-clean serializer. stdout is the data channel; an unparseable input is a data error (65) with no partial emit.

cosyte convert <file\|-> --to fhir

Convert an HL7 v2 message to a FHIR R4 Bundle via @cosyte/transform. --to fhir is required (the only target today). An error-severity conversion issue drives exit 1; a non-HL7 source is CLI_FORMAT_UNSUPPORTED (65).

cosyte map-codes <conceptmap\|-> --code <code> [--system <uri>] [--version <v>] [--display <d>]

Translate a code through a bring-your-own FHIR ConceptMap via @cosyte/terminology ($translate). A match prints the target coding(s) and exits 0; an unmapped code is TERM_TRANSLATE_UNMAPPED (exit 1); an unloadable map is CLI_MAP_INVALID (65). The positional is reference data, and a code is not PHI.

cosyte redact <file\|-> (alias: deid)

De-identify a message. Gated on @cosyte/deid (not yet wired): an honest CLI_NOT_IMPLEMENTED (exit 69). The input is not read. The CLI ships no built-in partial scrub.

cosyte completion <bash\|zsh\|fish>

Print a static, value-free shell-completion script generated from the command tree.

cosyte mcp / cosyte-mcp

Start the stdio MCP server: the agent front door, exposing parse/validate/inspect/convert as tools over the same core. See MCP server.

Exit codes

CodeMeaning
0success / validate found the input valid
1operation-level failure: validate found the input invalid (a real CI signal)
2usage error: unknown command, bad flag, missing argument
65data error: input could not be parsed / format not detected / (format, op) unsupported
66no input: the file does not exist or is unreadable
69unavailable: a capability is not yet built (e.g. redact, --profile)
70internal error: an unexpected exception (a bug)

The contract is a stability surface: renaming a code or a stable CLI_* diagnostic is a breaking change, and it is locked by an exit-code golden matrix in the test suite.