diff --git a/AGENTS.md b/AGENTS.md index c8259b17..e015c4d6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,7 +22,28 @@ Key rules from the specs: every user-visible action is a command and every state | `third_party/` | Vendored, locally patched third-party packages (`specs/01-architecture.md` §2.3) | | `tool/` | Repository scripts (dependency-rule check, web build + bundle sizes, generated-code check, goldens, pseudo-locale) | -Current state: the M0 restructure is done. **Wonky Write is complete for its first iteration** (sign-in, drive, sharing, real-time editor, comments, suggestions, history, themes and theme editor, import/export, offline cache, spellcheck, MCP, AI assistant). **Wonky Sheets is complete for its first iteration** (offline-first sync over RevLog, grid and editing, formulas, formatting and conditional formatting, data tools, validation and protection, pivots, charts, import/export/print, collaboration and history, MCP, AI assistant, scripting with its editor, macros and triggers). Deferred work is in `TODO.md`; the Sheets status per area is in `specs/wonky_sheets/STATUS.md`. **v2 (Drive, Slides, suite changes) is built**: the plans are `specs/wonky_drive/05-implementation-plan.md` and `specs/wonky_slides/12-implementation-plan.md`, the status `specs/wonky_drive/STATUS.md` and `specs/wonky_slides/STATUS.md` (M8 — Drive and the suite changes — is integrated and checked, D-18; the M8–M11 exit checklists are in `specs/14-roadmap.md` §2.1). **Wonky Slides is complete for its first iteration** (M9 SL-23, M10 SL-36, M11 SL-45): home and 10 templates, offline-first decks (RevLog sync), canvas with text, shapes, lines/connectors with route handles, icons, images with live adjustments, tables, element and slide groups, grid and outline views, speaker notes, themes, layouts, masters and the theme editor, clipboard within/across decks and apps, find & replace, builds and transitions incl. 3D and Magic Move, code blocks with highlight steps and type-in, linked Sheets charts incl. 3D, presenting with presenter view and audience/follower on another device, PDF (builds as pages) and PNG export, Layers, accessibility checker, presence, soft locks, live pointers and follow, comments on slides and elements, version history with diffs and restore, overwritten-text review, MCP `slides.*` and `ui.slides.*`, the assistant and AI commands, spelling, special characters and emoji. On hold (user decision): the phone remote, rehearse timings and the same-browser fast path (SL-41). Hidden by `SlidesFeatures` until built: native charts and *Import slides…* (P1), *Make a code walkthrough…*, editor preferences, notification settings, outline Markdown export and snap to grid (P2); the remaining work is in `TODO.md` ("Wonky Slides — later"). **Bugs & improvements (M12, `specs/16-bugs-and-improvements.md`) is built**: the public in-app board replacing *Report a bug* (report dialog with annotated screenshots, votes, Markdown comments, Jev/Gemini vetting on internal keys, admins by email domain, tasks with claims, the `board` MCP scope, `/improvements` routes), including the GitHub App integration (PR gate, AI review, merged/shipped lifecycle), which is enabled by config (`board.github.enabled`, default off); its open items are in spec 16 §17. `serverpod: flutter_apps:` declares `drive` (web-port 8100), `write` (8101), `sheets` (8102) and `slides` (8104), all with `auto_launch: false`: the Serverpod runner starts only the server, and an app is started on demand (the user from the `serverpod start` UI, agents with the `spawn_flutter_app` MCP tool). The debug web apps load slowly (thousands of DDC modules); for browser checks build a release with `flutter build web --wasm --base-href /write/ --output ../wonky_server/web/write` in `wonky_write` and open http://localhost:8082/write/ (Sheets: `--base-href /sheets/ --output ../wonky_server/web/sheets` in `wonky_sheets`, http://localhost:8082/sheets/; Drive: `--base-href /drive/ --output ../wonky_server/web/drive` in `wonky_drive`, http://localhost:8082/drive/; Slides: `--base-href /slides/ --output ../wonky_server/web/slides` in `wonky_slides`, http://localhost:8082/slides/). `serverpod run flutter_build` (in `wonky_server`) builds every existing app one after another with `tool/build_web.dart` (it fails when any build fails and prints the bundle sizes; `dart run tool/build_web.dart write` builds one app). Browser checks of the release builds: the dev server injects a live-reload script that reloads the page when `/__dev/version` changes (every server reload, also from other agents' edits — for a long walkthrough, make `fetch('/__dev/version')` reject in the page's console after each load); the agent's Browser pane only paints while it is displayed (hidden: frames lag and animations can't be judged), has no PDF viewer and can't emulate `prefers-reduced-motion`; enabling Flutter semantics (click `flt-semantics-placeholder`) makes `find`/`read_page` usable. +Current state: the M0 restructure is done. **Wonky Write is complete for its first iteration** (sign-in, drive, sharing, real-time editor, comments, suggestions, history, themes and theme editor, import/export, offline cache, spellcheck, MCP, AI assistant). **Wonky Sheets is complete for its first iteration** (offline-first sync over RevLog, grid and editing, formulas, formatting and conditional formatting, data tools, validation and protection, pivots, charts, import/export/print, collaboration and history, MCP, AI assistant, scripting with its editor, macros and triggers). Deferred work is in `TODO.md`; the Sheets status per area is in `specs/wonky_sheets/STATUS.md`. **v2 (Drive, Slides, suite changes) is built**: the plans are `specs/wonky_drive/05-implementation-plan.md` and `specs/wonky_slides/12-implementation-plan.md`, the status `specs/wonky_drive/STATUS.md` and `specs/wonky_slides/STATUS.md` (M8 — Drive and the suite changes — is integrated and checked, D-18; the M8–M11 exit checklists are in `specs/14-roadmap.md` §2.1). **Wonky Slides is complete for its first iteration** (M9 SL-23, M10 SL-36, M11 SL-45): home and 10 templates, offline-first decks (RevLog sync), canvas with text, shapes, lines/connectors with route handles, icons, images with live adjustments, tables, element and slide groups, grid and outline views, speaker notes, themes, layouts, masters and the theme editor, clipboard within/across decks and apps, find & replace, builds and transitions incl. 3D and Magic Move, code blocks with highlight steps and type-in, linked Sheets charts incl. 3D, presenting with presenter view and audience/follower on another device, PDF (builds as pages) and PNG export, Layers, accessibility checker, presence, soft locks, live pointers and follow, comments on slides and elements, version history with diffs and restore, overwritten-text review, MCP `slides.*` and `ui.slides.*`, the assistant and AI commands, spelling, special characters and emoji. On hold (user decision): the phone remote, rehearse timings and the same-browser fast path (SL-41). Hidden by `SlidesFeatures` until built: native charts and *Import slides…* (P1), *Make a code walkthrough…*, editor preferences, notification settings, outline Markdown export and snap to grid (P2); the remaining work is in `TODO.md` ("Wonky Slides — later"). **Bugs & improvements (M12, `specs/16-bugs-and-improvements.md`) is built**: the public in-app board replacing *Report a bug* (report dialog with annotated screenshots, votes, Markdown comments, Jev/Gemini vetting on internal keys, admins by email domain, tasks with claims, the `board` MCP scope, `/improvements` routes), including the GitHub App integration (PR gate, AI review, merged/shipped lifecycle), which is enabled by config (`board.github.enabled`, default off); its open items are in spec 16 §17. + +## Running locally + +The default way to run and try the apps is the Serverpod runner plus debug apps started through the `serverpod` MCP: no release build, and edits hot reload. + +1. **One-time setup.** Run `flutter pub get` in the repository root (one pub workspace for every package). In `wonky_server`, run `cp config/passwords.example.yaml config/passwords.yaml` (development defaults, git-ignored). You don't need Docker: `config/development.yaml` sets `database.dataPath`, so the runner starts an embedded PostgreSQL. +2. **Start the server** with `serverpod runner start` in `wonky_server` (see *Serverpod workflow*). When another Serverpod runner on the machine (another project) holds 8080–8082, this one binds ephemeral ports instead. That is fine: `serverpod runner status` prints the addresses. +3. **Start an app** with the MCP tool `spawn_flutter_app` and `appId` `drive`, `write`, `sheets` or `slides` (a user can start one from the `serverpod start` UI). `serverpod: flutter_apps:` declares all four with `auto_launch: false`, so the runner starts only the server. The app runs in debug mode from `lib/driver.dart` on the `web-server` device, at its fixed port and the root path: Drive http://localhost:8100/, Write http://localhost:8101/, Sheets http://localhost:8102/, Slides http://localhost:8104/. The runner passes `--dart-define=SERVER_URL=`, which overrides `apiUrl` in the app's `assets/config.json` (`AppUrls.load`), so the app reaches the server whatever port it got. Follow the compile with `tail_flutter_logs` until it prints `lib/driver.dart is being served at`. +4. **Open the app's URL** in a browser (the Browser pane or the user's). The debug app finishes starting only once a page connects: until then `get_flutter_app_dtd` maps it to `null`. The first load is slow (thousands of DDC modules). Edits hot reload automatically; call `hot_restart` for changes that hot reload can't apply. +5. **Sign up** with any email. The verification code is in the server log (`tail_server_logs`: `Registration code for : `). + +**Links between apps are expected to break when running locally; this is not a bug to fix.** Each debug app runs on its own origin, so: +- A link into another app (for example, opening a spreadsheet from Drive) goes to that app's dev port. That port only answers if that app has also been started with `spawn_flutter_app`. +- The session is stored per origin, so each app needs its own sign-in. +- Links to pages on the web server (`webUrl` in `config.json`, such as the legal pages) point at port 8082. When the runner bound ephemeral ports, that port belongs to another project's server or nothing at all. Only the API address follows the runner. + +Check a feature inside one app. When a check really crosses apps, start the other app too and sign in there, or use the release builds below. Don't change `config.json`, `AppUrls` or the link code to make local cross-app links work. + +Release builds are only for checking the production bundle (bundle sizes, Wasm-only behaviour, performance measurements). `serverpod run flutter_build` (in `wonky_server`) builds every app with `tool/build_web.dart`: it fails when any build fails and prints the bundle sizes; `dart run tool/build_web.dart write` builds one app. The server's web server then serves them at `/drive/`, `/write/`, `/sheets/` and `/slides/` (`/` redirects to `/drive/`). In development it injects a live-reload script into those pages, which reloads them whenever `/__dev/version` changes (every server reload, also from other agents' edits). For a long walkthrough, make `fetch('/__dev/version')` reject in the page's console after each load. + +Browser checks: the agent's Browser pane only paints while it is displayed (when hidden, frames lag and animations can't be judged). It has no PDF viewer and can't emulate `prefers-reduced-motion`. Enabling Flutter semantics (click `flt-semantics-placeholder`) makes `find`/`read_page` usable. ## Serverpod workflow diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03ea41f8..ed317ddc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,9 +85,12 @@ You don't need to start the server yourself: the agent starts it, together with database, through the `serverpod` MCP server, and starts the apps the same way. The repository configures it, together with the `dart` MCP server and the Flutter and Serverpod skills, for Claude Code (`.mcp.json`, `.claude/`), Codex (`.codex/`, `.agents/`), Cursor (`.cursor/`) and -Antigravity (`.agents/`). To watch it or start an app by hand, run `serverpod start` in -`wonky_server`; it attaches to the running server. Sign up with any email: in development the -verification code is printed in the server log. +Antigravity (`.agents/`). The apps run in debug mode and hot reload as the agent edits: open +Drive at http://localhost:8100/, Write at http://localhost:8101/, Sheets at +http://localhost:8102/ or Slides at http://localhost:8104/ once the agent has started it. To +watch the server or start an app by hand, run `serverpod start` in `wonky_server`; it attaches to +the running server. Sign up with any email: in development the verification code is printed in +the server log. You can **release** a claim at any time if you can't finish. Two active claims per person at a time. diff --git a/specs/01-architecture.md b/specs/01-architecture.md index e83ed98e..fdfdfa83 100644 --- a/specs/01-architecture.md +++ b/specs/01-architecture.md @@ -520,7 +520,11 @@ development) from one origin; there is no separate host app. In development each app runs from `flutter run` on its own port at the root path; the bundled `assets/config.json` lists those dev URLs (all four), and `allowedOrigins` in - `config/development.yaml` lists all four origins. Production builds always come from the + `config/development.yaml` lists all four origins. The runner passes + `--dart-define=SERVER_URL=`, which overrides `apiUrl` from `config.json` + (`AppUrls.load`): when another Serverpod runner holds 8080–8082 and this one binds ephemeral + ports, the apps still reach the API (only `webUrl` keeps port 8082). These debug apps are the + default way to run the suite locally (`AGENTS.md`, *Running locally*). Production builds always come from the server's `web/` folders. - **Routing**: `go_router` paths are relative to the base href (`/d/:uuid` is `/write/d/:uuid` in production). Cross-app navigation (open a spreadsheet from Write, the diff --git a/wonky_drive/README.md b/wonky_drive/README.md index 3ae0dcbe..1331d7a6 100644 --- a/wonky_drive/README.md +++ b/wonky_drive/README.md @@ -7,7 +7,9 @@ A13). - Specs: `specs/wonky_drive/` (start with `01-overview.md`; build plan `05-implementation-plan.md`, status `STATUS.md`). -- Served at `/drive/` by `wonky_server`; in development `serverpod start` - launches it from `lib/driver.dart` on port 8100 (`flutter_apps: drive`). +- Served at `/drive/` by `wonky_server`. In development, start it on demand + from the `serverpod start` UI or the `spawn_flutter_app` MCP tool: it runs + in debug mode from `lib/driver.dart` at http://localhost:8100/ + (`flutter_apps: drive`; `AGENTS.md`, *Running locally*). - Release build for the server: `flutter build web --wasm --base-href /drive/ --output ../wonky_server/web/drive`. diff --git a/wonky_server/README.md b/wonky_server/README.md index 66351498..4f30e5b7 100644 --- a/wonky_server/README.md +++ b/wonky_server/README.md @@ -1,10 +1,16 @@ # wonky_server -This is the starting point for your Serverpod server. +The Serverpod server of Wonky Work. It also serves the release web builds of +the apps at `/drive/`, `/write/`, `/sheets/` and `/slides/`. -Start your server by running: +To run it locally (details in `AGENTS.md`, *Running locally*): - cd wonky + flutter pub get # in the repository root, once + cd wonky_server + cp config/passwords.example.yaml config/passwords.yaml # once serverpod start -Press `Q` to stop the server and quit. +The development database is an embedded PostgreSQL, so Docker is not needed. +Start an app from the `serverpod start` UI (or the `spawn_flutter_app` MCP +tool). It runs in debug mode with hot reload: Drive on http://localhost:8100/, +Write on 8101, Sheets on 8102, Slides on 8104. Press `Q` to quit. diff --git a/wonky_slides/README.md b/wonky_slides/README.md index 0c2ce9ef..9a0ba3b3 100644 --- a/wonky_slides/README.md +++ b/wonky_slides/README.md @@ -7,10 +7,10 @@ A13). - Specs: `specs/wonky_slides/` (start with `01-overview.md`; build plan `12-implementation-plan.md`, status `STATUS.md`). -- Served at `/slides/` by `wonky_server`; in development `serverpod start` - can launch it from `lib/driver.dart` on port 8104 (`flutter_apps: slides`, - `auto_launch: false` while it is being built — start it with the - `spawn_flutter_app` MCP tool). +- Served at `/slides/` by `wonky_server`. In development, start it on demand + from the `serverpod start` UI or the `spawn_flutter_app` MCP tool: it runs + in debug mode from `lib/driver.dart` at http://localhost:8104/ + (`flutter_apps: slides`; `AGENTS.md`, *Running locally*). - Release build for the server: `flutter build web --wasm --base-href /slides/ --output ../wonky_server/web/slides`. - State (SL-1): the app skeleton — the Slides home (presentations only) and a