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.
- package/dist/cli/commands/blame.d.ts +259 -0
- package/dist/cli/commands/blame.d.ts.map +1 -0
- package/dist/cli/commands/blame.js +609 -0
- package/dist/cli/commands/blame.js.map +1 -0
- package/dist/cli/commands/branch.d.ts +249 -0
- package/dist/cli/commands/branch.d.ts.map +1 -0
- package/dist/cli/commands/branch.js +693 -0
- package/dist/cli/commands/branch.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +182 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +437 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/diff.d.ts +464 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +958 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/log.d.ts +239 -0
- package/dist/cli/commands/log.d.ts.map +1 -0
- package/dist/cli/commands/log.js +535 -0
- package/dist/cli/commands/log.js.map +1 -0
- package/dist/cli/commands/review.d.ts +457 -0
- package/dist/cli/commands/review.d.ts.map +1 -0
- package/dist/cli/commands/review.js +533 -0
- package/dist/cli/commands/review.js.map +1 -0
- package/dist/cli/commands/status.d.ts +269 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +493 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/web.d.ts +199 -0
- package/dist/cli/commands/web.d.ts.map +1 -0
- package/dist/cli/commands/web.js +696 -0
- package/dist/cli/commands/web.js.map +1 -0
- package/dist/cli/fs-adapter.d.ts +656 -0
- package/dist/cli/fs-adapter.d.ts.map +1 -0
- package/dist/cli/fs-adapter.js +1179 -0
- package/dist/cli/fs-adapter.js.map +1 -0
- package/dist/cli/index.d.ts +387 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +523 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui/components/DiffView.d.ts +7 -0
- package/dist/cli/ui/components/DiffView.d.ts.map +1 -0
- package/dist/cli/ui/components/DiffView.js +11 -0
- package/dist/cli/ui/components/DiffView.js.map +1 -0
- package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -0
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -0
- package/dist/cli/ui/components/ErrorDisplay.js +11 -0
- package/dist/cli/ui/components/ErrorDisplay.js.map +1 -0
- package/dist/cli/ui/components/FuzzySearch.d.ts +9 -0
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -0
- package/dist/cli/ui/components/FuzzySearch.js +12 -0
- package/dist/cli/ui/components/FuzzySearch.js.map +1 -0
- package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -0
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -0
- package/dist/cli/ui/components/LoadingSpinner.js +10 -0
- package/dist/cli/ui/components/LoadingSpinner.js.map +1 -0
- package/dist/cli/ui/components/NavigationList.d.ts +9 -0
- package/dist/cli/ui/components/NavigationList.d.ts.map +1 -0
- package/dist/cli/ui/components/NavigationList.js +11 -0
- package/dist/cli/ui/components/NavigationList.js.map +1 -0
- package/dist/cli/ui/components/ScrollableContent.d.ts +8 -0
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -0
- package/dist/cli/ui/components/ScrollableContent.js +11 -0
- package/dist/cli/ui/components/ScrollableContent.js.map +1 -0
- package/dist/cli/ui/components/index.d.ts +7 -0
- package/dist/cli/ui/components/index.d.ts.map +1 -0
- package/dist/cli/ui/components/index.js +9 -0
- package/dist/cli/ui/components/index.js.map +1 -0
- package/dist/cli/ui/terminal-ui.d.ts +52 -0
- package/dist/cli/ui/terminal-ui.d.ts.map +1 -0
- package/dist/cli/ui/terminal-ui.js +121 -0
- package/dist/cli/ui/terminal-ui.js.map +1 -0
- package/dist/durable-object/object-store.d.ts +401 -23
- package/dist/durable-object/object-store.d.ts.map +1 -1
- package/dist/durable-object/object-store.js +414 -25
- package/dist/durable-object/object-store.js.map +1 -1
- package/dist/durable-object/schema.d.ts +188 -0
- package/dist/durable-object/schema.d.ts.map +1 -1
- package/dist/durable-object/schema.js +160 -0
- package/dist/durable-object/schema.js.map +1 -1
- package/dist/durable-object/wal.d.ts +336 -31
- package/dist/durable-object/wal.d.ts.map +1 -1
- package/dist/durable-object/wal.js +272 -27
- package/dist/durable-object/wal.js.map +1 -1
- package/dist/index.d.ts +379 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +379 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/adapter.d.ts +579 -38
- package/dist/mcp/adapter.d.ts.map +1 -1
- package/dist/mcp/adapter.js +426 -33
- package/dist/mcp/adapter.js.map +1 -1
- package/dist/mcp/sandbox.d.ts +532 -29
- package/dist/mcp/sandbox.d.ts.map +1 -1
- package/dist/mcp/sandbox.js +389 -22
- package/dist/mcp/sandbox.js.map +1 -1
- package/dist/mcp/sdk-adapter.d.ts +478 -56
- package/dist/mcp/sdk-adapter.d.ts.map +1 -1
- package/dist/mcp/sdk-adapter.js +346 -44
- package/dist/mcp/sdk-adapter.js.map +1 -1
- package/dist/mcp/tools.d.ts +445 -30
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +363 -33
- package/dist/mcp/tools.js.map +1 -1
- package/dist/ops/blame.d.ts +424 -21
- package/dist/ops/blame.d.ts.map +1 -1
- package/dist/ops/blame.js +303 -20
- package/dist/ops/blame.js.map +1 -1
- package/dist/ops/branch.d.ts +583 -32
- package/dist/ops/branch.d.ts.map +1 -1
- package/dist/ops/branch.js +365 -23
- package/dist/ops/branch.js.map +1 -1
- package/dist/ops/commit-traversal.d.ts +164 -24
- package/dist/ops/commit-traversal.d.ts.map +1 -1
- package/dist/ops/commit-traversal.js +68 -2
- package/dist/ops/commit-traversal.js.map +1 -1
- package/dist/ops/commit.d.ts +387 -53
- package/dist/ops/commit.d.ts.map +1 -1
- package/dist/ops/commit.js +249 -29
- package/dist/ops/commit.js.map +1 -1
- package/dist/ops/merge-base.d.ts +195 -21
- package/dist/ops/merge-base.d.ts.map +1 -1
- package/dist/ops/merge-base.js +122 -12
- package/dist/ops/merge-base.js.map +1 -1
- package/dist/ops/merge.d.ts +600 -130
- package/dist/ops/merge.d.ts.map +1 -1
- package/dist/ops/merge.js +408 -60
- package/dist/ops/merge.js.map +1 -1
- package/dist/ops/tag.d.ts +67 -2
- package/dist/ops/tag.d.ts.map +1 -1
- package/dist/ops/tag.js +42 -1
- package/dist/ops/tag.js.map +1 -1
- package/dist/ops/tree-builder.d.ts +102 -6
- package/dist/ops/tree-builder.d.ts.map +1 -1
- package/dist/ops/tree-builder.js +30 -5
- package/dist/ops/tree-builder.js.map +1 -1
- package/dist/ops/tree-diff.d.ts +50 -2
- package/dist/ops/tree-diff.d.ts.map +1 -1
- package/dist/ops/tree-diff.js +50 -2
- package/dist/ops/tree-diff.js.map +1 -1
- package/dist/pack/delta.d.ts +211 -39
- package/dist/pack/delta.d.ts.map +1 -1
- package/dist/pack/delta.js +232 -46
- package/dist/pack/delta.js.map +1 -1
- package/dist/pack/format.d.ts +390 -28
- package/dist/pack/format.d.ts.map +1 -1
- package/dist/pack/format.js +344 -33
- package/dist/pack/format.js.map +1 -1
- package/dist/pack/full-generation.d.ts +313 -28
- package/dist/pack/full-generation.d.ts.map +1 -1
- package/dist/pack/full-generation.js +238 -19
- package/dist/pack/full-generation.js.map +1 -1
- package/dist/pack/generation.d.ts +346 -23
- package/dist/pack/generation.d.ts.map +1 -1
- package/dist/pack/generation.js +269 -21
- package/dist/pack/generation.js.map +1 -1
- package/dist/pack/index.d.ts +407 -86
- package/dist/pack/index.d.ts.map +1 -1
- package/dist/pack/index.js +351 -70
- package/dist/pack/index.js.map +1 -1
- package/dist/refs/branch.d.ts +517 -71
- package/dist/refs/branch.d.ts.map +1 -1
- package/dist/refs/branch.js +410 -26
- package/dist/refs/branch.js.map +1 -1
- package/dist/refs/storage.d.ts +610 -57
- package/dist/refs/storage.d.ts.map +1 -1
- package/dist/refs/storage.js +481 -29
- package/dist/refs/storage.js.map +1 -1
- package/dist/refs/tag.d.ts +677 -67
- package/dist/refs/tag.d.ts.map +1 -1
- package/dist/refs/tag.js +497 -30
- package/dist/refs/tag.js.map +1 -1
- package/dist/storage/lru-cache.d.ts +556 -53
- package/dist/storage/lru-cache.d.ts.map +1 -1
- package/dist/storage/lru-cache.js +439 -36
- package/dist/storage/lru-cache.js.map +1 -1
- package/dist/storage/object-index.d.ts +483 -38
- package/dist/storage/object-index.d.ts.map +1 -1
- package/dist/storage/object-index.js +388 -22
- package/dist/storage/object-index.js.map +1 -1
- package/dist/storage/r2-pack.d.ts +957 -94
- package/dist/storage/r2-pack.d.ts.map +1 -1
- package/dist/storage/r2-pack.js +756 -48
- package/dist/storage/r2-pack.js.map +1 -1
- package/dist/tiered/cdc-pipeline.d.ts +1610 -38
- package/dist/tiered/cdc-pipeline.d.ts.map +1 -1
- package/dist/tiered/cdc-pipeline.js +1131 -22
- package/dist/tiered/cdc-pipeline.js.map +1 -1
- package/dist/tiered/migration.d.ts +903 -41
- package/dist/tiered/migration.d.ts.map +1 -1
- package/dist/tiered/migration.js +646 -24
- package/dist/tiered/migration.js.map +1 -1
- package/dist/tiered/parquet-writer.d.ts +944 -47
- package/dist/tiered/parquet-writer.d.ts.map +1 -1
- package/dist/tiered/parquet-writer.js +667 -39
- package/dist/tiered/parquet-writer.js.map +1 -1
- package/dist/tiered/read-path.d.ts +728 -34
- package/dist/tiered/read-path.d.ts.map +1 -1
- package/dist/tiered/read-path.js +310 -27
- package/dist/tiered/read-path.js.map +1 -1
- package/dist/types/objects.d.ts +457 -0
- package/dist/types/objects.d.ts.map +1 -1
- package/dist/types/objects.js +305 -4
- package/dist/types/objects.js.map +1 -1
- package/dist/types/storage.d.ts +407 -35
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types/storage.js +27 -3
- package/dist/types/storage.js.map +1 -1
- package/dist/utils/hash.d.ts +133 -12
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +133 -12
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/sha1.d.ts +102 -9
- package/dist/utils/sha1.d.ts.map +1 -1
- package/dist/utils/sha1.js +114 -11
- package/dist/utils/sha1.js.map +1 -1
- package/dist/wire/capabilities.d.ts +896 -88
- package/dist/wire/capabilities.d.ts.map +1 -1
- package/dist/wire/capabilities.js +566 -62
- package/dist/wire/capabilities.js.map +1 -1
- package/dist/wire/pkt-line.d.ts +293 -15
- package/dist/wire/pkt-line.d.ts.map +1 -1
- package/dist/wire/pkt-line.js +251 -15
- package/dist/wire/pkt-line.js.map +1 -1
- package/dist/wire/receive-pack.d.ts +814 -64
- package/dist/wire/receive-pack.d.ts.map +1 -1
- package/dist/wire/receive-pack.js +542 -41
- package/dist/wire/receive-pack.js.map +1 -1
- package/dist/wire/smart-http.d.ts +575 -97
- package/dist/wire/smart-http.d.ts.map +1 -1
- package/dist/wire/smart-http.js +337 -46
- package/dist/wire/smart-http.js.map +1 -1
- package/dist/wire/upload-pack.d.ts +492 -98
- package/dist/wire/upload-pack.d.ts.map +1 -1
- package/dist/wire/upload-pack.js +347 -59
- package/dist/wire/upload-pack.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gitx.do - Git
|
|
2
|
+
* @fileoverview gitx.do - Complete Git Implementation for Cloudflare Workers
|
|
3
3
|
*
|
|
4
|
-
* This
|
|
5
|
-
* Cloudflare Workers with Durable Objects
|
|
4
|
+
* This is the main entry point for the gitx.do library, providing a complete
|
|
5
|
+
* Git implementation designed to run on Cloudflare Workers with Durable Objects
|
|
6
|
+
* and R2 storage.
|
|
7
|
+
*
|
|
8
|
+
* **Architecture Overview**:
|
|
9
|
+
* - **Types**: Core Git object types (blob, tree, commit, tag)
|
|
10
|
+
* - **Pack Operations**: Packfile format handling and index management
|
|
11
|
+
* - **Git Operations**: Core commands (merge, blame, commit, branch)
|
|
12
|
+
* - **MCP Integration**: Model Context Protocol for AI assistant integration
|
|
13
|
+
* - **Wire Protocol**: Git Smart HTTP protocol implementation
|
|
14
|
+
* - **Storage**: R2 packfile storage and object indexing
|
|
15
|
+
* - **Tiered Storage**: Hot/Warm/Cold storage with migration
|
|
6
16
|
*
|
|
7
17
|
* @module gitx.do
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import {
|
|
22
|
+
* // Types
|
|
23
|
+
* type CommitObject,
|
|
24
|
+
* parseCommit,
|
|
25
|
+
* serializeCommit,
|
|
26
|
+
*
|
|
27
|
+
* // Operations
|
|
28
|
+
* createCommit,
|
|
29
|
+
* merge,
|
|
30
|
+
* blame,
|
|
31
|
+
*
|
|
32
|
+
* // Storage
|
|
33
|
+
* R2PackStorage,
|
|
34
|
+
* ObjectIndex,
|
|
35
|
+
*
|
|
36
|
+
* // Wire Protocol
|
|
37
|
+
* handleInfoRefs,
|
|
38
|
+
* handleUploadPack,
|
|
39
|
+
* } from 'gitx.do'
|
|
40
|
+
*
|
|
41
|
+
* // Create a commit
|
|
42
|
+
* const commit = await createCommit(storage, {
|
|
43
|
+
* tree: treeSha,
|
|
44
|
+
* parents: [parentSha],
|
|
45
|
+
* message: 'Add new feature',
|
|
46
|
+
* author: { name: 'Alice', email: 'alice@example.com' }
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
8
49
|
*/
|
|
9
50
|
// =============================================================================
|
|
10
51
|
// Types - Core Git object types and interfaces
|
|
11
52
|
// =============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Git object types and serialization.
|
|
55
|
+
*
|
|
56
|
+
* @description
|
|
57
|
+
* Core types for Git objects (blob, tree, commit, tag) including:
|
|
58
|
+
* - Type definitions for each object type
|
|
59
|
+
* - Type guard functions for runtime type checking
|
|
60
|
+
* - Serialization functions for converting to Git format
|
|
61
|
+
* - Deserialization functions for parsing Git format
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { isCommit, parseCommit, serializeCommit } from 'gitx.do'
|
|
66
|
+
*
|
|
67
|
+
* // Parse raw commit data
|
|
68
|
+
* const commit = parseCommit(rawData)
|
|
69
|
+
*
|
|
70
|
+
* // Check type at runtime
|
|
71
|
+
* if (isCommit(obj)) {
|
|
72
|
+
* console.log(obj.message)
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
12
76
|
export {
|
|
13
77
|
// Type guards
|
|
14
78
|
isBlob, isTree, isCommit, isTag,
|
|
@@ -19,6 +83,27 @@ parseBlob, parseTree, parseCommit, parseTag, } from './types/objects';
|
|
|
19
83
|
// =============================================================================
|
|
20
84
|
// Pack Operations - Packfile format and index handling
|
|
21
85
|
// =============================================================================
|
|
86
|
+
/**
|
|
87
|
+
* Packfile format handling.
|
|
88
|
+
*
|
|
89
|
+
* @description
|
|
90
|
+
* Functions for reading and writing Git packfiles including:
|
|
91
|
+
* - Pack header parsing and creation
|
|
92
|
+
* - Variable-length integer encoding/decoding
|
|
93
|
+
* - Object type and size encoding
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* import { createPackfile, parsePackHeader } from 'gitx.do'
|
|
98
|
+
*
|
|
99
|
+
* // Create a packfile from objects
|
|
100
|
+
* const packData = await createPackfile(objects)
|
|
101
|
+
*
|
|
102
|
+
* // Parse pack header
|
|
103
|
+
* const header = parsePackHeader(packData)
|
|
104
|
+
* console.log(`Pack contains ${header.objectCount} objects`)
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
22
107
|
export {
|
|
23
108
|
// Constants
|
|
24
109
|
PACK_SIGNATURE, PACK_VERSION,
|
|
@@ -30,6 +115,29 @@ packObjectTypeToString, stringToPackObjectType,
|
|
|
30
115
|
encodeVarint, decodeVarint, encodeTypeAndSize, decodeTypeAndSize,
|
|
31
116
|
// Pack header
|
|
32
117
|
parsePackHeader, parsePackObject, createPackfile, } from './pack/format';
|
|
118
|
+
/**
|
|
119
|
+
* Pack index operations.
|
|
120
|
+
*
|
|
121
|
+
* @description
|
|
122
|
+
* Functions for reading and writing pack index files (.idx) including:
|
|
123
|
+
* - Index parsing and creation
|
|
124
|
+
* - Object lookup by SHA
|
|
125
|
+
* - CRC32 calculation for verification
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* import { createPackIndex, lookupObject } from 'gitx.do'
|
|
130
|
+
*
|
|
131
|
+
* // Create index for a packfile
|
|
132
|
+
* const index = await createPackIndex(packData)
|
|
133
|
+
*
|
|
134
|
+
* // Look up an object
|
|
135
|
+
* const result = lookupObject(index, sha)
|
|
136
|
+
* if (result) {
|
|
137
|
+
* console.log(`Object at offset ${result.offset}`)
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
33
141
|
export {
|
|
34
142
|
// Constants
|
|
35
143
|
PACK_INDEX_SIGNATURE, PACK_INDEX_MAGIC, PACK_INDEX_VERSION, LARGE_OFFSET_THRESHOLD,
|
|
@@ -40,26 +148,183 @@ getFanoutRange, calculateCRC32, binarySearchObjectId, binarySearchSha, parseFano
|
|
|
40
148
|
// =============================================================================
|
|
41
149
|
// Git Operations - Core git commands (merge, blame, commit, branch)
|
|
42
150
|
// =============================================================================
|
|
43
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Merge operations.
|
|
153
|
+
*
|
|
154
|
+
* @description
|
|
155
|
+
* Functions for performing Git merges including:
|
|
156
|
+
* - Three-way merge algorithm
|
|
157
|
+
* - Merge base finding
|
|
158
|
+
* - Conflict detection and resolution
|
|
159
|
+
* - Content merging for text files
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* import { merge, findMergeBase, resolveConflict } from 'gitx.do'
|
|
164
|
+
*
|
|
165
|
+
* // Find merge base
|
|
166
|
+
* const base = await findMergeBase(storage, commit1, commit2)
|
|
167
|
+
*
|
|
168
|
+
* // Perform merge
|
|
169
|
+
* const result = await merge(storage, {
|
|
170
|
+
* ours: 'main',
|
|
171
|
+
* theirs: 'feature',
|
|
172
|
+
* strategy: 'recursive'
|
|
173
|
+
* })
|
|
174
|
+
*
|
|
175
|
+
* if (result.conflicts.length > 0) {
|
|
176
|
+
* // Handle conflicts
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
44
180
|
export { merge, findMergeBase, resolveConflict, abortMerge, continueMerge, getMergeState, isMergeInProgress, mergeContent, isBinaryFile, } from './ops/merge';
|
|
45
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Blame operations.
|
|
183
|
+
*
|
|
184
|
+
* @description
|
|
185
|
+
* Functions for git blame functionality including:
|
|
186
|
+
* - Line-by-line attribution
|
|
187
|
+
* - Rename tracking across history
|
|
188
|
+
* - Range-based blame
|
|
189
|
+
* - Blame output formatting
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* import { blame, blameFile, formatBlame } from 'gitx.do'
|
|
194
|
+
*
|
|
195
|
+
* // Get blame for a file
|
|
196
|
+
* const result = await blameFile(storage, 'src/index.ts', { commit: 'HEAD' })
|
|
197
|
+
*
|
|
198
|
+
* // Format for display
|
|
199
|
+
* const output = formatBlame(result, { showEmail: true })
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
46
202
|
export { blame, blameFile, blameLine, blameRange, getBlameForCommit, trackContentAcrossRenames, detectRenames, buildBlameHistory, formatBlame, parseBlameOutput, } from './ops/blame';
|
|
47
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Commit operations.
|
|
205
|
+
*
|
|
206
|
+
* @description
|
|
207
|
+
* Functions for creating and working with commits including:
|
|
208
|
+
* - Commit creation and amendment
|
|
209
|
+
* - Commit message formatting and validation
|
|
210
|
+
* - Signature handling (GPG)
|
|
211
|
+
* - Author/timestamp utilities
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* import { createCommit, createAuthor, formatTimestamp } from 'gitx.do'
|
|
216
|
+
*
|
|
217
|
+
* const author = createAuthor('Alice', 'alice@example.com')
|
|
218
|
+
* const commit = await createCommit(storage, {
|
|
219
|
+
* tree: treeSha,
|
|
220
|
+
* parents: [parentSha],
|
|
221
|
+
* author,
|
|
222
|
+
* message: 'Add new feature'
|
|
223
|
+
* })
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
48
226
|
export { createCommit, amendCommit, buildCommitObject, formatCommitMessage, parseCommitMessage, validateCommitMessage, isCommitSigned, extractCommitSignature, addSignatureToCommit, isEmptyCommit, getCurrentTimezone, formatTimestamp, parseTimestamp, createAuthor, } from './ops/commit';
|
|
49
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Branch operations.
|
|
229
|
+
*
|
|
230
|
+
* @description
|
|
231
|
+
* Functions for branch management including:
|
|
232
|
+
* - Branch creation, deletion, and renaming
|
|
233
|
+
* - Branch listing and filtering
|
|
234
|
+
* - Upstream tracking configuration
|
|
235
|
+
* - Branch validation
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* import { createBranch, listBranches, getCurrentBranch } from 'gitx.do'
|
|
240
|
+
*
|
|
241
|
+
* // Create a new branch
|
|
242
|
+
* await createBranch(storage, 'feature/new-thing', { startPoint: 'main' })
|
|
243
|
+
*
|
|
244
|
+
* // List all branches
|
|
245
|
+
* const branches = await listBranches(storage, { includeRemotes: true })
|
|
246
|
+
*
|
|
247
|
+
* // Get current branch
|
|
248
|
+
* const current = await getCurrentBranch(storage)
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
50
251
|
export { createBranch, deleteBranch, listBranches, renameBranch, checkoutBranch, getCurrentBranch, getBranchInfo, branchExists, setBranchTracking, getBranchTracking, removeBranchTracking, getDefaultBranch, setDefaultBranch, isValidBranchName, normalizeBranchName, } from './ops/branch';
|
|
51
252
|
// =============================================================================
|
|
52
253
|
// MCP (Model Context Protocol) - AI assistant integration
|
|
53
254
|
// =============================================================================
|
|
255
|
+
/**
|
|
256
|
+
* MCP tool definitions.
|
|
257
|
+
*
|
|
258
|
+
* @description
|
|
259
|
+
* Tools for integrating with AI assistants via MCP including:
|
|
260
|
+
* - Tool registration and discovery
|
|
261
|
+
* - Input validation
|
|
262
|
+
* - Tool invocation
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* import { gitTools, invokeTool, validateToolInput } from 'gitx.do'
|
|
267
|
+
*
|
|
268
|
+
* // List available tools
|
|
269
|
+
* const tools = gitTools
|
|
270
|
+
*
|
|
271
|
+
* // Validate and invoke a tool
|
|
272
|
+
* if (validateToolInput('git_status', input)) {
|
|
273
|
+
* const result = await invokeTool('git_status', input, context)
|
|
274
|
+
* }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
54
277
|
export {
|
|
55
278
|
// Tool definitions
|
|
56
279
|
gitTools, registerTool, validateToolInput, invokeTool, listTools, getTool, } from './mcp/tools';
|
|
280
|
+
/**
|
|
281
|
+
* MCP adapter.
|
|
282
|
+
*
|
|
283
|
+
* @description
|
|
284
|
+
* Adapter for MCP protocol communication including:
|
|
285
|
+
* - Request/response handling
|
|
286
|
+
* - Capability negotiation
|
|
287
|
+
* - Error handling
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* import { createMCPAdapter, MCPError, MCPErrorCode } from 'gitx.do'
|
|
292
|
+
*
|
|
293
|
+
* const adapter = createMCPAdapter({
|
|
294
|
+
* name: 'gitx.do',
|
|
295
|
+
* version: '1.0.0'
|
|
296
|
+
* })
|
|
297
|
+
*
|
|
298
|
+
* const response = await adapter.handleRequest(request)
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
57
301
|
export {
|
|
58
302
|
// Adapter
|
|
59
303
|
MCPAdapter, createMCPAdapter, MCPError, MCPErrorCode, } from './mcp/adapter';
|
|
60
304
|
// =============================================================================
|
|
61
305
|
// Wire Protocol - Git Smart HTTP protocol implementation
|
|
62
306
|
// =============================================================================
|
|
307
|
+
/**
|
|
308
|
+
* Smart HTTP protocol handlers.
|
|
309
|
+
*
|
|
310
|
+
* @description
|
|
311
|
+
* Functions for handling Git Smart HTTP protocol including:
|
|
312
|
+
* - Info/refs endpoint handling
|
|
313
|
+
* - Upload-pack (fetch/clone)
|
|
314
|
+
* - Receive-pack (push)
|
|
315
|
+
* - Capability negotiation
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* import { handleInfoRefs, handleUploadPack, handleReceivePack } from 'gitx.do'
|
|
320
|
+
*
|
|
321
|
+
* // Handle info/refs request
|
|
322
|
+
* const refs = await handleInfoRefs(request, { service: 'git-upload-pack' })
|
|
323
|
+
*
|
|
324
|
+
* // Handle fetch request
|
|
325
|
+
* const pack = await handleUploadPack(request, storage)
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
63
328
|
export {
|
|
64
329
|
// Request handlers
|
|
65
330
|
handleInfoRefs, handleUploadPack, handleReceivePack,
|
|
@@ -71,6 +336,26 @@ parseUploadPackRequest, parseReceivePackRequest, parseCapabilities, capabilities
|
|
|
71
336
|
validateContentType, createErrorResponse,
|
|
72
337
|
// Constants
|
|
73
338
|
CONTENT_TYPE_UPLOAD_PACK_ADVERTISEMENT, CONTENT_TYPE_RECEIVE_PACK_ADVERTISEMENT, CONTENT_TYPE_UPLOAD_PACK_REQUEST, CONTENT_TYPE_UPLOAD_PACK_RESULT, CONTENT_TYPE_RECEIVE_PACK_REQUEST, CONTENT_TYPE_RECEIVE_PACK_RESULT, ZERO_SHA, } from './wire/smart-http';
|
|
339
|
+
/**
|
|
340
|
+
* Pkt-line encoding/decoding.
|
|
341
|
+
*
|
|
342
|
+
* @description
|
|
343
|
+
* Functions for Git pkt-line format handling including:
|
|
344
|
+
* - Line encoding/decoding
|
|
345
|
+
* - Flush and delimiter packets
|
|
346
|
+
* - Stream processing
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```typescript
|
|
350
|
+
* import { encodePktLine, decodePktLine, FLUSH_PKT } from 'gitx.do'
|
|
351
|
+
*
|
|
352
|
+
* // Encode a line
|
|
353
|
+
* const encoded = encodePktLine('want abc123')
|
|
354
|
+
*
|
|
355
|
+
* // Decode a line
|
|
356
|
+
* const { line, remaining } = decodePktLine(data)
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
74
359
|
export {
|
|
75
360
|
// Encoding/decoding
|
|
76
361
|
encodePktLine, decodePktLine, encodeFlushPkt, encodeDelimPkt, pktLineStream,
|
|
@@ -79,11 +364,55 @@ FLUSH_PKT, DELIM_PKT, MAX_PKT_LINE_DATA, } from './wire/pkt-line';
|
|
|
79
364
|
// =============================================================================
|
|
80
365
|
// Storage - R2 packfile storage and object indexing
|
|
81
366
|
// =============================================================================
|
|
367
|
+
/**
|
|
368
|
+
* R2 pack storage.
|
|
369
|
+
*
|
|
370
|
+
* @description
|
|
371
|
+
* Functions for storing packfiles in Cloudflare R2 including:
|
|
372
|
+
* - Packfile upload/download
|
|
373
|
+
* - Multi-pack index management
|
|
374
|
+
* - Pack locking for concurrent access
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* import { R2PackStorage, uploadPackfile, listPackfiles } from 'gitx.do'
|
|
379
|
+
*
|
|
380
|
+
* const storage = new R2PackStorage(r2Bucket, { prefix: 'git/packs' })
|
|
381
|
+
*
|
|
382
|
+
* // Upload a packfile
|
|
383
|
+
* const result = await uploadPackfile(storage, packData, { withIndex: true })
|
|
384
|
+
*
|
|
385
|
+
* // List all packfiles
|
|
386
|
+
* const packs = await listPackfiles(storage)
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
82
389
|
export {
|
|
83
390
|
// Class
|
|
84
391
|
R2PackStorage, R2PackError,
|
|
85
392
|
// Standalone functions
|
|
86
393
|
uploadPackfile, downloadPackfile, getPackfileMetadata, listPackfiles, deletePackfile, createMultiPackIndex, parseMultiPackIndex, lookupObjectInMultiPack, acquirePackLock, releasePackLock, } from './storage/r2-pack';
|
|
394
|
+
/**
|
|
395
|
+
* Object index.
|
|
396
|
+
*
|
|
397
|
+
* @description
|
|
398
|
+
* Functions for tracking object locations across storage tiers including:
|
|
399
|
+
* - Location recording and lookup
|
|
400
|
+
* - Batch operations
|
|
401
|
+
* - Statistics
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* import { ObjectIndex, recordLocation, lookupLocation } from 'gitx.do'
|
|
406
|
+
*
|
|
407
|
+
* const index = new ObjectIndex(storage)
|
|
408
|
+
*
|
|
409
|
+
* // Record object location
|
|
410
|
+
* await recordLocation(index, sha, { tier: 'hot', location: 'local' })
|
|
411
|
+
*
|
|
412
|
+
* // Look up location
|
|
413
|
+
* const location = await lookupLocation(index, sha)
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
87
416
|
export {
|
|
88
417
|
// Class
|
|
89
418
|
ObjectIndex,
|
|
@@ -92,9 +421,52 @@ recordLocation, lookupLocation, batchLookup, getStats, } from './storage/object-
|
|
|
92
421
|
// =============================================================================
|
|
93
422
|
// Tiered Storage - Hot/Warm/Cold storage with migration
|
|
94
423
|
// =============================================================================
|
|
424
|
+
/**
|
|
425
|
+
* Tier migration.
|
|
426
|
+
*
|
|
427
|
+
* @description
|
|
428
|
+
* Functions for managing object migration between storage tiers including:
|
|
429
|
+
* - Migration policies
|
|
430
|
+
* - Access tracking
|
|
431
|
+
* - Concurrent access handling
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```typescript
|
|
435
|
+
* import { TierMigrator, AccessTracker } from 'gitx.do'
|
|
436
|
+
*
|
|
437
|
+
* const tracker = new AccessTracker(storage)
|
|
438
|
+
* await tracker.recordAccess(sha)
|
|
439
|
+
*
|
|
440
|
+
* const migrator = new TierMigrator(storage, { policy: 'lru' })
|
|
441
|
+
* await migrator.migrate(sha, 'hot', 'warm')
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
95
444
|
export {
|
|
96
445
|
// Classes
|
|
97
446
|
TierMigrator, AccessTracker, MigrationError, MigrationRollback, ConcurrentAccessHandler, } from './tiered/migration';
|
|
447
|
+
/**
|
|
448
|
+
* Tiered read path.
|
|
449
|
+
*
|
|
450
|
+
* @description
|
|
451
|
+
* Functions for reading objects across storage tiers including:
|
|
452
|
+
* - Automatic tier traversal
|
|
453
|
+
* - Caching strategies
|
|
454
|
+
* - Read optimization
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```typescript
|
|
458
|
+
* import { TieredReader, type TieredStorageConfig } from 'gitx.do'
|
|
459
|
+
*
|
|
460
|
+
* const config: TieredStorageConfig = {
|
|
461
|
+
* hot: { backend: hotBackend, maxSize: 1_000_000 },
|
|
462
|
+
* warm: { backend: warmBackend },
|
|
463
|
+
* cold: { backend: coldBackend }
|
|
464
|
+
* }
|
|
465
|
+
*
|
|
466
|
+
* const reader = new TieredReader(config)
|
|
467
|
+
* const result = await reader.read(sha)
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
98
470
|
export {
|
|
99
471
|
// Class
|
|
100
472
|
TieredReader, TieredObjectStoreStub, } from './tiered/read-path';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,gFAAgF;AAChF,+CAA+C;AAC/C,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO;AAUL,cAAc;AACd,MAAM,EACN,MAAM,EACN,QAAQ,EACR,KAA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