@larkup/cli 0.2.14 → 0.2.16

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/README.md CHANGED
@@ -40,4 +40,4 @@ larkup media ./demo.mp4
40
40
  - `larkup open [target]` opens the Web UI or API reference.
41
41
  - `larkup update` checks for and installs CLI releases.
42
42
 
43
- Generated servers use `http://localhost:8080` by default. Run `larkup --help` or see the [CLI documentation](https://larkup.de/docs/developer/cli) for all options.
43
+ Generated servers use `http://localhost:8080` by default. Run `larkup --help` or see the [CLI documentation](https://www.larkup.de/docs/developer/cli) for all options.
@@ -70,6 +70,84 @@ async function getInstalledTool(toolId) {
70
70
  const tools = await getInstalledTools();
71
71
  return tools.find((t) => t.id === toolId);
72
72
  }
73
+ var INSTALL_HINTS = {
74
+ ffmpeg: {
75
+ macos: "brew install ffmpeg",
76
+ linux_apt: "sudo apt-get install -y ffmpeg",
77
+ linux_dnf: "sudo dnf install -y ffmpeg",
78
+ linux_pacman: "sudo pacman -S --noconfirm ffmpeg",
79
+ linux_apk: "sudo apk add --no-cache ffmpeg"
80
+ }
81
+ };
82
+ function detectPlatform() {
83
+ if (process.platform === "darwin") return "macos";
84
+ return "linux";
85
+ }
86
+ async function tryAutoInstallDep(dep, onProgress) {
87
+ const hints = INSTALL_HINTS[dep];
88
+ if (!hints) return false;
89
+ const platform = detectPlatform();
90
+ let installCmd;
91
+ if (platform === "macos") {
92
+ try {
93
+ await execAsync("which brew");
94
+ installCmd = hints.macos;
95
+ } catch {
96
+ return false;
97
+ }
98
+ } else {
99
+ const managers = [
100
+ { cmd: "apt-get", key: "linux_apt" },
101
+ { cmd: "dnf", key: "linux_dnf" },
102
+ { cmd: "pacman", key: "linux_pacman" },
103
+ { cmd: "apk", key: "linux_apk" }
104
+ ];
105
+ for (const { cmd, key } of managers) {
106
+ try {
107
+ await execAsync(`which ${cmd}`);
108
+ installCmd = hints[key];
109
+ break;
110
+ } catch {
111
+ }
112
+ }
113
+ }
114
+ if (!installCmd) return false;
115
+ onProgress?.(`Auto-installing ${dep} via "${installCmd}"\u2026`);
116
+ try {
117
+ await execAsync(installCmd, { timeout: 3e5 });
118
+ onProgress?.(`${dep} installation command finished.`);
119
+ } catch (err) {
120
+ const message = err instanceof Error ? err.message : String(err);
121
+ onProgress?.(`Auto-install of ${dep} failed: ${message}`);
122
+ return false;
123
+ }
124
+ try {
125
+ await execAsync(`which ${dep}`);
126
+ return true;
127
+ } catch {
128
+ return false;
129
+ }
130
+ }
131
+ function buildMissingDepsMessage(deps) {
132
+ const platform = detectPlatform();
133
+ const lines = [`Missing system dependencies: ${deps.join(", ")}.`];
134
+ for (const dep of deps) {
135
+ const hints = INSTALL_HINTS[dep];
136
+ if (!hints) {
137
+ lines.push(` \u2022 ${dep}: Please install it manually.`);
138
+ continue;
139
+ }
140
+ if (platform === "macos" && hints.macos) {
141
+ lines.push(` \u2022 ${dep}: Run \`${hints.macos}\``);
142
+ } else if (platform === "linux") {
143
+ const linuxHint = hints.linux_apt || hints.linux_dnf || hints.linux_pacman || hints.linux_apk;
144
+ if (linuxHint) {
145
+ lines.push(` \u2022 ${dep}: Run \`${linuxHint}\``);
146
+ }
147
+ }
148
+ }
149
+ return lines.join("\n");
150
+ }
73
151
  async function checkSystemDeps(toolId) {
74
152
  const descriptor = await getToolById(toolId);
75
153
  if (!descriptor?.systemDeps?.length) return [];
@@ -241,9 +319,22 @@ async function installTool(toolId, onProgress) {
241
319
  throw new Error(`${descriptor.name} is coming soon.`);
242
320
  }
243
321
  report("checking-deps", 15, "Checking system dependencies\u2026");
244
- const missing = (await checkSystemDeps(toolId)).filter((dependency) => dependency !== "docker");
322
+ let missing = (await checkSystemDeps(toolId)).filter((dependency) => dependency !== "docker");
323
+ if (missing.length > 0) {
324
+ const stillMissing = [];
325
+ for (const dep of missing) {
326
+ report("checking-deps", 18, `Attempting to install ${dep}\u2026`);
327
+ const installed = await tryAutoInstallDep(dep, (msg) => report("checking-deps", 20, msg));
328
+ if (installed) {
329
+ report("checking-deps", 22, `${dep} installed successfully.`);
330
+ } else {
331
+ stillMissing.push(dep);
332
+ }
333
+ }
334
+ missing = stillMissing;
335
+ }
245
336
  if (missing.length > 0) {
246
- const msg = `Missing system dependencies: ${missing.join(", ")}. Please install them first.`;
337
+ const msg = buildMissingDepsMessage(missing);
247
338
  report("failed", 0, msg);
248
339
  throw new Error(msg);
249
340
  }
@@ -323,7 +414,7 @@ async function uninstallTool(toolId) {
323
414
  }
324
415
  }
325
416
  invalidateRegistryCache();
326
- const { unloadTool: unloadTool2 } = await import("./tool-loader-BAUVT52G.js");
417
+ const { unloadTool: unloadTool2 } = await import("./tool-loader-AM6O3TCX.js");
327
418
  unloadTool2(toolId);
328
419
  }
329
420
  async function notifyHubInstall(toolId) {
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  isToolInstalled,
20
20
  loadTool,
21
21
  uninstallTool
22
- } from "./chunk-ECNTPZXZ.js";
22
+ } from "./chunk-EVFK76V4.js";
23
23
  import {
24
24
  getAllTools,
25
25
  getToolById
@@ -34,7 +34,7 @@ import { Command } from "commander";
34
34
  // package.json
35
35
  var package_default = {
36
36
  name: "@larkup/cli",
37
- version: "0.2.14",
37
+ version: "0.2.16",
38
38
  publishConfig: {
39
39
  access: "public"
40
40
  },
@@ -141,7 +141,7 @@ var prompts = {
141
141
  };
142
142
 
143
143
  // src/updater.ts
144
- var VERSION_CHECK_URL = "https://larkup.de/api/version";
144
+ var VERSION_CHECK_URL = "https://www.larkup.de/api/version";
145
145
  function compareVersions(a, b) {
146
146
  const pa = a.replace(/^v/, "").split(".").map(Number);
147
147
  const pb = b.replace(/^v/, "").split(".").map(Number);
@@ -3,7 +3,7 @@ import {
3
3
  isToolLoaded,
4
4
  loadTool,
5
5
  unloadTool
6
- } from "./chunk-ECNTPZXZ.js";
6
+ } from "./chunk-EVFK76V4.js";
7
7
  import "./chunk-UCYL66UI.js";
8
8
  import "./chunk-3RG5ZIWI.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larkup/cli",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,9 +29,9 @@
29
29
  "cli-table3": "^0.6.5",
30
30
  "commander": "^15.0.0",
31
31
  "zod": "^4.4.3",
32
- "@larkup/vector-stores": "0.1.24",
33
32
  "@larkup/core": "0.3.1",
34
- "@larkup/marketplace": "0.1.14"
33
+ "@larkup/marketplace": "0.1.16",
34
+ "@larkup/vector-stores": "0.1.24"
35
35
  },
36
36
  "devDependencies": {
37
37
  "tsup": "^8.0.0",