@knightcodeai/cli-win32-x64 0.4.1 → 0.5.1

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.
Files changed (48) hide show
  1. package/bin/CHANGELOG.md +196 -0
  2. package/bin/README.md +36 -0
  3. package/bin/docs/compaction.md +416 -0
  4. package/bin/docs/containerization.md +111 -0
  5. package/bin/docs/custom-provider.md +777 -0
  6. package/bin/docs/development.md +71 -0
  7. package/bin/docs/docs.json +156 -0
  8. package/bin/docs/environment-variables.md +97 -0
  9. package/bin/docs/extensions.md +3020 -0
  10. package/bin/docs/images/doom-extension.png +0 -0
  11. package/bin/docs/images/interactive-mode.png +0 -0
  12. package/bin/docs/images/tree-view.png +0 -0
  13. package/bin/docs/index.md +84 -0
  14. package/bin/docs/json.md +98 -0
  15. package/bin/docs/keybindings.md +236 -0
  16. package/bin/docs/llama-cpp.md +101 -0
  17. package/bin/docs/models.md +571 -0
  18. package/bin/docs/packages.md +228 -0
  19. package/bin/docs/prompt-templates.md +96 -0
  20. package/bin/docs/providers.md +317 -0
  21. package/bin/docs/quickstart.md +167 -0
  22. package/bin/docs/rpc.md +1618 -0
  23. package/bin/docs/sdk.md +1219 -0
  24. package/bin/docs/security.md +59 -0
  25. package/bin/docs/session-format.md +438 -0
  26. package/bin/docs/sessions.md +145 -0
  27. package/bin/docs/settings.md +368 -0
  28. package/bin/docs/shell-aliases.md +13 -0
  29. package/bin/docs/skills.md +231 -0
  30. package/bin/docs/terminal-setup.md +177 -0
  31. package/bin/docs/termux.md +127 -0
  32. package/bin/docs/themes.md +320 -0
  33. package/bin/docs/tmux.md +63 -0
  34. package/bin/docs/tui.md +942 -0
  35. package/bin/docs/usage.md +307 -0
  36. package/bin/docs/windows.md +39 -0
  37. package/bin/export-html/template.css +1066 -0
  38. package/bin/export-html/template.html +55 -0
  39. package/bin/export-html/template.js +1864 -0
  40. package/bin/export-html/vendor/highlight.min.js +1213 -0
  41. package/bin/export-html/vendor/marked.min.js +78 -0
  42. package/bin/knightcode.exe +0 -0
  43. package/bin/package.json +76 -0
  44. package/bin/photon_rs_bg.wasm +0 -0
  45. package/bin/theme/dark.json +90 -0
  46. package/bin/theme/light.json +89 -0
  47. package/bin/theme/theme-schema.json +352 -0
  48. package/package.json +7 -1
@@ -0,0 +1,307 @@
1
+ # Using KnightCode
2
+
3
+ This page collects day-to-day usage details that do not fit on the quickstart page.
4
+
5
+ ## Interactive Mode
6
+
7
+ <p align="center"><img src="images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
8
+
9
+ The interface has four main areas:
10
+
11
+ - **Startup header** - shortcuts, loaded context files, prompt templates, skills, and extensions
12
+ - **Messages** - user messages, assistant responses, tool calls, tool results, notifications, errors, and extension UI
13
+ - **Editor** - where you type; border color indicates the current thinking level
14
+ - **Footer** - working directory, session name, token/cache usage, cost, context usage, and current model. Totals include assistant responses, usage reported by tools, and summary generation.
15
+
16
+ The editor can be replaced temporarily by built-in UI such as `/settings` or by custom extension UI.
17
+
18
+ ### Editor Features
19
+
20
+ | Feature | How |
21
+ |---------|-----|
22
+ | File reference | Type `@` to fuzzy-search project files |
23
+ | Path completion | Press Tab to complete paths |
24
+ | Multi-line input | Shift+Enter, or Ctrl+Enter on Windows Terminal |
25
+ | Copy response | Ctrl+X copies the last assistant message; in `/tree`, it copies the selected message |
26
+ | Images | Paste with Ctrl+V, Alt+V on Windows, or drag into the terminal |
27
+ | Shell command | `!command` runs and sends output to the model |
28
+ | Hidden shell command | `!!command` runs without sending output to the model |
29
+ | External editor | Ctrl+G opens `externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere |
30
+
31
+ See [Keybindings](keybindings.md) for all shortcuts and customization.
32
+
33
+ ## Slash Commands
34
+
35
+ Type `/` in the editor to open command completion. Extensions can register custom commands, skills are available as `/skill:name`, and prompt templates expand via `/templatename`.
36
+
37
+ | Command | Description |
38
+ |---------|-------------|
39
+ | `/login`, `/logout` | Manage OAuth or API-key credentials |
40
+ | [`/llama`](llama-cpp.md) | Download, load, and unload llama.cpp router models |
41
+ | `/model` | Switch models; Ctrl+S in the picker saves the startup default |
42
+ | `/thinking` | Switch thinking level; Ctrl+S in the picker saves the startup default |
43
+ | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
44
+ | `/settings` | Theme, message delivery, transport, and other preferences |
45
+ | `/resume` | Pick from previous sessions |
46
+ | `/new` | Start a new session |
47
+ | `/name <name>` | Set session display name |
48
+ | `/session` | Show session file, ID, messages, tokens, and cost |
49
+ | `/tree` | Jump to any point in the session and continue from there |
50
+ | `/trust` | Save project trust decision for future sessions |
51
+ | `/fork` | Create a new session from a previous user message |
52
+ | `/clone` | Duplicate the current active branch into a new session |
53
+ | `/compact [prompt]` | Manually compact context, optionally with custom instructions |
54
+ | `/copy` | Copy last assistant message to clipboard |
55
+ | `/export [file]` | Export session to HTML or JSONL |
56
+ | `/import <file>` | Import and resume a session from a JSONL file |
57
+ | `/share` | Upload as private GitHub gist with shareable HTML link |
58
+ | `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
59
+ | `/hotkeys` | Show all keyboard shortcuts |
60
+ | `/changelog` | Display version history |
61
+ | `/quit` | Quit knightcode |
62
+
63
+ ## Message Queue
64
+
65
+ You can submit messages while the agent is still working:
66
+
67
+ - **Enter** queues a steering message, delivered after the current assistant turn finishes executing its tool calls.
68
+ - **Alt+Enter** queues a follow-up message, delivered after the agent finishes all work.
69
+ - **Escape** aborts and restores queued messages to the editor.
70
+ - **Alt+Up** retrieves queued messages back to the editor.
71
+
72
+ On Windows Terminal, Alt+Enter is fullscreen by default. Remap it as described in [Terminal setup](terminal-setup.md) if you want knightcode to receive the shortcut.
73
+
74
+ Configure delivery in [Settings](settings.md) with `steeringMode` and `followUpMode`.
75
+
76
+ ## Sessions
77
+
78
+ Sessions are saved automatically to `~/.knightcode/agent/sessions/`, organized by working directory.
79
+
80
+ ```bash
81
+ knightcode -c # Continue most recent session
82
+ knightcode -r # Browse and select a session
83
+ knightcode --no-session # Ephemeral mode; do not save
84
+ knightcode --name "my task" # Set session display name at startup
85
+ knightcode --session <path|id> # Use a specific session file or session ID
86
+ knightcode --fork <path|id> # Fork a session into a new session file
87
+ ```
88
+
89
+ Useful session commands:
90
+
91
+ - `/session` shows the current session file and ID.
92
+ - `/tree` navigates the in-file session tree and can summarize abandoned branches.
93
+ - `/fork` creates a new session from an earlier user message.
94
+ - `/clone` duplicates the current active branch into a new session file.
95
+ - `/compact` summarizes older messages to free context.
96
+
97
+ See [Sessions](sessions.md) and [Compaction](compaction.md) for details.
98
+
99
+ ## Context Files
100
+
101
+ KnightCode loads `AGENTS.md` or `CLAUDE.md` at startup from:
102
+
103
+ - `~/.knightcode/agent/AGENTS.md` for global instructions
104
+ - parent directories, walking up from the current working directory
105
+ - the current directory
106
+
107
+ If a directory contains `AGENTS.override.md`, KnightCode loads it instead of `AGENTS.md` or `CLAUDE.md` from that directory. Context files from other directories still layer normally.
108
+
109
+ Use context files for project conventions, commands, safety rules, and preferences. Disable loading with `--no-context-files` or `-nc`.
110
+
111
+ ### System Prompt Files
112
+
113
+ Replace the default system prompt with:
114
+
115
+ - `.knightcode/SYSTEM.md` for a project
116
+ - `~/.knightcode/agent/SYSTEM.md` globally
117
+
118
+ Append to the default prompt without replacing it with `APPEND_SYSTEM.md` in either location.
119
+
120
+ ### Project Trust
121
+
122
+ On interactive startup, knightcode asks before trusting a project folder that contains project-local settings, resources, or project `.agents/skills` and has no saved decision for the folder or a parent folder in `~/.knightcode/agent/trust.json`. Trusting a project allows knightcode to load `.knightcode/settings.json` and `.knightcode` resources, install missing project packages, and execute project extensions.
123
+
124
+ Before the trust decision, knightcode loads only context files, user/global extensions, and CLI `-e` extensions so they can handle the `project_trust` event. Project-local extensions, project package-managed extensions, and project settings are loaded only after the project is trusted. This split also applies when switching to a session from a different cwd whose trust has not been resolved in the current process.
125
+
126
+ Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, they use `defaultProjectTrust` from global settings: `ask` (default) and `never` ignore those project resources, while `always` trusts them. Pass `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
127
+
128
+ If no extension or saved decision applies, `defaultProjectTrust` controls the fallback behavior. Set it to `"ask"`, `"always"`, or `"never"` in `~/.knightcode/agent/settings.json`, or change it with `/settings`.
129
+
130
+ `knightcode config` and package commands use the same project trust flow, except `knightcode update` never prompts. Pass `--approve` to trust project-local settings for one command or `--no-approve` to ignore them.
131
+
132
+ Use `/trust` in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes `~/.knightcode/agent/trust.json` only; the current session is not reloaded, so restart knightcode for changes to take effect.
133
+
134
+
135
+ ## Exporting and Sharing Sessions
136
+
137
+ Use `/export [file]` to write a session to HTML.
138
+
139
+ Use `/share` to upload a private GitHub gist with a shareable HTML link.
140
+
141
+ ## CLI Reference
142
+
143
+ ```bash
144
+ knightcode [options] [--] [@files...] [messages...]
145
+ ```
146
+
147
+ ### Package Commands
148
+
149
+ ```bash
150
+ knightcode install <source> [-l] # Install package, -l for project-local
151
+ knightcode remove <source> [-l] # Remove package
152
+ knightcode uninstall <source> [-l] # Alias for remove
153
+ knightcode update [source|self|knightcode] # Update knightcode only, or one package source
154
+ knightcode update --all # Update knightcode and packages; reconcile pinned git refs
155
+ knightcode update --extensions # Update packages only; reconcile pinned git refs
156
+ knightcode update --models # Refresh model catalogs only
157
+ knightcode update --self # Update knightcode only
158
+ knightcode update --extension <src> # Update one package
159
+ knightcode list # List installed packages
160
+ knightcode config # Enable/disable package resources
161
+ ```
162
+
163
+ These commands manage knightcode packages and `knightcode update` can update the knightcode CLI installation. To uninstall knightcode itself, see [Quickstart](quickstart.md#uninstall). `knightcode config` and project package commands accept `--approve`/`--no-approve` to trust or ignore project-local settings for one command. `knightcode update` never prompts for project trust.
164
+
165
+ See [KnightCode Packages](packages.md) for package sources and security notes.
166
+
167
+ ### Modes
168
+
169
+ | Flag | Description |
170
+ |------|-------------|
171
+ | default | Interactive mode |
172
+ | `-p`, `--print` | Print response and exit |
173
+ | `--mode json` | Output all events as JSON lines; see [JSON mode](json.md) |
174
+ | `--mode rpc` | RPC mode over stdin/stdout; see [RPC mode](rpc.md) |
175
+ | `--export <in> [out]` | Export a session to HTML |
176
+
177
+ In print mode, knightcode also reads piped stdin and merges it into the initial prompt:
178
+
179
+ ```bash
180
+ cat README.md | knightcode -p "Summarize this text"
181
+ ```
182
+
183
+ ### Model Options
184
+
185
+ | Option | Description |
186
+ |--------|-------------|
187
+ | `--provider <name>` | Provider, such as `anthropic`, `openai`, or `google` |
188
+ | `--model <pattern>` | Model pattern or ID; supports `provider/id` and optional `:<thinking>` |
189
+ | `--api-key <key>` | API key, overriding environment variables |
190
+ | `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` |
191
+ | `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
192
+ | `--list-models [search]` | List available models |
193
+
194
+ ### Session Options
195
+
196
+ | Option | Description |
197
+ |--------|-------------|
198
+ | `-c`, `--continue` | Continue the most recent session |
199
+ | `-r`, `--resume` | Browse and select a session |
200
+ | `--session <path\|id>` | Use a specific session file or partial UUID |
201
+ | `--fork <path\|id>` | Fork a session file or partial UUID into a new session |
202
+ | `--session-dir <dir>` | Custom session storage directory |
203
+ | `--no-session` | Ephemeral mode; do not save |
204
+ | `--name <name>`, `-n <name>` | Set session display name at startup |
205
+
206
+ ### Tool Options
207
+
208
+ | Option | Description |
209
+ |--------|-------------|
210
+ | `--tools <list>`, `-t <list>` | Allowlist specific built-in, extension, and custom tools |
211
+ | `--exclude-tools <list>`, `-xt <list>` | Disable specific built-in, extension, and custom tools |
212
+ | `--no-builtin-tools`, `-nbt` | Disable built-in tools but keep extension/custom tools enabled |
213
+ | `--no-tools`, `-nt` | Disable all tools |
214
+
215
+ Built-in tools: `read`, `bash`, `powershell` (Windows), `edit`, `write`, `grep`, `find`, `ls`.
216
+
217
+ ### Resource Options
218
+
219
+ | Option | Description |
220
+ |--------|-------------|
221
+ | `-e`, `--extension <source>` | Load an extension from path, npm, or git; repeatable |
222
+ | `--no-extensions` | Disable extension discovery |
223
+ | `--skill <path>` | Load a skill; repeatable |
224
+ | `--no-skills` | Disable skill discovery |
225
+ | `--prompt-template <path>` | Load a prompt template; repeatable |
226
+ | `--no-prompt-templates` | Disable prompt template discovery |
227
+ | `--theme <path>` | Load a theme; repeatable |
228
+ | `--no-themes` | Disable theme discovery |
229
+ | `--no-context-files`, `-nc` | Disable `AGENTS.md` and `CLAUDE.md` discovery |
230
+
231
+ Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings. Example:
232
+
233
+ ```bash
234
+ knightcode --no-extensions -e ./my-extension.ts
235
+ ```
236
+
237
+ ### Other Options
238
+
239
+ | Option | Description |
240
+ |--------|-------------|
241
+ | `--system-prompt <text>` | Replace default prompt; context files and skills are still appended |
242
+ | `--append-system-prompt <text>` | Append to system prompt |
243
+ | `--tui-mode <mode>` | TUI mode: `regular` (default) or experimental `fullscreen` |
244
+ | `--use-theme <name[/name]>` | Set the initial interactive theme for this run without changing settings |
245
+ | `--verbose` | Force verbose startup |
246
+ | `-a`, `--approve` | Trust project-local files for this run |
247
+ | `-na`, `--no-approve` | Ignore project-local files for this run |
248
+ | `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs |
249
+ | `-h`, `--help` | Show help |
250
+ | `-v`, `--version` | Show version |
251
+
252
+ In `fullscreen` mode, the transcript scrolls inside the terminal viewport while queued messages, working status, extension widgets, editor, and footer remain fixed at the bottom. Mouse/trackpad input scrolls the region under the pointer; keyboard viewport actions always remain available. Inline images work in terminals that support the Kitty graphics protocol, including Kitty and Ghostty. In iTerm2 they render as text placeholders because its inline-image protocol cannot delete or crop placements during application-owned scrolling. In `regular` mode, knightcode uses the main screen and terminal-owned scrollback, and iTerm2 inline images continue to render normally. See [Terminal setup](terminal-setup.md) for terminal-specific settings and workarounds.
253
+
254
+ Set **TUI mode** in `/settings` to switch between `regular` and `fullscreen` immediately and choose the default for future sessions. **Fullscreen exit output** controls whether exiting fullscreen prints the final transcript or restores the previous screen and prints only the session resume hint.
255
+
256
+ ### File Arguments
257
+
258
+ Prefix files with `@` to include them in the message:
259
+
260
+ ```bash
261
+ knightcode @prompt.md "Answer this"
262
+ knightcode -p @screenshot.png "What's in this image?"
263
+ knightcode @code.ts @test.ts "Review these files"
264
+ ```
265
+
266
+ ### Examples
267
+
268
+ ```bash
269
+ # Interactive with initial prompt
270
+ knightcode "List all .ts files in src/"
271
+
272
+ # Non-interactive
273
+ knightcode -p "Summarize this codebase"
274
+
275
+ # Prompt beginning with a dash
276
+ knightcode -p -- "- Summarize these points"
277
+
278
+ # Non-interactive with piped stdin
279
+ cat README.md | knightcode -p "Summarize this text"
280
+
281
+ # Named one-shot session
282
+ knightcode --name "release audit" -p "Audit this repository"
283
+
284
+ # Different model
285
+ knightcode --provider openai --model gpt-4o "Help me refactor"
286
+
287
+ # Model with provider prefix
288
+ knightcode --model openai/gpt-4o "Help me refactor"
289
+
290
+ # Model with thinking level shorthand
291
+ knightcode --model sonnet:high "Solve this complex problem"
292
+
293
+ # Limit model cycling
294
+ knightcode --models "claude-*,gpt-4o"
295
+
296
+ # Read-only mode
297
+ knightcode --tools read,grep,find,ls -p "Review the code"
298
+
299
+ # Disable one extension or built-in tool while keeping the rest available
300
+ knightcode --exclude-tools ask_question
301
+ ```
302
+
303
+ ## Design Principles
304
+
305
+ KnightCode keeps the core small and pushes workflow-specific behavior into extensions, skills, prompt templates, and packages.
306
+
307
+ It intentionally does not include built-in MCP, sub-agents, permission popups, plan mode, to-dos, or background bash. You can build or install those workflows as extensions or packages, or use external tools such as containers and tmux.
@@ -0,0 +1,39 @@
1
+ # Windows Setup
2
+
3
+ KnightCode uses Git Bash by default on Windows. Checked locations (in order):
4
+
5
+ 1. Custom path from `~/.knightcode/agent/settings.json`
6
+ 2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
7
+ 3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
8
+
9
+ For most users, [Git for Windows](https://git-scm.com/download/win) is sufficient.
10
+
11
+ ## PowerShell Tool
12
+
13
+ The optional `powershell` tool runs commands through `pwsh.exe` when available, otherwise Windows PowerShell. It starts PowerShell with `-NoProfile -NonInteractive -ExecutionPolicy Bypass`. Administrator-enforced execution policies can still take precedence.
14
+
15
+ Use `defaultTools` to replace the model-facing `bash` tool:
16
+
17
+ ```json
18
+ {
19
+ "defaultTools": ["read", "powershell", "edit", "write"]
20
+ }
21
+ ```
22
+
23
+ Or enable both while comparing behavior:
24
+
25
+ ```json
26
+ {
27
+ "defaultTools": ["read", "bash", "powershell", "edit", "write"]
28
+ }
29
+ ```
30
+
31
+ The `!` and `!!` editor commands still use Bash.
32
+
33
+ ## Custom Bash Path
34
+
35
+ ```json
36
+ {
37
+ "shellPath": "C:\\cygwin64\\bin\\bash.exe"
38
+ }
39
+ ```