Skip to content

Commit 166c520

Browse files
Myoontyeeclaude
andcommitted
feat: add "Repair & Clone as New Session" option to Repair menu
Adds a third option to the Repair Session command that combines repair with inject functionality. This creates a clean copy of the current session with a new UUID while automatically stripping thinking-block signatures. Safer than in-place repair for API providers with strict signature requirements, as it preserves the original session and creates a fresh resumable clone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 90e77d7 commit 166c520

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "claude-code-exporter",
33
"displayName": "Claude Code Exporter — Claude Code, Codex & Cursor Conversation History",
44
"description": "Export AI coding agent conversations to Markdown. Supports Claude Code (→ .claude-code-history/), OpenAI Codex (→ .codex-history/), and Cursor Composer (→ .cursor-history/). Features: auto-watch, session inject/import for claude --resume, and repair of thinking-block signature errors when switching API providers.",
5-
"version": "0.6.5",
5+
"version": "0.6.6",
66
"publisher": "myoontyee",
77
"engines": {
88
"vscode": "^1.85.0"

src/extension.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ export function activate(context: vscode.ExtensionContext): void {
411411
description: 'Fix all sessions — useful after bulk API switch',
412412
value: 'all',
413413
},
414+
{
415+
label: '$(add) Repair & Clone as New Session',
416+
description: 'Create a clean copy with new UUID — safe for strict API providers',
417+
value: 'clone',
418+
},
414419
], { placeHolder: 'Repair thinking-block signatures (fixes 400 errors after provider switch)' });
415420

416421
if (!choice) return;
@@ -424,6 +429,24 @@ export function activate(context: vscode.ExtensionContext): void {
424429
return;
425430
}
426431

432+
// ── Clone mode: inject current session as new UUID ──────────────────────
433+
if (choice.value === 'clone') {
434+
const mostRecent = jsonls.sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs)[0];
435+
try {
436+
const result = injectSession(mostRecent, claudeProjectDir);
437+
vscode.window.showInformationMessage(
438+
`✓ Cloned session with new UUID: ${result.sessionId}\n\n` +
439+
`Resume with: claude --resume ${result.sessionId}\n\n` +
440+
`All thinking signatures have been stripped automatically.`,
441+
{ modal: true }
442+
);
443+
} catch (err) {
444+
vscode.window.showErrorMessage(`Clone failed: ${err}`);
445+
}
446+
return;
447+
}
448+
449+
// ── In-place repair mode ────────────────────────────────────────────────
427450
const targets = choice.value === 'current'
428451
? [jsonls.sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs)[0]]
429452
: jsonls;

0 commit comments

Comments
 (0)