Conversation
Add Fastify server infrastructure and three worktree action endpoints: - POST /api/worktrees/:id/merge — squash or no-ff merge with force flag and cleanup - POST /api/worktrees/:id/kill — kill all running agents in a worktree - POST /api/worktrees/:id/pr — create GitHub PR via gh CLI and store URL in manifest Includes 15 tests covering success paths, error handling (404, 409, 500, 502), merge strategies, cleanup toggles, draft PR flag, and gh/push failures. Closes #71
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Security: - Use crypto.timingSafeEqual for bearer token comparison (was string ===) - Use request.routeOptions.url for auth bypass check (was request.url) Architecture: - Extract mergeWorktree() to core/merge.ts (was duplicated in commands + routes) - Extract killWorktreeAgents() to core/kill.ts (was duplicated in commands + routes) - Extract createWorktreePr(), buildBodyFromResults(), truncateBody() to core/pr.ts - Routes now import from core/ only, not commands/ (fixes layer violation) - Commands are thin wrappers: core logic + CLI output Code quality: - errorReply() now returns FastifyReply (prevents undefined return after reply.send) - Remove unused imports (FastifyRequest, warn, KillBody) - Remove redundant requireManifest() calls before updateManifest() - Use Fastify declare module augmentation for projectRoot typing Tests: - Add core/merge.test.ts (7 tests): strategies, branch checkout, force, cleanup, failure - Add core/kill.test.ts (2 tests): running agents set to gone, no-op for idle - Route tests mock at core/ layer instead of duplicating low-level mock setup - 242 total tests passing (was 233)
Summary
src/server/index.ts) with CORS, bearer auth, health endpoint, and route registrationsrc/server/routes/worktrees.ts):POST /api/worktrees/:id/merge— merge with configurable strategy (squash default, no-ff), force flag, cleanup togglePOST /api/worktrees/:id/kill— kill all running agents in a worktreePOST /api/worktrees/:id/pr— create GitHub PR viaghCLI, store URL in manifestfastifyand@fastify/corsdependenciesserveStatePath/servePidPathhelpers tolib/paths.tsTest plan
npm run typecheckpasses (no new errors)npm test— all 233 tests pass (22 files)ppg serve, call merge/kill/pr endpoints against a real ppg sessionCloses #71