Skip to content

Commit cbf3264

Browse files
CopilotTyriar
andcommitted
Add chat subcommand to Fig completion spec
Co-authored-by: Tyriar <[email protected]>
1 parent ab41685 commit cbf3264

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

extensions/terminal-suggest/src/completions/code.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,39 @@ export const codeTunnelSubcommands = [
797797
},
798798
],
799799
},
800+
{
801+
name: 'chat',
802+
description: 'Pass in a prompt to run in a chat session in the current working directory.',
803+
args: {
804+
name: 'prompt',
805+
description: 'The prompt to use as chat',
806+
isVariadic: true,
807+
isOptional: true,
808+
},
809+
options: [
810+
{
811+
name: ['-m', '--mode'],
812+
description: 'The mode to use for the chat session. Defaults to \'agent\'',
813+
args: {
814+
name: 'mode',
815+
suggestions: ['agent', 'ask', 'edit'],
816+
},
817+
},
818+
{
819+
name: ['-a', '--add-file'],
820+
description: 'Add files as context to the chat session',
821+
isRepeatable: true,
822+
args: {
823+
name: 'file',
824+
template: 'filepaths',
825+
},
826+
},
827+
{
828+
name: ['-h', '--help'],
829+
description: 'Print usage',
830+
},
831+
],
832+
},
800833
{
801834
name: 'status',
802835
description: 'Print process usage and diagnostics information',

extensions/terminal-suggest/src/test/completions/code.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const codeSpecOptionsAndSubcommands = [
6060
'--version',
6161
'--wait',
6262
'tunnel',
63+
'chat',
6364
'serve-web',
6465
'help',
6566
'status',
@@ -119,6 +120,11 @@ export function createCodeTestSpecs(executable: string): ITestSpec[] {
119120
{ input: `${executable} --category |`, expectedCompletions: categoryOptions },
120121
{ input: `${executable} --category a|`, expectedCompletions: categoryOptions },
121122

123+
// Chat subcommand tests
124+
{ input: `${executable} chat |` },
125+
{ input: `${executable} chat --mode |`, expectedCompletions: ['agent', 'ask', 'edit'] },
126+
{ input: `${executable} chat --add-file |`, expectedResourceRequests: { type: 'files', cwd: testPaths.cwd } },
127+
122128
// Middle of command
123129
{ input: `${executable} | --locale`, expectedCompletions: codeSpecOptionsAndSubcommands, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } },
124130
];
@@ -177,6 +183,7 @@ export function createCodeTunnelTestSpecs(executable: string): ITestSpec[] {
177183
'-s',
178184
'-v',
179185
'-w',
186+
'chat',
180187
'ext',
181188
'help',
182189
'serve-web',
@@ -273,6 +280,9 @@ export function createCodeTunnelTestSpecs(executable: string): ITestSpec[] {
273280
{ input: `${executable} tunnel unregister |`, expectedCompletions: [...commonFlags] },
274281
{ input: `${executable} tunnel service |`, expectedCompletions: [...commonFlags, 'help', 'install', 'log', 'uninstall'] },
275282
{ input: `${executable} tunnel help |`, expectedCompletions: helpSubcommands },
283+
{ input: `${executable} chat |`, expectedCompletions: ['--mode <mode>', '--add-file <file>', '--help', '-m <mode>', '-a <file>', '-h'] },
284+
{ input: `${executable} chat --mode |`, expectedCompletions: ['agent', 'ask', 'edit'] },
285+
{ input: `${executable} chat --add-file |`, expectedResourceRequests: { type: 'files', cwd: testPaths.cwd } },
276286
{ input: `${executable} serve-web |`, expectedCompletions: serveWebSubcommandsAndFlags },
277287
{ input: `${executable} ext |`, expectedCompletions: extSubcommands },
278288
{ input: `${executable} ext list |`, expectedCompletions: [...commonFlags, '--category [<category>]', '--show-versions'] },

0 commit comments

Comments
 (0)