mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 18:02:11 +00:00
feat(coding-agent): export keyHint utilities for extensions (#802)
This commit is contained in:
parent
7f9cf543d5
commit
58eec55154
3 changed files with 31 additions and 0 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Export `keyHint`, `appKeyHint`, `editorKey`, `appKey`, `rawKeyHint` for extensions to format keybinding hints consistently
|
||||||
|
|
||||||
## [0.48.0] - 2026-01-16
|
## [0.48.0] - 2026-01-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -1276,6 +1276,28 @@ renderResult(result, { expanded, isPartial }, theme) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Keybinding Hints
|
||||||
|
|
||||||
|
Use `keyHint()` to display keybinding hints that respect user's keybinding configuration:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { keyHint } from "@mariozechner/pi-coding-agent";
|
||||||
|
|
||||||
|
renderResult(result, { expanded }, theme) {
|
||||||
|
let text = theme.fg("success", "✓ Done");
|
||||||
|
if (!expanded) {
|
||||||
|
text += ` (${keyHint("expandTools", "to expand")})`;
|
||||||
|
}
|
||||||
|
return new Text(text, 0, 0);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Available functions:
|
||||||
|
- `keyHint(action, description)` - Editor actions (e.g., `"expandTools"`, `"selectConfirm"`)
|
||||||
|
- `appKeyHint(keybindings, action, description)` - App actions (requires `KeybindingsManager`)
|
||||||
|
- `editorKey(action)` - Get raw key string for editor action
|
||||||
|
- `rawKeyHint(key, description)` - Format a raw key string
|
||||||
|
|
||||||
#### Best Practices
|
#### Best Practices
|
||||||
|
|
||||||
- Use `Text` with padding `(0, 0)` - the Box handles padding
|
- Use `Text` with padding `(0, 0)` - the Box handles padding
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,8 @@ export {
|
||||||
export {
|
export {
|
||||||
ArminComponent,
|
ArminComponent,
|
||||||
AssistantMessageComponent,
|
AssistantMessageComponent,
|
||||||
|
appKey,
|
||||||
|
appKeyHint,
|
||||||
BashExecutionComponent,
|
BashExecutionComponent,
|
||||||
BorderedLoader,
|
BorderedLoader,
|
||||||
BranchSummaryMessageComponent,
|
BranchSummaryMessageComponent,
|
||||||
|
|
@ -247,11 +249,14 @@ export {
|
||||||
ExtensionEditorComponent,
|
ExtensionEditorComponent,
|
||||||
ExtensionInputComponent,
|
ExtensionInputComponent,
|
||||||
ExtensionSelectorComponent,
|
ExtensionSelectorComponent,
|
||||||
|
editorKey,
|
||||||
FooterComponent,
|
FooterComponent,
|
||||||
|
keyHint,
|
||||||
LoginDialogComponent,
|
LoginDialogComponent,
|
||||||
ModelSelectorComponent,
|
ModelSelectorComponent,
|
||||||
OAuthSelectorComponent,
|
OAuthSelectorComponent,
|
||||||
type RenderDiffOptions,
|
type RenderDiffOptions,
|
||||||
|
rawKeyHint,
|
||||||
renderDiff,
|
renderDiff,
|
||||||
SessionSelectorComponent,
|
SessionSelectorComponent,
|
||||||
type SettingsCallbacks,
|
type SettingsCallbacks,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue