feat: extract @codeoid/protocol workspace package (P0) - #101
Conversation
Single source of truth for the client<->daemon wire protocol (message/event
types, PROTOCOL_VERSION, permission SCOPES), shared by the daemon, web UI, and
mobile client — first step of the packages extraction (design doc §4).
- Move src/protocol/{types,scopes,index}.ts -> packages/protocol/src/ and add
the @codeoid/protocol package (source-only; every consumer transpiles TS, so
no build step).
- Add a Bun workspace ("packages/*"); the daemon depends on @codeoid/protocol
(^0.1.0, linked locally) and keeps thin re-export shims at src/protocol/* so
the 52 existing "../protocol/…" imports resolve unchanged.
- Wire release.yml to publish @codeoid/protocol (only when its version is new)
before codeoid, so codeoid's published dependency resolves.
Verified: tsc clean, biome clean, daemon build bundles the package, full suite
786 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (11)
📝 WalkthroughWalkthroughExtracts wire-protocol types and permission scopes into a new ChangesProtocol Package Extraction
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
=======================================
Coverage 75.85% 75.86%
=======================================
Files 66 69 +3
Lines 11308 11312 +4
=======================================
+ Hits 8578 8582 +4
Misses 2730 2730
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
First step of the packages extraction (design doc §4): a single source of truth for the client↔daemon wire protocol, shared by the daemon, web UI, and the mobile client.
What changed
src/protocol/{types,scopes,index}.ts→packages/protocol/src/(history preserved) and added the@codeoid/protocolpackage. Source-only — every consumer (Bun, Vite, Metro) transpiles TS, so no build step."workspaces": ["packages/*"]). The daemon depends on@codeoid/protocol(^0.1.0, linked locally) and keeps thin re-export shims atsrc/protocol/{types,scopes,index}.ts, so the 52 existing../protocol/…imports resolve unchanged (zero churn across 44 files).release.ymlpublishes@codeoid/protocol(only when its version is new) before codeoid, so codeoid's published dependency resolves.Why the coupling / sequencing
codeoid is published on npm and runs raw
src, so once the daemon imports@codeoid/protocol, that package must be on npm ornpm i -g codeoidbreaks. This PR was intentionally sequenced after the #84 fix merged (it editedtypes.ts), and the daemon consumes the package via^0.1.0(linked locally now, resolves to the published version later).@codeoid/protocolneeds its own npm Trusted Publisher configured at npmjs.com (same OIDC setup as codeoid) before the first release that publishes protocol0.1.0. Until then the new release step no-ops for unchanged versions but will fail when it first tries to publish0.1.0.Verification
tsc --noEmitclean;biome check src/clean.bun run buildbundles@codeoid/protocol(384 modules).Not in this PR (follow-ups)
web/src/protocol/types.tsmirror. Migrating it to consume@codeoid/protocolis deferred —webis a separate package with its own Vite build + lockfile, so joining it to the workspace and swapping the mirror deserves its own verified PR rather than risking the web build here.@codeoid/core: the ws client + reducers + formatters (the larger, Solid-decoupling extraction).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation