codeam-cli 1.3.2 → 1.3.4
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 +40 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -114,7 +114,7 @@ var import_picocolors = __toESM(require("picocolors"));
|
|
|
114
114
|
// package.json
|
|
115
115
|
var package_default = {
|
|
116
116
|
name: "codeam-cli",
|
|
117
|
-
version: "1.3.
|
|
117
|
+
version: "1.3.4",
|
|
118
118
|
description: "Remote control Claude Code from your mobile device",
|
|
119
119
|
main: "dist/index.js",
|
|
120
120
|
bin: {
|
|
@@ -873,24 +873,51 @@ function renderToLines(raw) {
|
|
|
873
873
|
return screen;
|
|
874
874
|
}
|
|
875
875
|
function detectSelector(lines) {
|
|
876
|
+
if (lines.some((l) => /\?\s+for\s+shortcuts/i.test(l.trim()))) return null;
|
|
876
877
|
if (!lines.some((l) => /^❯\s*\d+\./.test(l.trim()))) return null;
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
|
|
880
|
-
|
|
878
|
+
let optionStartIdx = -1;
|
|
879
|
+
for (let i = 0; i < lines.length; i++) {
|
|
880
|
+
if (/^(?:❯\s*)?\d+\.\s/.test(lines[i].trim())) {
|
|
881
|
+
optionStartIdx = i;
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (optionStartIdx === -1) return null;
|
|
886
|
+
const questionParts = [];
|
|
887
|
+
for (let i = 0; i < optionStartIdx; i++) {
|
|
888
|
+
const t = lines[i].trim();
|
|
889
|
+
if (!t) continue;
|
|
890
|
+
if (/^[─━—═\-]{3,}$/.test(t)) continue;
|
|
891
|
+
if (/^\[.*\]$/.test(t)) continue;
|
|
892
|
+
if (/^[>❯]\s/.test(t)) continue;
|
|
893
|
+
questionParts.push(t);
|
|
894
|
+
}
|
|
895
|
+
const question = questionParts.join(" ").trim();
|
|
896
|
+
const optionLabels = /* @__PURE__ */ new Map();
|
|
897
|
+
const optionDescs = /* @__PURE__ */ new Map();
|
|
898
|
+
let currentNum = -1;
|
|
899
|
+
for (let i = optionStartIdx; i < lines.length; i++) {
|
|
900
|
+
const t = lines[i].trim();
|
|
881
901
|
if (!t) continue;
|
|
882
902
|
const m = t.match(/^(?:❯\s*)?(\d+)\.\s+(.+)/);
|
|
883
903
|
if (m) {
|
|
884
904
|
const num = parseInt(m[1], 10);
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
905
|
+
if (!optionLabels.has(num)) {
|
|
906
|
+
optionLabels.set(num, m[2].trim());
|
|
907
|
+
optionDescs.set(num, []);
|
|
908
|
+
}
|
|
909
|
+
currentNum = num;
|
|
910
|
+
} else if (currentNum !== -1 && !/^Enter to/i.test(t) && !/^[─━—═\-]{3,}$/.test(t) && !/↑.*↓.*navigate/i.test(t) && !/Esc to cancel/i.test(t)) {
|
|
911
|
+
optionDescs.get(currentNum)?.push(t);
|
|
888
912
|
}
|
|
889
|
-
if (t.endsWith("?")) question = t;
|
|
890
913
|
}
|
|
891
|
-
const keys = [...
|
|
914
|
+
const keys = [...optionLabels.keys()].sort((a, b) => a - b);
|
|
892
915
|
if (keys.length < 2 || keys[0] !== 1) return null;
|
|
893
|
-
return {
|
|
916
|
+
return {
|
|
917
|
+
question,
|
|
918
|
+
options: keys.map((k) => optionLabels.get(k)),
|
|
919
|
+
optionDescriptions: keys.map((k) => (optionDescs.get(k) ?? []).join(" ").trim())
|
|
920
|
+
};
|
|
894
921
|
}
|
|
895
922
|
function filterChrome(lines) {
|
|
896
923
|
return lines.filter((line) => {
|
|
@@ -964,7 +991,7 @@ var OutputService = class _OutputService {
|
|
|
964
991
|
if (idleMs2 >= _OutputService.SELECTOR_IDLE_MS) {
|
|
965
992
|
this.stopPoll();
|
|
966
993
|
this.active = false;
|
|
967
|
-
this.postChunk({ type: "select_prompt", content: selector.question, options: selector.options, done: true }).catch(() => {
|
|
994
|
+
this.postChunk({ type: "select_prompt", content: selector.question, options: selector.options, optionDescriptions: selector.optionDescriptions, done: true }).catch(() => {
|
|
968
995
|
});
|
|
969
996
|
}
|
|
970
997
|
return;
|
|
@@ -991,7 +1018,7 @@ var OutputService = class _OutputService {
|
|
|
991
1018
|
this.stopPoll();
|
|
992
1019
|
this.active = false;
|
|
993
1020
|
if (selector) {
|
|
994
|
-
this.postChunk({ type: "select_prompt", content: selector.question, options: selector.options, done: true }).catch(() => {
|
|
1021
|
+
this.postChunk({ type: "select_prompt", content: selector.question, options: selector.options, optionDescriptions: selector.optionDescriptions, done: true }).catch(() => {
|
|
995
1022
|
});
|
|
996
1023
|
} else {
|
|
997
1024
|
const content = filterChrome(lines).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|