Skip to main content

cerberus

The repository guard and shared source classifier. Verifies invariants for zyplux repository checkouts — CI workflow structure, justfile and dependency conventions, CODEOWNERS, and release-version bumps.

Requirements

  • uv and Python 3.14

The justfile bite shells out to just, which ships with the package (via rust-just) — no separate install. The jscpd and fallow bites run their tools via pnpx at exact versions pinned in pnpm_policy.py, so every cerberus release measures with the same tools everywhere; pnpm must be on PATH.

Source checks use tracked and unignored files: TypeScript checks require .ts, .tsx, .mts or .cts files, and Python checks require .py or .pyi files. Executable TypeScript tool configuration counts as source. Manifests used only to install tooling do not require application lint, typecheck or test steps. Ruff, Knip, Pyrefly and pytest configuration stays optional without source; supplied configuration must satisfy the same invariants. Package metadata, dependency, CI and Markdown checks still apply.

Every repository with a package manifest runs pnpm run lint:workflows in CI and its local lint recipe, including configuration-only repositories. The script runs actionlint with locked ShellCheck and Pyflakes integrations.

CI uses one unquoted canonical command with literal arguments per run step. Python tool calls use uv run --no-sync; Prettier uses pnpm exec prettier --check.

Tooling-only repositories carry a Python tooling manifest and run Rumdl for Markdown. Prettier is required only when TypeScript source is present.

Release targets record their content fingerprints in airlock_targets.toml. The release_surface_version_bump bite implements the version-bump policy, including repairs to unpublished versions and GITHUB_BASE_REF comparisons. Package fingerprints exclude npm devDependencies and Python [dependency-groups]; changed built output, runtime or peer dependencies and Python extras still require a bump. The release_readiness bite validates consumed change intents, synchronized Python versions, current release notes and content fingerprints. Both checks reuse release helpers from the zyplux-airlock Python dependency. Release-history reads use gh auth login locally or GH_TOKEN in CI. Fetch complete Git history and the target branch before running the check.

Dependency freshness and tool-pin freshness share Airlock's registry client for npm, PyPI and GHCR. Tool-pin lookups select stable npm versions within the latest release line that satisfy the configured minimum release age. Lookup failures produce error findings.

Named target tables derive their tag prefix as <name>-v; optional release_tag overrides the base name. Package names come from the referenced manifest, with optional package_name overrides. JSON and TOML manifests default to npm and PyPI publication respectively. Action targets use kind = "action" in the checked-out repository. Their latest published stable version comes from GitHub releases matching the derived tag prefix, across all pages. Action fingerprints cover their manifest directory by default; includes selects other source paths. Floating major tags do not define the version baseline.

Lint a repo

uv run cerberus            # lint the current directory
uv run cerberus PATH       # lint a checkout at PATH

Runs every bite and exits non-zero on any failure or error, so it drops into CI like any linter. Run cerberus list to see every bite, its scope, and what it verifies.

Option Description
--check NAME Limit to named bite(s); repeatable
--config PATH Overlay file applied in place of the repo root cerberus.toml
--fix Auto-fix fixable problems (e.g. trailing whitespace)
--verbose/-v Itemize what each bite measured (clones, dead-code issues)

A repo switches a bite off with off = true in that bite's cerberus.toml table (see Config below); naming an off bite with --check still runs it.

Bites

ID Scope Verifies
cerberus_schema content Repository configuration matches the schema; always runs before loading overrides
source_oracle content Category globs and shared policies enforce unambiguous classification and allowed nesting
justfile content Recipe names, aliases, ordered check dependencies and body calls, local cerberus run, wrapped tool calls, no trailing whitespace
ci_workflow_gate content ci.yml exists, exposes a ci check, runs on PRs (push to main recommended)
ci_check_sequence content ci.yml skips drafts, cancels superseded runs and uses shared setup before canonical checks
ci_cerberus_step content A CI workflow runs cerberus to self-verify org invariants
workflow_toolchain_only content Workflows use shared package-manager setup and install no extra tools
pyrefly content All code, tests included, type-checks under strict pyrefly with no relaxations
ruff content ruff runs standalone in preview with select = ["ALL"]; relaxations stay sanctioned
line_length content ruff line-length and prettier printWidth both match the configured width (120)
rumdl content .rumdl.toml carries the org-canonical rule config (per-repo exclude allowed)
knip content knip config is standalone, never inline in package.json; knip.prod.json runs the entry-exports pass and exempts exactly the repo's published npm targets
vitest content TypeScript tests use Vitest
tsc content TypeScript typecheck runs via project references (tsc -b)
catalog_pinned_deps content Every workspace package.json dependency pins via catalog: or workspace:
vitest_coverage content Root Vitest coverage thresholds meet the configured floor
consistent_package_export_entries content Workspace packages use index roots or named modules, with matching source/publication keys; application router roots match their TanStack Vite entry
explicit_module_side_effects content Library packages declare false or module patterns that preserve detected initialization in source and published modules
consistent_workspace_project_references content Workspace TypeScript projects reference their compiled dependencies once
no_worker_filesystem_imports content First-party Worker runtime imports avoid filesystem builtins
pnpm_release_age content pnpm waits one day before installing new third-party releases; only @zyplux/* packages may be exempt
unique_test_ids content Test file IDs are unique across languages and case IDs match their files
story_tests_lockstep_py content Python story criteria have a matching, title-matched pytest test
story_tests_lockstep_ts content Each TypeScript story directory pairs numeric or prefixed criterion IDs with tests
cli_py_test_seam content CLI apps' story tests import only their root module or cli entry module
lib_py_test_seam content Libraries' story tests import only their root module
release_readiness content Change intents are consumed, Python versions match, release notes exist and fingerprints match current contents
release_surface_version_bump git-history A published target's version is bumped by exactly one step whenever its release contents change
codeowners_coverage content CODEOWNERS present and covers /.github/
pytest content pytest configuration enforces a coverage floor of at least 90%
jscpd content Copy-paste duplication per language stays under the configured jscpd threshold
fallow content fallow finds no unused code, circular imports, or functions above its complexity thresholds
zyplux_deps_latest content Every @zyplux/* npm package, zyplux-* PyPI distribution, and ghcr.io/zyplux image is used at its latest release
tool_pins_latest content Npm tool pins are the newest stable releases eligible under pnpm's one-day quarantine

Justfile recipes

baseline.just is the starting template. Cerberus checks names, aliases, ordered gate steps and their actual tool calls, managed-tool runners, cleanup, and whitespace. Required calls run as standalone foreground commands that preserve failures; local shell helpers start with set -euo pipefail and contain no other set commands. Local Cerberus commands start with uv run cerberus. The test recipe may guard runners by their workspace manifests and accept pytest's empty-suite exit code. Application recipes may add parameters, modules, and commands; --fix removes trailing whitespace.

CI draft policy

The ci job uses if: github.event_name != 'pull_request' || !github.event.pull_request.draft, optionally wrapped in ${{ }}. Pull-request activity types include opened, synchronize, reopened and ready_for_review. The guarded job’s concurrency uses group: ci-${{ github.ref }} and cancel-in-progress: true. Ready PRs and non-PR events run the complete canonical sequence; jobs have no prerequisites or failure tolerance, and individual checks are unconditional.

Fallow inputs

[fallow].entry_points registers exact repository files loaded by framework or runtime conventions that Fallow cannot infer. Every declared file must exist. CRAP is enabled by default: [fallow].coverage_report defaults to coverage/coverage-final.json and must exist; run tests before Cerberus to refresh it.

[fallow.rules] accepts Fallow rule names. Set complexity-crap = "off" to disable CRAP and its coverage-file requirement while retaining dead-code and source complexity checks. Other rules can be disabled individually. Rules not overridden retain Fallow's defaults; Cerberus's --fail-on-issues makes both error and warn findings fail.

Config

Every default lives in cerberus.toml, under its bite's table ([source_oracle], [justfile], [pytest], …). The bundled file is the single home of the defaults; missing required keys are errors. A repo adjusts them with a root cerberus.toml, overlaid key by key. An explicit --config PATH stands in for that repository file. Lists replace the corresponding default list.

The mandatory cerberus_schema bite validates repository overrides against the configuration schema before other bites run. Unknown settings, invalid types and malformed TOML produce failure findings. It has no configuration table and cannot be disabled.

Configurable bite tables also take a common off key, handled by the runner: off = true removes the bite from the run entirely — no output line — and an overlay's off = false re-enables a bite the bundled defaults ship off. tool_pins_latest ships off for exactly that reason: only the repo carrying the pin source can act on it, and that repo's overlay switches it on.

Shared source classification

source_oracle is the single classifier used by repository checks and reports. Each category defines roots, needs_tests and allowed_child_types in the bundled defaults:

Category Purpose Needs tests Allowed child categories
prod Shipped applications and libraries Yes demo, test, docs, artifacts
infra Repository, CI and deployment code Yes docs, artifacts
demo Examples and demonstrations No docs, artifacts
test Tests, fixtures and coverage reporting No docs, artifacts
docs Documentation, including embedded executable code No artifacts
artifacts Generated records: root .changeset/, lockfiles and CHANGELOG.md No None

Consumer overlays replace category globs; policies remain shared. For example:

[source_oracle.types.prod]
roots = ["apps/*", "packages/*", "src", "tools/*"]

[source_oracle.types.demo]
roots = ["demo", "examples", "infra/demo"]

Root globs are repository-relative paths. Deeper matches win; equally deep matches use the most literal pattern. Equally specific conflicting categories fail. allowed_child_types names the categories permitted inside a category. Same-category nesting is implicit; the table lists permitted direct category changes. Artifacts roots are terminal. README files and docs directories are documentation, except within root .changeset/, whose contents remain artifacts. Unmatched paths are infra. Colocated tests retain their enclosing category and have an independent is_test flag, derived from [source_oracle].test_files.

Existing test-presence checks use needs_tests. Repositories configure test discovery, runners and coverage. [source_oracle].test_exempt_files records explicit repository policy exceptions. Linting and strict typechecking cover every category.

Knip uses prod classification and registered TypeScript workspaces; uv run cerberus --check knip --fix regenerates ignoreWorkspaces. Pyrefly requires min-severity = "warn"; extends and command-line severity overrides are rejected.

Python callers use load_source_oracle(repo_root).classify(relative_path) from cerberus; the result contains kind, root, is_test and needs_tests. Classification is pure; callers discover files.

zyplux_deps_latest queries npm, PyPI, and GHCR at lint time; a failed lookup is reported as an error, never a silent pass. It has no --fix — run just upgrade to catch up.

tool_pins_latest requires the newest stable jscpd/fallow versions eligible under pnpm's one-day release quarantine. It runs only in the repo carrying pnpm_policy.py; consumers receive updated pins through Cerberus releases.

Package and source checks

TypeScript seam checks use ESLint's resolved imports. Focused export, ownership and reference checks enforce package policies.

Worker traversal covers first-party static imports and literal dynamic imports. Normal output summarizes static coverage limits; --verbose lists computed imports, third-party modules, and framework-provided entries that require production bundle validation.

Side-effect detection checks registration and initialization in workspace source modules against package-relative sideEffects paths. Packages publishing compiled files use patterns that also cover their compiled modules. The check cannot prove an arbitrary dependency graph pure.

Vitest coverage resolves exported literal objects and local constants, including defineConfig and its direct-return callbacks, without executing configuration code. Every metric meets the configured floor, and collection is enabled through test.coverage.enabled: true or the root test script's coverage flag.

Story tests

Test files start with a repo-wide ID made of a number and up to two optional lowercase letters. For example, use 2_subject_test.py for Python and a2-subject.test.ts for TypeScript. Both bare and prefixed IDs share the same namespace. Start a pytest function with test_2_1_ or a Vitest title with a2.1 to identify its case.

Use a literal case ID in each Vitest title. Table-driven cases can format one part of the ID from a literal row or the row index.

A story test starts with # @story in Python or // @story in TypeScript. Keep the story document beside its test, link the Markdown title to the test file, and use the same case IDs in the criterion headings.

Metadata

Release files for zyplux-cerberus 0.29.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zyplux-cerberus 0.29.0
File Size Uploaded Provenance Actions
zyplux_cerberus-0.29.0.tar.gz 84.2 kB Without provenance Details for zyplux_cerberus-0.29.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zyplux-cerberus 0.29.0
File Interpreter ABI Platform Actions
zyplux_cerberus-0.29.0-py3-none-any.whl Python 3 none any Details for zyplux_cerberus-0.29.0-py3-none-any.whl

Total release size: 203.5 kB

Release files / zyplux_cerberus-0.29.0.tar.gz

Download URL zyplux_cerberus-0.29.0.tar.gz
Size 84.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f714f608f10834775607188dd143fa3ac27f82279c4feec2ff082c4c7a071cc3
BLAKE2b-256 checksum
How to use checksums
bc8c67ecf80ba21bc5899af12fe4ad139bf3c74c7af3824a884ede5bc10a06ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / zyplux_cerberus-0.29.0-py3-none-any.whl

Download URL zyplux_cerberus-0.29.0-py3-none-any.whl
Size 119.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f0425f36976359bcb5d74ee48c620b41bb0d22b34a8fa5da19d93dbb9215250
BLAKE2b-256 checksum
How to use checksums
516613d2a80b845cda51f64c1ed2eb09104b53bc77362f502227ea1d7bc90766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for zyplux-cerberus 0.29.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.29.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page