Repository navigation
feat(cli): setup-cursor — print Cursor setup steps for OmniRoute - #4291
Conversation
CLI #7 of the series. Cursor stores its OpenAI key + "Override OpenAI Base URL" in an opaque SQLite DB (state.vscdb) with no stable schema — not safe to file-write. So `omniroute setup-cursor` prints the exact in-app steps and lists real model names from /v1/models. - Resolves apiBase WITH /v1 (Cursor appends /chat/completions) + key from --remote/--api-key → active context → localhost. - Prints Settings → Models → Override OpenAI Base URL + key + model-name steps, with a clear caveat that the custom base URL powers Cursor's CHAT panel only (Composer / inline-edit / autocomplete stay on Cursor's backend). Researched against current Cursor behavior. Tests: resolveCursorTarget (/v1, key), buildCursorInstructions (base URL + /v1 note + model samples + caveat). 4 unit tests; check:cli-i18n green.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Code Review
This pull request introduces the setup-cursor command to guide users through manually configuring Cursor to use OmniRoute, complete with unit tests and updated documentation. The feedback suggests simplifying a redundant URL string replacement when fetching models and using optional chaining to safely handle potential null responses from the models endpoint.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| try { | ||
| const headers = { "Content-Type": "application/json" }; | ||
| if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`; | ||
| const res = await fetch(`${apiBase.replace(/\/v1$/, "")}/v1/models`, { |
There was a problem hiding this comment.
Since apiBase is guaranteed to end with /v1 (and have no trailing slashes) due to ensureV1, the regex replacement apiBase.replace(/\/v1$/, "") followed by appending /v1/models is redundant. It can be simplified directly to ${apiBase}/models.
| const res = await fetch(`${apiBase.replace(/\/v1$/, "")}/v1/models`, { | |
| const res = await fetch(`${apiBase}/models`, { |
| }); | ||
| if (!res.ok) return []; | ||
| const body = await res.json(); | ||
| const list = Array.isArray(body) ? body : body.data ?? body.models ?? []; |
There was a problem hiding this comment.
If the server returns null as a valid JSON response, body will be null. Accessing body.data directly will throw a TypeError. While this is caught by the try-catch block, using optional chaining (body?.data ?? body?.models ?? []) is safer and prevents unnecessary exceptions.
| const list = Array.isArray(body) ? body : body.data ?? body.models ?? []; | |
| const list = Array.isArray(body) ? body : (body?.data ?? body?.models ?? []); |
…aper-inference#4291) CLI cheaper-inference#7 of the series. Cursor stores its OpenAI key + "Override OpenAI Base URL" in an opaque SQLite DB (state.vscdb) with no stable schema — not safe to file-write. So `omniroute setup-cursor` prints the exact in-app steps and lists real model names from /v1/models. - Resolves apiBase WITH /v1 (Cursor appends /chat/completions) + key from --remote/--api-key → active context → localhost. - Prints Settings → Models → Override OpenAI Base URL + key + model-name steps, with a clear caveat that the custom base URL powers Cursor's CHAT panel only (Composer / inline-edit / autocomplete stay on Cursor's backend). Researched against current Cursor behavior. Tests: resolveCursorTarget (/v1, key), buildCursorInstructions (base URL + /v1 note + model samples + caveat). 4 unit tests; check:cli-i18n green.
What
CLI #7.
omniroute setup-cursorguides Cursor to use OmniRoute.Cursor stores its OpenAI key + "Override OpenAI Base URL" in an opaque SQLite DB (
state.vscdb) with no stable schema — not safe to file-write. So this command prints the exact in-app steps and lists real model names from/v1/models.apiBaseWITH/v1(Cursor appends/chat/completions) + key (--remote/--api-key→ active context → localhost).Validation
/v1base URL.check:cli-i18n✓.Series: …Cline #4280 · Kilo #4284 · Continue #4289 · Cursor (this). Next: Roo, Crush, Goose, Qwen Code, Gemini CLI, Aider.
🤖 Generated with Claude Code