@larkup/cli 0.2.3 → 0.2.4

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.
@@ -90,7 +90,7 @@ var FALLBACK_REGISTRY = {
90
90
  name: "Video & Audio",
91
91
  description: "Index video and audio files with transcription and frame analysis.",
92
92
  category: "media",
93
- version: "0.2.0",
93
+ version: "0.2.1",
94
94
  pricing: "free",
95
95
  emoji: "\u{1F3AC}",
96
96
  icon: "Film",
@@ -171,7 +171,7 @@ var FALLBACK_REGISTRY = {
171
171
  name: "Document Editor",
172
172
  description: "AI-powered form filling and document editing with Canvas-style live preview.",
173
173
  category: "utility",
174
- version: "0.2.1",
174
+ version: "0.2.3",
175
175
  pricing: "free",
176
176
  emoji: "\u{1F4DD}",
177
177
  icon: "FileEdit",
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  getAllTools,
17
17
  getToolById,
18
18
  invalidateRegistryCache
19
- } from "./chunk-SWHRNA3E.js";
19
+ } from "./chunk-P5JVXA7X.js";
20
20
  import {
21
21
  __require
22
22
  } from "./chunk-3RG5ZIWI.js";
@@ -27,7 +27,7 @@ import { Command } from "commander";
27
27
  // package.json
28
28
  var package_default = {
29
29
  name: "@larkup/cli",
30
- version: "0.2.3",
30
+ version: "0.2.4",
31
31
  publishConfig: {
32
32
  access: "public"
33
33
  },
@@ -4904,10 +4904,10 @@ async function execInstall(packageName, version, target, onProgress) {
4904
4904
  case "local":
4905
4905
  case "docker": {
4906
4906
  await ensureToolsPackageJson();
4907
- const installCmd = `npm install ${packageName}@${version} --prefix "${toolsDir}" --save --no-audit --no-fund`;
4908
- onProgress?.(`Running: npm install ${packageName}@${version}`);
4909
- try {
4910
- const { stdout, stderr } = await execAsync2(installCmd, {
4907
+ const install = async (specifier) => {
4908
+ const installCmd = `npm install ${specifier} --prefix "${toolsDir}" --save --no-audit --no-fund`;
4909
+ onProgress?.(`Running: npm install ${specifier}`);
4910
+ const { stderr } = await execAsync2(installCmd, {
4911
4911
  cwd: toolsDir,
4912
4912
  timeout: 12e4,
4913
4913
  // 2 minute timeout
@@ -4916,9 +4916,23 @@ async function execInstall(packageName, version, target, onProgress) {
4916
4916
  if (stderr && !stderr.includes("npm warn")) {
4917
4917
  console.warn(`[marketplace] Install stderr: ${stderr}`);
4918
4918
  }
4919
+ };
4920
+ try {
4921
+ await install(`${packageName}@${version}`);
4919
4922
  } catch (err) {
4920
4923
  const message = err instanceof Error ? err.message : "Install command failed";
4921
- throw new Error(`Failed to install ${packageName}: ${message}`);
4924
+ if (!message.includes("ETARGET") && !message.includes("No matching version found")) {
4925
+ throw new Error(`Failed to install ${packageName}: ${message}`);
4926
+ }
4927
+ onProgress?.(
4928
+ `Catalog version ${version} is unavailable; installing the latest published version\u2026`
4929
+ );
4930
+ try {
4931
+ await install(`${packageName}@latest`);
4932
+ } catch (latestErr) {
4933
+ const latestMessage = latestErr instanceof Error ? latestErr.message : "Install command failed";
4934
+ throw new Error(`Failed to install ${packageName}: ${latestMessage}`);
4935
+ }
4922
4936
  }
4923
4937
  const resolvedPath = path9.join(toolsDir, "node_modules", packageName);
4924
4938
  try {
@@ -4928,7 +4942,10 @@ async function execInstall(packageName, version, target, onProgress) {
4928
4942
  `Package ${packageName} was installed but could not be found at ${resolvedPath}`
4929
4943
  );
4930
4944
  }
4931
- return resolvedPath;
4945
+ const packageJson = JSON.parse(
4946
+ await fs8.readFile(path9.join(resolvedPath, "package.json"), "utf8")
4947
+ );
4948
+ return { resolvedPath, version: packageJson.version ?? version };
4932
4949
  }
4933
4950
  case "serverless": {
4934
4951
  onProgress?.("Serverless environment detected \u2014 queuing for next deploy");
@@ -4942,14 +4959,14 @@ async function execInstall(packageName, version, target, onProgress) {
4942
4959
  pending.tools.push({ packageName, version });
4943
4960
  await ensureDir();
4944
4961
  await fs8.writeFile(pendingPath, JSON.stringify(pending, null, 2), "utf8");
4945
- return path9.join(toolsDir, "node_modules", packageName);
4962
+ return { resolvedPath: path9.join(toolsDir, "node_modules", packageName), version };
4946
4963
  }
4947
4964
  case "sandbox": {
4948
4965
  onProgress?.("Installing in sandbox environment");
4949
4966
  await ensureToolsPackageJson();
4950
4967
  const installCmd = `npm install ${packageName}@${version} --prefix "${toolsDir}" --save --no-audit --no-fund`;
4951
4968
  await execAsync2(installCmd, { cwd: toolsDir, timeout: 12e4 });
4952
- return path9.join(toolsDir, "node_modules", packageName);
4969
+ return { resolvedPath: path9.join(toolsDir, "node_modules", packageName), version };
4953
4970
  }
4954
4971
  default:
4955
4972
  throw new Error(`Unsupported deployment target: ${target}`);
@@ -4992,6 +5009,7 @@ async function installTool(toolId, onProgress) {
4992
5009
  const isWorkspace = await isWorkspaceTool(descriptor.packageName);
4993
5010
  const target = detectDeploymentTarget();
4994
5011
  let resolvedPath;
5012
+ let installedVersion = descriptor.version;
4995
5013
  let source;
4996
5014
  if (isWorkspace) {
4997
5015
  report("downloading", 30, "Resolving workspace package\u2026");
@@ -5007,12 +5025,14 @@ async function installTool(toolId, onProgress) {
5007
5025
  report("installing", 60, "Workspace package resolved.");
5008
5026
  } else {
5009
5027
  report("downloading", 30, `Downloading ${descriptor.packageName}@${descriptor.version}\u2026`);
5010
- resolvedPath = await execInstall(
5028
+ const installed = await execInstall(
5011
5029
  descriptor.packageName,
5012
5030
  descriptor.version,
5013
5031
  target,
5014
5032
  (msg) => report("downloading", 50, msg)
5015
5033
  );
5034
+ resolvedPath = installed.resolvedPath;
5035
+ installedVersion = installed.version;
5016
5036
  source = target === "sandbox" ? "sandbox" : "registry";
5017
5037
  report("installing", 70, "Package installed.");
5018
5038
  }
@@ -5022,7 +5042,7 @@ async function installTool(toolId, onProgress) {
5022
5042
  const existing = manifest.tools.findIndex((t) => t.id === toolId);
5023
5043
  const entry = {
5024
5044
  id: toolId,
5025
- version: descriptor.version,
5045
+ version: installedVersion,
5026
5046
  installedAt: (/* @__PURE__ */ new Date()).toISOString(),
5027
5047
  packageName: descriptor.packageName,
5028
5048
  resolvedPath,
@@ -6,7 +6,7 @@ import {
6
6
  getToolById,
7
7
  getToolsWithCapability,
8
8
  invalidateRegistryCache
9
- } from "./chunk-SWHRNA3E.js";
9
+ } from "./chunk-P5JVXA7X.js";
10
10
  import "./chunk-3RG5ZIWI.js";
11
11
  export {
12
12
  buildRegistry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larkup/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,9 +28,9 @@
28
28
  "cli-table3": "^0.6.5",
29
29
  "commander": "^15.0.0",
30
30
  "zod": "^4.4.3",
31
- "@larkup/vector-stores": "0.1.22",
32
- "@larkup/marketplace": "0.1.3",
33
- "@larkup/core": "0.2.2"
31
+ "@larkup/core": "0.2.2",
32
+ "@larkup/marketplace": "0.1.4",
33
+ "@larkup/vector-stores": "0.1.22"
34
34
  },
35
35
  "devDependencies": {
36
36
  "tsup": "^8.0.0",