diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 17a7b288a..bcc880979 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -1,9 +1,9 @@ # Changelog ## [Unreleased] - ### Added +- Added `/dump` slash command to copy the full session transcript to the clipboard - Added automatic Nerd Fonts detection for terminals like iTerm, WezTerm, Kitty, Ghostty, and Alacritty to set appropriate symbol preset - Added `NERD_FONTS` environment variable override (`1` or `0`) to manually control Nerd Fonts symbol preset - Added Handlebars templating engine for prompt template rendering with `{{arg}}` helper for positional arguments @@ -11,6 +11,8 @@ ### Changed +- Separated `/export` and `/dump` commands—`/export` now only exports to HTML file, while `/dump` copies session transcript to clipboard +- Updated `/export` command to no longer accept `--copy` flag (use `/dump` instead) - Changed prompt template rendering to use Handlebars instead of simple string replacement - Updated prompt layout optimization to normalize indentation and collapse excessive blank lines - Changed auth migration to merge credentials per-provider instead of skipping when any credentials exist in database diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.md index 3fec7b7fe..5dfb36a67 100644 --- a/packages/coding-agent/README.md +++ b/packages/coding-agent/README.md @@ -223,7 +223,8 @@ The agent reads, writes, and edits files, and executes commands via bash. | ------------------------- | --------------------------------------------------------------------------- | | `/settings` | Open settings menu (thinking, theme, queue mode, toggles) | | `/model` | Switch models mid-session. Use `/model ` or `provider/model` to prefilter/disambiguate. | -| `/export [file\|--copy]` | Export session to HTML file or copy to clipboard | +| `/export [file]` | Export session to HTML file | +| `/dump` | Copy session transcript to clipboard | | `/share` | Upload session as secret GitHub gist, get shareable URL (requires `gh` CLI) | | `/session` | Show session info: path, message counts, token usage, cost | | `/hotkeys` | Show all keyboard shortcuts | diff --git a/packages/coding-agent/src/modes/interactive/controllers/command-controller.ts b/packages/coding-agent/src/modes/interactive/controllers/command-controller.ts index aeb0dc102..3b2a2661a 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/command-controller.ts +++ b/packages/coding-agent/src/modes/interactive/controllers/command-controller.ts @@ -38,17 +38,7 @@ export class CommandController { const arg = parts.length > 1 ? parts[1] : undefined; if (arg === "--copy" || arg === "clipboard" || arg === "copy") { - try { - const formatted = this.ctx.session.formatSessionAsText(); - if (!formatted) { - this.ctx.showError("No messages to export yet."); - return; - } - await copyToClipboard(formatted); - this.ctx.showStatus("Session copied to clipboard"); - } catch (error: unknown) { - this.ctx.showError(`Failed to copy session: ${error instanceof Error ? error.message : "Unknown error"}`); - } + this.ctx.showWarning("Use /dump to copy the session to clipboard."); return; } @@ -61,6 +51,20 @@ export class CommandController { } } + async handleDumpCommand(): Promise { + try { + const formatted = this.ctx.session.formatSessionAsText(); + if (!formatted) { + this.ctx.showError("No messages to dump yet."); + return; + } + await copyToClipboard(formatted); + this.ctx.showStatus("Session copied to clipboard"); + } catch (error: unknown) { + this.ctx.showError(`Failed to copy session: ${error instanceof Error ? error.message : "Unknown error"}`); + } + } + async handleShareCommand(): Promise { const tmpFile = path.join(os.tmpdir(), `${nanoid()}.html`); try { diff --git a/packages/coding-agent/src/modes/interactive/controllers/input-controller.ts b/packages/coding-agent/src/modes/interactive/controllers/input-controller.ts index 41d71350e..aff937002 100644 --- a/packages/coding-agent/src/modes/interactive/controllers/input-controller.ts +++ b/packages/coding-agent/src/modes/interactive/controllers/input-controller.ts @@ -139,6 +139,11 @@ export class InputController { this.ctx.editor.setText(""); return; } + if (text === "/dump") { + await this.ctx.handleDumpCommand(); + this.ctx.editor.setText(""); + return; + } if (text === "/share") { await this.ctx.handleShareCommand(); this.ctx.editor.setText(""); diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index 6366a6acc..e4a0552dc 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -186,7 +186,8 @@ export class InteractiveMode implements InteractiveModeContext { const slashCommands: SlashCommand[] = [ { name: "settings", description: "Open settings menu" }, { name: "model", description: "Select model (opens selector UI)" }, - { name: "export", description: "Export session to HTML file or clipboard (--copy)" }, + { name: "export", description: "Export session to HTML file" }, + { name: "dump", description: "Copy session transcript to clipboard" }, { name: "share", description: "Share session as a secret GitHub gist" }, { name: "copy", description: "Copy last agent message to clipboard" }, { name: "session", description: "Show session info and stats" }, @@ -494,6 +495,10 @@ export class InteractiveMode implements InteractiveModeContext { return this.commandController.handleExportCommand(text); } + handleDumpCommand(): Promise { + return this.commandController.handleDumpCommand(); + } + handleShareCommand(): Promise { return this.commandController.handleShareCommand(); }