-
Notifications
You must be signed in to change notification settings - Fork 11
Supercode cli #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supercode cli #209
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "name": "supercode-cli", | ||
| "version": "0.1.58", | ||
| "description": "AI-powered coding agent CLI", | ||
| "main": "dist/main.js", | ||
| "bin": { | ||
| "supercode": "dist/main.js" | ||
| }, | ||
| "scripts": { | ||
| "dev": "bun src/index.ts", | ||
| "dev:cli": "bun src/cli/main.ts", | ||
| "start": "bun src/index.ts", | ||
| "build": "bun run build:cli", | ||
| "build:cli": "bun build --target node --packages bundle --outdir dist --entry ./src/cli/main.ts --external @modelcontextprotocol/sdk && sed -i '' 's|#!/usr/bin/env bun|#!/usr/bin/env node|' dist/main.js", | ||
| "test": "bun test", | ||
| "typecheck": "tsc --noEmit", | ||
| "db:generate": "prisma generate", | ||
| "prepublishOnly": "bun run build:cli" | ||
| }, | ||
| "type": "module", | ||
| "files": [ | ||
| "dist/main.js", | ||
| "README.md" | ||
| ], | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/yashdev9274/supercli.git" | ||
| }, | ||
| "keywords": [ | ||
| "ai", | ||
| "cli", | ||
| "coding-agent", | ||
| "terminal" | ||
| ], | ||
| "author": "Yash Dewasthale", | ||
| "license": "MIT", | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
| "dependencies": { | ||
| "@ai-sdk/google": "^3.0.80", | ||
| "@ai-sdk/openai-compatible": "^2.0.48", | ||
| "@modelcontextprotocol/sdk": "^1.9.0", | ||
| "@prisma/adapter-pg": "^7.8.0", | ||
| "@prisma/client": "^7.8.0", | ||
| "@prisma/client-runtime-utils": "^7.8.0", | ||
| "@prisma/driver-adapter-utils": "^7.8.0", | ||
| "@vercel/connect": "^0.3.2", | ||
| "ai": "^6.0.195", | ||
| "better-auth": "^1.5.5", | ||
| "boxen": "^8.0.1", | ||
| "chalk": "^5.6.2", | ||
| "commander": "^15.0.0", | ||
| "cors": "^2.8.5", | ||
| "eve": "^0.22.5", | ||
| "express": "^5.1.0", | ||
| "marked": "^18.0.4", | ||
| "marked-terminal": "^7.3.0", | ||
| "open": "^11.0.0", | ||
| "vercel-minimax-ai-provider": "^0.0.2", | ||
| "yocto-spinner": "^1.2.0", | ||
| "zod": "^3.25.2", | ||
| "zod-to-json-schema": "^3.25.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@clack/prompts": "^1.5.0", | ||
| "@openrouter/ai-sdk-provider": "^2.9.0", | ||
| "@openrouter/sdk": "^0.12.79", | ||
| "@super/db-terminal": "workspace:*", | ||
| "@types/bun": "^1.3.14", | ||
| "@types/cors": "^2.8.17", | ||
| "@types/express": "^5.0.0", | ||
| "@types/node": "^22.0.0", | ||
| "@types/pg": "^8.18.0", | ||
| "api": "^6.1.3", | ||
| "dotenv": "^17.3.1", | ||
| "oas": "^34.0.1", | ||
| "prisma": "^7.4.2", | ||
| "typescript": "^5.7.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -355,7 +355,7 @@ async function streamAIResponse( | |||||||||||||||||||||||||||||||||||||||||||||
| // previous noisy per-tool debug lines. | ||||||||||||||||||||||||||||||||||||||||||||||
| const statusRow = new StepStatusRow() | ||||||||||||||||||||||||||||||||||||||||||||||
| const agentName = mode === "plan" ? "plan" : (mode === "chat" ? "chat" : "build") | ||||||||||||||||||||||||||||||||||||||||||||||
| statusRow.start(agentName, provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| statusRow.start(agentName, provider.modelName, provider.connectionType) | ||||||||||||||||||||||||||||||||||||||||||||||
| // Publish to the module-scoped slot so the persistent footer's resize | ||||||||||||||||||||||||||||||||||||||||||||||
| // handler can notify us too — StepStatusRow reserves no row of its own, | ||||||||||||||||||||||||||||||||||||||||||||||
| // but its render math depends on the current terminal width. | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -827,8 +827,9 @@ async function streamAIResponse( | |||||||||||||||||||||||||||||||||||||||||||||
| const elapsedStr = | ||||||||||||||||||||||||||||||||||||||||||||||
| elapsed < 1000 ? `${elapsed}ms` : `${(elapsed / 1000).toFixed(1)}s` | ||||||||||||||||||||||||||||||||||||||||||||||
| const modeLabel = mode === "plan" ? "plan" : (mode === "chat" ? "chat" : "build") | ||||||||||||||||||||||||||||||||||||||||||||||
| const connBadge = provider.connectionType === "direct" ? " 🔑" : " ☁️" | ||||||||||||||||||||||||||||||||||||||||||||||
| console.log( | ||||||||||||||||||||||||||||||||||||||||||||||
| ` ${chalk.hex(theme.green)("▣")} ${chalk.hex(theme.greenMute)(modeLabel)} ${chalk.hex(theme.greenDim)("·")} ${chalk.hex(theme.muted)(provider.modelName)} ${chalk.hex(theme.greenDim)("·")} ${chalk.hex(theme.muted)(elapsedStr)}`, | ||||||||||||||||||||||||||||||||||||||||||||||
| ` ${chalk.hex(theme.green)("▣")} ${chalk.hex(theme.greenMute)(modeLabel)} ${chalk.hex(theme.greenDim)("·")} ${chalk.hex(theme.muted)(provider.modelName)}${chalk.hex(theme.amber)(connBadge)} ${chalk.hex(theme.greenDim)("·")} ${chalk.hex(theme.muted)(elapsedStr)}`, | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| console.log() | ||||||||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1902,17 +1903,25 @@ export async function chatLoop( | |||||||||||||||||||||||||||||||||||||||||||||
| provider = newProvider | ||||||||||||||||||||||||||||||||||||||||||||||
| contextWindow = getContextWindow(provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| const label = result.label || provider.modelName | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setModel(provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setModel(provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setConnectionType(provider.connectionType) | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setContextWindow(contextWindow) | ||||||||||||||||||||||||||||||||||||||||||||||
| process.stdout.write(`\r\n ${chalk.hex(theme.green)("◆")} switched to ${chalk.hex(theme.green)(label)}\r\n\n`) | ||||||||||||||||||||||||||||||||||||||||||||||
| saveCliConfig({ provider: result.provider!, model: result.model || provider.modelName, mode: conversation.mode as "chat" | "agent" }) | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } else if (result?.type === "connect") { | ||||||||||||||||||||||||||||||||||||||||||||||
| if (result.provider) { | ||||||||||||||||||||||||||||||||||||||||||||||
| const newProvider = createProvider(result.provider, provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| const modelToUse = result.model || provider.modelName | ||||||||||||||||||||||||||||||||||||||||||||||
| const newProvider = createProvider(result.provider, modelToUse) | ||||||||||||||||||||||||||||||||||||||||||||||
| if (newProvider) { | ||||||||||||||||||||||||||||||||||||||||||||||
| provider = newProvider | ||||||||||||||||||||||||||||||||||||||||||||||
| contextWindow = getContextWindow(provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setModel(provider.modelName) | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setConnectionType(provider.connectionType) | ||||||||||||||||||||||||||||||||||||||||||||||
| footer.setContextWindow(contextWindow) | ||||||||||||||||||||||||||||||||||||||||||||||
| const label = `${provider.name} · ${provider.modelName}` | ||||||||||||||||||||||||||||||||||||||||||||||
| process.stdout.write(`\r\n ${chalk.hex(theme.green)("◆")} switched to ${chalk.hex(theme.green)(label)}\r\n`) | ||||||||||||||||||||||||||||||||||||||||||||||
| saveCliConfig({ provider: result.provider!, model: modelToUse, mode: conversation.mode as "chat" | "agent" }) | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1914
to
+1924
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Prevent cross-provider model leakage. When switching to a new provider via Instead, conditionally fall back to the existing model only if the provider remains the same, and use the newly resolved 🛠️ Proposed fix- const modelToUse = result.model || provider.modelName
- const newProvider = createProvider(result.provider, modelToUse)
+ const modelToUse = result.model || (result.provider === provider.name ? provider.modelName : undefined)
+ const newProvider = createProvider(result.provider, modelToUse)
if (newProvider) {
provider = newProvider
contextWindow = getContextWindow(provider.modelName)
footer.setModel(provider.modelName)
footer.setConnectionType(provider.connectionType)
footer.setContextWindow(contextWindow)
const label = `${provider.name} · ${provider.modelName}`
process.stdout.write(`\r\n ${chalk.hex(theme.green)("◆")} switched to ${chalk.hex(theme.green)(label)}\r\n`)
- saveCliConfig({ provider: result.provider!, model: modelToUse, mode: conversation.mode as "chat" | "agent" })
+ saveCliConfig({ provider: result.provider!, model: provider.modelName, mode: conversation.mode as "chat" | "agent" })📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| process.stdout.write(`\r\n`) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -2225,7 +2234,7 @@ export async function chatLoop( | |||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| export async function startChat( | ||||||||||||||||||||||||||||||||||||||||||||||
| provider: ModelProvider = "concentrateai", | ||||||||||||||||||||||||||||||||||||||||||||||
| provider: ModelProvider = "supercode", | ||||||||||||||||||||||||||||||||||||||||||||||
| model?: string, | ||||||||||||||||||||||||||||||||||||||||||||||
| conversationId?: string | null, | ||||||||||||||||||||||||||||||||||||||||||||||
| workspaceInfo?: WorkspaceInfo, | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
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
🧩 Analysis chain
🏁 Script executed:
Repository: yashdev9274/supercli
Length of output: 448
🏁 Script executed:
Repository: yashdev9274/supercli
Length of output: 665
🏁 Script executed:
Repository: yashdev9274/supercli
Length of output: 665
Delete the committed backup file and clean up the active manifest
apps/supercode-cli/server/package.json.bak2is a backup artifact and should be removed.apps/supercode-cli/server/package.jsonstill usessed -i ''inbuild:cli, which breaks on Linux.dotenvis still listed indevDependencies; Bun already loads.envfiles without it.🤖 Prompt for AI Agents
Source: Path instructions