codeam-cli 1.1.8 → 1.2.0

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 +14 -21
  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.8",
113
+ version: "1.2.0",
114
114
  description: "Remote control Claude Code from your mobile device",
115
115
  main: "dist/index.js",
116
116
  bin: {
@@ -840,29 +840,22 @@ function renderToLines(raw) {
840
840
  }
841
841
  return screen;
842
842
  }
843
- function detectSelector(raw) {
844
- const stripped = raw.replace(/\x1B\[[^@-~]*[@-~]/g, "").replace(/\x1B\][^\x07\x1B]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[@-Z\\-_]/g, "");
845
- if (!stripped.includes("\u276F")) return null;
846
- const segments = stripped.split(/[\r\n]+/);
843
+ function detectSelector(lines) {
844
+ if (!lines.some((l) => l.includes("\u276F"))) return null;
847
845
  const optionMap = /* @__PURE__ */ new Map();
848
- let hasHighlight = false;
849
846
  let question = "";
850
- const optRe = /(?:(❯)\s*)?(\d+)\.\s+((?:(?!\s*\d+\.\s).)+)/g;
851
- for (const seg of segments) {
852
- if (!seg.trim()) continue;
853
- for (const m of seg.matchAll(optRe)) {
854
- if (m[1] === "\u276F") hasHighlight = true;
855
- const num = parseInt(m[2], 10);
856
- const label = m[3].replace(/\s+/g, " ").trim();
847
+ for (const line of lines) {
848
+ const t = line.trim();
849
+ if (!t) continue;
850
+ const m = t.match(/^(?:❯\s*)?(\d+)\.\s+(.+)/);
851
+ if (m) {
852
+ const num = parseInt(m[1], 10);
853
+ const label = m[2].trim();
857
854
  if (label && !optionMap.has(num)) optionMap.set(num, label);
855
+ continue;
858
856
  }
859
- const beforeOptions = seg.replace(/(?:❯\s*)?\d+\.\s+.*/g, "").trim();
860
- if (beforeOptions.endsWith("?")) {
861
- const q = beforeOptions.match(/([^?]+\?)$/);
862
- if (q) question = q[1].trim();
863
- }
857
+ if (t.endsWith("?")) question = t;
864
858
  }
865
- if (!hasHighlight) return null;
866
859
  const keys = [...optionMap.keys()].sort((a, b) => a - b);
867
860
  if (keys.length < 2 || keys[0] !== 1) return null;
868
861
  return { question, options: keys.map((k) => optionMap.get(k)) };
@@ -933,7 +926,7 @@ var OutputService = class _OutputService {
933
926
  return;
934
927
  }
935
928
  const lines = renderToLines(this.rawBuffer);
936
- const selector = detectSelector(this.rawBuffer);
929
+ const selector = detectSelector(lines);
937
930
  if (selector) {
938
931
  const idleMs2 = this.lastPushTime > 0 ? now - this.lastPushTime : elapsed;
939
932
  if (idleMs2 >= _OutputService.SELECTOR_IDLE_MS) {
@@ -962,7 +955,7 @@ var OutputService = class _OutputService {
962
955
  }
963
956
  finalize() {
964
957
  const lines = renderToLines(this.rawBuffer);
965
- const selector = detectSelector(this.rawBuffer);
958
+ const selector = detectSelector(lines);
966
959
  this.stopPoll();
967
960
  this.active = false;
968
961
  if (selector) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.1.8",
3
+ "version": "1.2.0",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {