feat(coding-agent): added /dump command for clipboard transcript export
- Added new `/dump` slash command to copy full session transcript to clipboard. - Separated `/export` and `/dump` commands with distinct responsibilities, removing clipboard copy functionality from `/export`. - Implemented handleDumpCommand() method in command controller to manage clipboard operations independently.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <search>` 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 |
|
||||
|
||||
@@ -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<void> {
|
||||
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<void> {
|
||||
const tmpFile = path.join(os.tmpdir(), `${nanoid()}.html`);
|
||||
try {
|
||||
|
||||
@@ -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("");
|
||||
|
||||
@@ -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<void> {
|
||||
return this.commandController.handleDumpCommand();
|
||||
}
|
||||
|
||||
handleShareCommand(): Promise<void> {
|
||||
return this.commandController.handleShareCommand();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user