cc-hub-cli 1.0.9 → 1.0.10
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 +29 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -570,34 +570,6 @@ function profileCommand() {
|
|
|
570
570
|
writeJson(PROFILES_FILE, data);
|
|
571
571
|
console.log(`Profile '${name}' updated.`);
|
|
572
572
|
});
|
|
573
|
-
profile.command("remove-model").description("Remove specific models from a profile").argument("<name>", "Profile name").option("-m, --model <model>", "Model ID to remove - can be used multiple times", collect, []).action((name, opts) => {
|
|
574
|
-
ensureProfilesFile();
|
|
575
|
-
const data = readJson(PROFILES_FILE);
|
|
576
|
-
if (!data.profiles[name]) {
|
|
577
|
-
console.error(`Profile '${name}' not found.`);
|
|
578
|
-
process.exit(1);
|
|
579
|
-
}
|
|
580
|
-
const p = data.profiles[name];
|
|
581
|
-
const toRemove = new Set(opts.model);
|
|
582
|
-
if (toRemove.size === 0) {
|
|
583
|
-
console.error("No models specified to remove. Use -m <model> to specify models.");
|
|
584
|
-
process.exit(1);
|
|
585
|
-
}
|
|
586
|
-
const currentModels = p.models || (p.model ? [p.model] : []);
|
|
587
|
-
const newModels = currentModels.filter((m) => !toRemove.has(m));
|
|
588
|
-
if (newModels.length === 0) {
|
|
589
|
-
delete p.models;
|
|
590
|
-
delete p.model;
|
|
591
|
-
console.log(`Removed all models from profile '${name}'.`);
|
|
592
|
-
} else {
|
|
593
|
-
const removedCount = currentModels.length - newModels.length;
|
|
594
|
-
p.models = newModels;
|
|
595
|
-
p.model = newModels[0];
|
|
596
|
-
console.log(`Removed ${removedCount} model(s) from profile '${name}'.`);
|
|
597
|
-
console.log(`Remaining models: ${newModels.join(", ")}`);
|
|
598
|
-
}
|
|
599
|
-
writeJson(PROFILES_FILE, data);
|
|
600
|
-
});
|
|
601
573
|
profile.command("list").description("List all profiles").action(() => {
|
|
602
574
|
ensureProfilesFile();
|
|
603
575
|
const data = readJson(PROFILES_FILE);
|
|
@@ -669,6 +641,25 @@ function profileCommand() {
|
|
|
669
641
|
writeJson(PROFILES_FILE, data);
|
|
670
642
|
console.log(`Profile '${name}' removed.`);
|
|
671
643
|
});
|
|
644
|
+
profile.command("rename").description("Rename a profile").argument("<oldName>", "Current profile name").argument("<newName>", "New profile name").action((oldName, newName) => {
|
|
645
|
+
ensureProfilesFile();
|
|
646
|
+
const data = readJson(PROFILES_FILE);
|
|
647
|
+
if (!data.profiles[oldName]) {
|
|
648
|
+
console.error(`Profile '${oldName}' not found.`);
|
|
649
|
+
process.exit(1);
|
|
650
|
+
}
|
|
651
|
+
if (data.profiles[newName]) {
|
|
652
|
+
console.error(`Profile '${newName}' already exists. Choose a different name.`);
|
|
653
|
+
process.exit(1);
|
|
654
|
+
}
|
|
655
|
+
data.profiles[newName] = data.profiles[oldName];
|
|
656
|
+
delete data.profiles[oldName];
|
|
657
|
+
if (data.default === oldName) {
|
|
658
|
+
data.default = newName;
|
|
659
|
+
}
|
|
660
|
+
writeJson(PROFILES_FILE, data);
|
|
661
|
+
console.log(`Profile '${oldName}' renamed to '${newName}'.`);
|
|
662
|
+
});
|
|
672
663
|
profile.command("default").description("Set the default profile").argument("<name>", "Profile name to set as default").action((name) => {
|
|
673
664
|
ensureProfilesFile();
|
|
674
665
|
const data = readJson(PROFILES_FILE);
|
|
@@ -1376,10 +1367,10 @@ _cc-hub() {
|
|
|
1376
1367
|
profile_subcmds=(
|
|
1377
1368
|
'add:Add or update a profile'
|
|
1378
1369
|
'update:Update fields of an existing profile'
|
|
1379
|
-
'remove-model:Remove specific models from a profile'
|
|
1380
1370
|
'list:List all profiles'
|
|
1381
1371
|
'view:View full details of a profile'
|
|
1382
1372
|
'remove:Remove a profile'
|
|
1373
|
+
'rename:Rename a profile'
|
|
1383
1374
|
'default:Set the default profile'
|
|
1384
1375
|
)
|
|
1385
1376
|
|
|
@@ -1434,8 +1425,12 @@ _cc-hub() {
|
|
|
1434
1425
|
profile)
|
|
1435
1426
|
if (( CURRENT == 2 )); then
|
|
1436
1427
|
_describe -t profile-subcmds 'profile subcommand' profile_subcmds
|
|
1437
|
-
elif [[ $words[2] == "view" || $words[2] == "remove" || $words[2] == "default"
|
|
1428
|
+
elif [[ $words[2] == "view" || $words[2] == "remove" || $words[2] == "default" ]]; then
|
|
1438
1429
|
_cc_hub_profiles
|
|
1430
|
+
elif [[ $words[2] == "rename" ]]; then
|
|
1431
|
+
if (( CURRENT == 3 )); then
|
|
1432
|
+
_cc_hub_profiles
|
|
1433
|
+
fi
|
|
1439
1434
|
elif [[ $words[2] == "update" ]]; then
|
|
1440
1435
|
if (( CURRENT == 3 )); then
|
|
1441
1436
|
_cc_hub_profiles
|
|
@@ -1520,7 +1515,7 @@ _cc-hub() {
|
|
|
1520
1515
|
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
1521
1516
|
commands="profile use run hook session provider complete help"
|
|
1522
1517
|
|
|
1523
|
-
local profile_subcmds="add update
|
|
1518
|
+
local profile_subcmds="add update list view remove rename default"
|
|
1524
1519
|
local provider_subcmds="list"
|
|
1525
1520
|
local provider_types="anthropic openai"
|
|
1526
1521
|
local hooks_subcmds="list add remove enable disable"
|
|
@@ -1538,7 +1533,9 @@ _cc-hub() {
|
|
|
1538
1533
|
profile)
|
|
1539
1534
|
if [[ \${COMP_CWORD} -eq 2 ]]; then
|
|
1540
1535
|
COMPREPLY=($(compgen -W "$profile_subcmds" -- "$cur"))
|
|
1541
|
-
elif [[ "$prev" == "view" || "$prev" == "remove" || "$prev" == "default"
|
|
1536
|
+
elif [[ "$prev" == "view" || "$prev" == "remove" || "$prev" == "default" ]]; then
|
|
1537
|
+
_cc-hub_profiles
|
|
1538
|
+
elif [[ "$prev" == "rename" ]]; then
|
|
1542
1539
|
_cc-hub_profiles
|
|
1543
1540
|
elif [[ "$prev" == "profile" ]]; then
|
|
1544
1541
|
COMPREPLY=($(compgen -W "$profile_subcmds" -- "$cur"))
|