Expand description
Deterministic shell-output compression patterns for LeanCTX | OSS.
Every pattern is a pure text transform: command line plus output in,
compressed output (or None) out. Engine policy (protected commands,
user filters, configuration) stays in the engine, which reaches this crate
through its core::patterns facade. Engine-supplied facts enter through
PatternEnv, so this crate never depends on the engine.
Modules§
- alembic
- Alembic (SQLAlchemy migrations) output compression.
- ansi
- ANSI escape handling shared by the patterns and the engine compressor.
- ansible
- argocd
- Argo CD (
argocd app get/sync/list) output compression. - artisan
- aws
- bazel
- buf
- buf (protobuf tooling) output compression.
- bun
- cargo
- clang
- cmake
- composer
- cosign
- Cosign (sigstore) output compression.
- curl
- dbt
- dbt (data build tool)
run/test/buildoutput compression. - deno
- deploy
- Shared compressor for edge/PaaS deploy commands (vercel, fly, wrangler, skaffold, supabase).
- deps_
cmd - docker
- dotnet
- emspace
- emspace CLI output.
- env_
filter - eslint
- fd
- find
- flutter
- flyway
- Flyway (database migrations) output compression.
- gem
- RubyGems (
gem) output compression. - gh
- git
- glab
- golang
- grep
- grype
- Grype vulnerability scanner output compression.
- helm
- jj
- Jujutsu (
jj) output compression. - json_
crush - Deterministic JSON crusher — single source of truth for structural JSON compaction (#934, Headroom “Smart Crusher” port, GitLab #935).
- json_
schema - just
- kubectl
- linkerd
- linkerd (
linkerd check) output compression. - log_
dedup - lossless_
collapse - Strictly lossless repeat collapse for the governor’s R2 rule (governor design v1 §2 R2).
- ls
- make
- maven
- mise
- mise (dev tool version manager) output compression.
- mix
- mlflow
- MLflow CLI output compression.
- mypy
- mysql
- next_
build - ninja
- npm
- ollama
- Ollama CLI output compression.
- php
- pip
- playwright
- pnpm
- poetry
- prettier
- prisma
- psql
- pulumi
- Pulumi (
pulumi up/preview/destroy) output compression. - pytest
- ruby
- ruff
- safety_
needles - semgrep
- Semgrep output compression.
- spark
- Apache Spark (
spark-submit) log compression. - swift
- swiftlint
- SwiftLint output compression.
- syft
- Syft SBOM output compression.
- sysinfo
- systemd
- template_
collapse - Template collapse for the governor’s R4 rule.
- terraform
- test
- tokens
- trivy
- Trivy vulnerability scanner output compression.
- typescript
- wget
- zig
Structs§
- NoEnv
- The neutral
PatternEnv: no passthrough URLs.
Constants§
- PATTERN_
ENGINE_ VERSION - Pattern engine version. Bump when output format changes to maintain shell-output determinism guarantees. Consumers (proofs, benchmarks) can embed this version to detect pattern-breaking updates.
Traits§
- Pattern
Env - Engine-supplied facts a pattern may need. The engine implements this from
its configuration.
NoEnvis the neutral environment for callers without one (tests, tools that run outside an engine).
Functions§
- compress_
clean - The policy-free part of the engine’s
compress_output: everything after the protected-command gate, the leading-cdunwrap, ANSI stripping and the user filter rules, which the engine applies first.clean_outputis the ANSI-stripped output,outputthe raw one every result is measured against. - elision_
marker - How an elided block announces itself (GH #1679).
- has_
vcs_ owner - True for version-control commands whose output is authoritative under their
own compressor and must not be reinterpreted by the generic log/test
fallbacks (commit history is not application log output). emspace is owned
the same way: its page bodies are
page editanchors and must stay exact. - inflates_
tokens - True when
compressedcarries more tokens than the raworiginal— i.e. the transform inflated rather than compressed. Compared against the raw (pre-ANSI-strip) output so the guard matches the publiccompress_outputinvariant exactly: the returned text never tokenizes larger than its input. - pattern_
count - Ordered prefix → compressor dispatch table (#660 CC reduction): first
matching entry wins, mirroring the previous
if c.starts_with(..) { return ...; }cascade exactly — including that a matched entry’sNoneis final, never falls through to a later entry. Registering a new CLI tool is now a one-line addition here instead of a new branch intry_specific_pattern. Number of registered shell-output patterns, for the docs drift check (#1896). - shorter_
only Some(compressed)only when it carries fewer tokens thanoriginal(ties broken by length), compared on whitespace-normalized text.- try_
specific_ pattern_ with - Route
cmdto its dedicated compressor: the first matching entry of the dispatch table wins, and a matched entry’sNoneis final.