claudish 7.7.2 → 7.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +66 -18
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -581,7 +581,7 @@ var init_onepassword_config = __esm(() => {
581
581
  });
582
582
 
583
583
  // src/version.ts
584
- var VERSION = "7.7.2";
584
+ var VERSION = "7.7.4";
585
585
 
586
586
  // src/providers/onepassword-wasm.ts
587
587
  var exports_onepassword_wasm = {};
@@ -3043,6 +3043,7 @@ __export(exports_onepassword, {
3043
3043
  valueTail: () => valueTail,
3044
3044
  resolveSecrets: () => resolveSecrets,
3045
3045
  resolveSdkAuth: () => resolveSdkAuth,
3046
+ resolveGlobImportForEnvVars: () => resolveGlobImportForEnvVars,
3046
3047
  resolveGlobImport: () => resolveGlobImport,
3047
3048
  resolveDesktopAccount: () => resolveDesktopAccount,
3048
3049
  resetSdkClientCache: () => resetSdkClientCache,
@@ -3243,6 +3244,35 @@ async function resolveGlobImport(opPath, opts = {}) {
3243
3244
  env: opts.env
3244
3245
  });
3245
3246
  }
3247
+ async function resolveGlobImportForEnvVars(opPath, envNames, opts = {}) {
3248
+ const wanted = new Set(envNames);
3249
+ if (wanted.size === 0)
3250
+ return {};
3251
+ const warn = opts.warn ?? ((m) => console.error(m));
3252
+ const glob = parseGlobImport(opPath);
3253
+ const fields = await discoverItemFields(glob.vault, glob.item, {
3254
+ sdkFactory: opts.sdkFactory,
3255
+ auth: opts.auth,
3256
+ env: opts.env,
3257
+ warn
3258
+ });
3259
+ const matches = filterGlobFields(fields, glob);
3260
+ const refMap = {};
3261
+ for (const m of matches) {
3262
+ if (!m.valid)
3263
+ continue;
3264
+ if (!wanted.has(m.envName))
3265
+ continue;
3266
+ refMap[m.envName] = m.field.reference;
3267
+ }
3268
+ if (Object.keys(refMap).length === 0)
3269
+ return {};
3270
+ return resolveSecrets(refMap, {
3271
+ sdkFactory: opts.sdkFactory,
3272
+ auth: opts.auth,
3273
+ env: opts.env
3274
+ });
3275
+ }
3246
3276
  function envNameFromOpRef(opRef) {
3247
3277
  if (typeof opRef !== "string" || !opRef.startsWith("op://"))
3248
3278
  return null;
@@ -70139,7 +70169,7 @@ async function applyOpImport() {
70139
70169
  }
70140
70170
  process.argv = [...head, ...rebuilt];
70141
70171
  }
70142
- async function loadStoredApiKeys() {
70172
+ async function loadStoredApiKeys(neededEnvVars) {
70143
70173
  let opRefs = {};
70144
70174
  let globImports = [];
70145
70175
  let apiKeysForSeed;
@@ -70171,11 +70201,19 @@ async function loadStoredApiKeys() {
70171
70201
  for (const w of collected.warnings)
70172
70202
  console.error(w);
70173
70203
  } catch {}
70204
+ if (neededEnvVars) {
70205
+ const filteredRefs = {};
70206
+ for (const [envVar, ref] of Object.entries(opRefs)) {
70207
+ if (neededEnvVars.has(envVar))
70208
+ filteredRefs[envVar] = ref;
70209
+ }
70210
+ opRefs = filteredRefs;
70211
+ }
70174
70212
  const refKeys = Object.keys(opRefs);
70175
70213
  if (refKeys.length === 0 && globImports.length === 0)
70176
70214
  return;
70177
70215
  try {
70178
- const { resolveSecrets: resolveSecrets2, resolveGlobImport: resolveGlobImport2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
70216
+ const { resolveSecrets: resolveSecrets2, resolveGlobImport: resolveGlobImport2, resolveGlobImportForEnvVars: resolveGlobImportForEnvVars2 } = await Promise.resolve().then(() => (init_onepassword(), exports_onepassword));
70179
70217
  const auth = await getSdkAuth();
70180
70218
  if (refKeys.length > 0) {
70181
70219
  const resolved = await resolveSecrets2(opRefs, { auth });
@@ -70185,7 +70223,10 @@ async function loadStoredApiKeys() {
70185
70223
  }
70186
70224
  for (const globPath of globImports) {
70187
70225
  try {
70188
- const resolved = await resolveGlobImport2(globPath, {
70226
+ const resolved = neededEnvVars ? await resolveGlobImportForEnvVars2(globPath, neededEnvVars, {
70227
+ auth,
70228
+ warn: () => {}
70229
+ }) : await resolveGlobImport2(globPath, {
70189
70230
  auth,
70190
70231
  warn: () => {}
70191
70232
  });
@@ -70205,7 +70246,7 @@ async function loadStoredApiKeys() {
70205
70246
  process.exit(1);
70206
70247
  }
70207
70248
  }
70208
- async function applyCustomEndpointOpKeys() {
70249
+ async function applyCustomEndpointOpKeys(neededEnvVars) {
70209
70250
  let refs = {};
70210
70251
  try {
70211
70252
  const configPath = join29(homedir27(), ".claudish", "config.json");
@@ -70223,6 +70264,8 @@ async function applyCustomEndpointOpKeys() {
70223
70264
  if (typeof apiKey !== "string" || !isOpReference2(apiKey))
70224
70265
  continue;
70225
70266
  const envVar = `CUSTOM_${name.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_KEY`;
70267
+ if (neededEnvVars && !neededEnvVars.has(envVar))
70268
+ continue;
70226
70269
  if (process.env[envVar])
70227
70270
  continue;
70228
70271
  refs[envVar] = apiKey;
@@ -70245,15 +70288,15 @@ async function applyCustomEndpointOpKeys() {
70245
70288
  process.exit(1);
70246
70289
  }
70247
70290
  }
70248
- var earlyArgv = process.argv.slice(2);
70249
- var hasExplicitOpFlag = earlyArgv.some((a) => a === "--op" || a === "--op-env" || a.startsWith("--op-env="));
70250
- var earlyFirst = earlyArgv.find((a) => !a.startsWith("-"));
70251
- var isNoSecretCommand = !hasExplicitOpFlag && (earlyArgv.includes("--help") || earlyArgv.includes("-h") || earlyArgv.includes("--help-ai") || earlyArgv.includes("--version") || earlyArgv.includes("-v") || earlyFirst === "help" || earlyFirst === "version");
70252
- if (!isNoSecretCommand) {
70253
- await applyOpEnvironment();
70254
- await applyOpImport();
70255
- await loadStoredApiKeys();
70256
- await applyCustomEndpointOpKeys();
70291
+ await applyOpEnvironment();
70292
+ await applyOpImport();
70293
+ var opHydrated = false;
70294
+ async function hydrateOpSecrets(neededEnvVars) {
70295
+ if (opHydrated)
70296
+ return;
70297
+ opHydrated = true;
70298
+ await loadStoredApiKeys(neededEnvVars);
70299
+ await applyCustomEndpointOpKeys(neededEnvVars);
70257
70300
  }
70258
70301
  var isMcpMode = process.argv.includes("--mcp");
70259
70302
  function handlePromptExit(err) {
@@ -70281,13 +70324,13 @@ var isLegacyGeminiLogout = args.includes("--gemini-logout");
70281
70324
  var isLegacyKimiLogin = args.includes("--kimi-login");
70282
70325
  var isLegacyKimiLogout = args.includes("--kimi-logout");
70283
70326
  if (isMcpMode) {
70284
- Promise.resolve().then(() => (init_mcp_server(), exports_mcp_server)).then((mcp) => mcp.startMcpServer());
70327
+ hydrateOpSecrets().then(() => Promise.resolve().then(() => (init_mcp_server(), exports_mcp_server)).then((mcp) => mcp.startMcpServer()));
70285
70328
  } else if (isServeCommand) {
70286
70329
  const serveArgIndex = args.indexOf("serve");
70287
- Promise.resolve().then(() => (init_serve_command(), exports_serve_command)).then((m) => m.serveCommand(args.slice(serveArgIndex + 1)).catch((e) => {
70330
+ hydrateOpSecrets().then(() => Promise.resolve().then(() => (init_serve_command(), exports_serve_command)).then((m) => m.serveCommand(args.slice(serveArgIndex + 1)).catch((e) => {
70288
70331
  console.error(`[claudish serve] ${e instanceof Error ? e.message : String(e)}`);
70289
70332
  process.exit(1);
70290
- }));
70333
+ })));
70291
70334
  } else if (isProvidersCommand) {
70292
70335
  const json2 = args.includes("--json");
70293
70336
  Promise.resolve().then(() => (init_providers_command(), exports_providers_command)).then((m) => m.providersCommand({ json: json2 }).catch((e) => {
@@ -70494,7 +70537,12 @@ Team Status`);
70494
70537
  cliConfig.modelHaiku,
70495
70538
  cliConfig.modelSubagent
70496
70539
  ];
70497
- const resolutions = validateApiKeysForModels2(modelsToValidate);
70540
+ let resolutions = validateApiKeysForModels2(modelsToValidate);
70541
+ const neededEnvVars = new Set(getMissingKeyResolutions2(resolutions).map((r) => r.requiredApiKeyEnvVar).filter((v) => typeof v === "string" && v.length > 0));
70542
+ if (neededEnvVars.size > 0) {
70543
+ await hydrateOpSecrets(neededEnvVars);
70544
+ resolutions = validateApiKeysForModels2(modelsToValidate);
70545
+ }
70498
70546
  const missingKeys = getMissingKeyResolutions2(resolutions);
70499
70547
  if (missingKeys.length > 0) {
70500
70548
  if (cliConfig.interactive) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "7.7.2",
3
+ "version": "7.7.4",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "ai"
61
61
  ],
62
62
  "optionalDependencies": {
63
- "@claudish/magmux-darwin-arm64": "7.7.2",
64
- "@claudish/magmux-darwin-x64": "7.7.2",
65
- "@claudish/magmux-linux-arm64": "7.7.2",
66
- "@claudish/magmux-linux-x64": "7.7.2"
63
+ "@claudish/magmux-darwin-arm64": "7.7.4",
64
+ "@claudish/magmux-darwin-x64": "7.7.4",
65
+ "@claudish/magmux-linux-arm64": "7.7.4",
66
+ "@claudish/magmux-linux-x64": "7.7.4"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",