@knightcodeai/cli-linux-arm64 0.9.1 → 0.9.3
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/bin/CHANGELOG.md +60 -0
- package/bin/README.md +52 -19
- package/bin/docs/cli-integration.md +106 -0
- package/bin/docs/cli.md +270 -0
- package/bin/docs/compaction.md +56 -37
- package/bin/docs/configuration.md +46 -0
- package/bin/docs/containerization.md +86 -54
- package/bin/docs/custom-provider.md +132 -785
- package/bin/docs/docs.json +143 -103
- package/bin/docs/environment-variables.md +5 -4
- package/bin/docs/extensions.md +134 -2956
- package/bin/docs/how-knightcode-works.md +49 -0
- package/bin/docs/index.md +24 -69
- package/bin/docs/json.md +193 -65
- package/bin/docs/keybindings.md +56 -101
- package/bin/docs/llama-cpp.md +3 -3
- package/bin/docs/message-types.md +261 -0
- package/bin/docs/models.md +64 -547
- package/bin/docs/packages.md +66 -167
- package/bin/docs/prompt-templates.md +31 -68
- package/bin/docs/providers.md +103 -241
- package/bin/docs/quickstart.md +61 -106
- package/bin/docs/rpc-commands.md +854 -0
- package/bin/docs/rpc-extension-ui.md +200 -0
- package/bin/docs/rpc.md +129 -1556
- package/bin/docs/sdk.md +76 -1160
- package/bin/docs/security.md +70 -32
- package/bin/docs/session-format.md +25 -216
- package/bin/docs/sessions.md +38 -143
- package/bin/docs/settings.md +111 -389
- package/bin/docs/shell-aliases.md +85 -5
- package/bin/docs/skills.md +51 -189
- package/bin/docs/slash-commands.md +63 -0
- package/bin/docs/terminal-setup.md +107 -79
- package/bin/docs/termux.md +74 -83
- package/bin/docs/themes.md +68 -280
- package/bin/docs/tmux.md +31 -39
- package/bin/docs/tui.md +69 -923
- package/bin/docs/usage.md +79 -286
- package/bin/docs/windows.md +43 -17
- package/bin/export-html/template.js +6 -1
- package/bin/knightcode +2 -2
- package/bin/package.json +6 -6
- package/package.json +1 -1
- package/bin/docs/development.md +0 -71
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Configure your terminal
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Most modern terminals work with KnightCode without additional setup. Use this page when modified keys, scrolling, links, images, colors, or input-method editor (IME) positioning do not behave as expected.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
KnightCode uses extended-key protocols so terminals can distinguish combinations such as `Shift+Enter` and `Alt+Enter` from plain `Enter`. Terminal proxies, multiplexers, and built-in IDE terminals can change or discard that information.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Troubleshooting
|
|
8
8
|
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
9
|
+
| Symptom | Start here |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `Shift+Enter` submits instead of inserting a line | Your terminal's section below; for tmux, see [Run KnightCode in tmux](tmux.md) |
|
|
12
|
+
| `Alt+Enter` does not queue a follow-up | [WezTerm](#wezterm), [Alacritty](#alacritty), or [Windows Terminal](#windows-terminal) |
|
|
13
|
+
| Fullscreen scrolling is unusually slow | [iTerm2](#iterm2) |
|
|
14
|
+
| Dragging does not copy text, or copies it unexpectedly | [Text Selection and Copy](#text-selection-and-copy) |
|
|
15
|
+
| Links work but show no hover preview | [Ghostty](#ghostty) |
|
|
16
|
+
| Inline images or colors are not detected | [Override detected capabilities](#override-detected-capabilities) |
|
|
17
|
+
| An IME candidate window appears in the wrong place | [WezTerm](#wezterm) or [IntelliJ IDEA](#intellij-idea-integrated-terminal) |
|
|
18
|
+
| Modified keys fail only inside tmux | [Run KnightCode in tmux](tmux.md) |
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
Use `/hotkeys` to inspect KnightCode's active shortcuts. See [Keybindings](keybindings.md) to change them.
|
|
16
21
|
|
|
17
22
|
## Text Selection and Copy
|
|
18
23
|
|
|
19
|
-
Which side owns a mouse drag depends on the [TUI mode](usage.md#
|
|
24
|
+
Which side owns a mouse drag depends on the [TUI mode](usage.md#adjust-the-terminal).
|
|
20
25
|
|
|
21
26
|
In `fullscreen` mode, knightcode enables mouse reporting and owns text selection itself. Dragging with the primary button selects, and the selection is copied to the clipboard on release. Set `fullscreenCopyOnSelect` to `false` to keep the selection highlighted and copy it with `Ctrl+X` instead. To reach the terminal's own selection while knightcode captures the mouse, hold the terminal's bypass modifier — usually `Shift`, `Option` in iTerm2, and `Shift+Command`/`Shift+Ctrl` in Ghostty.
|
|
22
27
|
|
|
@@ -24,58 +29,55 @@ In `regular` mode, knightcode never enables mouse reporting, so a drag is the te
|
|
|
24
29
|
|
|
25
30
|
## Kitty
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
Kitty supports the required keyboard protocol without additional configuration.
|
|
28
33
|
|
|
29
34
|
## iTerm2
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Works out of the box.
|
|
36
|
+
Regular terminal mode works without additional configuration.
|
|
34
37
|
|
|
35
|
-
###
|
|
38
|
+
### Fix slow fullscreen scrolling
|
|
36
39
|
|
|
37
|
-
KnightCode owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling
|
|
40
|
+
In fullscreen mode, KnightCode owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling native terminal history. Fast trackpad gestures can then move only about one line at a time.
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
To change this behavior:
|
|
40
43
|
|
|
41
|
-
1. Open **iTerm2
|
|
42
|
-
2. Search for **Trackpad scrolls fast
|
|
44
|
+
1. Open **iTerm2 > Settings > Advanced**.
|
|
45
|
+
2. Search for **Trackpad scrolls fast?**.
|
|
46
|
+
3. Set it to **No**.
|
|
43
47
|
|
|
44
|
-
This is an iTerm2-wide
|
|
48
|
+
This is an iTerm2-wide setting and can also change native trackpad scrolling. The underlying behavior is tracked in [iTerm2 issue 9619](https://gitlab.com/gnachman/iterm2/-/work_items/9619).
|
|
45
49
|
|
|
46
50
|
## Apple Terminal
|
|
47
51
|
|
|
48
|
-
KnightCode enables enhanced key reporting when available. If Terminal.app still sends plain Return for `Shift+Enter`,
|
|
52
|
+
KnightCode enables enhanced key reporting when available. If Terminal.app still sends plain Return for `Shift+Enter`, KnightCode uses a local macOS modifier fallback and treats it as `Shift+Enter`.
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
The fallback works only when KnightCode runs on the same Mac as Terminal.app. It cannot inspect the local modifier state when KnightCode runs on another machine over SSH.
|
|
51
55
|
|
|
52
56
|
## Ghostty
|
|
53
57
|
|
|
54
|
-
Add to
|
|
58
|
+
Add this mapping to Ghostty's configuration if `Alt+Backspace` does not work:
|
|
55
59
|
|
|
56
|
-
```
|
|
60
|
+
```text
|
|
57
61
|
keybind = alt+backspace=text:\x1b\x7f
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
The configuration file is `~/Library/Application Support/com.mitchellh.ghostty/config` on macOS and `~/.config/ghostty/config` on Linux.
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
Older Claude Code configurations may contain:
|
|
67
|
+
|
|
68
|
+
```text
|
|
63
69
|
keybind = shift+enter=text:\n
|
|
64
70
|
```
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
If Claude Code 2.x or newer is the only reason you added that mapping, you can remove it, unless you want to use Claude Code in tmux, where it still requires that Ghostty mapping.
|
|
69
|
-
|
|
70
|
-
KnightCode binds `Ctrl+J` as a default newline alias, so `Shift+Enter` keeps working in tmux via that remap without extra knightcode configuration.
|
|
72
|
+
This sends a raw linefeed, which KnightCode cannot distinguish from `Ctrl+J`. Remove the mapping if an older Claude Code installation is the only reason you added it. KnightCode already binds `Ctrl+J` as a newline alternative, so the mapping may appear to work while still preventing KnightCode and tmux from receiving a real `Shift+Enter` event.
|
|
71
73
|
|
|
72
|
-
###
|
|
74
|
+
### Open links in fullscreen mode
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
Links remain clickable in fullscreen mode, but Ghostty does not show its normal hover underline or URL preview while KnightCode captures mouse input. Hold `Shift+Command` on macOS or `Shift+Ctrl` on Linux to use Ghostty's native link handling.
|
|
75
77
|
|
|
76
78
|
## WezTerm
|
|
77
79
|
|
|
78
|
-
WezTerm
|
|
80
|
+
WezTerm normally reports `Shift+Enter` through xterm extended keys. To enable the Kitty keyboard protocol explicitly, create `~/.wezterm.lua`:
|
|
79
81
|
|
|
80
82
|
```lua
|
|
81
83
|
local wezterm = require 'wezterm'
|
|
@@ -84,7 +86,19 @@ config.enable_kitty_keyboard = true
|
|
|
84
86
|
return config
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
### Forward Alt+Enter on macOS
|
|
90
|
+
|
|
91
|
+
WezTerm binds `Option+Enter` to fullscreen by default on macOS. To use it for KnightCode's follow-up queue, add this entry to your `config.keys` table:
|
|
92
|
+
|
|
93
|
+
```lua
|
|
94
|
+
{
|
|
95
|
+
key = 'Enter',
|
|
96
|
+
mods = 'ALT',
|
|
97
|
+
action = wezterm.action.SendString('\x1b[13;3u'),
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A complete minimal configuration is:
|
|
88
102
|
|
|
89
103
|
```lua
|
|
90
104
|
local wezterm = require 'wezterm'
|
|
@@ -99,13 +113,20 @@ config.keys = {
|
|
|
99
113
|
return config
|
|
100
114
|
```
|
|
101
115
|
|
|
102
|
-
|
|
116
|
+
### Position an IME candidate window in WSL
|
|
103
117
|
|
|
104
|
-
|
|
118
|
+
If CJK IME candidates do not follow KnightCode's text cursor in WSL, show the hardware cursor:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
export KNIGHTCODE_HARDWARE_CURSOR=1
|
|
122
|
+
knightcode
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can instead set `showHardwareCursor` to `true` in KnightCode settings.
|
|
105
126
|
|
|
106
127
|
## Alacritty
|
|
107
128
|
|
|
108
|
-
Alacritty
|
|
129
|
+
Alacritty normally reports `Shift+Enter`. On macOS, `Option+Enter` can arrive as plain `Enter`. Add this to `~/.config/alacritty/alacritty.toml` to forward it to KnightCode:
|
|
109
130
|
|
|
110
131
|
```toml
|
|
111
132
|
[[keyboard.bindings]]
|
|
@@ -114,20 +135,13 @@ mods = "Alt"
|
|
|
114
135
|
chars = "\u001b[13;3u"
|
|
115
136
|
```
|
|
116
137
|
|
|
117
|
-
Restart Alacritty after changing the
|
|
118
|
-
|
|
119
|
-
## VS Code (Integrated Terminal)
|
|
138
|
+
Restart Alacritty after changing the file.
|
|
120
139
|
|
|
121
|
-
VS Code
|
|
140
|
+
## VS Code integrated terminal
|
|
122
141
|
|
|
123
|
-
VS Code
|
|
142
|
+
VS Code 1.109.5 and newer enable the Kitty keyboard protocol in the integrated terminal by default.
|
|
124
143
|
|
|
125
|
-
`keybindings.json
|
|
126
|
-
- macOS: `~/Library/Application Support/Code/User/keybindings.json`
|
|
127
|
-
- Linux: `~/.config/Code/User/keybindings.json`
|
|
128
|
-
- Windows: `%APPDATA%\\Code\\User\\keybindings.json`
|
|
129
|
-
|
|
130
|
-
Add to `keybindings.json`:
|
|
144
|
+
For an older version, add a `Shift+Enter` terminal binding to `keybindings.json`:
|
|
131
145
|
|
|
132
146
|
```json
|
|
133
147
|
{
|
|
@@ -138,9 +152,15 @@ Add to `keybindings.json`:
|
|
|
138
152
|
}
|
|
139
153
|
```
|
|
140
154
|
|
|
141
|
-
|
|
155
|
+
The user `keybindings.json` file is normally located at:
|
|
156
|
+
|
|
157
|
+
- macOS: `~/Library/Application Support/Code/User/keybindings.json`
|
|
158
|
+
- Linux: `~/.config/Code/User/keybindings.json`
|
|
159
|
+
- Windows: `%APPDATA%\\Code\\User\\keybindings.json`
|
|
142
160
|
|
|
143
|
-
|
|
161
|
+
## Zed integrated terminal
|
|
162
|
+
|
|
163
|
+
Add these bindings to Zed's `keymap.json`:
|
|
144
164
|
|
|
145
165
|
```json
|
|
146
166
|
{
|
|
@@ -155,46 +175,54 @@ Add these key bindings to your Zed `keymap.json`:
|
|
|
155
175
|
|
|
156
176
|
## Windows Terminal
|
|
157
177
|
|
|
158
|
-
|
|
178
|
+
Windows Terminal uses KnightCode's Windows and WSL shortcut defaults. See [Keybindings](keybindings.md) for the complete list.
|
|
159
179
|
|
|
160
|
-
|
|
161
|
-
- `Ctrl+F` searches the transcript in fullscreen mode, and `Ctrl+Up`/`Ctrl+Down` jump between marked messages.
|
|
162
|
-
- `Alt+P` cycles to the previous model.
|
|
163
|
-
- `Ctrl+Z` undoes editing on native Windows; WSL uses `Alt+Z` so `Ctrl+Z` can suspend knightcode.
|
|
164
|
-
- `Ctrl+Q` queues a follow-up message and `Alt+Q` restores queued messages.
|
|
180
|
+
### Forward Shift+Enter
|
|
165
181
|
|
|
166
|
-
|
|
182
|
+
Open Windows Terminal's `settings.json` with `Ctrl+Shift+,` or **Settings > Open JSON file**. Add this object to its `actions` array:
|
|
167
183
|
|
|
168
184
|
```json
|
|
169
185
|
{
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
"command": { "action": "sendInput", "input": "\u001b[13;2u" },
|
|
173
|
-
"keys": "shift+enter"
|
|
174
|
-
}
|
|
175
|
-
]
|
|
186
|
+
"command": { "action": "sendInput", "input": "\u001b[13;2u" },
|
|
187
|
+
"keys": "shift+enter"
|
|
176
188
|
}
|
|
177
189
|
```
|
|
178
190
|
|
|
179
|
-
|
|
191
|
+
Fully close and reopen Windows Terminal, then verify that `Shift+Enter` inserts a new line in KnightCode.
|
|
192
|
+
|
|
193
|
+
### Use Alt+Enter for follow-ups
|
|
180
194
|
|
|
181
|
-
|
|
195
|
+
Windows Terminal binds `Alt+Enter` to fullscreen by default. KnightCode therefore uses `Ctrl+Q` for follow-ups on Windows and WSL.
|
|
182
196
|
|
|
183
|
-
|
|
197
|
+
To use `Alt+Enter` instead, configure Windows Terminal to forward the key and bind `app.message.followUp` to `alt+enter` in KnightCode's `keybindings.json`. See [Keybindings](keybindings.md#assign-keybindings).
|
|
184
198
|
|
|
185
|
-
|
|
199
|
+
## xfce4-terminal and Terminator
|
|
186
200
|
|
|
187
|
-
|
|
188
|
-
- [Kitty](https://sw.kovidgoyal.net/kitty/)
|
|
189
|
-
- [Ghostty](https://ghostty.org/)
|
|
190
|
-
- [WezTerm](https://wezfurlong.org/wezterm/)
|
|
191
|
-
- [iTerm2](https://iterm2.com/)
|
|
192
|
-
- [Alacritty](https://github.com/alacritty/alacritty) (requires compilation with Kitty protocol support)
|
|
201
|
+
These terminals cannot reliably distinguish modified Enter keys from plain `Enter`. Custom bindings such as `Ctrl+Enter` or `Shift+Enter` therefore may not work.
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
Use a terminal with modern extended-key support when you need those shortcuts, such as Kitty, Ghostty, WezTerm, iTerm2, Windows Terminal, or a compatible Alacritty build.
|
|
195
204
|
|
|
196
|
-
|
|
205
|
+
## IntelliJ IDEA integrated terminal
|
|
206
|
+
|
|
207
|
+
IntelliJ IDEA's built-in terminal cannot reliably distinguish `Shift+Enter` from plain `Enter`. Use `Ctrl+J` for a newline or run KnightCode in a terminal with modern extended-key support.
|
|
208
|
+
|
|
209
|
+
If an IME candidate window does not follow the text cursor, show the hardware cursor:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
export KNIGHTCODE_HARDWARE_CURSOR=1
|
|
213
|
+
knightcode
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Override detected capabilities
|
|
217
|
+
|
|
218
|
+
KnightCode automatically detects OSC 8 hyperlinks, inline image protocols, and truecolor support. A terminal proxy or multiplexer can make that detection inaccurate.
|
|
219
|
+
|
|
220
|
+
| Capability | Environment variable | Setting |
|
|
221
|
+
|---|---|---|
|
|
222
|
+
| Hyperlinks | `KNIGHTCODE_HYPERLINKS=1\|0\|auto` | `terminal.hyperlinks: true\|false\|"auto"` |
|
|
223
|
+
| Inline images | `KNIGHTCODE_IMAGE_PROTOCOL=kitty\|iterm2\|none\|auto` | `terminal.images: "kitty"\|"iterm2"\|false\|"auto"` |
|
|
224
|
+
| Truecolor | `KNIGHTCODE_TRUE_COLOR=1\|0\|auto` | `terminal.trueColor: true\|false\|"auto"` |
|
|
197
225
|
|
|
198
|
-
|
|
226
|
+
Settings take precedence over environment variables. An unset value or `auto` preserves automatic detection.
|
|
199
227
|
|
|
200
|
-
|
|
228
|
+
Only force a capability supported by the complete terminal path. Unsupported escape sequences can corrupt rendering. See [Environment Variables](environment-variables.md#knightcode-process-configuration) and [Settings](settings.md) for the canonical value definitions.
|
package/bin/docs/termux.md
CHANGED
|
@@ -1,126 +1,117 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Run KnightCode on Android with Termux
|
|
2
2
|
|
|
3
|
-
KnightCode runs on Android
|
|
3
|
+
KnightCode runs on Android through [Termux](https://termux.dev/), a terminal emulator and Linux environment. Text input, file tools, and shell commands are supported. KnightCode can copy and paste text through the Android clipboard with Termux:API. Clipboard image paste is not supported.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Before you begin
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
2. Install [Termux:API](https://github.com/termux/termux-api#installation) from GitHub or F-Droid for clipboard and other device integrations
|
|
7
|
+
Install Termux from [GitHub or F-Droid](https://github.com/termux/termux-app#installation). Do not use the deprecated Google Play build.
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
[Termux:API](https://github.com/termux/termux-api#installation) is optional. Install it only when you want KnightCode to copy or paste Android clipboard text, or when shell commands need Android device APIs.
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
# Update packages
|
|
14
|
-
pkg update && pkg upgrade
|
|
11
|
+
## Install KnightCode
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
pkg install nodejs termux-api git
|
|
13
|
+
1. Update Termux packages:
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
```bash
|
|
16
|
+
pkg update && pkg upgrade
|
|
17
|
+
```
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
mkdir -p ~/.knightcode/agent
|
|
19
|
+
2. Install Node.js and Git:
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```
|
|
21
|
+
```bash
|
|
22
|
+
pkg install nodejs git
|
|
23
|
+
```
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
3. Install KnightCode:
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g --ignore-scripts @knightcodeai/cli
|
|
29
|
+
```
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
4. Verify the installation:
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
```bash
|
|
34
|
+
knightcode --version
|
|
35
|
+
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
5. Open the folder you want to work in and start KnightCode:
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
```bash
|
|
40
|
+
cd /path/to/working-folder
|
|
41
|
+
knightcode
|
|
42
|
+
```
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
- **OS**: Android (Termux terminal emulator)
|
|
44
|
-
- **Home**: `/data/data/com.termux/files/home`
|
|
45
|
-
- **Prefix**: `/data/data/com.termux/files/usr`
|
|
46
|
-
- **Shared storage**: `/storage/emulated/0` (Downloads, Documents, etc.)
|
|
44
|
+
Continue with the main [Quickstart](quickstart.md#3-choose-a-model) to connect a model and run your first task.
|
|
47
45
|
|
|
48
|
-
##
|
|
49
|
-
```bash
|
|
50
|
-
termux-open-url "https://example.com"
|
|
51
|
-
```
|
|
46
|
+
## Access Android shared storage
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
termux-open file.pdf # Opens with default app
|
|
56
|
-
termux-open --chooser image.jpg # Choose app
|
|
57
|
-
```
|
|
48
|
+
Termux cannot access shared Android storage until you grant permission. Run this once:
|
|
58
49
|
|
|
59
|
-
## Clipboard
|
|
60
50
|
```bash
|
|
61
|
-
termux-
|
|
62
|
-
termux-clipboard-get # Paste
|
|
51
|
+
termux-setup-storage
|
|
63
52
|
```
|
|
64
53
|
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
termux-notification -t "Title" -c "Content"
|
|
68
|
-
```
|
|
54
|
+
After approval, Android shared storage is available under `/storage/emulated/0` and through the links Termux creates under `~/storage/`.
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
termux-
|
|
75
|
-
```
|
|
56
|
+
Only grant this permission when KnightCode should be able to access those files. Commands and tools running in Termux use the same storage permissions as the Termux process.
|
|
57
|
+
|
|
58
|
+
## Use clipboard commands
|
|
59
|
+
|
|
60
|
+
KnightCode uses `termux-clipboard-set` to copy text and `termux-clipboard-get` for its clipboard-paste shortcut. Shell commands can use both commands directly. Install the Termux:API app and its command-line package:
|
|
76
61
|
|
|
77
|
-
## Sharing
|
|
78
62
|
```bash
|
|
79
|
-
termux-
|
|
63
|
+
pkg install termux-api
|
|
80
64
|
```
|
|
81
65
|
|
|
82
|
-
|
|
66
|
+
Verify the integration:
|
|
67
|
+
|
|
83
68
|
```bash
|
|
84
|
-
|
|
85
|
-
termux-
|
|
86
|
-
termux-tts-speak "hello" # Text to speech
|
|
87
|
-
termux-camera-photo out.jpg # Take photo
|
|
69
|
+
printf 'KnightCode clipboard test' | termux-clipboard-set
|
|
70
|
+
termux-clipboard-get
|
|
88
71
|
```
|
|
89
72
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
73
|
+
The second command should print `KnightCode clipboard test`.
|
|
74
|
+
|
|
75
|
+
The Termux clipboard API supports text only. KnightCode's clipboard-paste shortcut inserts that text into the editor but cannot attach clipboard images.
|
|
76
|
+
|
|
77
|
+
## Add Termux-specific instructions
|
|
78
|
+
|
|
79
|
+
KnightCode detects that it is running in Termux, but it cannot infer how you want it to interact with Android. Add only the environment details relevant to your work to `~/.knightcode/agent/AGENTS.md`:
|
|
95
80
|
|
|
96
|
-
|
|
81
|
+
````markdown
|
|
82
|
+
# Termux environment
|
|
83
|
+
|
|
84
|
+
- KnightCode runs in Termux on Android.
|
|
85
|
+
- Shared Android storage is under `/storage/emulated/0`.
|
|
86
|
+
- Open URLs with `termux-open-url "https://example.com"`.
|
|
87
|
+
- Open files with `termux-open <path>`.
|
|
88
|
+
- Do not access shared storage unless the task requires it.
|
|
89
|
+
````
|
|
97
90
|
|
|
98
|
-
|
|
99
|
-
- **Storage access**: To access files in `/storage/emulated/0` (Downloads, etc.), run `termux-setup-storage` once to grant permissions
|
|
91
|
+
Run `/reload` after changing the file during an active session.
|
|
100
92
|
|
|
101
93
|
## Troubleshooting
|
|
102
94
|
|
|
103
|
-
### Clipboard
|
|
95
|
+
### Clipboard integration fails
|
|
104
96
|
|
|
105
|
-
|
|
106
|
-
1. Termux (from GitHub or F-Droid)
|
|
107
|
-
2. Termux:API (from GitHub or F-Droid)
|
|
97
|
+
Confirm that you installed both components:
|
|
108
98
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
pkg install termux-api
|
|
112
|
-
```
|
|
99
|
+
1. The Termux:API Android app from the same source as Termux
|
|
100
|
+
2. The `termux-api` command-line package
|
|
113
101
|
|
|
114
|
-
|
|
102
|
+
Then run the clipboard verification commands above outside KnightCode. If they fail there, fix the Termux:API installation before retrying KnightCode's copy command.
|
|
115
103
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
termux-setup-storage
|
|
119
|
-
```
|
|
104
|
+
### Shared storage reports permission denied
|
|
105
|
+
|
|
106
|
+
Run `termux-setup-storage`, approve the Android permission request, and retry the path under `~/storage/` or `/storage/emulated/0`.
|
|
120
107
|
|
|
121
|
-
###
|
|
108
|
+
### KnightCode is not found after installation
|
|
109
|
+
|
|
110
|
+
Open a new Termux shell and run:
|
|
122
111
|
|
|
123
|
-
If npm fails, try clearing the cache:
|
|
124
112
|
```bash
|
|
125
|
-
npm
|
|
113
|
+
npm prefix -g
|
|
114
|
+
command -v knightcode
|
|
126
115
|
```
|
|
116
|
+
|
|
117
|
+
Confirm that the global npm binary directory is on `PATH`, then reinstall KnightCode if the package is missing.
|