claudeck 1.0.4 → 1.0.6
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 +1 -1
- package/server/routes/stats.js +19 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudeck",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A browser-based UI for Claude Code — chat, run workflows, manage MCP servers, track costs, and orchestrate autonomous agents from a local web interface. Installable as a PWA.",
|
|
6
6
|
"main": "server.js",
|
package/server/routes/stats.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from "express";
|
|
2
|
-
import { execFile } from "child_process";
|
|
2
|
+
import { execFile, exec } from "child_process";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { existsSync } from "fs";
|
|
5
5
|
import { homedir } from "os";
|
|
@@ -28,6 +28,10 @@ function findClaudeBinary() {
|
|
|
28
28
|
if (process.platform === "win32") {
|
|
29
29
|
candidates.push(join(home, "AppData", "Local", "Programs", "claude", "claude.exe"));
|
|
30
30
|
candidates.push(join(home, ".claude", "local", "claude.exe"));
|
|
31
|
+
// npm global installs on Windows — both .cmd shim and plain executable
|
|
32
|
+
const appData = process.env.APPDATA || join(home, "AppData", "Roaming");
|
|
33
|
+
candidates.push(join(appData, "npm", "claude.cmd"));
|
|
34
|
+
candidates.push(join(appData, "npm", "claude"));
|
|
31
35
|
}
|
|
32
36
|
for (const p of candidates) {
|
|
33
37
|
if (existsSync(p)) return p;
|
|
@@ -42,13 +46,21 @@ router.get("/account", async (req, res) => {
|
|
|
42
46
|
}
|
|
43
47
|
try {
|
|
44
48
|
const data = await new Promise((resolve, reject) => {
|
|
45
|
-
const opts = { timeout: 10000 };
|
|
46
|
-
|
|
47
|
-
if (process.platform === "win32") opts.shell = true;
|
|
48
|
-
execFile(claudeBin, ["auth", "status"], opts, (err, stdout) => {
|
|
49
|
+
const opts = { timeout: 10000, env: { ...process.env, FORCE_COLOR: "0" } };
|
|
50
|
+
const cb = (err, stdout, stderr) => {
|
|
49
51
|
if (err) return reject(err);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
const out = (stdout || "").trim();
|
|
53
|
+
try { resolve(JSON.parse(out)); } catch {
|
|
54
|
+
// claude auth status may not return JSON — extract what we can
|
|
55
|
+
resolve({ email: null, subscriptionType: null, raw: out });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
// On Windows, use exec with shell so .cmd shims and PATH resolve correctly
|
|
59
|
+
if (process.platform === "win32") {
|
|
60
|
+
exec(`"${claudeBin}" auth status`, { ...opts, shell: true }, cb);
|
|
61
|
+
} else {
|
|
62
|
+
execFile(claudeBin, ["auth", "status"], opts, cb);
|
|
63
|
+
}
|
|
52
64
|
});
|
|
53
65
|
cachedAccountInfo = {
|
|
54
66
|
email: data.email || null,
|