mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-29 16:16:08 +00:00
✨ Add automatic update checking for PyPI and NPM packages
- Check for updates on startup (once per 24h) - Show update banner when new version available - Support --no-update-check and --auto-update flags - Add SUPERCLAUDE_AUTO_UPDATE environment variable - Implement for both Python (PyPI) and Node.js (NPM)
This commit is contained in:
22
bin/cli.js
22
bin/cli.js
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
const { spawnSync } = require("child_process");
|
||||
const { detectPython, detectPip } = require("./checkEnv");
|
||||
const { checkAndNotify } = require("./checkUpdate");
|
||||
|
||||
let pythonCmd = detectPython();
|
||||
if (!pythonCmd) {
|
||||
@@ -10,12 +11,33 @@ if (!pythonCmd) {
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
// Parse command line arguments for update control
|
||||
const noUpdateCheck = args.includes('--no-update-check');
|
||||
const autoUpdate = args.includes('--auto-update');
|
||||
const isQuiet = args.includes('--quiet') || args.includes('-q');
|
||||
|
||||
// Special case: update command
|
||||
if (args[0] === "update") {
|
||||
require("./update");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Check for updates unless disabled
|
||||
if (!noUpdateCheck && !isQuiet) {
|
||||
// Run update check asynchronously to avoid blocking
|
||||
checkAndNotify({
|
||||
autoUpdate: autoUpdate,
|
||||
silent: false
|
||||
}).then(updated => {
|
||||
if (updated) {
|
||||
console.log("\n🔄 SuperClaude was updated. Please restart to use the new version.");
|
||||
process.exit(0);
|
||||
}
|
||||
}).catch(() => {
|
||||
// Silently ignore update check errors
|
||||
});
|
||||
}
|
||||
|
||||
// Forward everything to Python SuperClaude
|
||||
const result = spawnSync(pythonCmd, ["-m", "SuperClaude", ...args], { stdio: "inherit", shell: true });
|
||||
process.exit(result.status);
|
||||
|
||||
Reference in New Issue
Block a user