|
1 | 1 | # Contributing to Schrute |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to Schrute! |
| 3 | +Thank you for contributing. |
4 | 4 |
|
5 | | -## Getting Started |
| 5 | +## Prerequisites |
6 | 6 |
|
7 | | -### Prerequisites |
8 | | - |
9 | | -- Node.js >= 22 |
| 7 | +- Node.js 22 or newer |
10 | 8 | - Git |
| 9 | +- Playwright Chromium: `npx playwright install chromium` |
11 | 10 |
|
12 | | -### Setup |
| 11 | +## Setup |
13 | 12 |
|
14 | 13 | ```bash |
15 | 14 | git clone https://github.com/sheeki03/schrute.git |
16 | 15 | cd schrute |
17 | 16 | npm install |
18 | | -npx playwright install chromium |
19 | 17 | npm run build |
20 | 18 | ``` |
21 | 19 |
|
22 | | -### Verify Setup |
| 20 | +## Verify Your Environment |
23 | 21 |
|
24 | 22 | ```bash |
25 | | -npx vitest run # All tests should pass |
26 | | -npx tsc --noEmit # No type errors |
27 | | -node dist/index.js doctor # Health check |
| 23 | +npm run lint |
| 24 | +npx vitest run |
| 25 | +node bin/schrute.cjs doctor |
28 | 26 | ``` |
29 | 27 |
|
30 | | -## Development Workflow |
| 28 | +## Development Expectations |
31 | 29 |
|
32 | | -1. Create a feature branch from `main` |
33 | | -2. Make your changes |
34 | | -3. Run tests: `npx vitest run` |
35 | | -4. Run type check: `npx tsc --noEmit` |
36 | | -5. Submit a pull request |
| 30 | +- Keep changes focused. Prefer one feature or one fix per pull request. |
| 31 | +- Add or update tests for behavioral changes. |
| 32 | +- Update user-facing docs when behavior, flags, commands, or APIs change. |
| 33 | +- Route execution, browser, and skill behavior through the engine and existing repositories instead of adding side paths. |
| 34 | +- Keep error handling fail-closed. If an operation is unsafe or ambiguous, deny it and log the reason. |
37 | 35 |
|
38 | | -## Code Style |
| 36 | +## Repo Hygiene |
39 | 37 |
|
40 | | -- TypeScript strict mode |
41 | | -- Fail-closed security: when in doubt, deny |
42 | | -- Bare `catch` blocks must log the error (no silent swallowing) |
43 | | -- Use `getLogger()` from `src/core/logger.ts` for logging |
| 38 | +- Do not commit local assistant/editor instruction files such as `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `COPILOT.md`, `.cursorrules`, or `.clinerules`. |
| 39 | +- Do not commit personal experiment artifacts or generated local assets unless they are intentionally part of the product. |
| 40 | +- Do not add package-manager lockfiles unless the project explicitly adopts one. |
44 | 41 |
|
45 | | -## Testing |
| 42 | +## Testing Notes |
46 | 43 |
|
47 | | -- Framework: vitest |
48 | | -- Config objects in tests must include `daemon: { port: 19420, autoStart: false }` |
49 | | -- Use the `makeTestConfig()` helper from `tests/helpers.ts` |
50 | | -- Browser tests mock Playwright via `vi.mock('playwright')` |
51 | | -- All tests must be deterministic (no timing-dependent assertions) |
| 44 | +- Tests use Vitest. |
| 45 | +- Prefer `makeTestConfig()` from `tests/helpers.ts` when a full config object is needed. |
| 46 | +- Browser-facing tests should mock Playwright unless the test is explicitly integration or E2E. |
| 47 | +- Keep tests deterministic. Avoid timing-sensitive assertions where possible. |
52 | 48 |
|
53 | | -### Running Tests |
| 49 | +## Useful Commands |
54 | 50 |
|
55 | 51 | ```bash |
56 | | -npx vitest run # All tests |
57 | | -npx vitest run tests/unit/config.test.ts # Specific test |
58 | | -npx vitest --watch # Watch mode |
59 | | -npx vitest run --coverage # With coverage |
| 52 | +npm run build |
| 53 | +npm run lint |
| 54 | +npx vitest run |
| 55 | +npx vitest run tests/unit/engine.test.ts |
| 56 | +npx vitest --watch |
60 | 57 | ``` |
61 | 58 |
|
62 | | -## Architecture Notes |
63 | | - |
64 | | -- **Engine boundary**: All browser/skill operations go through Engine. Never bypass. |
65 | | -- **Policy boundary**: 9 security gates on every execution. Never skip gates. |
66 | | -- **Daemon boundary**: CLI connects to daemon via UDS. No direct engine access from CLI. |
67 | | -- **Storage boundary**: All data access through repositories. Never raw SQL. |
| 59 | +## Pull Requests |
68 | 60 |
|
69 | | -## Pull Request Process |
| 61 | +Before opening a pull request: |
70 | 62 |
|
71 | | -1. Ensure all tests pass |
72 | | -2. Update documentation if needed |
73 | | -3. Add tests for new functionality |
74 | | -4. Keep PRs focused — one feature or fix per PR |
75 | | -5. Write descriptive commit messages |
| 63 | +1. Run the relevant tests and type checks. |
| 64 | +2. Update documentation if the change affects how Schrute is used or operated. |
| 65 | +3. Review the diff for accidental local files or generated artifacts. |
| 66 | +4. Write a clear pull request description explaining the behavior change and validation performed. |
76 | 67 |
|
77 | | -## Security |
| 68 | +## Security Issues |
78 | 69 |
|
79 | | -If you discover a security vulnerability, please see [SECURITY.md](SECURITY.md) for responsible disclosure instructions. Do NOT open a public issue for security vulnerabilities. |
| 70 | +If you discover a security vulnerability, follow [SECURITY.md](SECURITY.md). Do not open a public issue for undisclosed security bugs. |
80 | 71 |
|
81 | 72 | ## License |
82 | 73 |
|
|
0 commit comments