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 <ntaylormullen@google.com>
This commit is contained in:
Devansh Sharma
2025-07-20 20:57:41 +02:00
committed by GitHub
parent a01b1219a3
commit 8f85ac7de0
7 changed files with 771 additions and 1 deletions

View File

@@ -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<Config>;
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,

View File

@@ -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,