feat(cli): add /btw slash command for ephemeral side questions

Allow users to ask quick "by the way" questions that use the current
conversation context but don't pollute the main conversation history.

Closes #2370

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Shaojin Wen 2026-03-14 15:50:41 +08:00
parent 1359563f45
commit 3818f8acd4
6 changed files with 201 additions and 1 deletions

View file

@ -0,0 +1,44 @@
/**
* @license
* Copyright 2025 Qwen Code
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { Box, Text } from 'ink';
import type { BtwProps } from '../../types.js';
import Spinner from 'ink-spinner';
import { Colors } from '../../colors.js';
export interface BtwDisplayProps {
btw: BtwProps;
}
/**
* BtwMessage renders the /btw (by the way) sidebar response.
* Shows an ephemeral question and answer that doesn't affect the main conversation.
*/
export const BtwMessage: React.FC<BtwDisplayProps> = ({ btw }) => (
<Box flexDirection="column">
<Box flexDirection="row">
<Text color={Colors.Gray} dimColor>
{'btw> '}
</Text>
<Text color={Colors.Gray}>{btw.question}</Text>
</Box>
<Box flexDirection="row" marginTop={0}>
{btw.isPending ? (
<Box>
<Box marginRight={1}>
<Spinner type="dots" />
</Box>
<Text color={Colors.AccentPurple}>Thinking...</Text>
</Box>
) : (
<Box flexDirection="column">
<Text color={Colors.AccentCyan}>{btw.answer}</Text>
</Box>
)}
</Box>
</Box>
);