On this page
Schema dump (--dump-schema): builds the machine-readable schema dict and writes .strictcli/schema.json describing every command, group, flag, and arg.
#typescript/src/schema
#typescript/src/schema
Schema dump (--dump-schema): builds the machine-readable schema dict and writes .strictcli/schema.json describing every command, group, flag, and arg. Parity sources: go/strictcli/schema.go (all) and Python _serialize_flag/_dump_schema_core/_write_schema. Key order and omission rules follow Python (the divergence ground truth); Go sorts JSON map keys on marshal, so it pins content, not order.
TS model deltas (documented divergences):
- Flag/arg types are the exact ten TS carrier schema strings (str, bool,
int, float, list[str|int|float], dict[str,str|int|float]). Go spells compounds list[str]/dict[str]; Python emits JSON-schema-ish objects for compounds. The TS schema string IS the declaration surface.
- "repeatable" is never emitted: list carriers are the only repeatable
flags, and the list[...] type string already conveys it (Python's compound-list rule -- it omits repeatable for list[T] flags too).
- Empty list/dict defaults are omitted (Python's compound rule); explicit
empty defaults are banned at registration anyway.
- project_id comes from package.json "name" (the ecosystem analog of
Python's pyproject.toml [project].name and Go's go.mod module path).
Machine-channel number convention: bigint values are bare integer tokens; float values are SCF tokens (SCF strings are valid JSON numbers, and Python json.dumps floats via repr == SCF, so the bytes match the Python sibling).
#schemaJson
export function schemaJson(value: unknown, indent = 0): stringSerializes a schema value as pretty JSON with 2-space indentation, mirroring Python json.dumps(schema, indent=2): ": " key separator, one item per line, empty containers as {} / []. BigInt values become bare integer tokens and floats become SCF tokens (JSON.stringify can emit neither), which is why this is a custom writer. Plain objects keep insertion order; Maps are emitted with sorted keys (the TS dict display convention). No trailing newline -- the file writer appends it.
#dumpSchemaCore
export function dumpSchemaCore(app: AppImpl): Record<string, unknown>Builds the full schema dict, excluding project_id.
This is the CWD-free, filesystem-free core of schema production. It reads only the in-memory App; project_id is the only field that requires reading package.json from the CWD, so it is added later by the file-writer path. Fields matching their defaults are omitted; see buildSchemaDefaults().
#writeSchema
export function writeSchema(app: AppImpl): stringWrites the schema to .strictcli/schema.json (2-space indent, trailing newline) in the current working directory and returns the absolute path.