codeam-cli 1.2.1 → 1.2.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/dist/index.js +20 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ var import_picocolors = __toESM(require("picocolors"));
|
|
|
110
110
|
// package.json
|
|
111
111
|
var package_default = {
|
|
112
112
|
name: "codeam-cli",
|
|
113
|
-
version: "1.2.
|
|
113
|
+
version: "1.2.2",
|
|
114
114
|
description: "Remote control Claude Code from your mobile device",
|
|
115
115
|
main: "dist/index.js",
|
|
116
116
|
bin: {
|
|
@@ -681,26 +681,30 @@ var ClaudeService = class {
|
|
|
681
681
|
/**
|
|
682
682
|
* Navigate a React Ink selector to the given 0-based index and confirm.
|
|
683
683
|
*
|
|
684
|
-
* Why not
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
* selectedIndex
|
|
688
|
-
* arrows and the Enter, the closure still sees the initial index (0) when Enter
|
|
689
|
-
* fires, so it always submits option 0.
|
|
684
|
+
* Why not sendCommand(arrows + Enter) in one write()?
|
|
685
|
+
* All bytes arrive as one chunk → readline fires all keypress events in the
|
|
686
|
+
* same synchronous run → React Ink batches the state updates → each arrow
|
|
687
|
+
* sees selectedIndex=0 → final state is still 0 or 1 → wrong option selected.
|
|
690
688
|
*
|
|
691
|
-
* Fix: send
|
|
692
|
-
*
|
|
689
|
+
* Fix: send each down-arrow in a separate write(), ARROW_MS apart, so React
|
|
690
|
+
* has time to process and re-render between each keystroke. Enter is sent
|
|
691
|
+
* ENTER_MS after the last arrow.
|
|
693
692
|
*/
|
|
694
693
|
selectOption(index) {
|
|
695
|
-
|
|
696
|
-
if (arrows) {
|
|
697
|
-
this.proc?.stdin?.write(arrows);
|
|
698
|
-
setTimeout(() => {
|
|
699
|
-
this.proc?.stdin?.write("\r");
|
|
700
|
-
}, 150);
|
|
701
|
-
} else {
|
|
694
|
+
if (index <= 0) {
|
|
702
695
|
this.proc?.stdin?.write("\r");
|
|
696
|
+
return;
|
|
703
697
|
}
|
|
698
|
+
const ARROW_MS = 80;
|
|
699
|
+
const ENTER_MS = 200;
|
|
700
|
+
for (let i = 0; i < index; i++) {
|
|
701
|
+
setTimeout(() => {
|
|
702
|
+
this.proc?.stdin?.write("\x1B[B");
|
|
703
|
+
}, i * ARROW_MS);
|
|
704
|
+
}
|
|
705
|
+
setTimeout(() => {
|
|
706
|
+
this.proc?.stdin?.write("\r");
|
|
707
|
+
}, index * ARROW_MS + ENTER_MS);
|
|
704
708
|
}
|
|
705
709
|
/** Send Ctrl+C to Claude. */
|
|
706
710
|
interrupt() {
|