chore: add code formatting config and pre-commit hooks (#450)
This commit is contained in:
@@ -5,30 +5,30 @@
|
||||
* This file ensures proper execution when run via npx from GitHub
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { execSync } = require('node:child_process');
|
||||
const path = require('node:path');
|
||||
const fs = require('node:fs');
|
||||
|
||||
// Check if we're running in an npx temporary directory
|
||||
const isNpxExecution = __dirname.includes('_npx') || __dirname.includes('.npm');
|
||||
|
||||
// If running via npx, we need to handle things differently
|
||||
if (isNpxExecution) {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const arguments_ = process.argv.slice(2);
|
||||
|
||||
// Use the installer for all commands
|
||||
const bmadScriptPath = path.join(__dirname, 'installer', 'bin', 'bmad.js');
|
||||
|
||||
|
||||
if (!fs.existsSync(bmadScriptPath)) {
|
||||
console.error('Error: Could not find bmad.js at', bmadScriptPath);
|
||||
console.error('Current directory:', __dirname);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
execSync(`node "${bmadScriptPath}" ${args.join(' ')}`, {
|
||||
execSync(`node "${bmadScriptPath}" ${arguments_.join(' ')}`, {
|
||||
stdio: 'inherit',
|
||||
cwd: path.dirname(__dirname)
|
||||
cwd: path.dirname(__dirname),
|
||||
});
|
||||
} catch (error) {
|
||||
process.exit(error.status || 1);
|
||||
@@ -36,4 +36,4 @@ if (isNpxExecution) {
|
||||
} else {
|
||||
// Local execution - use installer for all commands
|
||||
require('./installer/bin/bmad.js');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user