@knightcodeai/cli-linux-x64 0.9.0 → 0.9.2
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 +88 -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 -782
- package/bin/docs/docs.json +143 -103
- package/bin/docs/environment-variables.md +5 -3
- package/bin/docs/extensions.md +134 -2937
- 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 +65 -517
- package/bin/docs/packages.md +66 -167
- package/bin/docs/prompt-templates.md +31 -68
- package/bin/docs/providers.md +103 -233
- 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 +39 -216
- package/bin/docs/sessions.md +43 -121
- package/bin/docs/settings.md +112 -367
- 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 -285
- 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
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.
|
package/bin/docs/themes.md
CHANGED
|
@@ -1,322 +1,110 @@
|
|
|
1
|
-
|
|
1
|
+
# Customize KnightCode with themes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Themes control the colors KnightCode uses in interactive mode and HTML exports. KnightCode includes `dark` and `light` themes. You can select one theme, follow your terminal's light or dark appearance, or create your own palette.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<a id="selecting-a-theme"></a>
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Choose a theme
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- [Selecting a Theme](#selecting-a-theme)
|
|
11
|
-
- [Creating a Custom Theme](#creating-a-custom-theme)
|
|
12
|
-
- [Theme Format](#theme-format)
|
|
13
|
-
- [Color Tokens](#color-tokens)
|
|
14
|
-
- [Color Values](#color-values)
|
|
15
|
-
- [Tips](#tips)
|
|
9
|
+
Open `/settings` and select **Theme**. You can use one theme for every terminal appearance or choose separate themes for light and dark terminals.
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
The selection is saved as the `theme` [setting](settings.md#terminal-and-display):
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Packages: `themes/` directories or `knightcode.themes` entries in `package.json`
|
|
25
|
-
- Settings: `themes` array with files or directories
|
|
26
|
-
- CLI: `--theme <path>` (repeatable)
|
|
27
|
-
|
|
28
|
-
Disable discovery with `--no-themes`.
|
|
29
|
-
|
|
30
|
-
## Selecting a Theme
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"theme": "dark"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
31
18
|
|
|
32
|
-
|
|
19
|
+
Automatic mode stores the light theme first and the dark theme second:
|
|
33
20
|
|
|
34
21
|
```json
|
|
35
22
|
{
|
|
36
|
-
"theme": "
|
|
23
|
+
"theme": "light/dark"
|
|
37
24
|
}
|
|
38
25
|
```
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
When automatic mode is active, KnightCode changes themes when the terminal reports an appearance change. Theme names cannot contain `/` because KnightCode reserves it for this setting format.
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Start an interactive run with a theme without changing the saved setting:
|
|
29
|
+
Use `--use-theme` to choose the initial theme for one invocation without changing the saved setting:
|
|
45
30
|
|
|
46
31
|
```bash
|
|
47
32
|
knightcode --use-theme light
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
To follow terminal appearance, use `lightTheme/darkTheme` syntax:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
33
|
knightcode --use-theme light/dark
|
|
54
34
|
```
|
|
55
35
|
|
|
56
|
-
|
|
57
|
-
and saves it normally.
|
|
58
|
-
|
|
59
|
-
## Creating a Custom Theme
|
|
60
|
-
|
|
61
|
-
1. Create a theme file:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
mkdir -p ~/.knightcode/agent/themes
|
|
65
|
-
vim ~/.knightcode/agent/themes/my-theme.json
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
2. Define the theme with all required colors (see [Color Tokens](#color-tokens)):
|
|
36
|
+
See [CLI resources](cli.md#resources) for the command-line option.
|
|
69
37
|
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
"$schema": "https://raw.githubusercontent.com/KnightCodeAI/knightcode/main/packages/cli/src/modes/interactive/theme/theme-schema.json",
|
|
73
|
-
"name": "my-theme",
|
|
74
|
-
"vars": {
|
|
75
|
-
"primary": "#00aaff",
|
|
76
|
-
"secondary": 242
|
|
77
|
-
},
|
|
78
|
-
"colors": {
|
|
79
|
-
"accent": "primary",
|
|
80
|
-
"border": "primary",
|
|
81
|
-
"borderAccent": "#00ffff",
|
|
82
|
-
"borderMuted": "secondary",
|
|
83
|
-
"success": "#00ff00",
|
|
84
|
-
"error": "#ff0000",
|
|
85
|
-
"warning": "#ffff00",
|
|
86
|
-
"muted": "secondary",
|
|
87
|
-
"dim": 240,
|
|
88
|
-
"text": "",
|
|
89
|
-
"thinkingText": "secondary",
|
|
90
|
-
"selectedBg": "#2d2d30",
|
|
91
|
-
"scrollbarTrack": "secondary",
|
|
92
|
-
"scrollbarThumb": "",
|
|
93
|
-
"searchMatchBg": "#2d2d30",
|
|
94
|
-
"searchMatchText": "",
|
|
95
|
-
"userMessageBg": "#2d2d30",
|
|
96
|
-
"userMessageText": "",
|
|
97
|
-
"customMessageBg": "#2d2d30",
|
|
98
|
-
"customMessageText": "",
|
|
99
|
-
"customMessageLabel": "primary",
|
|
100
|
-
"toolPendingBg": "#1e1e2e",
|
|
101
|
-
"toolSuccessBg": "#1e2e1e",
|
|
102
|
-
"toolErrorBg": "#2e1e1e",
|
|
103
|
-
"toolTitle": "primary",
|
|
104
|
-
"toolOutput": "",
|
|
105
|
-
"mdHeading": "#ffaa00",
|
|
106
|
-
"mdLink": "primary",
|
|
107
|
-
"mdLinkUrl": "secondary",
|
|
108
|
-
"mdCode": "#00ffff",
|
|
109
|
-
"mdCodeBlock": "",
|
|
110
|
-
"mdCodeBlockBorder": "secondary",
|
|
111
|
-
"mdQuote": "secondary",
|
|
112
|
-
"mdQuoteBorder": "secondary",
|
|
113
|
-
"mdHr": "secondary",
|
|
114
|
-
"mdListBullet": "#00ffff",
|
|
115
|
-
"toolDiffAdded": "#00ff00",
|
|
116
|
-
"toolDiffRemoved": "#ff0000",
|
|
117
|
-
"toolDiffContext": "secondary",
|
|
118
|
-
"syntaxComment": "secondary",
|
|
119
|
-
"syntaxKeyword": "primary",
|
|
120
|
-
"syntaxFunction": "#00aaff",
|
|
121
|
-
"syntaxVariable": "#ffaa00",
|
|
122
|
-
"syntaxString": "#00ff00",
|
|
123
|
-
"syntaxNumber": "#ff00ff",
|
|
124
|
-
"syntaxType": "#00aaff",
|
|
125
|
-
"syntaxOperator": "primary",
|
|
126
|
-
"syntaxPunctuation": "secondary",
|
|
127
|
-
"thinkingOff": "secondary",
|
|
128
|
-
"thinkingMinimal": "primary",
|
|
129
|
-
"thinkingLow": "#00aaff",
|
|
130
|
-
"thinkingMedium": "#00ffff",
|
|
131
|
-
"thinkingHigh": "#ff00ff",
|
|
132
|
-
"thinkingXhigh": "#ff0000",
|
|
133
|
-
"thinkingMax": "#ff0088",
|
|
134
|
-
"bashMode": "#ffaa00"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
38
|
+
## Create a custom theme
|
|
138
39
|
|
|
139
|
-
|
|
40
|
+
Copy one of the [built-in themes](https://github.com/KnightCodeAI/knightcode/tree/main/packages/cli/src/modes/interactive/theme) or create a new JSON file conforming to the [schema](https://github.com/KnightCodeAI/knightcode/blob/main/packages/cli/src/modes/interactive/theme/theme-schema.json).
|
|
140
41
|
|
|
141
|
-
|
|
42
|
+
1. Save the file as `<agent-dir>/themes/my-theme.json`. The agent directory defaults to `~/.knightcode/agent`.
|
|
43
|
+
2. Set its `name` to `my-theme`.
|
|
44
|
+
3. Change values in `vars` and `colors`.
|
|
45
|
+
4. Select `my-theme` through `/settings`.
|
|
142
46
|
|
|
143
|
-
|
|
47
|
+
Use the theme name as the filename. KnightCode hot-reloads the active user theme only from `<agent-dir>/themes/<name>.json`. Run `/reload` after adding or changing a theme from any other source.
|
|
144
48
|
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
"$schema": "https://raw.githubusercontent.com/KnightCodeAI/knightcode/main/packages/cli/src/modes/interactive/theme/theme-schema.json",
|
|
148
|
-
"name": "my-theme",
|
|
149
|
-
"vars": {
|
|
150
|
-
"blue": "#0066cc",
|
|
151
|
-
"gray": 242
|
|
152
|
-
},
|
|
153
|
-
"colors": {
|
|
154
|
-
"accent": "blue",
|
|
155
|
-
"muted": "gray",
|
|
156
|
-
"text": "",
|
|
157
|
-
...
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
49
|
+
## Understand the theme file
|
|
161
50
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
Every theme must define all 53 required color tokens. The optional tokens preserve compatibility with existing themes: `thinkingMax` falls back to `thinkingXhigh`, `searchMatchBg` falls back to `selectedBg`, and `searchMatchText` falls back to `text`. Other search matches use `searchMatchText` on `searchMatchBg` with an underline; the current match reverses that foreground/background pair and uses bold text.
|
|
171
|
-
|
|
172
|
-
### Core UI (13 colors)
|
|
173
|
-
|
|
174
|
-
| Token | Purpose |
|
|
175
|
-
|-------|---------|
|
|
176
|
-
| `accent` | Primary accent (logo, selected items, cursor) |
|
|
177
|
-
| `border` | Normal borders |
|
|
178
|
-
| `borderAccent` | Highlighted borders |
|
|
179
|
-
| `borderMuted` | Subtle borders (editor) |
|
|
180
|
-
| `success` | Success states |
|
|
181
|
-
| `error` | Error states |
|
|
182
|
-
| `warning` | Warning states |
|
|
183
|
-
| `muted` | Secondary text |
|
|
184
|
-
| `dim` | Tertiary text |
|
|
185
|
-
| `text` | Default text (usually `""`) |
|
|
186
|
-
| `thinkingText` | Thinking block text |
|
|
187
|
-
| `scrollbarTrack` | Fullscreen scrollbar track foreground |
|
|
188
|
-
| `scrollbarThumb` | Fullscreen scrollbar thumb foreground, shared by normal and expanded states |
|
|
189
|
-
|
|
190
|
-
### Backgrounds & Content (11 required, 2 optional)
|
|
191
|
-
|
|
192
|
-
| Token | Purpose |
|
|
193
|
-
|-------|---------|
|
|
194
|
-
| `selectedBg` | Selected line background |
|
|
195
|
-
| `searchMatchBg` | Transcript search match background and current-match text; optional, falls back to `selectedBg` |
|
|
196
|
-
| `searchMatchText` | Transcript search match text and current-match background; optional, falls back to `text` |
|
|
197
|
-
| `userMessageBg` | User message background |
|
|
198
|
-
| `userMessageText` | User message text |
|
|
199
|
-
| `customMessageBg` | Extension message background |
|
|
200
|
-
| `customMessageText` | Extension message text |
|
|
201
|
-
| `customMessageLabel` | Extension message label |
|
|
202
|
-
| `toolPendingBg` | Tool box (pending) |
|
|
203
|
-
| `toolSuccessBg` | Tool box (success) |
|
|
204
|
-
| `toolErrorBg` | Tool box (error) |
|
|
205
|
-
| `toolTitle` | Tool title |
|
|
206
|
-
| `toolOutput` | Tool output text |
|
|
207
|
-
|
|
208
|
-
### Markdown (10 colors)
|
|
209
|
-
|
|
210
|
-
| Token | Purpose |
|
|
211
|
-
|-------|---------|
|
|
212
|
-
| `mdHeading` | Headings |
|
|
213
|
-
| `mdLink` | Link text |
|
|
214
|
-
| `mdLinkUrl` | Link URL |
|
|
215
|
-
| `mdCode` | Inline code |
|
|
216
|
-
| `mdCodeBlock` | Code block content |
|
|
217
|
-
| `mdCodeBlockBorder` | Code block fences |
|
|
218
|
-
| `mdQuote` | Blockquote text |
|
|
219
|
-
| `mdQuoteBorder` | Blockquote border |
|
|
220
|
-
| `mdHr` | Horizontal rule |
|
|
221
|
-
| `mdListBullet` | List bullets |
|
|
222
|
-
|
|
223
|
-
### Tool Diffs (3 colors)
|
|
224
|
-
|
|
225
|
-
| Token | Purpose |
|
|
226
|
-
|-------|---------|
|
|
227
|
-
| `toolDiffAdded` | Added lines |
|
|
228
|
-
| `toolDiffRemoved` | Removed lines |
|
|
229
|
-
| `toolDiffContext` | Context lines |
|
|
230
|
-
|
|
231
|
-
### Syntax Highlighting (9 colors)
|
|
232
|
-
|
|
233
|
-
| Token | Purpose |
|
|
234
|
-
|-------|---------|
|
|
235
|
-
| `syntaxComment` | Comments |
|
|
236
|
-
| `syntaxKeyword` | Keywords |
|
|
237
|
-
| `syntaxFunction` | Function names |
|
|
238
|
-
| `syntaxVariable` | Variables |
|
|
239
|
-
| `syntaxString` | Strings |
|
|
240
|
-
| `syntaxNumber` | Numbers |
|
|
241
|
-
| `syntaxType` | Types |
|
|
242
|
-
| `syntaxOperator` | Operators |
|
|
243
|
-
| `syntaxPunctuation` | Punctuation |
|
|
244
|
-
|
|
245
|
-
### Thinking Level Borders (6 required, 1 optional)
|
|
246
|
-
|
|
247
|
-
Editor border colors indicating thinking level (visual hierarchy from subtle to prominent):
|
|
248
|
-
|
|
249
|
-
| Token | Purpose |
|
|
250
|
-
|-------|---------|
|
|
251
|
-
| `thinkingOff` | Thinking off |
|
|
252
|
-
| `thinkingMinimal` | Minimal thinking |
|
|
253
|
-
| `thinkingLow` | Low thinking |
|
|
254
|
-
| `thinkingMedium` | Medium thinking |
|
|
255
|
-
| `thinkingHigh` | High thinking |
|
|
256
|
-
| `thinkingXhigh` | Extra high thinking |
|
|
257
|
-
| `thinkingMax` | Maximum thinking; optional, falls back to `thinkingXhigh` |
|
|
258
|
-
|
|
259
|
-
### Bash Mode (1 color)
|
|
260
|
-
|
|
261
|
-
| Token | Purpose |
|
|
262
|
-
|-------|---------|
|
|
263
|
-
| `bashMode` | Editor border in bash mode (`!` prefix) |
|
|
264
|
-
|
|
265
|
-
### HTML Export (optional)
|
|
266
|
-
|
|
267
|
-
The `export` section controls colors for `/export` HTML output. If omitted, colors are derived from `userMessageBg`.
|
|
51
|
+
| Property | Required | Responsibility |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `$schema` | No | Enables editor validation and completion against KnightCode's published schema. |
|
|
54
|
+
| `name` | Yes | Identifies the theme in selectors and settings. It must be unique and cannot contain `/`. |
|
|
55
|
+
| `vars` | No | Defines reusable color values. Variables can reference other variables. |
|
|
56
|
+
| `colors` | Yes | Assigns colors to terminal UI roles. The schema identifies required and optional roles. |
|
|
57
|
+
| `export` | No | Overrides page and panel backgrounds in HTML exports. |
|
|
268
58
|
|
|
269
|
-
|
|
270
|
-
{
|
|
271
|
-
"export": {
|
|
272
|
-
"pageBg": "#18181e",
|
|
273
|
-
"cardBg": "#1e1e24",
|
|
274
|
-
"infoBg": "#3c3728"
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
```
|
|
59
|
+
A color can be written in four forms:
|
|
278
60
|
|
|
279
|
-
|
|
61
|
+
| Form | Example | Meaning |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| RGB hexadecimal | `"#00aaff"` | A six-digit RGB color. |
|
|
64
|
+
| 256-color index | `39` | An ANSI palette index from `0` through `255`. |
|
|
65
|
+
| Variable reference | `"primary"` | The value of an entry in `vars`. |
|
|
66
|
+
| Terminal default | `""` | The terminal's default foreground or background color. |
|
|
280
67
|
|
|
281
|
-
|
|
68
|
+
KnightCode resolves chained variable references. A missing variable or circular reference makes the theme invalid. Hexadecimal colors use truecolor when supported and are approximated in terminals limited to 256 colors. If colors differ from their hexadecimal values, check your terminal's truecolor detection and contrast settings. See [Configure Your Terminal](terminal-setup.md#override-detected-capabilities).
|
|
282
69
|
|
|
283
|
-
|
|
284
|
-
|--------|---------|-------------|
|
|
285
|
-
| Hex | `"#ff0000"` | 6-digit hex RGB |
|
|
286
|
-
| 256-color | `39` | xterm 256-color palette index (0-255) |
|
|
287
|
-
| Variable | `"primary"` | Reference to a `vars` entry |
|
|
288
|
-
| Default | `""` | Terminal's default color |
|
|
70
|
+
Use the [theme JSON schema](https://github.com/KnightCodeAI/knightcode/blob/main/packages/cli/src/modes/interactive/theme/theme-schema.json) for the exact properties, required colors, and accepted value types.
|
|
289
71
|
|
|
290
|
-
|
|
72
|
+
KnightCode reports invalid theme files during startup and `/reload`.
|
|
291
73
|
|
|
292
|
-
|
|
293
|
-
- `16-231`: 6×6×6 RGB cube (`16 + 36×R + 6×G + B` where R,G,B are 0-5)
|
|
294
|
-
- `232-255`: Grayscale ramp
|
|
74
|
+
## Find the color to change
|
|
295
75
|
|
|
296
|
-
|
|
76
|
+
Theme colors describe interface roles rather than individual components. Use these groups to find the relevant part of the schema:
|
|
297
77
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
78
|
+
| Area | Color names |
|
|
79
|
+
|---|---|
|
|
80
|
+
| General interface | `accent`, `border*`, `text`, `muted`, `dim`, `success`, `error`, `warning` |
|
|
81
|
+
| Selection and fullscreen | `selectedBg`, `searchMatch*`, `scrollbar*` |
|
|
82
|
+
| Messages | `userMessage*`, `customMessage*`, `thinkingText` |
|
|
83
|
+
| Tool execution | `toolPendingBg`, `toolSuccessBg`, `toolErrorBg`, `toolTitle`, `toolOutput` |
|
|
84
|
+
| Markdown | `md*` |
|
|
85
|
+
| Tool diffs | `toolDiff*` |
|
|
86
|
+
| Syntax highlighting | `syntax*` |
|
|
87
|
+
| Editor modes | `thinking*`, `bashMode` |
|
|
88
|
+
| HTML export | `export.pageBg`, `export.cardBg`, `export.infoBg` |
|
|
305
89
|
|
|
306
|
-
|
|
90
|
+
The schema is the format reference. The built-in themes provide complete values that you can copy and adjust.
|
|
307
91
|
|
|
308
|
-
|
|
92
|
+
Five colors are optional and inherit another color when omitted:
|
|
309
93
|
|
|
310
|
-
|
|
94
|
+
| Optional color | Fallback |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `scrollbarTrack` | `muted` |
|
|
97
|
+
| `scrollbarThumb` | `text` |
|
|
98
|
+
| `searchMatchBg` | `selectedBg` |
|
|
99
|
+
| `searchMatchText` | `text` |
|
|
100
|
+
| `thinkingMax` | `thinkingXhigh` |
|
|
311
101
|
|
|
312
|
-
|
|
102
|
+
If `export` colors are omitted, KnightCode derives HTML page and panel backgrounds from `userMessageBg`.
|
|
313
103
|
|
|
314
|
-
|
|
104
|
+
## Load a theme from a project or package
|
|
315
105
|
|
|
316
|
-
|
|
106
|
+
Place a project theme in `.knightcode/themes/`. Project themes load only after [project trust](security.md#understand-project-trust) is granted.
|
|
317
107
|
|
|
318
|
-
|
|
108
|
+
You can also load theme files and directories through the `themes` setting or distribute them in a KnightCode package. See [Configuration](configuration.md), [Settings](settings.md#resources), and [KnightCode Packages](packages.md).
|
|
319
109
|
|
|
320
|
-
|
|
321
|
-
- [dark.json](../src/modes/interactive/theme/dark.json)
|
|
322
|
-
- [light.json](../src/modes/interactive/theme/light.json)
|
|
110
|
+
Each loaded theme must have a unique name. KnightCode reports duplicate names as resource collisions.
|