@scolladon/tsgit 3.0.0 → 3.1.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 (143) hide show
  1. package/README.md +12 -0
  2. package/dist/cjs/adapters/browser/index.cjs +1 -2
  3. package/dist/cjs/adapters/memory/index.cjs +1 -2
  4. package/dist/cjs/adapters/node/index.cjs +1 -2
  5. package/dist/cjs/chunks/{adapter-detect-D7DFJtuk.cjs → adapter-detect-DW9fsw9d.cjs} +1 -2
  6. package/dist/cjs/chunks/browser-http-transport-DGwW5YL7.cjs +1 -0
  7. package/dist/cjs/chunks/context-BcoAzPuU.cjs +0 -1
  8. package/dist/cjs/chunks/error-CfLWDui_.cjs +1 -0
  9. package/dist/cjs/chunks/index-Cy44GVR6.cjs +1 -0
  10. package/dist/cjs/chunks/inflate-CmCtM4-w.cjs +1 -0
  11. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +0 -1
  12. package/dist/cjs/chunks/memory-http-transport-CGriODcQ.cjs +1 -0
  13. package/dist/cjs/chunks/node-ssh-transport-PFu3ijfp.cjs +1 -0
  14. package/dist/cjs/chunks/{progress-CjhUeyxd.cjs → progress-D8Dqbftk.cjs} +1 -2
  15. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +0 -1
  16. package/dist/cjs/chunks/{repository-DJNNrfQr.cjs → repository-Ci-BBxk0.cjs} +1 -2
  17. package/dist/cjs/chunks/write-sparse-checkout-C1dsHCAD.cjs +1 -0
  18. package/dist/cjs/commands/index.cjs +1 -2
  19. package/dist/cjs/index.browser.cjs +1 -2
  20. package/dist/cjs/index.cjs +1 -2
  21. package/dist/cjs/index.default.cjs +1 -2
  22. package/dist/cjs/index.node.cjs +1 -2
  23. package/dist/cjs/operators/index.cjs +0 -1
  24. package/dist/cjs/primitives/index.cjs +1 -2
  25. package/dist/cjs/transport/index.cjs +0 -1
  26. package/dist/esm/adapters/browser/index.js +1 -2
  27. package/dist/esm/adapters/memory/index.js +1 -2
  28. package/dist/esm/adapters/node/index.js +1 -2
  29. package/dist/esm/chunks/{adapter-detect-CTTG6hpk.js → adapter-detect-BkCMnjrI.js} +1 -2
  30. package/dist/esm/chunks/browser-http-transport-CSxAte5h.js +1 -0
  31. package/dist/esm/chunks/context-CumKOV7K.js +0 -1
  32. package/dist/esm/chunks/error-BotOd-nD.js +1 -0
  33. package/dist/esm/chunks/index-DsvINN8n.js +1 -0
  34. package/dist/esm/chunks/inflate-BCIXqeeE.js +1 -0
  35. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +0 -1
  36. package/dist/esm/chunks/memory-http-transport-caqmMGR1.js +1 -0
  37. package/dist/esm/chunks/node-ssh-transport-BgSv2IhT.js +1 -0
  38. package/dist/esm/chunks/{progress-CLPpgZJ6.js → progress-B_AJnOHx.js} +1 -2
  39. package/dist/esm/chunks/readable-stream-CGuf8k1J.js +0 -1
  40. package/dist/esm/chunks/repository-DyxknzvE.js +1 -0
  41. package/dist/esm/chunks/write-sparse-checkout-BwHbNKNS.js +1 -0
  42. package/dist/esm/commands/index.js +1 -2
  43. package/dist/esm/index.browser.js +1 -2
  44. package/dist/esm/index.default.js +1 -2
  45. package/dist/esm/index.js +1 -2
  46. package/dist/esm/index.node.js +1 -2
  47. package/dist/esm/operators/index.js +0 -1
  48. package/dist/esm/primitives/index.js +1 -2
  49. package/dist/esm/transport/index.js +0 -1
  50. package/dist/types/adapters/browser/index.d.cts +1 -1
  51. package/dist/types/adapters/browser/index.d.ts +1 -1
  52. package/dist/types/adapters/memory/index.d.cts +1 -1
  53. package/dist/types/adapters/memory/index.d.ts +1 -1
  54. package/dist/types/adapters/node/index.d.cts +94 -36
  55. package/dist/types/adapters/node/index.d.ts +94 -36
  56. package/dist/types/chunks/{context-D_A7-uau.d.cts → context-CF1YF2S8.d.cts} +48 -2
  57. package/dist/types/chunks/{context-CNtbFlwI.d.ts → context-sIhhtk2u.d.ts} +48 -2
  58. package/dist/types/chunks/{index-E_KapqW9.d.ts → index-B5Dps3fg.d.ts} +32 -3
  59. package/dist/types/chunks/{index-BJDekgCP.d.ts → index-B_A8VLaf.d.ts} +111 -12
  60. package/dist/types/chunks/{index-wwZiot4c.d.cts → index-Dfh8cvEs.d.cts} +32 -3
  61. package/dist/types/chunks/{index-CMLLVz9B.d.cts → index-Dqxddhav.d.cts} +111 -12
  62. package/dist/types/chunks/{progress-hcn9r2H3.d.ts → progress-BjAKfkam.d.ts} +51 -5
  63. package/dist/types/chunks/{progress-Cp-huK45.d.cts → progress-Ldnfb8st.d.cts} +51 -5
  64. package/dist/types/chunks/{reflog-entry-BGJr9VfU.d.cts → reflog-entry-Cqh3QrPH.d.ts} +12 -3
  65. package/dist/types/chunks/{reflog-entry-DecZqJna.d.ts → reflog-entry-Dy-O27Dd.d.cts} +12 -3
  66. package/dist/types/chunks/{repository-Dxhwpzd6.d.ts → repository-D8QBTkEz.d.ts} +5 -5
  67. package/dist/types/chunks/{repository-DASBgOb9.d.cts → repository-D9YrVhcH.d.cts} +5 -5
  68. package/dist/types/commands/index.d.cts +3 -3
  69. package/dist/types/commands/index.d.ts +3 -3
  70. package/dist/types/index.browser.d.cts +6 -6
  71. package/dist/types/index.browser.d.ts +6 -6
  72. package/dist/types/index.d.cts +8 -8
  73. package/dist/types/index.d.ts +8 -8
  74. package/dist/types/index.default.d.cts +6 -6
  75. package/dist/types/index.default.d.ts +6 -6
  76. package/dist/types/index.node.d.cts +6 -6
  77. package/dist/types/index.node.d.ts +6 -6
  78. package/dist/types/primitives/index.d.cts +3 -3
  79. package/dist/types/primitives/index.d.ts +3 -3
  80. package/package.json +90 -24
  81. package/dist/cjs/adapters/browser/index.cjs.map +0 -1
  82. package/dist/cjs/adapters/memory/index.cjs.map +0 -1
  83. package/dist/cjs/adapters/node/index.cjs.map +0 -1
  84. package/dist/cjs/chunks/adapter-detect-D7DFJtuk.cjs.map +0 -1
  85. package/dist/cjs/chunks/adler32-CrRRuL2P.cjs +0 -2
  86. package/dist/cjs/chunks/adler32-CrRRuL2P.cjs.map +0 -1
  87. package/dist/cjs/chunks/browser-http-transport-nGm6alox.cjs +0 -2
  88. package/dist/cjs/chunks/browser-http-transport-nGm6alox.cjs.map +0 -1
  89. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +0 -1
  90. package/dist/cjs/chunks/error-CA80UqXF.cjs +0 -2
  91. package/dist/cjs/chunks/error-CA80UqXF.cjs.map +0 -1
  92. package/dist/cjs/chunks/index-01WCH0eg.cjs +0 -2
  93. package/dist/cjs/chunks/index-01WCH0eg.cjs.map +0 -1
  94. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +0 -1
  95. package/dist/cjs/chunks/memory-http-transport-7hpDW8o3.cjs +0 -2
  96. package/dist/cjs/chunks/memory-http-transport-7hpDW8o3.cjs.map +0 -1
  97. package/dist/cjs/chunks/node-http-transport-CoqnAvIL.cjs +0 -2
  98. package/dist/cjs/chunks/node-http-transport-CoqnAvIL.cjs.map +0 -1
  99. package/dist/cjs/chunks/progress-CjhUeyxd.cjs.map +0 -1
  100. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +0 -1
  101. package/dist/cjs/chunks/repository-DJNNrfQr.cjs.map +0 -1
  102. package/dist/cjs/chunks/write-sparse-checkout-DzVubBcI.cjs +0 -2
  103. package/dist/cjs/chunks/write-sparse-checkout-DzVubBcI.cjs.map +0 -1
  104. package/dist/cjs/commands/index.cjs.map +0 -1
  105. package/dist/cjs/index.browser.cjs.map +0 -1
  106. package/dist/cjs/index.cjs.map +0 -1
  107. package/dist/cjs/index.default.cjs.map +0 -1
  108. package/dist/cjs/index.node.cjs.map +0 -1
  109. package/dist/cjs/operators/index.cjs.map +0 -1
  110. package/dist/cjs/primitives/index.cjs.map +0 -1
  111. package/dist/cjs/transport/index.cjs.map +0 -1
  112. package/dist/esm/adapters/browser/index.js.map +0 -1
  113. package/dist/esm/adapters/memory/index.js.map +0 -1
  114. package/dist/esm/adapters/node/index.js.map +0 -1
  115. package/dist/esm/chunks/adapter-detect-CTTG6hpk.js.map +0 -1
  116. package/dist/esm/chunks/adler32-BfvKJOAO.js +0 -2
  117. package/dist/esm/chunks/adler32-BfvKJOAO.js.map +0 -1
  118. package/dist/esm/chunks/browser-http-transport-DD0YKmIW.js +0 -2
  119. package/dist/esm/chunks/browser-http-transport-DD0YKmIW.js.map +0 -1
  120. package/dist/esm/chunks/context-CumKOV7K.js.map +0 -1
  121. package/dist/esm/chunks/error-BD0nFV6t.js +0 -2
  122. package/dist/esm/chunks/error-BD0nFV6t.js.map +0 -1
  123. package/dist/esm/chunks/index-BEI7XKaV.js +0 -2
  124. package/dist/esm/chunks/index-BEI7XKaV.js.map +0 -1
  125. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +0 -1
  126. package/dist/esm/chunks/memory-http-transport-D13LBPvu.js +0 -2
  127. package/dist/esm/chunks/memory-http-transport-D13LBPvu.js.map +0 -1
  128. package/dist/esm/chunks/node-http-transport-doU9Y8WN.js +0 -2
  129. package/dist/esm/chunks/node-http-transport-doU9Y8WN.js.map +0 -1
  130. package/dist/esm/chunks/progress-CLPpgZJ6.js.map +0 -1
  131. package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +0 -1
  132. package/dist/esm/chunks/repository-dCH3DdLQ.js +0 -2
  133. package/dist/esm/chunks/repository-dCH3DdLQ.js.map +0 -1
  134. package/dist/esm/chunks/write-sparse-checkout-D4tNUXOp.js +0 -2
  135. package/dist/esm/chunks/write-sparse-checkout-D4tNUXOp.js.map +0 -1
  136. package/dist/esm/commands/index.js.map +0 -1
  137. package/dist/esm/index.browser.js.map +0 -1
  138. package/dist/esm/index.default.js.map +0 -1
  139. package/dist/esm/index.js.map +0 -1
  140. package/dist/esm/index.node.js.map +0 -1
  141. package/dist/esm/operators/index.js.map +0 -1
  142. package/dist/esm/primitives/index.js.map +0 -1
  143. package/dist/esm/transport/index.js.map +0 -1
@@ -448,6 +448,43 @@ interface PromisorRemote {
448
448
  fetch(oids: ReadonlyArray<ObjectId>): Promise<PromisorFetchOutcome>;
449
449
  }
450
450
 
451
+ /**
452
+ * Request to open one SSH duplex channel. `command`/`args` are the fully
453
+ * resolved ssh program and argv (host token, `-p` flag, sq-quoted remote
454
+ * command) — the adapter performs no faithfulness logic of its own.
455
+ */
456
+ interface SshSpawnRequest {
457
+ /** Resolved ssh program (e.g. `ssh`, or a `GIT_SSH`/`core.sshCommand` override). */
458
+ readonly command: string;
459
+ /** Full argv, incl. host token and remote-command token. */
460
+ readonly args: ReadonlyArray<string>;
461
+ /** Additions merged OVER the parent process environment by the adapter. */
462
+ readonly env: Readonly<Record<string, string>>;
463
+ readonly signal?: AbortSignal;
464
+ }
465
+ /**
466
+ * One live SSH duplex channel — a thin process bridge. Stream shapes mirror
467
+ * `HttpTransport`: web streams in, web streams out.
468
+ */
469
+ interface SshChannel {
470
+ /** Request bytes written to the server. */
471
+ readonly stdin: WritableStream<Uint8Array>;
472
+ /** Advertisement + response bytes read from the server. */
473
+ readonly stdout: ReadableStream<Uint8Array>;
474
+ /** Resolves with the ssh process's exit code. */
475
+ readonly exit: Promise<number>;
476
+ /** Idempotent teardown — kills the child process. */
477
+ readonly close: () => Promise<void>;
478
+ }
479
+ /**
480
+ * Thin duplex process spawner. Knows nothing about git — argv building,
481
+ * quoting, and command resolution are pure application-tier concerns tested
482
+ * independently of this port.
483
+ */
484
+ interface SshTransport {
485
+ readonly open: (req: SshSpawnRequest) => Promise<SshChannel>;
486
+ }
487
+
451
488
  /**
452
489
  * Repository physical layout — where the working tree and.git directory live.
453
490
  * Renamed in from the previous `RepositoryConfig` (port-tier) to free that
@@ -544,6 +581,8 @@ interface Context {
544
581
  readonly layout: RepositoryLayout;
545
582
  /** User-supplied working directory (may be a sub-path of layout.workDir). Defaults to layout.workDir when not set by the facade. */
546
583
  readonly cwd: string;
584
+ /** The runtime this context was built for — names the adapter set in refusal messages. */
585
+ readonly runtime: 'node' | 'browser' | 'memory';
547
586
  /** Object serialization parameters (sha1 vs sha256 digest+hex sizes). */
548
587
  readonly hashConfig: HashConfig;
549
588
  /** Shared delta-base LRU cache; consumed by primitives' iterative delta walker. */
@@ -567,6 +606,11 @@ interface Context {
567
606
  * memory, where there is no process env). Notes-ref selection reads GIT_NOTES_REF through it.
568
607
  */
569
608
  readonly env?: EnvReader;
609
+ /**
610
+ * Optional SSH transport. Absent ⇒ ssh/scp remotes refuse — browser/memory
611
+ * cannot spawn a process.
612
+ */
613
+ readonly ssh?: SshTransport;
570
614
  /**
571
615
  * Optional promisor-remote capability. Populated by `openRepository`;
572
616
  * `readObject` consults it to lazy-fetch an object a partial clone omitted.
@@ -590,6 +634,7 @@ interface CreateContextParts {
590
634
  readonly progress: ProgressReporter;
591
635
  readonly layout: RepositoryLayout;
592
636
  readonly cwd?: string;
637
+ readonly runtime: 'node' | 'browser' | 'memory';
593
638
  readonly hashConfig: HashConfig;
594
639
  readonly deltaCache: LruCache<Uint8Array>;
595
640
  readonly config?: RepositoryConfig;
@@ -598,9 +643,10 @@ interface CreateContextParts {
598
643
  readonly hooks?: HookRunner;
599
644
  readonly command?: CommandRunner;
600
645
  readonly env?: EnvReader;
646
+ readonly ssh?: SshTransport;
601
647
  }
602
648
  /** Assemble a frozen Context from its constituent ports + layout. */
603
649
  declare function createContext(parts: CreateContextParts): Context;
604
650
 
605
- export { EMPTY_TREE_OID as E, FilePath as F, ObjectId as O, RefName as R, SHA1_CONFIG as S, ZERO_OID as Z, SHA256_CONFIG as r, createContext as s, noopLogger as t, wrapLoggerSanitizer as w };
606
- export type { AuthStrategy as A, CommandRunner as C, DirEntry as D, HashConfig as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, Compressor as a, AuthorIdentity as b, Context as c, CreateContextParts as d, EnvReader as e, FileStat as f, FileSystem as g, HashService as h, Hasher as i, HookName as j, HookRequest as k, HookResult as l, HookRunner as m, PromisorFetchOutcome as n, PromisorRemote as o, RepositoryConfig as p, RepositoryLayout as q, FileHandle as u, CommandRequest as v, CommandResult as x };
651
+ export { EMPTY_TREE_OID as E, FilePath as F, ObjectId as O, RefName as R, SHA1_CONFIG as S, ZERO_OID as Z, SHA256_CONFIG as r, createContext as v, noopLogger as w, wrapLoggerSanitizer as x };
652
+ export type { AuthStrategy as A, CommandResult as B, CommandRunner as C, DirEntry as D, HashConfig as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, Compressor as a, AuthorIdentity as b, Context as c, CreateContextParts as d, EnvReader as e, FileStat as f, FileSystem as g, HashService as h, Hasher as i, HookName as j, HookRequest as k, HookResult as l, HookRunner as m, PromisorFetchOutcome as n, PromisorRemote as o, RepositoryConfig as p, RepositoryLayout as q, SshChannel as s, SshSpawnRequest as t, SshTransport as u, FileHandle as y, CommandRequest as z };
@@ -1,5 +1,5 @@
1
- import { O as ObjectId, R as RefName, F as FilePath, c as Context, o as PromisorRemote } from './context-CNtbFlwI.js';
2
- import { o as FileMode, aN as IndexEntry, _ as StatData, G as GitIndex, p as FlatTree, a7 as TreeDiff, L as LineKey, a as AuthorIdentity, C as CatFileBatchEntry, aO as ConfigKey, aM as ConfigScope, W as RenameDetectOptions, a2 as StatTreeDiff, a3 as SubmoduleEntry, U as ReadObjectOptions, aP as ReflogEntry, e as CommitData, a5 as TagData } from './reflog-entry-DecZqJna.js';
1
+ import { O as ObjectId, R as RefName, F as FilePath, c as Context, o as PromisorRemote } from './context-sIhhtk2u.js';
2
+ import { p as FileMode, aO as IndexEntry, $ as StatData, G as GitIndex, q as FlatTree, a8 as TreeDiff, L as LineKey, a as AuthorIdentity, C as CatFileBatchEntry, aP as ConfigKey, aN as ConfigScope, X as RenameDetectOptions, a3 as StatTreeDiff, a4 as SubmoduleEntry, V as ReadObjectOptions, aQ as ReflogEntry, e as CommitData, a6 as TagData } from './reflog-entry-Cqh3QrPH.js';
3
3
 
4
4
  type BundleVersion = 2 | 3;
5
5
  type BundleHashAlgorithm = 'sha1';
@@ -489,6 +489,14 @@ interface CommitOptions {
489
489
  readonly allowEmptyMessage?: boolean;
490
490
  /** Skip the `pre-commit` and `commit-msg` hooks (git's `--no-verify`). */
491
491
  readonly noVerify?: boolean;
492
+ /**
493
+ * Sign the commit (git's `-S`). Tri-state against `commit.gpgsign`: an
494
+ * explicit `true`/`false` here always wins; leaving it `undefined` falls
495
+ * back to `commit.gpgsign` from config.
496
+ */
497
+ readonly sign?: boolean;
498
+ /** Signing key/identity override (git's `-S<keyid>`); falls back to `user.signingKey`. */
499
+ readonly signKey?: string;
492
500
  }
493
501
  interface CommitResult {
494
502
  readonly id: ObjectId;
@@ -780,6 +788,10 @@ declare function diff(ctx: Context, opts: DiffOptions & {
780
788
  declare function diff(ctx: Context, opts?: DiffOptions): Promise<TreeDiff>;
781
789
 
782
790
  interface FetchOptions {
791
+ /**
792
+ * Remote to fetch from. Default: `branch.<current>.remote` ?? the sole
793
+ * configured remote ?? `'origin'`; detached HEAD skips the branch step.
794
+ */
783
795
  readonly remote?: string;
784
796
  readonly refspecs?: ReadonlyArray<string>;
785
797
  readonly prune?: boolean;
@@ -1787,6 +1799,14 @@ interface TagCreateInput {
1787
1799
  readonly name: string;
1788
1800
  readonly target?: string;
1789
1801
  readonly force?: boolean;
1802
+ /** Create an annotated tag object (git's `-a`). Implied by `message` and `sign`. */
1803
+ readonly annotate?: boolean;
1804
+ /** Annotated tag message (git's `-m`). Setting this implies `annotate`. */
1805
+ readonly message?: string;
1806
+ /** GPG-sign the annotated tag (git's `-s`). Implies `annotate`; falls back to `tag.gpgSign` when unset. */
1807
+ readonly sign?: boolean;
1808
+ /** Signer key override (git's `-u <keyid>` / `--local-user`). */
1809
+ readonly signKey?: string;
1790
1810
  }
1791
1811
  interface TagCreateResult {
1792
1812
  readonly name: RefName;
@@ -2015,7 +2035,10 @@ interface MvResult {
2015
2035
  declare const mv: (ctx: Context, sources: ReadonlyArray<string>, destination: string, opts?: MvOptions) => Promise<MvResult>;
2016
2036
 
2017
2037
  interface PullOptions {
2018
- /** Remote to pull from. Default: `branch.<current>.remote` ?? `'origin'`. */
2038
+ /**
2039
+ * Remote to pull from. Default: `branch.<current>.remote` ?? the sole
2040
+ * configured remote ?? `'origin'`.
2041
+ */
2019
2042
  readonly remote?: string;
2020
2043
  /**
2021
2044
  * Remote ref to merge — a short branch name resolved as
@@ -2055,6 +2078,12 @@ interface PushOptions {
2055
2078
  readonly forceWithLease?: ObjectId | 'auto';
2056
2079
  /** Skip the `pre-push` hook (git's `--no-verify`). */
2057
2080
  readonly noVerify?: boolean;
2081
+ /**
2082
+ * GPG-sign the push certificate (git's `--signed`). `'yes'` refuses when
2083
+ * the receiving end doesn't advertise `push-cert`; `'if-asked'` falls back
2084
+ * to an unsigned push in that case. Falls back to `push.gpgSign` when unset.
2085
+ */
2086
+ readonly signed?: 'yes' | 'no' | 'if-asked';
2058
2087
  }
2059
2088
  interface PushedRef {
2060
2089
  readonly name: RefName;
@@ -1,6 +1,5 @@
1
- import { o as FileMode, aN as IndexEntry, G as GitIndex, B as BisectMidpoint, c as CatFileBatchOptions, C as CatFileBatchEntry, aM as ConfigScope, aO as ConfigKey, g as CreateCommitInput, m as DiffTreesInput, n as DiffTreesOptions, a2 as StatTreeDiff, a7 as TreeDiff, a6 as Tree, p as FlatTree, aQ as TreeEntry, U as ReadObjectOptions, b as Blob, r as GitObject, a as AuthorIdentity, aP as ReflogEntry, X as ResolveRefOptions, a9 as UpdateRefOptions, ab as WalkCommitsOptions, d as Commit, aa as WalkCommitsByDateOptions, ac as WalkSubmodulesOptions, a3 as SubmoduleEntry, ae as WalkTreeOptions, ad as WalkTreeEntry, ag as WalkWorkingTreeOptions, af as WalkWorkingTreeEntry } from './reflog-entry-DecZqJna.js';
2
- import { F as FilePath, c as Context, O as ObjectId, R as RefName, j as HookName } from './context-CNtbFlwI.js';
3
- import { b as HttpTransport } from './http-transport-DirKfK2S.js';
1
+ import { p as FileMode, aO as IndexEntry, G as GitIndex, B as BisectMidpoint, c as CatFileBatchOptions, C as CatFileBatchEntry, aN as ConfigScope, aP as ConfigKey, g as CreateCommitInput, h as CreateTagInput, n as DiffTreesInput, o as DiffTreesOptions, a3 as StatTreeDiff, a8 as TreeDiff, a7 as Tree, q as FlatTree, aR as TreeEntry, V as ReadObjectOptions, b as Blob, s as GitObject, a as AuthorIdentity, aQ as ReflogEntry, Y as ResolveRefOptions, aa as UpdateRefOptions, ac as WalkCommitsOptions, d as Commit, ab as WalkCommitsByDateOptions, ad as WalkSubmodulesOptions, a4 as SubmoduleEntry, af as WalkTreeOptions, ae as WalkTreeEntry, ah as WalkWorkingTreeOptions, ag as WalkWorkingTreeEntry } from './reflog-entry-Cqh3QrPH.js';
2
+ import { F as FilePath, c as Context, O as ObjectId, R as RefName, j as HookName } from './context-sIhhtk2u.js';
4
3
 
5
4
  /**
6
5
  * The four states a git attribute can resolve to (`gitattributes(5)`):
@@ -190,6 +189,8 @@ declare const buildPack: (ctx: Context, input: BuildPackInput) => Promise<BuildP
190
189
 
191
190
  declare function catFileBatch(ctx: Context, ids: AsyncIterable<ObjectId> | Iterable<ObjectId>, options?: CatFileBatchOptions): AsyncIterable<CatFileBatchEntry>;
192
191
 
192
+ /** `push.default` mode; `tracking` is a deprecated alias canonicalized to `upstream` at parse time. */
193
+ type PushDefaultMode = 'nothing' | 'current' | 'upstream' | 'simple' | 'matching';
193
194
  /**
194
195
  * Subset of `.git/config` that v1 commands consume. Only fields actually used by
195
196
  * commands are typed — the parser ignores everything else (lenient, like git itself).
@@ -206,10 +207,13 @@ interface ParsedConfig {
206
207
  readonly sparseCheckout?: boolean;
207
208
  readonly sparseCheckoutCone?: boolean;
208
209
  readonly looseCompression?: number;
210
+ /** `core.sshCommand` — shell string resolved by `resolveSshCommand` ahead of `GIT_SSH`. */
211
+ readonly sshCommand?: string;
209
212
  };
210
213
  readonly user?: {
211
- readonly name: string;
212
- readonly email: string;
214
+ readonly name?: string;
215
+ readonly email?: string;
216
+ readonly signingKey?: string;
213
217
  };
214
218
  readonly remote?: ReadonlyMap<string, {
215
219
  readonly url?: string;
@@ -221,9 +225,13 @@ interface ParsedConfig {
221
225
  /** `remote.<name>.partialclonefilter` — the canonical filter spec applied at clone. */
222
226
  readonly partialCloneFilter?: string;
223
227
  }>;
228
+ /** `remote.pushDefault` — subsectionless `[remote]` only; per-remote `[remote "x"] pushDefault` is not read. */
229
+ readonly remotePushDefault?: string;
224
230
  readonly branch?: ReadonlyMap<string, {
225
231
  readonly remote?: string;
226
232
  readonly merge?: string;
233
+ /** `branch.<name>.pushRemote` — overrides the push-remote for this branch. */
234
+ readonly pushRemote?: string;
227
235
  }>;
228
236
  /** `[submodule "<name>"]` — the registered (initialised) submodules. */
229
237
  readonly submodule?: ReadonlyMap<string, {
@@ -253,6 +261,29 @@ interface ParsedConfig {
253
261
  readonly extensions?: {
254
262
  readonly partialClone?: string;
255
263
  };
264
+ /** `commit.gpgSign` — sign commits by default when true. */
265
+ readonly commit?: {
266
+ readonly gpgSign?: boolean;
267
+ };
268
+ /** `tag.gpgSign` — sign annotated tags by default when true. */
269
+ readonly tag?: {
270
+ readonly gpgSign?: boolean;
271
+ };
272
+ readonly push?: {
273
+ /** `push.gpgSign` — sign push certificates: `true`/`false`, or `if-asked` (server-requested). */
274
+ readonly gpgSign?: 'true' | 'false' | 'if-asked';
275
+ /** `push.default` — canonicalized push remote-selection mode (`tracking` maps to `upstream`). */
276
+ readonly default?: PushDefaultMode;
277
+ };
278
+ /** `[gpg]` — signing backend selection and the external program(s) invoked to sign/verify. */
279
+ readonly gpg?: {
280
+ readonly format?: 'openpgp' | 'ssh' | 'x509';
281
+ readonly program?: string;
282
+ /** `gpg.ssh.program` — the `ssh-keygen`-compatible binary used for `gpg.format = ssh`. */
283
+ readonly ssh?: {
284
+ readonly program?: string;
285
+ };
286
+ };
256
287
  }
257
288
  /**
258
289
  * Read and cache `${gitDir}/config`. Missing → empty config (not an error).
@@ -275,12 +306,13 @@ interface ValuelessEntry {
275
306
  readonly line: number;
276
307
  }
277
308
  /**
278
- * Cold-path detection: re-tokenize the repo-local config and return the FIRST
309
+ * Valueless-entry detection: scan the repo-local config and return the FIRST
279
310
  * valueless (`value === null`) entry, by config-file line, whose key
280
311
  * (case-insensitive) is one of `keys` and which sits under `[<section> "<subsection>"]`
281
312
  * (subsection `undefined` ⇒ the section with no subsection). Returns the fully-qualified
282
313
  * key, the absolute config path, and the 1-based line, or `undefined` when no such
283
- * entry exists. Runs ONLY on a command's refusal path.
314
+ * entry exists. Walks the cached token stream, so an eager caller (the `[user]`
315
+ * identity pre-flight) pays only an in-memory scan, not a second read.
284
316
  */
285
317
  declare const findFirstValuelessEntry: (ctx: Context, section: string, subsection: string | undefined, keys: ReadonlyArray<string>) => Promise<ValuelessEntry | undefined>;
286
318
  /**
@@ -405,6 +437,16 @@ declare const getAllConfigValues: ({ ctx, key, scope, }: {
405
437
 
406
438
  declare function createCommit(ctx: Context, input: CreateCommitInput): Promise<ObjectId>;
407
439
 
440
+ /**
441
+ * Build and write an annotated tag object (`object`/`type`/`tag`/`tagger` +
442
+ * message). Tag-name validity (non-empty, no `\n`/`\0`) is enforced by
443
+ * `serializeTagContent` during `writeObject`; the tagger identity is
444
+ * roundtripped through `serializeIdentity` here first (rejects control
445
+ * characters per Step 0(a)), matching `createCommit`'s author/committer
446
+ * validation.
447
+ */
448
+ declare function createTag(ctx: Context, input: CreateTagInput): Promise<ObjectId>;
449
+
408
450
  declare function diffTrees(ctx: Context, a: DiffTreesInput, b: DiffTreesInput, options: DiffTreesOptions & {
409
451
  withStat: true;
410
452
  }): Promise<StatTreeDiff>;
@@ -465,8 +507,6 @@ interface FetchPackInput {
465
507
  readonly haves: ReadonlyArray<ObjectId>;
466
508
  /** Negotiated capabilities (intersection of advertised + supported). */
467
509
  readonly capabilities: ReadonlyArray<string>;
468
- /** Base remote URL (the same URL passed to clone). */
469
- readonly url: string;
470
510
  /** Progress op label — clone uses 'clone:write-objects', fetch uses 'fetch:write-objects'. */
471
511
  readonly progressOp: string;
472
512
  /**
@@ -498,7 +538,19 @@ interface FetchPackResult {
498
538
  /** Commits the server advertised as no-longer-shallow (empty when depth is unset). */
499
539
  readonly unshallow: ReadonlyArray<ObjectId>;
500
540
  }
501
- declare const fetchPack: (ctx: Context, transport: HttpTransport, input: FetchPackInput) => Promise<FetchPackResult>;
541
+ interface PackDownload {
542
+ readonly packBytes: Uint8Array;
543
+ readonly shallow: ReadonlyArray<ObjectId>;
544
+ readonly unshallow: ReadonlyArray<ObjectId>;
545
+ }
546
+ /**
547
+ * Negotiates and drains the pack body for one `fetchPack` call. Callers bind
548
+ * the wire version and the transport session into this closure — `fetchPack`
549
+ * itself stays version-agnostic, matching every other caller of the shared
550
+ * `PackDownload` shape.
551
+ */
552
+ type NegotiatePackBytes = (ctx: Context, input: FetchPackInput) => Promise<PackDownload>;
553
+ declare const fetchPack: (ctx: Context, negotiatePackBytes: NegotiatePackBytes, input: FetchPackInput) => Promise<FetchPackResult>;
502
554
 
503
555
  /**
504
556
  * Flatten a nested `Tree` into the `FlatTree` shape that the `mergeTrees`
@@ -517,6 +569,16 @@ declare const fetchPack: (ctx: Context, transport: HttpTransport, input: FetchPa
517
569
 
518
570
  declare const flattenTree: (ctx: Context, treeIdOrObject: ObjectId | Tree) => Promise<FlatTree>;
519
571
 
572
+ /**
573
+ * Local-only object-presence probe. A CQS query: unlike `readObject`, it never
574
+ * inflates, never verifies, and never consults `ctx.promisor` — a promised
575
+ * (not-yet-fetched) object in a partial repo answers `false` here, exactly as
576
+ * it would on disk. Callers that need the object's bytes still go through
577
+ * `readObject`.
578
+ */
579
+
580
+ declare const hasObject: (ctx: Context, id: ObjectId) => Promise<boolean>;
581
+
520
582
  interface HashBlobOptions {
521
583
  /** Persist the loose object under `.git/objects/<2>/<38>`. Default `false`. */
522
584
  readonly write?: boolean;
@@ -809,6 +871,43 @@ interface ShallowUpdate {
809
871
  */
810
872
  declare const updateShallow: (ctx: Context, updates: ShallowUpdate) => Promise<void>;
811
873
 
874
+ type SignPayloadResult = {
875
+ readonly ok: true;
876
+ readonly armor: string;
877
+ } | {
878
+ readonly ok: false;
879
+ readonly reason: 'off-node' | 'unsupported-format' | 'signer-failed';
880
+ };
881
+ interface SignRequest {
882
+ readonly format: 'openpgp' | 'ssh' | 'x509';
883
+ /** `gpg.program` / `gpg.ssh.program`; a family-specific default applies when absent. */
884
+ readonly program?: string;
885
+ /** Resolved `-u` value (openpgp) / `-f` key-file path (ssh). */
886
+ readonly selector: string;
887
+ }
888
+ interface ResolveSigningSelectorInput {
889
+ readonly signingKey?: string;
890
+ readonly keyOverride?: string;
891
+ readonly fallbackIdent: string;
892
+ }
893
+ /**
894
+ * Resolves the openpgp `-u` selector / the push-cert `pusher` selector —
895
+ * the identical `user.signingKey`-else-ident rule shared by commit, tag, and
896
+ * push-cert signing. The ssh `-f` key-file selector has NO ident fallback and
897
+ * is resolved by the caller directly (`keyOverride ?? signingKey`), not here.
898
+ */
899
+ declare const resolveSigningSelector: (input: ResolveSigningSelectorInput) => string;
900
+ /**
901
+ * Pure(ish) signing primitive delegating to the system signer through
902
+ * `ctx.command` — no new port. `gpg` runs stdin→stdout; `ssh-keygen` writes
903
+ * the payload to a temp file and reads the armor back from `<file>.sig`.
904
+ * Requesting `x509` and running with no `ctx.command` both refuse with a
905
+ * typed reason before any spawn or temp-file write. Success requires exit 0
906
+ * AND a well-formed armor block on the signer's output; anything else is a
907
+ * typed `signer-failed` refusal — never a partial or silent result.
908
+ */
909
+ declare const signPayload: (ctx: Context, payload: Uint8Array, req: SignRequest) => Promise<SignPayloadResult>;
910
+
812
911
  interface StreamBlobOptions {
813
912
  readonly verifyHash?: boolean;
814
913
  }
@@ -1118,5 +1217,5 @@ declare const writeSparsePatternText: (ctx: Context, text: string) => Promise<vo
1118
1217
 
1119
1218
  declare function writeTree(ctx: Context, entries: ReadonlyArray<TreeEntry>): Promise<ObjectId>;
1120
1219
 
1121
- export { getRepoRoot as $, DEFAULT_NOTES_REF as D, compareWorkingTreeEntry as G, computeChangeset as J, createCommit as K, MAX_SPARSE_PATTERN_FILE_BYTES as M, deleteReflog as N, diffTrees as O, enumerateObjects as Q, enumeratePushObjects as R, enumerateRefs as T, fetchPack as U, findFirstValuelessEntry as X, flattenTree as Y, getAllConfigValues as Z, getConfigValue as _, hashBlob as a0, invalidateConfigCache as a1, invalidateScopedConfigCache as a2, isIgnored as a3, isWorkingTreeDirty as a4, listReflogs as a5, loadNotesTree as a6, loadSparseMatcher as a7, materializeTree as a8, materializeWorktreeFromHead as a9, unsetAllConfigEntries as aA, unsetConfigEntry as aB, updateConfigEntries as aC, updateCoreConfig as aD, updateRef as aE, updateShallow as aF, walkCommits as aG, walkCommitsByDate as aH, walkSubmodules as aI, walkTree as aJ, walkWorkingTree as aK, writeNotesTree as aL, writeObject as aM, writeReflog as aN, writeSparsePatternText as aO, writeTree as aP, mergeBase as aa, parseIniSections as ab, readBlob as ac, readConfig as ad, readConfigSections as ae, readHeadTree as af, readIndex as ag, readObject as ah, readReflog as ai, readShallow as aj, readSparsePatternText as ak, readTree as al, reflogExists as am, removeConfigSection as an, renameConfigSection as ao, resolveNotesRef as ap, resolveRef as aq, resolveReflogIdentity as ar, runHook as as, runInformationalHook as at, setConfigEntry as au, setConfigEntryInText as av, setCoreConfigEntryInText as aw, sparseCheckoutPath as ax, streamBlob as ay, synthesizeTreeFromIndex as az, appendReflog as s, applyChangeset as t, applyConfigOpInText as u, bisectMidpoint as v, buildIndexFromTree as w, buildPack as x, catFileBatch as y, compareWorkingTreeDelta as z };
1122
- export type { ApplyChangesetOpts as A, BlobStream as B, Changeset as C, EnumerateObjectsOptions as E, FetchPackInput as F, HashBlobOptions as H, IniSection as I, LoadedNotesTree as L, ParsedConfig as P, StreamBlobOptions as S, ValuelessEntry as V, WorkingTreeComparison as W, ApplyChangesetResult as a, GlobMatcher as aQ, BuildIndexFromTreeOpts as b, BuildPackInput as c, BuildPackResult as d, ChangesetEntry as e, ChangesetStats as f, ConfigEntry as g, EnumeratePushObjectsInput as h, FetchPackResult as i, HookInput as j, IsIgnoredMatch as k, IsIgnoredMatchSource as l, IsIgnoredQuery as m, MaterializeTreeOpts as n, MaterializeTreeResult as o, MergeBaseOptions as p, WorkingTreeDelta as q, WriteNotesTreeInput as r };
1220
+ export { findFirstValuelessEntry as $, DEFAULT_NOTES_REF as D, buildPack as G, catFileBatch as J, compareWorkingTreeDelta as K, MAX_SPARSE_PATTERN_FILE_BYTES as M, compareWorkingTreeEntry as N, computeChangeset as O, createCommit as Q, createTag as R, deleteReflog as T, diffTrees as U, enumerateObjects as X, enumeratePushObjects as Y, enumerateRefs as Z, fetchPack as _, flattenTree as a0, getAllConfigValues as a1, getConfigValue as a2, getRepoRoot as a3, hasObject as a4, hashBlob as a5, invalidateConfigCache as a6, invalidateScopedConfigCache as a7, isIgnored as a8, isWorkingTreeDirty as a9, setConfigEntry as aA, setConfigEntryInText as aB, setCoreConfigEntryInText as aC, signPayload as aD, sparseCheckoutPath as aE, streamBlob as aF, synthesizeTreeFromIndex as aG, unsetAllConfigEntries as aH, unsetConfigEntry as aI, updateConfigEntries as aJ, updateCoreConfig as aK, updateRef as aL, updateShallow as aM, walkCommits as aN, walkCommitsByDate as aO, walkSubmodules as aP, walkTree as aQ, walkWorkingTree as aR, writeNotesTree as aS, writeObject as aT, writeReflog as aU, writeSparsePatternText as aV, writeTree as aW, listReflogs as aa, loadNotesTree as ab, loadSparseMatcher as ac, materializeTree as ad, materializeWorktreeFromHead as ae, mergeBase as af, parseIniSections as ag, readBlob as ah, readConfig as ai, readConfigSections as aj, readHeadTree as ak, readIndex as al, readObject as am, readReflog as an, readShallow as ao, readSparsePatternText as ap, readTree as aq, reflogExists as ar, removeConfigSection as as, renameConfigSection as at, resolveNotesRef as au, resolveRef as av, resolveReflogIdentity as aw, resolveSigningSelector as ax, runHook as ay, runInformationalHook as az, appendReflog as v, applyChangeset as w, applyConfigOpInText as x, bisectMidpoint as y, buildIndexFromTree as z };
1221
+ export type { ApplyChangesetOpts as A, BlobStream as B, Changeset as C, EnumerateObjectsOptions as E, FetchPackInput as F, HashBlobOptions as H, IniSection as I, LoadedNotesTree as L, ParsedConfig as P, SignPayloadResult as S, ValuelessEntry as V, WorkingTreeComparison as W, ApplyChangesetResult as a, GlobMatcher as aX, BuildIndexFromTreeOpts as b, BuildPackInput as c, BuildPackResult as d, ChangesetEntry as e, ChangesetStats as f, ConfigEntry as g, EnumeratePushObjectsInput as h, FetchPackResult as i, HookInput as j, IsIgnoredMatch as k, IsIgnoredMatchSource as l, IsIgnoredQuery as m, MaterializeTreeOpts as n, MaterializeTreeResult as o, MergeBaseOptions as p, PushDefaultMode as q, SignRequest as r, StreamBlobOptions as s, WorkingTreeDelta as t, WriteNotesTreeInput as u };
@@ -1,5 +1,5 @@
1
- import { O as ObjectId, R as RefName, F as FilePath, c as Context, o as PromisorRemote } from './context-D_A7-uau.cjs';
2
- import { o as FileMode, aN as IndexEntry, _ as StatData, G as GitIndex, p as FlatTree, a7 as TreeDiff, L as LineKey, a as AuthorIdentity, C as CatFileBatchEntry, aO as ConfigKey, aM as ConfigScope, W as RenameDetectOptions, a2 as StatTreeDiff, a3 as SubmoduleEntry, U as ReadObjectOptions, aP as ReflogEntry, e as CommitData, a5 as TagData } from './reflog-entry-BGJr9VfU.cjs';
1
+ import { O as ObjectId, R as RefName, F as FilePath, c as Context, o as PromisorRemote } from './context-CF1YF2S8.cjs';
2
+ import { p as FileMode, aO as IndexEntry, $ as StatData, G as GitIndex, q as FlatTree, a8 as TreeDiff, L as LineKey, a as AuthorIdentity, C as CatFileBatchEntry, aP as ConfigKey, aN as ConfigScope, X as RenameDetectOptions, a3 as StatTreeDiff, a4 as SubmoduleEntry, V as ReadObjectOptions, aQ as ReflogEntry, e as CommitData, a6 as TagData } from './reflog-entry-Dy-O27Dd.cjs';
3
3
 
4
4
  type BundleVersion = 2 | 3;
5
5
  type BundleHashAlgorithm = 'sha1';
@@ -489,6 +489,14 @@ interface CommitOptions {
489
489
  readonly allowEmptyMessage?: boolean;
490
490
  /** Skip the `pre-commit` and `commit-msg` hooks (git's `--no-verify`). */
491
491
  readonly noVerify?: boolean;
492
+ /**
493
+ * Sign the commit (git's `-S`). Tri-state against `commit.gpgsign`: an
494
+ * explicit `true`/`false` here always wins; leaving it `undefined` falls
495
+ * back to `commit.gpgsign` from config.
496
+ */
497
+ readonly sign?: boolean;
498
+ /** Signing key/identity override (git's `-S<keyid>`); falls back to `user.signingKey`. */
499
+ readonly signKey?: string;
492
500
  }
493
501
  interface CommitResult {
494
502
  readonly id: ObjectId;
@@ -780,6 +788,10 @@ declare function diff(ctx: Context, opts: DiffOptions & {
780
788
  declare function diff(ctx: Context, opts?: DiffOptions): Promise<TreeDiff>;
781
789
 
782
790
  interface FetchOptions {
791
+ /**
792
+ * Remote to fetch from. Default: `branch.<current>.remote` ?? the sole
793
+ * configured remote ?? `'origin'`; detached HEAD skips the branch step.
794
+ */
783
795
  readonly remote?: string;
784
796
  readonly refspecs?: ReadonlyArray<string>;
785
797
  readonly prune?: boolean;
@@ -1787,6 +1799,14 @@ interface TagCreateInput {
1787
1799
  readonly name: string;
1788
1800
  readonly target?: string;
1789
1801
  readonly force?: boolean;
1802
+ /** Create an annotated tag object (git's `-a`). Implied by `message` and `sign`. */
1803
+ readonly annotate?: boolean;
1804
+ /** Annotated tag message (git's `-m`). Setting this implies `annotate`. */
1805
+ readonly message?: string;
1806
+ /** GPG-sign the annotated tag (git's `-s`). Implies `annotate`; falls back to `tag.gpgSign` when unset. */
1807
+ readonly sign?: boolean;
1808
+ /** Signer key override (git's `-u <keyid>` / `--local-user`). */
1809
+ readonly signKey?: string;
1790
1810
  }
1791
1811
  interface TagCreateResult {
1792
1812
  readonly name: RefName;
@@ -2015,7 +2035,10 @@ interface MvResult {
2015
2035
  declare const mv: (ctx: Context, sources: ReadonlyArray<string>, destination: string, opts?: MvOptions) => Promise<MvResult>;
2016
2036
 
2017
2037
  interface PullOptions {
2018
- /** Remote to pull from. Default: `branch.<current>.remote` ?? `'origin'`. */
2038
+ /**
2039
+ * Remote to pull from. Default: `branch.<current>.remote` ?? the sole
2040
+ * configured remote ?? `'origin'`.
2041
+ */
2019
2042
  readonly remote?: string;
2020
2043
  /**
2021
2044
  * Remote ref to merge — a short branch name resolved as
@@ -2055,6 +2078,12 @@ interface PushOptions {
2055
2078
  readonly forceWithLease?: ObjectId | 'auto';
2056
2079
  /** Skip the `pre-push` hook (git's `--no-verify`). */
2057
2080
  readonly noVerify?: boolean;
2081
+ /**
2082
+ * GPG-sign the push certificate (git's `--signed`). `'yes'` refuses when
2083
+ * the receiving end doesn't advertise `push-cert`; `'if-asked'` falls back
2084
+ * to an unsigned push in that case. Falls back to `push.gpgSign` when unset.
2085
+ */
2086
+ readonly signed?: 'yes' | 'no' | 'if-asked';
2058
2087
  }
2059
2088
  interface PushedRef {
2060
2089
  readonly name: RefName;