@uvl000/claude-trace 3.0.13-workflowexp.1
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 +477 -0
- package/README.zh-CN.md +477 -0
- package/dist/adapt/api-format.d.ts +41 -0
- package/dist/adapt/api-format.d.ts.map +1 -0
- package/dist/adapt/api-format.js +132 -0
- package/dist/adapt/api-format.js.map +1 -0
- package/dist/adapt/openai-adapter.d.ts +123 -0
- package/dist/adapt/openai-adapter.d.ts.map +1 -0
- package/dist/adapt/openai-adapter.js +628 -0
- package/dist/adapt/openai-adapter.js.map +1 -0
- package/dist/cli/cli-common.d.ts +73 -0
- package/dist/cli/cli-common.d.ts.map +1 -0
- package/dist/cli/cli-common.js +189 -0
- package/dist/cli/cli-common.js.map +1 -0
- package/dist/cli/cli.d.ts +23 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +175 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/codex-cli.d.ts +24 -0
- package/dist/cli/codex-cli.d.ts.map +1 -0
- package/dist/cli/codex-cli.js +146 -0
- package/dist/cli/codex-cli.js.map +1 -0
- package/dist/cli/opencode-cli.d.ts +23 -0
- package/dist/cli/opencode-cli.d.ts.map +1 -0
- package/dist/cli/opencode-cli.js +156 -0
- package/dist/cli/opencode-cli.js.map +1 -0
- package/dist/cli/trace-runner.d.ts +21 -0
- package/dist/cli/trace-runner.d.ts.map +1 -0
- package/dist/cli/trace-runner.js +282 -0
- package/dist/cli/trace-runner.js.map +1 -0
- package/dist/cli/validate-trace.d.ts +30 -0
- package/dist/cli/validate-trace.d.ts.map +1 -0
- package/dist/cli/validate-trace.js +230 -0
- package/dist/cli/validate-trace.js.map +1 -0
- package/dist/cli/verify-offline-bundle.d.ts +13 -0
- package/dist/cli/verify-offline-bundle.d.ts.map +1 -0
- package/dist/cli/verify-offline-bundle.js +89 -0
- package/dist/cli/verify-offline-bundle.js.map +1 -0
- package/dist/cli/vibe-coding-proxy-cli.d.ts +12 -0
- package/dist/cli/vibe-coding-proxy-cli.d.ts.map +1 -0
- package/dist/cli/vibe-coding-proxy-cli.js +218 -0
- package/dist/cli/vibe-coding-proxy-cli.js.map +1 -0
- package/dist/config/claude-config-overlay.d.ts +69 -0
- package/dist/config/claude-config-overlay.d.ts.map +1 -0
- package/dist/config/claude-config-overlay.js +229 -0
- package/dist/config/claude-config-overlay.js.map +1 -0
- package/dist/config/codex-config-overlay.d.ts +122 -0
- package/dist/config/codex-config-overlay.d.ts.map +1 -0
- package/dist/config/codex-config-overlay.js +352 -0
- package/dist/config/codex-config-overlay.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/intercept/forward-proxy.d.ts +77 -0
- package/dist/intercept/forward-proxy.d.ts.map +1 -0
- package/dist/intercept/forward-proxy.js +368 -0
- package/dist/intercept/forward-proxy.js.map +1 -0
- package/dist/intercept/header-redaction.d.ts +7 -0
- package/dist/intercept/header-redaction.d.ts.map +1 -0
- package/dist/intercept/header-redaction.js +28 -0
- package/dist/intercept/header-redaction.js.map +1 -0
- package/dist/intercept/interceptor-loader.js +26 -0
- package/dist/intercept/interceptor.d.ts +164 -0
- package/dist/intercept/interceptor.d.ts.map +1 -0
- package/dist/intercept/interceptor.js +496 -0
- package/dist/intercept/interceptor.js.map +1 -0
- package/dist/intercept/mitm-cert.d.ts +53 -0
- package/dist/intercept/mitm-cert.d.ts.map +1 -0
- package/dist/intercept/mitm-cert.js +259 -0
- package/dist/intercept/mitm-cert.js.map +1 -0
- package/dist/intercept/proxy-log-writer.d.ts +77 -0
- package/dist/intercept/proxy-log-writer.d.ts.map +1 -0
- package/dist/intercept/proxy-log-writer.js +323 -0
- package/dist/intercept/proxy-log-writer.js.map +1 -0
- package/dist/intercept/proxy-targets.d.ts +69 -0
- package/dist/intercept/proxy-targets.d.ts.map +1 -0
- package/dist/intercept/proxy-targets.js +129 -0
- package/dist/intercept/proxy-targets.js.map +1 -0
- package/dist/intercept/reverse-proxy.d.ts +191 -0
- package/dist/intercept/reverse-proxy.d.ts.map +1 -0
- package/dist/intercept/reverse-proxy.js +807 -0
- package/dist/intercept/reverse-proxy.js.map +1 -0
- package/dist/intercept/token-extractor.js +28 -0
- package/dist/report/html-generator.d.ts +96 -0
- package/dist/report/html-generator.d.ts.map +1 -0
- package/dist/report/html-generator.js +225 -0
- package/dist/report/html-generator.js.map +1 -0
- package/dist/report/index-generator.d.ts +89 -0
- package/dist/report/index-generator.d.ts.map +1 -0
- package/dist/report/index-generator.js +319 -0
- package/dist/report/index-generator.js.map +1 -0
- package/dist/report/shared-conversation-processor.d.ts +200 -0
- package/dist/report/shared-conversation-processor.d.ts.map +1 -0
- package/dist/report/shared-conversation-processor.js +720 -0
- package/dist/report/shared-conversation-processor.js.map +1 -0
- package/dist/routing/codex-routing.d.ts +40 -0
- package/dist/routing/codex-routing.d.ts.map +1 -0
- package/dist/routing/codex-routing.js +96 -0
- package/dist/routing/codex-routing.js.map +1 -0
- package/dist/routing/proxy-routing.d.ts +48 -0
- package/dist/routing/proxy-routing.d.ts.map +1 -0
- package/dist/routing/proxy-routing.js +113 -0
- package/dist/routing/proxy-routing.js.map +1 -0
- package/dist/tools/binary-utils.d.ts +29 -0
- package/dist/tools/binary-utils.d.ts.map +1 -0
- package/dist/tools/binary-utils.js +134 -0
- package/dist/tools/binary-utils.js.map +1 -0
- package/dist/tools/claude.d.ts +61 -0
- package/dist/tools/claude.d.ts.map +1 -0
- package/dist/tools/claude.js +449 -0
- package/dist/tools/claude.js.map +1 -0
- package/dist/tools/codex.d.ts +70 -0
- package/dist/tools/codex.d.ts.map +1 -0
- package/dist/tools/codex.js +492 -0
- package/dist/tools/codex.js.map +1 -0
- package/dist/tools/opencode.d.ts +85 -0
- package/dist/tools/opencode.d.ts.map +1 -0
- package/dist/tools/opencode.js +401 -0
- package/dist/tools/opencode.js.map +1 -0
- package/dist/tools/types.d.ts +91 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +11 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types.d.ts +158 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/frontend/dist/index.global.js +1551 -0
- package/frontend/dist/styles.css +1027 -0
- package/frontend/template.html +19 -0
- package/node_modules/agent-base/LICENSE +22 -0
- package/node_modules/agent-base/README.md +69 -0
- package/node_modules/agent-base/dist/helpers.d.ts +15 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
- package/node_modules/agent-base/dist/helpers.js +66 -0
- package/node_modules/agent-base/dist/helpers.js.map +1 -0
- package/node_modules/agent-base/dist/index.d.ts +41 -0
- package/node_modules/agent-base/dist/index.d.ts.map +1 -0
- package/node_modules/agent-base/dist/index.js +178 -0
- package/node_modules/agent-base/dist/index.js.map +1 -0
- package/node_modules/agent-base/package.json +46 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/http-proxy-agent/LICENSE +22 -0
- package/node_modules/http-proxy-agent/README.md +44 -0
- package/node_modules/http-proxy-agent/dist/index.d.ts +44 -0
- package/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/http-proxy-agent/dist/index.js +148 -0
- package/node_modules/http-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/http-proxy-agent/package.json +47 -0
- package/node_modules/https-proxy-agent/LICENSE +22 -0
- package/node_modules/https-proxy-agent/README.md +70 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +47 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.js +180 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +15 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +50 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/node-forge/LICENSE +331 -0
- package/node_modules/node-forge/README.md +2071 -0
- package/node_modules/node-forge/dist/forge.all.min.js +2 -0
- package/node_modules/node-forge/dist/forge.all.min.js.map +1 -0
- package/node_modules/node-forge/dist/forge.min.js +2 -0
- package/node_modules/node-forge/dist/forge.min.js.map +1 -0
- package/node_modules/node-forge/dist/prime.worker.min.js +2 -0
- package/node_modules/node-forge/dist/prime.worker.min.js.map +1 -0
- package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
- package/node_modules/node-forge/lib/aes.js +1091 -0
- package/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
- package/node_modules/node-forge/lib/asn1-validator.js +91 -0
- package/node_modules/node-forge/lib/asn1.js +1503 -0
- package/node_modules/node-forge/lib/baseN.js +186 -0
- package/node_modules/node-forge/lib/cipher.js +230 -0
- package/node_modules/node-forge/lib/cipherModes.js +999 -0
- package/node_modules/node-forge/lib/des.js +496 -0
- package/node_modules/node-forge/lib/ed25519.js +1091 -0
- package/node_modules/node-forge/lib/forge.js +13 -0
- package/node_modules/node-forge/lib/form.js +149 -0
- package/node_modules/node-forge/lib/hmac.js +146 -0
- package/node_modules/node-forge/lib/http.js +1346 -0
- package/node_modules/node-forge/lib/index.all.js +16 -0
- package/node_modules/node-forge/lib/index.js +33 -0
- package/node_modules/node-forge/lib/jsbn.js +1294 -0
- package/node_modules/node-forge/lib/kem.js +168 -0
- package/node_modules/node-forge/lib/log.js +319 -0
- package/node_modules/node-forge/lib/md.all.js +13 -0
- package/node_modules/node-forge/lib/md.js +11 -0
- package/node_modules/node-forge/lib/md5.js +289 -0
- package/node_modules/node-forge/lib/mgf.js +12 -0
- package/node_modules/node-forge/lib/mgf1.js +57 -0
- package/node_modules/node-forge/lib/oids.js +180 -0
- package/node_modules/node-forge/lib/pbe.js +1023 -0
- package/node_modules/node-forge/lib/pbkdf2.js +211 -0
- package/node_modules/node-forge/lib/pem.js +237 -0
- package/node_modules/node-forge/lib/pkcs1.js +276 -0
- package/node_modules/node-forge/lib/pkcs12.js +1078 -0
- package/node_modules/node-forge/lib/pkcs7.js +1260 -0
- package/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
- package/node_modules/node-forge/lib/pki.js +102 -0
- package/node_modules/node-forge/lib/prime.js +297 -0
- package/node_modules/node-forge/lib/prime.worker.js +168 -0
- package/node_modules/node-forge/lib/prng.js +419 -0
- package/node_modules/node-forge/lib/pss.js +241 -0
- package/node_modules/node-forge/lib/random.js +191 -0
- package/node_modules/node-forge/lib/rc2.js +410 -0
- package/node_modules/node-forge/lib/rsa.js +1968 -0
- package/node_modules/node-forge/lib/sha1.js +319 -0
- package/node_modules/node-forge/lib/sha256.js +327 -0
- package/node_modules/node-forge/lib/sha512.js +561 -0
- package/node_modules/node-forge/lib/socket.js +287 -0
- package/node_modules/node-forge/lib/ssh.js +236 -0
- package/node_modules/node-forge/lib/tls.js +4282 -0
- package/node_modules/node-forge/lib/tlssocket.js +249 -0
- package/node_modules/node-forge/lib/util.js +2652 -0
- package/node_modules/node-forge/lib/x509.js +3251 -0
- package/node_modules/node-forge/lib/xhr.js +738 -0
- package/node_modules/node-forge/package.json +123 -0
- package/node_modules/smol-toml/LICENSE +24 -0
- package/node_modules/smol-toml/README.md +239 -0
- package/node_modules/smol-toml/dist/date.d.ts +41 -0
- package/node_modules/smol-toml/dist/date.js +127 -0
- package/node_modules/smol-toml/dist/error.d.ts +38 -0
- package/node_modules/smol-toml/dist/error.js +63 -0
- package/node_modules/smol-toml/dist/extract.d.ts +30 -0
- package/node_modules/smol-toml/dist/extract.js +100 -0
- package/node_modules/smol-toml/dist/index.cjs +897 -0
- package/node_modules/smol-toml/dist/index.d.ts +43 -0
- package/node_modules/smol-toml/dist/index.js +33 -0
- package/node_modules/smol-toml/dist/parse.d.ts +37 -0
- package/node_modules/smol-toml/dist/parse.js +148 -0
- package/node_modules/smol-toml/dist/primitive.d.ts +31 -0
- package/node_modules/smol-toml/dist/primitive.js +179 -0
- package/node_modules/smol-toml/dist/stringify.d.ts +31 -0
- package/node_modules/smol-toml/dist/stringify.js +167 -0
- package/node_modules/smol-toml/dist/struct.d.ts +32 -0
- package/node_modules/smol-toml/dist/struct.js +184 -0
- package/node_modules/smol-toml/dist/util.d.ts +42 -0
- package/node_modules/smol-toml/dist/util.js +111 -0
- package/node_modules/smol-toml/package.json +54 -0
- package/offline/bin/claude-trace +6 -0
- package/offline/bin/claude-wrapper +13 -0
- package/offline/bin/install-agent +14 -0
- package/offline/bin/validate-trace +6 -0
- package/offline/bin/verify-bundle +7 -0
- package/package.json +103 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file cli-common.ts
|
|
3
|
+
* @description Shared CLI utilities used by claude-trace, opencode-trace, and codex-trace.
|
|
4
|
+
*
|
|
5
|
+
* Provides colored console output, argument parsing, HTML generation from logs,
|
|
6
|
+
* conversation index generation, and debug/error logging helpers for the reverse proxy.
|
|
7
|
+
*/
|
|
8
|
+
/** ANSI escape codes for terminal-colored log output. */
|
|
9
|
+
export declare const colors: {
|
|
10
|
+
readonly red: "\u001B[0;31m";
|
|
11
|
+
readonly green: "\u001B[0;32m";
|
|
12
|
+
readonly yellow: "\u001B[1;33m";
|
|
13
|
+
readonly blue: "\u001B[0;34m";
|
|
14
|
+
readonly reset: "\u001B[0m";
|
|
15
|
+
};
|
|
16
|
+
type ColorName = keyof typeof colors;
|
|
17
|
+
/**
|
|
18
|
+
* Print a colored message to stdout.
|
|
19
|
+
* @param message - Text to print
|
|
20
|
+
* @param color - Color key from `colors` (default: no color)
|
|
21
|
+
*/
|
|
22
|
+
export declare function log(message: string, color?: ColorName): void;
|
|
23
|
+
/** @returns true when OPENCODE_TRACE_DEBUG=1 or "true" (enables verbose proxy stderr). */
|
|
24
|
+
export declare function isTraceDebugEnabled(): boolean;
|
|
25
|
+
/** Write to stderr only when OPENCODE_TRACE_DEBUG is set — avoids polluting OpenCode TUI. */
|
|
26
|
+
export declare function traceDebug(message: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Persist runtime proxy errors to log dir; stderr only in debug mode.
|
|
29
|
+
* @param message - Error description with context
|
|
30
|
+
* @param logDirectory - Tool log dir (e.g. ".opencode-trace") for proxy-errors.log
|
|
31
|
+
*/
|
|
32
|
+
export declare function traceRuntimeError(message: string, logDirectory?: string): void;
|
|
33
|
+
/** Result of splitting argv into trace flags vs tool passthrough args. */
|
|
34
|
+
export interface ParsedTraceArgs {
|
|
35
|
+
/** Flags consumed by claude-trace / opencode-trace / codex-trace. */
|
|
36
|
+
traceArgs: string[];
|
|
37
|
+
/** Arguments after `--run-with` forwarded to the underlying tool. */
|
|
38
|
+
toolArgs: string[];
|
|
39
|
+
includeAllRequests: boolean;
|
|
40
|
+
openInBrowser: boolean;
|
|
41
|
+
logSensitiveHeaders: boolean;
|
|
42
|
+
logBaseName?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse shared CLI flags from process.argv slice.
|
|
46
|
+
* Everything after `--run-with` is treated as tool arguments.
|
|
47
|
+
* @param args - Typically process.argv.slice(2)
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseTraceArgs(args: string[]): ParsedTraceArgs;
|
|
50
|
+
/**
|
|
51
|
+
* Extract input/output paths following the `--generate-html` flag.
|
|
52
|
+
* @param traceArgs - Parsed trace-side arguments only
|
|
53
|
+
*/
|
|
54
|
+
export declare function parseGenerateHtmlArgs(traceArgs: string[]): {
|
|
55
|
+
inputFile?: string;
|
|
56
|
+
outputFile?: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* CLI handler for `--generate-html`: build self-contained HTML from JSONL and optionally open it.
|
|
60
|
+
* @param inputFile - Path to .jsonl or .json log file
|
|
61
|
+
* @param outputFile - Optional output .html path
|
|
62
|
+
* @param includeAllRequests - Pass through to HTMLGenerator filtering
|
|
63
|
+
* @param openInBrowser - Launch default browser after generation
|
|
64
|
+
* @param tool - Tool name for report metadata
|
|
65
|
+
*/
|
|
66
|
+
export declare function generateHTMLFromCLI(inputFile: string, outputFile?: string, includeAllRequests?: boolean, openInBrowser?: boolean, tool?: string): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* CLI handler for `--index`: scan log directory and write conversation summaries.
|
|
69
|
+
* @param traceDir - e.g. ".claude-trace"
|
|
70
|
+
*/
|
|
71
|
+
export declare function generateIndex(traceDir: string): Promise<void>;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=cli-common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-common.d.ts","sourceRoot":"","sources":["../../src/cli/cli-common.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,yDAAyD;AACzD,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AAEX,KAAK,SAAS,GAAG,MAAM,OAAO,MAAM,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,SAAmB,GAAG,IAAI,CAErE;AAED,0FAA0F;AAC1F,wBAAgB,mBAAmB,IAAI,OAAO,CAG7C;AAED,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAU9E;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC/B,qEAAqE;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CAmB9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAiBtG;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACxC,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,kBAAkB,GAAE,OAAe,EACnC,aAAa,GAAE,OAAe,EAC9B,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWnE"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file cli-common.ts
|
|
4
|
+
* @description Shared CLI utilities used by claude-trace, opencode-trace, and codex-trace.
|
|
5
|
+
*
|
|
6
|
+
* Provides colored console output, argument parsing, HTML generation from logs,
|
|
7
|
+
* conversation index generation, and debug/error logging helpers for the reverse proxy.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.colors = void 0;
|
|
44
|
+
exports.log = log;
|
|
45
|
+
exports.isTraceDebugEnabled = isTraceDebugEnabled;
|
|
46
|
+
exports.traceDebug = traceDebug;
|
|
47
|
+
exports.traceRuntimeError = traceRuntimeError;
|
|
48
|
+
exports.parseTraceArgs = parseTraceArgs;
|
|
49
|
+
exports.parseGenerateHtmlArgs = parseGenerateHtmlArgs;
|
|
50
|
+
exports.generateHTMLFromCLI = generateHTMLFromCLI;
|
|
51
|
+
exports.generateIndex = generateIndex;
|
|
52
|
+
const child_process_1 = require("child_process");
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const html_generator_1 = require("../report/html-generator");
|
|
56
|
+
/** ANSI escape codes for terminal-colored log output. */
|
|
57
|
+
exports.colors = {
|
|
58
|
+
red: "\x1b[0;31m",
|
|
59
|
+
green: "\x1b[0;32m",
|
|
60
|
+
yellow: "\x1b[1;33m",
|
|
61
|
+
blue: "\x1b[0;34m",
|
|
62
|
+
reset: "\x1b[0m",
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Print a colored message to stdout.
|
|
66
|
+
* @param message - Text to print
|
|
67
|
+
* @param color - Color key from `colors` (default: no color)
|
|
68
|
+
*/
|
|
69
|
+
function log(message, color = "reset") {
|
|
70
|
+
console.log(`${exports.colors[color]}${message}${exports.colors.reset}`);
|
|
71
|
+
}
|
|
72
|
+
/** @returns true when OPENCODE_TRACE_DEBUG=1 or "true" (enables verbose proxy stderr). */
|
|
73
|
+
function isTraceDebugEnabled() {
|
|
74
|
+
const value = process.env.OPENCODE_TRACE_DEBUG;
|
|
75
|
+
return value === "1" || value === "true";
|
|
76
|
+
}
|
|
77
|
+
/** Write to stderr only when OPENCODE_TRACE_DEBUG is set — avoids polluting OpenCode TUI. */
|
|
78
|
+
function traceDebug(message) {
|
|
79
|
+
if (isTraceDebugEnabled()) {
|
|
80
|
+
console.error(message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Persist runtime proxy errors to log dir; stderr only in debug mode.
|
|
85
|
+
* @param message - Error description with context
|
|
86
|
+
* @param logDirectory - Tool log dir (e.g. ".opencode-trace") for proxy-errors.log
|
|
87
|
+
*/
|
|
88
|
+
function traceRuntimeError(message, logDirectory) {
|
|
89
|
+
const line = `[${new Date().toISOString()}] ${message}\n`;
|
|
90
|
+
if (logDirectory) {
|
|
91
|
+
try {
|
|
92
|
+
fs.appendFileSync(path.join(logDirectory, "proxy-errors.log"), line);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// ignore file write failures
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
traceDebug(message);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Parse shared CLI flags from process.argv slice.
|
|
102
|
+
* Everything after `--run-with` is treated as tool arguments.
|
|
103
|
+
* @param args - Typically process.argv.slice(2)
|
|
104
|
+
*/
|
|
105
|
+
function parseTraceArgs(args) {
|
|
106
|
+
const argIndex = args.indexOf("--run-with");
|
|
107
|
+
const traceArgs = argIndex !== -1 ? args.slice(0, argIndex) : args;
|
|
108
|
+
const toolArgs = argIndex !== -1 ? args.slice(argIndex + 1) : [];
|
|
109
|
+
const logIndex = traceArgs.indexOf("--log");
|
|
110
|
+
let logBaseName;
|
|
111
|
+
if (logIndex !== -1 && traceArgs[logIndex + 1]) {
|
|
112
|
+
logBaseName = traceArgs[logIndex + 1];
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
traceArgs,
|
|
116
|
+
toolArgs,
|
|
117
|
+
includeAllRequests: traceArgs.includes("--include-all-requests"),
|
|
118
|
+
openInBrowser: !traceArgs.includes("--no-open"),
|
|
119
|
+
logSensitiveHeaders: traceArgs.includes("--include-sensitive-headers"),
|
|
120
|
+
logBaseName,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Extract input/output paths following the `--generate-html` flag.
|
|
125
|
+
* @param traceArgs - Parsed trace-side arguments only
|
|
126
|
+
*/
|
|
127
|
+
function parseGenerateHtmlArgs(traceArgs) {
|
|
128
|
+
const flagIndex = traceArgs.indexOf("--generate-html");
|
|
129
|
+
if (flagIndex === -1) {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
const inputFile = traceArgs[flagIndex + 1];
|
|
133
|
+
let outputFile;
|
|
134
|
+
for (let i = flagIndex + 2; i < traceArgs.length; i++) {
|
|
135
|
+
const arg = traceArgs[i];
|
|
136
|
+
if (!arg.startsWith("--")) {
|
|
137
|
+
outputFile = arg;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return { inputFile, outputFile };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* CLI handler for `--generate-html`: build self-contained HTML from JSONL and optionally open it.
|
|
145
|
+
* @param inputFile - Path to .jsonl or .json log file
|
|
146
|
+
* @param outputFile - Optional output .html path
|
|
147
|
+
* @param includeAllRequests - Pass through to HTMLGenerator filtering
|
|
148
|
+
* @param openInBrowser - Launch default browser after generation
|
|
149
|
+
* @param tool - Tool name for report metadata
|
|
150
|
+
*/
|
|
151
|
+
async function generateHTMLFromCLI(inputFile, outputFile, includeAllRequests = false, openInBrowser = false, tool) {
|
|
152
|
+
try {
|
|
153
|
+
const htmlGenerator = new html_generator_1.HTMLGenerator();
|
|
154
|
+
const finalOutputFile = await htmlGenerator.generateHTMLFromJSONL(inputFile, outputFile, includeAllRequests, tool);
|
|
155
|
+
if (openInBrowser) {
|
|
156
|
+
if (process.platform === "win32") {
|
|
157
|
+
(0, child_process_1.spawn)("cmd", ["/c", "start", "", finalOutputFile], { detached: true, stdio: "ignore" }).unref();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
(0, child_process_1.spawn)("open", [finalOutputFile], { detached: true, stdio: "ignore" }).unref();
|
|
161
|
+
}
|
|
162
|
+
log(`Opening ${finalOutputFile} in browser`, "green");
|
|
163
|
+
}
|
|
164
|
+
process.exit(0);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
const err = error;
|
|
168
|
+
log(`Error: ${err.message}`, "red");
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* CLI handler for `--index`: scan log directory and write conversation summaries.
|
|
174
|
+
* @param traceDir - e.g. ".claude-trace"
|
|
175
|
+
*/
|
|
176
|
+
async function generateIndex(traceDir) {
|
|
177
|
+
try {
|
|
178
|
+
const { IndexGenerator } = await Promise.resolve().then(() => __importStar(require("../report/index-generator")));
|
|
179
|
+
const indexGenerator = new IndexGenerator(traceDir);
|
|
180
|
+
await indexGenerator.generateIndex();
|
|
181
|
+
process.exit(0);
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
const err = error;
|
|
185
|
+
log(`Error: ${err.message}`, "red");
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=cli-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-common.js","sourceRoot":"","sources":["../../src/cli/cli-common.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBH,kBAEC;AAGD,kDAGC;AAGD,gCAIC;AAOD,8CAUC;AAmBD,wCAmBC;AAMD,sDAiBC;AAUD,kDA+BC;AAMD,sCAWC;AA5KD,iDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAC7B,6DAAyD;AAEzD,yDAAyD;AAC5C,QAAA,MAAM,GAAG;IACrB,GAAG,EAAE,YAAY;IACjB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,SAAS;CACP,CAAC;AAIX;;;;GAIG;AACH,SAAgB,GAAG,CAAC,OAAe,EAAE,QAAmB,OAAO;IAC9D,OAAO,CAAC,GAAG,CAAC,GAAG,cAAM,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,0FAA0F;AAC1F,SAAgB,mBAAmB;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC/C,OAAO,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,MAAM,CAAC;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C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file cli.ts
|
|
4
|
+
* @description Entry point for the `claude-trace` command.
|
|
5
|
+
*
|
|
6
|
+
* Thin CLI wrapper that parses arguments, dispatches to utility modes
|
|
7
|
+
* (token extraction, HTML generation, index building), or delegates interactive
|
|
8
|
+
* tracing to `trace-runner.ts` via the Claude Code tool profile.
|
|
9
|
+
*
|
|
10
|
+
* Architecture:
|
|
11
|
+
* ```
|
|
12
|
+
* cli.ts → claudeProfile (tools/claude.ts) → trace-runner.ts
|
|
13
|
+
* ├─ reverse-proxy.ts (V2+ native)
|
|
14
|
+
* └─ interceptor.ts (V1 Node.js)
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* All shared argument parsing, logging, and HTML/index helpers live in
|
|
18
|
+
* `cli-common.ts` so `opencode-cli.ts` and `codex-cli.ts` stay consistent.
|
|
19
|
+
*
|
|
20
|
+
* Registered as the `claude-trace` bin in package.json.
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
package/dist/cli/cli.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* @file cli.ts
|
|
5
|
+
* @description Entry point for the `claude-trace` command.
|
|
6
|
+
*
|
|
7
|
+
* Thin CLI wrapper that parses arguments, dispatches to utility modes
|
|
8
|
+
* (token extraction, HTML generation, index building), or delegates interactive
|
|
9
|
+
* tracing to `trace-runner.ts` via the Claude Code tool profile.
|
|
10
|
+
*
|
|
11
|
+
* Architecture:
|
|
12
|
+
* ```
|
|
13
|
+
* cli.ts → claudeProfile (tools/claude.ts) → trace-runner.ts
|
|
14
|
+
* ├─ reverse-proxy.ts (V2+ native)
|
|
15
|
+
* └─ interceptor.ts (V1 Node.js)
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* All shared argument parsing, logging, and HTML/index helpers live in
|
|
19
|
+
* `cli-common.ts` so `opencode-cli.ts` and `codex-cli.ts` stay consistent.
|
|
20
|
+
*
|
|
21
|
+
* Registered as the `claude-trace` bin in package.json.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const claude_1 = require("../tools/claude");
|
|
25
|
+
const trace_runner_1 = require("./trace-runner");
|
|
26
|
+
const cli_common_1 = require("./cli-common");
|
|
27
|
+
/**
|
|
28
|
+
* Print usage help for all `claude-trace` modes and options to stdout.
|
|
29
|
+
*
|
|
30
|
+
* Documents interactive tracing, `--extract-token`, `--generate-html`,
|
|
31
|
+
* `--index`, and all shared flags (`--run-with`, `--log`, etc.).
|
|
32
|
+
*/
|
|
33
|
+
function showHelp() {
|
|
34
|
+
console.log(`
|
|
35
|
+
${cli_common_1.colors.blue}Claude Trace${cli_common_1.colors.reset}
|
|
36
|
+
Record all your interactions with Claude Code as you develop your projects
|
|
37
|
+
|
|
38
|
+
${cli_common_1.colors.yellow}USAGE:${cli_common_1.colors.reset}
|
|
39
|
+
claude-trace [OPTIONS] [--run-with CLAUDE_ARG...]
|
|
40
|
+
|
|
41
|
+
${cli_common_1.colors.yellow}OPTIONS:${cli_common_1.colors.reset}
|
|
42
|
+
--extract-token Extract OAuth token and exit (reproduces claude-token.py)
|
|
43
|
+
--generate-html Generate HTML report from JSONL file
|
|
44
|
+
--index Generate conversation summaries and index for .claude-trace/ directory
|
|
45
|
+
--run-with Pass all following arguments to Claude process
|
|
46
|
+
--include-all-requests Include all requests made through fetch, otherwise only requests to v1/messages with more than 2 messages in the context
|
|
47
|
+
--include-sensitive-headers Log sensitive headers (auth tokens, cookies) without redaction
|
|
48
|
+
--no-open Don't open generated HTML file in browser
|
|
49
|
+
--log Specify custom log file base name (without extension)
|
|
50
|
+
--claude-path Specify custom path to Claude binary
|
|
51
|
+
--help, -h Show this help message
|
|
52
|
+
|
|
53
|
+
${cli_common_1.colors.yellow}MODES:${cli_common_1.colors.reset}
|
|
54
|
+
${cli_common_1.colors.green}Interactive logging:${cli_common_1.colors.reset}
|
|
55
|
+
claude-trace Start Claude with traffic logging
|
|
56
|
+
claude-trace --log my-session Start Claude with custom log file name
|
|
57
|
+
claude-trace --run-with chat Run Claude with specific command
|
|
58
|
+
claude-trace --run-with chat --model sonnet-3.5 Run Claude with multiple arguments
|
|
59
|
+
|
|
60
|
+
${cli_common_1.colors.green}Token extraction:${cli_common_1.colors.reset}
|
|
61
|
+
claude-trace --extract-token Extract OAuth token for SDK usage
|
|
62
|
+
|
|
63
|
+
${cli_common_1.colors.green}HTML generation:${cli_common_1.colors.reset}
|
|
64
|
+
claude-trace --generate-html file.jsonl Generate HTML from JSONL file
|
|
65
|
+
claude-trace --generate-html file.jsonl out.html Generate HTML with custom output name
|
|
66
|
+
claude-trace --generate-html file.jsonl Generate HTML and open in browser (default)
|
|
67
|
+
claude-trace --generate-html file.jsonl --no-open Generate HTML without opening browser
|
|
68
|
+
|
|
69
|
+
${cli_common_1.colors.green}Indexing:${cli_common_1.colors.reset}
|
|
70
|
+
claude-trace --index Generate conversation summaries and index
|
|
71
|
+
|
|
72
|
+
${cli_common_1.colors.yellow}EXAMPLES:${cli_common_1.colors.reset}
|
|
73
|
+
# Start Claude with logging
|
|
74
|
+
claude-trace
|
|
75
|
+
|
|
76
|
+
# Start Claude with custom log file name
|
|
77
|
+
claude-trace --log my-session
|
|
78
|
+
|
|
79
|
+
# Run Claude chat with logging
|
|
80
|
+
claude-trace --run-with chat
|
|
81
|
+
|
|
82
|
+
# Run Claude with specific model
|
|
83
|
+
claude-trace --run-with chat --model sonnet-3.5
|
|
84
|
+
|
|
85
|
+
# Pass multiple arguments to Claude
|
|
86
|
+
claude-trace --run-with --model gpt-4o --temperature 0.7
|
|
87
|
+
|
|
88
|
+
# Extract token for Anthropic SDK
|
|
89
|
+
export ANTHROPIC_API_KEY=$(claude-trace --extract-token)
|
|
90
|
+
|
|
91
|
+
# Generate HTML report
|
|
92
|
+
claude-trace --generate-html logs/traffic.jsonl report.html
|
|
93
|
+
|
|
94
|
+
# Generate HTML report and open in browser (default)
|
|
95
|
+
claude-trace --generate-html logs/traffic.jsonl
|
|
96
|
+
|
|
97
|
+
# Generate HTML report without opening browser
|
|
98
|
+
claude-trace --generate-html logs/traffic.jsonl --no-open
|
|
99
|
+
|
|
100
|
+
# Generate conversation index
|
|
101
|
+
claude-trace --index
|
|
102
|
+
|
|
103
|
+
# Use custom Claude binary path
|
|
104
|
+
claude-trace --claude-path /usr/local/bin/claude
|
|
105
|
+
|
|
106
|
+
${cli_common_1.colors.yellow}OUTPUT:${cli_common_1.colors.reset}
|
|
107
|
+
Logs are saved to: ${cli_common_1.colors.green}.claude-trace/log-YYYY-MM-DD-HH-MM-SS.{jsonl,html}${cli_common_1.colors.reset}
|
|
108
|
+
With --log NAME: ${cli_common_1.colors.green}.claude-trace/NAME.{jsonl,html}${cli_common_1.colors.reset}
|
|
109
|
+
|
|
110
|
+
${cli_common_1.colors.yellow}MIGRATION:${cli_common_1.colors.reset}
|
|
111
|
+
This tool replaces Python-based claude-logger and claude-token.py scripts
|
|
112
|
+
with a pure Node.js implementation. All output formats are compatible.
|
|
113
|
+
|
|
114
|
+
For more information, visit: https://github.com/hanqunfeng/claude-trace
|
|
115
|
+
`);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Main CLI dispatcher.
|
|
119
|
+
*
|
|
120
|
+
* Modes are mutually exclusive and checked in priority order:
|
|
121
|
+
* 1. `--help` / `-h` — print usage and exit
|
|
122
|
+
* 2. `--extract-token` — OAuth token extraction (Claude-only)
|
|
123
|
+
* 3. `--generate-html` — offline HTML report from an existing JSONL log
|
|
124
|
+
* 4. `--index` — rebuild conversation summaries in `.claude-trace/`
|
|
125
|
+
* 5. Default — launch Claude with live traffic tracing via `runWithTracing`
|
|
126
|
+
*
|
|
127
|
+
* Arguments after `--run-with` are passed verbatim to the Claude child process.
|
|
128
|
+
* All other flags are consumed by `parseTraceArgs` before dispatch.
|
|
129
|
+
*/
|
|
130
|
+
async function main() {
|
|
131
|
+
const args = process.argv.slice(2);
|
|
132
|
+
const { traceArgs, toolArgs, includeAllRequests, openInBrowser, logSensitiveHeaders, logBaseName } = (0, cli_common_1.parseTraceArgs)(args);
|
|
133
|
+
if (traceArgs.includes("--help") || traceArgs.includes("-h")) {
|
|
134
|
+
showHelp();
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
// `--claude-path` takes the next positional arg as the binary location.
|
|
138
|
+
let customClaudePath;
|
|
139
|
+
const claudePathIndex = traceArgs.indexOf("--claude-path");
|
|
140
|
+
if (claudePathIndex !== -1 && traceArgs[claudePathIndex + 1]) {
|
|
141
|
+
customClaudePath = traceArgs[claudePathIndex + 1];
|
|
142
|
+
}
|
|
143
|
+
if (traceArgs.includes("--extract-token")) {
|
|
144
|
+
await (0, claude_1.extractClaudeToken)(customClaudePath);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (traceArgs.includes("--generate-html")) {
|
|
148
|
+
const { inputFile, outputFile } = (0, cli_common_1.parseGenerateHtmlArgs)(traceArgs);
|
|
149
|
+
if (!inputFile) {
|
|
150
|
+
(0, cli_common_1.log)(`Missing input file for --generate-html`, "red");
|
|
151
|
+
(0, cli_common_1.log)(`Usage: claude-trace --generate-html input.jsonl [output.html]`, "yellow");
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
await (0, cli_common_1.generateHTMLFromCLI)(inputFile, outputFile, includeAllRequests, openInBrowser, "claude");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (traceArgs.includes("--index")) {
|
|
158
|
+
await (0, cli_common_1.generateIndex)(claude_1.claudeProfile.logDirectory);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// Default mode: start proxy/interceptor + spawn Claude with logging.
|
|
162
|
+
await (0, trace_runner_1.runWithTracing)(claude_1.claudeProfile, toolArgs, {
|
|
163
|
+
includeAllRequests,
|
|
164
|
+
openInBrowser,
|
|
165
|
+
logBaseName,
|
|
166
|
+
logSensitiveHeaders,
|
|
167
|
+
customBinaryPath: customClaudePath,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
main().catch((error) => {
|
|
171
|
+
const err = error;
|
|
172
|
+
(0, cli_common_1.log)(`Unexpected error: ${err.message}`, "red");
|
|
173
|
+
process.exit(1);
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;GAmBG;;AAEH,4CAAoE;AACpE,iDAAgD;AAChD,6CAOsB;AAEtB;;;;;GAKG;AACH,SAAS,QAAQ;IAChB,OAAO,CAAC,GAAG,CAAC;EACX,mBAAM,CAAC,IAAI,eAAe,mBAAM,CAAC,KAAK;;;EAGtC,mBAAM,CAAC,MAAM,SAAS,mBAAM,CAAC,KAAK;;;EAGlC,mBAAM,CAAC,MAAM,WAAW,mBAAM,CAAC,KAAK;;;;;;;;;;;;EAYpC,mBAAM,CAAC,MAAM,SAAS,mBAAM,CAAC,KAAK;IAChC,mBAAM,CAAC,KAAK,uBAAuB,mBAAM,CAAC,KAAK;;;;;;IAM/C,mBAAM,CAAC,KAAK,oBAAoB,mBAAM,CAAC,KAAK;;;IAG5C,mBAAM,CAAC,KAAK,mBAAmB,mBAAM,CAAC,KAAK;;;;;;IAM3C,mBAAM,CAAC,KAAK,YAAY,mBAAM,CA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per that parses arguments, dispatches to utility modes
|
|
7
|
+
* (HTML generation, index building), or delegates interactive tracing to
|
|
8
|
+
* `trace-runner.ts` via the Codex CLI tool profile.
|
|
9
|
+
*
|
|
10
|
+
* Architecture:
|
|
11
|
+
* ```
|
|
12
|
+
* codex-cli.ts → codexProfile (tools/codex.ts) → trace-runner.ts
|
|
13
|
+
* └─ reverse-proxy.ts (always)
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Codex is a Rust native binary — always uses reverse-proxy interception with
|
|
17
|
+
* a `$CODEX_HOME` config overlay that rewrites upstream base URLs. Path-based
|
|
18
|
+
* routing in `codex-routing.ts` dispatches OpenAI API Key vs ChatGPT OAuth
|
|
19
|
+
* traffic to the correct upstream.
|
|
20
|
+
*
|
|
21
|
+
* Registered as the `codex-trace` bin in package.json.
|
|
22
|
+
*/
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=codex-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-cli.d.ts","sourceRoot":"","sources":["../../src/cli/codex-cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* @file codex-cli.ts
|
|
5
|
+
* @description Entry point for the `codex-trace` command.
|
|
6
|
+
*
|
|
7
|
+
* Thin CLI wrapper that parses arguments, dispatches to utility modes
|
|
8
|
+
* (HTML generation, index building), or delegates interactive tracing to
|
|
9
|
+
* `trace-runner.ts` via the Codex CLI tool profile.
|
|
10
|
+
*
|
|
11
|
+
* Architecture:
|
|
12
|
+
* ```
|
|
13
|
+
* codex-cli.ts → codexProfile (tools/codex.ts) → trace-runner.ts
|
|
14
|
+
* └─ reverse-proxy.ts (always)
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Codex is a Rust native binary — always uses reverse-proxy interception with
|
|
18
|
+
* a `$CODEX_HOME` config overlay that rewrites upstream base URLs. Path-based
|
|
19
|
+
* routing in `codex-routing.ts` dispatches OpenAI API Key vs ChatGPT OAuth
|
|
20
|
+
* traffic to the correct upstream.
|
|
21
|
+
*
|
|
22
|
+
* Registered as the `codex-trace` bin in package.json.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const codex_1 = require("../tools/codex");
|
|
26
|
+
const trace_runner_1 = require("./trace-runner");
|
|
27
|
+
const cli_common_1 = require("./cli-common");
|
|
28
|
+
/**
|
|
29
|
+
* Print usage help for all `codex-trace` modes and options to stdout.
|
|
30
|
+
*
|
|
31
|
+
* Documents Codex-specific config discovery (`CODEX_HOME`, `config.toml`)
|
|
32
|
+
* and the overlay-based interception approach.
|
|
33
|
+
*/
|
|
34
|
+
function showHelp() {
|
|
35
|
+
console.log(`
|
|
36
|
+
${cli_common_1.colors.blue}Codex Trace${cli_common_1.colors.reset}
|
|
37
|
+
Record all your interactions with Codex CLI as you develop your projects
|
|
38
|
+
|
|
39
|
+
${cli_common_1.colors.yellow}USAGE:${cli_common_1.colors.reset}
|
|
40
|
+
codex-trace [OPTIONS] [--run-with CODEX_ARG...]
|
|
41
|
+
|
|
42
|
+
${cli_common_1.colors.yellow}OPTIONS:${cli_common_1.colors.reset}
|
|
43
|
+
--generate-html Generate HTML report from JSONL file
|
|
44
|
+
--index Generate conversation summaries and index for .codex-trace/ directory
|
|
45
|
+
--run-with Pass all following arguments to Codex process
|
|
46
|
+
--include-all-requests Include all proxied API traffic, not just LLM API paths
|
|
47
|
+
--include-sensitive-headers Log sensitive headers (auth tokens, cookies) without redaction
|
|
48
|
+
--no-open Don't open generated HTML file in browser
|
|
49
|
+
--log Specify custom log file base name (without extension)
|
|
50
|
+
--codex-path Specify custom path to Codex binary
|
|
51
|
+
--help, -h Show this help message
|
|
52
|
+
|
|
53
|
+
${cli_common_1.colors.yellow}MODES:${cli_common_1.colors.reset}
|
|
54
|
+
${cli_common_1.colors.green}Interactive logging:${cli_common_1.colors.reset}
|
|
55
|
+
codex-trace Start Codex TUI with traffic logging
|
|
56
|
+
codex-trace --log my-session Start Codex with custom log file name
|
|
57
|
+
codex-trace --run-with exec "Explain closures" Run Codex headless with a prompt
|
|
58
|
+
|
|
59
|
+
${cli_common_1.colors.green}HTML generation:${cli_common_1.colors.reset}
|
|
60
|
+
codex-trace --generate-html file.jsonl Generate HTML from JSONL file
|
|
61
|
+
codex-trace --generate-html file.jsonl out.html Generate HTML with custom output name
|
|
62
|
+
|
|
63
|
+
${cli_common_1.colors.green}Indexing:${cli_common_1.colors.reset}
|
|
64
|
+
codex-trace --index Generate conversation summaries and index
|
|
65
|
+
|
|
66
|
+
${cli_common_1.colors.yellow}EXAMPLES:${cli_common_1.colors.reset}
|
|
67
|
+
# Start Codex TUI with logging
|
|
68
|
+
codex-trace
|
|
69
|
+
|
|
70
|
+
# Run a one-shot prompt with logging
|
|
71
|
+
codex-trace --run-with exec "Explain async/await"
|
|
72
|
+
|
|
73
|
+
# Generate HTML report
|
|
74
|
+
codex-trace --generate-html .codex-trace/log-2025-01-01-12-00-00.jsonl
|
|
75
|
+
|
|
76
|
+
# Use custom Codex binary path
|
|
77
|
+
codex-trace --codex-path /usr/local/bin/codex
|
|
78
|
+
|
|
79
|
+
${cli_common_1.colors.yellow}CONFIG:${cli_common_1.colors.reset}
|
|
80
|
+
Codex config is read from (in order):
|
|
81
|
+
1. CODEX_HOME environment variable
|
|
82
|
+
2. ~/.codex/config.toml
|
|
83
|
+
|
|
84
|
+
Intercepts OpenAI API Key, ChatGPT OAuth, and custom model_providers via
|
|
85
|
+
CODEX_HOME config overlay. Your original config file is never modified.
|
|
86
|
+
|
|
87
|
+
${cli_common_1.colors.yellow}OUTPUT:${cli_common_1.colors.reset}
|
|
88
|
+
Logs are saved to: ${cli_common_1.colors.green}.codex-trace/log-YYYY-MM-DD-HH-MM-SS.{jsonl,html}${cli_common_1.colors.reset}
|
|
89
|
+
With --log NAME: ${cli_common_1.colors.green}.codex-trace/NAME.{jsonl,html}${cli_common_1.colors.reset}
|
|
90
|
+
|
|
91
|
+
For more information, visit: https://github.com/hanqunfeng/claude-trace
|
|
92
|
+
`);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Main CLI dispatcher.
|
|
96
|
+
*
|
|
97
|
+
* Modes are mutually exclusive and checked in priority order:
|
|
98
|
+
* 1. `--help` / `-h` — print usage and exit
|
|
99
|
+
* 2. `--generate-html` — offline HTML report from an existing JSONL log
|
|
100
|
+
* 3. `--index` — rebuild conversation summaries in `.codex-trace/`
|
|
101
|
+
* 4. Default — launch Codex with live traffic tracing via `runWithTracing`
|
|
102
|
+
*
|
|
103
|
+
* Arguments after `--run-with` are passed verbatim to the Codex child process.
|
|
104
|
+
*/
|
|
105
|
+
async function main() {
|
|
106
|
+
const args = process.argv.slice(2);
|
|
107
|
+
const { traceArgs, toolArgs, includeAllRequests, openInBrowser, logSensitiveHeaders, logBaseName } = (0, cli_common_1.parseTraceArgs)(args);
|
|
108
|
+
if (traceArgs.includes("--help") || traceArgs.includes("-h")) {
|
|
109
|
+
showHelp();
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
112
|
+
// `--codex-path` takes the next positional arg as the binary location.
|
|
113
|
+
let customCodexPath;
|
|
114
|
+
const codexPathIndex = traceArgs.indexOf("--codex-path");
|
|
115
|
+
if (codexPathIndex !== -1 && traceArgs[codexPathIndex + 1]) {
|
|
116
|
+
customCodexPath = traceArgs[codexPathIndex + 1];
|
|
117
|
+
}
|
|
118
|
+
if (traceArgs.includes("--generate-html")) {
|
|
119
|
+
const { inputFile, outputFile } = (0, cli_common_1.parseGenerateHtmlArgs)(traceArgs);
|
|
120
|
+
if (!inputFile) {
|
|
121
|
+
(0, cli_common_1.log)(`Missing input file for --generate-html`, "red");
|
|
122
|
+
(0, cli_common_1.log)(`Usage: codex-trace --generate-html input.jsonl [output.html]`, "yellow");
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
await (0, cli_common_1.generateHTMLFromCLI)(inputFile, outputFile, includeAllRequests, openInBrowser, "codex");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (traceArgs.includes("--index")) {
|
|
129
|
+
await (0, cli_common_1.generateIndex)(codex_1.codexProfile.logDirectory);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// Default mode: start reverse proxy + spawn Codex with $CODEX_HOME overlay.
|
|
133
|
+
await (0, trace_runner_1.runWithTracing)(codex_1.codexProfile, toolArgs, {
|
|
134
|
+
includeAllRequests,
|
|
135
|
+
openInBrowser,
|
|
136
|
+
logBaseName,
|
|
137
|
+
logSensitiveHeaders,
|
|
138
|
+
customBinaryPath: customCodexPath,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
main().catch((error) => {
|
|
142
|
+
const err = error;
|
|
143
|
+
(0, cli_common_1.log)(`Unexpected error: ${err.message}`, "red");
|
|
144
|
+
process.exit(1);
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=codex-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-cli.js","sourceRoot":"","sources":["../../src/cli/codex-cli.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAEH,0CAA8C;AAC9C,iDAAgD;AAChD,6CAOsB;AAEtB;;;;;GAKG;AACH,SAAS,QAAQ;IAChB,OAAO,CAAC,GAAG,CAAC;EACX,mBAAM,CAAC,IAAI,cAAc,mBAAM,CAAC,KAAK;;;EAGrC,mBAAM,CAAC,MAAM,SAAS,mBAAM,CAAC,KAAK;;;EAGlC,mBAAM,CAAC,MAAM,WAAW,mBAAM,CAAC,KAAK;;;;;;;;;;;EAWpC,mBAAM,CAAC,MAAM,SAAS,mBAAM,CAAC,KAAK;IAChC,mBAAM,CAAC,KAAK,uBAAuB,mBAAM,CAAC,KAAK;;;;;I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