|
| 1 | +# Freenet Core – Agent Guide |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +Freenet Core is the peer-to-peer runtime that underpins applications in the Freenet ecosystem. The crates in this workspace implement the networking stack, contract execution environment, and developer tooling used by higher-level projects such as River. |
| 5 | + |
| 6 | +## Repository Layout |
| 7 | +- `crates/` – core libraries, binaries, and developer tooling (`core`, `gateway`, `fdev`, etc.) |
| 8 | +- `apps/` – integration binaries (benchmarks, diagnostic tools) |
| 9 | +- `docs/` – design notes and protocol documentation |
| 10 | +- `scripts/` – helper scripts used in CI and local workflows |
| 11 | +- `tests/` – end-to-end and integration test suites |
| 12 | + |
| 13 | +Refer to `README.md` for a more detailed component map. |
| 14 | + |
| 15 | +## Working with Git Worktrees |
| 16 | +- Keep a checkout on the `main` branch (for example, this directory) and create per-branch worktrees as siblings: |
| 17 | + ```bash |
| 18 | + git worktree add ../my-feature-branch feature/my-feature-branch |
| 19 | + ``` |
| 20 | +- Run `git worktree list` to see active worktrees and `git worktree remove ../my-feature-branch` when a branch merges. |
| 21 | +- Avoid committing from the `main` checkout; perform branch work inside the corresponding worktree directory to prevent conflicts between contributors. |
| 22 | + |
| 23 | +## Bootstrapping & Tooling |
| 24 | +```bash |
| 25 | +git submodule update --init --recursive |
| 26 | +cargo install --path crates/core # Provides the `freenet` binary |
| 27 | +cargo install --path crates/fdev # Utility CLI used in development |
| 28 | +``` |
| 29 | + |
| 30 | +## Common Commands |
| 31 | +```bash |
| 32 | +cargo build |
| 33 | +cargo test |
| 34 | +cargo fmt |
| 35 | +cargo clippy --all-targets --all-features |
| 36 | +``` |
| 37 | +Run these in any worktree before pushing a branch or opening a PR. |
| 38 | + |
| 39 | +## Testing Guidance |
| 40 | +- See `docs/TESTING.md` for mandatory scenarios and expectations. |
| 41 | +- The repository uses the special `TODO-` `MUST-FIX` marker to block commits that temporarily disable tests. If a test must be skipped, leave a `// TODO-` `MUST-FIX:` comment explaining why and create a follow-up issue. |
| 42 | +- Never remove or ignore failing tests without understanding the root cause. |
| 43 | + |
| 44 | +### Gateway Test Framework |
| 45 | +Integration testing is performed with the `freenet-testing-tools` repository (specifically `gateway-testing/`): |
| 46 | +```bash |
| 47 | +python gateway_test_framework.py --local # Smoke test against local build |
| 48 | +python gateway_test_framework.py --version v0.1.19 # Regression against a release |
| 49 | +python gateway_test_framework.py --version pr:123 # Validate a pull request |
| 50 | +``` |
| 51 | +Results land in `gateway-testing/results/<user>/<date>/` and include markdown summaries and compressed logs. Use the `--extended-stability`, `--multi-room`, or `--debug-locations` flags for deeper investigations. |
| 52 | + |
| 53 | +## Pull Requests & Reviews |
| 54 | +- All PR titles must follow Conventional Commits (`feat:`, `fix:`, `docs:`, etc.). CI fails non-conforming titles. |
| 55 | +- Substantial changes require review from another developer before merging. |
| 56 | +- Prefer stacked PRs for large efforts; rebase dependent branches after feedback. |
| 57 | + |
| 58 | +## Additional Resources |
| 59 | +- `PRE_COMMIT_HOOK_GUIDE.md` – configures local linting hooks. |
| 60 | +- `README.md` – high-level introduction and build instructions. |
| 61 | +- https://docs.rs/freenet – API documentation for published crates. |
| 62 | +- https://freenet.org/resources/manual/ – end-user manual explaining contracts, delegates, and network operation. |
| 63 | + |
| 64 | +Questions or blockers should be raised in the Freenet Matrix channels or GitHub discussions linked from `README.md`. |
0 commit comments