Skip to content

CLI Reference

Global Options

OptionDescription
--versionPrint the decoct version and exit.
--helpShow top-level help and exit.

decoct compress

decoct compress [FILES...] [OPTIONS]

Runs the compression pipeline on YAML, JSON, or INI files. Reads from stdin if no files given.

Arguments

ArgumentDescription
FILESOne or more input files or directories. Omit to read from stdin.

Files are auto-detected by extension: .yaml/.yml (YAML), .json (JSON), .ini/.conf/.cfg/.cnf/.properties (INI). Directories are expanded to all matching files.

Options

OptionDescription
--schema TEXTSchema file path or bundled name. Auto-detected if omitted.
--assertions PATHAssertions file defining design standards.
--profile TEXTProfile file path or bundled name (docker-compose).
--statsPrint token statistics to stderr.
--stats-onlyPrint only token statistics (no YAML output).
--show-removedPrint per-pass removal details to stderr.
-o, --output PATHWrite output to file instead of stdout.
-r, --recursiveRecurse into subdirectories when given a directory argument.
--encoding TEXTTiktoken encoding. Default: cl100k_base.

Platform Auto-Detection

When --schema is not provided, decoct examines document structure:

PlatformDetection heuristic
docker-composeHas services key with a mapping
kubernetesHas apiVersion and kind keys
terraform-stateHas terraform_version and resources keys
cloud-init2+ keys from packages, runcmd, write_files, etc.
ansible-playbookList where first item has hosts and tasks/roles
github-actionsHas on and jobs keys
traefikHas entryPoints or (providers and api/log)
prometheusHas scrape_configs key

Examples

Terminal window
# Basic — auto-detects platform
decoct compress docker-compose.yaml
# Explicit bundled schema
decoct compress config.yaml --schema docker-compose
decoct compress deployment.yaml --schema kubernetes
decoct compress playbook.yaml --schema ansible-playbook
decoct compress cloud-init.yaml --schema cloud-init
decoct compress terraform.tfstate --schema terraform-state
decoct compress prometheus.yml --schema prometheus
# Custom schema file
decoct compress config.yaml --schema schemas/my-platform.yaml
# With schema + assertions
decoct compress config.yaml \
--schema docker-compose \
--assertions assertions/docker-services.yaml
# Bundled profile (schema + assertions + pass config)
decoct compress config.yaml --profile docker-compose
# Save with stats
decoct compress config.yaml -o compressed.yaml --stats
# Stats only
decoct compress config.yaml --schema docker-compose --stats-only
# From stdin
kubectl get deployment myapp -o yaml | decoct compress --schema kubernetes
# INI files
decoct compress my.cnf --schema mariadb-mysql --stats
# Multiple files
decoct compress service-a.yaml service-b.yaml
# Directory, recursive, with stats
decoct compress ./config/ --recursive --stats
# Inspect what was removed
decoct compress deployment.yaml --stats-only --show-removed

decoct schema learn

decoct schema learn [OPTIONS]

Derives a schema from example configs and/or documentation using an LLM. Requires pip install decoct[llm] and ANTHROPIC_API_KEY.

Options

OptionDescription
-e, --example PATHExample config file (repeatable).
-d, --doc PATHDocumentation file (repeatable).
-p, --platform NAMEPlatform name hint.
-o, --output PATHOutput file (default: stdout).
-m, --merge PATHMerge into existing schema file.
--model MODEL_IDAnthropic model (default: claude-sonnet-4-20250514).

At least one --example or --doc is required.

Examples

Terminal window
decoct schema learn -e docker-compose.yml -p docker-compose -o schema.yaml
decoct schema learn -d haproxy-docs.txt -e haproxy.cfg -p haproxy -o schema.yaml
decoct schema learn -e new-config.yaml -m existing-schema.yaml -o merged.yaml

decoct assertion learn

decoct assertion learn [OPTIONS]

Derives assertions from standards documents, examples, or a corpus. Requires pip install decoct[llm] and ANTHROPIC_API_KEY.

Options

OptionDescription
-s, --standard PATHStandards document (repeatable).
-e, --example PATHExample config file (repeatable). Mutually exclusive with --corpus.
-c, --corpus PATHConfig files for cross-file analysis (repeatable). Mutually exclusive with --example.
-p, --platform NAMEPlatform name hint.
-o, --output PATHOutput file (default: stdout).
-m, --merge PATHMerge into existing assertions file.
--model MODEL_IDAnthropic model (default: claude-sonnet-4-20250514).

At least one of --standard, --example, or --corpus is required.

Examples

Terminal window
decoct assertion learn -s team-standards.md -p docker-compose -o assertions.yaml
decoct assertion learn -c configs/service-a.yml -c configs/service-b.yml -o learned.yaml
decoct assertion learn -s updated-standards.md -m assertions.yaml -o assertions.yaml

Exit Codes

CodeMeaning
0Success.
1Error (missing input, invalid schema, parse error, API error, etc.).

Environment Variables

VariableDescription
ANTHROPIC_API_KEYRequired for schema learn and assertion learn. Not used by compress.

stdin / stdout / stderr

Commandstdinstdoutstderr
compressInput data (when no FILES)Compressed YAMLStats, removal details, errors
schema learnGenerated schema YAMLProgress, errors
assertion learnGenerated assertions YAMLProgress, errors