nexrall-code 0.5.41 → 0.5.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +532 -385
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -982,8 +982,8 @@ var require_command = __commonJS({
982
982
  "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
983
983
  var EventEmitter4 = __require("node:events").EventEmitter;
984
984
  var childProcess = __require("node:child_process");
985
- var path5 = __require("node:path");
986
- var fs8 = __require("node:fs");
985
+ var path6 = __require("node:path");
986
+ var fs9 = __require("node:fs");
987
987
  var process14 = __require("node:process");
988
988
  var { Argument: Argument2, humanReadableArgName } = require_argument();
989
989
  var { CommanderError: CommanderError2 } = require_error();
@@ -1925,13 +1925,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1925
1925
  let launchWithNode = false;
1926
1926
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1927
1927
  function findFile(baseDir, baseName) {
1928
- const localBin = path5.resolve(baseDir, baseName);
1929
- if (fs8.existsSync(localBin))
1928
+ const localBin = path6.resolve(baseDir, baseName);
1929
+ if (fs9.existsSync(localBin))
1930
1930
  return localBin;
1931
- if (sourceExt.includes(path5.extname(baseName)))
1931
+ if (sourceExt.includes(path6.extname(baseName)))
1932
1932
  return void 0;
1933
1933
  const foundExt = sourceExt.find(
1934
- (ext) => fs8.existsSync(`${localBin}${ext}`)
1934
+ (ext) => fs9.existsSync(`${localBin}${ext}`)
1935
1935
  );
1936
1936
  if (foundExt)
1937
1937
  return `${localBin}${foundExt}`;
@@ -1944,21 +1944,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
1944
1944
  if (this._scriptPath) {
1945
1945
  let resolvedScriptPath;
1946
1946
  try {
1947
- resolvedScriptPath = fs8.realpathSync(this._scriptPath);
1947
+ resolvedScriptPath = fs9.realpathSync(this._scriptPath);
1948
1948
  } catch (err) {
1949
1949
  resolvedScriptPath = this._scriptPath;
1950
1950
  }
1951
- executableDir = path5.resolve(
1952
- path5.dirname(resolvedScriptPath),
1951
+ executableDir = path6.resolve(
1952
+ path6.dirname(resolvedScriptPath),
1953
1953
  executableDir
1954
1954
  );
1955
1955
  }
1956
1956
  if (executableDir) {
1957
1957
  let localFile = findFile(executableDir, executableFile);
1958
1958
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1959
- const legacyName = path5.basename(
1959
+ const legacyName = path6.basename(
1960
1960
  this._scriptPath,
1961
- path5.extname(this._scriptPath)
1961
+ path6.extname(this._scriptPath)
1962
1962
  );
1963
1963
  if (legacyName !== this._name) {
1964
1964
  localFile = findFile(
@@ -1969,7 +1969,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1969
1969
  }
1970
1970
  executableFile = localFile || executableFile;
1971
1971
  }
1972
- launchWithNode = sourceExt.includes(path5.extname(executableFile));
1972
+ launchWithNode = sourceExt.includes(path6.extname(executableFile));
1973
1973
  let proc;
1974
1974
  if (process14.platform !== "win32") {
1975
1975
  if (launchWithNode) {
@@ -2826,7 +2826,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2826
2826
  * @return {Command}
2827
2827
  */
2828
2828
  nameFromFilename(filename) {
2829
- this._name = path5.basename(filename, path5.extname(filename));
2829
+ this._name = path6.basename(filename, path6.extname(filename));
2830
2830
  return this;
2831
2831
  }
2832
2832
  /**
@@ -2840,10 +2840,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
2840
2840
  * @param {string} [path]
2841
2841
  * @return {(string|null|Command)}
2842
2842
  */
2843
- executableDir(path6) {
2844
- if (path6 === void 0)
2843
+ executableDir(path7) {
2844
+ if (path7 === void 0)
2845
2845
  return this._executableDir;
2846
- this._executableDir = path6;
2846
+ this._executableDir = path7;
2847
2847
  return this;
2848
2848
  }
2849
2849
  /**
@@ -3156,19 +3156,19 @@ var require_auth = __commonJS({
3156
3156
  exports.clearAuth = clearAuth2;
3157
3157
  exports.isAuthenticated = isAuthenticated3;
3158
3158
  exports.getToken = getToken;
3159
- var fs8 = __importStar(__require("fs"));
3160
- var path5 = __importStar(__require("path"));
3159
+ var fs9 = __importStar(__require("fs"));
3160
+ var path6 = __importStar(__require("path"));
3161
3161
  var os6 = __importStar(__require("os"));
3162
- var CONFIG_DIR = path5.join(os6.homedir(), ".nexrall");
3163
- var CONFIG_FILE = path5.join(CONFIG_DIR, "config.json");
3162
+ var CONFIG_DIR = path6.join(os6.homedir(), ".nexrall");
3163
+ var CONFIG_FILE = path6.join(CONFIG_DIR, "config.json");
3164
3164
  function ensureConfigDir() {
3165
- if (!fs8.existsSync(CONFIG_DIR)) {
3166
- fs8.mkdirSync(CONFIG_DIR, { recursive: true });
3165
+ if (!fs9.existsSync(CONFIG_DIR)) {
3166
+ fs9.mkdirSync(CONFIG_DIR, { recursive: true });
3167
3167
  }
3168
3168
  }
3169
3169
  function saveAuth2(config) {
3170
3170
  ensureConfigDir();
3171
- fs8.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), { mode: 384 });
3171
+ fs9.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), { mode: 384 });
3172
3172
  }
3173
3173
  function loadAuth() {
3174
3174
  const envToken = process.env.NEXRALL_TOKEN;
@@ -3176,10 +3176,10 @@ var require_auth = __commonJS({
3176
3176
  return { token: envToken.trim() };
3177
3177
  }
3178
3178
  try {
3179
- if (!fs8.existsSync(CONFIG_FILE)) {
3179
+ if (!fs9.existsSync(CONFIG_FILE)) {
3180
3180
  return null;
3181
3181
  }
3182
- const raw = fs8.readFileSync(CONFIG_FILE, "utf-8");
3182
+ const raw = fs9.readFileSync(CONFIG_FILE, "utf-8");
3183
3183
  const parsed = JSON.parse(raw);
3184
3184
  if (typeof parsed === "object" && parsed !== null && "token" in parsed && typeof parsed.token === "string") {
3185
3185
  return parsed;
@@ -3191,8 +3191,8 @@ var require_auth = __commonJS({
3191
3191
  }
3192
3192
  function clearAuth2() {
3193
3193
  try {
3194
- if (fs8.existsSync(CONFIG_FILE)) {
3195
- fs8.unlinkSync(CONFIG_FILE);
3194
+ if (fs9.existsSync(CONFIG_FILE)) {
3195
+ fs9.unlinkSync(CONFIG_FILE);
3196
3196
  }
3197
3197
  } catch {
3198
3198
  }
@@ -8150,22 +8150,22 @@ var init_from = __esm({
8150
8150
  init_file();
8151
8151
  init_fetch_blob();
8152
8152
  ({ stat } = fs);
8153
- blobFromSync = (path5, type) => fromBlob(statSync(path5), path5, type);
8154
- blobFrom = (path5, type) => stat(path5).then((stat2) => fromBlob(stat2, path5, type));
8155
- fileFrom = (path5, type) => stat(path5).then((stat2) => fromFile(stat2, path5, type));
8156
- fileFromSync = (path5, type) => fromFile(statSync(path5), path5, type);
8157
- fromBlob = (stat2, path5, type = "") => new fetch_blob_default([new BlobDataItem({
8158
- path: path5,
8153
+ blobFromSync = (path6, type) => fromBlob(statSync(path6), path6, type);
8154
+ blobFrom = (path6, type) => stat(path6).then((stat2) => fromBlob(stat2, path6, type));
8155
+ fileFrom = (path6, type) => stat(path6).then((stat2) => fromFile(stat2, path6, type));
8156
+ fileFromSync = (path6, type) => fromFile(statSync(path6), path6, type);
8157
+ fromBlob = (stat2, path6, type = "") => new fetch_blob_default([new BlobDataItem({
8158
+ path: path6,
8159
8159
  size: stat2.size,
8160
8160
  lastModified: stat2.mtimeMs,
8161
8161
  start: 0
8162
8162
  })], { type });
8163
- fromFile = (stat2, path5, type = "") => new file_default([new BlobDataItem({
8164
- path: path5,
8163
+ fromFile = (stat2, path6, type = "") => new file_default([new BlobDataItem({
8164
+ path: path6,
8165
8165
  size: stat2.size,
8166
8166
  lastModified: stat2.mtimeMs,
8167
8167
  start: 0
8168
- })], basename(path5), { type, lastModified: stat2.mtimeMs });
8168
+ })], basename(path6), { type, lastModified: stat2.mtimeMs });
8169
8169
  BlobDataItem = class _BlobDataItem {
8170
8170
  #path;
8171
8171
  #start;
@@ -10748,17 +10748,17 @@ var require_memory = __commonJS({
10748
10748
  exports.clearMemory = clearMemory2;
10749
10749
  exports.memoryStats = memoryStats2;
10750
10750
  exports.compactMemoryIfNeeded = compactMemoryIfNeeded2;
10751
- var fs8 = __importStar(__require("fs"));
10751
+ var fs9 = __importStar(__require("fs"));
10752
10752
  var os6 = __importStar(__require("os"));
10753
- var path5 = __importStar(__require("path"));
10753
+ var path6 = __importStar(__require("path"));
10754
10754
  var crypto2 = __importStar(__require("crypto"));
10755
- var MEMORY_ROOT = process.env.NEXRALL_MEMORY_DIR || path5.join(os6.homedir(), ".nexrall", "memory");
10756
- var GLOBAL_FILE = path5.join(MEMORY_ROOT, "global.md");
10755
+ var MEMORY_ROOT = process.env.NEXRALL_MEMORY_DIR || path6.join(os6.homedir(), ".nexrall", "memory");
10756
+ var GLOBAL_FILE = path6.join(MEMORY_ROOT, "global.md");
10757
10757
  function memoryFilePath(scope, workDir) {
10758
10758
  if (scope === "global" || !workDir)
10759
10759
  return GLOBAL_FILE;
10760
- const key = crypto2.createHash("sha1").update(path5.resolve(workDir)).digest("hex").slice(0, 16);
10761
- return path5.join(MEMORY_ROOT, `project-${key}.md`);
10760
+ const key = crypto2.createHash("sha1").update(path6.resolve(workDir)).digest("hex").slice(0, 16);
10761
+ return path6.join(MEMORY_ROOT, `project-${key}.md`);
10762
10762
  }
10763
10763
  exports.MEMORY_ENTRY_MAX_CHARS = 400;
10764
10764
  exports.MEMORY_MAX_BYTES = 12e3;
@@ -10784,14 +10784,14 @@ var require_memory = __commonJS({
10784
10784
  }
10785
10785
  function readMemoryFile(file) {
10786
10786
  try {
10787
- return fs8.readFileSync(file, "utf-8");
10787
+ return fs9.readFileSync(file, "utf-8");
10788
10788
  } catch {
10789
10789
  return "";
10790
10790
  }
10791
10791
  }
10792
10792
  function writeMemoryFile(file, content) {
10793
- fs8.mkdirSync(path5.dirname(file), { recursive: true });
10794
- fs8.writeFileSync(file, content, "utf-8");
10793
+ fs9.mkdirSync(path6.dirname(file), { recursive: true });
10794
+ fs9.writeFileSync(file, content, "utf-8");
10795
10795
  }
10796
10796
  function evictOldest(content, maxBytes) {
10797
10797
  if (Buffer.byteLength(content, "utf-8") <= maxBytes)
@@ -10837,7 +10837,7 @@ ${globalMem}`);
10837
10837
  if (workDir) {
10838
10838
  const projMem = readMemory2("project", workDir);
10839
10839
  if (projMem)
10840
- parts.push(`[Project memories \u2014 ${path5.basename(path5.resolve(workDir))}]
10840
+ parts.push(`[Project memories \u2014 ${path6.basename(path6.resolve(workDir))}]
10841
10841
  ${projMem}`);
10842
10842
  }
10843
10843
  return parts.join("\n\n");
@@ -10845,7 +10845,7 @@ ${projMem}`);
10845
10845
  function clearMemory2(scope, workDir) {
10846
10846
  const file = memoryFilePath(scope, workDir);
10847
10847
  try {
10848
- fs8.rmSync(file, { force: true });
10848
+ fs9.rmSync(file, { force: true });
10849
10849
  } catch {
10850
10850
  }
10851
10851
  }
@@ -10939,12 +10939,12 @@ var require_plugins = __commonJS({
10939
10939
  exports.pluginAssetDirs = pluginAssetDirs;
10940
10940
  exports.pluginHooks = pluginHooks;
10941
10941
  exports.pluginMcpServers = pluginMcpServers;
10942
- var fs8 = __importStar(__require("fs"));
10943
- var path5 = __importStar(__require("path"));
10942
+ var fs9 = __importStar(__require("fs"));
10943
+ var path6 = __importStar(__require("path"));
10944
10944
  var os6 = __importStar(__require("os"));
10945
10945
  function readMeta(dir) {
10946
10946
  try {
10947
- const raw = fs8.readFileSync(path5.join(dir, "plugin.json"), "utf-8");
10947
+ const raw = fs9.readFileSync(path6.join(dir, "plugin.json"), "utf-8");
10948
10948
  const j = JSON.parse(raw);
10949
10949
  return {
10950
10950
  name: typeof j.name === "string" ? j.name : void 0,
@@ -10958,16 +10958,16 @@ var require_plugins = __commonJS({
10958
10958
  function scanRoot(root, scope, into) {
10959
10959
  let entries;
10960
10960
  try {
10961
- entries = fs8.readdirSync(root, { withFileTypes: true });
10961
+ entries = fs9.readdirSync(root, { withFileTypes: true });
10962
10962
  } catch {
10963
10963
  return;
10964
10964
  }
10965
10965
  for (const entry of entries) {
10966
10966
  if (!entry.isDirectory() && !entry.isSymbolicLink())
10967
10967
  continue;
10968
- const dir = path5.join(root, entry.name);
10968
+ const dir = path6.join(root, entry.name);
10969
10969
  try {
10970
- if (!fs8.statSync(dir).isDirectory())
10970
+ if (!fs9.statSync(dir).isDirectory())
10971
10971
  continue;
10972
10972
  } catch {
10973
10973
  continue;
@@ -10981,14 +10981,14 @@ var require_plugins = __commonJS({
10981
10981
  }
10982
10982
  function loadPlugins3(workDir) {
10983
10983
  const out = /* @__PURE__ */ new Map();
10984
- scanRoot(path5.join(workDir, ".nexrall", "plugins"), "project", out);
10985
- scanRoot(path5.join(os6.homedir(), ".nexrall", "plugins"), "global", out);
10984
+ scanRoot(path6.join(workDir, ".nexrall", "plugins"), "project", out);
10985
+ scanRoot(path6.join(os6.homedir(), ".nexrall", "plugins"), "global", out);
10986
10986
  return [...out.values()];
10987
10987
  }
10988
10988
  function pluginAssetDirs(workDir, kind) {
10989
- return loadPlugins3(workDir).map((p) => path5.join(p.dir, kind)).filter((d) => {
10989
+ return loadPlugins3(workDir).map((p) => path6.join(p.dir, kind)).filter((d) => {
10990
10990
  try {
10991
- return fs8.statSync(d).isDirectory();
10991
+ return fs9.statSync(d).isDirectory();
10992
10992
  } catch {
10993
10993
  return false;
10994
10994
  }
@@ -10998,7 +10998,7 @@ var require_plugins = __commonJS({
10998
10998
  const merged = {};
10999
10999
  for (const p of loadPlugins3(workDir)) {
11000
11000
  try {
11001
- const raw = fs8.readFileSync(path5.join(p.dir, "hooks.json"), "utf-8");
11001
+ const raw = fs9.readFileSync(path6.join(p.dir, "hooks.json"), "utf-8");
11002
11002
  const j = JSON.parse(raw);
11003
11003
  const hooks = j.hooks ?? j;
11004
11004
  for (const [phase, entries] of Object.entries(hooks)) {
@@ -11015,7 +11015,7 @@ var require_plugins = __commonJS({
11015
11015
  const merged = {};
11016
11016
  for (const p of loadPlugins3(workDir)) {
11017
11017
  try {
11018
- const raw = fs8.readFileSync(path5.join(p.dir, "mcp.json"), "utf-8");
11018
+ const raw = fs9.readFileSync(path6.join(p.dir, "mcp.json"), "utf-8");
11019
11019
  const j = JSON.parse(raw);
11020
11020
  const servers = j.mcpServers ?? j;
11021
11021
  for (const [name, cfg] of Object.entries(servers)) {
@@ -11083,8 +11083,8 @@ var require_loader = __commonJS({
11083
11083
  exports.findSlashCommand = findSlashCommand;
11084
11084
  exports.expandBody = expandBody;
11085
11085
  exports.expandCommand = expandCommand;
11086
- var fs8 = __importStar(__require("fs"));
11087
- var path5 = __importStar(__require("path"));
11086
+ var fs9 = __importStar(__require("fs"));
11087
+ var path6 = __importStar(__require("path"));
11088
11088
  var os6 = __importStar(__require("os"));
11089
11089
  var child_process_1 = __require("child_process");
11090
11090
  var index_1 = require_plugins();
@@ -11137,15 +11137,15 @@ var require_loader = __commonJS({
11137
11137
  function loadDir(dir, source, into) {
11138
11138
  let files;
11139
11139
  try {
11140
- files = fs8.readdirSync(dir).filter((f3) => f3.endsWith(".md"));
11140
+ files = fs9.readdirSync(dir).filter((f3) => f3.endsWith(".md"));
11141
11141
  } catch {
11142
11142
  return;
11143
11143
  }
11144
11144
  for (const file of files) {
11145
11145
  try {
11146
- const raw = fs8.readFileSync(path5.join(dir, file), "utf-8");
11146
+ const raw = fs9.readFileSync(path6.join(dir, file), "utf-8");
11147
11147
  const { meta, body } = parseFrontmatter(raw);
11148
- const name = (meta.name || path5.basename(file, ".md")).trim().toLowerCase();
11148
+ const name = (meta.name || path6.basename(file, ".md")).trim().toLowerCase();
11149
11149
  if (!name)
11150
11150
  continue;
11151
11151
  if (source !== "project" && into.has(name))
@@ -11165,8 +11165,8 @@ var require_loader = __commonJS({
11165
11165
  }
11166
11166
  function loadSlashCommands(workDir) {
11167
11167
  const out = /* @__PURE__ */ new Map();
11168
- loadDir(path5.join(workDir, ".nexrall", "commands"), "project", out);
11169
- loadDir(path5.join(os6.homedir(), ".nexrall", "commands"), "global", out);
11168
+ loadDir(path6.join(workDir, ".nexrall", "commands"), "project", out);
11169
+ loadDir(path6.join(os6.homedir(), ".nexrall", "commands"), "global", out);
11170
11170
  for (const dir of (0, index_1.pluginAssetDirs)(workDir, "commands"))
11171
11171
  loadDir(dir, "plugin", out);
11172
11172
  for (const cmd of BUILTIN_COMMANDS) {
@@ -11192,9 +11192,9 @@ var require_loader = __commonJS({
11192
11192
  }
11193
11193
  });
11194
11194
  out = out.replace(/(^|\s)@([^\s]+)/g, (_m, lead, rel) => {
11195
- const abs = path5.isAbsolute(rel) ? rel : path5.join(workDir, rel);
11195
+ const abs = path6.isAbsolute(rel) ? rel : path6.join(workDir, rel);
11196
11196
  try {
11197
- const content = fs8.readFileSync(abs, "utf-8").slice(0, 12e3);
11197
+ const content = fs9.readFileSync(abs, "utf-8").slice(0, 12e3);
11198
11198
  return `${lead}
11199
11199
  [File: ${rel}]
11200
11200
  \`\`\`
@@ -11276,8 +11276,8 @@ var require_skills = __commonJS({
11276
11276
  exports.userInvokableSkills = userInvokableSkills2;
11277
11277
  exports.summariseSkills = summariseSkills;
11278
11278
  exports.expandSkill = expandSkill2;
11279
- var fs8 = __importStar(__require("fs"));
11280
- var path5 = __importStar(__require("path"));
11279
+ var fs9 = __importStar(__require("fs"));
11280
+ var path6 = __importStar(__require("path"));
11281
11281
  var os6 = __importStar(__require("os"));
11282
11282
  var index_1 = require_plugins();
11283
11283
  var loader_1 = require_loader();
@@ -11320,15 +11320,15 @@ var require_skills = __commonJS({
11320
11320
  function loadFlatCommandDir(dir, source, into) {
11321
11321
  let files;
11322
11322
  try {
11323
- files = fs8.readdirSync(dir).filter((f3) => f3.endsWith(".md"));
11323
+ files = fs9.readdirSync(dir).filter((f3) => f3.endsWith(".md"));
11324
11324
  } catch {
11325
11325
  return;
11326
11326
  }
11327
11327
  for (const file of files) {
11328
11328
  try {
11329
- const raw = fs8.readFileSync(path5.join(dir, file), "utf-8");
11329
+ const raw = fs9.readFileSync(path6.join(dir, file), "utf-8");
11330
11330
  const { meta, body } = parseFrontmatter(raw);
11331
- const name = (meta.name || path5.basename(file, ".md")).trim().toLowerCase();
11331
+ const name = (meta.name || path6.basename(file, ".md")).trim().toLowerCase();
11332
11332
  if (!name)
11333
11333
  continue;
11334
11334
  if (source !== "project" && into.has(name))
@@ -11341,23 +11341,23 @@ var require_skills = __commonJS({
11341
11341
  function loadSkillDir(root, source, into) {
11342
11342
  let entries;
11343
11343
  try {
11344
- entries = fs8.readdirSync(root, { withFileTypes: true });
11344
+ entries = fs9.readdirSync(root, { withFileTypes: true });
11345
11345
  } catch {
11346
11346
  return;
11347
11347
  }
11348
11348
  for (const entry of entries) {
11349
11349
  if (!entry.isDirectory() && !entry.isSymbolicLink())
11350
11350
  continue;
11351
- const skillDir = path5.join(root, entry.name);
11352
- const skillFile = path5.join(skillDir, "SKILL.md");
11351
+ const skillDir = path6.join(root, entry.name);
11352
+ const skillFile = path6.join(skillDir, "SKILL.md");
11353
11353
  try {
11354
- if (!fs8.statSync(skillFile).isFile())
11354
+ if (!fs9.statSync(skillFile).isFile())
11355
11355
  continue;
11356
11356
  } catch {
11357
11357
  continue;
11358
11358
  }
11359
11359
  try {
11360
- const raw = fs8.readFileSync(skillFile, "utf-8");
11360
+ const raw = fs9.readFileSync(skillFile, "utf-8");
11361
11361
  const { meta, body } = parseFrontmatter(raw);
11362
11362
  const name = (meta.name || entry.name).trim().toLowerCase();
11363
11363
  if (!name)
@@ -11407,10 +11407,10 @@ var require_skills = __commonJS({
11407
11407
  ];
11408
11408
  function loadSkills2(workDir) {
11409
11409
  const out = /* @__PURE__ */ new Map();
11410
- loadFlatCommandDir(path5.join(workDir, ".nexrall", "commands"), "project", out);
11411
- loadSkillDir(path5.join(workDir, ".nexrall", "skills"), "project", out);
11412
- loadFlatCommandDir(path5.join(os6.homedir(), ".nexrall", "commands"), "global", out);
11413
- loadSkillDir(path5.join(os6.homedir(), ".nexrall", "skills"), "global", out);
11410
+ loadFlatCommandDir(path6.join(workDir, ".nexrall", "commands"), "project", out);
11411
+ loadSkillDir(path6.join(workDir, ".nexrall", "skills"), "project", out);
11412
+ loadFlatCommandDir(path6.join(os6.homedir(), ".nexrall", "commands"), "global", out);
11413
+ loadSkillDir(path6.join(os6.homedir(), ".nexrall", "skills"), "global", out);
11414
11414
  for (const dir of (0, index_1.pluginAssetDirs)(workDir, "commands"))
11415
11415
  loadFlatCommandDir(dir, "plugin", out);
11416
11416
  for (const dir of (0, index_1.pluginAssetDirs)(workDir, "skills"))
@@ -11443,7 +11443,7 @@ var require_skills = __commonJS({
11443
11443
  return expanded;
11444
11444
  let siblings = [];
11445
11445
  try {
11446
- siblings = fs8.readdirSync(skill.dir).filter((f3) => f3 !== "SKILL.md");
11446
+ siblings = fs9.readdirSync(skill.dir).filter((f3) => f3 !== "SKILL.md");
11447
11447
  } catch {
11448
11448
  }
11449
11449
  if (!siblings.length)
@@ -11467,10 +11467,10 @@ var require_testIntegrity = __commonJS({
11467
11467
  exports.decodeTestIntegrityMarker = decodeTestIntegrityMarker;
11468
11468
  exports.stripTestIntegrityMarker = stripTestIntegrityMarker;
11469
11469
  var TEST_PATH_RE = /(?:^|[\/\\])(?:tests?|spec|__tests__|testing)[\/\\]|(?:\.|_|-)(?:test|spec|tests)\.[a-z]+$|(?:^|[\/\\])test_[^\/\\]+\.py$|(?:^|[\/\\])[^\/\\]+_test\.(?:go|py|rb)$|Test[^\/\\]*\.(?:java|kt|cs)$|(?:^|[\/\\])[^\/\\]*Tests?\.(?:java|kt|cs)$/i;
11470
- function isTestFile(path5) {
11471
- if (!path5 || typeof path5 !== "string")
11470
+ function isTestFile(path6) {
11471
+ if (!path6 || typeof path6 !== "string")
11472
11472
  return false;
11473
- return TEST_PATH_RE.test(path5);
11473
+ return TEST_PATH_RE.test(path6);
11474
11474
  }
11475
11475
  var ASSERTION_RES = [
11476
11476
  /\bexpect\s*\(/g,
@@ -11560,8 +11560,8 @@ var require_testIntegrity = __commonJS({
11560
11560
  }
11561
11561
  return n;
11562
11562
  }
11563
- function analyzeTestEdit(path5, oldText, newText) {
11564
- if (!isTestFile(path5)) {
11563
+ function analyzeTestEdit(path6, oldText, newText) {
11564
+ if (!isTestFile(path6)) {
11565
11565
  return { isTestFile: false, suspicious: false, findings: [] };
11566
11566
  }
11567
11567
  const findings = [];
@@ -11609,23 +11609,23 @@ var require_testIntegrity = __commonJS({
11609
11609
  function analyzeWriteToolForTestIntegrity(toolName, input) {
11610
11610
  if (!input)
11611
11611
  return null;
11612
- const path5 = typeof input.path === "string" ? input.path : typeof input.file_path === "string" ? input.file_path : "";
11613
- if (!isTestFile(path5))
11612
+ const path6 = typeof input.path === "string" ? input.path : typeof input.file_path === "string" ? input.file_path : "";
11613
+ if (!isTestFile(path6))
11614
11614
  return null;
11615
11615
  if (toolName === "edit_file") {
11616
11616
  const oldText = typeof input.old_string === "string" ? input.old_string : "";
11617
11617
  const newText = typeof input.new_string === "string" ? input.new_string : "";
11618
- return analyzeTestEdit(path5, oldText, newText);
11618
+ return analyzeTestEdit(path6, oldText, newText);
11619
11619
  }
11620
11620
  if (toolName === "multi_edit" && Array.isArray(input.edits)) {
11621
11621
  const edits = input.edits;
11622
11622
  const oldText = edits.map((e2) => typeof e2.old_string === "string" ? e2.old_string : "").join("\n");
11623
11623
  const newText = edits.map((e2) => typeof e2.new_string === "string" ? e2.new_string : "").join("\n");
11624
- return analyzeTestEdit(path5, oldText, newText);
11624
+ return analyzeTestEdit(path6, oldText, newText);
11625
11625
  }
11626
11626
  if (toolName === "write_file") {
11627
11627
  const content = typeof input.content === "string" ? input.content : "";
11628
- return analyzeTestEdit(path5, "", content);
11628
+ return analyzeTestEdit(path6, "", content);
11629
11629
  }
11630
11630
  return null;
11631
11631
  }
@@ -11685,19 +11685,19 @@ var require_crossFile = __commonJS({
11685
11685
  { kind: "def", re: /^def\s+([A-Za-z_][\w]*)/gm },
11686
11686
  { kind: "class", re: /^class\s+([A-Za-z_][\w]*)/gm }
11687
11687
  ];
11688
- function isJsLike(path5) {
11689
- return /\.(?:m?[jt]sx?|cjs|cts|mts)$/.test(path5);
11688
+ function isJsLike(path6) {
11689
+ return /\.(?:m?[jt]sx?|cjs|cts|mts)$/.test(path6);
11690
11690
  }
11691
- function isPy(path5) {
11692
- return /\.py$/.test(path5);
11691
+ function isPy(path6) {
11692
+ return /\.py$/.test(path6);
11693
11693
  }
11694
- function extractExportedSymbols(path5, content) {
11694
+ function extractExportedSymbols(path6, content) {
11695
11695
  const out = /* @__PURE__ */ new Map();
11696
11696
  const add = (name, kind) => {
11697
11697
  if (name && !out.has(name))
11698
11698
  out.set(name, kind);
11699
11699
  };
11700
- if (isJsLike(path5)) {
11700
+ if (isJsLike(path6)) {
11701
11701
  for (const { kind, re } of JS_EXPORT_RES) {
11702
11702
  re.lastIndex = 0;
11703
11703
  let m2;
@@ -11717,7 +11717,7 @@ var require_crossFile = __commonJS({
11717
11717
  add(name, "export");
11718
11718
  }
11719
11719
  }
11720
- } else if (isPy(path5)) {
11720
+ } else if (isPy(path6)) {
11721
11721
  for (const { kind, re } of PY_DEF_RES) {
11722
11722
  re.lastIndex = 0;
11723
11723
  let m2;
@@ -11727,11 +11727,11 @@ var require_crossFile = __commonJS({
11727
11727
  }
11728
11728
  return [...out.entries()].map(([name, kind]) => ({ name, kind }));
11729
11729
  }
11730
- function findRemovedExports(path5, oldContent, newContent) {
11731
- const before = extractExportedSymbols(path5, oldContent);
11730
+ function findRemovedExports(path6, oldContent, newContent) {
11731
+ const before = extractExportedSymbols(path6, oldContent);
11732
11732
  if (before.length === 0)
11733
11733
  return [];
11734
- const afterNames = new Set(extractExportedSymbols(path5, newContent).map((s2) => s2.name));
11734
+ const afterNames = new Set(extractExportedSymbols(path6, newContent).map((s2) => s2.name));
11735
11735
  return before.filter((s2) => !afterNames.has(s2.name));
11736
11736
  }
11737
11737
  var NOISY_NAMES = /* @__PURE__ */ new Set(["default", "index", "main", "test", "get", "set", "run", "app", "data", "item", "value"]);
@@ -11798,8 +11798,8 @@ var require_symbols = __commonJS({
11798
11798
  exports.extractSymbols = extractSymbols;
11799
11799
  exports.getSymbols = getSymbols;
11800
11800
  exports.getWorkspaceSymbols = getWorkspaceSymbols;
11801
- var fs8 = __importStar(__require("fs"));
11802
- var path5 = __importStar(__require("path"));
11801
+ var fs9 = __importStar(__require("fs"));
11802
+ var path6 = __importStar(__require("path"));
11803
11803
  var LANGS = [
11804
11804
  {
11805
11805
  exts: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"],
@@ -11899,7 +11899,7 @@ var require_symbols = __commonJS({
11899
11899
  }
11900
11900
  var MAX_FILE_BYTES = 1024 * 1024;
11901
11901
  function extractSymbols(filePath, source) {
11902
- const lang = EXT_TO_LANG.get(path5.extname(filePath).toLowerCase());
11902
+ const lang = EXT_TO_LANG.get(path6.extname(filePath).toLowerCase());
11903
11903
  if (!lang)
11904
11904
  return [];
11905
11905
  const hits = [];
@@ -11933,7 +11933,7 @@ var require_symbols = __commonJS({
11933
11933
  }
11934
11934
  function resolveIn(workDir, p) {
11935
11935
  const base = workDir ?? process.cwd();
11936
- return path5.isAbsolute(p) ? p : path5.resolve(base, p);
11936
+ return path6.isAbsolute(p) ? p : path6.resolve(base, p);
11937
11937
  }
11938
11938
  async function getSymbols(input, workDir) {
11939
11939
  const rel = typeof input.path === "string" ? input.path : "";
@@ -11942,17 +11942,17 @@ var require_symbols = __commonJS({
11942
11942
  const abs = resolveIn(workDir, rel);
11943
11943
  let source;
11944
11944
  try {
11945
- const st = fs8.statSync(abs);
11945
+ const st = fs9.statSync(abs);
11946
11946
  if (!st.isFile())
11947
11947
  return { error: `Not a file: ${rel}` };
11948
11948
  if (st.size > MAX_FILE_BYTES)
11949
11949
  return { error: `File too large for symbol scan (${Math.round(st.size / 1024)} KB > 1024 KB)` };
11950
- source = fs8.readFileSync(abs, "utf-8");
11950
+ source = fs9.readFileSync(abs, "utf-8");
11951
11951
  } catch (err) {
11952
11952
  return { error: `Cannot read ${rel}: ${err.message}` };
11953
11953
  }
11954
- if (!EXT_TO_LANG.has(path5.extname(abs).toLowerCase())) {
11955
- return { output: `No symbol support for ${path5.extname(abs) || "this file type"} (regex-based scanner). Use search_files instead.` };
11954
+ if (!EXT_TO_LANG.has(path6.extname(abs).toLowerCase())) {
11955
+ return { output: `No symbol support for ${path6.extname(abs) || "this file type"} (regex-based scanner). Use search_files instead.` };
11956
11956
  }
11957
11957
  const hits = extractSymbols(abs, source);
11958
11958
  if (!hits.length)
@@ -11978,30 +11978,30 @@ ${lines.join("\n")}` };
11978
11978
  return;
11979
11979
  let entries;
11980
11980
  try {
11981
- entries = fs8.readdirSync(dir, { withFileTypes: true });
11981
+ entries = fs9.readdirSync(dir, { withFileTypes: true });
11982
11982
  } catch {
11983
11983
  return;
11984
11984
  }
11985
11985
  for (const entry of entries) {
11986
11986
  if (results.length >= MAX_RESULTS || scanned >= MAX_FILES_SCANNED)
11987
11987
  return;
11988
- const full = path5.join(dir, entry.name);
11988
+ const full = path6.join(dir, entry.name);
11989
11989
  if (entry.isDirectory()) {
11990
11990
  if (SKIP_DIRS.has(entry.name) || entry.name.startsWith("."))
11991
11991
  continue;
11992
11992
  walk(full);
11993
- } else if (entry.isFile() && exts.has(path5.extname(entry.name).toLowerCase())) {
11993
+ } else if (entry.isFile() && exts.has(path6.extname(entry.name).toLowerCase())) {
11994
11994
  scanned++;
11995
11995
  try {
11996
- const st = fs8.statSync(full);
11996
+ const st = fs9.statSync(full);
11997
11997
  if (st.size > MAX_FILE_BYTES)
11998
11998
  continue;
11999
- const source = fs8.readFileSync(full, "utf-8");
11999
+ const source = fs9.readFileSync(full, "utf-8");
12000
12000
  if (!source.toLowerCase().includes(q))
12001
12001
  continue;
12002
12002
  for (const h2 of extractSymbols(full, source)) {
12003
12003
  if (h2.name.toLowerCase().includes(q)) {
12004
- results.push({ ...h2, file: path5.relative(root, full) });
12004
+ results.push({ ...h2, file: path6.relative(root, full) });
12005
12005
  if (results.length >= MAX_RESULTS)
12006
12006
  break;
12007
12007
  }
@@ -12083,12 +12083,12 @@ var require_tsLangService = __commonJS({
12083
12083
  exports.tsGetHover = tsGetHover;
12084
12084
  exports.tsServiceAvailable = tsServiceAvailable;
12085
12085
  exports._resetTsServiceCache = _resetTsServiceCache;
12086
- var path5 = __importStar(__require("path"));
12087
- var fs8 = __importStar(__require("fs"));
12086
+ var path6 = __importStar(__require("path"));
12087
+ var fs9 = __importStar(__require("fs"));
12088
12088
  var module_1 = __require("module");
12089
12089
  var TS_EXTS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"]);
12090
12090
  function isTsLike(filePath) {
12091
- return TS_EXTS.has(path5.extname(filePath).toLowerCase());
12091
+ return TS_EXTS.has(path6.extname(filePath).toLowerCase());
12092
12092
  }
12093
12093
  var _tsResolveTried = false;
12094
12094
  var _ts = null;
@@ -12098,7 +12098,7 @@ var require_tsLangService = __commonJS({
12098
12098
  _tsResolveTried = true;
12099
12099
  const candidates = [];
12100
12100
  try {
12101
- const req = (0, module_1.createRequire)(path5.join(workDir, "package.json"));
12101
+ const req = (0, module_1.createRequire)(path6.join(workDir, "package.json"));
12102
12102
  candidates.push(req.resolve("typescript"));
12103
12103
  } catch {
12104
12104
  }
@@ -12132,7 +12132,7 @@ var require_tsLangService = __commonJS({
12132
12132
  if (cachedSrc !== void 0)
12133
12133
  return cachedSrc;
12134
12134
  try {
12135
- const src = fs8.readFileSync(fileName, "utf-8");
12135
+ const src = fs9.readFileSync(fileName, "utf-8");
12136
12136
  snapshots.set(fileName, src);
12137
12137
  return src;
12138
12138
  } catch {
@@ -12144,7 +12144,7 @@ var require_tsLangService = __commonJS({
12144
12144
  const cfgPath = ts.findConfigFile(workDir, ts.sys.fileExists, "tsconfig.json");
12145
12145
  if (cfgPath) {
12146
12146
  const parsed = ts.readConfigFile(cfgPath, ts.sys.readFile);
12147
- const conf = ts.parseJsonConfigFileContent(parsed.config ?? {}, ts.sys, path5.dirname(cfgPath));
12147
+ const conf = ts.parseJsonConfigFileContent(parsed.config ?? {}, ts.sys, path6.dirname(cfgPath));
12148
12148
  if (conf.options)
12149
12149
  options = { ...conf.options, allowJs: true };
12150
12150
  }
@@ -12173,7 +12173,7 @@ var require_tsLangService = __commonJS({
12173
12173
  }
12174
12174
  function ensureFile(svc, absPath) {
12175
12175
  try {
12176
- const src = fs8.readFileSync(absPath, "utf-8");
12176
+ const src = fs9.readFileSync(absPath, "utf-8");
12177
12177
  const prev = svc.snapshots.get(absPath);
12178
12178
  if (prev !== src) {
12179
12179
  svc.snapshots.set(absPath, src);
@@ -12205,7 +12205,7 @@ var require_tsLangService = __commonJS({
12205
12205
  return { line, character: offset - last + 1 };
12206
12206
  }
12207
12207
  function relOf(root, abs) {
12208
- const r2 = path5.relative(root, abs);
12208
+ const r2 = path6.relative(root, abs);
12209
12209
  return r2.startsWith("..") ? abs : r2;
12210
12210
  }
12211
12211
  function tsGoToDefinition(deps) {
@@ -12225,7 +12225,7 @@ var require_tsLangService = __commonJS({
12225
12225
  if (!defs || defs.length === 0)
12226
12226
  return { output: "No definition found at that position." };
12227
12227
  const out = defs.map((d) => {
12228
- const src = svc.snapshots.get(d.fileName) ?? (fs8.existsSync(d.fileName) ? fs8.readFileSync(d.fileName, "utf-8") : "");
12228
+ const src = svc.snapshots.get(d.fileName) ?? (fs9.existsSync(d.fileName) ? fs9.readFileSync(d.fileName, "utf-8") : "");
12229
12229
  const pos = offsetToPos(src, d.textSpan.start);
12230
12230
  return `${relOf(svc.root, d.fileName)}:${pos.line}:${pos.character} ${d.kind ?? ""} ${d.name ?? ""}`.trimEnd();
12231
12231
  });
@@ -12252,7 +12252,7 @@ ${out.join("\n")}` };
12252
12252
  for (const r2 of refs) {
12253
12253
  if (r2.isDefinition && deps.includeDeclaration === false)
12254
12254
  continue;
12255
- const src = svc.snapshots.get(r2.fileName) ?? (fs8.existsSync(r2.fileName) ? fs8.readFileSync(r2.fileName, "utf-8") : "");
12255
+ const src = svc.snapshots.get(r2.fileName) ?? (fs9.existsSync(r2.fileName) ? fs9.readFileSync(r2.fileName, "utf-8") : "");
12256
12256
  const pos = offsetToPos(src, r2.textSpan.start);
12257
12257
  const lineText = (src.split("\n")[pos.line - 1] ?? "").trim().slice(0, 120);
12258
12258
  lines.push(`${relOf(svc.root, r2.fileName)}:${pos.line}:${pos.character}${r2.isDefinition ? " [def]" : ""} ${lineText}`);
@@ -12344,8 +12344,8 @@ var require_executor = __commonJS({
12344
12344
  }();
12345
12345
  Object.defineProperty(exports, "__esModule", { value: true });
12346
12346
  exports.executeTool = executeTool;
12347
- var fs8 = __importStar(__require("fs"));
12348
- var path5 = __importStar(__require("path"));
12347
+ var fs9 = __importStar(__require("fs"));
12348
+ var path6 = __importStar(__require("path"));
12349
12349
  var os6 = __importStar(__require("os"));
12350
12350
  var https3 = __importStar(__require("https"));
12351
12351
  var http3 = __importStar(__require("http"));
@@ -12370,7 +12370,7 @@ var require_executor = __commonJS({
12370
12370
  var READ_CHARS_PER_TOKEN = 4;
12371
12371
  var MAX_READ_CHARS = MAX_READ_TOKENS * READ_CHARS_PER_TOKEN;
12372
12372
  var MAX_SPILL_BYTES = 20 * 1024 * 1024;
12373
- var SPILL_DIR = path5.join(os6.tmpdir(), "nexrall-code", "bash-output");
12373
+ var SPILL_DIR = path6.join(os6.tmpdir(), "nexrall-code", "bash-output");
12374
12374
  var BLOCKED_REGEXES = [
12375
12375
  // Filesystem destruction — match rm/chmod with any whitespace between flags.
12376
12376
  // Only root itself and BARE top-level system dirs are blocked; ordinary
@@ -12430,9 +12430,9 @@ var require_executor = __commonJS({
12430
12430
  }
12431
12431
  function resolvePath(inputPath, workDir) {
12432
12432
  const base = workDir ?? process.cwd();
12433
- const resolved = path5.isAbsolute(inputPath) ? inputPath : path5.resolve(base, inputPath);
12434
- if (!path5.isAbsolute(inputPath)) {
12435
- const rel = path5.relative(base, resolved);
12433
+ const resolved = path6.isAbsolute(inputPath) ? inputPath : path6.resolve(base, inputPath);
12434
+ if (!path6.isAbsolute(inputPath)) {
12435
+ const rel = path6.relative(base, resolved);
12436
12436
  if (rel.startsWith("..")) {
12437
12437
  throw new Error(`Path traversal denied: "${inputPath}" escapes the workspace root.`);
12438
12438
  }
@@ -12443,9 +12443,9 @@ var require_executor = __commonJS({
12443
12443
  try {
12444
12444
  const SAMPLE = 8192;
12445
12445
  const buf = Buffer.alloc(SAMPLE);
12446
- const fd = fs8.openSync(filePath, "r");
12447
- const bytesRead = fs8.readSync(fd, buf, 0, SAMPLE, 0);
12448
- fs8.closeSync(fd);
12446
+ const fd = fs9.openSync(filePath, "r");
12447
+ const bytesRead = fs9.readSync(fd, buf, 0, SAMPLE, 0);
12448
+ fs9.closeSync(fd);
12449
12449
  if (bytesRead === 0)
12450
12450
  return false;
12451
12451
  let nonText = 0;
@@ -12478,7 +12478,7 @@ var require_executor = __commonJS({
12478
12478
  let stopped = false;
12479
12479
  let hitTokenCap = false;
12480
12480
  let sawEof = false;
12481
- const stream = fs8.createReadStream(resolved, { encoding: "utf-8", highWaterMark: 256 * 1024 });
12481
+ const stream = fs9.createReadStream(resolved, { encoding: "utf-8", highWaterMark: 256 * 1024 });
12482
12482
  const tryPushLine = (line) => {
12483
12483
  const formatted = formatNumberedLine(offset, kept.length, line);
12484
12484
  const added = formatted.length + 1;
@@ -12556,9 +12556,9 @@ ${numbered}` });
12556
12556
  return { error: "Missing required parameter: path" };
12557
12557
  try {
12558
12558
  const resolved = resolvePath(filePath, workDir);
12559
- fs8.statSync(resolved);
12559
+ fs9.statSync(resolved);
12560
12560
  if (isBinaryFile(resolved)) {
12561
- const ext = path5.extname(resolved).toLowerCase();
12561
+ const ext = path6.extname(resolved).toLowerCase();
12562
12562
  return { error: `Cannot read binary file: ${resolved} (${ext || "no extension"}). Use a text-based tool or convert it first.` };
12563
12563
  }
12564
12564
  return await readFileWindowed(resolved, offset, limit);
@@ -12575,9 +12575,9 @@ ${numbered}` });
12575
12575
  return { error: "Missing required parameter: content (must be a string)" };
12576
12576
  try {
12577
12577
  const resolved = resolvePath(filePath, workDir);
12578
- const dir = path5.dirname(resolved);
12579
- fs8.mkdirSync(dir, { recursive: true });
12580
- const isNew = !fs8.existsSync(resolved);
12578
+ const dir = path6.dirname(resolved);
12579
+ fs9.mkdirSync(dir, { recursive: true });
12580
+ const isNew = !fs9.existsSync(resolved);
12581
12581
  if (!isNew && content === "") {
12582
12582
  return { error: `Refusing to overwrite ${resolved} with empty content. Provide the full file content or use edit_file for targeted changes.` };
12583
12583
  }
@@ -12598,18 +12598,18 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
12598
12598
  let priorContent = "";
12599
12599
  if (!isNew) {
12600
12600
  try {
12601
- existingMode = fs8.statSync(resolved).mode;
12601
+ existingMode = fs9.statSync(resolved).mode;
12602
12602
  } catch {
12603
12603
  }
12604
12604
  try {
12605
- priorContent = fs8.readFileSync(resolved, "utf-8");
12605
+ priorContent = fs9.readFileSync(resolved, "utf-8");
12606
12606
  } catch {
12607
12607
  }
12608
12608
  }
12609
- fs8.writeFileSync(resolved, content, "utf-8");
12609
+ fs9.writeFileSync(resolved, content, "utf-8");
12610
12610
  if (existingMode !== void 0) {
12611
12611
  try {
12612
- fs8.chmodSync(resolved, existingMode);
12612
+ fs9.chmodSync(resolved, existingMode);
12613
12613
  } catch {
12614
12614
  }
12615
12615
  }
@@ -12634,14 +12634,14 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
12634
12634
  const resolved = resolvePath(dirPath, workDir);
12635
12635
  let stat2;
12636
12636
  try {
12637
- stat2 = fs8.statSync(resolved);
12637
+ stat2 = fs9.statSync(resolved);
12638
12638
  } catch {
12639
12639
  return { error: `Path not found: ${resolved}.` };
12640
12640
  }
12641
12641
  if (!stat2.isDirectory()) {
12642
12642
  return { error: `Path is a file, not a directory: ${resolved}. Use read_file to view its contents.` };
12643
12643
  }
12644
- const entries = fs8.readdirSync(resolved, { withFileTypes: true });
12644
+ const entries = fs9.readdirSync(resolved, { withFileTypes: true });
12645
12645
  const dirs = entries.filter((e2) => e2.isDirectory()).sort((a, b) => a.name.localeCompare(b.name));
12646
12646
  const files = entries.filter((e2) => !e2.isDirectory()).sort((a, b) => a.name.localeCompare(b.name));
12647
12647
  const lines = [`[Directory: ${resolved}]`];
@@ -12650,7 +12650,7 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
12650
12650
  }
12651
12651
  for (const f3 of files) {
12652
12652
  try {
12653
- const stat3 = fs8.statSync(path5.join(resolved, f3.name));
12653
+ const stat3 = fs9.statSync(path6.join(resolved, f3.name));
12654
12654
  const size = formatBytes(stat3.size);
12655
12655
  lines.push(`\u{1F4C4} ${f3.name} (${size})`);
12656
12656
  } catch {
@@ -12697,10 +12697,10 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
12697
12697
  if (shell.spillPath || shell.output.length + chunk.length > MAX_OUTPUT_CHARS) {
12698
12698
  if (!shell.spillPath && !shell.spillFull) {
12699
12699
  try {
12700
- fs8.mkdirSync(SPILL_DIR, { recursive: true });
12701
- shell.spillPath = path5.join(SPILL_DIR, `${id}-${Date.now()}.log`);
12702
- shell.spillFd = fs8.openSync(shell.spillPath, "w");
12703
- fs8.writeSync(shell.spillFd, shell.output);
12700
+ fs9.mkdirSync(SPILL_DIR, { recursive: true });
12701
+ shell.spillPath = path6.join(SPILL_DIR, `${id}-${Date.now()}.log`);
12702
+ shell.spillFd = fs9.openSync(shell.spillPath, "w");
12703
+ fs9.writeSync(shell.spillFd, shell.output);
12704
12704
  } catch {
12705
12705
  shell.spillPath = null;
12706
12706
  shell.spillFd = null;
@@ -12713,7 +12713,7 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
12713
12713
  shell.spillFull = true;
12714
12714
  } else {
12715
12715
  try {
12716
- fs8.writeSync(shell.spillFd, room >= buf.length ? buf : buf.subarray(0, room));
12716
+ fs9.writeSync(shell.spillFd, room >= buf.length ? buf : buf.subarray(0, room));
12717
12717
  shell.spillBytes += Math.min(room, buf.length);
12718
12718
  if (buf.length > room)
12719
12719
  shell.spillFull = true;
@@ -12737,7 +12737,7 @@ Resolve the conflict (remove <<<<<<< / ======= / >>>>>>> markers and keep the in
12737
12737
  shell.exitCode = code;
12738
12738
  if (shell.spillFd !== null) {
12739
12739
  try {
12740
- fs8.closeSync(shell.spillFd);
12740
+ fs9.closeSync(shell.spillFd);
12741
12741
  } catch {
12742
12742
  }
12743
12743
  shell.spillFd = null;
@@ -12869,9 +12869,9 @@ ${r2.output}`;
12869
12869
  if (spillPath || spillFull)
12870
12870
  return;
12871
12871
  try {
12872
- fs8.mkdirSync(SPILL_DIR, { recursive: true });
12873
- spillPath = path5.join(SPILL_DIR, `bash-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.log`);
12874
- spillFd = fs8.openSync(spillPath, "w");
12872
+ fs9.mkdirSync(SPILL_DIR, { recursive: true });
12873
+ spillPath = path6.join(SPILL_DIR, `bash-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.log`);
12874
+ spillFd = fs9.openSync(spillPath, "w");
12875
12875
  } catch {
12876
12876
  spillPath = null;
12877
12877
  spillFd = null;
@@ -12887,7 +12887,7 @@ ${r2.output}`;
12887
12887
  return;
12888
12888
  }
12889
12889
  try {
12890
- fs8.writeSync(spillFd, room >= buf.length ? buf : buf.subarray(0, room));
12890
+ fs9.writeSync(spillFd, room >= buf.length ? buf : buf.subarray(0, room));
12891
12891
  spillBytes += Math.min(room, buf.length);
12892
12892
  if (buf.length > room)
12893
12893
  spillFull = true;
@@ -12897,7 +12897,7 @@ ${r2.output}`;
12897
12897
  const closeSpill = () => {
12898
12898
  if (spillFd !== null) {
12899
12899
  try {
12900
- fs8.closeSync(spillFd);
12900
+ fs9.closeSync(spillFd);
12901
12901
  } catch {
12902
12902
  }
12903
12903
  spillFd = null;
@@ -13024,7 +13024,7 @@ ${body}` : void 0 }));
13024
13024
  return "";
13025
13025
  const editedReal = (() => {
13026
13026
  try {
13027
- return fs8.realpathSync(editedAbsPath);
13027
+ return fs9.realpathSync(editedAbsPath);
13028
13028
  } catch {
13029
13029
  return editedAbsPath;
13030
13030
  }
@@ -13092,15 +13092,15 @@ Update these call-sites (or restore the symbol), then run a build/typecheck to c
13092
13092
  }
13093
13093
  const rel = [];
13094
13094
  for (const f3 of files) {
13095
- const abs = path5.isAbsolute(f3) ? f3 : path5.join(workDir, f3);
13095
+ const abs = path6.isAbsolute(f3) ? f3 : path6.join(workDir, f3);
13096
13096
  let real = abs;
13097
13097
  try {
13098
- real = fs8.realpathSync(abs);
13098
+ real = fs9.realpathSync(abs);
13099
13099
  } catch {
13100
13100
  }
13101
13101
  if (real === excludeRealPath)
13102
13102
  continue;
13103
- rel.push(path5.relative(workDir, abs) || f3);
13103
+ rel.push(path6.relative(workDir, abs) || f3);
13104
13104
  }
13105
13105
  return rel;
13106
13106
  }
@@ -13119,9 +13119,9 @@ Update these call-sites (or restore the symbol), then run a build/typecheck to c
13119
13119
  const matches = [];
13120
13120
  const patternLower = pattern.toLowerCase();
13121
13121
  walkDir(resolved, (filePath) => {
13122
- const name = path5.basename(filePath);
13122
+ const name = path6.basename(filePath);
13123
13123
  const nameLower = name.toLowerCase();
13124
- const rel = path5.relative(resolved, filePath).replace(/\\/g, "/");
13124
+ const rel = path6.relative(resolved, filePath).replace(/\\/g, "/");
13125
13125
  const relLower = rel.toLowerCase();
13126
13126
  if (nameLower.includes(patternLower) || matchesGlob(name, pattern) || matchesPattern(name, pattern) || relLower.includes(patternLower) || matchesGlob(rel, pattern) || matchesPattern(rel, pattern)) {
13127
13127
  matches.push(filePath);
@@ -13227,16 +13227,16 @@ ${globalCapMatches(output)}` : "";
13227
13227
  }
13228
13228
  function walkDir(dirPath, callback, _visited = /* @__PURE__ */ new Set()) {
13229
13229
  try {
13230
- const real = fs8.realpathSync(dirPath);
13230
+ const real = fs9.realpathSync(dirPath);
13231
13231
  if (_visited.has(real))
13232
13232
  return;
13233
13233
  _visited.add(real);
13234
- const entries = fs8.readdirSync(dirPath, { withFileTypes: true });
13234
+ const entries = fs9.readdirSync(dirPath, { withFileTypes: true });
13235
13235
  for (const entry of entries) {
13236
- const fullPath = path5.join(dirPath, entry.name);
13236
+ const fullPath = path6.join(dirPath, entry.name);
13237
13237
  const isDir = entry.isDirectory() || entry.isSymbolicLink() && (() => {
13238
13238
  try {
13239
- return fs8.statSync(fullPath).isDirectory();
13239
+ return fs9.statSync(fullPath).isDirectory();
13240
13240
  } catch {
13241
13241
  return false;
13242
13242
  }
@@ -13259,7 +13259,7 @@ ${globalCapMatches(output)}` : "";
13259
13259
  }
13260
13260
  try {
13261
13261
  const resolved = resolvePath(dirPath, workDir);
13262
- fs8.mkdirSync(resolved, { recursive: true });
13262
+ fs9.mkdirSync(resolved, { recursive: true });
13263
13263
  return { output: `Directory created: ${resolved}` };
13264
13264
  } catch (err) {
13265
13265
  return { error: err.message };
@@ -13275,13 +13275,13 @@ ${globalCapMatches(output)}` : "";
13275
13275
  try {
13276
13276
  const resolvedSource = resolvePath(source, workDir);
13277
13277
  const resolvedDest = resolvePath(dest, workDir);
13278
- fs8.mkdirSync(path5.dirname(resolvedDest), { recursive: true });
13278
+ fs9.mkdirSync(path6.dirname(resolvedDest), { recursive: true });
13279
13279
  try {
13280
- fs8.renameSync(resolvedSource, resolvedDest);
13280
+ fs9.renameSync(resolvedSource, resolvedDest);
13281
13281
  } catch (e2) {
13282
13282
  if (e2.code === "EXDEV") {
13283
- fs8.copyFileSync(resolvedSource, resolvedDest);
13284
- fs8.unlinkSync(resolvedSource);
13283
+ fs9.copyFileSync(resolvedSource, resolvedDest);
13284
+ fs9.unlinkSync(resolvedSource);
13285
13285
  } else {
13286
13286
  throw e2;
13287
13287
  }
@@ -13312,7 +13312,7 @@ ${globalCapMatches(output)}` : "";
13312
13312
  function preflightEdit(resolved) {
13313
13313
  let stat2;
13314
13314
  try {
13315
- stat2 = fs8.statSync(resolved);
13315
+ stat2 = fs9.statSync(resolved);
13316
13316
  } catch {
13317
13317
  return { error: `File not found: ${resolved}. Read the file first to verify the path.` };
13318
13318
  }
@@ -13324,16 +13324,16 @@ ${globalCapMatches(output)}` : "";
13324
13324
  if (isBinaryFile(resolved)) {
13325
13325
  return { error: `Refusing to edit binary file ${resolved} \u2014 a text replace would corrupt it.` };
13326
13326
  }
13327
- return { mode: stat2.mode, content: fs8.readFileSync(resolved, "utf-8") };
13327
+ return { mode: stat2.mode, content: fs9.readFileSync(resolved, "utf-8") };
13328
13328
  }
13329
13329
  function atomicWritePreservingMode(resolved, data, mode) {
13330
13330
  const tmp = resolved + ".nexrall_tmp";
13331
- fs8.writeFileSync(tmp, data, "utf-8");
13331
+ fs9.writeFileSync(tmp, data, "utf-8");
13332
13332
  try {
13333
- fs8.chmodSync(tmp, mode);
13333
+ fs9.chmodSync(tmp, mode);
13334
13334
  } catch {
13335
13335
  }
13336
- fs8.renameSync(tmp, resolved);
13336
+ fs9.renameSync(tmp, resolved);
13337
13337
  }
13338
13338
  function normalizeLF(s2) {
13339
13339
  return s2.replace(/\r\n/g, "\n");
@@ -13388,11 +13388,11 @@ ${diff3}${xfile}` };
13388
13388
  try {
13389
13389
  const resolvedSrc = resolvePath(source, workDir);
13390
13390
  const resolvedDest = resolvePath(destination, workDir);
13391
- if (fs8.existsSync(resolvedDest) && fs8.statSync(resolvedDest).isDirectory()) {
13391
+ if (fs9.existsSync(resolvedDest) && fs9.statSync(resolvedDest).isDirectory()) {
13392
13392
  return { error: `Destination is a directory: ${resolvedDest}. Provide a full file path including the filename.` };
13393
13393
  }
13394
- fs8.mkdirSync(path5.dirname(resolvedDest), { recursive: true });
13395
- fs8.copyFileSync(resolvedSrc, resolvedDest);
13394
+ fs9.mkdirSync(path6.dirname(resolvedDest), { recursive: true });
13395
+ fs9.copyFileSync(resolvedSrc, resolvedDest);
13396
13396
  return { output: `Copied: ${resolvedSrc} \u2192 ${resolvedDest}` };
13397
13397
  } catch (err) {
13398
13398
  return { error: err.message };
@@ -13405,11 +13405,11 @@ ${diff3}${xfile}` };
13405
13405
  }
13406
13406
  try {
13407
13407
  const resolved = resolvePath(filePath, workDir);
13408
- const stat2 = fs8.statSync(resolved);
13408
+ const stat2 = fs9.statSync(resolved);
13409
13409
  if (stat2.isDirectory()) {
13410
13410
  return { error: `Path is a directory, not a file: ${resolved}. Use a recursive delete tool or remove contents first.` };
13411
13411
  }
13412
- fs8.unlinkSync(resolved);
13412
+ fs9.unlinkSync(resolved);
13413
13413
  return { output: `Deleted: ${resolved}` };
13414
13414
  } catch (err) {
13415
13415
  return { error: err.message };
@@ -13685,9 +13685,9 @@ ${d}`).join("\n") + xfile
13685
13685
  };
13686
13686
  const regex2 = toRegex(pattern);
13687
13687
  walkDir(resolved, (filePath) => {
13688
- const rel = path5.relative(resolved, filePath).replace(/\\/g, "/");
13688
+ const rel = path6.relative(resolved, filePath).replace(/\\/g, "/");
13689
13689
  const useBasename = !pattern.includes("/") && !pattern.includes("**");
13690
- if (regex2.test(rel) || useBasename && regex2.test(path5.basename(filePath))) {
13690
+ if (regex2.test(rel) || useBasename && regex2.test(path6.basename(filePath))) {
13691
13691
  matches.push(filePath);
13692
13692
  }
13693
13693
  });
@@ -13787,11 +13787,11 @@ ${lines.join("\n")}`;
13787
13787
  return { error: "File must be a Jupyter notebook (.ipynb)" };
13788
13788
  try {
13789
13789
  const resolved = resolvePath(filePath, workDir);
13790
- const stat2 = fs8.statSync(resolved);
13790
+ const stat2 = fs9.statSync(resolved);
13791
13791
  if (stat2.size > MAX_READ_BYTES) {
13792
13792
  return { error: `Notebook too large (${(stat2.size / 1024).toFixed(0)} KB). Max: ${MAX_READ_BYTES / 1024} KB.` };
13793
13793
  }
13794
- const nb = JSON.parse(fs8.readFileSync(resolved, "utf-8"));
13794
+ const nb = JSON.parse(fs9.readFileSync(resolved, "utf-8"));
13795
13795
  if (!Array.isArray(nb.cells))
13796
13796
  return { error: "Invalid notebook: missing cells array." };
13797
13797
  const lines = [`[Notebook: ${resolved} \u2014 ${nb.cells.length} cells, nbformat ${nb.nbformat}]`];
@@ -13840,11 +13840,11 @@ ${lines.join("\n")}`;
13840
13840
  }
13841
13841
  try {
13842
13842
  const resolved = resolvePath(filePath, workDir);
13843
- const nb = JSON.parse(fs8.readFileSync(resolved, "utf-8"));
13843
+ const nb = JSON.parse(fs9.readFileSync(resolved, "utf-8"));
13844
13844
  if (!Array.isArray(nb.cells))
13845
13845
  return { error: "Invalid notebook: missing cells array." };
13846
13846
  const n = nb.cells.length;
13847
- const save = () => fs8.writeFileSync(resolved, JSON.stringify(nb, null, 1) + "\n", "utf-8");
13847
+ const save = () => fs9.writeFileSync(resolved, JSON.stringify(nb, null, 1) + "\n", "utf-8");
13848
13848
  if (editType === "replace") {
13849
13849
  if (cellIndex < 0 || cellIndex >= n)
13850
13850
  return { error: `cell_index ${cellIndex} out of range (0\u2013${n - 1})` };
@@ -13956,14 +13956,14 @@ ${lines.join("\n")}`;
13956
13956
  }
13957
13957
  const destPath = resolvePath(relPath, workDir);
13958
13958
  try {
13959
- fs8.mkdirSync(path5.dirname(destPath), { recursive: true });
13959
+ fs9.mkdirSync(path6.dirname(destPath), { recursive: true });
13960
13960
  } catch (_) {
13961
13961
  }
13962
13962
  try {
13963
13963
  const dl = await _httpsGet(imageUrl, { "User-Agent": FETCH_USER_AGENT }, 6e4);
13964
13964
  if (dl.status !== 200)
13965
13965
  return { error: `Failed to download generated image (HTTP ${dl.status}).` };
13966
- fs8.writeFileSync(destPath, dl.body);
13966
+ fs9.writeFileSync(destPath, dl.body);
13967
13967
  const kb = (dl.body.length / 1024).toFixed(1);
13968
13968
  const costNote = cost != null ? ` ($${cost.toFixed(2)} charged` + (balance != null ? `, balance $${balance.toFixed(2)})` : ")") : "";
13969
13969
  return { output: `Generated and saved image to ${destPath} (${kb} KB)${costNote}.` };
@@ -14008,14 +14008,14 @@ ${lines.join("\n")}`;
14008
14008
  return { error: "No usable photo URL returned from Unsplash." };
14009
14009
  const destPath = resolvePath(relPath, workDir);
14010
14010
  try {
14011
- fs8.mkdirSync(path5.dirname(destPath), { recursive: true });
14011
+ fs9.mkdirSync(path6.dirname(destPath), { recursive: true });
14012
14012
  } catch (_) {
14013
14013
  }
14014
14014
  try {
14015
14015
  const dl = await _httpsGet(top.url, { "User-Agent": FETCH_USER_AGENT });
14016
14016
  if (dl.status !== 200)
14017
14017
  return { error: `Failed to download photo (HTTP ${dl.status}).` };
14018
- fs8.writeFileSync(destPath, dl.body);
14018
+ fs9.writeFileSync(destPath, dl.body);
14019
14019
  const kb = (dl.body.length / 1024).toFixed(1);
14020
14020
  const credit = top.credit ? ` \u2014 Photo by ${top.credit} on Unsplash` : "";
14021
14021
  return { output: `Downloaded "${top.alt || query}" to ${destPath} (${kb} KB).${credit}` };
@@ -14084,7 +14084,7 @@ ${expanded}` };
14084
14084
  return { ok: false, err: { error: e2.message } };
14085
14085
  }
14086
14086
  if (!(0, tsLangService_1.isTsLike)(resolved)) {
14087
- return { ok: false, err: { error: `Semantic navigation currently supports TypeScript/JavaScript only. For ${path5.extname(resolved) || "this file type"} use get_symbols / get_workspace_symbols (regex-based).` } };
14087
+ return { ok: false, err: { error: `Semantic navigation currently supports TypeScript/JavaScript only. For ${path6.extname(resolved) || "this file type"} use get_symbols / get_workspace_symbols (regex-based).` } };
14088
14088
  }
14089
14089
  return { ok: true, args: { workDir: workDir ?? process.cwd(), filePath: resolved, line, character } };
14090
14090
  }
@@ -14241,8 +14241,8 @@ var require_agentTypes = __commonJS({
14241
14241
  exports.loadAgentTypes = loadAgentTypes2;
14242
14242
  exports.summariseAgents = summariseAgents;
14243
14243
  exports.findAgentType = findAgentType;
14244
- var fs8 = __importStar(__require("fs"));
14245
- var path5 = __importStar(__require("path"));
14244
+ var fs9 = __importStar(__require("fs"));
14245
+ var path6 = __importStar(__require("path"));
14246
14246
  var os6 = __importStar(__require("os"));
14247
14247
  var index_1 = require_plugins();
14248
14248
  var BUILTIN_AGENTS = [
@@ -14292,15 +14292,15 @@ var require_agentTypes = __commonJS({
14292
14292
  function loadDir(dir, source, into) {
14293
14293
  let entries;
14294
14294
  try {
14295
- entries = fs8.readdirSync(dir).filter((f3) => f3.endsWith(".md"));
14295
+ entries = fs9.readdirSync(dir).filter((f3) => f3.endsWith(".md"));
14296
14296
  } catch {
14297
14297
  return;
14298
14298
  }
14299
14299
  for (const file of entries) {
14300
14300
  try {
14301
- const raw = fs8.readFileSync(path5.join(dir, file), "utf-8");
14301
+ const raw = fs9.readFileSync(path6.join(dir, file), "utf-8");
14302
14302
  const { meta, body } = parseFrontmatter(raw);
14303
- const name = (meta.name || path5.basename(file, ".md")).trim();
14303
+ const name = (meta.name || path6.basename(file, ".md")).trim();
14304
14304
  if (!name)
14305
14305
  continue;
14306
14306
  if (source !== "project" && into.has(name))
@@ -14319,8 +14319,8 @@ var require_agentTypes = __commonJS({
14319
14319
  }
14320
14320
  function loadAgentTypes2(workDir) {
14321
14321
  const out = /* @__PURE__ */ new Map();
14322
- loadDir(path5.join(workDir, ".nexrall", "agents"), "project", out);
14323
- loadDir(path5.join(os6.homedir(), ".nexrall", "agents"), "global", out);
14322
+ loadDir(path6.join(workDir, ".nexrall", "agents"), "project", out);
14323
+ loadDir(path6.join(os6.homedir(), ".nexrall", "agents"), "global", out);
14324
14324
  for (const dir of (0, index_1.pluginAssetDirs)(workDir, "agents"))
14325
14325
  loadDir(dir, "plugin", out);
14326
14326
  for (const agent of BUILTIN_AGENTS) {
@@ -14397,19 +14397,19 @@ var require_rules = __commonJS({
14397
14397
  Object.defineProperty(exports, "__esModule", { value: true });
14398
14398
  exports.loadSettings = loadSettings2;
14399
14399
  exports.evaluatePermission = evaluatePermission2;
14400
- var fs8 = __importStar(__require("fs"));
14401
- var path5 = __importStar(__require("path"));
14400
+ var fs9 = __importStar(__require("fs"));
14401
+ var path6 = __importStar(__require("path"));
14402
14402
  var os6 = __importStar(__require("os"));
14403
14403
  function managedSettingsPath() {
14404
14404
  if (process.platform === "darwin")
14405
14405
  return "/Library/Application Support/Nexrall/managed-settings.json";
14406
14406
  if (process.platform === "win32")
14407
- return path5.join(process.env.PROGRAMDATA ?? "C:\\ProgramData", "Nexrall", "managed-settings.json");
14407
+ return path6.join(process.env.PROGRAMDATA ?? "C:\\ProgramData", "Nexrall", "managed-settings.json");
14408
14408
  return "/etc/nexrall/managed-settings.json";
14409
14409
  }
14410
14410
  function readJson(file) {
14411
14411
  try {
14412
- return JSON.parse(fs8.readFileSync(file, "utf-8"));
14412
+ return JSON.parse(fs9.readFileSync(file, "utf-8"));
14413
14413
  } catch {
14414
14414
  return null;
14415
14415
  }
@@ -14422,9 +14422,9 @@ var require_rules = __commonJS({
14422
14422
  function loadSettings2(workDir) {
14423
14423
  const tiers = [
14424
14424
  managedSettingsPath(),
14425
- path5.join(os6.homedir(), ".nexrall", "settings.json"),
14426
- path5.join(workDir, ".nexrall", "settings.json"),
14427
- path5.join(workDir, ".nexrall", "settings.local.json")
14425
+ path6.join(os6.homedir(), ".nexrall", "settings.json"),
14426
+ path6.join(workDir, ".nexrall", "settings.json"),
14427
+ path6.join(workDir, ".nexrall", "settings.local.json")
14428
14428
  ];
14429
14429
  const merged = { allow: [], ask: [], deny: [] };
14430
14430
  const raw = {};
@@ -14492,10 +14492,10 @@ var require_rules = __commonJS({
14492
14492
  if (!p)
14493
14493
  return;
14494
14494
  vals.push(p);
14495
- if (path5.isAbsolute(p))
14496
- vals.push(path5.relative(workDir, p));
14495
+ if (path6.isAbsolute(p))
14496
+ vals.push(path6.relative(workDir, p));
14497
14497
  else
14498
- vals.push(path5.resolve(workDir, p));
14498
+ vals.push(path6.resolve(workDir, p));
14499
14499
  };
14500
14500
  switch (tool) {
14501
14501
  case "bash":
@@ -14763,15 +14763,15 @@ var require_loop = __commonJS({
14763
14763
  var flaky_1 = require_flaky();
14764
14764
  var claimEvidence_1 = require_claimEvidence();
14765
14765
  var memory_1 = require_memory();
14766
- var fs8 = __importStar(__require("fs"));
14767
- var path5 = __importStar(__require("path"));
14766
+ var fs9 = __importStar(__require("fs"));
14767
+ var path6 = __importStar(__require("path"));
14768
14768
  var child_process_1 = __require("child_process");
14769
14769
  function loadHooks(workDir) {
14770
14770
  let fromSettings = {};
14771
14771
  try {
14772
- const p = path5.join(workDir, ".nexrall", "settings.json");
14773
- if (fs8.existsSync(p))
14774
- fromSettings = JSON.parse(fs8.readFileSync(p, "utf-8")).hooks ?? {};
14772
+ const p = path6.join(workDir, ".nexrall", "settings.json");
14773
+ if (fs9.existsSync(p))
14774
+ fromSettings = JSON.parse(fs9.readFileSync(p, "utf-8")).hooks ?? {};
14775
14775
  } catch {
14776
14776
  }
14777
14777
  const fromPlugins = (0, index_1.pluginHooks)(workDir);
@@ -15697,7 +15697,7 @@ Continue the work from here.` }] });
15697
15697
  const onStream = options.onToolStreamChunk ? (chunk) => options.onToolStreamChunk(name, chunk) : void 0;
15698
15698
  if (WRITE_TOOLS.has(name)) {
15699
15699
  const targetPath = typeof input.path === "string" ? input.path : typeof input.source === "string" ? input.source : "";
15700
- const absTarget = targetPath && options.workDir ? path5.resolve(options.workDir, targetPath) : targetPath;
15700
+ const absTarget = targetPath && options.workDir ? path6.resolve(options.workDir, targetPath) : targetPath;
15701
15701
  result = await withFileLock(absTarget || name, () => (0, executor_1.executeTool)(name, input, options.abortSignal, sandboxCfg, options.workDir, agentScope, onStream));
15702
15702
  } else {
15703
15703
  result = await (0, executor_1.executeTool)(name, input, options.abortSignal, sandboxCfg, options.workDir, agentScope, onStream);
@@ -16362,8 +16362,8 @@ var require_manager = __commonJS({
16362
16362
  }();
16363
16363
  Object.defineProperty(exports, "__esModule", { value: true });
16364
16364
  exports.McpManager = void 0;
16365
- var fs8 = __importStar(__require("fs"));
16366
- var path5 = __importStar(__require("path"));
16365
+ var fs9 = __importStar(__require("fs"));
16366
+ var path6 = __importStar(__require("path"));
16367
16367
  var os6 = __importStar(__require("os"));
16368
16368
  var client_1 = require_client2();
16369
16369
  var httpClient_1 = require_httpClient();
@@ -16392,12 +16392,12 @@ var require_manager = __commonJS({
16392
16392
  } catch {
16393
16393
  }
16394
16394
  const locations = [
16395
- path5.join(os6.homedir(), ".nexrall", "mcp.json"),
16396
- path5.join(workDir, ".nexrall", "mcp.json")
16395
+ path6.join(os6.homedir(), ".nexrall", "mcp.json"),
16396
+ path6.join(workDir, ".nexrall", "mcp.json")
16397
16397
  ];
16398
16398
  for (const loc of locations) {
16399
16399
  try {
16400
- const raw = fs8.readFileSync(loc, "utf-8");
16400
+ const raw = fs9.readFileSync(loc, "utf-8");
16401
16401
  const cfg = JSON.parse(raw);
16402
16402
  Object.assign(merged.mcpServers, cfg.mcpServers ?? {});
16403
16403
  } catch {
@@ -16497,19 +16497,19 @@ var require_manager = __commonJS({
16497
16497
  // ─── Config file persistence (for the management UI) ──────────────────────────
16498
16498
  /** Path to an mcp.json for the given scope. */
16499
16499
  static configPath(workDir, scope) {
16500
- return scope === "user" ? path5.join(os6.homedir(), ".nexrall", "mcp.json") : path5.join(workDir, ".nexrall", "mcp.json");
16500
+ return scope === "user" ? path6.join(os6.homedir(), ".nexrall", "mcp.json") : path6.join(workDir, ".nexrall", "mcp.json");
16501
16501
  }
16502
16502
  static readConfigFile(p) {
16503
16503
  try {
16504
- const cfg = JSON.parse(fs8.readFileSync(p, "utf-8"));
16504
+ const cfg = JSON.parse(fs9.readFileSync(p, "utf-8"));
16505
16505
  return { mcpServers: cfg.mcpServers ?? {} };
16506
16506
  } catch {
16507
16507
  return { mcpServers: {} };
16508
16508
  }
16509
16509
  }
16510
16510
  static writeConfigFile(p, cfg) {
16511
- fs8.mkdirSync(path5.dirname(p), { recursive: true });
16512
- fs8.writeFileSync(p, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
16511
+ fs9.mkdirSync(path6.dirname(p), { recursive: true });
16512
+ fs9.writeFileSync(p, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
16513
16513
  }
16514
16514
  /** Add (or overwrite) a server in the given scope's mcp.json. */
16515
16515
  static addServer(workDir, name, server, scope = "project") {
@@ -16598,9 +16598,9 @@ var require_manager2 = __commonJS({
16598
16598
  exports.CheckpointManager = void 0;
16599
16599
  exports.isMutatingTool = isMutatingTool;
16600
16600
  exports.isPotentiallyMutatingBash = isPotentiallyMutatingBash;
16601
- var fs8 = __importStar(__require("fs"));
16601
+ var fs9 = __importStar(__require("fs"));
16602
16602
  var os6 = __importStar(__require("os"));
16603
- var path5 = __importStar(__require("path"));
16603
+ var path6 = __importStar(__require("path"));
16604
16604
  var crypto2 = __importStar(__require("crypto"));
16605
16605
  var child_process_1 = __require("child_process");
16606
16606
  var MAX_SNAPSHOT_BYTES = 2 * 1024 * 1024;
@@ -16657,13 +16657,13 @@ var require_manager2 = __commonJS({
16657
16657
  this.turns = [];
16658
16658
  this.current = null;
16659
16659
  this.nextId = 1;
16660
- const key = crypto2.createHash("sha1").update(path5.resolve(workDir) + "\0" + (scope ?? "")).digest("hex").slice(0, 16);
16661
- const base = process.env.NEXRALL_CHECKPOINT_DIR || path5.join(os6.homedir(), ".nexrall", "checkpoints");
16662
- this.storeDir = path5.join(base, key);
16660
+ const key = crypto2.createHash("sha1").update(path6.resolve(workDir) + "\0" + (scope ?? "")).digest("hex").slice(0, 16);
16661
+ const base = process.env.NEXRALL_CHECKPOINT_DIR || path6.join(os6.homedir(), ".nexrall", "checkpoints");
16662
+ this.storeDir = path6.join(base, key);
16663
16663
  this.loadFromDisk();
16664
16664
  }
16665
16665
  resolve(p) {
16666
- return path5.isAbsolute(p) ? p : path5.resolve(this.workDir, p);
16666
+ return path6.isAbsolute(p) ? p : path6.resolve(this.workDir, p);
16667
16667
  }
16668
16668
  /**
16669
16669
  * Open a new turn. `label` is a short description (usually the user prompt),
@@ -16703,10 +16703,10 @@ var require_manager2 = __commonJS({
16703
16703
  let existed = false;
16704
16704
  let content = null;
16705
16705
  try {
16706
- const st = fs8.statSync(abs);
16706
+ const st = fs9.statSync(abs);
16707
16707
  if (st.isFile()) {
16708
16708
  existed = true;
16709
- content = st.size <= MAX_SNAPSHOT_BYTES ? fs8.readFileSync(abs) : null;
16709
+ content = st.size <= MAX_SNAPSHOT_BYTES ? fs9.readFileSync(abs) : null;
16710
16710
  } else {
16711
16711
  existed = true;
16712
16712
  }
@@ -16807,31 +16807,31 @@ var require_manager2 = __commonJS({
16807
16807
  applySnapshot(snap) {
16808
16808
  try {
16809
16809
  if (!snap.existed) {
16810
- if (fs8.existsSync(snap.absPath)) {
16811
- const st = fs8.statSync(snap.absPath);
16810
+ if (fs9.existsSync(snap.absPath)) {
16811
+ const st = fs9.statSync(snap.absPath);
16812
16812
  if (st.isFile())
16813
- fs8.unlinkSync(snap.absPath);
16813
+ fs9.unlinkSync(snap.absPath);
16814
16814
  else {
16815
16815
  try {
16816
- fs8.rmdirSync(snap.absPath);
16816
+ fs9.rmdirSync(snap.absPath);
16817
16817
  } catch {
16818
16818
  }
16819
16819
  }
16820
16820
  }
16821
16821
  } else if (snap.content !== null) {
16822
- fs8.mkdirSync(path5.dirname(snap.absPath), { recursive: true });
16823
- fs8.writeFileSync(snap.absPath, snap.content);
16822
+ fs9.mkdirSync(path6.dirname(snap.absPath), { recursive: true });
16823
+ fs9.writeFileSync(snap.absPath, snap.content);
16824
16824
  }
16825
16825
  } catch {
16826
16826
  }
16827
16827
  }
16828
16828
  // ─── Disk persistence (best-effort — checkpointing must never crash the agent) ──
16829
16829
  turnFile(id) {
16830
- return path5.join(this.storeDir, `turn-${id}.json`);
16830
+ return path6.join(this.storeDir, `turn-${id}.json`);
16831
16831
  }
16832
16832
  persistTurn(turn) {
16833
16833
  try {
16834
- fs8.mkdirSync(this.storeDir, { recursive: true });
16834
+ fs9.mkdirSync(this.storeDir, { recursive: true });
16835
16835
  const persisted = {
16836
16836
  id: turn.id,
16837
16837
  label: turn.label,
@@ -16847,29 +16847,29 @@ var require_manager2 = __commonJS({
16847
16847
  }))
16848
16848
  };
16849
16849
  const tmp = this.turnFile(turn.id) + ".tmp";
16850
- fs8.writeFileSync(tmp, JSON.stringify(persisted));
16851
- fs8.renameSync(tmp, this.turnFile(turn.id));
16850
+ fs9.writeFileSync(tmp, JSON.stringify(persisted));
16851
+ fs9.renameSync(tmp, this.turnFile(turn.id));
16852
16852
  } catch {
16853
16853
  }
16854
16854
  }
16855
16855
  persistIndex() {
16856
16856
  try {
16857
- fs8.mkdirSync(this.storeDir, { recursive: true });
16857
+ fs9.mkdirSync(this.storeDir, { recursive: true });
16858
16858
  const index = {
16859
16859
  version: 1,
16860
- workDir: path5.resolve(this.workDir),
16860
+ workDir: path6.resolve(this.workDir),
16861
16861
  nextId: this.nextId,
16862
16862
  turnIds: this.turns.map((t2) => t2.id)
16863
16863
  };
16864
- const tmp = path5.join(this.storeDir, "index.json.tmp");
16865
- fs8.writeFileSync(tmp, JSON.stringify(index));
16866
- fs8.renameSync(tmp, path5.join(this.storeDir, "index.json"));
16864
+ const tmp = path6.join(this.storeDir, "index.json.tmp");
16865
+ fs9.writeFileSync(tmp, JSON.stringify(index));
16866
+ fs9.renameSync(tmp, path6.join(this.storeDir, "index.json"));
16867
16867
  } catch {
16868
16868
  }
16869
16869
  }
16870
16870
  deleteTurnFile(id) {
16871
16871
  try {
16872
- fs8.unlinkSync(this.turnFile(id));
16872
+ fs9.unlinkSync(this.turnFile(id));
16873
16873
  } catch {
16874
16874
  }
16875
16875
  }
@@ -16881,14 +16881,14 @@ var require_manager2 = __commonJS({
16881
16881
  }
16882
16882
  loadFromDisk() {
16883
16883
  try {
16884
- const raw = fs8.readFileSync(path5.join(this.storeDir, "index.json"), "utf-8");
16884
+ const raw = fs9.readFileSync(path6.join(this.storeDir, "index.json"), "utf-8");
16885
16885
  const index = JSON.parse(raw);
16886
16886
  if (index.version !== 1 || !Array.isArray(index.turnIds))
16887
16887
  return;
16888
16888
  this.nextId = Number.isFinite(index.nextId) && index.nextId > 0 ? index.nextId : 1;
16889
16889
  for (const id of index.turnIds) {
16890
16890
  try {
16891
- const t2 = JSON.parse(fs8.readFileSync(this.turnFile(id), "utf-8"));
16891
+ const t2 = JSON.parse(fs9.readFileSync(this.turnFile(id), "utf-8"));
16892
16892
  const snapshots = /* @__PURE__ */ new Map();
16893
16893
  for (const s2 of t2.snapshots ?? []) {
16894
16894
  snapshots.set(s2.absPath, {
@@ -17175,8 +17175,8 @@ var require_installer = __commonJS({
17175
17175
  exports.readReceipt = readReceipt2;
17176
17176
  exports.removePlugin = removePlugin2;
17177
17177
  exports.updatePlugin = updatePlugin2;
17178
- var fs8 = __importStar(__require("fs"));
17179
- var path5 = __importStar(__require("path"));
17178
+ var fs9 = __importStar(__require("fs"));
17179
+ var path6 = __importStar(__require("path"));
17180
17180
  var os6 = __importStar(__require("os"));
17181
17181
  var child_process_1 = __require("child_process");
17182
17182
  var client_1 = require_client();
@@ -17214,7 +17214,7 @@ var require_installer = __commonJS({
17214
17214
  if (!raw)
17215
17215
  throw new Error("Empty plugin source.");
17216
17216
  if (raw.startsWith("./") || raw.startsWith("../") || raw.startsWith("/") || raw.startsWith("~/")) {
17217
- const abs = path5.resolve(raw.replace(/^~(?=\/)/, os6.homedir()));
17217
+ const abs = path6.resolve(raw.replace(/^~(?=\/)/, os6.homedir()));
17218
17218
  return { kind: "local", repo: abs, raw };
17219
17219
  }
17220
17220
  let rest = raw;
@@ -17251,7 +17251,7 @@ var require_installer = __commonJS({
17251
17251
  }
17252
17252
  function listMd(dir) {
17253
17253
  try {
17254
- return fs8.readdirSync(dir).filter((f3) => f3.endsWith(".md")).map((f3) => f3.replace(/\.md$/, ""));
17254
+ return fs9.readdirSync(dir).filter((f3) => f3.endsWith(".md")).map((f3) => f3.replace(/\.md$/, ""));
17255
17255
  } catch {
17256
17256
  return [];
17257
17257
  }
@@ -17259,7 +17259,7 @@ var require_installer = __commonJS({
17259
17259
  function inspectPluginDir(dir) {
17260
17260
  let meta = {};
17261
17261
  try {
17262
- const j = JSON.parse(fs8.readFileSync(path5.join(dir, "plugin.json"), "utf-8"));
17262
+ const j = JSON.parse(fs9.readFileSync(path6.join(dir, "plugin.json"), "utf-8"));
17263
17263
  meta = {
17264
17264
  name: typeof j.name === "string" ? j.name : void 0,
17265
17265
  version: typeof j.version === "string" ? j.version : void 0,
@@ -17268,10 +17268,10 @@ var require_installer = __commonJS({
17268
17268
  } catch {
17269
17269
  }
17270
17270
  return {
17271
- commands: listMd(path5.join(dir, "commands")),
17272
- agents: listMd(path5.join(dir, "agents")),
17273
- hasHooks: fs8.existsSync(path5.join(dir, "hooks.json")),
17274
- hasMcp: fs8.existsSync(path5.join(dir, "mcp.json")),
17271
+ commands: listMd(path6.join(dir, "commands")),
17272
+ agents: listMd(path6.join(dir, "agents")),
17273
+ hasHooks: fs9.existsSync(path6.join(dir, "hooks.json")),
17274
+ hasMcp: fs9.existsSync(path6.join(dir, "mcp.json")),
17275
17275
  meta
17276
17276
  };
17277
17277
  }
@@ -17292,69 +17292,69 @@ var require_installer = __commonJS({
17292
17292
  const buf = Buffer.from(await res.arrayBuffer());
17293
17293
  if (buf.length > 50 * 1024 * 1024)
17294
17294
  throw new Error("Plugin tarball exceeds 50 MB \u2014 refusing to install.");
17295
- fs8.writeFileSync(destFile, buf);
17295
+ fs9.writeFileSync(destFile, buf);
17296
17296
  }
17297
17297
  function extractTarball(tarFile, destDir) {
17298
- fs8.mkdirSync(destDir, { recursive: true });
17298
+ fs9.mkdirSync(destDir, { recursive: true });
17299
17299
  (0, child_process_1.execFileSync)("tar", ["-xzf", tarFile, "-C", destDir], { stdio: "pipe" });
17300
- const entries = fs8.readdirSync(destDir).filter((e2) => {
17300
+ const entries = fs9.readdirSync(destDir).filter((e2) => {
17301
17301
  try {
17302
- return fs8.statSync(path5.join(destDir, e2)).isDirectory();
17302
+ return fs9.statSync(path6.join(destDir, e2)).isDirectory();
17303
17303
  } catch {
17304
17304
  return false;
17305
17305
  }
17306
17306
  });
17307
17307
  if (entries.length !== 1)
17308
17308
  throw new Error("Unexpected tarball layout.");
17309
- return path5.join(destDir, entries[0]);
17309
+ return path6.join(destDir, entries[0]);
17310
17310
  }
17311
17311
  function copyPluginDir(src, dest) {
17312
17312
  const SKIP = /* @__PURE__ */ new Set([".git", "node_modules", ".github", ".DS_Store", RECEIPT_FILE]);
17313
- fs8.mkdirSync(dest, { recursive: true });
17314
- for (const entry of fs8.readdirSync(src, { withFileTypes: true })) {
17313
+ fs9.mkdirSync(dest, { recursive: true });
17314
+ for (const entry of fs9.readdirSync(src, { withFileTypes: true })) {
17315
17315
  if (SKIP.has(entry.name))
17316
17316
  continue;
17317
- const s2 = path5.join(src, entry.name);
17318
- const d = path5.join(dest, entry.name);
17317
+ const s2 = path6.join(src, entry.name);
17318
+ const d = path6.join(dest, entry.name);
17319
17319
  if (entry.isSymbolicLink())
17320
17320
  continue;
17321
17321
  if (entry.isDirectory()) {
17322
17322
  copyPluginDir(s2, d);
17323
17323
  } else if (entry.isFile()) {
17324
- fs8.copyFileSync(s2, d);
17324
+ fs9.copyFileSync(s2, d);
17325
17325
  }
17326
17326
  }
17327
17327
  }
17328
17328
  function pluginsRoot(scope, workDir) {
17329
- return scope === "project" ? path5.join(workDir || process.cwd(), ".nexrall", "plugins") : path5.join(os6.homedir(), ".nexrall", "plugins");
17329
+ return scope === "project" ? path6.join(workDir || process.cwd(), ".nexrall", "plugins") : path6.join(os6.homedir(), ".nexrall", "plugins");
17330
17330
  }
17331
17331
  async function installPlugin2(spec, opts = {}) {
17332
17332
  const source = parsePluginSource(spec);
17333
17333
  const scope = opts.scope ?? "global";
17334
- const tmpBase = fs8.mkdtempSync(path5.join(os6.tmpdir(), "nexrall-plugin-"));
17334
+ const tmpBase = fs9.mkdtempSync(path6.join(os6.tmpdir(), "nexrall-plugin-"));
17335
17335
  try {
17336
17336
  let repoRoot;
17337
17337
  if (source.kind === "local") {
17338
- if (!fs8.existsSync(source.repo) || !fs8.statSync(source.repo).isDirectory()) {
17338
+ if (!fs9.existsSync(source.repo) || !fs9.statSync(source.repo).isDirectory()) {
17339
17339
  throw new Error(`Local plugin path not found: ${source.repo}`);
17340
17340
  }
17341
17341
  repoRoot = source.repo;
17342
17342
  } else {
17343
- const tarFile = path5.join(tmpBase, "plugin.tar.gz");
17343
+ const tarFile = path6.join(tmpBase, "plugin.tar.gz");
17344
17344
  await downloadTarball(source.repo, source.ref, tarFile);
17345
- repoRoot = extractTarball(tarFile, path5.join(tmpBase, "x"));
17345
+ repoRoot = extractTarball(tarFile, path6.join(tmpBase, "x"));
17346
17346
  }
17347
- let pluginRoot = source.subdir ? path5.join(repoRoot, source.subdir) : repoRoot;
17348
- pluginRoot = path5.resolve(pluginRoot);
17349
- if (!path5.resolve(pluginRoot).startsWith(path5.resolve(repoRoot))) {
17347
+ let pluginRoot = source.subdir ? path6.join(repoRoot, source.subdir) : repoRoot;
17348
+ pluginRoot = path6.resolve(pluginRoot);
17349
+ if (!path6.resolve(pluginRoot).startsWith(path6.resolve(repoRoot))) {
17350
17350
  throw new Error("Plugin subdirectory escapes the repository \u2014 refusing.");
17351
17351
  }
17352
- if (!fs8.existsSync(pluginRoot) || !fs8.statSync(pluginRoot).isDirectory()) {
17352
+ if (!fs9.existsSync(pluginRoot) || !fs9.statSync(pluginRoot).isDirectory()) {
17353
17353
  throw new Error(`Subdirectory not found in repo: ${source.subdir}`);
17354
17354
  }
17355
17355
  if (!looksLikePlugin(pluginRoot)) {
17356
- const candidates = ["plugin", ".nexrall-plugin"].map((c) => path5.join(pluginRoot, c));
17357
- const found = candidates.find((c) => fs8.existsSync(c) && looksLikePlugin(c));
17356
+ const candidates = ["plugin", ".nexrall-plugin"].map((c) => path6.join(pluginRoot, c));
17357
+ const found = candidates.find((c) => fs9.existsSync(c) && looksLikePlugin(c));
17358
17358
  if (found) {
17359
17359
  pluginRoot = found;
17360
17360
  } else {
@@ -17362,7 +17362,7 @@ var require_installer = __commonJS({
17362
17362
  }
17363
17363
  }
17364
17364
  const inspection = inspectPluginDir(pluginRoot);
17365
- const name = opts.name || inspection.meta.name || (source.subdir ? path5.basename(source.subdir) : void 0) || (source.kind === "github" ? source.repo.split("/")[1] : path5.basename(source.repo));
17365
+ const name = opts.name || inspection.meta.name || (source.subdir ? path6.basename(source.subdir) : void 0) || (source.kind === "github" ? source.repo.split("/")[1] : path6.basename(source.repo));
17366
17366
  if (!/^[\w.-]+$/.test(name))
17367
17367
  throw new Error(`Invalid plugin name "${name}".`);
17368
17368
  if (opts.confirm) {
@@ -17371,11 +17371,11 @@ var require_installer = __commonJS({
17371
17371
  throw new Error("Installation cancelled.");
17372
17372
  }
17373
17373
  const root = pluginsRoot(scope, opts.workDir);
17374
- const dest = path5.join(root, name);
17375
- if (fs8.existsSync(dest)) {
17374
+ const dest = path6.join(root, name);
17375
+ if (fs9.existsSync(dest)) {
17376
17376
  if (!opts.force)
17377
17377
  throw new Error(`Plugin "${name}" is already installed. Use --force to overwrite or 'nex plugin update ${name}'.`);
17378
- fs8.rmSync(dest, { recursive: true, force: true });
17378
+ fs9.rmSync(dest, { recursive: true, force: true });
17379
17379
  }
17380
17380
  copyPluginDir(pluginRoot, dest);
17381
17381
  const receipt = {
@@ -17385,15 +17385,15 @@ var require_installer = __commonJS({
17385
17385
  subdir: source.subdir,
17386
17386
  installedAt: (/* @__PURE__ */ new Date()).toISOString()
17387
17387
  };
17388
- fs8.writeFileSync(path5.join(dest, RECEIPT_FILE), JSON.stringify(receipt, null, 2));
17388
+ fs9.writeFileSync(path6.join(dest, RECEIPT_FILE), JSON.stringify(receipt, null, 2));
17389
17389
  return { name, dir: dest, scope, inspection };
17390
17390
  } finally {
17391
- fs8.rmSync(tmpBase, { recursive: true, force: true });
17391
+ fs9.rmSync(tmpBase, { recursive: true, force: true });
17392
17392
  }
17393
17393
  }
17394
17394
  function readReceipt2(pluginDir) {
17395
17395
  try {
17396
- const j = JSON.parse(fs8.readFileSync(path5.join(pluginDir, RECEIPT_FILE), "utf-8"));
17396
+ const j = JSON.parse(fs9.readFileSync(path6.join(pluginDir, RECEIPT_FILE), "utf-8"));
17397
17397
  return typeof j.source === "string" ? j : null;
17398
17398
  } catch {
17399
17399
  return null;
@@ -17404,9 +17404,9 @@ var require_installer = __commonJS({
17404
17404
  throw new Error(`Invalid plugin name "${name}".`);
17405
17405
  const scopes = opts.scope ? [opts.scope] : ["project", "global"];
17406
17406
  for (const s2 of scopes) {
17407
- const dir = path5.join(pluginsRoot(s2, opts.workDir), name);
17408
- if (fs8.existsSync(dir)) {
17409
- fs8.rmSync(dir, { recursive: true, force: true });
17407
+ const dir = path6.join(pluginsRoot(s2, opts.workDir), name);
17408
+ if (fs9.existsSync(dir)) {
17409
+ fs9.rmSync(dir, { recursive: true, force: true });
17410
17410
  return dir;
17411
17411
  }
17412
17412
  }
@@ -17415,8 +17415,8 @@ var require_installer = __commonJS({
17415
17415
  async function updatePlugin2(name, opts = {}) {
17416
17416
  const scopes = opts.scope ? [opts.scope] : ["project", "global"];
17417
17417
  for (const s2 of scopes) {
17418
- const dir = path5.join(pluginsRoot(s2, opts.workDir), name);
17419
- if (!fs8.existsSync(dir))
17418
+ const dir = path6.join(pluginsRoot(s2, opts.workDir), name);
17419
+ if (!fs9.existsSync(dir))
17420
17420
  continue;
17421
17421
  const receipt = readReceipt2(dir);
17422
17422
  if (!receipt) {
@@ -27275,14 +27275,14 @@ var require_react_reconciler_production = __commonJS({
27275
27275
  }
27276
27276
  var exports2 = {};
27277
27277
  "use strict";
27278
- var React12 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
27278
+ var React13 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
27279
27279
  Symbol.for("react.scope");
27280
27280
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
27281
27281
  Symbol.for("react.legacy_hidden");
27282
27282
  Symbol.for("react.tracing_marker");
27283
27283
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
27284
27284
  Symbol.for("react.view_transition");
27285
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React12.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
27285
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React13.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
27286
27286
  $$$config.cloneMutableInstance;
27287
27287
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
27288
27288
  $$$config.cloneMutableTextInstance;
@@ -28082,11 +28082,11 @@ var require_react_reconciler_development = __commonJS({
28082
28082
  fiber = fiber.next, id--;
28083
28083
  return fiber;
28084
28084
  }
28085
- function copyWithSetImpl(obj, path5, index, value) {
28086
- if (index >= path5.length)
28085
+ function copyWithSetImpl(obj, path6, index, value) {
28086
+ if (index >= path6.length)
28087
28087
  return value;
28088
- var key = path5[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
28089
- updated[key] = copyWithSetImpl(obj[key], path5, index + 1, value);
28088
+ var key = path6[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
28089
+ updated[key] = copyWithSetImpl(obj[key], path6, index + 1, value);
28090
28090
  return updated;
28091
28091
  }
28092
28092
  function copyWithRename(obj, oldPath, newPath) {
@@ -28113,11 +28113,11 @@ var require_react_reconciler_development = __commonJS({
28113
28113
  );
28114
28114
  return updated;
28115
28115
  }
28116
- function copyWithDeleteImpl(obj, path5, index) {
28117
- var key = path5[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
28118
- if (index + 1 === path5.length)
28116
+ function copyWithDeleteImpl(obj, path6, index) {
28117
+ var key = path6[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
28118
+ if (index + 1 === path6.length)
28119
28119
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
28120
- updated[key] = copyWithDeleteImpl(obj[key], path5, index + 1);
28120
+ updated[key] = copyWithDeleteImpl(obj[key], path6, index + 1);
28121
28121
  return updated;
28122
28122
  }
28123
28123
  function shouldSuspendImpl() {
@@ -40034,14 +40034,14 @@ var require_react_reconciler_development = __commonJS({
40034
40034
  }
40035
40035
  var exports2 = {};
40036
40036
  "use strict";
40037
- var React12 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
40037
+ var React13 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
40038
40038
  Symbol.for("react.scope");
40039
40039
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
40040
40040
  Symbol.for("react.legacy_hidden");
40041
40041
  Symbol.for("react.tracing_marker");
40042
40042
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
40043
40043
  Symbol.for("react.view_transition");
40044
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React12.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
40044
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React13.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
40045
40045
  $$$config.cloneMutableInstance;
40046
40046
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
40047
40047
  $$$config.cloneMutableTextInstance;
@@ -41543,29 +41543,29 @@ var require_react_reconciler_development = __commonJS({
41543
41543
  var didWarnAboutNestedUpdates = false;
41544
41544
  var didWarnAboutFindNodeInStrictMode = {};
41545
41545
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null;
41546
- overrideHookState = function(fiber, id, path5, value) {
41546
+ overrideHookState = function(fiber, id, path6, value) {
41547
41547
  id = findHook(fiber, id);
41548
- null !== id && (path5 = copyWithSetImpl(id.memoizedState, path5, 0, value), id.memoizedState = path5, id.baseState = path5, fiber.memoizedProps = assign({}, fiber.memoizedProps), path5 = enqueueConcurrentRenderForLane(fiber, 2), null !== path5 && scheduleUpdateOnFiber(path5, fiber, 2));
41548
+ null !== id && (path6 = copyWithSetImpl(id.memoizedState, path6, 0, value), id.memoizedState = path6, id.baseState = path6, fiber.memoizedProps = assign({}, fiber.memoizedProps), path6 = enqueueConcurrentRenderForLane(fiber, 2), null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2));
41549
41549
  };
41550
- overrideHookStateDeletePath = function(fiber, id, path5) {
41550
+ overrideHookStateDeletePath = function(fiber, id, path6) {
41551
41551
  id = findHook(fiber, id);
41552
- null !== id && (path5 = copyWithDeleteImpl(id.memoizedState, path5, 0), id.memoizedState = path5, id.baseState = path5, fiber.memoizedProps = assign({}, fiber.memoizedProps), path5 = enqueueConcurrentRenderForLane(fiber, 2), null !== path5 && scheduleUpdateOnFiber(path5, fiber, 2));
41552
+ null !== id && (path6 = copyWithDeleteImpl(id.memoizedState, path6, 0), id.memoizedState = path6, id.baseState = path6, fiber.memoizedProps = assign({}, fiber.memoizedProps), path6 = enqueueConcurrentRenderForLane(fiber, 2), null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2));
41553
41553
  };
41554
41554
  overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
41555
41555
  id = findHook(fiber, id);
41556
41556
  null !== id && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2));
41557
41557
  };
41558
- overrideProps = function(fiber, path5, value) {
41559
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path5, 0, value);
41558
+ overrideProps = function(fiber, path6, value) {
41559
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path6, 0, value);
41560
41560
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
41561
- path5 = enqueueConcurrentRenderForLane(fiber, 2);
41562
- null !== path5 && scheduleUpdateOnFiber(path5, fiber, 2);
41561
+ path6 = enqueueConcurrentRenderForLane(fiber, 2);
41562
+ null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2);
41563
41563
  };
41564
- overridePropsDeletePath = function(fiber, path5) {
41565
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path5, 0);
41564
+ overridePropsDeletePath = function(fiber, path6) {
41565
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path6, 0);
41566
41566
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
41567
- path5 = enqueueConcurrentRenderForLane(fiber, 2);
41568
- null !== path5 && scheduleUpdateOnFiber(path5, fiber, 2);
41567
+ path6 = enqueueConcurrentRenderForLane(fiber, 2);
41568
+ null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2);
41569
41569
  };
41570
41570
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
41571
41571
  fiber.pendingProps = copyWithRename(
@@ -51302,7 +51302,7 @@ var {
51302
51302
  } = import_index.default;
51303
51303
 
51304
51304
  // src/index.ts
51305
- import * as path4 from "path";
51305
+ import * as path5 from "path";
51306
51306
 
51307
51307
  // ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
51308
51308
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -51925,8 +51925,8 @@ function stopSpinner(handle2) {
51925
51925
 
51926
51926
  // src/commands/chat.ts
51927
51927
  import * as readline3 from "readline";
51928
- import * as path3 from "path";
51929
- import * as fs7 from "fs";
51928
+ import * as path4 from "path";
51929
+ import * as fs8 from "fs";
51930
51930
  import * as os5 from "os";
51931
51931
  import * as crypto from "crypto";
51932
51932
  import { execSync } from "child_process";
@@ -52456,11 +52456,11 @@ Diff.prototype = {
52456
52456
  }
52457
52457
  }
52458
52458
  },
52459
- addToPath: function addToPath(path5, added, removed, oldPosInc) {
52460
- var last = path5.lastComponent;
52459
+ addToPath: function addToPath(path6, added, removed, oldPosInc) {
52460
+ var last = path6.lastComponent;
52461
52461
  if (last && last.added === added && last.removed === removed) {
52462
52462
  return {
52463
- oldPos: path5.oldPos + oldPosInc,
52463
+ oldPos: path6.oldPos + oldPosInc,
52464
52464
  lastComponent: {
52465
52465
  count: last.count + 1,
52466
52466
  added,
@@ -52470,7 +52470,7 @@ Diff.prototype = {
52470
52470
  };
52471
52471
  } else {
52472
52472
  return {
52473
- oldPos: path5.oldPos + oldPosInc,
52473
+ oldPos: path6.oldPos + oldPosInc,
52474
52474
  lastComponent: {
52475
52475
  count: 1,
52476
52476
  added,
@@ -53366,14 +53366,10 @@ async function updateCommand(opts) {
53366
53366
  }
53367
53367
 
53368
53368
  // src/ui/screen.ts
53369
- function enableAltScreen() {
53369
+ function prepareSessionScreen() {
53370
53370
  if (!process.stdout.isTTY)
53371
53371
  return;
53372
- process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H");
53373
- }
53374
- function disableAltScreen() {
53375
- if (process.stdout.isTTY)
53376
- process.stdout.write("\x1B[?1049l");
53372
+ process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
53377
53373
  }
53378
53374
  var NEX_LOGO = [
53379
53375
  "\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557",
@@ -53502,7 +53498,51 @@ function wrapText(text, width) {
53502
53498
  return fitted;
53503
53499
  }
53504
53500
 
53505
- // src/ui/inkTerminal.tsx
53501
+ // src/trust.ts
53502
+ import fs5 from "fs";
53503
+ import path3 from "path";
53504
+ var TRUST_ENV_VAR = "NEXRALL_TRUST_WORKSPACE";
53505
+ function trustGrantedByEnv() {
53506
+ const v = process.env[TRUST_ENV_VAR];
53507
+ return v === "1" || v === "true";
53508
+ }
53509
+ function detectTrustSignals(dir) {
53510
+ const signals = [];
53511
+ const exists = (...p) => {
53512
+ try {
53513
+ return fs5.existsSync(path3.join(dir, ...p));
53514
+ } catch {
53515
+ return false;
53516
+ }
53517
+ };
53518
+ if (exists(".nexrall", "mcp.json")) {
53519
+ signals.push(".nexrall/mcp.json \u2014 can start MCP servers (runs local commands)");
53520
+ }
53521
+ if (exists(".nexrall", "plugins")) {
53522
+ signals.push(".nexrall/plugins/ \u2014 project plugins (may add MCP servers)");
53523
+ }
53524
+ if (exists(".nexrall", "permissions.json")) {
53525
+ signals.push(".nexrall/permissions.json \u2014 pre-approved tool permissions");
53526
+ }
53527
+ if (exists(".nexrall", "settings.json")) {
53528
+ signals.push(".nexrall/settings.json \u2014 project settings and permission rules");
53529
+ }
53530
+ if (exists("nexrall.md")) {
53531
+ signals.push("nexrall.md \u2014 project instructions added to the agent\u2019s prompt");
53532
+ }
53533
+ if (exists(".nexrall", "skills")) {
53534
+ signals.push(".nexrall/skills/ \u2014 custom agent playbooks");
53535
+ }
53536
+ if (exists(".nexrall", "commands")) {
53537
+ signals.push(".nexrall/commands/ \u2014 custom slash commands");
53538
+ }
53539
+ if (exists(".nexrall", "agents")) {
53540
+ signals.push(".nexrall/agents/ \u2014 custom sub-agent definitions");
53541
+ }
53542
+ return signals;
53543
+ }
53544
+
53545
+ // src/ui/trustPrompt.tsx
53506
53546
  var import_react34 = __toESM(require_react(), 1);
53507
53547
 
53508
53548
  // ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/render.js
@@ -56209,7 +56249,7 @@ function wrapAnsi(string, columns, options) {
56209
56249
  // ../../node_modules/.pnpm/terminal-size@4.0.1/node_modules/terminal-size/index.js
56210
56250
  import process4 from "node:process";
56211
56251
  import { execFileSync } from "node:child_process";
56212
- import fs5 from "node:fs";
56252
+ import fs6 from "node:fs";
56213
56253
  import tty2 from "node:tty";
56214
56254
  var defaultColumns = 80;
56215
56255
  var defaultRows = 24;
@@ -56239,7 +56279,7 @@ var isForegroundProcess = () => {
56239
56279
  return true;
56240
56280
  }
56241
56281
  try {
56242
- const statContents = fs5.readFileSync("/proc/self/stat", "utf8");
56282
+ const statContents = fs6.readFileSync("/proc/self/stat", "utf8");
56243
56283
  const closingParenthesisIndex = statContents.lastIndexOf(") ");
56244
56284
  if (closingParenthesisIndex === -1) {
56245
56285
  return false;
@@ -56283,8 +56323,8 @@ function terminalSize() {
56283
56323
  }
56284
56324
  var devTty = () => {
56285
56325
  try {
56286
- const flags = process4.platform === "darwin" ? fs5.constants.O_EVTONLY | fs5.constants.O_NONBLOCK : fs5.constants.O_NONBLOCK;
56287
- const { columns, rows } = tty2.WriteStream(fs5.openSync("/dev/tty", flags));
56326
+ const flags = process4.platform === "darwin" ? fs6.constants.O_EVTONLY | fs6.constants.O_NONBLOCK : fs6.constants.O_NONBLOCK;
56327
+ const { columns, rows } = tty2.WriteStream(fs6.openSync("/dev/tty", flags));
56288
56328
  return { columns, rows };
56289
56329
  } catch {
56290
56330
  }
@@ -58193,8 +58233,8 @@ var cleanupYogaNode = (node) => {
58193
58233
  var currentUpdatePriority = import_constants.NoEventPriority;
58194
58234
  var currentRootNode;
58195
58235
  async function loadPackageJson() {
58196
- const fs8 = await import("node:fs");
58197
- const content = fs8.readFileSync(new URL("../package.json", import.meta.url), "utf8");
58236
+ const fs9 = await import("node:fs");
58237
+ const content = fs9.readFileSync(new URL("../package.json", import.meta.url), "utf8");
58198
58238
  const parsedContent = JSON.parse(content);
58199
58239
  return {
58200
58240
  name: parsedContent?.name,
@@ -59975,7 +60015,7 @@ var import_react14 = __toESM(require_react(), 1);
59975
60015
  // ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/components/ErrorOverview.js
59976
60016
  var import_react13 = __toESM(require_react(), 1);
59977
60017
  var import_stack_utils = __toESM(require_stack_utils(), 1);
59978
- import * as fs6 from "node:fs";
60018
+ import * as fs7 from "node:fs";
59979
60019
  import { cwd } from "node:process";
59980
60020
 
59981
60021
  // ../../node_modules/.pnpm/convert-to-spaces@2.0.1/node_modules/convert-to-spaces/dist/index.js
@@ -60095,8 +60135,8 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
60095
60135
  }
60096
60136
 
60097
60137
  // ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/components/ErrorOverview.js
60098
- var cleanupPath = (path5) => {
60099
- return path5?.replace(`file://${cwd()}/`, "");
60138
+ var cleanupPath = (path6) => {
60139
+ return path6?.replace(`file://${cwd()}/`, "");
60100
60140
  };
60101
60141
  var stackUtils = new import_stack_utils.default({
60102
60142
  cwd: cwd(),
@@ -60109,8 +60149,8 @@ function ErrorOverview({ error }) {
60109
60149
  let excerpt;
60110
60150
  let lineWidth = 0;
60111
60151
  const stackLineCounts = /* @__PURE__ */ new Map();
60112
- if (filePath && origin?.line && fs6.existsSync(filePath)) {
60113
- const sourceCode = fs6.readFileSync(filePath, "utf8");
60152
+ if (filePath && origin?.line && fs7.existsSync(filePath)) {
60153
+ const sourceCode = fs7.readFileSync(filePath, "utf8");
60114
60154
  excerpt = dist_default4(sourceCode, origin.line);
60115
60155
  if (excerpt) {
60116
60156
  for (const { line } of excerpt) {
@@ -62200,7 +62240,73 @@ var import_react32 = __toESM(require_react(), 1);
62200
62240
  // ../../node_modules/.pnpm/ink@7.1.1_@types+react@19.2.18_react@19.2.8/node_modules/ink/build/hooks/use-box-metrics.js
62201
62241
  var import_react33 = __toESM(require_react(), 1);
62202
62242
 
62243
+ // src/ui/trustPrompt.tsx
62244
+ var CHOICES = ["Yes, I trust this folder", "No, exit"];
62245
+ function TrustPrompt({ workDir, signals, onDecide }) {
62246
+ const { exit } = use_app_default();
62247
+ const [index, setIndex] = import_react34.default.useState(0);
62248
+ const indexRef = import_react34.default.useRef(0);
62249
+ const setSelection = (next) => {
62250
+ indexRef.current = next;
62251
+ setIndex(next);
62252
+ };
62253
+ const decide = (trusted) => {
62254
+ onDecide(trusted);
62255
+ exit();
62256
+ };
62257
+ use_input_default((input, key) => {
62258
+ if (key.upArrow) {
62259
+ setSelection((indexRef.current + CHOICES.length - 1) % CHOICES.length);
62260
+ return;
62261
+ }
62262
+ if (key.downArrow) {
62263
+ setSelection((indexRef.current + 1) % CHOICES.length);
62264
+ return;
62265
+ }
62266
+ if (input === "1") {
62267
+ setSelection(0);
62268
+ decide(true);
62269
+ return;
62270
+ }
62271
+ if (input === "2") {
62272
+ setSelection(1);
62273
+ decide(false);
62274
+ return;
62275
+ }
62276
+ if (key.escape || key.ctrl && input === "c") {
62277
+ decide(false);
62278
+ return;
62279
+ }
62280
+ if (key.return || input === "\r" || input === "\n") {
62281
+ decide(indexRef.current === 0);
62282
+ }
62283
+ });
62284
+ return /* @__PURE__ */ import_react34.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react34.default.createElement(Box_default, null, /* @__PURE__ */ import_react34.default.createElement(Text, { bold: true, color: "yellow" }, "Accessing workspace:")), /* @__PURE__ */ import_react34.default.createElement(Box_default, { marginTop: 1 }, /* @__PURE__ */ import_react34.default.createElement(Text, { bold: true }, workDir)), /* @__PURE__ */ import_react34.default.createElement(Box_default, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ import_react34.default.createElement(Text, null, "Quick safety check: is this a project you created, or one you trust?"), /* @__PURE__ */ import_react34.default.createElement(Text, null, "Nexrall Code will be able to read, edit and execute files here.")), signals.length > 0 && /* @__PURE__ */ import_react34.default.createElement(Box_default, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, "This folder also configures the agent:"), signals.map((s2) => /* @__PURE__ */ import_react34.default.createElement(Text, { key: s2, dimColor: true }, ` \u2022 ${s2}`))), /* @__PURE__ */ import_react34.default.createElement(Box_default, { marginTop: 1, flexDirection: "column" }, CHOICES.map((choice, i2) => {
62285
+ const selected = i2 === index;
62286
+ return /* @__PURE__ */ import_react34.default.createElement(Text, { key: choice, color: selected ? "blue" : void 0 }, selected ? "\u276F " : " ", `${i2 + 1}. ${choice}`);
62287
+ })), /* @__PURE__ */ import_react34.default.createElement(Box_default, { marginTop: 1 }, /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, "Enter to confirm \xB7 Esc to cancel")));
62288
+ }
62289
+ function askForTrust(workDir, signals) {
62290
+ return new Promise((resolve3) => {
62291
+ let decided = false;
62292
+ const settle = (trusted) => {
62293
+ if (decided)
62294
+ return;
62295
+ decided = true;
62296
+ resolve3(trusted);
62297
+ };
62298
+ const app = render_default(
62299
+ /* @__PURE__ */ import_react34.default.createElement(TrustPrompt, { workDir, signals, onDecide: settle }),
62300
+ { exitOnCtrlC: false }
62301
+ );
62302
+ void app.waitUntilExit().then(() => {
62303
+ settle(false);
62304
+ });
62305
+ });
62306
+ }
62307
+
62203
62308
  // src/ui/inkTerminal.tsx
62309
+ var import_react35 = __toESM(require_react(), 1);
62204
62310
  function footerText(info) {
62205
62311
  const modeLabel = info.autoApprove ? "yolo mode on" : info.mode === "plan" ? "plan mode on" : info.mode === "edit" ? "edit mode on" : info.mode === "ask" ? "ask mode on" : "auto mode on";
62206
62312
  return `${modeLabel} \xB7 /help for shortcuts \xB7 /agents for agents`;
@@ -62230,28 +62336,28 @@ var inkInstance = null;
62230
62336
  var idCounter = 0;
62231
62337
  var DEFAULT_PROMPT = colors.primary.bold("> ");
62232
62338
  var App2 = ({ onReady }) => {
62233
- const [items, setItems] = (0, import_react34.useState)([]);
62234
- const [footer, setFooterState] = (0, import_react34.useState)({ mode: "auto", autoApprove: false });
62235
- const [inputEnabled, setInputEnabledState] = (0, import_react34.useState)(true);
62236
- const [line, setLineState] = (0, import_react34.useState)("");
62237
- const [prompt2, setPrompt] = (0, import_react34.useState)(DEFAULT_PROMPT);
62339
+ const [items, setItems] = (0, import_react35.useState)([]);
62340
+ const [footer, setFooterState] = (0, import_react35.useState)({ mode: "auto", autoApprove: false });
62341
+ const [inputEnabled, setInputEnabledState] = (0, import_react35.useState)(true);
62342
+ const [line, setLineState] = (0, import_react35.useState)("");
62343
+ const [prompt2, setPrompt] = (0, import_react35.useState)(DEFAULT_PROMPT);
62238
62344
  const { exit } = use_app_default();
62239
- const lineRef = (0, import_react34.useRef)("");
62240
- const setLine = (0, import_react34.useCallback)((next) => {
62345
+ const lineRef = (0, import_react35.useRef)("");
62346
+ const setLine = (0, import_react35.useCallback)((next) => {
62241
62347
  const value = typeof next === "function" ? next(lineRef.current) : next;
62242
62348
  lineRef.current = value;
62243
62349
  setLineState(value);
62244
62350
  }, []);
62245
- const askResolverRef = (0, import_react34.useRef)(null);
62246
- const onLineRef = (0, import_react34.useRef)(null);
62247
- const [live, setLiveState] = (0, import_react34.useState)("");
62248
- const print = (0, import_react34.useCallback)((text) => {
62351
+ const askResolverRef = (0, import_react35.useRef)(null);
62352
+ const onLineRef = (0, import_react35.useRef)(null);
62353
+ const [live, setLiveState] = (0, import_react35.useState)("");
62354
+ const print = (0, import_react35.useCallback)((text) => {
62249
62355
  setItems((prev) => [...prev, { id: idCounter++, content: text }]);
62250
62356
  }, []);
62251
- const setFooter = (0, import_react34.useCallback)((info) => setFooterState(info), []);
62252
- const setLive = (0, import_react34.useCallback)((text) => setLiveState(text), []);
62253
- const setInputEnabled = (0, import_react34.useCallback)((enabled) => setInputEnabledState(enabled), []);
62254
- const askLine = (0, import_react34.useCallback)((promptText) => {
62357
+ const setFooter = (0, import_react35.useCallback)((info) => setFooterState(info), []);
62358
+ const setLive = (0, import_react35.useCallback)((text) => setLiveState(text), []);
62359
+ const setInputEnabled = (0, import_react35.useCallback)((enabled) => setInputEnabledState(enabled), []);
62360
+ const askLine = (0, import_react35.useCallback)((promptText) => {
62255
62361
  setPrompt(promptText || DEFAULT_PROMPT);
62256
62362
  setLine("");
62257
62363
  return new Promise((resolve3) => {
@@ -62261,7 +62367,7 @@ var App2 = ({ onReady }) => {
62261
62367
  };
62262
62368
  });
62263
62369
  }, []);
62264
- const onLine = (0, import_react34.useCallback)((cb) => {
62370
+ const onLine = (0, import_react35.useCallback)((cb) => {
62265
62371
  onLineRef.current = cb;
62266
62372
  }, []);
62267
62373
  use_input_default((char, key) => {
@@ -62297,17 +62403,17 @@ var App2 = ({ onReady }) => {
62297
62403
  }
62298
62404
  setLine((s2) => s2 + char);
62299
62405
  });
62300
- import_react34.default.useEffect(() => {
62406
+ import_react35.default.useEffect(() => {
62301
62407
  onReady({ print, setFooter, setLive, askLine, onLine, setInputEnabled, close: () => exit() });
62302
62408
  }, []);
62303
- return /* @__PURE__ */ import_react34.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react34.default.createElement(Static, { items }, (item) => /* @__PURE__ */ import_react34.default.createElement(Text, { key: item.id }, item.content)), live ? /* @__PURE__ */ import_react34.default.createElement(Text, null, live) : null, /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, "\u2500".repeat(process.stdout.columns || 80)), inputEnabled ? /* @__PURE__ */ import_react34.default.createElement(Box_default, null, /* @__PURE__ */ import_react34.default.createElement(Text, null, prompt2), /* @__PURE__ */ import_react34.default.createElement(Text, null, line), /* @__PURE__ */ import_react34.default.createElement(Text, { inverse: true }, " ")) : /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, " (working\u2026)"), /* @__PURE__ */ import_react34.default.createElement(Text, { dimColor: true }, footerText(footer)));
62409
+ return /* @__PURE__ */ import_react35.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react35.default.createElement(Static, { items }, (item) => /* @__PURE__ */ import_react35.default.createElement(Text, { key: item.id }, item.content)), live ? /* @__PURE__ */ import_react35.default.createElement(Text, null, live) : null, /* @__PURE__ */ import_react35.default.createElement(Text, { dimColor: true }, "\u2500".repeat(process.stdout.columns || 80)), inputEnabled ? /* @__PURE__ */ import_react35.default.createElement(Box_default, null, /* @__PURE__ */ import_react35.default.createElement(Text, null, prompt2), /* @__PURE__ */ import_react35.default.createElement(Text, null, line), /* @__PURE__ */ import_react35.default.createElement(Text, { inverse: true }, " ")) : /* @__PURE__ */ import_react35.default.createElement(Text, { dimColor: true }, " (working\u2026)"), /* @__PURE__ */ import_react35.default.createElement(Text, { dimColor: true }, footerText(footer)));
62304
62410
  };
62305
62411
  function startInkTerminal() {
62306
62412
  if (handle)
62307
62413
  return Promise.resolve(handle);
62308
62414
  return new Promise((resolve3) => {
62309
62415
  inkInstance = render_default(
62310
- /* @__PURE__ */ import_react34.default.createElement(
62416
+ /* @__PURE__ */ import_react35.default.createElement(
62311
62417
  App2,
62312
62418
  {
62313
62419
  onReady: (h2) => {
@@ -62370,7 +62476,7 @@ var InkReadlineAdapter = class extends EventEmitter3 {
62370
62476
  };
62371
62477
 
62372
62478
  // src/commands/chat.ts
62373
- var CLI_VERSION = "0.5.41";
62479
+ var CLI_VERSION = "0.5.43";
62374
62480
  var MODEL_LABELS = {
62375
62481
  turbo: "Nexrall Turbo",
62376
62482
  pro: "Nexrall Pro",
@@ -62431,7 +62537,7 @@ var NEXRALL_MD_CANDIDATES = [
62431
62537
  ];
62432
62538
  var tryRead = (p) => {
62433
62539
  try {
62434
- return fs7.existsSync(p) ? fs7.readFileSync(p, "utf-8").trim() : null;
62540
+ return fs8.existsSync(p) ? fs8.readFileSync(p, "utf-8").trim() : null;
62435
62541
  } catch {
62436
62542
  return null;
62437
62543
  }
@@ -62441,12 +62547,12 @@ function readNexrallMd(workDir) {
62441
62547
  const memContent = (0, import_code_core3.readAllMemory)(workDir);
62442
62548
  if (memContent)
62443
62549
  parts.push(memContent);
62444
- const globalContent = tryRead(path3.join(os5.homedir(), ".nexrall", "nexrall.md"));
62550
+ const globalContent = tryRead(path4.join(os5.homedir(), ".nexrall", "nexrall.md"));
62445
62551
  if (globalContent)
62446
62552
  parts.push(`[Global instructions]
62447
62553
  ${globalContent}`);
62448
62554
  for (const candidate of NEXRALL_MD_CANDIDATES) {
62449
- const content = tryRead(path3.join(workDir, candidate));
62555
+ const content = tryRead(path4.join(workDir, candidate));
62450
62556
  if (content) {
62451
62557
  parts.push(`[Project instructions \u2014 ${candidate}]
62452
62558
  ${content}`);
@@ -62825,14 +62931,34 @@ async function startChatSession(options) {
62825
62931
  const headless = options.outputFormat === "json" || options.outputFormat === "stream-json";
62826
62932
  const { workDir } = options;
62827
62933
  let modelAlias = options.model;
62934
+ const canPrompt = !headless && !options.prompt && !options.stdinText && process.stdin.isTTY === true && process.stdout.isTTY === true;
62935
+ if (!trustGrantedByEnv()) {
62936
+ if (!canPrompt) {
62937
+ process.stderr.write(
62938
+ `Refusing to run in an unconfirmed folder:
62939
+ ${workDir}
62940
+
62941
+ This folder can configure the agent (.nexrall/mcp.json can run local commands, nexrall.md steers the agent).
62942
+ Set ${TRUST_ENV_VAR}=1 to confirm non-interactively, or run \`nex\` interactively here to review it.
62943
+ `
62944
+ );
62945
+ process.exit(1);
62946
+ }
62947
+ const signals = detectTrustSignals(workDir);
62948
+ const trusted = await askForTrust(workDir, signals);
62949
+ if (!trusted) {
62950
+ await new Promise((r2) => setImmediate(r2));
62951
+ process.stdout.write("Not trusted \u2014 exiting without loading this folder.\n");
62952
+ process.exit(0);
62953
+ }
62954
+ }
62828
62955
  const env3 = collectEnv(workDir);
62829
62956
  const nexrallMd = readNexrallMd(workDir);
62830
62957
  const interactive = !headless && !options.prompt && !options.stdinText;
62831
62958
  if (interactive) {
62832
- enableAltScreen();
62959
+ prepareSessionScreen();
62833
62960
  process.on("exit", () => {
62834
62961
  stopInkTerminal();
62835
- disableAltScreen();
62836
62962
  });
62837
62963
  await startInkTerminal();
62838
62964
  }
@@ -63131,7 +63257,7 @@ ${text}` : "");
63131
63257
  messages = messages.slice(0, res.messageIndex);
63132
63258
  console.log(source_default.green(` Rewound to #${id}: restored ${res.restored.length} file(s), ${messages.length} messages kept.`));
63133
63259
  for (const p of res.restored)
63134
- console.log(source_default.dim(" \u21A9 " + path3.relative(workDir, p)));
63260
+ console.log(source_default.dim(" \u21A9 " + path4.relative(workDir, p)));
63135
63261
  if (res.bashCount > 0) {
63136
63262
  console.log(source_default.yellow(` \u26A0 ${res.bashCount} shell command(s) ran in the rewound turns \u2014 their side effects were NOT undone.`));
63137
63263
  for (const h2 of res.gitStashHashes) {
@@ -63189,8 +63315,8 @@ ${summaryText}` }] },
63189
63315
  return;
63190
63316
  }
63191
63317
  case "/init": {
63192
- const nexrallMdPath = path3.join(workDir, "nexrall.md");
63193
- if (fs7.existsSync(nexrallMdPath)) {
63318
+ const nexrallMdPath = path4.join(workDir, "nexrall.md");
63319
+ if (fs8.existsSync(nexrallMdPath)) {
63194
63320
  const answer = await new Promise((resolve3) => rl.question(source_default.yellow(" nexrall.md already exists. Overwrite? [y/n] "), (a) => resolve3(a.trim())));
63195
63321
  if (answer !== "y" && answer !== "yes") {
63196
63322
  console.log(source_default.dim(" Cancelled."));
@@ -63198,8 +63324,8 @@ ${summaryText}` }] },
63198
63324
  return;
63199
63325
  }
63200
63326
  }
63201
- const readme = tryRead(path3.join(workDir, "README.md"))?.slice(0, 2e3) ?? "";
63202
- const pkgJson = tryRead(path3.join(workDir, "package.json"))?.slice(0, 1e3) ?? "";
63327
+ const readme = tryRead(path4.join(workDir, "README.md"))?.slice(0, 2e3) ?? "";
63328
+ const pkgJson = tryRead(path4.join(workDir, "package.json"))?.slice(0, 1e3) ?? "";
63203
63329
  const dirList = tryExec("ls -la", workDir)?.slice(0, 500) ?? "";
63204
63330
  const initPrompt = `Analyze this project and write a concise nexrall.md (project-specific instructions for an AI coding assistant).
63205
63331
  Include: project overview, tech stack, coding conventions, important files/folders, what to avoid.
@@ -63231,7 +63357,7 @@ ${dirList}`;
63231
63357
  agentRunning = false;
63232
63358
  const content = [...r2.messages].reverse().find((m2) => m2.role === "assistant")?.content[0]?.text ?? "";
63233
63359
  if (content) {
63234
- fs7.writeFileSync(nexrallMdPath, content, "utf-8");
63360
+ fs8.writeFileSync(nexrallMdPath, content, "utf-8");
63235
63361
  console.log(source_default.green(` nexrall.md written to ${nexrallMdPath}`));
63236
63362
  }
63237
63363
  } catch (err) {
@@ -63348,10 +63474,10 @@ ${dirList}`;
63348
63474
  rl.prompt();
63349
63475
  return;
63350
63476
  }
63351
- const filePath = path3.isAbsolute(arg) ? arg : path3.join(workDir, arg);
63477
+ const filePath = path4.isAbsolute(arg) ? arg : path4.join(workDir, arg);
63352
63478
  try {
63353
- const content = fs7.readFileSync(filePath, "utf-8");
63354
- const rel = path3.relative(workDir, filePath);
63479
+ const content = fs8.readFileSync(filePath, "utf-8");
63480
+ const rel = path4.relative(workDir, filePath);
63355
63481
  messages.push(
63356
63482
  { role: "user", content: [{ type: "text", text: `Content of \`${rel}\`:
63357
63483
  \`\`\`
@@ -63379,8 +63505,8 @@ ${content}
63379
63505
  }
63380
63506
  const [rawPath, ...captionParts] = arg.split(/\s+/);
63381
63507
  const caption = captionParts.join(" ").trim();
63382
- const filePath = path3.isAbsolute(rawPath) ? rawPath : path3.join(workDir, rawPath);
63383
- const ext = path3.extname(filePath).toLowerCase();
63508
+ const filePath = path4.isAbsolute(rawPath) ? rawPath : path4.join(workDir, rawPath);
63509
+ const ext = path4.extname(filePath).toLowerCase();
63384
63510
  const IMAGE_MIME = {
63385
63511
  ".png": "image/png",
63386
63512
  ".jpg": "image/jpeg",
@@ -63397,7 +63523,7 @@ ${content}
63397
63523
  }
63398
63524
  let buf;
63399
63525
  try {
63400
- buf = fs7.readFileSync(filePath);
63526
+ buf = fs8.readFileSync(filePath);
63401
63527
  } catch (err) {
63402
63528
  console.error(source_default.red(" Failed: ") + String(err.message));
63403
63529
  rl.prompt();
@@ -63409,7 +63535,7 @@ ${content}
63409
63535
  rl.prompt();
63410
63536
  return;
63411
63537
  }
63412
- const rel = path3.relative(workDir, filePath);
63538
+ const rel = path4.relative(workDir, filePath);
63413
63539
  const data = buf.toString("base64");
63414
63540
  const label = caption ? `[Attached: ${rel}]
63415
63541
  ${caption}` : `[Attached: ${rel}]`;
@@ -63471,6 +63597,27 @@ ${caption}` : `[Attached: ${rel}]`;
63471
63597
  rl.prompt();
63472
63598
  return;
63473
63599
  }
63600
+ case "/trust": {
63601
+ console.log();
63602
+ console.log(source_default.bold(" Workspace trust:"));
63603
+ console.log(source_default.dim(` ${workDir}`));
63604
+ const signals = detectTrustSignals(workDir);
63605
+ console.log();
63606
+ if (signals.length) {
63607
+ console.log(source_default.dim(" This folder configures the agent:"));
63608
+ for (const s2 of signals)
63609
+ console.log(source_default.dim(` \u2022 ${s2}`));
63610
+ } else {
63611
+ console.log(source_default.dim(" This folder contains no agent configuration files."));
63612
+ }
63613
+ console.log();
63614
+ console.log(
63615
+ source_default.dim(" You confirmed this folder when the session started. ") + source_default.dim("Trust is not saved \u2014 you will be asked again next time, so a\n ") + source_default.dim("newly added .nexrall/mcp.json can never run un-announced.")
63616
+ );
63617
+ console.log();
63618
+ rl.prompt();
63619
+ return;
63620
+ }
63474
63621
  case "/agents": {
63475
63622
  console.log();
63476
63623
  console.log(source_default.bold(" Sub-agent types (used by the `task` tool):"));
@@ -63776,7 +63923,7 @@ function pluginListCommand() {
63776
63923
 
63777
63924
  // src/index.ts
63778
63925
  var program2 = new Command();
63779
- program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.41");
63926
+ program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.43");
63780
63927
  program2.command("auth").description("Login to your Nexrall account").action(authCommand);
63781
63928
  program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
63782
63929
  program2.command("update").description("Update nex to the latest version").option("-c, --check", "Check for updates without installing").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
@@ -63843,7 +63990,7 @@ program2.option("-p, --pro", "Use Nexrall Pro (Claude Opus, most capable)").opti
63843
63990
  process.exit(1);
63844
63991
  }
63845
63992
  const model = options.model ? options.model : options.ultra ? "ultra" : options.pro ? "pro" : options.turbo ? "turbo" : "turbo";
63846
- const workDir = options.dir ? path4.resolve(options.dir) : process.cwd();
63993
+ const workDir = options.dir ? path5.resolve(options.dir) : process.cwd();
63847
63994
  if (options.yolo)
63848
63995
  setAutoApprove("all");
63849
63996
  const resume = options.resume === true ? "last" : typeof options.resume === "string" ? options.resume : void 0;