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.
@@ -448,6 +448,22 @@ var DEFAULT_ENV_ALLOWLIST = [
448
448
  // SSH agent (required for Git-over-SSH authentication)
449
449
  "SSH_AUTH_SOCK",
450
450
  "SSH_AGENT_PID",
451
+ // Git SSH transport and TLS configuration. These are commonly required for
452
+ // fetch/push to keep working under the default allowlist. They are transport
453
+ // configuration rather than credential stores, but note they can still carry
454
+ // sensitive data depending on local setup (e.g. GIT_SSH_COMMAND can name a command
455
+ // Git executes). The most credential-prone / askpass variables (GIT_ASKPASS,
456
+ // SSH_ASKPASS, GIT_PROXY_COMMAND) are intentionally NOT inherited by default — they
457
+ // can carry inline credentials or run a helper that reads secrets from the
458
+ // environment, which would weaken the traversal-prevention model. Opt into those
459
+ // explicitly via `inheritEnv` when needed.
460
+ "GIT_SSH",
461
+ "GIT_SSH_COMMAND",
462
+ "GIT_SSH_VARIANT",
463
+ "GIT_SSL_CAINFO",
464
+ "GIT_SSL_CAPATH",
465
+ "GIT_TERMINAL_PROMPT",
466
+ "GIT_CONFIG_NOSYSTEM",
451
467
  // HTTP(S) proxy configuration (required for Git network operations behind a proxy)
452
468
  "HTTP_PROXY",
453
469
  "HTTPS_PROXY",
@@ -478,35 +494,52 @@ var DEFAULT_ENV_ALLOWLIST = [
478
494
  "NUMBER_OF_PROCESSORS",
479
495
  "PROCESSOR_ARCHITECTURE"
480
496
  ];
481
- function resolveInheritedEnv(parentEnv, inheritEnv, platform = "") {
482
- if (inheritEnv === true) {
483
- const all = {};
484
- for (const [key, value] of Object.entries(parentEnv)) {
485
- if (value !== void 0) {
486
- all[key] = value;
487
- }
497
+ function pickEnv(parentEnv, predicate) {
498
+ const result = {};
499
+ for (const [key, value] of Object.entries(parentEnv)) {
500
+ if (value !== void 0 && predicate(key)) {
501
+ result[key] = value;
488
502
  }
489
- return all;
490
503
  }
504
+ return result;
505
+ }
506
+ function buildAllowlist(inheritEnv) {
491
507
  const allow = new Set(inheritEnv === false ? [] : DEFAULT_ENV_ALLOWLIST);
492
508
  if (Array.isArray(inheritEnv)) {
493
509
  for (const name of inheritEnv) {
494
510
  allow.add(name);
495
511
  }
512
+ return { allow, remove: void 0 };
496
513
  }
497
- const isWindows = platform === "win32";
498
- const allowLower = isWindows ? new Set([...allow].map((name) => name.toLowerCase())) : null;
499
- const result = {};
500
- for (const [key, value] of Object.entries(parentEnv)) {
501
- if (value === void 0) {
502
- continue;
503
- }
504
- const allowed = allowLower ? allowLower.has(key.toLowerCase()) : allow.has(key);
505
- if (allowed) {
506
- result[key] = value;
507
- }
514
+ if (inheritEnv === false) {
515
+ return { allow, remove: void 0 };
508
516
  }
509
- return result;
517
+ for (const name of inheritEnv.add ?? []) {
518
+ allow.add(name);
519
+ }
520
+ const hasRemove = inheritEnv.remove !== void 0 && inheritEnv.remove.length > 0;
521
+ const remove = hasRemove ? new Set(inheritEnv.remove) : void 0;
522
+ return { allow, remove };
523
+ }
524
+ function makeNameMatcher(names, isWindows) {
525
+ if (!isWindows) {
526
+ return (name) => names.has(name);
527
+ }
528
+ const lower = new Set([...names].map((name) => name.toLowerCase()));
529
+ return (name) => lower.has(name.toLowerCase());
530
+ }
531
+ function resolveInheritedEnv(parentEnv, inheritEnv, platform = "") {
532
+ if (inheritEnv === true) {
533
+ return pickEnv(parentEnv, () => true);
534
+ }
535
+ if (typeof inheritEnv === "function") {
536
+ return pickEnv(parentEnv, inheritEnv);
537
+ }
538
+ const { allow, remove } = buildAllowlist(inheritEnv ?? []);
539
+ const isWindows = platform === "win32";
540
+ const isAllowed = makeNameMatcher(allow, isWindows);
541
+ const isRemoved = remove ? makeNameMatcher(remove, isWindows) : () => false;
542
+ return pickEnv(parentEnv, (name) => isAllowed(name) && !isRemoved(name));
510
543
  }
511
544
 
512
545
  // src/runner/cli-runner.ts
@@ -691,8 +724,11 @@ var CliRunner = class _CliRunner {
691
724
  */
692
725
  async run(context, args, opts) {
693
726
  const argv = this.buildArgv(context, args);
694
- const { signal, onProgress, onLfsProgress } = opts ?? {};
727
+ const { signal, onProgress, onLfsProgress, env: envOverride } = opts ?? {};
695
728
  const env = this.buildEnv();
729
+ if (envOverride) {
730
+ Object.assign(env, envOverride);
731
+ }
696
732
  if (onLfsProgress) {
697
733
  env.GIT_LFS_FORCE_PROGRESS = "1";
698
734
  }
@@ -712,6 +748,7 @@ var CliRunner = class _CliRunner {
712
748
  result = await this.exec.spawn(
713
749
  {
714
750
  argv,
751
+ stdin: opts?.stdin,
715
752
  env,
716
753
  // The env above is already fully resolved (including any inherited variables),
717
754
  // so the adapter must not merge the parent environment on top of it.
@@ -1260,7 +1297,7 @@ var BareRepoImpl = class {
1260
1297
  */
1261
1298
  async push(opts) {
1262
1299
  const args = ["push"];
1263
- if (opts?.onProgress) {
1300
+ if (opts?.onProgress || opts?.onLfsProgress) {
1264
1301
  args.push("--progress");
1265
1302
  }
1266
1303
  if (opts?.force) {
@@ -1567,7 +1604,53 @@ var BareRepoImpl = class {
1567
1604
  }
1568
1605
  };
1569
1606
 
1607
+ // src/internal/concurrency.ts
1608
+ async function runWithConcurrency(items, run, options) {
1609
+ const { concurrency, warmupCount = 0 } = options;
1610
+ if (!Number.isInteger(concurrency) || concurrency < 1) {
1611
+ throw new RangeError(`concurrency must be a positive integer, got: ${concurrency}`);
1612
+ }
1613
+ if (!Number.isInteger(warmupCount) || warmupCount < 0) {
1614
+ throw new RangeError(`warmupCount must be a non-negative integer, got: ${warmupCount}`);
1615
+ }
1616
+ const results = new Array(items.length);
1617
+ let nextIndex = 0;
1618
+ let failed = false;
1619
+ let firstError;
1620
+ const runOne = async (index) => {
1621
+ try {
1622
+ const item = items[index];
1623
+ results[index] = await run(item, index);
1624
+ } catch (error) {
1625
+ if (!failed) {
1626
+ failed = true;
1627
+ firstError = error;
1628
+ }
1629
+ }
1630
+ };
1631
+ const warmupEnd = Math.min(warmupCount, items.length);
1632
+ while (nextIndex < warmupEnd && !failed) {
1633
+ await runOne(nextIndex++);
1634
+ }
1635
+ if (!failed && nextIndex < items.length) {
1636
+ const worker = async () => {
1637
+ while (!failed && nextIndex < items.length) {
1638
+ await runOne(nextIndex++);
1639
+ }
1640
+ };
1641
+ const workerCount = Math.min(concurrency, items.length - nextIndex);
1642
+ await Promise.all(Array.from({ length: workerCount }, () => worker()));
1643
+ }
1644
+ if (failed) {
1645
+ throw firstError;
1646
+ }
1647
+ return results;
1648
+ }
1649
+
1570
1650
  // src/impl/worktree-repo-impl.ts
1651
+ var PRE_UPLOAD_DEFAULT_BATCH_SIZE = 200;
1652
+ var PRE_UPLOAD_DEFAULT_CONCURRENCY = 4;
1653
+ var PRE_UPLOAD_WARMUP_BATCH_COUNT = 1;
1571
1654
  var WorktreeRepoImpl = class _WorktreeRepoImpl {
1572
1655
  workdir;
1573
1656
  runner;
@@ -2158,7 +2241,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2158
2241
  */
2159
2242
  async push(opts) {
2160
2243
  const args = ["push"];
2161
- if (opts?.onProgress) {
2244
+ if (opts?.onProgress || opts?.onLfsProgress) {
2162
2245
  args.push("--progress");
2163
2246
  }
2164
2247
  if (opts?.verbose) {
@@ -2263,6 +2346,29 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2263
2346
  setLfsMode(mode) {
2264
2347
  this._lfsMode = mode;
2265
2348
  }
2349
+ /**
2350
+ * Per-command environment overrides derived from the configured LFS mode.
2351
+ *
2352
+ * When the repository was opened (or reconfigured) with an object-form LFS
2353
+ * mode requesting `skipSmudge` and/or `skipDownload`, working-tree-populating
2354
+ * operations (checkout, switch, reset, merge, pull, rebase, restore) run with
2355
+ * `GIT_LFS_SKIP_SMUDGE=1`. Git then leaves LFS pointer files in place instead
2356
+ * of downloading their contents during the implicit checkout.
2357
+ *
2358
+ * The objects can be materialized later via the explicit `repo.lfs.pull()` /
2359
+ * `repo.lfs.checkout()` helpers, which use dedicated git-lfs commands and are
2360
+ * not affected by `GIT_LFS_SKIP_SMUDGE`.
2361
+ *
2362
+ * Returns `undefined` for the `'enabled'` / `'disabled'` string modes so the
2363
+ * runner environment is left untouched.
2364
+ */
2365
+ lfsModeEnv() {
2366
+ const mode = this._lfsMode;
2367
+ if (typeof mode === "object" && (mode.skipSmudge === true || mode.skipDownload === true)) {
2368
+ return { GIT_LFS_SKIP_SMUDGE: "1" };
2369
+ }
2370
+ return void 0;
2371
+ }
2266
2372
  // ==========================================================================
2267
2373
  // LFS Operations
2268
2374
  // ==========================================================================
@@ -2285,36 +2391,41 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2285
2391
  }
2286
2392
  await this.runner.runOrThrow(this.context, args, {
2287
2393
  signal: opts?.signal,
2288
- onProgress: opts?.onProgress
2394
+ onProgress: opts?.onProgress,
2395
+ onLfsProgress: opts?.onLfsProgress
2289
2396
  });
2290
2397
  }
2291
2398
  async lfsPush(opts) {
2292
2399
  if (this._lfsMode === "disabled") {
2293
2400
  return;
2294
2401
  }
2402
+ if (opts?.stdin && opts.objectId === void 0 && !opts.ref) {
2403
+ throw new TypeError("lfs.push with stdin requires objectId or ref");
2404
+ }
2295
2405
  const args = ["lfs", "push"];
2296
2406
  if (opts?.dryRun) {
2297
2407
  args.push("--dry-run");
2298
2408
  }
2299
- if (opts?.objectId) {
2300
- const oids = Array.isArray(opts.objectId) ? opts.objectId : [opts.objectId];
2301
- for (const oid of oids) {
2302
- args.push("--object-id", oid);
2303
- }
2304
- } else {
2305
- args.push("--all");
2409
+ const oids = opts?.objectId !== void 0 ? Array.isArray(opts.objectId) ? opts.objectId : [opts.objectId] : void 0;
2410
+ if (oids?.length === 0 && !opts?.stdin) {
2411
+ throw new TypeError(
2412
+ "lfs.push with objectId requires at least one OID unless stdin is enabled"
2413
+ );
2306
2414
  }
2307
- if (opts?.remote) {
2308
- args.push(opts.remote);
2415
+ args.push(oids ? "--object-id" : "--all");
2416
+ args.push(opts?.remote ?? "origin");
2417
+ const values = oids ?? (opts?.ref ? [opts.ref] : []);
2418
+ if (opts?.stdin) {
2419
+ args.push("--stdin");
2309
2420
  } else {
2310
- args.push("origin");
2311
- }
2312
- if (opts?.ref) {
2313
- args.push(opts.ref);
2421
+ args.push(...values);
2314
2422
  }
2315
2423
  await this.runner.runOrThrow(this.context, args, {
2424
+ stdin: opts?.stdin ? values.length > 0 ? `${values.join("\n")}
2425
+ ` : "" : void 0,
2316
2426
  signal: opts?.signal,
2317
- onProgress: opts?.onProgress
2427
+ onProgress: opts?.onProgress,
2428
+ onLfsProgress: opts?.onLfsProgress
2318
2429
  });
2319
2430
  }
2320
2431
  async lfsStatus(opts) {
@@ -2350,12 +2461,19 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2350
2461
  * Pre-upload LFS objects before commit/push (2-phase commit pattern)
2351
2462
  *
2352
2463
  * This allows uploading LFS objects to the remote before creating a commit,
2353
- * ensuring reliable large file handling. Objects are batched to handle
2354
- * Windows command line length limits (8KB).
2464
+ * ensuring reliable large file handling. Objects are batched to stay within
2465
+ * command-line length limits, and batches run with bounded concurrency to
2466
+ * overlap per-invocation fixed costs with other batches' transfers.
2467
+ *
2468
+ * Failure handling: once a batch fails, no new batch is started (in-flight
2469
+ * batches are awaited), and the objects of failed and unstarted batches are
2470
+ * reported in `skippedCount`. The first batch always runs alone before the
2471
+ * remaining batches widen to the concurrency limit, so a failure common to
2472
+ * all batches costs a single round-trip.
2355
2473
  *
2356
2474
  * Usage pattern:
2357
2475
  * 1. Stage changes: git add
2358
- * 2. Pre-upload LFS: await repo.lfs.preUpload()
2476
+ * 2. Pre-upload LFS: await repo.lfsExtra.preUpload()
2359
2477
  * 3. Commit: git commit
2360
2478
  * 4. Push refs: git push (only refs, objects already uploaded)
2361
2479
  */
@@ -2364,7 +2482,14 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2364
2482
  return { uploadedCount: 0, uploadedBytes: 0, skippedCount: 0 };
2365
2483
  }
2366
2484
  const remote = opts?.remote ?? "origin";
2367
- const batchSize = opts?.batchSize ?? 50;
2485
+ const batchSize = opts?.batchSize ?? PRE_UPLOAD_DEFAULT_BATCH_SIZE;
2486
+ const concurrency = opts?.concurrency ?? PRE_UPLOAD_DEFAULT_CONCURRENCY;
2487
+ if (!Number.isInteger(batchSize) || batchSize < 1) {
2488
+ throw new RangeError(`batchSize must be a positive integer, got: ${batchSize}`);
2489
+ }
2490
+ if (!Number.isInteger(concurrency) || concurrency < 1) {
2491
+ throw new RangeError(`concurrency must be a positive integer, got: ${concurrency}`);
2492
+ }
2368
2493
  let oids;
2369
2494
  if (opts?.oids && opts.oids.length > 0) {
2370
2495
  oids = opts.oids;
@@ -2389,17 +2514,24 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2389
2514
  if (oids.length === 0) {
2390
2515
  return { uploadedCount: 0, uploadedBytes: 0, skippedCount: 0 };
2391
2516
  }
2517
+ const batches = [];
2518
+ for (let i = 0; i < oids.length; i += batchSize) {
2519
+ batches.push(oids.slice(i, i + batchSize));
2520
+ }
2392
2521
  let uploadedCount = 0;
2393
2522
  let uploadedBytes = 0;
2394
2523
  let skippedCount = 0;
2395
- for (let i = 0; i < oids.length; i += batchSize) {
2396
- const batch = oids.slice(i, i + batchSize);
2524
+ let attemptedCount = 0;
2525
+ const batchFailedStop = new Error("lfs pre-upload batch failed");
2526
+ const pushBatch = async (batch) => {
2397
2527
  const args = ["lfs", "push", remote, "--object-id", ...batch];
2398
2528
  const result = await this.runner.run(this.context, args, {
2399
2529
  signal: opts?.signal,
2400
- onProgress: opts?.onProgress
2530
+ onProgress: opts?.onProgress,
2531
+ onLfsProgress: opts?.onLfsProgress
2401
2532
  });
2402
- if (result.exitCode === 0) {
2533
+ attemptedCount += batch.length;
2534
+ if (result.exitCode === 0 && !result.aborted) {
2403
2535
  uploadedCount += batch.length;
2404
2536
  const bytesMatch = result.stderr.match(
2405
2537
  /Uploading LFS objects:.*?\((\d+(?:\.\d+)?)\s*([KMG]?B)/i
@@ -2419,7 +2551,19 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2419
2551
  }
2420
2552
  } else {
2421
2553
  skippedCount += batch.length;
2554
+ throw batchFailedStop;
2422
2555
  }
2556
+ };
2557
+ try {
2558
+ await runWithConcurrency(batches, pushBatch, {
2559
+ concurrency,
2560
+ warmupCount: PRE_UPLOAD_WARMUP_BATCH_COUNT
2561
+ });
2562
+ } catch (error) {
2563
+ if (error !== batchFailedStop) {
2564
+ throw error;
2565
+ }
2566
+ skippedCount += oids.length - attemptedCount;
2423
2567
  }
2424
2568
  return { uploadedCount, uploadedBytes, skippedCount };
2425
2569
  }
@@ -2431,7 +2575,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2431
2575
  *
2432
2576
  * Usage pattern:
2433
2577
  * 1. Fetch refs: git fetch
2434
- * 2. Pre-download LFS: await repo.lfs.preDownload({ ref: 'origin/feature' })
2578
+ * 2. Pre-download LFS: await repo.lfsExtra.preDownload({ ref: 'origin/feature' })
2435
2579
  * 3. Checkout: git checkout feature
2436
2580
  */
2437
2581
  async lfsPreDownload(opts) {
@@ -2440,6 +2584,9 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2440
2584
  }
2441
2585
  const remote = opts?.remote ?? "origin";
2442
2586
  const batchSize = opts?.batchSize ?? 50;
2587
+ if (!Number.isInteger(batchSize) || batchSize < 1) {
2588
+ throw new RangeError(`batchSize must be a positive integer, got: ${batchSize}`);
2589
+ }
2443
2590
  let oids;
2444
2591
  if (opts?.oids && opts.oids.length > 0) {
2445
2592
  oids = opts.oids;
@@ -2474,7 +2621,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2474
2621
  const args = ["lfs", "fetch", remote, "--", ...batch];
2475
2622
  const result = await this.runner.run(this.context, args, {
2476
2623
  signal: opts?.signal,
2477
- onProgress: opts?.onProgress
2624
+ onProgress: opts?.onProgress,
2625
+ onLfsProgress: opts?.onLfsProgress
2478
2626
  });
2479
2627
  if (result.exitCode === 0) {
2480
2628
  downloadedCount += batch.length;
@@ -2539,7 +2687,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2539
2687
  return;
2540
2688
  }
2541
2689
  const args = ["lfs", "fetch"];
2542
- if (opts?.onProgress) {
2690
+ if (opts?.onProgress || opts?.onLfsProgress) {
2543
2691
  args.push("--progress");
2544
2692
  }
2545
2693
  if (opts?.all) {
@@ -2572,7 +2720,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
2572
2720
  }
2573
2721
  await this.runner.runOrThrow(this.context, args, {
2574
2722
  signal: opts?.signal,
2575
- onProgress: opts?.onProgress
2723
+ onProgress: opts?.onProgress,
2724
+ onLfsProgress: opts?.onLfsProgress
2576
2725
  });
2577
2726
  }
2578
2727
  async lfsInstall(opts) {
@@ -3334,7 +3483,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3334
3483
  }
3335
3484
  }
3336
3485
  await this.runner.runOrThrow(this.context, args, {
3337
- signal: opts?.signal
3486
+ signal: opts?.signal,
3487
+ env: this.lfsModeEnv()
3338
3488
  });
3339
3489
  }
3340
3490
  // ==========================================================================
@@ -3691,7 +3841,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3691
3841
  }
3692
3842
  args.push(branch);
3693
3843
  const result = await this.runner.run(this.context, args, {
3694
- signal: opts?.signal
3844
+ signal: opts?.signal,
3845
+ env: this.lfsModeEnv()
3695
3846
  });
3696
3847
  if (result.exitCode !== 0) {
3697
3848
  const statusResult = await this.runner.runOrThrow(this.context, ["status", "--porcelain"], {
@@ -3720,7 +3871,7 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3720
3871
  // ==========================================================================
3721
3872
  async pull(opts) {
3722
3873
  const args = ["pull"];
3723
- if (opts?.onProgress) {
3874
+ if (opts?.onProgress || opts?.onLfsProgress) {
3724
3875
  args.push("--progress");
3725
3876
  }
3726
3877
  if (opts?.rebase === true) {
@@ -3868,7 +4019,9 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3868
4019
  }
3869
4020
  await this.runner.runOrThrow(this.context, args, {
3870
4021
  signal: opts?.signal,
3871
- onProgress: opts?.onProgress
4022
+ onProgress: opts?.onProgress,
4023
+ onLfsProgress: opts?.onLfsProgress,
4024
+ env: this.lfsModeEnv()
3872
4025
  });
3873
4026
  }
3874
4027
  // ==========================================================================
@@ -3898,7 +4051,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
3898
4051
  args.push(target);
3899
4052
  }
3900
4053
  await this.runner.runOrThrow(this.context, args, {
3901
- signal: opts?.signal
4054
+ signal: opts?.signal,
4055
+ env: this.lfsModeEnv()
3902
4056
  });
3903
4057
  }
3904
4058
  // ==========================================================================
@@ -4094,7 +4248,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
4094
4248
  args.push(opts.startPoint);
4095
4249
  }
4096
4250
  await this.runner.runOrThrow(this.context, args, {
4097
- signal: opts?.signal
4251
+ signal: opts?.signal,
4252
+ env: this.lfsModeEnv()
4098
4253
  });
4099
4254
  }
4100
4255
  // ==========================================================================
@@ -4521,7 +4676,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
4521
4676
  args.push(opts.upstream);
4522
4677
  }
4523
4678
  await this.runner.runOrThrow(this.context, args, {
4524
- signal: opts?.signal
4679
+ signal: opts?.signal,
4680
+ env: this.lfsModeEnv()
4525
4681
  });
4526
4682
  }
4527
4683
  // ==========================================================================
@@ -4579,7 +4735,8 @@ var WorktreeRepoImpl = class _WorktreeRepoImpl {
4579
4735
  const pathList = Array.isArray(paths) ? paths : [paths];
4580
4736
  args.push("--", ...pathList);
4581
4737
  await this.runner.runOrThrow(this.context, args, {
4582
- signal: opts?.signal
4738
+ signal: opts?.signal,
4739
+ env: this.lfsModeEnv()
4583
4740
  });
4584
4741
  }
4585
4742
  // ==========================================================================
@@ -5592,7 +5749,7 @@ var GitImpl = class {
5592
5749
  }
5593
5750
  async clone(url, path, opts) {
5594
5751
  const args = buildCloneArgs(opts);
5595
- if (opts?.onProgress) {
5752
+ if (opts?.onProgress || opts?.onLfsProgress) {
5596
5753
  args.push("--progress");
5597
5754
  }
5598
5755
  args.push(url, path);
@@ -5976,7 +6133,7 @@ var NodeExecAdapter = class {
5976
6133
  const child = spawn(command, args, {
5977
6134
  cwd,
5978
6135
  env: resolveChildEnv(env, inheritEnv),
5979
- stdio: ["ignore", "pipe", "pipe"]
6136
+ stdio: [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"]
5980
6137
  });
5981
6138
  let stdout = "";
5982
6139
  let stderr = "";
@@ -6004,6 +6161,12 @@ var NodeExecAdapter = class {
6004
6161
  stderr += text;
6005
6162
  handlers?.onStderr?.(text);
6006
6163
  });
6164
+ child.stdin?.on("error", (error) => {
6165
+ if (error.code !== "EPIPE" && error.code !== "EOF") {
6166
+ reject(error);
6167
+ }
6168
+ });
6169
+ child.stdin?.end(options.stdin);
6007
6170
  child.on("error", (error) => {
6008
6171
  signal?.removeEventListener("abort", abortHandler);
6009
6172
  reject(error);
@@ -6032,7 +6195,7 @@ var NodeExecAdapter = class {
6032
6195
  const child = spawn(command, args, {
6033
6196
  cwd,
6034
6197
  env: resolveChildEnv(env, inheritEnv),
6035
- stdio: ["ignore", "pipe", "pipe"]
6198
+ stdio: [options.stdin === void 0 ? "ignore" : "pipe", "pipe", "pipe"]
6036
6199
  });
6037
6200
  let aborted = false;
6038
6201
  let exitSignal;
@@ -6057,6 +6220,12 @@ var NodeExecAdapter = class {
6057
6220
  child.stderr?.on("data", (chunk) => {
6058
6221
  stderr += chunk.toString("utf8");
6059
6222
  });
6223
+ child.stdin?.on("error", (error) => {
6224
+ if (error.code !== "EPIPE" && error.code !== "EOF") {
6225
+ reject(error);
6226
+ }
6227
+ });
6228
+ child.stdin?.end(options.stdin);
6060
6229
  child.on("error", (error) => {
6061
6230
  signal?.removeEventListener("abort", abortHandler);
6062
6231
  reject(error);