@karmaniverous/jeeves-watcher 0.18.5 → 0.18.6

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.
@@ -934,6 +934,39 @@ class CommitMessageGenerator {
934
934
  */
935
935
  /** Promisified execFile for git commands. */
936
936
  const execFileAsync = promisify(execFile);
937
+ /**
938
+ * Stage files via stdin to avoid ENAMETOOLONG on Windows.
939
+ *
940
+ * Uses `git add --pathspec-from-file=- --pathspec-file-nul` so the file list is piped
941
+ * through stdin (NUL-delimited) instead of passed as command-line
942
+ * arguments. This sidesteps the Windows CreateProcessW 32 767-char
943
+ * limit that triggers ENAMETOOLONG when batches contain many files
944
+ * with long absolute paths.
945
+ *
946
+ * @param files - Absolute paths of files to stage.
947
+ * @param cwd - Repository root (working directory for git).
948
+ */
949
+ function gitAddViaStdin(files, cwd) {
950
+ return new Promise((resolve, reject) => {
951
+ const child = execFile('git', ['add', '--pathspec-from-file=-', '--pathspec-file-nul'], { cwd }, (error) => {
952
+ if (error)
953
+ reject(error);
954
+ else
955
+ resolve();
956
+ });
957
+ if (!child.stdin) {
958
+ reject(new Error('Failed to open stdin for git add'));
959
+ return;
960
+ }
961
+ // Suppress EPIPE — expected if git exits before we finish writing
962
+ child.stdin.on('error', (err) => {
963
+ if (err.code !== 'EPIPE') {
964
+ reject(err);
965
+ }
966
+ });
967
+ child.stdin.end(files.join('\0'));
968
+ });
969
+ }
937
970
  /**
938
971
  * Normalize a path for case-insensitive comparison on Windows.
939
972
  * On Windows, lowercases the entire path; on other platforms, returns as-is.
@@ -1550,9 +1583,7 @@ class VcsManager {
1550
1583
  return;
1551
1584
  try {
1552
1585
  await retry(async (attempt) => {
1553
- await execFileAsync('git', ['add', '--', ...files], {
1554
- cwd: this.rootPath,
1555
- });
1586
+ await gitAddViaStdin(files, this.rootPath);
1556
1587
  // Build message after staging so getStagedDiff can see the changes
1557
1588
  // Skip AI for baselines and retries — use template directly
1558
1589
  const message = this.isBaseline || attempt > 1
@@ -224,7 +224,7 @@ async function startFromConfig(configPath, descriptor) {
224
224
  const config = await loadConfig(resolvedPath);
225
225
  // Dynamic import breaks the circular dependency between this module
226
226
  // and app/index.ts (which defines JeevesWatcher and re-exports startFromConfig).
227
- const { JeevesWatcher } = await import('./index-CaibsSrT.js');
227
+ const { JeevesWatcher } = await import('./index-CS1wrtes.js');
228
228
  const app = new JeevesWatcher(config, resolvedPath, descriptor);
229
229
  installShutdownHandlers(() => app.stop());
230
230
  await app.start();
package/dist/index.js CHANGED
@@ -3375,6 +3375,39 @@ function createSearchHandler(deps) {
3375
3375
  */
3376
3376
  /** Promisified execFile for git commands. */
3377
3377
  const execFileAsync = promisify(execFile);
3378
+ /**
3379
+ * Stage files via stdin to avoid ENAMETOOLONG on Windows.
3380
+ *
3381
+ * Uses `git add --pathspec-from-file=- --pathspec-file-nul` so the file list is piped
3382
+ * through stdin (NUL-delimited) instead of passed as command-line
3383
+ * arguments. This sidesteps the Windows CreateProcessW 32 767-char
3384
+ * limit that triggers ENAMETOOLONG when batches contain many files
3385
+ * with long absolute paths.
3386
+ *
3387
+ * @param files - Absolute paths of files to stage.
3388
+ * @param cwd - Repository root (working directory for git).
3389
+ */
3390
+ function gitAddViaStdin(files, cwd) {
3391
+ return new Promise((resolve, reject) => {
3392
+ const child = execFile('git', ['add', '--pathspec-from-file=-', '--pathspec-file-nul'], { cwd }, (error) => {
3393
+ if (error)
3394
+ reject(error);
3395
+ else
3396
+ resolve();
3397
+ });
3398
+ if (!child.stdin) {
3399
+ reject(new Error('Failed to open stdin for git add'));
3400
+ return;
3401
+ }
3402
+ // Suppress EPIPE — expected if git exits before we finish writing
3403
+ child.stdin.on('error', (err) => {
3404
+ if (err.code !== 'EPIPE') {
3405
+ reject(err);
3406
+ }
3407
+ });
3408
+ child.stdin.end(files.join('\0'));
3409
+ });
3410
+ }
3378
3411
  /**
3379
3412
  * Normalize a path for case-insensitive comparison on Windows.
3380
3413
  * On Windows, lowercases the entire path; on other platforms, returns as-is.
@@ -5046,9 +5079,7 @@ class VcsManager {
5046
5079
  return;
5047
5080
  try {
5048
5081
  await retry(async (attempt) => {
5049
- await execFileAsync('git', ['add', '--', ...files], {
5050
- cwd: this.rootPath,
5051
- });
5082
+ await gitAddViaStdin(files, this.rootPath);
5052
5083
  // Build message after staging so getStagedDiff can see the changes
5053
5084
  // Skip AI for baselines and retries — use template directly
5054
5085
  const message = this.isBaseline || attempt > 1
package/package.json CHANGED
@@ -149,5 +149,5 @@
149
149
  },
150
150
  "type": "module",
151
151
  "types": "dist/index.d.ts",
152
- "version": "0.18.5"
152
+ "version": "0.18.6"
153
153
  }