You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,29 @@ Before we can merge your pull request, you must sign our Contributor License Agr
12
12
13
13
---
14
14
15
+
## 📦 Repository Layout
16
+
17
+
Codra is migrating to an npm workspace monorepo. The repository is structured into `apps/` (deployable entrypoints) and `packages/` (reusable modules):
├── core/ # Review engine (pure ports, depends on schema)
23
+
├── db/ # Postgres interactions and migrations (depends on schema, core)
24
+
├── models/ # LLM provider integrations (depends on schema, core)
25
+
├── provider-github/ # GitHub API adapter (depends on schema, core)
26
+
├── api/ # Hono router and API routes (depends on schema, core, db, models, provider-github)
27
+
└── ui/ # React design system and primitives (depends on schema)
28
+
29
+
apps/
30
+
├── worker/ # Cloudflare Worker entrypoint (wires bindings to api ports)
31
+
└── dashboard/ # React SPA frontend (depends on ui, schema)
32
+
```
33
+
34
+
**Note:** We are incrementally migrating code from the legacy `src/` directory into this workspace structure. New logic should be placed in the appropriate `packages/` or `apps/` directory when possible.
35
+
36
+
---
37
+
15
38
## 🛠️ Local Development Setup
16
39
17
40
Codra is a monorepo-style project built with **Hono** (Worker), **React** (Vite), and **Cloudflare Workers**.
// The zone block at the bottom of this file cannot express this direction: its `files` is
77
+
// packages/** + apps/**, so a violation living in src/client is never linted by it.
78
+
'import-x/no-restricted-paths': ['error',{
79
+
zones: [
80
+
{
81
+
target: 'src/client/**/*',
82
+
from: ['packages/core/**/*','src/server/**/*'],
83
+
message: 'The review engine and the Worker tree are server-only. Importing either pulls zod/jsonrepair/picomatch into the browser bundle -- exactly what the `vite build` CI step exists to catch. (@codra/schema/review-limits is the sanctioned client-side import.)'
{group: ['**/core/github/http','**/core/github/app-auth','**/core/github/types','**/core/github/diff-fetch','**/core/github/review-post','**/core/github/labels','@server/core/github/http','@server/core/github/app-auth','@server/core/github/types','@server/core/github/diff-fetch','@server/core/github/review-post','@server/core/github/labels'],message: 'Import from @server/core/github, not a sibling. One spec vi.mocks that specifier. (core/github/oauth is deliberately NOT listed: it is the dashboard OAuth flow, not part of the GitHubClient barrel, and routes/auth.ts imports it directly.)'},
99
111
// Covers every sibling in the family, including the three the barrel re-exports publicly
100
112
// (budget, diff-cache, request) which were previously unprotected.
101
-
{group: ['**/core/review/*','@server/core/review/*'],message: 'Import from @server/core/review, not a sibling. One spec vi.mocks that specifier and workflows/review.ts imports only runReviewJob from it.'},
102
-
{group: ['**/core/model-output/*','@server/core/model-output/*'],message: 'Import from @server/core/model-output, not a sibling.'},
103
-
{group: ['**/core/diff/position','@server/core/diff/position'],message: 'Import from @server/core/diff, not a sibling.'},
104
-
{group: ['**/shared/schema-claims','**/shared/schema-repo-config','**/shared/schema-enums','@shared/schema-claims','@shared/schema-repo-config','@shared/schema-enums'],message: 'Import from @shared/schema, not a sibling. (@shared/review-limits is exempt: the client imports it directly to keep zod out of the browser bundle.)'},
113
+
{group: ['**/core/review/*','@server/core/review/*','@codra/core/review/*'],message: 'Import from @server/core/review, not a sibling. One spec vi.mocks that specifier and workflows/review.ts imports only runReviewJob from it.'},
114
+
{group: ['**/core/model-output/*','@server/core/model-output/*','@codra/core/model-output/*'],message: 'Import from @codra/core/model-output, not a sibling. (The package exports map already refuses to resolve these; the lint rule gives the error at edit time.)'},
115
+
{group: ['**/core/diff/position','@server/core/diff/position','@codra/core/diff/position'],message: 'Import from @codra/core/diff, not a sibling.'},
116
+
{group: ['**/schema-claims','**/schema-repo-config','**/schema-enums','@codra/schema/schema-claims','@codra/schema/schema-repo-config','@codra/schema/schema-enums'],message: 'Import from @codra/schema, not a sibling. (@codra/schema/review-limits is exempt: the client imports it directly to keep zod out of the browser bundle.)'},
0 commit comments