codeam-cli 1.1.3 → 1.1.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 +27 -25
  2. 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.1.3",
113
+ version: "1.1.4",
114
114
  description: "Remote control Claude Code from your mobile device",
115
115
  main: "dist/index.js",
116
116
  bin: {
@@ -840,31 +840,31 @@ function renderToLines(raw) {
840
840
  }
841
841
  return screen;
842
842
  }
843
- function detectSelector(lines) {
844
- const hasNav = lines.some((l) => /Enter to select.*↑.*↓.*navigate/i.test(l));
845
- if (!hasNav) return null;
846
- const options = [];
847
- const questionLines = [];
848
- for (const line of lines) {
849
- const t = line.trim();
843
+ function detectSelector(raw) {
844
+ const stripped = raw.replace(/\x1B\[[^@-~]*[@-~]/g, "").replace(/\x1B\][^\x07\x1B]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[@-Z\\-_]/g, "");
845
+ if (!/Enter to select/i.test(stripped)) return null;
846
+ const segments = stripped.split(/[\r\n]+/);
847
+ const optionMap = /* @__PURE__ */ new Map();
848
+ for (const seg of segments) {
849
+ const t = seg.trim();
850
850
  if (!t) continue;
851
- if (/^[─━—═]{3,}$/.test(t)) continue;
852
- if (/^[✳✢✶✻✽⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]\s/.test(t)) continue;
853
- if (/esc.{0,5}to.{0,5}interrupt/i.test(t)) continue;
854
- if (/high\s*[·•]\s*\/effort/i.test(t)) continue;
855
- if (/Enter to select/i.test(t)) continue;
856
- if (/^[❯>]\s*$/.test(t)) continue;
857
- const optMatch = t.match(/^[❯>]?\s*(\d+)\.\s+(.+)/);
858
- if (optMatch) {
859
- options.push(optMatch[2].trim());
860
- continue;
851
+ const m = t.match(/^[❯>]?\s*(\d+)\.\s+(.+)/);
852
+ if (m) {
853
+ const num = parseInt(m[1], 10);
854
+ if (!optionMap.has(num)) optionMap.set(num, m[2].trim());
861
855
  }
862
- if (line.length > 0 && (line[0] === " " || line[0] === " ") && line.trim().length > 0) continue;
863
- if (/^[❯>]\s+\S/.test(t)) continue;
864
- questionLines.push(t);
865
856
  }
857
+ const options = [...optionMap.entries()].sort(([a], [b]) => a - b).map(([, label]) => label);
866
858
  if (options.length === 0) return null;
867
- return { question: questionLines.join("\n").trim(), options };
859
+ let question = "";
860
+ for (let i = segments.length - 1; i >= 0; i--) {
861
+ const t = segments[i].trim();
862
+ if (t.endsWith("?") && !/Enter to select/i.test(t) && !/^[❯>]?\s*\d+\./.test(t)) {
863
+ question = t;
864
+ break;
865
+ }
866
+ }
867
+ return { question, options };
868
868
  }
869
869
  function filterChrome(lines) {
870
870
  return lines.filter((line) => {
@@ -875,10 +875,12 @@ function filterChrome(lines) {
875
875
  if (/esc.{0,5}to.{0,5}interrupt/i.test(t)) return false;
876
876
  if (/high\s*[·•]\s*\/effort/i.test(t)) return false;
877
877
  if (/^[❯>]\s*$/.test(t)) return false;
878
- if (/^[❯>]\s+\S/.test(t)) return false;
878
+ if (/^[❯>]\s+\S/.test(t) && !/^[❯>]\s*\d+\./.test(t)) return false;
879
879
  if (/^\(thinking\)\s*$/.test(t)) return false;
880
880
  if (/^\?\s.*shortcut/i.test(t)) return false;
881
881
  if (/spending limit|usage limit/i.test(t) && t.length < 80) return false;
882
+ if (/Enter to select/i.test(t)) return false;
883
+ if (/↑\s*\/\s*↓\s*to\s*navigate/i.test(t)) return false;
882
884
  return true;
883
885
  });
884
886
  }
@@ -931,7 +933,7 @@ var OutputService = class _OutputService {
931
933
  return;
932
934
  }
933
935
  const lines = renderToLines(this.rawBuffer);
934
- const selector = detectSelector(lines);
936
+ const selector = detectSelector(this.rawBuffer);
935
937
  if (selector) {
936
938
  const idleMs2 = this.lastPushTime > 0 ? now - this.lastPushTime : elapsed;
937
939
  if (idleMs2 >= _OutputService.SELECTOR_IDLE_MS) {
@@ -960,7 +962,7 @@ var OutputService = class _OutputService {
960
962
  }
961
963
  finalize() {
962
964
  const lines = renderToLines(this.rawBuffer);
963
- const selector = detectSelector(lines);
965
+ const selector = detectSelector(this.rawBuffer);
964
966
  this.stopPoll();
965
967
  this.active = false;
966
968
  if (selector) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {