Fix review feedback: duplicate wizard entry, command resolution, @types/node
- Remove duplicate opencode_local adapter entry in OnboardingWizard (old Code-icon version), keeping only the OpenCodeLogoIcon entry - Extract resolveOpenCodeCommand() helper to deduplicate the PAPERCLIP_OPENCODE_COMMAND env-var fallback logic in models.ts - Bump @types/node from ^22.12.0 to ^24.6.0 to match the monorepo Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,15 @@ import {
|
||||
|
||||
const MODELS_CACHE_TTL_MS = 60_000;
|
||||
|
||||
function resolveOpenCodeCommand(input: unknown): string {
|
||||
const envOverride =
|
||||
typeof process.env.PAPERCLIP_OPENCODE_COMMAND === "string" &&
|
||||
process.env.PAPERCLIP_OPENCODE_COMMAND.trim().length > 0
|
||||
? process.env.PAPERCLIP_OPENCODE_COMMAND.trim()
|
||||
: "opencode";
|
||||
return asString(input, envOverride);
|
||||
}
|
||||
|
||||
const discoveryCache = new Map<string, { expiresAt: number; models: AdapterModel[] }>();
|
||||
const VOLATILE_ENV_KEY_PREFIXES = ["PAPERCLIP_", "npm_", "NPM_"] as const;
|
||||
const VOLATILE_ENV_KEY_EXACT = new Set(["PWD", "OLDPWD", "SHLVL", "_", "TERM_SESSION_ID"]);
|
||||
@@ -94,13 +103,7 @@ export async function discoverOpenCodeModels(input: {
|
||||
cwd?: unknown;
|
||||
env?: unknown;
|
||||
} = {}): Promise<AdapterModel[]> {
|
||||
const command = asString(
|
||||
input.command,
|
||||
(typeof process.env.PAPERCLIP_OPENCODE_COMMAND === "string" &&
|
||||
process.env.PAPERCLIP_OPENCODE_COMMAND.trim().length > 0
|
||||
? process.env.PAPERCLIP_OPENCODE_COMMAND.trim()
|
||||
: "opencode"),
|
||||
);
|
||||
const command = resolveOpenCodeCommand(input.command);
|
||||
const cwd = asString(input.cwd, process.cwd());
|
||||
const env = normalizeEnv(input.env);
|
||||
const runtimeEnv = normalizeEnv(ensurePathInEnv({ ...process.env, ...env }));
|
||||
@@ -134,13 +137,7 @@ export async function discoverOpenCodeModelsCached(input: {
|
||||
cwd?: unknown;
|
||||
env?: unknown;
|
||||
} = {}): Promise<AdapterModel[]> {
|
||||
const command = asString(
|
||||
input.command,
|
||||
(typeof process.env.PAPERCLIP_OPENCODE_COMMAND === "string" &&
|
||||
process.env.PAPERCLIP_OPENCODE_COMMAND.trim().length > 0
|
||||
? process.env.PAPERCLIP_OPENCODE_COMMAND.trim()
|
||||
: "opencode"),
|
||||
);
|
||||
const command = resolveOpenCodeCommand(input.command);
|
||||
const cwd = asString(input.cwd, process.cwd());
|
||||
const env = normalizeEnv(input.env);
|
||||
const key = discoveryCacheKey(command, cwd, env);
|
||||
|
||||
Reference in New Issue
Block a user