-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathchatShortcutGuidance.ts
More file actions
60 lines (55 loc) · 1.73 KB
/
chatShortcutGuidance.ts
File metadata and controls
60 lines (55 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import type { KeybindingCommand, ResolvedKeybindingsConfig } from "@okcode/contracts";
import { shortcutLabelsForCommand } from "~/keybindings";
export interface ChatShortcutGuideDefinition {
id: string;
command: KeybindingCommand;
title: string;
description: string;
}
export interface ChatShortcutGuide extends ChatShortcutGuideDefinition {
shortcutLabels: string[];
}
export const CHAT_SHORTCUT_GUIDE_DEFINITIONS = [
{
id: "new-thread",
command: "chat.new",
title: "New thread",
description: "Open a fresh conversation without leaving the current project.",
},
{
id: "new-local-thread",
command: "chat.newLocal",
title: "Local thread",
description: "Create a thread in a local or worktree-backed environment.",
},
{
id: "toggle-terminal",
command: "terminal.toggle",
title: "Terminal",
description: "Keep the shell one shortcut away while you chat.",
},
{
id: "favorite-editor",
command: "editor.openFavorite",
title: "Favorite editor",
description: "Jump straight to the editor you last used on this project.",
},
{
id: "pull-request",
command: "git.pullRequest",
title: "Pull request",
description: "Jump to the current PR or start the PR flow for the active branch.",
},
] as const satisfies readonly ChatShortcutGuideDefinition[];
export function buildChatShortcutGuides(
keybindings: ResolvedKeybindingsConfig,
platform: string,
): ChatShortcutGuide[] {
return CHAT_SHORTCUT_GUIDE_DEFINITIONS.map((definition) => ({
id: definition.id,
command: definition.command,
title: definition.title,
description: definition.description,
shortcutLabels: shortcutLabelsForCommand(keybindings, definition.command, platform),
}));
}