chore: add typecheck, lint, and CI gates for AI-assisted development#16
Conversation
Establish bun run check (typecheck + biome lint + test) as the verification contract in AGENTS.md, fix the resulting type/lint baseline, and wire GitHub Actions so merges require all three gates to pass. Co-authored-by: Cursor <cursoragent@cursor.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 33 minutes and 49 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughAdds a GitHub Actions CI workflow with Bun-based typecheck, lint, and test gates, plus Biome linter configuration and root-level scripts. Accompanies these with targeted TypeScript type-safety fixes ( ChangesCI Tooling, Type Safety, and Hook Fixes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
CI bun install runs server postinstall (prisma generate), which requires DATABASE_URL to be defined even though no live database is needed. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/cli/src/components/input-bar.tsx (1)
343-351: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winCursor moves no longer resync the mention menu.
syncMentionMenunow only runs on content edits. If the user moves the caret with arrows or mouse, the@mentionpopup can stay open or point at the wrong token until the next text change. Please keep a cursor-change sync path alongsideonContentChange.Also applies to: 615-623
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/src/components/input-bar.tsx` around lines 343 - 351, The mention menu only syncs from content edits in handleTextareaContentChange, so cursor-only moves can leave the `@mention` popup stale. Add a separate cursor-change sync path in input-bar.tsx that also calls syncMentionMenu when the caret moves, and wire it through the textarea event handling alongside onContentChange (using the existing textareaRef, handleContentChange, and syncMentionMenu helpers) so mouse/arrow navigation keeps the menu aligned.
🧹 Nitpick comments (2)
packages/cli/src/hooks/use-chat.ts (1)
468-468: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winKeep
continueGenerationkeyed to the members it actually uses.Line 468’s
[chat]dependency will recreate this callback wheneveruseAiChat()returns a fresh object, which then churns downstream consumers likeSessionChat’s auto-resume effect and session-actions memo. Prefer the specificchat.*members read inside the callback instead of the whole object.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/src/hooks/use-chat.ts` at line 468, The `continueGeneration` callback in `use-chat.ts` is over-dependent on the full `chat` object, which causes unnecessary recreation when `useAiChat()` returns a new reference. Update the dependency list to include only the specific `chat.*` members actually read inside `continueGeneration` so the callback stays stable and avoids downstream churn in `SessionChat` and related memoized actions.packages/cli/src/mcp/tools.ts (1)
72-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid casting the whole
dynamicTool()config tonever.
This hides the schema/type mismatch at the call site; narrow the cast toinputSchemaor givejsonSchemaToInputSchema()an explicit SDK schema return type. The same pattern also exists inpackages/shared/src/mcp-tools.ts.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/src/mcp/tools.ts` around lines 72 - 75, The `dynamicTool()` setup is masking a type mismatch by casting the entire config to `never`, which should be fixed at the source. Update the `buildMcpTools`/`dynamicTool` call to use a properly typed `inputSchema` value instead of casting the whole object, either by narrowing the cast to `jsonSchemaToInputSchema(tool.inputSchema)` or by giving `jsonSchemaToInputSchema()` an explicit SDK schema return type. Apply the same correction in `packages/shared/src/mcp-tools.ts` where the same pattern appears.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 3-19: The CI workflow currently checks out PR code and runs it
with overly broad default token access; harden the job by reducing the
permissions granted to the built-in token and preventing the checkout token from
being persisted. Update the check job in the workflow to explicitly set minimal
`permissions` and configure the `actions/checkout@v4` step so the token is not
left available to later PR-controlled steps, while keeping the existing
`setup-bun` and install flow intact.
- Around line 14-16: The CI workflow is using a floating Bun version, which
makes builds non-reproducible. Update the setup-bun step to pin Bun to an exact
version instead of using bun-version: latest, or read the version from a
checked-in version file so the workflow stays stable; locate the change in the
setup-bun@v2 configuration.
In `@packages/cli/src/components/messages/bot-message.tsx`:
- Around line 142-146: The key for reasoning parts in the bot-message rendering
is not stable when identical text repeats within the same grouped batch. Update
the map in bot-message.tsx inside the group.parts render logic to use a stable
disambiguator such as the inner part index or a per-part id instead of part.text
in the key for the reasoning branch, so repeated reasoning/text chunks do not
collide.
In `@packages/cli/src/lib/stream-interrupt.ts`:
- Around line 134-143: The resume metadata path is still persisting `model` as
an unvalidated string in `trimMessagesForRegenerate`, while
`resolveAutoResumeRequest` later trusts it as `SupportedChatModelId`. Update the
write path to store only a `SupportedChatModelId` for `params.model`, or add a
validation step before reading `lastUser.metadata.model` in
`resolveAutoResumeRequest` so unsupported/stale values are rejected. Use the
existing `trimMessagesForRegenerate` and `resolveAutoResumeRequest` symbols to
keep the persisted model aligned with the resume contract.
In `@packages/cli/tsconfig.json`:
- Line 8: The typecheck gate is excluding a production module, which lets
shipped code bypass validation. Update the packages/cli tsconfig so only test
files are excluded, and fix any typing issues in
src/lib/hydrate-message-parts.ts instead of carving it out; use the existing
typecheck setup and the hydrate-message-parts module as the place to resolve
errors.
---
Outside diff comments:
In `@packages/cli/src/components/input-bar.tsx`:
- Around line 343-351: The mention menu only syncs from content edits in
handleTextareaContentChange, so cursor-only moves can leave the `@mention` popup
stale. Add a separate cursor-change sync path in input-bar.tsx that also calls
syncMentionMenu when the caret moves, and wire it through the textarea event
handling alongside onContentChange (using the existing textareaRef,
handleContentChange, and syncMentionMenu helpers) so mouse/arrow navigation
keeps the menu aligned.
---
Nitpick comments:
In `@packages/cli/src/hooks/use-chat.ts`:
- Line 468: The `continueGeneration` callback in `use-chat.ts` is over-dependent
on the full `chat` object, which causes unnecessary recreation when
`useAiChat()` returns a new reference. Update the dependency list to include
only the specific `chat.*` members actually read inside `continueGeneration` so
the callback stays stable and avoids downstream churn in `SessionChat` and
related memoized actions.
In `@packages/cli/src/mcp/tools.ts`:
- Around line 72-75: The `dynamicTool()` setup is masking a type mismatch by
casting the entire config to `never`, which should be fixed at the source.
Update the `buildMcpTools`/`dynamicTool` call to use a properly typed
`inputSchema` value instead of casting the whole object, either by narrowing the
cast to `jsonSchemaToInputSchema(tool.inputSchema)` or by giving
`jsonSchemaToInputSchema()` an explicit SDK schema return type. Apply the same
correction in `packages/shared/src/mcp-tools.ts` where the same pattern appears.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7407aa22-057e-4a9d-a4b2-7fabe5803c18
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (28)
.github/workflows/ci.ymlAGENTS.mdbiome.jsonpackage.jsonpackages/cli/package.jsonpackages/cli/src/components/command-menu/use-command-menu.tspackages/cli/src/components/dialogs/mcp-dialog.tsxpackages/cli/src/components/input-bar.tsxpackages/cli/src/components/messages/bot-message.tsxpackages/cli/src/hooks/use-chat.tspackages/cli/src/lib/local-chat-transport.test.tspackages/cli/src/lib/local-chat-transport.tspackages/cli/src/lib/mcp-tool-call.tspackages/cli/src/lib/stream-interrupt.tspackages/cli/src/mcp/tools.tspackages/cli/src/providers/dialog/index.tsxpackages/cli/src/providers/keyboard-layer/index.tsxpackages/cli/src/providers/theme/index.tsxpackages/cli/src/providers/toast/index.tsxpackages/cli/src/screens/new-session.tsxpackages/cli/src/screens/session.tsxpackages/cli/tsconfig.jsonpackages/server/src/lib/stream-interrupt.tspackages/server/src/routes/chat.tspackages/server/src/system-prompt.test.tspackages/server/tsconfig.jsonpackages/shared/src/mcp-tools.tspackages/shared/tsconfig.json
|
🚅 Deployed to the MoCode-TUI-pr-16 environment in lavish-courage
|
Harden CI (master trigger, pinned Bun, minimal permissions), remove dead hydrate-message-parts, validate resume model ids, fix streaming scroll and bot-message keys, with unit tests for each. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
bun run check(typecheck + Biome lint + test) as the repo-wide verification contract and document it inAGENTS.mdwith package boundaries and Definition of Done.Test plan
bun run typecheck— 0 errorsbun run lint— 0 errorsbun run test— 215 pass / 0 failbun run check— exit 0Made with Cursor
Summary by CodeRabbit
New Features
Bug Fixes