@aigne/afs-git 1.1.0 → 1.11.0-beta.1

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.
@@ -0,0 +1,301 @@
1
+ import { AFSAccessMode, AFSDeleteOptions, AFSDeleteResult, AFSListOptions, AFSListResult, AFSModule, AFSModuleLoadParams, AFSReadOptions, AFSReadResult, AFSRenameOptions, AFSSearchOptions, AFSSearchResult, AFSWriteEntryPayload, AFSWriteOptions, AFSWriteResult } from "@aigne/afs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/index.d.ts
5
+ interface AFSGitOptions {
6
+ name?: string;
7
+ /**
8
+ * Local path to git repository.
9
+ * If remoteUrl is provided and repoPath doesn't exist, will clone to this path.
10
+ * If remoteUrl is provided and repoPath is not specified, clones to temp directory.
11
+ */
12
+ repoPath?: string;
13
+ /**
14
+ * Remote repository URL (https or git protocol).
15
+ * If provided, will clone the repository if repoPath doesn't exist.
16
+ * Examples:
17
+ * - https://github.com/user/repo.git
18
+ * - git@github.com:user/repo.git
19
+ */
20
+ remoteUrl?: string;
21
+ description?: string;
22
+ /**
23
+ * List of branches to expose/access.
24
+ * Also used for clone optimization when cloning from remoteUrl:
25
+ * - Single branch (e.g., ['main']): Uses --single-branch for faster clone
26
+ * - Multiple branches: Clones all branches, filters access to specified ones
27
+ * - Not specified: All branches are accessible
28
+ */
29
+ branches?: string[];
30
+ /**
31
+ * Access mode for this module.
32
+ * - "readonly": Only read operations are allowed, uses git commands (no worktree)
33
+ * - "readwrite": All operations are allowed, creates worktrees as needed
34
+ * @default "readonly"
35
+ */
36
+ accessMode?: AFSAccessMode;
37
+ /**
38
+ * Automatically commit changes after write operations
39
+ * @default false
40
+ */
41
+ autoCommit?: boolean;
42
+ /**
43
+ * Author information for commits when autoCommit is enabled
44
+ */
45
+ commitAuthor?: {
46
+ name: string;
47
+ email: string;
48
+ };
49
+ /**
50
+ * Clone depth for shallow clone (only used when cloning from remoteUrl)
51
+ * @default 1
52
+ */
53
+ depth?: number;
54
+ /**
55
+ * Automatically clean up cloned repository on cleanup()
56
+ * Only applies when repository was auto-cloned to temp directory
57
+ * @default true
58
+ */
59
+ autoCleanup?: boolean;
60
+ /**
61
+ * Git clone options (only used when cloning from remoteUrl)
62
+ */
63
+ cloneOptions?: {
64
+ /**
65
+ * Authentication credentials for private repositories
66
+ */
67
+ auth?: {
68
+ username?: string;
69
+ password?: string;
70
+ };
71
+ };
72
+ }
73
+ declare class AFSGit implements AFSModule {
74
+ options: AFSGitOptions & {
75
+ cwd?: string;
76
+ };
77
+ static schema(): z.ZodEffects<z.ZodEffects<z.ZodObject<{
78
+ name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
79
+ repoPath: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
80
+ remoteUrl: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
81
+ description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
82
+ branches: z.ZodType<string[] | undefined, z.ZodTypeDef, string[] | undefined>;
83
+ accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
84
+ autoCommit: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
85
+ commitAuthor: z.ZodType<{
86
+ name: string;
87
+ email: string;
88
+ } | undefined, z.ZodTypeDef, {
89
+ name: string;
90
+ email: string;
91
+ } | undefined>;
92
+ depth: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
93
+ autoCleanup: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
94
+ cloneOptions: z.ZodType<{
95
+ auth?: {
96
+ username?: string | undefined;
97
+ password?: string | undefined;
98
+ } | undefined;
99
+ } | undefined, z.ZodTypeDef, {
100
+ auth?: {
101
+ username?: string | undefined;
102
+ password?: string | undefined;
103
+ } | undefined;
104
+ } | undefined>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ name?: string | undefined;
107
+ repoPath?: string | undefined;
108
+ remoteUrl?: string | undefined;
109
+ description?: string | undefined;
110
+ branches?: string[] | undefined;
111
+ accessMode?: "readonly" | "readwrite" | undefined;
112
+ autoCommit?: boolean | undefined;
113
+ commitAuthor?: {
114
+ name: string;
115
+ email: string;
116
+ } | undefined;
117
+ depth?: number | undefined;
118
+ autoCleanup?: boolean | undefined;
119
+ cloneOptions?: {
120
+ auth?: {
121
+ username?: string | undefined;
122
+ password?: string | undefined;
123
+ } | undefined;
124
+ } | undefined;
125
+ }, {
126
+ name?: string | undefined;
127
+ repoPath?: string | undefined;
128
+ remoteUrl?: string | undefined;
129
+ description?: string | undefined;
130
+ branches?: string[] | undefined;
131
+ accessMode?: "readonly" | "readwrite" | undefined;
132
+ autoCommit?: boolean | undefined;
133
+ commitAuthor?: {
134
+ name: string;
135
+ email: string;
136
+ } | undefined;
137
+ depth?: number | undefined;
138
+ autoCleanup?: boolean | undefined;
139
+ cloneOptions?: {
140
+ auth?: {
141
+ username?: string | undefined;
142
+ password?: string | undefined;
143
+ } | undefined;
144
+ } | undefined;
145
+ }>, {
146
+ name?: string | undefined;
147
+ repoPath?: string | undefined;
148
+ remoteUrl?: string | undefined;
149
+ description?: string | undefined;
150
+ branches?: string[] | undefined;
151
+ accessMode?: "readonly" | "readwrite" | undefined;
152
+ autoCommit?: boolean | undefined;
153
+ commitAuthor?: {
154
+ name: string;
155
+ email: string;
156
+ } | undefined;
157
+ depth?: number | undefined;
158
+ autoCleanup?: boolean | undefined;
159
+ cloneOptions?: {
160
+ auth?: {
161
+ username?: string | undefined;
162
+ password?: string | undefined;
163
+ } | undefined;
164
+ } | undefined;
165
+ }, {
166
+ name?: string | undefined;
167
+ repoPath?: string | undefined;
168
+ remoteUrl?: string | undefined;
169
+ description?: string | undefined;
170
+ branches?: string[] | undefined;
171
+ accessMode?: "readonly" | "readwrite" | undefined;
172
+ autoCommit?: boolean | undefined;
173
+ commitAuthor?: {
174
+ name: string;
175
+ email: string;
176
+ } | undefined;
177
+ depth?: number | undefined;
178
+ autoCleanup?: boolean | undefined;
179
+ cloneOptions?: {
180
+ auth?: {
181
+ username?: string | undefined;
182
+ password?: string | undefined;
183
+ } | undefined;
184
+ } | undefined;
185
+ }>, {
186
+ name?: string | undefined;
187
+ repoPath?: string | undefined;
188
+ remoteUrl?: string | undefined;
189
+ description?: string | undefined;
190
+ branches?: string[] | undefined;
191
+ accessMode?: "readonly" | "readwrite" | undefined;
192
+ autoCommit?: boolean | undefined;
193
+ commitAuthor?: {
194
+ name: string;
195
+ email: string;
196
+ } | undefined;
197
+ depth?: number | undefined;
198
+ autoCleanup?: boolean | undefined;
199
+ cloneOptions?: {
200
+ auth?: {
201
+ username?: string | undefined;
202
+ password?: string | undefined;
203
+ } | undefined;
204
+ } | undefined;
205
+ }, any>;
206
+ static load({
207
+ filepath,
208
+ parsed
209
+ }: AFSModuleLoadParams): Promise<AFSGit>;
210
+ private initPromise;
211
+ private git;
212
+ private tempBase;
213
+ private worktrees;
214
+ private repoHash;
215
+ private isAutoCloned;
216
+ private clonedPath?;
217
+ private repoPath;
218
+ constructor(options: AFSGitOptions & {
219
+ cwd?: string;
220
+ });
221
+ /**
222
+ * Wait for async initialization to complete
223
+ */
224
+ ready(): Promise<void>;
225
+ /**
226
+ * Async initialization logic (runs in constructor)
227
+ * Handles cloning remote repositories if needed
228
+ */
229
+ private initialize;
230
+ /**
231
+ * Clone a remote repository to local path
232
+ */
233
+ private static cloneRepository;
234
+ name: string;
235
+ description?: string;
236
+ accessMode: AFSAccessMode;
237
+ /**
238
+ * Parse AFS path into branch and file path
239
+ * Branch names may contain slashes and are encoded with ~ in paths
240
+ * Examples:
241
+ * "/" -> { branch: undefined, filePath: "" }
242
+ * "/main" -> { branch: "main", filePath: "" }
243
+ * "/feature~new-feature" -> { branch: "feature/new-feature", filePath: "" }
244
+ * "/main/src/index.ts" -> { branch: "main", filePath: "src/index.ts" }
245
+ */
246
+ private parsePath;
247
+ /**
248
+ * Detect MIME type based on file extension
249
+ */
250
+ private getMimeType;
251
+ /**
252
+ * Check if file is likely binary based on extension
253
+ */
254
+ private isBinaryFile;
255
+ /**
256
+ * Get list of available branches
257
+ */
258
+ private getBranches;
259
+ /**
260
+ * Ensure worktree exists for a branch (lazy creation)
261
+ */
262
+ private ensureWorktree;
263
+ /**
264
+ * List files using git ls-tree (no worktree needed)
265
+ */
266
+ private listWithGitLsTree;
267
+ /**
268
+ * Build AFS path with encoded branch name
269
+ * Branch names with slashes are encoded by replacing / with ~
270
+ * @param branch Branch name (may contain slashes)
271
+ * @param filePath File path within branch
272
+ */
273
+ private buildPath;
274
+ list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
275
+ read(path: string, _options?: AFSReadOptions): Promise<AFSReadResult>;
276
+ write(path: string, entry: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<AFSWriteResult>;
277
+ delete(path: string, options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
278
+ rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
279
+ message?: string;
280
+ }>;
281
+ search(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult>;
282
+ /**
283
+ * Fetch latest changes from remote
284
+ */
285
+ fetch(): Promise<void>;
286
+ /**
287
+ * Pull latest changes from remote for current branch
288
+ */
289
+ pull(): Promise<void>;
290
+ /**
291
+ * Push local changes to remote
292
+ */
293
+ push(branch?: string): Promise<void>;
294
+ /**
295
+ * Cleanup all worktrees (useful when unmounting)
296
+ */
297
+ cleanup(): Promise<void>;
298
+ }
299
+ //#endregion
300
+ export { AFSGit, AFSGitOptions };
301
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;UAiCiB,aAAA;EAAA,IAAA;EAAA;AA6GjB;;;;EA7GiB,QAAA;EAAA;AA6GjB;;;;;;EA7GiB,SAAA;EAAA,WAAA;EAAA;AA6GjB;;;;;;EA7GiB,QAAA;EAAA;AA6GjB;;;;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A,GAAiB,OAAA,CAAQ,aAAA;EAAA,KAAA,IAAA,UAAA,QAAA,GAyBxB,cAAA,GAAiB,OAAA,CAAQ,aAAA;EAAA,MAAA,IAAA,UAAA,KAAA,EAgGpD,oBAAA,EAAA,OAAA,GACG,eAAA,GACT,OAAA,CAAQ,cAAA;EAAA,OAAA,IAAA,UAAA,OAAA,GA2E0B,gBAAA,GAAmB,OAAA,CAAQ,eAAA;EAAA,OAAA,OAAA,UAAA,OAAA,UAAA,OAAA,GAoDpD,gBAAA,GACT,OAAA;IAAA,OAAA;EAAA;EAAA,OAAA,IAAA,UAAA,KAAA,UAAA,OAAA,GAyEiD,gBAAA,GAAmB,OAAA,CAAQ,eAAA;EAAA;;;EAAA,MAAA,GAuFhE,OAAA;EAAA;;;EAAA,KAAA,GAQD,OAAA;EAAA;;;EAAA,KAAA,MAAA,YAQe,OAAA;EAAA;;;EAAA,QAAA,GAYZ,OAAA;AAAA"}
@@ -0,0 +1,301 @@
1
+ import { z } from "zod";
2
+ import { AFSAccessMode, AFSDeleteOptions, AFSDeleteResult, AFSListOptions, AFSListResult, AFSModule, AFSModuleLoadParams, AFSReadOptions, AFSReadResult, AFSRenameOptions, AFSSearchOptions, AFSSearchResult, AFSWriteEntryPayload, AFSWriteOptions, AFSWriteResult } from "@aigne/afs";
3
+
4
+ //#region src/index.d.ts
5
+ interface AFSGitOptions {
6
+ name?: string;
7
+ /**
8
+ * Local path to git repository.
9
+ * If remoteUrl is provided and repoPath doesn't exist, will clone to this path.
10
+ * If remoteUrl is provided and repoPath is not specified, clones to temp directory.
11
+ */
12
+ repoPath?: string;
13
+ /**
14
+ * Remote repository URL (https or git protocol).
15
+ * If provided, will clone the repository if repoPath doesn't exist.
16
+ * Examples:
17
+ * - https://github.com/user/repo.git
18
+ * - git@github.com:user/repo.git
19
+ */
20
+ remoteUrl?: string;
21
+ description?: string;
22
+ /**
23
+ * List of branches to expose/access.
24
+ * Also used for clone optimization when cloning from remoteUrl:
25
+ * - Single branch (e.g., ['main']): Uses --single-branch for faster clone
26
+ * - Multiple branches: Clones all branches, filters access to specified ones
27
+ * - Not specified: All branches are accessible
28
+ */
29
+ branches?: string[];
30
+ /**
31
+ * Access mode for this module.
32
+ * - "readonly": Only read operations are allowed, uses git commands (no worktree)
33
+ * - "readwrite": All operations are allowed, creates worktrees as needed
34
+ * @default "readonly"
35
+ */
36
+ accessMode?: AFSAccessMode;
37
+ /**
38
+ * Automatically commit changes after write operations
39
+ * @default false
40
+ */
41
+ autoCommit?: boolean;
42
+ /**
43
+ * Author information for commits when autoCommit is enabled
44
+ */
45
+ commitAuthor?: {
46
+ name: string;
47
+ email: string;
48
+ };
49
+ /**
50
+ * Clone depth for shallow clone (only used when cloning from remoteUrl)
51
+ * @default 1
52
+ */
53
+ depth?: number;
54
+ /**
55
+ * Automatically clean up cloned repository on cleanup()
56
+ * Only applies when repository was auto-cloned to temp directory
57
+ * @default true
58
+ */
59
+ autoCleanup?: boolean;
60
+ /**
61
+ * Git clone options (only used when cloning from remoteUrl)
62
+ */
63
+ cloneOptions?: {
64
+ /**
65
+ * Authentication credentials for private repositories
66
+ */
67
+ auth?: {
68
+ username?: string;
69
+ password?: string;
70
+ };
71
+ };
72
+ }
73
+ declare class AFSGit implements AFSModule {
74
+ options: AFSGitOptions & {
75
+ cwd?: string;
76
+ };
77
+ static schema(): z.ZodEffects<z.ZodEffects<z.ZodObject<{
78
+ name: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
79
+ repoPath: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
80
+ remoteUrl: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
81
+ description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
82
+ branches: z.ZodType<string[] | undefined, z.ZodTypeDef, string[] | undefined>;
83
+ accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
84
+ autoCommit: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
85
+ commitAuthor: z.ZodType<{
86
+ name: string;
87
+ email: string;
88
+ } | undefined, z.ZodTypeDef, {
89
+ name: string;
90
+ email: string;
91
+ } | undefined>;
92
+ depth: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
93
+ autoCleanup: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
94
+ cloneOptions: z.ZodType<{
95
+ auth?: {
96
+ username?: string | undefined;
97
+ password?: string | undefined;
98
+ } | undefined;
99
+ } | undefined, z.ZodTypeDef, {
100
+ auth?: {
101
+ username?: string | undefined;
102
+ password?: string | undefined;
103
+ } | undefined;
104
+ } | undefined>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ name?: string | undefined;
107
+ repoPath?: string | undefined;
108
+ remoteUrl?: string | undefined;
109
+ description?: string | undefined;
110
+ branches?: string[] | undefined;
111
+ accessMode?: "readonly" | "readwrite" | undefined;
112
+ autoCommit?: boolean | undefined;
113
+ commitAuthor?: {
114
+ name: string;
115
+ email: string;
116
+ } | undefined;
117
+ depth?: number | undefined;
118
+ autoCleanup?: boolean | undefined;
119
+ cloneOptions?: {
120
+ auth?: {
121
+ username?: string | undefined;
122
+ password?: string | undefined;
123
+ } | undefined;
124
+ } | undefined;
125
+ }, {
126
+ name?: string | undefined;
127
+ repoPath?: string | undefined;
128
+ remoteUrl?: string | undefined;
129
+ description?: string | undefined;
130
+ branches?: string[] | undefined;
131
+ accessMode?: "readonly" | "readwrite" | undefined;
132
+ autoCommit?: boolean | undefined;
133
+ commitAuthor?: {
134
+ name: string;
135
+ email: string;
136
+ } | undefined;
137
+ depth?: number | undefined;
138
+ autoCleanup?: boolean | undefined;
139
+ cloneOptions?: {
140
+ auth?: {
141
+ username?: string | undefined;
142
+ password?: string | undefined;
143
+ } | undefined;
144
+ } | undefined;
145
+ }>, {
146
+ name?: string | undefined;
147
+ repoPath?: string | undefined;
148
+ remoteUrl?: string | undefined;
149
+ description?: string | undefined;
150
+ branches?: string[] | undefined;
151
+ accessMode?: "readonly" | "readwrite" | undefined;
152
+ autoCommit?: boolean | undefined;
153
+ commitAuthor?: {
154
+ name: string;
155
+ email: string;
156
+ } | undefined;
157
+ depth?: number | undefined;
158
+ autoCleanup?: boolean | undefined;
159
+ cloneOptions?: {
160
+ auth?: {
161
+ username?: string | undefined;
162
+ password?: string | undefined;
163
+ } | undefined;
164
+ } | undefined;
165
+ }, {
166
+ name?: string | undefined;
167
+ repoPath?: string | undefined;
168
+ remoteUrl?: string | undefined;
169
+ description?: string | undefined;
170
+ branches?: string[] | undefined;
171
+ accessMode?: "readonly" | "readwrite" | undefined;
172
+ autoCommit?: boolean | undefined;
173
+ commitAuthor?: {
174
+ name: string;
175
+ email: string;
176
+ } | undefined;
177
+ depth?: number | undefined;
178
+ autoCleanup?: boolean | undefined;
179
+ cloneOptions?: {
180
+ auth?: {
181
+ username?: string | undefined;
182
+ password?: string | undefined;
183
+ } | undefined;
184
+ } | undefined;
185
+ }>, {
186
+ name?: string | undefined;
187
+ repoPath?: string | undefined;
188
+ remoteUrl?: string | undefined;
189
+ description?: string | undefined;
190
+ branches?: string[] | undefined;
191
+ accessMode?: "readonly" | "readwrite" | undefined;
192
+ autoCommit?: boolean | undefined;
193
+ commitAuthor?: {
194
+ name: string;
195
+ email: string;
196
+ } | undefined;
197
+ depth?: number | undefined;
198
+ autoCleanup?: boolean | undefined;
199
+ cloneOptions?: {
200
+ auth?: {
201
+ username?: string | undefined;
202
+ password?: string | undefined;
203
+ } | undefined;
204
+ } | undefined;
205
+ }, any>;
206
+ static load({
207
+ filepath,
208
+ parsed
209
+ }: AFSModuleLoadParams): Promise<AFSGit>;
210
+ private initPromise;
211
+ private git;
212
+ private tempBase;
213
+ private worktrees;
214
+ private repoHash;
215
+ private isAutoCloned;
216
+ private clonedPath?;
217
+ private repoPath;
218
+ constructor(options: AFSGitOptions & {
219
+ cwd?: string;
220
+ });
221
+ /**
222
+ * Wait for async initialization to complete
223
+ */
224
+ ready(): Promise<void>;
225
+ /**
226
+ * Async initialization logic (runs in constructor)
227
+ * Handles cloning remote repositories if needed
228
+ */
229
+ private initialize;
230
+ /**
231
+ * Clone a remote repository to local path
232
+ */
233
+ private static cloneRepository;
234
+ name: string;
235
+ description?: string;
236
+ accessMode: AFSAccessMode;
237
+ /**
238
+ * Parse AFS path into branch and file path
239
+ * Branch names may contain slashes and are encoded with ~ in paths
240
+ * Examples:
241
+ * "/" -> { branch: undefined, filePath: "" }
242
+ * "/main" -> { branch: "main", filePath: "" }
243
+ * "/feature~new-feature" -> { branch: "feature/new-feature", filePath: "" }
244
+ * "/main/src/index.ts" -> { branch: "main", filePath: "src/index.ts" }
245
+ */
246
+ private parsePath;
247
+ /**
248
+ * Detect MIME type based on file extension
249
+ */
250
+ private getMimeType;
251
+ /**
252
+ * Check if file is likely binary based on extension
253
+ */
254
+ private isBinaryFile;
255
+ /**
256
+ * Get list of available branches
257
+ */
258
+ private getBranches;
259
+ /**
260
+ * Ensure worktree exists for a branch (lazy creation)
261
+ */
262
+ private ensureWorktree;
263
+ /**
264
+ * List files using git ls-tree (no worktree needed)
265
+ */
266
+ private listWithGitLsTree;
267
+ /**
268
+ * Build AFS path with encoded branch name
269
+ * Branch names with slashes are encoded by replacing / with ~
270
+ * @param branch Branch name (may contain slashes)
271
+ * @param filePath File path within branch
272
+ */
273
+ private buildPath;
274
+ list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
275
+ read(path: string, _options?: AFSReadOptions): Promise<AFSReadResult>;
276
+ write(path: string, entry: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<AFSWriteResult>;
277
+ delete(path: string, options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
278
+ rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
279
+ message?: string;
280
+ }>;
281
+ search(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult>;
282
+ /**
283
+ * Fetch latest changes from remote
284
+ */
285
+ fetch(): Promise<void>;
286
+ /**
287
+ * Pull latest changes from remote for current branch
288
+ */
289
+ pull(): Promise<void>;
290
+ /**
291
+ * Push local changes to remote
292
+ */
293
+ push(branch?: string): Promise<void>;
294
+ /**
295
+ * Cleanup all worktrees (useful when unmounting)
296
+ */
297
+ cleanup(): Promise<void>;
298
+ }
299
+ //#endregion
300
+ export { AFSGit, AFSGitOptions };
301
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;UAiCiB,aAAA;EAAA,IAAA;EAAA;AA6GjB;;;;EA7GiB,QAAA;EAAA;AA6GjB;;;;;;EA7GiB,SAAA;EAAA,WAAA;EAAA;AA6GjB;;;;;;EA7GiB,QAAA;EAAA;AA6GjB;;;;;EA7GiB,UAAA,GA+BF,aAAA;EAAA;AA8Ef;;;EA9Ee,UAAA;EAAA;AA8Ef;;EA9Ee,YAAA;IAAA,IAAA;IAAA,KAAA;EAAA;EAAA;AA8Ef;;;EA9Ee,KAAA;EAAA;AA8Ef;;;;EA9Ee,WAAA;EAAA;AA8Ef;;EA9Ee,YAAA;IAAA;AA8Ef;;IA9Ee,IAAA;MAAA,QAAA;MAAA,QAAA;IAAA;EAAA;AAAA;AAAA,cA8EF,MAAA,YAAkB,SAAA;EAAA,OAAA,EAqBD,aAAA;IAAA,GAAA;EAAA;EAAA,OAAA,OAAA,GApBf,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,SAAA;IAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAI2B,mBAAA,GAAmB,OAAA,CAAA,MAAA;EAAA,QAAA,WAAA;EAAA,QAAA,GAAA;EAAA,QAAA,QAAA;EAAA,QAAA,SAAA;EAAA,QAAA,QAAA;EAAA,QAAA,YAA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