|
| 1 | +# Contributing to Botloft |
| 2 | + |
| 3 | +Thanks for taking a look. Botloft is young (version 0.x) and every kind of help counts: trying it and |
| 4 | +reporting what broke, ideas, docs, translations and code. |
| 5 | + |
| 6 | +## Ways to help |
| 7 | + |
| 8 | +- **Try it and tell us.** A bug report with the steps to reproduce it is one of the most useful |
| 9 | + things you can send. Use the [bug report form](https://github.com/httpsphl/botloft/issues/new/choose). |
| 10 | +- **Antivirus false positives.** Releases are not code-signed yet (see the |
| 11 | + [code signing policy](docs/code-signing-policy.md)), so an antivirus may flag them by guesswork. |
| 12 | + If yours does, open an issue with the file name, the detection name and the antivirus; we report |
| 13 | + each one to the vendor. |
| 14 | +- **Pick an issue.** Issues labeled |
| 15 | + [`good first issue`](https://github.com/httpsphl/botloft/labels/good%20first%20issue) are small and |
| 16 | + self-contained; [`help wanted`](https://github.com/httpsphl/botloft/labels/help%20wanted) ones are |
| 17 | + bigger. Comment on the issue before you start so two people do not do the same work. |
| 18 | +- **Translations.** The app speaks English, Brazilian Portuguese and Spanish. Fixes to wording are |
| 19 | + welcome in any of them. |
| 20 | +- **Bigger changes.** For a new feature or a change in how something works, open an issue first and |
| 21 | + describe it. It saves you from writing code that does not fit the plan. |
| 22 | + |
| 23 | +## Getting set up |
| 24 | + |
| 25 | +The [Development section of the README](README.md#status) lists what to install and the commands to |
| 26 | +build and test. The short version: |
| 27 | + |
| 28 | +```powershell |
| 29 | +cargo test --workspace |
| 30 | +cd app |
| 31 | +pnpm install |
| 32 | +pnpm dev # the UI alone in a browser, with a fake daemon and sample crews |
| 33 | +``` |
| 34 | + |
| 35 | +`pnpm dev` needs neither Rust nor Claude Code, so it is the quickest way to work on the interface. |
| 36 | +Running real bots needs Claude Code installed and signed in. |
| 37 | + |
| 38 | +During development, set `BOTLOFT_HOME` to an absolute path (for example `$PWD\.dev\home`) for both |
| 39 | +the daemon and the app, so they never touch a real Botloft installation. |
| 40 | + |
| 41 | +## How the project is organized |
| 42 | + |
| 43 | +``` |
| 44 | +crates/botloft-core domain types, IDs, message envelope, protocol types (exported to TypeScript) |
| 45 | +crates/botloft-store SQLite storage, migrations in migrations/NNNN_name.sql |
| 46 | +crates/botloftd the daemon: RPC, supervisor, bot runtime, chat, message delivery, MCP tools |
| 47 | +app/ Tauri v2 + React 19 + TypeScript (strict) + Tailwind v4 + Zustand |
| 48 | +docs/ specification and architecture decision records |
| 49 | +``` |
| 50 | + |
| 51 | +[`docs/spec.md`](docs/spec.md) is the source of truth for architecture, protocol, data and states. |
| 52 | +It is written in Portuguese; a browser translation reads fine, and questions about it are welcome in |
| 53 | +an issue. If your change makes the spec wrong, update the spec in the same pull request. |
| 54 | + |
| 55 | +## Rules for code |
| 56 | + |
| 57 | +- **Write it yourself.** Botloft is its own implementation. Do not copy or adapt code, tests, texts |
| 58 | + or schemas from other agent orchestration projects. The spec, the official Claude Code |
| 59 | + documentation and the documentation of the libraries we use are fine sources. |
| 60 | +- **English** for code, identifiers, comments and commit messages. |
| 61 | +- **Small files.** Keep files under about 300 lines; split by responsibility past that. |
| 62 | +- **Errors:** `thiserror` in the library crates, `anyhow` only in the binary. |
| 63 | +- **Platform code** (Win32, systemd, launchd) lives in `crates/botloftd/src/platform/`. The rest of |
| 64 | + the daemon does not call the OS directly. |
| 65 | +- **The UI talks only to `BotloftApi`** (`app/src/lib/api.ts`). Component tests use `FakeBotloft`. |
| 66 | +- **No interface text inside components.** Every string goes in |
| 67 | + `app/src/i18n/{en,pt-BR,es}/<area>.ts`, in all three languages, and is read with `useT()`. The |
| 68 | + TypeScript check flags a missing one. Use plain words: the app never says "daemon" or other jargon |
| 69 | + to the user. |
| 70 | +- **Never edit `app/src/lib/protocol.gen.ts` by hand.** It is generated from the Rust types with |
| 71 | + `cargo test -p botloft-core export_bindings`. |
| 72 | +- **Privacy.** Never log tokens, message bodies, attachments or chat items at `info` level or |
| 73 | + above: bots may handle personal data. No telemetry. |
| 74 | + |
| 75 | +## Before you open a pull request |
| 76 | + |
| 77 | +1. `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings` and |
| 78 | + `cargo test --workspace` pass. |
| 79 | +2. If you changed the app: `pnpm check` passes (typecheck, Biome and Vitest). |
| 80 | +3. New behavior has a test. The supervisor, message delivery and chat are tested with |
| 81 | + `FakeRuntime`; components with `FakeBotloft`. |
| 82 | +4. The spec still describes what the code does. |
| 83 | +5. If the change depends on how the real Claude Code behaves, say in the pull request how you tested |
| 84 | + it by hand. |
| 85 | + |
| 86 | +Keep pull requests small, one change each, with a title in |
| 87 | +[Conventional Commits](https://www.conventionalcommits.org) form, such as |
| 88 | +`fix(chat): keep the draft when a bot restarts`. CI runs on Windows, Ubuntu and macOS and must pass |
| 89 | +before merging. |
| 90 | + |
| 91 | +Using an AI assistant to write your contribution is fine. You are still the one who answers for it: |
| 92 | +read every line, run the checks and make sure it follows the rules above. |
| 93 | + |
| 94 | +## License |
| 95 | + |
| 96 | +Botloft is licensed under the [Apache License 2.0](LICENSE). By sending a contribution, you agree |
| 97 | +that it is licensed under the same terms (section 5 of the license). |
| 98 | + |
| 99 | +## Security |
| 100 | + |
| 101 | +Please do not open a public issue for a security problem. See [SECURITY.md](SECURITY.md). |
0 commit comments