@lumerahq/cli 0.30.3-dev.1 → 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-OLDTUSKL.js").then((m) => m.plan(args.slice(1)));
243
+ await import("./resources-PHBQEMKZ.js").then((m) => m.plan(args.slice(1)));
244
244
  break;
245
245
  case "apply":
246
- await import("./resources-OLDTUSKL.js").then((m) => m.apply(args.slice(1)));
246
+ await import("./resources-PHBQEMKZ.js").then((m) => m.apply(args.slice(1)));
247
247
  break;
248
248
  case "pull":
249
- await import("./resources-OLDTUSKL.js").then((m) => m.pull(args.slice(1)));
249
+ await import("./resources-PHBQEMKZ.js").then((m) => m.pull(args.slice(1)));
250
250
  break;
251
251
  case "destroy":
252
- await import("./resources-OLDTUSKL.js").then((m) => m.destroy(args.slice(1)));
252
+ await import("./resources-PHBQEMKZ.js").then((m) => m.destroy(args.slice(1)));
253
253
  break;
254
254
  case "list":
255
- await import("./resources-OLDTUSKL.js").then((m) => m.list(args.slice(1)));
255
+ await import("./resources-PHBQEMKZ.js").then((m) => m.list(args.slice(1)));
256
256
  break;
257
257
  case "show":
258
- await import("./resources-OLDTUSKL.js").then((m) => m.show(args.slice(1)));
258
+ await import("./resources-PHBQEMKZ.js").then((m) => m.show(args.slice(1)));
259
259
  break;
260
260
  case "diff":
261
- await import("./resources-OLDTUSKL.js").then((m) => m.diff(args.slice(1)));
261
+ await import("./resources-PHBQEMKZ.js").then((m) => m.diff(args.slice(1)));
262
262
  break;
263
263
  // Development
264
264
  case "dev":
@@ -64,12 +64,13 @@ function apiCompileDiagnostics(err) {
64
64
  return [{ message: detail }];
65
65
  }
66
66
  function compileError(target, diagnostic) {
67
- const position = diagnostic.line ? ` at compiler line ${diagnostic.line}${diagnostic.column ? `, column ${diagnostic.column}` : ""}` : "";
67
+ const position = diagnostic.line ? ` at line ${diagnostic.line}${diagnostic.column ? `, column ${diagnostic.column}` : ""}` : "";
68
68
  return {
69
69
  ruleId: "agent-policy-compile",
70
70
  target,
71
71
  severity: "error",
72
- message: `Agent policy failed to compile${position}: ${diagnostic.message}`
72
+ message: `Agent policy failed to compile${position}: ${diagnostic.message}`,
73
+ line: diagnostic.line
73
74
  };
74
75
  }
75
76
  var agentPolicyCompileRule = {
@@ -77,11 +78,22 @@ var agentPolicyCompileRule = {
77
78
  description: "Verifies agent policy scripts compile with the backend runtime compiler.",
78
79
  appliesTo: ["agent-policy"],
79
80
  async check(target, ctx) {
80
- if (!target.source.trim() || !ctx.api) return [];
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 [];
81
92
  const script = ctx.appName ? target.source.replaceAll("{{app}}", ctx.appName) : target.source;
82
93
  try {
83
94
  await ctx.api.compileAgentPolicy(script);
84
95
  } catch (err) {
96
+ if (err instanceof ApiError && err.status === 404) return [];
85
97
  const diagnostics = err instanceof ApiError ? apiCompileDiagnostics(err) : [{ message: err instanceof Error ? err.message : String(err) }];
86
98
  return diagnostics.map((diagnostic) => compileError(target, diagnostic));
87
99
  }
@@ -949,9 +961,10 @@ function buildAgentPolicyTargets(platformDir, filterName, appName) {
949
961
  if (!entry.isDirectory()) continue;
950
962
  const agentDir = join(agentsDir, entry.name);
951
963
  const policyPath = join(agentDir, "policy.js");
952
- if (!existsSync(policyPath)) continue;
964
+ const hasPolicyFile = existsSync(policyPath);
953
965
  let externalID = appName ? `${appName}:${entry.name}` : "";
954
966
  let displayName = "";
967
+ let policyEnabled = false;
955
968
  const configPath = join(agentDir, "config.json");
956
969
  if (existsSync(configPath)) {
957
970
  try {
@@ -962,9 +975,11 @@ function buildAgentPolicyTargets(platformDir, filterName, appName) {
962
975
  if (typeof config.name === "string") {
963
976
  displayName = config.name;
964
977
  }
978
+ policyEnabled = config.policy_enabled === true;
965
979
  } catch {
966
980
  }
967
981
  }
982
+ if (!hasPolicyFile && !policyEnabled) continue;
968
983
  if (filterName && entry.name !== filterName && externalID !== filterName && displayName !== filterName) {
969
984
  continue;
970
985
  }
@@ -972,7 +987,8 @@ function buildAgentPolicyTargets(platformDir, filterName, appName) {
972
987
  kind: "agent-policy",
973
988
  name: externalID || displayName || entry.name,
974
989
  filePath: policyPath,
975
- source: readFileSync(policyPath, "utf-8")
990
+ source: hasPolicyFile ? readFileSync(policyPath, "utf-8") : "",
991
+ config: { policyEnabled }
976
992
  });
977
993
  }
978
994
  return targets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/cli",
3
- "version": "0.30.3-dev.1",
3
+ "version": "0.30.3",
4
4
  "description": "CLI for building and deploying Lumera apps",
5
5
  "type": "module",
6
6
  "engines": {