@tracemarketplace/cli 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/commands/submit.ts +3 -2
- package/src/submitter.ts +5 -3
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracemarketplace/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
|
-
"
|
|
6
|
+
"tracemp": "dist/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@tracemarketplace/shared": "^0.0.1",
|
|
15
|
-
"better-sqlite3": "^
|
|
15
|
+
"better-sqlite3": "^12.8.0",
|
|
16
16
|
"chalk": "^5.3.0",
|
|
17
17
|
"commander": "^12.0.0",
|
|
18
18
|
"fzstd": "^0.1.1",
|
package/src/commands/submit.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { join } from "path";
|
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import ora from "ora";
|
|
6
6
|
import inquirer from "inquirer";
|
|
7
|
-
import { extractClaudeCode, extractCodex, extractCursor } from "@tracemarketplace/shared";
|
|
7
|
+
import { extractClaudeCode, extractCodex, extractCursor, redactTrace } from "@tracemarketplace/shared";
|
|
8
8
|
import { loadConfig } from "../config.js";
|
|
9
9
|
import { ApiClient } from "../api-client.js";
|
|
10
10
|
import { findFiles, CURSOR_DB_PATH } from "../sessions.js";
|
|
@@ -154,8 +154,9 @@ export async function submitCommand(opts: SubmitOptions): Promise<void> {
|
|
|
154
154
|
const client = new ApiClient(config.serverUrl, config.apiKey);
|
|
155
155
|
|
|
156
156
|
try {
|
|
157
|
+
const home = homedir();
|
|
157
158
|
const result = (await client.post("/api/v1/traces/batch", {
|
|
158
|
-
traces,
|
|
159
|
+
traces: traces.map((t) => redactTrace(t, { homeDir: home })),
|
|
159
160
|
source_tool: tools[0] ?? "mixed",
|
|
160
161
|
})) as {
|
|
161
162
|
submission_id: string;
|
package/src/submitter.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Shared by auto-submit (hook), submit (batch), and daemon (watch).
|
|
4
4
|
*/
|
|
5
5
|
import { readFile } from "fs/promises";
|
|
6
|
-
import {
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
import { extractClaudeCode, extractCodex, extractCursor, redactTrace } from "@tracemarketplace/shared";
|
|
7
8
|
import { ApiClient } from "./api-client.js";
|
|
8
9
|
import { CURSOR_DB_PATH } from "./sessions.js";
|
|
9
10
|
import type { Config } from "./config.js";
|
|
@@ -62,10 +63,11 @@ export async function submitCursorSession(
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
async function submitTrace(trace: Awaited<ReturnType<typeof extractClaudeCode>>, config: Config): Promise<SubmitResult> {
|
|
66
|
+
const clean = redactTrace(trace, { homeDir: homedir() });
|
|
65
67
|
const client = new ApiClient(config.serverUrl, config.apiKey);
|
|
66
68
|
try {
|
|
67
69
|
const result = await client.post("/api/v1/traces/batch", {
|
|
68
|
-
traces: [
|
|
70
|
+
traces: [clean],
|
|
69
71
|
source_tool: trace.source_tool,
|
|
70
72
|
}) as {
|
|
71
73
|
accepted: number;
|
|
@@ -79,7 +81,7 @@ async function submitTrace(trace: Awaited<ReturnType<typeof extractClaudeCode>>,
|
|
|
79
81
|
accepted: result.accepted > 0,
|
|
80
82
|
superseded: result.superseded > 0,
|
|
81
83
|
duplicate: result.duplicate > 0,
|
|
82
|
-
turnCount:
|
|
84
|
+
turnCount: clean.turn_count,
|
|
83
85
|
payoutCents: first?.payout_cents ?? 0,
|
|
84
86
|
traceId: first?.trace_id ?? null,
|
|
85
87
|
};
|