Skip to content

Commit 1eb4286

Browse files
committed
Add copilot instructions for team review
1 parent 8f9315f commit 1eb4286

1 file changed

Lines changed: 127 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Copilot Instructions for jore4-ui
2+
3+
These instructions define how AI coding assistants should work in this repository.
4+
Follow them for all code edits unless the user explicitly asks otherwise.
5+
6+
## 1) Repository context
7+
8+
- Monorepo with Yarn workspaces.
9+
- Main workspaces:
10+
- `ui` (main application)
11+
- `cypress` (e2e tests)
12+
- `codegen` (GraphQL code generation)
13+
- `test-db-manager` (test DB tooling)
14+
- `timetables-data-inserter` (submodule)
15+
- Git submodules:
16+
- `timetables-data-inserter` — test data tooling, used in e2e tests
17+
- `jore4-hasura` — Hasura configuration; in development, jore4-hasura is pulled from the container registry and run as a Docker container. This submodule is present only for e2e tests.
18+
- Prefer workspace-scoped commands (`yarn ws:...`) when possible.
19+
20+
## 2) Default development workflow
21+
22+
- Prefer day-to-day development flow:
23+
- `yarn ws:ui dev`
24+
- Run GraphQL generation manually when needed: `yarn ws:codegen generate`
25+
- Avoid defaulting to `yarn dev` for normal edits because continuous codegen can heavily degrade IDE performance.
26+
- If test-db seed data is changed, rebuild with `yarn ws:db build`.
27+
28+
## 3) Environment and dependencies
29+
30+
- For local backend dependencies, use `./scripts/development.sh` commands (for example `start:deps`, `setup:env`, `setup:test`, `stop`).
31+
- Do not introduce alternative local orchestration scripts if existing script targets are sufficient.
32+
- Assume UI runs on `http://localhost:3300` when using local dev server.
33+
34+
## 4) Quality gates and verification
35+
36+
Before finalizing a non-trivial change, run the smallest relevant checks first, then broaden only as needed:
37+
38+
1. Targeted checks for changed area (tests/lint where applicable)
39+
2. Type checking: `yarn ts:check`
40+
3. Linting: `yarn lint` (or `yarn lint --fix` when safe)
41+
4. Formatting: `yarn prettier:check` (or `yarn prettier` when formatting is required)
42+
43+
Use `yarn qa` for full local validation when appropriate.
44+
Use `yarn qa:fix` for automatic eslint/prettier fixes.
45+
46+
## 5) Testing guidance
47+
48+
- Unit/local tests: `yarn test`
49+
- Integration tests (require Hasura/deps running): `yarn test:integration`
50+
- E2E tests:
51+
- Open mode: `yarn test:e2e:open`
52+
- Headless: `yarn test:e2e`
53+
- Tag filtering example: `yarn test:e2e --env grepTags=@routes`
54+
- For map-related Cypress reliability/speed, optionally set `CYPRESS_DISABLE_MAP_TILES=true`.
55+
- When adding or changing user-interactive UI elements, include stable `data-testid` attributes.
56+
57+
## 6) GraphQL codegen rules
58+
59+
- GraphQL typings are generated from Hasura schema and `gql` definitions.
60+
- Because generation is heavy in this repo, prefer manual generation after finishing query edits:
61+
- `yarn ws:codegen generate`
62+
- Do not set up automatic codegen watch flows unless explicitly requested.
63+
64+
## 7) Code style conventions
65+
66+
### General
67+
68+
- Keep changes minimal and scoped to the task.
69+
- Follow existing TypeScript/React patterns in the touched area.
70+
- Prefer editor/CI-aligned formatting and lint behavior over custom style choices.
71+
72+
### Components
73+
74+
- Avoid inline child components unless necessary; prefer extracted components.
75+
- Keep components composable and loosely coupled.
76+
77+
### Imports
78+
79+
- Prefer namespaced/barrel imports where available instead of fragmented deep imports.
80+
81+
### Test IDs
82+
83+
- Use `data-testid` for important interaction elements.
84+
- Follow naming convention: `ComponentName::camelCaseElementName`.
85+
- Define test IDs via a top-level `const testIds = { ... }` object instead of inline string literals where practical.
86+
87+
### Tailwind class composition
88+
89+
- Use `twJoin` for simple class concatenation and pass-through patterns.
90+
- Use `twMerge` as final composition step when conflicting utility classes are possible.
91+
- Do not rely on raw class order alone for override behavior.
92+
93+
## 8) Workspace dependency management
94+
95+
- Install workspace-specific dependencies into the correct workspace.
96+
- Install shared dependencies in repository root only when truly shared.
97+
- Do not move lint/prettier config out of root without explicit request.
98+
99+
## 9) Git workflow
100+
101+
- The user always makes git commits themselves. Never commit or offer to commit on behalf of the user.
102+
103+
## 10) Operational guardrails for AI edits
104+
105+
- Do not refactor unrelated areas.
106+
- Do not add new frameworks, state libraries, or architectural patterns without request.
107+
- Do not rewrite existing scripts when existing `yarn` and `development.sh` flows solve the task.
108+
- Keep generated-file churn minimal; regenerate only when required by changes.
109+
- When uncertain about behavior that depends on running services (Hasura, Docker stack, db seeds), state assumptions and choose the safest minimal change.
110+
- Avoid writing unnecessary comments. Explain your changes in chat instead of code comments.
111+
- Comments should be added only if they provide value beyond what the code itself can express. If you think a comment is needed, consider whether the code can be refactored to be more self-explanatory instead.
112+
113+
## 11) Helpful commands reference
114+
115+
- Dev UI only: `yarn ws:ui dev`
116+
- Full dev (heavy): `yarn dev`
117+
- GraphQL codegen: `yarn ws:codegen generate`
118+
- Build test DB manager: `yarn ws:db build`
119+
- Type check: `yarn ts:check`
120+
- Lint: `yarn lint`
121+
- Format check: `yarn prettier:check`
122+
- Full QA: `yarn qa`
123+
- Unit tests: `yarn test`
124+
- Integration tests: `yarn test:integration`
125+
- E2E tests: `yarn test:e2e`
126+
- Start dependencies: `./scripts/development.sh start:deps`
127+
- Stop dependencies: `./scripts/development.sh stop`

0 commit comments

Comments
 (0)