31 lines
1.5 KiB
Markdown
31 lines
1.5 KiB
Markdown
# sirmem
|
|
|
|
Nim CLI (stdlib only, no nimble deps) for a file-based knowledge-graph memory.
|
|
|
|
## Tooling: devbox
|
|
All tooling comes from devbox (nim, zig, git). Use `devbox shell` or
|
|
`devbox run <script>`. Fixing devbox.json / devbox.lock or running
|
|
`devbox update` needs no permission.
|
|
|
|
## Layout
|
|
- `src/sirmem/core.nim`: all logic; every command is a `cmdXxx` proc returning its output, `dispatch` routes args.
|
|
- `src/sirmem.nim`: thin main (`--dir`/`SIRMEM_DIR`, exit codes, stderr).
|
|
- `tests/test_all.nim`: std/unittest; the CLI suite runs `bin/sirmem`, so build first.
|
|
- `scripts/build.sh`, `scripts/zigcc`: cross-compile with `zig cc`.
|
|
- `.gitea/workflows/release.yml`: CI (test on push, release on `v*` tag).
|
|
|
|
## Build / test
|
|
- `devbox run build` -> `bin/sirmem`
|
|
- `devbox run test` (builds the binary, then runs the tests)
|
|
|
|
## Cross-compile (zig cc)
|
|
`scripts/build.sh <nim-os> <nim-cpu> <zig-target> <out>`, or `devbox run cross-all` -> `dist/`.
|
|
Targets: linux amd64 `x86_64-linux-musl`, linux arm64 `aarch64-linux-musl`,
|
|
macosx arm64 `aarch64-macos`, windows amd64 `x86_64-windows-gnu`.
|
|
Known zig 0.16 quirks (documented in build.sh): do not use `--opt:size`; linux-musl needs
|
|
`-d:useMalloc`; linux arm64 needs `--tlsEmulation:on` and links flakily, so the script retries.
|
|
|
|
## Conventions
|
|
- Errors: raise `SirmemError` (via `fail`); main prints `sirmem: error: ...`, exit 1. Warnings go to `Store.warnings` (stderr).
|
|
- Relations are always rewritten through `saveRels` (sorted, unique, atomic).
|