@lumerahq/cli 0.30.3-dev.0 → 0.30.3-dev.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
|
@@ -240,25 +240,25 @@ async function main() {
|
|
|
240
240
|
switch (command) {
|
|
241
241
|
// Resource commands
|
|
242
242
|
case "plan":
|
|
243
|
-
await import("./resources-
|
|
243
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.plan(args.slice(1)));
|
|
244
244
|
break;
|
|
245
245
|
case "apply":
|
|
246
|
-
await import("./resources-
|
|
246
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.apply(args.slice(1)));
|
|
247
247
|
break;
|
|
248
248
|
case "pull":
|
|
249
|
-
await import("./resources-
|
|
249
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.pull(args.slice(1)));
|
|
250
250
|
break;
|
|
251
251
|
case "destroy":
|
|
252
|
-
await import("./resources-
|
|
252
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.destroy(args.slice(1)));
|
|
253
253
|
break;
|
|
254
254
|
case "list":
|
|
255
|
-
await import("./resources-
|
|
255
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.list(args.slice(1)));
|
|
256
256
|
break;
|
|
257
257
|
case "show":
|
|
258
|
-
await import("./resources-
|
|
258
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.show(args.slice(1)));
|
|
259
259
|
break;
|
|
260
260
|
case "diff":
|
|
261
|
-
await import("./resources-
|
|
261
|
+
await import("./resources-OLDTUSKL.js").then((m) => m.diff(args.slice(1)));
|
|
262
262
|
break;
|
|
263
263
|
// Development
|
|
264
264
|
case "dev":
|
|
@@ -39,12 +39,37 @@ 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
|
|
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 compiler 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}`
|
|
48
73
|
};
|
|
49
74
|
}
|
|
50
75
|
var agentPolicyCompileRule = {
|
|
@@ -57,8 +82,8 @@ var agentPolicyCompileRule = {
|
|
|
57
82
|
try {
|
|
58
83
|
await ctx.api.compileAgentPolicy(script);
|
|
59
84
|
} catch (err) {
|
|
60
|
-
const
|
|
61
|
-
return
|
|
85
|
+
const diagnostics = err instanceof ApiError ? apiCompileDiagnostics(err) : [{ message: err instanceof Error ? err.message : String(err) }];
|
|
86
|
+
return diagnostics.map((diagnostic) => compileError(target, diagnostic));
|
|
62
87
|
}
|
|
63
88
|
return [];
|
|
64
89
|
}
|