opencode-miniterm 1.0.5 → 1.0.7
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/package.json +2 -1
- package/src/ansi.ts +2 -0
- package/src/commands/quit.ts +10 -1
- package/src/index.ts +303 -284
- package/src/render.ts +16 -3
- package/test/README.md +164 -0
- package/test/render.test.ts +5 -1
- package/test/tmux-menu-examples.ts +119 -0
- package/test/tmux-readline.test.ts +518 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-miniterm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "A small front-end terminal UI for OpenCode",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "bun src/index.ts",
|
|
11
11
|
"test": "bun test",
|
|
12
|
+
"test:tmux": "bun test/tmux-readline.test.ts",
|
|
12
13
|
"check": "tsgo --noEmit"
|
|
13
14
|
},
|
|
14
15
|
"keywords": [
|
package/src/ansi.ts
CHANGED
|
@@ -6,6 +6,8 @@ export const CURSOR_HOME = "\x1b[0G";
|
|
|
6
6
|
export const CURSOR_HIDE = "\x1b[?25l";
|
|
7
7
|
export const CURSOR_SHOW = "\x1b[?25h";
|
|
8
8
|
export const CURSOR_UP = (lines: number) => `\x1b[${lines}A`;
|
|
9
|
+
export const DISABLE_LINE_WRAP = "\x1b[?7l";
|
|
10
|
+
export const ENABLE_LINE_WRAP = "\x1b[?7h";
|
|
9
11
|
export const RESET = "\x1b[0m";
|
|
10
12
|
export const BRIGHT_WHITE = "\x1b[97m";
|
|
11
13
|
export const BRIGHT_BLACK = "\x1b[90m";
|
package/src/commands/quit.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
2
|
+
import * as ansi from "../ansi";
|
|
3
|
+
import { saveConfig } from "../config";
|
|
2
4
|
import type { State } from "../index";
|
|
3
5
|
import type { Command } from "../types";
|
|
4
6
|
|
|
@@ -12,6 +14,13 @@ let command: Command = {
|
|
|
12
14
|
export default command;
|
|
13
15
|
|
|
14
16
|
async function run(_client: OpencodeClient, _state: State): Promise<void> {
|
|
15
|
-
|
|
17
|
+
if (process.stdin.setRawMode) {
|
|
18
|
+
process.stdin.setRawMode(false);
|
|
19
|
+
}
|
|
20
|
+
process.stdin.destroy();
|
|
21
|
+
process.stdout.write(ansi.ENABLE_LINE_WRAP);
|
|
22
|
+
saveConfig();
|
|
23
|
+
// TODO: server?.close();
|
|
24
|
+
console.log(`${ansi.BRIGHT_BLACK}Goodbye!${ansi.RESET}`);
|
|
16
25
|
process.exit(0);
|
|
17
26
|
}
|