forgecode 1.5.0 → 1.7.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/install.js CHANGED
@@ -6,6 +6,26 @@ const { chmodSync, copyFileSync, existsSync } = require('fs');
6
6
  const { spawnSync } = require('child_process');
7
7
  const os = require('os');
8
8
 
9
+ // Function to check if running on Android
10
+ function isAndroid() {
11
+ try {
12
+ // Check for Android-specific system properties
13
+ const result = spawnSync('getprop', ['ro.build.version.release'], { encoding: 'utf8' });
14
+ if (result.status === 0 && result.stdout) {
15
+ return true;
16
+ }
17
+ } catch (e) {
18
+ // getprop command not available, probably not Android
19
+ }
20
+
21
+ // Check for Termux environment
22
+ if (process.env.PREFIX && process.env.PREFIX.includes('com.termux')) {
23
+ return true;
24
+ }
25
+
26
+ return false;
27
+ }
28
+
9
29
  // Function to get the glibc version on Linux
10
30
  function getGlibcVersion() {
11
31
  try {
@@ -151,6 +171,9 @@ const PLATFORMS = {
151
171
  x64: 'forge-x86_64-pc-windows-msvc.exe',
152
172
  arm64: 'forge-aarch64-pc-windows-msvc.exe',
153
173
  },
174
+ android: {
175
+ arm64: 'forge-aarch64-linux-android',
176
+ }
154
177
  };
155
178
 
156
179
  // Platform-specific binary extension
@@ -194,18 +217,25 @@ function printPlatformInfo() {
194
217
  function install() {
195
218
  printPlatformInfo();
196
219
 
220
+ // Detect actual platform (override for Android)
221
+ let actualPlatform = platform;
222
+ if (platform === 'linux' && isAndroid()) {
223
+ actualPlatform = 'android';
224
+ console.log('🤖 Android environment detected, using Android binaries');
225
+ }
226
+
197
227
  // Check if platform is supported
198
- if (!PLATFORMS[platform]) {
199
- console.error(`❌ Unsupported platform: ${platform}`);
200
- console.error('Supported platforms: macOS, Linux, Windows');
228
+ if (!PLATFORMS[actualPlatform]) {
229
+ console.error(`❌ Unsupported platform: ${actualPlatform}`);
230
+ console.error('Supported platforms: macOS, Linux, Windows, Android');
201
231
  process.exit(1);
202
232
  }
203
233
 
204
234
  // Check if architecture is supported
205
- if (!PLATFORMS[platform][arch]) {
206
- console.error(`❌ Unsupported architecture: ${arch} for platform ${platform}`);
235
+ if (!PLATFORMS[actualPlatform][arch]) {
236
+ console.error(`❌ Unsupported architecture: ${arch} for platform ${actualPlatform}`);
207
237
  console.error(
208
- `Supported architectures for ${platform}: ${Object.keys(PLATFORMS[platform]).join(', ')}`
238
+ `Supported architectures for ${actualPlatform}: ${Object.keys(PLATFORMS[actualPlatform]).join(', ')}`
209
239
  );
210
240
  process.exit(1);
211
241
  }
@@ -214,8 +244,13 @@ function install() {
214
244
  let binaryPath;
215
245
  const targetPath = join(__dirname, 'forge' + getBinaryExtension());
216
246
 
217
- // Handle Linux specially for libc type
218
- if (platform === 'linux') {
247
+ // Handle platform-specific binary selection
248
+ if (actualPlatform === 'android') {
249
+ // Android: simple case, just one binary per arch
250
+ binaryName = PLATFORMS[actualPlatform][arch];
251
+ binaryPath = join(__dirname, 'bin', actualPlatform, arch, binaryName);
252
+ } else if (platform === 'linux') {
253
+ // Linux: handle libc type detection
219
254
  // Check if running on Android first
220
255
  if (isAndroid() && arch === 'arm64' && PLATFORMS[platform][arch]['android']) {
221
256
  console.log('🤖 Android platform detected');
@@ -262,8 +297,9 @@ function install() {
262
297
  }
263
298
  }
264
299
  } else {
265
- binaryName = PLATFORMS[platform][arch];
266
- binaryPath = join(__dirname, 'bin', platform, arch, binaryName);
300
+ // macOS, Windows: simple case
301
+ binaryName = PLATFORMS[actualPlatform][arch];
302
+ binaryPath = join(__dirname, 'bin', actualPlatform, arch, binaryName);
267
303
  }
268
304
 
269
305
  // Check if binary exists
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgecode",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Code Forge CLI - an AI-powered coding assistant",
5
5
  "bin": {
6
6
  "forge": "forge.js"