cc-hub-cli 1.0.7 → 1.0.9

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 +41 -42
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command as Command6 } from "commander";
5
+ import { createRequire } from "module";
5
6
 
6
7
  // src/profiles.ts
7
8
  import { Command as Command2 } from "commander";
@@ -439,8 +440,8 @@ function formatModels(p) {
439
440
  p.models.forEach((m, i) => {
440
441
  if (!isAnthropicModel(m)) {
441
442
  const aliasIndex = nonAnthropicModels.indexOf(m);
442
- if (aliasIndex === 0) parts.push(`${m} (opus)`);
443
- else if (aliasIndex === 1) parts.push(`${m} (sonnet)`);
443
+ if (aliasIndex === 0) parts.push(`${m} (sonnet)`);
444
+ else if (aliasIndex === 1) parts.push(`${m} (opus)`);
444
445
  else if (aliasIndex === 2) parts.push(`${m} (haiku)`);
445
446
  else parts.push(m);
446
447
  } else {
@@ -466,18 +467,13 @@ function updateSettingsForProfile(p) {
466
467
  ensureSettingsFile();
467
468
  const settings = readJson(SETTINGS_FILE);
468
469
  const models = p.models || (p.model ? [p.model] : []);
469
- const nonAnthropicModels = models.filter((m) => !isAnthropicModel(m));
470
470
  if (models.length > 0) {
471
- settings.model = models[0];
472
- if (nonAnthropicModels.length > 0) {
473
- const aliases = [];
474
- if (nonAnthropicModels[0]) aliases.push("opus");
475
- if (nonAnthropicModels[1]) aliases.push("sonnet");
476
- if (nonAnthropicModels[2]) aliases.push("haiku");
477
- settings.availableModels = aliases;
478
- } else {
479
- settings.availableModels = models;
480
- }
471
+ const aliases = [];
472
+ if (models[0]) aliases.push("sonnet");
473
+ if (models[1]) aliases.push("opus");
474
+ if (models[2]) aliases.push("haiku");
475
+ settings.model = aliases[0];
476
+ settings.availableModels = aliases;
481
477
  } else {
482
478
  delete settings.model;
483
479
  delete settings.availableModels;
@@ -648,8 +644,8 @@ function profileCommand() {
648
644
  if (!isAnthropicModel(m)) {
649
645
  const aliasIndex = nonAnthropicModels.indexOf(m);
650
646
  let alias = "";
651
- if (aliasIndex === 0) alias = " (opus)";
652
- else if (aliasIndex === 1) alias = " (sonnet)";
647
+ if (aliasIndex === 0) alias = " (sonnet)";
648
+ else if (aliasIndex === 1) alias = " (opus)";
653
649
  else if (aliasIndex === 2) alias = " (haiku)";
654
650
  console.log(` - ${m}${alias}`);
655
651
  } else {
@@ -699,26 +695,27 @@ function execClaude(profileName, p, extraArgs) {
699
695
  const env = {
700
696
  ...process.env,
701
697
  ANTHROPIC_AUTH_TOKEN: p.token || void 0,
702
- ANTHROPIC_BASE_URL: p.url || void 0
698
+ ANTHROPIC_BASE_URL: p.url || void 0,
699
+ CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1",
700
+ CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1"
703
701
  };
704
- const nonAnthropicModels = models.filter((m) => !isAnthropicModel(m));
705
- if (nonAnthropicModels.length > 0) {
706
- if (nonAnthropicModels[0]) {
707
- env.ANTHROPIC_DEFAULT_OPUS_MODEL = nonAnthropicModels[0];
708
- env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME = nonAnthropicModels[0];
709
- env.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION = `Custom: ${nonAnthropicModels[0]}`;
710
- }
711
- if (nonAnthropicModels[1]) {
712
- env.ANTHROPIC_DEFAULT_SONNET_MODEL = nonAnthropicModels[1];
713
- env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME = nonAnthropicModels[1];
714
- env.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION = `Custom: ${nonAnthropicModels[1]}`;
715
- }
716
- if (nonAnthropicModels[2]) {
717
- env.ANTHROPIC_DEFAULT_HAIKU_MODEL = nonAnthropicModels[2];
718
- env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME = nonAnthropicModels[2];
719
- env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION = `Custom: ${nonAnthropicModels[2]}`;
720
- }
721
- env.ANTHROPIC_CUSTOM_MODEL_OPTION = nonAnthropicModels[0];
702
+ if (models.length > 0) {
703
+ if (models[0]) {
704
+ env.ANTHROPIC_DEFAULT_SONNET_MODEL = models[0];
705
+ env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME = models[0];
706
+ env.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION = `Custom: ${models[0]}`;
707
+ }
708
+ if (models[1]) {
709
+ env.ANTHROPIC_DEFAULT_OPUS_MODEL = models[1];
710
+ env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME = models[1];
711
+ env.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION = `Custom: ${models[1]}`;
712
+ }
713
+ if (models[2]) {
714
+ env.ANTHROPIC_DEFAULT_HAIKU_MODEL = models[2];
715
+ env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME = models[2];
716
+ env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION = `Custom: ${models[2]}`;
717
+ }
718
+ env.ANTHROPIC_CUSTOM_MODEL_OPTION = models[0];
722
719
  }
723
720
  delete env.ANTHROPIC_API_KEY;
724
721
  console.error(`Using profile '${profileName}': model=${firstModel || "(default)"} url=${p.url || "(default)"} provider=${p.provider || "anthropic"}`);
@@ -908,17 +905,18 @@ function hooksCommand() {
908
905
  }
909
906
  const hooksRoot = data.hooks || (data.hooks = {});
910
907
  const pool = data._cc_hub_disabled;
911
- const seqsToEnable = new Set(targets.map((t) => rows[t].seq));
908
+ const diToTarget = new Map(targets.map((t) => [rows[t].di, t]));
912
909
  const remaining = [];
913
910
  const toRestore = [];
914
- for (const entry of pool) {
915
- if (seqsToEnable.has(entry._seq || 0)) {
916
- toRestore.push(entry);
911
+ for (let di = 0; di < pool.length; di++) {
912
+ const t = diToTarget.get(di);
913
+ if (t !== void 0) {
914
+ toRestore.push({ entry: pool[di], t });
917
915
  } else {
918
- remaining.push(entry);
916
+ remaining.push(pool[di]);
919
917
  }
920
918
  }
921
- for (const entry of toRestore) {
919
+ for (const { entry, t } of toRestore) {
922
920
  const event = entry.event;
923
921
  const matcher = entry.matcher || "";
924
922
  const hook = { type: entry.type, command: entry.command, _seq: entry._seq, ...entry.async ? { async: true } : {} };
@@ -930,7 +928,6 @@ function hooksCommand() {
930
928
  groups.push(grp);
931
929
  }
932
930
  grp.hooks.push(hook);
933
- const t = rows.findIndex((r) => r.seq === entry._seq);
934
931
  console.log(`Hook ${t} (${event}) enabled.`);
935
932
  }
936
933
  data._cc_hub_disabled = remaining;
@@ -1602,8 +1599,10 @@ function completeCommand() {
1602
1599
  }
1603
1600
 
1604
1601
  // src/index.ts
1602
+ var _require = createRequire(import.meta.url);
1603
+ var { version } = _require("../package.json");
1605
1604
  var program = new Command6();
1606
- program.name("cc-hub").description("Manage Claude CLI profiles, hooks, and sessions").version("1.0.0");
1605
+ program.name("cc-hub").description("Manage Claude CLI profiles, hooks, and sessions").version(version);
1607
1606
  program.addCommand(profileCommand());
1608
1607
  program.addCommand(useCommand());
1609
1608
  program.addCommand(runCommand());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hub-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Manage Claude CLI profiles, hooks, and sessions",
5
5
  "type": "module",
6
6
  "bin": {