2026-05-13 09:17:37 +02:00
|
|
|
# SharedInbox — Development Guide
|
2026-04-16 07:35:56 +02:00
|
|
|
|
2026-05-14 18:14:19 +02:00
|
|
|
## Codeberg
|
|
|
|
|
|
|
|
|
|
We use Codeberg: https://codeberg.org/guettli/sharedinbox/
|
|
|
|
|
|
|
|
|
|
CLI tool `fgj` is available to query issues/PRs/actions.
|
|
|
|
|
|
|
|
|
|
## Issue Label Workflow
|
|
|
|
|
|
2026-05-31 09:12:24 +02:00
|
|
|
Automation is handled by [agentloop](https://github.com/guettli/agentloop) running every 5 minutes via cron. Add a label to trigger an agent:
|
2026-05-14 18:14:19 +02:00
|
|
|
|
2026-05-31 09:12:24 +02:00
|
|
|
| Label | Trigger | Outcome |
|
|
|
|
|
|---|---|---|
|
|
|
|
|
| `loop/plan` | Planning agent reads the issue and writes an implementation plan as a comment | Issue moves to `loop/plan-done` |
|
2026-06-07 04:38:19 +02:00
|
|
|
| `loop/code` | Coding agent implements the change, creates a branch + PR | Issue routes to `loop/merge` |
|
|
|
|
|
| `loop/merge` | Merge agent rebases, waits for CI, and merges the PR | Issue moves to `loop/merge-done` |
|
2026-05-24 18:56:46 +02:00
|
|
|
|
2026-05-31 09:12:24 +02:00
|
|
|
**State machine:**
|
2026-05-24 18:56:46 +02:00
|
|
|
|
|
|
|
|
```
|
2026-06-07 04:38:19 +02:00
|
|
|
loop/plan → loop/plan-in-process → loop/plan-done
|
|
|
|
|
↘ NeedSupervisor (on failure)
|
2026-05-31 09:12:24 +02:00
|
|
|
|
2026-06-07 04:38:19 +02:00
|
|
|
loop/code → loop/code-in-process → loop/merge (via route)
|
|
|
|
|
↘ NeedSupervisor (on failure)
|
|
|
|
|
|
|
|
|
|
loop/merge → loop/merge-in-process → loop/merge-done
|
|
|
|
|
↘ NeedSupervisor (on failure)
|
2026-05-24 18:56:46 +02:00
|
|
|
```
|
2026-05-14 18:14:19 +02:00
|
|
|
|
2026-05-31 09:12:24 +02:00
|
|
|
**Rules:**
|
2026-05-14 18:24:07 +02:00
|
|
|
|
2026-05-31 09:12:24 +02:00
|
|
|
- Only issues authored by allowed users are picked up (guettli, guettlibot, guettlibot2, forgejo-actions).
|
|
|
|
|
- An issue with `NeedSupervisor` needs human attention — investigate, fix, then re-label.
|
2026-06-07 04:38:19 +02:00
|
|
|
- The merge agent merges the PR automatically once CI is green. A human still reviews the PR before it merges if branch protection requires a review.
|
2026-05-31 09:12:24 +02:00
|
|
|
- Planning agents only post a comment — they do NOT write code or open PRs.
|
|
|
|
|
- `loop/*` labels are managed by agentloop — do not set them manually while an agent is active.
|
|
|
|
|
|
|
|
|
|
**Typical lifecycle for a new feature:**
|
2026-05-14 18:24:07 +02:00
|
|
|
|
2026-05-31 09:12:24 +02:00
|
|
|
```
|
|
|
|
|
1. Create issue
|
|
|
|
|
2. Add label loop/plan → agent writes plan as comment
|
|
|
|
|
3. Review plan, request changes or approve
|
2026-06-07 04:38:19 +02:00
|
|
|
4. Add label loop/code → agent implements + opens PR + hands off to merge
|
|
|
|
|
5. (Optional) Review PR before it merges
|
|
|
|
|
6. Merge agent waits for CI and merges the PR automatically
|
2026-05-31 09:12:24 +02:00
|
|
|
```
|
2026-05-14 18:14:19 +02:00
|
|
|
|
2026-04-16 07:35:56 +02:00
|
|
|
## Code conventions
|
|
|
|
|
|
2026-05-13 09:17:37 +02:00
|
|
|
- Avoid `else`, use "early return".
|
2026-04-16 07:35:56 +02:00
|
|
|
|
|
|
|
|
## Drift (DB)
|
|
|
|
|
|
|
|
|
|
- Schema in `lib/data/db/database.dart`.
|
|
|
|
|
- After any schema change run: `dart run build_runner build --delete-conflicting-outputs`
|
|
|
|
|
- Generated `database.g.dart` is committed — do not hand-edit it.
|
|
|
|
|
|
2026-05-13 09:17:37 +02:00
|
|
|
## enough_mail
|
2026-04-16 07:35:56 +02:00
|
|
|
|
2026-05-13 09:17:37 +02:00
|
|
|
- Standard pub dependency (`enough_mail: ^2.1.7` in `pubspec.yaml`) — not vendored.
|
2026-04-16 07:35:56 +02:00
|
|
|
- IMAP client helpers are in `lib/data/imap/imap_client_factory.dart`.
|
|
|
|
|
|
|
|
|
|
## Running
|
|
|
|
|
|
2026-05-13 09:17:37 +02:00
|
|
|
Flutter build dependencies (libgtk-3-dev, libepoxy-dev, libsecret-1-dev, etc.) are installed via apt
|
|
|
|
|
— see the Flutter Linux docs. The nix dev shell provides only tools: `task`, `fvm`, `stalwart-mail`.
|
2026-04-17 22:20:10 +02:00
|
|
|
|
|
|
|
|
Enter the nix dev shell first: `nix develop`
|
|
|
|
|
|
2026-04-16 07:35:56 +02:00
|
|
|
```bash
|
|
|
|
|
# Code generation (must run after schema changes)
|
2026-04-17 22:20:10 +02:00
|
|
|
task codegen
|
2026-04-16 07:35:56 +02:00
|
|
|
|
|
|
|
|
# Desktop
|
2026-04-17 22:20:10 +02:00
|
|
|
task run
|
2026-04-16 07:35:56 +02:00
|
|
|
|
|
|
|
|
# Tests
|
2026-04-17 22:20:10 +02:00
|
|
|
task test
|
2026-04-16 07:35:56 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Adding a screen
|
|
|
|
|
|
|
|
|
|
1. Create `lib/ui/screens/my_screen.dart`.
|
|
|
|
|
2. Add a `GoRoute` in `lib/ui/router.dart`.
|
2026-05-13 09:17:37 +02:00
|
|
|
3. No separate ViewModel file needed — use `ConsumerWidget` / `ConsumerStatefulWidget` directly with
|
|
|
|
|
Riverpod providers.
|
|
|
|
|
|
|
|
|
|
## Continuous Integration (CI)
|
|
|
|
|
|
|
|
|
|
* **Strategy:** "Thin CI, Heavy Taskfile".
|
|
|
|
|
* **Execution:** CI must only invoke `task` commands (e.g., `nix develop --command task check`).
|
|
|
|
|
All environment setup is handled by Nix (`flake.nix`), and all task orchestration is handled by
|
|
|
|
|
`Taskfile.yml`.
|
2026-05-13 11:00:09 +02:00
|
|
|
* The cli-tool `fgj` is available to query/wait for CI.
|