git-remote-ops 0.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 (245) hide show
  1. package/AGENTS.md +177 -0
  2. package/LICENSE +21 -0
  3. package/README.md +247 -0
  4. package/esm/_dnt.shims.js +72 -0
  5. package/esm/cli.js +217 -0
  6. package/esm/client.js +439 -0
  7. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.js +1 -0
  8. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_errors.js +133 -0
  9. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_spread.js +1 -0
  10. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.js +1 -0
  11. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_utils.js +141 -0
  12. package/esm/deps/jsr.io/@cliffy/command/1.1.0/command.js +1861 -0
  13. package/esm/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.js +357 -0
  14. package/esm/deps/jsr.io/@cliffy/command/1.1.0/mod.js +13 -0
  15. package/esm/deps/jsr.io/@cliffy/command/1.1.0/type.js +27 -0
  16. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.js +16 -0
  17. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.js +13 -0
  18. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.js +14 -0
  19. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/command.js +9 -0
  20. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/enum.js +24 -0
  21. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/file.js +12 -0
  22. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/integer.js +9 -0
  23. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/number.js +9 -0
  24. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/secret.js +7 -0
  25. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/string.js +9 -0
  26. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types.js +2 -0
  27. package/esm/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.js +26 -0
  28. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_errors.js +129 -0
  29. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_utils.js +100 -0
  30. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.js +166 -0
  31. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/flags.js +750 -0
  32. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/mod.js +55 -0
  33. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.js +11 -0
  34. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.js +9 -0
  35. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/number.js +11 -0
  36. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/string.js +4 -0
  37. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types.js +1 -0
  38. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.js +16 -0
  39. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.js +11 -0
  40. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.js +25 -0
  41. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.js +18 -0
  42. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.js +11 -0
  43. package/esm/deps/jsr.io/@cliffy/table/1.1.0/_layout.js +616 -0
  44. package/esm/deps/jsr.io/@cliffy/table/1.1.0/_utils.js +79 -0
  45. package/esm/deps/jsr.io/@cliffy/table/1.1.0/border.js +18 -0
  46. package/esm/deps/jsr.io/@cliffy/table/1.1.0/cell.js +190 -0
  47. package/esm/deps/jsr.io/@cliffy/table/1.1.0/column.js +117 -0
  48. package/esm/deps/jsr.io/@cliffy/table/1.1.0/consume_words.js +64 -0
  49. package/esm/deps/jsr.io/@cliffy/table/1.1.0/mod.js +42 -0
  50. package/esm/deps/jsr.io/@cliffy/table/1.1.0/row.js +82 -0
  51. package/esm/deps/jsr.io/@cliffy/table/1.1.0/table.js +341 -0
  52. package/esm/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.js +101 -0
  53. package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.js +2 -0
  54. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +237 -0
  55. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +2277 -0
  56. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +46 -0
  57. package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +132 -0
  58. package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.js +270 -0
  59. package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.js +23 -0
  60. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +61 -0
  61. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.js +51 -0
  62. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +13 -0
  63. package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.js +2 -0
  64. package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.js +87 -0
  65. package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.js +903 -0
  66. package/esm/deps/jsr.io/@std/text/1.0.18/closest_string.js +46 -0
  67. package/esm/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.js +127 -0
  68. package/esm/errors.js +38 -0
  69. package/esm/index.js +10 -0
  70. package/esm/logger.js +216 -0
  71. package/esm/objects/commit.js +47 -0
  72. package/esm/objects/index.js +2 -0
  73. package/esm/objects/tree.js +149 -0
  74. package/esm/pack/delta.js +179 -0
  75. package/esm/pack/index.js +3 -0
  76. package/esm/pack/objects.js +72 -0
  77. package/esm/pack/parser.js +304 -0
  78. package/esm/package.json +3 -0
  79. package/esm/protocol/index.js +3 -0
  80. package/esm/protocol/pkt_line.js +103 -0
  81. package/esm/protocol/refs.js +100 -0
  82. package/esm/protocol/upload_pack.js +259 -0
  83. package/esm/transport.js +128 -0
  84. package/esm/types.js +8 -0
  85. package/package.json +50 -0
  86. package/types/_dnt.shims.d.ts +16 -0
  87. package/types/_dnt.shims.d.ts.map +1 -0
  88. package/types/cli.d.ts +3 -0
  89. package/types/cli.d.ts.map +1 -0
  90. package/types/client.d.ts +108 -0
  91. package/types/client.d.ts.map +1 -0
  92. package/types/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.d.ts +163 -0
  93. package/types/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.d.ts.map +1 -0
  94. package/types/deps/jsr.io/@cliffy/command/1.1.0/_errors.d.ts +71 -0
  95. package/types/deps/jsr.io/@cliffy/command/1.1.0/_errors.d.ts.map +1 -0
  96. package/types/deps/jsr.io/@cliffy/command/1.1.0/_spread.d.ts +16 -0
  97. package/types/deps/jsr.io/@cliffy/command/1.1.0/_spread.d.ts.map +1 -0
  98. package/types/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.d.ts +15 -0
  99. package/types/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.d.ts.map +1 -0
  100. package/types/deps/jsr.io/@cliffy/command/1.1.0/_utils.d.ts +38 -0
  101. package/types/deps/jsr.io/@cliffy/command/1.1.0/_utils.d.ts.map +1 -0
  102. package/types/deps/jsr.io/@cliffy/command/1.1.0/command.d.ts +1086 -0
  103. package/types/deps/jsr.io/@cliffy/command/1.1.0/command.d.ts.map +1 -0
  104. package/types/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.d.ts +33 -0
  105. package/types/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.d.ts.map +1 -0
  106. package/types/deps/jsr.io/@cliffy/command/1.1.0/mod.d.ts +78 -0
  107. package/types/deps/jsr.io/@cliffy/command/1.1.0/mod.d.ts.map +1 -0
  108. package/types/deps/jsr.io/@cliffy/command/1.1.0/type.d.ts +51 -0
  109. package/types/deps/jsr.io/@cliffy/command/1.1.0/type.d.ts.map +1 -0
  110. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.d.ts +10 -0
  111. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.d.ts.map +1 -0
  112. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.d.ts +10 -0
  113. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.d.ts.map +1 -0
  114. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.d.ts +10 -0
  115. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.d.ts.map +1 -0
  116. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/command.d.ts +8 -0
  117. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/command.d.ts.map +1 -0
  118. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/enum.d.ts +11 -0
  119. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/enum.d.ts.map +1 -0
  120. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/file.d.ts +6 -0
  121. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/file.d.ts.map +1 -0
  122. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/integer.d.ts +8 -0
  123. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/integer.d.ts.map +1 -0
  124. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/number.d.ts +8 -0
  125. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/number.d.ts.map +1 -0
  126. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/secret.d.ts +6 -0
  127. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/secret.d.ts.map +1 -0
  128. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/string.d.ts +8 -0
  129. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/string.d.ts.map +1 -0
  130. package/types/deps/jsr.io/@cliffy/command/1.1.0/types.d.ts +161 -0
  131. package/types/deps/jsr.io/@cliffy/command/1.1.0/types.d.ts.map +1 -0
  132. package/types/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.d.ts +4 -0
  133. package/types/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.d.ts.map +1 -0
  134. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_errors.d.ts +67 -0
  135. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_errors.d.ts.map +1 -0
  136. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_utils.d.ts +17 -0
  137. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_utils.d.ts.map +1 -0
  138. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.d.ts +11 -0
  139. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.d.ts.map +1 -0
  140. package/types/deps/jsr.io/@cliffy/flags/1.1.0/flags.d.ts +154 -0
  141. package/types/deps/jsr.io/@cliffy/flags/1.1.0/flags.d.ts.map +1 -0
  142. package/types/deps/jsr.io/@cliffy/flags/1.1.0/mod.d.ts +57 -0
  143. package/types/deps/jsr.io/@cliffy/flags/1.1.0/mod.d.ts.map +1 -0
  144. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.d.ts +4 -0
  145. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.d.ts.map +1 -0
  146. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.d.ts +4 -0
  147. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.d.ts.map +1 -0
  148. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/number.d.ts +4 -0
  149. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/number.d.ts.map +1 -0
  150. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/string.d.ts +4 -0
  151. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/string.d.ts.map +1 -0
  152. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types.d.ts +170 -0
  153. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types.d.ts.map +1 -0
  154. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.d.ts +8 -0
  155. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.d.ts.map +1 -0
  156. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.d.ts +7 -0
  157. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.d.ts.map +1 -0
  158. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.d.ts +7 -0
  159. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.d.ts.map +1 -0
  160. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.d.ts +8 -0
  161. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.d.ts.map +1 -0
  162. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.d.ts +7 -0
  163. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.d.ts.map +1 -0
  164. package/types/deps/jsr.io/@cliffy/table/1.1.0/_layout.d.ts +108 -0
  165. package/types/deps/jsr.io/@cliffy/table/1.1.0/_layout.d.ts.map +1 -0
  166. package/types/deps/jsr.io/@cliffy/table/1.1.0/_utils.d.ts +26 -0
  167. package/types/deps/jsr.io/@cliffy/table/1.1.0/_utils.d.ts.map +1 -0
  168. package/types/deps/jsr.io/@cliffy/table/1.1.0/border.d.ts +21 -0
  169. package/types/deps/jsr.io/@cliffy/table/1.1.0/border.d.ts.map +1 -0
  170. package/types/deps/jsr.io/@cliffy/table/1.1.0/cell.d.ts +155 -0
  171. package/types/deps/jsr.io/@cliffy/table/1.1.0/cell.d.ts.map +1 -0
  172. package/types/deps/jsr.io/@cliffy/table/1.1.0/column.d.ts +97 -0
  173. package/types/deps/jsr.io/@cliffy/table/1.1.0/column.d.ts.map +1 -0
  174. package/types/deps/jsr.io/@cliffy/table/1.1.0/consume_words.d.ts +30 -0
  175. package/types/deps/jsr.io/@cliffy/table/1.1.0/consume_words.d.ts.map +1 -0
  176. package/types/deps/jsr.io/@cliffy/table/1.1.0/mod.d.ts +43 -0
  177. package/types/deps/jsr.io/@cliffy/table/1.1.0/mod.d.ts.map +1 -0
  178. package/types/deps/jsr.io/@cliffy/table/1.1.0/row.d.ts +67 -0
  179. package/types/deps/jsr.io/@cliffy/table/1.1.0/row.d.ts.map +1 -0
  180. package/types/deps/jsr.io/@cliffy/table/1.1.0/table.d.ts +235 -0
  181. package/types/deps/jsr.io/@cliffy/table/1.1.0/table.d.ts.map +1 -0
  182. package/types/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.d.ts +40 -0
  183. package/types/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.d.ts.map +1 -0
  184. package/types/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +9 -0
  185. package/types/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +1 -0
  186. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +2 -0
  187. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +1 -0
  188. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +69 -0
  189. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +1 -0
  190. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +13 -0
  191. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +1 -0
  192. package/types/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +76 -0
  193. package/types/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +1 -0
  194. package/types/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +149 -0
  195. package/types/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +1 -0
  196. package/types/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +22 -0
  197. package/types/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +1 -0
  198. package/types/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +40 -0
  199. package/types/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +1 -0
  200. package/types/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +23 -0
  201. package/types/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +1 -0
  202. package/types/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +4 -0
  203. package/types/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +1 -0
  204. package/types/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +9 -0
  205. package/types/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +1 -0
  206. package/types/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +39 -0
  207. package/types/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +1 -0
  208. package/types/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts +700 -0
  209. package/types/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +1 -0
  210. package/types/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts +42 -0
  211. package/types/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts.map +1 -0
  212. package/types/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts +23 -0
  213. package/types/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts.map +1 -0
  214. package/types/errors.d.ts +73 -0
  215. package/types/errors.d.ts.map +1 -0
  216. package/types/index.d.ts +14 -0
  217. package/types/index.d.ts.map +1 -0
  218. package/types/logger.d.ts +70 -0
  219. package/types/logger.d.ts.map +1 -0
  220. package/types/objects/commit.d.ts +23 -0
  221. package/types/objects/commit.d.ts.map +1 -0
  222. package/types/objects/index.d.ts +3 -0
  223. package/types/objects/index.d.ts.map +1 -0
  224. package/types/objects/tree.d.ts +49 -0
  225. package/types/objects/tree.d.ts.map +1 -0
  226. package/types/pack/delta.d.ts +47 -0
  227. package/types/pack/delta.d.ts.map +1 -0
  228. package/types/pack/index.d.ts +4 -0
  229. package/types/pack/index.d.ts.map +1 -0
  230. package/types/pack/objects.d.ts +53 -0
  231. package/types/pack/objects.d.ts.map +1 -0
  232. package/types/pack/parser.d.ts +61 -0
  233. package/types/pack/parser.d.ts.map +1 -0
  234. package/types/protocol/index.d.ts +4 -0
  235. package/types/protocol/index.d.ts.map +1 -0
  236. package/types/protocol/pkt_line.d.ts +44 -0
  237. package/types/protocol/pkt_line.d.ts.map +1 -0
  238. package/types/protocol/refs.d.ts +40 -0
  239. package/types/protocol/refs.d.ts.map +1 -0
  240. package/types/protocol/upload_pack.d.ts +45 -0
  241. package/types/protocol/upload_pack.d.ts.map +1 -0
  242. package/types/transport.d.ts +24 -0
  243. package/types/transport.d.ts.map +1 -0
  244. package/types/types.d.ts +121 -0
  245. package/types/types.d.ts.map +1 -0
@@ -0,0 +1,42 @@
1
+ /** Options for {@linkcode closestString}. */
2
+ export interface ClosestStringOptions {
3
+ /**
4
+ * Whether the distance should include case.
5
+ *
6
+ * @default {false}
7
+ */
8
+ caseSensitive?: boolean;
9
+ /**
10
+ * A custom comparison function to use for comparing strings.
11
+ *
12
+ * @param a The first string for comparison.
13
+ * @param b The second string for comparison.
14
+ * @returns The distance between the two strings.
15
+ * @default {levenshteinDistance}
16
+ */
17
+ compareFn?: (a: string, b: string) => number;
18
+ }
19
+ /**
20
+ * Finds the most similar string from an array of strings.
21
+ *
22
+ * By default, calculates the distance between words using the
23
+ * {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}.
24
+ *
25
+ * @example Usage
26
+ * ```ts
27
+ * import { closestString } from "@std/text/closest-string";
28
+ * import { assertEquals } from "@std/assert";
29
+ *
30
+ * const possibleWords = ["length", "size", "blah", "help"];
31
+ * const suggestion = closestString("hep", possibleWords);
32
+ *
33
+ * assertEquals(suggestion, "help");
34
+ * ```
35
+ *
36
+ * @param givenWord The string to measure distance against
37
+ * @param possibleWords The string-array to pick the closest string from
38
+ * @param options The options for the comparison.
39
+ * @returns The closest string
40
+ */
41
+ export declare function closestString(givenWord: string, possibleWords: ReadonlyArray<string>, options?: ClosestStringOptions): string;
42
+ //# sourceMappingURL=closest_string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closest_string.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/closest_string.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAwBR"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Calculates the
3
+ * {@link https://en.wikipedia.org/wiki/Levenshtein_distance | Levenshtein distance}
4
+ * between two strings.
5
+ *
6
+ * > [!NOTE]
7
+ * > The complexity of this function is O(m * n), where m and n are the lengths
8
+ * > of the two strings. It's recommended to limit the length and validate input
9
+ * > if arbitrarily accepting input.
10
+ *
11
+ * @example Usage
12
+ * ```ts
13
+ * import { levenshteinDistance } from "@std/text/levenshtein-distance";
14
+ * import { assertEquals } from "@std/assert";
15
+ *
16
+ * assertEquals(levenshteinDistance("aa", "bb"), 2);
17
+ * ```
18
+ * @param str1 The first string.
19
+ * @param str2 The second string.
20
+ * @returns The Levenshtein distance between the two strings.
21
+ */
22
+ export declare function levenshteinDistance(str1: string, str2: string): number;
23
+ //# sourceMappingURL=levenshtein_distance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"levenshtein_distance.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.ts"],"names":[],"mappings":"AAmGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAWtE"}
@@ -0,0 +1,73 @@
1
+ declare const PackParseError_base: import("better-result").TaggedErrorClass<"PackParseError", {
2
+ reason: string;
3
+ message: string;
4
+ offset?: number;
5
+ cause?: unknown;
6
+ }>;
7
+ /** Anything that goes wrong while parsing a packfile or applying a delta. */
8
+ export declare class PackParseError extends PackParseError_base {
9
+ }
10
+ declare const ObjectDecodeError_base: import("better-result").TaggedErrorClass<"ObjectDecodeError", {
11
+ reason: string;
12
+ message: string;
13
+ objectType?: string;
14
+ sha?: string;
15
+ cause?: unknown;
16
+ }>;
17
+ /** Raised when a commit/tree body fails structural validation. */
18
+ export declare class ObjectDecodeError extends ObjectDecodeError_base {
19
+ }
20
+ declare const PktLineError_base: import("better-result").TaggedErrorClass<"PktLineError", {
21
+ reason: string;
22
+ message: string;
23
+ offset?: number;
24
+ cause?: unknown;
25
+ }>;
26
+ /** Malformed pkt-line framing (bad length prefix or truncation). */
27
+ export declare class PktLineError extends PktLineError_base {
28
+ }
29
+ declare const UploadPackError_base: import("better-result").TaggedErrorClass<"UploadPackError", {
30
+ reason: string;
31
+ message: string;
32
+ cause?: unknown;
33
+ }>;
34
+ /** Server returned a `git-upload-pack` response we couldn't interpret. */
35
+ export declare class UploadPackError extends UploadPackError_base {
36
+ }
37
+ declare const TransportError_base: import("better-result").TaggedErrorClass<"TransportError", {
38
+ method: string;
39
+ url: string;
40
+ message: string;
41
+ status?: number;
42
+ statusText?: string;
43
+ cause?: unknown;
44
+ }>;
45
+ /** Anything HTTP — network failure, non-2xx status, body-read error. */
46
+ export declare class TransportError extends TransportError_base {
47
+ }
48
+ declare const RefNotFoundError_base: import("better-result").TaggedErrorClass<"RefNotFoundError", {
49
+ ref: string;
50
+ message: string;
51
+ }>;
52
+ /** The requested ref didn't appear in the server's advertisement. */
53
+ export declare class RefNotFoundError extends RefNotFoundError_base {
54
+ }
55
+ declare const ObjectNotFoundError_base: import("better-result").TaggedErrorClass<"ObjectNotFoundError", {
56
+ sha: string;
57
+ message: string;
58
+ }>;
59
+ /** An object referenced by sha wasn't present in the materialized store. */
60
+ export declare class ObjectNotFoundError extends ObjectNotFoundError_base {
61
+ }
62
+ declare const PathNotFoundError_base: import("better-result").TaggedErrorClass<"PathNotFoundError", {
63
+ path: string;
64
+ message: string;
65
+ treeSha?: string;
66
+ }>;
67
+ /** Tree-walk couldn't reach the requested path. */
68
+ export declare class PathNotFoundError extends PathNotFoundError_base {
69
+ }
70
+ /** Discriminated union of every error this library returns. */
71
+ export type GitRemoteOpsError = PackParseError | ObjectDecodeError | PktLineError | UploadPackError | TransportError | RefNotFoundError | ObjectNotFoundError | PathNotFoundError;
72
+ export {};
73
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";YAiBU,MAAM;aACL,MAAM;aACN,MAAM;YACP,OAAO;;AALjB,6EAA6E;AAC7E,qBAAa,cAAe,SAAQ,mBAKhC;CAAG;;YAIG,MAAM;aACL,MAAM;iBACF,MAAM;UACb,MAAM;YACJ,OAAO;;AANjB,kEAAkE;AAClE,qBAAa,iBAAkB,SAAQ,sBAMnC;CAAG;;YAIG,MAAM;aACL,MAAM;aACN,MAAM;YACP,OAAO;;AALjB,oEAAoE;AACpE,qBAAa,YAAa,SAAQ,iBAK9B;CAAG;;YAIG,MAAM;aACL,MAAM;YACP,OAAO;;AAJjB,0EAA0E;AAC1E,qBAAa,eAAgB,SAAQ,oBAIjC;CAAG;;YAIG,MAAM;SACT,MAAM;aACF,MAAM;aACN,MAAM;iBACF,MAAM;YACX,OAAO;;AAPjB,wEAAwE;AACxE,qBAAa,cAAe,SAAQ,mBAOhC;CAAG;;SAIA,MAAM;aACF,MAAM;;AAHjB,qEAAqE;AACrE,qBAAa,gBAAiB,SAAQ,qBAGlC;CAAG;;SAIA,MAAM;aACF,MAAM;;AAHjB,4EAA4E;AAC5E,qBAAa,mBAAoB,SAAQ,wBAGrC;CAAG;;UAIC,MAAM;aACH,MAAM;cACL,MAAM;;AAJlB,mDAAmD;AACnD,qBAAa,iBAAkB,SAAQ,sBAInC;CAAG;AAEP,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,iBAAiB,GACjB,YAAY,GACZ,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @module git-remote-ops
3
+ *
4
+ * Public entry point. Re-exports the {@link RemoteGit} client, the
5
+ * {@link Logger}, every {@link GitRemoteOpsError} subclass, and the shared
6
+ * type vocabulary. The CLI ships separately under `./cli`.
7
+ */
8
+ export { RemoteGit } from "./client.js";
9
+ export { Logger, NULL_LOGGER } from "./logger.js";
10
+ export type { LoggerOptions, LogLevel, Metrics } from "./logger.js";
11
+ export { ObjectDecodeError, ObjectNotFoundError, PackParseError, PathNotFoundError, PktLineError, RefNotFoundError, TransportError, UploadPackError, } from "./errors.js";
12
+ export type { GitRemoteOpsError } from "./errors.js";
13
+ export type { CommitInfo, DiagnosticFn, FetchCommitOptions, GitObject, GitObjectMap, GitObjectType, RemoteGitOptions, ServerProfile, TreeEntry, } from "./types.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,SAAS,GACV,MAAM,YAAY,CAAC"}
@@ -0,0 +1,70 @@
1
+ export type LogLevel = "silent" | "info" | "debug" | "trace";
2
+ export interface LoggerOptions {
3
+ level?: LogLevel;
4
+ sink?: (line: string) => void;
5
+ collectMetrics?: boolean;
6
+ color?: boolean;
7
+ timestamps?: boolean;
8
+ }
9
+ export interface Metrics {
10
+ httpRequests: number;
11
+ httpBytesIn: number;
12
+ httpBytesOut: number;
13
+ httpDurationMs: number;
14
+ packObjects: number;
15
+ packBytes: number;
16
+ packParseMs: number;
17
+ byType: Record<"commit" | "tree" | "blob" | "tag", number>;
18
+ }
19
+ /** Pretty-print a byte count with binary-prefix units. */
20
+ export declare function formatBytes(n: number): string;
21
+ /** Pretty-print a millisecond duration, scaling unit to magnitude. */
22
+ export declare function formatDuration(ms: number): string;
23
+ /**
24
+ * Levelled logger with namespaced children and shared metrics.
25
+ *
26
+ * Children share their parent's `metrics` object so that any `recordHttp` /
27
+ * `recordPack` call anywhere in the tree contributes to the same totals
28
+ * surfaced by {@link Logger.summary}.
29
+ */
30
+ export declare class Logger {
31
+ readonly level: LogLevel;
32
+ readonly metrics: Metrics;
33
+ private sink;
34
+ private namespace;
35
+ private collect;
36
+ private color;
37
+ private timestamps;
38
+ private epoch;
39
+ constructor(options?: LoggerOptions, namespace?: string);
40
+ /** Spawn a logger that prefixes its messages with `parent.namespace + "." + namespace`. */
41
+ child(namespace: string): Logger;
42
+ private enabled;
43
+ private paint;
44
+ private emit;
45
+ /** Emit at `info`. No-op if level is `silent`. */
46
+ info(message: string): void;
47
+ /** Emit at `debug`. No-op unless level ≥ `debug`. */
48
+ debug(message: string): void;
49
+ /** Emit at `trace`. No-op unless level is `trace`. */
50
+ trace(message: string): void;
51
+ /** Time an async op; emits at `level` with duration. */
52
+ time<T>(level: Exclude<LogLevel, "silent">, label: string, fn: () => Promise<T>): Promise<T>;
53
+ /** Add one HTTP request's totals to {@link Logger.metrics}. */
54
+ recordHttp(opts: {
55
+ bytesIn: number;
56
+ bytesOut: number;
57
+ durationMs: number;
58
+ }): void;
59
+ /** Add one parsed pack's totals to {@link Logger.metrics}. */
60
+ recordPack(opts: {
61
+ bytes: number;
62
+ durationMs: number;
63
+ byType: Record<"commit" | "tree" | "blob" | "tag", number>;
64
+ }): void;
65
+ /** Render an aligned multi-line table of {@link Logger.metrics}. CLI uses this for `--stats`. */
66
+ summary(): string;
67
+ }
68
+ /** Shared no-op logger. Use as a default when callers don't pass one in. */
69
+ export declare const NULL_LOGGER: Logger;
70
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AA+B7D,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,OAAO;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC;CAC5D;AAwBD,0DAA0D;AAC1D,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;;;;;GAMG;AACH,qBAAa,MAAM;IACjB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,KAAK,CAAS;gBAEV,OAAO,GAAE,aAAkB,EAAE,SAAS,SAAK;IAWvD,2FAA2F;IAC3F,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAchC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,IAAI;IAaZ,kDAAkD;IAClD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAG3B,qDAAqD;IACrD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAG5B,sDAAsD;IACtD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,wDAAwD;IAClD,IAAI,CAAC,CAAC,EACV,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAClC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC;IAab,+DAA+D;IAC/D,UAAU,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAQjF,8DAA8D;IAC9D,UAAU,CAAC,IAAI,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC;KAC5D,GAAG,IAAI;IAUR,iGAAiG;IACjG,OAAO,IAAI,MAAM;CA+BlB;AAED,4EAA4E;AAC5E,eAAO,MAAM,WAAW,QAAyD,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module objects-commit
3
+ *
4
+ * Decoder for the loose-commit object body.
5
+ *
6
+ * A commit is a header block followed by a blank line and a freeform message.
7
+ * Each header line is `<field> <value>` and only the first occurrence of any
8
+ * header is significant for our purposes (Git allows multiple `parent` lines
9
+ * for merge commits; this client deliberately keeps just the first since it
10
+ * only ever walks toward the root snapshot).
11
+ */
12
+ import { Result } from "better-result";
13
+ import { ObjectDecodeError } from "../errors.js";
14
+ import type { CommitInfo } from "../types.js";
15
+ /**
16
+ * Parse the body of a commit object.
17
+ *
18
+ * @param content Uncompressed commit bytes (no `commit <size>\0` header).
19
+ * @returns The decoded {@link CommitInfo}, or {@link ObjectDecodeError} if the
20
+ * mandatory `tree` field is absent.
21
+ */
22
+ export declare function parseCommit(content: Uint8Array): Result<CommitInfo, ObjectDecodeError>;
23
+ //# sourceMappingURL=commit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/objects/commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,CA6BtF"}
@@ -0,0 +1,3 @@
1
+ export * from "./commit.js";
2
+ export * from "./tree.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/objects/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @module objects-tree
3
+ *
4
+ * Tree decoder and helpers for walking trees / resolving paths to blobs.
5
+ *
6
+ * A tree entry on disk is `<octal-mode> <name>\0<20-byte-sha>` with no length
7
+ * prefix; entries are concatenated. Subtrees use mode `"40000"`; everything
8
+ * else (regular files, executable files, symlinks, gitlinks) is treated as a
9
+ * leaf by {@link walkTree}.
10
+ */
11
+ import { Result } from "better-result";
12
+ import { ObjectDecodeError, PathNotFoundError } from "../errors.js";
13
+ import type { GitObjectMap, TreeEntry } from "../types.js";
14
+ interface FileEntry {
15
+ mode: string;
16
+ path: string;
17
+ sha: string;
18
+ }
19
+ /**
20
+ * Parse a tree body into its entries, in the order they appear on disk.
21
+ *
22
+ * @param content Uncompressed tree bytes (no `tree <size>\0` header).
23
+ * @returns Ordered entries, or {@link ObjectDecodeError} on a malformed entry.
24
+ */
25
+ export declare function parseTree(content: Uint8Array): Result<TreeEntry[], ObjectDecodeError>;
26
+ /**
27
+ * Recursively flatten a tree into its leaf entries.
28
+ *
29
+ * Subtrees are followed; every other mode is treated as a file and emitted
30
+ * with its full path joined from `pathPrefix`. Requires that every reachable
31
+ * tree object is already present in `objects` — typically the case after a
32
+ * full (unfiltered) snapshot fetch.
33
+ *
34
+ * @param pathPrefix Internal: prefix prepended to entry names while recursing.
35
+ */
36
+ export declare function walkTree(objects: GitObjectMap, treeSha: string, pathPrefix?: string): Result<FileEntry[], ObjectDecodeError>;
37
+ /**
38
+ * Resolve a slash-separated path inside a tree to the SHA of its leaf entry
39
+ * (usually a blob).
40
+ *
41
+ * Intermediate components must be subtrees; the final component may be any
42
+ * mode (blob, exec, symlink). Leading/trailing/duplicate slashes are tolerated.
43
+ *
44
+ * @returns Leaf SHA-1, or {@link PathNotFoundError} when any component is
45
+ * missing or an intermediate component is not a tree.
46
+ */
47
+ export declare function resolvePathToBlob(objects: GitObjectMap, treeSha: string, path: string): Result<string, PathNotFoundError | ObjectDecodeError>;
48
+ export {};
49
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/objects/tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3D,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAaD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,CAgCrF;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,EACf,UAAU,SAAK,GACd,MAAM,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,CA4BxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAAC,CAoDvD"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @module pack-delta
3
+ *
4
+ * Pack format varint decoders and the Git delta reconstruction routine.
5
+ *
6
+ * Two varint flavours live in pack files. The "big-endian" form used by
7
+ * `OBJ_OFS_DELTA` headers is decoded by {@link readVarintBe}; the
8
+ * little-endian form used inside the delta opcode stream is handled inline
9
+ * by {@link applyDelta}.
10
+ *
11
+ * Delta format spec: https://git-scm.com/docs/pack-format#_deltified_representation
12
+ */
13
+ import { Result } from "better-result";
14
+ import { PackParseError } from "../errors.js";
15
+ import type { ReadResult } from "../types.js";
16
+ /**
17
+ * Decode Git's "offset-encoded" big-endian varint (used for `OBJ_OFS_DELTA`
18
+ * base offsets).
19
+ *
20
+ * Each continuation byte adds an implicit `+1` before shifting, which lets the
21
+ * encoding represent more values in the same number of bytes than a plain MSB
22
+ * varint would.
23
+ *
24
+ * @returns `{ value, offset }` where `offset` points just past the last byte
25
+ * consumed, or {@link PackParseError} if the buffer ends mid-varint.
26
+ */
27
+ export declare function readVarintBe(data: Uint8Array, offset: number): Result<ReadResult<number>, PackParseError>;
28
+ /**
29
+ * Reconstruct an object body from a delta against `base`.
30
+ *
31
+ * The delta stream begins with two little-endian varints (source size, target
32
+ * size). Then a sequence of opcodes follows, each either:
33
+ *
34
+ * - **COPY** (high bit set): copy a range from `base` into the output. The
35
+ * low nibble's set bits select which of up to 4 offset bytes follow; the
36
+ * next 3 bits select up to 3 size bytes. A size of 0 means 64 KiB.
37
+ * - **INSERT** (high bit clear, opcode `1..0x7f`): emit the next `opcode`
38
+ * bytes of the delta stream verbatim into the output.
39
+ * - opcode `0` is reserved and invalid.
40
+ *
41
+ * The source size is validated implicitly by every COPY's bounds check.
42
+ *
43
+ * @returns The fully reconstructed object, or {@link PackParseError} on any
44
+ * truncation, invalid opcode, or size mismatch.
45
+ */
46
+ export declare function applyDelta(base: Uint8Array, delta: Uint8Array): Result<Uint8Array, PackParseError>;
47
+ //# sourceMappingURL=delta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta.d.ts","sourceRoot":"","sources":["../../src/pack/delta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiB9C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,CA4B5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,UAAU,GAChB,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CA+GpC"}
@@ -0,0 +1,4 @@
1
+ export * from "./objects.js";
2
+ export * from "./delta.js";
3
+ export * from "./parser.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pack/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @module pack-objects
3
+ *
4
+ * Shared constants and the SHA-1 helper used by the packfile parser. Object
5
+ * type codes, varint flags, and pack-format magic live here so that
6
+ * {@link parser} and {@link delta} both reach for the same source of truth.
7
+ *
8
+ * Pack format reference:
9
+ * https://git-scm.com/docs/pack-format
10
+ */
11
+ import { Result } from "better-result";
12
+ import { PackParseError } from "../errors.js";
13
+ import type { GitObjectType } from "../types.js";
14
+ /** Magic bytes opening every packfile: ASCII `"PACK"`. */
15
+ export declare const PACK_SIGNATURE: Uint8Array<ArrayBuffer>;
16
+ /** Bytes consumed by the fixed pack header (signature + version + count). */
17
+ export declare const PACK_HEADER_SIZE = 12;
18
+ /** Size of {@link PACK_SIGNATURE} in bytes. */
19
+ export declare const PACK_SIGNATURE_SIZE = 4;
20
+ /** Pack format versions this parser accepts. v4 exists but is not produced by mainline Git. */
21
+ export declare const SUPPORTED_PACK_VERSIONS: ReadonlySet<number>;
22
+ /** Trailing SHA-1 over the rest of the pack — sits at the very end of the buffer. */
23
+ export declare const PACK_TRAILER_SIZE = 20;
24
+ /** High bit set on a varint byte means "another byte follows". */
25
+ export declare const VARINT_CONTINUE = 128;
26
+ /** Low 7 bits of a varint byte hold value bits. */
27
+ export declare const VARINT_VALUE_MASK = 127;
28
+ /** Packfile object type code: commit. */
29
+ export declare const OBJ_COMMIT = 1;
30
+ /** Packfile object type code: tree. */
31
+ export declare const OBJ_TREE = 2;
32
+ /** Packfile object type code: blob. */
33
+ export declare const OBJ_BLOB = 3;
34
+ /** Packfile object type code: annotated tag. */
35
+ export declare const OBJ_TAG = 4;
36
+ /** Delta object whose base is referenced by negative offset within the same pack. */
37
+ export declare const OBJ_OFS_DELTA = 6;
38
+ /** Delta object whose base is referenced by 20-byte SHA-1 (may be outside the pack). */
39
+ export declare const OBJ_REF_DELTA = 7;
40
+ /** Pack type code → loose-object type name. Excludes delta codes by design. */
41
+ export declare const OBJ_NAMES: Map<number, GitObjectType>;
42
+ /** Reverse of {@link OBJ_NAMES} — type name → pack type code. */
43
+ export declare const OBJ_TYPES: Map<GitObjectType, number>;
44
+ /**
45
+ * Compute the canonical Git SHA-1 of an object — `sha1("<type> <size>\0" || content)`.
46
+ *
47
+ * @param type Either a pack type code (1–4) or the loose-object type name.
48
+ * @param content The uncompressed object body.
49
+ * @returns Lowercase hex SHA-1, or {@link PackParseError} when `type` is a
50
+ * delta code or otherwise unknown.
51
+ */
52
+ export declare function sha1OfObject(type: number | GitObjectType, content: Uint8Array): Result<string, PackParseError>;
53
+ //# sourceMappingURL=objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/pack/objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,0DAA0D;AAC1D,eAAO,MAAM,cAAc,yBAA2C,CAAC;AACvE,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,+CAA+C;AAC/C,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,+FAA+F;AAC/F,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAmB,CAAC;AAE5E,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,kEAAkE;AAClE,eAAO,MAAM,eAAe,MAAO,CAAC;AACpC,mDAAmD;AACnD,eAAO,MAAM,iBAAiB,MAAO,CAAC;AAEtC,yCAAyC;AACzC,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,uCAAuC;AACvC,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,uCAAuC;AACvC,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,gDAAgD;AAChD,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,qFAAqF;AACrF,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,wFAAwF;AACxF,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,SAAS,4BAKpB,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,SAAS,4BAErB,CAAC;AAIF;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,GAAG,aAAa,EAC5B,OAAO,EAAE,UAAU,GAClB,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAehC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @module pack-parser
3
+ *
4
+ * Decode an in-memory packfile into a `sha → GitObject` map.
5
+ *
6
+ * The parser handles the four loose-object types directly and resolves both
7
+ * delta encodings (`OBJ_OFS_DELTA`, `OBJ_REF_DELTA`) by applying
8
+ * {@link applyDelta} against bases discovered earlier in the same pack. Ref
9
+ * deltas whose bases haven't appeared yet are deferred and retried in fixed
10
+ * point until every delta resolves or progress stalls.
11
+ *
12
+ * Optimization: passing a `targets` set lets the parser bail out as soon as
13
+ * every requested SHA has been materialized — useful for "fetch one object"
14
+ * paths where the server may have sent a much larger pack.
15
+ *
16
+ * zlib note: we reach into `node:zlib`'s `_processChunk` to learn exactly how
17
+ * many compressed input bytes were consumed. The public Streams API doesn't
18
+ * expose that, and parsing the next object requires knowing where the current
19
+ * one's compressed run ends.
20
+ */
21
+ import { Result } from "better-result";
22
+ import { PackParseError } from "../errors.js";
23
+ import type { GitObjectMap, PackObjectHeader, ReadResult } from "../types.js";
24
+ /**
25
+ * Decode a single pack-entry header starting at `offset`.
26
+ *
27
+ * Format: one byte holds `[MSB | type:3 | size_lo:4]`. While MSB is set,
28
+ * each additional byte contributes 7 more size bits. Returns the parsed
29
+ * type code, uncompressed size, and the offset just past the header.
30
+ */
31
+ export declare function readPackObjectHeader(data: Uint8Array, offset: number): Result<PackObjectHeader, PackParseError>;
32
+ /**
33
+ * Inflate one zlib stream embedded in the pack at `offset`.
34
+ *
35
+ * The pack's 20-byte trailer is sliced off before inflation so the deflate
36
+ * engine never sees it. `bytesWritten` on the `Inflate` engine reports how
37
+ * many input bytes were consumed, which is the only reliable way to advance
38
+ * `offset` to the next entry — multiple deflate streams sit back-to-back
39
+ * inside the pack and there's no length prefix at this layer.
40
+ *
41
+ * @param expectedSize Uncompressed size reported by the object header. When
42
+ * provided, used to right-size the inflate chunk buffer and to assert the
43
+ * output length post-hoc.
44
+ */
45
+ export declare function decompressAt(data: Uint8Array, offset: number, expectedSize?: number): Result<ReadResult<Uint8Array>, PackParseError>;
46
+ /**
47
+ * Walk every entry in `pack` and return a map of resolved objects keyed by
48
+ * SHA-1.
49
+ *
50
+ * For non-delta entries, the inflated bytes are hashed and stored. For
51
+ * `OBJ_OFS_DELTA` the base is looked up via `byOffset` (always present, since
52
+ * pack ordering guarantees the base appears earlier in the stream). For
53
+ * `OBJ_REF_DELTA` the base may be either earlier or later — unresolved ones
54
+ * accumulate in `pendingRefDeltas` and are retried until either all resolve
55
+ * or a pass makes no progress (cyclic / out-of-pack reference).
56
+ *
57
+ * @param targets Optional set of "wanted" SHAs. If supplied, the parser
58
+ * returns as soon as every target has been materialized — even mid-pack.
59
+ */
60
+ export declare function parsePackfile(pack: Uint8Array, targets?: ReadonlySet<string>): Result<GitObjectMap, PackParseError>;
61
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/pack/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAEV,YAAY,EAEZ,gBAAgB,EAChB,UAAU,EACX,MAAM,aAAa,CAAC;AA4DrB;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CA6B1C;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CAmChD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAiKtC"}
@@ -0,0 +1,4 @@
1
+ export * from "./pkt_line.js";
2
+ export * from "./refs.js";
3
+ export * from "./upload_pack.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @module pkt-line
3
+ *
4
+ * Encode/decode Git's framing format. A pkt-line is a 4-byte ASCII-hex length
5
+ * prefix followed by `length - 4` payload bytes. Three reserved length values
6
+ * carry no payload and act as control markers (flush / delim / response-end).
7
+ *
8
+ * Spec: https://git-scm.com/docs/protocol-common
9
+ */
10
+ import { Result } from "better-result";
11
+ import { PktLineError } from "../errors.js";
12
+ import type { PktLine } from "../types.js";
13
+ /** Encoded `"0000"` flush packet — closes a section in v0 and v2. */
14
+ export declare const FLUSH_PKT: Uint8Array<ArrayBufferLike>;
15
+ /** Encoded `"0001"` delim packet — only valid in protocol v2. */
16
+ export declare const DELIM_PKT: Uint8Array<ArrayBufferLike>;
17
+ /** Encoded `"0002"` response-end packet — only valid in protocol v2. */
18
+ export declare const RESPONSE_END_PKT: Uint8Array<ArrayBufferLike>;
19
+ /**
20
+ * Wrap `payload` in a pkt-line frame.
21
+ *
22
+ * An empty payload returns the flush packet rather than a 4-byte zero-length
23
+ * frame, matching `git`'s convention.
24
+ *
25
+ * @param payload Raw bytes to frame. Pass any trailing `\n` you want preserved.
26
+ * @returns The framed bytes, or {@link PktLineError} if the total would exceed
27
+ * {@link MAX_PKT_LINE_LENGTH}.
28
+ */
29
+ export declare function pktLine(payload: Uint8Array): Result<Uint8Array, PktLineError>;
30
+ /**
31
+ * Decode a sequence of pkt-lines from `buf`.
32
+ *
33
+ * Returns one entry per frame. Control packets (flush/delim/response-end) have
34
+ * `payload: null`. Data packets expose `payload` as a subarray view into `buf` —
35
+ * no bytes are copied. Trailing `\n` bytes inside payloads are preserved; callers
36
+ * that want them stripped must do so explicitly.
37
+ *
38
+ * @param buf Bytes containing zero or more concatenated pkt-lines.
39
+ * @param offset Starting byte index in `buf` (default `0`).
40
+ * @returns The decoded frames in order, or {@link PktLineError} on a bad length
41
+ * prefix or a frame that runs past `buf`'s end.
42
+ */
43
+ export declare function parsePktLines(buf: Uint8Array, offset?: number): Result<PktLine[], PktLineError>;
44
+ //# sourceMappingURL=pkt_line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkt_line.d.ts","sourceRoot":"","sources":["../../src/protocol/pkt_line.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAmB3C,qEAAqE;AACrE,eAAO,MAAM,SAAS,6BAAyB,CAAC;AAChD,iEAAiE;AACjE,eAAO,MAAM,SAAS,6BAAyB,CAAC;AAChD,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,6BAAyB,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAoB7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,UAAU,EACf,MAAM,SAAI,GACT,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAqCjC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module refs
3
+ *
4
+ * Decoders for the two flavours of `info/refs` response Git can return for the
5
+ * `git-upload-pack` service:
6
+ *
7
+ * - **Protocol v0/v1** — a flat stream of `<sha> <ref>` pkt-lines where the
8
+ * first ref also carries a NUL-separated capability list.
9
+ * - **Protocol v2** — a capability advertisement (`version 2`, then one
10
+ * `key[=args]` pkt-line per capability).
11
+ */
12
+ import { Result } from "better-result";
13
+ import type { PktLineError } from "../errors.js";
14
+ import type { ParsedRefAdvertisement } from "../types.js";
15
+ /**
16
+ * Parse a v0/v1 ref advertisement (response body of
17
+ * `GET /info/refs?service=git-upload-pack`).
18
+ *
19
+ * The first non-comment data line is special: its payload contains the ref
20
+ * pair, a NUL byte, then a space-separated list of capabilities. Subsequent
21
+ * lines are plain `<sha> <ref>\n` pairs.
22
+ *
23
+ * @param body Raw response bytes (including any `# service=...` banner).
24
+ * @returns The advertised refs (name → sha) and capabilities, or
25
+ * {@link PktLineError} if the pkt-line framing is malformed.
26
+ */
27
+ export declare function parseRefAdvertisement(body: Uint8Array): Result<ParsedRefAdvertisement, PktLineError>;
28
+ /**
29
+ * Parse a v2 capability advertisement.
30
+ *
31
+ * The first data line is always `version 2`; we encode that as the synthetic
32
+ * capability `"version=2"` so callers can detect protocol v2 with a single
33
+ * lookup. For the `fetch` capability, any space-separated arguments (e.g.
34
+ * `shallow`, `filter`, `wait-for-done`) are added as separate set entries.
35
+ *
36
+ * @param body Raw response bytes from the `git-upload-pack` advertisement.
37
+ * @returns Set of capability tokens, or {@link PktLineError} on bad framing.
38
+ */
39
+ export declare function parseV2CapabilityAdvertisement(body: Uint8Array): Result<Set<string>, PktLineError>;
40
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/protocol/refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAkB1D;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,UAAU,GACf,MAAM,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAgC9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,UAAU,GACf,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAoBnC"}