diff --git a/skillhub-cli/src/commands/archive.ts b/skillhub-cli/src/commands/archive.ts index 6741a78d0..c720b962d 100644 --- a/skillhub-cli/src/commands/archive.ts +++ b/skillhub-cli/src/commands/archive.ts @@ -33,7 +33,7 @@ export function registerArchive(program: Command) { success(`Archived ${skillSlug}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/delete.ts b/skillhub-cli/src/commands/delete.ts index a535ec290..94c534337 100644 --- a/skillhub-cli/src/commands/delete.ts +++ b/skillhub-cli/src/commands/delete.ts @@ -34,7 +34,7 @@ export function registerDelete(program: Command) { success(`Deleted ${skillSlug} from ${namespace}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/download.ts b/skillhub-cli/src/commands/download.ts index 54db14a69..d3d389ca3 100644 --- a/skillhub-cli/src/commands/download.ts +++ b/skillhub-cli/src/commands/download.ts @@ -45,7 +45,7 @@ export function registerDownload(program: Command) { const location = response.headers.location; if (!location) { spinner.fail(`Redirect response has no Location header`); - process.exit(1); + process.exitCode = 1; } response = await request(location as string, { method: "GET" }); } @@ -53,7 +53,7 @@ export function registerDownload(program: Command) { if (statusCode >= 400) { spinner.fail(`Download failed: HTTP ${statusCode}`); - process.exit(1); + process.exitCode = 1; } const outPath = resolve(outputDir, `${skillSlug}.zip`); @@ -63,7 +63,7 @@ export function registerDownload(program: Command) { spinner.succeed(`Downloaded ${skillSlug} to ${outPath}`); } catch (e: any) { error(`Download failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/hide.ts b/skillhub-cli/src/commands/hide.ts index d647e3f2f..dd1373b89 100644 --- a/skillhub-cli/src/commands/hide.ts +++ b/skillhub-cli/src/commands/hide.ts @@ -42,7 +42,7 @@ export function registerHide(program: Command) { success(`Hidden ${skillSlug}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); @@ -82,7 +82,7 @@ export function registerHide(program: Command) { success(`Unhidden ${skillSlug}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/init.ts b/skillhub-cli/src/commands/init.ts index 0ddafed08..25d9077ab 100644 --- a/skillhub-cli/src/commands/init.ts +++ b/skillhub-cli/src/commands/init.ts @@ -17,7 +17,7 @@ export function registerInit(program: Command) { const skillMd = join(dir, "SKILL.md"); if (existsSync(skillMd)) { error("SKILL.md already exists"); - process.exit(1); + process.exitCode = 1; } const slug = name || "my-skill"; diff --git a/skillhub-cli/src/commands/inspect.ts b/skillhub-cli/src/commands/inspect.ts index f68ca0eeb..399ab437a 100644 --- a/skillhub-cli/src/commands/inspect.ts +++ b/skillhub-cli/src/commands/inspect.ts @@ -94,7 +94,7 @@ export function registerInspect(program: Command) { if (!namespaces || namespaces.length === 0) { error("No namespaces found. You may need to log in."); - process.exit(1); + process.exitCode = 1; } const searchPromises = namespaces.map(async (ns) => { @@ -116,7 +116,7 @@ export function registerInspect(program: Command) { if (namespaces.length > 1) { dim(`Tried namespaces: ${namespaces.map((n) => n.slug).join(", ")}`); } - process.exit(1); + process.exitCode = 1; } if (isJson) { diff --git a/skillhub-cli/src/commands/install.ts b/skillhub-cli/src/commands/install.ts index 7062e52bb..03a64a6db 100644 --- a/skillhub-cli/src/commands/install.ts +++ b/skillhub-cli/src/commands/install.ts @@ -233,7 +233,7 @@ export function registerInstall(program: Command) { } } catch (e: any) { spinner.fail(e.message); - process.exit(1); + process.exitCode = 1; } }); } @@ -277,7 +277,7 @@ async function installFromRegistry( if (uniqueResults.length === 0) { spinner.fail(`Skill not found: ${actualSlug}`); - process.exit(1); + process.exitCode = 1; } if (uniqueResults.length === 1) { @@ -373,7 +373,7 @@ async function installFromRegistry( if (!location) { spinner.fail(`Redirect response has no Location header`); await rm(tmpDir, { recursive: true, force: true }); - process.exit(1); + process.exitCode = 1; } response = await request(location as string, { method: "GET" }); } @@ -382,7 +382,7 @@ async function installFromRegistry( if (statusCode >= 400) { spinner.fail(`Skill not found: ${ns}/${actualSlug}`); await rm(tmpDir, { recursive: true, force: true }); - process.exit(1); + process.exitCode = 1; } const fileStream = createWriteStream(zipPath); @@ -398,7 +398,7 @@ async function installFromRegistry( const skills = discoverSkills(extractDir); if (skills.length === 0) { spinner.fail("No SKILL.md found in package"); - process.exit(1); + process.exitCode = 1; } spinner.succeed(`Found ${skills.length} skill(s) in ${ns}/${actualSlug}`); @@ -639,7 +639,7 @@ async function installFromGit( if (skills.length === 0) { spinner.fail("No skills found. Ensure the directory contains SKILL.md files."); - process.exit(1); + process.exitCode = 1; } spinner.succeed(`Found ${skills.length} skill(s)`); @@ -663,7 +663,7 @@ async function installFromGit( if (selectedSkills.length === 0) { error(`No matching skills for: ${skillNames.join(", ")}`); info("Available: " + skills.map((s) => s.name).join(", ")); - process.exit(1); + process.exitCode = 1; } } } else if (!opts.yes && skills.length > 1) { diff --git a/skillhub-cli/src/commands/login.ts b/skillhub-cli/src/commands/login.ts index 9b7d83762..a236b19f2 100644 --- a/skillhub-cli/src/commands/login.ts +++ b/skillhub-cli/src/commands/login.ts @@ -28,7 +28,7 @@ export function registerLogin(program: Command) { success(`Authenticated as ${resp.user.displayName} (@${resp.user.handle})`); } catch (e: any) { error(`Authentication failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/me.ts b/skillhub-cli/src/commands/me.ts index 015e5ed32..b1fce52d2 100644 --- a/skillhub-cli/src/commands/me.ts +++ b/skillhub-cli/src/commands/me.ts @@ -53,7 +53,7 @@ export function registerMe(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); @@ -83,7 +83,7 @@ export function registerMe(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/namespaces.ts b/skillhub-cli/src/commands/namespaces.ts index 942bdb10b..6607070bf 100644 --- a/skillhub-cli/src/commands/namespaces.ts +++ b/skillhub-cli/src/commands/namespaces.ts @@ -29,7 +29,7 @@ export function registerNamespaces(program: Command) { } } catch (e: any) { error(`Failed to list namespaces: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/notifications.ts b/skillhub-cli/src/commands/notifications.ts index fe341ee6e..7b02675b2 100644 --- a/skillhub-cli/src/commands/notifications.ts +++ b/skillhub-cli/src/commands/notifications.ts @@ -40,7 +40,7 @@ export function registerNotifications(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); @@ -56,7 +56,7 @@ export function registerNotifications(program: Command) { success(`Marked notification ${id} as read`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); @@ -72,7 +72,7 @@ export function registerNotifications(program: Command) { success("All notifications marked as read"); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/publish.ts b/skillhub-cli/src/commands/publish.ts index 0ccd41f71..26e02aec9 100644 --- a/skillhub-cli/src/commands/publish.ts +++ b/skillhub-cli/src/commands/publish.ts @@ -25,7 +25,7 @@ export function registerPublish(program: Command) { const folderStat = await stat(folder).catch(() => null); if (!folderStat || !folderStat.isDirectory()) { error("Path must be a directory containing SKILL.md"); - process.exit(1); + process.exitCode = 1; } const slug = opts.slug || basename(folder); @@ -40,7 +40,7 @@ export function registerPublish(program: Command) { const isValidVersion = semver.valid(version) || /^\d{8}\.\d+$/.test(version); if (!isValidVersion) { error("--skill-version must be a valid semver (e.g. 1.0.0) or timestamp (e.g. 20260414.123045)"); - process.exit(1); + process.exitCode = 1; } const namespace = opts.namespace || "global"; @@ -58,7 +58,7 @@ export function registerPublish(program: Command) { const skillMdStat = await stat(skillMdPath).catch(() => null); if (!skillMdStat) { spinner.fail("SKILL.md not found in directory"); - process.exit(1); + process.exitCode = 1; } const skillMdContent = await readFile(skillMdPath, "utf-8"); @@ -92,7 +92,7 @@ export function registerPublish(program: Command) { } } catch (e: any) { error(`Publish failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/rating.ts b/skillhub-cli/src/commands/rating.ts index 92fcd1732..12c825761 100644 --- a/skillhub-cli/src/commands/rating.ts +++ b/skillhub-cli/src/commands/rating.ts @@ -32,7 +32,7 @@ export function registerRating(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } @@ -45,7 +45,7 @@ export function registerRate(program: Command) { const score = parseInt(scoreStr, 10); if (isNaN(score) || score < 1 || score > 5) { error("Score must be between 1 and 5"); - process.exit(1); + process.exitCode = 1; } try { @@ -65,7 +65,7 @@ export function registerRate(program: Command) { success(`Rated ${skillSlug}: ${"★".repeat(score)}${"☆".repeat(5 - score)}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/report.ts b/skillhub-cli/src/commands/report.ts index f20c6d870..52da128d6 100644 --- a/skillhub-cli/src/commands/report.ts +++ b/skillhub-cli/src/commands/report.ts @@ -34,7 +34,7 @@ export function registerReport(program: Command) { success(`Report submitted for ${skillSlug}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/resolve.ts b/skillhub-cli/src/commands/resolve.ts index 6d83ce2a4..3f14c9e57 100644 --- a/skillhub-cli/src/commands/resolve.ts +++ b/skillhub-cli/src/commands/resolve.ts @@ -70,7 +70,7 @@ export function registerResolve(program: Command) { } error(`Version ${specifiedVersion} not found for ${namespace}/${skillSlug}`); error(`Please check if the version number is correct.`); - process.exit(1); + process.exitCode = 1; } const results = await searchSkills(client, skillSlug, 50); @@ -86,7 +86,7 @@ export function registerResolve(program: Command) { if (uniqueResults.length === 0) { error(`Skill not found: ${skillSlug}`); - process.exit(1); + process.exitCode = 1; } const resolvePromises = uniqueResults.map(async (r) => ({ @@ -99,7 +99,7 @@ export function registerResolve(program: Command) { if (matches.length === 0) { error(`Version ${specifiedVersion} not found for ${skillSlug}`); error(`Please check if the version number is correct.`); - process.exit(1); + process.exitCode = 1; } if (matches.length === 1) { @@ -114,7 +114,7 @@ export function registerResolve(program: Command) { console.log(` ${m.namespace}/${m.name}`); } dim(`\nUse: resolve / --skill-version ${specifiedVersion}`); - process.exit(1); + process.exitCode = 1; } // Case 2: No version specified (original behavior) @@ -133,7 +133,7 @@ export function registerResolve(program: Command) { if (uniqueResults.length === 0) { error(`Skill not found: ${skillSlug}`); - process.exit(1); + process.exitCode = 1; } if (uniqueResults.length === 1) { @@ -163,7 +163,7 @@ export function registerResolve(program: Command) { printResolveResult(result); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/reviews.ts b/skillhub-cli/src/commands/reviews.ts index 911777e0a..745c6113d 100644 --- a/skillhub-cli/src/commands/reviews.ts +++ b/skillhub-cli/src/commands/reviews.ts @@ -37,7 +37,7 @@ export function registerReviews(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/search.ts b/skillhub-cli/src/commands/search.ts index 70c96ddda..fb7a3cc59 100644 --- a/skillhub-cli/src/commands/search.ts +++ b/skillhub-cli/src/commands/search.ts @@ -48,7 +48,7 @@ export function registerSearch(program: Command) { } } catch (e: any) { error(`Search failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/star.ts b/skillhub-cli/src/commands/star.ts index 26651965a..2ff16ea4e 100644 --- a/skillhub-cli/src/commands/star.ts +++ b/skillhub-cli/src/commands/star.ts @@ -31,7 +31,7 @@ export function registerStar(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/sync.ts b/skillhub-cli/src/commands/sync.ts index 7f87bbb86..cfb13002b 100644 --- a/skillhub-cli/src/commands/sync.ts +++ b/skillhub-cli/src/commands/sync.ts @@ -31,7 +31,7 @@ export function registerSync(program: Command) { if (!existsSync(scanPath)) { error(`Directory not found: ${scanPath}`); - process.exit(1); + process.exitCode = 1; } try { @@ -139,7 +139,7 @@ export function registerSync(program: Command) { console.log(""); } catch (e: any) { error(`Sync failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/transfer.ts b/skillhub-cli/src/commands/transfer.ts index 92c983a9d..cf79e3473 100644 --- a/skillhub-cli/src/commands/transfer.ts +++ b/skillhub-cli/src/commands/transfer.ts @@ -32,7 +32,7 @@ export function registerTransfer(program: Command) { success(`Ownership of ${namespace} transferred to ${newOwnerId}`); } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } \ No newline at end of file diff --git a/skillhub-cli/src/commands/update.ts b/skillhub-cli/src/commands/update.ts index 78c5ca352..8fbbf3766 100644 --- a/skillhub-cli/src/commands/update.ts +++ b/skillhub-cli/src/commands/update.ts @@ -22,7 +22,7 @@ export function registerUpdate(program: Command) { if (!existsSync(lockPath)) { error("No skillhub.lock found. Have you installed any skills?"); - process.exit(1); + process.exitCode = 1; } const lockedSkills = await getAllLockedSkills(); @@ -30,7 +30,7 @@ export function registerUpdate(program: Command) { if (allSkillNames.length === 0) { error("No skills in lock file."); - process.exit(1); + process.exitCode = 1; } let skillsToUpdate: string[] = []; diff --git a/skillhub-cli/src/commands/versions.ts b/skillhub-cli/src/commands/versions.ts index 4177e2be0..87c79eabb 100644 --- a/skillhub-cli/src/commands/versions.ts +++ b/skillhub-cli/src/commands/versions.ts @@ -59,7 +59,7 @@ export function registerVersions(program: Command) { if (uniqueResults.length === 0) { error(`Skill not found: ${skillSlug}`); - process.exit(1); + process.exitCode = 1; } if (uniqueResults.length === 1) { @@ -95,7 +95,7 @@ export function registerVersions(program: Command) { } } catch (e: any) { error(`Failed: ${e.message}`); - process.exit(1); + process.exitCode = 1; } }); } diff --git a/skillhub-cli/src/commands/whoami.ts b/skillhub-cli/src/commands/whoami.ts index 936026089..43cf73d12 100644 --- a/skillhub-cli/src/commands/whoami.ts +++ b/skillhub-cli/src/commands/whoami.ts @@ -24,7 +24,7 @@ export function registerWhoami(program: Command) { } } catch (e: any) { error(e.message); - process.exit(1); + process.exitCode = 1; } }); }