114 lines
7.9 KiB
Markdown
114 lines
7.9 KiB
Markdown
# Agent Notes
|
|
|
|
lore-forge is a Rust web server that sits beside Epic's [Lore](https://github.com/EpicGames/lore)
|
|
version control server. It provides accounts, sign-in through GitHub, Discord and Google, the
|
|
tokens Lore verifies, per-repository permissions, and a self-hosted forge UI on top.
|
|
|
|
**Status:** phase 1 in progress. The walking skeleton works end to end against a real
|
|
`loreserver`; see the phases in [architecture-overview.md](.ai/designs/architecture-overview.md).
|
|
|
|
## Git commits
|
|
|
|
- **Do not add Claude or any other AI attribution to commits.** No `Co-Authored-By: Claude ...`
|
|
trailer, no "Generated with Claude Code" line, no similar footer. This applies to commit
|
|
messages and to pull request descriptions.
|
|
- Commit only when asked.
|
|
|
|
## Building and testing
|
|
|
|
- `cargo test --workspace` runs the unit and in-process HTTP tests. `protoc` must be on `PATH`
|
|
(Lore's `user.proto` is compiled at build time).
|
|
- `cargo clippy --workspace --all-targets` should stay clean.
|
|
- `scripts/e2e-lore.sh` runs lore-forge against an unmodified `loreserver` and `lore` CLI: by
|
|
default the release pinned in `lore.lock`, fetched into `.lore/` by `scripts/fetch-lore.sh`.
|
|
Set `LORE_BIN_DIR` to test another build, and `LORE_PORT`/`FORGE_PORT` to run it beside a
|
|
deployment started by `scripts/start.sh`. Run it after any change to the issuer, registry or
|
|
directory, the generated `loreserver` config, the backup scripts, and whenever the Lore
|
|
version moves. `SMOKE=1` stops after one login and push.
|
|
It runs loreserver over TLS (`lores://`) with a CA made for the run, trusted through
|
|
`SSL_CERT_FILE` by the lore commands, lore-forge and the desktop service only; `NO_TLS=1`
|
|
uses `lore://`. It ends with a backup, a push, and a restore through `scripts/backup.sh` and
|
|
`scripts/restore.sh`.
|
|
It also drives the desktop `forge-service` through `scripts/desktop-e2e.py`, so run it after
|
|
service changes too; `NO_DESKTOP=1` skips that. That part signs in a second user, bob, with a
|
|
CLI working copy, to check locks and autosync between two users. The service logs at
|
|
`RUST_LOG` (default `info,forge_service=debug`) to `stdout.log` in its directory, which the
|
|
script prints on failure. Its logins use `LORE_AUTH_STORE=fallback`, so it never asks for
|
|
the keychain.
|
|
- To move Lore: `scripts/fetch-lore.sh --pin vX.Y.Z`, then the e2e test, then update the version
|
|
recorded in [lore-integration.md](.ai/designs/lore-integration.md). If `lore.h` changed,
|
|
regenerate the bindings (`cargo run -p lore-sys-gen -- .lore/vX.Y.Z/lore.h` in `desktop/`,
|
|
after `scripts/fetch-lore.sh --liblore`) and bump `lore_sys::INTERFACE_VERSION`.
|
|
|
|
- The desktop client in `desktop/` builds separately with Zig 0.17.1 and Cargo:
|
|
- `cd desktop && zig build test` runs its Rust tests and the GUI's self-test against a
|
|
private service. On macOS the window cannot open while the display sleeps ("open session:
|
|
Operating system error"); `caffeinate -u -t 2` first wakes it;
|
|
- `zig build check -Dtarget=x86_64-windows-gnu` cross-compiles the GUI;
|
|
- `cargo clippy --all-targets` in `desktop/` should stay clean;
|
|
- `forge-desktop --test --config-from <toml> --screenshot <png> [--tab files|graph|tree|changes|locks]`
|
|
captures the window, for checking UI changes without screen-recording permission. With
|
|
workspaces it syncs the first and waits for the tab's data, so it needs a live server and
|
|
a login (`LORE_AUTH_PATH`); a held e2e run (`HOLD=1 KEEP_WORK=1`) provides both.
|
|
- The service finds liblore through `LORE_FORGE_LIBLORE` or beside its executable;
|
|
`forge-desktop --liblore=PATH` passes it on. Outside the e2e, the real service on macOS
|
|
asks for keychain access once per binary unless `LORE_AUTH_STORE=fallback` is set.
|
|
|
|
## Where things are
|
|
|
|
| Path | Contents |
|
|
| --- | --- |
|
|
| `crates/forge-store` | SQLite pool, migrations (`migrations/`), audit helper |
|
|
| `crates/forge-access` | Actions, presets, name rules, grant resolution, registry rules, organisations |
|
|
| `crates/forge-id` | Secret key, passwords, signing keys and JWTs, users, sessions, the issuer (`src/issuer/`) |
|
|
| `crates/forge-lore` | Vendored Lore protos (`proto/`), the gRPC directory and registry, generated `loreserver` config |
|
|
| `crates/forge-web` | axum routes: issuer endpoints, pages (maud), CSRF and security headers |
|
|
| `crates/lore-forge` | The binary: `serve`, `loreserver-config`, `generate-secret-key`, `create-user`, `rotate-signing-key`, `backup-database` |
|
|
| `scripts/start.sh` | Starts a deployment from `run/` (git-ignored): settings, secret key, both servers |
|
|
| `scripts/fetch-lore.sh`, `lore.lock` | Downloads the pinned Lore release into `.lore/` (git-ignored), checking SHA-256; `--liblore` fetches liblore and `lore.h` |
|
|
| `scripts/e2e-lore.sh`, `scripts/desktop-e2e.py` | End-to-end test against real Lore, including the desktop service |
|
|
| `scripts/backup.sh`, `scripts/restore.sh` | Back up and restore the database and loreserver's store together |
|
|
| `scripts/build-desktop-dist.sh` | Cross-compiles the desktop client for Linux and Windows with Zig and packs the archives `/download` serves |
|
|
| `deploy/` | Production on Linux: `install.sh`, systemd units, the Caddy site, the settings template, `README.md` for operators |
|
|
| `desktop/` | The desktop client: `gui/` (C++ tray app), `service/` and `protocol/` (Rust), `lore-sys/` (liblore bindings; `gen/` regenerates them), `vendor/` (UHDK, Dear ImGui) |
|
|
|
|
- [.ai/designs/](.ai/designs/) holds the design documents. Start with
|
|
[architecture-overview.md](.ai/designs/architecture-overview.md), which links to the rest.
|
|
|
|
| Document | Covers |
|
|
| --- | --- |
|
|
| [architecture-overview.md](.ai/designs/architecture-overview.md) | The whole system, decisions made so far, build phases |
|
|
| [lore-integration.md](.ai/designs/lore-integration.md) | What Lore provides and requires, and how lore-forge connects to it |
|
|
| [accounts-and-sign-in.md](.ai/designs/accounts-and-sign-in.md) | Accounts, invites, provider linking, sessions |
|
|
| [token-issuer.md](.ai/designs/token-issuer.md) | The OIDC issuer: endpoints, grants, claims, keys |
|
|
| [namespaces-and-access.md](.ai/designs/namespaces-and-access.md) | User/org namespaces, teams, role presets, grants |
|
|
| [web-ui.md](.ai/designs/web-ui.md) | Server-rendered UI stack and its security constraints |
|
|
| [forge-features.md](.ai/designs/forge-features.md) | Repo browser, change requests, landing, activity |
|
|
| [storage.md](.ai/designs/storage.md) | SQLite, the data directory, tables |
|
|
| [deployment.md](.ai/designs/deployment.md) | Production on Linux: TLS, Caddy, systemd, backups |
|
|
| [desktop-client.md](.ai/designs/desktop-client.md) | The desktop client: service, GUI, TUI, their protocol, liblore, UHDK |
|
|
|
|
## Working on the design
|
|
|
|
- Keep the design documents current. When a decision changes, edit the document that owns it
|
|
and the decision table in the overview, rather than adding a new file that contradicts it.
|
|
- Each document separates what was **verified in Lore's source** from what is **assumed** or
|
|
**open**. Keep that distinction when editing; do not promote an assumption to a fact without
|
|
checking.
|
|
- Lore is pre-1.0 and changes quickly. Before relying on a Lore behaviour described here,
|
|
re-check it against the Lore version in use. The documents record which commit they were
|
|
checked against.
|
|
- Put open design decisions to the project owner as interactive questions with a recommended
|
|
option, rather than listing them in prose and assuming an answer.
|
|
|
|
## References
|
|
|
|
- **Lore:** <https://github.com/EpicGames/lore>. Minimum version for this design is v0.14.0.
|
|
The most relevant upstream files are listed in
|
|
[lore-integration.md](.ai/designs/lore-integration.md).
|
|
- **UHDK:** the owner's desktop library (a sibling checkout, `../uhdk-internal`), vendored into
|
|
`desktop/vendor/`. Update it only as [desktop/vendor/README.md](desktop/vendor/README.md)
|
|
describes; never edit the vendored copy.
|
|
- **piki:** the owner's Go project (a sibling checkout, `../piki`) is the reference for the
|
|
account system. Its `agents/data-auth-services.md` maps the auth code.
|