gitx.do 0.0.2 → 0.0.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.
Files changed (237) hide show
  1. package/dist/cli/commands/blame.d.ts +259 -0
  2. package/dist/cli/commands/blame.d.ts.map +1 -0
  3. package/dist/cli/commands/blame.js +609 -0
  4. package/dist/cli/commands/blame.js.map +1 -0
  5. package/dist/cli/commands/branch.d.ts +249 -0
  6. package/dist/cli/commands/branch.d.ts.map +1 -0
  7. package/dist/cli/commands/branch.js +693 -0
  8. package/dist/cli/commands/branch.js.map +1 -0
  9. package/dist/cli/commands/commit.d.ts +182 -0
  10. package/dist/cli/commands/commit.d.ts.map +1 -0
  11. package/dist/cli/commands/commit.js +437 -0
  12. package/dist/cli/commands/commit.js.map +1 -0
  13. package/dist/cli/commands/diff.d.ts +464 -0
  14. package/dist/cli/commands/diff.d.ts.map +1 -0
  15. package/dist/cli/commands/diff.js +958 -0
  16. package/dist/cli/commands/diff.js.map +1 -0
  17. package/dist/cli/commands/log.d.ts +239 -0
  18. package/dist/cli/commands/log.d.ts.map +1 -0
  19. package/dist/cli/commands/log.js +535 -0
  20. package/dist/cli/commands/log.js.map +1 -0
  21. package/dist/cli/commands/review.d.ts +457 -0
  22. package/dist/cli/commands/review.d.ts.map +1 -0
  23. package/dist/cli/commands/review.js +533 -0
  24. package/dist/cli/commands/review.js.map +1 -0
  25. package/dist/cli/commands/status.d.ts +269 -0
  26. package/dist/cli/commands/status.d.ts.map +1 -0
  27. package/dist/cli/commands/status.js +493 -0
  28. package/dist/cli/commands/status.js.map +1 -0
  29. package/dist/cli/commands/web.d.ts +199 -0
  30. package/dist/cli/commands/web.d.ts.map +1 -0
  31. package/dist/cli/commands/web.js +696 -0
  32. package/dist/cli/commands/web.js.map +1 -0
  33. package/dist/cli/fs-adapter.d.ts +656 -0
  34. package/dist/cli/fs-adapter.d.ts.map +1 -0
  35. package/dist/cli/fs-adapter.js +1179 -0
  36. package/dist/cli/fs-adapter.js.map +1 -0
  37. package/dist/cli/index.d.ts +387 -0
  38. package/dist/cli/index.d.ts.map +1 -0
  39. package/dist/cli/index.js +523 -0
  40. package/dist/cli/index.js.map +1 -0
  41. package/dist/cli/ui/components/DiffView.d.ts +7 -0
  42. package/dist/cli/ui/components/DiffView.d.ts.map +1 -0
  43. package/dist/cli/ui/components/DiffView.js +11 -0
  44. package/dist/cli/ui/components/DiffView.js.map +1 -0
  45. package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -0
  46. package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -0
  47. package/dist/cli/ui/components/ErrorDisplay.js +11 -0
  48. package/dist/cli/ui/components/ErrorDisplay.js.map +1 -0
  49. package/dist/cli/ui/components/FuzzySearch.d.ts +9 -0
  50. package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -0
  51. package/dist/cli/ui/components/FuzzySearch.js +12 -0
  52. package/dist/cli/ui/components/FuzzySearch.js.map +1 -0
  53. package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -0
  54. package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -0
  55. package/dist/cli/ui/components/LoadingSpinner.js +10 -0
  56. package/dist/cli/ui/components/LoadingSpinner.js.map +1 -0
  57. package/dist/cli/ui/components/NavigationList.d.ts +9 -0
  58. package/dist/cli/ui/components/NavigationList.d.ts.map +1 -0
  59. package/dist/cli/ui/components/NavigationList.js +11 -0
  60. package/dist/cli/ui/components/NavigationList.js.map +1 -0
  61. package/dist/cli/ui/components/ScrollableContent.d.ts +8 -0
  62. package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -0
  63. package/dist/cli/ui/components/ScrollableContent.js +11 -0
  64. package/dist/cli/ui/components/ScrollableContent.js.map +1 -0
  65. package/dist/cli/ui/components/index.d.ts +7 -0
  66. package/dist/cli/ui/components/index.d.ts.map +1 -0
  67. package/dist/cli/ui/components/index.js +9 -0
  68. package/dist/cli/ui/components/index.js.map +1 -0
  69. package/dist/cli/ui/terminal-ui.d.ts +52 -0
  70. package/dist/cli/ui/terminal-ui.d.ts.map +1 -0
  71. package/dist/cli/ui/terminal-ui.js +121 -0
  72. package/dist/cli/ui/terminal-ui.js.map +1 -0
  73. package/dist/durable-object/object-store.d.ts +401 -23
  74. package/dist/durable-object/object-store.d.ts.map +1 -1
  75. package/dist/durable-object/object-store.js +414 -25
  76. package/dist/durable-object/object-store.js.map +1 -1
  77. package/dist/durable-object/schema.d.ts +188 -0
  78. package/dist/durable-object/schema.d.ts.map +1 -1
  79. package/dist/durable-object/schema.js +160 -0
  80. package/dist/durable-object/schema.js.map +1 -1
  81. package/dist/durable-object/wal.d.ts +336 -31
  82. package/dist/durable-object/wal.d.ts.map +1 -1
  83. package/dist/durable-object/wal.js +272 -27
  84. package/dist/durable-object/wal.js.map +1 -1
  85. package/dist/index.d.ts +379 -3
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +379 -7
  88. package/dist/index.js.map +1 -1
  89. package/dist/mcp/adapter.d.ts +579 -38
  90. package/dist/mcp/adapter.d.ts.map +1 -1
  91. package/dist/mcp/adapter.js +426 -33
  92. package/dist/mcp/adapter.js.map +1 -1
  93. package/dist/mcp/sandbox.d.ts +532 -29
  94. package/dist/mcp/sandbox.d.ts.map +1 -1
  95. package/dist/mcp/sandbox.js +389 -22
  96. package/dist/mcp/sandbox.js.map +1 -1
  97. package/dist/mcp/sdk-adapter.d.ts +478 -56
  98. package/dist/mcp/sdk-adapter.d.ts.map +1 -1
  99. package/dist/mcp/sdk-adapter.js +346 -44
  100. package/dist/mcp/sdk-adapter.js.map +1 -1
  101. package/dist/mcp/tools.d.ts +445 -30
  102. package/dist/mcp/tools.d.ts.map +1 -1
  103. package/dist/mcp/tools.js +363 -33
  104. package/dist/mcp/tools.js.map +1 -1
  105. package/dist/ops/blame.d.ts +424 -21
  106. package/dist/ops/blame.d.ts.map +1 -1
  107. package/dist/ops/blame.js +303 -20
  108. package/dist/ops/blame.js.map +1 -1
  109. package/dist/ops/branch.d.ts +583 -32
  110. package/dist/ops/branch.d.ts.map +1 -1
  111. package/dist/ops/branch.js +365 -23
  112. package/dist/ops/branch.js.map +1 -1
  113. package/dist/ops/commit-traversal.d.ts +164 -24
  114. package/dist/ops/commit-traversal.d.ts.map +1 -1
  115. package/dist/ops/commit-traversal.js +68 -2
  116. package/dist/ops/commit-traversal.js.map +1 -1
  117. package/dist/ops/commit.d.ts +387 -53
  118. package/dist/ops/commit.d.ts.map +1 -1
  119. package/dist/ops/commit.js +249 -29
  120. package/dist/ops/commit.js.map +1 -1
  121. package/dist/ops/merge-base.d.ts +195 -21
  122. package/dist/ops/merge-base.d.ts.map +1 -1
  123. package/dist/ops/merge-base.js +122 -12
  124. package/dist/ops/merge-base.js.map +1 -1
  125. package/dist/ops/merge.d.ts +600 -130
  126. package/dist/ops/merge.d.ts.map +1 -1
  127. package/dist/ops/merge.js +408 -60
  128. package/dist/ops/merge.js.map +1 -1
  129. package/dist/ops/tag.d.ts +67 -2
  130. package/dist/ops/tag.d.ts.map +1 -1
  131. package/dist/ops/tag.js +42 -1
  132. package/dist/ops/tag.js.map +1 -1
  133. package/dist/ops/tree-builder.d.ts +102 -6
  134. package/dist/ops/tree-builder.d.ts.map +1 -1
  135. package/dist/ops/tree-builder.js +30 -5
  136. package/dist/ops/tree-builder.js.map +1 -1
  137. package/dist/ops/tree-diff.d.ts +50 -2
  138. package/dist/ops/tree-diff.d.ts.map +1 -1
  139. package/dist/ops/tree-diff.js +50 -2
  140. package/dist/ops/tree-diff.js.map +1 -1
  141. package/dist/pack/delta.d.ts +211 -39
  142. package/dist/pack/delta.d.ts.map +1 -1
  143. package/dist/pack/delta.js +232 -46
  144. package/dist/pack/delta.js.map +1 -1
  145. package/dist/pack/format.d.ts +390 -28
  146. package/dist/pack/format.d.ts.map +1 -1
  147. package/dist/pack/format.js +344 -33
  148. package/dist/pack/format.js.map +1 -1
  149. package/dist/pack/full-generation.d.ts +313 -28
  150. package/dist/pack/full-generation.d.ts.map +1 -1
  151. package/dist/pack/full-generation.js +238 -19
  152. package/dist/pack/full-generation.js.map +1 -1
  153. package/dist/pack/generation.d.ts +346 -23
  154. package/dist/pack/generation.d.ts.map +1 -1
  155. package/dist/pack/generation.js +269 -21
  156. package/dist/pack/generation.js.map +1 -1
  157. package/dist/pack/index.d.ts +407 -86
  158. package/dist/pack/index.d.ts.map +1 -1
  159. package/dist/pack/index.js +351 -70
  160. package/dist/pack/index.js.map +1 -1
  161. package/dist/refs/branch.d.ts +517 -71
  162. package/dist/refs/branch.d.ts.map +1 -1
  163. package/dist/refs/branch.js +410 -26
  164. package/dist/refs/branch.js.map +1 -1
  165. package/dist/refs/storage.d.ts +610 -57
  166. package/dist/refs/storage.d.ts.map +1 -1
  167. package/dist/refs/storage.js +481 -29
  168. package/dist/refs/storage.js.map +1 -1
  169. package/dist/refs/tag.d.ts +677 -67
  170. package/dist/refs/tag.d.ts.map +1 -1
  171. package/dist/refs/tag.js +497 -30
  172. package/dist/refs/tag.js.map +1 -1
  173. package/dist/storage/lru-cache.d.ts +556 -53
  174. package/dist/storage/lru-cache.d.ts.map +1 -1
  175. package/dist/storage/lru-cache.js +439 -36
  176. package/dist/storage/lru-cache.js.map +1 -1
  177. package/dist/storage/object-index.d.ts +483 -38
  178. package/dist/storage/object-index.d.ts.map +1 -1
  179. package/dist/storage/object-index.js +388 -22
  180. package/dist/storage/object-index.js.map +1 -1
  181. package/dist/storage/r2-pack.d.ts +957 -94
  182. package/dist/storage/r2-pack.d.ts.map +1 -1
  183. package/dist/storage/r2-pack.js +756 -48
  184. package/dist/storage/r2-pack.js.map +1 -1
  185. package/dist/tiered/cdc-pipeline.d.ts +1610 -38
  186. package/dist/tiered/cdc-pipeline.d.ts.map +1 -1
  187. package/dist/tiered/cdc-pipeline.js +1131 -22
  188. package/dist/tiered/cdc-pipeline.js.map +1 -1
  189. package/dist/tiered/migration.d.ts +903 -41
  190. package/dist/tiered/migration.d.ts.map +1 -1
  191. package/dist/tiered/migration.js +646 -24
  192. package/dist/tiered/migration.js.map +1 -1
  193. package/dist/tiered/parquet-writer.d.ts +944 -47
  194. package/dist/tiered/parquet-writer.d.ts.map +1 -1
  195. package/dist/tiered/parquet-writer.js +667 -39
  196. package/dist/tiered/parquet-writer.js.map +1 -1
  197. package/dist/tiered/read-path.d.ts +728 -34
  198. package/dist/tiered/read-path.d.ts.map +1 -1
  199. package/dist/tiered/read-path.js +310 -27
  200. package/dist/tiered/read-path.js.map +1 -1
  201. package/dist/types/objects.d.ts +457 -0
  202. package/dist/types/objects.d.ts.map +1 -1
  203. package/dist/types/objects.js +305 -4
  204. package/dist/types/objects.js.map +1 -1
  205. package/dist/types/storage.d.ts +407 -35
  206. package/dist/types/storage.d.ts.map +1 -1
  207. package/dist/types/storage.js +27 -3
  208. package/dist/types/storage.js.map +1 -1
  209. package/dist/utils/hash.d.ts +133 -12
  210. package/dist/utils/hash.d.ts.map +1 -1
  211. package/dist/utils/hash.js +133 -12
  212. package/dist/utils/hash.js.map +1 -1
  213. package/dist/utils/sha1.d.ts +102 -9
  214. package/dist/utils/sha1.d.ts.map +1 -1
  215. package/dist/utils/sha1.js +114 -11
  216. package/dist/utils/sha1.js.map +1 -1
  217. package/dist/wire/capabilities.d.ts +896 -88
  218. package/dist/wire/capabilities.d.ts.map +1 -1
  219. package/dist/wire/capabilities.js +566 -62
  220. package/dist/wire/capabilities.js.map +1 -1
  221. package/dist/wire/pkt-line.d.ts +293 -15
  222. package/dist/wire/pkt-line.d.ts.map +1 -1
  223. package/dist/wire/pkt-line.js +251 -15
  224. package/dist/wire/pkt-line.js.map +1 -1
  225. package/dist/wire/receive-pack.d.ts +814 -64
  226. package/dist/wire/receive-pack.d.ts.map +1 -1
  227. package/dist/wire/receive-pack.js +542 -41
  228. package/dist/wire/receive-pack.js.map +1 -1
  229. package/dist/wire/smart-http.d.ts +575 -97
  230. package/dist/wire/smart-http.d.ts.map +1 -1
  231. package/dist/wire/smart-http.js +337 -46
  232. package/dist/wire/smart-http.js.map +1 -1
  233. package/dist/wire/upload-pack.d.ts +492 -98
  234. package/dist/wire/upload-pack.d.ts.map +1 -1
  235. package/dist/wire/upload-pack.js +347 -59
  236. package/dist/wire/upload-pack.js.map +1 -1
  237. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"upload-pack.d.ts","sourceRoot":"","sources":["../../src/wire/upload-pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAQlD;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kDAAkD;IAClD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,uCAAuC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oDAAoD;IACpD,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,+BAA+B;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAChC,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;A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EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CA2DzB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EAAE,EACjB,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,cAAc,CAAC,CAqBzB;AAmID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,UAAU,CAAC,CAmGrB"}
@@ -1,31 +1,59 @@
1
1
  /**
2
- * Git upload-pack protocol implementation
2
+ * @fileoverview Git upload-pack Protocol Implementation
3
3
  *
4
- * The upload-pack service is used by git-fetch and git-clone to retrieve
5
- * objects from a remote repository.
4
+ * This module implements the server-side of Git's upload-pack service, which is
5
+ * used by `git-fetch` and `git-clone` to retrieve objects from a remote repository.
6
6
  *
7
- * Protocol flow:
8
- * 1. Server advertises refs (ref advertisement)
9
- * 2. Client sends "want" lines for desired objects
10
- * 3. Client sends "have" lines for objects it already has
11
- * 4. Server responds with ACK/NAK
12
- * 5. Server sends packfile with requested objects
7
+ * @module wire/upload-pack
13
8
  *
14
- * Reference: https://git-scm.com/docs/protocol-v2
15
- * https://git-scm.com/docs/pack-protocol
9
+ * ## Protocol Flow
10
+ *
11
+ * 1. **Ref Advertisement**: Server advertises available refs with capabilities
12
+ * 2. **Want Phase**: Client sends "want" lines for objects it needs
13
+ * 3. **Negotiation**: Client sends "have" lines, server responds with ACK/NAK
14
+ * 4. **Done**: Client signals negotiation complete with "done"
15
+ * 5. **Packfile**: Server generates and sends packfile with requested objects
16
+ *
17
+ * ## Features
18
+ *
19
+ * - Side-band multiplexing for progress reporting
20
+ * - Thin pack support for bandwidth efficiency
21
+ * - Shallow clone support with depth limiting
22
+ * - Multi-ack negotiation for optimal object transfer
23
+ *
24
+ * @see {@link https://git-scm.com/docs/protocol-v2} Git Protocol v2
25
+ * @see {@link https://git-scm.com/docs/pack-protocol} Git Pack Protocol
26
+ *
27
+ * @example Basic fetch operation
28
+ * ```typescript
29
+ * import { createSession, advertiseRefs, handleFetch } from './wire/upload-pack'
30
+ *
31
+ * // Create session and advertise refs
32
+ * const session = createSession('my-repo', await store.getRefs())
33
+ * const advertisement = await advertiseRefs(store)
34
+ *
35
+ * // Process fetch request
36
+ * const response = await handleFetch(session, requestBody, store)
37
+ * ```
16
38
  */
17
39
  import { encodePktLine, FLUSH_PKT } from './pkt-line';
18
40
  import * as pako from 'pako';
19
41
  /**
20
- * Side-band channel types
42
+ * Side-band channel types for multiplexed output.
43
+ *
44
+ * @description
45
+ * When side-band is enabled, the server can send data on multiple channels:
46
+ * - Channel 1: Packfile data
47
+ * - Channel 2: Progress messages (displayed to user)
48
+ * - Channel 3: Error messages (fatal, abort transfer)
21
49
  */
22
50
  export var SideBandChannel;
23
51
  (function (SideBandChannel) {
24
- /** Packfile data */
52
+ /** Packfile data - the actual objects being transferred */
25
53
  SideBandChannel[SideBandChannel["PACK_DATA"] = 1] = "PACK_DATA";
26
- /** Progress messages */
54
+ /** Progress messages - informational output for the user */
27
55
  SideBandChannel[SideBandChannel["PROGRESS"] = 2] = "PROGRESS";
28
- /** Error messages */
56
+ /** Error messages - fatal errors that abort the transfer */
29
57
  SideBandChannel[SideBandChannel["ERROR"] = 3] = "ERROR";
30
58
  })(SideBandChannel || (SideBandChannel = {}));
31
59
  // ============================================================================
@@ -33,16 +61,32 @@ export var SideBandChannel;
33
61
  // ============================================================================
34
62
  const encoder = new TextEncoder();
35
63
  const decoder = new TextDecoder();
36
- // SHA-1 regex for validation
64
+ /** SHA-1 regex for validation */
37
65
  const SHA1_REGEX = /^[0-9a-f]{40}$/i;
38
66
  // ============================================================================
39
67
  // Capability Functions
40
68
  // ============================================================================
41
69
  /**
42
- * Build capability string for ref advertisement
70
+ * Build capability string for ref advertisement.
71
+ *
72
+ * @description
73
+ * Converts a capabilities object into a space-separated string suitable
74
+ * for inclusion in the ref advertisement. Boolean capabilities become
75
+ * simple names, while capabilities with values become "name=value".
43
76
  *
44
77
  * @param capabilities - Capabilities to advertise
45
78
  * @returns Space-separated capability string
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const caps: UploadPackCapabilities = {
83
+ * sideBand64k: true,
84
+ * thinPack: true,
85
+ * agent: 'my-server/1.0'
86
+ * }
87
+ * const str = buildCapabilityString(caps)
88
+ * // 'side-band-64k thin-pack agent=my-server/1.0'
89
+ * ```
46
90
  */
47
91
  export function buildCapabilityString(capabilities) {
48
92
  const caps = [];
@@ -77,10 +121,22 @@ export function buildCapabilityString(capabilities) {
77
121
  return caps.join(' ');
78
122
  }
79
123
  /**
80
- * Parse capabilities from first want line
124
+ * Parse capabilities from first want line.
81
125
  *
82
- * @param capsString - Space-separated capabilities
83
- * @returns Parsed capabilities
126
+ * @description
127
+ * Parses a space-separated capability string (typically from the first
128
+ * want line of a fetch request) into a structured capabilities object.
129
+ *
130
+ * @param capsString - Space-separated capabilities from client
131
+ * @returns Parsed capabilities object
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const caps = parseCapabilities('side-band-64k thin-pack agent=git/2.30.0')
136
+ * // caps.sideBand64k === true
137
+ * // caps.thinPack === true
138
+ * // caps.agent === 'git/2.30.0'
139
+ * ```
84
140
  */
85
141
  export function parseCapabilities(capsString) {
86
142
  const caps = {};
@@ -125,12 +181,23 @@ export function parseCapabilities(capsString) {
125
181
  // Session Management
126
182
  // ============================================================================
127
183
  /**
128
- * Create a new upload-pack session
184
+ * Create a new upload-pack session.
185
+ *
186
+ * @description
187
+ * Initializes a new session for an upload-pack operation. The session
188
+ * tracks state across the negotiation and packfile generation phases.
129
189
  *
130
- * @param repoId - Repository identifier
131
- * @param refs - Available refs
190
+ * @param repoId - Repository identifier for logging/tracking
191
+ * @param refs - Available refs to advertise
132
192
  * @param stateless - Whether this is a stateless (HTTP) request
133
193
  * @returns New session object
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const refs = await store.getRefs()
198
+ * const session = createSession('my-repo', refs, true) // HTTP
199
+ * // session.negotiationComplete === false initially
200
+ * ```
134
201
  */
135
202
  export function createSession(repoId, refs, stateless = false) {
136
203
  return {
@@ -149,10 +216,31 @@ export function createSession(repoId, refs, stateless = false) {
149
216
  // Want/Have Parsing
150
217
  // ============================================================================
151
218
  /**
152
- * Parse a want line from the client
219
+ * Parse a want line from the client.
220
+ *
221
+ * @description
222
+ * Parses a "want" line which has the format:
223
+ * `want <sha> [capabilities...]`
224
+ *
225
+ * The first want line typically includes capabilities, subsequent ones don't.
153
226
  *
154
- * @param line - The want line (e.g., "want <sha> [capabilities]")
227
+ * @param line - The want line (e.g., "want abc123... side-band-64k")
155
228
  * @returns Parsed SHA and capabilities
229
+ *
230
+ * @throws {Error} If the line format is invalid or SHA is malformed
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * // First want line with capabilities
235
+ * const { sha, capabilities } = parseWantLine(
236
+ * 'want abc123... side-band-64k thin-pack'
237
+ * )
238
+ * // sha === 'abc123...'
239
+ * // capabilities.sideBand64k === true
240
+ *
241
+ * // Subsequent want line
242
+ * const { sha: sha2 } = parseWantLine('want def456...')
243
+ * ```
156
244
  */
157
245
  export function parseWantLine(line) {
158
246
  const trimmed = line.trim();
@@ -171,10 +259,22 @@ export function parseWantLine(line) {
171
259
  return { sha, capabilities };
172
260
  }
173
261
  /**
174
- * Parse a have line from the client
262
+ * Parse a have line from the client.
175
263
  *
176
- * @param line - The have line (e.g., "have <sha>")
177
- * @returns Parsed SHA
264
+ * @description
265
+ * Parses a "have" line which has the simple format:
266
+ * `have <sha>`
267
+ *
268
+ * @param line - The have line (e.g., "have abc123...")
269
+ * @returns The parsed SHA
270
+ *
271
+ * @throws {Error} If the line format is invalid or SHA is malformed
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * const sha = parseHaveLine('have abc123def456...')
276
+ * // sha === 'abc123def456...'
277
+ * ```
178
278
  */
179
279
  export function parseHaveLine(line) {
180
280
  const trimmed = line.trim();
@@ -191,11 +291,27 @@ export function parseHaveLine(line) {
191
291
  // Ref Advertisement
192
292
  // ============================================================================
193
293
  /**
194
- * Advertise refs to the client
294
+ * Advertise refs to the client.
295
+ *
296
+ * @description
297
+ * Generates the ref advertisement response for the initial phase of
298
+ * upload-pack. This includes:
299
+ * - HEAD reference with capabilities
300
+ * - Sorted refs with symref information
301
+ * - Peeled refs for annotated tags
195
302
  *
196
303
  * @param store - Object store to get refs from
197
- * @param capabilities - Server capabilities to advertise
304
+ * @param capabilities - Optional server capabilities to advertise
198
305
  * @returns Pkt-line formatted ref advertisement
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * const advertisement = await advertiseRefs(store, {
310
+ * sideBand64k: true,
311
+ * thinPack: true
312
+ * })
313
+ * // Send as response to GET /info/refs?service=git-upload-pack
314
+ * ```
199
315
  */
200
316
  export async function advertiseRefs(store, capabilities) {
201
317
  const refs = await store.getRefs();
@@ -265,11 +381,27 @@ export async function advertiseRefs(store, capabilities) {
265
381
  // ACK/NAK Formatting
266
382
  // ============================================================================
267
383
  /**
268
- * Format an ACK response
384
+ * Format an ACK response.
385
+ *
386
+ * @description
387
+ * Creates a pkt-line formatted ACK response for negotiation:
388
+ * - Simple ACK: `ACK <sha>` (when negotiation is complete)
389
+ * - Status ACK: `ACK <sha> <status>` (during multi_ack negotiation)
269
390
  *
270
391
  * @param sha - The SHA being acknowledged
271
392
  * @param status - ACK status (common, ready, continue, or none for simple ACK)
272
393
  * @returns Pkt-line formatted ACK
394
+ *
395
+ * @example
396
+ * ```typescript
397
+ * // Simple ACK
398
+ * const ack = formatAck('abc123...')
399
+ * // '0014ACK abc123...\n'
400
+ *
401
+ * // Multi-ack with status
402
+ * const ackContinue = formatAck('abc123...', 'continue')
403
+ * // '001dACK abc123... continue\n'
404
+ * ```
273
405
  */
274
406
  export function formatAck(sha, status) {
275
407
  const lowerSha = sha.toLowerCase();
@@ -283,9 +415,19 @@ export function formatAck(sha, status) {
283
415
  return encodePktLine(ackLine);
284
416
  }
285
417
  /**
286
- * Format a NAK response
418
+ * Format a NAK response.
419
+ *
420
+ * @description
421
+ * Creates a pkt-line formatted NAK response. NAK indicates that the
422
+ * server has no objects in common with the client's "have" list.
287
423
  *
288
424
  * @returns Pkt-line formatted NAK
425
+ *
426
+ * @example
427
+ * ```typescript
428
+ * const nak = formatNak()
429
+ * // '0008NAK\n'
430
+ * ```
289
431
  */
290
432
  export function formatNak() {
291
433
  return encodePktLine('NAK\n');
@@ -294,12 +436,25 @@ export function formatNak() {
294
436
  // Want/Have Processing
295
437
  // ============================================================================
296
438
  /**
297
- * Process client wants and update session
439
+ * Process client wants and update session.
440
+ *
441
+ * @description
442
+ * Validates and processes the "want" SHAs from a client fetch request.
443
+ * Verifies that all wanted objects exist in the repository.
298
444
  *
299
445
  * @param session - Current session state
300
- * @param wants - Array of want SHAs
446
+ * @param wants - Array of want SHAs from the client
301
447
  * @param store - Object store to verify objects exist
302
448
  * @returns Updated session
449
+ *
450
+ * @throws {Error} If any wanted object doesn't exist
451
+ *
452
+ * @example
453
+ * ```typescript
454
+ * const session = createSession('repo', refs)
455
+ * await processWants(session, ['abc123...', 'def456...'], store)
456
+ * // session.wants now contains the validated wants
457
+ * ```
303
458
  */
304
459
  export async function processWants(session, wants, store) {
305
460
  // Deduplicate wants
@@ -316,13 +471,28 @@ export async function processWants(session, wants, store) {
316
471
  return session;
317
472
  }
318
473
  /**
319
- * Process client haves and perform negotiation
474
+ * Process client haves and perform negotiation.
475
+ *
476
+ * @description
477
+ * Processes the "have" SHAs from the client to find common ancestors.
478
+ * This determines which objects need to be sent vs which the client
479
+ * already has.
320
480
  *
321
481
  * @param session - Current session state
322
- * @param haves - Array of have SHAs
482
+ * @param haves - Array of have SHAs from the client
323
483
  * @param store - Object store to check for common objects
324
484
  * @param done - Whether client is done sending haves
325
- * @returns Negotiation result
485
+ * @returns Negotiation result with ACKs/NAKs and objects to send
486
+ *
487
+ * @example
488
+ * ```typescript
489
+ * const result = await processHaves(session, ['abc123...'], store, true)
490
+ * if (result.nak) {
491
+ * // No common objects, will send full pack
492
+ * } else {
493
+ * // Can send incremental pack
494
+ * }
495
+ * ```
326
496
  */
327
497
  export async function processHaves(session, haves, store, done) {
328
498
  const result = {
@@ -370,14 +540,28 @@ export async function processHaves(session, haves, store, done) {
370
540
  // Object Calculation
371
541
  // ============================================================================
372
542
  /**
373
- * Calculate objects needed by client
543
+ * Calculate objects needed by client.
374
544
  *
375
- * Given wants and haves, determine minimal set of objects to send.
545
+ * @description
546
+ * Given the client's wants and haves, determines the minimal set of
547
+ * objects that need to be sent. Walks the object graph from wants,
548
+ * stopping at objects the client already has.
376
549
  *
377
550
  * @param store - Object store
378
551
  * @param wants - Objects client wants
379
552
  * @param haves - Objects client has
380
553
  * @returns Set of object SHAs to include in packfile
554
+ *
555
+ * @example
556
+ * ```typescript
557
+ * const missing = await calculateMissingObjects(
558
+ * store,
559
+ * ['new-commit-sha'],
560
+ * ['old-commit-sha']
561
+ * )
562
+ * // missing contains only objects reachable from new-commit
563
+ * // but not reachable from old-commit
564
+ * ```
381
565
  */
382
566
  export async function calculateMissingObjects(store, wants, haves) {
383
567
  const missing = new Set();
@@ -441,15 +625,33 @@ export async function calculateMissingObjects(store, wants, haves) {
441
625
  // Shallow Clone Support
442
626
  // ============================================================================
443
627
  /**
444
- * Process shallow/deepen commands
628
+ * Process shallow/deepen commands.
629
+ *
630
+ * @description
631
+ * Handles shallow clone requests by processing depth limits, deepen-since
632
+ * timestamps, and deepen-not refs. Updates the session with shallow
633
+ * boundary information.
445
634
  *
446
635
  * @param session - Current session
447
636
  * @param shallowLines - Shallow commit lines from client
448
- * @param depth - Requested depth
637
+ * @param depth - Requested commit depth
449
638
  * @param deepenSince - Timestamp to deepen since
450
639
  * @param deepenNot - Refs to not deepen past
451
640
  * @param store - Object store
452
641
  * @returns Shallow info with boundary commits
642
+ *
643
+ * @example
644
+ * ```typescript
645
+ * const shallowInfo = await processShallow(
646
+ * session,
647
+ * [], // No previous shallow commits
648
+ * 3, // Depth of 3 commits
649
+ * undefined,
650
+ * undefined,
651
+ * store
652
+ * )
653
+ * // shallowInfo.shallowCommits contains boundary commits
654
+ * ```
453
655
  */
454
656
  export async function processShallow(session, shallowLines, depth, deepenSince, deepenNot, store) {
455
657
  const result = {
@@ -512,10 +714,23 @@ export async function processShallow(session, shallowLines, depth, deepenSince,
512
714
  return result;
513
715
  }
514
716
  /**
515
- * Format shallow/unshallow lines for response
717
+ * Format shallow/unshallow lines for response.
718
+ *
719
+ * @description
720
+ * Creates pkt-line formatted shallow/unshallow responses to send
721
+ * to the client before the packfile.
516
722
  *
517
723
  * @param shallowInfo - Shallow info to format
518
724
  * @returns Pkt-line formatted shallow response
725
+ *
726
+ * @example
727
+ * ```typescript
728
+ * const response = formatShallowResponse({
729
+ * shallowCommits: ['abc123...'],
730
+ * unshallowCommits: []
731
+ * })
732
+ * // '001cshallow abc123...\n'
733
+ * ```
519
734
  */
520
735
  export function formatShallowResponse(shallowInfo) {
521
736
  const lines = [];
@@ -531,11 +746,27 @@ export function formatShallowResponse(shallowInfo) {
531
746
  // Side-band Multiplexing
532
747
  // ============================================================================
533
748
  /**
534
- * Wrap data in side-band format
749
+ * Wrap data in side-band format.
750
+ *
751
+ * @description
752
+ * Wraps data in side-band format for multiplexed transmission.
753
+ * The format is: pkt-line length + channel byte + data
535
754
  *
536
755
  * @param channel - Side-band channel (1=data, 2=progress, 3=error)
537
756
  * @param data - Data to wrap
538
757
  * @returns Pkt-line formatted side-band data
758
+ *
759
+ * @example
760
+ * ```typescript
761
+ * // Wrap packfile data for channel 1
762
+ * const wrapped = wrapSideBand(SideBandChannel.PACK_DATA, packfile)
763
+ *
764
+ * // Wrap progress message for channel 2
765
+ * const progress = wrapSideBand(
766
+ * SideBandChannel.PROGRESS,
767
+ * encoder.encode('Counting objects: 100%\n')
768
+ * )
769
+ * ```
539
770
  */
540
771
  export function wrapSideBand(channel, data) {
541
772
  // Total length = 4 (pkt-line header) + 1 (channel byte) + data length
@@ -551,10 +782,20 @@ export function wrapSideBand(channel, data) {
551
782
  return result;
552
783
  }
553
784
  /**
554
- * Send progress message via side-band
785
+ * Send progress message via side-band.
786
+ *
787
+ * @description
788
+ * Creates a side-band channel 2 message for progress reporting.
789
+ * Messages are displayed to the user during fetch operations.
555
790
  *
556
- * @param message - Progress message
791
+ * @param message - Progress message (newline added if not present)
557
792
  * @returns Pkt-line formatted progress message
793
+ *
794
+ * @example
795
+ * ```typescript
796
+ * const progress = formatProgress('Counting objects: 42')
797
+ * // Side-band channel 2 packet with the message
798
+ * ```
558
799
  */
559
800
  export function formatProgress(message) {
560
801
  // Ensure message ends with newline
@@ -566,13 +807,32 @@ export function formatProgress(message) {
566
807
  // Packfile Generation
567
808
  // ============================================================================
568
809
  /**
569
- * Generate a packfile containing the requested objects
810
+ * Generate a packfile containing the requested objects.
811
+ *
812
+ * @description
813
+ * Creates a Git packfile containing all objects needed by the client.
814
+ * The packfile format includes:
815
+ * - 12-byte header (PACK + version + object count)
816
+ * - Compressed objects with type/size headers
817
+ * - 20-byte SHA-1 checksum
570
818
  *
571
819
  * @param store - Object store to get objects from
572
820
  * @param wants - Objects the client wants
573
821
  * @param haves - Objects the client already has
574
822
  * @param options - Packfile generation options
575
- * @returns Packfile result
823
+ * @returns Packfile result with binary data and metadata
824
+ *
825
+ * @example
826
+ * ```typescript
827
+ * const result = await generatePackfile(
828
+ * store,
829
+ * ['commit-sha-1', 'commit-sha-2'],
830
+ * ['base-commit-sha'],
831
+ * { thinPack: true, onProgress: console.log }
832
+ * )
833
+ * // result.packfile contains the binary packfile
834
+ * // result.objectCount is the number of objects
835
+ * ```
576
836
  */
577
837
  export async function generatePackfile(store, wants, haves, options) {
578
838
  const onProgress = options?.onProgress;
@@ -624,12 +884,25 @@ export async function generatePackfile(store, wants, haves, options) {
624
884
  };
625
885
  }
626
886
  /**
627
- * Generate thin pack with deltas against client's objects
887
+ * Generate thin pack with deltas against client's objects.
888
+ *
889
+ * @description
890
+ * Creates a thin pack that can use objects the client already has
891
+ * as delta bases, resulting in smaller transfer sizes.
628
892
  *
629
893
  * @param store - Object store
630
894
  * @param objects - Objects to include
631
895
  * @param clientHasObjects - Objects client already has (for delta bases)
632
896
  * @returns Thin packfile
897
+ *
898
+ * @example
899
+ * ```typescript
900
+ * const result = await generateThinPack(
901
+ * store,
902
+ * ['new-blob-sha'],
903
+ * ['similar-blob-sha'] // Client has this, can be delta base
904
+ * )
905
+ * ```
633
906
  */
634
907
  export async function generateThinPack(store, objects, clientHasObjects) {
635
908
  // For thin packs, we can use client's objects as delta bases
@@ -653,7 +926,8 @@ export async function generateThinPack(store, objects, clientHasObjects) {
653
926
  // Packfile Building Helpers
654
927
  // ============================================================================
655
928
  /**
656
- * Object type to packfile type number mapping
929
+ * Object type to packfile type number mapping.
930
+ * @internal
657
931
  */
658
932
  const OBJECT_TYPE_MAP = {
659
933
  commit: 1,
@@ -662,7 +936,8 @@ const OBJECT_TYPE_MAP = {
662
936
  tag: 4
663
937
  };
664
938
  /**
665
- * Create packfile header
939
+ * Create packfile header.
940
+ * @internal
666
941
  */
667
942
  function createPackfileHeader(objectCount) {
668
943
  const header = new Uint8Array(12);
@@ -684,7 +959,8 @@ function createPackfileHeader(objectCount) {
684
959
  return header;
685
960
  }
686
961
  /**
687
- * Encode object header in packfile format
962
+ * Encode object header in packfile format.
963
+ * @internal
688
964
  */
689
965
  function encodePackfileObjectHeader(type, size) {
690
966
  const bytes = [];
@@ -700,7 +976,8 @@ function encodePackfileObjectHeader(type, size) {
700
976
  return new Uint8Array(bytes);
701
977
  }
702
978
  /**
703
- * Build complete packfile from objects
979
+ * Build complete packfile from objects.
980
+ * @internal
704
981
  */
705
982
  async function buildPackfile(objects, _onProgress, _clientHasObjects) {
706
983
  const parts = [];
@@ -737,7 +1014,8 @@ async function buildPackfile(objects, _onProgress, _clientHasObjects) {
737
1014
  return result;
738
1015
  }
739
1016
  /**
740
- * Calculate SHA-1 hash using Web Crypto API
1017
+ * Calculate SHA-1 hash using Web Crypto API.
1018
+ * @internal
741
1019
  */
742
1020
  async function sha1(data) {
743
1021
  const hashBuffer = await crypto.subtle.digest('SHA-1', data);
@@ -747,17 +1025,27 @@ async function sha1(data) {
747
1025
  // Full Fetch Handler
748
1026
  // ============================================================================
749
1027
  /**
750
- * Handle a complete fetch request
1028
+ * Handle a complete fetch request.
751
1029
  *
752
- * This is the main entry point that handles the full protocol flow:
753
- * 1. Parse client request (wants, haves, capabilities)
754
- * 2. Negotiate common ancestors
755
- * 3. Generate and send packfile
1030
+ * @description
1031
+ * This is the main entry point that handles the full upload-pack protocol flow:
1032
+ * 1. Parse client request (wants, haves, capabilities, shallow commands)
1033
+ * 2. Negotiate common ancestors via ACK/NAK
1034
+ * 3. Generate and return packfile with requested objects
756
1035
  *
757
1036
  * @param session - Upload pack session
758
- * @param request - Raw request data
1037
+ * @param request - Raw request data (pkt-line formatted)
759
1038
  * @param store - Object store
760
1039
  * @returns Response data (ACKs/NAKs + packfile)
1040
+ *
1041
+ * @example
1042
+ * ```typescript
1043
+ * const session = createSession('repo', refs)
1044
+ * const requestBody = '0032want abc123... side-band-64k\n00000009done\n'
1045
+ *
1046
+ * const response = await handleFetch(session, requestBody, store)
1047
+ * // response contains NAK + packfile data
1048
+ * ```
761
1049
  */
762
1050
  export async function handleFetch(session, request, store) {
763
1051
  const lines = request.split('\n').filter(l => l.trim() && l !== '0000');