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.
- 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 +10 -2
package/dist/types/storage.d.ts
CHANGED
|
@@ -1,117 +1,489 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Storage Interface Types
|
|
2
|
+
* @fileoverview Storage Interface Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
48
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/types/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAMzD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,WAAW;IAK1B;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAE1E;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE5D;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAMxC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAE/C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEnD;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,C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js
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Storage Interface Types
|
|
2
|
+
* @fileoverview Storage Interface Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/types/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG"}
|