oh-langfuse 0.1.22 → 0.1.23
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 +1 -1
- package/package.json +4 -4
- package/scripts/opencode-langfuse-check.mjs +0 -52
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-langfuse",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Use npm scripts to configure Claude Code / OpenCode / Codex with Langfuse tracing.",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"opencode:langfuse:run": "node scripts/opencode-langfuse-run.mjs",
|
|
43
43
|
"codex:setup": "node scripts/codex-langfuse-setup.mjs",
|
|
44
44
|
"codex:check": "node scripts/codex-langfuse-check.mjs",
|
|
45
|
-
"codex:langfuse:setup": "node scripts/codex-langfuse-setup.mjs",
|
|
46
|
-
"codex:langfuse:check": "node scripts/codex-langfuse-check.mjs"
|
|
47
|
-
},
|
|
45
|
+
"codex:langfuse:setup": "node scripts/codex-langfuse-setup.mjs",
|
|
46
|
+
"codex:langfuse:check": "node scripts/codex-langfuse-check.mjs"
|
|
47
|
+
},
|
|
48
48
|
"dependencies": {}
|
|
49
49
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import os from "node:os";
|
|
4
|
-
import { spawnSync } from "node:child_process";
|
|
5
4
|
import { parseJsonRelaxed, stripBom } from "./json-utils.mjs";
|
|
6
5
|
|
|
7
6
|
function parseArgs(argv) {
|
|
@@ -50,24 +49,6 @@ function addResult(results, item, ok, detail, fix = "") {
|
|
|
50
49
|
results.push({ item, ok, detail, fix });
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
function envStatus(publicKey, secretKey, baseUrl) {
|
|
54
|
-
return `publicKey=${publicKey ? "set" : "missing"}, secretKey=${secretKey ? "set" : "missing"}, baseUrl=${
|
|
55
|
-
baseUrl || "missing"
|
|
56
|
-
}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function windowsUserEnv(name) {
|
|
60
|
-
if (process.platform !== "win32") return "";
|
|
61
|
-
const escapedName = name.replace(/'/g, "''");
|
|
62
|
-
const result = spawnSync(
|
|
63
|
-
"powershell.exe",
|
|
64
|
-
["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", `[Environment]::GetEnvironmentVariable('${escapedName}', 'User')`],
|
|
65
|
-
{ encoding: "utf8", windowsHide: true }
|
|
66
|
-
);
|
|
67
|
-
if (result.status !== 0) return "";
|
|
68
|
-
return (result.stdout || "").trim();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
52
|
function main() {
|
|
72
53
|
const home = os.homedir();
|
|
73
54
|
const opencodeDir = path.join(home, ".config", "opencode");
|
|
@@ -153,39 +134,6 @@ function main() {
|
|
|
153
134
|
"Run setup again and enter userId when prompted."
|
|
154
135
|
);
|
|
155
136
|
|
|
156
|
-
const currentPublicKey = process.env.LANGFUSE_PUBLIC_KEY || "";
|
|
157
|
-
const currentSecretKey = process.env.LANGFUSE_SECRET_KEY || "";
|
|
158
|
-
const currentBaseUrl = process.env.LANGFUSE_BASEURL || "";
|
|
159
|
-
const currentEnvOk = !!(currentPublicKey && currentSecretKey && currentBaseUrl);
|
|
160
|
-
const launcherCmdOk = fs.existsSync(windowsLauncherPath);
|
|
161
|
-
|
|
162
|
-
let envAvailableOk = currentEnvOk;
|
|
163
|
-
let envAvailableDetail = `current terminal: ${envStatus(currentPublicKey, currentSecretKey, currentBaseUrl)}`;
|
|
164
|
-
if (process.platform === "win32") {
|
|
165
|
-
const userPublicKey = windowsUserEnv("LANGFUSE_PUBLIC_KEY");
|
|
166
|
-
const userSecretKey = windowsUserEnv("LANGFUSE_SECRET_KEY");
|
|
167
|
-
const userBaseUrl = windowsUserEnv("LANGFUSE_BASEURL");
|
|
168
|
-
const userEnvOk = !!(userPublicKey && userSecretKey && userBaseUrl);
|
|
169
|
-
envAvailableOk = currentEnvOk || userEnvOk || launcherCmdOk;
|
|
170
|
-
if (currentEnvOk) {
|
|
171
|
-
envAvailableDetail = `current terminal: ${envStatus(currentPublicKey, currentSecretKey, currentBaseUrl)}`;
|
|
172
|
-
} else if (userEnvOk) {
|
|
173
|
-
envAvailableDetail = `current terminal missing; Windows user env is set and will apply to new terminals`;
|
|
174
|
-
} else if (launcherCmdOk) {
|
|
175
|
-
envAvailableDetail = `current terminal missing; launcher cmd exists and will inject LANGFUSE_*`;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
addResult(
|
|
180
|
-
results,
|
|
181
|
-
"OpenCode LANGFUSE_* availability",
|
|
182
|
-
envAvailableOk,
|
|
183
|
-
envAvailableDetail,
|
|
184
|
-
process.platform === "win32"
|
|
185
|
-
? "Run setup again, open a new terminal, or launch with ~/.config/opencode/launch-opencode-langfuse.cmd."
|
|
186
|
-
: "Open a new terminal, source your shell rc file, or launch with ~/.config/opencode/launch-opencode-langfuse.sh."
|
|
187
|
-
);
|
|
188
|
-
|
|
189
137
|
if (process.platform === "win32") {
|
|
190
138
|
addResult(
|
|
191
139
|
results,
|