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,117 +1,489 @@
1
1
  /**
2
- * Storage Interface Types
2
+ * @fileoverview Storage Interface Types
3
3
  *
4
- * Canonical interfaces for object storage and commit providers.
5
- * These are the single source of truth - all modules should import from here.
4
+ * This module defines the canonical interfaces for object storage and commit providers.
5
+ * All storage-related interfaces are defined here as the single source of truth.
6
+ *
7
+ * The interfaces follow a layered design:
8
+ * - {@link BasicObjectStore} - Core object CRUD operations
9
+ * - {@link RefObjectStore} - Adds ref management capabilities
10
+ * - {@link TreeDiffObjectStore} - Specialized for tree diff operations
11
+ * - {@link ObjectStore} - Full-featured store combining all capabilities
12
+ *
13
+ * Similarly for commit providers:
14
+ * - {@link BasicCommitProvider} - Core commit retrieval
15
+ * - {@link CommitProvider} - Extended with path filtering and tree access
16
+ *
17
+ * @module types/storage
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import type { ObjectStore, CommitProvider } from './types/storage'
22
+ *
23
+ * // Implement a storage backend
24
+ * class MyObjectStore implements ObjectStore {
25
+ * async getObject(sha: string) { ... }
26
+ * async storeObject(type: string, data: Uint8Array) { ... }
27
+ * // ... other methods
28
+ * }
29
+ * ```
6
30
  */
7
31
  import type { CommitObject, TreeObject } from './objects';
8
32
  /**
9
- * Interface for Git object storage operations.
33
+ * Full-featured interface for Git object storage operations.
10
34
  *
35
+ * @description
11
36
  * This is the canonical ObjectStore interface that combines all required
12
37
  * methods from various modules. Implementations should provide all methods.
13
38
  *
14
- * Used by: commit.ts, tag.ts, tree-builder.ts, tree-diff.ts
39
+ * The interface is organized into three groups:
40
+ * 1. **Core object operations**: Basic CRUD for Git objects
41
+ * 2. **Ref operations**: Managing references (branches, tags, HEAD)
42
+ * 3. **Typed accessors**: Convenient methods for specific object types
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const store: ObjectStore = new DurableObjectStore(storage)
47
+ *
48
+ * // Store a blob
49
+ * const sha = await store.storeObject('blob', content)
50
+ *
51
+ * // Retrieve it
52
+ * const obj = await store.getObject(sha)
53
+ *
54
+ * // Work with refs
55
+ * await store.setRef('refs/heads/main', sha)
56
+ * const mainSha = await store.getRef('refs/heads/main')
57
+ * ```
15
58
  */
16
59
  export interface ObjectStore {
17
- /** Get an object by SHA */
60
+ /**
61
+ * Retrieve a Git object by its SHA-1 hash.
62
+ *
63
+ * @description
64
+ * Fetches the raw object data and type for the given SHA.
65
+ * Returns null if the object does not exist.
66
+ *
67
+ * @param sha - 40-character hexadecimal SHA-1 hash
68
+ * @returns The object with type and data, or null if not found
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const obj = await store.getObject('abc123...')
73
+ * if (obj) {
74
+ * console.log(`Type: ${obj.type}, Size: ${obj.data.length}`)
75
+ * }
76
+ * ```
77
+ */
18
78
  getObject(sha: string): Promise<{
19
79
  type: string;
20
80
  data: Uint8Array;
21
81
  } | null>;
22
- /** Store an object and return its SHA */
82
+ /**
83
+ * Store a Git object and return its SHA-1 hash.
84
+ *
85
+ * @description
86
+ * Computes the SHA-1 hash of the object in Git format (type + size + content)
87
+ * and stores it. If an object with the same SHA already exists, this is a no-op.
88
+ *
89
+ * @param type - Object type ('blob', 'tree', 'commit', 'tag')
90
+ * @param data - Raw object content (without Git header)
91
+ * @returns The 40-character SHA-1 hash of the stored object
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const content = new TextEncoder().encode('Hello, World!')
96
+ * const sha = await store.storeObject('blob', content)
97
+ * console.log(`Stored blob: ${sha}`)
98
+ * ```
99
+ */
23
100
  storeObject(type: string, data: Uint8Array): Promise<string>;
24
- /** Check if an object exists */
101
+ /**
102
+ * Check if an object exists in the store.
103
+ *
104
+ * @description
105
+ * Efficiently checks for object existence without fetching the full content.
106
+ *
107
+ * @param sha - 40-character hexadecimal SHA-1 hash
108
+ * @returns True if the object exists, false otherwise
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * if (await store.hasObject(sha)) {
113
+ * console.log('Object exists')
114
+ * }
115
+ * ```
116
+ */
25
117
  hasObject(sha: string): Promise<boolean>;
26
- /** Get a ref by name */
118
+ /**
119
+ * Get a reference by its name.
120
+ *
121
+ * @description
122
+ * Retrieves the SHA-1 that a ref points to. For symbolic refs,
123
+ * this returns the resolved SHA (following the chain).
124
+ *
125
+ * @param refName - Full ref name (e.g., 'refs/heads/main', 'HEAD')
126
+ * @returns The SHA-1 hash the ref points to, or null if not found
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const mainSha = await store.getRef('refs/heads/main')
131
+ * const headSha = await store.getRef('HEAD')
132
+ * ```
133
+ */
27
134
  getRef(refName: string): Promise<string | null>;
28
- /** Set a ref to point to a SHA */
135
+ /**
136
+ * Set a reference to point to a SHA.
137
+ *
138
+ * @description
139
+ * Creates or updates a ref to point to the given SHA.
140
+ * For atomic operations, consider using compare-and-swap patterns.
141
+ *
142
+ * @param refName - Full ref name (e.g., 'refs/heads/main')
143
+ * @param sha - 40-character SHA-1 hash to point to
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * await store.setRef('refs/heads/feature', commitSha)
148
+ * ```
149
+ */
29
150
  setRef(refName: string, sha: string): Promise<void>;
30
- /** Delete a ref */
151
+ /**
152
+ * Delete a reference.
153
+ *
154
+ * @description
155
+ * Removes a ref from storage. Returns true if the ref existed
156
+ * and was deleted, false if it didn't exist.
157
+ *
158
+ * @param refName - Full ref name to delete
159
+ * @returns True if deleted, false if ref didn't exist
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * const deleted = await store.deleteRef('refs/heads/old-branch')
164
+ * ```
165
+ */
31
166
  deleteRef(refName: string): Promise<boolean>;
32
- /** List refs with a given prefix */
167
+ /**
168
+ * List references with a given prefix.
169
+ *
170
+ * @description
171
+ * Returns all refs that start with the given prefix.
172
+ * Commonly used to list branches or tags.
173
+ *
174
+ * @param prefix - Prefix to filter refs (e.g., 'refs/heads/', 'refs/tags/')
175
+ * @returns Array of ref names and their SHA targets
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * // List all branches
180
+ * const branches = await store.listRefs('refs/heads/')
181
+ * for (const { name, sha } of branches) {
182
+ * console.log(`${name} -> ${sha}`)
183
+ * }
184
+ *
185
+ * // List all tags
186
+ * const tags = await store.listRefs('refs/tags/')
187
+ * ```
188
+ */
33
189
  listRefs(prefix: string): Promise<Array<{
34
190
  name: string;
35
191
  sha: string;
36
192
  }>>;
37
- /** Get a tree object by SHA */
193
+ /**
194
+ * Get a tree object by SHA.
195
+ *
196
+ * @description
197
+ * Retrieves and parses a tree object, returning it with parsed entries.
198
+ * Returns null if the object doesn't exist or isn't a tree.
199
+ *
200
+ * @param sha - 40-character SHA-1 of the tree
201
+ * @returns Parsed TreeObject or null
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * const tree = await store.getTree(treeSha)
206
+ * if (tree) {
207
+ * for (const entry of tree.entries) {
208
+ * console.log(`${entry.mode} ${entry.name}`)
209
+ * }
210
+ * }
211
+ * ```
212
+ */
38
213
  getTree(sha: string): Promise<TreeObject | null>;
39
- /** Get blob content by SHA */
214
+ /**
215
+ * Get blob content by SHA.
216
+ *
217
+ * @description
218
+ * Retrieves the raw content of a blob object.
219
+ * Returns null if the object doesn't exist or isn't a blob.
220
+ *
221
+ * @param sha - 40-character SHA-1 of the blob
222
+ * @returns Raw blob content or null
223
+ *
224
+ * @example
225
+ * ```typescript
226
+ * const content = await store.getBlob(blobSha)
227
+ * if (content) {
228
+ * const text = new TextDecoder().decode(content)
229
+ * }
230
+ * ```
231
+ */
40
232
  getBlob(sha: string): Promise<Uint8Array | null>;
41
- /** Check if an object exists (alias for hasObject) */
233
+ /**
234
+ * Check if an object exists (alias for hasObject).
235
+ *
236
+ * @description
237
+ * Convenience alias for hasObject, commonly used in tree diff operations.
238
+ *
239
+ * @param sha - 40-character SHA-1 hash
240
+ * @returns True if the object exists
241
+ */
42
242
  exists(sha: string): Promise<boolean>;
43
243
  }
44
244
  /**
45
245
  * Minimal ObjectStore interface for basic operations.
46
246
  *
47
- * Use this when only core object operations are needed,
48
- * without ref management or typed accessors.
247
+ * @description
248
+ * Use this interface when only core object operations are needed,
249
+ * without ref management or typed accessors. This is useful for
250
+ * modules that only need to read/write raw objects.
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * function processObjects(store: BasicObjectStore) {
255
+ * const obj = await store.getObject(sha)
256
+ * if (obj) {
257
+ * // Process the object
258
+ * await store.storeObject('blob', processedData)
259
+ * }
260
+ * }
261
+ * ```
49
262
  */
50
263
  export interface BasicObjectStore {
51
- /** Get an object by SHA */
264
+ /**
265
+ * Get an object by SHA.
266
+ *
267
+ * @param sha - 40-character SHA-1 hash
268
+ * @returns Object with type and data, or null if not found
269
+ */
52
270
  getObject(sha: string): Promise<{
53
271
  type: string;
54
272
  data: Uint8Array;
55
273
  } | null>;
56
- /** Store an object and return its SHA */
274
+ /**
275
+ * Store an object and return its SHA.
276
+ *
277
+ * @param type - Object type ('blob', 'tree', 'commit', 'tag')
278
+ * @param data - Raw object content
279
+ * @returns 40-character SHA-1 hash of the stored object
280
+ */
57
281
  storeObject(type: string, data: Uint8Array): Promise<string>;
58
- /** Check if an object exists */
282
+ /**
283
+ * Check if an object exists.
284
+ *
285
+ * @param sha - 40-character SHA-1 hash
286
+ * @returns True if the object exists
287
+ */
59
288
  hasObject(sha: string): Promise<boolean>;
60
289
  }
61
290
  /**
62
291
  * ObjectStore with ref management capabilities.
63
292
  *
64
- * Extends BasicObjectStore with ref operations needed for tag management.
293
+ * @description
294
+ * Extends BasicObjectStore with ref operations needed for tag management
295
+ * and branch operations. Use this when you need both object storage
296
+ * and reference management.
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * async function createTag(store: RefObjectStore, name: string, target: string) {
301
+ * // Store the tag object
302
+ * const tagSha = await store.storeObject('tag', tagData)
303
+ * // Create the ref
304
+ * await store.setRef(`refs/tags/${name}`, tagSha)
305
+ * }
306
+ * ```
65
307
  */
66
308
  export interface RefObjectStore extends BasicObjectStore {
67
- /** Get a ref by name */
309
+ /**
310
+ * Get a ref by name.
311
+ *
312
+ * @param refName - Full ref name (e.g., 'refs/heads/main')
313
+ * @returns SHA-1 hash or null if not found
314
+ */
68
315
  getRef(refName: string): Promise<string | null>;
69
- /** Set a ref to point to a SHA */
316
+ /**
317
+ * Set a ref to point to a SHA.
318
+ *
319
+ * @param refName - Full ref name
320
+ * @param sha - Target SHA-1 hash
321
+ */
70
322
  setRef(refName: string, sha: string): Promise<void>;
71
- /** Delete a ref */
323
+ /**
324
+ * Delete a ref.
325
+ *
326
+ * @param refName - Full ref name to delete
327
+ * @returns True if deleted, false if not found
328
+ */
72
329
  deleteRef(refName: string): Promise<boolean>;
73
- /** List refs with a given prefix */
330
+ /**
331
+ * List refs with a given prefix.
332
+ *
333
+ * @param prefix - Prefix to filter (e.g., 'refs/heads/')
334
+ * @returns Array of ref names and their targets
335
+ */
74
336
  listRefs(prefix: string): Promise<Array<{
75
337
  name: string;
76
338
  sha: string;
77
339
  }>>;
78
340
  }
79
341
  /**
80
- * ObjectStore for tree diff operations.
342
+ * ObjectStore specialized for tree diff operations.
343
+ *
344
+ * @description
345
+ * Provides typed accessors for tree and blob objects, optimized for
346
+ * operations that need to traverse and compare directory trees.
81
347
  *
82
- * Provides typed accessors for tree and blob objects.
348
+ * @example
349
+ * ```typescript
350
+ * async function compareFiles(store: TreeDiffObjectStore, sha1: string, sha2: string) {
351
+ * const blob1 = await store.getBlob(sha1)
352
+ * const blob2 = await store.getBlob(sha2)
353
+ * // Compare contents...
354
+ * }
355
+ * ```
83
356
  */
84
357
  export interface TreeDiffObjectStore {
85
- /** Get a tree object by SHA */
358
+ /**
359
+ * Get a tree object by SHA.
360
+ *
361
+ * @param sha - 40-character SHA-1 of the tree
362
+ * @returns Parsed TreeObject or null
363
+ */
86
364
  getTree(sha: string): Promise<TreeObject | null>;
87
- /** Get blob content by SHA */
365
+ /**
366
+ * Get blob content by SHA.
367
+ *
368
+ * @param sha - 40-character SHA-1 of the blob
369
+ * @returns Raw content or null
370
+ */
88
371
  getBlob(sha: string): Promise<Uint8Array | null>;
89
- /** Check if an object exists */
372
+ /**
373
+ * Check if an object exists.
374
+ *
375
+ * @param sha - 40-character SHA-1 hash
376
+ * @returns True if the object exists
377
+ */
90
378
  exists(sha: string): Promise<boolean>;
91
379
  }
92
380
  /**
93
381
  * Interface for retrieving commits from storage.
94
382
  *
383
+ * @description
95
384
  * This is the canonical CommitProvider interface that combines all required
96
- * methods from various modules. The base method is required; others are optional.
385
+ * methods for commit traversal and history operations. The base getCommit
386
+ * method is required; path filtering and tree access are optional extensions.
97
387
  *
98
388
  * Used by: commit-traversal.ts, merge-base.ts
389
+ *
390
+ * @example
391
+ * ```typescript
392
+ * async function walkHistory(provider: CommitProvider, startSha: string) {
393
+ * const commit = await provider.getCommit(startSha)
394
+ * if (!commit) return
395
+ *
396
+ * console.log(commit.message)
397
+ *
398
+ * for (const parentSha of commit.parents) {
399
+ * await walkHistory(provider, parentSha)
400
+ * }
401
+ * }
402
+ * ```
99
403
  */
100
404
  export interface CommitProvider {
101
- /** Get a commit by SHA */
405
+ /**
406
+ * Get a commit by SHA.
407
+ *
408
+ * @description
409
+ * Retrieves and parses a commit object. This is the core method
410
+ * required for all commit traversal operations.
411
+ *
412
+ * @param sha - 40-character SHA-1 of the commit
413
+ * @returns Parsed CommitObject or null if not found
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * const commit = await provider.getCommit(sha)
418
+ * if (commit) {
419
+ * console.log(`${commit.author.name}: ${commit.message}`)
420
+ * }
421
+ * ```
422
+ */
102
423
  getCommit(sha: string): Promise<CommitObject | null>;
103
- /** Get commits that modify a path (optional, for path filtering) */
424
+ /**
425
+ * Get commits that modify a specific path.
426
+ *
427
+ * @description
428
+ * Optional method for efficient path-filtered history traversal.
429
+ * Returns commit SHAs that touched the given file or directory path.
430
+ *
431
+ * @param path - File or directory path (relative to repo root)
432
+ * @returns Array of commit SHAs that modified the path
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * if (provider.getCommitsForPath) {
437
+ * const commits = await provider.getCommitsForPath('src/index.ts')
438
+ * console.log(`File modified in ${commits.length} commits`)
439
+ * }
440
+ * ```
441
+ */
104
442
  getCommitsForPath?(path: string): Promise<string[]>;
105
- /** Get the tree for a commit (optional, for tree operations) */
443
+ /**
444
+ * Get the tree for a commit.
445
+ *
446
+ * @description
447
+ * Optional method for accessing the tree associated with a commit.
448
+ * Useful for operations that need to examine file contents.
449
+ *
450
+ * @param commitSha - 40-character SHA-1 of the commit
451
+ * @returns The tree structure (implementation-defined format)
452
+ *
453
+ * @example
454
+ * ```typescript
455
+ * if (provider.getTree) {
456
+ * const tree = await provider.getTree(commitSha)
457
+ * // Examine tree contents...
458
+ * }
459
+ * ```
460
+ */
106
461
  getTree?(commitSha: string): Promise<unknown>;
107
462
  }
108
463
  /**
109
464
  * Minimal CommitProvider interface for basic operations.
110
465
  *
466
+ * @description
111
467
  * Use this when only the core getCommit method is needed.
468
+ * Suitable for simple commit lookups without path filtering or tree access.
469
+ *
470
+ * @example
471
+ * ```typescript
472
+ * function findMergeBase(provider: BasicCommitProvider, sha1: string, sha2: string) {
473
+ * // Only needs getCommit for ancestor traversal
474
+ * const commit1 = await provider.getCommit(sha1)
475
+ * const commit2 = await provider.getCommit(sha2)
476
+ * // ... traverse parents
477
+ * }
478
+ * ```
112
479
  */
113
480
  export interface BasicCommitProvider {
114
- /** Get a commit by SHA */
481
+ /**
482
+ * Get a commit by SHA.
483
+ *
484
+ * @param sha - 40-character SHA-1 of the commit
485
+ * @returns Parsed CommitObject or null if not found
486
+ */
115
487
  getCommit(sha: string): Promise<CommitObject | null>;
116
488
  }
117
489
  //# sourceMappingURL=storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/types/storage.ts"],"names":[],"mappings":"AAAA;;;;;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iBG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;CACrD"}
@@ -1,8 +1,32 @@
1
1
  /**
2
- * Storage Interface Types
2
+ * @fileoverview Storage Interface Types
3
3
  *
4
- * Canonical interfaces for object storage and commit providers.
5
- * These are the single source of truth - all modules should import from here.
4
+ * This module defines the canonical interfaces for object storage and commit providers.
5
+ * All storage-related interfaces are defined here as the single source of truth.
6
+ *
7
+ * The interfaces follow a layered design:
8
+ * - {@link BasicObjectStore} - Core object CRUD operations
9
+ * - {@link RefObjectStore} - Adds ref management capabilities
10
+ * - {@link TreeDiffObjectStore} - Specialized for tree diff operations
11
+ * - {@link ObjectStore} - Full-featured store combining all capabilities
12
+ *
13
+ * Similarly for commit providers:
14
+ * - {@link BasicCommitProvider} - Core commit retrieval
15
+ * - {@link CommitProvider} - Extended with path filtering and tree access
16
+ *
17
+ * @module types/storage
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import type { ObjectStore, CommitProvider } from './types/storage'
22
+ *
23
+ * // Implement a storage backend
24
+ * class MyObjectStore implements ObjectStore {
25
+ * async getObject(sha: string) { ... }
26
+ * async storeObject(type: string, data: Uint8Array) { ... }
27
+ * // ... other methods
28
+ * }
29
+ * ```
6
30
  */
7
31
  export {};
8
32
  //# sourceMappingURL=storage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/types/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/types/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG"}