Skip to content

feat: update supercode-cli version to 0.1.77 and enhance BYOK provider management:#217

Merged
yashdev9274 merged 1 commit into
mainfrom
supercode-cli
Jul 19, 2026
Merged

feat: update supercode-cli version to 0.1.77 and enhance BYOK provider management:#217
yashdev9274 merged 1 commit into
mainfrom
supercode-cli

Conversation

@yashdev9274

@yashdev9274 yashdev9274 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Description

  • Bumped version in package.json to 0.1.77.
  • Improved handling of BYOK environment variables for multiple providers.
  • Updated input rendering in chat to include placeholder text when input is empty.
  • Refactored API key retrieval to streamline session-only BYOK logic across various commands.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • bun test passes
  • bun run typecheck passes
  • bun run lint passes (if applicable)

Checklist:

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Summary by CodeRabbit

  • New Features

    • Added support for session-based BYOK credentials across more AI providers.
    • Provider credentials now use the appropriate production or development environment settings.
    • Updated CLI model selections, including refreshed Kimi model options.
  • Improvements

    • Improved provider connection and model-selection flows when credentials are already available.
    • CLI input now displays a helpful placeholder prompt when no text has been entered.
  • Bug Fixes

    • Prevented sensitive provider keys from being persisted in local CLI configuration files.

…r management:

- Bumped version in package.json to 0.1.77.
- Improved handling of BYOK environment variables for multiple providers.
- Updated input rendering in chat to include placeholder text when input is empty.
- Refactored API key retrieval to streamline session-only BYOK logic across various commands.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
supercli Ready Ready Preview, Comment Jul 19, 2026 7:39am
supercli-client Ready Ready Preview, Comment Jul 19, 2026 7:39am
supercli-docs Ready Ready Preview, Comment Jul 19, 2026 7:39am

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Changes

BYOK session key flow

Layer / File(s) Summary
Session key configuration
apps/supercode-cli/server/src/lib/cli-config.ts
BYOK providers now resolve prod/dev session environment variables, clear persisted API keys, and save keys without persistent storage.
Provider configuration resolution
apps/supercode-cli/server/src/cli/ai/provider.ts, apps/supercode-cli/server/src/cli/commands/ai/init.ts
Provider configuration and session restoration now support multiple BYOK providers and environment-variable fallbacks.
CLI connection and model integration
apps/supercode-cli/server/src/cli/commands/slashCommands/connect.ts, apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts
Connection and model selection use session BYOK keys, and Kimi model entries are updated.

CLI release and prompt updates

Layer / File(s) Summary
Prompt rendering and package release
apps/supercode-cli/server/src/cli/ai/chat/chat.ts, apps/supercode-cli/server/package.json
Empty input displays a dim placeholder with reserved wrapping space, and the package version changes to 0.1.77.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant cli-config
  participant Environment
  participant Provider
  CLI->>cli-config: saveProviderApiKey(provider, key)
  cli-config->>Environment: write provider BYOK env variable
  CLI->>cli-config: getByokSessionKey(provider)
  cli-config->>Environment: read prod/dev BYOK env variable
  cli-config-->>Provider: return session key
  Provider-->>CLI: configure selected provider
Loading

Possibly related PRs

Poem

A bunny found keys in the env’s cozy glow,
And taught every provider where session winds blow.
“Ask anything...” now softly appears,
While Kimi grows models and package numbers cheer.
Hop, hop—CLI magic is here!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main changes: version bump and broader BYOK provider management, with only minor omissions like the chat input tweak.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch supercode-cli

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@apps/supercode-cli/server/src/cli/ai/chat/chat.ts`:
- Line 1046: Update the placeholder string literals in the visibleLen
expressions near lines 1046 and 1068 to use double-quoted strings, escaping the
embedded double quotes while preserving the existing text and behavior.

In `@apps/supercode-cli/server/src/lib/cli-config.ts`:
- Around line 108-114: Update getByokSessionKey in
apps/supercode-cli/server/src/lib/cli-config.ts to fall back to the standard API
key mapping when configured BYOK override variables are absent. In
apps/supercode-cli/server/src/cli/commands/ai/init.ts, remove the duplicated
BYOK_PROVIDER_VARS mapping, import getByokSessionKey from src/lib/cli-config.ts,
and replace the manual environment check with !getByokSessionKey(sp).
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 975cfad2-95da-4959-a238-4172b5ffd4c7

📥 Commits

Reviewing files that changed from the base of the PR and between 44e6482 and 4d5c08b.

📒 Files selected for processing (7)
  • apps/supercode-cli/server/package.json
  • apps/supercode-cli/server/src/cli/ai/chat/chat.ts
  • apps/supercode-cli/server/src/cli/ai/provider.ts
  • apps/supercode-cli/server/src/cli/commands/ai/init.ts
  • apps/supercode-cli/server/src/cli/commands/slashCommands/connect.ts
  • apps/supercode-cli/server/src/cli/commands/slashCommands/model.ts
  • apps/supercode-cli/server/src/lib/cli-config.ts

const promptLen = getStdoutPromptLen()
stdinPromptLen = promptLen
const totalChars = promptLen + stdinInput.length
const visibleLen = stdinInput.length || 'Ask anything... "Fix broken tests"'.length

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use double-quoted strings for the new placeholder literals.

Lines 1046 and 1068 introduce single-quoted strings, contrary to the project guideline. Convert both literals to double quotes while escaping the embedded quotes.

Proposed fix
-  const visibleLen = stdinInput.length || 'Ask anything... "Fix broken tests"'.length
+  const visibleLen = stdinInput.length || "Ask anything... \"Fix broken tests\"".length
...
-  const inputText = stdinInput || chalk.hex(theme.greenDim)('Ask anything... "Fix broken tests"')
+  const inputText = stdinInput || chalk.hex(theme.greenDim)("Ask anything... \"Fix broken tests\"")

As per coding guidelines: **/*.{ts,tsx,js,mjs,cjs} must use double quotes for strings.

Also applies to: 1068-1068

🤖 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 `@apps/supercode-cli/server/src/cli/ai/chat/chat.ts` at line 1046, Update the
placeholder string literals in the visibleLen expressions near lines 1046 and
1068 to use double-quoted strings, escaping the embedded double quotes while
preserving the existing text and behavior.

Source: Coding guidelines

Comment on lines +108 to 114
export function getByokSessionKey(provider: ModelProvider): string | undefined {
const override = BYOK_ENV_OVERRIDES[provider]
if (override) {
return process.env[override.prod] || process.env[override.dev]
}
return "CONCENTRATE_BYOK_PROD_KEY"
return process.env[API_KEY_ENV_MAP[provider]] || undefined
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Missing fallback to standard API keys for BYOK providers.

Both files fail to account for the standard environment variables (e.g., GOOGLE_GENERATIVE_AI_API_KEY) when a provider has BYOK overrides configured but they are absent from the environment. This results in the user's provider being unexpectedly reset to supercode on startup, as well as erroneous prompts for an API key in /connect and /model, even when a valid standard key is active.

  • apps/supercode-cli/server/src/lib/cli-config.ts#L108-L114: Update getByokSessionKey to explicitly return the standard fallback key when the BYOK overrides are unset.
  • apps/supercode-cli/server/src/cli/commands/ai/init.ts#L92-L104: Remove the duplicated BYOK_PROVIDER_VARS mapping and replace the manual environment check with !getByokSessionKey(sp) to properly respect fallback keys. (Ensure getByokSessionKey is imported from src/lib/cli-config.ts).
🛠️ Proposed fixes

apps/supercode-cli/server/src/lib/cli-config.ts

 export function getByokSessionKey(provider: ModelProvider): string | undefined {
   const override = BYOK_ENV_OVERRIDES[provider]
   if (override) {
-    return process.env[override.prod] || process.env[override.dev]
+    const val = process.env[override.prod] || process.env[override.dev]
+    if (val) return val
   }
   return process.env[API_KEY_ENV_MAP[provider]] || undefined
 }

apps/supercode-cli/server/src/cli/commands/ai/init.ts

-    const BYOK_PROVIDER_VARS: Record<string, string[]> = {
-      concentrateai: ["CONCENTRATE_BYOK_PROD_KEY", "CONCENTRATE_BYOK_DEV_KEY"],
-      mergedev: ["MERGE_DEV_BYOK_PROD_KEY", "MERGE_DEV_BYOK_DEV_KEY"],
-      google: ["GOOGLE_BYOK_PROD_KEY", "GOOGLE_BYOK_DEV_KEY"],
-      openrouter: ["OPENROUTER_BYOK_PROD_KEY", "OPENROUTER_BYOK_DEV_KEY"],
-      nvidia: ["NVIDIA_BYOK_PROD_KEY", "NVIDIA_BYOK_DEV_KEY"],
-    }
     const sp = stored.provider
-    const byokVars = sp && BYOK_PROVIDER_VARS[sp]
-    if (byokVars && !byokVars.some((v) => process.env[v])) {
+    if (sp && sp !== "supercode" && !getByokSessionKey(sp)) {
       stored.provider = "supercode"
       await saveCliConfig({ provider: "supercode", model: stored.model })
     }
📍 Affects 2 files
  • apps/supercode-cli/server/src/lib/cli-config.ts#L108-L114 (this comment)
  • apps/supercode-cli/server/src/cli/commands/ai/init.ts#L92-L104
🤖 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 `@apps/supercode-cli/server/src/lib/cli-config.ts` around lines 108 - 114,
Update getByokSessionKey in apps/supercode-cli/server/src/lib/cli-config.ts to
fall back to the standard API key mapping when configured BYOK override
variables are absent. In apps/supercode-cli/server/src/cli/commands/ai/init.ts,
remove the duplicated BYOK_PROVIDER_VARS mapping, import getByokSessionKey from
src/lib/cli-config.ts, and replace the manual environment check with
!getByokSessionKey(sp).

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