@lamsa/cli 0.1.0 → 0.1.1-rc.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/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
- import { A as recordActivity, B as validateProject, C as loadComments, D as moveNode, E as loadTokens, F as stableStringify, G as createOutput, H as designFileJsonSchema, I as summarize$1, K as formatIssue, L as toRepoPath, M as replyToComment, N as resolveComment, O as readDesignFile, P as saveDesignFile, R as treeLines, S as listDesignFiles, T as loadProject, U as CliError, V as writeFileAtomic, W as ExitCode, _ as fontSetup, a as resolveRoot, b as isDesignFile, c as addTree, d as commentAuthor, f as deleteNodes, g as findProjectRoot, h as diffAgainstRef, i as readInput, j as reopenComment, k as readSession, l as allNodes, m as didYouMean, n as renderFrames, o as CONFIG_FILE, p as detectTokenSource, q as reportError, r as openWorkspace, s as addComment, u as buildChildIndex, v as formatDesignFile, w as loadConfig, x as isOpen, y as indexNodes, z as validateComments } from "./render-B5Kz3okC.js";
3
+ import { A as recordActivity, B as validateProject, C as loadComments, D as moveNode, E as loadTokens, F as stableStringify, G as createOutput, H as designFileJsonSchema, I as summarize$1, K as formatIssue, L as toRepoPath, M as replyToComment, N as resolveComment, O as readDesignFile, P as saveDesignFile, R as treeLines, S as listDesignFiles, T as loadProject, U as CliError, V as writeFileAtomic, W as ExitCode, _ as fontSetup, a as resolveRoot, b as isDesignFile, c as addTree, d as commentAuthor, f as deleteNodes, g as findProjectRoot, h as diffAgainstRef, i as readInput, j as reopenComment, k as readSession, l as allNodes, m as didYouMean, n as renderFrames, o as CONFIG_FILE, p as detectTokenSource, q as reportError, r as openWorkspace, s as addComment, u as buildChildIndex, v as formatDesignFile, w as loadConfig, x as isOpen, y as indexNodes, z as validateComments } from "./render-CiFXTSpf.js";
4
4
  import { delimiter, join, relative, resolve } from "node:path";
5
5
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
6
6
  import { execFileSync, spawn } from "node:child_process";
7
- import { tmpdir } from "node:os";
7
+ import { homedir, tmpdir } from "node:os";
8
8
  import { mkdir, readFile, writeFile } from "node:fs/promises";
9
9
  import { fileURLToPath } from "node:url";
10
10
  // src/run.ts
@@ -1171,6 +1171,21 @@ function findOnPath(command) {
1171
1171
  if (existsSync(candidate)) return candidate;
1172
1172
  }
1173
1173
  }
1174
+ const RELEASES = "https://github.com/Shunseii/lamsa/releases/latest";
1175
+ /** The newest lamsa AppImage in a folder, by file name (they carry the version). */
1176
+ function findAppImage(dir) {
1177
+ if (!existsSync(dir)) return void 0;
1178
+ const newest = readdirSync(dir).filter((name) => /^lamsa-.*\.AppImage$/.test(name)).sort((a, b) => a.localeCompare(b, void 0, { numeric: true })).at(-1);
1179
+ return newest ? join(dir, newest) : void 0;
1180
+ }
1181
+ /** Where the desktop app is: LAMSA_DESKTOP_BIN, `lamsa-desktop` on PATH (the .deb and source installs), the macOS app, or an AppImage. */
1182
+ function findDesktopApp() {
1183
+ if (process.env.LAMSA_DESKTOP_BIN) return process.env.LAMSA_DESKTOP_BIN;
1184
+ const onPath = findOnPath("lamsa-desktop");
1185
+ if (onPath) return onPath;
1186
+ if (process.platform === "darwin") return [join("/Applications"), join(homedir(), "Applications")].map((dir) => join(dir, "lamsa.app", "Contents", "MacOS", "lamsa-desktop")).find((path) => existsSync(path));
1187
+ if (process.platform === "linux") return [join(homedir(), "Applications"), join(homedir(), ".local", "bin")].map(findAppImage).find(Boolean);
1188
+ }
1174
1189
  async function openCommand({ out, file, select }) {
1175
1190
  const root = resolveRoot();
1176
1191
  const ids = [...new Set((select ?? []).map((id) => id.trim()).filter(Boolean))];
@@ -1178,8 +1193,8 @@ async function openCommand({ out, file, select }) {
1178
1193
  root,
1179
1194
  ids
1180
1195
  });
1181
- const app = process.env.LAMSA_DESKTOP_BIN ?? findOnPath("lamsa-desktop");
1182
- if (!app) throw new CliError("the lamsa desktop app is not installed", ExitCode.notFound, "install it, or set LAMSA_DESKTOP_BIN; everything else works without it (use `lamsa render` to look at designs)");
1196
+ const app = findDesktopApp();
1197
+ if (!app) throw new CliError("the lamsa desktop app is not installed", ExitCode.notFound, `download it from ${RELEASES}, or set LAMSA_DESKTOP_BIN; everything else works without it (use \`lamsa render\` to look at designs)`);
1183
1198
  const args = [`--root=${root}`];
1184
1199
  if (file) args.push(`--file=${toRepoPath(root, file)}`);
1185
1200
  if (ids.length) args.push(`--select=${ids.join(",")}`);
@@ -1203,7 +1218,7 @@ async function checkNodesExist({ root, ids }) {
1203
1218
  throw new CliError(`no node with ID ${missing.join(", ")}`, ExitCode.notFound, missing.map((id) => didYouMean(id, Object.keys(nodes))).filter(Boolean).join("; ") || "run `lamsa tree` to list nodes");
1204
1219
  }
1205
1220
  // src/cli.ts
1206
- const program = new Command().name("lamsa").description("Design files for apps, driven by your own coding agent. Every command is non-interactive.").version("0.1.0").option("--json", "machine-readable output").showHelpAfterError();
1221
+ const program = new Command().name("lamsa").description("Design files for apps, driven by your own coding agent. Every command is non-interactive.").version("0.1.1-rc.2").option("--json", "machine-readable output").showHelpAfterError();
1207
1222
  const out = () => createOutput(Boolean(program.opts().json));
1208
1223
  const run = (task) => checkCommandResult(task, Boolean(program.opts().json));
1209
1224
  program.command("init").description("set up lamsa in this repo: config, agent skill, AGENTS.md section").option("--agent <name>", "claude | codex | cursor | generic", "claude").option("--tokens <path>", "token source CSS (default: detect globals.css)").option("--designs <dir>", "where design files live", "designs").option("--force", "overwrite an existing lamsa.config.json").option("--yes", "accepted for scripts; init never prompts").action((o) => run(() => initCommand({
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { t as launchBrowser, r as openWorkspace, n as renderFrames } from "./render-B5Kz3okC.js";
1
+ export { t as launchBrowser, r as openWorkspace, n as renderFrames } from "./render-CiFXTSpf.js";
@@ -2642,11 +2642,17 @@ function installChromium(log) {
2642
2642
  cli,
2643
2643
  "install",
2644
2644
  "chromium-headless-shell"
2645
- ], { stdio: [
2646
- "ignore",
2647
- "ignore",
2648
- "inherit"
2649
- ] });
2645
+ ], {
2646
+ stdio: [
2647
+ "ignore",
2648
+ "ignore",
2649
+ "inherit"
2650
+ ],
2651
+ env: {
2652
+ ...process.env,
2653
+ ELECTRON_RUN_AS_NODE: "1"
2654
+ }
2655
+ });
2650
2656
  }
2651
2657
  async function launchBrowser(log = () => {}) {
2652
2658
  if (!process.env.LAMSA_BUNDLED_CHROMIUM) try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lamsa/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-rc.2",
4
4
  "description": "Local-first design files for apps, driven by your own coding agent",
5
5
  "license": "MIT",
6
6
  "publishConfig": {