Skip to main content

🛡️ Hexaqual

GitHub Marketplace Open in GitHub Codespaces CI Coverage PyPI: hexaqual Python 3.12+ License: Apache 2.0

Governs Hexastack Governs Hexaqueue Governs Hexaflow Powered by Hexaflow Code style: ruff Type checker: ty

OpenSSF Scorecard OpenSSF Best Practices OpenSSF Best Practices: Progress

🛡️ Universal quality & governance engine for Hexastack, Hexaqueue, and Hexaflow · 🌊 Execution DAGs powered by Hexaflow

Universal Python quality gates, architectural boundary enforcement, and release engineering toolchain.

Hexaqual provides an opinionated, high-velocity quality harness designed for modular Python architectures, monorepos, and single-package projects. It unifies linting, type-checking, cognitive complexity enforcement, __all__ integrity, 1:1 test symmetry, and automated PyPI release workflows into a cohesive, workflow-driven developer CLI.


🚀 Key Features

  • Workflow-Driven Sanity Checks: Multi-stage DAG pipeline powered by Hexaflow for parallel linting, typechecking, and testing.
  • Turnkey GitHub Marketplace Action: Drop-in composite action setting up Python, uv, pre-commit caching, and executing quality checks in CI.
  • Architectural Invariants: First-class support for hexagonal layer enforcement (domain, ports, adapters, infra).
  • Test Parity Enforcement: 1:1 symmetry verification between source modules and unit test suites.
  • Public API Integrity: Automatic sorting, deduplication, and AST validation of __all__ exports.
  • Smart PyPI Publishing: Dependency-ordered, reproducible builds with automatic skip-if-exists checks.

⚡ GitHub Marketplace Action

Hexaqual is available on the GitHub Marketplace as a turnkey composite action that automatically sets up uv, Python, caches pre-commit environments, and runs your checks:

jobs:
  quality-gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: TheTrueSCU/hexaqual@6117ce25b1d39768f22396a55d13103abee88926 # v0.12.1
        with:
          mode: "pre-commit" # options: 'pre-commit', 'sanity', 'setup'
          sync-args: "--all-extras --dev"

📦 Installation

# Add as a development dependency
uv add --dev hexaqual

# Or install globally
uv tool install hexaqual

🛠️ Unified CLI (hexaqual)

Hexaqual subsumes all developer quality tools into a single unified entrypoint (hexaqual). It dynamically detects workspace layout:

  • Multi-package workspaces (packages/ exists): accepts -p / --package to filter focus across packages, or -a / --all for the whole workspace.
  • Single-package projects (no packages/): automatically focuses on the root package without requiring -p.
  • Examples support: if an examples/ directory exists, -e / --example allows targeted auditing of example projects.

Command Overview

Command Subcommands Description
hexaqual check (alias: sanity) — Run the multi-stage quality pipeline (Ruff, Ty, Complexipy, __all__, test parity, deptry, pytest).
hexaqual statements check, fix Audit and auto-format __all__ exports with strict casefold sorting.
hexaqual parity test, architecture, extras Audit 1:1 test symmetry, architectural boundary suites, and optional extras forwarding.
hexaqual test run, bench, boundary, impact, redundancy, fuzz, snapshot, archon, benchmark-report Run pytest suites, microbenchmarks, boundary audits, redundancy, impact tests, fuzzing, and snapshots.
hexaqual mutate run, inspect, plan Dual-engine mutation testing (pytest-gremlins & mutmut) with auto-parallelism, triage inspection, and CI slicing.
hexaqual hooks install, check, uninstall, commit-msg Multi-stage Git hooks lifecycle management (pre-commit, commit-msg, pre-push, post-merge, post-checkout).
hexaqual iac check, discover, fmt Auto-detecting IaC formatting, linting, and misconfiguration scanning (OpenTofu/Terraform, Docker, K8s, Shell).
hexaqual openssf audit, propose, checklist, scorecard, scaffold, check Audit OpenSSF Best Practices badge compliance, evaluate scorecard checks, and propose remediation updates.
hexaqual release build, check, publish, reproducible Build sdist/wheel distributions, verify metadata and reproducibility, and publish to PyPI skipping existing releases.
hexaqual gh pr, checks, repo, security, code-scanning, codeql, resolve, ci-duration Inspect PR health dashboards, CI checks, repo settings, security threads, CodeQL alerts, and CI duration trends.
hexaqual deps audit, deptry, linter, linter-generate, pydeps Audit dependencies, run deptry checks, verify/generate import-linter contracts, and inspect pydeps diagrams.
hexaqual refactor alphabetize, rename, extract, move, run Automated code refactoring and AST-level symbol alphabetization via Rope.
hexaqual docs usage, drift, links, publish, blog medium Verify/regenerate USAGE.md, check documentation drift/links, and publish Dev.to or Medium links.
hexaqual agents sync, check, list Synchronize and verify universal .agents guardrails (rules, workflows, skills).
hexaqual complexity — Audit cognitive complexity across functions and methods via complexipy.
hexaqual version — Display the installed hexaqual version.
# Run sanity checks on specific packages in a workspace
hexaqual check -p core -p cqrs

# Run sanity check with auto-formatting on a single-package repo
hexaqual check --fix

# Audit __all__ integrity across all packages
hexaqual statements check

# Run pytest on tests impacted by recent git changes
hexaqual test impact

# Examine a GitHub Pull Request dashboard with live polling
hexaqual gh pr 42 --watch

# Verify USAGE.md catalog is up to date
hexaqual docs usage --check

For the complete unrolled CLI reference and full option listings for every subcommand, see USAGE.md.


🪝 Git Lifecycle Hooks & Commit Governance

Standard pre-commit install only installs the pre-commit stage by default. Hexaqual provides a unified hooks manager that configures all 5 critical lifecycle stages in a single step:

# Install all 5 hook stages (pre-commit, commit-msg, pre-push, post-merge, post-checkout)
uv run hexaqual hooks install

# Inspect active hook status across all stages
uv run hexaqual hooks check
Hook Stage Trigger Purpose
pre-commit git commit Fast static quality checks (Ruff, Ty, complexipy, __all__, test symmetry).
commit-msg git commit Validates Conventional Commits and OpenSSF DCO sign-offs (Signed-off-by:).
pre-push git push Fast regression sanity gate preventing broken builds from reaching remote CI.
post-merge git pull / merge Auto-syncs dependencies (uv sync) and re-synchronizes universal agent rules.
post-checkout git switch Auto-syncs dependencies and agent guardrails on branch changes.

Pre-Commit Configuration (.pre-commit-config.yaml)

Hexaqual distributes reusable hooks via GitHub:

repos:
  - repo: https://github.com/TheTrueSCU/hexaqual
    rev: v0.13.1
    hooks:
      - id: hexaqual-sanity        # Fast static sanity gate (Ruff, Ty, complexipy, etc.)
      - id: hexaqual-architecture  # Verify test_hexagonal_boundaries.py suites
      - id: hexaqual-agents        # Verify .agents/ assets match installed hexaqual
      - id: hexaqual-agents-sync   # Auto-sync .agents/ on post-merge and post-checkout
      - id: hexaqual-commit-msg    # Enforce Conventional Commits & DCO on commit-msg
      - id: hexaqual-pre-push      # Run fast sanity check on pre-push
      - id: hexaqual-iac           # Auto-detecting IaC formatting, linting, & security scan

🧬 Dual-Engine Mutation Testing

Hexaqual implements a high-velocity dual-engine mutation testing harness:

  1. pytest-gremlins (Default): In-process AST mutation engine targeting executable boundary conditions (< vs <=, and vs or, arithmetic, returns). Delivers 100% actionable signal with decoupled multicore scaling:
    • -n auto: Parallel baseline pytest execution via pytest-xdist.
    • -w auto: Parallel in-process mutation workers (--gremlin-workers).
    • --batch-size 10: Batched mutant execution (--gremlin-batch).
    • -A / --affected: Scopes mutation testing strictly to packages impacted by git diff.
  2. mutmut: Subprocess-isolated deep mutation auditor for literal constants, token shifts, and pre-release audits.
# High-velocity developer loop: multicore auto-scaled boundary mutations
uv run hexaqual mutate run -p <pkg> -e gremlins -w auto --batch-size 10 -n auto

# Scoped to affected packages only (ideal for PR CI verification)
uv run hexaqual mutate run -A -e gremlins -w auto

# Deep literal constant audit
uv run hexaqual mutate run -p <pkg> -e mutmut

# High-level triage summary of surviving mutants (Critical, Equivalent, Ignorable)
uv run hexaqual mutate inspect -s

# Actionable critical mutants only
uv run hexaqual mutate inspect -p <pkg> -act

🐕 Dogfooding Hexaflow: Workflows as Architecture

Hexaqual serves as the primary real-world dogfooding ground for Hexaflow, demonstrating how lightweight, in-memory workflow DAGs can orchestrate high-performance developer tooling without complexity or latency.

The Sanity Workflow DAG

Rather than executing checks in a rigid, monolithic sequence or maintaining ad-hoc shell orchestration, hexaqual sanity compiles each target's verification into a declarative hexaflow.Workflow:

graph LR
    subgraph stage1 ["Stage 1: Leaf Static Checks"]
        Lint["Ruff Lint & Format"]
        Statements["__all__ Integrity"]
        Parity["1:1 Test Symmetry"]
        Diagrams["Architecture Diagrams"]
    end

    subgraph stage2 ["Stage 2: Static Analysis"]
        Typecheck["Ty Typecheck"]
        Complexity["Cognitive Complexity <= 25"]
        Deptry["Deptry Dependencies"]
    end

    subgraph stage3 ["Stage 3: Dynamic Verification"]
        Pytest["Pytest Test Suites"]
    end

    Lint --> Typecheck
    Statements --> Typecheck
    Parity --> Complexity
    Diagrams --> Complexity
    Typecheck --> Pytest
    Complexity --> Pytest
    Deptry --> Pytest

Why Dogfooding Hexaflow Matters:

  1. Deterministic Staging & Fail-Fast: Ultra-fast leaf AST checks (Ruff, __all__, test symmetry, architecture diagrams) execute in Stage 1, providing immediate feedback before heavier static analysis (ty, complexipy, deptry) or test suites run.
  2. Granular Step Checkpoints: Each verification step executes within a discrete StepContext, recording execution metrics, structured findings, and pass/fail states into an InMemoryStateStore.
  3. Zero-Latency Overhead: Hexaflow's minimal runtime footprint lets static checks fan out cleanly across stages.
  4. Resilient Error Isolation: If a step fails, the workflow gracefully preserves partial reports, enabling the Rich presenter to render complete multi-target dashboards showing exact failure context.

🤖 Universal AI Guardrails & Agent Management (.agents/)

Hexaqual acts as the single source of truth for AI pair programming assistants (Antigravity CLI, Cursor, Claude Code, Windsurf) across the entire hexa- family (hexastack, hexaqueue, hexaflow, hexaqual).

It implements a Two-Tier Architecture:

  1. Universal Guardrails (Managed by hexaqual): Bundled rules (hexaqual-*.md), workflows (hexaqual-*.md), and skills (hexaqual_*.py) that apply universally across every repository.
  2. Family-Member Guardrails (Local to X): Repository-specific rules (hexa<X>-*.md) that define project-specific invariants (e.g., hexaqueue-elevation.md, hexaflow-dag-invariants.md). These local assets are preserved untouched during synchronizations.

Bundled Universal Catalog

Category File Description
Rule hexaqual-boundaries.md Enforce hexagonal layer isolation (domain/ -> ports/ -> adapters/ -> infra/).
Rule hexaqual-docstrings.md Mandatory Google docstrings with Args:, Returns:, Raises:, and Notes/Architectural Intent:.
Rule hexaqual-documentation.md Synchronize READMEs, Zensical docs, diagrams, and the canonical docs/ecosystem.md map on changes.
Rule hexaqual-hermetic-testing.md Hermetically sealed test fixtures, tmp_path, zero global state or socket pollution.
Rule hexaqual-lazy-imports.md Strict directional hexagonal import boundaries and lazy-import hygiene.
Rule hexaqual-modifications.md Blast-radius limits, atomic diff constraints, and prohibition of placeholder truncation.
Rule hexaqual-openssf.md OpenSSF Best Practices badge & Security Scorecard regression prevention (DCO sign-off, pinned SHAs).
Rule hexaqual-property-testing.md Hypothesis stateful fuzzing (RuleBasedStateMachine) for state machines and schedulers.
Rule hexaqual-reanchoring.md Architectural re-anchoring, context re-hydration, and evidence receipts after compaction.
Rule hexaqual-security.md Prohibition of shell=True, path traversal guards, secret scanning, least-privilege defaults.
Rule hexaqual-sync.md Guardrail invariant to execute hexaqual agents sync upon dependency upgrades.
Rule hexaqual-test-authoring.md 1:1 test parity, __init__.py mirroring, pure ABC port mocking, side-effect-free assertions.
Rule hexaqual-test-pyramid.md Four-tier testing pyramid standards (Unit, Integration, Property-Based, and Fuzzing).
Rule hexaqual-tooling.md Modern Python tooling invariants (uv run, PEP 735) and mandatory local verification protocol.
Rule hexaqual-typing.md PEP 695 generic syntax (class C[T]:), zero bare Any across domain boundaries.
Rule hexaqual-workspace.md Monorepo hierarchy, subpackage import boundaries, casefold-sorted __all__ exports.
Workflow hexaqual-mutation.md Dual-engine mutation testing (pytest-gremlins & mutmut) and actionable mutant triage.
Workflow hexaqual-openssf.md Triage and remediate OpenSSF Best Practices badge & Security Scorecard regressions.
Workflow hexaqual-pre-commit.md Fast pre-commit gate (hexaqual sanity -a --skip-tests, docs freshness, agent sync).
Workflow hexaqual-pre-push.md Full pre-push gate: format drift -> sanity with tests -> graphify -> pre-commit hooks.
Workflow hexaqual-pre-release.md Pre-release packaging audit, doc freeze, PyPI availability, reproducible wheel check.
Workflow hexaqual-scaffold-unit.md Scaffold domain entity, port, adapter, and mirrored unit test file.
Workflow hexaqual-sync.md Synchronize shared agent guardrails from installed hexaqual.
Skill hexaqual_audit_complexity.py Fast function cognitive complexity linter (<= 25 via complexipy).
Skill hexaqual_audit_docstrings.py AST docstring auditor checking for Google docstrings & Architectural Intent.
Skill hexaqual_audit_lazy_imports.py AST auditor detecting unauthorized lazy imports and hexagonal layer bypasses.
Skill hexaqual_scaffold_test_parity.py Git-aware test mirror and __init__.py scaffolding helper.

CLI Synchronization & Drift Verification

# Synchronize universal guardrails to current repository (preserves local hexaX-* rules)
uv run hexaqual agents sync

# Dry-run simulation of synchronization
uv run hexaqual agents sync --dry-run

# Verify repository guardrails match the installed hexaqual version (pre-commit gate)
uv run hexaqual agents check

# List all universal bundled rules, workflows, and skills
uv run hexaqual agents list

Root Pointer (AGENTS.md) & Dynamic Reloading

  • Aggregated Index: hexaqual agents sync creates a root AGENTS.md indexing all active rules, workflows, and skills (both universal hexaqual-* and project-specific hexa<X>-* assets). This ensures single-file agent tools (like GitHub Copilot Workspace) maintain full context.
  • VCS Hygiene: hexaqual agents sync ensures .gitignore excludes .agents/*/hexaqual-* so upstream assets are never committed to git. Maintainers may commit AGENTS.md for GitHub visibility or add it to local .git/info/exclude to keep the root directory clean.
  • Per-Turn Dynamic Reloading: In Antigravity CLI/IDE, rule files under .agents/rules/ and AGENTS.md are dynamically reloaded at the start of each user prompt, so synced guardrails take effect immediately on the next interaction.

🏛️ Architecture & Documentation


📄 License

Apache-2.0. See LICENSE for details.

Metadata

Release files for hexaqual 0.13.1

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

Source distribution (sdist)

Source distribution for hexaqual 0.13.1
File Size Uploaded Provenance Actions
hexaqual-0.13.1.tar.gz 6.7 MB Without provenance Details for hexaqual-0.13.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hexaqual 0.13.1
File Interpreter ABI Platform Actions
hexaqual-0.13.1-py3-none-any.whl Python 3 none any Details for hexaqual-0.13.1-py3-none-any.whl

Total release size: 7.0 MB

Release files / hexaqual-0.13.1.tar.gz

Download URL hexaqual-0.13.1.tar.gz
Size 6.7 MB
Tags Source
SHA-256 checksum
How to use checksums
747cdf2a0f2fc64cbedc7e68ca5cb44ce19e6e1977beb658b71f836566bfe670
BLAKE2b-256 checksum
How to use checksums
845a092668491c089edb80a735f9c846c8aa3a41231be806858c8a083f530d67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hexaqual-0.13.1-py3-none-any.whl

Download URL hexaqual-0.13.1-py3-none-any.whl
Size 355.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27dc5e33fcac1d65efa5388c653f32c0c37bade86bcbb6ee01128558122acf73
BLAKE2b-256 checksum
How to use checksums
a5538787b64dfc9dd273bd8109adfda932a707324f8ec491a0c4e0b504102ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for hexaqual 0.13.1

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.13.1 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