curt-convert 1.0.0 → 1.0.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 (3) hide show
  1. package/README.md +120 -112
  2. package/dist/cli.js +0 -0
  3. package/package.json +45 -37
package/README.md CHANGED
@@ -1,112 +1,120 @@
1
- # curt-convert
2
-
3
- Convert Claude Code session transcripts (`.jsonl`) into
4
- [`.curt`](https://github.com/JordanNewell/dot_curt) single-file conversation
5
- format. Built on [`curt-format`](https://www.npmjs.com/package/curt-format)
6
- (reference implementation, v1 core).
7
-
8
- > **Warning: output is transcript-equivalent.** Conversion is faithful, not
9
- > redacting: if the transcript contains secrets (API keys, tokens, hostnames,
10
- > private paths, unreleased code), the `.curt` file contains them too. Do not
11
- > share, commit, or publish `.curt` output without scrubbing it first. The
12
- > fixtures in `test/fixtures/` are fully synthetic; no real transcript content
13
- > is committed to this repo.
14
-
15
- ```sh
16
- npm install -g curt-convert # or: npx curt-convert
17
- curt-convert C:/Users/you/.claude/projects/C--tmp-demo/abc-123.jsonl
18
- curt-convert C:/Users/you/.claude/projects/C--tmp-demo/ -o ./out
19
- curt-convert "**/*.jsonl" -o ./out
20
- curt-convert session.jsonl --stdout > session.curt
21
- ```
22
-
23
- - A `.jsonl` file, a directory (walked recursively), or a glob all work.
24
- - Output defaults to alongside each input; `-o/--out` redirects to a directory.
25
- - Output file names follow the Curtis bulk convention
26
- (`YYYY-MM-DD <slug> <suffix>.curt`) via `curtFilename()`.
27
- - Bulk runs never overwrite: when two inputs produce the same output name
28
- (parent sessions and their sidechain files share a `sessionId`), later
29
- inputs get a deterministic `-<6 hex>` suffix derived from the source file
30
- path — stable across runs, no randomness.
31
- - Every file is re-parsed with `parseCurt` before it is written; a file that
32
- fails round-trip validation is never written (set `CURT_CONVERT_SELFCHECK=0`
33
- to skip).
34
-
35
- ## Mapping
36
-
37
- | Claude Code JSONL | .curt | Notes |
38
- |---|---|---|
39
- | `sessionId` | `conversation.id` | Falls back to the file stem. |
40
- | `ai-title` line `aiTitle` | `conversation.title` | Last one wins; otherwise first user text (<= 60 chars). |
41
- | first/last kept message `timestamp` | `conversation.createdAt` / `updatedAt` | ISO 8601 -> epoch milliseconds. |
42
- | `"model"` on assistant messages | `conversation.model` + per-message `model` | Most frequent model wins at conversation level. |
43
- | — | `conversation.provider` | Always `"anthropic"`. |
44
- | `cwd`, `gitBranch`, `version` | `conversation.cwd` / `gitBranch` / `claudeCodeVersion` | Extra fields; readers ignore unknowns. |
45
- | entry `type: "user"`, string `message.content` | message `{ role: "user" }` | `<system-reminder>...</system-reminder>` spans are stripped (harness-injected, not user content). |
46
- | `message.content[]` block `type: "text"` | `content` (blocks joined with `\n\n`) | On user and assistant messages. |
47
- | `message.content[]` block `type: "tool_use"` (`id`, `name`, `input`) | `message.toolCalls[] = { id, name, arguments }` | Declares the `tool-linkage` extension on the conversation. |
48
- | `message.content[]` block `type: "tool_result"` (`tool_use_id`, `content`) | separate message `{ role: "tool", toolCallId }` | Text content lands in `content`; per `tool-linkage`, `toolCallId` references `toolCalls[].id`. |
49
- | tool_result non-text blocks (images, ...) | message extra field `nonTextContent` | Structured passthrough; the base64 payload survives verbatim. |
50
- | tool_result `is_error: true` | message extra field `isError: true` | |
51
- | `type: "assistant"`, `thinking` blocks | message extra field `thinking` | Kept out of `content` (model-internal); opaque `signature` dropped. |
52
- | `server_tool_use` blocks (web search) | mapped into `toolCalls` like any call | Results for these often have no `tool_use_id` result line; counted as unlinked. |
53
- | entry `uuid` | message `id` | Synthesized `"<file-stem>-<n>"` when absent. |
54
- | `isSidechain: true` (subagent turns) | message extra field `isSidechain: true` | Kept, flagged — not dropped. |
55
- | `isApiErrorMessage: true` | dropped | Failed API calls are not conversation. |
56
- | `isMeta: true`, `isVisibleInTranscriptOnly` | dropped | Caveat banners and transcript-only echoes. |
57
-
58
- Lines with any other `type` are noise and dropped: `summary`, `system`,
59
- `attachment`, `queue-operation`, `ai-title` (read for the title, then dropped),
60
- `mode`, `permission-mode`, `cost-state`, `file-history-snapshot`,
61
- `file-history-delta`, `agent-setting`, `atis-latch`, `last-prompt`,
62
- `agent-name`, `api-request*`, `pr-link`, `fork-context-ref`, `started`,
63
- `result`, `failed`, `launched`, `continued-in`, and anything unrecognized.
64
- Unparseable lines are counted in stats, never fatal. User/assistant entries
65
- that end up with no content at all (whitespace-only text, reminder-only user
66
- turns, assistant entries with empty block arrays) are skipped too and counted
67
- as meta, not conversation.
68
-
69
- ## Documented losses
70
-
71
- - Token counts and cost (`message.usage`, `cost-state` lines) — dropped.
72
- - `toolUseResult` on user entries — a client-side debug mirror of tool output,
73
- not the wire payload; dropped (the `tool_result` block is the source).
74
- - Thinking block `signature` (opaque verifier) — dropped; the thinking *text*
75
- is kept on the message.
76
- - `parentUuid` / `sourceToolAssistantUUID` chain — dropped; ordering is the
77
- JSONL line order, and call/result linkage rides `tool-linkage` ids instead.
78
- - `<system-reminder>` spans inside user text — stripped as harness chatter.
79
- - Summaries, attachments, file-history snapshots, PR links, cost state —
80
- these lines have no `.curt` counterpart and are dropped entirely.
81
- - Envelope-top-level extras beyond `curt`/`version`/`generator`/
82
- `conversation` are not carried from a *read* `.curt` file (this tool only
83
- writes). Unknown fields inside the conversation and its messages are
84
- preserved where possible by conforming readers, but preservation is not
85
- guaranteed normatively by the spec.
86
-
87
- ## The `tool-linkage` extension
88
-
89
- When the transcript contains any tool calls, the output declares
90
- `extensions: ["tool-linkage"]` and uses its field contract: assistant messages
91
- carry `toolCalls[] = { id, name, arguments }`, and each tool result is its own
92
- `role: "tool"` message with `toolCallId` referencing `toolCalls[].id`.
93
- Readers that do not know the extension ignore these fields; the v1 core
94
- still validates.
95
-
96
- ## Security
97
-
98
- See the warning at the top of this README: `.curt` output is
99
- transcript-equivalent. Conversion adds nothing and removes only harness
100
- chatter (`<system-reminder>` spans, meta/noise lines) — everything else in
101
- the conversation, including anything sensitive that was in the session,
102
- survives verbatim. Scrub before sharing.
103
-
104
- ## Development
105
-
106
- ```sh
107
- npm i
108
- npm test # vitest, 30 tests
109
- npm run build # tsc -> dist/
110
- ```
111
-
112
- MIT — see [LICENSE](LICENSE).
1
+ # curt-convert
2
+
3
+ Convert Claude Code session transcripts (`.jsonl`) into
4
+ [`.curt`](https://github.com/dotcurt/dot_curt) single-file conversation
5
+ format. Built on [`curt-format`](https://www.npmjs.com/package/curt-format)
6
+ (reference implementation, v1 core).
7
+
8
+ > **Warning: output is transcript-equivalent.** Conversion is faithful, not
9
+ > redacting: if the transcript contains secrets (API keys, tokens, hostnames,
10
+ > private paths, unreleased code), the `.curt` file contains them too. Do not
11
+ > share, commit, or publish `.curt` output without scrubbing it first. The
12
+ > fixtures in `test/fixtures/` are fully synthetic; no real transcript content
13
+ > is committed to this repo.
14
+
15
+ ```sh
16
+ npm install -g curt-convert # or: npx curt-convert
17
+ curt-convert C:/Users/you/.claude/projects/C--tmp-demo/abc-123.jsonl
18
+ curt-convert C:/Users/you/.claude/projects/C--tmp-demo/ -o ./out
19
+ curt-convert "**/*.jsonl" -o ./out
20
+ curt-convert session.jsonl --stdout > session.curt
21
+ ```
22
+
23
+ - A `.jsonl` file, a directory (walked recursively), or a glob all work.
24
+ - Output defaults to alongside each input; `-o/--out` redirects to a directory.
25
+ - Output file names follow the Curtis bulk convention
26
+ (`YYYY-MM-DD <slug> <suffix>.curt`) via `curtFilename()`.
27
+ - Bulk runs never overwrite: when two inputs produce the same output name
28
+ (parent sessions and their sidechain files share a `sessionId`), later
29
+ inputs get a deterministic `-<6 hex>` suffix derived from the source file
30
+ path — stable across runs, no randomness.
31
+ - Every file is re-parsed with `parseCurt` before it is written; a file that
32
+ fails round-trip validation is never written (set `CURT_CONVERT_SELFCHECK=0`
33
+ to skip).
34
+
35
+ ## Mapping
36
+
37
+ | Claude Code JSONL | .curt | Notes |
38
+ |---|---|---|
39
+ | `sessionId` | `conversation.id` | Falls back to the file stem. |
40
+ | `ai-title` line `aiTitle` | `conversation.title` | Last one wins; otherwise first user text (<= 60 chars). |
41
+ | first/last kept message `timestamp` | `conversation.createdAt` / `updatedAt` | ISO 8601 -> epoch milliseconds. |
42
+ | `"model"` on assistant messages | `conversation.model` + per-message `model` | Most frequent model wins at conversation level. |
43
+ | — | `conversation.provider` | Always `"anthropic"`. |
44
+ | `cwd`, `gitBranch`, `version` | `conversation.cwd` / `gitBranch` / `claudeCodeVersion` | Extra fields; readers ignore unknowns. |
45
+ | entry `type: "user"`, string `message.content` | message `{ role: "user" }` | `<system-reminder>...</system-reminder>` spans are stripped (harness-injected, not user content). |
46
+ | `message.content[]` block `type: "text"` | `content` (blocks joined with `\n\n`) | On user and assistant messages. |
47
+ | `message.content[]` block `type: "tool_use"` (`id`, `name`, `input`) | `message.toolCalls[] = { id, name, arguments }` | Declares the `tool-linkage` extension on the conversation. |
48
+ | `message.content[]` block `type: "tool_result"` (`tool_use_id`, `content`) | separate message `{ role: "tool", toolCallId }` | Text content lands in `content`; per `tool-linkage`, `toolCallId` references `toolCalls[].id`. |
49
+ | tool_result non-text blocks (images, ...) | message extra field `nonTextContent` | Structured passthrough; the base64 payload survives verbatim. |
50
+ | tool_result `is_error: true` | message extra field `isError: true` | |
51
+ | `type: "assistant"`, `thinking` blocks | message extra field `thinking` | Kept out of `content` (model-internal); opaque `signature` dropped. |
52
+ | `server_tool_use` blocks (web search) | mapped into `toolCalls` like any call | Results for these often have no `tool_use_id` result line; counted as unlinked. |
53
+ | entry `uuid` | message `id` | Synthesized `"<file-stem>-<n>"` when absent. |
54
+ | `isSidechain: true` (subagent turns) | message extra field `isSidechain: true` | Kept, flagged — not dropped. |
55
+ | `isApiErrorMessage: true` | dropped | Failed API calls are not conversation. |
56
+ | `isMeta: true`, `isVisibleInTranscriptOnly` | dropped | Caveat banners and transcript-only echoes. |
57
+
58
+ Lines with any other `type` are noise and dropped: `summary`, `system`,
59
+ `attachment`, `queue-operation`, `ai-title` (read for the title, then dropped),
60
+ `mode`, `permission-mode`, `cost-state`, `file-history-snapshot`,
61
+ `file-history-delta`, `agent-setting`, `atis-latch`, `last-prompt`,
62
+ `agent-name`, `api-request*`, `pr-link`, `fork-context-ref`, `started`,
63
+ `result`, `failed`, `launched`, `continued-in`, and anything unrecognized.
64
+ Unparseable lines are counted in stats, never fatal. User/assistant entries
65
+ that end up with no content at all (whitespace-only text, reminder-only user
66
+ turns, assistant entries with empty block arrays) are skipped too and counted
67
+ as meta, not conversation.
68
+
69
+ ## Documented losses
70
+
71
+ - Token counts and cost (`message.usage`, `cost-state` lines) — dropped.
72
+ - `toolUseResult` on user entries — a client-side debug mirror of tool output,
73
+ not the wire payload; dropped (the `tool_result` block is the source).
74
+ - Thinking block `signature` (opaque verifier) — dropped; the thinking *text*
75
+ is kept on the message.
76
+ - `parentUuid` / `sourceToolAssistantUUID` chain — dropped; ordering is the
77
+ JSONL line order, and call/result linkage rides `tool-linkage` ids instead.
78
+ - `<system-reminder>` spans inside user text — stripped as harness chatter.
79
+ - Summaries, attachments, file-history snapshots, PR links, cost state —
80
+ these lines have no `.curt` counterpart and are dropped entirely.
81
+ - Envelope-top-level extras beyond `curt`/`version`/`generator`/
82
+ `conversation` are not carried from a *read* `.curt` file (this tool only
83
+ writes). Unknown fields inside the conversation and its messages are
84
+ preserved where possible by conforming readers, but preservation is not
85
+ guaranteed normatively by the spec.
86
+
87
+ ## The `tool-linkage` extension
88
+
89
+ When the transcript contains any tool calls, the output declares
90
+ `extensions: ["tool-linkage"]` and uses its field contract: assistant messages
91
+ carry `toolCalls[] = { id, name, arguments }`, and each tool result is its own
92
+ `role: "tool"` message with `toolCallId` referencing `toolCalls[].id`.
93
+ Readers that do not know the extension ignore these fields; the v1 core
94
+ still validates.
95
+
96
+ ## Security
97
+
98
+ See the warning at the top of this README: `.curt` output is
99
+ transcript-equivalent. Conversion adds nothing and removes only harness
100
+ chatter (`<system-reminder>` spans, meta/noise lines) — everything else in
101
+ the conversation, including anything sensitive that was in the session,
102
+ survives verbatim. Scrub before sharing.
103
+
104
+ ## Development
105
+
106
+ ```sh
107
+ npm i
108
+ npm test # vitest, 30 tests
109
+ npm run build # tsc -> dist/
110
+ ```
111
+
112
+ ## Part of the .curt suite
113
+
114
+ - [`curt-format`](https://github.com/dotcurt/dot_curt) — the .curt format spec + reference implementation ([npm](https://www.npmjs.com/package/curt-format))
115
+ - [`curt-convert`](https://github.com/dotcurt/curt-convert) — Claude Code transcripts → .curt ([npm](https://www.npmjs.com/package/curt-convert))
116
+ - [`curt-vcon`](https://github.com/dotcurt/curt-vcon) — .curt ⇄ vCon (IETF) bridge ([npm](https://www.npmjs.com/package/curt-vcon))
117
+ - [`curt-wildchat`](https://github.com/dotcurt/curt-wildchat) — WildChat-1M records → .curt ([npm](https://www.npmjs.com/package/curt-wildchat))
118
+ - [`curt-openwith`](https://github.com/dotcurt/curt-openwith) — double-click any .curt file: offline viewer, Windows + macOS + Linux
119
+
120
+ MIT — see [LICENSE](LICENSE).
package/dist/cli.js CHANGED
Binary file
package/package.json CHANGED
@@ -1,37 +1,45 @@
1
- {
2
- "name": "curt-convert",
3
- "version": "1.0.0",
4
- "description": "Convert Claude Code session transcripts (JSONL) to .curt conversation files",
5
- "license": "MIT",
6
- "type": "module",
7
- "engines": {
8
- "node": ">=18"
9
- },
10
- "bin": {
11
- "curt-convert": "dist/cli.js"
12
- },
13
- "main": "dist/convert.js",
14
- "types": "dist/convert.d.ts",
15
- "files": [
16
- "dist"
17
- ],
18
- "scripts": {
19
- "build": "tsc",
20
- "test": "vitest run",
21
- "prepack": "npm run build"
22
- },
23
- "dependencies": {
24
- "curt-format": "^1.2.0"
25
- },
26
- "devDependencies": {
27
- "@types/node": "^24.0.0",
28
- "typescript": "^5.6.0",
29
- "vitest": "^3.0.0"
30
- },
31
- "keywords": [
32
- "curt",
33
- "claude-code",
34
- "transcript",
35
- "converter"
36
- ]
37
- }
1
+ {
2
+ "name": "curt-convert",
3
+ "version": "1.0.3",
4
+ "description": "Convert Claude Code session transcripts (JSONL) to .curt conversation files",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
10
+ "bin": {
11
+ "curt-convert": "dist/cli.js"
12
+ },
13
+ "main": "dist/convert.js",
14
+ "types": "dist/convert.d.ts",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "test": "vitest run",
21
+ "prepack": "npm run build"
22
+ },
23
+ "dependencies": {
24
+ "curt-format": "^1.2.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^24.0.0",
28
+ "typescript": "^5.6.0",
29
+ "vitest": "^5.1.0"
30
+ },
31
+ "keywords": [
32
+ "curt",
33
+ "claude-code",
34
+ "transcript",
35
+ "converter"
36
+ ],
37
+ "repository": {
38
+ "url": "https://github.com/JordanNewell/curt-convert.git",
39
+ "type": "git"
40
+ },
41
+ "homepage": "https://github.com/JordanNewell/curt-convert#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/JordanNewell/curt-convert/issues"
44
+ }
45
+ }