cskit-cli 1.0.40 → 1.0.41
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 +94 -120
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -377,7 +377,8 @@ async function initCommand(options) {
|
|
|
377
377
|
timeline.addStep('Scan changes');
|
|
378
378
|
timeline.addStep('Confirm changes');
|
|
379
379
|
timeline.addStep('Apply changes');
|
|
380
|
-
timeline.addStep('
|
|
380
|
+
timeline.addStep('Check dependencies');
|
|
381
|
+
timeline.addStep('Install packages');
|
|
381
382
|
|
|
382
383
|
// Step 1: Authenticate
|
|
383
384
|
timeline.start(0);
|
|
@@ -546,6 +547,7 @@ async function initCommand(options) {
|
|
|
546
547
|
timeline.skip(4, 'User cancelled');
|
|
547
548
|
timeline.skip(5, 'Skipped');
|
|
548
549
|
timeline.skip(6, 'Skipped');
|
|
550
|
+
timeline.skip(7, 'Skipped');
|
|
549
551
|
|
|
550
552
|
// Cleanup
|
|
551
553
|
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
@@ -607,111 +609,43 @@ async function initCommand(options) {
|
|
|
607
609
|
|
|
608
610
|
timeline.complete(5, `${applied} files`);
|
|
609
611
|
|
|
610
|
-
// Step 7:
|
|
612
|
+
// Step 7: Check dependencies
|
|
611
613
|
timeline.start(6);
|
|
612
614
|
|
|
613
615
|
const libPythonDir = path.join(projectDir, 'lib', 'python');
|
|
614
616
|
|
|
615
|
-
//
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
timeline.resume();
|
|
636
|
-
|
|
637
|
-
const pkgStatus = checkPythonPackages(libPythonDir);
|
|
638
|
-
|
|
639
|
-
// Show Python version in timeline
|
|
640
|
-
timeline.addChild(6, `Python ${pythonCmd === 'python3' ? pythonInfo.version : '3.x'} (${pythonCmd})`, 'update');
|
|
641
|
-
|
|
642
|
-
// Show already installed count
|
|
643
|
-
if (pkgStatus.installed.length > 0) {
|
|
644
|
-
timeline.addChild(6, `${pkgStatus.installed.length} packages already installed`, 'info');
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
const allToInstall = [...pkgStatus.toInstall, ...pkgStatus.toUpdate];
|
|
648
|
-
|
|
649
|
-
if (allToInstall.length === 0) {
|
|
650
|
-
timeline.complete(6, `${pkgStatus.installed.length} packages ready`);
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
// Show what needs to be installed/updated with tree connector
|
|
655
|
-
console.log(`\n ${pipe}`);
|
|
656
|
-
console.log(` ${branch} ${chalk.cyan('Packages to install/update:')}`);
|
|
657
|
-
|
|
658
|
-
const showPkgs = allToInstall.slice(0, 10);
|
|
659
|
-
const hasMore = allToInstall.length > 10;
|
|
660
|
-
|
|
661
|
-
for (let i = 0; i < showPkgs.length; i++) {
|
|
662
|
-
const pkg = showPkgs[i];
|
|
663
|
-
const isLast = i === showPkgs.length - 1 && !hasMore;
|
|
664
|
-
const prefix = isLast ? corner : branch;
|
|
665
|
-
if (pkg.current) {
|
|
666
|
-
console.log(` ${pipe} ${prefix} ${chalk.blue('~')} ${pkg.name}: ${pkg.current} → ${pkg.required}`);
|
|
667
|
-
} else {
|
|
668
|
-
console.log(` ${pipe} ${prefix} ${chalk.green('+')} ${pkg.name}: ${pkg.required || 'latest'}`);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
if (hasMore) {
|
|
672
|
-
console.log(` ${pipe} ${corner} ${chalk.dim(`... and ${allToInstall.length - 10} more`)}`);
|
|
673
|
-
}
|
|
674
|
-
console.log(` ${pipe}`);
|
|
675
|
-
|
|
676
|
-
timeline.pause();
|
|
677
|
-
const { confirmPkgs } = await inquirer.prompt([{
|
|
678
|
-
type: 'confirm',
|
|
679
|
-
name: 'confirmPkgs',
|
|
680
|
-
message: `Install/update ${allToInstall.length} packages?`,
|
|
681
|
-
default: true
|
|
682
|
-
}]);
|
|
683
|
-
timeline.resume();
|
|
684
|
-
|
|
685
|
-
if (confirmPkgs) {
|
|
686
|
-
await installPackages(libPythonDir, allToInstall, timeline, 6, pythonCmd);
|
|
687
|
-
timeline.complete(6, `${pkgStatus.installed.length + allToInstall.length} packages`);
|
|
688
|
-
} else {
|
|
689
|
-
timeline.skip(6, 'User skipped');
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
// Check Python availability first
|
|
617
|
+
// Check if lib/python exists
|
|
618
|
+
if (!fs.existsSync(libPythonDir)) {
|
|
619
|
+
timeline.addChild(6, 'No lib/python folder', 'skip');
|
|
620
|
+
timeline.complete(6, 'Skipped');
|
|
621
|
+
timeline.skip(7, 'No dependencies');
|
|
622
|
+
|
|
623
|
+
// Cleanup and finish
|
|
624
|
+
try { fs.rmSync(tempDir, { recursive: true, force: true }); } catch {}
|
|
625
|
+
const ver = selectedVersion.replace(/^v/, '');
|
|
626
|
+
console.log(chalk.green(`\n ✓ CSK v${ver} ${isUpdate ? 'updated' : 'installed'} successfully!\n`));
|
|
627
|
+
console.log(chalk.cyan(' Quick Start\n'));
|
|
628
|
+
console.log(chalk.dim(' 1. Open Claude Code:'));
|
|
629
|
+
console.log(` ${chalk.white('claude')}\n`);
|
|
630
|
+
console.log(chalk.dim(' 2. Start with CSK:'));
|
|
631
|
+
console.log(` ${chalk.white('/csk')}\n`);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// Check Python availability
|
|
694
636
|
let pythonInfo = detectPython();
|
|
695
637
|
let pythonReady = false;
|
|
696
638
|
|
|
697
639
|
if (!pythonInfo.found) {
|
|
698
|
-
|
|
699
|
-
console.log(chalk.yellow(' Python not found on this system.'));
|
|
700
|
-
console.log(chalk.dim(' Python is required for:'));
|
|
701
|
-
console.log(chalk.dim(' - Data fetching and analysis'));
|
|
702
|
-
console.log(chalk.dim(' - Chart generation'));
|
|
703
|
-
console.log(chalk.dim(' - MCP server tools'));
|
|
704
|
-
console.log('');
|
|
640
|
+
timeline.addChild(6, 'Python not found', 'skip');
|
|
705
641
|
|
|
706
642
|
// Check if we can auto-install
|
|
707
643
|
const autoInstall = canAutoInstall();
|
|
708
644
|
|
|
709
645
|
if (autoInstall.canInstall) {
|
|
646
|
+
console.log('');
|
|
647
|
+
console.log(chalk.yellow(' Python not found on this system.'));
|
|
710
648
|
console.log(chalk.cyan(` Auto-install available via ${autoInstall.manager}`));
|
|
711
|
-
if (autoInstall.needsSudo) {
|
|
712
|
-
console.log(chalk.dim(' (requires sudo password)'));
|
|
713
|
-
}
|
|
714
|
-
console.log(chalk.dim(` Command: ${autoInstall.command}`));
|
|
715
649
|
console.log('');
|
|
716
650
|
|
|
717
651
|
timeline.pause();
|
|
@@ -724,11 +658,9 @@ async function initCommand(options) {
|
|
|
724
658
|
timeline.resume();
|
|
725
659
|
|
|
726
660
|
if (doInstall) {
|
|
727
|
-
console.log('');
|
|
728
661
|
timeline.addChild(6, `Installing via ${autoInstall.manager}...`, 'update');
|
|
729
|
-
|
|
730
662
|
const result = await installPython((msg) => {
|
|
731
|
-
console.log(chalk.dim(`
|
|
663
|
+
console.log(chalk.dim(` ${msg}`));
|
|
732
664
|
});
|
|
733
665
|
|
|
734
666
|
if (result.success) {
|
|
@@ -736,43 +668,85 @@ async function initCommand(options) {
|
|
|
736
668
|
timeline.addChild(6, `Python ${result.version} installed`, 'new');
|
|
737
669
|
pythonReady = true;
|
|
738
670
|
} else {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
console.log('');
|
|
743
|
-
timeline.skip(6, 'Installation failed');
|
|
671
|
+
timeline.addChild(6, 'Installation failed', 'skip');
|
|
672
|
+
timeline.complete(6, 'Failed');
|
|
673
|
+
timeline.skip(7, 'No Python');
|
|
744
674
|
}
|
|
745
675
|
} else {
|
|
746
|
-
timeline.
|
|
676
|
+
timeline.complete(6, 'Skipped');
|
|
677
|
+
timeline.skip(7, 'No Python');
|
|
747
678
|
}
|
|
748
679
|
} else {
|
|
749
|
-
//
|
|
680
|
+
// Show manual instructions
|
|
750
681
|
const instructions = getInstallInstructions();
|
|
751
|
-
console.log(chalk.bold(` Install via ${instructions.method}:\n`));
|
|
752
|
-
for (const cmd of instructions.commands.slice(0, 4)) {
|
|
753
|
-
if (cmd.startsWith('#')) {
|
|
754
|
-
console.log(chalk.dim(` ${cmd}`));
|
|
755
|
-
} else if (cmd !== '') {
|
|
756
|
-
console.log(chalk.cyan(` ${cmd}`));
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
682
|
console.log('');
|
|
760
|
-
|
|
683
|
+
console.log(chalk.yellow(' Python not found. Install via:'));
|
|
684
|
+
console.log(chalk.cyan(` ${instructions.commands[0]}`));
|
|
685
|
+
console.log('');
|
|
686
|
+
timeline.complete(6, 'Python needed');
|
|
687
|
+
timeline.skip(7, 'No Python');
|
|
761
688
|
}
|
|
762
689
|
} else if (!pythonInfo.meetsMinimum) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
console.log('');
|
|
767
|
-
timeline.skip(6, `Python ${pythonInfo.version} too old`);
|
|
690
|
+
timeline.addChild(6, `Python ${pythonInfo.version} (need 3.8+)`, 'skip');
|
|
691
|
+
timeline.complete(6, 'Upgrade needed');
|
|
692
|
+
timeline.skip(7, 'Python too old');
|
|
768
693
|
} else {
|
|
769
694
|
pythonReady = true;
|
|
695
|
+
timeline.addChild(6, `Python ${pythonInfo.version}`, 'info');
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// If Python not ready, exit early
|
|
699
|
+
if (!pythonReady) {
|
|
700
|
+
try { fs.rmSync(tempDir, { recursive: true, force: true }); } catch {}
|
|
701
|
+
const ver = selectedVersion.replace(/^v/, '');
|
|
702
|
+
console.log(chalk.green(`\n ✓ CSK v${ver} ${isUpdate ? 'updated' : 'installed'} successfully!\n`));
|
|
703
|
+
console.log(chalk.dim(' Note: Python dependencies not installed.\n'));
|
|
704
|
+
return;
|
|
770
705
|
}
|
|
771
706
|
|
|
772
|
-
//
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
707
|
+
// Check packages
|
|
708
|
+
const pkgStatus = checkPythonPackages(libPythonDir);
|
|
709
|
+
const allToInstall = [...pkgStatus.toInstall, ...pkgStatus.toUpdate];
|
|
710
|
+
|
|
711
|
+
if (pkgStatus.installed.length > 0) {
|
|
712
|
+
timeline.addChild(6, `${pkgStatus.installed.length} packages OK`, 'info');
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
if (allToInstall.length === 0) {
|
|
716
|
+
timeline.complete(6, 'All ready');
|
|
717
|
+
timeline.skip(7, 'Nothing to install');
|
|
718
|
+
} else {
|
|
719
|
+
// Show packages to install/update
|
|
720
|
+
for (const pkg of allToInstall.slice(0, 5)) {
|
|
721
|
+
if (pkg.current) {
|
|
722
|
+
timeline.addChild(6, `${pkg.name}: ${pkg.current} → ${pkg.required}`, 'update');
|
|
723
|
+
} else {
|
|
724
|
+
timeline.addChild(6, `${pkg.name}: ${pkg.required || 'latest'}`, 'new');
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (allToInstall.length > 5) {
|
|
728
|
+
timeline.addChild(6, `... and ${allToInstall.length - 5} more`, 'info');
|
|
729
|
+
}
|
|
730
|
+
timeline.complete(6, `${allToInstall.length} to install`);
|
|
731
|
+
|
|
732
|
+
// Step 8: Install packages
|
|
733
|
+
timeline.start(7);
|
|
734
|
+
|
|
735
|
+
timeline.pause();
|
|
736
|
+
const { confirmPkgs } = await inquirer.prompt([{
|
|
737
|
+
type: 'confirm',
|
|
738
|
+
name: 'confirmPkgs',
|
|
739
|
+
message: `Install ${allToInstall.length} packages?`,
|
|
740
|
+
default: true
|
|
741
|
+
}]);
|
|
742
|
+
timeline.resume();
|
|
743
|
+
|
|
744
|
+
if (confirmPkgs) {
|
|
745
|
+
await installPackages(libPythonDir, allToInstall, timeline, 7, pythonInfo.command);
|
|
746
|
+
timeline.complete(7, `${pkgStatus.installed.length + allToInstall.length} packages`);
|
|
747
|
+
} else {
|
|
748
|
+
timeline.skip(7, 'Skipped');
|
|
749
|
+
}
|
|
776
750
|
}
|
|
777
751
|
|
|
778
752
|
// Cleanup temp files
|