cc-hub-cli 1.0.8 → 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.
- package/dist/index.js +34 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -440,8 +440,8 @@ function formatModels(p) {
|
|
|
440
440
|
p.models.forEach((m, i) => {
|
|
441
441
|
if (!isAnthropicModel(m)) {
|
|
442
442
|
const aliasIndex = nonAnthropicModels.indexOf(m);
|
|
443
|
-
if (aliasIndex === 0) parts.push(`${m} (
|
|
444
|
-
else if (aliasIndex === 1) parts.push(`${m} (
|
|
443
|
+
if (aliasIndex === 0) parts.push(`${m} (sonnet)`);
|
|
444
|
+
else if (aliasIndex === 1) parts.push(`${m} (opus)`);
|
|
445
445
|
else if (aliasIndex === 2) parts.push(`${m} (haiku)`);
|
|
446
446
|
else parts.push(m);
|
|
447
447
|
} else {
|
|
@@ -467,18 +467,13 @@ function updateSettingsForProfile(p) {
|
|
|
467
467
|
ensureSettingsFile();
|
|
468
468
|
const settings = readJson(SETTINGS_FILE);
|
|
469
469
|
const models = p.models || (p.model ? [p.model] : []);
|
|
470
|
-
const nonAnthropicModels = models.filter((m) => !isAnthropicModel(m));
|
|
471
470
|
if (models.length > 0) {
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
settings.availableModels = aliases;
|
|
479
|
-
} else {
|
|
480
|
-
settings.availableModels = models;
|
|
481
|
-
}
|
|
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;
|
|
482
477
|
} else {
|
|
483
478
|
delete settings.model;
|
|
484
479
|
delete settings.availableModels;
|
|
@@ -649,8 +644,8 @@ function profileCommand() {
|
|
|
649
644
|
if (!isAnthropicModel(m)) {
|
|
650
645
|
const aliasIndex = nonAnthropicModels.indexOf(m);
|
|
651
646
|
let alias = "";
|
|
652
|
-
if (aliasIndex === 0) alias = " (
|
|
653
|
-
else if (aliasIndex === 1) alias = " (
|
|
647
|
+
if (aliasIndex === 0) alias = " (sonnet)";
|
|
648
|
+
else if (aliasIndex === 1) alias = " (opus)";
|
|
654
649
|
else if (aliasIndex === 2) alias = " (haiku)";
|
|
655
650
|
console.log(` - ${m}${alias}`);
|
|
656
651
|
} else {
|
|
@@ -704,24 +699,23 @@ function execClaude(profileName, p, extraArgs) {
|
|
|
704
699
|
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: "1",
|
|
705
700
|
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1"
|
|
706
701
|
};
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
env.
|
|
711
|
-
env.
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
env.
|
|
716
|
-
env.
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
env.
|
|
721
|
-
env.
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
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];
|
|
725
719
|
}
|
|
726
720
|
delete env.ANTHROPIC_API_KEY;
|
|
727
721
|
console.error(`Using profile '${profileName}': model=${firstModel || "(default)"} url=${p.url || "(default)"} provider=${p.provider || "anthropic"}`);
|
|
@@ -911,17 +905,18 @@ function hooksCommand() {
|
|
|
911
905
|
}
|
|
912
906
|
const hooksRoot = data.hooks || (data.hooks = {});
|
|
913
907
|
const pool = data._cc_hub_disabled;
|
|
914
|
-
const
|
|
908
|
+
const diToTarget = new Map(targets.map((t) => [rows[t].di, t]));
|
|
915
909
|
const remaining = [];
|
|
916
910
|
const toRestore = [];
|
|
917
|
-
for (
|
|
918
|
-
|
|
919
|
-
|
|
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 });
|
|
920
915
|
} else {
|
|
921
|
-
remaining.push(
|
|
916
|
+
remaining.push(pool[di]);
|
|
922
917
|
}
|
|
923
918
|
}
|
|
924
|
-
for (const entry of toRestore) {
|
|
919
|
+
for (const { entry, t } of toRestore) {
|
|
925
920
|
const event = entry.event;
|
|
926
921
|
const matcher = entry.matcher || "";
|
|
927
922
|
const hook = { type: entry.type, command: entry.command, _seq: entry._seq, ...entry.async ? { async: true } : {} };
|
|
@@ -933,7 +928,6 @@ function hooksCommand() {
|
|
|
933
928
|
groups.push(grp);
|
|
934
929
|
}
|
|
935
930
|
grp.hooks.push(hook);
|
|
936
|
-
const t = rows.findIndex((r) => r.seq === entry._seq);
|
|
937
931
|
console.log(`Hook ${t} (${event}) enabled.`);
|
|
938
932
|
}
|
|
939
933
|
data._cc_hub_disabled = remaining;
|