@lumerahq/cli 0.25.0 → 0.28.0

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.
@@ -1,12 +1,10 @@
1
- import "./chunk-PNKVD2UK.js";
2
-
3
1
  // src/commands/functions.ts
4
2
  import { spawn } from "child_process";
5
3
  import { existsSync } from "fs";
6
4
  import { join, resolve } from "path";
7
5
  import pc from "picocolors";
8
6
  var SUPPORTED_SUBCOMMANDS = /* @__PURE__ */ new Set(["list", "inspect", "invoke", "test"]);
9
- var FUNCTIONS_SDK_REQUIREMENT = "lumera[functions]>=0.29.0,<0.30.0";
7
+ var FUNCTIONS_SDK_REQUIREMENT = "lumera[functions]>=0.31.0,<0.32.0";
10
8
  var FUNCTIONS_RUNNER_PROTOCOL_VERSION = 1;
11
9
  function errorMessage(error, fallback) {
12
10
  return error instanceof Error && error.message ? error.message : fallback;
@@ -203,10 +201,11 @@ async function functions(subcommand, args, dependencies = {}) {
203
201
  process.exitCode = exitCode;
204
202
  }
205
203
  }
204
+
206
205
  export {
207
- buildFunctionRunnerArgs,
208
206
  emitFunctionCliFailure,
209
207
  findFunctionsProjectRoot,
210
- functions,
211
- runFunctionRunner
208
+ buildFunctionRunnerArgs,
209
+ runFunctionRunner,
210
+ functions
212
211
  };
@@ -0,0 +1,15 @@
1
+ import {
2
+ buildFunctionRunnerArgs,
3
+ emitFunctionCliFailure,
4
+ findFunctionsProjectRoot,
5
+ functions,
6
+ runFunctionRunner
7
+ } from "./chunk-NIVQLH6V.js";
8
+ import "./chunk-PNKVD2UK.js";
9
+ export {
10
+ buildFunctionRunnerArgs,
11
+ emitFunctionCliFailure,
12
+ findFunctionsProjectRoot,
13
+ functions,
14
+ runFunctionRunner
15
+ };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import pc from "picocolors";
12
12
 
13
13
  // src/lib/command-output.ts
14
14
  function commandOwnsStdout(command2) {
15
- return command2 === "functions";
15
+ return command2 === "functions" || command2 === "project";
16
16
  }
17
17
 
18
18
  // src/lib/update-check.ts
@@ -96,6 +96,7 @@ var COMMANDS = [
96
96
  "dev",
97
97
  "run",
98
98
  "functions",
99
+ "project",
99
100
  "init",
100
101
  "register",
101
102
  "templates",
@@ -158,6 +159,7 @@ ${pc.dim("Development:")}
158
159
  ${pc.cyan("dev")} Start dev server
159
160
  ${pc.cyan("run")} <target> Run script, trigger automation, or invoke agent
160
161
  ${pc.cyan("functions")} <command> Develop and test Functions locally
162
+ ${pc.cyan("project release")} <command> Build and verify immutable releases
161
163
 
162
164
  ${pc.dim("Project:")}
163
165
  ${pc.cyan("init")} [name] Scaffold a new project
@@ -266,13 +268,18 @@ async function main() {
266
268
  await import("./run-WHVUVIYB.js").then((m) => m.run(args.slice(1)));
267
269
  break;
268
270
  case "functions":
269
- await import("./functions-NKI3ZKIV.js").then(
271
+ await import("./functions-JUOVWQQH.js").then(
270
272
  (m) => m.functions(subcommand, args.slice(2))
271
273
  );
272
274
  break;
275
+ case "project":
276
+ await import("./project-2PYA24JV.js").then(
277
+ (m) => m.project(subcommand, args.slice(2))
278
+ );
279
+ break;
273
280
  // Project
274
281
  case "init":
275
- await import("./init-CUB3KH6M.js").then((m) => m.init(args.slice(1)));
282
+ await import("./init-ZR2SLJ3K.js").then((m) => m.init(args.slice(1)));
276
283
  break;
277
284
  case "register":
278
285
  await import("./register-HRLBT4FI.js").then((m) => m.register(args.slice(1)));
@@ -0,0 +1,115 @@
1
+ import {
2
+ findFunctionsProjectRoot
3
+ } from "./chunk-NIVQLH6V.js";
4
+ import "./chunk-PNKVD2UK.js";
5
+
6
+ // src/commands/project.ts
7
+ import { spawn } from "child_process";
8
+ import pc from "picocolors";
9
+ var RELEASE_SDK_REQUIREMENT = "lumera[release]>=0.31.0,<0.32.0";
10
+ var RELEASE_PROTOCOL_VERSION = 1;
11
+ var RELEASE_COMMANDS = /* @__PURE__ */ new Set(["build", "inspect", "contract-test", "deploy"]);
12
+ function showHelp() {
13
+ console.log(`
14
+ ${pc.dim("Usage:")}
15
+ lumera project release build [--output dist/releases]
16
+ lumera project release inspect <archive> [--expected-digest <sha256>]
17
+ lumera project release contract-test <archive> [--mode api|worker|all]
18
+ lumera project release deploy <archive> --project <project-id>
19
+
20
+ ${pc.dim("Description:")}
21
+ Build, verify, and contract-test immutable Python 3.13/Linux/ARM64 project
22
+ releases, or upload a verified release as an inactive project resource.
23
+ `);
24
+ }
25
+ function buildReleaseRunnerArgs(command, args, projectRoot) {
26
+ if (!RELEASE_COMMANDS.has(command)) {
27
+ throw new Error(`Unknown project release command: ${command}`);
28
+ }
29
+ return [
30
+ "run",
31
+ "--locked",
32
+ "--with",
33
+ RELEASE_SDK_REQUIREMENT,
34
+ "python",
35
+ "-m",
36
+ "lumera.releases",
37
+ "--project-root",
38
+ projectRoot,
39
+ command,
40
+ ...args
41
+ ];
42
+ }
43
+ async function runReleaseRunner(runnerArgs, projectRoot, spawnRunner = (command, args, options) => spawn(command, args, options)) {
44
+ return await new Promise((resolvePromise, reject) => {
45
+ const child = spawnRunner("uv", runnerArgs, {
46
+ cwd: projectRoot,
47
+ env: process.env,
48
+ shell: false,
49
+ stdio: ["inherit", "pipe", "inherit"]
50
+ });
51
+ let output = "";
52
+ child.stdout?.setEncoding("utf8");
53
+ child.stdout?.on("data", (chunk) => {
54
+ output += chunk;
55
+ });
56
+ child.once("error", (error) => {
57
+ reject(
58
+ error.code === "ENOENT" ? new Error("uv is not installed. Install it from https://docs.astral.sh/uv/") : error
59
+ );
60
+ });
61
+ child.once("close", (code) => {
62
+ try {
63
+ const envelope = JSON.parse(output);
64
+ if (envelope.protocol_version !== RELEASE_PROTOCOL_VERSION || typeof envelope.ok !== "boolean") {
65
+ throw new Error("invalid release runner protocol");
66
+ }
67
+ resolvePromise({ code: code ?? 1, envelope, raw: output });
68
+ } catch {
69
+ reject(
70
+ new Error(
71
+ `Release runner exited with status ${code ?? 1} before emitting a valid protocol envelope`
72
+ )
73
+ );
74
+ }
75
+ });
76
+ });
77
+ }
78
+ async function project(subcommand, args, dependencies = {}) {
79
+ if (subcommand !== "release" || args.length === 0 || args.includes("--help") || args.includes("-h")) {
80
+ showHelp();
81
+ return;
82
+ }
83
+ const [releaseCommand, ...releaseArgs] = args;
84
+ const findProjectRoot = dependencies.findProjectRoot ?? findFunctionsProjectRoot;
85
+ const runRunner = dependencies.runRunner ?? runReleaseRunner;
86
+ const writeOutput = dependencies.writeOutput ?? ((value) => process.stdout.write(value));
87
+ try {
88
+ const projectRoot = findProjectRoot();
89
+ const result = await runRunner(
90
+ buildReleaseRunnerArgs(releaseCommand, releaseArgs, projectRoot),
91
+ projectRoot
92
+ );
93
+ writeOutput(result.raw);
94
+ if (result.code !== 0) process.exitCode = result.code;
95
+ } catch (error) {
96
+ writeOutput(
97
+ `${JSON.stringify({
98
+ protocol_version: RELEASE_PROTOCOL_VERSION,
99
+ ok: false,
100
+ error: {
101
+ code: "release_cli_error",
102
+ message: error instanceof Error ? error.message : "Release command failed",
103
+ retryable: false
104
+ }
105
+ })}
106
+ `
107
+ );
108
+ process.exitCode = 1;
109
+ }
110
+ }
111
+ export {
112
+ buildReleaseRunnerArgs,
113
+ project,
114
+ runReleaseRunner
115
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/cli",
3
- "version": "0.25.0",
3
+ "version": "0.28.0",
4
4
  "description": "CLI for building and deploying Lumera apps",
5
5
  "type": "module",
6
6
  "engines": {
@@ -4,7 +4,7 @@ version = "0.1.0"
4
4
  description = "{{projectTitle}} - Lumera custom app"
5
5
  requires-python = ">=3.11"
6
6
  dependencies = [
7
- "lumera[functions]>=0.29.0,<0.30.0",
7
+ "lumera[functions]>=0.31.0,<0.32.0",
8
8
  ]
9
9
 
10
10
  [project.optional-dependencies]
@@ -1,3 +1,6 @@
1
+ import {
2
+ spinner
3
+ } from "./chunk-BHYDYR75.js";
1
4
  import {
2
5
  listAllTemplates,
3
6
  resolveTemplate
@@ -6,9 +9,6 @@ import {
6
9
  installAllSkills,
7
10
  syncClaudeMd
8
11
  } from "./chunk-VL5GDJKU.js";
9
- import {
10
- spinner
11
- } from "./chunk-BHYDYR75.js";
12
12
  import {
13
13
  createApiClient,
14
14
  validateProjectNameLength