@ishlabs/cli 0.19.0 → 0.21.0

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/dist/upgrade.js CHANGED
@@ -32,11 +32,18 @@ export async function upgrade(currentVersion, targetVersion) {
32
32
  const scriptUrl = import.meta.url;
33
33
  const runningFromNodeModules = scriptUrl.includes("/node_modules/");
34
34
  if (looksLikeNode || runningFromNodeModules) {
35
- throw new Error("Cannot self-upgrade an npm-installed CLI (would overwrite the node binary). " +
35
+ // Pattern C: tag as ValidationError so exitCodeFromError maps to 2
36
+ // (usage_error). Otherwise this would fall through to the generic
37
+ // exit 1 even with the wrapper in place (ISSUE-012).
38
+ const err = new Error("Cannot self-upgrade an npm-installed CLI (would overwrite the node binary). " +
36
39
  "Run `npm install -g @ishlabs/cli@latest` instead.");
40
+ err.name = "ValidationError";
41
+ throw err;
37
42
  }
38
43
  if (targetVersion && !/^\d+\.\d+\.\d+/.test(targetVersion)) {
39
- throw new Error(`Invalid version format: ${targetVersion}`);
44
+ const err = new Error(`Invalid version format: ${targetVersion}`);
45
+ err.name = "ValidationError";
46
+ throw err;
40
47
  }
41
48
  const latest = targetVersion || (await getLatestVersion());
42
49
  if (latest === currentVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ishlabs/cli",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "The command-line interface for ish",
5
5
  "type": "module",
6
6
  "bin": {