Red Agent Guide
- Dependencies: Raku >= 2022.07. Install deps:
zef install --/test --test-depends --deps-only .. - Run all tests:
prove6 -lj8 t(CI uses this). Alt:zef test . --verbose. - Run a single test file:
prove6 -lv t/35-create.rakutest(replace with target file). - Quick compile check (lint):
raku -c lib/Red.rakumodand for any changed files. - Install locally:
zef install --/test .. Generate docs:make docsorraku tools/make-docs.raku. - DB config for tests/examples: set
RED_DATABASE(e.g.Pg host=localhost ...); many tests work with SQLite by default. - Imports: prefer explicit
use; examples useuse Red:api<2>; internal modules asuse Red::.... - Formatting: 4-space indent, no tabs, trim trailing spaces, ~100 char lines, one statement per line.
- Types: add type constraints on attributes/signatures (Int, Str, Bool, DateTime, etc.); use
is rwonly when mutation is required. - Naming: Types/Models CamelCase; methods/attributes kebab-case (e.g.,
create-table,author-id); SQL/table/column names snake_case. - Errors: throw typed exceptions (
X::Red::*) instead of genericdie; useCATCH { default { ... } }to transform/rethrow; avoid silent Nil—returnFailureor throw. - ORM traits: columns via
is column, ids viais serial/is id, FKs viais referencing{ ... }, relations viais relationship{ ... }; keepinflate/deflatepure. - Immutability: prefer immutable updates; call
.^saveexplicitly for persistence. - Tests: place under
t/as.rakutest; avoid external state; prefer temp SQLite unlessRED_DATABASEis required. - CI reference: see
.github/workflows/matrix.yaml(Raku setup, deps,prove6). Replicate locally when debugging. - Docs:
make clean-docsthenmake docsto refresh API docs. - Cursor/Copilot: none present (
.cursor/rules/,.cursorrules, and.github/copilot-instructions.mdnot found). - Commits: keep diffs minimal and focused; match existing patterns and avoid unrelated formatting changes.
Project Links
- GitHub repo: https://github.com/FCO/Red
- Issue tracker: https://github.com/FCO/Red/issues
- Wiki: https://github.com/FCO/Red/wiki
- Docs (GitHub Pages): https://fco.github.io/Red/
- API index: https://fco.github.io/Red/API
- Tutorials index: https://fco.github.io/Red/#tutorials
- Coverage report: https://fco.github.io/Red/coverage/report.html
Release to Zef
- Prereqs:
zef install App::Mi6 fez; ensuredist.inihas[UploadToZef]andMETA6.jsonhasauthlikezef:FCO. - Login:
fez login(stores token) or setFEZ_TOKENenvironment variable. - Verify: tests green (
prove6 -lj8 torzef test .); rebuild docs if needed (make docs). - Prepare: update
Changesunder{{$NEXT}}with notes; keep the format consistent with prior entries. - Bump + release (preferred):
mi6 release --bump patch(orminor/major). This updatesMETA6.jsonandChanges, creates and pushes a git tag, then uploads to the Zef ecosystem via Fez (because[UploadToZef]is enabled). - Manual alternative: bump
META6.jsonandChanges, commit and tag;mi6 build; thenfez uploadfrom the repo root. - Verify: after a few minutes,
zef search Redor check the Zef index; consumers canzef install Red:ver<NEW>. - Troubleshooting: if upload/auth fails, rerun
fez login; ensure the version is new and the git tree is clean; make sure the tarball includesMETA6.jsonand README (generated byReadmeFromPodduring build).