gitx.do 0.0.1 → 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 +10 -2
@@ -1,53 +1,510 @@
1
+ /**
2
+ * @fileoverview Git Object Types and Serialization
3
+ *
4
+ * This module defines the core Git object types (blob, tree, commit, tag) and provides
5
+ * functions for serializing and deserializing these objects in the Git format.
6
+ *
7
+ * Git uses a content-addressable storage model where each object is identified by
8
+ * its SHA-1 hash. The format for each object type is:
9
+ * - Header: "{type} {size}\0"
10
+ * - Content: type-specific binary data
11
+ *
12
+ * @module types/objects
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { serializeBlob, parseBlob, isBlob } from './types/objects'
17
+ *
18
+ * // Create and serialize a blob
19
+ * const content = new TextEncoder().encode('Hello, World!')
20
+ * const serialized = serializeBlob(content)
21
+ *
22
+ * // Parse it back
23
+ * const blob = parseBlob(serialized)
24
+ * console.log(blob.type) // 'blob'
25
+ * ```
26
+ */
27
+ /**
28
+ * The four Git object types.
29
+ *
30
+ * @description
31
+ * - `blob`: Raw file content
32
+ * - `tree`: Directory listing (contains references to blobs and other trees)
33
+ * - `commit`: A snapshot pointing to a tree with metadata (author, message, parents)
34
+ * - `tag`: An annotated tag pointing to another object with metadata
35
+ */
1
36
  export type ObjectType = 'blob' | 'tree' | 'commit' | 'tag';
37
+ /**
38
+ * Base interface for all Git objects.
39
+ *
40
+ * @description
41
+ * All Git objects share a common structure with a type discriminator
42
+ * and raw binary data. The data field contains the object content
43
+ * WITHOUT the Git header (type and size).
44
+ *
45
+ * @property type - The object type discriminator
46
+ * @property data - Raw binary content of the object (excluding header)
47
+ */
2
48
  export interface GitObject {
49
+ /** The type of Git object */
3
50
  type: ObjectType;
51
+ /** Raw binary data of the object content */
4
52
  data: Uint8Array;
5
53
  }
54
+ /**
55
+ * A Git blob object representing raw file content.
56
+ *
57
+ * @description
58
+ * Blobs are the simplest Git objects - they just store raw file content.
59
+ * The data field contains the file content as-is, without any transformation.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const blob: BlobObject = {
64
+ * type: 'blob',
65
+ * data: new TextEncoder().encode('file content')
66
+ * }
67
+ * ```
68
+ */
6
69
  export interface BlobObject extends GitObject {
70
+ /** Type discriminator - always 'blob' for blob objects */
7
71
  type: 'blob';
8
72
  }
73
+ /**
74
+ * A single entry in a Git tree object.
75
+ *
76
+ * @description
77
+ * Tree entries represent files or subdirectories within a directory.
78
+ * Each entry has a file mode, name, and SHA-1 reference to the content.
79
+ *
80
+ * @property mode - Unix file mode as a string
81
+ * @property name - File or directory name (no path separators)
82
+ * @property sha - 40-character hex SHA-1 of the referenced object
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const fileEntry: TreeEntry = {
87
+ * mode: '100644', // Regular file
88
+ * name: 'README.md',
89
+ * sha: 'abc123...' // SHA-1 of the blob
90
+ * }
91
+ *
92
+ * const dirEntry: TreeEntry = {
93
+ * mode: '040000', // Directory
94
+ * name: 'src',
95
+ * sha: 'def456...' // SHA-1 of another tree
96
+ * }
97
+ * ```
98
+ */
9
99
  export interface TreeEntry {
100
+ /**
101
+ * Unix file mode string.
102
+ * Common values:
103
+ * - '100644': Regular file
104
+ * - '100755': Executable file
105
+ * - '040000': Directory (subdirectory)
106
+ * - '120000': Symbolic link
107
+ * - '160000': Git submodule (gitlink)
108
+ */
10
109
  mode: string;
110
+ /** File or directory name */
11
111
  name: string;
112
+ /** 40-character lowercase hex SHA-1 hash of the referenced object */
12
113
  sha: string;
13
114
  }
115
+ /**
116
+ * A Git tree object representing a directory.
117
+ *
118
+ * @description
119
+ * Trees are Git's way of representing directories. Each tree contains
120
+ * entries pointing to blobs (files) or other trees (subdirectories).
121
+ * Entries are sorted by name with a special rule for directories.
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const tree: TreeObject = {
126
+ * type: 'tree',
127
+ * data: rawTreeData,
128
+ * entries: [
129
+ * { mode: '100644', name: 'file.txt', sha: '...' },
130
+ * { mode: '040000', name: 'subdir', sha: '...' }
131
+ * ]
132
+ * }
133
+ * ```
134
+ */
14
135
  export interface TreeObject extends GitObject {
136
+ /** Type discriminator - always 'tree' for tree objects */
15
137
  type: 'tree';
138
+ /** Parsed tree entries (files and subdirectories) */
16
139
  entries: TreeEntry[];
17
140
  }
141
+ /**
142
+ * Author/committer/tagger information.
143
+ *
144
+ * @description
145
+ * Represents identity information used in commits and tags.
146
+ * Includes name, email, Unix timestamp, and timezone offset.
147
+ *
148
+ * @property name - Full name of the person
149
+ * @property email - Email address
150
+ * @property timestamp - Unix timestamp in seconds
151
+ * @property timezone - Timezone offset string (e.g., '+0530', '-0800')
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * const author: Author = {
156
+ * name: 'John Doe',
157
+ * email: 'john@example.com',
158
+ * timestamp: 1704067200, // Unix seconds
159
+ * timezone: '-0800' // PST
160
+ * }
161
+ * ```
162
+ */
18
163
  export interface Author {
164
+ /** Full name of the author */
19
165
  name: string;
166
+ /** Email address */
20
167
  email: string;
168
+ /** Unix timestamp in seconds since epoch */
21
169
  timestamp: number;
170
+ /** Timezone offset in +/-HHMM format (e.g., '+0530', '-0800') */
22
171
  timezone: string;
23
172
  }
173
+ /**
174
+ * A Git commit object representing a snapshot in history.
175
+ *
176
+ * @description
177
+ * Commits are the core of Git's version control. Each commit points to
178
+ * a tree (representing the project state), has zero or more parent commits,
179
+ * and includes author/committer information with a message.
180
+ *
181
+ * @property tree - SHA-1 of the tree object representing project state
182
+ * @property parents - Array of parent commit SHA-1s (empty for initial commit)
183
+ * @property author - Who created the original changes
184
+ * @property committer - Who created the commit
185
+ * @property message - Commit message describing the changes
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const commit: CommitObject = {
190
+ * type: 'commit',
191
+ * data: rawCommitData,
192
+ * tree: 'abc123...',
193
+ * parents: ['parent1sha...'],
194
+ * author: { name: 'Alice', email: 'alice@example.com', timestamp: 1704067200, timezone: '+0000' },
195
+ * committer: { name: 'Alice', email: 'alice@example.com', timestamp: 1704067200, timezone: '+0000' },
196
+ * message: 'Initial commit\n\nAdd project structure'
197
+ * }
198
+ * ```
199
+ */
24
200
  export interface CommitObject extends GitObject {
201
+ /** Type discriminator - always 'commit' for commit objects */
25
202
  type: 'commit';
203
+ /** 40-character hex SHA-1 of the root tree object */
26
204
  tree: string;
205
+ /** Array of parent commit SHA-1s (empty for root commit, multiple for merge) */
27
206
  parents: string[];
207
+ /** Original author of the changes */
28
208
  author: Author;
209
+ /** Person who created this commit (may differ from author in cherry-picks, rebases) */
29
210
  committer: Author;
211
+ /** Commit message including subject line and optional body */
30
212
  message: string;
31
213
  }
214
+ /**
215
+ * A Git tag object (annotated tag).
216
+ *
217
+ * @description
218
+ * Annotated tags are Git objects that contain metadata about a tag,
219
+ * including who created it, when, and an optional message. They can
220
+ * point to any Git object (usually commits).
221
+ *
222
+ * Note: Lightweight tags are just refs pointing directly to commits,
223
+ * not tag objects.
224
+ *
225
+ * @property object - SHA-1 of the tagged object
226
+ * @property objectType - Type of the tagged object
227
+ * @property tagger - Who created the tag (optional for some tags)
228
+ * @property message - Tag message/annotation
229
+ * @property name - Tag name
230
+ * @property tag - Alternative tag name field (deprecated, use name)
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * const tag: TagObject = {
235
+ * type: 'tag',
236
+ * data: rawTagData,
237
+ * object: 'commitsha...',
238
+ * objectType: 'commit',
239
+ * name: 'v1.0.0',
240
+ * tagger: { name: 'Bob', email: 'bob@example.com', timestamp: 1704067200, timezone: '+0000' },
241
+ * message: 'Release version 1.0.0'
242
+ * }
243
+ * ```
244
+ */
32
245
  export interface TagObject extends GitObject {
246
+ /** Type discriminator - always 'tag' for tag objects */
33
247
  type: 'tag';
248
+ /** 40-character hex SHA-1 of the tagged object */
34
249
  object: string;
250
+ /** Type of the object being tagged */
35
251
  objectType: ObjectType;
252
+ /** Tag creator information (optional for lightweight-style annotated tags) */
36
253
  tagger?: Author;
254
+ /** Tag annotation message */
37
255
  message: string;
256
+ /** Tag name (e.g., 'v1.0.0') */
38
257
  name: string;
258
+ /** Alternative tag name field (deprecated, prefer 'name') */
39
259
  tag?: string;
40
260
  }
261
+ /**
262
+ * Type guard to check if a GitObject is a BlobObject.
263
+ *
264
+ * @description
265
+ * Narrows the type of a GitObject to BlobObject based on the type field.
266
+ *
267
+ * @param obj - The Git object to check
268
+ * @returns True if the object is a blob, false otherwise
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * const obj: GitObject = getObject(sha)
273
+ * if (isBlob(obj)) {
274
+ * // obj is now typed as BlobObject
275
+ * const content = new TextDecoder().decode(obj.data)
276
+ * }
277
+ * ```
278
+ */
41
279
  export declare function isBlob(obj: GitObject): obj is BlobObject;
280
+ /**
281
+ * Type guard to check if a GitObject is a TreeObject.
282
+ *
283
+ * @description
284
+ * Narrows the type of a GitObject to TreeObject based on the type field.
285
+ *
286
+ * @param obj - The Git object to check
287
+ * @returns True if the object is a tree, false otherwise
288
+ *
289
+ * @example
290
+ * ```typescript
291
+ * const obj: GitObject = getObject(sha)
292
+ * if (isTree(obj)) {
293
+ * // obj is now typed as TreeObject
294
+ * for (const entry of obj.entries) {
295
+ * console.log(entry.name, entry.mode)
296
+ * }
297
+ * }
298
+ * ```
299
+ */
42
300
  export declare function isTree(obj: GitObject): obj is TreeObject;
301
+ /**
302
+ * Type guard to check if a GitObject is a CommitObject.
303
+ *
304
+ * @description
305
+ * Narrows the type of a GitObject to CommitObject based on the type field.
306
+ *
307
+ * @param obj - The Git object to check
308
+ * @returns True if the object is a commit, false otherwise
309
+ *
310
+ * @example
311
+ * ```typescript
312
+ * const obj: GitObject = getObject(sha)
313
+ * if (isCommit(obj)) {
314
+ * // obj is now typed as CommitObject
315
+ * console.log(obj.message, obj.author.name)
316
+ * }
317
+ * ```
318
+ */
43
319
  export declare function isCommit(obj: GitObject): obj is CommitObject;
320
+ /**
321
+ * Type guard to check if a GitObject is a TagObject.
322
+ *
323
+ * @description
324
+ * Narrows the type of a GitObject to TagObject based on the type field.
325
+ *
326
+ * @param obj - The Git object to check
327
+ * @returns True if the object is a tag, false otherwise
328
+ *
329
+ * @example
330
+ * ```typescript
331
+ * const obj: GitObject = getObject(sha)
332
+ * if (isTag(obj)) {
333
+ * // obj is now typed as TagObject
334
+ * console.log(obj.name, obj.message)
335
+ * }
336
+ * ```
337
+ */
44
338
  export declare function isTag(obj: GitObject): obj is TagObject;
339
+ /**
340
+ * Serialize raw blob data into Git blob object format.
341
+ *
342
+ * @description
343
+ * Creates a complete Git blob object with header: "blob {size}\0{content}"
344
+ * This format is used for hashing and storage.
345
+ *
346
+ * @param data - Raw file content as binary data
347
+ * @returns Complete blob object with Git header
348
+ *
349
+ * @example
350
+ * ```typescript
351
+ * const content = new TextEncoder().encode('Hello, World!')
352
+ * const blob = serializeBlob(content)
353
+ * // blob contains: "blob 13\0Hello, World!"
354
+ *
355
+ * // Hash it to get the SHA
356
+ * const sha = await sha1(blob)
357
+ * ```
358
+ */
45
359
  export declare function serializeBlob(data: Uint8Array): Uint8Array;
360
+ /**
361
+ * Serialize tree entries into Git tree object format.
362
+ *
363
+ * @description
364
+ * Creates a complete Git tree object with header and sorted entries.
365
+ * Each entry format: "{mode} {name}\0{20-byte-sha}"
366
+ * Entries are sorted by name with directories treated as having trailing slashes.
367
+ *
368
+ * @param entries - Array of tree entries to serialize
369
+ * @returns Complete tree object with Git header
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * const entries: TreeEntry[] = [
374
+ * { mode: '100644', name: 'file.txt', sha: 'abc...' },
375
+ * { mode: '040000', name: 'src', sha: 'def...' }
376
+ * ]
377
+ * const tree = serializeTree(entries)
378
+ * const sha = await sha1(tree)
379
+ * ```
380
+ */
46
381
  export declare function serializeTree(entries: TreeEntry[]): Uint8Array;
382
+ /**
383
+ * Serialize commit data into Git commit object format.
384
+ *
385
+ * @description
386
+ * Creates a complete Git commit object with header and formatted content.
387
+ * The content includes tree SHA, parent SHAs, author, committer, and message.
388
+ *
389
+ * @param commit - Commit data (without 'type' and 'data' fields)
390
+ * @returns Complete commit object with Git header
391
+ *
392
+ * @example
393
+ * ```typescript
394
+ * const commit = serializeCommit({
395
+ * tree: 'abc123...',
396
+ * parents: ['parent1...'],
397
+ * author: { name: 'Alice', email: 'alice@example.com', timestamp: 1704067200, timezone: '+0000' },
398
+ * committer: { name: 'Alice', email: 'alice@example.com', timestamp: 1704067200, timezone: '+0000' },
399
+ * message: 'Initial commit'
400
+ * })
401
+ * const sha = await sha1(commit)
402
+ * ```
403
+ */
47
404
  export declare function serializeCommit(commit: Omit<CommitObject, 'type' | 'data'>): Uint8Array;
405
+ /**
406
+ * Serialize tag data into Git tag object format.
407
+ *
408
+ * @description
409
+ * Creates a complete Git tag object with header and formatted content.
410
+ * The content includes object SHA, object type, tag name, tagger (optional), and message.
411
+ *
412
+ * @param tag - Tag data (without 'type' and 'data' fields)
413
+ * @returns Complete tag object with Git header
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * const tag = serializeTag({
418
+ * object: 'commitsha...',
419
+ * objectType: 'commit',
420
+ * name: 'v1.0.0',
421
+ * tagger: { name: 'Bob', email: 'bob@example.com', timestamp: 1704067200, timezone: '+0000' },
422
+ * message: 'Release v1.0.0'
423
+ * })
424
+ * const sha = await sha1(tag)
425
+ * ```
426
+ */
48
427
  export declare function serializeTag(tag: Omit<TagObject, 'type' | 'data'>): Uint8Array;
428
+ /**
429
+ * Parse a Git blob object from its serialized format.
430
+ *
431
+ * @description
432
+ * Parses a complete Git blob object (with header) back into a BlobObject.
433
+ * Validates the header format and extracts the content.
434
+ *
435
+ * @param data - Complete blob object data including Git header
436
+ * @returns Parsed BlobObject
437
+ * @throws Error if the data is not a valid blob object (missing null byte or invalid header)
438
+ *
439
+ * @example
440
+ * ```typescript
441
+ * const rawBlob = await storage.getObject(sha)
442
+ * const blob = parseBlob(rawBlob)
443
+ * const content = new TextDecoder().decode(blob.data)
444
+ * ```
445
+ */
49
446
  export declare function parseBlob(data: Uint8Array): BlobObject;
447
+ /**
448
+ * Parse a Git tree object from its serialized format.
449
+ *
450
+ * @description
451
+ * Parses a complete Git tree object (with header) back into a TreeObject.
452
+ * Extracts all tree entries with their modes, names, and SHA references.
453
+ *
454
+ * @param data - Complete tree object data including Git header
455
+ * @returns Parsed TreeObject with entries array
456
+ * @throws Error if the data is not a valid tree object (missing null byte or invalid header)
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * const rawTree = await storage.getObject(sha)
461
+ * const tree = parseTree(rawTree)
462
+ * for (const entry of tree.entries) {
463
+ * console.log(`${entry.mode} ${entry.name} ${entry.sha}`)
464
+ * }
465
+ * ```
466
+ */
50
467
  export declare function parseTree(data: Uint8Array): TreeObject;
468
+ /**
469
+ * Parse a Git commit object from its serialized format.
470
+ *
471
+ * @description
472
+ * Parses a complete Git commit object (with header) back into a CommitObject.
473
+ * Extracts tree SHA, parent SHAs, author, committer, and message.
474
+ *
475
+ * @param data - Complete commit object data including Git header
476
+ * @returns Parsed CommitObject
477
+ * @throws Error if the data is not a valid commit object (missing null byte, invalid header, or missing author/committer)
478
+ *
479
+ * @example
480
+ * ```typescript
481
+ * const rawCommit = await storage.getObject(sha)
482
+ * const commit = parseCommit(rawCommit)
483
+ * console.log(`Author: ${commit.author.name}`)
484
+ * console.log(`Message: ${commit.message}`)
485
+ * console.log(`Parents: ${commit.parents.length}`)
486
+ * ```
487
+ */
51
488
  export declare function parseCommit(data: Uint8Array): CommitObject;
489
+ /**
490
+ * Parse a Git tag object from its serialized format.
491
+ *
492
+ * @description
493
+ * Parses a complete Git tag object (with header) back into a TagObject.
494
+ * Extracts object SHA, object type, tag name, tagger, and message.
495
+ *
496
+ * @param data - Complete tag object data including Git header
497
+ * @returns Parsed TagObject
498
+ * @throws Error if the data is not a valid tag object (missing null byte, invalid header, or missing tagger)
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * const rawTag = await storage.getObject(sha)
503
+ * const tag = parseTag(rawTag)
504
+ * console.log(`Tag: ${tag.name}`)
505
+ * console.log(`Points to: ${tag.object} (${tag.objectType})`)
506
+ * console.log(`Message: ${tag.message}`)
507
+ * ```
508
+ */
52
509
  export declare function parseTag(data: Uint8Array): TagObject;
53
510
  //# sourceMappingURL=objects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/types/objects.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,SAAS,EAAE,CAAA;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,IAAI,EAAE,KAAK,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,UAAU,CAA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