wispy-cli 2.7.23 → 2.7.25

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.
@@ -0,0 +1,101 @@
1
+ /**
2
+ * cjk-text-input.mjs — CJK-aware text input for Ink TUI
3
+ *
4
+ * Uses Ink's native useInput hook (not raw stdin) so it works alongside
5
+ * other Ink components. Korean/CJK works because useInput already receives
6
+ * decoded UTF-8 characters — the real fix is handling them correctly.
7
+ */
8
+
9
+ import React, { useState, useEffect } from "react";
10
+ import { Box, Text, useInput } from "ink";
11
+
12
+ function CJKTextInput({
13
+ value = "",
14
+ onChange,
15
+ onSubmit,
16
+ placeholder = "",
17
+ focus = true,
18
+ showCursor = true,
19
+ }) {
20
+ useInput(
21
+ (input, key) => {
22
+ // Skip keys handled by parent (Tab, Ctrl+C, arrows for view switching)
23
+ if (
24
+ key.tab ||
25
+ (key.shift && key.tab) ||
26
+ key.upArrow ||
27
+ key.downArrow ||
28
+ (key.ctrl && input === "c")
29
+ ) {
30
+ return;
31
+ }
32
+
33
+ if (key.return) {
34
+ onSubmit?.(value);
35
+ return;
36
+ }
37
+
38
+ if (key.backspace || key.delete) {
39
+ // For CJK: slice off one character (which may be multi-byte)
40
+ const newVal = [...value].slice(0, -1).join("");
41
+ onChange?.(newVal);
42
+ return;
43
+ }
44
+
45
+ if (key.leftArrow || key.rightArrow) {
46
+ // Cursor movement — skip for now (append-only input)
47
+ return;
48
+ }
49
+
50
+ // Ctrl+U — clear line
51
+ if (key.ctrl && input === "u") {
52
+ onChange?.("");
53
+ return;
54
+ }
55
+
56
+ // Ctrl+W — delete last word
57
+ if (key.ctrl && input === "w") {
58
+ const trimmed = value.trimEnd();
59
+ const lastSpace = trimmed.lastIndexOf(" ");
60
+ onChange?.(lastSpace >= 0 ? trimmed.slice(0, lastSpace + 1) : "");
61
+ return;
62
+ }
63
+
64
+ // Normal character input — this includes CJK characters
65
+ // Ink's useInput already decodes UTF-8, so 'input' is a proper string
66
+ if (input && input.length > 0) {
67
+ onChange?.(value + input);
68
+ }
69
+ },
70
+ { isActive: focus }
71
+ );
72
+
73
+ // Render
74
+ const displayValue = value;
75
+ const showPlaceholder = !displayValue && placeholder;
76
+
77
+ if (showPlaceholder) {
78
+ if (showCursor && focus) {
79
+ return React.createElement(
80
+ Box,
81
+ {},
82
+ React.createElement(Text, { inverse: true }, placeholder[0] || " "),
83
+ React.createElement(Text, { dimColor: true }, placeholder.slice(1))
84
+ );
85
+ }
86
+ return React.createElement(Text, { dimColor: true }, placeholder);
87
+ }
88
+
89
+ if (showCursor && focus) {
90
+ return React.createElement(
91
+ Box,
92
+ {},
93
+ React.createElement(Text, {}, displayValue),
94
+ React.createElement(Text, { inverse: true }, " ")
95
+ );
96
+ }
97
+
98
+ return React.createElement(Text, {}, displayValue);
99
+ }
100
+
101
+ export default CJKTextInput;
package/lib/wispy-tui.mjs CHANGED
@@ -12,7 +12,9 @@
12
12
  import React, { useState, useEffect, useRef, useCallback } from "react";
13
13
  import { render, Box, Text, useApp, useInput, useStdout } from "ink";
14
14
  import Spinner from "ink-spinner";
15
- import TextInput from "ink-text-input";
15
+ import CJKTextInput from "./cjk-text-input.mjs";
16
+ // CJKTextInput is a drop-in replacement for ink-text-input with Korean/CJK support
17
+ const TextInput = CJKTextInput;
16
18
 
17
19
  import { COMMANDS, filterCommands } from "./command-registry.mjs";
18
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wispy-cli",
3
- "version": "2.7.23",
3
+ "version": "2.7.25",
4
4
  "description": "🌿 Wispy — AI workspace assistant with trustworthy execution (harness, receipts, approvals, diffs)",
5
5
  "license": "MIT",
6
6
  "author": "Minseo & Poropo",