Heurix (hx)
Deterministic Codebase Scanner & Automated YAML Synthesizer
100% Deterministic • Offline-Capable • Deep Heuristic Analysis • Non-Destructive AST Smart Merge
Overview
Heurix (CLI alias: hx) is an offline-capable, pure-logic codebase scanner and infrastructure YAML synthesizer. It inspects .gitignore-filtered repository files once via RepoIndexer into a strongly-typed Pydantic ProjectContext Intermediate Representation (IR), cross-references lockfiles, manifests, Dockerfiles, compose configurations, .env templates, and cloud deployment targets, and deterministically synthesizes schema-validated CI/CD workflows, Dependabot maintenance files, and Kubernetes manifests.
Why Pure Logic?
- 100% Deterministic & Reproducible: No LLM hallucinations or non-determinism; vetted action pins with least-privilege
permissions: contents: readand customizable action versions/commit SHAs via.heurix.toml. - Instantaneous & Offline: Runs locally in milliseconds without network calls or API keys.
- Non-Destructive AST Smart Merge: Traverses
ruamel.yamlASTs recursively to preserve comments, custom user jobs, triggers, and any step tagged with# @heurix:preserveor# @autoyaml:preserveacross repeated runs. - Pre-Flight Schema Validation: Validates single- and multi-document YAML outputs against JSON schemas (
PreflightValidator) before writing a single byte to disk, with symlink/path-traversal protection. - Structural Drift Detection:
hx checkparses existing CI workflows and Dependabot configs structurally to detect missing backing services, pinned runtime mismatches, or outdated package manager setup.
Documentation & Interactive Playground
- Web Docs & Live Playground:
https://naveen-boddepalli.github.io/heurix/ - LLM Context Index:
llms.txt(andhttps://naveen-boddepalli.github.io/heurix/llms-full.txt) - Guides & Reference Docs (
docs/):docs/getting-started.md— installation, first scan, and.heurix.tomloverridesdocs/heuristics.md— full matrix for all 8 ecosystem detectorsdocs/cli-reference.md— commands, flags, interactive prompts, and exit codesdocs/smart-merge.md—ruamel.yamlAST merging and# @heurix:preservedocs/kubernetes-and-ci.md— synthesized GitHub Actions, Dependabot, andk8s/outputsdocs/drift-detection.md— runninghx checkin CI and pre-commit hooksdocs/architecture.md— unidirectional 5-layer IR architecture
Installation & Deployment
1. Install via PyPI
pip install heurix
# or with pipx for isolated global CLI access (recommended)
pipx install heurix
2. Standalone One-Line Installer
curl -fsSL https://raw.githubusercontent.com/Naveen-Boddepalli/heurix/main/install.sh | bash
3. Docker Container (No Python installation required)
docker run --rm -v $(pwd):/workspace ghcr.io/naveen-boddepalli/heurix:latest generate
4. Local Development & Global Shell Alias
Clone the repository and install in editable mode:
git clone https://github.com/Naveen-Boddepalli/heurix.git
cd heurix
python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev,build]'
To run hx from anywhere in your shell, add this to your ~/.zshrc or ~/.bashrc:
alias hx="/path/to/heurix/.venv/bin/hx"
Or execute directly from the repository root using ./hx.
Deployment & CI/CD Pipelines
The repository includes automated build, test, and publishing workflows:
- Continuous Integration (
.github/workflows/ci.yml): Runs the test suite on pull requests and pushes tomain. - PyPI Trusted Publishing (
.github/workflows/publish-pypi.yml): Builds sdist and wheel distributions and publishes to PyPI via GitHub Actions OIDC trusted publishing on release orv*.*.*tag push (plus manualworkflow_dispatchfor TestPyPI/PyPI). - Multi-Platform Docker Publishing (
.github/workflows/docker-publish.yml): Builds multi-arch (linux/amd64,linux/arm64) container images and publishes toghcr.io/naveen-boddepalli/heurix:latest. - GitHub Pages Docs & Playground (
.github/workflows/pages.yml): Syncsdocs/andllms.txt, builds the React + Vite frontend (site/), and deploys to GitHub Pages on push tomain. - Production
Dockerfile&.dockerignore: Multi-stage minimal container runtime with a non-root user and/workspacemount point. - Homebrew Formula (
packaging/homebrew/heurix.rb): Tap-ready formula forbrew install. Makefile: Developer tasks (make test,make check,make build,make docker-build,make docker-run,make site-dev,make site-build,make clean).
CLI Commands & Usage
Both hx and heurix invoke the CLI. Running hx with no subcommand runs hx generate.
1. hx generate (or hx)
Scans the codebase, runs heuristic detectors, validates synthesized YAML, and writes or non-destructively merges outputs.
# Scan and generate with step-by-step explainability log
hx generate
# Preview synthesized files without modifying disk (Dry Run)
hx generate --dry-run
# Show colorized terminal diff of proposed changes
hx generate --diff
# Non-interactive mode (auto-apply changes without prompts)
hx generate --yes
# Skip Kubernetes manifest synthesis
hx generate --no-k8s
# Target a specific repository path
hx generate --path /path/to/project
When an existing file would change in interactive mode, Heurix lets you choose between applying the AST smart merge, previewing the colorized diff (and re-prompting), creating a .bak backup before overwriting, or skipping the file.
2. hx diff
Compare existing repository configs against synthesized & smart-merged outputs without writing changes:
hx diff
3. hx check (Continuous Drift Detection)
Verifies structurally whether .github/workflows/ci.yml and .github/dependabot.yml match current codebase dependencies, pinned versions, backing services, and package managers. Exits with code 0 if synchronized, or 1 if drift is detected (ideal for CI and Git pre-commit hooks):
hx check
4. hx scan
Inspect the strongly-typed ProjectContext Intermediate Representation (IR) as JSON:
hx scan
5. hx init & .heurix.toml Policy Overrides
Initialize an optional .heurix.toml policy file for custom runners, synthesizer toggles, action SHA pinning, or version overrides:
hx init
Supported .heurix.toml sections:
[engine]:runner(e.g.,"ubuntu-latest"),non_destructive(true/false)[ci]:include_dependabot,include_k8s,default_branch,pin_actions,action_shas(40-char commit SHA mapping)[overrides]: explicit language runtime pins (python = "3.12",node = "20.x", etc.)
Deep Heuristic Capabilities
- Weighted Polyglot Ecosystem Detection: Scores root manifests and source file counts across Python, Node.js/TypeScript, Rust, Go, and C/C++ so primary language selection is deterministic and resilient to polyglot repos.
- Exact Version Pinning: Discovers runtime pins from
.python-version,.tool-versions,pyproject.toml,.nvmrc(preserving exact semver pins),.node-version,package.json,rust-toolchain.toml,go.mod, andCMakeLists.txt(CMAKE_CXX_STANDARD). - Lockfile & Virtualenv-Aware Commands: Selects install, lint, build, and test commands plus caching for
uv(uv run ...),poetry(poetry run ...),pipenv,pip,pnpm,yarn,bun,npm,cargo,go,cmake,conan,vcpkg, andmake(guardingMakefiledetection so non-C/C++ repos are never misclassified, and sequencingclang-tidyafter CMake builds only when.clang-tidyexists). - Automatic Backing Service Provisioning: Infers
postgres,redis, andmongodbfrom dependency manifests (Python:psycopg2,asyncpg,pymongo,motor,mongoengine,beanie; Node.js:prisma,ioredis,mongoose,mongodb) and externaldocker-compose.ymlservices, aligning test credentials and configuring health checks and ports. - Environment & Secret Isolation: Parses
.env.example/.env.template/.env.sample/.env.dist/.env.local.example, separating non-sensitive defaults (env:andk8s/configmap.yaml) from sensitive keys (test_secretswired to${{ secrets.KEY }},deployment_secretsisolated to deploy jobs), and enforcing top-levelpermissions: contents: read. - Cloud Deployment Target Detection (
CloudDetector): Detects Vercel (vercel.json,.vercel, serverlessapi/routes) and Firebase (firebase.json,.firebasercproject ID and features), wiring required secrets and generating conditionaldeploy_vercel/deploy_firebasejobs. - Monorepo Topology: Detects
pnpm-workspace.yaml,turbo.json,nx.json, andpackage.jsonworkspaces, enumerating sub-packages and adding Dependabot entries. - Hardened Kubernetes & Kind Manifests (
k8s/): Generates production-hardened manifests with pod and containersecurityContext(runAsNonRoot: true,allowPrivilegeEscalation: false,readOnlyRootFilesystem: true,drop: [ALL]capabilities),k8s/deployment.yaml,k8s/service.yaml,k8s/ingress.yaml(ingressClassName: nginx),k8s/configmap.yaml,k8s/secret.yaml, andk8s/kind-config.yaml. - Maintenance & Safety Controls: Synthesizes
.github/dependabot.ymlcoveringgithub-actionsand every detected ecosystem, with empty directory guards that prevent generating hollow workflows on repos with no code.
Project Structure
heurix/
├── pyproject.toml # Build & dependency metadata (scripts: hx, heurix)
├── Makefile # Dev, test, Docker, build, and docs site tasks
├── Dockerfile # Multi-stage production container image
├── heurix.md # Master architecture & product plan
├── llms.txt # LLM-friendly project index
├── hx # Direct executable wrapper
├── docs/ # Guides, CLI reference, and architecture docs
├── site/ # Interactive Vite + React docs & playground frontend
├── .github/workflows/ # ci.yml, pages.yml, docker-publish.yml, publish-pypi.yml
├── src/
│ └── heurix/
│ ├── cli.py # Typer CLI entrypoint & path-safe file writer
│ ├── core/
│ │ ├── context.py # Pydantic ProjectContext IR & DeploymentTarget models
│ │ ├── indexer.py # .gitignore-aware repo indexer & language scorer
│ │ ├── merger.py # ruamel.yaml recursive AST merge & comment preservation
│ │ ├── validator.py # Multi-doc pre-flight JSON schema validator
│ │ └── drift.py # Structural AST drift detection engine
│ ├── detectors/ # Modular language, infra & cloud providers
│ │ ├── base.py
│ │ ├── python_detector.py
│ │ ├── node_detector.py
│ │ ├── rust_detector.py
│ │ ├── go_detector.py
│ │ ├── cpp_detector.py
│ │ ├── docker_detector.py
│ │ ├── env_detector.py
│ │ └── cloud_detector.py
│ ├── synthesizers/ # Deterministic YAML generators
│ │ ├── base.py
│ │ ├── github_actions.py
│ │ ├── maintenance.py
│ │ └── kubernetes.py
│ └── ui/
│ ├── console.py # Rich explain-tree and summary tables
│ ├── differ.py # Colorized terminal diff viewer
│ └── prompts.py # Interactive conflict resolution prompts
└── tests/ # Full test suite (168 tests across 14 test modules)
Running Tests & Site Build
# Run full test suite (168 tests)
.venv/bin/pytest -v
# Check repository CI drift
.venv/bin/hx check
# Build docs & interactive playground locally
make site-build
Metadata
Release files for heurix 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| heurix-0.2.0.tar.gz | 93.9 kB | Without provenance | Details for heurix-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heurix-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for heurix-0.2.0-py3-none-any.whl |
Total release size: 201.0 kB
Release files / heurix-0.2.0.tar.gz
| Download URL | heurix-0.2.0.tar.gz |
|---|---|
| Size | 93.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
930d13f2bc3a03ea6877838ff1e09e4df8f22e8143ac9111241db07fd0eee4a0
|
|
BLAKE2b-256 checksum How to use checksums |
94b980269775a15eca763dfb2b83c1b68d28786e02ec534a2740849e8d4a729f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / heurix-0.2.0-py3-none-any.whl
| Download URL | heurix-0.2.0-py3-none-any.whl |
|---|---|
| Size | 107.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59a84b6e1c3523ca7005df382fd92dd4c935bf7804538647595f163eec8a40a4
|
|
BLAKE2b-256 checksum How to use checksums |
7f79a476f00a8019edac5f8de6b00a2b8183820d181c9239c9eab3014af1250f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for heurix 0.2.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.