feat(cli): add /btw command architecture and types

This commit is contained in:
Mahima Shanware
2026-03-26 16:51:49 +00:00
committed by Mahima Shanware
parent 0bd797a2be
commit 09774da43c
3 changed files with 42 additions and 1 deletions
@@ -21,6 +21,7 @@ import {
import { aboutCommand } from '../ui/commands/aboutCommand.js';
import { agentsCommand } from '../ui/commands/agentsCommand.js';
import { authCommand } from '../ui/commands/authCommand.js';
import { btwCommand } from '../ui/commands/btwCommand.js';
import { bugCommand } from '../ui/commands/bugCommand.js';
import { chatCommand, debugCommand } from '../ui/commands/chatCommand.js';
import { clearCommand } from '../ui/commands/clearCommand.js';
@@ -120,6 +121,7 @@ export class BuiltinCommandLoader implements ICommandLoader {
aboutCommand,
...(this.config?.isAgentsEnabled() ? [agentsCommand] : []),
authCommand,
btwCommand,
bugCommand,
{
...chatCommand,
@@ -0,0 +1,33 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { CommandKind, type SlashCommand } from './types.js';
export const btwCommand: SlashCommand = {
name: 'btw',
description: 'Ask a side question without affecting history (ephemeral)',
kind: CommandKind.BUILT_IN,
autoExecute: true,
isSafeConcurrent: true,
action: (context, args) => {
const query = args.trim();
if (!query) {
return {
type: 'command_output',
value: [
{
text: 'Please provide a question, e.g. /btw what is this regex doing?',
},
],
};
}
return {
type: 'btw',
query,
};
},
};
+7 -1
View File
@@ -166,6 +166,11 @@ export interface LogoutActionReturn {
type: 'logout';
}
export interface BtwActionReturn {
type: 'btw';
query: string;
}
export type SlashCommandActionReturn =
| CommandActionReturn<HistoryItemWithoutId[]>
| QuitActionReturn
@@ -173,7 +178,8 @@ export type SlashCommandActionReturn =
| ConfirmShellCommandsActionReturn
| ConfirmActionReturn
| OpenCustomDialogActionReturn
| LogoutActionReturn;
| LogoutActionReturn
| BtwActionReturn;
export enum CommandKind {
BUILT_IN = 'built-in',