1
>
/*---------------------------------------------------------------------------------------------
agentHostSlashCommand.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
/** A slash command token at the start of a user message. */
7
>
export interface IParsedLeadingSlashCommand {
8
>
readonly command: string;
9
>
readonly rest: string;
10
>
readonly rawRest: string;
11
>
}
12
>
13
>
/** Parses a leading `/command` token followed by optional whitespace and text. */
14
>
export function parseLeadingSlashCommand(prompt: string): IParsedLeadingSlashCommand | undefined {
15
const match = /^\/([^\s/]+)(?:$|\s+([\s\S]*))/.exec(prompt);
16
if (!match) {