@ridit/lens 0.3.2 → 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 +1541 -264
- package/package.json +1 -1
- package/src/commands/commit.tsx +10 -2
- package/src/commands/watch.tsx +56 -0
- package/src/components/timeline/TimelineRunner.tsx +0 -7
- package/src/components/watch/WatchRunner.tsx +929 -0
- package/src/index.tsx +144 -110
- package/src/utils/watch.ts +307 -0
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(
|
|
194365
|
+
exports.write = function(path24, frames, spec, encoder) {
|
|
194366
194366
|
encoder = encoder || defaultCodec;
|
|
194367
|
-
const matches2 =
|
|
194367
|
+
const matches2 = path24.match(/\.[a-zA-Z]+$/);
|
|
194368
194368
|
if (matches2 !== null && INVALID_SUFFIXES.includes(matches2[0].toLowerCase())) {
|
|
194369
|
-
throw new Error(`GIF '${
|
|
194369
|
+
throw new Error(`GIF '${path24}' has an unexpected suffix`);
|
|
194370
194370
|
}
|
|
194371
194371
|
return encoder.encodeGif(frames, spec).then((gif) => {
|
|
194372
|
-
return _writeBinary(
|
|
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(
|
|
194434
|
+
function _readBinary(path24) {
|
|
194435
194435
|
return new Promise((resolve2, reject3) => {
|
|
194436
|
-
fs4.readFile(
|
|
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(
|
|
194444
|
+
function _writeBinary(path24, buffer) {
|
|
194445
194445
|
return new Promise((resolve2, reject3) => {
|
|
194446
|
-
fs4.writeFile(
|
|
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(
|
|
196399
|
+
load: function load(path24) {
|
|
196400
196400
|
var xhr = new XMLHttpRequest;
|
|
196401
|
-
xhr.open("GET",
|
|
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:
|
|
207201
|
-
const fullPath = [...
|
|
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,
|
|
207247
|
+
constructor(parent, value, path24, key) {
|
|
207248
207248
|
this._cachedPath = [];
|
|
207249
207249
|
this.parent = parent;
|
|
207250
207250
|
this.data = value;
|
|
207251
|
-
this._path =
|
|
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
|
|
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(
|
|
214411
|
-
|
|
214412
|
-
let last2 =
|
|
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 <
|
|
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 (
|
|
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(
|
|
216155
|
-
const mimeType = import_lite.default.getType(
|
|
216156
|
-
await writeFile2(
|
|
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(
|
|
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 &&
|
|
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,
|
|
226610
|
+
function checkStat(stat, path24, options) {
|
|
226611
226611
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
226612
226612
|
return false;
|
|
226613
226613
|
}
|
|
226614
|
-
return checkPathExt(
|
|
226614
|
+
return checkPathExt(path24, options);
|
|
226615
226615
|
}
|
|
226616
|
-
function isexe(
|
|
226617
|
-
fs5.stat(
|
|
226618
|
-
cb(er, er ? false : checkStat(stat,
|
|
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(
|
|
226622
|
-
return checkStat(fs5.statSync(
|
|
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(
|
|
226632
|
-
fs5.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(
|
|
226637
|
-
return checkStat(fs5.statSync(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
226697
|
+
function sync(path24, options) {
|
|
226698
226698
|
try {
|
|
226699
|
-
return core.sync(
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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 ?
|
|
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 =
|
|
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 [
|
|
226888
|
-
const binary =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
227038
|
-
module.exports.spawn =
|
|
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
|
|
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 =
|
|
227073
|
+
let cwdPath = path24.resolve(options.cwd);
|
|
227074
227074
|
const result2 = [];
|
|
227075
227075
|
while (previous !== cwdPath) {
|
|
227076
|
-
result2.push(
|
|
227076
|
+
result2.push(path24.join(cwdPath, "node_modules/.bin"));
|
|
227077
227077
|
previous = cwdPath;
|
|
227078
|
-
cwdPath =
|
|
227078
|
+
cwdPath = path24.resolve(cwdPath, "..");
|
|
227079
227079
|
}
|
|
227080
|
-
const execPathDir =
|
|
227080
|
+
const execPathDir = path24.resolve(options.cwd, options.execPath, "..");
|
|
227081
227081
|
result2.push(execPathDir);
|
|
227082
|
-
return result2.concat(options.path).join(
|
|
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
|
|
227093
|
-
options.path = env3[
|
|
227094
|
-
env3[
|
|
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
|
|
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" &&
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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 (
|
|
237275
|
+
if (path26.dirname(p) === p)
|
|
237276
237276
|
return cb(er);
|
|
237277
|
-
mkdirP(
|
|
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 =
|
|
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(
|
|
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(
|
|
239096
|
-
var pathParts =
|
|
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,
|
|
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 (
|
|
239755
|
-
return MIME.getType(
|
|
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,
|
|
239827
|
-
var mime2 = getMIMEFromBuffer(data,
|
|
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 <" +
|
|
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(
|
|
240007
|
-
return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this),
|
|
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
|
|
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(
|
|
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,
|
|
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,
|
|
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(
|
|
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
|
|
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(
|
|
240240
|
-
var pathObj = _path["default"].parse(
|
|
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(
|
|
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,
|
|
240857
|
-
if (!Array.isArray(
|
|
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 <
|
|
240864
|
-
const key =
|
|
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,
|
|
240882
|
-
if (!
|
|
240881
|
+
function setIn(obj, path26, val) {
|
|
240882
|
+
if (!path26.length)
|
|
240883
240883
|
return val;
|
|
240884
|
-
return doSetIn(obj,
|
|
240884
|
+
return doSetIn(obj, path26, val, 0);
|
|
240885
240885
|
}
|
|
240886
|
-
function doSetIn(obj,
|
|
240886
|
+
function doSetIn(obj, path26, val, idx) {
|
|
240887
240887
|
let newValue;
|
|
240888
|
-
const key =
|
|
240889
|
-
if (idx ===
|
|
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
|
|
240893
|
-
newValue = doSetIn(nestedObj,
|
|
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,
|
|
240903
|
-
const prevVal = getIn(obj,
|
|
240902
|
+
function updateIn(obj, path26, fnUpdate) {
|
|
240903
|
+
const prevVal = getIn(obj, path26);
|
|
240904
240904
|
const nextVal = fnUpdate(prevVal);
|
|
240905
|
-
return setIn(obj,
|
|
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,
|
|
240914
|
-
let prevVal = getIn(a,
|
|
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,
|
|
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(
|
|
250470
|
+
exports.write = function(path26, frames, spec, encoder) {
|
|
250471
250471
|
encoder = encoder || defaultCodec;
|
|
250472
|
-
const matches2 =
|
|
250472
|
+
const matches2 = path26.match(/\.[a-zA-Z]+$/);
|
|
250473
250473
|
if (matches2 !== null && INVALID_SUFFIXES.includes(matches2[0].toLowerCase())) {
|
|
250474
|
-
throw new Error(`GIF '${
|
|
250474
|
+
throw new Error(`GIF '${path26}' has an unexpected suffix`);
|
|
250475
250475
|
}
|
|
250476
250476
|
return encoder.encodeGif(frames, spec).then((gif2) => {
|
|
250477
|
-
return _writeBinary(
|
|
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(
|
|
250539
|
+
function _readBinary(path26) {
|
|
250540
250540
|
return new Promise((resolve2, reject3) => {
|
|
250541
|
-
fs7.readFile(
|
|
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(
|
|
250549
|
+
function _writeBinary(path26, buffer) {
|
|
250550
250550
|
return new Promise((resolve2, reject3) => {
|
|
250551
|
-
fs7.writeFile(
|
|
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
|
|
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 =
|
|
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
|
|
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(
|
|
255105
|
-
var ext =
|
|
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
|
|
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();
|
|
@@ -275585,16 +275585,1278 @@ var ChatCommand = ({ path: inputPath }) => {
|
|
|
275585
275585
|
}, undefined, false, undefined, this);
|
|
275586
275586
|
};
|
|
275587
275587
|
|
|
275588
|
-
// src/commands/
|
|
275589
|
-
import
|
|
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";
|
|
275590
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
|
|
275591
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);
|
|
275592
276854
|
var TimelineCommand = ({ path: inputPath }) => {
|
|
275593
|
-
const resolvedPath =
|
|
275594
|
-
if (!
|
|
275595
|
-
return /* @__PURE__ */
|
|
276855
|
+
const resolvedPath = path22.resolve(inputPath);
|
|
276856
|
+
if (!existsSync17(resolvedPath)) {
|
|
276857
|
+
return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(Box_default, {
|
|
275596
276858
|
marginTop: 1,
|
|
275597
|
-
children: /* @__PURE__ */
|
|
276859
|
+
children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(Text, {
|
|
275598
276860
|
color: "red",
|
|
275599
276861
|
children: [
|
|
275600
276862
|
figures_default.cross,
|
|
@@ -275604,17 +276866,17 @@ var TimelineCommand = ({ path: inputPath }) => {
|
|
|
275604
276866
|
}, undefined, true, undefined, this)
|
|
275605
276867
|
}, undefined, false, undefined, this);
|
|
275606
276868
|
}
|
|
275607
|
-
return /* @__PURE__ */
|
|
276869
|
+
return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(TimelineRunner, {
|
|
275608
276870
|
repoPath: resolvedPath
|
|
275609
276871
|
}, undefined, false, undefined, this);
|
|
275610
276872
|
};
|
|
275611
276873
|
|
|
275612
276874
|
// src/commands/commit.tsx
|
|
275613
|
-
var
|
|
276875
|
+
var import_react51 = __toESM(require_react(), 1);
|
|
275614
276876
|
import { execSync as execSync5 } from "child_process";
|
|
275615
|
-
import { existsSync as
|
|
275616
|
-
import
|
|
275617
|
-
var
|
|
276877
|
+
import { existsSync as existsSync18 } from "fs";
|
|
276878
|
+
import path23 from "path";
|
|
276879
|
+
var jsx_dev_runtime27 = __toESM(require_jsx_dev_runtime(), 1);
|
|
275618
276880
|
function gitRun3(cmd, cwd2) {
|
|
275619
276881
|
try {
|
|
275620
276882
|
const out = execSync5(cmd, {
|
|
@@ -275683,9 +276945,9 @@ function validateFiles(files, cwd2) {
|
|
|
275683
276945
|
const missing = [];
|
|
275684
276946
|
const valid = [];
|
|
275685
276947
|
for (const f of files) {
|
|
275686
|
-
const abs =
|
|
275687
|
-
if (
|
|
275688
|
-
valid.push(
|
|
276948
|
+
const abs = path23.isAbsolute(f) ? f : path23.join(cwd2, f);
|
|
276949
|
+
if (existsSync18(abs)) {
|
|
276950
|
+
valid.push(path23.relative(cwd2, abs).replace(/\\/g, "/"));
|
|
275689
276951
|
} else {
|
|
275690
276952
|
missing.push(f);
|
|
275691
276953
|
}
|
|
@@ -275722,7 +276984,7 @@ Rules:
|
|
|
275722
276984
|
- Skip bullets that just restate the subject line or describe trivial version bumps
|
|
275723
276985
|
- Be specific — mention file names, feature names, component names
|
|
275724
276986
|
- No markdown, no backticks, no code blocks
|
|
275725
|
-
- Output ONLY the commit message, nothing else
|
|
276987
|
+
- Output ONLY the commit message, nothing else — no preamble, no explanation, no thinking
|
|
275726
276988
|
|
|
275727
276989
|
Examples of good short commits:
|
|
275728
276990
|
chore: bump version to 0.1.6
|
|
@@ -275735,6 +276997,9 @@ feat(chat): add persistent memory across sessions
|
|
|
275735
276997
|
- store memories in ~/.lens/memories per repo
|
|
275736
276998
|
- inject memory summary into system prompt on load
|
|
275737
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
|
+
}
|
|
275738
277003
|
async function generateCommitMessage(provider, diff2) {
|
|
275739
277004
|
const msgs = [
|
|
275740
277005
|
{
|
|
@@ -275746,7 +277011,9 @@ ${diff2.slice(0, 8000)}`,
|
|
|
275746
277011
|
}
|
|
275747
277012
|
];
|
|
275748
277013
|
const raw = await callChat(provider, SYSTEM_PROMPT, msgs);
|
|
275749
|
-
|
|
277014
|
+
if (typeof raw !== "string")
|
|
277015
|
+
return "chore: update files";
|
|
277016
|
+
return stripThinking(raw) || "chore: update files";
|
|
275750
277017
|
}
|
|
275751
277018
|
function trunc2(s, n) {
|
|
275752
277019
|
return s.length > n ? s.slice(0, n - 1) + "…" : s;
|
|
@@ -275760,9 +277027,9 @@ function CommitRunner({
|
|
|
275760
277027
|
push,
|
|
275761
277028
|
confirm
|
|
275762
277029
|
}) {
|
|
275763
|
-
const [phase, setPhase] =
|
|
277030
|
+
const [phase, setPhase] = import_react51.useState({ type: "checking" });
|
|
275764
277031
|
const phraseText = useThinkingPhrase(phase.type === "generating", "commit", 2800);
|
|
275765
|
-
|
|
277032
|
+
import_react51.useEffect(() => {
|
|
275766
277033
|
(async () => {
|
|
275767
277034
|
if (!gitRun3("git rev-parse --git-dir", cwd2).ok) {
|
|
275768
277035
|
setPhase({ type: "error", message: "not a git repository" });
|
|
@@ -275887,24 +277154,24 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
275887
277154
|
});
|
|
275888
277155
|
const w = process.stdout.columns ?? 80;
|
|
275889
277156
|
const div = "─".repeat(w);
|
|
275890
|
-
return /* @__PURE__ */
|
|
277157
|
+
return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275891
277158
|
flexDirection: "column",
|
|
275892
277159
|
paddingY: 1,
|
|
275893
277160
|
children: [
|
|
275894
|
-
/* @__PURE__ */
|
|
277161
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275895
277162
|
gap: 2,
|
|
275896
277163
|
marginBottom: 1,
|
|
275897
277164
|
children: [
|
|
275898
|
-
/* @__PURE__ */
|
|
277165
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275899
277166
|
color: ACCENT,
|
|
275900
277167
|
bold: true,
|
|
275901
277168
|
children: "◈ COMMIT"
|
|
275902
277169
|
}, undefined, false, undefined, this),
|
|
275903
|
-
/* @__PURE__ */
|
|
277170
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275904
277171
|
color: "gray",
|
|
275905
277172
|
children: cwd2
|
|
275906
277173
|
}, undefined, false, undefined, this),
|
|
275907
|
-
files.length > 0 && /* @__PURE__ */
|
|
277174
|
+
files.length > 0 && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275908
277175
|
color: CYAN,
|
|
275909
277176
|
children: [
|
|
275910
277177
|
files.length,
|
|
@@ -275914,105 +277181,105 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
275914
277181
|
}, undefined, true, undefined, this)
|
|
275915
277182
|
]
|
|
275916
277183
|
}, undefined, true, undefined, this),
|
|
275917
|
-
files.length > 0 && /* @__PURE__ */
|
|
277184
|
+
files.length > 0 && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275918
277185
|
flexDirection: "column",
|
|
275919
277186
|
marginBottom: 1,
|
|
275920
|
-
children: files.map((f, i) => /* @__PURE__ */
|
|
277187
|
+
children: files.map((f, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275921
277188
|
gap: 1,
|
|
275922
277189
|
children: [
|
|
275923
|
-
/* @__PURE__ */
|
|
277190
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275924
277191
|
color: "gray",
|
|
275925
277192
|
children: " ·"
|
|
275926
277193
|
}, undefined, false, undefined, this),
|
|
275927
|
-
/* @__PURE__ */
|
|
277194
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275928
277195
|
color: "white",
|
|
275929
277196
|
children: f
|
|
275930
277197
|
}, undefined, false, undefined, this)
|
|
275931
277198
|
]
|
|
275932
277199
|
}, i, true, undefined, this))
|
|
275933
277200
|
}, undefined, false, undefined, this),
|
|
275934
|
-
/* @__PURE__ */
|
|
277201
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275935
277202
|
color: "gray",
|
|
275936
277203
|
children: div
|
|
275937
277204
|
}, undefined, false, undefined, this),
|
|
275938
|
-
phase.type === "checking" && /* @__PURE__ */
|
|
277205
|
+
phase.type === "checking" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275939
277206
|
gap: 1,
|
|
275940
277207
|
marginTop: 1,
|
|
275941
277208
|
children: [
|
|
275942
|
-
/* @__PURE__ */
|
|
277209
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275943
277210
|
color: ACCENT,
|
|
275944
277211
|
children: "*"
|
|
275945
277212
|
}, undefined, false, undefined, this),
|
|
275946
|
-
/* @__PURE__ */
|
|
277213
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275947
277214
|
color: "gray",
|
|
275948
277215
|
children: "checking changes…"
|
|
275949
277216
|
}, undefined, false, undefined, this)
|
|
275950
277217
|
]
|
|
275951
277218
|
}, undefined, true, undefined, this),
|
|
275952
|
-
phase.type === "staging" && /* @__PURE__ */
|
|
277219
|
+
phase.type === "staging" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275953
277220
|
gap: 1,
|
|
275954
277221
|
marginTop: 1,
|
|
275955
277222
|
children: [
|
|
275956
|
-
/* @__PURE__ */
|
|
277223
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275957
277224
|
color: ACCENT,
|
|
275958
277225
|
children: "*"
|
|
275959
277226
|
}, undefined, false, undefined, this),
|
|
275960
|
-
/* @__PURE__ */
|
|
277227
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275961
277228
|
color: "gray",
|
|
275962
277229
|
children: phase.files.length > 0 ? `staging ${phase.files.length} file${phase.files.length !== 1 ? "s" : ""}…` : "staging all changes…"
|
|
275963
277230
|
}, undefined, false, undefined, this)
|
|
275964
277231
|
]
|
|
275965
277232
|
}, undefined, true, undefined, this),
|
|
275966
|
-
phase.type === "no-changes" && /* @__PURE__ */
|
|
277233
|
+
phase.type === "no-changes" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275967
277234
|
flexDirection: "column",
|
|
275968
277235
|
marginTop: 1,
|
|
275969
277236
|
gap: 1,
|
|
275970
|
-
children: /* @__PURE__ */
|
|
277237
|
+
children: /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275971
277238
|
gap: 1,
|
|
275972
277239
|
children: [
|
|
275973
|
-
/* @__PURE__ */
|
|
277240
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275974
277241
|
color: "yellow",
|
|
275975
277242
|
children: figures_default.warning
|
|
275976
277243
|
}, undefined, false, undefined, this),
|
|
275977
|
-
/* @__PURE__ */
|
|
277244
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275978
277245
|
color: "white",
|
|
275979
277246
|
children: "nothing to commit — working tree is clean"
|
|
275980
277247
|
}, undefined, false, undefined, this)
|
|
275981
277248
|
]
|
|
275982
277249
|
}, undefined, true, undefined, this)
|
|
275983
277250
|
}, undefined, false, undefined, this),
|
|
275984
|
-
phase.type === "no-staged" && /* @__PURE__ */
|
|
277251
|
+
phase.type === "no-staged" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275985
277252
|
flexDirection: "column",
|
|
275986
277253
|
marginTop: 1,
|
|
275987
277254
|
gap: 1,
|
|
275988
277255
|
children: [
|
|
275989
|
-
/* @__PURE__ */
|
|
277256
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
275990
277257
|
gap: 1,
|
|
275991
277258
|
children: [
|
|
275992
|
-
/* @__PURE__ */
|
|
277259
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275993
277260
|
color: "yellow",
|
|
275994
277261
|
children: figures_default.warning
|
|
275995
277262
|
}, undefined, false, undefined, this),
|
|
275996
|
-
/* @__PURE__ */
|
|
277263
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
275997
277264
|
color: "white",
|
|
275998
277265
|
children: "no staged changes found"
|
|
275999
277266
|
}, undefined, false, undefined, this)
|
|
276000
277267
|
]
|
|
276001
277268
|
}, undefined, true, undefined, this),
|
|
276002
|
-
phase.hasUnstaged && /* @__PURE__ */
|
|
277269
|
+
phase.hasUnstaged && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276003
277270
|
flexDirection: "column",
|
|
276004
277271
|
marginLeft: 2,
|
|
276005
277272
|
gap: 1,
|
|
276006
277273
|
children: [
|
|
276007
|
-
/* @__PURE__ */
|
|
277274
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276008
277275
|
color: "gray",
|
|
276009
277276
|
children: "you have unstaged changes. try:"
|
|
276010
277277
|
}, undefined, false, undefined, this),
|
|
276011
|
-
phase.files.length > 0 ? /* @__PURE__ */
|
|
277278
|
+
phase.files.length > 0 ? /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276012
277279
|
color: "gray",
|
|
276013
277280
|
children: [
|
|
276014
277281
|
" ",
|
|
276015
|
-
/* @__PURE__ */
|
|
277282
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276016
277283
|
color: ACCENT,
|
|
276017
277284
|
children: [
|
|
276018
277285
|
"lens commit ",
|
|
@@ -276022,11 +277289,11 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276022
277289
|
" ",
|
|
276023
277290
|
"(stages and commits those files)"
|
|
276024
277291
|
]
|
|
276025
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
277292
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276026
277293
|
color: "gray",
|
|
276027
277294
|
children: [
|
|
276028
277295
|
" ",
|
|
276029
|
-
/* @__PURE__ */
|
|
277296
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276030
277297
|
color: ACCENT,
|
|
276031
277298
|
children: [
|
|
276032
277299
|
"git add ",
|
|
@@ -276036,7 +277303,7 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276036
277303
|
" ",
|
|
276037
277304
|
"or",
|
|
276038
277305
|
" ",
|
|
276039
|
-
/* @__PURE__ */
|
|
277306
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276040
277307
|
color: ACCENT,
|
|
276041
277308
|
children: "lens commit --auto"
|
|
276042
277309
|
}, undefined, false, undefined, this)
|
|
@@ -276046,48 +277313,48 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276046
277313
|
}, undefined, true, undefined, this)
|
|
276047
277314
|
]
|
|
276048
277315
|
}, undefined, true, undefined, this),
|
|
276049
|
-
phase.type === "generating" && /* @__PURE__ */
|
|
277316
|
+
phase.type === "generating" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276050
277317
|
gap: 1,
|
|
276051
277318
|
marginTop: 1,
|
|
276052
277319
|
children: [
|
|
276053
|
-
/* @__PURE__ */
|
|
277320
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276054
277321
|
color: ACCENT,
|
|
276055
277322
|
children: "●"
|
|
276056
277323
|
}, undefined, false, undefined, this),
|
|
276057
|
-
/* @__PURE__ */
|
|
277324
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276058
277325
|
color: "gray",
|
|
276059
277326
|
children: phraseText
|
|
276060
277327
|
}, undefined, false, undefined, this)
|
|
276061
277328
|
]
|
|
276062
277329
|
}, undefined, true, undefined, this),
|
|
276063
|
-
phase.type === "preview" && /* @__PURE__ */
|
|
277330
|
+
phase.type === "preview" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276064
277331
|
flexDirection: "column",
|
|
276065
277332
|
marginTop: 1,
|
|
276066
277333
|
gap: 1,
|
|
276067
277334
|
children: [
|
|
276068
|
-
/* @__PURE__ */
|
|
277335
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276069
277336
|
color: ACCENT,
|
|
276070
277337
|
bold: true,
|
|
276071
277338
|
children: "GENERATED MESSAGE"
|
|
276072
277339
|
}, undefined, false, undefined, this),
|
|
276073
|
-
/* @__PURE__ */
|
|
277340
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276074
277341
|
flexDirection: "column",
|
|
276075
277342
|
marginLeft: 2,
|
|
276076
277343
|
marginTop: 1,
|
|
276077
277344
|
marginBottom: 1,
|
|
276078
277345
|
children: phase.message.split(`
|
|
276079
|
-
`).map((line, i) => /* @__PURE__ */
|
|
277346
|
+
`).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276080
277347
|
color: i === 0 ? "white" : "gray",
|
|
276081
277348
|
bold: i === 0,
|
|
276082
277349
|
children: line || " "
|
|
276083
277350
|
}, i, false, undefined, this))
|
|
276084
277351
|
}, undefined, false, undefined, this),
|
|
276085
|
-
phase.splitGroups.length > 0 && /* @__PURE__ */
|
|
277352
|
+
phase.splitGroups.length > 0 && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276086
277353
|
flexDirection: "column",
|
|
276087
277354
|
marginLeft: 2,
|
|
276088
277355
|
marginBottom: 1,
|
|
276089
277356
|
children: [
|
|
276090
|
-
/* @__PURE__ */
|
|
277357
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276091
277358
|
color: "yellow",
|
|
276092
277359
|
children: [
|
|
276093
277360
|
"⚡ large diff — consider splitting into",
|
|
@@ -276096,7 +277363,7 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276096
277363
|
" commits:"
|
|
276097
277364
|
]
|
|
276098
277365
|
}, undefined, true, undefined, this),
|
|
276099
|
-
phase.splitGroups.map((g, i) => /* @__PURE__ */
|
|
277366
|
+
phase.splitGroups.map((g, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276100
277367
|
color: "gray",
|
|
276101
277368
|
children: [
|
|
276102
277369
|
" · ",
|
|
@@ -276105,23 +277372,23 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276105
277372
|
}, i, true, undefined, this))
|
|
276106
277373
|
]
|
|
276107
277374
|
}, undefined, true, undefined, this),
|
|
276108
|
-
/* @__PURE__ */
|
|
277375
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276109
277376
|
color: "gray",
|
|
276110
277377
|
children: div
|
|
276111
277378
|
}, undefined, false, undefined, this),
|
|
276112
|
-
/* @__PURE__ */
|
|
277379
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276113
277380
|
gap: 3,
|
|
276114
277381
|
marginTop: 1,
|
|
276115
277382
|
children: [
|
|
276116
|
-
/* @__PURE__ */
|
|
277383
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276117
277384
|
color: GREEN,
|
|
276118
277385
|
children: "y/enter commit"
|
|
276119
277386
|
}, undefined, false, undefined, this),
|
|
276120
|
-
/* @__PURE__ */
|
|
277387
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276121
277388
|
color: CYAN,
|
|
276122
277389
|
children: "e edit"
|
|
276123
277390
|
}, undefined, false, undefined, this),
|
|
276124
|
-
/* @__PURE__ */
|
|
277391
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276125
277392
|
color: "gray",
|
|
276126
277393
|
children: "n/esc cancel"
|
|
276127
277394
|
}, undefined, false, undefined, this)
|
|
@@ -276129,23 +277396,23 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276129
277396
|
}, undefined, true, undefined, this)
|
|
276130
277397
|
]
|
|
276131
277398
|
}, undefined, true, undefined, this),
|
|
276132
|
-
phase.type === "editing" && /* @__PURE__ */
|
|
277399
|
+
phase.type === "editing" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276133
277400
|
flexDirection: "column",
|
|
276134
277401
|
marginTop: 1,
|
|
276135
277402
|
gap: 1,
|
|
276136
277403
|
children: [
|
|
276137
|
-
/* @__PURE__ */
|
|
277404
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276138
277405
|
color: ACCENT,
|
|
276139
277406
|
bold: true,
|
|
276140
277407
|
children: "EDIT MESSAGE"
|
|
276141
277408
|
}, undefined, false, undefined, this),
|
|
276142
|
-
/* @__PURE__ */
|
|
277409
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276143
277410
|
marginLeft: 2,
|
|
276144
277411
|
marginTop: 1,
|
|
276145
277412
|
flexDirection: "column",
|
|
276146
277413
|
gap: 1,
|
|
276147
277414
|
children: [
|
|
276148
|
-
/* @__PURE__ */
|
|
277415
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(build_default2, {
|
|
276149
277416
|
value: phase.message,
|
|
276150
277417
|
onChange: (msg) => setPhase((prev) => prev.type === "editing" ? { ...prev, message: msg } : prev),
|
|
276151
277418
|
onSubmit: (msg) => setPhase((prev) => prev.type === "editing" ? {
|
|
@@ -276155,7 +277422,7 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276155
277422
|
diff: prev.diff
|
|
276156
277423
|
} : prev)
|
|
276157
277424
|
}, undefined, false, undefined, this),
|
|
276158
|
-
/* @__PURE__ */
|
|
277425
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276159
277426
|
color: "gray",
|
|
276160
277427
|
children: "enter confirm · esc back"
|
|
276161
277428
|
}, undefined, false, undefined, this)
|
|
@@ -276163,52 +277430,52 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276163
277430
|
}, undefined, true, undefined, this)
|
|
276164
277431
|
]
|
|
276165
277432
|
}, undefined, true, undefined, this),
|
|
276166
|
-
phase.type === "committing" && /* @__PURE__ */
|
|
277433
|
+
phase.type === "committing" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276167
277434
|
gap: 1,
|
|
276168
277435
|
marginTop: 1,
|
|
276169
277436
|
children: [
|
|
276170
|
-
/* @__PURE__ */
|
|
277437
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276171
277438
|
color: ACCENT,
|
|
276172
277439
|
children: "*"
|
|
276173
277440
|
}, undefined, false, undefined, this),
|
|
276174
|
-
/* @__PURE__ */
|
|
277441
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276175
277442
|
color: "gray",
|
|
276176
277443
|
children: "committing…"
|
|
276177
277444
|
}, undefined, false, undefined, this)
|
|
276178
277445
|
]
|
|
276179
277446
|
}, undefined, true, undefined, this),
|
|
276180
|
-
phase.type === "pushing" && /* @__PURE__ */
|
|
277447
|
+
phase.type === "pushing" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276181
277448
|
flexDirection: "column",
|
|
276182
277449
|
marginTop: 1,
|
|
276183
277450
|
gap: 1,
|
|
276184
277451
|
children: [
|
|
276185
|
-
/* @__PURE__ */
|
|
277452
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276186
277453
|
gap: 2,
|
|
276187
277454
|
children: [
|
|
276188
|
-
/* @__PURE__ */
|
|
277455
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276189
277456
|
color: GREEN,
|
|
276190
277457
|
children: figures_default.tick
|
|
276191
277458
|
}, undefined, false, undefined, this),
|
|
276192
|
-
/* @__PURE__ */
|
|
277459
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276193
277460
|
color: ACCENT,
|
|
276194
277461
|
children: phase.hash
|
|
276195
277462
|
}, undefined, false, undefined, this),
|
|
276196
|
-
/* @__PURE__ */
|
|
277463
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276197
277464
|
color: "white",
|
|
276198
277465
|
children: trunc2(phase.message.split(`
|
|
276199
277466
|
`)[0], 65)
|
|
276200
277467
|
}, undefined, false, undefined, this)
|
|
276201
277468
|
]
|
|
276202
277469
|
}, undefined, true, undefined, this),
|
|
276203
|
-
/* @__PURE__ */
|
|
277470
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276204
277471
|
gap: 1,
|
|
276205
277472
|
marginLeft: 2,
|
|
276206
277473
|
children: [
|
|
276207
|
-
/* @__PURE__ */
|
|
277474
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276208
277475
|
color: ACCENT,
|
|
276209
277476
|
children: "*"
|
|
276210
277477
|
}, undefined, false, undefined, this),
|
|
276211
|
-
/* @__PURE__ */
|
|
277478
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276212
277479
|
color: "gray",
|
|
276213
277480
|
children: "pushing…"
|
|
276214
277481
|
}, undefined, false, undefined, this)
|
|
@@ -276216,23 +277483,23 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276216
277483
|
}, undefined, true, undefined, this)
|
|
276217
277484
|
]
|
|
276218
277485
|
}, undefined, true, undefined, this),
|
|
276219
|
-
phase.type === "done" && /* @__PURE__ */
|
|
277486
|
+
phase.type === "done" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276220
277487
|
flexDirection: "column",
|
|
276221
277488
|
marginTop: 1,
|
|
276222
277489
|
gap: 1,
|
|
276223
277490
|
children: [
|
|
276224
|
-
/* @__PURE__ */
|
|
277491
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276225
277492
|
gap: 2,
|
|
276226
277493
|
children: [
|
|
276227
|
-
/* @__PURE__ */
|
|
277494
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276228
277495
|
color: GREEN,
|
|
276229
277496
|
children: figures_default.tick
|
|
276230
277497
|
}, undefined, false, undefined, this),
|
|
276231
|
-
/* @__PURE__ */
|
|
277498
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276232
277499
|
color: ACCENT,
|
|
276233
277500
|
children: phase.hash
|
|
276234
277501
|
}, undefined, false, undefined, this),
|
|
276235
|
-
/* @__PURE__ */
|
|
277502
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276236
277503
|
color: "white",
|
|
276237
277504
|
bold: true,
|
|
276238
277505
|
children: trunc2(phase.message.split(`
|
|
@@ -276241,70 +277508,70 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276241
277508
|
]
|
|
276242
277509
|
}, undefined, true, undefined, this),
|
|
276243
277510
|
phase.message.split(`
|
|
276244
|
-
`).slice(2).filter(Boolean).map((line, i) => /* @__PURE__ */
|
|
277511
|
+
`).slice(2).filter(Boolean).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276245
277512
|
color: "gray",
|
|
276246
277513
|
children: line
|
|
276247
277514
|
}, i, false, undefined, this)),
|
|
276248
|
-
phase.pushed && /* @__PURE__ */
|
|
277515
|
+
phase.pushed && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276249
277516
|
gap: 2,
|
|
276250
277517
|
marginTop: 1,
|
|
276251
277518
|
children: [
|
|
276252
|
-
/* @__PURE__ */
|
|
277519
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276253
277520
|
color: GREEN,
|
|
276254
277521
|
children: figures_default.tick
|
|
276255
277522
|
}, undefined, false, undefined, this),
|
|
276256
|
-
/* @__PURE__ */
|
|
277523
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276257
277524
|
color: "gray",
|
|
276258
277525
|
children: "pushed to remote"
|
|
276259
277526
|
}, undefined, false, undefined, this)
|
|
276260
277527
|
]
|
|
276261
277528
|
}, undefined, true, undefined, this),
|
|
276262
|
-
/* @__PURE__ */
|
|
277529
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276263
277530
|
color: "gray",
|
|
276264
277531
|
children: "press any key to exit"
|
|
276265
277532
|
}, undefined, false, undefined, this)
|
|
276266
277533
|
]
|
|
276267
277534
|
}, undefined, true, undefined, this),
|
|
276268
|
-
phase.type === "preview-only" && /* @__PURE__ */
|
|
277535
|
+
phase.type === "preview-only" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276269
277536
|
flexDirection: "column",
|
|
276270
277537
|
marginTop: 1,
|
|
276271
277538
|
gap: 1,
|
|
276272
277539
|
children: [
|
|
276273
|
-
/* @__PURE__ */
|
|
277540
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276274
277541
|
color: ACCENT,
|
|
276275
277542
|
bold: true,
|
|
276276
277543
|
children: "GENERATED MESSAGE"
|
|
276277
277544
|
}, undefined, false, undefined, this),
|
|
276278
|
-
/* @__PURE__ */
|
|
277545
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276279
277546
|
flexDirection: "column",
|
|
276280
277547
|
marginLeft: 2,
|
|
276281
277548
|
marginTop: 1,
|
|
276282
277549
|
children: phase.message.split(`
|
|
276283
|
-
`).map((line, i) => /* @__PURE__ */
|
|
277550
|
+
`).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276284
277551
|
color: i === 0 ? "white" : "gray",
|
|
276285
277552
|
bold: i === 0,
|
|
276286
277553
|
children: line || " "
|
|
276287
277554
|
}, i, false, undefined, this))
|
|
276288
277555
|
}, undefined, false, undefined, this),
|
|
276289
|
-
/* @__PURE__ */
|
|
277556
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276290
277557
|
color: "gray",
|
|
276291
277558
|
children: "(preview only — not committed)"
|
|
276292
277559
|
}, undefined, false, undefined, this)
|
|
276293
277560
|
]
|
|
276294
277561
|
}, undefined, true, undefined, this),
|
|
276295
|
-
phase.type === "error" && /* @__PURE__ */
|
|
277562
|
+
phase.type === "error" && /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276296
277563
|
flexDirection: "column",
|
|
276297
277564
|
marginTop: 1,
|
|
276298
277565
|
gap: 1,
|
|
276299
277566
|
children: [
|
|
276300
|
-
/* @__PURE__ */
|
|
277567
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Box_default, {
|
|
276301
277568
|
gap: 1,
|
|
276302
277569
|
children: [
|
|
276303
|
-
/* @__PURE__ */
|
|
277570
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276304
277571
|
color: RED,
|
|
276305
277572
|
children: figures_default.cross
|
|
276306
277573
|
}, undefined, false, undefined, this),
|
|
276307
|
-
/* @__PURE__ */
|
|
277574
|
+
/* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276308
277575
|
color: "white",
|
|
276309
277576
|
children: phase.message.split(`
|
|
276310
277577
|
`)[0]
|
|
@@ -276312,7 +277579,7 @@ ${missing.map((f) => ` ${f}`).join(`
|
|
|
276312
277579
|
]
|
|
276313
277580
|
}, undefined, true, undefined, this),
|
|
276314
277581
|
phase.message.split(`
|
|
276315
|
-
`).slice(1).map((line, i) => /* @__PURE__ */
|
|
277582
|
+
`).slice(1).map((line, i) => /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276316
277583
|
color: "gray",
|
|
276317
277584
|
children: line
|
|
276318
277585
|
}, i, false, undefined, this))
|
|
@@ -276329,12 +277596,12 @@ function CommitCommand({
|
|
|
276329
277596
|
push,
|
|
276330
277597
|
confirm
|
|
276331
277598
|
}) {
|
|
276332
|
-
const cwd2 =
|
|
276333
|
-
const [provider, setProvider] =
|
|
276334
|
-
if (!
|
|
276335
|
-
return /* @__PURE__ */
|
|
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, {
|
|
276336
277603
|
marginTop: 1,
|
|
276337
|
-
children: /* @__PURE__ */
|
|
277604
|
+
children: /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Text, {
|
|
276338
277605
|
color: RED,
|
|
276339
277606
|
children: [
|
|
276340
277607
|
figures_default.cross,
|
|
@@ -276345,11 +277612,11 @@ function CommitCommand({
|
|
|
276345
277612
|
}, undefined, false, undefined, this);
|
|
276346
277613
|
}
|
|
276347
277614
|
if (!provider) {
|
|
276348
|
-
return /* @__PURE__ */
|
|
277615
|
+
return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(ProviderPicker, {
|
|
276349
277616
|
onDone: setProvider
|
|
276350
277617
|
}, undefined, false, undefined, this);
|
|
276351
277618
|
}
|
|
276352
|
-
return /* @__PURE__ */
|
|
277619
|
+
return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(CommitRunner, {
|
|
276353
277620
|
cwd: cwd2,
|
|
276354
277621
|
provider,
|
|
276355
277622
|
files,
|
|
@@ -276360,8 +277627,8 @@ function CommitCommand({
|
|
|
276360
277627
|
}, undefined, false, undefined, this);
|
|
276361
277628
|
}
|
|
276362
277629
|
// src/tools/view-image.ts
|
|
276363
|
-
import
|
|
276364
|
-
import { existsSync as
|
|
277630
|
+
import path26 from "path";
|
|
277631
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
|
|
276365
277632
|
import { execSync as execSync6 } from "child_process";
|
|
276366
277633
|
function parseViewImageInput(body) {
|
|
276367
277634
|
const trimmed = body.trim();
|
|
@@ -276387,10 +277654,10 @@ async function fetchBytes(src, repoPath) {
|
|
|
276387
277654
|
throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
|
276388
277655
|
return Buffer.from(await res.arrayBuffer());
|
|
276389
277656
|
}
|
|
276390
|
-
const resolved =
|
|
276391
|
-
if (!
|
|
277657
|
+
const resolved = path26.isAbsolute(src) ? src : path26.join(repoPath, src);
|
|
277658
|
+
if (!existsSync20(resolved))
|
|
276392
277659
|
throw new Error(`File not found: ${resolved}`);
|
|
276393
|
-
return
|
|
277660
|
+
return readFileSync14(resolved);
|
|
276394
277661
|
}
|
|
276395
277662
|
function detectProtocol() {
|
|
276396
277663
|
const term = (process.env["TERM"] ?? "").toLowerCase();
|
|
@@ -276461,7 +277728,7 @@ function renderKitty2(buf, width) {
|
|
|
276461
277728
|
}
|
|
276462
277729
|
function renderSixel(buf, src, repoPath, width) {
|
|
276463
277730
|
const widthCols = typeof width === "number" ? width : width.endsWith("%") ? Math.floor((process.stdout.columns ?? 80) * (parseInt(width) / 100)) : parseInt(width);
|
|
276464
|
-
const tmpPath =
|
|
277731
|
+
const tmpPath = path26.join(process.env["TEMP"] ?? process.env["TMPDIR"] ?? "/tmp", `lens_img_${Date.now()}.bin`);
|
|
276465
277732
|
const { writeFileSync: writeFileSync10, unlinkSync: unlinkSync2 } = __require("fs");
|
|
276466
277733
|
writeFileSync10(tmpPath, buf);
|
|
276467
277734
|
try {
|
|
@@ -276541,7 +277808,7 @@ var viewImageTool = {
|
|
|
276541
277808
|
].join(`
|
|
276542
277809
|
`),
|
|
276543
277810
|
parseInput: parseViewImageInput,
|
|
276544
|
-
summariseInput: ({ src, width }) => `${
|
|
277811
|
+
summariseInput: ({ src, width }) => `${path26.basename(src)} (${width ?? "80%"})`,
|
|
276545
277812
|
execute: async (input, ctx) => {
|
|
276546
277813
|
try {
|
|
276547
277814
|
const ansi = await renderImage(input, ctx.repoPath);
|
|
@@ -276704,8 +277971,8 @@ var chartDataTool = {
|
|
|
276704
277971
|
}
|
|
276705
277972
|
};
|
|
276706
277973
|
// src/tools/convert-image.ts
|
|
276707
|
-
import
|
|
276708
|
-
import { existsSync as
|
|
277974
|
+
import path27 from "path";
|
|
277975
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync8 } from "fs";
|
|
276709
277976
|
import { execSync as execSync7 } from "child_process";
|
|
276710
277977
|
function parseInput(body) {
|
|
276711
277978
|
const trimmed = body.trim();
|
|
@@ -276729,11 +277996,11 @@ function ffmpegAvailable() {
|
|
|
276729
277996
|
}
|
|
276730
277997
|
}
|
|
276731
277998
|
function resolve2(p, repoPath) {
|
|
276732
|
-
return
|
|
277999
|
+
return path27.isAbsolute(p) ? p : path27.join(repoPath, p);
|
|
276733
278000
|
}
|
|
276734
278001
|
function ensureDir(filePath) {
|
|
276735
|
-
const dir =
|
|
276736
|
-
if (!
|
|
278002
|
+
const dir = path27.dirname(filePath);
|
|
278003
|
+
if (!existsSync21(dir))
|
|
276737
278004
|
mkdirSync8(dir, { recursive: true });
|
|
276738
278005
|
}
|
|
276739
278006
|
function buildVfFilters(input) {
|
|
@@ -276805,7 +278072,7 @@ function buildArgs(input, resolvedInput, resolvedOutput, repoPath) {
|
|
|
276805
278072
|
if (vf.length)
|
|
276806
278073
|
args.push("-vf", vf.join(","));
|
|
276807
278074
|
}
|
|
276808
|
-
const ext =
|
|
278075
|
+
const ext = path27.extname(resolvedOutput).toLowerCase();
|
|
276809
278076
|
if (input.quality !== undefined) {
|
|
276810
278077
|
if (ext === ".jpg" || ext === ".jpeg") {
|
|
276811
278078
|
const q = Math.round(2 + (100 - input.quality) / 100 * 29);
|
|
@@ -276845,7 +278112,7 @@ function runConvert(input, repoPath) {
|
|
|
276845
278112
|
ensureDir(resolvedOutput);
|
|
276846
278113
|
const resolvedInput = Array.isArray(input.input) ? resolve2(input.input[0], repoPath) : resolve2(input.input, repoPath);
|
|
276847
278114
|
if (!Array.isArray(input.input) && !input.input.startsWith("http")) {
|
|
276848
|
-
if (!
|
|
278115
|
+
if (!existsSync21(resolvedInput)) {
|
|
276849
278116
|
return `Error: input file not found — ${resolvedInput}`;
|
|
276850
278117
|
}
|
|
276851
278118
|
}
|
|
@@ -276860,7 +278127,7 @@ function runConvert(input, repoPath) {
|
|
|
276860
278127
|
const lines = (stderr || "").split(`
|
|
276861
278128
|
`).filter((l) => l.includes("video:") || l.includes("frame=")).slice(-3).join(`
|
|
276862
278129
|
`);
|
|
276863
|
-
const inputLabel = Array.isArray(input.input) ? `${input.input.length} files` :
|
|
278130
|
+
const inputLabel = Array.isArray(input.input) ? `${input.input.length} files` : path27.basename(input.input);
|
|
276864
278131
|
return (`✓ converted ${inputLabel} → ${input.output}
|
|
276865
278132
|
` + (lines ? `
|
|
276866
278133
|
${lines}` : "")).trim();
|
|
@@ -276909,8 +278176,8 @@ var convertImageTool = {
|
|
|
276909
278176
|
`),
|
|
276910
278177
|
parseInput,
|
|
276911
278178
|
summariseInput: ({ input, output }) => {
|
|
276912
|
-
const src = Array.isArray(input) ? `${input.length} files` :
|
|
276913
|
-
return `${src} → ${
|
|
278179
|
+
const src = Array.isArray(input) ? `${input.length} files` : path27.basename(input);
|
|
278180
|
+
return `${src} → ${path27.basename(output)}`;
|
|
276914
278181
|
},
|
|
276915
278182
|
execute: async (input, ctx) => {
|
|
276916
278183
|
try {
|
|
@@ -277031,7 +278298,7 @@ var writeFileTool = {
|
|
|
277031
278298
|
return null;
|
|
277032
278299
|
}
|
|
277033
278300
|
},
|
|
277034
|
-
summariseInput: ({ path:
|
|
278301
|
+
summariseInput: ({ path: path28, content }) => `${path28} (${content.length} bytes)`,
|
|
277035
278302
|
execute: ({ path: filePath, content }, ctx) => ({
|
|
277036
278303
|
kind: "text",
|
|
277037
278304
|
value: writeFile(filePath, content, ctx.repoPath)
|
|
@@ -277209,13 +278476,13 @@ function registerBuiltins() {
|
|
|
277209
278476
|
}
|
|
277210
278477
|
|
|
277211
278478
|
// src/utils/addons/loadAddons.ts
|
|
277212
|
-
import
|
|
278479
|
+
import path28 from "path";
|
|
277213
278480
|
import os9 from "os";
|
|
277214
|
-
import { existsSync as
|
|
278481
|
+
import { existsSync as existsSync22, readdirSync as readdirSync5 } from "fs";
|
|
277215
278482
|
import { pathToFileURL } from "url";
|
|
277216
|
-
var ADDONS_DIR =
|
|
278483
|
+
var ADDONS_DIR = path28.join(os9.homedir(), ".lens", "addons");
|
|
277217
278484
|
async function loadAddons() {
|
|
277218
|
-
if (!
|
|
278485
|
+
if (!existsSync22(ADDONS_DIR)) {
|
|
277219
278486
|
return;
|
|
277220
278487
|
}
|
|
277221
278488
|
const files = readdirSync5(ADDONS_DIR).filter((f) => f.endsWith(".js") && !f.startsWith("_"));
|
|
@@ -277223,7 +278490,7 @@ async function loadAddons() {
|
|
|
277223
278490
|
const file = files[i];
|
|
277224
278491
|
if (!file)
|
|
277225
278492
|
return;
|
|
277226
|
-
const fullPath =
|
|
278493
|
+
const fullPath = path28.join(ADDONS_DIR, file);
|
|
277227
278494
|
const fileUrl = pathToFileURL(fullPath).href;
|
|
277228
278495
|
const isLast = i === files.length - 1;
|
|
277229
278496
|
try {
|
|
@@ -277237,41 +278504,41 @@ async function loadAddons() {
|
|
|
277237
278504
|
}
|
|
277238
278505
|
|
|
277239
278506
|
// src/index.tsx
|
|
277240
|
-
var
|
|
278507
|
+
var jsx_dev_runtime28 = __toESM(require_jsx_dev_runtime(), 1);
|
|
277241
278508
|
registerBuiltins();
|
|
277242
278509
|
await loadAddons();
|
|
277243
278510
|
var program2 = new Command;
|
|
277244
278511
|
program2.command("stalk <url>").alias("repo").description("Analyze a remote repository").action((url) => {
|
|
277245
|
-
render_default(/* @__PURE__ */
|
|
278512
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(RepoCommand, {
|
|
277246
278513
|
url
|
|
277247
278514
|
}, undefined, false, undefined, this));
|
|
277248
278515
|
});
|
|
277249
278516
|
program2.command("provider").description("Configure AI providers").action(() => {
|
|
277250
|
-
render_default(/* @__PURE__ */
|
|
278517
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(InitCommand, {}, undefined, false, undefined, this));
|
|
277251
278518
|
});
|
|
277252
278519
|
program2.command("judge [path]").alias("review").description("Review a local codebase").action((inputPath) => {
|
|
277253
|
-
render_default(/* @__PURE__ */
|
|
278520
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(ReviewCommand, {
|
|
277254
278521
|
path: inputPath ?? "."
|
|
277255
278522
|
}, undefined, false, undefined, this));
|
|
277256
278523
|
});
|
|
277257
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) => {
|
|
277258
|
-
render_default(/* @__PURE__ */
|
|
278525
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(TaskCommand, {
|
|
277259
278526
|
prompt: text,
|
|
277260
278527
|
path: opts.path
|
|
277261
278528
|
}, undefined, false, undefined, this));
|
|
277262
278529
|
});
|
|
277263
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) => {
|
|
277264
|
-
render_default(/* @__PURE__ */
|
|
278531
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(ChatCommand, {
|
|
277265
278532
|
path: opts.path
|
|
277266
278533
|
}, undefined, false, undefined, this));
|
|
277267
278534
|
});
|
|
277268
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) => {
|
|
277269
|
-
render_default(/* @__PURE__ */
|
|
278536
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(TimelineCommand, {
|
|
277270
278537
|
path: opts.path
|
|
277271
278538
|
}, undefined, false, undefined, this));
|
|
277272
278539
|
});
|
|
277273
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) => {
|
|
277274
|
-
render_default(/* @__PURE__ */
|
|
278541
|
+
render_default(/* @__PURE__ */ jsx_dev_runtime28.jsxDEV(CommitCommand, {
|
|
277275
278542
|
path: opts.path,
|
|
277276
278543
|
files: files ?? [],
|
|
277277
278544
|
auto: opts.auto ?? false,
|
|
@@ -277280,4 +278547,14 @@ program2.command("crimes [files...]").alias("commit").description("Generate a sm
|
|
|
277280
278547
|
push: opts.push ?? false
|
|
277281
278548
|
}, undefined, false, undefined, this));
|
|
277282
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
|
+
});
|
|
277283
278560
|
program2.parse(process.argv);
|