just-git 1.0.2 → 1.1.0
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/README.md +50 -60
- package/dist/hooks-jTfqkfs1.d.ts +480 -0
- package/dist/index.d.ts +22 -407
- package/dist/index.js +398 -398
- package/dist/repo/index.d.ts +261 -0
- package/dist/repo/index.js +18 -0
- package/dist/server/index.d.ts +284 -0
- package/dist/server/index.js +42 -0
- package/package.json +9 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,401 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
isDirectory: boolean;
|
|
4
|
-
isSymbolicLink: boolean;
|
|
5
|
-
mode: number;
|
|
6
|
-
size: number;
|
|
7
|
-
mtime: Date;
|
|
8
|
-
}
|
|
9
|
-
interface FileSystem {
|
|
10
|
-
readFile(path: string): Promise<string>;
|
|
11
|
-
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
12
|
-
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
13
|
-
exists(path: string): Promise<boolean>;
|
|
14
|
-
stat(path: string): Promise<FileStat>;
|
|
15
|
-
mkdir(path: string, options?: {
|
|
16
|
-
recursive?: boolean;
|
|
17
|
-
}): Promise<void>;
|
|
18
|
-
readdir(path: string): Promise<string[]>;
|
|
19
|
-
rm(path: string, options?: {
|
|
20
|
-
recursive?: boolean;
|
|
21
|
-
force?: boolean;
|
|
22
|
-
}): Promise<void>;
|
|
23
|
-
/** Stat without following symlinks. Falls back to stat() semantics when not implemented. */
|
|
24
|
-
lstat?(path: string): Promise<FileStat>;
|
|
25
|
-
/** Read the target of a symbolic link. */
|
|
26
|
-
readlink?(path: string): Promise<string>;
|
|
27
|
-
/** Create a symbolic link pointing to target at the given path. */
|
|
28
|
-
symlink?(target: string, path: string): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Git object storage: compressed loose objects for new writes, with
|
|
33
|
-
* retained packfiles from fetch/clone. Reads check loose first,
|
|
34
|
-
* then fall back to pack indices.
|
|
35
|
-
*/
|
|
36
|
-
declare class PackedObjectStore {
|
|
37
|
-
private fs;
|
|
38
|
-
private gitDir;
|
|
39
|
-
private hooks?;
|
|
40
|
-
private packs;
|
|
41
|
-
private loadedPackNames;
|
|
42
|
-
private discoverPromise;
|
|
43
|
-
constructor(fs: FileSystem, gitDir: string, hooks?: HookEmitter | undefined);
|
|
44
|
-
write(type: ObjectType, content: Uint8Array): Promise<ObjectId>;
|
|
45
|
-
read(hash: ObjectId): Promise<RawObject>;
|
|
46
|
-
exists(hash: ObjectId): Promise<boolean>;
|
|
47
|
-
ingestPack(packData: Uint8Array): Promise<number>;
|
|
48
|
-
/** Scan `.git/objects/pack/` for existing pack/idx pairs. */
|
|
49
|
-
private discover;
|
|
50
|
-
private doDiscover;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** 40-character lowercase hex SHA-1 hash. */
|
|
54
|
-
type ObjectId = string;
|
|
55
|
-
/** The four Git object types. */
|
|
56
|
-
type ObjectType = "blob" | "tree" | "commit" | "tag";
|
|
57
|
-
/** An object as stored in .git/objects — type + raw content bytes. */
|
|
58
|
-
interface RawObject {
|
|
59
|
-
type: ObjectType;
|
|
60
|
-
content: Uint8Array;
|
|
61
|
-
}
|
|
62
|
-
/** Author or committer identity with timestamp. */
|
|
63
|
-
interface Identity {
|
|
64
|
-
name: string;
|
|
65
|
-
email: string;
|
|
66
|
-
/** Unix epoch seconds. */
|
|
67
|
-
timestamp: number;
|
|
68
|
-
/** Timezone offset string, e.g. "+0000", "-0500". */
|
|
69
|
-
timezone: string;
|
|
70
|
-
}
|
|
71
|
-
/** Stat-like metadata stored per index entry. */
|
|
72
|
-
interface IndexStat {
|
|
73
|
-
ctimeSeconds: number;
|
|
74
|
-
ctimeNanoseconds: number;
|
|
75
|
-
mtimeSeconds: number;
|
|
76
|
-
mtimeNanoseconds: number;
|
|
77
|
-
dev: number;
|
|
78
|
-
ino: number;
|
|
79
|
-
uid: number;
|
|
80
|
-
gid: number;
|
|
81
|
-
size: number;
|
|
82
|
-
}
|
|
83
|
-
interface IndexEntry {
|
|
84
|
-
/** File path relative to the work tree root. */
|
|
85
|
-
path: string;
|
|
86
|
-
/** File mode as a numeric value (e.g. 0o100644). */
|
|
87
|
-
mode: number;
|
|
88
|
-
/** SHA-1 of the blob content. */
|
|
89
|
-
hash: ObjectId;
|
|
90
|
-
/** Merge stage: 0 = normal, 1 = base, 2 = ours, 3 = theirs. */
|
|
91
|
-
stage: number;
|
|
92
|
-
stat: IndexStat;
|
|
93
|
-
}
|
|
94
|
-
interface Index {
|
|
95
|
-
version: number;
|
|
96
|
-
entries: IndexEntry[];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Bundles the filesystem handle with resolved repository paths.
|
|
100
|
-
* Threaded through all library functions so they don't need to
|
|
101
|
-
* re-discover the .git directory on every call.
|
|
102
|
-
*/
|
|
103
|
-
interface GitContext {
|
|
104
|
-
fs: FileSystem;
|
|
105
|
-
/** Absolute path to the .git directory. */
|
|
106
|
-
gitDir: string;
|
|
107
|
-
/** Absolute path to the working tree root, or null for bare repos. */
|
|
108
|
-
workTree: string | null;
|
|
109
|
-
/** Hook emitter for operation hooks and low-level events. */
|
|
110
|
-
hooks?: HookEmitter;
|
|
111
|
-
/** Operator-provided credential resolver (bypasses env vars). */
|
|
112
|
-
credentialProvider?: CredentialProvider;
|
|
113
|
-
/** Operator-provided identity override for author/committer. */
|
|
114
|
-
identityOverride?: IdentityOverride;
|
|
115
|
-
/** Custom fetch function for HTTP transport. Falls back to globalThis.fetch. */
|
|
116
|
-
fetchFn?: FetchFunction;
|
|
117
|
-
/** Network access policy. `false` blocks all HTTP access. */
|
|
118
|
-
networkPolicy?: NetworkPolicy | false;
|
|
119
|
-
/** Resolves remote URLs to GitContexts on potentially different VFS instances. */
|
|
120
|
-
resolveRemote?: RemoteResolver;
|
|
121
|
-
/** Cached object store instance. Lazily created by object-db. */
|
|
122
|
-
objectStore?: PackedObjectStore;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
type HttpAuth = {
|
|
126
|
-
type: "basic";
|
|
127
|
-
username: string;
|
|
128
|
-
password: string;
|
|
129
|
-
} | {
|
|
130
|
-
type: "bearer";
|
|
131
|
-
token: string;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
interface ExecResult {
|
|
135
|
-
stdout: string;
|
|
136
|
-
stderr: string;
|
|
137
|
-
exitCode: number;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
type CredentialProvider = (url: string) => HttpAuth | null | Promise<HttpAuth | null>;
|
|
141
|
-
interface IdentityOverride {
|
|
142
|
-
name: string;
|
|
143
|
-
email: string;
|
|
144
|
-
locked?: boolean;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Resolves a remote URL to a GitContext, enabling cross-VFS transport.
|
|
148
|
-
* Called before local filesystem lookup for non-HTTP URLs.
|
|
149
|
-
* Return null to fall back to local filesystem resolution.
|
|
150
|
-
*/
|
|
151
|
-
type RemoteResolver = (url: string) => GitContext | null | Promise<GitContext | null>;
|
|
152
|
-
type FetchFunction = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
153
|
-
interface NetworkPolicy {
|
|
154
|
-
/**
|
|
155
|
-
* Allowed URL patterns. Can be:
|
|
156
|
-
* - A hostname: "github.com" (matches any URL whose host equals this)
|
|
157
|
-
* - A URL prefix: "https://github.com/myorg/" (matches URLs starting with this)
|
|
158
|
-
*/
|
|
159
|
-
allowed?: string[];
|
|
160
|
-
/** Custom fetch function for HTTP transport. Falls back to globalThis.fetch. */
|
|
161
|
-
fetch?: FetchFunction;
|
|
162
|
-
}
|
|
163
|
-
interface PreCommitEvent {
|
|
164
|
-
readonly index: Index;
|
|
165
|
-
readonly treeHash: ObjectId;
|
|
166
|
-
}
|
|
167
|
-
interface CommitMsgEvent {
|
|
168
|
-
message: string;
|
|
169
|
-
}
|
|
170
|
-
interface MergeMsgEvent {
|
|
171
|
-
message: string;
|
|
172
|
-
readonly treeHash: ObjectId;
|
|
173
|
-
readonly headHash: ObjectId;
|
|
174
|
-
readonly theirsHash: ObjectId;
|
|
175
|
-
}
|
|
176
|
-
interface PostCommitEvent {
|
|
177
|
-
readonly hash: ObjectId;
|
|
178
|
-
readonly message: string;
|
|
179
|
-
readonly branch: string | null;
|
|
180
|
-
readonly parents: readonly ObjectId[];
|
|
181
|
-
readonly author: Identity;
|
|
182
|
-
}
|
|
183
|
-
interface PreMergeCommitEvent {
|
|
184
|
-
readonly mergeMessage: string;
|
|
185
|
-
readonly treeHash: ObjectId;
|
|
186
|
-
readonly headHash: ObjectId;
|
|
187
|
-
readonly theirsHash: ObjectId;
|
|
188
|
-
}
|
|
189
|
-
interface PostMergeEvent {
|
|
190
|
-
readonly headHash: ObjectId;
|
|
191
|
-
readonly theirsHash: ObjectId;
|
|
192
|
-
readonly strategy: "fast-forward" | "three-way";
|
|
193
|
-
readonly commitHash: ObjectId | null;
|
|
194
|
-
}
|
|
195
|
-
interface PostCheckoutEvent {
|
|
196
|
-
readonly prevHead: ObjectId | null;
|
|
197
|
-
readonly newHead: ObjectId;
|
|
198
|
-
readonly isBranchCheckout: boolean;
|
|
199
|
-
}
|
|
200
|
-
interface PrePushEvent {
|
|
201
|
-
readonly remote: string;
|
|
202
|
-
readonly url: string;
|
|
203
|
-
readonly refs: ReadonlyArray<{
|
|
204
|
-
srcRef: string | null;
|
|
205
|
-
srcHash: ObjectId | null;
|
|
206
|
-
dstRef: string;
|
|
207
|
-
dstHash: ObjectId | null;
|
|
208
|
-
force: boolean;
|
|
209
|
-
delete: boolean;
|
|
210
|
-
}>;
|
|
211
|
-
}
|
|
212
|
-
type PostPushEvent = PrePushEvent;
|
|
213
|
-
interface PreRebaseEvent {
|
|
214
|
-
readonly upstream: string;
|
|
215
|
-
readonly branch: string | null;
|
|
216
|
-
}
|
|
217
|
-
interface PreCheckoutEvent {
|
|
218
|
-
readonly target: string;
|
|
219
|
-
readonly mode: "switch" | "detach" | "create-branch" | "paths";
|
|
220
|
-
}
|
|
221
|
-
interface PreFetchEvent {
|
|
222
|
-
readonly remote: string;
|
|
223
|
-
readonly url: string;
|
|
224
|
-
readonly refspecs: readonly string[];
|
|
225
|
-
readonly prune: boolean;
|
|
226
|
-
readonly tags: boolean;
|
|
227
|
-
}
|
|
228
|
-
interface PostFetchEvent {
|
|
229
|
-
readonly remote: string;
|
|
230
|
-
readonly url: string;
|
|
231
|
-
readonly refsUpdated: number;
|
|
232
|
-
}
|
|
233
|
-
interface PreCloneEvent {
|
|
234
|
-
readonly repository: string;
|
|
235
|
-
readonly targetPath: string;
|
|
236
|
-
readonly bare: boolean;
|
|
237
|
-
readonly branch: string | null;
|
|
238
|
-
}
|
|
239
|
-
interface PostCloneEvent {
|
|
240
|
-
readonly repository: string;
|
|
241
|
-
readonly targetPath: string;
|
|
242
|
-
readonly bare: boolean;
|
|
243
|
-
readonly branch: string | null;
|
|
244
|
-
}
|
|
245
|
-
interface PrePullEvent {
|
|
246
|
-
readonly remote: string;
|
|
247
|
-
readonly branch: string | null;
|
|
248
|
-
}
|
|
249
|
-
interface PostPullEvent {
|
|
250
|
-
readonly remote: string;
|
|
251
|
-
readonly branch: string | null;
|
|
252
|
-
readonly strategy: "up-to-date" | "fast-forward" | "three-way";
|
|
253
|
-
readonly commitHash: ObjectId | null;
|
|
254
|
-
}
|
|
255
|
-
interface PreResetEvent {
|
|
256
|
-
readonly mode: "soft" | "mixed" | "hard" | "paths";
|
|
257
|
-
readonly target: string | null;
|
|
258
|
-
}
|
|
259
|
-
interface PostResetEvent {
|
|
260
|
-
readonly mode: "soft" | "mixed" | "hard" | "paths";
|
|
261
|
-
readonly targetHash: ObjectId | null;
|
|
262
|
-
}
|
|
263
|
-
interface PreCleanEvent {
|
|
264
|
-
readonly dryRun: boolean;
|
|
265
|
-
readonly force: boolean;
|
|
266
|
-
readonly removeDirs: boolean;
|
|
267
|
-
readonly removeIgnored: boolean;
|
|
268
|
-
readonly onlyIgnored: boolean;
|
|
269
|
-
}
|
|
270
|
-
interface PostCleanEvent {
|
|
271
|
-
readonly removed: readonly string[];
|
|
272
|
-
readonly dryRun: boolean;
|
|
273
|
-
}
|
|
274
|
-
interface PreRmEvent {
|
|
275
|
-
readonly paths: readonly string[];
|
|
276
|
-
readonly cached: boolean;
|
|
277
|
-
readonly recursive: boolean;
|
|
278
|
-
readonly force: boolean;
|
|
279
|
-
}
|
|
280
|
-
interface PostRmEvent {
|
|
281
|
-
readonly removedPaths: readonly string[];
|
|
282
|
-
readonly cached: boolean;
|
|
283
|
-
}
|
|
284
|
-
interface PreCherryPickEvent {
|
|
285
|
-
readonly mode: "pick" | "continue" | "abort";
|
|
286
|
-
readonly commit: string | null;
|
|
287
|
-
}
|
|
288
|
-
interface PostCherryPickEvent {
|
|
289
|
-
readonly mode: "pick" | "continue" | "abort";
|
|
290
|
-
readonly commitHash: ObjectId | null;
|
|
291
|
-
readonly hadConflicts: boolean;
|
|
292
|
-
}
|
|
293
|
-
interface PreRevertEvent {
|
|
294
|
-
readonly mode: "revert" | "continue" | "abort";
|
|
295
|
-
readonly commit: string | null;
|
|
296
|
-
}
|
|
297
|
-
interface PostRevertEvent {
|
|
298
|
-
readonly mode: "revert" | "continue" | "abort";
|
|
299
|
-
readonly commitHash: ObjectId | null;
|
|
300
|
-
readonly hadConflicts: boolean;
|
|
301
|
-
}
|
|
302
|
-
interface PreStashEvent {
|
|
303
|
-
readonly action: "push" | "pop" | "apply" | "list" | "drop" | "show" | "clear";
|
|
304
|
-
readonly ref: string | null;
|
|
305
|
-
}
|
|
306
|
-
interface PostStashEvent {
|
|
307
|
-
readonly action: "push" | "pop" | "apply" | "list" | "drop" | "show" | "clear";
|
|
308
|
-
readonly ok: boolean;
|
|
309
|
-
}
|
|
310
|
-
interface RefUpdateEvent {
|
|
311
|
-
readonly ref: string;
|
|
312
|
-
readonly oldHash: ObjectId | null;
|
|
313
|
-
readonly newHash: ObjectId;
|
|
314
|
-
}
|
|
315
|
-
interface RefDeleteEvent {
|
|
316
|
-
readonly ref: string;
|
|
317
|
-
readonly oldHash: ObjectId | null;
|
|
318
|
-
}
|
|
319
|
-
interface ObjectWriteEvent {
|
|
320
|
-
readonly type: ObjectType;
|
|
321
|
-
readonly hash: ObjectId;
|
|
322
|
-
}
|
|
323
|
-
interface HookEventMap {
|
|
324
|
-
"pre-commit": PreCommitEvent;
|
|
325
|
-
"commit-msg": CommitMsgEvent;
|
|
326
|
-
"merge-msg": MergeMsgEvent;
|
|
327
|
-
"post-commit": PostCommitEvent;
|
|
328
|
-
"pre-merge-commit": PreMergeCommitEvent;
|
|
329
|
-
"post-merge": PostMergeEvent;
|
|
330
|
-
"pre-checkout": PreCheckoutEvent;
|
|
331
|
-
"post-checkout": PostCheckoutEvent;
|
|
332
|
-
"pre-push": PrePushEvent;
|
|
333
|
-
"post-push": PostPushEvent;
|
|
334
|
-
"pre-fetch": PreFetchEvent;
|
|
335
|
-
"post-fetch": PostFetchEvent;
|
|
336
|
-
"pre-clone": PreCloneEvent;
|
|
337
|
-
"post-clone": PostCloneEvent;
|
|
338
|
-
"pre-pull": PrePullEvent;
|
|
339
|
-
"post-pull": PostPullEvent;
|
|
340
|
-
"pre-rebase": PreRebaseEvent;
|
|
341
|
-
"pre-reset": PreResetEvent;
|
|
342
|
-
"post-reset": PostResetEvent;
|
|
343
|
-
"pre-clean": PreCleanEvent;
|
|
344
|
-
"post-clean": PostCleanEvent;
|
|
345
|
-
"pre-rm": PreRmEvent;
|
|
346
|
-
"post-rm": PostRmEvent;
|
|
347
|
-
"pre-cherry-pick": PreCherryPickEvent;
|
|
348
|
-
"post-cherry-pick": PostCherryPickEvent;
|
|
349
|
-
"pre-revert": PreRevertEvent;
|
|
350
|
-
"post-revert": PostRevertEvent;
|
|
351
|
-
"pre-stash": PreStashEvent;
|
|
352
|
-
"post-stash": PostStashEvent;
|
|
353
|
-
"ref:update": RefUpdateEvent;
|
|
354
|
-
"ref:delete": RefDeleteEvent;
|
|
355
|
-
"object:write": ObjectWriteEvent;
|
|
356
|
-
}
|
|
357
|
-
type PreHookName = "pre-commit" | "commit-msg" | "merge-msg" | "pre-merge-commit" | "pre-checkout" | "pre-push" | "pre-fetch" | "pre-clone" | "pre-pull" | "pre-rebase" | "pre-reset" | "pre-clean" | "pre-rm" | "pre-cherry-pick" | "pre-revert" | "pre-stash";
|
|
358
|
-
interface AbortResult {
|
|
359
|
-
abort: true;
|
|
360
|
-
message?: string;
|
|
361
|
-
}
|
|
362
|
-
type PreHookHandler<E extends PreHookName> = (event: HookEventMap[E]) => void | AbortResult | Promise<void | AbortResult>;
|
|
363
|
-
type PostHookHandler<E extends keyof HookEventMap> = (event: HookEventMap[E]) => void | Promise<void>;
|
|
364
|
-
type HookHandler<E extends keyof HookEventMap> = E extends PreHookName ? PreHookHandler<E> : PostHookHandler<E>;
|
|
365
|
-
|
|
366
|
-
interface CommandEvent {
|
|
367
|
-
/** The git subcommand being invoked (e.g. "commit", "push"). */
|
|
368
|
-
command: string | undefined;
|
|
369
|
-
/** Arguments after the subcommand. */
|
|
370
|
-
rawArgs: string[];
|
|
371
|
-
/** Virtual filesystem — same instance custom commands receive from just-bash. */
|
|
372
|
-
fs: FileSystem;
|
|
373
|
-
/** Current working directory. */
|
|
374
|
-
cwd: string;
|
|
375
|
-
/** Environment variables. */
|
|
376
|
-
env: Map<string, string>;
|
|
377
|
-
/** Standard input content. */
|
|
378
|
-
stdin: string;
|
|
379
|
-
/** Execute a subcommand in the shell. Available when running via just-bash. */
|
|
380
|
-
exec?: (command: string, options: CommandExecOptions) => Promise<ExecResult>;
|
|
381
|
-
/** Abort signal for cooperative cancellation. */
|
|
382
|
-
signal?: AbortSignal;
|
|
383
|
-
}
|
|
384
|
-
type Middleware = (event: CommandEvent, next: () => Promise<ExecResult>) => ExecResult | Promise<ExecResult>;
|
|
385
|
-
declare class HookEmitter {
|
|
386
|
-
private listeners;
|
|
387
|
-
onError: (error: unknown) => void;
|
|
388
|
-
on<E extends keyof HookEventMap>(event: E, handler: HookHandler<E>): () => void;
|
|
389
|
-
/**
|
|
390
|
-
* Emit a pre-hook event. Returns an AbortResult if any handler aborts,
|
|
391
|
-
* or null if all handlers allow the operation to proceed.
|
|
392
|
-
*/
|
|
393
|
-
emitPre<E extends PreHookName>(event: E, data: HookEventMap[E]): Promise<AbortResult | null>;
|
|
394
|
-
/** Emit a post-hook event and await all handlers in order. */
|
|
395
|
-
emitPost<E extends keyof HookEventMap>(event: E, data: HookEventMap[E]): Promise<void>;
|
|
396
|
-
/** Emit low-level events (synchronous, fire-and-forget). */
|
|
397
|
-
emit<E extends keyof HookEventMap>(event: E, data: HookEventMap[E]): void;
|
|
398
|
-
}
|
|
1
|
+
import { F as FileSystem, E as ExecResult, G as GitHooks, C as CredentialProvider, I as IdentityOverride, N as NetworkPolicy, R as RemoteResolver, O as ObjectStore, a as RefStore, b as FetchFunction, c as GitContext } from './hooks-jTfqkfs1.js';
|
|
2
|
+
export { A as AfterCommandEvent, B as BeforeCommandEvent, d as CommitMsgEvent, e as FileStat, f as GitRepo, H as HttpAuth, M as MergeMsgEvent, g as ObjectWriteEvent, P as PostCheckoutEvent, h as PostCherryPickEvent, i as PostCleanEvent, j as PostCloneEvent, k as PostCommitEvent, l as PostFetchEvent, m as PostMergeEvent, n as PostPullEvent, o as PostPushEvent, p as PostResetEvent, q as PostRevertEvent, r as PostRmEvent, s as PostStashEvent, t as PreCheckoutEvent, u as PreCherryPickEvent, v as PreCleanEvent, w as PreCloneEvent, x as PreCommitEvent, y as PreFetchEvent, z as PreMergeCommitEvent, D as PrePullEvent, J as PrePushEvent, K as PreRebaseEvent, L as PreResetEvent, Q as PreRevertEvent, S as PreRmEvent, T as PreStashEvent, U as RefDeleteEvent, V as RefEntry, W as RefUpdateEvent, X as Rejection, Y as composeGitHooks, Z as isRejection } from './hooks-jTfqkfs1.js';
|
|
399
3
|
|
|
400
4
|
/** Options for subcommand execution (mirrors just-bash's CommandExecOptions). */
|
|
401
5
|
interface CommandExecOptions {
|
|
@@ -420,6 +24,7 @@ interface CommandContext {
|
|
|
420
24
|
}
|
|
421
25
|
type GitCommandName = "init" | "clone" | "fetch" | "pull" | "push" | "add" | "blame" | "commit" | "status" | "log" | "branch" | "tag" | "checkout" | "diff" | "reset" | "merge" | "cherry-pick" | "revert" | "rebase" | "mv" | "rm" | "remote" | "config" | "show" | "stash" | "rev-parse" | "ls-files" | "clean" | "switch" | "restore" | "reflog" | "repack" | "gc" | "bisect";
|
|
422
26
|
interface GitOptions {
|
|
27
|
+
hooks?: GitHooks;
|
|
423
28
|
credentials?: CredentialProvider;
|
|
424
29
|
identity?: IdentityOverride;
|
|
425
30
|
disabled?: GitCommandName[];
|
|
@@ -431,30 +36,40 @@ interface GitOptions {
|
|
|
431
36
|
* Return null to fall back to local filesystem resolution.
|
|
432
37
|
*/
|
|
433
38
|
resolveRemote?: RemoteResolver;
|
|
39
|
+
/**
|
|
40
|
+
* Override the object store discovered by `findRepo`.
|
|
41
|
+
* When set, all object reads/writes bypass the VFS `.git/objects/`
|
|
42
|
+
* and go through this store instead (e.g. SQLite-backed).
|
|
43
|
+
*/
|
|
44
|
+
objectStore?: ObjectStore;
|
|
45
|
+
/**
|
|
46
|
+
* Override the ref store discovered by `findRepo`.
|
|
47
|
+
* When set, all ref reads/writes bypass the VFS `.git/refs/`
|
|
48
|
+
* and go through this store instead (e.g. SQLite-backed).
|
|
49
|
+
*/
|
|
50
|
+
refStore?: RefStore;
|
|
434
51
|
}
|
|
435
52
|
/**
|
|
436
53
|
* Bundle of operator-level extensions threaded into command handlers
|
|
437
54
|
* via closures and merged onto GitContext after discovery.
|
|
438
55
|
*/
|
|
439
56
|
interface GitExtensions {
|
|
440
|
-
hooks?:
|
|
57
|
+
hooks?: GitHooks;
|
|
441
58
|
credentialProvider?: CredentialProvider;
|
|
442
59
|
identityOverride?: IdentityOverride;
|
|
443
60
|
fetchFn?: FetchFunction;
|
|
444
61
|
networkPolicy?: NetworkPolicy | false;
|
|
445
62
|
resolveRemote?: RemoteResolver;
|
|
63
|
+
objectStore?: ObjectStore;
|
|
64
|
+
refStore?: RefStore;
|
|
446
65
|
}
|
|
447
66
|
declare class Git {
|
|
448
67
|
readonly name = "git";
|
|
449
|
-
|
|
450
|
-
private
|
|
451
|
-
private extensions;
|
|
68
|
+
private blocked;
|
|
69
|
+
private hooks;
|
|
452
70
|
private inner;
|
|
453
71
|
constructor(options?: GitOptions);
|
|
454
|
-
on<E extends keyof HookEventMap>(event: E, handler: HookHandler<E>): () => void;
|
|
455
|
-
use(middleware: Middleware): () => void;
|
|
456
72
|
execute: (args: string[], ctx: CommandContext) => Promise<ExecResult>;
|
|
457
|
-
private runMiddleware;
|
|
458
73
|
}
|
|
459
74
|
declare function createGit(options?: GitOptions): Git;
|
|
460
75
|
|
|
@@ -464,6 +79,6 @@ declare function createGit(options?: GitOptions): Git;
|
|
|
464
79
|
* (`HEAD` + `objects/` + `refs/` directly in the directory).
|
|
465
80
|
* Returns a GitContext if found, null otherwise.
|
|
466
81
|
*/
|
|
467
|
-
declare function
|
|
82
|
+
declare function findRepo(fs: FileSystem, startPath: string): Promise<GitContext | null>;
|
|
468
83
|
|
|
469
|
-
export { type
|
|
84
|
+
export { type CommandContext, type CommandExecOptions, CredentialProvider, ExecResult, FetchFunction, FileSystem, Git, type GitCommandName, GitContext, type GitExtensions, GitHooks, type GitOptions, IdentityOverride, NetworkPolicy, ObjectStore, RefStore, RemoteResolver, createGit, findRepo };
|