@thegitai/cli 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/src/client-environment.js +1 -1
- package/dist/src/help-text.js +232 -226
- package/dist/src/keybindings-file.js +38 -0
- package/dist/src/keyboard-shortcuts.js +57 -0
- package/dist/src/tools/computer.js +23 -10
- package/dist/src/ui/repl.js +17 -2
- package/dist/src/ui/slash-commands.js +2 -1
- package/dist/src/ui/tui/build-frame.js +8 -4
- package/dist/src/ui/tui/shell-input.js +10 -14
- package/dist/src/ui/tui/shortcuts.js +8 -5
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -15,8 +15,8 @@ This package is the CLI. The same agent is also available as a
|
|
|
15
15
|
running in the background while it reproduces a bug and reads the logs.
|
|
16
16
|
- **Your signed-in Chrome** - with the TheGitAI Chrome extension it works in the
|
|
17
17
|
browser you already have open, signed in as you, in its own tab group.
|
|
18
|
-
- **Computer Control** - it uses the apps on your computer on Linux and
|
|
19
|
-
in front of you, or on a screen of its own while you keep working.
|
|
18
|
+
- **Computer Control** - it uses the apps on your computer on Linux, macOS and Windows:
|
|
19
|
+
in front of you, or, on Linux and macOS, on a screen of its own while you keep working.
|
|
20
20
|
[Setup guide](https://thegit.ai/docs/computer-control/overview).
|
|
21
21
|
- **Skills** - teach it your team's workflows as `SKILL.md` folders. It uses one
|
|
22
22
|
when a request calls for it, or when you type `/<name>`.
|
|
@@ -29,6 +29,7 @@ This package is the CLI. The same agent is also available as a
|
|
|
29
29
|
- **Beyond source code** - reads PDF, Word and Excel files, edits Word
|
|
30
30
|
documents, looks at screenshots, generates images, and searches and fetches
|
|
31
31
|
the web.
|
|
32
|
+
- **Keyboard shortcuts** - open `/keybindings` to edit the keys for mode switching, image paste, background jobs, and notifications. Saved changes apply in the current session.
|
|
32
33
|
- **Steering and recovery** - send corrections while it works, switch between
|
|
33
34
|
Default, Bypass all permissions and Plan modes, and undo an edit, a turn or a
|
|
34
35
|
file, or restore a checkpoint.
|
|
@@ -128,6 +128,6 @@ export function collectClientEnvironment(options = {}) {
|
|
|
128
128
|
packageManagers: detectPackageManagers(env, platform, executableExists),
|
|
129
129
|
scratchDir: options.scratchDir ?? ensureSessionScratchDir(),
|
|
130
130
|
browserExtensionSeen: options.browserExtensionSeen ?? browserExtensionSeen(env),
|
|
131
|
-
computerControl: (platform === 'linux' || platform === 'darwin') && Boolean(computerHelperPath(env)),
|
|
131
|
+
computerControl: (platform === 'linux' || platform === 'darwin' || platform === 'win32') && Boolean(computerHelperPath(env)),
|
|
132
132
|
};
|
|
133
133
|
}
|
package/dist/src/help-text.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import chalk from './colors.js';
|
|
2
|
+
import { shortcutLabel } from './keyboard-shortcuts.js';
|
|
2
3
|
import { getCliVersion, getPlatformTag } from './version.js';
|
|
3
4
|
function pasteShortcutForPlatform() {
|
|
4
5
|
switch (process.platform) {
|
|
@@ -11,227 +12,232 @@ function pasteShortcutForPlatform() {
|
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
const PASTE_SHORTCUT = pasteShortcutForPlatform();
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
15
|
+
function helpMarkdown(shortcuts = {}) {
|
|
16
|
+
const key = (id) => shortcutLabel(id, shortcuts);
|
|
17
|
+
return [
|
|
18
|
+
'# TheGitAI',
|
|
19
|
+
'',
|
|
20
|
+
'Interactive terminal coding agent. Local repo search, file edits, and',
|
|
21
|
+
'shell commands run on your machine. Model inference and server-executed',
|
|
22
|
+
'tools run on the server.',
|
|
23
|
+
'',
|
|
24
|
+
'## Usage',
|
|
25
|
+
'',
|
|
26
|
+
'- `ai` - start an interactive chat session in the current repo',
|
|
27
|
+
'- `ai "<request>"` - start an interactive session with `<request>` as the first message',
|
|
28
|
+
'- Coding sessions require terminal stdin and stdout; piped prompts are not supported.',
|
|
29
|
+
'',
|
|
30
|
+
'## Auth',
|
|
31
|
+
'',
|
|
32
|
+
'- `ai` - signs you in if you are not already, then starts a session',
|
|
33
|
+
'- `ai login` - the same thing; kept for muscle memory',
|
|
34
|
+
'- Signing in opens your browser. When it cannot open one - over SSH, in a',
|
|
35
|
+
' container, or when the browser you want is on another device - the same',
|
|
36
|
+
' screen prints a URL you can open anywhere and takes the code that page',
|
|
37
|
+
' gives you back. There is no mode to pick and no flag to remember.',
|
|
38
|
+
'- `ai whoami` - show the signed-in account',
|
|
39
|
+
'- `ai --usage` - show account usage percentage and reset times',
|
|
40
|
+
'- `ai logout` - sign out',
|
|
41
|
+
'',
|
|
42
|
+
'## MCP servers',
|
|
43
|
+
'',
|
|
44
|
+
'- `ai mcp add <name> -- <command> [args...]` - connect a local MCP server',
|
|
45
|
+
'- `ai mcp add --transport http <name> <url>` - connect a remote MCP server',
|
|
46
|
+
'- `ai mcp --help` - configuration, headers, environment variables and commands',
|
|
47
|
+
'- Short setup flags: `-t` transport, `-e` environment, `-H` header, `-s user` scope.',
|
|
48
|
+
'- `/mcp` - check connections and available tools; changes apply next turn',
|
|
49
|
+
'- Default mode asks before MCP calls; approvals can cover one tool for the session.',
|
|
50
|
+
'- Bypass mode also approves MCP calls. Plan mode blocks MCP calls.',
|
|
51
|
+
'- Invalid servers are reported individually; chat continues with available tools.',
|
|
52
|
+
'- `/mcp` retries connections; tool lists are cached for one minute.',
|
|
53
|
+
'- MCP supports tools over stdio and Streamable HTTP. OAuth, prompts and resources',
|
|
54
|
+
' are not supported yet. Add only servers you trust.',
|
|
55
|
+
'',
|
|
56
|
+
'## Sessions',
|
|
57
|
+
'',
|
|
58
|
+
'- `ai --list-sessions` - list saved sessions for this repo',
|
|
59
|
+
'- `ai --session <id|name>` - resume a saved session by id or name',
|
|
60
|
+
'- Sessions are stored locally and can be listed or resumed in the same repo.',
|
|
61
|
+
' Continuing one requires the TheGitAI account used for that session.',
|
|
62
|
+
'',
|
|
63
|
+
'## Updates',
|
|
64
|
+
'',
|
|
65
|
+
'- On start, `ai` says when a newer release is published and offers to install',
|
|
66
|
+
' it. TheGitAI works best on the latest version, and an older CLI may not',
|
|
67
|
+
' work optimally.',
|
|
68
|
+
'- **Update now** is selected when the offer appears, so **Enter** takes the',
|
|
69
|
+
' update; **↑/↓** moves to **Skip**, and the number keys still jump straight',
|
|
70
|
+
' to a row. The CLI installs the update and asks you to start `ai` again, so',
|
|
71
|
+
' the whole session runs one version.',
|
|
72
|
+
'- Skipping starts the session on the version you have and asks again next',
|
|
73
|
+
' time. A release cannot be silenced for good - that is what keeps a broken',
|
|
74
|
+
' combination from lasting.',
|
|
75
|
+
'- **Ctrl+C** at the prompt quits without installing anything and without',
|
|
76
|
+
' starting the session.',
|
|
77
|
+
'',
|
|
78
|
+
'## Options',
|
|
79
|
+
'',
|
|
80
|
+
'- `-y, --yes` - start in Bypass all permissions mode',
|
|
81
|
+
'- `-h, --help` - show this help',
|
|
82
|
+
'- `-v, --version` - print the version and exit',
|
|
83
|
+
'',
|
|
84
|
+
'## Modes',
|
|
85
|
+
'',
|
|
86
|
+
'- Default · Ask for Approval - asks before creating, editing or deleting',
|
|
87
|
+
' files, before running commands, and before touching a website. Each answer',
|
|
88
|
+
' can be remembered for the rest of the session, and once it is, Default',
|
|
89
|
+
' stops asking for that action; see Safety & approvals.',
|
|
90
|
+
'- Bypass all permissions - approves every command, file edit, deletion and',
|
|
91
|
+
' browser action for the rest of the session, without asking. Shown in red',
|
|
92
|
+
' in the footer. Blocked commands stay blocked.',
|
|
93
|
+
'- Plan - read-only; the agent can inspect, ask typed questions, and plan,',
|
|
94
|
+
' with file-reading shell commands only. It will not edit files or run tests,',
|
|
95
|
+
' builds, diagnostics, package managers, project code, or network probes.',
|
|
96
|
+
`- In the TUI, press **?** on an empty composer for the keyboard-and-mouse panel. ${key('cycleMode')} cycles Default → Bypass → Plan (refused while the agent is working), mouse drag copies transcript/footer text, left-click opens rendered links, right-click copies rendered links or pastes in the sticky composer/footer when no selection is active, double-click copies a word, and triple-click copies a row.`,
|
|
97
|
+
'',
|
|
98
|
+
'## Keys & clipboard',
|
|
99
|
+
'',
|
|
100
|
+
'- **?** on an empty composer opens the keyboard-and-mouse panel.',
|
|
101
|
+
`- **Enter** sends • **${key('cycleMode')}** cycles Default → Bypass → Plan (only`,
|
|
102
|
+
' between turns) • **Esc** cancels the turn •',
|
|
103
|
+
' **Ctrl+C** clears the composer or the queued message, and quits once there',
|
|
104
|
+
' is nothing left to clear. These are the same on macOS, Linux, and Windows.',
|
|
105
|
+
'- **While the agent is working**, Enter queues your message and locks the',
|
|
106
|
+
' composer. Press **Enter** again to send it into the running turn: the agent',
|
|
107
|
+
' picks it up at its next step instead of waiting for the turn to finish, and',
|
|
108
|
+
' the Your messages panel tracks it from queued to delivered. **↑** brings it',
|
|
109
|
+
' back for editing and **Esc**/**Ctrl+C** discards it; both unlock the',
|
|
110
|
+
` composer for the next message. **${key('pasteImage')}** pastes a screenshot onto the`,
|
|
111
|
+
' queued message, and it is delivered into the running turn with the text.',
|
|
112
|
+
`- **${key('notifications')}** turns desktop notifications on or off. One is raised when a turn`,
|
|
113
|
+
' ends and when a permission prompt or a question is waiting for you, but',
|
|
114
|
+
' only while the terminal is in the background - if you are looking at the',
|
|
115
|
+
' session you are told nothing. Coming back clears it. The choice is',
|
|
116
|
+
' remembered between sessions.',
|
|
117
|
+
`- **Paste** into the composer with your terminal's paste shortcut (\`${PASTE_SHORTCUT}\``,
|
|
118
|
+
' on this system) or by right-clicking the composer.',
|
|
119
|
+
'- **Copy** from the transcript by dragging to select; double-click copies a',
|
|
120
|
+
' word and triple-click copies a row. Left-click opens rendered links.',
|
|
121
|
+
...(process.platform === 'darwin'
|
|
122
|
+
? ['- On Mac laptops without dedicated keys, **Home/End** are `Fn+←` / `Fn+→`.']
|
|
123
|
+
: []),
|
|
124
|
+
'',
|
|
125
|
+
'## Questions',
|
|
126
|
+
'',
|
|
127
|
+
'- The agent can pause a turn to ask up to four questions in one form.',
|
|
128
|
+
' **↑/↓** moves, the option number or **Enter** chooses, **←/→** moves',
|
|
129
|
+
' between questions, and the last question has a **Submit answers** row.',
|
|
130
|
+
'- Only the option you are on shows its description, so the whole form fits',
|
|
131
|
+
' on screen. Move to an option to read what it means.',
|
|
132
|
+
'- **Something else / add details** is the numbered final option: focus it',
|
|
133
|
+
' and type. **Enter** commits the note and moves to the next question, or to',
|
|
134
|
+
' Submit on the last one - it never submits the form for you.',
|
|
135
|
+
'- **Esc** closes an open note first, and otherwise cancels the form.',
|
|
136
|
+
'',
|
|
137
|
+
'## Chat commands',
|
|
138
|
+
'',
|
|
139
|
+
'- Type `/` to open the command picker. It ranks what you type, so a typo or',
|
|
140
|
+
' a stray plural (`/moddel`, `/models`) still finds the command, and a word',
|
|
141
|
+
' from the description does too (`/bug` finds `/report`). It shows the five',
|
|
142
|
+
' best matches and counts the rest; **↑/↓** chooses, **Tab** or **Enter**',
|
|
143
|
+
' accepts, **Esc** closes it.',
|
|
144
|
+
'- `/help` - show this help',
|
|
145
|
+
'- `/mcp` - check MCP connections and list available tools',
|
|
146
|
+
'- `/skills` - list your skills and any that failed to load',
|
|
147
|
+
'- `/skills add <source>` - install a skill from GitHub (`owner/repo/path`',
|
|
148
|
+
' or a GitHub URL) or from a local folder into ~/.thegitai/skills; add',
|
|
149
|
+
' `--project` to put it in this project\'s .thegitai/skills instead',
|
|
150
|
+
'- `/memory` - see the topics the agent has saved on this computer; also',
|
|
151
|
+
' `/memory show <number>`, `/memory delete <number>`, `/memory off`, `/memory on`',
|
|
152
|
+
'- `/<skill> [what to do]` - run a skill yourself. Skills show up in the',
|
|
153
|
+
' command picker, and the agent also loads a matching skill on its own',
|
|
154
|
+
'- `/about` - show version and platform info',
|
|
155
|
+
'- `/report` - report a bug or request a feature privately through the TheGitAI website in your',
|
|
156
|
+
' browser (sign in with your existing account)',
|
|
157
|
+
'- `/usage` - show account usage percentage and reset times',
|
|
158
|
+
'- `/model` - ↑/↓ picks a model, ←/→ adjusts effort; Enter saves for this project, Esc cancels',
|
|
159
|
+
'- `/model <id>` - switch the active model without clearing history',
|
|
160
|
+
'- `/resume` - resume a saved session for this repo',
|
|
161
|
+
'- `/jobs` - manage long-running commands like dev servers and watchers:',
|
|
162
|
+
' browse them, press Enter to expand one and read its output, k to stop it',
|
|
163
|
+
`- ${key('backgroundJobs')} - open the same jobs picker, and the only way in while the agent`,
|
|
164
|
+
' is working; press it again or Esc to close without touching the turn',
|
|
165
|
+
'- `/jobs output <id>` - print one job\'s full captured output',
|
|
166
|
+
'- `/jobs kill <id>` - stop one background job',
|
|
167
|
+
`- \`/notify\` - turn desktop notifications on or off (same as ${key('notifications')})`,
|
|
168
|
+
'- `/keybindings` - change the keys for the agent mode, image paste, background',
|
|
169
|
+
' jobs and notifications',
|
|
170
|
+
'- `/new` - start a new conversation; this session remains saved',
|
|
171
|
+
'- `/logout` - sign out and quit',
|
|
172
|
+
'- `/exit` - quit the session',
|
|
173
|
+
'',
|
|
174
|
+
'## Safety & approvals',
|
|
175
|
+
'',
|
|
176
|
+
'- In Default mode TheGitAI asks before it creates a file, edits an existing',
|
|
177
|
+
' file, deletes a file, or runs a command. These are four separate',
|
|
178
|
+
' permissions: allowing edits does not allow deletions, and allowing file',
|
|
179
|
+
' changes does not allow commands.',
|
|
180
|
+
'- At each prompt: **↑/↓** moves between choices, **Enter** confirms the',
|
|
181
|
+
' highlighted one, and **Esc** denies. Deny is selected by default.',
|
|
182
|
+
' Single-letter shortcuts were removed on purpose: a prompt can appear',
|
|
183
|
+
' while you are typing, and a stray letter must never approve anything.',
|
|
184
|
+
'- Every prompt offers Approve once, an "Always allow" for that kind of',
|
|
185
|
+
' action, and Deny. A command also offers to remember just its prefix - for',
|
|
186
|
+
' example approving `npm test -- --watch=false` can allow `npm test`.',
|
|
187
|
+
'- A prefix is only offered when the command shows a plain verb, as in',
|
|
188
|
+
' `npm test` or `git status`. Commands with no verb (`ls -la`), interpreters',
|
|
189
|
+
' and wrappers (`bash -c`, `python -c`, `env`, `timeout`, `make`), and',
|
|
190
|
+
' destructive or network binaries (`rm`, `sudo`, `curl`) are never offered',
|
|
191
|
+
' one - a bare binary grant would mean "anything this program can do".',
|
|
192
|
+
' `npm run` must name its script, so the grant is `npm run build`.',
|
|
193
|
+
'- A remembered prefix never covers a command that chains, pipes, redirects,',
|
|
194
|
+
' or substitutes, so allowing `npm test` can never green-light',
|
|
195
|
+
' `npm test && rm -rf build`.',
|
|
196
|
+
'- Everything you allow lasts for the current session only and is forgotten',
|
|
197
|
+
' when it ends. `/new` clears it immediately.',
|
|
198
|
+
'- If an approved `sudo` command needs a password, the TUI shows the exact',
|
|
199
|
+
' command and keeps the password masked and local.',
|
|
200
|
+
'- `-y` / `--yes` at startup auto-approves every shell command and file',
|
|
201
|
+
' edit for the whole session - use with care.',
|
|
202
|
+
'- Using desktop apps (Linux and macOS, preview) always asks first, even in',
|
|
203
|
+
' Bypass all permissions mode: in the background, on a screen of its own',
|
|
204
|
+
' you watch in a small window while you keep your mouse and keyboard, or on',
|
|
205
|
+
' your screen, where Esc takes over. The answer lasts for the task, or for',
|
|
206
|
+
' the session if you choose that.',
|
|
207
|
+
'- Long-running commands (e.g. dev servers) can run as managed background',
|
|
208
|
+
' jobs after the same approval as any other command. Background output',
|
|
209
|
+
' stays quiet once the model has responded; the footer shows only a compact',
|
|
210
|
+
' shell-running indicator, `/jobs` lists, inspects, and kills jobs, and',
|
|
211
|
+
' killed jobs disappear immediately. While a turn is running the indicator',
|
|
212
|
+
` points at ${key('backgroundJobs')} instead, which opens the same picker without cancelling`,
|
|
213
|
+
' or interrupting the turn. Every job is killed when the session ends.',
|
|
214
|
+
'- File and shell operations are confined to the target repo root.',
|
|
215
|
+
'- Sensitive directories (`.git`, `node_modules`, build output) are',
|
|
216
|
+
' excluded from search and listing.',
|
|
217
|
+
'',
|
|
218
|
+
'## Troubleshooting',
|
|
219
|
+
'',
|
|
220
|
+
'- Auth or permission errors → run `ai whoami` to confirm the signed-in',
|
|
221
|
+
' account.',
|
|
222
|
+
'- Usage or quota errors → run `ai --usage`.',
|
|
223
|
+
'- Signed in with the wrong account → `/logout` (or `ai logout`), then run',
|
|
224
|
+
' `ai` and sign in as the account you intended to use.',
|
|
225
|
+
'- The browser did not open, or opened on the wrong machine → open the URL',
|
|
226
|
+
' printed on the sign-in screen anywhere you like, choose "On another',
|
|
227
|
+
' computer" on that page, and paste the code back into the terminal.',
|
|
228
|
+
'- A local session was used with a different sign-in → sign in with the',
|
|
229
|
+
' account you used for that session or start a new session.',
|
|
230
|
+
'- The connection drops mid-turn → nothing to do: the CLI reconnects to the',
|
|
231
|
+
' same turn up to three times, ten seconds apart, without running anything',
|
|
232
|
+
' twice. Esc stops it. If it cannot reconnect it says so; some actions may',
|
|
233
|
+
' already have completed, and a queued message waits in the composer.',
|
|
234
|
+
' If the service restarted mid-turn, the turn continues from the steps that',
|
|
235
|
+
' had finished. Starting `ai` while the service is briefly unavailable waits',
|
|
236
|
+
' the same way.',
|
|
237
|
+
'- For anything else, re-run the command and file the printed error',
|
|
238
|
+
' message with `/report` - there is no client-side debug mode by design.',
|
|
239
|
+
].join('\n');
|
|
240
|
+
}
|
|
235
241
|
export function formatAboutCard() {
|
|
236
242
|
return [
|
|
237
243
|
'```',
|
|
@@ -243,14 +249,14 @@ export function formatAboutCard() {
|
|
|
243
249
|
].join('\n');
|
|
244
250
|
}
|
|
245
251
|
export function formatHelpMarkdown() {
|
|
246
|
-
return
|
|
252
|
+
return helpMarkdown();
|
|
247
253
|
}
|
|
248
|
-
export function formatInteractiveHelpText() {
|
|
249
|
-
return
|
|
254
|
+
export function formatInteractiveHelpText(shortcuts) {
|
|
255
|
+
return helpMarkdown(shortcuts);
|
|
250
256
|
}
|
|
251
257
|
export function formatCliHelpText({ color = false } = {}) {
|
|
252
258
|
if (!color) {
|
|
253
|
-
return
|
|
259
|
+
return helpMarkdown().split('\n')
|
|
254
260
|
.map((line) => line
|
|
255
261
|
.replace(/^#{1,6}\s+/, '')
|
|
256
262
|
.replace(/^-\s+/, ' ')
|
|
@@ -258,7 +264,7 @@ export function formatCliHelpText({ color = false } = {}) {
|
|
|
258
264
|
.replace(/\*\*([^*]+)\*\*/g, '$1'))
|
|
259
265
|
.join('\n');
|
|
260
266
|
}
|
|
261
|
-
return
|
|
267
|
+
return helpMarkdown().split('\n')
|
|
262
268
|
.map((line) => {
|
|
263
269
|
const heading = line.match(/^(#{1,6})\s+(.*)$/);
|
|
264
270
|
if (heading) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, unwatchFile, watchFile, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getClientStateDir } from './client-state.js';
|
|
4
|
+
import { defaultShortcuts, parseShortcutFile } from './keyboard-shortcuts.js';
|
|
5
|
+
export function keybindingsPath(env) {
|
|
6
|
+
return path.join(getClientStateDir(env), 'keybindings.json');
|
|
7
|
+
}
|
|
8
|
+
export function prepareKeybindings(file, platform = process.platform) {
|
|
9
|
+
mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
10
|
+
const defaults = Object.entries(defaultShortcuts(platform)).map(([id, keys]) => [id, keys.length === 1 ? keys[0] : keys]);
|
|
11
|
+
const content = {
|
|
12
|
+
$docs: 'https://thegit.ai/docs/basics/keyboard-and-mouse#customize-cli-shortcuts',
|
|
13
|
+
...Object.fromEntries(defaults),
|
|
14
|
+
};
|
|
15
|
+
try {
|
|
16
|
+
writeFileSync(file, JSON.stringify(content, null, 2) + '\n', { flag: 'wx', mode: 0o600 });
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code !== 'EEXIST')
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function watchKeybindings(file, update, error) {
|
|
24
|
+
function reload() {
|
|
25
|
+
try {
|
|
26
|
+
update(parseShortcutFile(JSON.parse(readFileSync(file, 'utf8'))));
|
|
27
|
+
}
|
|
28
|
+
catch (reason) {
|
|
29
|
+
if (reason.code === 'ENOENT')
|
|
30
|
+
update({});
|
|
31
|
+
else
|
|
32
|
+
error(`Could not apply ${file}: ${reason.message} Your previous keys still work.`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
watchFile(file, { persistent: false, interval: 450 }, reload);
|
|
36
|
+
reload();
|
|
37
|
+
return () => unwatchFile(file, reload);
|
|
38
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const RESERVED_KEYS = ['Ctrl+C', 'Ctrl+H', 'Ctrl+I', 'Ctrl+J', 'Ctrl+M'];
|
|
2
|
+
export function defaultShortcuts(platform = process.platform) {
|
|
3
|
+
return {
|
|
4
|
+
cycleMode: ['Shift+Tab'],
|
|
5
|
+
pasteImage: platform === 'win32' ? ['Alt+V', 'Ctrl+V'] : ['Ctrl+V'],
|
|
6
|
+
backgroundJobs: ['Ctrl+B'],
|
|
7
|
+
notifications: ['Ctrl+G'],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function shortcutLabel(id, overrides = {}, platform = process.platform) {
|
|
11
|
+
return (overrides[id] ?? defaultShortcuts(platform)[id]).join(' / ');
|
|
12
|
+
}
|
|
13
|
+
export function matchesShortcut(id, key, overrides = {}) {
|
|
14
|
+
const chord = key.tab
|
|
15
|
+
? key.shift && !key.ctrl && !key.meta ? 'Shift+Tab' : ''
|
|
16
|
+
: key.ctrl !== key.meta && !key.shift && /^[a-z]$/i.test(key.input)
|
|
17
|
+
? `${key.ctrl ? 'Ctrl' : 'Alt'}+${key.input.toUpperCase()}`
|
|
18
|
+
: '';
|
|
19
|
+
return chord !== '' && (overrides[id] ?? defaultShortcuts()[id]).includes(chord);
|
|
20
|
+
}
|
|
21
|
+
export function parseShortcutFile(value, platform = process.platform) {
|
|
22
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
23
|
+
throw new Error('Expected an object such as { "cycleMode": "Ctrl+T" }.');
|
|
24
|
+
}
|
|
25
|
+
const defaults = defaultShortcuts(platform);
|
|
26
|
+
const overrides = {};
|
|
27
|
+
for (const [name, setting] of Object.entries(value)) {
|
|
28
|
+
if (name.startsWith('$'))
|
|
29
|
+
continue;
|
|
30
|
+
if (!Object.hasOwn(defaults, name)) {
|
|
31
|
+
throw new Error(`Unknown action "${name}". Use ${Object.keys(defaults).join(', ')}.`);
|
|
32
|
+
}
|
|
33
|
+
const id = name;
|
|
34
|
+
const list = Array.isArray(setting) ? setting : [setting];
|
|
35
|
+
overrides[id] = [...new Set(list.map((raw) => {
|
|
36
|
+
const match = typeof raw === 'string' ? /^\s*(ctrl|alt)\s*\+\s*([a-z])\s*$/i.exec(raw) : null;
|
|
37
|
+
const key = match
|
|
38
|
+
? `${match[1].toLowerCase() === 'ctrl' ? 'Ctrl' : 'Alt'}+${match[2].toUpperCase()}`
|
|
39
|
+
: defaults[id].find((item) => typeof raw === 'string' && item.toLowerCase() === raw.trim().toLowerCase());
|
|
40
|
+
if (!key || RESERVED_KEYS.includes(key)) {
|
|
41
|
+
throw new Error(`"${String(raw)}" can't be used for ${id}. Use Ctrl or Alt with a letter, like Ctrl+T (not Ctrl+C, H, I, J or M).`);
|
|
42
|
+
}
|
|
43
|
+
return key;
|
|
44
|
+
}))];
|
|
45
|
+
if (overrides[id].length === 0)
|
|
46
|
+
throw new Error(`Give ${id} a key, like "Ctrl+T".`);
|
|
47
|
+
}
|
|
48
|
+
const owners = new Map();
|
|
49
|
+
for (const [id, keys] of Object.entries({ ...defaults, ...overrides })) {
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
if (owners.has(key))
|
|
52
|
+
throw new Error(`${key} is set for both ${owners.get(key)} and ${id}.`);
|
|
53
|
+
owners.set(key, id);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return overrides;
|
|
57
|
+
}
|
|
@@ -27,6 +27,10 @@ let helper = null;
|
|
|
27
27
|
const currentTurn = new AsyncLocalStorage();
|
|
28
28
|
const computerUsers = new Set();
|
|
29
29
|
function defaultHelperPath(env) {
|
|
30
|
+
if (process.platform === 'win32') {
|
|
31
|
+
const local = env.LOCALAPPDATA?.trim();
|
|
32
|
+
return local ? path.win32.join(local, 'thegitai', 'computer', 'helper.exe') : null;
|
|
33
|
+
}
|
|
30
34
|
const home = env.HOME?.trim();
|
|
31
35
|
const dataHome = env.XDG_DATA_HOME?.trim() || (home ? path.join(home, '.local', 'share') : '');
|
|
32
36
|
return dataHome ? path.join(dataHome, 'thegitai', 'computer', 'helper') : null;
|
|
@@ -116,6 +120,9 @@ function conversation() {
|
|
|
116
120
|
return scopedSessionId() ?? '';
|
|
117
121
|
}
|
|
118
122
|
function promptBody() {
|
|
123
|
+
if (process.platform === 'win32') {
|
|
124
|
+
return "It works on your screen: it moves your pointer and types until it's done. Press Esc anytime to take over.";
|
|
125
|
+
}
|
|
119
126
|
const background = process.platform === 'darwin'
|
|
120
127
|
? 'In the background, it works on a virtual display in your login session. Adding the display can briefly move your pointer before restoring it. Targeted input is experimental: some apps can take focus or ignore gestures. Hover requires control on your screen. You can move the same running window to your desktop afterward. '
|
|
121
128
|
: 'In the background, it works on a screen of its own with its own mouse and keyboard, so you keep yours. ';
|
|
@@ -131,16 +138,22 @@ async function askForDesktop(context, key) {
|
|
|
131
138
|
alwaysAsk: true,
|
|
132
139
|
title: 'TheGitAI wants to use apps on this computer',
|
|
133
140
|
body: promptBody(),
|
|
134
|
-
options:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
label: '
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
options: process.platform === 'win32'
|
|
142
|
+
? [
|
|
143
|
+
{ label: 'Allow on my screen', decision: { kind: 'computer', desktop: 'screen', session: false } },
|
|
144
|
+
{ label: 'Allow on my screen for this session', decision: { kind: 'computer', desktop: 'screen', session: true } },
|
|
145
|
+
{ label: 'Deny', decision: { kind: 'deny' } },
|
|
146
|
+
]
|
|
147
|
+
: [
|
|
148
|
+
{ label: 'Allow in the background', decision: { kind: 'computer', desktop: 'background', session: false } },
|
|
149
|
+
{ label: 'Allow on my screen', decision: { kind: 'computer', desktop: 'screen', session: false } },
|
|
150
|
+
{
|
|
151
|
+
label: 'Allow in the background for this session',
|
|
152
|
+
decision: { kind: 'computer', desktop: 'background', session: true },
|
|
153
|
+
},
|
|
154
|
+
{ label: 'Allow on my screen for this session', decision: { kind: 'computer', desktop: 'screen', session: true } },
|
|
155
|
+
{ label: 'Deny', decision: { kind: 'deny' } },
|
|
156
|
+
],
|
|
144
157
|
});
|
|
145
158
|
if (decision.kind !== 'computer') {
|
|
146
159
|
taskChoices.set(key, 'denied');
|
package/dist/src/ui/repl.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { keybindingsPath, prepareKeybindings, watchKeybindings } from '../keybindings-file.js';
|
|
1
2
|
import { sessionMcp } from '../mcp-client.js';
|
|
2
3
|
import { projectModelEffort, readProjectModelEfforts, saveProjectModelEffort } from '../project-model-preferences.js';
|
|
3
4
|
import { REASONING_EFFORT_LABELS } from '../reasoning-effort.js';
|
|
@@ -1205,6 +1206,7 @@ function createInitialShellState(session, serverModels, debugUi, serverUrl) {
|
|
|
1205
1206
|
jobsPickerOpen: false,
|
|
1206
1207
|
modelPickerIndex: getDefaultModelPickerIndex(session.modelId, serverModels.models),
|
|
1207
1208
|
modelPickerOpen: false,
|
|
1209
|
+
shortcuts: {},
|
|
1208
1210
|
shortcutsOpen: false,
|
|
1209
1211
|
skillsPickerIndex: 0,
|
|
1210
1212
|
skillsPickerItems: [],
|
|
@@ -2926,7 +2928,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2926
2928
|
}
|
|
2927
2929
|
appendTurnAwareEntry({
|
|
2928
2930
|
body: "Slash commands can't be queued while a turn is running. " +
|
|
2929
|
-
'
|
|
2931
|
+
'Use /jobs for background jobs or /notify to toggle notifications.',
|
|
2930
2932
|
kind: 'system',
|
|
2931
2933
|
title: 'Queued',
|
|
2932
2934
|
});
|
|
@@ -3025,9 +3027,20 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
3025
3027
|
await flushQueuedMessage();
|
|
3026
3028
|
return;
|
|
3027
3029
|
}
|
|
3030
|
+
if (input === '/keybindings') {
|
|
3031
|
+
const file = keybindingsPath(session.env);
|
|
3032
|
+
try {
|
|
3033
|
+
prepareKeybindings(file);
|
|
3034
|
+
appendStaticEntry({ kind: 'system', title: 'Keyboard shortcuts', body: `Edit ${file} in any editor. Saved changes apply right away.` });
|
|
3035
|
+
}
|
|
3036
|
+
catch (error) {
|
|
3037
|
+
appendStaticEntry({ kind: 'error', title: 'Keyboard shortcuts', body: error.message });
|
|
3038
|
+
}
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
3028
3041
|
if (input === '/help') {
|
|
3029
3042
|
appendStaticEntry({
|
|
3030
|
-
body: formatInteractiveHelpText(),
|
|
3043
|
+
body: formatInteractiveHelpText(store.getState().shortcuts),
|
|
3031
3044
|
kind: 'system',
|
|
3032
3045
|
title: 'Help',
|
|
3033
3046
|
});
|
|
@@ -3764,10 +3777,12 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
3764
3777
|
setCommandOutputHook((text) => {
|
|
3765
3778
|
store.update((current) => appendCommandLog(current, text));
|
|
3766
3779
|
});
|
|
3780
|
+
const stopWatchingKeys = watchKeybindings(keybindingsPath(session.env), (shortcuts) => store.update((current) => ({ ...current, shortcuts })), (body) => appendStaticEntry({ kind: 'error', title: 'Keyboard shortcuts', body }));
|
|
3767
3781
|
try {
|
|
3768
3782
|
await done;
|
|
3769
3783
|
}
|
|
3770
3784
|
finally {
|
|
3785
|
+
stopWatchingKeys();
|
|
3771
3786
|
clearInterval(spinnerTimer);
|
|
3772
3787
|
clearInterval(clockTimer);
|
|
3773
3788
|
unsubscribe();
|
|
@@ -13,8 +13,9 @@ export const SLASH_COMMANDS = [
|
|
|
13
13
|
{ command: '/jobs', description: 'Background jobs: pick to view output or kill' },
|
|
14
14
|
{
|
|
15
15
|
command: '/notify',
|
|
16
|
-
description: 'Toggle desktop notifications when a turn ends
|
|
16
|
+
description: 'Toggle desktop notifications when a turn ends',
|
|
17
17
|
},
|
|
18
|
+
{ command: '/keybindings', description: 'Change your keyboard shortcuts' },
|
|
18
19
|
{ command: '/report', description: 'Report a bug or request a feature privately on the TheGitAI website' },
|
|
19
20
|
{ command: '/about', description: 'Show version and platform info' },
|
|
20
21
|
{ command: '/logout', description: 'Sign out and quit' },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shortcutLabel } from '../../keyboard-shortcuts.js';
|
|
1
2
|
import { modelPickerWindow, modelPickerScrollLabel } from './model-picker-window.js';
|
|
2
3
|
import { fitModelLabel } from './model-label.js';
|
|
3
4
|
import { projectModelEffort } from '../../project-model-preferences.js';
|
|
@@ -48,7 +49,6 @@ export function footerNotificationHint(status) {
|
|
|
48
49
|
return FOOTER_NOTIFICATIONS_OFF;
|
|
49
50
|
return '';
|
|
50
51
|
}
|
|
51
|
-
const FOOTER_CYCLE_HINT = ' (shift+tab to cycle)';
|
|
52
52
|
const OVERLAY_PANEL_MAX_WIDTH = 86;
|
|
53
53
|
const USER_INPUT_PANEL_MAX_WIDTH = 120;
|
|
54
54
|
const OVERLAY_PANEL_MARGIN_LINES = 2;
|
|
@@ -489,7 +489,9 @@ function backgroundJobIndicatorSpans(state) {
|
|
|
489
489
|
if (runningCount === 0)
|
|
490
490
|
return [];
|
|
491
491
|
const noun = runningCount === 1 ? 'shell' : 'shells';
|
|
492
|
-
const hint = state.busy
|
|
492
|
+
const hint = state.busy
|
|
493
|
+
? ` · ${shortcutLabel('backgroundJobs', state.shortcuts).toLowerCase()}`
|
|
494
|
+
: ' · /jobs';
|
|
493
495
|
return [
|
|
494
496
|
span(' ', { color: 'gray', dim: true }),
|
|
495
497
|
span(`● ${runningCount} ${noun} running`, { color: 'green', bold: true }),
|
|
@@ -618,7 +620,9 @@ function composerFooterModeLines(state, contentWidth, modelLabel, usageWidth, us
|
|
|
618
620
|
const row = fitComposerFooterRow({
|
|
619
621
|
modeLabels,
|
|
620
622
|
modeLabelFallback: `Mode: ${agentModeShortLabel(state.agentMode)}`,
|
|
621
|
-
cycleHint: state.busy
|
|
623
|
+
cycleHint: state.busy
|
|
624
|
+
? ''
|
|
625
|
+
: ` (${shortcutLabel('cycleMode', state.shortcuts).toLowerCase()} to cycle)`,
|
|
622
626
|
rightHints: composerFooterRightHints(state),
|
|
623
627
|
leadWidth: combined ? displayWidth(modelLabel + effortText) + FOOTER_MODEL_SEPARATOR.length : 0,
|
|
624
628
|
tailWidth,
|
|
@@ -1481,7 +1485,7 @@ function buildOverlayLines(state, width, height, nowMs) {
|
|
|
1481
1485
|
return buildOverlayPanel(lines, width, OVERLAY_BORDER_COLOR, height);
|
|
1482
1486
|
}
|
|
1483
1487
|
if (state.shortcutsOpen) {
|
|
1484
|
-
lines.push(...buildShortcutsPanel(buildShortcutGroups(), width, height));
|
|
1488
|
+
lines.push(...buildShortcutsPanel(buildShortcutGroups(process.platform, state.shortcuts), width, height));
|
|
1485
1489
|
}
|
|
1486
1490
|
if (state.skillsPickerOpen) {
|
|
1487
1491
|
lines.push(...buildSkillsPickerPanel(state.skillsPickerItems ?? [], state.skillsPickerIndex ?? 0, width, height));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { matchesShortcut } from '../../keyboard-shortcuts.js';
|
|
1
2
|
import { projectModelEffort } from '../../project-model-preferences.js';
|
|
2
3
|
import { cycleReasoningEffort } from '../../reasoning-effort.js';
|
|
3
4
|
import { shortcutsPanelAvailable } from './shortcuts.js';
|
|
@@ -9,14 +10,6 @@ import { applySlashCommandSuggestion, buildModelPickerOptions, deleteAtCursor, d
|
|
|
9
10
|
import { buildPastePlaceholder, shouldCollapsePaste, } from '../paste-collapse.js';
|
|
10
11
|
import { handleUserInputPromptEvent, } from './user-input.js';
|
|
11
12
|
const APPROVAL_PREVIEW_PAGE_ROWS = 3;
|
|
12
|
-
function isClipboardImagePasteKey(key) {
|
|
13
|
-
if (process.platform === 'win32') {
|
|
14
|
-
return ((key.ctrl || key.meta) &&
|
|
15
|
-
key.input.toLowerCase() === 'v' &&
|
|
16
|
-
!key.shift);
|
|
17
|
-
}
|
|
18
|
-
return key.ctrl && key.input === 'v' && !key.shift && !key.meta;
|
|
19
|
-
}
|
|
20
13
|
export const APPROVAL_INPUT_GUARD_MS = 500;
|
|
21
14
|
function approvalIsGuarded(state) {
|
|
22
15
|
const openedAt = state.approvalOpenedAt;
|
|
@@ -369,7 +362,7 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
369
362
|
return;
|
|
370
363
|
}
|
|
371
364
|
if (state.jobsPickerOpen) {
|
|
372
|
-
if (key.escape || (
|
|
365
|
+
if (key.escape || matchesShortcut('backgroundJobs', key, state.shortcuts)) {
|
|
373
366
|
handlers.onLiveFrameShapeChange();
|
|
374
367
|
store.update((current) => ({
|
|
375
368
|
...current,
|
|
@@ -525,13 +518,13 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
525
518
|
}
|
|
526
519
|
return;
|
|
527
520
|
}
|
|
528
|
-
if (
|
|
521
|
+
if (matchesShortcut('backgroundJobs', key, state.shortcuts)) {
|
|
529
522
|
if ((state.backgroundJobs ?? []).length > 0) {
|
|
530
523
|
handlers.onOpenJobsPicker();
|
|
531
524
|
}
|
|
532
525
|
return;
|
|
533
526
|
}
|
|
534
|
-
if (
|
|
527
|
+
if (matchesShortcut('notifications', key, state.shortcuts)) {
|
|
535
528
|
handlers.onToggleNotifications?.();
|
|
536
529
|
return;
|
|
537
530
|
}
|
|
@@ -567,7 +560,7 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
567
560
|
});
|
|
568
561
|
return;
|
|
569
562
|
}
|
|
570
|
-
if (key
|
|
563
|
+
if (matchesShortcut('cycleMode', key, state.shortcuts)) {
|
|
571
564
|
if (state.busy) {
|
|
572
565
|
handlers.onAgentModeChangeBlocked?.();
|
|
573
566
|
return;
|
|
@@ -575,12 +568,15 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
575
568
|
handlers.onCycleAgentMode();
|
|
576
569
|
return;
|
|
577
570
|
}
|
|
571
|
+
if (key.tab && key.shift) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
578
574
|
if (state.busy && state.queuedMessage) {
|
|
579
575
|
if (key.returnKey) {
|
|
580
576
|
void handlers.onFireQueuedMessage?.();
|
|
581
577
|
return;
|
|
582
578
|
}
|
|
583
|
-
if (!key.upArrow && !
|
|
579
|
+
if (!key.upArrow && !matchesShortcut('pasteImage', key, state.shortcuts)) {
|
|
584
580
|
return;
|
|
585
581
|
}
|
|
586
582
|
}
|
|
@@ -717,7 +713,7 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
717
713
|
});
|
|
718
714
|
return;
|
|
719
715
|
}
|
|
720
|
-
if (
|
|
716
|
+
if (matchesShortcut('pasteImage', key, state.shortcuts)) {
|
|
721
717
|
const current = store.getState();
|
|
722
718
|
const target = current.queuedMessage
|
|
723
719
|
? {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { agentModeCycleSequence } from '../../agent-mode.js';
|
|
2
|
+
import { shortcutLabel } from '../../keyboard-shortcuts.js';
|
|
2
3
|
export function shortcutsPanelAvailable(state) {
|
|
3
4
|
return (!state.exiting &&
|
|
4
5
|
!state.approvalPrompt &&
|
|
@@ -10,8 +11,9 @@ export function shortcutsPanelAvailable(state) {
|
|
|
10
11
|
(state.pastedChunks?.length ?? 0) === 0 &&
|
|
11
12
|
state.promptHistoryCursor == null);
|
|
12
13
|
}
|
|
13
|
-
export function buildShortcutGroups(platform = process.platform) {
|
|
14
|
-
const
|
|
14
|
+
export function buildShortcutGroups(platform = process.platform, shortcuts = {}) {
|
|
15
|
+
const key = (id) => shortcutLabel(id, shortcuts, platform);
|
|
16
|
+
const imagePaste = key('pasteImage');
|
|
15
17
|
const textPaste = platform === 'darwin' ? 'Cmd+V' : 'Ctrl+Shift+V';
|
|
16
18
|
return [
|
|
17
19
|
{
|
|
@@ -19,14 +21,15 @@ export function buildShortcutGroups(platform = process.platform) {
|
|
|
19
21
|
rows: [
|
|
20
22
|
{ keys: 'Enter', description: 'Send your message' },
|
|
21
23
|
{
|
|
22
|
-
keys: '
|
|
24
|
+
keys: key('cycleMode'),
|
|
23
25
|
description: `Cycle ${agentModeCycleSequence()} (between turns)`,
|
|
24
26
|
},
|
|
25
27
|
{ keys: '/', description: 'Slash commands - /help lists them all' },
|
|
26
28
|
{ keys: '↑ / ↓', description: 'Earlier prompts' },
|
|
27
29
|
{ keys: 'Esc', description: 'Clear the composer' },
|
|
28
30
|
{ keys: 'Ctrl+C', description: 'Clear the composer, or quit when empty' },
|
|
29
|
-
{ keys: '
|
|
31
|
+
{ keys: key('notifications'), description: 'Desktop notifications - toggle on or off' },
|
|
32
|
+
{ keys: '/keybindings', description: 'Change these shortcuts' },
|
|
30
33
|
],
|
|
31
34
|
},
|
|
32
35
|
{
|
|
@@ -36,7 +39,7 @@ export function buildShortcutGroups(platform = process.platform) {
|
|
|
36
39
|
{ keys: '↑', description: 'Bring a queued message back to edit it' },
|
|
37
40
|
{ keys: 'Esc', description: 'Discard the queued message, or cancel the turn' },
|
|
38
41
|
{ keys: 'Ctrl+C', description: 'Cancel the turn' },
|
|
39
|
-
{ keys: '
|
|
42
|
+
{ keys: key('backgroundJobs'), description: 'Background jobs' },
|
|
40
43
|
],
|
|
41
44
|
},
|
|
42
45
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegitai/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "TheGitAI is an AI coding agent. It reads and searches your repository, writes and edits files, runs your tests, verifies the change before handing it back, and remembers your corrections between sessions.",
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "TheGitAI is an AI coding agent. It reads and searches your repository, writes and edits files, runs your tests, verifies the change before handing it back, uses the apps on your computer, and remembers your corrections between sessions. Customize its keyboard shortcuts in your editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentic-ai",
|
|
7
7
|
"ai-coding-agent",
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"ai-pair-programming",
|
|
13
13
|
"coding-assistant",
|
|
14
14
|
"ai-memory",
|
|
15
|
+
"keyboard-shortcuts",
|
|
16
|
+
"computer-use",
|
|
15
17
|
"code-assistant",
|
|
16
18
|
"ai",
|
|
17
19
|
"terminal",
|
|
@@ -46,11 +48,11 @@
|
|
|
46
48
|
"@lydell/node-pty-linux-x64": "1.1.0",
|
|
47
49
|
"@lydell/node-pty-win32-arm64": "1.1.0",
|
|
48
50
|
"@lydell/node-pty-win32-x64": "1.1.0",
|
|
49
|
-
"@thegitai/tui-darwin-arm64": "1.
|
|
50
|
-
"@thegitai/tui-darwin-x64": "1.
|
|
51
|
-
"@thegitai/tui-linux-arm64": "1.
|
|
52
|
-
"@thegitai/tui-linux-x64": "1.
|
|
53
|
-
"@thegitai/tui-win32-x64": "1.
|
|
51
|
+
"@thegitai/tui-darwin-arm64": "1.7.0",
|
|
52
|
+
"@thegitai/tui-darwin-x64": "1.7.0",
|
|
53
|
+
"@thegitai/tui-linux-arm64": "1.7.0",
|
|
54
|
+
"@thegitai/tui-linux-x64": "1.7.0",
|
|
55
|
+
"@thegitai/tui-win32-x64": "1.7.0",
|
|
54
56
|
"@vscode/ripgrep": "1.18.0"
|
|
55
57
|
},
|
|
56
58
|
"repository": {
|