@lumerahq/cli 0.30.3-dev.2 → 0.30.3
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-PHBQEMKZ.js").then((m) => m.plan(args.slice(1)));
|
|
244
244
|
break;
|
|
245
245
|
case "apply":
|
|
246
|
-
await import("./resources-
|
|
246
|
+
await import("./resources-PHBQEMKZ.js").then((m) => m.apply(args.slice(1)));
|
|
247
247
|
break;
|
|
248
248
|
case "pull":
|
|
249
|
-
await import("./resources-
|
|
249
|
+
await import("./resources-PHBQEMKZ.js").then((m) => m.pull(args.slice(1)));
|
|
250
250
|
break;
|
|
251
251
|
case "destroy":
|
|
252
|
-
await import("./resources-
|
|
252
|
+
await import("./resources-PHBQEMKZ.js").then((m) => m.destroy(args.slice(1)));
|
|
253
253
|
break;
|
|
254
254
|
case "list":
|
|
255
|
-
await import("./resources-
|
|
255
|
+
await import("./resources-PHBQEMKZ.js").then((m) => m.list(args.slice(1)));
|
|
256
256
|
break;
|
|
257
257
|
case "show":
|
|
258
|
-
await import("./resources-
|
|
258
|
+
await import("./resources-PHBQEMKZ.js").then((m) => m.show(args.slice(1)));
|
|
259
259
|
break;
|
|
260
260
|
case "diff":
|
|
261
|
-
await import("./resources-
|
|
261
|
+
await import("./resources-PHBQEMKZ.js").then((m) => m.diff(args.slice(1)));
|
|
262
262
|
break;
|
|
263
263
|
// Development
|
|
264
264
|
case "dev":
|
|
@@ -78,11 +78,22 @@ var agentPolicyCompileRule = {
|
|
|
78
78
|
description: "Verifies agent policy scripts compile with the backend runtime compiler.",
|
|
79
79
|
appliesTo: ["agent-policy"],
|
|
80
80
|
async check(target, ctx) {
|
|
81
|
-
if (!target.source.trim()
|
|
81
|
+
if (!target.source.trim()) {
|
|
82
|
+
const policyEnabled = !!target.config && typeof target.config === "object" && target.config.policyEnabled === true;
|
|
83
|
+
if (!policyEnabled) return [];
|
|
84
|
+
return [{
|
|
85
|
+
ruleId: "agent-policy-compile",
|
|
86
|
+
target,
|
|
87
|
+
severity: "error",
|
|
88
|
+
message: "policy.js must not be empty when policy_enabled is true"
|
|
89
|
+
}];
|
|
90
|
+
}
|
|
91
|
+
if (!ctx.api) return [];
|
|
82
92
|
const script = ctx.appName ? target.source.replaceAll("{{app}}", ctx.appName) : target.source;
|
|
83
93
|
try {
|
|
84
94
|
await ctx.api.compileAgentPolicy(script);
|
|
85
95
|
} catch (err) {
|
|
96
|
+
if (err instanceof ApiError && err.status === 404) return [];
|
|
86
97
|
const diagnostics = err instanceof ApiError ? apiCompileDiagnostics(err) : [{ message: err instanceof Error ? err.message : String(err) }];
|
|
87
98
|
return diagnostics.map((diagnostic) => compileError(target, diagnostic));
|
|
88
99
|
}
|
|
@@ -950,9 +961,10 @@ function buildAgentPolicyTargets(platformDir, filterName, appName) {
|
|
|
950
961
|
if (!entry.isDirectory()) continue;
|
|
951
962
|
const agentDir = join(agentsDir, entry.name);
|
|
952
963
|
const policyPath = join(agentDir, "policy.js");
|
|
953
|
-
|
|
964
|
+
const hasPolicyFile = existsSync(policyPath);
|
|
954
965
|
let externalID = appName ? `${appName}:${entry.name}` : "";
|
|
955
966
|
let displayName = "";
|
|
967
|
+
let policyEnabled = false;
|
|
956
968
|
const configPath = join(agentDir, "config.json");
|
|
957
969
|
if (existsSync(configPath)) {
|
|
958
970
|
try {
|
|
@@ -963,9 +975,11 @@ function buildAgentPolicyTargets(platformDir, filterName, appName) {
|
|
|
963
975
|
if (typeof config.name === "string") {
|
|
964
976
|
displayName = config.name;
|
|
965
977
|
}
|
|
978
|
+
policyEnabled = config.policy_enabled === true;
|
|
966
979
|
} catch {
|
|
967
980
|
}
|
|
968
981
|
}
|
|
982
|
+
if (!hasPolicyFile && !policyEnabled) continue;
|
|
969
983
|
if (filterName && entry.name !== filterName && externalID !== filterName && displayName !== filterName) {
|
|
970
984
|
continue;
|
|
971
985
|
}
|
|
@@ -973,7 +987,8 @@ function buildAgentPolicyTargets(platformDir, filterName, appName) {
|
|
|
973
987
|
kind: "agent-policy",
|
|
974
988
|
name: externalID || displayName || entry.name,
|
|
975
989
|
filePath: policyPath,
|
|
976
|
-
source: readFileSync(policyPath, "utf-8")
|
|
990
|
+
source: hasPolicyFile ? readFileSync(policyPath, "utf-8") : "",
|
|
991
|
+
config: { policyEnabled }
|
|
977
992
|
});
|
|
978
993
|
}
|
|
979
994
|
return targets;
|