Skip to content

feat(cli): setup-roo — configure Roo Code for OmniRoute (import JSON + autoImport + UI) - #4292

Merged
diegosouzapw merged 1 commit into
release/v3.8.30from
feat/roo-cli
Jun 19, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.30from
feat/roo-cli

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

What

CLI #8. omniroute setup-roo configures Roo Code (RooVeterinaryInc.roo-cline, a Cline fork) for OmniRoute. Roo's live settings are opaque VS Code globalStorage, but it supports Settings Import + roo-cline.autoImportSettingsPath.

  • Writes ~/.omniroute/roo-settings.json (provider profile: apiProvider=openai, openAiBaseUrl WITH /v1, key, model).
  • Sets roo-cline.autoImportSettingsPath in VS Code settings.json when present (preserves other settings).
  • Prints the guaranteed UI path + the "Import Settings" fallback. Remote-aware.

baseUrl needs /v1 (Roo appends /chat/completions); model must support native tool-calling (OmniRoute does).

Validation

  • Remote (VPS v3.8.30): setup-roo --remote --dry-run --model glm/glm-5-turbo → correct import doc.
  • Roo's wire (/v1/chat/completions) already validated → "OK". 5 unit tests; check:cli-i18n ✓.

Series: …Continue #4289 · Cursor #4291 · Roo (this). Next: Crush, Goose, Qwen Code, Gemini CLI, Aider.

🤖 Generated with Claude Code

…+ autoImport + UI)

CLI #8 of the series. Roo Code (RooVeterinaryInc.roo-cline, a Cline fork) keeps
live settings in opaque VS Code globalStorage, but supports Settings Import and
an `roo-cline.autoImportSettingsPath` (VS Code settings.json) that loads a JSON
at startup.

`omniroute setup-roo`:
- writes ~/.omniroute/roo-settings.json — a Roo provider profile
  (providerProfiles.apiConfigs.OmniRoute: apiProvider=openai, openAiBaseUrl WITH
  /v1 — Roo appends /chat/completions — openAiApiKey, openAiModelId).
- sets roo-cline.autoImportSettingsPath in VS Code settings.json when present
  (preserves other settings).
- prints the guaranteed UI path (Settings → Providers → OpenAI Compatible) +
  the "Import Settings" fallback.
- remote-aware; model via --model or interactive pick.

Researched against current Roo docs: OpenAI-compatible needs baseUrl WITH /v1 and
native tool-calling (OmniRoute supports it). Roo's wire (/v1/chat/completions)
already validated → "OK".

Tests: resolveRooTarget (/v1, key), buildRooImport (provider profile + /v1 + key
fallback), buildRooVscodeAutoImport (pointer + preserve). 5 unit tests; cli-i18n green.
@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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the setup-roo CLI command to configure Roo Code for OmniRoute, along with associated documentation and unit tests. The feedback highlights critical improvements for robustness and cross-platform compatibility: preventing potential data loss by throwing an error if the VS Code settings.json fails to parse, wrapping the settings update in a try-catch block, and dynamically resolving the VS Code settings path for macOS and Windows instead of hardcoding the Linux path.

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.

Comment on lines +73 to +80
function readJson(path) {
try {
if (existsSync(path)) return JSON.parse(readFileSync(path, "utf8"));
} catch {
/* corrupt/missing */
}
return {};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Returning {} when a file exists but fails to parse is extremely dangerous. VS Code settings.json files often contain comments or trailing commas, which cause JSON.parse to throw. If we return {} here, the caller will merge the new setting into {} and overwrite the user's entire settings.json file, causing complete data loss of their VS Code configuration. We should throw an error if the file exists but cannot be parsed.

Suggested change
function readJson(path) {
try {
if (existsSync(path)) return JSON.parse(readFileSync(path, "utf8"));
} catch {
/* corrupt/missing */
}
return {};
}
function readJson(path) {
if (!existsSync(path)) return {};
try {
return JSON.parse(readFileSync(path, "utf8"));
} catch (err) {
throw new Error(`Malformed JSON or unsupported comments/trailing commas: ${err.message}`);
}
}

Comment on lines +139 to +143
if (vscodeExists) {
const merged = buildRooVscodeAutoImport(readJson(vscodePath), importPath);
writeFileSync(vscodePath, JSON.stringify(merged, null, 2) + "\n", "utf8");
printSuccess(`Set roo-cline.autoImportSettingsPath in ${vscodePath}`);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Wrap the VS Code settings update in a try-catch block. If readJson throws an error (e.g., due to parsing failure of a file with comments), we must catch it and abort the write operation to prevent overwriting and destroying the user's VS Code settings.

    if (vscodeExists) {
      try {
        const merged = buildRooVscodeAutoImport(readJson(vscodePath), importPath);
        writeFileSync(vscodePath, JSON.stringify(merged, null, 2) + "\n", "utf8");
        printSuccess(`Set roo-cline.autoImportSettingsPath in ${vscodePath}`);
      } catch (err) {
        printError(`Skipped updating VS Code settings to prevent data loss: ${err.message}`);
      }
    }

Comment on lines +103 to +104
const vscodePath =
opts.vscodeSettings ?? opts["vscode-settings"] ?? join(os.homedir(), ".config", "Code", "User", "settings.json");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The default VS Code settings path is hardcoded to the Linux path (~/.config/Code/User/settings.json). This will fail to locate the settings file on macOS (which uses ~/Library/Application Support/Code/User/settings.json) and Windows (which uses %APPDATA%\\Code\\User\\settings.json). We should resolve this path dynamically based on the operating system platform.

Suggested change
const vscodePath =
opts.vscodeSettings ?? opts["vscode-settings"] ?? join(os.homedir(), ".config", "Code", "User", "settings.json");
const defaultVscodePath =
os.platform() === "win32"
? join(process.env.APPDATA || join(os.homedir(), "AppData", "Roaming"), "Code", "User", "settings.json")
: os.platform() === "darwin"
? join(os.homedir(), "Library", "Application Support", "Code", "User", "settings.json")
: join(os.homedir(), ".config", "Code", "User", "settings.json");
const vscodePath = opts.vscodeSettings ?? opts["vscode-settings"] ?? defaultVscodePath;

@diegosouzapw
diegosouzapw merged commit 5b40069 into release/v3.8.30 Jun 19, 2026
4 checks passed
@diegosouzapw
diegosouzapw deleted the feat/roo-cli branch June 19, 2026 19:13
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…+ autoImport + UI) (diegosouzapw#4292)

CLI diegosouzapw#8 of the series. Roo Code (RooVeterinaryInc.roo-cline, a Cline fork) keeps
live settings in opaque VS Code globalStorage, but supports Settings Import and
an `roo-cline.autoImportSettingsPath` (VS Code settings.json) that loads a JSON
at startup.

`omniroute setup-roo`:
- writes ~/.omniroute/roo-settings.json — a Roo provider profile
  (providerProfiles.apiConfigs.OmniRoute: apiProvider=openai, openAiBaseUrl WITH
  /v1 — Roo appends /chat/completions — openAiApiKey, openAiModelId).
- sets roo-cline.autoImportSettingsPath in VS Code settings.json when present
  (preserves other settings).
- prints the guaranteed UI path (Settings → Providers → OpenAI Compatible) +
  the "Import Settings" fallback.
- remote-aware; model via --model or interactive pick.

Researched against current Roo docs: OpenAI-compatible needs baseUrl WITH /v1 and
native tool-calling (OmniRoute supports it). Roo's wire (/v1/chat/completions)
already validated → "OK".

Tests: resolveRooTarget (/v1, key), buildRooImport (provider profile + /v1 + key
fallback), buildRooVscodeAutoImport (pointer + preserve). 5 unit tests; cli-i18n green.
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.

1 participant