@agenit/cli 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/cli.js +371 -278
  3. package/package.json +25 -3
package/cli.js CHANGED
@@ -148,8 +148,8 @@ var init_soul = __esm({
148
148
  "use strict";
149
149
  SoulEngine = class {
150
150
  path;
151
- constructor(path55) {
152
- this.path = path55;
151
+ constructor(path56) {
152
+ this.path = path56;
153
153
  }
154
154
  async load() {
155
155
  return await fs2.readFile(this.path, "utf8");
@@ -1529,14 +1529,14 @@ var require_url_state_machine = __commonJS({
1529
1529
  return url.replace(/\u0009|\u000A|\u000D/g, "");
1530
1530
  }
1531
1531
  function shortenPath(url) {
1532
- const path55 = url.path;
1533
- if (path55.length === 0) {
1532
+ const path56 = url.path;
1533
+ if (path56.length === 0) {
1534
1534
  return;
1535
1535
  }
1536
- if (url.scheme === "file" && path55.length === 1 && isNormalizedWindowsDriveLetter(path55[0])) {
1536
+ if (url.scheme === "file" && path56.length === 1 && isNormalizedWindowsDriveLetter(path56[0])) {
1537
1537
  return;
1538
1538
  }
1539
- path55.pop();
1539
+ path56.pop();
1540
1540
  }
1541
1541
  function includesCredentials(url) {
1542
1542
  return url.username !== "" || url.password !== "";
@@ -7117,14 +7117,14 @@ __export(fileFromPath_exports, {
7117
7117
  });
7118
7118
  import { statSync, createReadStream, promises as fs9 } from "fs";
7119
7119
  import { basename } from "path";
7120
- function createFileFromPath(path55, { mtimeMs, size }, filenameOrOptions, options = {}) {
7120
+ function createFileFromPath(path56, { mtimeMs, size }, filenameOrOptions, options = {}) {
7121
7121
  let filename;
7122
7122
  if (isPlainObject_default2(filenameOrOptions)) {
7123
7123
  [options, filename] = [filenameOrOptions, void 0];
7124
7124
  } else {
7125
7125
  filename = filenameOrOptions;
7126
7126
  }
7127
- const file = new FileFromPath({ path: path55, size, lastModified: mtimeMs });
7127
+ const file = new FileFromPath({ path: path56, size, lastModified: mtimeMs });
7128
7128
  if (!filename) {
7129
7129
  filename = file.name;
7130
7130
  }
@@ -7133,13 +7133,13 @@ function createFileFromPath(path55, { mtimeMs, size }, filenameOrOptions, option
7133
7133
  lastModified: file.lastModified
7134
7134
  });
7135
7135
  }
7136
- function fileFromPathSync(path55, filenameOrOptions, options = {}) {
7137
- const stats = statSync(path55);
7138
- return createFileFromPath(path55, stats, filenameOrOptions, options);
7136
+ function fileFromPathSync(path56, filenameOrOptions, options = {}) {
7137
+ const stats = statSync(path56);
7138
+ return createFileFromPath(path56, stats, filenameOrOptions, options);
7139
7139
  }
7140
- async function fileFromPath2(path55, filenameOrOptions, options) {
7141
- const stats = await fs9.stat(path55);
7142
- return createFileFromPath(path55, stats, filenameOrOptions, options);
7140
+ async function fileFromPath2(path56, filenameOrOptions, options) {
7141
+ const stats = await fs9.stat(path56);
7142
+ return createFileFromPath(path56, stats, filenameOrOptions, options);
7143
7143
  }
7144
7144
  var import_node_domexception, __classPrivateFieldSet4, __classPrivateFieldGet5, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath;
7145
7145
  var init_fileFromPath = __esm({
@@ -10797,12 +10797,12 @@ var init_esm5 = __esm({
10797
10797
  /**
10798
10798
  * Get the Path object referenced by the string path, resolved from this Path
10799
10799
  */
10800
- resolve(path55) {
10801
- if (!path55) {
10800
+ resolve(path56) {
10801
+ if (!path56) {
10802
10802
  return this;
10803
10803
  }
10804
- const rootPath = this.getRootString(path55);
10805
- const dir = path55.substring(rootPath.length);
10804
+ const rootPath = this.getRootString(path56);
10805
+ const dir = path56.substring(rootPath.length);
10806
10806
  const dirParts = dir.split(this.splitSep);
10807
10807
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
10808
10808
  return result;
@@ -11554,8 +11554,8 @@ var init_esm5 = __esm({
11554
11554
  /**
11555
11555
  * @internal
11556
11556
  */
11557
- getRootString(path55) {
11558
- return win32.parse(path55).root;
11557
+ getRootString(path56) {
11558
+ return win32.parse(path56).root;
11559
11559
  }
11560
11560
  /**
11561
11561
  * @internal
@@ -11601,8 +11601,8 @@ var init_esm5 = __esm({
11601
11601
  /**
11602
11602
  * @internal
11603
11603
  */
11604
- getRootString(path55) {
11605
- return path55.startsWith("/") ? "/" : "";
11604
+ getRootString(path56) {
11605
+ return path56.startsWith("/") ? "/" : "";
11606
11606
  }
11607
11607
  /**
11608
11608
  * @internal
@@ -11651,8 +11651,8 @@ var init_esm5 = __esm({
11651
11651
  *
11652
11652
  * @internal
11653
11653
  */
11654
- constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs54 = defaultFS } = {}) {
11655
- this.#fs = fsFromOption(fs54);
11654
+ constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs55 = defaultFS } = {}) {
11655
+ this.#fs = fsFromOption(fs55);
11656
11656
  if (cwd instanceof URL || cwd.startsWith("file://")) {
11657
11657
  cwd = fileURLToPath(cwd);
11658
11658
  }
@@ -11691,11 +11691,11 @@ var init_esm5 = __esm({
11691
11691
  /**
11692
11692
  * Get the depth of a provided path, string, or the cwd
11693
11693
  */
11694
- depth(path55 = this.cwd) {
11695
- if (typeof path55 === "string") {
11696
- path55 = this.cwd.resolve(path55);
11694
+ depth(path56 = this.cwd) {
11695
+ if (typeof path56 === "string") {
11696
+ path56 = this.cwd.resolve(path56);
11697
11697
  }
11698
- return path55.depth();
11698
+ return path56.depth();
11699
11699
  }
11700
11700
  /**
11701
11701
  * Return the cache of child entries. Exposed so subclasses can create
@@ -12182,9 +12182,9 @@ var init_esm5 = __esm({
12182
12182
  process2();
12183
12183
  return results;
12184
12184
  }
12185
- chdir(path55 = this.cwd) {
12185
+ chdir(path56 = this.cwd) {
12186
12186
  const oldCwd = this.cwd;
12187
- this.cwd = typeof path55 === "string" ? this.cwd.resolve(path55) : path55;
12187
+ this.cwd = typeof path56 === "string" ? this.cwd.resolve(path56) : path56;
12188
12188
  this.cwd[setAsCwd](oldCwd);
12189
12189
  }
12190
12190
  };
@@ -12210,8 +12210,8 @@ var init_esm5 = __esm({
12210
12210
  /**
12211
12211
  * @internal
12212
12212
  */
12213
- newRoot(fs54) {
12214
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs54 });
12213
+ newRoot(fs55) {
12214
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs55 });
12215
12215
  }
12216
12216
  /**
12217
12217
  * Return true if the provided path string is an absolute path
@@ -12239,8 +12239,8 @@ var init_esm5 = __esm({
12239
12239
  /**
12240
12240
  * @internal
12241
12241
  */
12242
- newRoot(fs54) {
12243
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs54 });
12242
+ newRoot(fs55) {
12243
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs55 });
12244
12244
  }
12245
12245
  /**
12246
12246
  * Return true if the provided path string is an absolute path
@@ -12559,8 +12559,8 @@ var init_processor = __esm({
12559
12559
  }
12560
12560
  // match, absolute, ifdir
12561
12561
  entries() {
12562
- return [...this.store.entries()].map(([path55, n2]) => [
12563
- path55,
12562
+ return [...this.store.entries()].map(([path56, n2]) => [
12563
+ path56,
12564
12564
  !!(n2 & 2),
12565
12565
  !!(n2 & 1)
12566
12566
  ]);
@@ -12773,9 +12773,9 @@ var init_walker = __esm({
12773
12773
  signal;
12774
12774
  maxDepth;
12775
12775
  includeChildMatches;
12776
- constructor(patterns, path55, opts) {
12776
+ constructor(patterns, path56, opts) {
12777
12777
  this.patterns = patterns;
12778
- this.path = path55;
12778
+ this.path = path56;
12779
12779
  this.opts = opts;
12780
12780
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
12781
12781
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -12794,11 +12794,11 @@ var init_walker = __esm({
12794
12794
  });
12795
12795
  }
12796
12796
  }
12797
- #ignored(path55) {
12798
- return this.seen.has(path55) || !!this.#ignore?.ignored?.(path55);
12797
+ #ignored(path56) {
12798
+ return this.seen.has(path56) || !!this.#ignore?.ignored?.(path56);
12799
12799
  }
12800
- #childrenIgnored(path55) {
12801
- return !!this.#ignore?.childrenIgnored?.(path55);
12800
+ #childrenIgnored(path56) {
12801
+ return !!this.#ignore?.childrenIgnored?.(path56);
12802
12802
  }
12803
12803
  // backpressure mechanism
12804
12804
  pause() {
@@ -13013,8 +13013,8 @@ var init_walker = __esm({
13013
13013
  };
13014
13014
  GlobWalker = class extends GlobUtil {
13015
13015
  matches = /* @__PURE__ */ new Set();
13016
- constructor(patterns, path55, opts) {
13017
- super(patterns, path55, opts);
13016
+ constructor(patterns, path56, opts) {
13017
+ super(patterns, path56, opts);
13018
13018
  }
13019
13019
  matchEmit(e2) {
13020
13020
  this.matches.add(e2);
@@ -13051,8 +13051,8 @@ var init_walker = __esm({
13051
13051
  };
13052
13052
  GlobStream = class extends GlobUtil {
13053
13053
  results;
13054
- constructor(patterns, path55, opts) {
13055
- super(patterns, path55, opts);
13054
+ constructor(patterns, path56, opts) {
13055
+ super(patterns, path56, opts);
13056
13056
  this.results = new Minipass({
13057
13057
  signal: this.signal,
13058
13058
  objectMode: true
@@ -14062,7 +14062,7 @@ var init_esm7 = __esm({
14062
14062
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
14063
14063
  const statMethod = opts.lstat ? lstat2 : stat;
14064
14064
  if (wantBigintFsStats) {
14065
- this._stat = (path55) => statMethod(path55, { bigint: true });
14065
+ this._stat = (path56) => statMethod(path56, { bigint: true });
14066
14066
  } else {
14067
14067
  this._stat = statMethod;
14068
14068
  }
@@ -14087,8 +14087,8 @@ var init_esm7 = __esm({
14087
14087
  const par = this.parent;
14088
14088
  const fil = par && par.files;
14089
14089
  if (fil && fil.length > 0) {
14090
- const { path: path55, depth } = par;
14091
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path55));
14090
+ const { path: path56, depth } = par;
14091
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path56));
14092
14092
  const awaited = await Promise.all(slice);
14093
14093
  for (const entry of awaited) {
14094
14094
  if (!entry)
@@ -14128,20 +14128,20 @@ var init_esm7 = __esm({
14128
14128
  this.reading = false;
14129
14129
  }
14130
14130
  }
14131
- async _exploreDir(path55, depth) {
14131
+ async _exploreDir(path56, depth) {
14132
14132
  let files;
14133
14133
  try {
14134
- files = await readdir2(path55, this._rdOptions);
14134
+ files = await readdir2(path56, this._rdOptions);
14135
14135
  } catch (error) {
14136
14136
  this._onError(error);
14137
14137
  }
14138
- return { files, depth, path: path55 };
14138
+ return { files, depth, path: path56 };
14139
14139
  }
14140
- async _formatEntry(dirent, path55) {
14140
+ async _formatEntry(dirent, path56) {
14141
14141
  let entry;
14142
14142
  const basename4 = this._isDirent ? dirent.name : dirent;
14143
14143
  try {
14144
- const fullPath = presolve(pjoin(path55, basename4));
14144
+ const fullPath = presolve(pjoin(path56, basename4));
14145
14145
  entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
14146
14146
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
14147
14147
  } catch (err) {
@@ -14202,16 +14202,16 @@ import { watchFile, unwatchFile, watch as fs_watch } from "fs";
14202
14202
  import { open, stat as stat2, lstat as lstat3, realpath as fsrealpath } from "fs/promises";
14203
14203
  import * as sysPath from "path";
14204
14204
  import { type as osType } from "os";
14205
- function createFsWatchInstance(path55, options, listener, errHandler, emitRaw) {
14205
+ function createFsWatchInstance(path56, options, listener, errHandler, emitRaw) {
14206
14206
  const handleEvent = (rawEvent, evPath) => {
14207
- listener(path55);
14208
- emitRaw(rawEvent, evPath, { watchedPath: path55 });
14209
- if (evPath && path55 !== evPath) {
14210
- fsWatchBroadcast(sysPath.resolve(path55, evPath), KEY_LISTENERS, sysPath.join(path55, evPath));
14207
+ listener(path56);
14208
+ emitRaw(rawEvent, evPath, { watchedPath: path56 });
14209
+ if (evPath && path56 !== evPath) {
14210
+ fsWatchBroadcast(sysPath.resolve(path56, evPath), KEY_LISTENERS, sysPath.join(path56, evPath));
14211
14211
  }
14212
14212
  };
14213
14213
  try {
14214
- return fs_watch(path55, {
14214
+ return fs_watch(path56, {
14215
14215
  persistent: options.persistent
14216
14216
  }, handleEvent);
14217
14217
  } catch (error) {
@@ -14555,12 +14555,12 @@ var init_handler = __esm({
14555
14555
  listener(val1, val2, val3);
14556
14556
  });
14557
14557
  };
14558
- setFsWatchListener = (path55, fullPath, options, handlers) => {
14558
+ setFsWatchListener = (path56, fullPath, options, handlers) => {
14559
14559
  const { listener, errHandler, rawEmitter } = handlers;
14560
14560
  let cont = FsWatchInstances.get(fullPath);
14561
14561
  let watcher;
14562
14562
  if (!options.persistent) {
14563
- watcher = createFsWatchInstance(path55, options, listener, errHandler, rawEmitter);
14563
+ watcher = createFsWatchInstance(path56, options, listener, errHandler, rawEmitter);
14564
14564
  if (!watcher)
14565
14565
  return;
14566
14566
  return watcher.close.bind(watcher);
@@ -14571,7 +14571,7 @@ var init_handler = __esm({
14571
14571
  addAndConvert(cont, KEY_RAW, rawEmitter);
14572
14572
  } else {
14573
14573
  watcher = createFsWatchInstance(
14574
- path55,
14574
+ path56,
14575
14575
  options,
14576
14576
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
14577
14577
  errHandler,
@@ -14586,7 +14586,7 @@ var init_handler = __esm({
14586
14586
  cont.watcherUnusable = true;
14587
14587
  if (isWindows && error.code === "EPERM") {
14588
14588
  try {
14589
- const fd = await open(path55, "r");
14589
+ const fd = await open(path56, "r");
14590
14590
  await fd.close();
14591
14591
  broadcastErr(error);
14592
14592
  } catch (err) {
@@ -14617,7 +14617,7 @@ var init_handler = __esm({
14617
14617
  };
14618
14618
  };
14619
14619
  FsWatchFileInstances = /* @__PURE__ */ new Map();
14620
- setFsWatchFileListener = (path55, fullPath, options, handlers) => {
14620
+ setFsWatchFileListener = (path56, fullPath, options, handlers) => {
14621
14621
  const { listener, rawEmitter } = handlers;
14622
14622
  let cont = FsWatchFileInstances.get(fullPath);
14623
14623
  const copts = cont && cont.options;
@@ -14639,7 +14639,7 @@ var init_handler = __esm({
14639
14639
  });
14640
14640
  const currmtime = curr.mtimeMs;
14641
14641
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
14642
- foreach(cont.listeners, (listener2) => listener2(path55, curr));
14642
+ foreach(cont.listeners, (listener2) => listener2(path56, curr));
14643
14643
  }
14644
14644
  })
14645
14645
  };
@@ -14667,13 +14667,13 @@ var init_handler = __esm({
14667
14667
  * @param listener on fs change
14668
14668
  * @returns closer for the watcher instance
14669
14669
  */
14670
- _watchWithNodeFs(path55, listener) {
14670
+ _watchWithNodeFs(path56, listener) {
14671
14671
  const opts = this.fsw.options;
14672
- const directory = sysPath.dirname(path55);
14673
- const basename4 = sysPath.basename(path55);
14672
+ const directory = sysPath.dirname(path56);
14673
+ const basename4 = sysPath.basename(path56);
14674
14674
  const parent = this.fsw._getWatchedDir(directory);
14675
14675
  parent.add(basename4);
14676
- const absolutePath = sysPath.resolve(path55);
14676
+ const absolutePath = sysPath.resolve(path56);
14677
14677
  const options = {
14678
14678
  persistent: opts.persistent
14679
14679
  };
@@ -14683,12 +14683,12 @@ var init_handler = __esm({
14683
14683
  if (opts.usePolling) {
14684
14684
  const enableBin = opts.interval !== opts.binaryInterval;
14685
14685
  options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
14686
- closer = setFsWatchFileListener(path55, absolutePath, options, {
14686
+ closer = setFsWatchFileListener(path56, absolutePath, options, {
14687
14687
  listener,
14688
14688
  rawEmitter: this.fsw._emitRaw
14689
14689
  });
14690
14690
  } else {
14691
- closer = setFsWatchListener(path55, absolutePath, options, {
14691
+ closer = setFsWatchListener(path56, absolutePath, options, {
14692
14692
  listener,
14693
14693
  errHandler: this._boundHandleError,
14694
14694
  rawEmitter: this.fsw._emitRaw
@@ -14710,7 +14710,7 @@ var init_handler = __esm({
14710
14710
  let prevStats = stats;
14711
14711
  if (parent.has(basename4))
14712
14712
  return;
14713
- const listener = async (path55, newStats) => {
14713
+ const listener = async (path56, newStats) => {
14714
14714
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
14715
14715
  return;
14716
14716
  if (!newStats || newStats.mtimeMs === 0) {
@@ -14724,11 +14724,11 @@ var init_handler = __esm({
14724
14724
  this.fsw._emit(EV.CHANGE, file, newStats2);
14725
14725
  }
14726
14726
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
14727
- this.fsw._closeFile(path55);
14727
+ this.fsw._closeFile(path56);
14728
14728
  prevStats = newStats2;
14729
14729
  const closer2 = this._watchWithNodeFs(file, listener);
14730
14730
  if (closer2)
14731
- this.fsw._addPathCloser(path55, closer2);
14731
+ this.fsw._addPathCloser(path56, closer2);
14732
14732
  } else {
14733
14733
  prevStats = newStats2;
14734
14734
  }
@@ -14760,7 +14760,7 @@ var init_handler = __esm({
14760
14760
  * @param item basename of this item
14761
14761
  * @returns true if no more processing is needed for this entry.
14762
14762
  */
14763
- async _handleSymlink(entry, directory, path55, item) {
14763
+ async _handleSymlink(entry, directory, path56, item) {
14764
14764
  if (this.fsw.closed) {
14765
14765
  return;
14766
14766
  }
@@ -14770,7 +14770,7 @@ var init_handler = __esm({
14770
14770
  this.fsw._incrReadyCount();
14771
14771
  let linkPath;
14772
14772
  try {
14773
- linkPath = await fsrealpath(path55);
14773
+ linkPath = await fsrealpath(path56);
14774
14774
  } catch (e2) {
14775
14775
  this.fsw._emitReady();
14776
14776
  return true;
@@ -14780,12 +14780,12 @@ var init_handler = __esm({
14780
14780
  if (dir.has(item)) {
14781
14781
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
14782
14782
  this.fsw._symlinkPaths.set(full, linkPath);
14783
- this.fsw._emit(EV.CHANGE, path55, entry.stats);
14783
+ this.fsw._emit(EV.CHANGE, path56, entry.stats);
14784
14784
  }
14785
14785
  } else {
14786
14786
  dir.add(item);
14787
14787
  this.fsw._symlinkPaths.set(full, linkPath);
14788
- this.fsw._emit(EV.ADD, path55, entry.stats);
14788
+ this.fsw._emit(EV.ADD, path56, entry.stats);
14789
14789
  }
14790
14790
  this.fsw._emitReady();
14791
14791
  return true;
@@ -14814,9 +14814,9 @@ var init_handler = __esm({
14814
14814
  return;
14815
14815
  }
14816
14816
  const item = entry.path;
14817
- let path55 = sysPath.join(directory, item);
14817
+ let path56 = sysPath.join(directory, item);
14818
14818
  current.add(item);
14819
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path55, item)) {
14819
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path56, item)) {
14820
14820
  return;
14821
14821
  }
14822
14822
  if (this.fsw.closed) {
@@ -14825,8 +14825,8 @@ var init_handler = __esm({
14825
14825
  }
14826
14826
  if (item === target || !target && !previous.has(item)) {
14827
14827
  this.fsw._incrReadyCount();
14828
- path55 = sysPath.join(dir, sysPath.relative(dir, path55));
14829
- this._addToNodeFs(path55, initialAdd, wh, depth + 1);
14828
+ path56 = sysPath.join(dir, sysPath.relative(dir, path56));
14829
+ this._addToNodeFs(path56, initialAdd, wh, depth + 1);
14830
14830
  }
14831
14831
  }).on(EV.ERROR, this._boundHandleError);
14832
14832
  return new Promise((resolve3, reject) => {
@@ -14895,13 +14895,13 @@ var init_handler = __esm({
14895
14895
  * @param depth Child path actually targeted for watch
14896
14896
  * @param target Child path actually targeted for watch
14897
14897
  */
14898
- async _addToNodeFs(path55, initialAdd, priorWh, depth, target) {
14898
+ async _addToNodeFs(path56, initialAdd, priorWh, depth, target) {
14899
14899
  const ready = this.fsw._emitReady;
14900
- if (this.fsw._isIgnored(path55) || this.fsw.closed) {
14900
+ if (this.fsw._isIgnored(path56) || this.fsw.closed) {
14901
14901
  ready();
14902
14902
  return false;
14903
14903
  }
14904
- const wh = this.fsw._getWatchHelpers(path55);
14904
+ const wh = this.fsw._getWatchHelpers(path56);
14905
14905
  if (priorWh) {
14906
14906
  wh.filterPath = (entry) => priorWh.filterPath(entry);
14907
14907
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -14917,8 +14917,8 @@ var init_handler = __esm({
14917
14917
  const follow = this.fsw.options.followSymlinks;
14918
14918
  let closer;
14919
14919
  if (stats.isDirectory()) {
14920
- const absPath = sysPath.resolve(path55);
14921
- const targetPath = follow ? await fsrealpath(path55) : path55;
14920
+ const absPath = sysPath.resolve(path56);
14921
+ const targetPath = follow ? await fsrealpath(path56) : path56;
14922
14922
  if (this.fsw.closed)
14923
14923
  return;
14924
14924
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -14928,29 +14928,29 @@ var init_handler = __esm({
14928
14928
  this.fsw._symlinkPaths.set(absPath, targetPath);
14929
14929
  }
14930
14930
  } else if (stats.isSymbolicLink()) {
14931
- const targetPath = follow ? await fsrealpath(path55) : path55;
14931
+ const targetPath = follow ? await fsrealpath(path56) : path56;
14932
14932
  if (this.fsw.closed)
14933
14933
  return;
14934
14934
  const parent = sysPath.dirname(wh.watchPath);
14935
14935
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
14936
14936
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
14937
- closer = await this._handleDir(parent, stats, initialAdd, depth, path55, wh, targetPath);
14937
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path56, wh, targetPath);
14938
14938
  if (this.fsw.closed)
14939
14939
  return;
14940
14940
  if (targetPath !== void 0) {
14941
- this.fsw._symlinkPaths.set(sysPath.resolve(path55), targetPath);
14941
+ this.fsw._symlinkPaths.set(sysPath.resolve(path56), targetPath);
14942
14942
  }
14943
14943
  } else {
14944
14944
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
14945
14945
  }
14946
14946
  ready();
14947
14947
  if (closer)
14948
- this.fsw._addPathCloser(path55, closer);
14948
+ this.fsw._addPathCloser(path56, closer);
14949
14949
  return false;
14950
14950
  } catch (error) {
14951
14951
  if (this.fsw._handleError(error)) {
14952
14952
  ready();
14953
- return path55;
14953
+ return path56;
14954
14954
  }
14955
14955
  }
14956
14956
  }
@@ -14989,26 +14989,26 @@ function createPattern(matcher) {
14989
14989
  }
14990
14990
  return () => false;
14991
14991
  }
14992
- function normalizePath(path55) {
14993
- if (typeof path55 !== "string")
14992
+ function normalizePath(path56) {
14993
+ if (typeof path56 !== "string")
14994
14994
  throw new Error("string expected");
14995
- path55 = sysPath2.normalize(path55);
14996
- path55 = path55.replace(/\\/g, "/");
14995
+ path56 = sysPath2.normalize(path56);
14996
+ path56 = path56.replace(/\\/g, "/");
14997
14997
  let prepend = false;
14998
- if (path55.startsWith("//"))
14998
+ if (path56.startsWith("//"))
14999
14999
  prepend = true;
15000
15000
  const DOUBLE_SLASH_RE2 = /\/\//;
15001
- while (path55.match(DOUBLE_SLASH_RE2))
15002
- path55 = path55.replace(DOUBLE_SLASH_RE2, "/");
15001
+ while (path56.match(DOUBLE_SLASH_RE2))
15002
+ path56 = path56.replace(DOUBLE_SLASH_RE2, "/");
15003
15003
  if (prepend)
15004
- path55 = "/" + path55;
15005
- return path55;
15004
+ path56 = "/" + path56;
15005
+ return path56;
15006
15006
  }
15007
15007
  function matchPatterns(patterns, testString, stats) {
15008
- const path55 = normalizePath(testString);
15008
+ const path56 = normalizePath(testString);
15009
15009
  for (let index2 = 0; index2 < patterns.length; index2++) {
15010
15010
  const pattern = patterns[index2];
15011
- if (pattern(path55, stats)) {
15011
+ if (pattern(path56, stats)) {
15012
15012
  return true;
15013
15013
  }
15014
15014
  }
@@ -15068,19 +15068,19 @@ var init_esm8 = __esm({
15068
15068
  }
15069
15069
  return str;
15070
15070
  };
15071
- normalizePathToUnix = (path55) => toUnix(sysPath2.normalize(toUnix(path55)));
15072
- normalizeIgnored = (cwd = "") => (path55) => {
15073
- if (typeof path55 === "string") {
15074
- return normalizePathToUnix(sysPath2.isAbsolute(path55) ? path55 : sysPath2.join(cwd, path55));
15071
+ normalizePathToUnix = (path56) => toUnix(sysPath2.normalize(toUnix(path56)));
15072
+ normalizeIgnored = (cwd = "") => (path56) => {
15073
+ if (typeof path56 === "string") {
15074
+ return normalizePathToUnix(sysPath2.isAbsolute(path56) ? path56 : sysPath2.join(cwd, path56));
15075
15075
  } else {
15076
- return path55;
15076
+ return path56;
15077
15077
  }
15078
15078
  };
15079
- getAbsolutePath = (path55, cwd) => {
15080
- if (sysPath2.isAbsolute(path55)) {
15081
- return path55;
15079
+ getAbsolutePath = (path56, cwd) => {
15080
+ if (sysPath2.isAbsolute(path56)) {
15081
+ return path56;
15082
15082
  }
15083
- return sysPath2.join(cwd, path55);
15083
+ return sysPath2.join(cwd, path56);
15084
15084
  };
15085
15085
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
15086
15086
  DirEntry = class {
@@ -15135,10 +15135,10 @@ var init_esm8 = __esm({
15135
15135
  STAT_METHOD_F = "stat";
15136
15136
  STAT_METHOD_L = "lstat";
15137
15137
  WatchHelper = class {
15138
- constructor(path55, follow, fsw) {
15138
+ constructor(path56, follow, fsw) {
15139
15139
  this.fsw = fsw;
15140
- const watchPath = path55;
15141
- this.path = path55 = path55.replace(REPLACER_RE, "");
15140
+ const watchPath = path56;
15141
+ this.path = path56 = path56.replace(REPLACER_RE, "");
15142
15142
  this.watchPath = watchPath;
15143
15143
  this.fullWatchPath = sysPath2.resolve(watchPath);
15144
15144
  this.dirParts = [];
@@ -15260,20 +15260,20 @@ var init_esm8 = __esm({
15260
15260
  this._closePromise = void 0;
15261
15261
  let paths = unifyPaths(paths_);
15262
15262
  if (cwd) {
15263
- paths = paths.map((path55) => {
15264
- const absPath = getAbsolutePath(path55, cwd);
15263
+ paths = paths.map((path56) => {
15264
+ const absPath = getAbsolutePath(path56, cwd);
15265
15265
  return absPath;
15266
15266
  });
15267
15267
  }
15268
- paths.forEach((path55) => {
15269
- this._removeIgnoredPath(path55);
15268
+ paths.forEach((path56) => {
15269
+ this._removeIgnoredPath(path56);
15270
15270
  });
15271
15271
  this._userIgnored = void 0;
15272
15272
  if (!this._readyCount)
15273
15273
  this._readyCount = 0;
15274
15274
  this._readyCount += paths.length;
15275
- Promise.all(paths.map(async (path55) => {
15276
- const res = await this._nodeFsHandler._addToNodeFs(path55, !_internal, void 0, 0, _origAdd);
15275
+ Promise.all(paths.map(async (path56) => {
15276
+ const res = await this._nodeFsHandler._addToNodeFs(path56, !_internal, void 0, 0, _origAdd);
15277
15277
  if (res)
15278
15278
  this._emitReady();
15279
15279
  return res;
@@ -15295,17 +15295,17 @@ var init_esm8 = __esm({
15295
15295
  return this;
15296
15296
  const paths = unifyPaths(paths_);
15297
15297
  const { cwd } = this.options;
15298
- paths.forEach((path55) => {
15299
- if (!sysPath2.isAbsolute(path55) && !this._closers.has(path55)) {
15298
+ paths.forEach((path56) => {
15299
+ if (!sysPath2.isAbsolute(path56) && !this._closers.has(path56)) {
15300
15300
  if (cwd)
15301
- path55 = sysPath2.join(cwd, path55);
15302
- path55 = sysPath2.resolve(path55);
15301
+ path56 = sysPath2.join(cwd, path56);
15302
+ path56 = sysPath2.resolve(path56);
15303
15303
  }
15304
- this._closePath(path55);
15305
- this._addIgnoredPath(path55);
15306
- if (this._watched.has(path55)) {
15304
+ this._closePath(path56);
15305
+ this._addIgnoredPath(path56);
15306
+ if (this._watched.has(path56)) {
15307
15307
  this._addIgnoredPath({
15308
- path: path55,
15308
+ path: path56,
15309
15309
  recursive: true
15310
15310
  });
15311
15311
  }
@@ -15369,38 +15369,38 @@ var init_esm8 = __esm({
15369
15369
  * @param stats arguments to be passed with event
15370
15370
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
15371
15371
  */
15372
- async _emit(event, path55, stats) {
15372
+ async _emit(event, path56, stats) {
15373
15373
  if (this.closed)
15374
15374
  return;
15375
15375
  const opts = this.options;
15376
15376
  if (isWindows)
15377
- path55 = sysPath2.normalize(path55);
15377
+ path56 = sysPath2.normalize(path56);
15378
15378
  if (opts.cwd)
15379
- path55 = sysPath2.relative(opts.cwd, path55);
15380
- const args = [path55];
15379
+ path56 = sysPath2.relative(opts.cwd, path56);
15380
+ const args = [path56];
15381
15381
  if (stats != null)
15382
15382
  args.push(stats);
15383
15383
  const awf = opts.awaitWriteFinish;
15384
15384
  let pw;
15385
- if (awf && (pw = this._pendingWrites.get(path55))) {
15385
+ if (awf && (pw = this._pendingWrites.get(path56))) {
15386
15386
  pw.lastChange = /* @__PURE__ */ new Date();
15387
15387
  return this;
15388
15388
  }
15389
15389
  if (opts.atomic) {
15390
15390
  if (event === EVENTS.UNLINK) {
15391
- this._pendingUnlinks.set(path55, [event, ...args]);
15391
+ this._pendingUnlinks.set(path56, [event, ...args]);
15392
15392
  setTimeout(() => {
15393
- this._pendingUnlinks.forEach((entry, path56) => {
15393
+ this._pendingUnlinks.forEach((entry, path57) => {
15394
15394
  this.emit(...entry);
15395
15395
  this.emit(EVENTS.ALL, ...entry);
15396
- this._pendingUnlinks.delete(path56);
15396
+ this._pendingUnlinks.delete(path57);
15397
15397
  });
15398
15398
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
15399
15399
  return this;
15400
15400
  }
15401
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path55)) {
15401
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path56)) {
15402
15402
  event = EVENTS.CHANGE;
15403
- this._pendingUnlinks.delete(path55);
15403
+ this._pendingUnlinks.delete(path56);
15404
15404
  }
15405
15405
  }
15406
15406
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -15418,16 +15418,16 @@ var init_esm8 = __esm({
15418
15418
  this.emitWithAll(event, args);
15419
15419
  }
15420
15420
  };
15421
- this._awaitWriteFinish(path55, awf.stabilityThreshold, event, awfEmit);
15421
+ this._awaitWriteFinish(path56, awf.stabilityThreshold, event, awfEmit);
15422
15422
  return this;
15423
15423
  }
15424
15424
  if (event === EVENTS.CHANGE) {
15425
- const isThrottled = !this._throttle(EVENTS.CHANGE, path55, 50);
15425
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path56, 50);
15426
15426
  if (isThrottled)
15427
15427
  return this;
15428
15428
  }
15429
15429
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
15430
- const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path55) : path55;
15430
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path56) : path56;
15431
15431
  let stats2;
15432
15432
  try {
15433
15433
  stats2 = await stat3(fullPath);
@@ -15458,23 +15458,23 @@ var init_esm8 = __esm({
15458
15458
  * @param timeout duration of time to suppress duplicate actions
15459
15459
  * @returns tracking object or false if action should be suppressed
15460
15460
  */
15461
- _throttle(actionType, path55, timeout) {
15461
+ _throttle(actionType, path56, timeout) {
15462
15462
  if (!this._throttled.has(actionType)) {
15463
15463
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
15464
15464
  }
15465
15465
  const action = this._throttled.get(actionType);
15466
15466
  if (!action)
15467
15467
  throw new Error("invalid throttle");
15468
- const actionPath = action.get(path55);
15468
+ const actionPath = action.get(path56);
15469
15469
  if (actionPath) {
15470
15470
  actionPath.count++;
15471
15471
  return false;
15472
15472
  }
15473
15473
  let timeoutObject;
15474
15474
  const clear2 = () => {
15475
- const item = action.get(path55);
15475
+ const item = action.get(path56);
15476
15476
  const count = item ? item.count : 0;
15477
- action.delete(path55);
15477
+ action.delete(path56);
15478
15478
  clearTimeout(timeoutObject);
15479
15479
  if (item)
15480
15480
  clearTimeout(item.timeoutObject);
@@ -15482,7 +15482,7 @@ var init_esm8 = __esm({
15482
15482
  };
15483
15483
  timeoutObject = setTimeout(clear2, timeout);
15484
15484
  const thr = { timeoutObject, clear: clear2, count: 0 };
15485
- action.set(path55, thr);
15485
+ action.set(path56, thr);
15486
15486
  return thr;
15487
15487
  }
15488
15488
  _incrReadyCount() {
@@ -15496,44 +15496,44 @@ var init_esm8 = __esm({
15496
15496
  * @param event
15497
15497
  * @param awfEmit Callback to be called when ready for event to be emitted.
15498
15498
  */
15499
- _awaitWriteFinish(path55, threshold, event, awfEmit) {
15499
+ _awaitWriteFinish(path56, threshold, event, awfEmit) {
15500
15500
  const awf = this.options.awaitWriteFinish;
15501
15501
  if (typeof awf !== "object")
15502
15502
  return;
15503
15503
  const pollInterval = awf.pollInterval;
15504
15504
  let timeoutHandler;
15505
- let fullPath = path55;
15506
- if (this.options.cwd && !sysPath2.isAbsolute(path55)) {
15507
- fullPath = sysPath2.join(this.options.cwd, path55);
15505
+ let fullPath = path56;
15506
+ if (this.options.cwd && !sysPath2.isAbsolute(path56)) {
15507
+ fullPath = sysPath2.join(this.options.cwd, path56);
15508
15508
  }
15509
15509
  const now = /* @__PURE__ */ new Date();
15510
15510
  const writes = this._pendingWrites;
15511
15511
  function awaitWriteFinishFn(prevStat) {
15512
15512
  statcb(fullPath, (err, curStat) => {
15513
- if (err || !writes.has(path55)) {
15513
+ if (err || !writes.has(path56)) {
15514
15514
  if (err && err.code !== "ENOENT")
15515
15515
  awfEmit(err);
15516
15516
  return;
15517
15517
  }
15518
15518
  const now2 = Number(/* @__PURE__ */ new Date());
15519
15519
  if (prevStat && curStat.size !== prevStat.size) {
15520
- writes.get(path55).lastChange = now2;
15520
+ writes.get(path56).lastChange = now2;
15521
15521
  }
15522
- const pw = writes.get(path55);
15522
+ const pw = writes.get(path56);
15523
15523
  const df = now2 - pw.lastChange;
15524
15524
  if (df >= threshold) {
15525
- writes.delete(path55);
15525
+ writes.delete(path56);
15526
15526
  awfEmit(void 0, curStat);
15527
15527
  } else {
15528
15528
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
15529
15529
  }
15530
15530
  });
15531
15531
  }
15532
- if (!writes.has(path55)) {
15533
- writes.set(path55, {
15532
+ if (!writes.has(path56)) {
15533
+ writes.set(path56, {
15534
15534
  lastChange: now,
15535
15535
  cancelWait: () => {
15536
- writes.delete(path55);
15536
+ writes.delete(path56);
15537
15537
  clearTimeout(timeoutHandler);
15538
15538
  return event;
15539
15539
  }
@@ -15544,8 +15544,8 @@ var init_esm8 = __esm({
15544
15544
  /**
15545
15545
  * Determines whether user has asked to ignore this path.
15546
15546
  */
15547
- _isIgnored(path55, stats) {
15548
- if (this.options.atomic && DOT_RE.test(path55))
15547
+ _isIgnored(path56, stats) {
15548
+ if (this.options.atomic && DOT_RE.test(path56))
15549
15549
  return true;
15550
15550
  if (!this._userIgnored) {
15551
15551
  const { cwd } = this.options;
@@ -15555,17 +15555,17 @@ var init_esm8 = __esm({
15555
15555
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
15556
15556
  this._userIgnored = anymatch(list, void 0);
15557
15557
  }
15558
- return this._userIgnored(path55, stats);
15558
+ return this._userIgnored(path56, stats);
15559
15559
  }
15560
- _isntIgnored(path55, stat4) {
15561
- return !this._isIgnored(path55, stat4);
15560
+ _isntIgnored(path56, stat4) {
15561
+ return !this._isIgnored(path56, stat4);
15562
15562
  }
15563
15563
  /**
15564
15564
  * Provides a set of common helpers and properties relating to symlink handling.
15565
15565
  * @param path file or directory pattern being watched
15566
15566
  */
15567
- _getWatchHelpers(path55) {
15568
- return new WatchHelper(path55, this.options.followSymlinks, this);
15567
+ _getWatchHelpers(path56) {
15568
+ return new WatchHelper(path56, this.options.followSymlinks, this);
15569
15569
  }
15570
15570
  // Directory helpers
15571
15571
  // -----------------
@@ -15597,63 +15597,63 @@ var init_esm8 = __esm({
15597
15597
  * @param item base path of item/directory
15598
15598
  */
15599
15599
  _remove(directory, item, isDirectory) {
15600
- const path55 = sysPath2.join(directory, item);
15601
- const fullPath = sysPath2.resolve(path55);
15602
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path55) || this._watched.has(fullPath);
15603
- if (!this._throttle("remove", path55, 100))
15600
+ const path56 = sysPath2.join(directory, item);
15601
+ const fullPath = sysPath2.resolve(path56);
15602
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path56) || this._watched.has(fullPath);
15603
+ if (!this._throttle("remove", path56, 100))
15604
15604
  return;
15605
15605
  if (!isDirectory && this._watched.size === 1) {
15606
15606
  this.add(directory, item, true);
15607
15607
  }
15608
- const wp = this._getWatchedDir(path55);
15608
+ const wp = this._getWatchedDir(path56);
15609
15609
  const nestedDirectoryChildren = wp.getChildren();
15610
- nestedDirectoryChildren.forEach((nested) => this._remove(path55, nested));
15610
+ nestedDirectoryChildren.forEach((nested) => this._remove(path56, nested));
15611
15611
  const parent = this._getWatchedDir(directory);
15612
15612
  const wasTracked = parent.has(item);
15613
15613
  parent.remove(item);
15614
15614
  if (this._symlinkPaths.has(fullPath)) {
15615
15615
  this._symlinkPaths.delete(fullPath);
15616
15616
  }
15617
- let relPath = path55;
15617
+ let relPath = path56;
15618
15618
  if (this.options.cwd)
15619
- relPath = sysPath2.relative(this.options.cwd, path55);
15619
+ relPath = sysPath2.relative(this.options.cwd, path56);
15620
15620
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
15621
15621
  const event = this._pendingWrites.get(relPath).cancelWait();
15622
15622
  if (event === EVENTS.ADD)
15623
15623
  return;
15624
15624
  }
15625
- this._watched.delete(path55);
15625
+ this._watched.delete(path56);
15626
15626
  this._watched.delete(fullPath);
15627
15627
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
15628
- if (wasTracked && !this._isIgnored(path55))
15629
- this._emit(eventName, path55);
15630
- this._closePath(path55);
15628
+ if (wasTracked && !this._isIgnored(path56))
15629
+ this._emit(eventName, path56);
15630
+ this._closePath(path56);
15631
15631
  }
15632
15632
  /**
15633
15633
  * Closes all watchers for a path
15634
15634
  */
15635
- _closePath(path55) {
15636
- this._closeFile(path55);
15637
- const dir = sysPath2.dirname(path55);
15638
- this._getWatchedDir(dir).remove(sysPath2.basename(path55));
15635
+ _closePath(path56) {
15636
+ this._closeFile(path56);
15637
+ const dir = sysPath2.dirname(path56);
15638
+ this._getWatchedDir(dir).remove(sysPath2.basename(path56));
15639
15639
  }
15640
15640
  /**
15641
15641
  * Closes only file-specific watchers
15642
15642
  */
15643
- _closeFile(path55) {
15644
- const closers = this._closers.get(path55);
15643
+ _closeFile(path56) {
15644
+ const closers = this._closers.get(path56);
15645
15645
  if (!closers)
15646
15646
  return;
15647
15647
  closers.forEach((closer) => closer());
15648
- this._closers.delete(path55);
15648
+ this._closers.delete(path56);
15649
15649
  }
15650
- _addPathCloser(path55, closer) {
15650
+ _addPathCloser(path56, closer) {
15651
15651
  if (!closer)
15652
15652
  return;
15653
- let list = this._closers.get(path55);
15653
+ let list = this._closers.get(path56);
15654
15654
  if (!list) {
15655
15655
  list = [];
15656
- this._closers.set(path55, list);
15656
+ this._closers.set(path56, list);
15657
15657
  }
15658
15658
  list.push(closer);
15659
15659
  }
@@ -37854,8 +37854,8 @@ var require_lib3 = __commonJS({
37854
37854
 
37855
37855
  // src/cli.tsx
37856
37856
  init_dist();
37857
- import { promises as fs53 } from "node:fs";
37858
- import path54 from "node:path";
37857
+ import { promises as fs54 } from "node:fs";
37858
+ import path55 from "node:path";
37859
37859
  import { spawn as spawn17 } from "node:child_process";
37860
37860
  import { render as render2 } from "ink";
37861
37861
  import yargs from "yargs";
@@ -39050,13 +39050,13 @@ var MultipartBody = class {
39050
39050
  // ../../node_modules/.pnpm/@anthropic-ai+sdk@0.30.1/node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs
39051
39051
  import { ReadableStream as ReadableStream3 } from "node:stream/web";
39052
39052
  var fileFromPathWarned = false;
39053
- async function fileFromPath3(path55, ...args) {
39053
+ async function fileFromPath3(path56, ...args) {
39054
39054
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
39055
39055
  if (!fileFromPathWarned) {
39056
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path55)}) instead`);
39056
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path56)}) instead`);
39057
39057
  fileFromPathWarned = true;
39058
39058
  }
39059
- return await _fileFromPath(path55, ...args);
39059
+ return await _fileFromPath(path56, ...args);
39060
39060
  }
39061
39061
  var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
39062
39062
  var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -39655,29 +39655,29 @@ var APIClient = class {
39655
39655
  defaultIdempotencyKey() {
39656
39656
  return `stainless-node-retry-${uuid4()}`;
39657
39657
  }
39658
- get(path55, opts) {
39659
- return this.methodRequest("get", path55, opts);
39658
+ get(path56, opts) {
39659
+ return this.methodRequest("get", path56, opts);
39660
39660
  }
39661
- post(path55, opts) {
39662
- return this.methodRequest("post", path55, opts);
39661
+ post(path56, opts) {
39662
+ return this.methodRequest("post", path56, opts);
39663
39663
  }
39664
- patch(path55, opts) {
39665
- return this.methodRequest("patch", path55, opts);
39664
+ patch(path56, opts) {
39665
+ return this.methodRequest("patch", path56, opts);
39666
39666
  }
39667
- put(path55, opts) {
39668
- return this.methodRequest("put", path55, opts);
39667
+ put(path56, opts) {
39668
+ return this.methodRequest("put", path56, opts);
39669
39669
  }
39670
- delete(path55, opts) {
39671
- return this.methodRequest("delete", path55, opts);
39670
+ delete(path56, opts) {
39671
+ return this.methodRequest("delete", path56, opts);
39672
39672
  }
39673
- methodRequest(method, path55, opts) {
39673
+ methodRequest(method, path56, opts) {
39674
39674
  return this.request(Promise.resolve(opts).then(async (opts2) => {
39675
39675
  const body = opts2 && isBlobLike(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
39676
- return { method, path: path55, ...opts2, body };
39676
+ return { method, path: path56, ...opts2, body };
39677
39677
  }));
39678
39678
  }
39679
- getAPIList(path55, Page2, opts) {
39680
- return this.requestAPIList(Page2, { method: "get", path: path55, ...opts });
39679
+ getAPIList(path56, Page2, opts) {
39680
+ return this.requestAPIList(Page2, { method: "get", path: path56, ...opts });
39681
39681
  }
39682
39682
  calculateContentLength(body) {
39683
39683
  if (typeof body === "string") {
@@ -39695,10 +39695,10 @@ var APIClient = class {
39695
39695
  return null;
39696
39696
  }
39697
39697
  buildRequest(options, { retryCount = 0 } = {}) {
39698
- const { method, path: path55, query, headers = {} } = options;
39698
+ const { method, path: path56, query, headers = {} } = options;
39699
39699
  const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
39700
39700
  const contentLength = this.calculateContentLength(body);
39701
- const url = this.buildURL(path55, query);
39701
+ const url = this.buildURL(path56, query);
39702
39702
  if ("timeout" in options)
39703
39703
  validatePositiveInteger("timeout", options.timeout);
39704
39704
  const timeout = options.timeout ?? this.timeout;
@@ -39811,8 +39811,8 @@ var APIClient = class {
39811
39811
  const request = this.makeRequest(options, null);
39812
39812
  return new PagePromise(this, request, Page2);
39813
39813
  }
39814
- buildURL(path55, query) {
39815
- const url = isAbsoluteURL(path55) ? new URL(path55) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path55.startsWith("/") ? path55.slice(1) : path55));
39814
+ buildURL(path56, query) {
39815
+ const url = isAbsoluteURL(path56) ? new URL(path56) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path56.startsWith("/") ? path56.slice(1) : path56));
39816
39816
  const defaultQuery = this.defaultQuery();
39817
39817
  if (!isEmptyObj(defaultQuery)) {
39818
39818
  query = { ...defaultQuery, ...query };
@@ -47813,8 +47813,8 @@ import path29 from "node:path";
47813
47813
  var GoalLock = class _GoalLock {
47814
47814
  path;
47815
47815
  released = false;
47816
- constructor(path55) {
47817
- this.path = path55;
47816
+ constructor(path56) {
47817
+ this.path = path56;
47818
47818
  }
47819
47819
  /**
47820
47820
  * Try to acquire the lock, polling every 50 ms up to `timeoutMs`. If a
@@ -48016,13 +48016,13 @@ async function gitChangedFiles(workspace) {
48016
48016
  return out.stdout.split("\n").map(parsePorcelainLine).filter((p2) => p2 !== null);
48017
48017
  }
48018
48018
  function parsePorcelainLine(line) {
48019
- const path55 = line.slice(3).trim();
48020
- if (!path55)
48019
+ const path56 = line.slice(3).trim();
48020
+ if (!path56)
48021
48021
  return null;
48022
- const renameIdx = path55.indexOf(" -> ");
48022
+ const renameIdx = path56.indexOf(" -> ");
48023
48023
  if (renameIdx >= 0)
48024
- return path55.slice(renameIdx + 4);
48025
- return path55;
48024
+ return path56.slice(renameIdx + 4);
48025
+ return path56;
48026
48026
  }
48027
48027
  function countTestChanges(files) {
48028
48028
  return files.filter(isTestPath).length;
@@ -51349,6 +51349,11 @@ var speckitCommand = {
51349
51349
 
51350
51350
  // src/commands/feature.ts
51351
51351
  import chalk24 from "chalk";
51352
+ function setOuterStage(label) {
51353
+ tuiBus.update((s2) => {
51354
+ s2.status.stage = label;
51355
+ });
51356
+ }
51352
51357
  var featureCommand = {
51353
51358
  name: "feature",
51354
51359
  description: "End-to-end feature pipeline: speckit run \u2192 export-to-swe1 \u2192 squad implement \u2192 tests \u2192 audit",
@@ -51367,6 +51372,7 @@ var featureCommand = {
51367
51372
  log += `### 1/7 \u2014 Spec-Kit pipeline
51368
51373
 
51369
51374
  `;
51375
+ setOuterStage("Spec-Kit (specify \u2192 plan \u2192 tasks)");
51370
51376
  try {
51371
51377
  const speckitLog = await speckitCommand.execute(`run ${task}`, state, cfg);
51372
51378
  log += `${speckitLog}
@@ -51390,6 +51396,7 @@ var featureCommand = {
51390
51396
  log += `### 2/7 \u2014 Export to SWE.1 requirements
51391
51397
 
51392
51398
  `;
51399
+ setOuterStage("Export spec \u2192 SWE.1");
51393
51400
  try {
51394
51401
  const exportLog = await speckitCommand.execute(`export-to-swe1 ${fid}`, state, cfg);
51395
51402
  log += `${exportLog}
@@ -53733,7 +53740,17 @@ function App({
53733
53740
  const [tuiState, setTuiState] = useState(tuiBus.get());
53734
53741
  const [picker, setPicker] = useState(null);
53735
53742
  const nextId = useRef(1);
53736
- const cols = stdout?.columns ?? 100;
53743
+ const [cols, setCols] = useState(stdout?.columns ?? 100);
53744
+ useEffect(() => {
53745
+ if (!stdout) return;
53746
+ const onResize = () => {
53747
+ setCols(stdout.columns ?? 100);
53748
+ };
53749
+ stdout.on("resize", onResize);
53750
+ return () => {
53751
+ stdout.off("resize", onResize);
53752
+ };
53753
+ }, [stdout]);
53737
53754
  const railEnabled = railVisible && cols >= RAIL_MIN_WIDTH;
53738
53755
  useEffect(() => {
53739
53756
  process.env.FLOW_TUI_ACTIVE = "1";
@@ -54132,12 +54149,71 @@ var History = class _History {
54132
54149
  }
54133
54150
  };
54134
54151
 
54135
- // src/config.ts
54152
+ // src/binary-resolver.ts
54136
54153
  import { promises as fs51 } from "node:fs";
54137
54154
  import path52 from "node:path";
54155
+ import os3 from "node:os";
54156
+ async function resolveBinary(nameOrPath) {
54157
+ if (!nameOrPath) return null;
54158
+ const isWindows2 = process.platform === "win32";
54159
+ const exts = isWindows2 ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").map((e2) => e2.toLowerCase()).filter(Boolean) : [""];
54160
+ const candidate = async (full) => {
54161
+ for (const ext2 of exts) {
54162
+ const probe = ext2 && !full.toLowerCase().endsWith(ext2) ? full + ext2 : full;
54163
+ try {
54164
+ await fs51.access(probe, fs51.constants.F_OK);
54165
+ return probe;
54166
+ } catch {
54167
+ }
54168
+ }
54169
+ return null;
54170
+ };
54171
+ if (path52.isAbsolute(nameOrPath) || nameOrPath.includes(path52.sep)) {
54172
+ return await candidate(nameOrPath);
54173
+ }
54174
+ const pathEntries = (process.env.PATH ?? "").split(path52.delimiter).filter(Boolean);
54175
+ for (const dir of pathEntries) {
54176
+ const found = await candidate(path52.join(dir, nameOrPath));
54177
+ if (found) return found;
54178
+ }
54179
+ const fallbackDirs = wellKnownBinDirs();
54180
+ for (const dir of fallbackDirs) {
54181
+ const found = await candidate(path52.join(dir, nameOrPath));
54182
+ if (found) return found;
54183
+ }
54184
+ return null;
54185
+ }
54186
+ function wellKnownBinDirs() {
54187
+ const home = os3.homedir();
54188
+ const dirs = [];
54189
+ if (process.platform === "darwin") {
54190
+ dirs.push("/opt/homebrew/bin", "/usr/local/bin");
54191
+ dirs.push(path52.join(home, ".npm-global/bin"));
54192
+ } else if (process.platform === "linux") {
54193
+ dirs.push("/usr/local/bin", "/usr/bin");
54194
+ dirs.push("/home/linuxbrew/.linuxbrew/bin");
54195
+ dirs.push(path52.join(home, ".npm-global/bin"));
54196
+ dirs.push(path52.join(home, ".local/bin"));
54197
+ } else if (process.platform === "win32") {
54198
+ if (process.env.APPDATA) {
54199
+ dirs.push(path52.join(process.env.APPDATA, "npm"));
54200
+ }
54201
+ if (process.env.ProgramFiles) {
54202
+ dirs.push(path52.join(process.env.ProgramFiles, "nodejs"));
54203
+ }
54204
+ if (process.env.LOCALAPPDATA) {
54205
+ dirs.push(path52.join(process.env.LOCALAPPDATA, "Programs", "gemini-cli"));
54206
+ }
54207
+ }
54208
+ return dirs;
54209
+ }
54210
+
54211
+ // src/config.ts
54212
+ import { promises as fs52 } from "node:fs";
54213
+ import path53 from "node:path";
54138
54214
  import toml2 from "@iarna/toml";
54139
54215
  function resolvePath(raw, base) {
54140
- return path52.isAbsolute(raw) ? raw : path52.resolve(base, raw);
54216
+ return path53.isAbsolute(raw) ? raw : path53.resolve(base, raw);
54141
54217
  }
54142
54218
  function asString2(v2, fallback = "") {
54143
54219
  return typeof v2 === "string" ? v2 : fallback;
@@ -54175,10 +54251,10 @@ var DEFAULT_WEB_ALLOWLIST = [
54175
54251
  "*.espressif.com",
54176
54252
  "developer.arm.com"
54177
54253
  ];
54178
- async function loadConfig(configPath) {
54179
- const raw = await fs51.readFile(configPath, "utf8");
54254
+ async function loadConfig(configPath, projectDir2 = process.cwd()) {
54255
+ const raw = await fs52.readFile(configPath, "utf8");
54180
54256
  const parsed = toml2.parse(raw);
54181
- const baseDir = path52.dirname(path52.resolve(configPath));
54257
+ const baseDir = path53.dirname(path53.resolve(configPath));
54182
54258
  const gemini = parsed.gemini ?? {};
54183
54259
  const tools = parsed.tools ?? {};
54184
54260
  const jlink = parsed.jlink ?? {};
@@ -54199,7 +54275,7 @@ async function loadConfig(configPath) {
54199
54275
  const planMode = modes.plan ?? {};
54200
54276
  const buildMode = modes.build ?? {};
54201
54277
  const cfg = {
54202
- configPath: path52.resolve(configPath),
54278
+ configPath: path53.resolve(configPath),
54203
54279
  baseDir,
54204
54280
  gemini: {
54205
54281
  binary: asString2(gemini.binary, "gemini"),
@@ -54221,9 +54297,11 @@ async function loadConfig(configPath) {
54221
54297
  },
54222
54298
  flow: {
54223
54299
  flowHome: resolvePath(asString2(flow.flow_home, "."), baseDir),
54300
+ // Project-scoped: memory/codedigest follow the user's invocation
54301
+ // dir so each project owns its own artefacts.
54224
54302
  memoryDir: resolvePath(
54225
54303
  asString2(flow.memory_dir, "memory/projects"),
54226
- baseDir
54304
+ projectDir2
54227
54305
  ),
54228
54306
  soulPath: resolvePath(
54229
54307
  asString2(flow.soul_path, ".flow/soul.md"),
@@ -54239,7 +54317,7 @@ async function loadConfig(configPath) {
54239
54317
  ),
54240
54318
  codedigestDir: resolvePath(
54241
54319
  asString2(flow.codedigest_dir, "memory/codedigest"),
54242
- baseDir
54320
+ projectDir2
54243
54321
  )
54244
54322
  },
54245
54323
  backend: {
@@ -54348,7 +54426,7 @@ async function loadConfig(configPath) {
54348
54426
  binary: asString2(mempalaceCfg.binary, "mempalace"),
54349
54427
  palaceDir: resolvePath(
54350
54428
  asString2(mempalaceCfg.palace_dir, "memory/mempalace"),
54351
- baseDir
54429
+ projectDir2
54352
54430
  ),
54353
54431
  topK: asNumber2(mempalaceCfg.top_k, 5),
54354
54432
  queryTimeoutSecs: asNumber2(mempalaceCfg.query_timeout_secs, 5)
@@ -54377,11 +54455,11 @@ async function loadConfig(configPath) {
54377
54455
  pythonTimeoutMs: asNumber2(memoryCfg.python_timeout_ms, 6e4),
54378
54456
  reasoningDir: resolvePath(
54379
54457
  asString2(memoryCfg.reasoning_dir, "memory/reasoning"),
54380
- baseDir
54458
+ projectDir2
54381
54459
  ),
54382
54460
  rvfDir: resolvePath(
54383
54461
  asString2(memoryCfg.rvf_dir, "memory/rvf"),
54384
- baseDir
54462
+ projectDir2
54385
54463
  ),
54386
54464
  reasoningOnGoalComplete: asBool(memoryCfg.reasoning_on_goal_complete, true),
54387
54465
  rvfOnGoalComplete: asBool(memoryCfg.rvf_on_goal_complete, true),
@@ -54390,7 +54468,7 @@ async function loadConfig(configPath) {
54390
54468
  sonaEnabled: asBool(memoryCfg.sona_enabled, true),
54391
54469
  sonaDir: resolvePath(
54392
54470
  asString2(memoryCfg.sona_dir, "memory/sona"),
54393
- baseDir
54471
+ projectDir2
54394
54472
  )
54395
54473
  },
54396
54474
  routing: {
@@ -54418,26 +54496,24 @@ async function loadConfig(configPath) {
54418
54496
  })()
54419
54497
  }
54420
54498
  };
54421
- if (cfg.gemini.workingDir) {
54422
- cfg.gemini.workingDir = resolvePath(cfg.gemini.workingDir, baseDir);
54423
- }
54499
+ cfg.gemini.workingDir = cfg.gemini.workingDir ? resolvePath(cfg.gemini.workingDir, projectDir2) : projectDir2;
54424
54500
  return cfg;
54425
54501
  }
54426
54502
  async function resolveDefaultConfig() {
54427
54503
  const candidates = [];
54428
54504
  const agenitHome = process.env.AGENIT_HOME;
54429
54505
  const flowHome = process.env.FLOW_HOME;
54430
- const here = path52.dirname(new URL(import.meta.url).pathname);
54431
- const siblingDir = path52.resolve(here, "..", "..", "..", "..", "config");
54506
+ const here = path53.dirname(new URL(import.meta.url).pathname);
54507
+ const siblingDir = path53.resolve(here, "..", "..", "..", "..", "config");
54432
54508
  for (const name of ["agenit.toml", "flow.toml"]) {
54433
- if (agenitHome) candidates.push(path52.join(agenitHome, "config", name));
54434
- if (flowHome) candidates.push(path52.join(flowHome, "config", name));
54435
- candidates.push(path52.join(siblingDir, name));
54436
- candidates.push(path52.join(process.cwd(), "config", name));
54509
+ if (agenitHome) candidates.push(path53.join(agenitHome, "config", name));
54510
+ if (flowHome) candidates.push(path53.join(flowHome, "config", name));
54511
+ candidates.push(path53.join(siblingDir, name));
54512
+ candidates.push(path53.join(process.cwd(), "config", name));
54437
54513
  }
54438
54514
  for (const c2 of candidates) {
54439
54515
  try {
54440
- await fs51.access(c2);
54516
+ await fs52.access(c2);
54441
54517
  return c2;
54442
54518
  } catch {
54443
54519
  }
@@ -54640,18 +54716,18 @@ async function readStdin() {
54640
54716
  }
54641
54717
 
54642
54718
  // src/update-check.ts
54643
- import { promises as fs52 } from "node:fs";
54644
- import os3 from "node:os";
54645
- import path53 from "node:path";
54719
+ import { promises as fs53 } from "node:fs";
54720
+ import os4 from "node:os";
54721
+ import path54 from "node:path";
54646
54722
  var DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
54647
54723
  function defaultCachePath() {
54648
54724
  const xdg = process.env.XDG_CACHE_HOME;
54649
- const base = xdg ? xdg : path53.join(os3.homedir(), ".cache");
54650
- return path53.join(base, "flow", "version-check.json");
54725
+ const base = xdg ? xdg : path54.join(os4.homedir(), ".cache");
54726
+ return path54.join(base, "flow", "version-check.json");
54651
54727
  }
54652
54728
  async function readCache(p2) {
54653
54729
  try {
54654
- const raw = await fs52.readFile(p2, "utf8");
54730
+ const raw = await fs53.readFile(p2, "utf8");
54655
54731
  const parsed = JSON.parse(raw);
54656
54732
  if (typeof parsed.checked_at === "number" && typeof parsed.installed === "string") {
54657
54733
  return {
@@ -54667,8 +54743,8 @@ async function readCache(p2) {
54667
54743
  }
54668
54744
  async function writeCache(p2, entry) {
54669
54745
  try {
54670
- await fs52.mkdir(path53.dirname(p2), { recursive: true });
54671
- await fs52.writeFile(p2, JSON.stringify(entry, null, 2));
54746
+ await fs53.mkdir(path54.dirname(p2), { recursive: true });
54747
+ await fs53.writeFile(p2, JSON.stringify(entry, null, 2));
54672
54748
  } catch {
54673
54749
  }
54674
54750
  }
@@ -54787,14 +54863,31 @@ var SoulKeeperWorker = class {
54787
54863
 
54788
54864
  // src/cli.tsx
54789
54865
  import { jsx as jsx5 } from "react/jsx-runtime";
54790
- var FLOW_VERSION = "0.5.0";
54866
+ var FLOW_VERSION = "1.0.3";
54791
54867
  var MIN_GEMINI_MAJOR = 0;
54792
54868
  var MIN_GEMINI_MINOR = 37;
54793
- async function checkGeminiCli(binary) {
54869
+ async function checkGeminiCli(cfg) {
54870
+ const configured = cfg.gemini.binary;
54871
+ const resolved = await resolveBinary(configured) ?? // Last-ditch: try the literal name in case spawn() can find it via
54872
+ // shell semantics we didn't model (cygwin, WSL bridge, etc.).
54873
+ (configured ? configured : null);
54874
+ if (!resolved) {
54875
+ throw new Error(
54876
+ `Gemini CLI not found.
54877
+ Configured binary: '${configured}' is not on PATH and was not found in any well-known install location.
54878
+ Install: npm install -g @google/gemini-cli
54879
+ Or set [gemini] binary = "<path>" in agenit.toml (or flow.toml)`
54880
+ );
54881
+ }
54882
+ cfg.gemini.binary = resolved;
54794
54883
  const out = await new Promise(
54795
54884
  (resolve3, reject) => {
54796
- const child = spawn17(binary, ["--version"], {
54797
- stdio: ["ignore", "pipe", "pipe"]
54885
+ const child = spawn17(resolved, ["--version"], {
54886
+ stdio: ["ignore", "pipe", "pipe"],
54887
+ // shell:true on Windows lets .cmd/.bat shims execute correctly
54888
+ // when invoked without their extension. POSIX leaves shell=false
54889
+ // (the default) so we don't pay the spawn-a-shell tax.
54890
+ shell: process.platform === "win32"
54798
54891
  });
54799
54892
  let stdout = "";
54800
54893
  child.stdout.setEncoding("utf8");
@@ -54807,9 +54900,8 @@ async function checkGeminiCli(binary) {
54807
54900
  ).catch(() => null);
54808
54901
  if (!out) {
54809
54902
  throw new Error(
54810
- `Gemini CLI not found at '${binary}'.
54811
- Install: npm install -g @google/gemini-cli
54812
- Then update [gemini] binary = "<path>" in agenit.toml (or flow.toml)`
54903
+ `Gemini CLI at '${resolved}' could not be executed.
54904
+ Reinstall: npm install -g @google/gemini-cli`
54813
54905
  );
54814
54906
  }
54815
54907
  for (const tok of out.stdout.split(/\s+/)) {
@@ -54828,13 +54920,13 @@ Upgrade: npm install -g @google/gemini-cli@latest`
54828
54920
  }
54829
54921
  }
54830
54922
  process.stderr.write(
54831
- `warning: could not parse Gemini CLI version from \`${binary} --version\`
54923
+ `warning: could not parse Gemini CLI version from \`${resolved} --version\`
54832
54924
  `
54833
54925
  );
54834
54926
  }
54835
54927
  async function readActiveProject() {
54836
54928
  try {
54837
- const txt = await fs53.readFile(".agenit_project", "utf8");
54929
+ const txt = await fs54.readFile(".agenit_project", "utf8");
54838
54930
  const trimmed = txt.trim();
54839
54931
  if (!trimmed) return null;
54840
54932
  if (trimmed.includes("=")) {
@@ -54846,16 +54938,17 @@ async function readActiveProject() {
54846
54938
  } catch {
54847
54939
  }
54848
54940
  try {
54849
- const txt = await fs53.readFile(".flow_project", "utf8");
54941
+ const txt = await fs54.readFile(".flow_project", "utf8");
54850
54942
  const trimmed = txt.trim();
54851
54943
  return trimmed || null;
54852
54944
  } catch {
54853
54945
  return null;
54854
54946
  }
54855
54947
  }
54948
+ var INVOCATION_CWD = process.cwd();
54856
54949
  async function loadFlowConfig(configFlag) {
54857
54950
  const configPath = configFlag ?? await resolveDefaultConfig();
54858
- const cfg = await loadConfig(configPath);
54951
+ const cfg = await loadConfig(configPath, INVOCATION_CWD);
54859
54952
  initTelemetry(cfg.telemetry);
54860
54953
  initMetrics(cfg.telemetry);
54861
54954
  return cfg;
@@ -54874,7 +54967,7 @@ async function cmdResume(cfg, idHint) {
54874
54967
  `);
54875
54968
  process.exit(1);
54876
54969
  }
54877
- await checkGeminiCli(cfg.gemini.binary);
54970
+ await checkGeminiCli(cfg);
54878
54971
  const initialProject = session.meta.project ?? await readActiveProject();
54879
54972
  const history = await History.load();
54880
54973
  await writeGuard(cfg, null);
@@ -54915,7 +55008,7 @@ async function cmdSessionsList() {
54915
55008
  }
54916
55009
  }
54917
55010
  async function cmdRepl(cfg) {
54918
- await checkGeminiCli(cfg.gemini.binary);
55011
+ await checkGeminiCli(cfg);
54919
55012
  const initialProject = await readActiveProject();
54920
55013
  const history = await History.load();
54921
55014
  await writeGuard(cfg, null);
@@ -54948,12 +55041,12 @@ async function cmdRepl(cfg) {
54948
55041
  }
54949
55042
  if (cfg.memory.soulKeeperEnabled && initialProject) {
54950
55043
  try {
54951
- const projectMemoryDir = path54.join(cfg.flow.memoryDir, initialProject);
55044
+ const projectMemoryDir = path55.join(cfg.flow.memoryDir, initialProject);
54952
55045
  getLoopWorkerPool().spawn(
54953
55046
  new SoulKeeperWorker({
54954
55047
  project: initialProject,
54955
55048
  soulPath: cfg.flow.soulPath,
54956
- contextPath: path54.join(projectMemoryDir, "context.md")
55049
+ contextPath: path55.join(projectMemoryDir, "context.md")
54957
55050
  }),
54958
55051
  { gapMs: cfg.memory.soulKeeperGapMs }
54959
55052
  );
@@ -55003,7 +55096,7 @@ async function cmdCompletions(shell) {
55003
55096
  process.stdout.write(completionScript(shell));
55004
55097
  }
55005
55098
  async function cmdRun(cfg, project, input) {
55006
- await checkGeminiCli(cfg.gemini.binary);
55099
+ await checkGeminiCli(cfg);
55007
55100
  await writeGuard(cfg, null);
55008
55101
  await ensureGuardHookRegistered();
55009
55102
  const out = await runFlow(cfg, project, input);
@@ -55020,7 +55113,7 @@ async function cmdProjects(cfg) {
55020
55113
  const dir = cfg.flow.memoryDir;
55021
55114
  let entries = [];
55022
55115
  try {
55023
- entries = await fs53.readdir(dir, { withFileTypes: true });
55116
+ entries = await fs54.readdir(dir, { withFileTypes: true });
55024
55117
  } catch {
55025
55118
  return;
55026
55119
  }
@@ -55030,20 +55123,20 @@ async function cmdProjects(cfg) {
55030
55123
  }
55031
55124
  }
55032
55125
  async function cmdInit(cfg, projectDir2, name) {
55033
- const target = path54.resolve(projectDir2);
55034
- const projectName = name ?? path54.basename(target);
55035
- const memDir = path54.join(cfg.flow.memoryDir, projectName);
55036
- await fs53.mkdir(memDir, { recursive: true });
55126
+ const target = path55.resolve(projectDir2);
55127
+ const projectName = name ?? path55.basename(target);
55128
+ const memDir = path55.join(cfg.flow.memoryDir, projectName);
55129
+ await fs54.mkdir(memDir, { recursive: true });
55037
55130
  for (const file of ["context.md", "decisions.md", "requirements.md"]) {
55038
- const p2 = path54.join(memDir, file);
55131
+ const p2 = path55.join(memDir, file);
55039
55132
  try {
55040
- await fs53.access(p2);
55133
+ await fs54.access(p2);
55041
55134
  } catch {
55042
- await fs53.writeFile(p2, "");
55135
+ await fs54.writeFile(p2, "");
55043
55136
  }
55044
55137
  }
55045
- await fs53.writeFile(
55046
- path54.join(target, ".agenit_project"),
55138
+ await fs54.writeFile(
55139
+ path55.join(target, ".agenit_project"),
55047
55140
  `project = "${projectName}"
55048
55141
  profile = "automotive"
55049
55142
  `
@@ -55052,12 +55145,12 @@ profile = "automotive"
55052
55145
  `);
55053
55146
  }
55054
55147
  async function cmdUnflow(projectDir2) {
55055
- const target = path54.resolve(projectDir2);
55148
+ const target = path55.resolve(projectDir2);
55056
55149
  let removed = false;
55057
55150
  for (const fname of [".agenit_project", ".flow_project"]) {
55058
- const marker = path54.join(target, fname);
55151
+ const marker = path55.join(target, fname);
55059
55152
  try {
55060
- await fs53.unlink(marker);
55153
+ await fs54.unlink(marker);
55061
55154
  process.stdout.write(`\u2713 Removed ${marker}
55062
55155
  `);
55063
55156
  removed = true;