Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .codex/superpowers-codex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const fs = require('fs');
const path = require('path');
const os = require('os');
const skillsCore = require('../lib/skills-core');
const { parseArgs, runInstall, runUpgrade, runDoctor } = require('../lib/installer-core');

// Paths
const homeDir = os.homedir();
Expand Down Expand Up @@ -242,6 +243,14 @@ function runUseSkill(skillName) {
const command = process.argv[2];
const arg = process.argv[3];

if (command === 'install' || command === 'upgrade' || command === 'doctor') {
const parsedArgs = parseArgs(process.argv.slice(3));
if (command === 'install') runInstall('codex', parsedArgs);
if (command === 'upgrade') runUpgrade('codex', parsedArgs);
if (command === 'doctor') runDoctor('codex', parsedArgs);
process.exit(0);
}
Comment on lines +246 to +252
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

process.exit(0) overrides exitCode set by runDoctor on failure.

When runDoctor detects issues, it sets process.exitCode = 1 (line 310 in installer-core.js). However, line 251 unconditionally calls process.exit(0), which overrides this and reports success even when the doctor check fails.

Proposed fix
 if (command === 'install' || command === 'upgrade' || command === 'doctor') {
     const parsedArgs = parseArgs(process.argv.slice(3));
     if (command === 'install') runInstall('codex', parsedArgs);
     if (command === 'upgrade') runUpgrade('codex', parsedArgs);
     if (command === 'doctor') runDoctor('codex', parsedArgs);
-    process.exit(0);
+    process.exit(process.exitCode || 0);
 }
🤖 Prompt for AI Agents
In @.codex/superpowers-codex around lines 246 - 252, The unconditional
process.exit(0) after dispatching runInstall/runUpgrade/runDoctor overrides any
nonzero exit status set by runDoctor; change the shutdown logic so it preserves
runDoctor's outcome — e.g., call process.exit(process.exitCode || 0) or only
exit with 0 when process.exitCode is undefined/zero, and ensure runDoctor (and
the dispatch path) is awaited or returns before exiting; update the block around
runInstall/runUpgrade/runDoctor and the process.exit call accordingly so nonzero
exit codes from runDoctor are honored.


switch (command) {
case 'bootstrap':
runBootstrap();
Expand All @@ -258,10 +267,14 @@ switch (command) {
console.log(' superpowers-codex bootstrap # Run complete bootstrap with all skills');
console.log(' superpowers-codex use-skill <skill-name> # Load a specific skill');
console.log(' superpowers-codex find-skills # List all available skills');
console.log(' superpowers-codex install [flags] # Clone/update central repo and link into Codex');
console.log(' superpowers-codex upgrade [flags] # Update central repo and repair links');
console.log(' superpowers-codex doctor [flags] # Check installation and links');
console.log('');
console.log('Examples:');
console.log(' superpowers-codex bootstrap');
console.log(' superpowers-codex use-skill superpowers:brainstorming');
console.log(' superpowers-codex use-skill my-custom-skill');
break;
}

43 changes: 43 additions & 0 deletions .opencode/superpowers-opencode
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env node

const { parseArgs, runInstall, runUpgrade, runDoctor } = require('../lib/installer-core');

const cliName = 'superpowers-opencode';

const commands = {
install: (args) => runInstall('opencode', args),
upgrade: (args) => runUpgrade('opencode', args),
doctor: (args) => runDoctor('opencode', args),
};

function printHelp() {
console.log('Superpowers for OpenCode');
console.log('Usage:');
console.log(` ${cliName} install [flags] # Clone/update central repo and link into OpenCode`);
console.log(` ${cliName} upgrade [flags] # Update central repo and repair links`);
console.log(` ${cliName} doctor [flags] # Check installation and links`);
console.log('');
console.log('Flags:');
console.log(' --repo <owner/name> # default: obra/superpowers');
console.log(' --ref <branch|tag> # default: main');
console.log(' --dir <path> # default: ~/.superpowers');
console.log(' --force # replace existing paths / continue if repo dirty');
console.log(' --no-update # skip git fetch/pull');
}

const command = process.argv[2];
const parsedArgs = parseArgs(process.argv.slice(3));

if (!command) {
printHelp();
process.exit(0);
}

const runner = commands[command];
if (!runner) {
console.log(`Unknown command: ${command}`);
printHelp();
process.exit(1);
}

runner(parsedArgs);
Loading