@knightcodeai/cli 0.18.0 → 0.18.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/CHANGELOG.md +26 -0
- package/dist/bundle/chunks/{anthropic-messages-A2IH2IY3.js → anthropic-messages-QIZAJBTA.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-XZILQZOG.js → azure-openai-responses-7R44RRTC.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +22 -22
- package/dist/bundle/chunks/chunk-2QXPCKUQ.js +9 -0
- package/dist/bundle/chunks/{chunk-AFR2OW6S.js → chunk-3B66IKOZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-NCIBB66G.js → chunk-55AAX2FB.js} +1 -1
- package/dist/bundle/chunks/{chunk-FO7CEQB3.js → chunk-76TARFPL.js} +1 -1
- package/dist/bundle/chunks/{chunk-M5GCRGV6.js → chunk-7CWBI3GL.js} +9 -9
- package/dist/bundle/chunks/{chunk-NNCIIYD6.js → chunk-BPNRVFVQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-XIRAUXOE.js → chunk-HNZSETB2.js} +2 -2
- package/dist/bundle/chunks/{chunk-OFST7FDG.js → chunk-IGNYWP4P.js} +1 -1
- package/dist/bundle/chunks/{chunk-GHVXUCGU.js → chunk-LA7DDYYM.js} +2 -2
- package/dist/bundle/chunks/{chunk-ACHHEROF.js → chunk-NGWSYXD5.js} +1 -1
- package/dist/bundle/chunks/{chunk-U5XE4RWR.js → chunk-R2XYMDTS.js} +1 -1
- package/dist/bundle/chunks/chunk-T7XWBYOA.js +11 -0
- package/dist/bundle/chunks/chunk-XZJICKQ6.js +30 -0
- package/dist/bundle/chunks/{chunk-A5LJINMT.js → chunk-YQ26QP2R.js} +1 -1
- package/dist/bundle/chunks/{chunk-FHM6KUY3.js → chunk-ZB5LGRB5.js} +1 -1
- package/dist/bundle/chunks/{cli-6ZTWO6GL.js → cli-66ZLURJW.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-6E2UM7IG.js → cloudflare-workers-ai-system-one-LA7TF5LV.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-FDCGDUF3.js → easter-egg-3d-DQYQIGP2.js} +1 -1
- package/dist/bundle/chunks/{execute-VSDU5VSN.js → execute-KJDH5JWX.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-CSWR3ORZ.js → google-generative-ai-GEBPSQBJ.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-QIDRFOFB.js → google-vertex-BRMU44TN.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-46TK5OBA.js → mistral-conversations-FKYKJV7R.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-IT7VEKUU.js → openai-codex-responses-DAZKF6IV.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-LOKIW33V.js → openai-completions-A6RD26ED.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-4F3LWHMG.js → openai-decisions-OBTJNBTE.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-OK36GJXP.js → openai-responses-L3QPK3MQ.js} +1 -1
- package/dist/bundle/chunks/{runtime-RMPIV5AR.js → runtime-IU2Z5WWF.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-J2CJBWEH.js → typesafe-system-one-FZHRNG67.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-EGJP3AJA.js → virtual-modules-IKIDAUHO.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/cli.js +14 -3
- package/docs/custom-provider.md +53 -1
- package/docs/extensions.md +116 -10
- package/docs/tui.md +70 -0
- package/docs/windows.md +16 -2
- package/package.json +1 -1
- package/dist/bundle/chunks/chunk-EPYT326Y.js +0 -30
- package/dist/bundle/chunks/chunk-MB4QRS7Y.js +0 -9
- package/dist/bundle/chunks/chunk-V5ANFNKF.js +0 -11
package/docs/tui.md
CHANGED
|
@@ -65,6 +65,76 @@ Regular mode leaves mouse input to the terminal because the terminal owns scroll
|
|
|
65
65
|
|
|
66
66
|
`ctx.ui.custom()` temporarily gives one component control of the interactive area and resolves when that component calls the supplied completion callback.
|
|
67
67
|
|
|
68
|
+
### Build a minimal custom screen
|
|
69
|
+
|
|
70
|
+
This complete extension shows the custom-component lifecycle: render within the supplied width, use injected keybindings, invalidate cached output after state changes, request a render, and finish through `done()`.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import type { ExtensionAPI } from "@knightcodeai/cli";
|
|
74
|
+
import { truncateToWidth } from "@knightcode/tui";
|
|
75
|
+
|
|
76
|
+
export default function (knightcode: ExtensionAPI) {
|
|
77
|
+
knightcode.registerCommand("pick-target", {
|
|
78
|
+
description: "Pick a deployment target",
|
|
79
|
+
handler: async (_args, ctx) => {
|
|
80
|
+
if (ctx.mode !== "tui") {
|
|
81
|
+
ctx.ui.notify("pick-target requires interactive mode", "error");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const choices = ["development", "staging", "production"];
|
|
86
|
+
const selected = await ctx.ui.custom<string | undefined>((tui, theme, keybindings, done) => {
|
|
87
|
+
let selectedIndex = 0;
|
|
88
|
+
let cachedWidth: number | undefined;
|
|
89
|
+
let cachedLines: string[] | undefined;
|
|
90
|
+
|
|
91
|
+
const invalidate = () => {
|
|
92
|
+
cachedWidth = undefined;
|
|
93
|
+
cachedLines = undefined;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
render(width: number): string[] {
|
|
98
|
+
if (cachedLines && cachedWidth === width) return cachedLines;
|
|
99
|
+
|
|
100
|
+
cachedWidth = width;
|
|
101
|
+
cachedLines = [
|
|
102
|
+
theme.fg("accent", "Choose a deployment target"),
|
|
103
|
+
...choices.map((choice, index) => `${index === selectedIndex ? "> " : " "}${choice}`),
|
|
104
|
+
theme.fg("dim", "up/down move, enter selects, escape cancels"),
|
|
105
|
+
].map((line) => truncateToWidth(line, width));
|
|
106
|
+
return cachedLines;
|
|
107
|
+
},
|
|
108
|
+
handleInput(data: string): void {
|
|
109
|
+
if (keybindings.matches(data, "tui.select.up")) {
|
|
110
|
+
selectedIndex = (selectedIndex - 1 + choices.length) % choices.length;
|
|
111
|
+
} else if (keybindings.matches(data, "tui.select.down")) {
|
|
112
|
+
selectedIndex = (selectedIndex + 1) % choices.length;
|
|
113
|
+
} else if (keybindings.matches(data, "tui.select.confirm")) {
|
|
114
|
+
done(choices[selectedIndex]);
|
|
115
|
+
return;
|
|
116
|
+
} else if (keybindings.matches(data, "tui.select.cancel")) {
|
|
117
|
+
done(undefined);
|
|
118
|
+
return;
|
|
119
|
+
} else {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
invalidate();
|
|
124
|
+
tui.requestRender();
|
|
125
|
+
},
|
|
126
|
+
invalidate,
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (selected) ctx.ui.notify(`Selected ${selected}`, "info");
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This component does not display a text cursor, so it does not need `Focusable`. A component containing `Input` or `Editor` must implement `Focusable` and propagate its `focused` value to that child.
|
|
137
|
+
|
|
68
138
|
Pass `overlay: true` to draw above existing content. Overlay options control size, anchors, offsets, margins, and responsive visibility. An overlay handle can change focus or temporarily hide and show the overlay with `setHidden()` while the interaction remains active.
|
|
69
139
|
|
|
70
140
|
Focused overlays retain input ownership across ordinary renders. If another component should receive input while an overlay remains visible, explicitly release or redirect focus through the handle.
|
package/docs/windows.md
CHANGED
|
@@ -19,8 +19,9 @@ For most native Windows users, installing [Git for Windows](https://git-scm.com/
|
|
|
19
19
|
KnightCode resolves Bash in this order:
|
|
20
20
|
|
|
21
21
|
1. `shellPath` from `~/.knightcode/agent/settings.json`
|
|
22
|
-
2. Git Bash
|
|
23
|
-
3.
|
|
22
|
+
2. Git Bash at `%ProgramFiles%\Git\bin\bash.exe`
|
|
23
|
+
3. Git Bash at `%ProgramFiles(x86)%\Git\bin\bash.exe`
|
|
24
|
+
4. `bash.exe` on `PATH`, including Cygwin, MSYS2, or legacy WSL Bash
|
|
24
25
|
|
|
25
26
|
Start KnightCode and enter this command to verify the shell:
|
|
26
27
|
|
|
@@ -34,6 +35,13 @@ If KnightCode cannot find Bash, it reports the locations it checked. Install Git
|
|
|
34
35
|
|
|
35
36
|
The optional `powershell` tool runs commands through `pwsh.exe` when available, then falls back to Windows PowerShell. It starts PowerShell with `-NoProfile -NonInteractive -ExecutionPolicy Bypass`. Administrator-enforced execution policies can still take precedence.
|
|
36
37
|
|
|
38
|
+
PowerShell discovery checks these locations in order:
|
|
39
|
+
|
|
40
|
+
1. `pwsh.exe` on `PATH`
|
|
41
|
+
2. `%ProgramFiles%\PowerShell\7\pwsh.exe`
|
|
42
|
+
3. `powershell.exe` on `PATH`
|
|
43
|
+
4. `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`
|
|
44
|
+
|
|
37
45
|
To replace the model-facing `bash` tool with `powershell`, add this to `~/.knightcode/agent/settings.json`:
|
|
38
46
|
|
|
39
47
|
```json
|
|
@@ -48,6 +56,12 @@ Restart KnightCode, then ask it to run a harmless PowerShell command. The `!` an
|
|
|
48
56
|
|
|
49
57
|
See [Settings](settings.md#tools) for other tool combinations.
|
|
50
58
|
|
|
59
|
+
## WSL
|
|
60
|
+
|
|
61
|
+
WSL path conversion on Windows and extra Git branch polling in WSL recognize `/mnt/<drive>`, not custom mount roots.
|
|
62
|
+
|
|
63
|
+
When using the legacy WSL `bash.exe` launcher from Windows, KnightCode sends commands over stdin to avoid command-line quoting problems.
|
|
64
|
+
|
|
51
65
|
## Use a custom Bash executable
|
|
52
66
|
|
|
53
67
|
Set `shellPath` when Bash is installed somewhere KnightCode does not discover automatically:
|