tracer-sh 0.2.1 → 0.2.3

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.
Files changed (23) hide show
  1. package/README.md +11 -1
  2. package/bin/tracer.mjs +58 -0
  3. package/package.json +7 -2
  4. package/packages/server/dist/{chunk-6QUU7TGZ.js → chunk-IKD3ICQK.js} +2 -0
  5. package/packages/server/dist/{chunk-OTYSD6PF.js → chunk-L7TO4UJ4.js} +2 -0
  6. package/packages/server/dist/{chunk-4VNS5WPM.js → chunk-WOL2ZWU7.js} +1 -0
  7. package/packages/server/dist/{chunk-7J2BYJNR.js → chunk-WUFQGSGW.js} +2 -1
  8. package/packages/server/dist/{chunk-5IQ4TST5.js → chunk-XFJVNMJI.js} +2 -0
  9. package/packages/server/dist/{domain-knowledge-WHIEZOOH.js → domain-knowledge-4AAER546.js} +3 -2
  10. package/packages/server/dist/{domain-knowledge-V6AENXZV.js → domain-knowledge-A3WXZ55R.js} +3 -2
  11. package/packages/server/dist/{domain-knowledge-5ZUPRLNB.js → domain-knowledge-CAD7MDFJ.js} +3 -2
  12. package/packages/server/dist/index.js +601 -77
  13. package/packages/server/dist/{token-4WRACUIQ.js → token-QV5VOVJ4.js} +3 -2
  14. package/packages/server/dist/token-util-DLXYCJR4.js +6 -0
  15. package/packages/web/dist/assets/{SearchableSelect-DGHfwNeM.js → SearchableSelect-DwcqGvga.js} +1 -1
  16. package/packages/web/dist/assets/{Settings-CM7N7YVW.js → Settings-V6P0atyS.js} +1 -1
  17. package/packages/web/dist/assets/{highlighted-body-OFNGDK62-CbmcR8p5.js → highlighted-body-OFNGDK62-BI81QblF.js} +1 -1
  18. package/packages/web/dist/assets/{index-DLQaH2AJ.css → index-CxrnanDH.css} +1 -1
  19. package/packages/web/dist/assets/index-XO-cs6YP.js +48 -0
  20. package/packages/web/dist/assets/{mermaid-GHXKKRXX-BCl4cq6r.js → mermaid-GHXKKRXX-mO3J4JDi.js} +3 -3
  21. package/packages/web/dist/index.html +2 -2
  22. package/packages/server/dist/token-util-NKFL6ZOU.js +0 -5
  23. package/packages/web/dist/assets/index-Chm2Gi5F.js +0 -48
package/README.md CHANGED
@@ -66,9 +66,19 @@ tracer-sh
66
66
 
67
67
  Open `http://localhost:3579`, go to **Settings** to add your API keys and choose an LLM — done.
68
68
 
69
+ ## Headless / CLI
70
+
71
+ Run an investigation from the terminal and get back the final analysis — so other tools and agents (including Claude Code) can drive Tracer:
72
+
73
+ ```bash
74
+ tracer-sh analyze "Why did checkout error rate spike after 14:00 UTC?"
75
+ ```
76
+
77
+ Continue a prior run with `--session <id>`; pass `--json` for the full response (session id, queries, usage). Requires a running server.
78
+
69
79
  ## Supported Providers
70
80
 
71
- **Data:** New Relic (NRQL via NerdGraph), Google Cloud (Logs, Traces, Metrics, Errors)
81
+ **Data:** New Relic (NRQL), Google Cloud (Logs, Traces, Metrics, Errors), PostHog (HogQL)
72
82
 
73
83
  **LLM:** Anthropic (Claude), Google (Gemini)
74
84
 
package/bin/tracer.mjs CHANGED
@@ -10,6 +10,64 @@ const serverPath = resolve(__dirname, "../packages/server/dist/index.js");
10
10
  // Must match RESTART_EXIT_CODE in packages/server/src/updater.ts
11
11
  const RESTART_EXIT_CODE = 75;
12
12
 
13
+ // `tracer analyze "<message>" [--session <id>] [--provider <name>] [--json]`
14
+ // Runs the investigation agent on the already-running local server and prints
15
+ // the final analysis. Lets other local agents (e.g. Claude Code) drive Tracer.
16
+ if (process.argv[2] === "analyze") {
17
+ await runAnalyze(process.argv.slice(3));
18
+ process.exit(0);
19
+ }
20
+
21
+ async function runAnalyze(args) {
22
+ let message;
23
+ let sessionId;
24
+ let provider;
25
+ let asJson = false;
26
+
27
+ for (let i = 0; i < args.length; i++) {
28
+ const a = args[i];
29
+ if (a === "--json") asJson = true;
30
+ else if (a === "--session" || a === "-s") sessionId = args[++i];
31
+ else if (a === "--provider" || a === "-p") provider = args[++i];
32
+ else if (message === undefined) message = a;
33
+ }
34
+
35
+ if (!message) {
36
+ console.error('Usage: tracer-sh analyze "<message>" [--session <id>] [--provider <name>] [--json]');
37
+ process.exit(2);
38
+ }
39
+
40
+ const host = process.env.TRACER_HOST || "127.0.0.1";
41
+ const port = process.env.TRACER_PORT || "3579";
42
+ const url = `http://${host}:${port}/api/v1/analyze`;
43
+
44
+ let res;
45
+ try {
46
+ res = await fetch(url, {
47
+ method: "POST",
48
+ headers: { "content-type": "application/json" },
49
+ body: JSON.stringify({ message, sessionId, provider }),
50
+ });
51
+ } catch {
52
+ console.error(`Could not reach Tracer at ${url}. Is the server running? Start it with: tracer-sh`);
53
+ process.exit(1);
54
+ }
55
+
56
+ const data = await res.json().catch(() => ({}));
57
+
58
+ if (!res.ok || data.status === "error") {
59
+ console.error(`Error: ${data.error || res.statusText}`);
60
+ process.exit(1);
61
+ }
62
+
63
+ if (asJson) {
64
+ process.stdout.write(JSON.stringify(data, null, 2) + "\n");
65
+ } else {
66
+ process.stdout.write((data.analysis || "") + "\n");
67
+ console.error(`session ${data.sessionId}${data.model ? ` · ${data.model}` : ""}`);
68
+ }
69
+ }
70
+
13
71
  const banner = `
14
72
  ╔═══════════════════════════════════╗
15
73
  ║ Tracer Debug Platform ║
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tracer-sh",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "Local-first debugging & analysis platform",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -34,7 +34,12 @@
34
34
  "onlyBuiltDependencies": [
35
35
  "better-sqlite3",
36
36
  "esbuild"
37
- ]
37
+ ],
38
+ "overrides": {
39
+ "mermaid": "^11.15.0",
40
+ "postcss": "^8.5.10",
41
+ "uuid": "^11.1.1"
42
+ }
38
43
  },
39
44
  "devDependencies": {
40
45
  "concurrently": "^9.2.1",
@@ -1,3 +1,5 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
2
+
1
3
  // src/providers/gcp/domain-knowledge.ts
2
4
  var GCP_AUTH_STOP_RULE = `## Authentication Failure \u2014 STOP IMMEDIATELY
3
5
  If any tool returns an authentication or permission error (e.g. "unauthenticated", "permission denied", "credentials", "401", "403", "UNAUTHENTICATED", "insufficient permissions"), **STOP ALL FURTHER TOOL CALLS** and report:
@@ -1,3 +1,5 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
2
+
1
3
  // src/providers/posthog/domain-knowledge.ts
2
4
  var POSTHOG_AUTH_STOP_RULE = `## Authentication Failure \u2014 STOP IMMEDIATELY
3
5
  If any query returns an authentication or permission error (e.g. "Invalid personal API key", "401", "403", "Unauthorized", "Forbidden"), **STOP ALL FURTHER TOOL CALLS** and report:
@@ -1,3 +1,4 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,7 +1,8 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  __commonJS,
3
4
  __require
4
- } from "./chunk-4VNS5WPM.js";
5
+ } from "./chunk-WOL2ZWU7.js";
5
6
 
6
7
  // ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-error.js
7
8
  var require_token_error = __commonJS({
@@ -1,3 +1,5 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
2
+
1
3
  // src/providers/newrelic/domain-knowledge.ts
2
4
  var NR_AUTH_STOP_RULE = `## Authentication Failure \u2014 STOP IMMEDIATELY
3
5
  If any query returns an authentication or permission error (e.g. "Invalid API key", "401", "403", "Unauthorized"), **STOP ALL FURTHER TOOL CALLS** and report:
@@ -1,10 +1,11 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  NR_AUTH_STOP_RULE,
3
4
  NR_DOMAIN_KNOWLEDGE,
4
5
  NR_INSIDE_OUT_DEBUGGING,
5
6
  NR_SERVICE_HEALTH_RUNBOOK
6
- } from "./chunk-5IQ4TST5.js";
7
- import "./chunk-4VNS5WPM.js";
7
+ } from "./chunk-XFJVNMJI.js";
8
+ import "./chunk-WOL2ZWU7.js";
8
9
  export {
9
10
  NR_AUTH_STOP_RULE,
10
11
  NR_DOMAIN_KNOWLEDGE,
@@ -1,3 +1,4 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  GCP_AUTH_STOP_RULE,
3
4
  GCP_CROSS_SIGNAL,
@@ -5,8 +6,8 @@ import {
5
6
  GCP_INSIDE_OUT_DEBUGGING,
6
7
  GCP_PAGE_SIZE_RULE,
7
8
  GCP_TOOL_REFERENCE
8
- } from "./chunk-6QUU7TGZ.js";
9
- import "./chunk-4VNS5WPM.js";
9
+ } from "./chunk-IKD3ICQK.js";
10
+ import "./chunk-WOL2ZWU7.js";
10
11
  export {
11
12
  GCP_AUTH_STOP_RULE,
12
13
  GCP_CROSS_SIGNAL,
@@ -1,9 +1,10 @@
1
+ import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  POSTHOG_AUTH_STOP_RULE,
3
4
  POSTHOG_DOMAIN_KNOWLEDGE,
4
5
  POSTHOG_INSIDE_OUT_DEBUGGING
5
- } from "./chunk-OTYSD6PF.js";
6
- import "./chunk-4VNS5WPM.js";
6
+ } from "./chunk-L7TO4UJ4.js";
7
+ import "./chunk-WOL2ZWU7.js";
7
8
  export {
8
9
  POSTHOG_AUTH_STOP_RULE,
9
10
  POSTHOG_DOMAIN_KNOWLEDGE,