# Contributing to zfj Changes are welcome as pull requests on the Tangled mirror, , where problems can be reported too. ## Getting set up Everything a build needs comes from the Nix flake: ```console $ nix develop $ zig build test ``` The tools in the devshell — Zig 0.17, `reuse`, `zon2nix` — are the versions the checks below are run with. ## What a change needs - `zig build test` passes. It compiles all 506 generated operations, which is the broadest check there is, and runs the tests in `src/` and `src/cli/`. - `zig fmt --exclude zig-pkg --check .` and `reuse lint` pass. Every new file carries an SPDX header, or an entry in `REUSE.toml` when it cannot. - `nix build .#zfj` still builds without the network. A change to `build.zig.zon` regenerates `build.zig.zon.nix` with `nix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon`. - A change to the command-line tool that a user can see is covered by the NixOS test in `tests/nixos/`, which drives `zfj` against a real Forgejo: `nix build -L .#checks.x86_64-linux.forgejo`. It needs KVM. - The README says what the project does *now*, and changes with it. ## Where things are - `api/swagger.v1.json` is Forgejo's API description, vendored from a release; `zig build update-spec` replaces it. Nothing generated is checked in: the build runs `src/generate.zig` over it on every build. - `src/cli/` is the command-line tool. Its plumbing commands come from reflecting over the generated bindings, so an operation needs no code of its own to be one. Shell completion is answered by `src/cli/completion.zig` from the same option structs and notes the commands parse with, so a new command or option is completed with no work of its own; a top-level word goes in `entries` in `main.zig`, beside its line in `dispatch`. `src/cli/completions/` holds each shell's completion script. - `GLOSSARY.md` holds the project's vocabulary, and `docs/adr/` the decisions that would surprise a reader. Use the glossary's words, and add to it when a new one settles. ## Fixes that belong elsewhere The generator is a fork of openapi2zig. A wrong type, a missing field or a broken request in the bindings is usually the generator's, and is fixed there — in `github:jcollie/openapi2zig`, branch `zig-0.17` — rather than worked around here; `build.zig.zon` then moves to the fixed commit.