From 8f85ac7de027326c0440cc21122d6439687fab44 Mon Sep 17 00:00:00 2001 From: Devansh Sharma Date: Sun, 20 Jul 2025 20:57:41 +0200 Subject: feat: Added /copy command for copying output to clipboard with new Command Service approach (#3706) Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com> Co-authored-by: N. Taylor Mullen --- packages/cli/src/services/CommandService.test.ts | 8 +++++++- packages/cli/src/services/CommandService.ts | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'packages/cli/src/services') diff --git a/packages/cli/src/services/CommandService.test.ts b/packages/cli/src/services/CommandService.test.ts index d03bf988..de4ff2ea 100644 --- a/packages/cli/src/services/CommandService.test.ts +++ b/packages/cli/src/services/CommandService.test.ts @@ -11,6 +11,7 @@ import { type SlashCommand } from '../ui/commands/types.js'; import { memoryCommand } from '../ui/commands/memoryCommand.js'; import { helpCommand } from '../ui/commands/helpCommand.js'; import { clearCommand } from '../ui/commands/clearCommand.js'; +import { copyCommand } from '../ui/commands/copyCommand.js'; import { corgiCommand } from '../ui/commands/corgiCommand.js'; import { docsCommand } from '../ui/commands/docsCommand.js'; import { chatCommand } from '../ui/commands/chatCommand.js'; @@ -51,6 +52,9 @@ vi.mock('../ui/commands/authCommand.js', () => ({ vi.mock('../ui/commands/themeCommand.js', () => ({ themeCommand: { name: 'theme', description: 'Mock Theme' }, })); +vi.mock('../ui/commands/copyCommand.js', () => ({ + copyCommand: { name: 'copy', description: 'Mock Copy' }, +})); vi.mock('../ui/commands/privacyCommand.js', () => ({ privacyCommand: { name: 'privacy', description: 'Mock Privacy' }, })); @@ -89,7 +93,7 @@ vi.mock('../ui/commands/restoreCommand.js', () => ({ })); describe('CommandService', () => { - const subCommandLen = 18; + const subCommandLen = 19; let mockConfig: Mocked; beforeEach(() => { @@ -132,6 +136,7 @@ describe('CommandService', () => { expect(commandNames).toContain('memory'); expect(commandNames).toContain('help'); expect(commandNames).toContain('clear'); + expect(commandNames).toContain('copy'); expect(commandNames).toContain('compress'); expect(commandNames).toContain('corgi'); expect(commandNames).toContain('docs'); @@ -205,6 +210,7 @@ describe('CommandService', () => { bugCommand, chatCommand, clearCommand, + copyCommand, compressCommand, corgiCommand, docsCommand, diff --git a/packages/cli/src/services/CommandService.ts b/packages/cli/src/services/CommandService.ts index def8cfcc..99eccbf2 100644 --- a/packages/cli/src/services/CommandService.ts +++ b/packages/cli/src/services/CommandService.ts @@ -9,6 +9,7 @@ import { SlashCommand } from '../ui/commands/types.js'; import { memoryCommand } from '../ui/commands/memoryCommand.js'; import { helpCommand } from '../ui/commands/helpCommand.js'; import { clearCommand } from '../ui/commands/clearCommand.js'; +import { copyCommand } from '../ui/commands/copyCommand.js'; import { corgiCommand } from '../ui/commands/corgiCommand.js'; import { docsCommand } from '../ui/commands/docsCommand.js'; import { mcpCommand } from '../ui/commands/mcpCommand.js'; @@ -36,6 +37,7 @@ const loadBuiltInCommands = async ( bugCommand, chatCommand, clearCommand, + copyCommand, compressCommand, corgiCommand, docsCommand, -- cgit v1.2.3