@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.
- package/LICENSE.md +17 -84
- package/README.md +46 -45
- package/dist/index.cjs +610 -0
- package/dist/index.d.cts +301 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +301 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +611 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -43
- package/CHANGELOG.md +0 -57
- package/lib/cjs/index.d.ts +0 -129
- package/lib/cjs/index.js +0 -601
- package/lib/cjs/package.json +0 -3
- package/lib/dts/index.d.ts +0 -129
- package/lib/esm/index.d.ts +0 -129
- package/lib/esm/index.js +0 -597
- package/lib/esm/package.json +0 -3
package/LICENSE.md
CHANGED
|
@@ -1,93 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
# Proprietary License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2024-2025 ArcBlock, Inc. All Rights Reserved.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This software and associated documentation files (the "Software") are proprietary
|
|
6
|
+
and confidential. Unauthorized copying, modification, distribution, or use of
|
|
7
|
+
this Software, via any medium, is strictly prohibited.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
The Software is provided for internal use only within ArcBlock, Inc. and its
|
|
10
|
+
authorized affiliates.
|
|
8
11
|
|
|
9
|
-
##
|
|
12
|
+
## No License Granted
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
-
the limitations and conditions below.
|
|
14
|
+
No license, express or implied, is granted to any party for any purpose.
|
|
15
|
+
All rights are reserved by ArcBlock, Inc.
|
|
15
16
|
|
|
16
|
-
##
|
|
17
|
+
## Public Artifact Distribution
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Portions of this Software may be released publicly under separate open-source
|
|
20
|
+
licenses (such as MIT License) through designated public repositories. Such
|
|
21
|
+
public releases are governed by their respective licenses and do not affect
|
|
22
|
+
the proprietary nature of this repository.
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
-
software that is protected by the license key.
|
|
24
|
+
## Contact
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
-
to applicable law.
|
|
29
|
-
|
|
30
|
-
## Patents
|
|
31
|
-
|
|
32
|
-
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
-
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
-
sale, import and have imported the software, in each case subject to the
|
|
35
|
-
limitations and conditions in this license. This license does not cover any
|
|
36
|
-
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
-
the software. If you or your company make any written claim that the software
|
|
38
|
-
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
-
the software granted under these terms ends immediately. If your company makes
|
|
40
|
-
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
-
company.
|
|
42
|
-
|
|
43
|
-
## Notices
|
|
44
|
-
|
|
45
|
-
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
-
also gets a copy of these terms.
|
|
47
|
-
|
|
48
|
-
If you modify the software, you must include in any modified copies of the
|
|
49
|
-
software prominent notices stating that you have modified the software.
|
|
50
|
-
|
|
51
|
-
## No Other Rights
|
|
52
|
-
|
|
53
|
-
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
-
these terms.
|
|
55
|
-
|
|
56
|
-
## Termination
|
|
57
|
-
|
|
58
|
-
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
-
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
-
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
-
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
-
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
-
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
-
to terminate automatically and permanently.
|
|
65
|
-
|
|
66
|
-
## No Liability
|
|
67
|
-
|
|
68
|
-
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
-
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
-
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
-
legal claim.*
|
|
72
|
-
|
|
73
|
-
## Definitions
|
|
74
|
-
|
|
75
|
-
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
-
software the licensor makes available under these terms, including any portion
|
|
77
|
-
of it.
|
|
78
|
-
|
|
79
|
-
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
-
|
|
81
|
-
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
-
organization that you work for, plus all organizations that have control over,
|
|
83
|
-
are under the control of, or are under common control with that
|
|
84
|
-
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
-
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
-
otherwise. Control can be direct or indirect.
|
|
87
|
-
|
|
88
|
-
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
-
these terms.
|
|
90
|
-
|
|
91
|
-
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
-
|
|
93
|
-
**trademark** means trademarks, service marks, and similar rights.
|
|
26
|
+
For licensing inquiries, contact: legal@arcblock.io
|
package/README.md
CHANGED
|
@@ -29,10 +29,12 @@ import { AFSGit } from "@aigne/afs-git";
|
|
|
29
29
|
const afs = new AFS();
|
|
30
30
|
|
|
31
31
|
// Mount a git repository in read-only mode
|
|
32
|
-
afs.mount(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
afs.mount(
|
|
33
|
+
new AFSGit({
|
|
34
|
+
repoPath: "/path/to/repo",
|
|
35
|
+
accessMode: "readonly", // default
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
### Path Structure
|
|
@@ -54,22 +56,22 @@ afs.mount(new AFSGit({
|
|
|
54
56
|
|
|
55
57
|
```typescript
|
|
56
58
|
// List all branches
|
|
57
|
-
const branches = await afs.list(
|
|
59
|
+
const branches = await afs.list("/modules/git");
|
|
58
60
|
// Returns: ['/main', '/develop', '/feature-auth']
|
|
59
61
|
|
|
60
62
|
// List files in a branch
|
|
61
|
-
const files = await afs.list(
|
|
63
|
+
const files = await afs.list("/modules/git/main");
|
|
62
64
|
// Returns files at root of main branch
|
|
63
65
|
|
|
64
66
|
// List files recursively
|
|
65
|
-
const allFiles = await afs.list(
|
|
67
|
+
const allFiles = await afs.list("/modules/git/main", { maxDepth: 10 });
|
|
66
68
|
|
|
67
69
|
// Read file content
|
|
68
|
-
const content = await afs.read(
|
|
70
|
+
const content = await afs.read("/modules/git/main/README.md");
|
|
69
71
|
console.log(content.data?.content);
|
|
70
72
|
|
|
71
73
|
// Search across branch
|
|
72
|
-
const results = await afs.search(
|
|
74
|
+
const results = await afs.search("/modules/git/main", "TODO");
|
|
73
75
|
// Uses git grep for fast searching
|
|
74
76
|
```
|
|
75
77
|
|
|
@@ -79,56 +81,56 @@ const results = await afs.search('/modules/git/main', 'TODO');
|
|
|
79
81
|
import { AFSGit } from "@aigne/afs-git";
|
|
80
82
|
|
|
81
83
|
const afsGit = new AFSGit({
|
|
82
|
-
repoPath:
|
|
83
|
-
accessMode:
|
|
84
|
+
repoPath: "/path/to/repo",
|
|
85
|
+
accessMode: "readwrite",
|
|
84
86
|
autoCommit: true,
|
|
85
87
|
commitAuthor: {
|
|
86
|
-
name:
|
|
87
|
-
email:
|
|
88
|
-
}
|
|
88
|
+
name: "AI Agent",
|
|
89
|
+
email: "agent@example.com",
|
|
90
|
+
},
|
|
89
91
|
});
|
|
90
92
|
|
|
91
93
|
afs.mount(afsGit);
|
|
92
94
|
|
|
93
95
|
// Write a new file (creates worktree automatically)
|
|
94
|
-
await afs.write(
|
|
95
|
-
content:
|
|
96
|
+
await afs.write("/modules/git/main/newfile.txt", {
|
|
97
|
+
content: "Hello World",
|
|
96
98
|
});
|
|
97
99
|
// Automatically committed with message "Update newfile.txt"
|
|
98
100
|
|
|
99
101
|
// Update existing file
|
|
100
|
-
await afs.write(
|
|
101
|
-
content: updatedCode
|
|
102
|
+
await afs.write("/modules/git/main/src/index.ts", {
|
|
103
|
+
content: updatedCode,
|
|
102
104
|
});
|
|
103
105
|
|
|
104
106
|
// Delete file
|
|
105
|
-
await afs.delete(
|
|
107
|
+
await afs.delete("/modules/git/main/oldfile.txt");
|
|
106
108
|
// Automatically committed
|
|
107
109
|
|
|
108
110
|
// Rename/move file
|
|
109
|
-
await afs.rename(
|
|
111
|
+
await afs.rename("/modules/git/main/old.txt", "/modules/git/main/new.txt");
|
|
110
112
|
```
|
|
111
113
|
|
|
112
114
|
### Advanced Configuration
|
|
113
115
|
|
|
114
116
|
```typescript
|
|
115
117
|
const afsGit = new AFSGit({
|
|
116
|
-
repoPath:
|
|
117
|
-
name:
|
|
118
|
-
description:
|
|
118
|
+
repoPath: "/path/to/repo",
|
|
119
|
+
name: "my-repo",
|
|
120
|
+
description: "My project repository",
|
|
119
121
|
|
|
120
122
|
// Limit accessible branches
|
|
121
|
-
branches: [
|
|
123
|
+
branches: ["main", "develop"],
|
|
122
124
|
|
|
123
125
|
// Access control
|
|
124
|
-
accessMode:
|
|
126
|
+
accessMode: "readwrite",
|
|
125
127
|
|
|
126
128
|
// Auto-commit settings
|
|
127
129
|
autoCommit: true,
|
|
128
130
|
commitAuthor: {
|
|
129
|
-
name:
|
|
130
|
-
email:
|
|
131
|
-
}
|
|
131
|
+
name: "AI Agent",
|
|
132
|
+
email: "agent@example.com",
|
|
133
|
+
},
|
|
132
134
|
});
|
|
133
135
|
|
|
134
136
|
// Cleanup worktrees when done
|
|
@@ -165,15 +167,16 @@ Worktrees are created in temporary directories and cleaned up when the module is
|
|
|
165
167
|
```typescript
|
|
166
168
|
interface AFSGitOptions {
|
|
167
169
|
// Required
|
|
168
|
-
repoPath: string;
|
|
170
|
+
repoPath: string; // Path to git repository
|
|
169
171
|
|
|
170
172
|
// Optional
|
|
171
|
-
name?: string;
|
|
172
|
-
description?: string;
|
|
173
|
-
branches?: string[];
|
|
174
|
-
accessMode?:
|
|
175
|
-
autoCommit?: boolean;
|
|
176
|
-
commitAuthor?: {
|
|
173
|
+
name?: string; // Module name (default: repo basename)
|
|
174
|
+
description?: string; // Module description
|
|
175
|
+
branches?: string[]; // Limit accessible branches
|
|
176
|
+
accessMode?: "readonly" | "readwrite"; // Default: 'readonly'
|
|
177
|
+
autoCommit?: boolean; // Auto-commit changes (default: false)
|
|
178
|
+
commitAuthor?: {
|
|
179
|
+
// Author for commits
|
|
177
180
|
name: string;
|
|
178
181
|
email: string;
|
|
179
182
|
};
|
|
@@ -202,10 +205,12 @@ import { AFS } from "@aigne/afs";
|
|
|
202
205
|
import { AFSGit } from "@aigne/afs-git";
|
|
203
206
|
|
|
204
207
|
const afs = new AFS();
|
|
205
|
-
afs.mount(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
afs.mount(
|
|
209
|
+
new AFSGit({
|
|
210
|
+
repoPath: process.cwd(),
|
|
211
|
+
accessMode: "readonly",
|
|
212
|
+
}),
|
|
213
|
+
);
|
|
209
214
|
|
|
210
215
|
const aigne = new AIGNE({});
|
|
211
216
|
|
|
@@ -213,15 +218,11 @@ const aigne = new AIGNE({});
|
|
|
213
218
|
const agent = AIAgent.from({
|
|
214
219
|
name: "CodeReviewer",
|
|
215
220
|
instructions: "Review code and suggest improvements",
|
|
216
|
-
afs
|
|
221
|
+
afs,
|
|
217
222
|
});
|
|
218
223
|
|
|
219
224
|
// Agent can list files, read code, search for patterns
|
|
220
225
|
await aigne.invoke(agent, {
|
|
221
|
-
message: "Review the authentication code in src/auth/"
|
|
226
|
+
message: "Review the authentication code in src/auth/",
|
|
222
227
|
});
|
|
223
228
|
```
|
|
224
|
-
|
|
225
|
-
## License
|
|
226
|
-
|
|
227
|
-
This project is licensed under the [Elastic-2.0](../../LICENSE.md) License.
|