Skip to content

Restructure Codra into npm workspaces and extract the review engine into @codra/core - #87

Merged
devarshishimpi merged 6 commits into
mainfrom
refactor/restructure-codra-workspace-packages
Aug 13, 2026
Merged

Restructure Codra into npm workspaces and extract the review engine into @codra/core#87
devarshishimpi merged 6 commits into
mainfrom
refactor/restructure-codra-workspace-packages

Conversation

@devarshishimpi

Copy link
Copy Markdown
Owner

Description

Converts the repo into an npm workspace monorepo. Moves shared contracts and the review engine out of src/ into real packages (packages/schema, packages/core), with the worker wired to them via ports and adapters.

What changed

1. Workspace structure

  • Root package.json adds workspaces: ["packages/*", "apps/*"] and fan-out scripts.
  • tsconfig.base.json shared by all packages.
  • apps/worker holds the Cloudflare Worker entrypoint.
  • CONTRIBUTING.md documents the new layout.

2. @codra/schema

  • src/shared/* moved to packages/schema (types, zod contracts, only depends on zod).
  • All @shared/schema imports updated to @codra/schema.

3. @codra/core

  • Review engine moved to packages/core (pipeline, parsing, diffing, rules, prompts, etc).
  • Platform coupling replaced with ports (@codra/core/ports); src/server/adapters/ implements them.
  • packages/core/test/in-memory.ts lets the package's test suite run with no database, the acceptance bar for the extraction.
  • picomatch moved from root deps to @codra/core.

Guardrails

  • scripts/check-core-boundary.mjs (npm run check:boundaries) asserts @codra/core
    purity as a check rather than a convention: no hono/postgres/wrangler/Octokit in the
    manifest, no banned import specifiers, and no banned identifiers (AppBindings,
    KVNamespace, GitHubService, ModelService, …). The identifier half exists because a
    import type { AppBindings } leaves no runtime trace and would silently reintroduce the
    coupling this extraction removes.
  • ESLint gains import-x/no-restricted-paths rules covering the new package boundaries.

Part of #66
Closes #67 #68 #69

Type of change

  • Documentation update
  • Chore (refactoring, dependency updates, etc.)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests

Checklist:

  • I have starred Codra on GitHub
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have signed the CLA

Comment thread packages/core/src/claim-checks.ts Fixed
Comment thread packages/core/src/claim-checks.ts Dismissed
Comment thread packages/core/src/model-output/json.ts Fixed
Comment thread packages/core/src/model-output/json.ts Fixed
Comment thread packages/core/src/model-output/json.ts Dismissed
@devarshishimpi
devarshishimpi marked this pull request as ready for review August 13, 2026 01:12
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

codra-app-personal[bot]

This comment was marked as resolved.

codra-app-personal[bot]

This comment was marked as resolved.

@devarshishimpi
devarshishimpi merged commit 4da9f80 into main Aug 13, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set up npm workspaces and the packages/apps layout

2 participants