Skip to content

Commit 61b7ff6

Browse files
committed
internal: Update co-pilot instructions
1 parent c50bfdc commit 61b7ff6

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

.github/copilot-instructions.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,45 @@
1-
- Use [@data-client/rest guide](.github/instructions/rest.instructions.md) for REST API definitions.
2-
- Use [@data-client/react guide](.github/instructions/react.instructions.md) for React.
3-
- Use [@data-client/test guide](.github/instructions/test.instructions.md) when writing tests.
4-
- Use [@data-client/manager guide](.github/instructions/manager.instructions.md) when writing custom Managers for @data-client/react.
5-
- Use markdown files in the [API docs](docs/core/api) directory to validate API usage.
6-
- Use markdown files in the [guides](docs/core/guides) directory to help with more specific use cases.
7-
- use markdown files in the [REST](docs/rest) directory to help building REST APIs.
8-
- If you are not sure about file content or codebase structure pertaining to the user’s request, use your tools to read files and gather the relevant information: do NOT guess or make up an answer.
9-
- Place API definitions and custom managers in the 'resources' directory.
1+
## Reactive Data Client – AI contributor guide
2+
3+
- Use [@data-client/rest guide](instructions/rest.instructions.md) for Resource/Endpoint modeling.
4+
- Use [@data-client/react guide](instructions/react.instructions.md) for React hooks/components and Managers.
5+
- Use [@data-client/test guide](instructions/test.instructions.md) for fixtures and hook testing.
6+
- Use [@data-client/manager guide](instructions/manager.instructions.md) to implement global side-effects.
7+
- Validate API usage with docs in `docs/core/api`, `docs/rest`, and focused guides in `docs/core/guides`.
8+
9+
### Big picture
10+
- Monorepo managed by Yarn workspaces (`packages/*`, examples under `examples/*`, site in `website/`).
11+
- Core architecture:
12+
- `packages/endpoint`: base Endpoint types; `packages/rest`: REST modeling (`resource()`, `RestEndpoint`).
13+
- `packages/core`: framework-agnostic normalized store, actions, Controller, Managers.
14+
- `packages/react`: React bindings (hooks like `useSuspense`, `useLive`, `useQuery`, `DataProvider`).
15+
- `packages/normalizr`: schema/Entity/normalization; used by rest/core/react.
16+
17+
### Developer workflows
18+
- Build all packages: `yarn build` (runs `tsc --build` + each workspace build). Clean with `yarn build:clean`.
19+
- Tests: `yarn test` (Jest projects: ReactDOM, Node, ReactNative). Coverage: `yarn test:coverage`.
20+
- Node-only tests name with `.node.test.ts[x]`; RN tests with `.native.test.ts[x]` (see `jest.config.js`).
21+
- Lint/format: `yarn lint` and `yarn format`.
22+
- Website (docs) local dev: run the workspace task “website: start”.
23+
24+
### Conventions and patterns
25+
- Define REST resources using `resource()` and Entities with default field values; prefer normalized schemas.
26+
- Examples: `examples/nextjs/resources/TodoResource.ts`, `examples/github-app/src/resources/Issue.tsx`.
27+
- Place app-level API definitions and custom Managers in `src/resources/` within examples/apps (e.g., `examples/todo-app/src/resources/`).
28+
- Managers communicate via actions and the `Controller`; import `actionTypes` from `@data-client/react` for type checks.
29+
- Programmatic queries use `new schema.Query(...)` with a Resource’s schema; see `README.md` examples.
30+
31+
### Integration details
32+
- Babel (`babel.config.js`) resolves relative `.js` imports to `.ts` in tests; when `COMPILE_TARGET=native`, it prefers `.native.*` files.
33+
- Jest maps `@data-client/*` imports to local `packages/*/src` during tests (`moduleNameMapper`).
34+
- TypeScript 5.9 project references are used; ambient `.d.ts` files are copied during build (`build:copy:ambient`).
35+
36+
### Where to look first
37+
- High-level usage: root `README.md` and `packages/*/README.md` (react, rest, core) show canonical patterns.
38+
- REST patterns: `docs/rest/*`; Core/Controller/Managers: `docs/core/api/*`.
39+
- Example apps: `examples/todo-app`, `examples/github-app`, `examples/nextjs` demonstrate resources, hooks, mutations, and Managers.
40+
41+
### Testing patterns
42+
- Prefer `renderDataHook()` from `@data-client/test` with `initialFixtures`/`resolverFixtures` for hook tests.
43+
- Use `nock` for low-level HTTP tests of endpoints. Keep tests under `packages/*/src/**/__tests__`.
44+
45+
If anything here is unclear or missing (e.g., adding a new package, expanding CI/build), point it out and I’ll refine these instructions.

0 commit comments

Comments
 (0)