codeam-cli 1.2.0 → 1.2.1
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 +29 -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.1",
|
|
114
114
|
description: "Remote control Claude Code from your mobile device",
|
|
115
115
|
main: "dist/index.js",
|
|
116
116
|
bin: {
|
|
@@ -678,6 +678,30 @@ 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 just sendCommand(arrows)? When all arrow keys + Enter arrive in one
|
|
685
|
+
* write() call, Node's readline splits them into individual keypress events that
|
|
686
|
+
* all fire in the same synchronous run. React Ink's SelectInput captures
|
|
687
|
+
* selectedIndex in a closure — because React hasn't re-rendered between the
|
|
688
|
+
* arrows and the Enter, the closure still sees the initial index (0) when Enter
|
|
689
|
+
* fires, so it always submits option 0.
|
|
690
|
+
*
|
|
691
|
+
* Fix: send the arrows first, then wait 150 ms for React to process + re-render,
|
|
692
|
+
* then send the confirming Enter.
|
|
693
|
+
*/
|
|
694
|
+
selectOption(index) {
|
|
695
|
+
const arrows = "\x1B[B".repeat(Math.max(0, index));
|
|
696
|
+
if (arrows) {
|
|
697
|
+
this.proc?.stdin?.write(arrows);
|
|
698
|
+
setTimeout(() => {
|
|
699
|
+
this.proc?.stdin?.write("\r");
|
|
700
|
+
}, 150);
|
|
701
|
+
} else {
|
|
702
|
+
this.proc?.stdin?.write("\r");
|
|
703
|
+
}
|
|
704
|
+
}
|
|
681
705
|
/** Send Ctrl+C to Claude. */
|
|
682
706
|
interrupt() {
|
|
683
707
|
this.proc?.stdin?.write("");
|
|
@@ -1056,8 +1080,8 @@ async function start() {
|
|
|
1056
1080
|
}
|
|
1057
1081
|
case "select_option": {
|
|
1058
1082
|
const index = cmd.payload.index ?? 0;
|
|
1059
|
-
|
|
1060
|
-
|
|
1083
|
+
outputSvc.newTurn();
|
|
1084
|
+
claude.selectOption(index);
|
|
1061
1085
|
break;
|
|
1062
1086
|
}
|
|
1063
1087
|
case "stop_task":
|
|
@@ -1082,8 +1106,8 @@ async function start() {
|
|
|
1082
1106
|
if (input) sendPrompt(input);
|
|
1083
1107
|
} else if (cmdType === "select_option") {
|
|
1084
1108
|
const index = inner.index ?? 0;
|
|
1085
|
-
|
|
1086
|
-
|
|
1109
|
+
outputSvc.newTurn();
|
|
1110
|
+
claude.selectOption(index);
|
|
1087
1111
|
} else if (cmdType === "stop_task") {
|
|
1088
1112
|
claude.interrupt();
|
|
1089
1113
|
}
|