hyperclaw 5.1.0 → 5.1.1

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/run-main.js +43 -6
  2. package/package.json +1 -1
package/dist/run-main.js CHANGED
@@ -2878,12 +2878,49 @@ cfgCmd.command("show").description("Show current configuration (scrubbed)").acti
2878
2878
  console.log("\n" + JSON.stringify(scrubbed, null, 2) + "\n");
2879
2879
  process.exit(0);
2880
2880
  });
2881
- cfgCmd.command("set-key <KEY=value>").description("Set an API key or config value").action(async (kv) => {
2882
- const [key, ...rest] = kv.split("=");
2883
- const value = rest.join("=");
2884
- const store = new AuthStore();
2885
- store.setProviderKey(key, value);
2886
- console.log(chalk.default.hex("#06b6d4")(`\n ✔ Set ${key}\n`));
2881
+ cfgCmd.command("set-key <KEY=value>").description("Set provider API key or config value.\n Examples:\n hyperclaw config set-key GOOGLE_AI_API_KEY=AIza...\n hyperclaw config set-key anthropic=sk-ant-...\n hyperclaw config set-key OPENROUTER_API_KEY=sk-or-...").action(async (kv) => {
2882
+ const eqIdx = kv.indexOf("=");
2883
+ if (eqIdx === -1) {
2884
+ console.log(chalk.default.red("\n Usage: hyperclaw config set-key KEY=value\n"));
2885
+ console.log(chalk.default.gray(" Example: hyperclaw config set-key GOOGLE_AI_API_KEY=AIza...\n"));
2886
+ process.exit(1);
2887
+ }
2888
+ const key = kv.slice(0, eqIdx).trim();
2889
+ const value = kv.slice(eqIdx + 1).trim();
2890
+ if (!value) {
2891
+ console.log(chalk.default.red("\n Value cannot be empty.\n"));
2892
+ process.exit(1);
2893
+ }
2894
+ const PROVIDER_KEY_NAMES = new Set([
2895
+ "GOOGLE_AI_API_KEY",
2896
+ "ANTHROPIC_API_KEY",
2897
+ "OPENROUTER_API_KEY",
2898
+ "OPENAI_API_KEY",
2899
+ "XAI_API_KEY",
2900
+ "google",
2901
+ "anthropic",
2902
+ "openrouter",
2903
+ "openai",
2904
+ "xai"
2905
+ ]);
2906
+ const config = new require_manager.ConfigManager();
2907
+ const cfg = await config.load();
2908
+ if (PROVIDER_KEY_NAMES.has(key) || key === cfg?.provider?.providerId) {
2909
+ const next = {
2910
+ ...cfg,
2911
+ provider: {
2912
+ ...cfg?.provider || {},
2913
+ apiKey: value
2914
+ }
2915
+ };
2916
+ await config.save(next);
2917
+ console.log(chalk.default.hex("#06b6d4")(`\n ✔ Provider API key saved to config.\n`));
2918
+ console.log(chalk.default.gray(" Run: hyperclaw chat — to use the updated key.\n"));
2919
+ } else {
2920
+ const store = new AuthStore();
2921
+ store.setProviderKey(key, value);
2922
+ console.log(chalk.default.hex("#06b6d4")(`\n ✔ Set ${key}\n`));
2923
+ }
2887
2924
  process.exit(0);
2888
2925
  });
2889
2926
  cfgCmd.command("set-service-key <serviceId> [apiKey]").description("Set API key for a service (hackerone, bugcrowd, synack, or custom). Prompts if apiKey omitted.").action(async (serviceId, apiKey) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperclaw",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "⚡ HyperClaw — AI Gateway Platform. The Lobster Evolution 🦅",
5
5
  "main": "dist/run-main.js",
6
6
  "bin": {