codeam-cli 1.1.3 → 1.1.5

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 +28 -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.5",
114
114
  description: "Remote control Claude Code from your mobile device",
115
115
  main: "dist/index.js",
116
116
  bin: {
@@ -840,31 +840,32 @@ 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
+ const hasNavHint = /Enter to (?:select|enter)/i.test(stripped) || /↑\s*\/\s*↓\s*to\s*navigate/i.test(stripped);
846
+ if (!hasNavHint) return null;
847
+ const segments = stripped.split(/[\r\n]+/);
848
+ const optionMap = /* @__PURE__ */ new Map();
849
+ for (const seg of segments) {
850
+ const t = seg.trim();
850
851
  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;
852
+ const m = t.match(/^[❯>]?\s*(\d+)\.\s+(.+)/);
853
+ if (m) {
854
+ const num = parseInt(m[1], 10);
855
+ if (!optionMap.has(num)) optionMap.set(num, m[2].trim());
861
856
  }
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
857
  }
858
+ const options = [...optionMap.entries()].sort(([a], [b]) => a - b).map(([, label]) => label);
866
859
  if (options.length === 0) return null;
867
- return { question: questionLines.join("\n").trim(), options };
860
+ let question = "";
861
+ for (let i = segments.length - 1; i >= 0; i--) {
862
+ const t = segments[i].trim();
863
+ if (t.endsWith("?") && !/Enter to select/i.test(t) && !/^[❯>]?\s*\d+\./.test(t)) {
864
+ question = t;
865
+ break;
866
+ }
867
+ }
868
+ return { question, options };
868
869
  }
869
870
  function filterChrome(lines) {
870
871
  return lines.filter((line) => {
@@ -875,10 +876,12 @@ function filterChrome(lines) {
875
876
  if (/esc.{0,5}to.{0,5}interrupt/i.test(t)) return false;
876
877
  if (/high\s*[·•]\s*\/effort/i.test(t)) return false;
877
878
  if (/^[❯>]\s*$/.test(t)) return false;
878
- if (/^[❯>]\s+\S/.test(t)) return false;
879
+ if (/^[❯>]\s+\S/.test(t) && !/^[❯>]\s*\d+\./.test(t)) return false;
879
880
  if (/^\(thinking\)\s*$/.test(t)) return false;
880
881
  if (/^\?\s.*shortcut/i.test(t)) return false;
881
882
  if (/spending limit|usage limit/i.test(t) && t.length < 80) return false;
883
+ if (/Enter to (?:select|enter)/i.test(t)) return false;
884
+ if (/↑\s*\/\s*↓\s*to\s*navigate/i.test(t)) return false;
882
885
  return true;
883
886
  });
884
887
  }
@@ -931,7 +934,7 @@ var OutputService = class _OutputService {
931
934
  return;
932
935
  }
933
936
  const lines = renderToLines(this.rawBuffer);
934
- const selector = detectSelector(lines);
937
+ const selector = detectSelector(this.rawBuffer);
935
938
  if (selector) {
936
939
  const idleMs2 = this.lastPushTime > 0 ? now - this.lastPushTime : elapsed;
937
940
  if (idleMs2 >= _OutputService.SELECTOR_IDLE_MS) {
@@ -960,7 +963,7 @@ var OutputService = class _OutputService {
960
963
  }
961
964
  finalize() {
962
965
  const lines = renderToLines(this.rawBuffer);
963
- const selector = detectSelector(lines);
966
+ const selector = detectSelector(this.rawBuffer);
964
967
  this.stopPoll();
965
968
  this.active = false;
966
969
  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.5",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {