Contributing to flua

Thanks for your interest! flua is an open project — pull requests are welcome.

Before diving in, read the orientation pair:

Setup

python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"     # pytest + ruff
git config core.hooksPath .githooks    # the pre-commit hook keeps the synced trees fresh

Requires Python 3.11+; lupa is the only runtime dependency.

The pre-commit hook runs scripts/sync-skills.sh and stages the regenerated trees (skills, docs, forum index) — commits can then never fail the CI sync guard because of drift. Hooks are not transferred by clone, which is why the core.hooksPath line above is part of setup.

Development loop

.venv/bin/pytest tests/ -q            # full suite (live-HC3 tests are skipped)
.venv/bin/pytest tests/test_qa.py -q  # one file
.venv/bin/ruff check src/ tests/      # lint
.venv/bin/ruff format src/ tests/     # format (line length 100)

Run one test, test class, or test function with pytest's normal selectors:

.venv/bin/pytest tests/test_qa.py::test_name -q
.venv/bin/pytest tests/test_qa.py -k timer -q

Tests run against local mock servers, never a real HC3. The opt-in live suites (HC3_TEST=1 pytest tests/test_hc3_live.py) need your own controller credentials and touch only their own test QA.

Some tests bind localhost sockets. If tests fail in a restricted sandbox, rerun them in an environment that permits local socket binds. Prefer existing wait_until/wait_for_output helpers over sleeps so tests remain deterministic.

Making a change

  1. Open an issue or discuss the change first when it is not a small fix.
  2. Keep changes focused: one concern per PR, behavior and tests together.
  3. Add a test for new behavior — the suite is the contract. New tests follow the existing patterns (mock HC3 servers, wait_until helpers, stdout assertions).
  4. Update the docs: user-facing behavior in USAGE.md, internals in ARCHITECTURE.md, new directives in the directive table.
  5. Run ruff check and the full suite before pushing.

Prefer the one-command workflow when your change is ready:

git add <the files in this PR>
./scripts/pr.sh my-fix "feat: describe the change"

It runs the gate (ruff + the offline suite), creates a contrib/ branch, commits the staged files, pushes, and opens the PR (gh required for the last step). CI runs the same gate on every PR and push to main.

For larger changes, also run ruff format --check src/ tests/ and inspect the complete diff with git diff --check.

Code style

AI agents

Agents working on this repo (any framework) start at AGENTS.md — the repo map, commands, invariants, and conventions in one place.

The expected agent workflow is: inspect source and tests, make a focused change, add deterministic coverage, update documentation, run targeted tests, run Ruff, and report validation results. Agents must not contact a real HC3 or commit scratch probes from dev/ unless explicitly instructed.

Pull requests

License

MIT — see LICENSE.