ardent-cli 0.0.11 → 0.0.13

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -3
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -151,10 +151,21 @@ function getCliVersion() {
151
151
  }
152
152
  }
153
153
  var CLI_VERSION = getCliVersion();
154
+ function formatErrorDetail(detail) {
155
+ if (typeof detail === "string") return detail;
156
+ if (Array.isArray(detail)) {
157
+ return detail.map((entry) => {
158
+ const location = Array.isArray(entry.loc) ? entry.loc.join(" \u2192 ") : "";
159
+ const message = entry.msg ?? "unknown error";
160
+ return location ? `${location}: ${message}` : String(message);
161
+ }).join("; ");
162
+ }
163
+ return JSON.stringify(detail);
164
+ }
154
165
  function parseApiError(status, text) {
155
166
  try {
156
167
  const json = JSON.parse(text);
157
- if (json.detail) return `API error ${status}: ${json.detail}`;
168
+ if (json.detail) return `API error ${status}: ${formatErrorDetail(json.detail)}`;
158
169
  } catch {
159
170
  }
160
171
  return `API error ${status}: ${text}`;
@@ -1015,8 +1026,13 @@ async function listAction2() {
1015
1026
  let cacheTime = "";
1016
1027
  try {
1017
1028
  const currentProjectId = getConfig("currentProjectId");
1018
- const projectFilter = currentProjectId ? `?project_id=${currentProjectId}` : "";
1019
- const result = await api.get(`/v1/cli/connectors${projectFilter}`);
1029
+ if (!currentProjectId) {
1030
+ console.error("\u2717 No current project set. Switch to a project first:");
1031
+ console.error(" ardent project list");
1032
+ console.error(" ardent project switch <name>");
1033
+ process.exit(1);
1034
+ }
1035
+ const result = await api.get(`/v1/cli/connectors?project_id=${currentProjectId}`);
1020
1036
  if (!result.connectors) {
1021
1037
  throw new Error("API returned invalid response: missing connectors array");
1022
1038
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ardent-cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Git for Data infrastructure",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  "scripts": {
10
10
  "build": "tsup",
11
11
  "dev": "tsup --watch",
12
- "start": "node dist/index.js"
12
+ "start": "node dist/index.js",
13
+ "test": "tsx --test src/lib/*.test.ts"
13
14
  },
14
15
  "files": [
15
16
  "dist"
@@ -24,6 +25,7 @@
24
25
  "devDependencies": {
25
26
  "@types/node": "^20.0.0",
26
27
  "tsup": "^8.0.0",
28
+ "tsx": "^4.21.0",
27
29
  "typescript": "^5.0.0"
28
30
  }
29
31
  }