cskit-cli 1.0.44 → 1.0.50
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/package.json +1 -1
- package/src/commands/init.js +44 -5
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -609,14 +609,32 @@ async function initCommand(options) {
|
|
|
609
609
|
|
|
610
610
|
timeline.complete(5, `${applied} files`);
|
|
611
611
|
|
|
612
|
-
// Create .env from .env.example if not exists
|
|
612
|
+
// Create .env from .env.example if not exists, or detect new variables
|
|
613
613
|
const envPath = path.join(projectDir, '.claude', '.env');
|
|
614
614
|
const envExamplePath = path.join(projectDir, '.claude', '.env.example');
|
|
615
615
|
let envCreated = false;
|
|
616
|
+
let newEnvVars = [];
|
|
616
617
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
// Helper to extract variable names from env file content
|
|
619
|
+
const extractEnvVars = (content) => {
|
|
620
|
+
return content.split('\n')
|
|
621
|
+
.filter(line => /^[A-Z_][A-Z0-9_]*=/.test(line.trim()))
|
|
622
|
+
.map(line => line.trim().split('=')[0]);
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
if (fs.existsSync(envExamplePath)) {
|
|
626
|
+
if (!fs.existsSync(envPath)) {
|
|
627
|
+
// No .env exists - create from template
|
|
628
|
+
fs.copyFileSync(envExamplePath, envPath);
|
|
629
|
+
envCreated = true;
|
|
630
|
+
} else {
|
|
631
|
+
// .env exists - check for new variables
|
|
632
|
+
const exampleContent = fs.readFileSync(envExamplePath, 'utf8');
|
|
633
|
+
const envContent = fs.readFileSync(envPath, 'utf8');
|
|
634
|
+
const exampleVars = extractEnvVars(exampleContent);
|
|
635
|
+
const envVars = extractEnvVars(envContent);
|
|
636
|
+
newEnvVars = exampleVars.filter(v => !envVars.includes(v));
|
|
637
|
+
}
|
|
620
638
|
}
|
|
621
639
|
|
|
622
640
|
// Step 7: Check dependencies
|
|
@@ -640,6 +658,13 @@ async function initCommand(options) {
|
|
|
640
658
|
console.log(chalk.dim(' Edit .claude/.env and set:'));
|
|
641
659
|
console.log(` ${chalk.white('CSK_OUTPUT_DIR')} - Output folder for reports`);
|
|
642
660
|
console.log(` ${chalk.white('GEMINI_API_KEY')} - For AI features (optional)\n`);
|
|
661
|
+
} else if (newEnvVars.length > 0) {
|
|
662
|
+
console.log(chalk.yellow(' ⚠ New config variables available:\n'));
|
|
663
|
+
console.log(chalk.dim(' Add to .claude/.env:'));
|
|
664
|
+
for (const v of newEnvVars) {
|
|
665
|
+
console.log(` ${chalk.white(v)}`);
|
|
666
|
+
}
|
|
667
|
+
console.log(chalk.dim('\n See .claude/.env.example for details.\n'));
|
|
643
668
|
}
|
|
644
669
|
|
|
645
670
|
console.log(chalk.cyan(' Quick Start\n'));
|
|
@@ -725,6 +750,13 @@ async function initCommand(options) {
|
|
|
725
750
|
console.log(chalk.dim(' Edit .claude/.env and set:'));
|
|
726
751
|
console.log(` ${chalk.white('CSK_OUTPUT_DIR')} - Output folder for reports`);
|
|
727
752
|
console.log(` ${chalk.white('GEMINI_API_KEY')} - For AI features (optional)\n`);
|
|
753
|
+
} else if (newEnvVars.length > 0) {
|
|
754
|
+
console.log(chalk.yellow(' ⚠ New config variables available:\n'));
|
|
755
|
+
console.log(chalk.dim(' Add to .claude/.env:'));
|
|
756
|
+
for (const v of newEnvVars) {
|
|
757
|
+
console.log(` ${chalk.white(v)}`);
|
|
758
|
+
}
|
|
759
|
+
console.log(chalk.dim('\n See .claude/.env.example for details.\n'));
|
|
728
760
|
}
|
|
729
761
|
return;
|
|
730
762
|
}
|
|
@@ -783,12 +815,19 @@ async function initCommand(options) {
|
|
|
783
815
|
const ver = selectedVersion.replace(/^v/, '');
|
|
784
816
|
console.log(chalk.green(`\n ✓ CSK v${ver} ${isUpdate ? 'updated' : 'installed'} successfully!\n`));
|
|
785
817
|
|
|
786
|
-
// Show .env reminder if created
|
|
818
|
+
// Show .env reminder if created or new vars available
|
|
787
819
|
if (envCreated) {
|
|
788
820
|
console.log(chalk.yellow(' ⚠ Configuration needed:\n'));
|
|
789
821
|
console.log(chalk.dim(' Edit .claude/.env and set:'));
|
|
790
822
|
console.log(` ${chalk.white('CSK_OUTPUT_DIR')} - Output folder for reports`);
|
|
791
823
|
console.log(` ${chalk.white('GEMINI_API_KEY')} - For AI features (optional)\n`);
|
|
824
|
+
} else if (newEnvVars.length > 0) {
|
|
825
|
+
console.log(chalk.yellow(' ⚠ New config variables available:\n'));
|
|
826
|
+
console.log(chalk.dim(' Add to .claude/.env:'));
|
|
827
|
+
for (const v of newEnvVars) {
|
|
828
|
+
console.log(` ${chalk.white(v)}`);
|
|
829
|
+
}
|
|
830
|
+
console.log(chalk.dim('\n See .claude/.env.example for details.\n'));
|
|
792
831
|
}
|
|
793
832
|
|
|
794
833
|
console.log(chalk.cyan(' Quick Start\n'));
|