algomath-extract 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/bin/install.js +12 -11
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -328,7 +328,7 @@ throw new Error(`Unknown runtime: ${runtime}`);
328
328
  }
329
329
 
330
330
  // Check if we need elevated permissions
331
- const needsElevated = !fs.existsSync(targetDir) || !isWritable(targetDir);
331
+ let needsElevated = !fs.existsSync(targetDir) || !isWritable(targetDir);
332
332
  const isWindows = platform === 'win32';
333
333
  const isMac = platform === 'darwin';
334
334
 
@@ -345,16 +345,17 @@ execSync(`sudo mkdir -p "${commandDir}"`, { stdio: 'inherit' });
345
345
  const parentDir = path.dirname(targetDir);
346
346
  execSync(`sudo chown -R $(whoami) "${parentDir}"`, { stdio: 'inherit' });
347
347
  } else if (needsElevated && location === 'local') {
348
- // Local install but permissions needed - try sudo
349
- console.log(` Installing locally requires elevated permissions...`);
350
- console.log(` This happens when .opencode was previously created with sudo.`);
351
- console.log(` Running with sudo...\n`);
352
-
353
- execSync(`sudo mkdir -p "${commandDir}"`, { stdio: 'inherit' });
354
- // Fix ownership so user can write to it
355
- execSync(`sudo chown -R $(whoami) "${targetDir}"`, { stdio: 'inherit' });
356
- } else {
357
- fs.mkdirSync(commandDir, { recursive: true });
348
+ // Local install but permissions needed - try sudo
349
+ console.log(` Installing locally requires elevated permissions...`);
350
+ console.log(` This happens when .opencode was previously created with sudo.`);
351
+ console.log(` Running with sudo...\n`);
352
+
353
+ execSync(`sudo mkdir -p "${commandDir}"`, { stdio: 'inherit' });
354
+ // Fix ownership so user can write to it
355
+ execSync(`sudo chown -R $(whoami) "${targetDir}"`, { stdio: 'inherit' });
356
+
357
+ // Recalculate needsElevated after fixing permissions
358
+ needsElevated = !isWritable(commandDir);
358
359
  }
359
360
 
360
361
  // Copy command files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algomath-extract",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "AlgoMath Framework - Transform AI assistants into reliable mathematical problem-solving environments",
5
5
  "main": "index.js",
6
6
  "bin": {