openkbs 0.0.47 → 0.0.49
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/actions.js +4 -88
- package/version.json +2 -2
package/package.json
CHANGED
package/src/actions.js
CHANGED
|
@@ -651,12 +651,10 @@ async function updateCliAction() {
|
|
|
651
651
|
if (compareVersions(currentVersion, remoteVersion) < 0) {
|
|
652
652
|
cliUpdateAvailable = true;
|
|
653
653
|
console.log(`New CLI version available: ${remoteVersion}`);
|
|
654
|
-
console.
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
console.green(`Successfully updated OpenKBS CLI to version ${remoteVersion}!`);
|
|
654
|
+
console.yellow('To update the CLI, please run:');
|
|
655
|
+
console.log(`npm uninstall -g openkbs && npm install -g openkbs@${remoteVersion}`);
|
|
656
|
+
console.yellow('Or simply:');
|
|
657
|
+
console.log('npm update -g openkbs');
|
|
660
658
|
} else {
|
|
661
659
|
console.green('OpenKBS CLI is already up to date.');
|
|
662
660
|
}
|
|
@@ -667,10 +665,6 @@ async function updateCliAction() {
|
|
|
667
665
|
// Also update knowledge base silently if it exists
|
|
668
666
|
await updateKnowledgeAction(true);
|
|
669
667
|
|
|
670
|
-
if (cliUpdateAvailable) {
|
|
671
|
-
console.log('Please restart your terminal or run `source ~/.bashrc` to use the updated CLI version.');
|
|
672
|
-
}
|
|
673
|
-
|
|
674
668
|
} catch (error) {
|
|
675
669
|
console.red('Error updating CLI:', error.message);
|
|
676
670
|
}
|
|
@@ -691,84 +685,6 @@ function compareVersions(version1, version2) {
|
|
|
691
685
|
return 0;
|
|
692
686
|
}
|
|
693
687
|
|
|
694
|
-
async function downloadAndInstallCli() {
|
|
695
|
-
const platform = os.platform();
|
|
696
|
-
const arch = os.arch();
|
|
697
|
-
let url = '';
|
|
698
|
-
|
|
699
|
-
if (platform === 'linux' && arch === 'x64') {
|
|
700
|
-
url = 'https://downloads.openkbs.com/cli/linux/openkbs';
|
|
701
|
-
} else if (platform === 'darwin' && arch === 'arm64') {
|
|
702
|
-
url = 'https://downloads.openkbs.com/cli/macos/openkbs';
|
|
703
|
-
} else if (platform === 'darwin' && arch === 'x64') {
|
|
704
|
-
url = 'https://downloads.openkbs.com/cli/macos/openkbs-x64';
|
|
705
|
-
} else if (platform === 'win32' && arch === 'x64') {
|
|
706
|
-
url = 'https://downloads.openkbs.com/cli/windows/openkbs.exe';
|
|
707
|
-
} else if (platform === 'win32' && arch === 'arm64') {
|
|
708
|
-
url = 'https://downloads.openkbs.com/cli/windows/openkbs-arm64.exe';
|
|
709
|
-
} else if (platform === 'linux' && arch === 'arm64') {
|
|
710
|
-
url = 'https://downloads.openkbs.com/cli/linux/openkbs-arm64';
|
|
711
|
-
} else {
|
|
712
|
-
throw new Error(`Unsupported platform: ${platform} ${arch}`);
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
const tempPath = path.join(os.tmpdir(), 'openkbs-update');
|
|
716
|
-
|
|
717
|
-
return new Promise((resolve, reject) => {
|
|
718
|
-
const file = fs.createWriteStream(tempPath);
|
|
719
|
-
|
|
720
|
-
https.get(url, (response) => {
|
|
721
|
-
if (response.statusCode !== 200) {
|
|
722
|
-
reject(new Error(`Failed to download binary: HTTP ${response.statusCode}`));
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
response.pipe(file);
|
|
727
|
-
|
|
728
|
-
file.on('finish', () => {
|
|
729
|
-
file.close(async () => {
|
|
730
|
-
try {
|
|
731
|
-
// Make executable
|
|
732
|
-
if (platform !== 'win32') {
|
|
733
|
-
fs.chmodSync(tempPath, '755');
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
// Find the current binary location
|
|
737
|
-
const currentBinaryPath = process.argv[0] === 'node' ? process.argv[1] : process.argv[0];
|
|
738
|
-
let targetPath;
|
|
739
|
-
|
|
740
|
-
// If we're running through npm, find the global bin path
|
|
741
|
-
if (currentBinaryPath.includes('node_modules')) {
|
|
742
|
-
targetPath = currentBinaryPath;
|
|
743
|
-
} else {
|
|
744
|
-
// Try to find in common global locations
|
|
745
|
-
const globalPaths = [
|
|
746
|
-
'/usr/local/bin/openkbs',
|
|
747
|
-
path.join(os.homedir(), '.npm-global', 'bin', 'openkbs'),
|
|
748
|
-
path.join(os.homedir(), '.yarn', 'bin', 'openkbs')
|
|
749
|
-
];
|
|
750
|
-
|
|
751
|
-
targetPath = globalPaths.find(p => fs.existsSync(p)) || currentBinaryPath;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
// Replace the binary
|
|
755
|
-
fs.copyFileSync(tempPath, targetPath);
|
|
756
|
-
|
|
757
|
-
// Clean up temp file
|
|
758
|
-
fs.unlinkSync(tempPath);
|
|
759
|
-
|
|
760
|
-
resolve();
|
|
761
|
-
} catch (error) {
|
|
762
|
-
reject(error);
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
});
|
|
766
|
-
}).on('error', (err) => {
|
|
767
|
-
fs.unlink(tempPath, () => {});
|
|
768
|
-
reject(err);
|
|
769
|
-
});
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
688
|
|
|
773
689
|
async function downloadKnowledgeFromS3(targetDir) {
|
|
774
690
|
const https = require('https');
|
package/version.json
CHANGED