feat(hooks): support no-compose CLI repos in common.just #8

Merged
David merged 1 commit from feat/GOV-39-no-compose-cli-shape into main 2026-07-02 14:00:03 +02:00
Owner

Makes the no-compose CLI repo shape a first-class, variable-driven option in common.just so pure-CLI consumers (forgejo-cli, youtrack-cli) can adopt common without shadowing recipes via set allow-duplicate-recipes (the drift anti-pattern the repo CLAUDE.md blast-radius rule forbids). Tracks GOV-39; unblocks the forgejo-cli adoption (FJCLI-44).

What changed

  • pre-commit is now a dispatcher on the new pre_commit_mode variable (compose | docker). compose (default) is the existing compose-backed flow, extracted verbatim into pre-commit-compose. docker runs the same four checks in dev_image via a bare docker run with per-user named cargo caches (dev-{{app}}-cargo-{target,registry,git}-<user>), in pre-commit-docker. The four checks live in one place per variant, so the modes cannot drift on WHAT they run.
  • New test_args variable (default --bins). A workspace with library or integration tests overrides it (e.g. "" for the full suite) so those tests are not silently skipped before commit. --bins alone skips lib unit tests, integration tests, and doctests.
  • New dev_image variable (default ""), required only in docker mode.
  • run gains *args and forwards them (cargo run --release -- {{args}}). Backward compatible: existing arg-less callers get a trailing -- no-op.
  • dev-clean is now compose-aware: it runs docker compose ... down only when compose.dev.yml exists, removes the target/registry/git cargo volume superset (skipping absent ones), and removes target/ and dist/. No mode flag needed.
  • New binary_name variable (default app); build-docker-export reports dist/{{binary_name}} for repos whose binary name diverges from app.
  • README.md documents the compose-vs-no-compose shape selector.

Backward compatibility

All new variable defaults (pre_commit_mode = compose, dev_image = "", test_args = --bins, binary_name = app) preserve today's behavior. da-info, claude-run, and youtrack-cli are unaffected without any justfile edits. youtrack-cli can later drop its pre-commit / run / dev-clean shadows in favor of these variables (separate change).

Validation

just --justfile common.just --list and just --justfile common.just --evaluate both succeed; the new pre-commit-docker nushell block was syntax-checked with nu --ide-check on 0.112.2.

Makes the no-compose CLI repo shape a first-class, variable-driven option in `common.just` so pure-CLI consumers (forgejo-cli, youtrack-cli) can adopt common without shadowing recipes via `set allow-duplicate-recipes` (the drift anti-pattern the repo `CLAUDE.md` blast-radius rule forbids). Tracks GOV-39; unblocks the forgejo-cli adoption (FJCLI-44). ## What changed - `pre-commit` is now a dispatcher on the new `pre_commit_mode` variable (`compose` | `docker`). `compose` (default) is the existing compose-backed flow, extracted verbatim into `pre-commit-compose`. `docker` runs the same four checks in `dev_image` via a bare `docker run` with per-user named cargo caches (`dev-{{app}}-cargo-{target,registry,git}-<user>`), in `pre-commit-docker`. The four checks live in one place per variant, so the modes cannot drift on WHAT they run. - New `test_args` variable (default `--bins`). A workspace with library or integration tests overrides it (e.g. `""` for the full suite) so those tests are not silently skipped before commit. `--bins` alone skips lib unit tests, integration tests, and doctests. - New `dev_image` variable (default `""`), required only in `docker` mode. - `run` gains `*args` and forwards them (`cargo run --release -- {{args}}`). Backward compatible: existing arg-less callers get a trailing `--` no-op. - `dev-clean` is now compose-aware: it runs `docker compose ... down` only when `compose.dev.yml` exists, removes the target/registry/git cargo volume superset (skipping absent ones), and removes `target/` and `dist/`. No mode flag needed. - New `binary_name` variable (default `app`); `build-docker-export` reports `dist/{{binary_name}}` for repos whose binary name diverges from `app`. - `README.md` documents the compose-vs-no-compose shape selector. ## Backward compatibility All new variable defaults (`pre_commit_mode = compose`, `dev_image = ""`, `test_args = --bins`, `binary_name = app`) preserve today's behavior. da-info, claude-run, and youtrack-cli are unaffected without any justfile edits. youtrack-cli can later drop its `pre-commit` / `run` / `dev-clean` shadows in favor of these variables (separate change). ## Validation `just --justfile common.just --list` and `just --justfile common.just --evaluate` both succeed; the new `pre-commit-docker` nushell block was syntax-checked with `nu --ide-check` on 0.112.2.
common.just assumed every consumer is a compose-backed web service: pre-commit ran its checks via `docker compose ... run app`, dev-clean began with `docker compose ... down`, run was arg-less, and build-docker-export reported dist/{{app}}. No-compose CLI repos (forgejo-cli, youtrack-cli) could only adopt common by shadowing those recipes with `set allow-duplicate-recipes`, which is the drift anti-pattern the repo CLAUDE.md forbids. Make the CLI shape a first-class, variable-driven option so a consumer adapts by setting variables, not by re-forking recipes.

pre-commit becomes a dispatcher on the new pre_commit_mode (compose | docker); docker mode runs the same four checks in dev_image via a bare `docker run` with per-user named cargo caches. New test_args (default --bins) lets a workspace with library or integration tests run the full suite instead of silently skipping lib tests. run gains `*args` (backward compatible: arg-less callers get `cargo run --release --`). dev-clean now downs the compose stack only when compose.dev.yml exists and removes the target/registry/git volume superset plus target/ and dist/. build-docker-export reports dist/{{binary_name}}. All defaults (compose, "", --bins, app) preserve current behavior for da-info, claude-run, and youtrack-cli. Document the shape selector in README.md.

#GOV-39

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: David Randall <David@NiceGuyIT.biz>
David merged commit d424d6a3ce into main 2026-07-02 14:00:03 +02:00
David deleted branch feat/GOV-39-no-compose-cli-shape 2026-07-02 14:00:03 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/common!8
No description provided.