tracer-sh 0.3.0 → 0.3.2
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/bin/tracer.mjs +58 -3
- package/package.json +1 -1
- package/packages/server/dist/{chunk-WOL2ZWU7.js → chunk-5GQDB6U7.js} +4 -0
- package/packages/server/dist/chunk-IAWOYD5E.js +4793 -0
- package/packages/server/dist/{chunk-WUFQGSGW.js → chunk-YL5JSOUN.js} +1 -1
- package/packages/server/dist/dist-ZMUHFP5T.js +1257 -0
- package/packages/server/dist/{domain-knowledge-4AAER546.js → domain-knowledge-B2IREATL.js} +1 -1
- package/packages/server/dist/{domain-knowledge-CAD7MDFJ.js → domain-knowledge-K3OB4NDB.js} +1 -1
- package/packages/server/dist/{domain-knowledge-A3WXZ55R.js → domain-knowledge-U2RLSFM2.js} +1 -1
- package/packages/server/dist/index.js +39640 -23247
- package/packages/server/dist/multipart-parser-ONCUQ5VA.js +372 -0
- package/packages/server/dist/src-434DTNEL.js +1409 -0
- package/packages/server/dist/{token-QV5VOVJ4.js → token-4YFRZJYT.js} +2 -2
- package/packages/server/dist/{token-util-DLXYCJR4.js → token-util-CTKMWUIG.js} +2 -2
- package/packages/web/dist/assets/{SearchableSelect-ClBD3uDN.js → SearchableSelect-BGG4ZQsh.js} +1 -1
- package/packages/web/dist/assets/Settings-CbI-LDKy.js +1 -0
- package/packages/web/dist/assets/{highlighted-body-OFNGDK62-ClhPAwAu.js → highlighted-body-OFNGDK62-DZkDbKbU.js} +1 -1
- package/packages/web/dist/assets/index-BMMlPHJO.css +1 -0
- package/packages/web/dist/assets/index-D555Ai5J.js +48 -0
- package/packages/web/dist/assets/{mermaid-GHXKKRXX-BP9XJxn7.js → mermaid-GHXKKRXX-B2DXmpLw.js} +84 -84
- package/packages/web/dist/index.html +2 -2
- package/packages/web/dist/assets/Settings-DqYpr-dx.js +0 -1
- package/packages/web/dist/assets/index-B4Hwftt4.css +0 -1
- package/packages/web/dist/assets/index-BfsXwolP.js +0 -48
package/bin/tracer.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
|
-
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
4
|
+
import { existsSync, readdirSync, statSync, readFileSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { dirname, join, resolve } from "node:path";
|
|
7
7
|
|
|
@@ -12,14 +12,68 @@ const serverPath = resolve(repoRoot, "packages/server/dist/index.js");
|
|
|
12
12
|
// Must match RESTART_EXIT_CODE in packages/server/src/updater.ts
|
|
13
13
|
const RESTART_EXIT_CODE = 75;
|
|
14
14
|
|
|
15
|
+
const cmd = process.argv[2];
|
|
16
|
+
|
|
17
|
+
// `tracer-sh --help` / `-h` / `help` — usage for every subcommand.
|
|
18
|
+
if (cmd === "--help" || cmd === "-h" || cmd === "help") {
|
|
19
|
+
printHelp();
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// `tracer-sh --version` / `-v` — print the installed version.
|
|
24
|
+
if (cmd === "--version" || cmd === "-v" || cmd === "version") {
|
|
25
|
+
process.stdout.write(getVersion() + "\n");
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
// `tracer analyze "<message>" [--session <id>] [--provider <name>] [--json]`
|
|
16
30
|
// Runs the investigation agent on the already-running local server and prints
|
|
17
31
|
// the final analysis. Lets other local agents (e.g. Claude Code) drive Tracer.
|
|
18
|
-
if (
|
|
32
|
+
if (cmd === "analyze") {
|
|
19
33
|
await runAnalyze(process.argv.slice(3));
|
|
20
34
|
process.exit(0);
|
|
21
35
|
}
|
|
22
36
|
|
|
37
|
+
/** Read the package version (best-effort; "unknown" if package.json is unreadable). */
|
|
38
|
+
function getVersion() {
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(readFileSync(join(repoRoot, "package.json"), "utf8")).version ?? "unknown";
|
|
41
|
+
} catch {
|
|
42
|
+
return "unknown";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function printHelp() {
|
|
47
|
+
process.stdout.write(`Tracer ${getVersion()} — local-first AI observability agent
|
|
48
|
+
|
|
49
|
+
Usage:
|
|
50
|
+
tracer-sh Start the Tracer server (default http://127.0.0.1:3579)
|
|
51
|
+
tracer-sh analyze "<message>" [options] Run a headless investigation on a running server
|
|
52
|
+
tracer-sh --help Show this help
|
|
53
|
+
tracer-sh --version Print the version
|
|
54
|
+
|
|
55
|
+
analyze options:
|
|
56
|
+
-s, --session <id> Resume an existing session by id (preserves full context)
|
|
57
|
+
-p, --provider <name> Scope to one provider (newrelic, gcp, posthog); omit for unified mode
|
|
58
|
+
--json Print the full JSON envelope:
|
|
59
|
+
{ sessionId, status, analysis, queries, usage, model }.
|
|
60
|
+
The "queries" array holds the FULL raw rows and can be very
|
|
61
|
+
large. Without --json, stdout is just the analysis prose and the
|
|
62
|
+
line "session <id> · <model>" is written to stderr.
|
|
63
|
+
|
|
64
|
+
Environment:
|
|
65
|
+
TRACER_PORT Server port (default 3579)
|
|
66
|
+
TRACER_HOST Bind/target host (default 127.0.0.1)
|
|
67
|
+
TRACER_SKIP_BUILD Skip the source-checkout rebuild-on-launch check
|
|
68
|
+
|
|
69
|
+
Examples:
|
|
70
|
+
tracer-sh
|
|
71
|
+
tracer-sh analyze "Why did checkout error rate spike after 14:00 UTC?"
|
|
72
|
+
tracer-sh analyze "Now break that down by service." --session <id>
|
|
73
|
+
tracer-sh analyze "Top 5 slowest GCP Cloud Run requests." --provider gcp
|
|
74
|
+
`);
|
|
75
|
+
}
|
|
76
|
+
|
|
23
77
|
async function runAnalyze(args) {
|
|
24
78
|
let message;
|
|
25
79
|
let sessionId;
|
|
@@ -28,7 +82,8 @@ async function runAnalyze(args) {
|
|
|
28
82
|
|
|
29
83
|
for (let i = 0; i < args.length; i++) {
|
|
30
84
|
const a = args[i];
|
|
31
|
-
if (a === "--
|
|
85
|
+
if (a === "--help" || a === "-h") { printHelp(); process.exit(0); }
|
|
86
|
+
else if (a === "--json") asJson = true;
|
|
32
87
|
else if (a === "--session" || a === "-s") sessionId = args[++i];
|
|
33
88
|
else if (a === "--provider" || a === "-p") provider = args[++i];
|
|
34
89
|
else if (message === undefined) message = a;
|
package/package.json
CHANGED
|
@@ -11,6 +11,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
12
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
13
|
});
|
|
14
|
+
var __esm = (fn, res) => function __init() {
|
|
15
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
+
};
|
|
14
17
|
var __commonJS = (cb, mod) => function __require2() {
|
|
15
18
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
19
|
};
|
|
@@ -37,6 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
40
|
|
|
38
41
|
export {
|
|
39
42
|
__require,
|
|
43
|
+
__esm,
|
|
40
44
|
__commonJS,
|
|
41
45
|
__export,
|
|
42
46
|
__toESM
|