@neta-art/cohub-cli 1.5.0 → 1.5.1

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/index.js CHANGED
@@ -63,6 +63,7 @@ try {
63
63
  catch (error) {
64
64
  const message = error instanceof Error ? error.message : String(error);
65
65
  process.stderr.write(`cohub self-update failed: ${message}\n`);
66
+ process.stderr.write("run with --version to skip self-update\n");
66
67
  process.exit(1);
67
68
  }
68
69
  program.parse();
package/dist/output.js CHANGED
@@ -46,20 +46,44 @@ export function error(msg, detail) {
46
46
  process.exit(1);
47
47
  }
48
48
  // -- HTTP error handler ------------------------------------------------------
49
+ function errorMessageFromBody(body) {
50
+ if (!body || typeof body !== "object")
51
+ return null;
52
+ const errorBody = body;
53
+ if (typeof errorBody.message === "string" && errorBody.message.trim())
54
+ return errorBody.message;
55
+ if (typeof errorBody.error?.message === "string" && errorBody.error.message.trim())
56
+ return errorBody.error.message;
57
+ return null;
58
+ }
59
+ function debugErrorMetaFromBody(body) {
60
+ if (!body || typeof body !== "object")
61
+ return [];
62
+ const errorBody = body;
63
+ const items = [];
64
+ const code = typeof errorBody.code === "string" ? errorBody.code : typeof errorBody.error?.code === "string" ? errorBody.error.code : null;
65
+ if (code)
66
+ items.push(code);
67
+ if (typeof errorBody.requestId === "string")
68
+ items.push(`requestId: ${errorBody.requestId}`);
69
+ if (typeof errorBody.traceId === "string")
70
+ items.push(`traceId: ${errorBody.traceId}`);
71
+ return items;
72
+ }
49
73
  export function handleHttp(e) {
50
74
  if (e instanceof Error && e.name === "AuthRequiredError") {
51
- return error("Not authenticated", "Run `cohub auth login`.");
75
+ return error("not authenticated", "run `cohub auth login`");
52
76
  }
53
77
  const status = e.status;
54
78
  const body = e.body;
55
- const msg = e instanceof Error ? e.message : String(e);
56
- let detail;
57
- if (status)
58
- detail = `HTTP ${status}`;
59
- if (body && typeof body === "object" && "message" in body) {
60
- detail = `${detail ? `${detail} — ` : ""}${body.message}`;
79
+ const message = errorMessageFromBody(body) ?? (e instanceof Error ? e.message : String(e));
80
+ const detailParts = [];
81
+ if (process.env.COHUB_DEBUG_ERRORS) {
82
+ if (status)
83
+ detailParts.push(`HTTP ${status}`);
84
+ detailParts.push(...debugErrorMetaFromBody(body));
61
85
  }
62
- error(msg, detail);
86
+ error(message, detailParts.length > 0 ? detailParts.join(" · ") : undefined);
63
87
  }
64
88
  // -- Spinner -----------------------------------------------------------------
65
89
  export function spinner() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "commander": "^13.1.0",
17
- "@neta-art/cohub": "1.11.0"
17
+ "@neta-art/cohub": "1.12.0"
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public"