Skip to content

Machine-readable command output ​

Every Metewand command supports the global --output option. The option may appear before or after the command:

sh
metewand --output json check
metewand plan --output jsonl
metewand schema manifest --output json

The accepted formats are human, json, and jsonl; human is the default. The option may be supplied at most once. Global option parsing stops at --, allowing authoring destinations such as metewand --output json init -- --output.

init emits one terminal result with command, dry_run, manifest, and an ordered paths list. Each entry identifies a created or proposed path and its kind (directory or file). The machine-output schema defines this command's result shape.

scaffold emits one terminal result with command, component, name, dry_run, manifest, and ordered paths. Each path has path, kind (directory or file), and action (create or modify). The manifest is the only modified path and is reported last. The machine-output schema defines this additive version-1 result shape.

Versioned envelopes ​

Both machine formats use the published machine-output schema. Every emitted record has schema_version, kind, and data fields:

json
{
  "schema_version": 1,
  "kind": "result",
  "data": {
    "command": "check",
    "benchmark": "example"
  }
}

json writes one indented envelope. jsonl writes one compact envelope per line. Read-only commands produce one terminal result or diagnostic record. run streams ordered event records before its terminal record in JSON Lines mode; its JSON result includes the same history in data.events. The run-output schema defines those events and final reports. Consumers must select behavior from schema_version, not from the package version.

status and explain emit one terminal result conforming to inspection-output. Status includes all recorded attempts, so a successful inspection exits with 0 even when the inspected benchmark has failures.

export emits one terminal export-output receipt with record and row counts, the explicitly created destination or rebuilt index path, and the export manifest. --format jsonl|csv selects the table file's encoding; the global --output option continues to select the receipt's encoding.

The command-owned data object retains deterministic ordering. A plan result contains the same definitions, resource identities, requirements, experiments, candidate and slot identities, capability evidence, counts, and side-effect claims shown by the human renderer. A schema-document result embeds the parsed schema under data.document; omit --output when exact checked-in schema bytes are required.

A successful check --workers result additionally includes workers with verified_now capability evidence and reference_cases with matching canonical metrics. Plain check omits these fields. The command produces one terminal envelope in either machine format and keeps worker logs out of standard output.

Standard streams ​

Successful human output is written to standard output. Human diagnostics are written to standard error.

In json and jsonl modes, standard output contains only schema-conforming machine envelopes. A failed command writes its diagnostic envelope to standard output and renders that same typed diagnostic for people on standard error. Progress and other human-oriented messages also belong on standard error. A consumer can therefore parse standard output without filtering prose.

Execution failures represented by finalized attempts produce a terminal run result with failure counts and exit code 5. Their typed diagnostics appear inside the attempt summaries and are rendered on standard error. A failure outside an attempt, such as preflight or publication, produces a diagnostic envelope.

Exit codes ​

Exit codes are part of the command-line compatibility contract:

CodeMeaning
0The command completed successfully. A closed downstream pipe is also treated as successful cancellation.
2The command line is invalid, or the requested operation is not supported.
3The repository or logical plan is invalid.
4A required manifest or repository input is unavailable.
5Execution completed with at least one durably failed attempt.
70An internal invariant or serialization operation failed.
74Filesystem authoring, command output, run-directory setup, or durable publication failed.

Export uses 2 for malformed options or unsafe index targets, 4 for missing store inputs or unknown result selectors, 3 for incompatible or corrupt evidence, and 74 for snapshot contention or export writes. It reuses the inspection diagnostic codes for source-reading failures. Its own codes are missing_export_value, duplicate_export_option, invalid_export_id, missing_output_directory, missing_export_destination, invalid_export_format, export_id_not_found, export_write_failed, invalid_export_destination, and invalid_export_evidence.

The exit code classifies the command outcome; data.code identifies the specific diagnostic.

Structured diagnostics ​

A diagnostic always contains a stable code and a human-readable message. It may also contain:

  • details, for code-specific structured context;
  • source_span, with one-indexed lines and columns and an exclusive end position;
  • affected_ids, as a sorted, duplicate-free list of stable identities;
  • causes, as ordered nested diagnostics; and
  • remediation, when Metewand can state a safe concrete correction.

Human diagnostics are rendered from this record. Source locations, causal indentation, affected identities, and remediation therefore cannot diverge between the human and machine paths. Fields that do not apply are omitted. In particular, validation failures that occur before identity construction have no affected_ids field.

Diagnostic codes ​

The CLI emits these stable codes:

CodeMeaning
missing_output_format--output has no value.
invalid_output_formatThe output-format value is invalid.
duplicate_output_format--output was supplied more than once.
invalid_command_nameThe command name is not UTF-8.
unknown_commandThe command name is not recognized.
invalid_init_pathThe initialization destination is empty or not UTF-8.
duplicate_init_flag--dry-run was supplied more than once.
init_path_existsA manifest path or required directory conflicts with an existing entry.
init_io_failedInitialization could not validate or create a path.
invalid_scaffold_componentThe scaffold component is missing or is not dataset, problem, or implementation.
invalid_scaffold_argumentA scaffold name or path is empty or is not UTF-8.
missing_scaffold_argumentA required scaffold name, environment, or option value is missing.
duplicate_scaffold_flagA scaffold option was supplied more than once.
scaffold_invalid_requestA component name is invalid, an environment or problem is undefined, or the problem selection does not match the component.
scaffold_component_existsThe requested component name is already defined in its manifest namespace.
scaffold_invalid_manifestThe existing manifest could not be parsed or the component addition could not be represented.
scaffold_path_existsA generated path conflicts with an existing entry, or a required directory or manifest is a symbolic link or has the wrong type.
scaffold_manifest_busyAnother operation holds the manifest lock.
scaffold_manifest_changedThe manifest file or contents changed before the requested addition could be written.
scaffold_io_failedScaffolding could not read, create, or modify a path.
invalid_schema_nameA schema name is not UTF-8.
unknown_schemaA public schema name is not recognized.
unexpected_argumentA command or option received an extra argument.
empty_manifest_pathThe selected manifest path is empty.
missing_manifest_path--manifest has no path argument.
duplicate_manifest_path--manifest was supplied more than once.
missing_output_directory--output-dir has no path, or run lacks its required destination.
empty_output_directoryThe selected run-directory path is empty.
duplicate_output_directory--output-dir was supplied more than once.
unsupported_operationThe requested operation is deliberately unavailable.
repository_check_failedThe repository-validation operation failed; causes identifies why.
manifest_access_failedThe manifest could not be accessed.
manifest_not_fileThe manifest path is not a regular file.
repository_file_access_failedA declared repository file could not be read.
repository_path_escapeA declared path resolves outside the repository.
invalid_utf8_fileA declared text file is not UTF-8.
invalid_schema_jsonA repository schema is not valid Metewand JSON.
invalid_schema_referenceA schema reference is not a valid repository reference.
missing_schema_identityA loaded schema unexpectedly lacks a content identity.
invalid_typed_digestA validated digest could not be decoded.
invalid_manifestThe manifest does not satisfy the typed format.
invalid_manifest_referenceA typed manifest reference cannot be resolved.
invalid_problem_contractA problem contract cannot be parsed or validated.
invalid_schema_catalogThe offline repository schema catalog is invalid.
invalid_configurationParameter expansion or cross-definition compatibility failed.
invalid_source_bundleA declared source bundle cannot be expanded or identified.
canonicalization_failedA value cannot enter the canonical JSON domain.
identity_construction_failedA stable identity cannot be constructed.
logical_planning_failedLogical planning failed; causes identifies why.
missing_definition_identityPlanning lacks an identity for a selected definition.
seed_derivation_failedA deterministic seed cannot be derived.
internal_errorAn internal invariant or output serialization failed.
output_write_failedStandard output could not be written.
invalid_run_selectionA selected ID matches no current measured slot, or a resume destination is invalid.
invalid_max_attemptsThe attempt bound is not a positive safe integer.
duplicate_max_attemptsThe attempt bound was supplied more than once.
missing_run_selectionA selection or attempt bound lacks a value.
duplicate_run_flagA resume or retry flag was supplied more than once.
run_store_failedDurable run coordination or recovery failed.
missing_inspection_idexplain lacks its required stable identity.
invalid_inspection_idThe explanation target is not a complete supported identity.
inspection_id_not_foundThe exact ID is absent from the selected plan and store.
inspection_input_unavailableA required run-store or artifact input could not be read.
inspection_store_busyA changing store prevented a stable private snapshot within five seconds.
invalid_inspection_evidenceThe store schema, committed records, or artifact contents are invalid or incompatible.
coordination_failedThe nested run-store diagnostic explains the failure.
run_setup_failedExecution resolution or destination setup failed.
execution_input_unavailableA required executable or run path is unavailable.
execution_resolution_failedAn internal resolution invariant failed.
invalid_execution_inputFixed data or other resolved inputs are invalid or changed.
artifact_cache_failedArtifact publication, integrity checking, construction lookup, or a cache lease failed.
run_publication_failedAn execution artifact could not be finalized.
publication_failedThe nested publisher diagnostic explains why publication failed.

The run result also retains attempt diagnostic codes: setup_failure, implementation_failure, implementation_crash, scientific_timeout, phase_timeout, invalid_result, evaluator_failure, protocol_error, input_changed, and completion_target_not_reached. See execution output for their publication and exit behavior.

Adding a new failure mode may add a diagnostic code. Changing the meaning of an existing code or exit code requires an explicit compatibility review.

Released under the MIT or Apache-2.0 license.