codeam-cli 1.3.3 → 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.
Files changed (2) hide show
  1. package/dist/index.js +39 -13
  2. 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.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: {
@@ -875,23 +875,49 @@ function renderToLines(raw) {
875
875
  function detectSelector(lines) {
876
876
  if (lines.some((l) => /\?\s+for\s+shortcuts/i.test(l.trim()))) return null;
877
877
  if (!lines.some((l) => /^❯\s*\d+\./.test(l.trim()))) return null;
878
- const optionMap = /* @__PURE__ */ new Map();
879
- let question = "";
880
- for (const line of lines) {
881
- const t = line.trim();
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();
882
901
  if (!t) continue;
883
902
  const m = t.match(/^(?:❯\s*)?(\d+)\.\s+(.+)/);
884
903
  if (m) {
885
904
  const num = parseInt(m[1], 10);
886
- const label = m[2].trim();
887
- if (label && !optionMap.has(num)) optionMap.set(num, label);
888
- continue;
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);
889
912
  }
890
- if (t.endsWith("?")) question = t;
891
913
  }
892
- const keys = [...optionMap.keys()].sort((a, b) => a - b);
914
+ const keys = [...optionLabels.keys()].sort((a, b) => a - b);
893
915
  if (keys.length < 2 || keys[0] !== 1) return null;
894
- return { question, options: keys.map((k) => optionMap.get(k)) };
916
+ return {
917
+ question,
918
+ options: keys.map((k) => optionLabels.get(k)),
919
+ optionDescriptions: keys.map((k) => (optionDescs.get(k) ?? []).join(" ").trim())
920
+ };
895
921
  }
896
922
  function filterChrome(lines) {
897
923
  return lines.filter((line) => {
@@ -965,7 +991,7 @@ var OutputService = class _OutputService {
965
991
  if (idleMs2 >= _OutputService.SELECTOR_IDLE_MS) {
966
992
  this.stopPoll();
967
993
  this.active = false;
968
- 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(() => {
969
995
  });
970
996
  }
971
997
  return;
@@ -992,7 +1018,7 @@ var OutputService = class _OutputService {
992
1018
  this.stopPoll();
993
1019
  this.active = false;
994
1020
  if (selector) {
995
- 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(() => {
996
1022
  });
997
1023
  } else {
998
1024
  const content = filterChrome(lines).join("\n").replace(/\n{3,}/g, "\n\n").trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {