gitx.do 0.1.0 → 0.1.2

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 (344) hide show
  1. package/README.md +40 -353
  2. package/dist/do/logger.d.ts +50 -0
  3. package/dist/do/logger.d.ts.map +1 -0
  4. package/dist/do/logger.js +122 -0
  5. package/dist/do/logger.js.map +1 -0
  6. package/dist/{durable-object → do}/schema.d.ts +3 -3
  7. package/dist/do/schema.d.ts.map +1 -0
  8. package/dist/{durable-object → do}/schema.js +4 -3
  9. package/dist/do/schema.js.map +1 -0
  10. package/dist/do/types.d.ts +267 -0
  11. package/dist/do/types.d.ts.map +1 -0
  12. package/dist/do/types.js +62 -0
  13. package/dist/do/types.js.map +1 -0
  14. package/dist/index.d.ts +15 -415
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +31 -483
  17. package/dist/index.js.map +1 -1
  18. package/package.json +13 -21
  19. package/dist/cli/commands/add.d.ts +0 -174
  20. package/dist/cli/commands/add.d.ts.map +0 -1
  21. package/dist/cli/commands/add.js +0 -131
  22. package/dist/cli/commands/add.js.map +0 -1
  23. package/dist/cli/commands/blame.d.ts +0 -259
  24. package/dist/cli/commands/blame.d.ts.map +0 -1
  25. package/dist/cli/commands/blame.js +0 -609
  26. package/dist/cli/commands/blame.js.map +0 -1
  27. package/dist/cli/commands/branch.d.ts +0 -249
  28. package/dist/cli/commands/branch.d.ts.map +0 -1
  29. package/dist/cli/commands/branch.js +0 -693
  30. package/dist/cli/commands/branch.js.map +0 -1
  31. package/dist/cli/commands/commit.d.ts +0 -182
  32. package/dist/cli/commands/commit.d.ts.map +0 -1
  33. package/dist/cli/commands/commit.js +0 -437
  34. package/dist/cli/commands/commit.js.map +0 -1
  35. package/dist/cli/commands/diff.d.ts +0 -464
  36. package/dist/cli/commands/diff.d.ts.map +0 -1
  37. package/dist/cli/commands/diff.js +0 -958
  38. package/dist/cli/commands/diff.js.map +0 -1
  39. package/dist/cli/commands/log.d.ts +0 -239
  40. package/dist/cli/commands/log.d.ts.map +0 -1
  41. package/dist/cli/commands/log.js +0 -535
  42. package/dist/cli/commands/log.js.map +0 -1
  43. package/dist/cli/commands/merge.d.ts +0 -106
  44. package/dist/cli/commands/merge.d.ts.map +0 -1
  45. package/dist/cli/commands/merge.js +0 -55
  46. package/dist/cli/commands/merge.js.map +0 -1
  47. package/dist/cli/commands/review.d.ts +0 -457
  48. package/dist/cli/commands/review.d.ts.map +0 -1
  49. package/dist/cli/commands/review.js +0 -533
  50. package/dist/cli/commands/review.js.map +0 -1
  51. package/dist/cli/commands/status.d.ts +0 -269
  52. package/dist/cli/commands/status.d.ts.map +0 -1
  53. package/dist/cli/commands/status.js +0 -493
  54. package/dist/cli/commands/status.js.map +0 -1
  55. package/dist/cli/commands/web.d.ts +0 -199
  56. package/dist/cli/commands/web.d.ts.map +0 -1
  57. package/dist/cli/commands/web.js +0 -696
  58. package/dist/cli/commands/web.js.map +0 -1
  59. package/dist/cli/fs-adapter.d.ts +0 -656
  60. package/dist/cli/fs-adapter.d.ts.map +0 -1
  61. package/dist/cli/fs-adapter.js +0 -1179
  62. package/dist/cli/fs-adapter.js.map +0 -1
  63. package/dist/cli/fsx-cli-adapter.d.ts +0 -359
  64. package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
  65. package/dist/cli/fsx-cli-adapter.js +0 -619
  66. package/dist/cli/fsx-cli-adapter.js.map +0 -1
  67. package/dist/cli/index.d.ts +0 -387
  68. package/dist/cli/index.d.ts.map +0 -1
  69. package/dist/cli/index.js +0 -523
  70. package/dist/cli/index.js.map +0 -1
  71. package/dist/cli/ui/components/DiffView.d.ts +0 -7
  72. package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
  73. package/dist/cli/ui/components/DiffView.js +0 -11
  74. package/dist/cli/ui/components/DiffView.js.map +0 -1
  75. package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -6
  76. package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
  77. package/dist/cli/ui/components/ErrorDisplay.js +0 -11
  78. package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
  79. package/dist/cli/ui/components/FuzzySearch.d.ts +0 -9
  80. package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
  81. package/dist/cli/ui/components/FuzzySearch.js +0 -12
  82. package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
  83. package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -6
  84. package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
  85. package/dist/cli/ui/components/LoadingSpinner.js +0 -10
  86. package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
  87. package/dist/cli/ui/components/NavigationList.d.ts +0 -9
  88. package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
  89. package/dist/cli/ui/components/NavigationList.js +0 -11
  90. package/dist/cli/ui/components/NavigationList.js.map +0 -1
  91. package/dist/cli/ui/components/ScrollableContent.d.ts +0 -8
  92. package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
  93. package/dist/cli/ui/components/ScrollableContent.js +0 -11
  94. package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
  95. package/dist/cli/ui/components/index.d.ts +0 -7
  96. package/dist/cli/ui/components/index.d.ts.map +0 -1
  97. package/dist/cli/ui/components/index.js +0 -9
  98. package/dist/cli/ui/components/index.js.map +0 -1
  99. package/dist/cli/ui/terminal-ui.d.ts +0 -52
  100. package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
  101. package/dist/cli/ui/terminal-ui.js +0 -121
  102. package/dist/cli/ui/terminal-ui.js.map +0 -1
  103. package/dist/do/BashModule.d.ts +0 -871
  104. package/dist/do/BashModule.d.ts.map +0 -1
  105. package/dist/do/BashModule.js +0 -1143
  106. package/dist/do/BashModule.js.map +0 -1
  107. package/dist/do/FsModule.d.ts +0 -601
  108. package/dist/do/FsModule.d.ts.map +0 -1
  109. package/dist/do/FsModule.js +0 -1120
  110. package/dist/do/FsModule.js.map +0 -1
  111. package/dist/do/GitModule.d.ts +0 -635
  112. package/dist/do/GitModule.d.ts.map +0 -1
  113. package/dist/do/GitModule.js +0 -781
  114. package/dist/do/GitModule.js.map +0 -1
  115. package/dist/do/GitRepoDO.d.ts +0 -281
  116. package/dist/do/GitRepoDO.d.ts.map +0 -1
  117. package/dist/do/GitRepoDO.js +0 -479
  118. package/dist/do/GitRepoDO.js.map +0 -1
  119. package/dist/do/bash-ast.d.ts +0 -246
  120. package/dist/do/bash-ast.d.ts.map +0 -1
  121. package/dist/do/bash-ast.js +0 -888
  122. package/dist/do/bash-ast.js.map +0 -1
  123. package/dist/do/container-executor.d.ts +0 -491
  124. package/dist/do/container-executor.d.ts.map +0 -1
  125. package/dist/do/container-executor.js +0 -730
  126. package/dist/do/container-executor.js.map +0 -1
  127. package/dist/do/index.d.ts +0 -53
  128. package/dist/do/index.d.ts.map +0 -1
  129. package/dist/do/index.js +0 -91
  130. package/dist/do/index.js.map +0 -1
  131. package/dist/do/tiered-storage.d.ts +0 -403
  132. package/dist/do/tiered-storage.d.ts.map +0 -1
  133. package/dist/do/tiered-storage.js +0 -689
  134. package/dist/do/tiered-storage.js.map +0 -1
  135. package/dist/do/withBash.d.ts +0 -231
  136. package/dist/do/withBash.d.ts.map +0 -1
  137. package/dist/do/withBash.js +0 -244
  138. package/dist/do/withBash.js.map +0 -1
  139. package/dist/do/withFs.d.ts +0 -237
  140. package/dist/do/withFs.d.ts.map +0 -1
  141. package/dist/do/withFs.js +0 -387
  142. package/dist/do/withFs.js.map +0 -1
  143. package/dist/do/withGit.d.ts +0 -180
  144. package/dist/do/withGit.d.ts.map +0 -1
  145. package/dist/do/withGit.js +0 -271
  146. package/dist/do/withGit.js.map +0 -1
  147. package/dist/durable-object/object-store.d.ts +0 -633
  148. package/dist/durable-object/object-store.d.ts.map +0 -1
  149. package/dist/durable-object/object-store.js +0 -1161
  150. package/dist/durable-object/object-store.js.map +0 -1
  151. package/dist/durable-object/schema.d.ts.map +0 -1
  152. package/dist/durable-object/schema.js.map +0 -1
  153. package/dist/durable-object/wal.d.ts +0 -416
  154. package/dist/durable-object/wal.d.ts.map +0 -1
  155. package/dist/durable-object/wal.js +0 -445
  156. package/dist/durable-object/wal.js.map +0 -1
  157. package/dist/mcp/adapter.d.ts +0 -772
  158. package/dist/mcp/adapter.d.ts.map +0 -1
  159. package/dist/mcp/adapter.js +0 -895
  160. package/dist/mcp/adapter.js.map +0 -1
  161. package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
  162. package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
  163. package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
  164. package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
  165. package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
  166. package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
  167. package/dist/mcp/sandbox/object-store-proxy.js +0 -30
  168. package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
  169. package/dist/mcp/sandbox/template.d.ts +0 -17
  170. package/dist/mcp/sandbox/template.d.ts.map +0 -1
  171. package/dist/mcp/sandbox/template.js +0 -71
  172. package/dist/mcp/sandbox/template.js.map +0 -1
  173. package/dist/mcp/sandbox.d.ts +0 -764
  174. package/dist/mcp/sandbox.d.ts.map +0 -1
  175. package/dist/mcp/sandbox.js +0 -1362
  176. package/dist/mcp/sandbox.js.map +0 -1
  177. package/dist/mcp/sdk-adapter.d.ts +0 -835
  178. package/dist/mcp/sdk-adapter.d.ts.map +0 -1
  179. package/dist/mcp/sdk-adapter.js +0 -974
  180. package/dist/mcp/sdk-adapter.js.map +0 -1
  181. package/dist/mcp/tools/do.d.ts +0 -32
  182. package/dist/mcp/tools/do.d.ts.map +0 -1
  183. package/dist/mcp/tools/do.js +0 -115
  184. package/dist/mcp/tools/do.js.map +0 -1
  185. package/dist/mcp/tools.d.ts +0 -548
  186. package/dist/mcp/tools.d.ts.map +0 -1
  187. package/dist/mcp/tools.js +0 -1934
  188. package/dist/mcp/tools.js.map +0 -1
  189. package/dist/ops/blame.d.ts +0 -551
  190. package/dist/ops/blame.d.ts.map +0 -1
  191. package/dist/ops/blame.js +0 -1037
  192. package/dist/ops/blame.js.map +0 -1
  193. package/dist/ops/branch.d.ts +0 -766
  194. package/dist/ops/branch.d.ts.map +0 -1
  195. package/dist/ops/branch.js +0 -950
  196. package/dist/ops/branch.js.map +0 -1
  197. package/dist/ops/commit-traversal.d.ts +0 -349
  198. package/dist/ops/commit-traversal.d.ts.map +0 -1
  199. package/dist/ops/commit-traversal.js +0 -821
  200. package/dist/ops/commit-traversal.js.map +0 -1
  201. package/dist/ops/commit.d.ts +0 -555
  202. package/dist/ops/commit.d.ts.map +0 -1
  203. package/dist/ops/commit.js +0 -826
  204. package/dist/ops/commit.js.map +0 -1
  205. package/dist/ops/merge-base.d.ts +0 -397
  206. package/dist/ops/merge-base.d.ts.map +0 -1
  207. package/dist/ops/merge-base.js +0 -691
  208. package/dist/ops/merge-base.js.map +0 -1
  209. package/dist/ops/merge.d.ts +0 -855
  210. package/dist/ops/merge.d.ts.map +0 -1
  211. package/dist/ops/merge.js +0 -1551
  212. package/dist/ops/merge.js.map +0 -1
  213. package/dist/ops/tag.d.ts +0 -247
  214. package/dist/ops/tag.d.ts.map +0 -1
  215. package/dist/ops/tag.js +0 -649
  216. package/dist/ops/tag.js.map +0 -1
  217. package/dist/ops/tree-builder.d.ts +0 -178
  218. package/dist/ops/tree-builder.d.ts.map +0 -1
  219. package/dist/ops/tree-builder.js +0 -271
  220. package/dist/ops/tree-builder.js.map +0 -1
  221. package/dist/ops/tree-diff.d.ts +0 -291
  222. package/dist/ops/tree-diff.d.ts.map +0 -1
  223. package/dist/ops/tree-diff.js +0 -705
  224. package/dist/ops/tree-diff.js.map +0 -1
  225. package/dist/pack/delta.d.ts +0 -248
  226. package/dist/pack/delta.d.ts.map +0 -1
  227. package/dist/pack/delta.js +0 -736
  228. package/dist/pack/delta.js.map +0 -1
  229. package/dist/pack/format.d.ts +0 -446
  230. package/dist/pack/format.d.ts.map +0 -1
  231. package/dist/pack/format.js +0 -572
  232. package/dist/pack/format.js.map +0 -1
  233. package/dist/pack/full-generation.d.ts +0 -612
  234. package/dist/pack/full-generation.d.ts.map +0 -1
  235. package/dist/pack/full-generation.js +0 -1378
  236. package/dist/pack/full-generation.js.map +0 -1
  237. package/dist/pack/generation.d.ts +0 -441
  238. package/dist/pack/generation.d.ts.map +0 -1
  239. package/dist/pack/generation.js +0 -707
  240. package/dist/pack/generation.js.map +0 -1
  241. package/dist/pack/index.d.ts +0 -502
  242. package/dist/pack/index.d.ts.map +0 -1
  243. package/dist/pack/index.js +0 -833
  244. package/dist/pack/index.js.map +0 -1
  245. package/dist/refs/branch.d.ts +0 -668
  246. package/dist/refs/branch.d.ts.map +0 -1
  247. package/dist/refs/branch.js +0 -897
  248. package/dist/refs/branch.js.map +0 -1
  249. package/dist/refs/storage.d.ts +0 -833
  250. package/dist/refs/storage.d.ts.map +0 -1
  251. package/dist/refs/storage.js +0 -1023
  252. package/dist/refs/storage.js.map +0 -1
  253. package/dist/refs/tag.d.ts +0 -860
  254. package/dist/refs/tag.d.ts.map +0 -1
  255. package/dist/refs/tag.js +0 -996
  256. package/dist/refs/tag.js.map +0 -1
  257. package/dist/storage/backend.d.ts +0 -425
  258. package/dist/storage/backend.d.ts.map +0 -1
  259. package/dist/storage/backend.js +0 -41
  260. package/dist/storage/backend.js.map +0 -1
  261. package/dist/storage/fsx-adapter.d.ts +0 -204
  262. package/dist/storage/fsx-adapter.d.ts.map +0 -1
  263. package/dist/storage/fsx-adapter.js +0 -470
  264. package/dist/storage/fsx-adapter.js.map +0 -1
  265. package/dist/storage/lru-cache.d.ts +0 -691
  266. package/dist/storage/lru-cache.d.ts.map +0 -1
  267. package/dist/storage/lru-cache.js +0 -813
  268. package/dist/storage/lru-cache.js.map +0 -1
  269. package/dist/storage/object-index.d.ts +0 -585
  270. package/dist/storage/object-index.d.ts.map +0 -1
  271. package/dist/storage/object-index.js +0 -532
  272. package/dist/storage/object-index.js.map +0 -1
  273. package/dist/storage/r2-pack.d.ts +0 -1257
  274. package/dist/storage/r2-pack.d.ts.map +0 -1
  275. package/dist/storage/r2-pack.js +0 -1770
  276. package/dist/storage/r2-pack.js.map +0 -1
  277. package/dist/tiered/cdc-pipeline.d.ts +0 -1888
  278. package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
  279. package/dist/tiered/cdc-pipeline.js +0 -1880
  280. package/dist/tiered/cdc-pipeline.js.map +0 -1
  281. package/dist/tiered/migration.d.ts +0 -1104
  282. package/dist/tiered/migration.d.ts.map +0 -1
  283. package/dist/tiered/migration.js +0 -1214
  284. package/dist/tiered/migration.js.map +0 -1
  285. package/dist/tiered/parquet-writer.d.ts +0 -1145
  286. package/dist/tiered/parquet-writer.d.ts.map +0 -1
  287. package/dist/tiered/parquet-writer.js +0 -1183
  288. package/dist/tiered/parquet-writer.js.map +0 -1
  289. package/dist/tiered/read-path.d.ts +0 -835
  290. package/dist/tiered/read-path.d.ts.map +0 -1
  291. package/dist/tiered/read-path.js +0 -487
  292. package/dist/tiered/read-path.js.map +0 -1
  293. package/dist/types/capability.d.ts +0 -1385
  294. package/dist/types/capability.d.ts.map +0 -1
  295. package/dist/types/capability.js +0 -36
  296. package/dist/types/capability.js.map +0 -1
  297. package/dist/types/index.d.ts +0 -13
  298. package/dist/types/index.d.ts.map +0 -1
  299. package/dist/types/index.js +0 -18
  300. package/dist/types/index.js.map +0 -1
  301. package/dist/types/objects.d.ts +0 -692
  302. package/dist/types/objects.d.ts.map +0 -1
  303. package/dist/types/objects.js +0 -837
  304. package/dist/types/objects.js.map +0 -1
  305. package/dist/types/storage.d.ts +0 -603
  306. package/dist/types/storage.d.ts.map +0 -1
  307. package/dist/types/storage.js +0 -191
  308. package/dist/types/storage.js.map +0 -1
  309. package/dist/types/worker-loader.d.ts +0 -60
  310. package/dist/types/worker-loader.d.ts.map +0 -1
  311. package/dist/types/worker-loader.js +0 -62
  312. package/dist/types/worker-loader.js.map +0 -1
  313. package/dist/utils/hash.d.ts +0 -197
  314. package/dist/utils/hash.d.ts.map +0 -1
  315. package/dist/utils/hash.js +0 -268
  316. package/dist/utils/hash.js.map +0 -1
  317. package/dist/utils/sha1.d.ts +0 -290
  318. package/dist/utils/sha1.d.ts.map +0 -1
  319. package/dist/utils/sha1.js +0 -582
  320. package/dist/utils/sha1.js.map +0 -1
  321. package/dist/wire/capabilities.d.ts +0 -1044
  322. package/dist/wire/capabilities.d.ts.map +0 -1
  323. package/dist/wire/capabilities.js +0 -941
  324. package/dist/wire/capabilities.js.map +0 -1
  325. package/dist/wire/path-security.d.ts +0 -157
  326. package/dist/wire/path-security.d.ts.map +0 -1
  327. package/dist/wire/path-security.js +0 -307
  328. package/dist/wire/path-security.js.map +0 -1
  329. package/dist/wire/pkt-line.d.ts +0 -345
  330. package/dist/wire/pkt-line.d.ts.map +0 -1
  331. package/dist/wire/pkt-line.js +0 -381
  332. package/dist/wire/pkt-line.js.map +0 -1
  333. package/dist/wire/receive-pack.d.ts +0 -1059
  334. package/dist/wire/receive-pack.d.ts.map +0 -1
  335. package/dist/wire/receive-pack.js +0 -1414
  336. package/dist/wire/receive-pack.js.map +0 -1
  337. package/dist/wire/smart-http.d.ts +0 -799
  338. package/dist/wire/smart-http.d.ts.map +0 -1
  339. package/dist/wire/smart-http.js +0 -945
  340. package/dist/wire/smart-http.js.map +0 -1
  341. package/dist/wire/upload-pack.d.ts +0 -727
  342. package/dist/wire/upload-pack.d.ts.map +0 -1
  343. package/dist/wire/upload-pack.js +0 -1138
  344. package/dist/wire/upload-pack.js.map +0 -1
@@ -1,268 +0,0 @@
1
- /**
2
- * @fileoverview SHA Hashing Utilities for Git Objects
3
- *
4
- * This module provides cryptographic hashing functions used for Git object
5
- * identification and verification. Git uses SHA-1 as its primary hash algorithm,
6
- * with SHA-256 available as an optional newer algorithm (Git v2.29+).
7
- *
8
- * Core hash primitives are re-exported from fsx.do, with gitx-specific
9
- * utilities like HashCache and hashObject defined here.
10
- *
11
- * @module utils/hash
12
- *
13
- * @example
14
- * ```typescript
15
- * import { sha1, hashObject, hexToBytes, bytesToHex } from './utils/hash'
16
- *
17
- * // Hash raw data
18
- * const hash = await sha1('Hello, World!')
19
- *
20
- * // Hash as a Git object (includes type header)
21
- * const content = new TextEncoder().encode('file content')
22
- * const blobSha = await hashObject('blob', content)
23
- * console.log(`blob ${blobSha}`)
24
- * ```
25
- */
26
- // Re-export core hash primitives from fsx.do
27
- export { sha1, sha256, hexToBytes, bytesToHex } from '../../../fsx/src/cas/hash';
28
- // Import for internal use
29
- import { sha1, bytesToHex } from '../../../fsx/src/cas/hash';
30
- /**
31
- * Hash a Git object with its type header.
32
- *
33
- * @description
34
- * Computes the SHA-1 hash of a Git object including its header.
35
- * The header format is: "{type} {size}\0" followed by the content.
36
- *
37
- * This matches the output of `git hash-object` command and is the
38
- * standard way Git computes object identifiers.
39
- *
40
- * @param type - Object type ('blob', 'tree', 'commit', 'tag')
41
- * @param data - Object content as binary data (without header)
42
- * @returns 40-character lowercase hexadecimal SHA-1 hash
43
- *
44
- * @example
45
- * ```typescript
46
- * // Hash a blob (equivalent to `echo -n "hello" | git hash-object --stdin`)
47
- * const content = new TextEncoder().encode('hello')
48
- * const sha = await hashObject('blob', content)
49
- * console.log(sha) // 'b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0'
50
- *
51
- * // Verify with git:
52
- * // $ echo -n "hello" | git hash-object --stdin
53
- * // b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0
54
- * ```
55
- */
56
- export async function hashObject(type, data) {
57
- const header = `${type} ${data.length}\0`;
58
- const headerBytes = new TextEncoder().encode(header);
59
- const combined = new Uint8Array(headerBytes.length + data.length);
60
- combined.set(headerBytes, 0);
61
- combined.set(data, headerBytes.length);
62
- return sha1(combined);
63
- }
64
- // ============================================================================
65
- // Hash Caching
66
- // ============================================================================
67
- /**
68
- * LRU cache for storing computed hashes.
69
- *
70
- * @description
71
- * A Least Recently Used (LRU) cache implementation for caching SHA-1 hashes.
72
- * This is useful when the same data is hashed multiple times, such as during
73
- * pack file operations or object store lookups.
74
- *
75
- * **Key Strategy**: The cache key is derived from the first few bytes of the
76
- * data combined with its length, which provides a fast key generation while
77
- * avoiding collisions for different data.
78
- *
79
- * **Thread Safety**: This implementation is NOT thread-safe. In multi-threaded
80
- * environments, external synchronization is required.
81
- *
82
- * @class HashCache
83
- *
84
- * @example
85
- * ```typescript
86
- * const cache = new HashCache(1000) // Cache up to 1000 hashes
87
- *
88
- * // Use with getOrCompute for automatic caching
89
- * const hash1 = await cache.getOrCompute(data, async () => sha1(data))
90
- * const hash2 = await cache.getOrCompute(data, async () => sha1(data)) // Returns cached
91
- *
92
- * // Check stats
93
- * console.log(`Hit rate: ${cache.hitRate}%`)
94
- * ```
95
- */
96
- export class HashCache {
97
- cache;
98
- maxSize;
99
- hits = 0;
100
- misses = 0;
101
- /**
102
- * Creates a new HashCache with the specified maximum size.
103
- *
104
- * @param {number} maxSize - Maximum number of hashes to cache (default: 10000)
105
- */
106
- constructor(maxSize = 10000) {
107
- this.cache = new Map();
108
- this.maxSize = maxSize;
109
- }
110
- /**
111
- * Generates a cache key for the given data.
112
- *
113
- * @description Uses length + first 32 bytes (if available) to create a unique key.
114
- * This is fast while providing good collision resistance.
115
- *
116
- * @param {Uint8Array} data - Data to generate key for
117
- * @returns {string} Cache key
118
- * @internal
119
- */
120
- generateKey(data) {
121
- // Use length + first 32 bytes as key (fast and reasonably unique)
122
- const prefix = data.length <= 32
123
- ? bytesToHex(data)
124
- : bytesToHex(data.subarray(0, 32));
125
- return `${data.length}:${prefix}`;
126
- }
127
- /**
128
- * Gets a cached hash if available.
129
- *
130
- * @param {Uint8Array} data - Data to look up
131
- * @returns {string | undefined} Cached hash or undefined if not cached
132
- */
133
- get(data) {
134
- const key = this.generateKey(data);
135
- const value = this.cache.get(key);
136
- if (value !== undefined) {
137
- this.hits++;
138
- // Move to end (most recently used)
139
- this.cache.delete(key);
140
- this.cache.set(key, value);
141
- return value;
142
- }
143
- this.misses++;
144
- return undefined;
145
- }
146
- /**
147
- * Stores a hash in the cache.
148
- *
149
- * @param {Uint8Array} data - Original data
150
- * @param {string} hash - Computed hash to cache
151
- */
152
- set(data, hash) {
153
- const key = this.generateKey(data);
154
- // Remove oldest entry if at capacity
155
- if (this.cache.size >= this.maxSize && !this.cache.has(key)) {
156
- const firstKey = this.cache.keys().next().value;
157
- if (firstKey !== undefined) {
158
- this.cache.delete(firstKey);
159
- }
160
- }
161
- this.cache.set(key, hash);
162
- }
163
- /**
164
- * Gets a hash from cache or computes and caches it.
165
- *
166
- * @description This is the recommended way to use the cache. It automatically
167
- * handles cache lookup, computation, and storage.
168
- *
169
- * @param {Uint8Array} data - Data to hash
170
- * @param {() => Promise<string> | string} compute - Function to compute hash if not cached
171
- * @returns {Promise<string>} The hash (from cache or newly computed)
172
- *
173
- * @example
174
- * ```typescript
175
- * const hash = await cache.getOrCompute(data, () => sha1(data))
176
- * ```
177
- */
178
- async getOrCompute(data, compute) {
179
- const cached = this.get(data);
180
- if (cached !== undefined) {
181
- return cached;
182
- }
183
- const hash = await compute();
184
- this.set(data, hash);
185
- return hash;
186
- }
187
- /**
188
- * Synchronous version of getOrCompute for use with synchronous hash functions.
189
- *
190
- * @param {Uint8Array} data - Data to hash
191
- * @param {() => string} compute - Function to compute hash if not cached
192
- * @returns {string} The hash (from cache or newly computed)
193
- *
194
- * @example
195
- * ```typescript
196
- * import { sha1Hex } from './sha1'
197
- * const hash = cache.getOrComputeSync(data, () => sha1Hex(data))
198
- * ```
199
- */
200
- getOrComputeSync(data, compute) {
201
- const cached = this.get(data);
202
- if (cached !== undefined) {
203
- return cached;
204
- }
205
- const hash = compute();
206
- this.set(data, hash);
207
- return hash;
208
- }
209
- /**
210
- * Clears all entries from the cache.
211
- */
212
- clear() {
213
- this.cache.clear();
214
- this.hits = 0;
215
- this.misses = 0;
216
- }
217
- /**
218
- * Gets the current number of cached entries.
219
- */
220
- get size() {
221
- return this.cache.size;
222
- }
223
- /**
224
- * Gets the cache hit rate as a percentage.
225
- */
226
- get hitRate() {
227
- const total = this.hits + this.misses;
228
- return total === 0 ? 0 : (this.hits / total) * 100;
229
- }
230
- /**
231
- * Gets cache statistics.
232
- *
233
- * @returns {{ hits: number; misses: number; size: number; hitRate: number }}
234
- */
235
- getStats() {
236
- return {
237
- hits: this.hits,
238
- misses: this.misses,
239
- size: this.cache.size,
240
- hitRate: this.hitRate
241
- };
242
- }
243
- }
244
- /**
245
- * Global hash cache instance for common use cases.
246
- *
247
- * @description
248
- * A shared cache instance that can be used across the application for
249
- * caching object hashes. This is particularly useful for pack file
250
- * operations where the same objects are hashed multiple times.
251
- *
252
- * **Memory Management**: The cache has a default limit of 10,000 entries.
253
- * For applications with different requirements, create a custom HashCache
254
- * instance with appropriate size.
255
- *
256
- * @example
257
- * ```typescript
258
- * import { globalHashCache, sha1 } from './utils/hash'
259
- *
260
- * // Use the global cache
261
- * const hash = await globalHashCache.getOrCompute(data, () => sha1(data))
262
- *
263
- * // Check cache stats
264
- * console.log(globalHashCache.getStats())
265
- * ```
266
- */
267
- export const globalHashCache = new HashCache();
268
- //# sourceMappingURL=hash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/utils/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6CAA6C;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEhF,0BAA0B;AAC1B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,IAAgB;IAC7D,MAAM,MAAM,GAAG,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,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/**
2
- * @fileoverview Synchronous SHA-1 Utilities for Git Pack Operations
3
- *
4
- * This module provides synchronous (non-async) SHA-1 hashing needed for pack file
5
- * generation, verification, and streaming operations where async is impractical.
6
- *
7
- * The implementation follows the SHA-1 specification (FIPS 180-4) and processes
8
- * data in 512-bit (64-byte) chunks using the standard compression function.
9
- *
10
- * **When to use this vs hash.ts**:
11
- * - Use `utils/hash.ts` for general async hashing (uses Web Crypto API)
12
- * - Use this module for pack operations that need synchronous hashing
13
- *
14
- * @module utils/sha1
15
- *
16
- * @example
17
- * ```typescript
18
- * import { sha1, sha1Hex, sha1Verify } from './utils/sha1'
19
- *
20
- * // Compute SHA-1 as bytes
21
- * const data = new TextEncoder().encode('Hello, World!')
22
- * const hashBytes = sha1(data) // 20-byte Uint8Array
23
- *
24
- * // Compute SHA-1 as hex string
25
- * const hashHex = sha1Hex(data) // 40-char string
26
- *
27
- * // Verify data against expected hash
28
- * const isValid = sha1Verify(data, expectedHash)
29
- * ```
30
- */
31
- /**
32
- * Compute SHA-1 hash of data synchronously.
33
- *
34
- * @description
35
- * Implements the SHA-1 algorithm per FIPS 180-4. This pure JavaScript
36
- * implementation is used when synchronous hashing is needed, such as
37
- * in pack file generation or streaming operations.
38
- *
39
- * **Algorithm Details**:
40
- * 1. Pad message to 512-bit boundary (with 1-bit, zeros, and 64-bit length)
41
- * 2. Process in 64-byte chunks using 80-round compression function
42
- * 3. Return final 160-bit (20-byte) hash
43
- *
44
- * **Performance Note**: This is slower than Web Crypto API. Use `hash.ts`
45
- * for async operations where performance is critical.
46
- *
47
- * @param data - Input data to hash
48
- * @returns 20-byte hash as Uint8Array
49
- *
50
- * @example
51
- * ```typescript
52
- * const data = new TextEncoder().encode('test')
53
- * const hash = sha1(data)
54
- * console.log(hash.length) // 20
55
- *
56
- * // Use with pack file verification
57
- * const packData = readPackFile()
58
- * const computedHash = sha1(packData.slice(0, -20))
59
- * ```
60
- */
61
- export declare function sha1(data: Uint8Array): Uint8Array;
62
- /**
63
- * Compute SHA-1 hash and return as hexadecimal string.
64
- *
65
- * @description
66
- * Convenience wrapper that computes SHA-1 and converts the result
67
- * to a lowercase hexadecimal string. Equivalent to calling `sha1()`
68
- * followed by hex conversion.
69
- *
70
- * @param data - Input data to hash
71
- * @returns 40-character lowercase hexadecimal hash string
72
- *
73
- * @example
74
- * ```typescript
75
- * const data = new TextEncoder().encode('hello')
76
- * const hex = sha1Hex(data)
77
- * console.log(hex) // 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
78
- *
79
- * // Compare with git:
80
- * // $ echo -n "hello" | sha1sum
81
- * // aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
82
- * ```
83
- */
84
- export declare function sha1Hex(data: Uint8Array): string;
85
- /**
86
- * Verify data against an expected SHA-1 hash.
87
- *
88
- * @description
89
- * Computes the SHA-1 hash of the data and compares it byte-by-byte
90
- * with the expected hash. Returns true only if all 20 bytes match.
91
- *
92
- * This uses constant-time comparison to avoid timing attacks,
93
- * though SHA-1 is not used for security purposes in Git.
94
- *
95
- * @param data - Data to verify
96
- * @param expected - Expected 20-byte SHA-1 hash
97
- * @returns True if the computed hash matches the expected hash
98
- * @throws Never throws - returns false for invalid inputs
99
- *
100
- * @example
101
- * ```typescript
102
- * // Verify pack file integrity
103
- * const packContent = readPackFile()
104
- * const contentWithoutChecksum = packContent.slice(0, -20)
105
- * const expectedChecksum = packContent.slice(-20)
106
- *
107
- * if (sha1Verify(contentWithoutChecksum, expectedChecksum)) {
108
- * console.log('Pack file integrity verified')
109
- * } else {
110
- * console.log('Pack file corrupted!')
111
- * }
112
- *
113
- * // Invalid expected hash length
114
- * const badHash = new Uint8Array(10)
115
- * sha1Verify(data, badHash) // false (wrong length)
116
- * ```
117
- */
118
- export declare function sha1Verify(data: Uint8Array, expected: Uint8Array): boolean;
119
- /**
120
- * Streaming SHA-1 hasher for processing large data incrementally.
121
- *
122
- * @description
123
- * This class allows hashing data in chunks, which is essential for:
124
- * - Processing large files without loading everything into memory
125
- * - Computing hashes of data streams
126
- * - Pack file generation and verification
127
- *
128
- * The hasher maintains internal state and can accept data through the
129
- * `update()` method before finalizing with `digest()` or `digestHex()`.
130
- *
131
- * **Performance Note**: For small data (< 64 bytes), the non-streaming
132
- * `sha1()` function may be slightly faster due to lower overhead.
133
- *
134
- * @class StreamingSHA1
135
- *
136
- * @example
137
- * ```typescript
138
- * // Hash a large file in chunks
139
- * const hasher = new StreamingSHA1()
140
- *
141
- * for await (const chunk of fileStream) {
142
- * hasher.update(chunk)
143
- * }
144
- *
145
- * const hash = hasher.digestHex()
146
- * console.log(`File hash: ${hash}`)
147
- * ```
148
- *
149
- * @example
150
- * ```typescript
151
- * // Hash Git object with header
152
- * const hasher = new StreamingSHA1()
153
- * hasher.update(new TextEncoder().encode(`blob ${size}\0`))
154
- * hasher.update(content)
155
- * const objectId = hasher.digestHex()
156
- * ```
157
- */
158
- export declare class StreamingSHA1 {
159
- /** Hash state */
160
- private h;
161
- /** Working array for chunk processing */
162
- private w;
163
- /** Buffer for incomplete chunks */
164
- private buffer;
165
- /** Current position in buffer */
166
- private bufferLength;
167
- /** Total bytes processed */
168
- private totalLength;
169
- /** Whether digest has been called */
170
- private finalized;
171
- /**
172
- * Creates a new StreamingSHA1 hasher instance.
173
- */
174
- constructor();
175
- /**
176
- * Resets the hasher to its initial state.
177
- *
178
- * @description Allows reusing the same hasher instance for a new hash
179
- * computation without creating a new object.
180
- *
181
- * @example
182
- * ```typescript
183
- * const hasher = new StreamingSHA1()
184
- * hasher.update(data1)
185
- * const hash1 = hasher.digestHex()
186
- *
187
- * hasher.reset()
188
- * hasher.update(data2)
189
- * const hash2 = hasher.digestHex()
190
- * ```
191
- */
192
- reset(): void;
193
- /**
194
- * Updates the hash with additional data.
195
- *
196
- * @description Processes the input data, updating the internal hash state.
197
- * Data is buffered internally until a complete 64-byte chunk is available,
198
- * then processed immediately.
199
- *
200
- * This method can be called multiple times before finalizing with `digest()`.
201
- *
202
- * @param {Uint8Array} data - Data to add to the hash computation
203
- * @returns {this} The hasher instance for method chaining
204
- * @throws {Error} If called after digest() without reset()
205
- *
206
- * @example
207
- * ```typescript
208
- * const hasher = new StreamingSHA1()
209
- * .update(header)
210
- * .update(content)
211
- * .update(footer)
212
- * const hash = hasher.digestHex()
213
- * ```
214
- */
215
- update(data: Uint8Array): this;
216
- /**
217
- * Finalizes the hash computation and returns the 20-byte digest.
218
- *
219
- * @description Applies SHA-1 padding to the remaining data and computes
220
- * the final hash. After calling this method, the hasher cannot be updated
221
- * unless `reset()` is called.
222
- *
223
- * @returns {Uint8Array} 20-byte SHA-1 hash
224
- *
225
- * @example
226
- * ```typescript
227
- * const hasher = new StreamingSHA1()
228
- * hasher.update(data)
229
- * const hashBytes = hasher.digest()
230
- * console.log(hashBytes.length) // 20
231
- * ```
232
- */
233
- digest(): Uint8Array;
234
- /**
235
- * Finalizes the hash computation and returns the hex string digest.
236
- *
237
- * @description Convenience method that calls `digest()` and converts
238
- * the result to a 40-character lowercase hexadecimal string.
239
- *
240
- * @returns {string} 40-character lowercase hexadecimal hash string
241
- *
242
- * @example
243
- * ```typescript
244
- * const hasher = new StreamingSHA1()
245
- * hasher.update(data)
246
- * const hash = hasher.digestHex()
247
- * console.log(hash) // 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
248
- * ```
249
- */
250
- digestHex(): string;
251
- }
252
- /**
253
- * Hash a Git object with streaming support for large objects.
254
- *
255
- * @description
256
- * Uses the streaming hasher to compute the SHA-1 of a Git object with its header.
257
- * This is more memory-efficient than `hashObject` in `hash.ts` for large objects
258
- * as it doesn't require concatenating header and data.
259
- *
260
- * @param type - Object type ('blob', 'tree', 'commit', 'tag')
261
- * @param data - Object content as binary data
262
- * @returns 20-byte SHA-1 hash as Uint8Array
263
- *
264
- * @example
265
- * ```typescript
266
- * const content = new TextEncoder().encode('hello')
267
- * const hashBytes = hashObjectStreaming('blob', content)
268
- * ```
269
- */
270
- export declare function hashObjectStreaming(type: string, data: Uint8Array): Uint8Array;
271
- /**
272
- * Hash a Git object with streaming support, returning hex string.
273
- *
274
- * @description
275
- * Convenience wrapper that returns the hash as a 40-character hex string
276
- * instead of raw bytes.
277
- *
278
- * @param type - Object type ('blob', 'tree', 'commit', 'tag')
279
- * @param data - Object content as binary data
280
- * @returns 40-character lowercase hexadecimal SHA-1 hash
281
- *
282
- * @example
283
- * ```typescript
284
- * const content = new TextEncoder().encode('hello')
285
- * const sha = hashObjectStreamingHex('blob', content)
286
- * console.log(sha) // 'b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0'
287
- * ```
288
- */
289
- export declare function hashObjectStreamingHex(type: string, data: Uint8Array): string;
290
- //# sourceMappingURL=sha1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sha1.d.ts","sourceRoot":"","sources":["../../src/utils/sha1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAwGjD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAOhD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAgB1E;AA4FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,aAAa;IACxB,iBAAiB;IACjB,OAAO,CAAC,CAAC,CAAa;IACtB,yCAAyC;IACzC,OAAO,CAAC,CAAC,CAAa;IACtB,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAY;IAC1B,iCAAiC;IACjC,OAAO,CAAC,YAAY,CAAQ;IAC5B,4BAA4B;IAC5B,OAAO,CAAC,WAAW,CAAQ;IAC3B,qC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