@lumerahq/cli 0.30.3-dev.0 → 0.30.3-dev.2

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
@@ -240,25 +240,25 @@ async function main() {
240
240
  switch (command) {
241
241
  // Resource commands
242
242
  case "plan":
243
- await import("./resources-ZSFI5CJM.js").then((m) => m.plan(args.slice(1)));
243
+ await import("./resources-WUHGNK7K.js").then((m) => m.plan(args.slice(1)));
244
244
  break;
245
245
  case "apply":
246
- await import("./resources-ZSFI5CJM.js").then((m) => m.apply(args.slice(1)));
246
+ await import("./resources-WUHGNK7K.js").then((m) => m.apply(args.slice(1)));
247
247
  break;
248
248
  case "pull":
249
- await import("./resources-ZSFI5CJM.js").then((m) => m.pull(args.slice(1)));
249
+ await import("./resources-WUHGNK7K.js").then((m) => m.pull(args.slice(1)));
250
250
  break;
251
251
  case "destroy":
252
- await import("./resources-ZSFI5CJM.js").then((m) => m.destroy(args.slice(1)));
252
+ await import("./resources-WUHGNK7K.js").then((m) => m.destroy(args.slice(1)));
253
253
  break;
254
254
  case "list":
255
- await import("./resources-ZSFI5CJM.js").then((m) => m.list(args.slice(1)));
255
+ await import("./resources-WUHGNK7K.js").then((m) => m.list(args.slice(1)));
256
256
  break;
257
257
  case "show":
258
- await import("./resources-ZSFI5CJM.js").then((m) => m.show(args.slice(1)));
258
+ await import("./resources-WUHGNK7K.js").then((m) => m.show(args.slice(1)));
259
259
  break;
260
260
  case "diff":
261
- await import("./resources-ZSFI5CJM.js").then((m) => m.diff(args.slice(1)));
261
+ await import("./resources-WUHGNK7K.js").then((m) => m.diff(args.slice(1)));
262
262
  break;
263
263
  // Development
264
264
  case "dev":
@@ -39,12 +39,38 @@ import { existsSync, readFileSync, readdirSync } from "fs";
39
39
  import { basename, dirname, join } from "path";
40
40
 
41
41
  // src/lib/lint/rules/agent-policy-compile.ts
42
- function compileError(target, message) {
42
+ function compileDiagnostic(value) {
43
+ if (!value || typeof value !== "object") return void 0;
44
+ const diagnostic = value;
45
+ if (typeof diagnostic.message !== "string") return void 0;
46
+ return {
47
+ message: diagnostic.message,
48
+ line: typeof diagnostic.line === "number" && diagnostic.line > 0 ? diagnostic.line : void 0,
49
+ column: typeof diagnostic.column === "number" && diagnostic.column > 0 ? diagnostic.column : void 0
50
+ };
51
+ }
52
+ function apiCompileDiagnostics(err) {
53
+ const detail = err.body.trim();
54
+ try {
55
+ const parsed = JSON.parse(detail);
56
+ if (parsed && typeof parsed === "object") {
57
+ const diagnostics = Array.isArray(parsed.errors) ? parsed.errors.map(compileDiagnostic).filter((item) => !!item) : [];
58
+ if (diagnostics.length > 0) return diagnostics;
59
+ const legacyDiagnostic = compileDiagnostic(parsed);
60
+ if (legacyDiagnostic) return [legacyDiagnostic];
61
+ }
62
+ } catch {
63
+ }
64
+ return [{ message: detail }];
65
+ }
66
+ function compileError(target, diagnostic) {
67
+ const position = diagnostic.line ? ` at line ${diagnostic.line}${diagnostic.column ? `, column ${diagnostic.column}` : ""}` : "";
43
68
  return {
44
69
  ruleId: "agent-policy-compile",
45
70
  target,
46
71
  severity: "error",
47
- message
72
+ message: `Agent policy failed to compile${position}: ${diagnostic.message}`,
73
+ line: diagnostic.line
48
74
  };
49
75
  }
50
76
  var agentPolicyCompileRule = {
@@ -57,8 +83,8 @@ var agentPolicyCompileRule = {
57
83
  try {
58
84
  await ctx.api.compileAgentPolicy(script);
59
85
  } catch (err) {
60
- const detail = err instanceof ApiError ? err.body.trim() : err instanceof Error ? err.message : String(err);
61
- return [compileError(target, `Agent policy failed to compile on the backend: ${detail}`)];
86
+ const diagnostics = err instanceof ApiError ? apiCompileDiagnostics(err) : [{ message: err instanceof Error ? err.message : String(err) }];
87
+ return diagnostics.map((diagnostic) => compileError(target, diagnostic));
62
88
  }
63
89
  return [];
64
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/cli",
3
- "version": "0.30.3-dev.0",
3
+ "version": "0.30.3-dev.2",
4
4
  "description": "CLI for building and deploying Lumera apps",
5
5
  "type": "module",
6
6
  "engines": {