chorus-codes 0.8.26 → 0.8.27
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +3 -3
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/connect/page_client-reference-manifest.js +1 -1
- package/.next/server/app/demo/[scenario]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/new.html +1 -1
- package/.next/server/app/new.rsc +1 -1
- package/.next/server/app/new.segments/_full.segment.rsc +1 -1
- package/.next/server/app/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/new.segments/_index.segment.rsc +1 -1
- package/.next/server/app/new.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/new.segments/new/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/new.segments/new.segment.rsc +1 -1
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding.html +1 -1
- package/.next/server/app/onboarding.rsc +1 -1
- package/.next/server/app/onboarding.segments/_full.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_index.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas.html +1 -1
- package/.next/server/app/personas.rsc +1 -1
- package/.next/server/app/personas.segments/_full.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_head.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_index.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/personas.segments/personas/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/personas.segments/personas.segment.rsc +1 -1
- package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/permissions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +1 -1
- package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/.next/server/app/templates.html +1 -1
- package/.next/server/app/templates.rsc +1 -1
- package/.next/server/app/templates.segments/_full.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_head.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_index.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/templates.segments/templates/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/templates.segments/templates.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +3 -3
- package/.next/server/chunks/325.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{245-e103518e1c6037c0.js → 245-203bd8285e6b0858.js} +1 -1
- package/.next/trace +20 -20
- package/.next/trace-build +1 -1
- package/README.md +22 -0
- package/bin/chorus.mjs +87 -5
- package/dist/cli/commands/diagnose.js +255 -0
- package/dist/cli/commands/diagnose.js.map +1 -0
- package/dist/cli/crash-hook.js +135 -0
- package/dist/cli/crash-hook.js.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/daemon/runner/fallback-registry.js +110 -0
- package/dist/daemon/runner/fallback-registry.js.map +1 -0
- package/dist/daemon/runner/reviewer-driver.js +68 -23
- package/dist/daemon/runner/reviewer-driver.js.map +1 -1
- package/dist/daemon/runner/template-fallback.js +22 -8
- package/dist/daemon/runner/template-fallback.js.map +1 -1
- package/package.json +1 -1
- /package/.next/static/{eOeXty5cBGWg7xnmtF6ST → p1K3tWuW1MBx6L7K5jGPV}/_buildManifest.js +0 -0
- /package/.next/static/{eOeXty5cBGWg7xnmtF6ST → p1K3tWuW1MBx6L7K5jGPV}/_ssgManifest.js +0 -0
package/.next/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":11651697,"timestamp":6828811183292,"id":14,"parentId":1,"tags":{},"startTime":1778220181609,"traceId":"9a5b8a7e3af50bc1"},{"name":"run-typescript","duration":5805716,"timestamp":6828822837899,"id":2118,"parentId":1,"tags":{},"startTime":1778220193264,"traceId":"9a5b8a7e3af50bc1"},{"name":"static-check","duration":445586,"timestamp":6828828706455,"id":2121,"parentId":1,"tags":{},"startTime":1778220199132,"traceId":"9a5b8a7e3af50bc1"},{"name":"static-generation","duration":1046366,"timestamp":6828829573846,"id":2161,"parentId":1,"tags":{},"startTime":1778220200000,"traceId":"9a5b8a7e3af50bc1"},{"name":"collect-build-traces","duration":6535738,"timestamp":6828829152477,"id":2158,"parentId":1,"tags":{},"startTime":1778220199579,"traceId":"9a5b8a7e3af50bc1"},{"name":"telemetry-flush","duration":30,"timestamp":6828835689860,"id":2170,"parentId":1,"tags":{},"startTime":1778220206116,"traceId":"9a5b8a7e3af50bc1"},{"name":"next-build","duration":24660005,"timestamp":6828811029893,"id":1,"tags":{"buildMode":"default","version":"16.2.4","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1778220181456,"traceId":"9a5b8a7e3af50bc1"}]
|
package/README.md
CHANGED
|
@@ -328,10 +328,32 @@ chorus start --ui # boot + open browser
|
|
|
328
328
|
chorus stop # shut it down
|
|
329
329
|
chorus status # is it running?
|
|
330
330
|
chorus doctor # diagnose AI tool detection / sandbox issues
|
|
331
|
+
chorus diagnose # print a redacted diagnostic bundle for bug reports
|
|
331
332
|
```
|
|
332
333
|
|
|
333
334
|
---
|
|
334
335
|
|
|
336
|
+
## Reporting bugs
|
|
337
|
+
|
|
338
|
+
When something goes wrong, run:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
chorus diagnose
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
It prints a fenced markdown block with: chorus version, running daemon
|
|
345
|
+
version (and a **VERSION MISMATCH** flag if the CLI was upgraded but the
|
|
346
|
+
daemon hasn't been restarted), node + OS + arch, daemon health, DB
|
|
347
|
+
counts, CLI detection, the latest crash dump if any, and the last 50
|
|
348
|
+
lines of `daemon.log`. Paste the block into a new issue at
|
|
349
|
+
<https://github.com/chorus-codes/chorus/issues/new>.
|
|
350
|
+
|
|
351
|
+
If chorus crashes hard (uncaught exception during boot — common on
|
|
352
|
+
older Node + Windows combos), a self-contained crash log is written to
|
|
353
|
+
`~/.chorus/crashes/<timestamp>.log`. Attach it to the issue.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
335
357
|
## Telemetry
|
|
336
358
|
|
|
337
359
|
Chorus pings home once on startup and once every 24h. The payload is fixed:
|
package/bin/chorus.mjs
CHANGED
|
@@ -13,18 +13,100 @@ if (nodeMajor < 20) {
|
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
import { existsSync } from "node:fs";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { homedir } from "node:os";
|
|
18
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
19
|
+
import { dirname, join, resolve } from "node:path";
|
|
20
|
+
|
|
21
|
+
// Crash hook — installed BEFORE any other import so it captures early
|
|
22
|
+
// startup failures. The src/cli/crash-hook.ts version is the testable
|
|
23
|
+
// canonical source; this is its zero-dependency twin, kept inline so it
|
|
24
|
+
// works even if `await import(distEntry)` itself throws (e.g. the Node
|
|
25
|
+
// 25 + Windows ESM URL scheme bug that motivated this work).
|
|
26
|
+
//
|
|
27
|
+
// Field set must stay in sync with src/cli/crash-hook.ts buildCrashLog
|
|
28
|
+
// (timestamp, source, chorus, node, platform, argv, cwd, uptime_ms).
|
|
29
|
+
// Drift means the maintainer has to read two formats. The package
|
|
30
|
+
// version is read from package.json beside this file rather than
|
|
31
|
+
// importing pkg from src — that import would itself need to load via
|
|
32
|
+
// dist/src and could fail in the very situations this hook exists for.
|
|
33
|
+
const ISSUE_URL = "https://github.com/chorus-codes/chorus/issues/new";
|
|
34
|
+
|
|
35
|
+
function readChorusVersion() {
|
|
36
|
+
try {
|
|
37
|
+
const __dn = dirname(fileURLToPath(import.meta.url));
|
|
38
|
+
const raw = readFileSync(resolve(__dn, "..", "package.json"), "utf-8");
|
|
39
|
+
const parsed = JSON.parse(raw);
|
|
40
|
+
return typeof parsed.version === "string" ? parsed.version : "(unknown)";
|
|
41
|
+
} catch {
|
|
42
|
+
return "(unknown)";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function installCrashHook() {
|
|
47
|
+
const crashDir = join(homedir(), ".chorus", "crashes");
|
|
48
|
+
const version = readChorusVersion();
|
|
49
|
+
const handle = (err, source) => {
|
|
50
|
+
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
51
|
+
const stack =
|
|
52
|
+
err instanceof Error
|
|
53
|
+
? `${err.name}: ${err.message}\n${err.stack ?? "(no stack)"}`
|
|
54
|
+
: String(err);
|
|
55
|
+
const body = [
|
|
56
|
+
"# Chorus crash report",
|
|
57
|
+
"",
|
|
58
|
+
`timestamp: ${new Date().toISOString()}`,
|
|
59
|
+
`source: ${source}`,
|
|
60
|
+
`chorus: ${version}`,
|
|
61
|
+
`node: ${process.versions.node}`,
|
|
62
|
+
`platform: ${process.platform} ${process.arch}`,
|
|
63
|
+
`argv: ${process.argv.slice(1).join(" ")}`,
|
|
64
|
+
`cwd: ${process.cwd()}`,
|
|
65
|
+
`uptime_ms: ${Math.round(process.uptime() * 1000)}`,
|
|
66
|
+
"",
|
|
67
|
+
"## Error",
|
|
68
|
+
"",
|
|
69
|
+
stack,
|
|
70
|
+
"",
|
|
71
|
+
].join("\n");
|
|
72
|
+
let written = null;
|
|
73
|
+
try {
|
|
74
|
+
mkdirSync(crashDir, { recursive: true });
|
|
75
|
+
written = join(crashDir, `${ts}.log`);
|
|
76
|
+
writeFileSync(written, body, "utf-8");
|
|
77
|
+
} catch {
|
|
78
|
+
written = null;
|
|
79
|
+
}
|
|
80
|
+
const headline =
|
|
81
|
+
err instanceof Error ? `${err.name}: ${err.message}` : String(err);
|
|
82
|
+
process.stderr.write(`\n✗ Chorus crashed (${source}): ${headline}\n`);
|
|
83
|
+
if (written) {
|
|
84
|
+
process.stderr.write(` Crash log saved to: ${written}\n`);
|
|
85
|
+
process.stderr.write(` Please attach it to a new issue: ${ISSUE_URL}\n`);
|
|
86
|
+
process.stderr.write(` Or run: chorus diagnose\n\n`);
|
|
87
|
+
} else {
|
|
88
|
+
process.stderr.write(` (could not write log to ${crashDir})\n`);
|
|
89
|
+
process.stderr.write(` Please file an issue at ${ISSUE_URL} with:\n`);
|
|
90
|
+
process.stderr.write(body + "\n\n");
|
|
91
|
+
}
|
|
92
|
+
process.exit(1);
|
|
93
|
+
};
|
|
94
|
+
process.on("uncaughtException", (err) => handle(err, "uncaughtException"));
|
|
95
|
+
process.on("unhandledRejection", (err) => handle(err, "unhandledRejection"));
|
|
96
|
+
}
|
|
97
|
+
installCrashHook();
|
|
19
98
|
|
|
20
99
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
100
|
const distEntry = resolve(__dirname, "../dist/cli/index.js");
|
|
22
101
|
|
|
102
|
+
// Use pathToFileURL so dynamic import works on Windows where absolute
|
|
103
|
+
// paths look like `C:\...` and Node 25 rejects them as bare URLs with
|
|
104
|
+
// ERR_UNSUPPORTED_ESM_URL_SCHEME (Reddit user `SelectSouth2582` 2026-05-08).
|
|
23
105
|
if (existsSync(distEntry)) {
|
|
24
|
-
await import(distEntry);
|
|
106
|
+
await import(pathToFileURL(distEntry).href);
|
|
25
107
|
} else {
|
|
26
108
|
// Dev / unpublished install — register tsx and run from src.
|
|
27
109
|
const tsx = await import("tsx/esm/api");
|
|
28
110
|
tsx.register();
|
|
29
|
-
await import(resolve(__dirname, "../src/cli/index.ts"));
|
|
111
|
+
await import(pathToFileURL(resolve(__dirname, "../src/cli/index.ts")).href);
|
|
30
112
|
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._testing = void 0;
|
|
7
|
+
exports.formatReport = formatReport;
|
|
8
|
+
exports.registerDiagnoseCommand = registerDiagnoseCommand;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const daemon_discovery_js_1 = require("../../lib/daemon-discovery.js");
|
|
13
|
+
const shared_js_1 = require("../shared.js");
|
|
14
|
+
const ISSUE_URL = 'https://github.com/chorus-codes/chorus/issues/new';
|
|
15
|
+
function abbreviateHome(p) {
|
|
16
|
+
const home = os_1.default.homedir();
|
|
17
|
+
return p.startsWith(home) ? '~' + p.slice(home.length) : p;
|
|
18
|
+
}
|
|
19
|
+
function detectInstallMode(binPath) {
|
|
20
|
+
if (binPath.includes('node_modules'))
|
|
21
|
+
return 'global-npm';
|
|
22
|
+
if (binPath.endsWith('.ts'))
|
|
23
|
+
return 'dev-tsx';
|
|
24
|
+
if (binPath.includes('/dist/') || binPath.includes('\\dist\\'))
|
|
25
|
+
return 'local-dist';
|
|
26
|
+
return 'unknown';
|
|
27
|
+
}
|
|
28
|
+
function tailFile(p, lines) {
|
|
29
|
+
try {
|
|
30
|
+
if (!fs_1.default.existsSync(p))
|
|
31
|
+
return '(file not present)';
|
|
32
|
+
const content = fs_1.default.readFileSync(p, 'utf-8');
|
|
33
|
+
const all = content.split('\n');
|
|
34
|
+
return all.slice(-lines).join('\n').trim();
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return `(read failed: ${err instanceof Error ? err.message : String(err)})`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function gather() {
|
|
41
|
+
const chorusDir = path_1.default.join(os_1.default.homedir(), '.chorus');
|
|
42
|
+
const cliVersion = shared_js_1.pkg.version;
|
|
43
|
+
// Daemon state — look up daemon.json and probe /health for the
|
|
44
|
+
// currently-running version. Mismatch flag fires when CLI has been
|
|
45
|
+
// upgraded but the running daemon is still on the old version
|
|
46
|
+
// (the case the user hit after `npm install -g` without restart).
|
|
47
|
+
let runningDaemonVersion = null;
|
|
48
|
+
let healthyOnPort = null;
|
|
49
|
+
let daemonPidAlive = null;
|
|
50
|
+
let daemonJsonRaw = '(missing)';
|
|
51
|
+
try {
|
|
52
|
+
const info = (0, daemon_discovery_js_1.readDaemonInfo)();
|
|
53
|
+
if (info) {
|
|
54
|
+
daemonJsonRaw = JSON.stringify(info, null, 2);
|
|
55
|
+
try {
|
|
56
|
+
process.kill(info.daemonPid, 0);
|
|
57
|
+
daemonPidAlive = true;
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
// ESRCH — process truly dead. EPERM — process exists but we
|
|
61
|
+
// don't own it (sudo'd daemon, container UID mismatch). Treat
|
|
62
|
+
// EPERM as alive — the daemon is there, we just can't signal
|
|
63
|
+
// it. Distinguishing matters: a sudo-started daemon with a
|
|
64
|
+
// user-mode CLI looks "dead" without this check, leading to
|
|
65
|
+
// wrong remediation advice in the bug report.
|
|
66
|
+
const code = err.code;
|
|
67
|
+
daemonPidAlive = code === 'EPERM';
|
|
68
|
+
}
|
|
69
|
+
const healthy = await (0, daemon_discovery_js_1.isDaemonHealthy)(info.daemonPort, 800);
|
|
70
|
+
if (healthy) {
|
|
71
|
+
healthyOnPort = info.daemonPort;
|
|
72
|
+
try {
|
|
73
|
+
// Mirror the 800ms cap from isDaemonHealthy. Without this,
|
|
74
|
+
// a daemon that passes the first health probe but stalls on
|
|
75
|
+
// the second response will hang `chorus diagnose` forever —
|
|
76
|
+
// the very state we're trying to capture in a bug report.
|
|
77
|
+
const ac = new AbortController();
|
|
78
|
+
const timer = setTimeout(() => ac.abort(), 800);
|
|
79
|
+
try {
|
|
80
|
+
const res = await fetch(`http://127.0.0.1:${info.daemonPort}/api/v1/health`, { signal: ac.signal });
|
|
81
|
+
const env = (await res.json());
|
|
82
|
+
if (env.data?.version)
|
|
83
|
+
runningDaemonVersion = env.data.version;
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
clearTimeout(timer);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
/* health passed but version read failed/timed out — leave null */
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
/* daemon.json absent or malformed — leave defaults */
|
|
97
|
+
}
|
|
98
|
+
const mismatch = runningDaemonVersion !== null && runningDaemonVersion !== cliVersion;
|
|
99
|
+
// DB counts — best-effort. If the daemon is on an old version with
|
|
100
|
+
// a schema we can't read, we want to say "(unavailable)" not crash.
|
|
101
|
+
let chatsCount = '(unavailable)';
|
|
102
|
+
let voicesCount = '(unavailable)';
|
|
103
|
+
try {
|
|
104
|
+
const { getDb } = await import('../../lib/db/connection.js');
|
|
105
|
+
const db = await getDb();
|
|
106
|
+
const cr = await db.execute('SELECT COUNT(*) AS n FROM chats');
|
|
107
|
+
const vr = await db.execute('SELECT COUNT(*) AS n FROM voices');
|
|
108
|
+
chatsCount = Number(cr.rows[0].n);
|
|
109
|
+
voicesCount = Number(vr.rows[0].n);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
chatsCount = `(error: ${err instanceof Error ? err.message.slice(0, 80) : 'unknown'})`;
|
|
113
|
+
}
|
|
114
|
+
// Crashes — list crashes/ dir, surface the most recent file and a
|
|
115
|
+
// 20-line preview. The crash hook writes here; if diagnose finds
|
|
116
|
+
// entries, the user almost certainly wants to attach them.
|
|
117
|
+
let crashCount = 0;
|
|
118
|
+
let latestCrash = null;
|
|
119
|
+
try {
|
|
120
|
+
const crashDir = path_1.default.join(chorusDir, 'crashes');
|
|
121
|
+
if (fs_1.default.existsSync(crashDir)) {
|
|
122
|
+
const entries = fs_1.default
|
|
123
|
+
.readdirSync(crashDir)
|
|
124
|
+
.filter((n) => n.endsWith('.log'))
|
|
125
|
+
.map((n) => ({ name: n, full: path_1.default.join(crashDir, n) }))
|
|
126
|
+
.sort((a, b) => (a.name < b.name ? 1 : -1));
|
|
127
|
+
crashCount = entries.length;
|
|
128
|
+
if (entries.length > 0) {
|
|
129
|
+
const head = entries[0];
|
|
130
|
+
latestCrash = {
|
|
131
|
+
file: abbreviateHome(head.full),
|
|
132
|
+
preview: tailFile(head.full, 20),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
/* crashes dir unreadable — leave defaults */
|
|
139
|
+
}
|
|
140
|
+
// CLI detection — reuse the same module doctor uses, but emit a
|
|
141
|
+
// compact summary (no PATH visibility section; that's doctor's job).
|
|
142
|
+
let clis = [];
|
|
143
|
+
try {
|
|
144
|
+
const { detectAllClis } = await import('../../lib/cli-detect.js');
|
|
145
|
+
const found = detectAllClis(true);
|
|
146
|
+
clis = found.map((d) => ({
|
|
147
|
+
id: d.id,
|
|
148
|
+
found: d.found,
|
|
149
|
+
path: d.path ? abbreviateHome(d.path) : undefined,
|
|
150
|
+
reason: d.reason,
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
/* detection module load failed — leave empty */
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
chorus: { cliVersion, runningDaemonVersion, mismatch },
|
|
158
|
+
runtime: {
|
|
159
|
+
node: process.versions.node,
|
|
160
|
+
platform: process.platform,
|
|
161
|
+
arch: process.arch,
|
|
162
|
+
release: os_1.default.release(),
|
|
163
|
+
},
|
|
164
|
+
install: {
|
|
165
|
+
binPath: abbreviateHome(process.argv[1] ?? '(unknown)'),
|
|
166
|
+
mode: detectInstallMode(process.argv[1] ?? ''),
|
|
167
|
+
},
|
|
168
|
+
daemon: { daemonJson: daemonJsonRaw, daemonPidAlive, healthyOnPort },
|
|
169
|
+
db: { chats: chatsCount, voices: voicesCount },
|
|
170
|
+
logs: {
|
|
171
|
+
daemonTail: tailFile(path_1.default.join(chorusDir, 'logs', 'daemon.log'), 50),
|
|
172
|
+
webTail: tailFile(path_1.default.join(chorusDir, 'logs', 'web.log'), 20),
|
|
173
|
+
},
|
|
174
|
+
crashes: { count: crashCount, latest: latestCrash },
|
|
175
|
+
clis,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function formatReport(s) {
|
|
179
|
+
const lines = [];
|
|
180
|
+
lines.push('```');
|
|
181
|
+
lines.push('# Chorus diagnose');
|
|
182
|
+
lines.push('');
|
|
183
|
+
lines.push(`chorus CLI: ${s.chorus.cliVersion}`);
|
|
184
|
+
lines.push(`running daemon: ${s.chorus.runningDaemonVersion ?? '(not reachable)'}` +
|
|
185
|
+
(s.chorus.mismatch ? ' ⚠ VERSION MISMATCH — run `chorus stop && chorus start`' : ''));
|
|
186
|
+
lines.push(`node: ${s.runtime.node}`);
|
|
187
|
+
lines.push(`platform: ${s.runtime.platform} (${s.runtime.arch}, ${s.runtime.release})`);
|
|
188
|
+
lines.push(`install mode: ${s.install.mode}`);
|
|
189
|
+
lines.push(`bin path: ${s.install.binPath}`);
|
|
190
|
+
lines.push('');
|
|
191
|
+
lines.push('## Daemon state');
|
|
192
|
+
lines.push(`pid alive: ${s.daemon.daemonPidAlive ?? '(no daemon.json)'}`);
|
|
193
|
+
lines.push(`health probe: ${s.daemon.healthyOnPort !== null ? `OK on :${s.daemon.healthyOnPort}` : 'no response'}`);
|
|
194
|
+
lines.push('daemon.json:');
|
|
195
|
+
for (const ln of s.daemon.daemonJson.split('\n'))
|
|
196
|
+
lines.push(` ${ln}`);
|
|
197
|
+
lines.push('');
|
|
198
|
+
lines.push('## DB');
|
|
199
|
+
lines.push(`chats: ${s.db.chats}`);
|
|
200
|
+
lines.push(`voices: ${s.db.voices}`);
|
|
201
|
+
lines.push('');
|
|
202
|
+
lines.push('## CLI detection');
|
|
203
|
+
if (s.clis.length === 0) {
|
|
204
|
+
lines.push('(detection module failed to load)');
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
for (const c of s.clis) {
|
|
208
|
+
lines.push(c.found
|
|
209
|
+
? ` ✓ ${c.id.padEnd(14)} ${c.path ?? ''}`
|
|
210
|
+
: ` ✗ ${c.id.padEnd(14)} not found${c.reason ? ` — ${c.reason}` : ''}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
lines.push('');
|
|
214
|
+
lines.push('## Crashes');
|
|
215
|
+
lines.push(`count: ${s.crashes.count}`);
|
|
216
|
+
if (s.crashes.latest) {
|
|
217
|
+
lines.push(`latest: ${s.crashes.latest.file}`);
|
|
218
|
+
lines.push('preview:');
|
|
219
|
+
for (const ln of s.crashes.latest.preview.split('\n'))
|
|
220
|
+
lines.push(` ${ln}`);
|
|
221
|
+
}
|
|
222
|
+
lines.push('');
|
|
223
|
+
lines.push('## Recent daemon.log (last 50 lines)');
|
|
224
|
+
for (const ln of s.logs.daemonTail.split('\n'))
|
|
225
|
+
lines.push(` ${ln}`);
|
|
226
|
+
lines.push('');
|
|
227
|
+
lines.push('## Recent web.log (last 20 lines)');
|
|
228
|
+
for (const ln of s.logs.webTail.split('\n'))
|
|
229
|
+
lines.push(` ${ln}`);
|
|
230
|
+
lines.push('```');
|
|
231
|
+
return lines.join('\n');
|
|
232
|
+
}
|
|
233
|
+
function registerDiagnoseCommand(program) {
|
|
234
|
+
program
|
|
235
|
+
.command('diagnose')
|
|
236
|
+
.description('Print a redacted diagnostic bundle to paste into a bug report')
|
|
237
|
+
.action(async () => {
|
|
238
|
+
try {
|
|
239
|
+
const snap = await gather();
|
|
240
|
+
const report = formatReport(snap);
|
|
241
|
+
console.log('');
|
|
242
|
+
console.log(report);
|
|
243
|
+
console.log('');
|
|
244
|
+
console.log(`Copy the block above into a new issue: ${ISSUE_URL}`);
|
|
245
|
+
console.log('');
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
console.error('diagnose failed:', err instanceof Error ? err.message : err);
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
// Exported for tests — pure function over a snapshot is easy to assert.
|
|
254
|
+
exports._testing = { gather, formatReport, detectInstallMode, abbreviateHome };
|
|
255
|
+
//# sourceMappingURL=diagnose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnose.js","sourceRoot":"","sources":["../../../src/cli/commands/diagnose.ts"],"names":[],"mappings":";;;;;;AAmNA,oCAyDC;AAED,0DAyBC;AA/QD,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,uEAAgF;AAChF,4CAAmC;AAEnC,MAAM,SAAS,GAAG,mDAAmD,CAAC;AAiBtE,SAAS,cAAc,CAAC,CAAS;IAC/B,MAAM,IAAI,GAAG,YAAE,CAAC,OAAO,EAAE,CAAC;IAC1B,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAe;IACxC,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;QAAE,OAAO,YAAY,CAAC;IAC1D,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,YAAY,CAAC;IACpF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,KAAa;IACxC,IAAI,CAAC;QACH,IAAI,CAAC,YAAE,CAAC,UAAU,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C,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CACT,0CAA0C,SAAS,EAAE,CACtD,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CACX,kBAAkB,EAClB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CACzC,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,wEAAwE;AAC3D,QAAA,QAAQ,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._testing = void 0;
|
|
4
|
+
exports.installCrashHook = installCrashHook;
|
|
5
|
+
/**
|
|
6
|
+
* Crash hook — last-resort uncaught error capture for the CLI.
|
|
7
|
+
*
|
|
8
|
+
* Goals:
|
|
9
|
+
* 1. When the bin entry crashes (uncaught exception or unhandled
|
|
10
|
+
* rejection), write a single self-contained log file to
|
|
11
|
+
* ~/.chorus/crashes/<ISO>.log so the user has something concrete
|
|
12
|
+
* to attach to a bug report.
|
|
13
|
+
* 2. Print a one-line nudge to stderr pointing at the file + the
|
|
14
|
+
* issues URL. Do NOT dump the full stack — most users panic at
|
|
15
|
+
* raw stack traces; the file is for the maintainer.
|
|
16
|
+
* 3. NEVER throw from inside the hook — a hook that itself crashes
|
|
17
|
+
* is the worst failure mode (silently lost diagnostic).
|
|
18
|
+
*
|
|
19
|
+
* Why this lives in its own tiny module:
|
|
20
|
+
* - Must be installable BEFORE any other import in bin/chorus.mjs so
|
|
21
|
+
* it catches early-startup crashes (e.g. the Node 25 + Windows
|
|
22
|
+
* ESM URL scheme issue that motivated this work — bin's
|
|
23
|
+
* `await import(distEntry)` fails with `Received protocol 'c:'`
|
|
24
|
+
* before any CLI code runs).
|
|
25
|
+
* - Therefore can't depend on commander, ui.ts, libsql, or any
|
|
26
|
+
* compiled module that itself might fail to load.
|
|
27
|
+
*
|
|
28
|
+
* Plain `node:` builtins only — same reason. Module is loaded by the
|
|
29
|
+
* .mjs bin in raw-ESM mode, no tsx, no transpile.
|
|
30
|
+
*/
|
|
31
|
+
const node_fs_1 = require("node:fs");
|
|
32
|
+
const node_os_1 = require("node:os");
|
|
33
|
+
const node_path_1 = require("node:path");
|
|
34
|
+
const ISSUE_URL = 'https://github.com/chorus-codes/chorus/issues/new';
|
|
35
|
+
function timestamp() {
|
|
36
|
+
return new Date().toISOString().replace(/[:.]/g, '-');
|
|
37
|
+
}
|
|
38
|
+
function buildCrashLog(err, source, version) {
|
|
39
|
+
const stack = err instanceof Error
|
|
40
|
+
? `${err.name}: ${err.message}\n${err.stack ?? '(no stack)'}`
|
|
41
|
+
: String(err);
|
|
42
|
+
return [
|
|
43
|
+
'# Chorus crash report',
|
|
44
|
+
'',
|
|
45
|
+
`timestamp: ${new Date().toISOString()}`,
|
|
46
|
+
`source: ${source}`,
|
|
47
|
+
`chorus: ${version}`,
|
|
48
|
+
`node: ${process.versions.node}`,
|
|
49
|
+
`platform: ${process.platform} ${process.arch}`,
|
|
50
|
+
`argv: ${process.argv.slice(1).join(' ')}`,
|
|
51
|
+
`cwd: ${process.cwd()}`,
|
|
52
|
+
`uptime_ms: ${Math.round(process.uptime() * 1000)}`,
|
|
53
|
+
'',
|
|
54
|
+
'## Error',
|
|
55
|
+
'',
|
|
56
|
+
stack,
|
|
57
|
+
'',
|
|
58
|
+
].join('\n');
|
|
59
|
+
}
|
|
60
|
+
function writeCrashFile(dir, body) {
|
|
61
|
+
try {
|
|
62
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
63
|
+
const file = (0, node_path_1.join)(dir, `${timestamp()}.log`);
|
|
64
|
+
(0, node_fs_1.writeFileSync)(file, body, { encoding: 'utf-8' });
|
|
65
|
+
return file;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// mkdir or write failed (read-only home, ENOSPC, ...). The hook
|
|
69
|
+
// must still print SOMETHING useful to stderr — the user's
|
|
70
|
+
// diagnostic value here is "chorus crashed at <stack>", not "we
|
|
71
|
+
// couldn't write a file."
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Install crash handlers on process. Idempotent — calling twice is a
|
|
77
|
+
* no-op. We track the registered listeners so `_testing.reset()` (and
|
|
78
|
+
* a hypothetical re-install in production) can detach them, otherwise
|
|
79
|
+
* each test that runs install spawns a new listener and the next
|
|
80
|
+
* uncaughtException fires the cumulative chain N times.
|
|
81
|
+
*/
|
|
82
|
+
let installed = false;
|
|
83
|
+
let activeUncaught = null;
|
|
84
|
+
let activeUnhandled = null;
|
|
85
|
+
function installCrashHook(opts = {}) {
|
|
86
|
+
if (installed)
|
|
87
|
+
return;
|
|
88
|
+
installed = true;
|
|
89
|
+
const crashDir = opts.crashDir ?? (0, node_path_1.join)((0, node_os_1.homedir)(), '.chorus', 'crashes');
|
|
90
|
+
const stderr = opts.stderr ?? ((msg) => process.stderr.write(msg));
|
|
91
|
+
const exit = opts.exit ?? ((code) => process.exit(code));
|
|
92
|
+
const version = opts.version ?? '(unknown)';
|
|
93
|
+
const handle = (err, source) => {
|
|
94
|
+
const body = buildCrashLog(err, source, version);
|
|
95
|
+
const file = writeCrashFile(crashDir, body);
|
|
96
|
+
const headline = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
|
|
97
|
+
stderr('\n');
|
|
98
|
+
stderr(`✗ Chorus crashed (${source}): ${headline}\n`);
|
|
99
|
+
if (file) {
|
|
100
|
+
stderr(` Crash log saved to: ${file}\n`);
|
|
101
|
+
stderr(` Please attach it to a new issue: ${ISSUE_URL}\n`);
|
|
102
|
+
stderr(' Or run: chorus diagnose\n');
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// File write failed — give the user the stack inline as a
|
|
106
|
+
// last-resort fallback so they have something to paste.
|
|
107
|
+
stderr(` (could not write crash log to ${crashDir})\n`);
|
|
108
|
+
stderr(` Please file an issue at ${ISSUE_URL} with this stack:\n`);
|
|
109
|
+
stderr(body + '\n');
|
|
110
|
+
}
|
|
111
|
+
stderr('\n');
|
|
112
|
+
exit(1);
|
|
113
|
+
};
|
|
114
|
+
activeUncaught = (err) => handle(err, 'uncaughtException');
|
|
115
|
+
activeUnhandled = (err) => handle(err, 'unhandledRejection');
|
|
116
|
+
process.on('uncaughtException', activeUncaught);
|
|
117
|
+
process.on('unhandledRejection', activeUnhandled);
|
|
118
|
+
}
|
|
119
|
+
// Exported for tests.
|
|
120
|
+
exports._testing = {
|
|
121
|
+
buildCrashLog,
|
|
122
|
+
writeCrashFile,
|
|
123
|
+
reset: () => {
|
|
124
|
+
if (activeUncaught) {
|
|
125
|
+
process.off('uncaughtException', activeUncaught);
|
|
126
|
+
activeUncaught = null;
|
|
127
|
+
}
|
|
128
|
+
if (activeUnhandled) {
|
|
129
|
+
process.off('unhandledRejection', activeUnhandled);
|
|
130
|
+
activeUnhandled = null;
|
|
131
|
+
}
|
|
132
|
+
installed = false;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=crash-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crash-hook.js","sourceRoot":"","sources":["../../src/cli/crash-hook.ts"],"names":[],"mappings":";;;AAwGA,4CAoCC;AA5ID;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qCAAmD;AACnD,qCAAkC;AAClC,yCAAiC;AAEjC,MAAM,SAAS,GAAG,mDAAmD,CAAC;AAgBtE,SAAS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AC,oBAAoB,EAAE,eAAe,CAAC,CAAC;YACnD,eAAe,GAAG,IAAI,CAAC;QACzB,CAAC;QACD,SAAS,GAAG,KAAK,CAAC;IACpB,CAAC;CACF,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const open_1 = __importDefault(require("open"));
|
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const daemon_discovery_js_1 = require("../lib/daemon-discovery.js");
|
|
12
|
+
const diagnose_js_1 = require("./commands/diagnose.js");
|
|
12
13
|
const doctor_js_1 = require("./commands/doctor.js");
|
|
13
14
|
const init_js_1 = require("./commands/init.js");
|
|
14
15
|
const start_js_1 = require("./commands/start.js");
|
|
@@ -60,6 +61,7 @@ program.addHelpText('beforeAll', () => {
|
|
|
60
61
|
(0, stop_js_1.registerStopCommand)(program);
|
|
61
62
|
(0, status_js_1.registerStatusCommand)(program);
|
|
62
63
|
(0, doctor_js_1.registerDoctorCommand)(program);
|
|
64
|
+
(0, diagnose_js_1.registerDiagnoseCommand)(program);
|
|
63
65
|
(0, update_js_1.registerUpdateCommand)(program);
|
|
64
66
|
program
|
|
65
67
|
.command('ui')
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,gDAAwB;AACxB,oEAA+D;AAC/D,oDAA6D;AAC7D,gDAAyD;AACzD,kDAA2D;AAC3D,oDAA6D;AAC7D,gDAAyD;AACzD,oDAA6D;AAC7D,qDAA2E;AAC3E,2CAAkC;AAClC,mCAAsC;AAEtC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,0DAA0D,CAAC;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