ts-repo-utils 7.8.1 → 7.9.0

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 (73) hide show
  1. package/README.md +10 -0
  2. package/dist/cmd/assert-repo-is-clean.mjs +2 -1
  3. package/dist/cmd/assert-repo-is-clean.mjs.map +1 -1
  4. package/dist/cmd/check-should-run-type-checks.mjs +2 -1
  5. package/dist/cmd/check-should-run-type-checks.mjs.map +1 -1
  6. package/dist/cmd/format-diff-from.mjs +2 -1
  7. package/dist/cmd/format-diff-from.mjs.map +1 -1
  8. package/dist/cmd/format-uncommitted.mjs +2 -1
  9. package/dist/cmd/format-uncommitted.mjs.map +1 -1
  10. package/dist/cmd/gen-index-ts.mjs +2 -1
  11. package/dist/cmd/gen-index-ts.mjs.map +1 -1
  12. package/dist/entry-point.d.mts.map +1 -1
  13. package/dist/functions/assert-ext.d.mts +0 -1
  14. package/dist/functions/assert-ext.d.mts.map +1 -1
  15. package/dist/functions/assert-ext.mjs.map +1 -1
  16. package/dist/functions/assert-path-exists.d.mts.map +1 -1
  17. package/dist/functions/assert-path-exists.mjs.map +1 -1
  18. package/dist/functions/assert-repo-is-clean.d.mts.map +1 -1
  19. package/dist/functions/assert-repo-is-clean.mjs.map +1 -1
  20. package/dist/functions/create-result-assert.d.mts +0 -1
  21. package/dist/functions/create-result-assert.d.mts.map +1 -1
  22. package/dist/functions/create-result-assert.mjs.map +1 -1
  23. package/dist/functions/diff.d.mts +0 -1
  24. package/dist/functions/diff.d.mts.map +1 -1
  25. package/dist/functions/exec-async.d.mts +0 -1
  26. package/dist/functions/exec-async.d.mts.map +1 -1
  27. package/dist/functions/exec-async.mjs.map +1 -1
  28. package/dist/functions/format.d.mts +4 -5
  29. package/dist/functions/format.d.mts.map +1 -1
  30. package/dist/functions/format.mjs +3 -3
  31. package/dist/functions/format.mjs.map +1 -1
  32. package/dist/functions/gen-index.d.mts +0 -1
  33. package/dist/functions/gen-index.d.mts.map +1 -1
  34. package/dist/functions/gen-index.mjs.map +1 -1
  35. package/dist/functions/should-run.d.mts.map +1 -1
  36. package/dist/functions/should-run.mjs.map +1 -1
  37. package/dist/functions/workspace-utils/execute-parallel.d.mts.map +1 -1
  38. package/dist/functions/workspace-utils/execute-parallel.mjs +4 -5
  39. package/dist/functions/workspace-utils/execute-parallel.mjs.map +1 -1
  40. package/dist/functions/workspace-utils/get-workspace-packages.d.mts.map +1 -1
  41. package/dist/functions/workspace-utils/get-workspace-packages.mjs.map +1 -1
  42. package/dist/functions/workspace-utils/run-cmd-in-parallel.d.mts.map +1 -1
  43. package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs +2 -1
  44. package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs.map +1 -1
  45. package/dist/functions/workspace-utils/run-cmd-in-stages.d.mts.map +1 -1
  46. package/dist/functions/workspace-utils/run-cmd-in-stages.mjs +2 -1
  47. package/dist/functions/workspace-utils/run-cmd-in-stages.mjs.map +1 -1
  48. package/dist/node-global.d.mts +0 -1
  49. package/dist/node-global.d.mts.map +1 -1
  50. package/package.json +25 -26
  51. package/src/cmd/assert-repo-is-clean.mts +2 -1
  52. package/src/cmd/check-should-run-type-checks.mts +2 -1
  53. package/src/cmd/format-diff-from.mts +2 -1
  54. package/src/cmd/format-uncommitted.mts +3 -1
  55. package/src/cmd/gen-index-ts.mts +8 -2
  56. package/src/entry-point.mts +1 -0
  57. package/src/functions/assert-ext.mts +4 -0
  58. package/src/functions/assert-path-exists.mts +2 -0
  59. package/src/functions/assert-repo-is-clean.mts +9 -0
  60. package/src/functions/create-result-assert.mts +1 -0
  61. package/src/functions/diff.test.mts +136 -8
  62. package/src/functions/exec-async.mts +4 -0
  63. package/src/functions/exec-async.test.mts +59 -2
  64. package/src/functions/format.mts +26 -7
  65. package/src/functions/format.test.mts +166 -9
  66. package/src/functions/gen-index.mts +16 -0
  67. package/src/functions/should-run.mts +2 -0
  68. package/src/functions/workspace-utils/execute-parallel.mts +27 -5
  69. package/src/functions/workspace-utils/get-workspace-packages.mts +5 -0
  70. package/src/functions/workspace-utils/run-cmd-in-parallel.mts +7 -1
  71. package/src/functions/workspace-utils/run-cmd-in-stages.mts +7 -1
  72. package/src/functions/workspace-utils/run-cmd-in-stages.test.mts +17 -3
  73. package/src/node-global.mts +7 -1
@@ -10,10 +10,12 @@ describe('exec-async', () => {
10
10
  const withSilentEcho = async <T,>(fn: () => Promise<T>): Promise<T> => {
11
11
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
12
12
  const originalEcho = (globalThis as any).echo;
13
+
13
14
  // eslint-disable-next-line functional/immutable-data, @typescript-eslint/no-unsafe-member-access
14
15
  (globalThis as any).echo = () => {
15
16
  // Silent implementation - no output
16
17
  };
18
+
17
19
  try {
18
20
  return await fn();
19
21
  } finally {
@@ -21,13 +23,16 @@ describe('exec-async', () => {
21
23
  (globalThis as any).echo = originalEcho;
22
24
  }
23
25
  };
26
+
24
27
  describe('basic command execution', () => {
25
28
  test('should execute simple command successfully', async () => {
26
29
  const result = await $('echo "hello world"', { silent: true });
27
30
 
28
31
  expect(Result.isOk(result)).toBe(true);
32
+
29
33
  if (Result.isOk(result)) {
30
34
  expect(result.value.stdout.trim()).toBe('hello world');
35
+
31
36
  expect(result.value.stderr).toBe('');
32
37
  }
33
38
  });
@@ -36,8 +41,10 @@ describe('exec-async', () => {
36
41
  const result = await $('echo "line1\nline2\nline3"', { silent: true });
37
42
 
38
43
  expect(Result.isOk(result)).toBe(true);
44
+
39
45
  if (Result.isOk(result)) {
40
46
  expect(result.value.stdout.trim()).toBe('line1\nline2\nline3');
47
+
41
48
  expect(result.value.stderr).toBe('');
42
49
  }
43
50
  });
@@ -46,8 +53,10 @@ describe('exec-async', () => {
46
53
  const result = await $('true', { silent: true });
47
54
 
48
55
  expect(Result.isOk(result)).toBe(true);
56
+
49
57
  if (Result.isOk(result)) {
50
58
  expect(result.value.stdout).toBe('');
59
+
51
60
  expect(result.value.stderr).toBe('');
52
61
  }
53
62
  });
@@ -58,8 +67,10 @@ describe('exec-async', () => {
58
67
  const result = await $('nonexistent_command_xyz', { silent: true });
59
68
 
60
69
  expect(Result.isErr(result)).toBe(true);
70
+
61
71
  if (Result.isErr(result)) {
62
72
  expect(result.value).toBeDefined();
73
+
63
74
  expect(result.value.code).toBeDefined();
64
75
  }
65
76
  });
@@ -68,8 +79,10 @@ describe('exec-async', () => {
68
79
  const result = await $('exit 1', { silent: true });
69
80
 
70
81
  expect(Result.isErr(result)).toBe(true);
82
+
71
83
  if (Result.isErr(result)) {
72
84
  expect(result.value).toBeDefined();
85
+
73
86
  expect(result.value.code).toBe(1);
74
87
  }
75
88
  });
@@ -80,6 +93,7 @@ describe('exec-async', () => {
80
93
  });
81
94
 
82
95
  expect(Result.isErr(result)).toBe(true);
96
+
83
97
  if (Result.isErr(result)) {
84
98
  expect(result.value).toBeDefined();
85
99
  }
@@ -115,8 +129,9 @@ describe('exec-async', () => {
115
129
  const result = await $('echo "test"', { silent: true });
116
130
 
117
131
  expect(Result.isOk(result)).toBe(true);
132
+
118
133
  if (Result.isOk(result)) {
119
- expect(typeof result.value.stdout).toBe('string');
134
+ expectTypeOf(result.value.stdout).toBeString();
120
135
  }
121
136
  });
122
137
 
@@ -127,8 +142,10 @@ describe('exec-async', () => {
127
142
  });
128
143
 
129
144
  expect(Result.isOk(result)).toBe(true);
145
+
130
146
  if (Result.isOk(result)) {
131
147
  expect(Buffer.isBuffer(result.value.stdout)).toBe(true);
148
+
132
149
  expect(Buffer.isBuffer(result.value.stderr)).toBe(true);
133
150
  }
134
151
  });
@@ -137,8 +154,10 @@ describe('exec-async', () => {
137
154
  const result = await $('echo "test"', { silent: true, encoding: null });
138
155
 
139
156
  expect(Result.isOk(result)).toBe(true);
157
+
140
158
  if (Result.isOk(result)) {
141
159
  expect(Buffer.isBuffer(result.value.stdout)).toBe(true);
160
+
142
161
  expect(Buffer.isBuffer(result.value.stderr)).toBe(true);
143
162
  }
144
163
  });
@@ -150,8 +169,10 @@ describe('exec-async', () => {
150
169
  });
151
170
 
152
171
  expect(Result.isOk(result)).toBe(true);
172
+
153
173
  if (Result.isOk(result)) {
154
- expect(typeof result.value.stdout).toBe('string');
174
+ expectTypeOf(result.value.stdout).toBeString();
175
+
155
176
  expect(result.value.stdout.trim()).toBe('test 日本語');
156
177
  }
157
178
  });
@@ -164,6 +185,7 @@ describe('exec-async', () => {
164
185
  });
165
186
 
166
187
  expect(Result.isOk(result)).toBe(true);
188
+
167
189
  if (Result.isOk(result)) {
168
190
  expect(result.value.stdout.trim()).toBe('hello world');
169
191
  }
@@ -173,6 +195,7 @@ describe('exec-async', () => {
173
195
  const result = await $('echo "first" && echo "second"', { silent: true });
174
196
 
175
197
  expect(Result.isOk(result)).toBe(true);
198
+
176
199
  if (Result.isOk(result)) {
177
200
  expect(result.value.stdout.trim()).toBe('first\nsecond');
178
201
  }
@@ -182,6 +205,7 @@ describe('exec-async', () => {
182
205
  const result = await $('echo "first"; echo "second"', { silent: true });
183
206
 
184
207
  expect(Result.isOk(result)).toBe(true);
208
+
185
209
  if (Result.isOk(result)) {
186
210
  expect(result.value.stdout.trim()).toBe('first\nsecond');
187
211
  }
@@ -208,6 +232,7 @@ describe('exec-async', () => {
208
232
  if (Result.isOk(result)) {
209
233
  // These assignments will fail at compile time if types don't match
210
234
  assertType<string>(result.value.stdout);
235
+
211
236
  assertType<string>(result.value.stderr);
212
237
  }
213
238
  });
@@ -234,6 +259,7 @@ describe('exec-async', () => {
234
259
 
235
260
  if (Result.isOk(result)) {
236
261
  assertType<Buffer>(result.value.stdout);
262
+
237
263
  assertType<Buffer>(result.value.stderr);
238
264
  }
239
265
  });
@@ -248,6 +274,7 @@ describe('exec-async', () => {
248
274
 
249
275
  if (Result.isOk(result)) {
250
276
  assertType<Buffer>(result.value.stdout);
277
+
251
278
  assertType<Buffer>(result.value.stderr);
252
279
  }
253
280
  });
@@ -257,10 +284,12 @@ describe('exec-async', () => {
257
284
  encoding: 'utf8',
258
285
  silent: true,
259
286
  });
287
+
260
288
  const _resultAscii = await $('echo "test"', {
261
289
  encoding: 'ascii',
262
290
  silent: true,
263
291
  });
292
+
264
293
  const _resultBase64 = await $('echo "test"', {
265
294
  encoding: 'base64',
266
295
  silent: true,
@@ -284,17 +313,21 @@ describe('exec-async', () => {
284
313
 
285
314
  test('should maintain type safety with const encoding values', async () => {
286
315
  const bufferEncoding = 'buffer';
316
+
287
317
  const nullEncoding = null;
318
+
288
319
  const utf8Encoding = 'utf8';
289
320
 
290
321
  const _resultBuffer = await $('echo "test"', {
291
322
  encoding: bufferEncoding,
292
323
  silent: true,
293
324
  });
325
+
294
326
  const _resultNull = await $('echo "test"', {
295
327
  encoding: nullEncoding,
296
328
  silent: true,
297
329
  });
330
+
298
331
  const _resultUtf8 = await $('echo "test"', {
299
332
  encoding: utf8Encoding,
300
333
  silent: true,
@@ -350,12 +383,15 @@ describe('exec-async', () => {
350
383
  // Type check for native exec with default options
351
384
  exec('echo "test"', (error, stdout, stderr) => {
352
385
  expectType<ExecException | null, typeof error>('=');
386
+
353
387
  expectType<string, typeof stdout>('=');
388
+
354
389
  expectType<string, typeof stderr>('=');
355
390
  });
356
391
 
357
392
  // The $ function should produce the same types wrapped in Result (suppressed for clean output)
358
393
  const _resultPromise = withSilentEcho(async () => $('echo "test"'));
394
+
359
395
  expectType<
360
396
  typeof _resultPromise,
361
397
  Promise<
@@ -368,7 +404,9 @@ describe('exec-async', () => {
368
404
  // Type check for native exec with buffer encoding
369
405
  exec('echo "test"', { encoding: 'buffer' }, (error, stdout, stderr) => {
370
406
  expectType<ExecException | null, typeof error>('=');
407
+
371
408
  expectType<Buffer, typeof stdout>('>=');
409
+
372
410
  expectType<Buffer, typeof stderr>('>=');
373
411
  });
374
412
 
@@ -376,6 +414,7 @@ describe('exec-async', () => {
376
414
  const _resultPromise = withSilentEcho(async () =>
377
415
  $('echo "test"', { encoding: 'buffer' }),
378
416
  );
417
+
379
418
  expectType<
380
419
  typeof _resultPromise,
381
420
  Promise<
@@ -388,7 +427,9 @@ describe('exec-async', () => {
388
427
  // Type check for native exec with null encoding
389
428
  exec('echo "test"', { encoding: null }, (error, stdout, stderr) => {
390
429
  expectType<ExecException | null, typeof error>('=');
430
+
391
431
  expectType<Buffer, typeof stdout>('>=');
432
+
392
433
  expectType<Buffer, typeof stderr>('>=');
393
434
  });
394
435
 
@@ -396,6 +437,7 @@ describe('exec-async', () => {
396
437
  const _resultPromise = withSilentEcho(async () =>
397
438
  $('echo "test"', { encoding: null }),
398
439
  );
440
+
399
441
  expectType<
400
442
  typeof _resultPromise,
401
443
  Promise<
@@ -408,7 +450,9 @@ describe('exec-async', () => {
408
450
  // Type check for native exec with utf8 encoding
409
451
  exec('echo "test"', { encoding: 'utf8' }, (error, stdout, stderr) => {
410
452
  expectType<ExecException | null, typeof error>('=');
453
+
411
454
  expectType<string, typeof stdout>('=');
455
+
412
456
  expectType<string, typeof stderr>('=');
413
457
  });
414
458
 
@@ -416,6 +460,7 @@ describe('exec-async', () => {
416
460
  const _resultPromise = withSilentEcho(async () =>
417
461
  $('echo "test"', { encoding: 'utf8' }),
418
462
  );
463
+
419
464
  expectType<
420
465
  typeof _resultPromise,
421
466
  Promise<
@@ -431,7 +476,9 @@ describe('exec-async', () => {
431
476
  { encoding: 'utf8', timeout: 5000 },
432
477
  (error, stdout, stderr) => {
433
478
  expectType<ExecException | null, typeof error>('=');
479
+
434
480
  expectType<string, typeof stdout>('=');
481
+
435
482
  expectType<string, typeof stderr>('=');
436
483
  },
437
484
  );
@@ -441,6 +488,7 @@ describe('exec-async', () => {
441
488
  encoding: 'utf8',
442
489
  silent: true,
443
490
  });
491
+
444
492
  expectType<
445
493
  typeof _resultPromise,
446
494
  Promise<
@@ -488,17 +536,21 @@ describe('exec-async', () => {
488
536
  // eslint-disable-next-line total-functions/no-unsafe-type-assertion
489
537
  stderr: undefined as unknown as T,
490
538
  };
539
+
491
540
  return emptyParams;
492
541
  };
493
542
 
494
543
  // Default encoding comparison
495
544
  const _execDefault = captureExecTypes<string>();
545
+
496
546
  const $Default = await $('echo "test"', { silent: true });
547
+
497
548
  if (Result.isOk($Default)) {
498
549
  expectType<
499
550
  typeof _execDefault.stdout,
500
551
  typeof $Default.value.stdout
501
552
  >('=');
553
+
502
554
  expectType<
503
555
  typeof _execDefault.stderr,
504
556
  typeof $Default.value.stderr
@@ -507,14 +559,17 @@ describe('exec-async', () => {
507
559
 
508
560
  // Buffer encoding comparison
509
561
  const _execBuffer = captureExecTypes<Buffer>('buffer');
562
+
510
563
  const $Buffer = await $('echo "test"', {
511
564
  encoding: 'buffer',
512
565
  silent: true,
513
566
  });
567
+
514
568
  if (Result.isOk($Buffer)) {
515
569
  expectType<typeof _execBuffer.stdout, typeof $Buffer.value.stdout>(
516
570
  '=',
517
571
  );
572
+
518
573
  expectType<typeof _execBuffer.stderr, typeof $Buffer.value.stderr>(
519
574
  '=',
520
575
  );
@@ -527,7 +582,9 @@ describe('exec-async', () => {
527
582
  });
528
583
  } finally {
529
584
  consoleLogSpy.mockRestore();
585
+
530
586
  consoleErrorSpy.mockRestore();
587
+
531
588
  stderrWriteSpy.mockRestore();
532
589
  }
533
590
  });
@@ -18,7 +18,7 @@ export const formatFiles = async (
18
18
  files: readonly string[],
19
19
  options?: Readonly<{
20
20
  silent?: boolean;
21
- ignore?: (filePath: string) => boolean;
21
+ ignore?: false | ((filePath: string) => boolean);
22
22
  ignoreUnknown?: boolean;
23
23
  }>,
24
24
  ): Promise<Result<undefined, readonly unknown[]>> => {
@@ -28,6 +28,7 @@ export const formatFiles = async (
28
28
 
29
29
  if (files.length === 0) {
30
30
  conditionalEcho('No files to format');
31
+
31
32
  return Result.ok(undefined);
32
33
  }
33
34
 
@@ -45,6 +46,7 @@ export const formatFiles = async (
45
46
  } catch {
46
47
  // File doesn't exist, skip it
47
48
  conditionalEcho(`Skipping non-existent file: ${filePath}`);
49
+
48
50
  return Result.ok(undefined);
49
51
  }
50
52
 
@@ -60,10 +62,11 @@ export const formatFiles = async (
60
62
  });
61
63
 
62
64
  if (
63
- fileInfo.ignored ||
64
- (options?.ignore ?? defaultIgnoreFn)(filePath)
65
+ options?.ignore !== false &&
66
+ (fileInfo.ignored || (options?.ignore ?? defaultIgnoreFn)(filePath))
65
67
  ) {
66
68
  conditionalEcho(`Skipping ignored file: ${filePath}`);
69
+
67
70
  return Result.ok(undefined);
68
71
  }
69
72
 
@@ -73,6 +76,7 @@ export const formatFiles = async (
73
76
  ) {
74
77
  // Silently skip files with no parser
75
78
  conditionalEcho(`Skipping file (no parser): ${filePath}`);
79
+
76
80
  return Result.ok(undefined);
77
81
  }
78
82
 
@@ -87,6 +91,7 @@ export const formatFiles = async (
87
91
  conditionalEcho(`Unchanged: ${filePath}`);
88
92
  } else {
89
93
  await fs.writeFile(filePath, formatted, 'utf8');
94
+
90
95
  conditionalEcho(`Formatted: ${filePath}`);
91
96
  }
92
97
 
@@ -95,6 +100,7 @@ export const formatFiles = async (
95
100
  if (!silent) {
96
101
  console.error(`Error formatting ${filePath}:`, error);
97
102
  }
103
+
98
104
  return Result.err(error);
99
105
  }
100
106
  }),
@@ -102,6 +108,7 @@ export const formatFiles = async (
102
108
 
103
109
  if (results.every((r) => r.status === 'fulfilled')) {
104
110
  const fulfilled = results.map((r) => r.value);
111
+
105
112
  if (fulfilled.every(Result.isOk)) {
106
113
  return Result.ok(undefined);
107
114
  } else {
@@ -191,24 +198,28 @@ export const formatFilesGlob = async (
191
198
  options?: Readonly<{
192
199
  silent?: boolean;
193
200
  ignoreUnknown?: boolean;
194
- ignore?: (filePath: string) => boolean;
201
+ ignore?: false | ((filePath: string) => boolean);
195
202
  }>,
196
203
  ): Promise<Result<undefined, unknown>> => {
197
204
  const silent = options?.silent ?? false;
205
+
198
206
  const ignoreUnknown = options?.ignoreUnknown ?? true;
207
+
199
208
  const ignore = options?.ignore;
209
+
200
210
  const conditionalEcho = silent ? () => {} : echo;
201
211
 
202
212
  try {
203
213
  // Find all files matching the glob
204
214
  const files = await glob(pathGlob, {
205
215
  absolute: true,
206
- ignore: ['**/node_modules/**', '**/.git/**'],
216
+ ignore: ignore === false ? [] : ['**/node_modules/**', '**/.git/**'],
207
217
  dot: true,
208
218
  });
209
219
 
210
220
  if (files.length === 0) {
211
221
  conditionalEcho('No files found matching pattern:', pathGlob);
222
+
212
223
  return Result.ok(undefined);
213
224
  }
214
225
 
@@ -217,6 +228,7 @@ export const formatFilesGlob = async (
217
228
  if (!silent) {
218
229
  console.error('Error in formatFiles:', error);
219
230
  }
231
+
220
232
  return Result.err(error);
221
233
  }
222
234
  };
@@ -233,7 +245,7 @@ export const formatUncommittedFiles = async (
233
245
  staged?: boolean;
234
246
  silent?: boolean;
235
247
  ignoreUnknown?: boolean;
236
- ignore?: (filePath: string) => boolean;
248
+ ignore?: false | ((filePath: string) => boolean);
237
249
  }>,
238
250
  ): Promise<
239
251
  Result<
@@ -262,6 +274,7 @@ export const formatUncommittedFiles = async (
262
274
  untrackedFilesResult.value,
263
275
  );
264
276
  }
277
+
265
278
  return untrackedFilesResult;
266
279
  }
267
280
 
@@ -275,6 +288,7 @@ export const formatUncommittedFiles = async (
275
288
  if (!silent) {
276
289
  console.error('Error getting changed files:', diffFilesResult.value);
277
290
  }
291
+
278
292
  return diffFilesResult;
279
293
  }
280
294
 
@@ -288,6 +302,7 @@ export const formatUncommittedFiles = async (
288
302
  if (!silent) {
289
303
  console.error('Error getting changed files:', stagedFilesResult.value);
290
304
  }
305
+
291
306
  return stagedFilesResult;
292
307
  }
293
308
 
@@ -322,7 +337,7 @@ export const formatDiffFrom = async (
322
337
  includeStaged?: boolean;
323
338
  silent?: boolean;
324
339
  ignoreUnknown?: boolean;
325
- ignore?: (filePath: string) => boolean;
340
+ ignore?: false | ((filePath: string) => boolean);
326
341
  }>,
327
342
  ): Promise<
328
343
  Result<
@@ -355,10 +370,12 @@ export const formatDiffFrom = async (
355
370
  if (!silent) {
356
371
  console.error('Error getting changed files:', diffFromBaseResult.value);
357
372
  }
373
+
358
374
  return diffFromBaseResult;
359
375
  }
360
376
 
361
377
  const diffFiles = diffFromBaseResult.value;
378
+
362
379
  const mut_allFiles: string[] = diffFiles.slice();
363
380
 
364
381
  // If includeUntracked is true, also get untracked files
@@ -375,6 +392,7 @@ export const formatDiffFrom = async (
375
392
  if (!silent) {
376
393
  console.error(`Error getting ${type} files:`, filesResult.value);
377
394
  }
395
+
378
396
  return filesResult;
379
397
  }
380
398
 
@@ -408,6 +426,7 @@ export const formatDiffFrom = async (
408
426
 
409
427
  if (allFiles.length === 0) {
410
428
  conditionalEcho('No files to format');
429
+
411
430
  return Result.ok(undefined);
412
431
  }
413
432