forgecode 0.100.1 → 0.100.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/README.md +4 -4
- package/bin/darwin/arm64/forge-aarch64-apple-darwin +0 -0
- package/bin/darwin/x64/forge-x86_64-apple-darwin +0 -0
- package/bin/linux/arm64/forge-aarch64-unknown-linux-gnu +0 -0
- package/bin/linux/arm64/forge-aarch64-unknown-linux-musl +0 -0
- package/bin/linux/x64/forge-x86_64-unknown-linux-gnu +0 -0
- package/bin/linux/x64/forge-x86_64-unknown-linux-musl +0 -0
- package/bin/win32/arm64/forge-aarch64-pc-windows-msvc.exe +0 -0
- package/bin/win32/x64/forge-x86_64-pc-windows-msvc.exe +0 -0
- package/forge.js +18 -17
- package/install.js +69 -54
- package/package.json +36 -36
package/README.md
CHANGED
|
@@ -341,9 +341,9 @@ Define custom commands as shortcuts for repetitive prompts:
|
|
|
341
341
|
```yaml
|
|
342
342
|
# forge.yaml
|
|
343
343
|
commands:
|
|
344
|
-
- name:
|
|
345
|
-
description:
|
|
346
|
-
prompt:
|
|
344
|
+
- name: 'refactor'
|
|
345
|
+
description: 'Refactor selected code'
|
|
346
|
+
prompt: 'Please refactor this code to improve readability and performance'
|
|
347
347
|
```
|
|
348
348
|
|
|
349
349
|
</details>
|
|
@@ -355,7 +355,7 @@ Specify the default AI model to use for all agents in the workflow.
|
|
|
355
355
|
|
|
356
356
|
```yaml
|
|
357
357
|
# forge.yaml
|
|
358
|
-
model:
|
|
358
|
+
model: 'claude-3.7-sonnet'
|
|
359
359
|
```
|
|
360
360
|
|
|
361
361
|
</details>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/forge.js
CHANGED
|
@@ -20,24 +20,25 @@ if (!existsSync(forgeBinaryPath)) {
|
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Pass through SIGINT signals to the child process
|
|
23
|
+
// Configure spawn options based on platform
|
|
24
|
+
const spawnOptions = {
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Spawn the forge process
|
|
29
|
+
const forgeProcess = spawn(forgeBinaryPath, process.argv.slice(2), spawnOptions);
|
|
30
|
+
|
|
31
|
+
// Handle SIGINT (Ctrl+C) based on platform
|
|
33
32
|
process.on('SIGINT', () => {
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
// for windows, let the child process handle it
|
|
34
|
+
if (process.platform !== 'win32') {
|
|
35
|
+
forgeProcess.kill('SIGINT');
|
|
36
|
+
}
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
// Handle process exit
|
|
40
|
-
forgeProcess.on('exit',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
40
|
+
forgeProcess.on('exit', code => {
|
|
41
|
+
if (code !== null) {
|
|
42
|
+
process.exit(code);
|
|
43
|
+
}
|
|
44
|
+
});
|
package/install.js
CHANGED
|
@@ -10,23 +10,26 @@ const os = require('os');
|
|
|
10
10
|
function getGlibcVersion() {
|
|
11
11
|
try {
|
|
12
12
|
// Using ldd to get version info (common on most Linux distros)
|
|
13
|
-
const lddOutput =
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const lddOutput =
|
|
14
|
+
spawnSync('ldd', ['--version'], { encoding: 'utf8' }).stderr.toString() ||
|
|
15
|
+
spawnSync('ldd', ['--version'], { encoding: 'utf8' }).stdout.toString();
|
|
16
|
+
|
|
16
17
|
// Check if this is musl libc
|
|
17
18
|
if (lddOutput.toLowerCase().includes('musl')) {
|
|
18
19
|
return { type: 'musl', version: null };
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
// Extract glibc version using regex
|
|
22
23
|
const versionMatch = /\b(\d+\.\d+)\b/.exec(lddOutput);
|
|
23
24
|
if (versionMatch && versionMatch[1]) {
|
|
24
25
|
return { type: 'gnu', version: versionMatch[1] };
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
// Alternative method using GNU-specific getconf
|
|
28
29
|
try {
|
|
29
|
-
const getconfOutput = spawnSync('getconf', ['GNU_LIBC_VERSION'], {
|
|
30
|
+
const getconfOutput = spawnSync('getconf', ['GNU_LIBC_VERSION'], {
|
|
31
|
+
encoding: 'utf8',
|
|
32
|
+
}).stdout.toString();
|
|
30
33
|
const getconfMatch = /\b(\d+\.\d+)\b/.exec(getconfOutput);
|
|
31
34
|
if (getconfMatch && getconfMatch[1]) {
|
|
32
35
|
return { type: 'gnu', version: getconfMatch[1] };
|
|
@@ -34,7 +37,7 @@ function getGlibcVersion() {
|
|
|
34
37
|
} catch (e) {
|
|
35
38
|
// Ignore error if getconf is not available
|
|
36
39
|
}
|
|
37
|
-
|
|
40
|
+
|
|
38
41
|
// If we got here, we couldn't get the specific version
|
|
39
42
|
return { type: 'gnu', version: null };
|
|
40
43
|
} catch (error) {
|
|
@@ -46,11 +49,11 @@ function getGlibcVersion() {
|
|
|
46
49
|
// Check if the glibc version is sufficient for our binary
|
|
47
50
|
function isGlibcVersionSufficient(version) {
|
|
48
51
|
if (!version) return false;
|
|
49
|
-
|
|
52
|
+
|
|
50
53
|
// Our binary requires 2.32 or higher based on the error message
|
|
51
54
|
const requiredVersion = 2.32;
|
|
52
55
|
const currentVersion = parseFloat(version);
|
|
53
|
-
|
|
56
|
+
|
|
54
57
|
return currentVersion >= requiredVersion;
|
|
55
58
|
}
|
|
56
59
|
|
|
@@ -61,36 +64,40 @@ function detectLibcType() {
|
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
const libcInfo = getGlibcVersion();
|
|
64
|
-
console.log(
|
|
65
|
-
|
|
67
|
+
console.log(
|
|
68
|
+
`🔍 Detected libc: ${libcInfo.type}${libcInfo.version ? ` version ${libcInfo.version}` : ''}`
|
|
69
|
+
);
|
|
70
|
+
|
|
66
71
|
// If it's musl, or if it's an older glibc version, prefer musl
|
|
67
|
-
if (
|
|
68
|
-
|
|
72
|
+
if (
|
|
73
|
+
libcInfo.type === 'musl' ||
|
|
74
|
+
(libcInfo.type === 'gnu' && !isGlibcVersionSufficient(libcInfo.version))
|
|
75
|
+
) {
|
|
69
76
|
return 'musl';
|
|
70
77
|
}
|
|
71
|
-
|
|
78
|
+
|
|
72
79
|
return 'gnu';
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
// Test if a binary will run on this system
|
|
76
83
|
function testBinary(binaryPath) {
|
|
77
84
|
try {
|
|
78
|
-
const result = spawnSync(binaryPath, ['--version'], {
|
|
85
|
+
const result = spawnSync(binaryPath, ['--version'], {
|
|
79
86
|
encoding: 'utf8',
|
|
80
|
-
timeout: 5000 // 5 second timeout
|
|
87
|
+
timeout: 5000, // 5 second timeout
|
|
81
88
|
});
|
|
82
|
-
|
|
89
|
+
|
|
83
90
|
// Check if execution was successful (return code 0)
|
|
84
91
|
if (result.status === 0) {
|
|
85
92
|
return true;
|
|
86
93
|
}
|
|
87
|
-
|
|
94
|
+
|
|
88
95
|
// Check specific errors that indicate glibc version problems
|
|
89
96
|
if (result.stderr && result.stderr.includes('GLIBC_')) {
|
|
90
97
|
console.warn(`⚠️ Binary compatibility issue: ${result.stderr.split('\n')[0]}`);
|
|
91
98
|
return false;
|
|
92
99
|
}
|
|
93
|
-
|
|
100
|
+
|
|
94
101
|
return false;
|
|
95
102
|
} catch (error) {
|
|
96
103
|
console.warn(`⚠️ Binary test failed: ${error.message}`);
|
|
@@ -100,24 +107,24 @@ function testBinary(binaryPath) {
|
|
|
100
107
|
|
|
101
108
|
// Map of supported platforms and architectures to binary names
|
|
102
109
|
const PLATFORMS = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
darwin: {
|
|
111
|
+
x64: 'forge-x86_64-apple-darwin',
|
|
112
|
+
arm64: 'forge-aarch64-apple-darwin',
|
|
106
113
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
linux: {
|
|
115
|
+
x64: {
|
|
116
|
+
gnu: 'forge-x86_64-unknown-linux-gnu',
|
|
117
|
+
musl: 'forge-x86_64-unknown-linux-musl',
|
|
118
|
+
},
|
|
119
|
+
arm64: {
|
|
120
|
+
gnu: 'forge-aarch64-unknown-linux-gnu',
|
|
121
|
+
musl: 'forge-aarch64-unknown-linux-musl',
|
|
111
122
|
},
|
|
112
|
-
'arm64': {
|
|
113
|
-
'gnu': 'forge-aarch64-unknown-linux-gnu',
|
|
114
|
-
'musl': 'forge-aarch64-unknown-linux-musl'
|
|
115
|
-
}
|
|
116
123
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
124
|
+
win32: {
|
|
125
|
+
x64: 'forge-x86_64-pc-windows-msvc.exe',
|
|
126
|
+
arm64: 'forge-aarch64-pc-windows-msvc.exe',
|
|
127
|
+
},
|
|
121
128
|
};
|
|
122
129
|
|
|
123
130
|
// Platform-specific binary extension
|
|
@@ -132,13 +139,17 @@ function printPlatformInfo() {
|
|
|
132
139
|
console.log(` - Architecture: ${arch}`);
|
|
133
140
|
console.log(` - Node.js: ${process.version}`);
|
|
134
141
|
console.log(` - OS: ${os.type()} ${os.release()}`);
|
|
135
|
-
|
|
142
|
+
|
|
136
143
|
if (platform === 'linux') {
|
|
137
144
|
const libcInfo = getGlibcVersion();
|
|
138
|
-
console.log(
|
|
139
|
-
|
|
145
|
+
console.log(
|
|
146
|
+
` - Libc: ${libcInfo.type}${libcInfo.version ? ` version ${libcInfo.version}` : ''}`
|
|
147
|
+
);
|
|
148
|
+
|
|
140
149
|
try {
|
|
141
|
-
const distroInfo = spawnSync('cat', ['/etc/os-release'], {
|
|
150
|
+
const distroInfo = spawnSync('cat', ['/etc/os-release'], {
|
|
151
|
+
encoding: 'utf8',
|
|
152
|
+
}).stdout.toString();
|
|
142
153
|
const distroName = /PRETTY_NAME="([^"]+)"/.exec(distroInfo);
|
|
143
154
|
if (distroName && distroName[1]) {
|
|
144
155
|
console.log(` - Distribution: ${distroName[1]}`);
|
|
@@ -152,7 +163,7 @@ function printPlatformInfo() {
|
|
|
152
163
|
// Install binary based on platform and architecture
|
|
153
164
|
function install() {
|
|
154
165
|
printPlatformInfo();
|
|
155
|
-
|
|
166
|
+
|
|
156
167
|
// Check if platform is supported
|
|
157
168
|
if (!PLATFORMS[platform]) {
|
|
158
169
|
console.error(`❌ Unsupported platform: ${platform}`);
|
|
@@ -163,7 +174,9 @@ function install() {
|
|
|
163
174
|
// Check if architecture is supported
|
|
164
175
|
if (!PLATFORMS[platform][arch]) {
|
|
165
176
|
console.error(`❌ Unsupported architecture: ${arch} for platform ${platform}`);
|
|
166
|
-
console.error(
|
|
177
|
+
console.error(
|
|
178
|
+
`Supported architectures for ${platform}: ${Object.keys(PLATFORMS[platform]).join(', ')}`
|
|
179
|
+
);
|
|
167
180
|
process.exit(1);
|
|
168
181
|
}
|
|
169
182
|
|
|
@@ -174,36 +187,36 @@ function install() {
|
|
|
174
187
|
// Handle Linux specially for libc type
|
|
175
188
|
if (platform === 'linux') {
|
|
176
189
|
let libcType = detectLibcType();
|
|
177
|
-
|
|
190
|
+
|
|
178
191
|
// Always try musl first if available (it's more portable)
|
|
179
192
|
const muslBinaryName = PLATFORMS[platform][arch]['musl'];
|
|
180
193
|
const muslBinaryPath = join(__dirname, 'bin', platform, arch, muslBinaryName);
|
|
181
|
-
|
|
194
|
+
|
|
182
195
|
// Check if musl binary exists
|
|
183
196
|
if (existsSync(muslBinaryPath)) {
|
|
184
197
|
console.log('📦 Found musl binary, which should work on most Linux systems');
|
|
185
198
|
binaryName = muslBinaryName;
|
|
186
199
|
binaryPath = muslBinaryPath;
|
|
187
|
-
}
|
|
200
|
+
}
|
|
188
201
|
// Fall back to detected libc type
|
|
189
202
|
else {
|
|
190
203
|
// Check if the detected libc type is supported in our binaries
|
|
191
204
|
if (!PLATFORMS[platform][arch][libcType]) {
|
|
192
205
|
// If not supported, try the alternative
|
|
193
|
-
libcType =
|
|
206
|
+
libcType = libcType === 'gnu' ? 'musl' : 'gnu';
|
|
194
207
|
console.warn(`⚠️ Detected libc type is not supported, trying ${libcType} instead`);
|
|
195
208
|
}
|
|
196
|
-
|
|
209
|
+
|
|
197
210
|
binaryName = PLATFORMS[platform][arch][libcType];
|
|
198
211
|
binaryPath = join(__dirname, 'bin', platform, arch, binaryName);
|
|
199
212
|
}
|
|
200
|
-
|
|
213
|
+
|
|
201
214
|
// If binary doesn't exist, try the alternative
|
|
202
215
|
if (!existsSync(binaryPath)) {
|
|
203
216
|
const alternativeLibc = libcType === 'gnu' ? 'musl' : 'gnu';
|
|
204
217
|
const alternativeBinaryName = PLATFORMS[platform][arch][alternativeLibc];
|
|
205
218
|
const alternativeBinaryPath = join(__dirname, 'bin', platform, arch, alternativeBinaryName);
|
|
206
|
-
|
|
219
|
+
|
|
207
220
|
if (existsSync(alternativeBinaryPath)) {
|
|
208
221
|
console.warn(`⚠️ Binary for ${libcType} not found, trying ${alternativeLibc} instead`);
|
|
209
222
|
binaryName = alternativeBinaryName;
|
|
@@ -218,7 +231,9 @@ function install() {
|
|
|
218
231
|
// Check if binary exists
|
|
219
232
|
if (!existsSync(binaryPath)) {
|
|
220
233
|
console.error(`❌ Binary not found: ${binaryPath}`);
|
|
221
|
-
console.error(
|
|
234
|
+
console.error(
|
|
235
|
+
'If this is a new architecture or platform, please check the repository for updates.'
|
|
236
|
+
);
|
|
222
237
|
process.exit(1);
|
|
223
238
|
}
|
|
224
239
|
|
|
@@ -229,7 +244,7 @@ function install() {
|
|
|
229
244
|
if (platform !== 'win32') {
|
|
230
245
|
chmodSync(targetPath, '755');
|
|
231
246
|
}
|
|
232
|
-
|
|
247
|
+
|
|
233
248
|
// For Linux, test if the binary will actually run
|
|
234
249
|
if (platform === 'linux') {
|
|
235
250
|
console.log('🧪 Testing binary compatibility...');
|
|
@@ -238,12 +253,12 @@ function install() {
|
|
|
238
253
|
if (binaryName.includes('-gnu')) {
|
|
239
254
|
const muslBinaryName = binaryName.replace('-gnu', '-musl');
|
|
240
255
|
const muslBinaryPath = join(__dirname, 'bin', platform, arch, muslBinaryName);
|
|
241
|
-
|
|
256
|
+
|
|
242
257
|
if (existsSync(muslBinaryPath)) {
|
|
243
258
|
console.log('🔄 GNU binary not compatible, trying musl binary instead');
|
|
244
259
|
copyFileSync(muslBinaryPath, targetPath);
|
|
245
260
|
chmodSync(targetPath, '755');
|
|
246
|
-
|
|
261
|
+
|
|
247
262
|
if (!testBinary(targetPath)) {
|
|
248
263
|
console.error('❌ Both GNU and musl binaries failed to run on this system.');
|
|
249
264
|
reportCompatibilityError();
|
|
@@ -261,7 +276,7 @@ function install() {
|
|
|
261
276
|
}
|
|
262
277
|
}
|
|
263
278
|
}
|
|
264
|
-
|
|
279
|
+
|
|
265
280
|
console.log(`✅ Successfully installed forge for ${platform}/${arch}`);
|
|
266
281
|
} catch (error) {
|
|
267
282
|
console.error(`❌ Error installing binary: ${error.message}`);
|
|
@@ -274,7 +289,7 @@ function reportCompatibilityError() {
|
|
|
274
289
|
console.error('\n🔧 Possible solutions:');
|
|
275
290
|
console.error('1. Try using the musl binary, which has fewer system dependencies:');
|
|
276
291
|
console.error(' - Set FORCE_MUSL=1 before installing');
|
|
277
|
-
console.error(
|
|
292
|
+
console.error("2. Update your system's glibc to a newer version");
|
|
278
293
|
console.error('3. Contact support with the following information:');
|
|
279
294
|
printPlatformInfo();
|
|
280
295
|
}
|
|
@@ -286,4 +301,4 @@ if (process.env.FORCE_MUSL === '1' && platform === 'linux') {
|
|
|
286
301
|
}
|
|
287
302
|
|
|
288
303
|
// Run installation
|
|
289
|
-
install();
|
|
304
|
+
install();
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
"name": "forgecode",
|
|
3
|
+
"version": "0.100.3",
|
|
4
|
+
"description": "Code Forge CLI - an AI-powered coding assistant",
|
|
5
|
+
"bin": {
|
|
6
|
+
"forge": "forge.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/antinomyhq/forge.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"code-forge",
|
|
17
|
+
"ai",
|
|
18
|
+
"assistant",
|
|
19
|
+
"cli"
|
|
20
|
+
],
|
|
21
|
+
"author": "Antinomy Inc.",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/antinomyhq/forge/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://antinomy.ai/",
|
|
27
|
+
"files": [
|
|
28
|
+
"bin/**/*",
|
|
29
|
+
"install.js",
|
|
30
|
+
"forge.js"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
38
38
|
}
|