SuperClaude/bin/update.js
NomenAK e0d5b8cae5 🚀 v4.0.4 - Enhanced installation with pipx support
- Added automatic detection of PEP 668 environments
- Implemented pipx as preferred installation method for Linux/macOS
- Added fallback to pip --user for externally managed environments
- Improved error messages with clear installation alternatives
- Added --break-system-packages as last resort option
- Updated NPM wrapper to handle all installation scenarios
- Enhanced update mechanism to detect and use correct tool
2025-08-22 21:12:24 +02:00

71 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
const { run, detectPip, detectPipx, isSuperClaudeInstalledPipx, checkPythonEnvironment } = require("./checkEnv");
console.log("🔄 Checking for SuperClaude updates...");
// Detect installation method
const isExternallyManaged = checkPythonEnvironment();
let updateMethod = null;
// Check if installed via pipx
if (detectPipx() && isSuperClaudeInstalledPipx()) {
updateMethod = "pipx";
console.log("✅ Detected pipx installation");
} else {
// Check for pip installation
let pipCmd = detectPip();
if (!pipCmd) {
console.error("❌ Neither pipx nor pip found, cannot update.");
console.error(" Please install SuperClaude first using:");
console.error(" pipx install SuperClaude");
console.error(" or");
console.error(" pip install SuperClaude");
process.exit(1);
}
if (isExternallyManaged) {
updateMethod = "pip-user";
console.log("✅ Detected pip installation with --user flag");
} else {
updateMethod = "pip";
console.log("✅ Detected standard pip installation");
}
}
// Perform update based on detected method
console.log("🔄 Updating SuperClaude from PyPI...");
let result;
switch(updateMethod) {
case "pipx":
result = run("pipx", ["upgrade", "SuperClaude"], { stdio: "inherit" });
break;
case "pip-user":
result = run(detectPip(), ["install", "--upgrade", "--user", "SuperClaude"], { stdio: "inherit" });
break;
case "pip":
result = run(detectPip(), ["install", "--upgrade", "SuperClaude"], { stdio: "inherit" });
break;
}
if (result.status !== 0) {
console.error("❌ Update failed.");
if (updateMethod === "pip" && isExternallyManaged) {
console.error(" Your system requires pipx or --user flag for pip operations.");
console.error(" Try: pipx upgrade SuperClaude");
console.error(" Or: pip install --upgrade --user SuperClaude");
}
process.exit(1);
}
console.log("✅ SuperClaude updated successfully!");
// Run SuperClaude update command
console.log("\n🚀 Running SuperClaude update...");
const updateResult = run("SuperClaude", ["update"], { stdio: "inherit" });
if (updateResult.status !== 0) {
console.log("\n⚠ Could not run 'SuperClaude update' automatically.");
console.log(" Please run it manually:");
console.log(" SuperClaude update");
}