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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../../src/cli/commands/web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AA8EhC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,gBAAgB,GAAG,gCAAgC,CAAA;AAEzD,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;;;;;;;;;;;;;;GAeG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EAAE,EAAE,CACtC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AACxE,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CACtC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AACxE,CAAC"}
|
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Local Filesystem Git Repository Adapter
|
|
3
|
+
*
|
|
4
|
+
* This module provides a filesystem adapter for reading git repositories
|
|
5
|
+
* directly from the local .git directory. It implements interfaces for:
|
|
6
|
+
* - Object storage (blobs, trees, commits, tags)
|
|
7
|
+
* - Reference storage (branches, tags, HEAD)
|
|
8
|
+
* - Index/staging area
|
|
9
|
+
* - Git configuration
|
|
10
|
+
* - Pack file reading
|
|
11
|
+
*
|
|
12
|
+
* The adapter supports both loose objects and packed objects, handles
|
|
13
|
+
* symbolic and direct references, and can detect bare repositories.
|
|
14
|
+
*
|
|
15
|
+
* @module cli/fs-adapter
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Create an adapter for a repository
|
|
19
|
+
* import { createFSAdapter } from './fs-adapter'
|
|
20
|
+
*
|
|
21
|
+
* const adapter = await createFSAdapter('/path/to/repo')
|
|
22
|
+
* const head = await adapter.getHead()
|
|
23
|
+
* const commit = await adapter.getObject(head.target)
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Check if a directory is a git repository
|
|
27
|
+
* import { isGitRepository } from './fs-adapter'
|
|
28
|
+
*
|
|
29
|
+
* if (await isGitRepository('/some/path')) {
|
|
30
|
+
* console.log('Valid git repository')
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
import type { ObjectType } from '../types/objects';
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for the filesystem adapter.
|
|
36
|
+
*
|
|
37
|
+
* @description Allows customization of the adapter behavior including
|
|
38
|
+
* specifying a custom git directory path and memory limits for pack files.
|
|
39
|
+
*
|
|
40
|
+
* @property gitDir - Custom path to the git directory. Defaults to '.git' relative to repo root.
|
|
41
|
+
* @property followSymlinks - Whether to follow symbolic links when traversing. Defaults to true.
|
|
42
|
+
* @property maxPackSize - Maximum pack file size in bytes to load into memory. Large packs may be streamed.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const config: FSAdapterConfig = {
|
|
46
|
+
* gitDir: '/custom/.git',
|
|
47
|
+
* maxPackSize: 100 * 1024 * 1024 // 100MB
|
|
48
|
+
* }
|
|
49
|
+
*/
|
|
50
|
+
export interface FSAdapterConfig {
|
|
51
|
+
/** Path to the git directory (defaults to '.git') */
|
|
52
|
+
gitDir?: string;
|
|
53
|
+
/** Whether to follow symbolic links */
|
|
54
|
+
followSymlinks?: boolean;
|
|
55
|
+
/** Maximum pack file size to load into memory */
|
|
56
|
+
maxPackSize?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A stored git object with metadata.
|
|
60
|
+
*
|
|
61
|
+
* @description Represents a git object (blob, tree, commit, or tag) retrieved
|
|
62
|
+
* from the repository. Includes both the object data and metadata about its
|
|
63
|
+
* storage location (loose file or pack file).
|
|
64
|
+
*
|
|
65
|
+
* @property sha - SHA-1 hash of the object (40 hex characters)
|
|
66
|
+
* @property type - Object type: 'blob', 'tree', 'commit', or 'tag'
|
|
67
|
+
* @property size - Size of the object data in bytes
|
|
68
|
+
* @property data - Raw object data (uncompressed)
|
|
69
|
+
* @property source - Storage location: 'loose' for individual files, 'pack' for pack files
|
|
70
|
+
* @property packFile - If from a pack, the pack file name (without extension)
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const obj = await adapter.getObject('abc123...')
|
|
74
|
+
* if (obj.type === 'blob') {
|
|
75
|
+
* console.log('File content:', new TextDecoder().decode(obj.data))
|
|
76
|
+
* }
|
|
77
|
+
*/
|
|
78
|
+
export interface FSObject {
|
|
79
|
+
/** SHA-1 hash of the object */
|
|
80
|
+
sha: string;
|
|
81
|
+
/** Object type: blob, tree, commit, tag */
|
|
82
|
+
type: ObjectType;
|
|
83
|
+
/** Size of the object data in bytes */
|
|
84
|
+
size: number;
|
|
85
|
+
/** Raw object data (uncompressed) */
|
|
86
|
+
data: Uint8Array;
|
|
87
|
+
/** Source location: 'loose' or 'pack' */
|
|
88
|
+
source: 'loose' | 'pack';
|
|
89
|
+
/** If from a pack, the pack file name */
|
|
90
|
+
packFile?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Interface for reading git objects from the filesystem.
|
|
94
|
+
*
|
|
95
|
+
* @description Provides methods for accessing git objects stored in the
|
|
96
|
+
* repository, supporting both loose objects and pack files. All methods
|
|
97
|
+
* are asynchronous and return null for non-existent objects.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* const obj = await store.getObject('abc123def...')
|
|
101
|
+
* if (obj) {
|
|
102
|
+
* console.log(`Found ${obj.type} object, ${obj.size} bytes`)
|
|
103
|
+
* }
|
|
104
|
+
*/
|
|
105
|
+
export interface FSObjectStore {
|
|
106
|
+
/**
|
|
107
|
+
* Get an object by SHA.
|
|
108
|
+
* @param sha - 40-character SHA-1 hash
|
|
109
|
+
* @returns The object if found, null otherwise
|
|
110
|
+
*/
|
|
111
|
+
getObject(sha: string): Promise<FSObject | null>;
|
|
112
|
+
/**
|
|
113
|
+
* Check if an object exists.
|
|
114
|
+
* @param sha - 40-character SHA-1 hash
|
|
115
|
+
* @returns true if the object exists
|
|
116
|
+
*/
|
|
117
|
+
hasObject(sha: string): Promise<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* Get object type without loading full data.
|
|
120
|
+
* @param sha - 40-character SHA-1 hash
|
|
121
|
+
* @returns The object type if found, null otherwise
|
|
122
|
+
*/
|
|
123
|
+
getObjectType(sha: string): Promise<ObjectType | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Get object size without loading full data.
|
|
126
|
+
* @param sha - 40-character SHA-1 hash
|
|
127
|
+
* @returns The object size in bytes if found, null otherwise
|
|
128
|
+
*/
|
|
129
|
+
getObjectSize(sha: string): Promise<number | null>;
|
|
130
|
+
/**
|
|
131
|
+
* List all available object SHAs.
|
|
132
|
+
* @returns Array of 40-character SHA-1 hashes
|
|
133
|
+
*/
|
|
134
|
+
listObjects(): Promise<string[]>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Type of git reference.
|
|
138
|
+
*
|
|
139
|
+
* @description Git references can be either 'direct' (pointing to a SHA)
|
|
140
|
+
* or 'symbolic' (pointing to another reference like HEAD -> refs/heads/main).
|
|
141
|
+
*/
|
|
142
|
+
export type FSRefType = 'direct' | 'symbolic';
|
|
143
|
+
/**
|
|
144
|
+
* A git reference.
|
|
145
|
+
*
|
|
146
|
+
* @description Represents a named pointer in the git repository.
|
|
147
|
+
* Direct refs point to a commit SHA, while symbolic refs point to
|
|
148
|
+
* another reference name.
|
|
149
|
+
*
|
|
150
|
+
* @property name - Full ref name (e.g., 'refs/heads/main', 'HEAD')
|
|
151
|
+
* @property target - For direct refs: SHA-1 hash. For symbolic refs: target ref name.
|
|
152
|
+
* @property type - 'direct' for SHA targets, 'symbolic' for ref targets
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* // Direct reference
|
|
156
|
+
* const mainRef: FSRef = {
|
|
157
|
+
* name: 'refs/heads/main',
|
|
158
|
+
* target: 'abc123def456...',
|
|
159
|
+
* type: 'direct'
|
|
160
|
+
* }
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* // Symbolic reference
|
|
164
|
+
* const headRef: FSRef = {
|
|
165
|
+
* name: 'HEAD',
|
|
166
|
+
* target: 'refs/heads/main',
|
|
167
|
+
* type: 'symbolic'
|
|
168
|
+
* }
|
|
169
|
+
*/
|
|
170
|
+
export interface FSRef {
|
|
171
|
+
/** Full ref name (e.g., 'refs/heads/main') */
|
|
172
|
+
name: string;
|
|
173
|
+
/** Target - SHA (direct) or ref name (symbolic) */
|
|
174
|
+
target: string;
|
|
175
|
+
/** Type of reference */
|
|
176
|
+
type: FSRefType;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Resolved reference with SHA.
|
|
180
|
+
*
|
|
181
|
+
* @description Contains the result of resolving a reference to its final
|
|
182
|
+
* commit SHA, including the chain of symbolic refs that were followed.
|
|
183
|
+
*
|
|
184
|
+
* @property ref - The final resolved reference
|
|
185
|
+
* @property sha - The commit SHA that the ref ultimately points to
|
|
186
|
+
* @property chain - Array of refs followed during resolution (for symbolic refs)
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* const resolved = await adapter.resolveRef('HEAD')
|
|
190
|
+
* console.log(`HEAD -> ${resolved.sha}`)
|
|
191
|
+
* console.log(`Resolution chain: ${resolved.chain.map(r => r.name).join(' -> ')}`)
|
|
192
|
+
*/
|
|
193
|
+
export interface FSResolvedRef {
|
|
194
|
+
/** The original ref */
|
|
195
|
+
ref: FSRef;
|
|
196
|
+
/** Final SHA after resolving symbolic refs */
|
|
197
|
+
sha: string;
|
|
198
|
+
/** Chain of refs followed */
|
|
199
|
+
chain: FSRef[];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Interface for reading git refs from the filesystem.
|
|
203
|
+
*
|
|
204
|
+
* @description Provides methods for accessing and resolving git references
|
|
205
|
+
* including branches, tags, HEAD, and packed refs. Supports both loose
|
|
206
|
+
* refs (individual files) and packed refs.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* const head = await store.getHead()
|
|
210
|
+
* if (head?.type === 'symbolic') {
|
|
211
|
+
* console.log(`On branch: ${head.target}`)
|
|
212
|
+
* } else {
|
|
213
|
+
* console.log('Detached HEAD')
|
|
214
|
+
* }
|
|
215
|
+
*/
|
|
216
|
+
export interface FSRefStore {
|
|
217
|
+
/**
|
|
218
|
+
* Get a ref by name.
|
|
219
|
+
* @param name - Ref name (e.g., 'refs/heads/main', 'HEAD')
|
|
220
|
+
* @returns The ref if found, null otherwise
|
|
221
|
+
*/
|
|
222
|
+
getRef(name: string): Promise<FSRef | null>;
|
|
223
|
+
/**
|
|
224
|
+
* Resolve a ref to its final SHA.
|
|
225
|
+
* @param name - Ref name to resolve
|
|
226
|
+
* @returns Resolved ref with SHA and resolution chain
|
|
227
|
+
*/
|
|
228
|
+
resolveRef(name: string): Promise<FSResolvedRef | null>;
|
|
229
|
+
/**
|
|
230
|
+
* Get HEAD ref.
|
|
231
|
+
* @returns HEAD reference (symbolic or direct)
|
|
232
|
+
*/
|
|
233
|
+
getHead(): Promise<FSRef | null>;
|
|
234
|
+
/**
|
|
235
|
+
* Check if HEAD is detached.
|
|
236
|
+
* @returns true if HEAD points directly to a SHA
|
|
237
|
+
*/
|
|
238
|
+
isHeadDetached(): Promise<boolean>;
|
|
239
|
+
/**
|
|
240
|
+
* List all branches.
|
|
241
|
+
* @returns Array of refs under refs/heads/
|
|
242
|
+
*/
|
|
243
|
+
listBranches(): Promise<FSRef[]>;
|
|
244
|
+
/**
|
|
245
|
+
* List all tags.
|
|
246
|
+
* @returns Array of refs under refs/tags/
|
|
247
|
+
*/
|
|
248
|
+
listTags(): Promise<FSRef[]>;
|
|
249
|
+
/**
|
|
250
|
+
* List all refs matching a pattern.
|
|
251
|
+
* @param pattern - Optional glob pattern to filter refs
|
|
252
|
+
* @returns Array of matching refs
|
|
253
|
+
*/
|
|
254
|
+
listRefs(pattern?: string): Promise<FSRef[]>;
|
|
255
|
+
/**
|
|
256
|
+
* Get packed refs.
|
|
257
|
+
* @returns Map of ref name to SHA from packed-refs file
|
|
258
|
+
*/
|
|
259
|
+
getPackedRefs(): Promise<Map<string, string>>;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* A single entry in the git index (staging area).
|
|
263
|
+
*
|
|
264
|
+
* @description Represents a file entry in the git index, which tracks staged
|
|
265
|
+
* changes for the next commit. Each entry contains file metadata, blob SHA,
|
|
266
|
+
* and staging information.
|
|
267
|
+
*
|
|
268
|
+
* @property path - File path relative to repository root
|
|
269
|
+
* @property sha - SHA-1 hash of the blob content
|
|
270
|
+
* @property mode - File mode (e.g., 0o100644 for regular file, 0o100755 for executable)
|
|
271
|
+
* @property size - File size in bytes
|
|
272
|
+
* @property mtime - Last modification time
|
|
273
|
+
* @property ctime - Creation time (inode change time)
|
|
274
|
+
* @property stage - Stage number: 0 for normal, 1-3 for merge conflicts
|
|
275
|
+
* @property flags - Various index entry flags
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* const entry = await index.getEntry('src/main.ts')
|
|
279
|
+
* console.log(`${entry.path}: ${entry.sha.substring(0, 7)} (stage ${entry.stage})`)
|
|
280
|
+
*/
|
|
281
|
+
export interface IndexEntry {
|
|
282
|
+
/** File path relative to repo root */
|
|
283
|
+
path: string;
|
|
284
|
+
/** SHA of the blob */
|
|
285
|
+
sha: string;
|
|
286
|
+
/** File mode */
|
|
287
|
+
mode: number;
|
|
288
|
+
/** File size */
|
|
289
|
+
size: number;
|
|
290
|
+
/** Modification time */
|
|
291
|
+
mtime: Date;
|
|
292
|
+
/** Creation time */
|
|
293
|
+
ctime: Date;
|
|
294
|
+
/** Stage number (0 for normal, 1-3 for conflicts) */
|
|
295
|
+
stage: number;
|
|
296
|
+
/** Various flags */
|
|
297
|
+
flags: {
|
|
298
|
+
/** Assume file is unchanged (skip stat calls) */
|
|
299
|
+
assumeValid: boolean;
|
|
300
|
+
/** Entry uses extended flags */
|
|
301
|
+
extended: boolean;
|
|
302
|
+
/** Skip file in worktree operations */
|
|
303
|
+
skipWorktree: boolean;
|
|
304
|
+
/** File is marked as intent-to-add */
|
|
305
|
+
intentToAdd: boolean;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Interface for reading the git index (staging area).
|
|
310
|
+
*
|
|
311
|
+
* @description Provides methods for accessing the git index file, which
|
|
312
|
+
* tracks staged changes and merge conflicts. The index is used to prepare
|
|
313
|
+
* the next commit.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* const entries = await index.getEntries()
|
|
317
|
+
* const conflicts = await index.listConflicts()
|
|
318
|
+
* if (conflicts.length > 0) {
|
|
319
|
+
* console.log('Merge conflicts in:', conflicts.join(', '))
|
|
320
|
+
* }
|
|
321
|
+
*/
|
|
322
|
+
export interface FSIndex {
|
|
323
|
+
/**
|
|
324
|
+
* Get all index entries.
|
|
325
|
+
* @returns Array of all entries in the index
|
|
326
|
+
*/
|
|
327
|
+
getEntries(): Promise<IndexEntry[]>;
|
|
328
|
+
/**
|
|
329
|
+
* Get an entry by path.
|
|
330
|
+
* @param path - File path relative to repo root
|
|
331
|
+
* @returns The entry if found, null otherwise
|
|
332
|
+
*/
|
|
333
|
+
getEntry(path: string): Promise<IndexEntry | null>;
|
|
334
|
+
/**
|
|
335
|
+
* Check if a path is staged.
|
|
336
|
+
* @param path - File path to check
|
|
337
|
+
* @returns true if the path has an entry in the index
|
|
338
|
+
*/
|
|
339
|
+
isStaged(path: string): Promise<boolean>;
|
|
340
|
+
/**
|
|
341
|
+
* Get conflict entries for a path (stages 1, 2, 3).
|
|
342
|
+
* @param path - File path to check
|
|
343
|
+
* @returns Array of conflict entries (base, ours, theirs)
|
|
344
|
+
*/
|
|
345
|
+
getConflicts(path: string): Promise<IndexEntry[]>;
|
|
346
|
+
/**
|
|
347
|
+
* Get all conflicted paths.
|
|
348
|
+
* @returns Array of paths with merge conflicts
|
|
349
|
+
*/
|
|
350
|
+
listConflicts(): Promise<string[]>;
|
|
351
|
+
/**
|
|
352
|
+
* Get the index version.
|
|
353
|
+
* @returns Index format version (2, 3, or 4)
|
|
354
|
+
*/
|
|
355
|
+
getVersion(): Promise<number>;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Interface for reading git configuration.
|
|
359
|
+
*
|
|
360
|
+
* @description Provides methods for reading git configuration values from
|
|
361
|
+
* the repository's .git/config file. Supports single values, multi-valued
|
|
362
|
+
* configs, and common shorthand methods for remotes and branch tracking.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* const name = await config.get('user', 'name')
|
|
366
|
+
* const email = await config.get('user', 'email')
|
|
367
|
+
* const upstream = await config.getBranchUpstream('main')
|
|
368
|
+
*/
|
|
369
|
+
export interface FSConfig {
|
|
370
|
+
/**
|
|
371
|
+
* Get a config value.
|
|
372
|
+
* @param section - Config section (e.g., 'user', 'core', 'remote.origin')
|
|
373
|
+
* @param key - Config key (e.g., 'name', 'email')
|
|
374
|
+
* @returns The value if found, null otherwise
|
|
375
|
+
*/
|
|
376
|
+
get(section: string, key: string): Promise<string | null>;
|
|
377
|
+
/**
|
|
378
|
+
* Get all values for a key (for multi-valued configs).
|
|
379
|
+
* @param section - Config section
|
|
380
|
+
* @param key - Config key
|
|
381
|
+
* @returns Array of all values for this key
|
|
382
|
+
*/
|
|
383
|
+
getAll(section: string, key: string): Promise<string[]>;
|
|
384
|
+
/**
|
|
385
|
+
* Get all config entries.
|
|
386
|
+
* @returns Map of full key names to values
|
|
387
|
+
*/
|
|
388
|
+
getAllEntries(): Promise<Map<string, string>>;
|
|
389
|
+
/**
|
|
390
|
+
* Check if config has a key.
|
|
391
|
+
* @param section - Config section
|
|
392
|
+
* @param key - Config key
|
|
393
|
+
* @returns true if the key exists
|
|
394
|
+
*/
|
|
395
|
+
has(section: string, key: string): Promise<boolean>;
|
|
396
|
+
/**
|
|
397
|
+
* Get remote URL.
|
|
398
|
+
* @param remoteName - Name of the remote (e.g., 'origin')
|
|
399
|
+
* @returns The remote URL if configured
|
|
400
|
+
*/
|
|
401
|
+
getRemoteUrl(remoteName: string): Promise<string | null>;
|
|
402
|
+
/**
|
|
403
|
+
* Get branch tracking info.
|
|
404
|
+
* @param branchName - Name of the branch
|
|
405
|
+
* @returns Object with remote and merge ref, or null if not tracking
|
|
406
|
+
*/
|
|
407
|
+
getBranchUpstream(branchName: string): Promise<{
|
|
408
|
+
remote: string;
|
|
409
|
+
merge: string;
|
|
410
|
+
} | null>;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Pack file index entry.
|
|
414
|
+
*
|
|
415
|
+
* @description Represents an entry in a pack index (.idx) file, which
|
|
416
|
+
* maps object SHAs to their locations within the pack file.
|
|
417
|
+
*
|
|
418
|
+
* @property sha - SHA-1 hash of the object
|
|
419
|
+
* @property offset - Byte offset of the object within the pack file
|
|
420
|
+
* @property crc32 - CRC32 checksum for data integrity verification
|
|
421
|
+
*/
|
|
422
|
+
export interface PackIndexEntry {
|
|
423
|
+
/** SHA of the object */
|
|
424
|
+
sha: string;
|
|
425
|
+
/** Offset in the pack file */
|
|
426
|
+
offset: number;
|
|
427
|
+
/** CRC32 checksum */
|
|
428
|
+
crc32: number;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Interface for reading pack files.
|
|
432
|
+
*
|
|
433
|
+
* @description Provides methods for working with git pack files, which
|
|
434
|
+
* store multiple compressed objects efficiently. Supports listing packs,
|
|
435
|
+
* reading the index, and extracting individual objects.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* const packs = await packReader.listPackFiles()
|
|
439
|
+
* for (const pack of packs) {
|
|
440
|
+
* const objects = await packReader.getPackObjects(pack)
|
|
441
|
+
* console.log(`Pack ${pack}: ${objects.length} objects`)
|
|
442
|
+
* }
|
|
443
|
+
*/
|
|
444
|
+
export interface FSPackReader {
|
|
445
|
+
/**
|
|
446
|
+
* List all pack files.
|
|
447
|
+
* @returns Array of pack names (without .pack extension)
|
|
448
|
+
*/
|
|
449
|
+
listPackFiles(): Promise<string[]>;
|
|
450
|
+
/**
|
|
451
|
+
* Get objects from a pack file.
|
|
452
|
+
* @param packName - Pack name (without extension)
|
|
453
|
+
* @returns Array of index entries for all objects in the pack
|
|
454
|
+
*/
|
|
455
|
+
getPackObjects(packName: string): Promise<PackIndexEntry[]>;
|
|
456
|
+
/**
|
|
457
|
+
* Read an object from a pack file.
|
|
458
|
+
* @param packName - Pack name (without extension)
|
|
459
|
+
* @param offset - Byte offset in the pack file
|
|
460
|
+
* @returns The decompressed object, or null if not found
|
|
461
|
+
*/
|
|
462
|
+
readPackObject(packName: string, offset: number): Promise<FSObject | null>;
|
|
463
|
+
/**
|
|
464
|
+
* Get pack file checksum.
|
|
465
|
+
* @param packName - Pack name (without extension)
|
|
466
|
+
* @returns SHA-1 checksum of the pack file
|
|
467
|
+
*/
|
|
468
|
+
getPackChecksum(packName: string): Promise<string | null>;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Main filesystem adapter that combines all interfaces.
|
|
472
|
+
*
|
|
473
|
+
* @description The primary interface for interacting with a git repository
|
|
474
|
+
* on the local filesystem. Combines object store, ref store, and provides
|
|
475
|
+
* access to index, config, and pack readers.
|
|
476
|
+
*
|
|
477
|
+
* @extends FSObjectStore - Methods for reading git objects
|
|
478
|
+
* @extends FSRefStore - Methods for reading git references
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* const adapter = await createFSAdapter('/path/to/repo')
|
|
482
|
+
*
|
|
483
|
+
* // Read HEAD
|
|
484
|
+
* const head = await adapter.getHead()
|
|
485
|
+
*
|
|
486
|
+
* // Get commit object
|
|
487
|
+
* const resolved = await adapter.resolveRef('HEAD')
|
|
488
|
+
* const commit = await adapter.getObject(resolved.sha)
|
|
489
|
+
*
|
|
490
|
+
* // Access staging area
|
|
491
|
+
* const index = adapter.getIndex()
|
|
492
|
+
* const entries = await index.getEntries()
|
|
493
|
+
*/
|
|
494
|
+
export interface FSAdapter extends FSObjectStore, FSRefStore {
|
|
495
|
+
/** Path to the repository root (working directory) */
|
|
496
|
+
readonly repoPath: string;
|
|
497
|
+
/** Path to the git directory (.git or bare repo root) */
|
|
498
|
+
readonly gitDir: string;
|
|
499
|
+
/** Whether this is a bare repository (no working directory) */
|
|
500
|
+
readonly isBare: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Get the index/staging area.
|
|
503
|
+
* @returns FSIndex interface for reading the index
|
|
504
|
+
*/
|
|
505
|
+
getIndex(): FSIndex;
|
|
506
|
+
/**
|
|
507
|
+
* Get the config reader.
|
|
508
|
+
* @returns FSConfig interface for reading configuration
|
|
509
|
+
*/
|
|
510
|
+
getConfig(): FSConfig;
|
|
511
|
+
/**
|
|
512
|
+
* Get the pack reader.
|
|
513
|
+
* @returns FSPackReader interface for reading pack files
|
|
514
|
+
*/
|
|
515
|
+
getPackReader(): FSPackReader;
|
|
516
|
+
/**
|
|
517
|
+
* Check if the directory is a valid git repository.
|
|
518
|
+
* @returns true if valid git repository structure exists
|
|
519
|
+
*/
|
|
520
|
+
isGitRepository(): Promise<boolean>;
|
|
521
|
+
/**
|
|
522
|
+
* Get repository description.
|
|
523
|
+
* @returns Contents of .git/description file, or null
|
|
524
|
+
*/
|
|
525
|
+
getDescription(): Promise<string | null>;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Error codes for filesystem operations.
|
|
529
|
+
*
|
|
530
|
+
* @description Enum-like type of error codes that can occur during
|
|
531
|
+
* filesystem adapter operations. Used to identify specific error types.
|
|
532
|
+
*
|
|
533
|
+
* - NOT_A_GIT_REPO: Path is not a valid git repository
|
|
534
|
+
* - OBJECT_NOT_FOUND: Requested object SHA does not exist
|
|
535
|
+
* - REF_NOT_FOUND: Requested reference does not exist
|
|
536
|
+
* - CORRUPT_OBJECT: Object data is malformed or corrupt
|
|
537
|
+
* - CORRUPT_PACK: Pack file is malformed or corrupt
|
|
538
|
+
* - CORRUPT_INDEX: Index file is malformed or corrupt
|
|
539
|
+
* - INVALID_SHA: Provided SHA is not valid format
|
|
540
|
+
* - READ_ERROR: General filesystem read error
|
|
541
|
+
* - UNSUPPORTED_VERSION: File format version not supported
|
|
542
|
+
*/
|
|
543
|
+
export type FSAdapterErrorCode = 'NOT_A_GIT_REPO' | 'OBJECT_NOT_FOUND' | 'REF_NOT_FOUND' | 'CORRUPT_OBJECT' | 'CORRUPT_PACK' | 'CORRUPT_INDEX' | 'INVALID_SHA' | 'READ_ERROR' | 'UNSUPPORTED_VERSION';
|
|
544
|
+
/**
|
|
545
|
+
* Error thrown by filesystem operations.
|
|
546
|
+
*
|
|
547
|
+
* @description Custom error class for filesystem adapter operations.
|
|
548
|
+
* Includes an error code for programmatic handling and optional path
|
|
549
|
+
* information for debugging.
|
|
550
|
+
*
|
|
551
|
+
* @extends Error
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* try {
|
|
555
|
+
* await adapter.getObject(sha)
|
|
556
|
+
* } catch (error) {
|
|
557
|
+
* if (error instanceof FSAdapterError) {
|
|
558
|
+
* if (error.code === 'OBJECT_NOT_FOUND') {
|
|
559
|
+
* console.log('Object does not exist')
|
|
560
|
+
* } else if (error.code === 'CORRUPT_OBJECT') {
|
|
561
|
+
* console.log('Object is corrupted:', error.path)
|
|
562
|
+
* }
|
|
563
|
+
* }
|
|
564
|
+
* }
|
|
565
|
+
*/
|
|
566
|
+
export declare class FSAdapterError extends Error {
|
|
567
|
+
/** Error code for programmatic handling */
|
|
568
|
+
readonly code: FSAdapterErrorCode;
|
|
569
|
+
/** Optional path related to the error */
|
|
570
|
+
readonly path?: string | undefined;
|
|
571
|
+
/**
|
|
572
|
+
* Creates a new FSAdapterError.
|
|
573
|
+
*
|
|
574
|
+
* @param message - Human-readable error message
|
|
575
|
+
* @param code - Error code for programmatic handling
|
|
576
|
+
* @param path - Optional path related to the error
|
|
577
|
+
*/
|
|
578
|
+
constructor(message: string,
|
|
579
|
+
/** Error code for programmatic handling */
|
|
580
|
+
code: FSAdapterErrorCode,
|
|
581
|
+
/** Optional path related to the error */
|
|
582
|
+
path?: string | undefined);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Check if a directory is a git repository.
|
|
586
|
+
*
|
|
587
|
+
* @description Validates whether the given path is a valid git repository
|
|
588
|
+
* by checking for the presence of .git (directory or file for worktrees)
|
|
589
|
+
* and validating the git directory structure.
|
|
590
|
+
*
|
|
591
|
+
* @param repoPath - Path to check
|
|
592
|
+
* @returns true if the path is a valid git repository
|
|
593
|
+
*
|
|
594
|
+
* @example
|
|
595
|
+
* if (await isGitRepository('/path/to/repo')) {
|
|
596
|
+
* console.log('Valid git repository')
|
|
597
|
+
* } else {
|
|
598
|
+
* console.log('Not a git repository')
|
|
599
|
+
* }
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* // Works with worktrees (where .git is a file)
|
|
603
|
+
* const isRepo = await isGitRepository('/path/to/worktree')
|
|
604
|
+
*/
|
|
605
|
+
export declare function isGitRepository(repoPath: string): Promise<boolean>;
|
|
606
|
+
/**
|
|
607
|
+
* Detect if a repository is bare.
|
|
608
|
+
*
|
|
609
|
+
* @description Checks whether a git directory represents a bare repository
|
|
610
|
+
* (one without a working directory). Looks at the config file for the
|
|
611
|
+
* 'bare' setting, or infers from directory structure.
|
|
612
|
+
*
|
|
613
|
+
* @param gitDir - Path to .git directory or potential bare repo root
|
|
614
|
+
* @returns true if the repository is bare
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* const isBare = await isBareRepository('/path/to/.git')
|
|
618
|
+
* // or for bare repos
|
|
619
|
+
* const isBare = await isBareRepository('/path/to/repo.git')
|
|
620
|
+
*/
|
|
621
|
+
export declare function isBareRepository(gitDir: string): Promise<boolean>;
|
|
622
|
+
/**
|
|
623
|
+
* Create a filesystem adapter for a local git repository.
|
|
624
|
+
*
|
|
625
|
+
* @description Factory function that creates an FSAdapter for a git repository.
|
|
626
|
+
* Automatically detects the git directory, handles worktrees (where .git is
|
|
627
|
+
* a file), and identifies bare repositories.
|
|
628
|
+
*
|
|
629
|
+
* @param repoPath - Path to the repository root (or bare repo directory)
|
|
630
|
+
* @param config - Optional configuration for the adapter
|
|
631
|
+
* @returns A fully initialized FSAdapter instance
|
|
632
|
+
*
|
|
633
|
+
* @throws {FSAdapterError} With code 'NOT_A_GIT_REPO' if the path is not a valid git repository
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* // Create adapter for a regular repository
|
|
637
|
+
* const adapter = await createFSAdapter('/path/to/repo')
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* // Create adapter with custom git directory
|
|
641
|
+
* const adapter = await createFSAdapter('/path/to/repo', {
|
|
642
|
+
* gitDir: '/path/to/custom/.git'
|
|
643
|
+
* })
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* // Handle errors
|
|
647
|
+
* try {
|
|
648
|
+
* const adapter = await createFSAdapter('/not/a/repo')
|
|
649
|
+
* } catch (error) {
|
|
650
|
+
* if (error instanceof FSAdapterError && error.code === 'NOT_A_GIT_REPO') {
|
|
651
|
+
* console.log('Not a git repository')
|
|
652
|
+
* }
|
|
653
|
+
* }
|
|
654
|
+
*/
|
|
655
|
+
export declare function createFSAdapter(repoPath: string, config?: FSAdapterConfig): Promise<FSAdapter>;
|
|
656
|
+
//# sourceMappingURL=fs-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-adapter.d.ts","sourceRoot":"","sources":["../../src/cli/fs-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AASlD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,uCAAuC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;C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