wispy-cli 2.7.30 → 2.7.32
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/wispy.mjs +5 -7
- package/lib/wispy-tui-v3.mjs +24 -24
- package/package.json +1 -1
package/bin/wispy.mjs
CHANGED
|
@@ -1400,14 +1400,12 @@ _wispy() {
|
|
|
1400
1400
|
local -a commands flags
|
|
1401
1401
|
commands=(${cmds.map(c => `'${c}'`).join(" ")})
|
|
1402
1402
|
flags=(${flags.map(f => `'${f}'`).join(" ")})
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
_describe '
|
|
1406
|
-
|
|
1407
|
-
_files
|
|
1408
|
-
fi
|
|
1403
|
+
_arguments -C '1:command:->cmd' '*:file:_files' && return
|
|
1404
|
+
case "$state" in
|
|
1405
|
+
cmd) _describe 'command' commands -- flags ;;
|
|
1406
|
+
esac
|
|
1409
1407
|
}
|
|
1410
|
-
_wispy
|
|
1408
|
+
compdef _wispy wispy 2>/dev/null`);
|
|
1411
1409
|
} else if (shell === "bash") {
|
|
1412
1410
|
console.log(`_wispy_completions() {
|
|
1413
1411
|
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
package/lib/wispy-tui-v3.mjs
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
-
TUI, Container, Box, Text, Editor, Markdown, Loader,
|
|
12
|
-
Spacer, ProcessTerminal, Key, matchesKey, isKeyRelease,
|
|
11
|
+
TUI, Container, Box, Text, Editor, Input, Markdown, Loader,
|
|
12
|
+
Spacer, ProcessTerminal, Key, matchesKey, isKeyRelease, visibleWidth,
|
|
13
13
|
} from "@mariozechner/pi-tui";
|
|
14
14
|
|
|
15
15
|
import chalk from "chalk";
|
|
@@ -411,7 +411,7 @@ class WispyTUI {
|
|
|
411
411
|
);
|
|
412
412
|
|
|
413
413
|
// 4. Input editor
|
|
414
|
-
this.inputEditor = new
|
|
414
|
+
this.inputEditor = new WispyInput(this);
|
|
415
415
|
|
|
416
416
|
// Initially loader is not added — we add/remove dynamically
|
|
417
417
|
root.addChild(this.inputEditor);
|
|
@@ -1101,42 +1101,42 @@ class WispyTUI {
|
|
|
1101
1101
|
|
|
1102
1102
|
// ─── WispyEditor — custom Editor that intercepts global keys ─────────────────
|
|
1103
1103
|
|
|
1104
|
-
class
|
|
1105
|
-
constructor(
|
|
1106
|
-
super(
|
|
1104
|
+
class WispyInput extends Input {
|
|
1105
|
+
constructor(wispyTUI) {
|
|
1106
|
+
super();
|
|
1107
1107
|
this._wispy = wispyTUI;
|
|
1108
1108
|
|
|
1109
|
-
// Handle submit via Editor's onSubmit
|
|
1110
1109
|
this.onSubmit = (text) => {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1110
|
+
const trimmed = (text ?? "").trim();
|
|
1111
|
+
if (trimmed) {
|
|
1112
|
+
this._wispy.handleSubmit(trimmed).catch(err => {
|
|
1113
|
+
console.error("Submit error:", err.message);
|
|
1114
|
+
});
|
|
1115
|
+
this.setValue("");
|
|
1116
|
+
}
|
|
1114
1117
|
};
|
|
1115
1118
|
}
|
|
1116
1119
|
|
|
1117
1120
|
handleInput(data) {
|
|
1118
1121
|
if (isKeyRelease(data)) return;
|
|
1119
1122
|
|
|
1120
|
-
//
|
|
1121
|
-
|
|
1122
|
-
const currentText = this.getText();
|
|
1123
|
+
// Global keys (Tab, Ctrl+C, 1-6, ?, Ctrl+L) when input is empty
|
|
1124
|
+
const currentText = this.getValue();
|
|
1123
1125
|
if (currentText.length === 0 || matchesKey(data, Key.tab) || matchesKey(data, Key.ctrl("c")) || matchesKey(data, Key.ctrl("l"))) {
|
|
1124
1126
|
if (this._wispy.handleGlobalKey(data)) return;
|
|
1125
1127
|
}
|
|
1126
1128
|
|
|
1127
|
-
//
|
|
1128
|
-
if (matchesKey(data, Key.enter) && !matchesKey(data, Key.shift("enter"))) {
|
|
1129
|
-
const text = this.getText().trim();
|
|
1130
|
-
if (text) {
|
|
1131
|
-
this.onSubmit(text);
|
|
1132
|
-
this.setText("");
|
|
1133
|
-
}
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
// Default: pass to Editor (handles typing, backspace, CJK, undo, etc.)
|
|
1129
|
+
// Default: pass to Input (single-line, handles typing, backspace, CJK, cursor movement)
|
|
1138
1130
|
super.handleInput(data);
|
|
1139
1131
|
}
|
|
1132
|
+
|
|
1133
|
+
render(width) {
|
|
1134
|
+
// Render with prompt prefix
|
|
1135
|
+
const prompt = `${this._wispy.activeWorkstream} › `;
|
|
1136
|
+
const lines = super.render(width - visibleWidth(prompt));
|
|
1137
|
+
if (lines.length === 0) return [prompt];
|
|
1138
|
+
return [prompt + lines[0]];
|
|
1139
|
+
}
|
|
1140
1140
|
}
|
|
1141
1141
|
|
|
1142
1142
|
// ─── ContentArea — custom component for sidebar + main layout ─────────────────
|
package/package.json
CHANGED