codeam-cli 1.1.9 → 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 +13 -17
  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.9",
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,25 +840,21 @@ 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
846
  let question = "";
849
- const optRe = /(?:❯\s*)?(\d+)\.\s+((?:(?!\s*\d+\.\s).)+)/g;
850
- for (const seg of segments) {
851
- if (!seg.trim()) continue;
852
- for (const m of seg.matchAll(optRe)) {
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) {
853
852
  const num = parseInt(m[1], 10);
854
- const label = m[2].replace(/\s+/g, " ").trim();
853
+ const label = m[2].trim();
855
854
  if (label && !optionMap.has(num)) optionMap.set(num, label);
855
+ continue;
856
856
  }
857
- const beforeOptions = seg.replace(/(?:❯\s*)?\d+\.\s+.*/g, "").trim();
858
- if (beforeOptions.endsWith("?")) {
859
- const q = beforeOptions.match(/([^?]+\?)$/);
860
- if (q) question = q[1].trim();
861
- }
857
+ if (t.endsWith("?")) question = t;
862
858
  }
863
859
  const keys = [...optionMap.keys()].sort((a, b) => a - b);
864
860
  if (keys.length < 2 || keys[0] !== 1) return null;
@@ -930,7 +926,7 @@ var OutputService = class _OutputService {
930
926
  return;
931
927
  }
932
928
  const lines = renderToLines(this.rawBuffer);
933
- const selector = detectSelector(this.rawBuffer);
929
+ const selector = detectSelector(lines);
934
930
  if (selector) {
935
931
  const idleMs2 = this.lastPushTime > 0 ? now - this.lastPushTime : elapsed;
936
932
  if (idleMs2 >= _OutputService.SELECTOR_IDLE_MS) {
@@ -959,7 +955,7 @@ var OutputService = class _OutputService {
959
955
  }
960
956
  finalize() {
961
957
  const lines = renderToLines(this.rawBuffer);
962
- const selector = detectSelector(this.rawBuffer);
958
+ const selector = detectSelector(lines);
963
959
  this.stopPoll();
964
960
  this.active = false;
965
961
  if (selector) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.1.9",
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": {