=================================================================== --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -254,4 +254,110 @@ - **Sharing**: Private by default, shareable with org or specific users (same model as other ownable resources) - **Security**: Iframe sandbox + CSP + SSRF protection on the proxy See the `extensions` skill in `.agents/skills/extensions/SKILL.md` for full implementation details. + +## Preserve existing work + +This starter ships as a blank Agent-Native app canvas — that describes its +initial state, not necessarily its current one. Before assuming no UI or +brand exists, check `app/routes/_index.tsx` and `app/global.css`: if they +already contain real content, that content is the current product and its +established brand. Build additively, preserve existing tokens/routes/palette, +and do not re-derive a new visual direction or overwrite shipped UI unless +the user explicitly asks for a redesign. Only treat the canvas as blank when +the files actually show the starter's placeholder content. + +If `DECISIONS.md` exists at the repo root, read it before starting work — it +holds pre-build choices as current requirements. If the user changes one +later in chat, update `DECISIONS.md` to match. + +`README.md` starts as a generic "My App" placeholder. Once the app has real +features, rewrite its title and opening paragraph to name the app and say what +it does, and keep the run instructions accurate when you change scripts or +required env vars. + +**Do not add internationalization or changelog support unless the user +explicitly asks for them.** This starter ships English-only UI copy inline — +no `app/i18n/`, LanguagePicker, `CHANGELOG.md`, or What's New surfaces. If the +user requests i18n or changelogs, load the matching skill and add only what +they asked for. + +## Data & actions (read these first) + +Add persistence or auth **only when data must survive reload or be shared +between users**. A pure UI, copy, or layout change needs no schema, action, or +auth — build it directly and do **not** read the `security` or `storing-data` +skills for UI-only work. Only when you actually add an action, route, or schema +that handles user input or persistence, read `security` and `storing-data` +first. + +### Choose the post-auth landing route from the app + +Before enabling authentication, inspect `app/routes`, the app's navigation, +and any existing `app.homePath` in `server/plugins/config.ts`. Preserve an +existing `homePath` when it still points to a valid route. Otherwise choose +the actual primary authenticated landing page from the product already built, +such as `/`, `/dashboard`, or `/tasks`. Never assume `/home` unless that +route really exists. + +The starter ships `homePath: "/"` only so sign-in lands on the blank canvas. +Once `/` is a public page and the signed-in app lives elsewhere, replace it +with that route. + +Do not choose an auth route, API route, public-only marketing page, wildcard +route, or parameterized route that cannot open without an id. If multiple +authenticated landing routes are equally plausible and the product intent is +unclear, ask the user instead of inventing one. + +Write the selected route to the existing `defineAppConfig` object in +`server/plugins/config.ts` while preserving its `plugins.disabled` settings: + +```ts +export default defineAppConfig({ + app: { homePath: "/dashboard" }, + plugins: { + disabled: ["integrations", "observational-memory", "sentry", "terminal"], + }, +}); +``` + +After enabling or changing auth, verify both signup and login land on an +existing page rather than a 404. + +When adding SQL-backed features, do **not** start with `find` / `cat` over +`node_modules`. Read these two files first: + +1. `drizzle/START_HERE.md` — table map, migrate commands, path map +2. `drizzle/crud-action-example.ts` — copy-paste list/create/update/delete + +Then use `getDb` / `schema` from `server/db.ts`. After a batch of related +schema/action edits: one smoke test, one `pnpm typecheck` (see Verification). + +- Guarded verification: run `pnpm agent-native:doctor`; fix findings before done. + +## Verification + +Run checks **once at the end of a batch of related edits**, not after every +file, action, or small UI tweak. Dev already runs route/action typegen while +`pnpm dev` is up — do not treat that as a reason to also run full typecheck +after each write. + +| Change shape | Verify with | +| ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| UI / copy / layout only | Formatter if the app has one; preview if something looks wrong. Skip full typecheck unless the edit touched types or imports. | +| New/changed actions, schema, server, or shared types | One `pnpm typecheck` (and lint if the app has it) after the batch. | +| New DB-backed CRUD | One smoke path only (e.g. create + list via `pnpm action …` or a single HTTP call). Do **not** CLI-test every action method. | + +Do not re-run typecheck to "confirm" after a clean pass. If typecheck fails on +unrelated pre-existing errors, fix or note them — do not thrash with repeated +full runs and greps. + +## Configuration is code, not env vars + +Configure framework behavior in `agent-native.config.ts` via +`defineAgentNativeConfig({ ... })`. App metadata consumed by `getAppConfig()`, +including `app.homePath`, belongs in the existing `defineAppConfig` object in +`server/plugins/config.ts`. Do **not** reach for `process.env` to drive app +behavior, feature flags, or framework options. Environment variables are only +for deploy-level secrets and host settings (see `secrets`); never add a +`process.env` fallback to configure a feature.