oh-langfuse 0.1.66 → 0.1.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-langfuse",
3
- "version": "0.1.66",
3
+ "version": "0.1.68",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Use npm scripts to configure Claude Code / OpenCode / Codex with Langfuse tracing.",
@@ -6,9 +6,10 @@ import { fileURLToPath } from "node:url";
6
6
  import { extractVersionFromNpmMetadata, isNewerVersion } from "./update-utils.mjs";
7
7
  import { getRuntimeInstallRecord } from "./runtime-state-utils.mjs";
8
8
 
9
- const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
10
- const packageJson = JSON.parse(fs.readFileSync(path.join(rootDir, "package.json"), "utf8"));
11
- const ALLOWED_TARGETS = new Set(["claude", "opencode", "codex"]);
9
+ const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
10
+ const packageJson = JSON.parse(fs.readFileSync(path.join(rootDir, "package.json"), "utf8"));
11
+ const ALLOWED_TARGETS = new Set(["claude", "opencode", "codex"]);
12
+ const OFFICIAL_NPM_REGISTRY = "https://registry.npmjs.org/";
12
13
 
13
14
  const colorEnabled = process.stdout.isTTY && process.env.NO_COLOR !== "1";
14
15
  const ansi = (code) => (colorEnabled ? `\x1b[${code}m` : "");
@@ -39,7 +40,7 @@ function parseArgs(argv) {
39
40
  return args;
40
41
  }
41
42
 
42
- async function latestVersion(packageName, registry = "https://registry.npmjs.org") {
43
+ async function latestVersion(packageName, registry = OFFICIAL_NPM_REGISTRY) {
43
44
  const base = registry.replace(/\/+$/, "");
44
45
  const response = await fetch(`${base}/${packageName}`, { headers: { accept: "application/json" } });
45
46
  if (!response.ok) throw new Error(`npm registry ${response.status} ${response.statusText}`);
@@ -105,15 +106,15 @@ function printAlreadyCurrent(target, packageName, version) {
105
106
  console.log(paint(`[OK] ${label} Langfuse \u5df2\u662f\u6700\u65b0\uff1a${packageName}@${version}`, t.bold, t.green));
106
107
  }
107
108
 
108
- function updateCommandForPackage(packageName, target) {
109
- if (packageName === "oh-aicoding-tool") return `npx oh-aicoding-tool@latest langfuse update ${target}`;
110
- return `npx ${packageName}@latest update ${target}`;
111
- }
112
-
113
- function updateArgsForPackage(packageName, target) {
114
- if (packageName === "oh-aicoding-tool") return ["-y", "oh-aicoding-tool@latest", "langfuse", "update", target];
115
- return ["-y", `${packageName}@latest`, "update", target];
116
- }
109
+ function updateCommandForPackage(packageName, target) {
110
+ if (packageName === "oh-aicoding-tool") return `npx --registry=${OFFICIAL_NPM_REGISTRY} oh-aicoding-tool@latest langfuse update ${target}`;
111
+ return `npx --registry=${OFFICIAL_NPM_REGISTRY} ${packageName}@latest update ${target}`;
112
+ }
113
+
114
+ function updateArgsForPackage(packageName, target) {
115
+ if (packageName === "oh-aicoding-tool") return ["-y", `--registry=${OFFICIAL_NPM_REGISTRY}`, "oh-aicoding-tool@latest", "langfuse", "update", target];
116
+ return ["-y", `--registry=${OFFICIAL_NPM_REGISTRY}`, `${packageName}@latest`, "update", target];
117
+ }
117
118
 
118
119
  function runUpdate(target, packageName, args) {
119
120
  const updateArgs = updateArgsForPackage(packageName, target);
@@ -132,7 +132,7 @@ function writeAutoUpdateHelper(target) {
132
132
  const helperDir = autoUpdateHelperDir();
133
133
  ensureDir(helperDir);
134
134
  const runtimePath = autoUpdateRuntimePath();
135
- const fallbackArgs = ["-y", "oh-langfuse@latest", "auto-update", target, "--skip-check", "--startup-status"];
135
+ const fallbackArgs = ["-y", "--registry=https://registry.npmjs.org/", "oh-langfuse@latest", "auto-update", target, "--skip-check", "--startup-status"];
136
136
 
137
137
  if (process.platform === "win32") {
138
138
  const helper = path.join(helperDir, `oh-langfuse-auto-update-${target}.cmd`);
@@ -161,7 +161,7 @@ function writeAutoUpdateHelper(target) {
161
161
  const helperDir = autoUpdateHelperDir();
162
162
  ensureDir(helperDir);
163
163
  const runtimePath = autoUpdateRuntimePath();
164
- const fallbackArgs = ["-y", "oh-langfuse@latest", "auto-update", target, "--skip-check", "--startup-status"];
164
+ const fallbackArgs = ["-y", "--registry=https://registry.npmjs.org/", "oh-langfuse@latest", "auto-update", target, "--skip-check", "--startup-status"];
165
165
 
166
166
  if (process.platform === "win32") {
167
167
  const helper = path.join(helperDir, `oh-langfuse-auto-update-${target}.cmd`);
@@ -868,7 +868,7 @@ function writeAutoUpdateHelper(target) {
868
868
  const helperDir = autoUpdateHelperDir();
869
869
  ensureDir(helperDir);
870
870
  const runtimePath = autoUpdateRuntimePath();
871
- const fallbackArgs = ["-y", "oh-langfuse@latest", "auto-update", target, "--skip-check", "--startup-status"];
871
+ const fallbackArgs = ["-y", "--registry=https://registry.npmjs.org/", "oh-langfuse@latest", "auto-update", target, "--skip-check", "--startup-status"];
872
872
 
873
873
  if (process.platform === "win32") {
874
874
  const helper = path.join(helperDir, `oh-langfuse-auto-update-${target}.cmd`);
@@ -983,8 +983,10 @@ function writeOpencodeCommandShim(opencodeDir, { publicKey, secretKey, baseUrl,
983
983
  cmd.push(" exit /b %ERRORLEVEL%");
984
984
  cmd.push(" )");
985
985
  cmd.push(")");
986
- cmd.push("call npx.cmd -y opencode@latest %*");
987
- cmd.push("exit /b %ERRORLEVEL%");
986
+ cmd.push("echo [ERROR] OpenCode CLI not found. Install OpenCode CLI first. 1>&2");
987
+ cmd.push("echo Try: npm install -g opencode-windows-x64 1>&2");
988
+ cmd.push("echo Then run: npx oh-langfuse@latest update opencode 1>&2");
989
+ cmd.push("exit /b 127");
988
990
  fs.writeFileSync(shim, cmd.join("\r\n") + "\r\n", "utf8");
989
991
  return { shim, shimDir };
990
992
  }
@@ -1008,7 +1010,11 @@ function writeOpencodeCommandShim(opencodeDir, { publicKey, secretKey, baseUrl,
1008
1010
  ' resolved="$(command -v opencode)"',
1009
1011
  ' if [ "$resolved" != "$0" ]; then exec "$resolved" "$@"; fi',
1010
1012
  "fi",
1011
- 'exec npx -y opencode@latest "$@"',
1013
+ 'echo "[ERROR] OpenCode CLI not found. Install OpenCode CLI first." >&2',
1014
+ 'echo "Try: npm install -g opencode-linux-x64" >&2',
1015
+ 'echo "If that package fails on your host, try opencode-linux-x64-baseline or opencode-linux-x64-musl." >&2',
1016
+ 'echo "Then run: npx oh-langfuse@latest update opencode" >&2',
1017
+ "exit 127",
1012
1018
  ""
1013
1019
  ].filter(Boolean);
1014
1020
  fs.writeFileSync(shim, lines.join("\n"), "utf8");