@ridit/lens 0.3.1 → 0.3.3

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.
package/dist/index.mjs CHANGED
@@ -194362,14 +194362,14 @@ var require_gifutil = __commonJS((exports) => {
194362
194362
  jimpImage.bitmap.data = bitmapImageToShare.bitmap.data;
194363
194363
  return jimpImage;
194364
194364
  };
194365
- exports.write = function(path22, frames, spec, encoder) {
194365
+ exports.write = function(path24, frames, spec, encoder) {
194366
194366
  encoder = encoder || defaultCodec;
194367
- const matches2 = path22.match(/\.[a-zA-Z]+$/);
194367
+ const matches2 = path24.match(/\.[a-zA-Z]+$/);
194368
194368
  if (matches2 !== null && INVALID_SUFFIXES.includes(matches2[0].toLowerCase())) {
194369
- throw new Error(`GIF '${path22}' has an unexpected suffix`);
194369
+ throw new Error(`GIF '${path24}' has an unexpected suffix`);
194370
194370
  }
194371
194371
  return encoder.encodeGif(frames, spec).then((gif) => {
194372
- return _writeBinary(path22, gif.buffer).then(() => {
194372
+ return _writeBinary(path24, gif.buffer).then(() => {
194373
194373
  return gif;
194374
194374
  });
194375
194375
  });
@@ -194431,9 +194431,9 @@ var require_gifutil = __commonJS((exports) => {
194431
194431
  }
194432
194432
  }
194433
194433
  }
194434
- function _readBinary(path22) {
194434
+ function _readBinary(path24) {
194435
194435
  return new Promise((resolve2, reject3) => {
194436
- fs4.readFile(path22, (err, buffer) => {
194436
+ fs4.readFile(path24, (err, buffer) => {
194437
194437
  if (err) {
194438
194438
  return reject3(err);
194439
194439
  }
@@ -194441,9 +194441,9 @@ var require_gifutil = __commonJS((exports) => {
194441
194441
  });
194442
194442
  });
194443
194443
  }
194444
- function _writeBinary(path22, buffer) {
194444
+ function _writeBinary(path24, buffer) {
194445
194445
  return new Promise((resolve2, reject3) => {
194446
- fs4.writeFile(path22, buffer, (err) => {
194446
+ fs4.writeFile(path24, buffer, (err) => {
194447
194447
  if (err) {
194448
194448
  return reject3(err);
194449
194449
  }
@@ -196396,9 +196396,9 @@ var require_decoder = __commonJS((exports, module) => {
196396
196396
  return a < 0 ? 0 : a > 255 ? 255 : a;
196397
196397
  }
196398
196398
  constructor.prototype = {
196399
- load: function load(path22) {
196399
+ load: function load(path24) {
196400
196400
  var xhr = new XMLHttpRequest;
196401
- xhr.open("GET", path22, true);
196401
+ xhr.open("GET", path24, true);
196402
196402
  xhr.responseType = "arraybuffer";
196403
196403
  xhr.onload = function() {
196404
196404
  var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);
@@ -207197,8 +207197,8 @@ class ParseStatus {
207197
207197
  }
207198
207198
  }
207199
207199
  var makeIssue = (params) => {
207200
- const { data, path: path22, errorMaps, issueData } = params;
207201
- const fullPath = [...path22, ...issueData.path || []];
207200
+ const { data, path: path24, errorMaps, issueData } = params;
207201
+ const fullPath = [...path24, ...issueData.path || []];
207202
207202
  const fullIssue = {
207203
207203
  ...issueData,
207204
207204
  path: fullPath
@@ -207244,11 +207244,11 @@ var init_errorUtil = __esm(() => {
207244
207244
 
207245
207245
  // node_modules/zod/v3/types.js
207246
207246
  class ParseInputLazyPath {
207247
- constructor(parent, value, path22, key) {
207247
+ constructor(parent, value, path24, key) {
207248
207248
  this._cachedPath = [];
207249
207249
  this.parent = parent;
207250
207250
  this.data = value;
207251
- this._path = path22;
207251
+ this._path = path24;
207252
207252
  this._key = key;
207253
207253
  }
207254
207254
  get path() {
@@ -214366,7 +214366,7 @@ var require_await_to_js_umd = __commonJS((exports, module) => {
214366
214366
 
214367
214367
  // node_modules/@jimp/file-ops/dist/esm/index.js
214368
214368
  import { promises as fs4 } from "fs";
214369
- import { existsSync as existsSync17 } from "fs";
214369
+ import { existsSync as existsSync19 } from "fs";
214370
214370
  var readFile2, writeFile2;
214371
214371
  var init_esm13 = __esm(() => {
214372
214372
  readFile2 = fs4.readFile;
@@ -214407,11 +214407,11 @@ var require_Mime = __commonJS((exports, module) => {
214407
214407
  }
214408
214408
  }
214409
214409
  };
214410
- Mime.prototype.getType = function(path22) {
214411
- path22 = String(path22);
214412
- let last2 = path22.replace(/^.*[/\\]/, "").toLowerCase();
214410
+ Mime.prototype.getType = function(path24) {
214411
+ path24 = String(path24);
214412
+ let last2 = path24.replace(/^.*[/\\]/, "").toLowerCase();
214413
214413
  let ext = last2.replace(/^.*\./, "").toLowerCase();
214414
- let hasPath = last2.length < path22.length;
214414
+ let hasPath = last2.length < path24.length;
214415
214415
  let hasDot = ext.length < last2.length - 1;
214416
214416
  return (hasDot || !hasPath) && this._types[ext] || null;
214417
214417
  };
@@ -216062,7 +216062,7 @@ function createJimp({ plugins: pluginsArg, formats: formatsArg } = {}) {
216062
216062
  if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) {
216063
216063
  return this.fromBuffer(url);
216064
216064
  }
216065
- if (existsSync17(url)) {
216065
+ if (existsSync19(url)) {
216066
216066
  return this.fromBuffer(await readFile2(url));
216067
216067
  }
216068
216068
  const [fetchErr, response] = await import_await_to_js.to(fetch(url));
@@ -216151,9 +216151,9 @@ function createJimp({ plugins: pluginsArg, formats: formatsArg } = {}) {
216151
216151
  const data = await this.getBuffer(mime2, options);
216152
216152
  return "data:" + mime2 + ";base64," + data.toString("base64");
216153
216153
  }
216154
- async write(path22, options) {
216155
- const mimeType = import_lite.default.getType(path22);
216156
- await writeFile2(path22, await this.getBuffer(mimeType, options));
216154
+ async write(path24, options) {
216155
+ const mimeType = import_lite.default.getType(path24);
216156
+ await writeFile2(path24, await this.getBuffer(mimeType, options));
216157
216157
  }
216158
216158
  clone() {
216159
216159
  return new CustomJimp({
@@ -226590,7 +226590,7 @@ var require_windows = __commonJS((exports, module) => {
226590
226590
  module.exports = isexe;
226591
226591
  isexe.sync = sync;
226592
226592
  var fs5 = __require("fs");
226593
- function checkPathExt(path22, options) {
226593
+ function checkPathExt(path24, options) {
226594
226594
  var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
226595
226595
  if (!pathext) {
226596
226596
  return true;
@@ -226601,25 +226601,25 @@ var require_windows = __commonJS((exports, module) => {
226601
226601
  }
226602
226602
  for (var i = 0;i < pathext.length; i++) {
226603
226603
  var p = pathext[i].toLowerCase();
226604
- if (p && path22.substr(-p.length).toLowerCase() === p) {
226604
+ if (p && path24.substr(-p.length).toLowerCase() === p) {
226605
226605
  return true;
226606
226606
  }
226607
226607
  }
226608
226608
  return false;
226609
226609
  }
226610
- function checkStat(stat, path22, options) {
226610
+ function checkStat(stat, path24, options) {
226611
226611
  if (!stat.isSymbolicLink() && !stat.isFile()) {
226612
226612
  return false;
226613
226613
  }
226614
- return checkPathExt(path22, options);
226614
+ return checkPathExt(path24, options);
226615
226615
  }
226616
- function isexe(path22, options, cb) {
226617
- fs5.stat(path22, function(er, stat) {
226618
- cb(er, er ? false : checkStat(stat, path22, options));
226616
+ function isexe(path24, options, cb) {
226617
+ fs5.stat(path24, function(er, stat) {
226618
+ cb(er, er ? false : checkStat(stat, path24, options));
226619
226619
  });
226620
226620
  }
226621
- function sync(path22, options) {
226622
- return checkStat(fs5.statSync(path22), path22, options);
226621
+ function sync(path24, options) {
226622
+ return checkStat(fs5.statSync(path24), path24, options);
226623
226623
  }
226624
226624
  });
226625
226625
 
@@ -226628,13 +226628,13 @@ var require_mode = __commonJS((exports, module) => {
226628
226628
  module.exports = isexe;
226629
226629
  isexe.sync = sync;
226630
226630
  var fs5 = __require("fs");
226631
- function isexe(path22, options, cb) {
226632
- fs5.stat(path22, function(er, stat) {
226631
+ function isexe(path24, options, cb) {
226632
+ fs5.stat(path24, function(er, stat) {
226633
226633
  cb(er, er ? false : checkStat(stat, options));
226634
226634
  });
226635
226635
  }
226636
- function sync(path22, options) {
226637
- return checkStat(fs5.statSync(path22), options);
226636
+ function sync(path24, options) {
226637
+ return checkStat(fs5.statSync(path24), options);
226638
226638
  }
226639
226639
  function checkStat(stat, options) {
226640
226640
  return stat.isFile() && checkMode(stat, options);
@@ -226665,7 +226665,7 @@ var require_isexe = __commonJS((exports, module) => {
226665
226665
  }
226666
226666
  module.exports = isexe;
226667
226667
  isexe.sync = sync;
226668
- function isexe(path22, options, cb) {
226668
+ function isexe(path24, options, cb) {
226669
226669
  if (typeof options === "function") {
226670
226670
  cb = options;
226671
226671
  options = {};
@@ -226675,7 +226675,7 @@ var require_isexe = __commonJS((exports, module) => {
226675
226675
  throw new TypeError("callback not provided");
226676
226676
  }
226677
226677
  return new Promise(function(resolve2, reject3) {
226678
- isexe(path22, options || {}, function(er, is) {
226678
+ isexe(path24, options || {}, function(er, is) {
226679
226679
  if (er) {
226680
226680
  reject3(er);
226681
226681
  } else {
@@ -226684,7 +226684,7 @@ var require_isexe = __commonJS((exports, module) => {
226684
226684
  });
226685
226685
  });
226686
226686
  }
226687
- core(path22, options || {}, function(er, is) {
226687
+ core(path24, options || {}, function(er, is) {
226688
226688
  if (er) {
226689
226689
  if (er.code === "EACCES" || options && options.ignoreErrors) {
226690
226690
  er = null;
@@ -226694,9 +226694,9 @@ var require_isexe = __commonJS((exports, module) => {
226694
226694
  cb(er, is);
226695
226695
  });
226696
226696
  }
226697
- function sync(path22, options) {
226697
+ function sync(path24, options) {
226698
226698
  try {
226699
- return core.sync(path22, options || {});
226699
+ return core.sync(path24, options || {});
226700
226700
  } catch (er) {
226701
226701
  if (options && options.ignoreErrors || er.code === "EACCES") {
226702
226702
  return false;
@@ -226710,7 +226710,7 @@ var require_isexe = __commonJS((exports, module) => {
226710
226710
  // node_modules/which/which.js
226711
226711
  var require_which = __commonJS((exports, module) => {
226712
226712
  var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
226713
- var path22 = __require("path");
226713
+ var path24 = __require("path");
226714
226714
  var COLON = isWindows3 ? ";" : ":";
226715
226715
  var isexe = require_isexe();
226716
226716
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -226746,7 +226746,7 @@ var require_which = __commonJS((exports, module) => {
226746
226746
  return opt.all && found.length ? resolve2(found) : reject3(getNotFoundError(cmd));
226747
226747
  const ppRaw = pathEnv[i];
226748
226748
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
226749
- const pCmd = path22.join(pathPart, cmd);
226749
+ const pCmd = path24.join(pathPart, cmd);
226750
226750
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
226751
226751
  resolve2(subStep(p, i, 0));
226752
226752
  });
@@ -226773,7 +226773,7 @@ var require_which = __commonJS((exports, module) => {
226773
226773
  for (let i = 0;i < pathEnv.length; i++) {
226774
226774
  const ppRaw = pathEnv[i];
226775
226775
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
226776
- const pCmd = path22.join(pathPart, cmd);
226776
+ const pCmd = path24.join(pathPart, cmd);
226777
226777
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
226778
226778
  for (let j = 0;j < pathExt.length; j++) {
226779
226779
  const cur = p + pathExt[j];
@@ -226814,7 +226814,7 @@ var require_path_key = __commonJS((exports, module) => {
226814
226814
 
226815
226815
  // node_modules/cross-spawn/lib/util/resolveCommand.js
226816
226816
  var require_resolveCommand = __commonJS((exports, module) => {
226817
- var path22 = __require("path");
226817
+ var path24 = __require("path");
226818
226818
  var which = require_which();
226819
226819
  var getPathKey = require_path_key();
226820
226820
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -226831,7 +226831,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
226831
226831
  try {
226832
226832
  resolved = which.sync(parsed.command, {
226833
226833
  path: env3[getPathKey({ env: env3 })],
226834
- pathExt: withoutPathExt ? path22.delimiter : undefined
226834
+ pathExt: withoutPathExt ? path24.delimiter : undefined
226835
226835
  });
226836
226836
  } catch (e) {} finally {
226837
226837
  if (shouldSwitchCwd) {
@@ -226839,7 +226839,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
226839
226839
  }
226840
226840
  }
226841
226841
  if (resolved) {
226842
- resolved = path22.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
226842
+ resolved = path24.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
226843
226843
  }
226844
226844
  return resolved;
226845
226845
  }
@@ -226884,8 +226884,8 @@ var require_shebang_command = __commonJS((exports, module) => {
226884
226884
  if (!match) {
226885
226885
  return null;
226886
226886
  }
226887
- const [path22, argument] = match[0].replace(/#! ?/, "").split(" ");
226888
- const binary = path22.split("/").pop();
226887
+ const [path24, argument] = match[0].replace(/#! ?/, "").split(" ");
226888
+ const binary = path24.split("/").pop();
226889
226889
  if (binary === "env") {
226890
226890
  return argument;
226891
226891
  }
@@ -226913,7 +226913,7 @@ var require_readShebang = __commonJS((exports, module) => {
226913
226913
 
226914
226914
  // node_modules/cross-spawn/lib/parse.js
226915
226915
  var require_parse = __commonJS((exports, module) => {
226916
- var path22 = __require("path");
226916
+ var path24 = __require("path");
226917
226917
  var resolveCommand = require_resolveCommand();
226918
226918
  var escape4 = require_escape();
226919
226919
  var readShebang = require_readShebang();
@@ -226938,7 +226938,7 @@ var require_parse = __commonJS((exports, module) => {
226938
226938
  const needsShell = !isExecutableRegExp.test(commandFile);
226939
226939
  if (parsed.options.forceShell || needsShell) {
226940
226940
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
226941
- parsed.command = path22.normalize(parsed.command);
226941
+ parsed.command = path24.normalize(parsed.command);
226942
226942
  parsed.command = escape4.command(parsed.command);
226943
226943
  parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
226944
226944
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -227022,7 +227022,7 @@ var require_cross_spawn = __commonJS((exports, module) => {
227022
227022
  var cp = __require("child_process");
227023
227023
  var parse = require_parse();
227024
227024
  var enoent = require_enoent();
227025
- function spawn2(command, args, options) {
227025
+ function spawn3(command, args, options) {
227026
227026
  const parsed = parse(command, args, options);
227027
227027
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
227028
227028
  enoent.hookChildProcess(spawned, parsed);
@@ -227034,8 +227034,8 @@ var require_cross_spawn = __commonJS((exports, module) => {
227034
227034
  result2.error = result2.error || enoent.verifyENOENTSync(result2.status, parsed);
227035
227035
  return result2;
227036
227036
  }
227037
- module.exports = spawn2;
227038
- module.exports.spawn = spawn2;
227037
+ module.exports = spawn3;
227038
+ module.exports.spawn = spawn3;
227039
227039
  module.exports.sync = spawnSync;
227040
227040
  module.exports._parse = parse;
227041
227041
  module.exports._enoent = enoent;
@@ -227060,7 +227060,7 @@ var require_strip_final_newline = __commonJS((exports, module) => {
227060
227060
 
227061
227061
  // node_modules/npm-run-path/index.js
227062
227062
  var require_npm_run_path = __commonJS((exports, module) => {
227063
- var path22 = __require("path");
227063
+ var path24 = __require("path");
227064
227064
  var pathKey = require_path_key();
227065
227065
  var npmRunPath = (options) => {
227066
227066
  options = {
@@ -227070,16 +227070,16 @@ var require_npm_run_path = __commonJS((exports, module) => {
227070
227070
  ...options
227071
227071
  };
227072
227072
  let previous;
227073
- let cwdPath = path22.resolve(options.cwd);
227073
+ let cwdPath = path24.resolve(options.cwd);
227074
227074
  const result2 = [];
227075
227075
  while (previous !== cwdPath) {
227076
- result2.push(path22.join(cwdPath, "node_modules/.bin"));
227076
+ result2.push(path24.join(cwdPath, "node_modules/.bin"));
227077
227077
  previous = cwdPath;
227078
- cwdPath = path22.resolve(cwdPath, "..");
227078
+ cwdPath = path24.resolve(cwdPath, "..");
227079
227079
  }
227080
- const execPathDir = path22.resolve(options.cwd, options.execPath, "..");
227080
+ const execPathDir = path24.resolve(options.cwd, options.execPath, "..");
227081
227081
  result2.push(execPathDir);
227082
- return result2.concat(options.path).join(path22.delimiter);
227082
+ return result2.concat(options.path).join(path24.delimiter);
227083
227083
  };
227084
227084
  module.exports = npmRunPath;
227085
227085
  module.exports.default = npmRunPath;
@@ -227089,9 +227089,9 @@ var require_npm_run_path = __commonJS((exports, module) => {
227089
227089
  ...options
227090
227090
  };
227091
227091
  const env3 = { ...options.env };
227092
- const path23 = pathKey({ env: env3 });
227093
- options.path = env3[path23];
227094
- env3[path23] = module.exports(options);
227092
+ const path25 = pathKey({ env: env3 });
227093
+ options.path = env3[path25];
227094
+ env3[path25] = module.exports(options);
227095
227095
  return env3;
227096
227096
  };
227097
227097
  });
@@ -227980,7 +227980,7 @@ var require_command2 = __commonJS((exports, module) => {
227980
227980
 
227981
227981
  // node_modules/execa/index.js
227982
227982
  var require_execa = __commonJS((exports, module) => {
227983
- var path22 = __require("path");
227983
+ var path24 = __require("path");
227984
227984
  var childProcess = __require("child_process");
227985
227985
  var crossSpawn = require_cross_spawn();
227986
227986
  var stripFinalNewline = require_strip_final_newline();
@@ -228022,7 +228022,7 @@ var require_execa = __commonJS((exports, module) => {
228022
228022
  };
228023
228023
  options.env = getEnv(options);
228024
228024
  options.stdio = normalizeStdio(options);
228025
- if (process.platform === "win32" && path22.basename(file, ".exe") === "cmd") {
228025
+ if (process.platform === "win32" && path24.basename(file, ".exe") === "cmd") {
228026
228026
  args.unshift("/q");
228027
228027
  }
228028
228028
  return { file, args, options, parsed };
@@ -228201,7 +228201,7 @@ var require_execa = __commonJS((exports, module) => {
228201
228201
 
228202
228202
  // node_modules/app-path/index.js
228203
228203
  import { fileURLToPath } from "node:url";
228204
- import path22 from "node:path";
228204
+ import path24 from "node:path";
228205
228205
  async function appPath(appName) {
228206
228206
  if (process.platform !== "darwin") {
228207
228207
  throw new Error("macOS only");
@@ -228224,7 +228224,7 @@ var import_execa, dirname, improveError = (error) => {
228224
228224
  };
228225
228225
  var init_app_path = __esm(() => {
228226
228226
  import_execa = __toESM(require_execa(), 1);
228227
- dirname = path22.dirname(fileURLToPath(import.meta.url));
228227
+ dirname = path24.dirname(fileURLToPath(import.meta.url));
228228
228228
  appPath.sync = (appName) => {
228229
228229
  if (process.platform !== "darwin") {
228230
228230
  throw new Error("macOS only");
@@ -236391,7 +236391,7 @@ var require_plist = __commonJS((exports) => {
236391
236391
  });
236392
236392
 
236393
236393
  // node_modules/iterm2-version/index.js
236394
- import path23 from "node:path";
236394
+ import path25 from "node:path";
236395
236395
  import fs5 from "node:fs";
236396
236396
  function iterm2Version() {
236397
236397
  if (process.platform !== "darwin") {
@@ -236401,7 +236401,7 @@ function iterm2Version() {
236401
236401
  if (process.env.TERM_PROGRAM === "iTerm.app" && process.env.TERM_PROGRAM_VERSION) {
236402
236402
  version = process.env.TERM_PROGRAM_VERSION;
236403
236403
  } else {
236404
- const filePath = path23.join(appPath.sync("iTerm"), "Contents/Info.plist");
236404
+ const filePath = path25.join(appPath.sync("iTerm"), "Contents/Info.plist");
236405
236405
  version = import_plist.default.parse(fs5.readFileSync(filePath, "utf8")).CFBundleVersion;
236406
236406
  }
236407
236407
  }
@@ -237245,7 +237245,7 @@ var require_dist = __commonJS((exports) => {
237245
237245
 
237246
237246
  // node_modules/mkdirp/index.js
237247
237247
  var require_mkdirp = __commonJS((exports, module) => {
237248
- var path24 = __require("path");
237248
+ var path26 = __require("path");
237249
237249
  var fs7 = __require("fs");
237250
237250
  var _0777 = parseInt("0777", 8);
237251
237251
  module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
@@ -237264,7 +237264,7 @@ var require_mkdirp = __commonJS((exports, module) => {
237264
237264
  if (!made)
237265
237265
  made = null;
237266
237266
  var cb = f || function() {};
237267
- p = path24.resolve(p);
237267
+ p = path26.resolve(p);
237268
237268
  xfs.mkdir(p, mode, function(er) {
237269
237269
  if (!er) {
237270
237270
  made = made || p;
@@ -237272,9 +237272,9 @@ var require_mkdirp = __commonJS((exports, module) => {
237272
237272
  }
237273
237273
  switch (er.code) {
237274
237274
  case "ENOENT":
237275
- if (path24.dirname(p) === p)
237275
+ if (path26.dirname(p) === p)
237276
237276
  return cb(er);
237277
- mkdirP(path24.dirname(p), opts, function(er2, made2) {
237277
+ mkdirP(path26.dirname(p), opts, function(er2, made2) {
237278
237278
  if (er2)
237279
237279
  cb(er2, made2);
237280
237280
  else
@@ -237303,14 +237303,14 @@ var require_mkdirp = __commonJS((exports, module) => {
237303
237303
  }
237304
237304
  if (!made)
237305
237305
  made = null;
237306
- p = path24.resolve(p);
237306
+ p = path26.resolve(p);
237307
237307
  try {
237308
237308
  xfs.mkdirSync(p, mode);
237309
237309
  made = made || p;
237310
237310
  } catch (err0) {
237311
237311
  switch (err0.code) {
237312
237312
  case "ENOENT":
237313
- made = sync(path24.dirname(p), opts, made);
237313
+ made = sync(path26.dirname(p), opts, made);
237314
237314
  sync(p, opts, made);
237315
237315
  break;
237316
237316
  default:
@@ -239092,8 +239092,8 @@ var require_mime = __commonJS((exports) => {
239092
239092
  mimeTypes[mime2] = extensions;
239093
239093
  };
239094
239094
  exports.addType = addType;
239095
- var getType = function getType2(path24) {
239096
- var pathParts = path24.split("/").slice(-1);
239095
+ var getType = function getType2(path26) {
239096
+ var pathParts = path26.split("/").slice(-1);
239097
239097
  var extension = pathParts[pathParts.length - 1].split(".").pop();
239098
239098
  var type = findType(extension);
239099
239099
  return type[0];
@@ -239746,13 +239746,13 @@ var require_image_bitmap = __commonJS((exports) => {
239746
239746
  var constants6 = _interopRequireWildcard(require_constants5());
239747
239747
  var MIME = _interopRequireWildcard(require_mime());
239748
239748
  var _promisify = _interopRequireDefault(require_promisify());
239749
- function getMIMEFromBuffer(buffer, path24) {
239749
+ function getMIMEFromBuffer(buffer, path26) {
239750
239750
  var fileTypeFromBuffer = (0, _fileType["default"])(buffer);
239751
239751
  if (fileTypeFromBuffer) {
239752
239752
  return fileTypeFromBuffer.mime;
239753
239753
  }
239754
- if (path24) {
239755
- return MIME.getType(path24);
239754
+ if (path26) {
239755
+ return MIME.getType(path26);
239756
239756
  }
239757
239757
  return null;
239758
239758
  }
@@ -239823,10 +239823,10 @@ var require_image_bitmap = __commonJS((exports) => {
239823
239823
  var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;
239824
239824
  transformBitmap2(img, newWidth, newHeight, transformation);
239825
239825
  }
239826
- function parseBitmap(data, path24, cb) {
239827
- var mime2 = getMIMEFromBuffer(data, path24);
239826
+ function parseBitmap(data, path26, cb) {
239827
+ var mime2 = getMIMEFromBuffer(data, path26);
239828
239828
  if (typeof mime2 !== "string") {
239829
- return cb(new Error("Could not find MIME for Buffer <" + path24 + ">"));
239829
+ return cb(new Error("Could not find MIME for Buffer <" + path26 + ">"));
239830
239830
  }
239831
239831
  this._originalMime = mime2.toLowerCase();
239832
239832
  try {
@@ -240003,8 +240003,8 @@ var require_dist2 = __commonJS((exports) => {
240003
240003
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp3.MIME_PNG);
240004
240004
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null);
240005
240005
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true);
240006
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function(path25) {
240007
- return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path25);
240006
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function(path27) {
240007
+ return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path27);
240008
240008
  });
240009
240009
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function(mime2) {
240010
240010
  return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime2);
@@ -240107,7 +240107,7 @@ var require_dist2 = __commonJS((exports) => {
240107
240107
  };
240108
240108
  finish(null, (0, _assertThisInitialized2["default"])(_this));
240109
240109
  } else if (typeof args[0] === "string") {
240110
- var path24 = args[0];
240110
+ var path26 = args[0];
240111
240111
  cb = args[1];
240112
240112
  if (typeof cb === "undefined") {
240113
240113
  cb = noop3;
@@ -240115,11 +240115,11 @@ var require_dist2 = __commonJS((exports) => {
240115
240115
  if (typeof cb !== "function") {
240116
240116
  return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), "cb must be a function", finish));
240117
240117
  }
240118
- loadBufferFromPath(path24, function(err, data2) {
240118
+ loadBufferFromPath(path26, function(err, data2) {
240119
240119
  if (err) {
240120
240120
  return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish);
240121
240121
  }
240122
- _this.parseBitmap(data2, path24, finish);
240122
+ _this.parseBitmap(data2, path26, finish);
240123
240123
  });
240124
240124
  } else if ((0, _typeof2["default"])(args[0]) === "object" && Buffer.isBuffer(args[0])) {
240125
240125
  var data = args[0];
@@ -240154,7 +240154,7 @@ var require_dist2 = __commonJS((exports) => {
240154
240154
  }
240155
240155
  (0, _createClass2["default"])(Jimp3, [{
240156
240156
  key: "parseBitmap",
240157
- value: function parseBitmap(data, path24, finish) {
240157
+ value: function parseBitmap(data, path26, finish) {
240158
240158
  _imageBitmap.parseBitmap.call(this, data, null, finish);
240159
240159
  }
240160
240160
  }, {
@@ -240222,12 +240222,12 @@ var require_dist2 = __commonJS((exports) => {
240222
240222
  }
240223
240223
  }, {
240224
240224
  key: "write",
240225
- value: function write(path24, cb) {
240225
+ value: function write(path26, cb) {
240226
240226
  var _this2 = this;
240227
240227
  if (!_fs["default"] || !_fs["default"].createWriteStream) {
240228
240228
  throw new Error("Cant access the filesystem. You can use the getBase64 method.");
240229
240229
  }
240230
- if (typeof path24 !== "string") {
240230
+ if (typeof path26 !== "string") {
240231
240231
  return _utils.throwError.call(this, "path must be a string", cb);
240232
240232
  }
240233
240233
  if (typeof cb === "undefined") {
@@ -240236,8 +240236,8 @@ var require_dist2 = __commonJS((exports) => {
240236
240236
  if (typeof cb !== "function") {
240237
240237
  return _utils.throwError.call(this, "cb must be a function", cb);
240238
240238
  }
240239
- var mime2 = MIME.getType(path24) || this.getMIME();
240240
- var pathObj = _path["default"].parse(path24);
240239
+ var mime2 = MIME.getType(path26) || this.getMIME();
240240
+ var pathObj = _path["default"].parse(path26);
240241
240241
  if (pathObj.dir) {
240242
240242
  _mkdirp["default"].sync(pathObj.dir);
240243
240243
  }
@@ -240245,7 +240245,7 @@ var require_dist2 = __commonJS((exports) => {
240245
240245
  if (err) {
240246
240246
  return _utils.throwError.call(_this2, err, cb);
240247
240247
  }
240248
- var stream2 = _fs["default"].createWriteStream(path24);
240248
+ var stream2 = _fs["default"].createWriteStream(path26);
240249
240249
  stream2.on("open", function() {
240250
240250
  stream2.write(buffer);
240251
240251
  stream2.end();
@@ -240853,15 +240853,15 @@ var require_timm = __commonJS((exports) => {
240853
240853
  result2[idx] = newItem;
240854
240854
  return result2;
240855
240855
  }
240856
- function getIn(obj, path24) {
240857
- if (!Array.isArray(path24)) {
240856
+ function getIn(obj, path26) {
240857
+ if (!Array.isArray(path26)) {
240858
240858
  throwStr(IS_DEV ? "A path array should be provided when calling getIn()" : INVALID_ARGS);
240859
240859
  }
240860
240860
  if (obj == null)
240861
240861
  return;
240862
240862
  let ptr = obj;
240863
- for (let i = 0;i < path24.length; i++) {
240864
- const key = path24[i];
240863
+ for (let i = 0;i < path26.length; i++) {
240864
+ const key = path26[i];
240865
240865
  ptr = ptr != null ? ptr[key] : undefined;
240866
240866
  if (ptr === undefined)
240867
240867
  return ptr;
@@ -240878,19 +240878,19 @@ var require_timm = __commonJS((exports) => {
240878
240878
  obj2[key] = val;
240879
240879
  return obj2;
240880
240880
  }
240881
- function setIn(obj, path24, val) {
240882
- if (!path24.length)
240881
+ function setIn(obj, path26, val) {
240882
+ if (!path26.length)
240883
240883
  return val;
240884
- return doSetIn(obj, path24, val, 0);
240884
+ return doSetIn(obj, path26, val, 0);
240885
240885
  }
240886
- function doSetIn(obj, path24, val, idx) {
240886
+ function doSetIn(obj, path26, val, idx) {
240887
240887
  let newValue;
240888
- const key = path24[idx];
240889
- if (idx === path24.length - 1) {
240888
+ const key = path26[idx];
240889
+ if (idx === path26.length - 1) {
240890
240890
  newValue = val;
240891
240891
  } else {
240892
- const nestedObj = isObject2(obj) && isObject2(obj[key]) ? obj[key] : typeof path24[idx + 1] === "number" ? [] : {};
240893
- newValue = doSetIn(nestedObj, path24, val, idx + 1);
240892
+ const nestedObj = isObject2(obj) && isObject2(obj[key]) ? obj[key] : typeof path26[idx + 1] === "number" ? [] : {};
240893
+ newValue = doSetIn(nestedObj, path26, val, idx + 1);
240894
240894
  }
240895
240895
  return set2(obj, key, newValue);
240896
240896
  }
@@ -240899,10 +240899,10 @@ var require_timm = __commonJS((exports) => {
240899
240899
  const nextVal = fnUpdate(prevVal);
240900
240900
  return set2(obj, key, nextVal);
240901
240901
  }
240902
- function updateIn(obj, path24, fnUpdate) {
240903
- const prevVal = getIn(obj, path24);
240902
+ function updateIn(obj, path26, fnUpdate) {
240903
+ const prevVal = getIn(obj, path26);
240904
240904
  const nextVal = fnUpdate(prevVal);
240905
- return setIn(obj, path24, nextVal);
240905
+ return setIn(obj, path26, nextVal);
240906
240906
  }
240907
240907
  function merge2(a, b, c2, d, e, f, ...rest2) {
240908
240908
  return rest2.length ? doMerge.call(null, false, false, a, b, c2, d, e, f, ...rest2) : doMerge(false, false, a, b, c2, d, e, f);
@@ -240910,8 +240910,8 @@ var require_timm = __commonJS((exports) => {
240910
240910
  function mergeDeep(a, b, c2, d, e, f, ...rest2) {
240911
240911
  return rest2.length ? doMerge.call(null, false, true, a, b, c2, d, e, f, ...rest2) : doMerge(false, true, a, b, c2, d, e, f);
240912
240912
  }
240913
- function mergeIn(a, path24, b, c2, d, e, f, ...rest2) {
240914
- let prevVal = getIn(a, path24);
240913
+ function mergeIn(a, path26, b, c2, d, e, f, ...rest2) {
240914
+ let prevVal = getIn(a, path26);
240915
240915
  if (prevVal == null)
240916
240916
  prevVal = {};
240917
240917
  let nextVal;
@@ -240920,7 +240920,7 @@ var require_timm = __commonJS((exports) => {
240920
240920
  } else {
240921
240921
  nextVal = doMerge(false, false, prevVal, b, c2, d, e, f);
240922
240922
  }
240923
- return setIn(a, path24, nextVal);
240923
+ return setIn(a, path26, nextVal);
240924
240924
  }
240925
240925
  function omit2(obj, attrs) {
240926
240926
  const omitList = Array.isArray(attrs) ? attrs : [attrs];
@@ -250467,14 +250467,14 @@ var require_gifutil2 = __commonJS((exports) => {
250467
250467
  jimpImage.bitmap.data = bitmapImageToShare.bitmap.data;
250468
250468
  return jimpImage;
250469
250469
  };
250470
- exports.write = function(path24, frames, spec, encoder) {
250470
+ exports.write = function(path26, frames, spec, encoder) {
250471
250471
  encoder = encoder || defaultCodec;
250472
- const matches2 = path24.match(/\.[a-zA-Z]+$/);
250472
+ const matches2 = path26.match(/\.[a-zA-Z]+$/);
250473
250473
  if (matches2 !== null && INVALID_SUFFIXES.includes(matches2[0].toLowerCase())) {
250474
- throw new Error(`GIF '${path24}' has an unexpected suffix`);
250474
+ throw new Error(`GIF '${path26}' has an unexpected suffix`);
250475
250475
  }
250476
250476
  return encoder.encodeGif(frames, spec).then((gif2) => {
250477
- return _writeBinary(path24, gif2.buffer).then(() => {
250477
+ return _writeBinary(path26, gif2.buffer).then(() => {
250478
250478
  return gif2;
250479
250479
  });
250480
250480
  });
@@ -250536,9 +250536,9 @@ var require_gifutil2 = __commonJS((exports) => {
250536
250536
  }
250537
250537
  }
250538
250538
  }
250539
- function _readBinary(path24) {
250539
+ function _readBinary(path26) {
250540
250540
  return new Promise((resolve2, reject3) => {
250541
- fs7.readFile(path24, (err, buffer) => {
250541
+ fs7.readFile(path26, (err, buffer) => {
250542
250542
  if (err) {
250543
250543
  return reject3(err);
250544
250544
  }
@@ -250546,9 +250546,9 @@ var require_gifutil2 = __commonJS((exports) => {
250546
250546
  });
250547
250547
  });
250548
250548
  }
250549
- function _writeBinary(path24, buffer) {
250549
+ function _writeBinary(path26, buffer) {
250550
250550
  return new Promise((resolve2, reject3) => {
250551
- fs7.writeFile(path24, buffer, (err) => {
250551
+ fs7.writeFile(path26, buffer, (err) => {
250552
250552
  if (err) {
250553
250553
  return reject3(err);
250554
250554
  }
@@ -254809,7 +254809,7 @@ var require_CentraResponse = __commonJS((exports, module) => {
254809
254809
 
254810
254810
  // node_modules/centra/model/CentraRequest.js
254811
254811
  var require_CentraRequest = __commonJS((exports, module) => {
254812
- var path24 = __require("path");
254812
+ var path26 = __require("path");
254813
254813
  var http = __require("http");
254814
254814
  var https = __require("https");
254815
254815
  var followRedirects = require_follow_redirects();
@@ -254866,7 +254866,7 @@ var require_CentraRequest = __commonJS((exports, module) => {
254866
254866
  return this;
254867
254867
  }
254868
254868
  path(relativePath) {
254869
- this.url.pathname = path24.join(this.url.pathname, relativePath);
254869
+ this.url.pathname = path26.join(this.url.pathname, relativePath);
254870
254870
  return this;
254871
254871
  }
254872
254872
  body(data, sendAs) {
@@ -255071,7 +255071,7 @@ var require_types = __commonJS((exports, module) => {
255071
255071
 
255072
255072
  // node_modules/load-bmfont/node_modules/mime/mime.js
255073
255073
  var require_mime2 = __commonJS((exports, module) => {
255074
- var path24 = __require("path");
255074
+ var path26 = __require("path");
255075
255075
  var fs7 = __require("fs");
255076
255076
  function Mime() {
255077
255077
  this.types = Object.create(null);
@@ -255101,8 +255101,8 @@ var require_mime2 = __commonJS((exports, module) => {
255101
255101
  this.define(map2);
255102
255102
  this._loading = null;
255103
255103
  };
255104
- Mime.prototype.lookup = function(path25, fallback) {
255105
- var ext = path25.replace(/^.*[\.\/\\]/, "").toLowerCase();
255104
+ Mime.prototype.lookup = function(path27, fallback) {
255105
+ var ext = path27.replace(/^.*[\.\/\\]/, "").toLowerCase();
255106
255106
  return this.types[ext] || fallback || this.default_type;
255107
255107
  };
255108
255108
  Mime.prototype.extension = function(mimeType) {
@@ -255156,7 +255156,7 @@ var require_is_binary = __commonJS((exports, module) => {
255156
255156
  var require_load_bmfont = __commonJS((exports, module) => {
255157
255157
  var fs7 = __require("fs");
255158
255158
  var url = __require("url");
255159
- var path24 = __require("path");
255159
+ var path26 = __require("path");
255160
255160
  var request = require_phin();
255161
255161
  var parseASCII = require_parse_bmfont_ascii();
255162
255162
  var parseXML = require_lib4();
@@ -270896,85 +270896,64 @@ They are stripped before display — the user will not see the raw tags.
270896
270896
  ### memory-delete — delete a memory by its ID (shown in brackets like [abc123])
270897
270897
  <memory-delete>abc123</memory-delete>
270898
270898
 
270899
- Use memory-add when:
270900
- - The user explicitly asks you to remember something ("remember that...", "don't forget...")
270901
- - You learn something project-specific that would be useful in future sessions
270902
- (e.g. preferred patterns, architecture decisions, known gotchas, user preferences)
270903
-
270904
- Use memory-delete when:
270905
- - The user asks you to forget something
270906
- - A memory is outdated or wrong and you are replacing it with a new one
270907
-
270908
- You may emit multiple memory operations in a single response alongside normal content.
270899
+ Use memory-add when the user asks you to remember something, or when you learn something project-specific that would be useful in future sessions.
270900
+ Use memory-delete when the user asks you to forget something or a memory is outdated.
270909
270901
 
270910
270902
  ## RULES
270911
270903
 
270912
- 1. When you need to use a tool, output ONLY the XML tag nothing before or after it in that response
270913
- 2. ONE tool per response emit the tag, then stop completely
270914
- 3. After the user approves and you get the result, continue your analysis in the next response
270915
- 4. NEVER print a URL, command, filename, or JSON blob as plain text when you should be using a tool
270916
- 5. NEVER say "I'll fetch" / "run this command" / "here's the write-file" — just emit the tag
270917
- 6. NEVER use shell to run git clone always use the clone tag instead
270918
- 7. NEVER use shell to list files or folders (no ls, dir, find, git ls-files, tree) — ALWAYS use read-folder instead
270919
- 8. NEVER use shell to read a file (no cat, type, Get-Content) ALWAYS use read-file instead
270920
- 9. NEVER use shell grep, findstr, or Select-String to search file contentsALWAYS use grep instead
270921
- 10. shell is ONLY for running code, installing packages, building, testing not for filesystem inspection
270922
- 11. write-file content field must be the COMPLETE file content, never empty or placeholder
270923
- 12. After a write-file succeeds, do NOT repeat it — trust the result and move on
270924
- 13. After a write-file succeeds, tell the user it is done immediately do NOT auto-read the file back to verify
270925
- 13a. NEVER read a file you just wrote the write output confirms success. Reading back is a wasted tool call and will confuse you.
270926
- 14. NEVER apologize and redo a tool call you already made if write-file or shell ran and returned a result, it worked, do not run it again
270927
- 15. NEVER say "I made a mistake" and repeat the same tool one attempt is enough, trust the output
270928
- 16. NEVER second-guess yourself mid-response commit to your answer
270929
- 17. If a read-folder or read-file returns "not found", accept it and move on — do NOT retry the same path
270930
- 18. If you have already retrieved a result for a path in this conversation, do NOT request it again — use the result you already have
270931
- 19. Every shell command runs from the repo root — \`cd\` has NO persistent effect. NEVER use \`cd\` alone. Use full paths or combine with && e.g. \`cd list && bun run index.ts\`
270932
- 20. write-file paths are relative to the repo root if creating files in a subfolder write the full relative path e.g. \`list/src/index.tsx\` NOT \`src/index.tsx\`
270933
- 21. When scaffolding a new project in a subfolder, ALL write-file paths must start with that subfolder name e.g. \`list/package.json\`, \`list/src/index.tsx\`
270934
- 22. When scaffolding a multi-file project, after each write-file succeeds, immediately proceed to writing the NEXT file — NEVER rewrite a file you already wrote in this session. Each file is written ONCE and ONLY ONCE.
270935
- 23. For JSX/TSX files always use \`.tsx\` extension and include \`/** @jsxImportSource react */\` or ensure tsconfig has jsx set — bun needs this to parse JSX
270936
- 24. When explaining how to use a tool in text, use [tag] bracket notation or a fenced code block — NEVER emit a real XML tool tag as part of an explanation or example
270937
- 25. NEVER read files, list folders, or run tools that were not asked for in the current user message
270938
- 26. NEVER use markdown formatting in plain text responses — no **bold**, no *italics*, no # headings, no bullet points with -, *, or +, no numbered lists, no backtick inline code. Write in plain prose. Only use fenced \`\`\` code blocks when showing actual code.
270939
- 27. When the user asks you to CREATE a new file (e.g. "write a README", "create a config", "add a license", "this codebase doesn't have X"), write it IMMEDIATELY — do NOT read first, even if a stub exists.
270940
- 28. When a tool result is returned, your response must be directly based on that result — never invent or hallucinate content unrelated to the tool output.
270941
- 29. When scaffolding multiple files, emit ONE write-file tag per response — wait for each result before emitting the next. Never chain multiple write-file tags in a single response when file content is complex (more than 20 lines).
270942
-
270943
- ## SCAFFOLDING CHAINING WRITE-FILE CALLS
270944
-
270945
- When creating multiple files (e.g. scaffolding a project or creating 10 files), emit ALL of them
270946
- in a single response by chaining the tags back-to-back with no text between them:
270947
-
270948
- <write-file>
270949
- {"path": "test/file1.txt", "content": "File 1 content"}
270950
- </write-file>
270951
- <write-file>
270952
- {"path": "test/file2.txt", "content": "File 2 content"}
270953
- </write-file>
270954
- <write-file>
270955
- {"path": "test/file3.txt", "content": "File 3 content"}
270956
- </write-file>
270904
+ 1. ONE tool per response emit the XML tag, then stop. Never chain tools in one response except when scaffolding (see below).
270905
+ 2. NEVER call a tool more than once for the same path in a session. If write-file or shell returned a result, it succeeded. Move on immediately.
270906
+ 3. NEVER write the same file twice in one session. One write per file, period. If you already wrote it, it is done.
270907
+ 4. shell is ONLY for running code, installing packages, building, and testing. NEVER use shell to inspect the filesystem or read files — use read-file, read-folder, or grep instead.
270908
+ 5. write-file content must be the COMPLETE file content, never a placeholder or partial.
270909
+ 6. NEVER read a file you just wrote. The write output confirms success.
270910
+ 7. NEVER apologize and redo a tool call one attempt is enough, trust the output.
270911
+ 8. NEVER use shell to run git clone use the clone tag instead.
270912
+ 9. When the user asks you to CREATE a new file, write it immediately do NOT read first.
270913
+ 10. When the user asks you to MODIFY or FIX an existing file, read it first, then write the complete updated version ONCE.
270914
+ 11. When fixing multiple files, use read-files to read ALL of them first, then write each one ONCE sequentially — never rewrite a file already written this session.
270915
+ 12. If a read-folder or read-file returns not found, accept it and move on do NOT retry the same path.
270916
+ 13. Every shell command runs from the repo root cd has no persistent effect. Use full paths or combine with && e.g. cd myapp && bun run index.ts
270917
+ 14. write-file paths are relative to the repo root use full relative paths e.g. myapp/src/index.tsx not src/index.tsx
270918
+ 15. When explaining how to use a tool in text, use [tag] bracket notation NEVER emit a real XML tool tag as part of an explanation.
270919
+ 16. NEVER use markdown formatting in plain text responses no bold, no headings, no bullet points. Only use fenced code blocks when showing actual code.
270920
+ 17. When scaffolding multiple files, emit ONE write-file tag per response and wait for the result before writing the next file.
270921
+
270922
+ ## ADDON FORMAT
270923
+
270924
+ All addons use defineTool from @ridit/lens-sdk. The ONLY correct format is:
270925
+
270926
+ \`\`\`js
270927
+ const { defineTool } = require("@ridit/lens-sdk");
270928
+ const { execSync } = require("child_process");
270929
+
270930
+ defineTool({
270931
+ name: "tool-name",
270932
+ description: "what it does",
270933
+ safe: false,
270934
+ permissionLabel: "label shown to user",
270935
+ systemPromptEntry: () => "<tool-name>{}</tool-name> — description",
270936
+ parseInput: (body) => JSON.parse(body.trim() || "{}"),
270937
+ summariseInput: (input) => "summary",
270938
+ execute: async (input, ctx) => {
270939
+ // ctx.repoPath is the current repo path
270940
+ // use execSync from child_process for shell commands, NOT ctx.tools.shell
270941
+ return { kind: "text", value: "result" };
270942
+ },
270943
+ });
270944
+ \`\`\`
270957
270945
 
270958
- The system processes each tag sequentially and automatically continues to the next one.
270959
- Do NOT wait for a user message between files — emit all tags at once.
270946
+ NEVER use module.exports, registerTool, ctx.tools.shell, or any other format. See addons/run-tests.js for a full working example.
270960
270947
 
270961
- ## WHEN TO READ BEFORE WRITING
270948
+ ## SCAFFOLDING
270962
270949
 
270963
- Only read a file before writing if ALL of these are true:
270964
- - The file already exists AND has content you need to preserve
270965
- - The user explicitly asked you to modify, edit, or update it (not create it)
270966
- - You do not already have the file content in this conversation
270950
+ When creating multiple files, emit ONE write-file per response and wait for each result:
270967
270951
 
270968
- Never read before writing when:
270969
- - The user asked you to create, write, or add a new file
270970
- - The file is empty, missing, or a stub
270971
- - You already read it earlier in this conversation
270952
+ <write-file>
270953
+ {"path": "myapp/package.json", "content": "..."}
270954
+ </write-file>
270972
270955
 
270973
- When modifying an existing file:
270974
- 1. Use read-file on the exact file first
270975
- 2. Preserve ALL existing content — do not remove anything that was not part of the request
270976
- 3. Your write-file must contain EVERYTHING the original had, PLUS your additions
270977
- 4. NEVER produce a file shorter than the original unless explicitly asked to delete things
270956
+ Wait for result, then emit the next file. Never chain write-file tags when content is complex.
270978
270957
 
270979
270958
  ## CODEBASE
270980
270959
 
@@ -270984,59 +270963,59 @@ ${memorySummary}`;
270984
270963
  }
270985
270964
  var BUILTIN_TOOLS_SECTION = `## TOOLS
270986
270965
 
270987
- You have exactly thirteen tools. To use a tool you MUST wrap it in the exact XML tags shown below — no other format will work.
270966
+ You have exactly fourteen tools. Use ONLY the XML tags shown below.
270988
270967
 
270989
270968
  ### 1. fetch — load a URL
270990
270969
  <fetch>https://example.com</fetch>
270991
270970
 
270992
- ### 2. shell — run a terminal command
270971
+ ### 2. shell — run a terminal command (NOT for filesystem inspection)
270993
270972
  <shell>node -v</shell>
270994
270973
 
270995
- ### 3. read-file — read a file from the repo
270974
+ ### 3. read-file — read a single file from the repo
270996
270975
  <read-file>src/foo.ts</read-file>
270997
270976
 
270998
- ### 4. read-folderlist contents of a folder (files + subfolders, one level deep)
270977
+ ### 4. read-filesread multiple files at once
270978
+ <read-files>
270979
+ ["src/foo.ts", "src/bar.ts"]
270980
+ </read-files>
270981
+
270982
+ ### 5. read-folder — list contents of a folder (one level deep)
270999
270983
  <read-folder>src/components</read-folder>
271000
270984
 
271001
- ### 5. grep — search for a pattern across files in the repo (cross-platform, no shell needed)
270985
+ ### 6. grep — search for a pattern across files
271002
270986
  <grep>
271003
270987
  {"pattern": "ChatRunner", "glob": "src/**/*.tsx"}
271004
270988
  </grep>
271005
270989
 
271006
- ### 6. write-file — create or overwrite a file
270990
+ ### 7. write-file — create or overwrite a file (COMPLETE content only)
271007
270991
  <write-file>
271008
270992
  {"path": "data/output.csv", "content": "col1,col2\\nval1,val2"}
271009
270993
  </write-file>
271010
270994
 
271011
- ### 7. delete-file — permanently delete a single file
270995
+ ### 8. delete-file — permanently delete a single file
271012
270996
  <delete-file>src/old-component.tsx</delete-file>
271013
270997
 
271014
- ### 8. delete-folder — permanently delete a folder and all its contents
270998
+ ### 9. delete-folder — permanently delete a folder and all its contents
271015
270999
  <delete-folder>src/legacy</delete-folder>
271016
271000
 
271017
- ### 9. open-url — open a URL in the user's default browser
271001
+ ### 10. open-url — open a URL in the user's default browser
271018
271002
  <open-url>https://github.com/owner/repo</open-url>
271019
271003
 
271020
- ### 10. generate-pdf — generate a PDF file from markdown-style content
271004
+ ### 11. generate-pdf — generate a PDF from markdown-style content
271021
271005
  <generate-pdf>
271022
- {"path": "output/report.pdf", "content": "# Title\\n\\nSome body text.\\n\\n## Section\\n\\nMore content."}
271006
+ {"path": "output/report.pdf", "content": "# Title\\n\\nBody text."}
271023
271007
  </generate-pdf>
271024
271008
 
271025
- ### 11. search — search the internet for anything you are unsure about
271026
- <search>how to use React useEffect cleanup function</search>
271009
+ ### 12. search — search the internet
271010
+ <search>how to use React useEffect cleanup</search>
271027
271011
 
271028
- ### 12. clone — clone a GitHub repo so you can explore and discuss it
271012
+ ### 13. clone — clone a GitHub repo
271029
271013
  <clone>https://github.com/owner/repo</clone>
271030
271014
 
271031
- ### 13. changes — propose code edits (shown as a diff for user approval)
271015
+ ### 14. changes — propose code edits shown as a diff for user approval
271032
271016
  <changes>
271033
271017
  {"summary": "what changed and why", "patches": [{"path": "src/foo.ts", "content": "COMPLETE file content", "isNew": false}]}
271034
271018
  </changes>
271035
-
271036
- ### 14. read-files — read multiple files from the repo at once
271037
- <read-files>
271038
- ["src/foo.ts", "src/bar.ts"]
271039
- </read-files>
271040
271019
  `;
271041
271020
  // src/prompts/fewshot.ts
271042
271021
  var FEW_SHOT_MESSAGES = [
@@ -271046,7 +271025,7 @@ var FEW_SHOT_MESSAGES = [
271046
271025
  },
271047
271026
  {
271048
271027
  role: "assistant",
271049
- content: '<write-file>\n{"path": "README.md", "content": "# Project\\n\\nA brief description of what this project does.\\n\\n## Getting Started\\n\\n```bash\\nbun install\\nbun run dev\\n```"}\n</write-file>'
271028
+ content: '<write-file>\n{"path": "README.md", "content": "# Project\\n\\nA brief description.\\n\\n## Getting Started\\n\\n```bash\\nbun install\\nbun run dev\\n```"}\n</write-file>'
271050
271029
  },
271051
271030
  {
271052
271031
  role: "user",
@@ -271062,259 +271041,184 @@ Please continue your response based on this output.`
271062
271041
  },
271063
271042
  {
271064
271043
  role: "user",
271065
- content: "add more information to the README"
271044
+ content: "fix the bug in addons/clean-cache.js"
271066
271045
  },
271067
271046
  {
271068
271047
  role: "assistant",
271069
- content: "<read-file>README.md</read-file>"
271048
+ content: "<read-file>addons/clean-cache.js</read-file>"
271070
271049
  },
271071
271050
  {
271072
271051
  role: "user",
271073
- content: `Here is the output from read-file of README.md:
271074
-
271075
- File: README.md (10 lines)
271076
-
271077
- # Project
271052
+ content: `Here is the output from read-file of addons/clean-cache.js:
271078
271053
 
271079
- A brief description.
271054
+ File: addons/clean-cache.js (42 lines)
271080
271055
 
271081
- ## Getting Started
271082
-
271083
- \`\`\`bash
271084
- bun install
271085
- \`\`\`
271056
+ const { defineTool } = require("@ridit/lens-sdk");
271057
+ defineTool({ name: "clean-cache", execute: async (_, ctx) => { const { shell } = ctx.tools; await shell("rm -rf node_modules"); } });
271086
271058
 
271087
271059
  Please continue your response based on this output.`
271088
271060
  },
271089
271061
  {
271090
271062
  role: "assistant",
271091
- content: '<write-file>\n{"path": "README.md", "content": "# Project\\n\\nA brief description.\\n\\n## Getting Started\\n\\n```bash\\nbun install\\nbun run dev\\n```\\n\\n## Features\\n\\n- Feature one\\n- Feature two\\n\\n## Contributing\\n\\nPull requests welcome."}\n</write-file>'
271063
+ content: `<write-file>
271064
+ {"path": "addons/clean-cache.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\nconst { execSync } = require(\\"child_process\\");\\n\\ndefineTool({\\n name: \\"clean-cache\\",\\n description: \\"Clean node_modules and bun cache\\",\\n safe: false,\\n permissionLabel: \\"Clean cache\\",\\n systemPromptEntry: () => \\"<clean-cache>{}</clean-cache> — clean node_modules and bun cache\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"clean cache\\",\\n execute: async (_, ctx) => {\\n try {\\n execSync(\\"rm -rf node_modules\\", { cwd: ctx.repoPath, stdio: \\"pipe\\" });\\n return { kind: \\"text\\", value: \\"Cache cleaned!\\" };\\n } catch (err) {\\n return { kind: \\"error\\", value: err.message };\\n }\\n },\\n});"}
271065
+ </write-file>`
271092
271066
  },
271093
271067
  {
271094
271068
  role: "user",
271095
- content: `Here is the output from write-file to README.md:
271069
+ content: `Here is the output from write-file to addons/clean-cache.js:
271096
271070
 
271097
- Written: /repo/README.md (20 lines, 280 bytes)
271071
+ Written: /repo/addons/clean-cache.js (20 lines, 480 bytes)
271098
271072
 
271099
271073
  Please continue your response based on this output.`
271100
271074
  },
271101
271075
  {
271102
271076
  role: "assistant",
271103
- content: "Done — README.md updated with more detail."
271077
+ content: "Done — clean-cache.js fixed. Now uses execSync instead of ctx.tools.shell."
271104
271078
  },
271105
271079
  {
271106
271080
  role: "user",
271107
- content: "update LENS.md"
271081
+ content: "add a logout button to src/components/Header.tsx"
271108
271082
  },
271109
271083
  {
271110
271084
  role: "assistant",
271111
- content: "<read-file>LENS.md</read-file>"
271085
+ content: "<read-file>src/components/Header.tsx</read-file>"
271112
271086
  },
271113
271087
  {
271114
271088
  role: "user",
271115
- content: `Here is the output from read-file of LENS.md:
271116
-
271117
- File: LENS.md (33 lines)
271118
-
271119
- # Lens Analysis
271120
-
271121
- ## Overview
271122
- A CLI tool for codebase analysis.
271089
+ content: `Here is the output from read-file of src/components/Header.tsx:
271123
271090
 
271124
- ## Important Folders
271125
- - src/components
271126
- - src/utils
271091
+ File: src/components/Header.tsx (42 lines)
271127
271092
 
271128
- ## Suggestions
271129
- - Add tests
271093
+ import React from 'react';
271094
+ // ... existing content ...
271130
271095
 
271131
271096
  Please continue your response based on this output.`
271132
271097
  },
271133
271098
  {
271134
271099
  role: "assistant",
271135
- content: `<write-file>
271136
- {"path": "LENS.md", "content": "# Lens Analysis\\n\\n## Overview\\nA CLI tool for AI-powered codebase analysis, built with React and Ink.\\n\\n## Important Folders\\n- src/components — UI components rendered in the terminal\\n- src/utils — tools, chat, memory, and registry utilities\\n\\n## Suggestions\\n- Add tests\\n- Add more providers\\n- Improve error handling"}
271137
- </write-file>`
271100
+ content: `<changes>
271101
+ {"summary": "Add logout button to Header preserves all existing content", "patches": [{"path": "src/components/Header.tsx", "content": "// complete file with logout button added", "isNew": false}]}
271102
+ </changes>`
271138
271103
  },
271139
271104
  {
271140
271105
  role: "user",
271141
- content: `Here is the output from write-file to LENS.md:
271106
+ content: `Here is the output from changes:
271142
271107
 
271143
- Written: /repo/LENS.md (15 lines, 420 bytes)
271108
+ Changes applied.
271144
271109
 
271145
271110
  Please continue your response based on this output.`
271146
271111
  },
271147
271112
  {
271148
271113
  role: "assistant",
271149
- content: "Done — LENS.md updated."
271114
+ content: "Done — logout button added to Header.tsx."
271150
271115
  },
271151
271116
  {
271152
271117
  role: "user",
271153
- content: "write a contributing guide"
271118
+ content: "fix addons/a.js, addons/b.js and addons/c.js"
271154
271119
  },
271155
271120
  {
271156
271121
  role: "assistant",
271157
- content: `<write-file>
271158
- {"path": "CONTRIBUTING.md", "content": "# Contributing\\n\\nPull requests welcome. Please open an issue first to discuss major changes."}
271159
- </write-file>`
271122
+ content: `<read-files>
271123
+ ["addons/a.js", "addons/b.js", "addons/c.js"]
271124
+ </read-files>`
271160
271125
  },
271161
271126
  {
271162
271127
  role: "user",
271163
- content: `Here is the output from write-file to CONTRIBUTING.md:
271128
+ content: `Here is the output from read-files:
271164
271129
 
271165
- Written: /repo/CONTRIBUTING.md (4 lines, 96 bytes)
271130
+ === addons/a.js ===
271131
+ module.exports = { name: 'a', run: async () => {} }
271166
271132
 
271167
- Please continue your response based on this output.`
271168
- },
271169
- {
271170
- role: "assistant",
271171
- content: "Done — CONTRIBUTING.md has been written."
271172
- },
271173
- {
271174
- role: "user",
271175
- content: "scaffold a new project called myapp with package.json and src/index.tsx"
271176
- },
271177
- {
271178
- role: "assistant",
271179
- content: `<write-file>
271180
- {"path": "myapp/package.json", "content": "{\\n \\"name\\": \\"myapp\\",\\n \\"version\\": \\"1.0.0\\",\\n \\"scripts\\": { \\"dev\\": \\"bun run src/index.tsx\\" },\\n \\"dependencies\\": { \\"react\\": \\"^18.2.0\\", \\"ink\\": \\"^4.4.1\\" },\\n \\"devDependencies\\": { \\"@types/react\\": \\"^18.2.0\\" }\\n}"}
271181
- </write-file>`
271182
- },
271183
- {
271184
- role: "user",
271185
- content: `Here is the output from write-file to myapp/package.json:
271133
+ === addons/b.js ===
271134
+ module.exports = { name: 'b', run: async () => {} }
271186
271135
 
271187
- Written: /repo/myapp/package.json (10 lines, 220 bytes)
271136
+ === addons/c.js ===
271137
+ module.exports = { name: 'c', run: async () => {} }
271188
271138
 
271189
271139
  Please continue your response based on this output.`
271190
271140
  },
271191
271141
  {
271192
271142
  role: "assistant",
271193
271143
  content: `<write-file>
271194
- {"path": "myapp/src/index.tsx", "content": "/** @jsxImportSource react */\\nimport React from 'react';\\nimport { render, Text } from 'ink';\\n\\nfunction App() {\\n return <Text>Hello from myapp!</Text>;\\n}\\n\\nrender(<App />);"}
271144
+ {"path": "addons/a.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"a\\",\\n description: \\"Does A\\",\\n safe: true,\\n permissionLabel: \\"Run A\\",\\n systemPromptEntry: () => \\"<a>{}</a> run A\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"a\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"A done!\\" }),\\n});"}
271195
271145
  </write-file>`
271196
271146
  },
271197
271147
  {
271198
271148
  role: "user",
271199
- content: `Here is the output from write-file to myapp/src/index.tsx:
271200
-
271201
- Written: /repo/myapp/src/index.tsx (9 lines, 210 bytes)
271202
-
271203
- Please continue your response based on this output.`
271204
- },
271205
- {
271206
- role: "assistant",
271207
- content: "Done — scaffolded myapp/package.json and myapp/src/index.tsx. Run `cd myapp && bun install` to get started."
271208
- },
271209
- {
271210
- role: "user",
271211
- content: "delete src/old-component.tsx"
271212
- },
271213
- {
271214
- role: "assistant",
271215
- content: "<delete-file>src/old-component.tsx</delete-file>"
271216
- },
271217
- {
271218
- role: "user",
271219
- content: `Here is the output from delete-file of src/old-component.tsx:
271149
+ content: `Here is the output from write-file to addons/a.js:
271220
271150
 
271221
- Deleted: /repo/src/old-component.tsx
271151
+ Written: /repo/addons/a.js (12 lines, 280 bytes)
271222
271152
 
271223
271153
  Please continue your response based on this output.`
271224
271154
  },
271225
271155
  {
271226
271156
  role: "assistant",
271227
- content: "Done — src/old-component.tsx has been deleted."
271228
- },
271229
- {
271230
- role: "user",
271231
- content: "delete the legacy folder"
271232
- },
271233
- {
271234
- role: "assistant",
271235
- content: "<delete-folder>src/legacy</delete-folder>"
271157
+ content: `<write-file>
271158
+ {"path": "addons/b.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"b\\",\\n description: \\"Does B\\",\\n safe: true,\\n permissionLabel: \\"Run B\\",\\n systemPromptEntry: () => \\"<b>{}</b> — run B\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"b\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"B done!\\" }),\\n});"}
271159
+ </write-file>`
271236
271160
  },
271237
271161
  {
271238
271162
  role: "user",
271239
- content: `Here is the output from delete-folder of src/legacy:
271163
+ content: `Here is the output from write-file to addons/b.js:
271240
271164
 
271241
- Deleted folder: /repo/src/legacy
271165
+ Written: /repo/addons/b.js (12 lines, 280 bytes)
271242
271166
 
271243
271167
  Please continue your response based on this output.`
271244
271168
  },
271245
271169
  {
271246
271170
  role: "assistant",
271247
- content: "Done — src/legacy and all its contents have been deleted."
271248
- },
271249
- {
271250
- role: "user",
271251
- content: "open https://github.com/microsoft/typescript"
271252
- },
271253
- {
271254
- role: "assistant",
271255
- content: "<open-url>https://github.com/microsoft/typescript</open-url>"
271171
+ content: `<write-file>
271172
+ {"path": "addons/c.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"c\\",\\n description: \\"Does C\\",\\n safe: true,\\n permissionLabel: \\"Run C\\",\\n systemPromptEntry: () => \\"<c>{}</c> — run C\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"c\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"C done!\\" }),\\n});"}
271173
+ </write-file>`
271256
271174
  },
271257
271175
  {
271258
271176
  role: "user",
271259
- content: `Here is the output from open-url https://github.com/microsoft/typescript:
271177
+ content: `Here is the output from write-file to addons/c.js:
271260
271178
 
271261
- Opened: https://github.com/microsoft/typescript
271179
+ Written: /repo/addons/c.js (12 lines, 280 bytes)
271262
271180
 
271263
271181
  Please continue your response based on this output.`
271264
271182
  },
271265
271183
  {
271266
271184
  role: "assistant",
271267
- content: "Opened the TypeScript GitHub page in your browser."
271185
+ content: "Done fixed all three addons. Each now uses defineTool from @ridit/lens-sdk correctly."
271268
271186
  },
271269
271187
  {
271270
271188
  role: "user",
271271
- content: "generate a PDF report about the project and save it to docs/report.pdf"
271189
+ content: "scaffold a new project called myapp with package.json and src/index.tsx"
271272
271190
  },
271273
271191
  {
271274
271192
  role: "assistant",
271275
- content: `<generate-pdf>
271276
- {"path": "docs/report.pdf", "content": "# Project Report\\n\\n## Overview\\n\\nThis document summarizes the project.\\n\\n## Details\\n\\nMore content here."}
271277
- </generate-pdf>`
271193
+ content: `<write-file>
271194
+ {"path": "myapp/package.json", "content": "{\\n \\"name\\": \\"myapp\\",\\n \\"version\\": \\"1.0.0\\",\\n \\"scripts\\": { \\"dev\\": \\"bun run src/index.tsx\\" },\\n \\"dependencies\\": { \\"react\\": \\"^18.2.0\\", \\"ink\\": \\"^4.4.1\\" }\\n}"}
271195
+ </write-file>`
271278
271196
  },
271279
271197
  {
271280
271198
  role: "user",
271281
- content: `Here is the output from generate-pdf to docs/report.pdf:
271199
+ content: `Here is the output from write-file to myapp/package.json:
271282
271200
 
271283
- PDF generated: /repo/docs/report.pdf
271201
+ Written: /repo/myapp/package.json (8 lines, 180 bytes)
271284
271202
 
271285
271203
  Please continue your response based on this output.`
271286
271204
  },
271287
271205
  {
271288
271206
  role: "assistant",
271289
- content: "Done — docs/report.pdf has been generated."
271290
- },
271291
- {
271292
- role: "user",
271293
- content: 'grep -R "ChatRunner" -n src'
271294
- },
271295
- {
271296
- role: "assistant",
271297
- content: `<grep>
271298
- {"pattern": "ChatRunner", "glob": "src/**/*"}
271299
- </grep>`
271207
+ content: `<write-file>
271208
+ {"path": "myapp/src/index.tsx", "content": "/** @jsxImportSource react */\\nimport React from 'react';\\nimport { render, Text } from 'ink';\\n\\nfunction App() {\\n return <Text>Hello from myapp!</Text>;\\n}\\n\\nrender(<App />);"}
271209
+ </write-file>`
271300
271210
  },
271301
271211
  {
271302
271212
  role: "user",
271303
- content: `Here is the output from grep for "ChatRunner":
271304
-
271305
- grep /ChatRunner/ src/**/* — 3 match(es) in 2 file(s)
271306
-
271307
- src/index.tsx
271308
- 12: import { ChatRunner } from "./components/chat/ChatRunner";
271213
+ content: `Here is the output from write-file to myapp/src/index.tsx:
271309
271214
 
271310
- src/components/chat/ChatRunner.tsx
271311
- 1: export const ChatRunner = ...
271215
+ Written: /repo/myapp/src/index.tsx (9 lines, 210 bytes)
271312
271216
 
271313
271217
  Please continue your response based on this output.`
271314
271218
  },
271315
271219
  {
271316
271220
  role: "assistant",
271317
- content: "ChatRunner is defined in src/components/chat/ChatRunner.tsx and imported in src/index.tsx."
271221
+ content: "Done scaffolded myapp/package.json and myapp/src/index.tsx. Run cd myapp && bun install to get started."
271318
271222
  },
271319
271223
  {
271320
271224
  role: "user",
@@ -271342,197 +271246,6 @@ Please continue your response based on this output.`
271342
271246
  role: "assistant",
271343
271247
  content: "useInput is used in src/components/chat/ChatRunner.tsx — imported on line 5 and called on line 210."
271344
271248
  },
271345
- {
271346
- role: "user",
271347
- content: "show me how to use the read-file tool"
271348
- },
271349
- {
271350
- role: "assistant",
271351
- content: "To read a file, emit the tag alone in your response — nothing else on that turn:\n\n```text\n[read-file]src/components/Header.tsx[/read-file]\n```\n\nThe result comes back as the next user message and you can then analyze it."
271352
- },
271353
- {
271354
- role: "user",
271355
- content: "show me an example of the shell tool"
271356
- },
271357
- {
271358
- role: "assistant",
271359
- content: "To run a shell command, emit only the tag:\n\n```text\n[shell]node -v[/shell]\n```\n\nThe stdout/stderr is returned and you can read it in the next turn."
271360
- },
271361
- {
271362
- role: "user",
271363
- content: "read src folder"
271364
- },
271365
- {
271366
- role: "assistant",
271367
- content: "<read-folder>src</read-folder>"
271368
- },
271369
- {
271370
- role: "user",
271371
- content: `Here is the output from read-folder of src:
271372
-
271373
- Folder: src (4 entries)
271374
-
271375
- Files:
271376
- index.ts
271377
- App.tsx
271378
-
271379
- Subfolders:
271380
- components/
271381
- utils/
271382
-
271383
- Please continue your response based on this output.`
271384
- },
271385
- {
271386
- role: "assistant",
271387
- content: "The src folder contains index.ts, App.tsx, plus subfolders components/ and utils/."
271388
- },
271389
- {
271390
- role: "user",
271391
- content: "what files are in src/components?"
271392
- },
271393
- {
271394
- role: "assistant",
271395
- content: "<read-folder>src/components</read-folder>"
271396
- },
271397
- {
271398
- role: "user",
271399
- content: `Here is the output from read-folder of src/components:
271400
-
271401
- Folder: src/components (5 entries)
271402
-
271403
- Files:
271404
- Header.tsx
271405
- Footer.tsx
271406
- Button.tsx
271407
-
271408
- Subfolders:
271409
- ui/
271410
- forms/
271411
-
271412
- Please continue your response based on this output.`
271413
- },
271414
- {
271415
- role: "assistant",
271416
- content: "src/components has 3 files — Header.tsx, Footer.tsx, Button.tsx — plus two subfolders: ui/ and forms/."
271417
- },
271418
- {
271419
- role: "user",
271420
- content: "show me the project structure"
271421
- },
271422
- {
271423
- role: "assistant",
271424
- content: "<read-folder>.</read-folder>"
271425
- },
271426
- {
271427
- role: "user",
271428
- content: `Here is the output from read-folder of .:
271429
-
271430
- Folder: . (5 entries)
271431
-
271432
- Files:
271433
- package.json
271434
- tsconfig.json
271435
- README.md
271436
-
271437
- Subfolders:
271438
- src/
271439
- node_modules/
271440
-
271441
- Please continue your response based on this output.`
271442
- },
271443
- {
271444
- role: "assistant",
271445
- content: "The project root has package.json, tsconfig.json, README.md and the src/ folder for source code."
271446
- },
271447
- {
271448
- role: "user",
271449
- content: "fetch https://api.github.com/repos/microsoft/typescript"
271450
- },
271451
- {
271452
- role: "assistant",
271453
- content: "<fetch>https://api.github.com/repos/microsoft/typescript</fetch>"
271454
- },
271455
- {
271456
- role: "user",
271457
- content: `Here is the output from fetch of https://api.github.com/repos/microsoft/typescript:
271458
-
271459
- {"name":"TypeScript","stargazers_count":100000}
271460
-
271461
- Please continue your response based on this output.`
271462
- },
271463
- {
271464
- role: "assistant",
271465
- content: "Found 1 object with fields: name, stargazers_count. Writing to ts-info.json now."
271466
- },
271467
- {
271468
- role: "user",
271469
- content: "ok go ahead"
271470
- },
271471
- {
271472
- role: "assistant",
271473
- content: `<write-file>
271474
- {"path": "ts-info.json", "content": "{"name":"TypeScript","stars":100000}"}
271475
- </write-file>`
271476
- },
271477
- {
271478
- role: "user",
271479
- content: `Here is the output from write-file to ts-info.json:
271480
-
271481
- Written: /repo/ts-info.json (1 lines, 44 bytes)
271482
-
271483
- Please continue your response based on this output.`
271484
- },
271485
- {
271486
- role: "assistant",
271487
- content: "Done — ts-info.json has been saved."
271488
- },
271489
- {
271490
- role: "user",
271491
- content: "write it to a file called hello.py"
271492
- },
271493
- {
271494
- role: "assistant",
271495
- content: `<write-file>
271496
- {"path": "hello.py", "content": "# hello.py\\nprint('hello')"}
271497
- </write-file>`
271498
- },
271499
- {
271500
- role: "user",
271501
- content: `Here is the output from write-file to hello.py:
271502
-
271503
- Written: /repo/hello.py (2 lines, 32 bytes)
271504
-
271505
- Please continue your response based on this output.`
271506
- },
271507
- {
271508
- role: "assistant",
271509
- content: "Done — hello.py has been written."
271510
- },
271511
- {
271512
- role: "user",
271513
- content: "add a logout button to src/components/Header.tsx"
271514
- },
271515
- {
271516
- role: "assistant",
271517
- content: "<read-file>src/components/Header.tsx</read-file>"
271518
- },
271519
- {
271520
- role: "user",
271521
- content: `Here is the output from read-file of src/components/Header.tsx:
271522
-
271523
- File: src/components/Header.tsx (42 lines)
271524
-
271525
- import React from 'react';
271526
- // ... full file content ...
271527
-
271528
- Please continue your response based on this output.`
271529
- },
271530
- {
271531
- role: "assistant",
271532
- content: `<changes>
271533
- {"summary": "Add logout button to Header — preserves all existing nav items and imports", "patches": [{"path": "src/components/Header.tsx", "content": "// complete file with logout button added", "isNew": false}]}
271534
- </changes>`
271535
- },
271536
271249
  {
271537
271250
  role: "user",
271538
271251
  content: "what node version am I on"
@@ -271551,63 +271264,39 @@ Please continue your response based on this output.`
271551
271264
  },
271552
271265
  {
271553
271266
  role: "assistant",
271554
- content: "You're running Node.js v20.11.0."
271267
+ content: "You're on Node.js v20.11.0."
271555
271268
  },
271556
271269
  {
271557
271270
  role: "user",
271558
- content: "clone https://github.com/facebook/react"
271559
- },
271560
- {
271561
- role: "assistant",
271562
- content: "<clone>https://github.com/facebook/react</clone>"
271563
- },
271564
- {
271565
- role: "user",
271566
- content: "Cloned react to /tmp/react — 2847 files available. You can now read files from this repo using read-file with paths relative to /tmp/react."
271271
+ content: "remember that we always use bun in this project"
271567
271272
  },
271568
271273
  {
271569
271274
  role: "assistant",
271570
- content: "Cloned! The React repo has 2847 files. I can read source files, explain how it works, or suggest improvements — just ask."
271275
+ content: `<memory-add>Project uses bun as the package manager and runtime, not npm or node</memory-add>
271276
+
271277
+ Got it — I'll always use bun for this project.`
271571
271278
  },
271572
271279
  {
271573
271280
  role: "user",
271574
- content: "what does the ?? operator do in typescript"
271281
+ content: "add a new addon that prints hello world"
271575
271282
  },
271576
271283
  {
271577
271284
  role: "assistant",
271578
- content: "<search>nullish coalescing operator ?? TypeScript</search>"
271285
+ content: `<write-file>
271286
+ {"path": "addons/hello-world.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"hello-world\\",\\n description: \\"Prints hello world\\",\\n safe: true,\\n permissionLabel: \\"Print hello world\\",\\n systemPromptEntry: () => \\"<hello-world>{}</hello-world> — print hello world\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"hello world\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"Hello world!\\" }),\\n});"}
271287
+ </write-file>`
271579
271288
  },
271580
271289
  {
271581
271290
  role: "user",
271582
- content: `Here is the output from web search for "nullish coalescing operator ?? TypeScript":
271291
+ content: `Here is the output from write-file to addons/hello-world.js:
271583
271292
 
271584
- Answer: The ?? operator returns the right-hand side when the left-hand side is null or undefined.
271293
+ Written: /repo/addons/hello-world.js (14 lines, 320 bytes)
271585
271294
 
271586
271295
  Please continue your response based on this output.`
271587
271296
  },
271588
271297
  {
271589
271298
  role: "assistant",
271590
- content: "The ?? operator is the nullish coalescing operator. It returns the right side only when the left side is null or undefined."
271591
- },
271592
- {
271593
- role: "user",
271594
- content: "remember that we always use bun in this project"
271595
- },
271596
- {
271597
- role: "assistant",
271598
- content: `<memory-add>Project uses bun as the package manager and runtime, not npm or node</memory-add>
271599
-
271600
- Got it — I'll always use bun for this project.`
271601
- },
271602
- {
271603
- role: "user",
271604
- content: "forget the bun preference"
271605
- },
271606
- {
271607
- role: "assistant",
271608
- content: `<memory-delete>MEMORY_ID</memory-delete>
271609
-
271610
- Done — removed that memory.`
271299
+ content: "Done addons/hello-world.js created using defineTool from @ridit/lens-sdk."
271611
271300
  }
271612
271301
  ];
271613
271302
  // src/utils/chat.ts
@@ -275896,16 +275585,1278 @@ var ChatCommand = ({ path: inputPath }) => {
275896
275585
  }, undefined, false, undefined, this);
275897
275586
  };
275898
275587
 
275899
- // src/commands/timeline.tsx
275900
- import { existsSync as existsSync15 } from "fs";
275588
+ // src/commands/watch.tsx
275589
+ import path21 from "path";
275590
+ import { existsSync as existsSync16 } from "fs";
275591
+
275592
+ // src/components/watch/WatchRunner.tsx
275593
+ var import_react50 = __toESM(require_react(), 1);
275594
+
275595
+ // src/utils/watch.ts
275596
+ import { spawn as spawn2 } from "child_process";
275597
+ import { readFileSync as readFileSync13, existsSync as existsSync15 } from "fs";
275901
275598
  import path20 from "path";
275599
+ var ERROR_PATTERNS = [
275600
+ /error:/i,
275601
+ /TypeError/,
275602
+ /ReferenceError/,
275603
+ /SyntaxError/,
275604
+ /RangeError/,
275605
+ /NameError/,
275606
+ /AttributeError/,
275607
+ /KeyError/,
275608
+ /IndexError/,
275609
+ /ImportError/,
275610
+ /ModuleNotFoundError/,
275611
+ /ZeroDivisionError/,
275612
+ /ValueError/,
275613
+ /RuntimeError/,
275614
+ /Traceback \(most recent call last\)/,
275615
+ /Cannot find module/,
275616
+ /Cannot read propert/,
275617
+ /is not defined/,
275618
+ /is not a function/,
275619
+ /Unhandled/,
275620
+ /ENOENT/,
275621
+ /EADDRINUSE/,
275622
+ /failed to compile/i,
275623
+ /Build failed/i,
275624
+ /Module not found/i,
275625
+ /unexpected token/i,
275626
+ /Expected/
275627
+ ];
275628
+ var NOISE_PATTERNS = [
275629
+ /^\s*at\s+/,
275630
+ /^\s*\^+\s*$/,
275631
+ /^\s*$/,
275632
+ /^\s*warn/i,
275633
+ /deprecat/i
275634
+ ];
275635
+ var INPUT_REQUEST_PATTERNS = [
275636
+ /:\s*$/,
275637
+ /\?\s*$/,
275638
+ />\s*$/,
275639
+ /input/i,
275640
+ /enter\s+\w/i,
275641
+ /type\s+\w/i,
275642
+ /press\s+\w/i
275643
+ ];
275644
+ function isErrorLine(line) {
275645
+ return ERROR_PATTERNS.some((p) => p.test(line));
275646
+ }
275647
+ function isNoise(line) {
275648
+ return NOISE_PATTERNS.some((p) => p.test(line));
275649
+ }
275650
+ function isInputRequest(line) {
275651
+ const stripped = line.replace(/\x1b\[[0-9;]*m/g, "").trim();
275652
+ if (!stripped)
275653
+ return false;
275654
+ return INPUT_REQUEST_PATTERNS.some((p) => p.test(stripped));
275655
+ }
275656
+ function extractFilePath(lines) {
275657
+ for (const line of lines) {
275658
+ const pyM = line.match(/File "([^"]+\.py)",\s*line\s*(\d+)/);
275659
+ if (pyM) {
275660
+ return { filePath: pyM[1], lineNumber: parseInt(pyM[2], 10) };
275661
+ }
275662
+ const m = line.match(/([./][\w./\\-]+\.(tsx?|jsx?|mjs|cjs|ts|js|py)):(\d+)/);
275663
+ if (m) {
275664
+ return { filePath: m[1], lineNumber: parseInt(m[3], 10) };
275665
+ }
275666
+ const absM = line.match(/\(([^)]+\.(tsx?|jsx?|ts|js)):(\d+)/);
275667
+ if (absM) {
275668
+ return { filePath: absM[1], lineNumber: parseInt(absM[3], 10) };
275669
+ }
275670
+ }
275671
+ return {};
275672
+ }
275673
+ function spawnWatch(cmd, cwd2) {
275674
+ const [bin, ...args] = cmd.split(/\s+/);
275675
+ const child = spawn2(bin, args, {
275676
+ cwd: cwd2,
275677
+ shell: true,
275678
+ env: { ...process.env, FORCE_COLOR: "1" },
275679
+ stdio: ["pipe", "pipe", "pipe"]
275680
+ });
275681
+ const logCallbacks = [];
275682
+ const errorCallbacks = [];
275683
+ const exitCallbacks = [];
275684
+ const inputRequestCallbacks = [];
275685
+ const recentLines = [];
275686
+ let errorBuffer = [];
275687
+ let errorTimer = null;
275688
+ const seenErrors = new Set;
275689
+ const flushError = () => {
275690
+ if (errorBuffer.length === 0)
275691
+ return;
275692
+ const raw = errorBuffer.join(`
275693
+ `);
275694
+ const key = raw.slice(0, 120);
275695
+ if (seenErrors.has(key)) {
275696
+ errorBuffer = [];
275697
+ return;
275698
+ }
275699
+ seenErrors.add(key);
275700
+ const { filePath, lineNumber } = extractFilePath(errorBuffer);
275701
+ const chunk2 = {
275702
+ raw,
275703
+ lines: errorBuffer.filter((l) => !isNoise(l)).slice(0, 20),
275704
+ contextBefore: recentLines.slice(-15),
275705
+ filePath,
275706
+ lineNumber,
275707
+ timestamp: Date.now()
275708
+ };
275709
+ errorCallbacks.forEach((cb) => cb(chunk2));
275710
+ errorBuffer = [];
275711
+ };
275712
+ const processLine = (line, isErr) => {
275713
+ recentLines.push(line);
275714
+ if (recentLines.length > 30)
275715
+ recentLines.shift();
275716
+ logCallbacks.forEach((cb) => cb(line, isErr));
275717
+ if (isErrorLine(line)) {
275718
+ errorBuffer.push(line);
275719
+ if (errorTimer)
275720
+ clearTimeout(errorTimer);
275721
+ errorTimer = setTimeout(flushError, 300);
275722
+ } else if (errorBuffer.length > 0) {
275723
+ errorBuffer.push(line);
275724
+ if (errorTimer)
275725
+ clearTimeout(errorTimer);
275726
+ errorTimer = setTimeout(flushError, 300);
275727
+ } else if (!isErr && isInputRequest(line)) {
275728
+ inputRequestCallbacks.forEach((cb) => cb(line.trim()));
275729
+ }
275730
+ };
275731
+ child.stdout?.on("data", (data) => {
275732
+ data.toString().split(`
275733
+ `).filter(Boolean).forEach((l) => processLine(l, false));
275734
+ });
275735
+ child.stderr?.on("data", (data) => {
275736
+ data.toString().split(`
275737
+ `).filter(Boolean).forEach((l) => processLine(l, true));
275738
+ });
275739
+ child.on("close", (code) => {
275740
+ if (errorTimer)
275741
+ clearTimeout(errorTimer);
275742
+ flushError();
275743
+ exitCallbacks.forEach((cb) => cb(code));
275744
+ });
275745
+ return {
275746
+ kill: () => child.kill(),
275747
+ onLog: (cb) => logCallbacks.push(cb),
275748
+ onError: (cb) => errorCallbacks.push(cb),
275749
+ onExit: (cb) => exitCallbacks.push(cb),
275750
+ onInputRequest: (cb) => inputRequestCallbacks.push(cb),
275751
+ sendInput: (text) => {
275752
+ child.stdin?.write(text + `
275753
+ `);
275754
+ }
275755
+ };
275756
+ }
275757
+ function readPackageJson(repoPath) {
275758
+ const p = path20.join(repoPath, "package.json");
275759
+ if (!existsSync15(p))
275760
+ return "";
275761
+ try {
275762
+ const pkg = JSON.parse(readFileSync13(p, "utf-8"));
275763
+ const deps = {
275764
+ ...pkg.dependencies ?? {},
275765
+ ...pkg.devDependencies ?? {}
275766
+ };
275767
+ return Object.keys(deps).slice(0, 30).join(", ");
275768
+ } catch {
275769
+ return "";
275770
+ }
275771
+ }
275772
+
275773
+ // src/components/watch/WatchRunner.tsx
275902
275774
  var jsx_dev_runtime24 = __toESM(require_jsx_dev_runtime(), 1);
275775
+ var MAX_LOGS2 = 120;
275776
+ var MAX_SUGGESTIONS = 8;
275777
+ function stripAnsi2(str) {
275778
+ return str.replace(/\x1b\[[0-9;]*m/g, "");
275779
+ }
275780
+ function buildWatchSystemPrompt(repoPath, deps, importantFiles, lensContext, extraPrompt) {
275781
+ const base2 = buildSystemPrompt(importantFiles, "", undefined);
275782
+ const sections = [base2];
275783
+ if (lensContext) {
275784
+ sections.push(`## PROJECT CONTEXT (from LENS.md)
275785
+
275786
+ ${lensContext}`);
275787
+ }
275788
+ if (extraPrompt) {
275789
+ sections.push(`## ADDITIONAL CONTEXT (HIGHEST PRIORITY — override your assumptions with this)
275790
+
275791
+ ${extraPrompt}
275792
+
275793
+ When providing patches, you MUST follow the above context. Do not guess intent — use exactly what is described above.`);
275794
+ }
275795
+ sections.push(`## WATCH MODE
275796
+
275797
+ You are monitoring a running dev process at: ${repoPath}
275798
+ ${deps ? `Project dependencies: ${deps}` : ""}
275799
+
275800
+ When an error occurs you will be given the error output. You should:
275801
+ 1. Use your tools to investigate — read the erroring file, grep for related patterns, check imports
275802
+ 2. Explain the error in plain language (2-3 sentences max)
275803
+ 3. Give a specific fix referencing actual file names and line numbers
275804
+
275805
+ After investigating, respond ONLY with this exact JSON (no markdown, no backticks):
275806
+ {
275807
+ "errorSummary": "one line — what went wrong",
275808
+ "simplified": "2-3 sentences plain language explanation",
275809
+ "fix": "specific actionable fix with file names and line numbers",
275810
+ "patch": null
275811
+ }
275812
+
275813
+ If confident in a code fix, replace patch with:
275814
+ { "path": "relative/path.ts", "content": "complete corrected file content", "isNew": false }
275815
+
275816
+ CRITICAL patch rules:
275817
+ - You MUST read the file with read-file BEFORE providing a patch
275818
+ - The patch content must be the COMPLETE file with ONLY the broken lines changed
275819
+ - Do NOT simplify, rewrite, or remove any existing code
275820
+ - Do NOT invent new content — preserve every function, comment, and line exactly as-is except the fix
275821
+ - If you haven't read the file yet, use read-file first, then respond with the JSON`);
275822
+ return sections.join(`
275823
+
275824
+ `);
275825
+ }
275826
+ function buildErrorPrompt(chunk2) {
275827
+ return `Error detected in dev process:
275828
+
275829
+ \`\`\`
275830
+ ${chunk2.lines.join(`
275831
+ `).slice(0, 2000)}
275832
+ \`\`\`
275833
+
275834
+ ${chunk2.contextBefore.length > 0 ? `Log context before error:
275835
+ \`\`\`
275836
+ ${chunk2.contextBefore.join(`
275837
+ `)}
275838
+ \`\`\`` : ""}
275839
+ ${chunk2.filePath ? `Error file: ${chunk2.filePath}${chunk2.lineNumber ? `:${chunk2.lineNumber}` : ""}` : ""}
275840
+
275841
+ Use read-file to read the full file content first, then respond with the JSON. Do not provide a patch without reading the file first.`;
275842
+ }
275843
+ function SuggestionCard({
275844
+ suggestion,
275845
+ isNew,
275846
+ fixAll,
275847
+ repoPath
275848
+ }) {
275849
+ const w = process.stdout.columns ?? 80;
275850
+ const divider = "─".repeat(Math.min(w - 4, 60));
275851
+ const [patchState, setPatchState] = import_react50.useState(fixAll && suggestion.patch ? "applied" : null);
275852
+ use_input_default((input) => {
275853
+ if (!isNew || !suggestion.patch || patchState !== null || fixAll)
275854
+ return;
275855
+ if (input === "y" || input === "Y") {
275856
+ try {
275857
+ applyPatches3(repoPath, [suggestion.patch]);
275858
+ setPatchState("applied");
275859
+ } catch {
275860
+ setPatchState("error");
275861
+ }
275862
+ } else if (input === "n" || input === "N") {
275863
+ setPatchState("skipped");
275864
+ }
275865
+ });
275866
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275867
+ flexDirection: "column",
275868
+ marginBottom: 1,
275869
+ children: [
275870
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275871
+ color: "gray",
275872
+ children: divider
275873
+ }, undefined, false, undefined, this),
275874
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275875
+ gap: 1,
275876
+ children: [
275877
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275878
+ color: RED,
275879
+ children: "✖"
275880
+ }, undefined, false, undefined, this),
275881
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275882
+ color: "white",
275883
+ bold: true,
275884
+ children: suggestion.errorSummary
275885
+ }, undefined, false, undefined, this),
275886
+ isNew && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275887
+ color: ACCENT,
275888
+ bold: true,
275889
+ children: "[new]"
275890
+ }, undefined, false, undefined, this)
275891
+ ]
275892
+ }, undefined, true, undefined, this),
275893
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275894
+ marginLeft: 2,
275895
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275896
+ color: "gray",
275897
+ children: suggestion.simplified
275898
+ }, undefined, false, undefined, this)
275899
+ }, undefined, false, undefined, this),
275900
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275901
+ marginLeft: 2,
275902
+ marginTop: 1,
275903
+ flexDirection: "column",
275904
+ children: [
275905
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275906
+ color: CYAN,
275907
+ bold: true,
275908
+ children: "fix →"
275909
+ }, undefined, false, undefined, this),
275910
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275911
+ marginLeft: 2,
275912
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275913
+ color: TEXT,
275914
+ children: suggestion.fix
275915
+ }, undefined, false, undefined, this)
275916
+ }, undefined, false, undefined, this)
275917
+ ]
275918
+ }, undefined, true, undefined, this),
275919
+ suggestion.patch && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275920
+ marginLeft: 2,
275921
+ marginTop: 1,
275922
+ flexDirection: "column",
275923
+ gap: 1,
275924
+ children: [
275925
+ patchState === "applied" && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275926
+ gap: 1,
275927
+ children: [
275928
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275929
+ color: ACCENT,
275930
+ children: "✔"
275931
+ }, undefined, false, undefined, this),
275932
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275933
+ color: GREEN,
275934
+ children: [
275935
+ "patch applied →",
275936
+ " ",
275937
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275938
+ color: "white",
275939
+ children: suggestion.patch.path
275940
+ }, undefined, false, undefined, this)
275941
+ ]
275942
+ }, undefined, true, undefined, this)
275943
+ ]
275944
+ }, undefined, true, undefined, this),
275945
+ patchState === "skipped" && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275946
+ gap: 1,
275947
+ children: [
275948
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275949
+ color: "gray",
275950
+ dimColor: true,
275951
+ children: "✗"
275952
+ }, undefined, false, undefined, this),
275953
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275954
+ color: "gray",
275955
+ dimColor: true,
275956
+ children: "patch skipped"
275957
+ }, undefined, false, undefined, this)
275958
+ ]
275959
+ }, undefined, true, undefined, this),
275960
+ patchState === "error" && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275961
+ gap: 1,
275962
+ children: [
275963
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275964
+ color: RED,
275965
+ children: "✗"
275966
+ }, undefined, false, undefined, this),
275967
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275968
+ color: RED,
275969
+ children: "failed to apply patch"
275970
+ }, undefined, false, undefined, this)
275971
+ ]
275972
+ }, undefined, true, undefined, this),
275973
+ patchState === null && !fixAll && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
275974
+ gap: 1,
275975
+ children: [
275976
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275977
+ color: "gray",
275978
+ dimColor: true,
275979
+ children: figures_default.pointer
275980
+ }, undefined, false, undefined, this),
275981
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275982
+ color: "gray",
275983
+ dimColor: true,
275984
+ children: suggestion.patch.path
275985
+ }, undefined, false, undefined, this),
275986
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275987
+ color: "gray",
275988
+ dimColor: true,
275989
+ children: "·"
275990
+ }, undefined, false, undefined, this),
275991
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275992
+ color: ACCENT,
275993
+ bold: true,
275994
+ children: "y"
275995
+ }, undefined, false, undefined, this),
275996
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
275997
+ color: "white",
275998
+ children: "apply patch"
275999
+ }, undefined, false, undefined, this),
276000
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276001
+ color: "gray",
276002
+ dimColor: true,
276003
+ children: "·"
276004
+ }, undefined, false, undefined, this),
276005
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276006
+ color: "gray",
276007
+ bold: true,
276008
+ children: "n"
276009
+ }, undefined, false, undefined, this),
276010
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276011
+ color: "gray",
276012
+ children: "skip"
276013
+ }, undefined, false, undefined, this)
276014
+ ]
276015
+ }, undefined, true, undefined, this)
276016
+ ]
276017
+ }, undefined, true, undefined, this),
276018
+ suggestion.filePath && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276019
+ marginLeft: 2,
276020
+ gap: 1,
276021
+ children: [
276022
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276023
+ color: "gray",
276024
+ dimColor: true,
276025
+ children: figures_default.pointer
276026
+ }, undefined, false, undefined, this),
276027
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276028
+ color: "gray",
276029
+ dimColor: true,
276030
+ children: suggestion.filePath
276031
+ }, undefined, false, undefined, this)
276032
+ ]
276033
+ }, undefined, true, undefined, this)
276034
+ ]
276035
+ }, undefined, true, undefined, this);
276036
+ }
276037
+ var INVESTIGATION_TIMEOUT_MS = 60000;
276038
+ function ThinkingCard({
276039
+ chunk: chunk2,
276040
+ toolLog,
276041
+ startTime
276042
+ }) {
276043
+ const [elapsed, setElapsed] = import_react50.useState(0);
276044
+ import_react50.useEffect(() => {
276045
+ const t = setInterval(() => setElapsed(Math.floor((Date.now() - startTime) / 1000)), 1000);
276046
+ return () => clearInterval(t);
276047
+ }, [startTime]);
276048
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276049
+ flexDirection: "column",
276050
+ marginBottom: 1,
276051
+ children: [
276052
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276053
+ gap: 1,
276054
+ children: [
276055
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276056
+ color: ACCENT,
276057
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(build_default, {}, undefined, false, undefined, this)
276058
+ }, undefined, false, undefined, this),
276059
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276060
+ color: "gray",
276061
+ dimColor: true,
276062
+ children: chunk2.lines[0]?.slice(0, 50) ?? ""
276063
+ }, undefined, false, undefined, this),
276064
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276065
+ color: "gray",
276066
+ dimColor: true,
276067
+ children: [
276068
+ elapsed,
276069
+ "s"
276070
+ ]
276071
+ }, undefined, true, undefined, this),
276072
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276073
+ color: "gray",
276074
+ children: "investigating..."
276075
+ }, undefined, false, undefined, this)
276076
+ ]
276077
+ }, undefined, true, undefined, this),
276078
+ toolLog.slice(-3).map((t, i) => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276079
+ marginLeft: 2,
276080
+ gap: 1,
276081
+ children: [
276082
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276083
+ color: "gray",
276084
+ dimColor: true,
276085
+ children: "$"
276086
+ }, undefined, false, undefined, this),
276087
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276088
+ color: "gray",
276089
+ dimColor: true,
276090
+ children: t
276091
+ }, undefined, false, undefined, this)
276092
+ ]
276093
+ }, i, true, undefined, this))
276094
+ ]
276095
+ }, undefined, true, undefined, this);
276096
+ }
276097
+ function ConfirmCard({ pending }) {
276098
+ const w = process.stdout.columns ?? 80;
276099
+ const divider = "─".repeat(Math.min(w - 4, 60));
276100
+ const preview = pending.chunk.lines[0]?.slice(0, 60) ?? "error detected";
276101
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276102
+ flexDirection: "column",
276103
+ marginBottom: 1,
276104
+ children: [
276105
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276106
+ color: "gray",
276107
+ children: divider
276108
+ }, undefined, false, undefined, this),
276109
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276110
+ gap: 1,
276111
+ children: [
276112
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276113
+ color: RED,
276114
+ children: "✖"
276115
+ }, undefined, false, undefined, this),
276116
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276117
+ color: "white",
276118
+ children: preview
276119
+ }, undefined, false, undefined, this)
276120
+ ]
276121
+ }, undefined, true, undefined, this),
276122
+ pending.chunk.filePath && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276123
+ marginLeft: 2,
276124
+ gap: 1,
276125
+ children: [
276126
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276127
+ color: "gray",
276128
+ dimColor: true,
276129
+ children: figures_default.pointer
276130
+ }, undefined, false, undefined, this),
276131
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276132
+ color: "gray",
276133
+ dimColor: true,
276134
+ children: [
276135
+ pending.chunk.filePath,
276136
+ pending.chunk.lineNumber ? `:${pending.chunk.lineNumber}` : ""
276137
+ ]
276138
+ }, undefined, true, undefined, this)
276139
+ ]
276140
+ }, undefined, true, undefined, this),
276141
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276142
+ marginLeft: 2,
276143
+ marginTop: 1,
276144
+ gap: 1,
276145
+ children: [
276146
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276147
+ color: ACCENT,
276148
+ bold: true,
276149
+ children: "y"
276150
+ }, undefined, false, undefined, this),
276151
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276152
+ color: "white",
276153
+ children: "investigate"
276154
+ }, undefined, false, undefined, this),
276155
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276156
+ color: "gray",
276157
+ dimColor: true,
276158
+ children: "·"
276159
+ }, undefined, false, undefined, this),
276160
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276161
+ color: "gray",
276162
+ bold: true,
276163
+ children: "n"
276164
+ }, undefined, false, undefined, this),
276165
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276166
+ color: "gray",
276167
+ children: "skip"
276168
+ }, undefined, false, undefined, this)
276169
+ ]
276170
+ }, undefined, true, undefined, this)
276171
+ ]
276172
+ }, undefined, true, undefined, this);
276173
+ }
276174
+ function InputCard({ prompt, value }) {
276175
+ const w = process.stdout.columns ?? 80;
276176
+ const divider = "─".repeat(Math.min(w - 4, 60));
276177
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276178
+ flexDirection: "column",
276179
+ marginBottom: 1,
276180
+ children: [
276181
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276182
+ color: "gray",
276183
+ children: divider
276184
+ }, undefined, false, undefined, this),
276185
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276186
+ gap: 1,
276187
+ children: [
276188
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276189
+ color: CYAN,
276190
+ bold: true,
276191
+ children: "⌨"
276192
+ }, undefined, false, undefined, this),
276193
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276194
+ color: "white",
276195
+ children: prompt
276196
+ }, undefined, false, undefined, this)
276197
+ ]
276198
+ }, undefined, true, undefined, this),
276199
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276200
+ marginLeft: 2,
276201
+ marginTop: 1,
276202
+ gap: 1,
276203
+ children: [
276204
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276205
+ color: ACCENT,
276206
+ children: ">"
276207
+ }, undefined, false, undefined, this),
276208
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276209
+ color: "white",
276210
+ children: value
276211
+ }, undefined, false, undefined, this),
276212
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276213
+ color: ACCENT,
276214
+ children: "▋"
276215
+ }, undefined, false, undefined, this)
276216
+ ]
276217
+ }, undefined, true, undefined, this),
276218
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276219
+ marginLeft: 2,
276220
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276221
+ color: "gray",
276222
+ dimColor: true,
276223
+ children: "enter to confirm"
276224
+ }, undefined, false, undefined, this)
276225
+ }, undefined, false, undefined, this)
276226
+ ]
276227
+ }, undefined, true, undefined, this);
276228
+ }
276229
+ function WatchRunner({
276230
+ cmd,
276231
+ repoPath,
276232
+ clean,
276233
+ fixAll,
276234
+ autoRestart,
276235
+ extraPrompt
276236
+ }) {
276237
+ const [stage, setStage] = import_react50.useState({ type: "picking-provider" });
276238
+ const [logs, setLogs] = import_react50.useState([]);
276239
+ const [suggestions, setSuggestions] = import_react50.useState([]);
276240
+ const [active, setActive] = import_react50.useState([]);
276241
+ const [lensLoaded, setLensLoaded] = import_react50.useState(false);
276242
+ const [pendingQueue, setPendingQueue] = import_react50.useState([]);
276243
+ const [fixedCount, setFixedCount] = import_react50.useState(0);
276244
+ const [inputRequest, setInputRequest] = import_react50.useState(null);
276245
+ const [inputValue, setInputValue] = import_react50.useState("");
276246
+ const processRef = import_react50.useRef(null);
276247
+ const providerRef = import_react50.useRef(null);
276248
+ const systemPromptRef = import_react50.useRef("");
276249
+ const activeCountRef = import_react50.useRef(0);
276250
+ const pendingExitCode = import_react50.useRef(undefined);
276251
+ const abortControllersRef = import_react50.useRef(new Map);
276252
+ const patchedThisRunRef = import_react50.useRef(0);
276253
+ const { stdout } = use_stdout_default();
276254
+ const currentPending = pendingQueue[0] ?? null;
276255
+ const handleRestart = () => {
276256
+ pendingExitCode.current = undefined;
276257
+ activeCountRef.current = 0;
276258
+ abortControllersRef.current.forEach((a) => a.abort());
276259
+ abortControllersRef.current.clear();
276260
+ processRef.current?.kill();
276261
+ setActive([]);
276262
+ setSuggestions([]);
276263
+ setLogs([]);
276264
+ setPendingQueue([]);
276265
+ setStage({ type: "running" });
276266
+ startWatching();
276267
+ };
276268
+ use_input_default((input, key) => {
276269
+ if (key.ctrl && input === "c") {
276270
+ processRef.current?.kill();
276271
+ process.exit(0);
276272
+ }
276273
+ if (inputRequest !== null) {
276274
+ if (key.return) {
276275
+ processRef.current?.sendInput(inputValue);
276276
+ setInputRequest(null);
276277
+ setInputValue("");
276278
+ } else if (key.backspace || key.delete) {
276279
+ setInputValue((v) => v.slice(0, -1));
276280
+ } else if (input && !key.ctrl && !key.meta) {
276281
+ setInputValue((v) => v + input);
276282
+ }
276283
+ return;
276284
+ }
276285
+ if (stage.type === "crashed" && (input === "r" || input === "R")) {
276286
+ handleRestart();
276287
+ }
276288
+ if (currentPending) {
276289
+ if (input === "y" || input === "Y") {
276290
+ const confirmed = currentPending;
276291
+ setPendingQueue((prev) => prev.filter((p) => p.id !== confirmed.id));
276292
+ dispatchInvestigation(confirmed.id, confirmed.chunk);
276293
+ } else if (input === "n" || input === "N") {
276294
+ activeCountRef.current -= 1;
276295
+ setPendingQueue((prev) => prev.filter((p) => p.id !== currentPending.id));
276296
+ if (activeCountRef.current === 0 && pendingExitCode.current !== undefined) {
276297
+ setStage({
276298
+ type: "crashed",
276299
+ exitCode: pendingExitCode.current,
276300
+ patchedCount: patchedThisRunRef.current
276301
+ });
276302
+ }
276303
+ }
276304
+ }
276305
+ });
276306
+ const handleProviderDone = async (p) => {
276307
+ providerRef.current = p;
276308
+ try {
276309
+ const fileTree = await fetchFileTree(repoPath).catch(() => []);
276310
+ const importantFiles = readImportantFiles(repoPath, fileTree);
276311
+ const deps = readPackageJson(repoPath);
276312
+ let lensContext = "";
276313
+ if (lensFileExists(repoPath)) {
276314
+ const lensFile = readLensFile(repoPath);
276315
+ if (lensFile) {
276316
+ setLensLoaded(true);
276317
+ lensContext = `Overview: ${lensFile.overview}
276318
+
276319
+ Important folders: ${lensFile.importantFolders.join(", ")}
276320
+ ${lensFile.securityIssues.length > 0 ? `
276321
+ Known security issues:
276322
+ ${lensFile.securityIssues.map((s) => `- ${s}`).join(`
276323
+ `)}` : ""}
276324
+ ${lensFile.suggestions.length > 0 ? `
276325
+ Project suggestions:
276326
+ ${lensFile.suggestions.map((s) => `- ${s}`).join(`
276327
+ `)}` : ""}`;
276328
+ }
276329
+ }
276330
+ systemPromptRef.current = buildWatchSystemPrompt(repoPath, deps, importantFiles, lensContext, extraPrompt ?? "");
276331
+ } catch {
276332
+ systemPromptRef.current = buildWatchSystemPrompt(repoPath, "", [], "", extraPrompt ?? "");
276333
+ }
276334
+ setStage({ type: "running" });
276335
+ startWatching();
276336
+ };
276337
+ const startWatching = () => {
276338
+ patchedThisRunRef.current = 0;
276339
+ const proc = spawnWatch(cmd, repoPath);
276340
+ processRef.current = proc;
276341
+ proc.onLog((line, isErr) => {
276342
+ const text = stripAnsi2(line).slice(0, 200);
276343
+ setLogs((prev) => {
276344
+ const next = [...prev, { text, isErr }];
276345
+ return next.length > MAX_LOGS2 ? next.slice(-MAX_LOGS2) : next;
276346
+ });
276347
+ });
276348
+ proc.onError((chunk2) => {
276349
+ const id = nanoid(6);
276350
+ activeCountRef.current += 1;
276351
+ if (fixAll) {
276352
+ const abort = new AbortController;
276353
+ abortControllersRef.current.set(id, abort);
276354
+ const t = Date.now();
276355
+ setActive((prev) => [
276356
+ ...prev,
276357
+ { id, chunk: chunk2, toolLog: [], startTime: t }
276358
+ ]);
276359
+ const initialMessages = [
276360
+ { role: "user", content: buildErrorPrompt(chunk2), type: "text" }
276361
+ ];
276362
+ runInvestigation(id, chunk2, initialMessages, abort.signal, t);
276363
+ } else {
276364
+ setPendingQueue((prev) => [...prev, { id, chunk: chunk2 }]);
276365
+ }
276366
+ });
276367
+ proc.onInputRequest((prompt) => {
276368
+ setInputRequest(prompt);
276369
+ setInputValue("");
276370
+ });
276371
+ proc.onExit((code) => {
276372
+ pendingExitCode.current = code;
276373
+ setTimeout(() => {
276374
+ if (activeCountRef.current === 0) {
276375
+ setStage({
276376
+ type: "crashed",
276377
+ exitCode: code,
276378
+ patchedCount: patchedThisRunRef.current
276379
+ });
276380
+ }
276381
+ }, 0);
276382
+ });
276383
+ };
276384
+ const dispatchInvestigation = (id, chunk2) => {
276385
+ const abort = new AbortController;
276386
+ abortControllersRef.current.set(id, abort);
276387
+ const t = Date.now();
276388
+ setActive((prev) => [...prev, { id, chunk: chunk2, toolLog: [], startTime: t }]);
276389
+ const initialMessages = [
276390
+ { role: "user", content: buildErrorPrompt(chunk2), type: "text" }
276391
+ ];
276392
+ runInvestigation(id, chunk2, initialMessages, abort.signal, t);
276393
+ };
276394
+ import_react50.useEffect(() => {
276395
+ return () => {
276396
+ processRef.current?.kill();
276397
+ abortControllersRef.current.forEach((a) => a.abort());
276398
+ };
276399
+ }, []);
276400
+ import_react50.useEffect(() => {
276401
+ if (autoRestart && stage.type === "crashed") {
276402
+ const t = setTimeout(() => handleRestart(), 1500);
276403
+ return () => clearTimeout(t);
276404
+ }
276405
+ }, [stage.type]);
276406
+ const runInvestigation = async (id, chunk2, messages, signal, startTime = Date.now()) => {
276407
+ const provider = providerRef.current;
276408
+ if (!provider || signal.aborted)
276409
+ return;
276410
+ const finishInvestigation = () => {
276411
+ activeCountRef.current -= 1;
276412
+ setActive((prev) => prev.filter((a) => a.id !== id));
276413
+ if (activeCountRef.current === 0 && pendingExitCode.current !== undefined) {
276414
+ setTimeout(() => {
276415
+ setStage({
276416
+ type: "crashed",
276417
+ exitCode: pendingExitCode.current,
276418
+ patchedCount: patchedThisRunRef.current
276419
+ });
276420
+ }, 100);
276421
+ }
276422
+ };
276423
+ try {
276424
+ const timeoutController = new AbortController;
276425
+ const timeoutId = setTimeout(() => timeoutController.abort(), INVESTIGATION_TIMEOUT_MS);
276426
+ const combinedSignal = AbortSignal.any ? AbortSignal.any([signal, timeoutController.signal]) : signal;
276427
+ let raw;
276428
+ try {
276429
+ raw = await callChat(provider, systemPromptRef.current, messages, combinedSignal);
276430
+ } finally {
276431
+ clearTimeout(timeoutId);
276432
+ }
276433
+ if (signal.aborted)
276434
+ return;
276435
+ const parsed = parseResponse(raw);
276436
+ if (parsed.kind === "tool") {
276437
+ const tool = registry.get(parsed.toolName);
276438
+ if (!tool)
276439
+ throw new Error(`unknown tool: ${parsed.toolName}`);
276440
+ const label = tool.summariseInput ? String(tool.summariseInput(parsed.input)) : parsed.toolName;
276441
+ setActive((prev) => prev.map((a) => a.id === id ? { ...a, toolLog: [...a.toolLog, label] } : a));
276442
+ const approved = tool.safe || fixAll;
276443
+ let result2 = "(denied)";
276444
+ if (approved) {
276445
+ try {
276446
+ const r = await tool.execute(parsed.input, { repoPath, messages });
276447
+ result2 = r.value;
276448
+ if (r.kind === "image") {
276449
+ stdout.write(result2 + `
276450
+ `);
276451
+ result2 = "(image rendered)";
276452
+ }
276453
+ } catch (e) {
276454
+ result2 = `Error: ${e.message}`;
276455
+ }
276456
+ }
276457
+ const nextMessages = [
276458
+ ...messages,
276459
+ {
276460
+ role: "user",
276461
+ content: approved ? `Tool result for <${parsed.toolName}>:
276462
+ ${result2}` : `Tool <${parsed.toolName}> was denied.`,
276463
+ type: "text"
276464
+ }
276465
+ ];
276466
+ return runInvestigation(id, chunk2, nextMessages, signal, startTime);
276467
+ }
276468
+ const text = parsed.kind === "text" ? parsed.content : raw;
276469
+ const cleaned = text.replace(/```json|```/g, "").trim();
276470
+ const match = cleaned.match(/\{[\s\S]*\}/);
276471
+ if (match) {
276472
+ const data = JSON.parse(match[0]);
276473
+ const suggestion = {
276474
+ id,
276475
+ errorSummary: data.errorSummary,
276476
+ simplified: data.simplified,
276477
+ fix: data.fix,
276478
+ filePath: chunk2.filePath,
276479
+ patch: data.patch ?? undefined,
276480
+ timestamp: Date.now()
276481
+ };
276482
+ if (fixAll && data.patch) {
276483
+ try {
276484
+ applyPatches3(repoPath, [data.patch]);
276485
+ setFixedCount((n) => n + 1);
276486
+ patchedThisRunRef.current += 1;
276487
+ } catch {}
276488
+ }
276489
+ const elapsed = Date.now() - startTime;
276490
+ if (elapsed < 800)
276491
+ await new Promise((r) => setTimeout(r, 800 - elapsed));
276492
+ setSuggestions((prev) => {
276493
+ const next = [...prev, suggestion];
276494
+ return next.length > MAX_SUGGESTIONS ? next.slice(-MAX_SUGGESTIONS) : next;
276495
+ });
276496
+ finishInvestigation();
276497
+ } else {
276498
+ const elapsed = Date.now() - startTime;
276499
+ if (elapsed < 800)
276500
+ await new Promise((r) => setTimeout(r, 800 - elapsed));
276501
+ finishInvestigation();
276502
+ }
276503
+ } catch (e) {
276504
+ if (e?.name === "AbortError" && signal.aborted)
276505
+ return;
276506
+ const errMsg = e?.name === "AbortError" ? `Timed out after ${INVESTIGATION_TIMEOUT_MS / 1000}s — provider may be slow or unreachable` : e?.message ?? String(e);
276507
+ const elapsed = Date.now() - startTime;
276508
+ if (elapsed < 800)
276509
+ await new Promise((r) => setTimeout(r, 800 - elapsed));
276510
+ setSuggestions((prev) => [
276511
+ ...prev,
276512
+ {
276513
+ id,
276514
+ errorSummary: chunk2.lines[0]?.slice(0, 80) ?? "Error",
276515
+ simplified: `Investigation failed: ${errMsg}`,
276516
+ fix: "Check your provider config or try again.",
276517
+ filePath: chunk2.filePath,
276518
+ timestamp: Date.now()
276519
+ }
276520
+ ]);
276521
+ finishInvestigation();
276522
+ }
276523
+ };
276524
+ if (stage.type === "picking-provider") {
276525
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ProviderPicker, {
276526
+ onDone: handleProviderDone
276527
+ }, undefined, false, undefined, this);
276528
+ }
276529
+ const w = process.stdout.columns ?? 80;
276530
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276531
+ flexDirection: "column",
276532
+ children: [
276533
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276534
+ flexDirection: "column",
276535
+ marginBottom: 1,
276536
+ children: [
276537
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276538
+ color: ACCENT,
276539
+ bold: true,
276540
+ children: [
276541
+ "◈ SPY",
276542
+ " ",
276543
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276544
+ color: "white",
276545
+ bold: false,
276546
+ children: cmd
276547
+ }, undefined, false, undefined, this),
276548
+ clean && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276549
+ color: "gray",
276550
+ bold: false,
276551
+ children: [
276552
+ " ",
276553
+ "--clean"
276554
+ ]
276555
+ }, undefined, true, undefined, this),
276556
+ fixAll && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276557
+ color: GREEN,
276558
+ bold: false,
276559
+ children: [
276560
+ " ",
276561
+ "--fix-all"
276562
+ ]
276563
+ }, undefined, true, undefined, this),
276564
+ autoRestart && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276565
+ color: CYAN,
276566
+ bold: false,
276567
+ children: [
276568
+ " ",
276569
+ "--auto-restart"
276570
+ ]
276571
+ }, undefined, true, undefined, this),
276572
+ extraPrompt && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276573
+ color: "gray",
276574
+ bold: false,
276575
+ children: [
276576
+ " ",
276577
+ "--prompt"
276578
+ ]
276579
+ }, undefined, true, undefined, this),
276580
+ lensLoaded && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276581
+ color: ACCENT,
276582
+ bold: false,
276583
+ children: [
276584
+ " ",
276585
+ "[LENS.md]"
276586
+ ]
276587
+ }, undefined, true, undefined, this),
276588
+ fixedCount > 0 && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276589
+ color: GREEN,
276590
+ bold: false,
276591
+ children: [
276592
+ " ",
276593
+ "(",
276594
+ fixedCount,
276595
+ " fixed)"
276596
+ ]
276597
+ }, undefined, true, undefined, this)
276598
+ ]
276599
+ }, undefined, true, undefined, this),
276600
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276601
+ color: "gray",
276602
+ children: "═".repeat(Math.min(w, 80))
276603
+ }, undefined, false, undefined, this)
276604
+ ]
276605
+ }, undefined, true, undefined, this),
276606
+ !clean && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276607
+ flexDirection: "column",
276608
+ marginBottom: 1,
276609
+ children: [
276610
+ logs.slice(-Math.max(4, (process.stdout.rows ?? 24) - 10)).map((log, i) => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276611
+ color: log.isErr ? RED : "gray",
276612
+ dimColor: !log.isErr,
276613
+ children: log.text
276614
+ }, i, false, undefined, this)),
276615
+ stage.type === "running" && logs.length === 0 && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276616
+ gap: 1,
276617
+ children: [
276618
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276619
+ color: ACCENT,
276620
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(build_default, {}, undefined, false, undefined, this)
276621
+ }, undefined, false, undefined, this),
276622
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276623
+ color: "gray",
276624
+ children: "waiting for output..."
276625
+ }, undefined, false, undefined, this)
276626
+ ]
276627
+ }, undefined, true, undefined, this)
276628
+ ]
276629
+ }, undefined, true, undefined, this),
276630
+ inputRequest !== null && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(InputCard, {
276631
+ prompt: inputRequest,
276632
+ value: inputValue
276633
+ }, undefined, false, undefined, this),
276634
+ (suggestions.length > 0 || active.length > 0 || currentPending) && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276635
+ marginBottom: 1,
276636
+ gap: 1,
276637
+ children: [
276638
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276639
+ color: ACCENT,
276640
+ bold: true,
276641
+ children: "◈ LENS"
276642
+ }, undefined, false, undefined, this),
276643
+ fixAll && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276644
+ color: GREEN,
276645
+ children: "· auto-fixing"
276646
+ }, undefined, false, undefined, this)
276647
+ ]
276648
+ }, undefined, true, undefined, this),
276649
+ currentPending && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ConfirmCard, {
276650
+ pending: currentPending
276651
+ }, undefined, false, undefined, this),
276652
+ pendingQueue.length > 1 && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276653
+ marginLeft: 2,
276654
+ marginBottom: 1,
276655
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276656
+ color: "gray",
276657
+ dimColor: true,
276658
+ children: [
276659
+ "+",
276660
+ pendingQueue.length - 1,
276661
+ " more error",
276662
+ pendingQueue.length - 1 > 1 ? "s" : "",
276663
+ " queued"
276664
+ ]
276665
+ }, undefined, true, undefined, this)
276666
+ }, undefined, false, undefined, this),
276667
+ active.map((a) => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ThinkingCard, {
276668
+ chunk: a.chunk,
276669
+ toolLog: a.toolLog,
276670
+ startTime: a.startTime
276671
+ }, a.id, false, undefined, this)),
276672
+ suggestions.map((s, i) => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(SuggestionCard, {
276673
+ suggestion: s,
276674
+ isNew: i === suggestions.length - 1,
276675
+ fixAll,
276676
+ repoPath
276677
+ }, s.id, false, undefined, this)),
276678
+ clean && suggestions.length === 0 && active.length === 0 && !currentPending && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276679
+ gap: 1,
276680
+ marginTop: 1,
276681
+ children: [
276682
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276683
+ color: ACCENT,
276684
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(build_default, {}, undefined, false, undefined, this)
276685
+ }, undefined, false, undefined, this),
276686
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276687
+ color: "gray",
276688
+ children: "watching for errors..."
276689
+ }, undefined, false, undefined, this)
276690
+ ]
276691
+ }, undefined, true, undefined, this),
276692
+ stage.type === "crashed" && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276693
+ flexDirection: "column",
276694
+ marginTop: 1,
276695
+ gap: 1,
276696
+ children: [
276697
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276698
+ gap: 1,
276699
+ children: [
276700
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276701
+ color: RED,
276702
+ children: "✗"
276703
+ }, undefined, false, undefined, this),
276704
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276705
+ color: "white",
276706
+ children: [
276707
+ "process exited",
276708
+ stage.exitCode !== null ? ` (code ${stage.exitCode})` : ""
276709
+ ]
276710
+ }, undefined, true, undefined, this)
276711
+ ]
276712
+ }, undefined, true, undefined, this),
276713
+ autoRestart && stage.patchedCount > 0 && stage.exitCode !== 0 ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276714
+ gap: 1,
276715
+ children: [
276716
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276717
+ color: ACCENT,
276718
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(build_default, {}, undefined, false, undefined, this)
276719
+ }, undefined, false, undefined, this),
276720
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276721
+ color: "gray",
276722
+ children: "restarting..."
276723
+ }, undefined, false, undefined, this)
276724
+ ]
276725
+ }, undefined, true, undefined, this) : stage.patchedCount > 0 ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276726
+ flexDirection: "column",
276727
+ gap: 1,
276728
+ children: [
276729
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276730
+ gap: 1,
276731
+ children: [
276732
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276733
+ color: ACCENT,
276734
+ children: "✔"
276735
+ }, undefined, false, undefined, this),
276736
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276737
+ color: GREEN,
276738
+ children: [
276739
+ stage.patchedCount,
276740
+ " patch",
276741
+ stage.patchedCount > 1 ? "es" : "",
276742
+ " ",
276743
+ "applied"
276744
+ ]
276745
+ }, undefined, true, undefined, this)
276746
+ ]
276747
+ }, undefined, true, undefined, this),
276748
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276749
+ gap: 1,
276750
+ children: [
276751
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276752
+ color: ACCENT,
276753
+ bold: true,
276754
+ children: "r"
276755
+ }, undefined, false, undefined, this),
276756
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276757
+ color: "white",
276758
+ children: "re-run to verify fixes"
276759
+ }, undefined, false, undefined, this),
276760
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276761
+ color: "gray",
276762
+ dimColor: true,
276763
+ children: "· ctrl+c to quit"
276764
+ }, undefined, false, undefined, this)
276765
+ ]
276766
+ }, undefined, true, undefined, this)
276767
+ ]
276768
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276769
+ gap: 1,
276770
+ children: [
276771
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276772
+ color: ACCENT,
276773
+ bold: true,
276774
+ children: "r"
276775
+ }, undefined, false, undefined, this),
276776
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276777
+ color: "white",
276778
+ children: "re-run"
276779
+ }, undefined, false, undefined, this),
276780
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276781
+ color: "gray",
276782
+ dimColor: true,
276783
+ children: "· ctrl+c to quit"
276784
+ }, undefined, false, undefined, this)
276785
+ ]
276786
+ }, undefined, true, undefined, this)
276787
+ ]
276788
+ }, undefined, true, undefined, this),
276789
+ stage.type === "running" && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276790
+ marginTop: 1,
276791
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276792
+ color: "gray",
276793
+ dimColor: true,
276794
+ children: [
276795
+ "ctrl+c to stop",
276796
+ !fixAll && suggestions.some((s) => s.patch) ? " · patches available (use --fix-all to auto-apply)" : ""
276797
+ ]
276798
+ }, undefined, true, undefined, this)
276799
+ }, undefined, false, undefined, this)
276800
+ ]
276801
+ }, undefined, true, undefined, this);
276802
+ }
276803
+
276804
+ // src/commands/watch.tsx
276805
+ var jsx_dev_runtime25 = __toESM(require_jsx_dev_runtime(), 1);
276806
+ function WatchCommand({
276807
+ cmd,
276808
+ path: inputPath,
276809
+ clean,
276810
+ fixAll,
276811
+ autoRestart,
276812
+ prompt
276813
+ }) {
276814
+ const repoPath = path21.resolve(inputPath);
276815
+ if (!cmd.trim()) {
276816
+ return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
276817
+ marginTop: 1,
276818
+ children: /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
276819
+ color: RED,
276820
+ children: [
276821
+ figures_default.cross,
276822
+ ' Usage: lens watch "bun dev"'
276823
+ ]
276824
+ }, undefined, true, undefined, this)
276825
+ }, undefined, false, undefined, this);
276826
+ }
276827
+ if (!existsSync16(repoPath)) {
276828
+ return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
276829
+ marginTop: 1,
276830
+ children: /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
276831
+ color: RED,
276832
+ children: [
276833
+ figures_default.cross,
276834
+ " Path not found: ",
276835
+ repoPath
276836
+ ]
276837
+ }, undefined, true, undefined, this)
276838
+ }, undefined, false, undefined, this);
276839
+ }
276840
+ return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(WatchRunner, {
276841
+ cmd,
276842
+ repoPath,
276843
+ clean,
276844
+ fixAll,
276845
+ autoRestart,
276846
+ extraPrompt: prompt
276847
+ }, undefined, false, undefined, this);
276848
+ }
276849
+
276850
+ // src/commands/timeline.tsx
276851
+ import { existsSync as existsSync17 } from "fs";
276852
+ import path22 from "path";
276853
+ var jsx_dev_runtime26 = __toESM(require_jsx_dev_runtime(), 1);
275903
276854
  var TimelineCommand = ({ path: inputPath }) => {
275904
- const resolvedPath = path20.resolve(inputPath);
275905
- if (!existsSync15(resolvedPath)) {
275906
- return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Box_default, {
276855
+ const resolvedPath = path22.resolve(inputPath);
276856
+ if (!existsSync17(resolvedPath)) {
276857
+ return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(Box_default, {
275907
276858
  marginTop: 1,
275908
- children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Text, {
276859
+ children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(Text, {
275909
276860
  color: "red",
275910
276861
  children: [
275911
276862
  figures_default.cross,
@@ -275915,17 +276866,17 @@ var TimelineCommand = ({ path: inputPath }) => {
275915
276866
  }, undefined, true, undefined, this)
275916
276867
  }, undefined, false, undefined, this);
275917
276868
  }
275918
- return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(TimelineRunner, {
276869
+ return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(TimelineRunner, {
275919
276870
  repoPath: resolvedPath
275920
276871
  }, undefined, false, undefined, this);
275921
276872
  };
275922
276873
 
275923
276874
  // src/commands/commit.tsx
275924
- var import_react50 = __toESM(require_react(), 1);
276875
+ var import_react51 = __toESM(require_react(), 1);
275925
276876
  import { execSync as execSync5 } from "child_process";
275926
- import { existsSync as existsSync16 } from "fs";
275927
- import path21 from "path";
275928
- var jsx_dev_runtime25 = __toESM(require_jsx_dev_runtime(), 1);
276877
+ import { existsSync as existsSync18 } from "fs";
276878
+ import path23 from "path";
276879
+ var jsx_dev_runtime27 = __toESM(require_jsx_dev_runtime(), 1);
275929
276880
  function gitRun3(cmd, cwd2) {
275930
276881
  try {
275931
276882
  const out = execSync5(cmd, {
@@ -275994,9 +276945,9 @@ function validateFiles(files, cwd2) {
275994
276945
  const missing = [];
275995
276946
  const valid = [];
275996
276947
  for (const f of files) {
275997
- const abs = path21.isAbsolute(f) ? f : path21.join(cwd2, f);
275998
- if (existsSync16(abs)) {
275999
- valid.push(path21.relative(cwd2, abs).replace(/\\/g, "/"));
276948
+ const abs = path23.isAbsolute(f) ? f : path23.join(cwd2, f);
276949
+ if (existsSync18(abs)) {
276950
+ valid.push(path23.relative(cwd2, abs).replace(/\\/g, "/"));
276000
276951
  } else {
276001
276952
  missing.push(f);
276002
276953
  }
@@ -276033,7 +276984,7 @@ Rules:
276033
276984
  - Skip bullets that just restate the subject line or describe trivial version bumps
276034
276985
  - Be specific — mention file names, feature names, component names
276035
276986
  - No markdown, no backticks, no code blocks
276036
- - Output ONLY the commit message, nothing else
276987
+ - Output ONLY the commit message, nothing else — no preamble, no explanation, no thinking
276037
276988
 
276038
276989
  Examples of good short commits:
276039
276990
  chore: bump version to 0.1.6
@@ -276046,6 +276997,9 @@ feat(chat): add persistent memory across sessions
276046
276997
  - store memories in ~/.lens/memories per repo
276047
276998
  - inject memory summary into system prompt on load
276048
276999
  - expose /memory commands for manual management`;
277000
+ function stripThinking(raw) {
277001
+ return raw.replace(/<thinking>[\s\S]*?<\/thinking>/g, "").replace(/^[\s\n]+/, "").trim();
277002
+ }
276049
277003
  async function generateCommitMessage(provider, diff2) {
276050
277004
  const msgs = [
276051
277005
  {
@@ -276057,7 +277011,9 @@ ${diff2.slice(0, 8000)}`,
276057
277011
  }
276058
277012
  ];
276059
277013
  const raw = await callChat(provider, SYSTEM_PROMPT, msgs);
276060
- return typeof raw === "string" ? raw.trim() : "chore: update files";
277014
+ if (typeof raw !== "string")
277015
+ return "chore: update files";
277016
+ return stripThinking(raw) || "chore: update files";
276061
277017
  }
276062
277018
  function trunc2(s, n) {
276063
277019
  return s.length > n ? s.slice(0, n - 1) + "…" : s;
@@ -276071,9 +277027,9 @@ function CommitRunner({
276071
277027
  push,
276072
277028
  confirm
276073
277029
  }) {
276074
- const [phase, setPhase] = import_react50.useState({ type: "checking" });
277030
+ const [phase, setPhase] = import_react51.useState({ type: "checking" });
276075
277031
  const phraseText = useThinkingPhrase(phase.type === "generating", "commit", 2800);
276076
- import_react50.useEffect(() => {
277032
+ import_react51.useEffect(() => {
276077
277033
  (async () => {
276078
277034
  if (!gitRun3("git rev-parse --git-dir", cwd2).ok) {
276079
277035
  setPhase({ type: "error", message: "not a git repository" });
@@ -276198,27 +277154,25 @@ ${missing.map((f) => ` ${f}`).join(`
276198
277154
  });
276199
277155
  const w = process.stdout.columns ?? 80;
276200
277156
  const div = "─".repeat(w);
276201
- return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277157
+ return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276202
277158
  flexDirection: "column",
276203
277159
  paddingY: 1,
276204
277160
  children: [
276205
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277161
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276206
277162
  gap: 2,
276207
277163
  marginBottom: 1,
276208
277164
  children: [
276209
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277165
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276210
277166
  color: ACCENT,
276211
277167
  bold: true,
276212
277168
  children: "◈ COMMIT"
276213
277169
  }, undefined, false, undefined, this),
276214
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277170
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276215
277171
  color: "gray",
276216
- dimColor: true,
276217
277172
  children: cwd2
276218
277173
  }, undefined, false, undefined, this),
276219
- files.length > 0 && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277174
+ files.length > 0 && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276220
277175
  color: CYAN,
276221
- dimColor: true,
276222
277176
  children: [
276223
277177
  files.length,
276224
277178
  " file",
@@ -276227,111 +277181,105 @@ ${missing.map((f) => ` ${f}`).join(`
276227
277181
  }, undefined, true, undefined, this)
276228
277182
  ]
276229
277183
  }, undefined, true, undefined, this),
276230
- files.length > 0 && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277184
+ files.length > 0 && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276231
277185
  flexDirection: "column",
276232
277186
  marginBottom: 1,
276233
- children: files.map((f, i) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277187
+ children: files.map((f, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276234
277188
  gap: 1,
276235
277189
  children: [
276236
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277190
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276237
277191
  color: "gray",
276238
- dimColor: true,
276239
277192
  children: " ·"
276240
277193
  }, undefined, false, undefined, this),
276241
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277194
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276242
277195
  color: "white",
276243
277196
  children: f
276244
277197
  }, undefined, false, undefined, this)
276245
277198
  ]
276246
277199
  }, i, true, undefined, this))
276247
277200
  }, undefined, false, undefined, this),
276248
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277201
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276249
277202
  color: "gray",
276250
- dimColor: true,
276251
277203
  children: div
276252
277204
  }, undefined, false, undefined, this),
276253
- phase.type === "checking" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277205
+ phase.type === "checking" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276254
277206
  gap: 1,
276255
277207
  marginTop: 1,
276256
277208
  children: [
276257
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277209
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276258
277210
  color: ACCENT,
276259
277211
  children: "*"
276260
277212
  }, undefined, false, undefined, this),
276261
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277213
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276262
277214
  color: "gray",
276263
- dimColor: true,
276264
277215
  children: "checking changes…"
276265
277216
  }, undefined, false, undefined, this)
276266
277217
  ]
276267
277218
  }, undefined, true, undefined, this),
276268
- phase.type === "staging" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277219
+ phase.type === "staging" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276269
277220
  gap: 1,
276270
277221
  marginTop: 1,
276271
277222
  children: [
276272
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277223
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276273
277224
  color: ACCENT,
276274
277225
  children: "*"
276275
277226
  }, undefined, false, undefined, this),
276276
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277227
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276277
277228
  color: "gray",
276278
- dimColor: true,
276279
277229
  children: phase.files.length > 0 ? `staging ${phase.files.length} file${phase.files.length !== 1 ? "s" : ""}…` : "staging all changes…"
276280
277230
  }, undefined, false, undefined, this)
276281
277231
  ]
276282
277232
  }, undefined, true, undefined, this),
276283
- phase.type === "no-changes" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277233
+ phase.type === "no-changes" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276284
277234
  flexDirection: "column",
276285
277235
  marginTop: 1,
276286
277236
  gap: 1,
276287
- children: /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277237
+ children: /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276288
277238
  gap: 1,
276289
277239
  children: [
276290
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277240
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276291
277241
  color: "yellow",
276292
277242
  children: figures_default.warning
276293
277243
  }, undefined, false, undefined, this),
276294
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277244
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276295
277245
  color: "white",
276296
277246
  children: "nothing to commit — working tree is clean"
276297
277247
  }, undefined, false, undefined, this)
276298
277248
  ]
276299
277249
  }, undefined, true, undefined, this)
276300
277250
  }, undefined, false, undefined, this),
276301
- phase.type === "no-staged" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277251
+ phase.type === "no-staged" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276302
277252
  flexDirection: "column",
276303
277253
  marginTop: 1,
276304
277254
  gap: 1,
276305
277255
  children: [
276306
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277256
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276307
277257
  gap: 1,
276308
277258
  children: [
276309
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277259
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276310
277260
  color: "yellow",
276311
277261
  children: figures_default.warning
276312
277262
  }, undefined, false, undefined, this),
276313
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277263
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276314
277264
  color: "white",
276315
277265
  children: "no staged changes found"
276316
277266
  }, undefined, false, undefined, this)
276317
277267
  ]
276318
277268
  }, undefined, true, undefined, this),
276319
- phase.hasUnstaged && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277269
+ phase.hasUnstaged && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276320
277270
  flexDirection: "column",
276321
277271
  marginLeft: 2,
276322
277272
  gap: 1,
276323
277273
  children: [
276324
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277274
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276325
277275
  color: "gray",
276326
- dimColor: true,
276327
277276
  children: "you have unstaged changes. try:"
276328
277277
  }, undefined, false, undefined, this),
276329
- phase.files.length > 0 ? /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277278
+ phase.files.length > 0 ? /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276330
277279
  color: "gray",
276331
- dimColor: true,
276332
277280
  children: [
276333
277281
  " ",
276334
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277282
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276335
277283
  color: ACCENT,
276336
277284
  children: [
276337
277285
  "lens commit ",
@@ -276341,12 +277289,11 @@ ${missing.map((f) => ` ${f}`).join(`
276341
277289
  " ",
276342
277290
  "(stages and commits those files)"
276343
277291
  ]
276344
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277292
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276345
277293
  color: "gray",
276346
- dimColor: true,
276347
277294
  children: [
276348
277295
  " ",
276349
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277296
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276350
277297
  color: ACCENT,
276351
277298
  children: [
276352
277299
  "git add ",
@@ -276356,7 +277303,7 @@ ${missing.map((f) => ` ${f}`).join(`
276356
277303
  " ",
276357
277304
  "or",
276358
277305
  " ",
276359
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277306
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276360
277307
  color: ACCENT,
276361
277308
  children: "lens commit --auto"
276362
277309
  }, undefined, false, undefined, this)
@@ -276366,50 +277313,49 @@ ${missing.map((f) => ` ${f}`).join(`
276366
277313
  }, undefined, true, undefined, this)
276367
277314
  ]
276368
277315
  }, undefined, true, undefined, this),
276369
- phase.type === "generating" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277316
+ phase.type === "generating" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276370
277317
  gap: 1,
276371
277318
  marginTop: 1,
276372
277319
  children: [
276373
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277320
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276374
277321
  color: ACCENT,
276375
277322
  children: "●"
276376
277323
  }, undefined, false, undefined, this),
276377
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277324
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276378
277325
  color: "gray",
276379
277326
  children: phraseText
276380
277327
  }, undefined, false, undefined, this)
276381
277328
  ]
276382
277329
  }, undefined, true, undefined, this),
276383
- phase.type === "preview" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277330
+ phase.type === "preview" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276384
277331
  flexDirection: "column",
276385
277332
  marginTop: 1,
276386
277333
  gap: 1,
276387
277334
  children: [
276388
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277335
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276389
277336
  color: ACCENT,
276390
277337
  bold: true,
276391
277338
  children: "GENERATED MESSAGE"
276392
277339
  }, undefined, false, undefined, this),
276393
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277340
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276394
277341
  flexDirection: "column",
276395
277342
  marginLeft: 2,
276396
277343
  marginTop: 1,
276397
277344
  marginBottom: 1,
276398
277345
  children: phase.message.split(`
276399
- `).map((line, i) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277346
+ `).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276400
277347
  color: i === 0 ? "white" : "gray",
276401
277348
  bold: i === 0,
276402
277349
  children: line || " "
276403
277350
  }, i, false, undefined, this))
276404
277351
  }, undefined, false, undefined, this),
276405
- phase.splitGroups.length > 0 && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277352
+ phase.splitGroups.length > 0 && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276406
277353
  flexDirection: "column",
276407
277354
  marginLeft: 2,
276408
277355
  marginBottom: 1,
276409
277356
  children: [
276410
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277357
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276411
277358
  color: "yellow",
276412
- dimColor: true,
276413
277359
  children: [
276414
277360
  "⚡ large diff — consider splitting into",
276415
277361
  " ",
@@ -276417,9 +277363,8 @@ ${missing.map((f) => ` ${f}`).join(`
276417
277363
  " commits:"
276418
277364
  ]
276419
277365
  }, undefined, true, undefined, this),
276420
- phase.splitGroups.map((g, i) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277366
+ phase.splitGroups.map((g, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276421
277367
  color: "gray",
276422
- dimColor: true,
276423
277368
  children: [
276424
277369
  " · ",
276425
277370
  g
@@ -276427,49 +277372,47 @@ ${missing.map((f) => ` ${f}`).join(`
276427
277372
  }, i, true, undefined, this))
276428
277373
  ]
276429
277374
  }, undefined, true, undefined, this),
276430
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277375
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276431
277376
  color: "gray",
276432
- dimColor: true,
276433
277377
  children: div
276434
277378
  }, undefined, false, undefined, this),
276435
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277379
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276436
277380
  gap: 3,
276437
277381
  marginTop: 1,
276438
277382
  children: [
276439
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277383
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276440
277384
  color: GREEN,
276441
277385
  children: "y/enter commit"
276442
277386
  }, undefined, false, undefined, this),
276443
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277387
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276444
277388
  color: CYAN,
276445
277389
  children: "e edit"
276446
277390
  }, undefined, false, undefined, this),
276447
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277391
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276448
277392
  color: "gray",
276449
- dimColor: true,
276450
277393
  children: "n/esc cancel"
276451
277394
  }, undefined, false, undefined, this)
276452
277395
  ]
276453
277396
  }, undefined, true, undefined, this)
276454
277397
  ]
276455
277398
  }, undefined, true, undefined, this),
276456
- phase.type === "editing" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277399
+ phase.type === "editing" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276457
277400
  flexDirection: "column",
276458
277401
  marginTop: 1,
276459
277402
  gap: 1,
276460
277403
  children: [
276461
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277404
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276462
277405
  color: ACCENT,
276463
277406
  bold: true,
276464
277407
  children: "EDIT MESSAGE"
276465
277408
  }, undefined, false, undefined, this),
276466
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277409
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276467
277410
  marginLeft: 2,
276468
277411
  marginTop: 1,
276469
277412
  flexDirection: "column",
276470
277413
  gap: 1,
276471
277414
  children: [
276472
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(build_default2, {
277415
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(build_default2, {
276473
277416
  value: phase.message,
276474
277417
  onChange: (msg) => setPhase((prev) => prev.type === "editing" ? { ...prev, message: msg } : prev),
276475
277418
  onSubmit: (msg) => setPhase((prev) => prev.type === "editing" ? {
@@ -276479,87 +277422,84 @@ ${missing.map((f) => ` ${f}`).join(`
276479
277422
  diff: prev.diff
276480
277423
  } : prev)
276481
277424
  }, undefined, false, undefined, this),
276482
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277425
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276483
277426
  color: "gray",
276484
- dimColor: true,
276485
277427
  children: "enter confirm · esc back"
276486
277428
  }, undefined, false, undefined, this)
276487
277429
  ]
276488
277430
  }, undefined, true, undefined, this)
276489
277431
  ]
276490
277432
  }, undefined, true, undefined, this),
276491
- phase.type === "committing" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277433
+ phase.type === "committing" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276492
277434
  gap: 1,
276493
277435
  marginTop: 1,
276494
277436
  children: [
276495
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277437
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276496
277438
  color: ACCENT,
276497
277439
  children: "*"
276498
277440
  }, undefined, false, undefined, this),
276499
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277441
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276500
277442
  color: "gray",
276501
- dimColor: true,
276502
277443
  children: "committing…"
276503
277444
  }, undefined, false, undefined, this)
276504
277445
  ]
276505
277446
  }, undefined, true, undefined, this),
276506
- phase.type === "pushing" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277447
+ phase.type === "pushing" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276507
277448
  flexDirection: "column",
276508
277449
  marginTop: 1,
276509
277450
  gap: 1,
276510
277451
  children: [
276511
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277452
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276512
277453
  gap: 2,
276513
277454
  children: [
276514
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277455
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276515
277456
  color: GREEN,
276516
277457
  children: figures_default.tick
276517
277458
  }, undefined, false, undefined, this),
276518
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277459
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276519
277460
  color: ACCENT,
276520
277461
  children: phase.hash
276521
277462
  }, undefined, false, undefined, this),
276522
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277463
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276523
277464
  color: "white",
276524
277465
  children: trunc2(phase.message.split(`
276525
277466
  `)[0], 65)
276526
277467
  }, undefined, false, undefined, this)
276527
277468
  ]
276528
277469
  }, undefined, true, undefined, this),
276529
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277470
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276530
277471
  gap: 1,
276531
277472
  marginLeft: 2,
276532
277473
  children: [
276533
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277474
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276534
277475
  color: ACCENT,
276535
277476
  children: "*"
276536
277477
  }, undefined, false, undefined, this),
276537
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277478
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276538
277479
  color: "gray",
276539
- dimColor: true,
276540
277480
  children: "pushing…"
276541
277481
  }, undefined, false, undefined, this)
276542
277482
  ]
276543
277483
  }, undefined, true, undefined, this)
276544
277484
  ]
276545
277485
  }, undefined, true, undefined, this),
276546
- phase.type === "done" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277486
+ phase.type === "done" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276547
277487
  flexDirection: "column",
276548
277488
  marginTop: 1,
276549
277489
  gap: 1,
276550
277490
  children: [
276551
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277491
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276552
277492
  gap: 2,
276553
277493
  children: [
276554
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277494
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276555
277495
  color: GREEN,
276556
277496
  children: figures_default.tick
276557
277497
  }, undefined, false, undefined, this),
276558
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277498
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276559
277499
  color: ACCENT,
276560
277500
  children: phase.hash
276561
277501
  }, undefined, false, undefined, this),
276562
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277502
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276563
277503
  color: "white",
276564
277504
  bold: true,
276565
277505
  children: trunc2(phase.message.split(`
@@ -276568,74 +277508,70 @@ ${missing.map((f) => ` ${f}`).join(`
276568
277508
  ]
276569
277509
  }, undefined, true, undefined, this),
276570
277510
  phase.message.split(`
276571
- `).slice(2).filter(Boolean).map((line, i) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277511
+ `).slice(2).filter(Boolean).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276572
277512
  color: "gray",
276573
- dimColor: true,
276574
277513
  children: line
276575
277514
  }, i, false, undefined, this)),
276576
- phase.pushed && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277515
+ phase.pushed && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276577
277516
  gap: 2,
276578
277517
  marginTop: 1,
276579
277518
  children: [
276580
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277519
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276581
277520
  color: GREEN,
276582
277521
  children: figures_default.tick
276583
277522
  }, undefined, false, undefined, this),
276584
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277523
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276585
277524
  color: "gray",
276586
- dimColor: true,
276587
277525
  children: "pushed to remote"
276588
277526
  }, undefined, false, undefined, this)
276589
277527
  ]
276590
277528
  }, undefined, true, undefined, this),
276591
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277529
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276592
277530
  color: "gray",
276593
- dimColor: true,
276594
277531
  children: "press any key to exit"
276595
277532
  }, undefined, false, undefined, this)
276596
277533
  ]
276597
277534
  }, undefined, true, undefined, this),
276598
- phase.type === "preview-only" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277535
+ phase.type === "preview-only" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276599
277536
  flexDirection: "column",
276600
277537
  marginTop: 1,
276601
277538
  gap: 1,
276602
277539
  children: [
276603
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277540
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276604
277541
  color: ACCENT,
276605
277542
  bold: true,
276606
277543
  children: "GENERATED MESSAGE"
276607
277544
  }, undefined, false, undefined, this),
276608
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277545
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276609
277546
  flexDirection: "column",
276610
277547
  marginLeft: 2,
276611
277548
  marginTop: 1,
276612
277549
  children: phase.message.split(`
276613
- `).map((line, i) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277550
+ `).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276614
277551
  color: i === 0 ? "white" : "gray",
276615
277552
  bold: i === 0,
276616
277553
  children: line || " "
276617
277554
  }, i, false, undefined, this))
276618
277555
  }, undefined, false, undefined, this),
276619
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277556
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276620
277557
  color: "gray",
276621
- dimColor: true,
276622
277558
  children: "(preview only — not committed)"
276623
277559
  }, undefined, false, undefined, this)
276624
277560
  ]
276625
277561
  }, undefined, true, undefined, this),
276626
- phase.type === "error" && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277562
+ phase.type === "error" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276627
277563
  flexDirection: "column",
276628
277564
  marginTop: 1,
276629
277565
  gap: 1,
276630
277566
  children: [
276631
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277567
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276632
277568
  gap: 1,
276633
277569
  children: [
276634
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277570
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276635
277571
  color: RED,
276636
277572
  children: figures_default.cross
276637
277573
  }, undefined, false, undefined, this),
276638
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277574
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276639
277575
  color: "white",
276640
277576
  children: phase.message.split(`
276641
277577
  `)[0]
@@ -276643,9 +277579,8 @@ ${missing.map((f) => ` ${f}`).join(`
276643
277579
  ]
276644
277580
  }, undefined, true, undefined, this),
276645
277581
  phase.message.split(`
276646
- `).slice(1).map((line, i) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277582
+ `).slice(1).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276647
277583
  color: "gray",
276648
- dimColor: true,
276649
277584
  children: line
276650
277585
  }, i, false, undefined, this))
276651
277586
  ]
@@ -276661,12 +277596,12 @@ function CommitCommand({
276661
277596
  push,
276662
277597
  confirm
276663
277598
  }) {
276664
- const cwd2 = path21.resolve(inputPath);
276665
- const [provider, setProvider] = import_react50.useState(null);
276666
- if (!existsSync16(cwd2)) {
276667
- return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Box_default, {
277599
+ const cwd2 = path23.resolve(inputPath);
277600
+ const [provider, setProvider] = import_react51.useState(null);
277601
+ if (!existsSync18(cwd2)) {
277602
+ return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
276668
277603
  marginTop: 1,
276669
- children: /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Text, {
277604
+ children: /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
276670
277605
  color: RED,
276671
277606
  children: [
276672
277607
  figures_default.cross,
@@ -276677,11 +277612,11 @@ function CommitCommand({
276677
277612
  }, undefined, false, undefined, this);
276678
277613
  }
276679
277614
  if (!provider) {
276680
- return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(ProviderPicker, {
277615
+ return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(ProviderPicker, {
276681
277616
  onDone: setProvider
276682
277617
  }, undefined, false, undefined, this);
276683
277618
  }
276684
- return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(CommitRunner, {
277619
+ return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(CommitRunner, {
276685
277620
  cwd: cwd2,
276686
277621
  provider,
276687
277622
  files,
@@ -276692,8 +277627,8 @@ function CommitCommand({
276692
277627
  }, undefined, false, undefined, this);
276693
277628
  }
276694
277629
  // src/tools/view-image.ts
276695
- import path24 from "path";
276696
- import { existsSync as existsSync18, readFileSync as readFileSync13 } from "fs";
277630
+ import path26 from "path";
277631
+ import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
276697
277632
  import { execSync as execSync6 } from "child_process";
276698
277633
  function parseViewImageInput(body) {
276699
277634
  const trimmed = body.trim();
@@ -276719,10 +277654,10 @@ async function fetchBytes(src, repoPath) {
276719
277654
  throw new Error(`HTTP ${res.status}: ${res.statusText}`);
276720
277655
  return Buffer.from(await res.arrayBuffer());
276721
277656
  }
276722
- const resolved = path24.isAbsolute(src) ? src : path24.join(repoPath, src);
276723
- if (!existsSync18(resolved))
277657
+ const resolved = path26.isAbsolute(src) ? src : path26.join(repoPath, src);
277658
+ if (!existsSync20(resolved))
276724
277659
  throw new Error(`File not found: ${resolved}`);
276725
- return readFileSync13(resolved);
277660
+ return readFileSync14(resolved);
276726
277661
  }
276727
277662
  function detectProtocol() {
276728
277663
  const term = (process.env["TERM"] ?? "").toLowerCase();
@@ -276793,7 +277728,7 @@ function renderKitty2(buf, width) {
276793
277728
  }
276794
277729
  function renderSixel(buf, src, repoPath, width) {
276795
277730
  const widthCols = typeof width === "number" ? width : width.endsWith("%") ? Math.floor((process.stdout.columns ?? 80) * (parseInt(width) / 100)) : parseInt(width);
276796
- const tmpPath = path24.join(process.env["TEMP"] ?? process.env["TMPDIR"] ?? "/tmp", `lens_img_${Date.now()}.bin`);
277731
+ const tmpPath = path26.join(process.env["TEMP"] ?? process.env["TMPDIR"] ?? "/tmp", `lens_img_${Date.now()}.bin`);
276797
277732
  const { writeFileSync: writeFileSync10, unlinkSync: unlinkSync2 } = __require("fs");
276798
277733
  writeFileSync10(tmpPath, buf);
276799
277734
  try {
@@ -276873,7 +277808,7 @@ var viewImageTool = {
276873
277808
  ].join(`
276874
277809
  `),
276875
277810
  parseInput: parseViewImageInput,
276876
- summariseInput: ({ src, width }) => `${path24.basename(src)} (${width ?? "80%"})`,
277811
+ summariseInput: ({ src, width }) => `${path26.basename(src)} (${width ?? "80%"})`,
276877
277812
  execute: async (input, ctx) => {
276878
277813
  try {
276879
277814
  const ansi = await renderImage(input, ctx.repoPath);
@@ -277036,8 +277971,8 @@ var chartDataTool = {
277036
277971
  }
277037
277972
  };
277038
277973
  // src/tools/convert-image.ts
277039
- import path25 from "path";
277040
- import { existsSync as existsSync19, mkdirSync as mkdirSync8 } from "fs";
277974
+ import path27 from "path";
277975
+ import { existsSync as existsSync21, mkdirSync as mkdirSync8 } from "fs";
277041
277976
  import { execSync as execSync7 } from "child_process";
277042
277977
  function parseInput(body) {
277043
277978
  const trimmed = body.trim();
@@ -277061,11 +277996,11 @@ function ffmpegAvailable() {
277061
277996
  }
277062
277997
  }
277063
277998
  function resolve2(p, repoPath) {
277064
- return path25.isAbsolute(p) ? p : path25.join(repoPath, p);
277999
+ return path27.isAbsolute(p) ? p : path27.join(repoPath, p);
277065
278000
  }
277066
278001
  function ensureDir(filePath) {
277067
- const dir = path25.dirname(filePath);
277068
- if (!existsSync19(dir))
278002
+ const dir = path27.dirname(filePath);
278003
+ if (!existsSync21(dir))
277069
278004
  mkdirSync8(dir, { recursive: true });
277070
278005
  }
277071
278006
  function buildVfFilters(input) {
@@ -277137,7 +278072,7 @@ function buildArgs(input, resolvedInput, resolvedOutput, repoPath) {
277137
278072
  if (vf.length)
277138
278073
  args.push("-vf", vf.join(","));
277139
278074
  }
277140
- const ext = path25.extname(resolvedOutput).toLowerCase();
278075
+ const ext = path27.extname(resolvedOutput).toLowerCase();
277141
278076
  if (input.quality !== undefined) {
277142
278077
  if (ext === ".jpg" || ext === ".jpeg") {
277143
278078
  const q = Math.round(2 + (100 - input.quality) / 100 * 29);
@@ -277177,7 +278112,7 @@ function runConvert(input, repoPath) {
277177
278112
  ensureDir(resolvedOutput);
277178
278113
  const resolvedInput = Array.isArray(input.input) ? resolve2(input.input[0], repoPath) : resolve2(input.input, repoPath);
277179
278114
  if (!Array.isArray(input.input) && !input.input.startsWith("http")) {
277180
- if (!existsSync19(resolvedInput)) {
278115
+ if (!existsSync21(resolvedInput)) {
277181
278116
  return `Error: input file not found — ${resolvedInput}`;
277182
278117
  }
277183
278118
  }
@@ -277192,7 +278127,7 @@ function runConvert(input, repoPath) {
277192
278127
  const lines = (stderr || "").split(`
277193
278128
  `).filter((l) => l.includes("video:") || l.includes("frame=")).slice(-3).join(`
277194
278129
  `);
277195
- const inputLabel = Array.isArray(input.input) ? `${input.input.length} files` : path25.basename(input.input);
278130
+ const inputLabel = Array.isArray(input.input) ? `${input.input.length} files` : path27.basename(input.input);
277196
278131
  return (`✓ converted ${inputLabel} → ${input.output}
277197
278132
  ` + (lines ? `
277198
278133
  ${lines}` : "")).trim();
@@ -277241,8 +278176,8 @@ var convertImageTool = {
277241
278176
  `),
277242
278177
  parseInput,
277243
278178
  summariseInput: ({ input, output }) => {
277244
- const src = Array.isArray(input) ? `${input.length} files` : path25.basename(input);
277245
- return `${src} → ${path25.basename(output)}`;
278179
+ const src = Array.isArray(input) ? `${input.length} files` : path27.basename(input);
278180
+ return `${src} → ${path27.basename(output)}`;
277246
278181
  },
277247
278182
  execute: async (input, ctx) => {
277248
278183
  try {
@@ -277257,6 +278192,7 @@ var convertImageTool = {
277257
278192
  }
277258
278193
  };
277259
278194
  // src/utils/tools/builtins.ts
278195
+ var cleanBody = (body) => body.trim().replace(/\\/g, "/");
277260
278196
  var fetchTool = {
277261
278197
  name: "fetch",
277262
278198
  description: "load a URL",
@@ -277299,7 +278235,7 @@ var readFileTool = {
277299
278235
  permissionLabel: "read",
277300
278236
  systemPromptEntry: (i) => `### ${i}. read-file — read a file from the repo
277301
278237
  <read-file>src/foo.ts</read-file>`,
277302
- parseInput: (body) => body || null,
278238
+ parseInput: (body) => cleanBody(body) || null,
277303
278239
  summariseInput: (p) => p,
277304
278240
  execute: (filePath, ctx) => ({
277305
278241
  kind: "text",
@@ -277313,7 +278249,7 @@ var readFolderTool = {
277313
278249
  permissionLabel: "folder",
277314
278250
  systemPromptEntry: (i) => `### ${i}. read-folder — list contents of a folder (files + subfolders, one level deep)
277315
278251
  <read-folder>src/components</read-folder>`,
277316
- parseInput: (body) => body || null,
278252
+ parseInput: (body) => cleanBody(body) || null,
277317
278253
  summariseInput: (p) => p,
277318
278254
  execute: (folderPath, ctx) => ({
277319
278255
  kind: "text",
@@ -277331,7 +278267,7 @@ var grepTool = {
277331
278267
  </grep>`,
277332
278268
  parseInput: (body) => {
277333
278269
  try {
277334
- const parsed = JSON.parse(body);
278270
+ const parsed = JSON.parse(cleanBody(body));
277335
278271
  return { pattern: parsed.pattern, glob: parsed.glob ?? "**/*" };
277336
278272
  } catch {
277337
278273
  return { pattern: body, glob: "**/*" };
@@ -277357,12 +278293,12 @@ var writeFileTool = {
277357
278293
  const parsed = JSON.parse(body);
277358
278294
  if (!parsed.path)
277359
278295
  return null;
277360
- return parsed;
278296
+ return { ...parsed, path: parsed.path.replace(/\\/g, "/") };
277361
278297
  } catch {
277362
278298
  return null;
277363
278299
  }
277364
278300
  },
277365
- summariseInput: ({ path: path26, content }) => `${path26} (${content.length} bytes)`,
278301
+ summariseInput: ({ path: path28, content }) => `${path28} (${content.length} bytes)`,
277366
278302
  execute: ({ path: filePath, content }, ctx) => ({
277367
278303
  kind: "text",
277368
278304
  value: writeFile(filePath, content, ctx.repoPath)
@@ -277375,7 +278311,7 @@ var deleteFileTool = {
277375
278311
  permissionLabel: "delete",
277376
278312
  systemPromptEntry: (i) => `### ${i}. delete-file — permanently delete a single file
277377
278313
  <delete-file>src/old-component.tsx</delete-file>`,
277378
- parseInput: (body) => body || null,
278314
+ parseInput: (body) => cleanBody(body) || null,
277379
278315
  summariseInput: (p) => p,
277380
278316
  execute: (filePath, ctx) => ({
277381
278317
  kind: "text",
@@ -277389,7 +278325,7 @@ var deleteFolderTool = {
277389
278325
  permissionLabel: "delete folder",
277390
278326
  systemPromptEntry: (i) => `### ${i}. delete-folder — permanently delete a folder and all its contents
277391
278327
  <delete-folder>src/legacy</delete-folder>`,
277392
- parseInput: (body) => body || null,
278328
+ parseInput: (body) => cleanBody(body) || null,
277393
278329
  summariseInput: (p) => p,
277394
278330
  execute: (folderPath, ctx) => ({
277395
278331
  kind: "text",
@@ -277418,7 +278354,7 @@ var generatePdfTool = {
277418
278354
  </generate-pdf>`,
277419
278355
  parseInput: (body) => {
277420
278356
  try {
277421
- const parsed = JSON.parse(body);
278357
+ const parsed = JSON.parse(cleanBody(body));
277422
278358
  return {
277423
278359
  filePath: parsed.path ?? parsed.filePath ?? "output.pdf",
277424
278360
  content: parsed.content ?? ""
@@ -277479,7 +278415,7 @@ var changesTool = {
277479
278415
  </changes>`,
277480
278416
  parseInput: (body) => {
277481
278417
  try {
277482
- return JSON.parse(body);
278418
+ return JSON.parse(cleanBody(body));
277483
278419
  } catch {
277484
278420
  return null;
277485
278421
  }
@@ -277501,8 +278437,7 @@ var readFilesTool = {
277501
278437
  </read-files>`,
277502
278438
  parseInput: (body) => {
277503
278439
  try {
277504
- const cleaned = body.trim().replace(/\\/g, "/");
277505
- const parsed = JSON.parse(cleaned);
278440
+ const parsed = JSON.parse(cleanBody(body));
277506
278441
  if (!Array.isArray(parsed) || parsed.length === 0)
277507
278442
  return null;
277508
278443
  return { paths: parsed };
@@ -277541,13 +278476,13 @@ function registerBuiltins() {
277541
278476
  }
277542
278477
 
277543
278478
  // src/utils/addons/loadAddons.ts
277544
- import path26 from "path";
278479
+ import path28 from "path";
277545
278480
  import os9 from "os";
277546
- import { existsSync as existsSync20, readdirSync as readdirSync5 } from "fs";
278481
+ import { existsSync as existsSync22, readdirSync as readdirSync5 } from "fs";
277547
278482
  import { pathToFileURL } from "url";
277548
- var ADDONS_DIR = path26.join(os9.homedir(), ".lens", "addons");
278483
+ var ADDONS_DIR = path28.join(os9.homedir(), ".lens", "addons");
277549
278484
  async function loadAddons() {
277550
- if (!existsSync20(ADDONS_DIR)) {
278485
+ if (!existsSync22(ADDONS_DIR)) {
277551
278486
  return;
277552
278487
  }
277553
278488
  const files = readdirSync5(ADDONS_DIR).filter((f) => f.endsWith(".js") && !f.startsWith("_"));
@@ -277555,7 +278490,7 @@ async function loadAddons() {
277555
278490
  const file = files[i];
277556
278491
  if (!file)
277557
278492
  return;
277558
- const fullPath = path26.join(ADDONS_DIR, file);
278493
+ const fullPath = path28.join(ADDONS_DIR, file);
277559
278494
  const fileUrl = pathToFileURL(fullPath).href;
277560
278495
  const isLast = i === files.length - 1;
277561
278496
  try {
@@ -277569,41 +278504,41 @@ async function loadAddons() {
277569
278504
  }
277570
278505
 
277571
278506
  // src/index.tsx
277572
- var jsx_dev_runtime26 = __toESM(require_jsx_dev_runtime(), 1);
278507
+ var jsx_dev_runtime28 = __toESM(require_jsx_dev_runtime(), 1);
277573
278508
  registerBuiltins();
277574
278509
  await loadAddons();
277575
278510
  var program2 = new Command;
277576
278511
  program2.command("stalk <url>").alias("repo").description("Analyze a remote repository").action((url) => {
277577
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(RepoCommand, {
278512
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(RepoCommand, {
277578
278513
  url
277579
278514
  }, undefined, false, undefined, this));
277580
278515
  });
277581
278516
  program2.command("provider").description("Configure AI providers").action(() => {
277582
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(InitCommand, {}, undefined, false, undefined, this));
278517
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(InitCommand, {}, undefined, false, undefined, this));
277583
278518
  });
277584
278519
  program2.command("judge [path]").alias("review").description("Review a local codebase").action((inputPath) => {
277585
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(ReviewCommand, {
278520
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(ReviewCommand, {
277586
278521
  path: inputPath ?? "."
277587
278522
  }, undefined, false, undefined, this));
277588
278523
  });
277589
278524
  program2.command("cook <text>").alias("task").description("Apply a natural language change to the codebase").option("-p, --path <path>", "Path to the repo", ".").action((text, opts) => {
277590
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(TaskCommand, {
278525
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(TaskCommand, {
277591
278526
  prompt: text,
277592
278527
  path: opts.path
277593
278528
  }, undefined, false, undefined, this));
277594
278529
  });
277595
278530
  program2.command("vibe").alias("chat").description("Chat with your codebase — ask questions or make changes").option("-p, --path <path>", "Path to the repo", ".").action((opts) => {
277596
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(ChatCommand, {
278531
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(ChatCommand, {
277597
278532
  path: opts.path
277598
278533
  }, undefined, false, undefined, this));
277599
278534
  });
277600
278535
  program2.command("history").alias("timeline").description("Explore your code history — see commits, changes, and evolution").option("-p, --path <path>", "Path to the repo", ".").action((opts) => {
277601
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(TimelineCommand, {
278536
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(TimelineCommand, {
277602
278537
  path: opts.path
277603
278538
  }, undefined, false, undefined, this));
277604
278539
  });
277605
278540
  program2.command("crimes [files...]").alias("commit").description("Generate a smart conventional commit message from staged changes or specific files").option("-p, --path <path>", "Path to the repo", ".").option("--auto", "Stage all changes (or the given files) and commit without confirmation").option("--confirm", "Show preview before committing even when using --auto").option("--preview", "Show the generated message without committing").option("--push", "Push to remote after committing").action((files, opts) => {
277606
- render_default(/* @__PURE__ */ jsx_dev_runtime26.jsxDEV(CommitCommand, {
278541
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(CommitCommand, {
277607
278542
  path: opts.path,
277608
278543
  files: files ?? [],
277609
278544
  auto: opts.auto ?? false,
@@ -277612,4 +278547,14 @@ program2.command("crimes [files...]").alias("commit").description("Generate a sm
277612
278547
  push: opts.push ?? false
277613
278548
  }, undefined, false, undefined, this));
277614
278549
  });
278550
+ program2.command("watch <cmd>").alias("spy").description("Watch a dev command and get AI suggestions for errors").option("-p, --path <path>", "Path to the repo", ".").option("--clean", "Only show AI suggestions, hide raw logs").option("--fix-all", "Auto-apply fixes as errors are detected").option("--auto-restart", "Automatically re-run the command after a crash").option("--prompt <text>", "Extra context for the AI about your project").action((cmd, opts) => {
278551
+ render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(WatchCommand, {
278552
+ cmd,
278553
+ path: opts.path,
278554
+ clean: opts.clean ?? false,
278555
+ fixAll: opts.fixAll ?? false,
278556
+ autoRestart: opts.autoRestart ?? false,
278557
+ prompt: opts.prompt
278558
+ }, undefined, false, undefined, this));
278559
+ });
277615
278560
  program2.parse(process.argv);