Skip to main content
Version: v0.0.4

Variable: CLI_CODES

const CLI_CODES: object

Stable CLI diagnostic code registry: errors the CLI owns (routing, I/O, argument handling), distinct from the wrapped library's own warning/issue codes which are passed through unchanged. Each code is its own value (key === value) so the set survives Object.values(...); renaming or removing one is a breaking change because scripts branch on the stderr text.

Type Declaration

CLI_EMPTY_INPUT

readonly CLI_EMPTY_INPUT: "CLI_EMPTY_INPUT" = "CLI_EMPTY_INPUT"

The input was empty, no bytes to detect or parse. Exit 65.

CLI_FORMAT_AMBIGUOUS

readonly CLI_FORMAT_AMBIGUOUS: "CLI_FORMAT_AMBIGUOUS" = "CLI_FORMAT_AMBIGUOUS"

More than one format signature matched; the CLI will not guess. Names the candidates, never the bytes. Exit 65.

CLI_FORMAT_UNDETECTED

readonly CLI_FORMAT_UNDETECTED: "CLI_FORMAT_UNDETECTED" = "CLI_FORMAT_UNDETECTED"

No format signature matched; the CLI will not guess. Names the candidates, never the bytes. Exit 65.

CLI_FORMAT_UNSUPPORTED

readonly CLI_FORMAT_UNSUPPORTED: "CLI_FORMAT_UNSUPPORTED" = "CLI_FORMAT_UNSUPPORTED"

A recognised format whose parser does not support the requested operation (e.g. parse on a format wired only for inspect). Names the format + operation, never the bytes. Exit 65.

CLI_INTERNAL

readonly CLI_INTERNAL: "CLI_INTERNAL" = "CLI_INTERNAL"

An unexpected internal error (a bug). Exit 70.

CLI_MAP_INVALID

readonly CLI_MAP_INVALID: "CLI_MAP_INVALID" = "CLI_MAP_INVALID"

The BYO ConceptMap supplied to map-codes is not valid JSON or not a loadable FHIR ConceptMap. Names the stable terminology-loader code, never the map's bytes. Exit 65.

CLI_NO_INPUT

readonly CLI_NO_INPUT: "CLI_NO_INPUT" = "CLI_NO_INPUT"

The named file does not exist or could not be read. Exit 66.

CLI_NOT_IMPLEMENTED

readonly CLI_NOT_IMPLEMENTED: "CLI_NOT_IMPLEMENTED" = "CLI_NOT_IMPLEMENTED"

A command whose ground-layer library is not yet wired (e.g. redact before @cosyte/deid is wired). Never a fake success: a distinct, value-free "unavailable" signal. Exit 69.

CLI_PARSE_FAILED

readonly CLI_PARSE_FAILED: "CLI_PARSE_FAILED" = "CLI_PARSE_FAILED"

The wrapped parser rejected the input. Positional context only, never the offending bytes. Exit 65.

CLI_PARSER_UNAVAILABLE

readonly CLI_PARSER_UNAVAILABLE: "CLI_PARSER_UNAVAILABLE" = "CLI_PARSER_UNAVAILABLE"

The optional parser package for a recognised format is not installed. The six breadth parsers (dicom/x12/ccda/ncpdp/astm/mllp) are optionalDependencies: normally installed, but if one is absent the CLI degrades to this value-free signal rather than crashing. Exit 69.

CLI_USAGE

readonly CLI_USAGE: "CLI_USAGE" = "CLI_USAGE"

A required argument was missing or a flag was invalid. Exit 2.

Example

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

if (diagnostic.code === CLI_CODES.CLI_FORMAT_UNDETECTED) {
// ask the user for --format
}