Skip to content

Commit 923ab54

Browse files
authored
Merge branch 'main' into merge/common-v8-04-02-2026
Signed-off-by: Miccy <support@miccy.dev>
2 parents d952c70 + e9f7a58 commit 923ab54

File tree

1 file changed

+136
-2
lines changed

1 file changed

+136
-2
lines changed

.github/copilot-instructions.md

Lines changed: 136 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,72 @@
22
applyTo: "**/*.{ts,tsx}"
33
---
44

5-
# Evolu project guidelines
5+
# Evolu Plan B - Copilot Instructions
6+
7+
## Project Overview
8+
9+
Evolu Plan B is a TypeScript-based local-first platform forked from [evoluhq/evolu](https://github.com/evoluhq/evolu). This monorepo uses **Bun** as the package manager and runtime, and **Biome** for linting and formatting.
10+
11+
**Key characteristics:**
12+
- Local-first architecture with CRDT-based synchronization
13+
- TypeScript strict mode throughout
14+
- Functional programming patterns with explicit dependency injection
15+
- Multi-platform support (Web, React Native, Node.js, Svelte, Vue)
16+
17+
**Tech Stack:**
18+
- Package Manager: Bun 1.3.8
19+
- Linter/Formatter: Biome 2.3.13
20+
- Test Framework: Vitest
21+
- Build System: Turbo (monorepo)
22+
- Target: Node.js >=24.0.0
23+
24+
**Directory Structure:**
25+
```
26+
packages/
27+
├── common/ # Core logic, CRDTs, sync engine
28+
├── web/ # Browser adapter (wa-sqlite)
29+
├── react/ # React bindings
30+
├── react-native/ # React Native adapter
31+
├── nodejs/ # Node.js adapter
32+
├── svelte/ # Svelte bindings
33+
└── vue/ # Vue bindings
34+
apps/
35+
├── relay/ # Sync relay server
36+
└── web/ # Documentation site (deprecated)
37+
```
38+
39+
## Repository-Specific Guidelines
40+
41+
### Package Management
42+
- **MUST** use Bun commands: `bun install`, `bun run`, etc.
43+
- **MUST NOT** use npm, pnpm, or yarn
44+
- **MUST** run `bun run verify` before submitting changes (includes format, build, test, lint)
45+
46+
### Linting and Formatting
47+
- **MUST** use Biome for all linting and formatting
48+
- **MUST NOT** add ESLint or Prettier configurations
49+
- **MUST** follow the rules defined in `biome.json`
50+
- Use `bun run lint` to check, `bun run format` to auto-fix
51+
52+
### Testing
53+
- **MUST** write tests using Vitest
54+
- **MUST** create isolated test dependencies using `testCreateDeps()` from `@evolu/common`
55+
- **SHOULD** run targeted tests during development: `bun run test:watch`
56+
57+
### Security Requirements
58+
- **MUST NOT** commit secrets, tokens, or credentials
59+
- **MUST** validate all external inputs using the Evolu Type system
60+
- **MUST** handle errors explicitly with `Result<T, E>` pattern
61+
- **MUST** use `trySync`/`tryAsync` for unsafe operations
62+
- **SHOULD** use CodeQL scanning for vulnerability detection
63+
- **MUST** document security implications in code reviews
64+
65+
### Upstream Sync
66+
- This is a fork; upstream commits are cherry-picked
67+
- **MUST** reference upstream issues as `upstream#XXX`
68+
- **SHOULD** maintain compatibility with upstream API surface
69+
70+
## Evolu Project Guidelines
671

772
Follow these specific conventions and patterns:
873

@@ -533,9 +598,22 @@ export const testCreateTime = (options?: {
533598
}): TestTime => { ... };
534599
```
535600

601+
### Vitest filtering (https://vitest.dev/guide/filtering)
602+
603+
```bash
604+
# Run all tests in a package
605+
bun run test --filter @evolu/common
606+
607+
# Run a single file
608+
bun run test --filter @evolu/common -- Task
609+
610+
# Run a single test by name (-t flag)
611+
bun run test --filter @evolu/common -- -t "yields and returns ok"
612+
```
613+
536614
## Monorepo TypeScript issues
537615

538-
**ESLint "Unsafe..." errors after changes** - In a monorepo, ESLint may show "Unsafe call", "Unsafe member access", or "Unsafe assignment" errors after modifying packages that other packages depend on. These errors are caused by stale TypeScript type cache. Solution: run "ESLint: Restart ESLint Server" command (Cmd+Shift+P)
616+
**TypeScript "Unsafe..." errors after changes** - In a monorepo, you may see "Unsafe call", "Unsafe member access", or "Unsafe assignment" errors after modifying packages that other packages depend on. These are TypeScript language server errors, not Biome linting errors. They should be investigated but may be false positives. Solution: use VS Code's "Developer: Reload Window" command (Cmd+Shift+P) to refresh the TypeScript language server.
539617

540618
## Git commit messages
541619

@@ -557,4 +635,60 @@ Added support for custom error formatters
557635
Add support for custom error formatters
558636
```
559637

638+
## Workflow Commands
639+
640+
### Development
641+
```bash
642+
bun install # Install dependencies
643+
bun run dev # Start dev mode (packages + web + relay)
644+
bun run build # Build all packages
645+
```
646+
647+
### Quality Checks
648+
```bash
649+
bun run lint # Lint with Biome
650+
bun run format # Format with Biome
651+
bun run test # Run tests
652+
bun run test:coverage # Tests with coverage
653+
bun run verify # Full verification (format + build + test + lint)
654+
```
655+
656+
### Release
657+
```bash
658+
bun run changeset # Add changeset for release
659+
bun run version # Bump versions
660+
bun run release # Publish packages
661+
```
662+
663+
## Deprecated Patterns
664+
665+
**DO NOT use these patterns:**
666+
- ❌ Default exports (use named exports only)
667+
- ❌ Namespace imports (`import * as Foo`)
668+
-`function` keyword (except for overloads)
669+
- ❌ Class components in React (use functional components)
670+
-`any` type (use proper typing or `unknown`)
671+
- ❌ Global static instances (use dependency injection)
672+
- ❌ pnpm, npm, or yarn commands (use Bun)
673+
- ❌ ESLint or Prettier (use Biome)
674+
- ❌ Throwing errors directly (use Result pattern)
675+
676+
## Quick Reference
677+
678+
**When adding new code:**
679+
1. Write a failing test first (TDD)
680+
2. Use named exports only
681+
3. Use arrow functions (except overloads)
682+
4. Apply dependency injection pattern
683+
5. Handle errors with Result<T, E>
684+
6. Document with JSDoc (avoid @param/@return)
685+
7. Run `bun run verify` before committing
686+
687+
**When editing existing code:**
688+
1. Maintain existing patterns and style
689+
2. Update tests to match changes
690+
3. Keep changes minimal and focused
691+
4. Preserve immutability (`readonly`, `ReadonlyArray`)
692+
5. Short-circuit on error (`if (!result.ok) return result`)
693+
560694
When suggesting code changes, ensure they follow these patterns and conventions.

0 commit comments

Comments
 (0)