From e32fb855ce9170d0154fc6f51228aba70fe2fb5e Mon Sep 17 00:00:00 2001 From: Anderson Date: Fri, 10 Apr 2026 22:31:25 -0300 Subject: [PATCH 1/2] fix: symlink node_modules so squad scripts can resolve framework deps Scripts in squads/ (e.g. squad-creator-pro) use `require('js-yaml')` but Node.js module resolution never finds it because node_modules only exists inside .aiox-core/. This creates a symlink from the project root node_modules to .aiox-core/node_modules during `aiox init`, allowing standard require() calls to work from any directory in the project. Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/aiox-init.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/aiox-init.js b/bin/aiox-init.js index a519a69f40..1bf7ede893 100644 --- a/bin/aiox-init.js +++ b/bin/aiox-init.js @@ -175,6 +175,27 @@ async function main() { console.log(chalk.green('✓') + ' package.json created'); } + // Ensure node_modules symlink so squads/ scripts can resolve framework dependencies + const projectNodeModules = path.join(projectRoot, 'node_modules'); + const frameworkNodeModules = path.join(projectRoot, '.aiox-core', 'node_modules'); + if (!fs.existsSync(projectNodeModules) && fs.existsSync(frameworkNodeModules)) { + try { + await fse.symlink( + path.relative(projectRoot, frameworkNodeModules), + projectNodeModules, + 'junction', + ); + console.log(chalk.green('✓') + ' node_modules linked to .aiox-core/node_modules'); + } catch (symlinkError) { + // Non-fatal: squads scripts will need explicit paths + console.log( + chalk.yellow('⚠') + + ' Could not create node_modules symlink: ' + + symlinkError.message, + ); + } + } + console.log(chalk.green('✓') + ' Prerequisites ready\n'); // Try to detect context again From 72ae3e7aeeab59975970d31ed6e3cf1587b663de Mon Sep 17 00:00:00 2001 From: Anderson Date: Fri, 10 Apr 2026 22:44:51 -0300 Subject: [PATCH 2/2] fix: move symlink creation after core copy for fresh installs Address CodeRabbit review: the symlink block was in checkPrerequisites() which runs before .aiox-core is copied, so fresh installs would skip it. Now runs immediately after fse.copy(sourceCoreDir, targetCoreDir) when .aiox-core/node_modules is guaranteed to exist. Co-Authored-By: Claude Opus 4.6 (1M context) --- bin/aiox-init.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/bin/aiox-init.js b/bin/aiox-init.js index 1bf7ede893..9dc81f64d6 100644 --- a/bin/aiox-init.js +++ b/bin/aiox-init.js @@ -175,27 +175,6 @@ async function main() { console.log(chalk.green('✓') + ' package.json created'); } - // Ensure node_modules symlink so squads/ scripts can resolve framework dependencies - const projectNodeModules = path.join(projectRoot, 'node_modules'); - const frameworkNodeModules = path.join(projectRoot, '.aiox-core', 'node_modules'); - if (!fs.existsSync(projectNodeModules) && fs.existsSync(frameworkNodeModules)) { - try { - await fse.symlink( - path.relative(projectRoot, frameworkNodeModules), - projectNodeModules, - 'junction', - ); - console.log(chalk.green('✓') + ' node_modules linked to .aiox-core/node_modules'); - } catch (symlinkError) { - // Non-fatal: squads scripts will need explicit paths - console.log( - chalk.yellow('⚠') + - ' Could not create node_modules symlink: ' + - symlinkError.message, - ); - } - } - console.log(chalk.green('✓') + ' Prerequisites ready\n'); // Try to detect context again @@ -539,6 +518,27 @@ async function main() { chalk.gray('(11 agents, 68 tasks, 23 templates)') ); + // Ensure node_modules symlink so squads/ scripts can resolve framework dependencies + const projectNodeModules = path.join(context.projectRoot, 'node_modules'); + const frameworkNodeModules = path.join(targetCoreDir, 'node_modules'); + if (!fs.existsSync(projectNodeModules) && fs.existsSync(frameworkNodeModules)) { + try { + await fse.symlink( + path.relative(context.projectRoot, frameworkNodeModules), + projectNodeModules, + 'junction', + ); + console.log(chalk.green('✓') + ' node_modules linked to .aiox-core/node_modules'); + } catch (symlinkError) { + // Non-fatal: squads scripts will need explicit paths + console.log( + chalk.yellow('⚠') + + ' Could not create node_modules symlink: ' + + symlinkError.message, + ); + } + } + // Create installed manifest for brownfield upgrades (Story 6.18) if (brownfieldUpgrader) { try {