|
| 1 | +# Source runtime instructions |
| 2 | + |
| 3 | +This file applies to `src/` and inherits the repository-wide rules in `/AGENTS.md`. |
| 4 | + |
| 5 | +## Runtime and module rules |
| 6 | + |
| 7 | +- `src/` is Bun-native TypeScript in strict mode and uses ES modules only. |
| 8 | +- Do not assume a separate server compilation step. |
| 9 | +- Prefer Bun and Web-platform APIs. Introduce a Node-only runtime dependency only when the task explicitly requires compatibility code and the owning module already has that role. |
| 10 | +- Preserve existing public exports and configuration compatibility unless the task explicitly changes them. |
| 11 | +- Read the applicable documents in `structure/` before changing shared routing, adapters, transports, sidecars, authentication, configuration, or server architecture. |
| 12 | + |
| 13 | +## Implementation rules |
| 14 | + |
| 15 | +- Follow the existing subsystem boundaries and naming patterns. |
| 16 | +- Do not combine unrelated responsibilities to avoid creating another large shared module. |
| 17 | +- Handle asynchronous failures at request, transport, and sidecar boundaries. Optional integrations must degrade through the existing failure representation rather than crash the request path. |
| 18 | +- Provider catalog metadata belongs in the canonical provider registry and derivation flow. Do not duplicate provider facts across independent pickers or seeds. |
| 19 | +- Adapter changes must preserve the internal event contract, streaming behavior, tool calls, cancellation, error mapping, and image handling relevant to that adapter. |
| 20 | +- Authentication, OAuth, token, credential, management API, and CORS changes are security-boundary changes. |
| 21 | + |
| 22 | +## Tests and validation |
| 23 | + |
| 24 | +- Place focused regression coverage near the existing tests for the affected subsystem. |
| 25 | +- For focused behavior, run the relevant `bun test tests/<name>.test.ts` and `bun run typecheck`. |
| 26 | +- For shared routing, adapters, config, OAuth, or server behavior, also run `bun run test`. |
| 27 | +- For logging, requests, credentials, account data, or fixtures, also run `bun run privacy:scan`. |
| 28 | +- Update `docs-site/` when the change affects user-visible behavior or configuration. |
0 commit comments