Skip to content

fix: symlink node_modules so squad scripts can resolve framework deps#624

Open
andersnsouza wants to merge 2 commits intoSynkraAI:mainfrom
andersnsouza:fix/squad-scripts-js-yaml-resolution
Open

fix: symlink node_modules so squad scripts can resolve framework deps#624
andersnsouza wants to merge 2 commits intoSynkraAI:mainfrom
andersnsouza:fix/squad-scripts-js-yaml-resolution

Conversation

@andersnsouza
Copy link
Copy Markdown

@andersnsouza andersnsouza commented Apr 11, 2026

Summary

  • Scripts in squads/ (e.g. squad-creator-pro) fail with Cannot find module 'js-yaml' because node_modules only exists inside .aiox-core/
  • Node.js module resolution walks up from squads/.../scripts/ to the project root and never finds js-yaml
  • This fix creates a symlink <project>/node_modules.aiox-core/node_modules/ during aiox init, so standard require() calls work from any directory in the project tree

Root Cause

aiox-init.js creates a package.json at the project root but never installs dependencies or links to .aiox-core/node_modules/. Any script outside .aiox-core/ that does require('js-yaml') (or any other framework dependency) fails.

Error Reproduced

Error: Cannot find module 'js-yaml'
Require stack:
- squads/squad-creator-pro/scripts/generate-squad-greeting.js

Fix

After package.json creation in checkPrerequisites(), add a symlink step:

  • If <project>/node_modules doesn't exist AND .aiox-core/node_modules exists
  • Create a symlink (junction on Windows) pointing to the framework's node_modules
  • Non-fatal: if symlink fails, just warn (scripts can still use explicit relative paths)

Test plan

  • Run aiox init on a fresh project — verify symlink is created
  • Run node squads/squad-creator-pro/scripts/generate-squad-greeting.js — verify no Cannot find module error
  • Run aiox init on existing project with node_modules/ — verify symlink is skipped (no overwrite)
  • Verify framework scripts in .aiox-core/ still work normally

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Installer now ensures project can access framework dependencies automatically by linking to existing bundled modules when needed.
    • Provides a clear success message when linking completes and a non-blocking warning with details if linking fails, allowing installation to continue.

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) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 11, 2026

@andersnsouza is attempting to deploy a commit to the SINKRA - AIOX Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added area: agents Agent system related area: workflows Workflow system related squad mcp type: test Test coverage and quality area: core Core framework (.aios-core/core/) area: installer Installer and setup (packages/installer/) area: synapse SYNAPSE context engine area: cli CLI tools (bin/, packages/aios-pro-cli/) area: pro Pro features (pro/) area: health-check Health check system area: docs Documentation (docs/) area: devops CI/CD, GitHub Actions (.github/) labels Apr 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00c93bd1-2dea-4708-94a4-c9378844532c

📥 Commits

Reviewing files that changed from the base of the PR and between e32fb85 and 72ae3e7.

📒 Files selected for processing (1)
  • bin/aiox-init.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • bin/aiox-init.js

Walkthrough

Added a post-package.json step in the init script that, when the project root lacks node_modules but .aiox-core/node_modules exists, attempts to create a junction symlink from the project root node_modules to .aiox-core/node_modules. Symlink success is logged; failures are logged as non-fatal warnings.

Changes

Cohort / File(s) Summary
Installer Setup Enhancement
bin/aiox-init.js
Added logic after copying AIOX core to conditionally create a node_modules junction symlink from the project root to .aiox-core/node_modules, with success (green) logging and non-fatal warning logging on error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

area: installer, area: core, area: cli, squad

Suggested reviewers

  • oalanicolas
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: creating a symlink for node_modules to enable squad scripts to resolve framework dependencies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to aiox-core! Thanks for your first pull request.

What happens next?

  1. Automated checks will run on your PR
  2. A maintainer will review your changes
  3. Once approved, we'll merge your contribution!

PR Checklist:

Thanks for contributing!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bin/aiox-init.js`:
- Around line 178-197: The symlink creation checks frameworkNodeModules (vars:
projectNodeModules, frameworkNodeModules) before the framework files are copied,
so fresh installs never create the link; move the entire symlink block to run
immediately after the core is copied (i.e., after the fse.copy(sourceCoreDir,
targetCoreDir) operation completes) so .aiox-core/node_modules exists when you
create the junction and keep the same try/catch logging behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3f96499f-1770-49e6-a510-37c9c5a718ca

📥 Commits

Reviewing files that changed from the base of the PR and between 0df1e25 and e32fb85.

📒 Files selected for processing (1)
  • bin/aiox-init.js

Comment thread bin/aiox-init.js Outdated
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) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: cli CLI tools (bin/, packages/aios-pro-cli/) area: core Core framework (.aios-core/core/) area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/) area: health-check Health check system area: installer Installer and setup (packages/installer/) area: pro Pro features (pro/) area: synapse SYNAPSE context engine area: workflows Workflow system related mcp squad type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants