type-git 0.3.0-alpha.1 → 0.3.0-alpha.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.
@@ -487,6 +487,22 @@ var DEFAULT_ENV_ALLOWLIST = [
487
487
  // SSH agent (required for Git-over-SSH authentication)
488
488
  "SSH_AUTH_SOCK",
489
489
  "SSH_AGENT_PID",
490
+ // Git SSH transport and TLS configuration. These are commonly required for
491
+ // fetch/push to keep working under the default allowlist. They are transport
492
+ // configuration rather than credential stores, but note they can still carry
493
+ // sensitive data depending on local setup (e.g. GIT_SSH_COMMAND can name a command
494
+ // Git executes). The most credential-prone / askpass variables (GIT_ASKPASS,
495
+ // SSH_ASKPASS, GIT_PROXY_COMMAND) are intentionally NOT inherited by default — they
496
+ // can carry inline credentials or run a helper that reads secrets from the
497
+ // environment, which would weaken the traversal-prevention model. Opt into those
498
+ // explicitly via `inheritEnv` when needed.
499
+ "GIT_SSH",
500
+ "GIT_SSH_COMMAND",
501
+ "GIT_SSH_VARIANT",
502
+ "GIT_SSL_CAINFO",
503
+ "GIT_SSL_CAPATH",
504
+ "GIT_TERMINAL_PROMPT",
505
+ "GIT_CONFIG_NOSYSTEM",
490
506
  // HTTP(S) proxy configuration (required for Git network operations behind a proxy)
491
507
  "HTTP_PROXY",
492
508
  "HTTPS_PROXY",
@@ -517,35 +533,52 @@ var DEFAULT_ENV_ALLOWLIST = [
517
533
  "NUMBER_OF_PROCESSORS",
518
534
  "PROCESSOR_ARCHITECTURE"
519
535
  ];
520
- function resolveInheritedEnv(parentEnv, inheritEnv, platform = "") {
521
- if (inheritEnv === true) {
522
- const all = {};
523
- for (const [key, value] of Object.entries(parentEnv)) {
524
- if (value !== void 0) {
525
- all[key] = value;
526
- }
536
+ function pickEnv(parentEnv, predicate) {
537
+ const result = {};
538
+ for (const [key, value] of Object.entries(parentEnv)) {
539
+ if (value !== void 0 && predicate(key)) {
540
+ result[key] = value;
527
541
  }
528
- return all;
529
542
  }
543
+ return result;
544
+ }
545
+ function buildAllowlist(inheritEnv) {
530
546
  const allow = new Set(inheritEnv === false ? [] : DEFAULT_ENV_ALLOWLIST);
531
547
  if (Array.isArray(inheritEnv)) {
532
548
  for (const name of inheritEnv) {
533
549
  allow.add(name);
534
550
  }
551
+ return { allow, remove: void 0 };
535
552
  }
536
- const isWindows = platform === "win32";
537
- const allowLower = isWindows ? new Set([...allow].map((name) => name.toLowerCase())) : null;
538
- const result = {};
539
- for (const [key, value] of Object.entries(parentEnv)) {
540
- if (value === void 0) {
541
- continue;
542
- }
543
- const allowed = allowLower ? allowLower.has(key.toLowerCase()) : allow.has(key);
544
- if (allowed) {
545
- result[key] = value;
546
- }
553
+ if (inheritEnv === false) {
554
+ return { allow, remove: void 0 };
547
555
  }
548
- return result;
556
+ for (const name of inheritEnv.add ?? []) {
557
+ allow.add(name);
558
+ }
559
+ const hasRemove = inheritEnv.remove !== void 0 && inheritEnv.remove.length > 0;
560
+ const remove = hasRemove ? new Set(inheritEnv.remove) : void 0;
561
+ return { allow, remove };
562
+ }
563
+ function makeNameMatcher(names, isWindows) {
564
+ if (!isWindows) {
565
+ return (name) => names.has(name);
566
+ }
567
+ const lower = new Set([...names].map((name) => name.toLowerCase()));
568
+ return (name) => lower.has(name.toLowerCase());
569
+ }
570
+ function resolveInheritedEnv(parentEnv, inheritEnv, platform = "") {
571
+ if (inheritEnv === true) {
572
+ return pickEnv(parentEnv, () => true);
573
+ }
574
+ if (typeof inheritEnv === "function") {
575
+ return pickEnv(parentEnv, inheritEnv);
576
+ }
577
+ const { allow, remove } = buildAllowlist(inheritEnv ?? []);
578
+ const isWindows = platform === "win32";
579
+ const isAllowed = makeNameMatcher(allow, isWindows);
580
+ const isRemoved = remove ? makeNameMatcher(remove, isWindows) : () => false;
581
+ return pickEnv(parentEnv, (name) => isAllowed(name) && !isRemoved(name));
549
582
  }
550
583
 
551
584
  // src/runner/cli-runner.ts
@@ -730,8 +763,11 @@ var CliRunner = class _CliRunner {
730
763
  */
731
764
  async run(context, args, opts) {
732
765
  const argv = this.buildArgv(context, args);
733
- const { signal, onProgress, onLfsProgress } = opts ?? {};
766
+ const { signal, onProgress, onLfsProgress, env: envOverride } = opts ?? {};
734
767
  const env = this.buildEnv();
768
+ if (envOverride) {
769
+ Object.assign(env, envOverride);
770
+ }
735
771
  if (onLfsProgress) {
736
772
  env.GIT_LFS_FORCE_PROGRESS = "1";
737
773
  }
@@ -751,6 +787,7 @@ var CliRunner = class _CliRunner {
751
787
  result = await this.exec.spawn(
752
788
  {
753
789
  argv,
790
+ stdin: opts?.stdin,
754
791
  env,
755
792
  // The env above is already fully resolved (including any inherited variables),
756
793
  // so the adapter must not merge the parent environment on top of it.
@@ -1299,7 +1336,7 @@ var BareRepoImpl = class {
1299
1336
  */
1300
1337
  async push(opts) {
1301
1338
  const args = ["push"];
1302
- if (opts?.onProgress) {
1339
+ if (opts?.onProgress || opts?.onLfsProgress) {
1303
1340
  args.push("--progress");
1304
1341
  }
1305
1342
  if (opts?.force) {
@@ -1606,7 +1643,53 @@ var BareRepoImpl = class {
1606
1643
  }
1607
1644
  };
1608
1645
 
1646
+ // src/internal/concurrency.ts
1647
+ async function runWithConcurrency(items, run, options) {
1648
+ const { concurrency, warmupCount = 0 } = options;
1649
+ if (!Number.isInteger(concurrency) || concurrency < 1) {
1650
+ throw new RangeError(`concurrency must be a positive integer, got: ${concurrency}`);
1651
+ }
1652
+ if (!Number.isInteger(warmupCount) || warmupCount < 0) {
1653
+ throw new RangeError(`warmupCount must be a non-negative integer, got: ${warmupCount}`);
1654
+ }
1655
+ const results = new Array(items.length);
1656
+ let nextIndex = 0;
1657
+ let failed = false;
1658
+ let firstError;
1659
+ const runOne = async (index) => {
1660
+ try {
1661
+ const item = items[index];
1662
+ results[index] = await run(item, index);
1663
+ } catch (error) {
1664
+ if (!failed) {
1665
+ failed = true;
1666
+ firstError = error;
1667
+ }
1668
+ }
1669
+ };
1670
+ const warmupEnd = Math.min(warmupCount, items.length);
1671
+ while (nextIndex < warmupEnd && !failed) {
1672
+ await runOne(nextIndex++);
1673
+ }
1674
+ if (!failed && nextIndex < items.length) {
1675
+ const worker = async () => {
1676
+ while (!failed && nextIndex < items.length) {
1677
+ await runOne(nextIndex++);
1678
+ }
1679
+ };
1680
+ const workerCount = Math.min(concurrency, items.length - nextIndex);
1681
+ await Promise.all(Array.from({ length: workerCount }, () => worker()));
1682
+ }
1683
+ if (failed) {
1684
+ throw firstError;
1685
+ }
1686
+ return results;
1687
+ }
1688
+
1609
1689
  // src/impl/worktree-repo-impl.ts
1690
+ var PRE_UPLOAD_DEFAULT_BATCH_SIZE = 200;
1691
+ var PRE_UPLOAD_DEFAULT_CONCURRENCY = 4;
1692
+ var PRE_UPLOAD_WARMUP_BATCH_COUNT = 1;
1610
1693
  var WorktreeRepoImpl = class _WorktreeRepoImpl {
1611
1694
  workdir;
1612
1695
  runner;
@@ -2197,7 +2280,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2197
2280
  */
2198
2281
  async push(opts) {
2199
2282
  const args = ["push"];
2200
- if (opts?.onProgress) {
2283
+ if (opts?.onProgress || opts?.onLfsProgress) {
2201
2284
  args.push("--progress");
2202
2285
  }
2203
2286
  if (opts?.verbose) {
@@ -2302,6 +2385,29 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2302
2385
  setLfsMode(mode) {
2303
2386
  this._lfsMode = mode;
2304
2387
  }
2388
+ /**
2389
+ * Per-command environment overrides derived from the configured LFS mode.
2390
+ *
2391
+ * When the repository was opened (or reconfigured) with an object-form LFS
2392
+ * mode requesting `skipSmudge` and/or `skipDownload`, working-tree-populating
2393
+ * operations (checkout, switch, reset, merge, pull, rebase, restore) run with
2394
+ * `GIT_LFS_SKIP_SMUDGE=1`. Git then leaves LFS pointer files in place instead
2395
+ * of downloading their contents during the implicit checkout.
2396
+ *
2397
+ * The objects can be materialized later via the explicit `repo.lfs.pull()` /
2398
+ * `repo.lfs.checkout()` helpers, which use dedicated git-lfs commands and are
2399
+ * not affected by `GIT_LFS_SKIP_SMUDGE`.
2400
+ *
2401
+ * Returns `undefined` for the `'enabled'` / `'disabled'` string modes so the
2402
+ * runner environment is left untouched.
2403
+ */
2404
+ lfsModeEnv() {
2405
+ const mode = this._lfsMode;
2406
+ if (typeof mode === "object" && (mode.skipSmudge === true || mode.skipDownload === true)) {
2407
+ return { GIT_LFS_SKIP_SMUDGE: "1" };
2408
+ }
2409
+ return void 0;
2410
+ }
2305
2411
  // ==========================================================================
2306
2412
  // LFS Operations
2307
2413
  // ==========================================================================
@@ -2324,36 +2430,41 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2324
2430
  }
2325
2431
  await this.runner.runOrThrow(this.context, args, {
2326
2432
  signal: opts?.signal,
2327
- onProgress: opts?.onProgress
2433
+ onProgress: opts?.onProgress,
2434
+ onLfsProgress: opts?.onLfsProgress
2328
2435
  });
2329
2436
  }
2330
2437
  async lfsPush(opts) {
2331
2438
  if (this._lfsMode === "disabled") {
2332
2439
  return;
2333
2440
  }
2441
+ if (opts?.stdin && opts.objectId === void 0 && !opts.ref) {
2442
+ throw new TypeError("lfs.push with stdin requires objectId or ref");
2443
+ }
2334
2444
  const args = ["lfs", "push"];
2335
2445
  if (opts?.dryRun) {
2336
2446
  args.push("--dry-run");
2337
2447
  }
2338
- if (opts?.objectId) {
2339
- const oids = Array.isArray(opts.objectId) ? opts.objectId : [opts.objectId];
2340
- for (const oid of oids) {
2341
- args.push("--object-id", oid);
2342
- }
2343
- } else {
2344
- args.push("--all");
2448
+ const oids = opts?.objectId !== void 0 ? Array.isArray(opts.objectId) ? opts.objectId : [opts.objectId] : void 0;
2449
+ if (oids?.length === 0 && !opts?.stdin) {
2450
+ throw new TypeError(
2451
+ "lfs.push with objectId requires at least one OID unless stdin is enabled"
2452
+ );
2345
2453
  }
2346
- if (opts?.remote) {
2347
- args.push(opts.remote);
2454
+ args.push(oids ? "--object-id" : "--all");
2455
+ args.push(opts?.remote ?? "origin");
2456
+ const values = oids ?? (opts?.ref ? [opts.ref] : []);
2457
+ if (opts?.stdin) {
2458
+ args.push("--stdin");
2348
2459
  } else {
2349
- args.push("origin");
2350
- }
2351
- if (opts?.ref) {
2352
- args.push(opts.ref);
2460
+ args.push(...values);
2353
2461
  }
2354
2462
  await this.runner.runOrThrow(this.context, args, {
2463
+ stdin: opts?.stdin ? values.length > 0 ? `${values.join("\n")}
2464
+ ` : "" : void 0,
2355
2465
  signal: opts?.signal,
2356
- onProgress: opts?.onProgress
2466
+ onProgress: opts?.onProgress,
2467
+ onLfsProgress: opts?.onLfsProgress
2357
2468
  });
2358
2469
  }
2359
2470
  async lfsStatus(opts) {
@@ -2389,12 +2500,19 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2389
2500
  * Pre-upload LFS objects before commit/push (2-phase commit pattern)
2390
2501
  *
2391
2502
  * This allows uploading LFS objects to the remote before creating a commit,
2392
- * ensuring reliable large file handling. Objects are batched to handle
2393
- * Windows command line length limits (8KB).
2503
+ * ensuring reliable large file handling. Objects are batched to stay within
2504
+ * command-line length limits, and batches run with bounded concurrency to
2505
+ * overlap per-invocation fixed costs with other batches' transfers.
2506
+ *
2507
+ * Failure handling: once a batch fails, no new batch is started (in-flight
2508
+ * batches are awaited), and the objects of failed and unstarted batches are
2509
+ * reported in `skippedCount`. The first batch always runs alone before the
2510
+ * remaining batches widen to the concurrency limit, so a failure common to
2511
+ * all batches costs a single round-trip.
2394
2512
  *
2395
2513
  * Usage pattern:
2396
2514
  * 1. Stage changes: git add
2397
- * 2. Pre-upload LFS: await repo.lfs.preUpload()
2515
+ * 2. Pre-upload LFS: await repo.lfsExtra.preUpload()
2398
2516
  * 3. Commit: git commit
2399
2517
  * 4. Push refs: git push (only refs, objects already uploaded)
2400
2518
  */
@@ -2403,7 +2521,14 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2403
2521
  return { uploadedCount: 0, uploadedBytes: 0, skippedCount: 0 };
2404
2522
  }
2405
2523
  const remote = opts?.remote ?? "origin";
2406
- const batchSize = opts?.batchSize ?? 50;
2524
+ const batchSize = opts?.batchSize ?? PRE_UPLOAD_DEFAULT_BATCH_SIZE;
2525
+ const concurrency = opts?.concurrency ?? PRE_UPLOAD_DEFAULT_CONCURRENCY;
2526
+ if (!Number.isInteger(batchSize) || batchSize < 1) {
2527
+ throw new RangeError(`batchSize must be a positive integer, got: ${batchSize}`);
2528
+ }
2529
+ if (!Number.isInteger(concurrency) || concurrency < 1) {
2530
+ throw new RangeError(`concurrency must be a positive integer, got: ${concurrency}`);
2531
+ }
2407
2532
  let oids;
2408
2533
  if (opts?.oids && opts.oids.length > 0) {
2409
2534
  oids = opts.oids;
@@ -2428,17 +2553,24 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2428
2553
  if (oids.length === 0) {
2429
2554
  return { uploadedCount: 0, uploadedBytes: 0, skippedCount: 0 };
2430
2555
  }
2556
+ const batches = [];
2557
+ for (let i = 0; i < oids.length; i += batchSize) {
2558
+ batches.push(oids.slice(i, i + batchSize));
2559
+ }
2431
2560
  let uploadedCount = 0;
2432
2561
  let uploadedBytes = 0;
2433
2562
  let skippedCount = 0;
2434
- for (let i = 0; i < oids.length; i += batchSize) {
2435
- const batch = oids.slice(i, i + batchSize);
2563
+ let attemptedCount = 0;
2564
+ const batchFailedStop = new Error("lfs pre-upload batch failed");
2565
+ const pushBatch = async (batch) => {
2436
2566
  const args = ["lfs", "push", remote, "--object-id", ...batch];
2437
2567
  const result = await this.runner.run(this.context, args, {
2438
2568
  signal: opts?.signal,
2439
- onProgress: opts?.onProgress
2569
+ onProgress: opts?.onProgress,
2570
+ onLfsProgress: opts?.onLfsProgress
2440
2571
  });
2441
- if (result.exitCode === 0) {
2572
+ attemptedCount += batch.length;
2573
+ if (result.exitCode === 0 && !result.aborted) {
2442
2574
  uploadedCount += batch.length;
2443
2575
  const bytesMatch = result.stderr.match(
2444
2576
  /Uploading LFS objects:.*?\((\d+(?:\.\d+)?)\s*([KMG]?B)/i
@@ -2458,7 +2590,19 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2458
2590
  }
2459
2591
  } else {
2460
2592
  skippedCount += batch.length;
2593
+ throw batchFailedStop;
2461
2594
  }
2595
+ };
2596
+ try {
2597
+ await runWithConcurrency(batches, pushBatch, {
2598
+ concurrency,
2599
+ warmupCount: PRE_UPLOAD_WARMUP_BATCH_COUNT
2600
+ });
2601
+ } catch (error) {
2602
+ if (error !== batchFailedStop) {
2603
+ throw error;
2604
+ }
2605
+ skippedCount += oids.length - attemptedCount;
2462
2606
  }
2463
2607
  return { uploadedCount, uploadedBytes, skippedCount };
2464
2608
  }
@@ -2470,7 +2614,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2470
2614
  *
2471
2615
  * Usage pattern:
2472
2616
  * 1. Fetch refs: git fetch
2473
- * 2. Pre-download LFS: await repo.lfs.preDownload({ ref: 'origin/feature' })
2617
+ * 2. Pre-download LFS: await repo.lfsExtra.preDownload({ ref: 'origin/feature' })
2474
2618
  * 3. Checkout: git checkout feature
2475
2619
  */
2476
2620
  async lfsPreDownload(opts) {
@@ -2479,6 +2623,9 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2479
2623
  }
2480
2624
  const remote = opts?.remote ?? "origin";
2481
2625
  const batchSize = opts?.batchSize ?? 50;
2626
+ if (!Number.isInteger(batchSize) || batchSize < 1) {
2627
+ throw new RangeError(`batchSize must be a positive integer, got: ${batchSize}`);
2628
+ }
2482
2629
  let oids;
2483
2630
  if (opts?.oids && opts.oids.length > 0) {
2484
2631
  oids = opts.oids;
@@ -2513,7 +2660,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2513
2660
  const args = ["lfs", "fetch", remote, "--", ...batch];
2514
2661
  const result = await this.runner.run(this.context, args, {
2515
2662
  signal: opts?.signal,
2516
- onProgress: opts?.onProgress
2663
+ onProgress: opts?.onProgress,
2664
+ onLfsProgress: opts?.onLfsProgress
2517
2665
  });
2518
2666
  if (result.exitCode === 0) {
2519
2667
  downloadedCount += batch.length;
@@ -2578,7 +2726,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2578
2726
  return;
2579
2727
  }
2580
2728
  const args = ["lfs", "fetch"];
2581
- if (opts?.onProgress) {
2729
+ if (opts?.onProgress || opts?.onLfsProgress) {
2582
2730
  args.push("--progress");
2583
2731
  }
2584
2732
  if (opts?.all) {
@@ -2611,7 +2759,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2611
2759
  }
2612
2760
  await this.runner.runOrThrow(this.context, args, {
2613
2761
  signal: opts?.signal,
2614
- onProgress: opts?.onProgress
2762
+ onProgress: opts?.onProgress,
2763
+ onLfsProgress: opts?.onLfsProgress
2615
2764
  });
2616
2765
  }
2617
2766
  async lfsInstall(opts) {
@@ -3373,7 +3522,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3373
3522
  }
3374
3523
  }
3375
3524
  await this.runner.runOrThrow(this.context, args, {
3376
- signal: opts?.signal
3525
+ signal: opts?.signal,
3526
+ env: this.lfsModeEnv()
3377
3527
  });
3378
3528
  }
3379
3529
  // ==========================================================================
@@ -3730,7 +3880,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3730
3880
  }
3731
3881
  args.push(branch);
3732
3882
  const result = await this.runner.run(this.context, args, {
3733
- signal: opts?.signal
3883
+ signal: opts?.signal,
3884
+ env: this.lfsModeEnv()
3734
3885
  });
3735
3886
  if (result.exitCode !== 0) {
3736
3887
  const statusResult = await this.runner.runOrThrow(this.context, ["status", "--porcelain"], {
@@ -3759,7 +3910,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3759
3910
  // ==========================================================================
3760
3911
  async pull(opts) {
3761
3912
  const args = ["pull"];
3762
- if (opts?.onProgress) {
3913
+ if (opts?.onProgress || opts?.onLfsProgress) {
3763
3914
  args.push("--progress");
3764
3915
  }
3765
3916
  if (opts?.rebase === true) {
@@ -3907,7 +4058,9 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3907
4058
  }
3908
4059
  await this.runner.runOrThrow(this.context, args, {
3909
4060
  signal: opts?.signal,
3910
- onProgress: opts?.onProgress
4061
+ onProgress: opts?.onProgress,
4062
+ onLfsProgress: opts?.onLfsProgress,
4063
+ env: this.lfsModeEnv()
3911
4064
  });
3912
4065
  }
3913
4066
  // ==========================================================================
@@ -3937,7 +4090,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3937
4090
  args.push(target);
3938
4091
  }
3939
4092
  await this.runner.runOrThrow(this.context, args, {
3940
- signal: opts?.signal
4093
+ signal: opts?.signal,
4094
+ env: this.lfsModeEnv()
3941
4095
  });
3942
4096
  }
3943
4097
  // ==========================================================================
@@ -4133,7 +4287,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
4133
4287
  args.push(opts.startPoint);
4134
4288
  }
4135
4289
  await this.runner.runOrThrow(this.context, args, {
4136
- signal: opts?.signal
4290
+ signal: opts?.signal,
4291
+ env: this.lfsModeEnv()
4137
4292
  });
4138
4293
  }
4139
4294
  // ==========================================================================
@@ -4560,7 +4715,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
4560
4715
  args.push(opts.upstream);
4561
4716
  }
4562
4717
  await this.runner.runOrThrow(this.context, args, {
4563
- signal: opts?.signal
4718
+ signal: opts?.signal,
4719
+ env: this.lfsModeEnv()
4564
4720
  });
4565
4721
  }
4566
4722
  // ==========================================================================
@@ -4618,7 +4774,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
4618
4774
  const pathList = Array.isArray(paths) ? paths : [paths];
4619
4775
  args.push("--", ...pathList);
4620
4776
  await this.runner.runOrThrow(this.context, args, {
4621
- signal: opts?.signal
4777
+ signal: opts?.signal,
4778
+ env: this.lfsModeEnv()
4622
4779
  });
4623
4780
  }
4624
4781
  // ==========================================================================
@@ -5631,7 +5788,7 @@ var GitImpl = class {
5631
5788
  }
5632
5789
  async clone(url, path, opts) {
5633
5790
  const args = buildCloneArgs(opts);
5634
- if (opts?.onProgress) {
5791
+ if (opts?.onProgress || opts?.onLfsProgress) {
5635
5792
  args.push("--progress");
5636
5793
  }
5637
5794
  args.push(url, path);
@@ -6015,7 +6172,7 @@ var NodeExecAdapter = class {
6015
6172
  const child = (0, import_node_child_process.spawn)(command, args, {
6016
6173
  cwd,
6017
6174
  env: resolveChildEnv(env, inheritEnv),
6018
- stdio: ["ignore", "pipe", "pipe"]
6175
+ stdio: [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"]
6019
6176
  });
6020
6177
  let stdout = "";
6021
6178
  let stderr = "";
@@ -6043,6 +6200,12 @@ var NodeExecAdapter = class {
6043
6200
  stderr += text;
6044
6201
  handlers?.onStderr?.(text);
6045
6202
  });
6203
+ child.stdin?.on("error", (error) => {
6204
+ if (error.code !== "EPIPE" && error.code !== "EOF") {
6205
+ reject(error);
6206
+ }
6207
+ });
6208
+ child.stdin?.end(options.stdin);
6046
6209
  child.on("error", (error) => {
6047
6210
  signal?.removeEventListener("abort", abortHandler);
6048
6211
  reject(error);
@@ -6071,7 +6234,7 @@ var NodeExecAdapter = class {
6071
6234
  const child = (0, import_node_child_process.spawn)(command, args, {
6072
6235
  cwd,
6073
6236
  env: resolveChildEnv(env, inheritEnv),
6074
- stdio: ["ignore", "pipe", "pipe"]
6237
+ stdio: [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"]
6075
6238
  });
6076
6239
  let aborted = false;
6077
6240
  let exitSignal;
@@ -6096,6 +6259,12 @@ var NodeExecAdapter = class {
6096
6259
  child.stderr?.on("data", (chunk) => {
6097
6260
  stderr += chunk.toString("utf8");
6098
6261
  });
6262
+ child.stdin?.on("error", (error) => {
6263
+ if (error.code !== "EPIPE" && error.code !== "EOF") {
6264
+ reject(error);
6265
+ }
6266
+ });
6267
+ child.stdin?.end(options.stdin);
6099
6268
  child.on("error", (error) => {
6100
6269
  signal?.removeEventListener("abort", abortHandler);
6101
6270
  reject(error);