codeam-cli 1.2.0 → 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 +33 -5
- 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: {
|
|
@@ -678,6 +678,34 @@ var ClaudeService = class {
|
|
|
678
678
|
sendCommand(text) {
|
|
679
679
|
this.proc?.stdin?.write(text + "\r");
|
|
680
680
|
}
|
|
681
|
+
/**
|
|
682
|
+
* Navigate a React Ink selector to the given 0-based index and confirm.
|
|
683
|
+
*
|
|
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.
|
|
688
|
+
*
|
|
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.
|
|
692
|
+
*/
|
|
693
|
+
selectOption(index) {
|
|
694
|
+
if (index <= 0) {
|
|
695
|
+
this.proc?.stdin?.write("\r");
|
|
696
|
+
return;
|
|
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);
|
|
708
|
+
}
|
|
681
709
|
/** Send Ctrl+C to Claude. */
|
|
682
710
|
interrupt() {
|
|
683
711
|
this.proc?.stdin?.write("");
|
|
@@ -1056,8 +1084,8 @@ async function start() {
|
|
|
1056
1084
|
}
|
|
1057
1085
|
case "select_option": {
|
|
1058
1086
|
const index = cmd.payload.index ?? 0;
|
|
1059
|
-
|
|
1060
|
-
|
|
1087
|
+
outputSvc.newTurn();
|
|
1088
|
+
claude.selectOption(index);
|
|
1061
1089
|
break;
|
|
1062
1090
|
}
|
|
1063
1091
|
case "stop_task":
|
|
@@ -1082,8 +1110,8 @@ async function start() {
|
|
|
1082
1110
|
if (input) sendPrompt(input);
|
|
1083
1111
|
} else if (cmdType === "select_option") {
|
|
1084
1112
|
const index = inner.index ?? 0;
|
|
1085
|
-
|
|
1086
|
-
|
|
1113
|
+
outputSvc.newTurn();
|
|
1114
|
+
claude.selectOption(index);
|
|
1087
1115
|
} else if (cmdType === "stop_task") {
|
|
1088
1116
|
claude.interrupt();
|
|
1089
1117
|
}
|