claudekit-cli 3.14.0 → 3.15.0
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 +85 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34480,10 +34480,40 @@ async function generateEnvFile(targetDir, values) {
|
|
|
34480
34480
|
"# See .env.example for all available options",
|
|
34481
34481
|
""
|
|
34482
34482
|
];
|
|
34483
|
+
const geminiKeys = [];
|
|
34484
|
+
const otherValues = [];
|
|
34483
34485
|
for (const [key, value] of Object.entries(values)) {
|
|
34484
34486
|
if (value) {
|
|
34487
|
+
if (key.startsWith("GEMINI_API_KEY")) {
|
|
34488
|
+
geminiKeys.push([key, value]);
|
|
34489
|
+
} else {
|
|
34490
|
+
otherValues.push([key, value]);
|
|
34491
|
+
}
|
|
34492
|
+
}
|
|
34493
|
+
}
|
|
34494
|
+
if (geminiKeys.length > 0) {
|
|
34495
|
+
if (geminiKeys.length > 1) {
|
|
34496
|
+
lines.push("# Gemini API Keys (rotation enabled)");
|
|
34497
|
+
lines.push("# Keys auto-rotate on rate limit (429/RESOURCE_EXHAUSTED)");
|
|
34498
|
+
}
|
|
34499
|
+
geminiKeys.sort((a3, b3) => {
|
|
34500
|
+
const getKeyNumber = (key) => {
|
|
34501
|
+
if (key === "GEMINI_API_KEY")
|
|
34502
|
+
return 1;
|
|
34503
|
+
const match2 = key.match(/^GEMINI_API_KEY_(\d+)$/);
|
|
34504
|
+
return match2 ? Number.parseInt(match2[1], 10) : 999;
|
|
34505
|
+
};
|
|
34506
|
+
return getKeyNumber(a3[0]) - getKeyNumber(b3[0]);
|
|
34507
|
+
});
|
|
34508
|
+
for (const [key, value] of geminiKeys) {
|
|
34485
34509
|
lines.push(`${key}=${value}`);
|
|
34486
34510
|
}
|
|
34511
|
+
if (otherValues.length > 0) {
|
|
34512
|
+
lines.push("");
|
|
34513
|
+
}
|
|
34514
|
+
}
|
|
34515
|
+
for (const [key, value] of otherValues) {
|
|
34516
|
+
lines.push(`${key}=${value}`);
|
|
34487
34517
|
}
|
|
34488
34518
|
const envPath = join53(targetDir, ".env");
|
|
34489
34519
|
await import_fs_extra25.writeFile(envPath, `${lines.join(`
|
|
@@ -34627,10 +34657,64 @@ async function runSetupWizard(options) {
|
|
|
34627
34657
|
values[config.key] = result;
|
|
34628
34658
|
}
|
|
34629
34659
|
}
|
|
34660
|
+
if (values.GEMINI_API_KEY) {
|
|
34661
|
+
const additionalKeys = await promptForAdditionalGeminiKeys(values.GEMINI_API_KEY);
|
|
34662
|
+
for (let i = 0;i < additionalKeys.length; i++) {
|
|
34663
|
+
values[`GEMINI_API_KEY_${i + 2}`] = additionalKeys[i];
|
|
34664
|
+
}
|
|
34665
|
+
const totalKeys = 1 + additionalKeys.length;
|
|
34666
|
+
if (totalKeys > 1) {
|
|
34667
|
+
f2.success(`✓ Configured ${totalKeys} Gemini API keys for rotation`);
|
|
34668
|
+
}
|
|
34669
|
+
}
|
|
34630
34670
|
await generateEnvFile(targetDir, values);
|
|
34631
34671
|
f2.success(`Configuration saved to ${join54(targetDir, ".env")}`);
|
|
34632
34672
|
return true;
|
|
34633
34673
|
}
|
|
34674
|
+
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
34675
|
+
const additionalKeys = [];
|
|
34676
|
+
const allKeys = new Set([primaryKey]);
|
|
34677
|
+
const wantMore = await se({
|
|
34678
|
+
message: "Add additional API keys for rotation? (recommended for high usage)",
|
|
34679
|
+
initialValue: false
|
|
34680
|
+
});
|
|
34681
|
+
if (lD(wantMore) || !wantMore) {
|
|
34682
|
+
return additionalKeys;
|
|
34683
|
+
}
|
|
34684
|
+
let keyNumber = 2;
|
|
34685
|
+
const maxKeys = 10;
|
|
34686
|
+
while (keyNumber <= maxKeys) {
|
|
34687
|
+
const result = await te({
|
|
34688
|
+
message: `Gemini API Key #${keyNumber} (press Enter to finish)`,
|
|
34689
|
+
placeholder: "AIza... or leave empty to finish",
|
|
34690
|
+
validate: (value) => {
|
|
34691
|
+
if (!value)
|
|
34692
|
+
return;
|
|
34693
|
+
const trimmed = value.trim();
|
|
34694
|
+
if (!trimmed)
|
|
34695
|
+
return;
|
|
34696
|
+
if (!validateApiKey(trimmed, VALIDATION_PATTERNS.GEMINI_API_KEY)) {
|
|
34697
|
+
return "Invalid format. Gemini keys start with 'AIza' and are 39 characters.";
|
|
34698
|
+
}
|
|
34699
|
+
if (allKeys.has(trimmed)) {
|
|
34700
|
+
return "This key was already added. Please enter a different key.";
|
|
34701
|
+
}
|
|
34702
|
+
return;
|
|
34703
|
+
}
|
|
34704
|
+
});
|
|
34705
|
+
if (lD(result)) {
|
|
34706
|
+
break;
|
|
34707
|
+
}
|
|
34708
|
+
if (!result || result.trim() === "") {
|
|
34709
|
+
break;
|
|
34710
|
+
}
|
|
34711
|
+
const trimmedKey = result.trim();
|
|
34712
|
+
additionalKeys.push(trimmedKey);
|
|
34713
|
+
allKeys.add(trimmedKey);
|
|
34714
|
+
keyNumber++;
|
|
34715
|
+
}
|
|
34716
|
+
return additionalKeys;
|
|
34717
|
+
}
|
|
34634
34718
|
|
|
34635
34719
|
// src/commands/init/phases/post-install-handler.ts
|
|
34636
34720
|
init_logger();
|
|
@@ -36419,7 +36503,7 @@ var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
|
36419
36503
|
// package.json
|
|
36420
36504
|
var package_default = {
|
|
36421
36505
|
name: "claudekit-cli",
|
|
36422
|
-
version: "3.
|
|
36506
|
+
version: "3.15.0",
|
|
36423
36507
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
36424
36508
|
type: "module",
|
|
36425
36509
|
repository: {
|