Linking Local AIWrapper Package
Purpose
When new features or fixes are added to the aiwrapper repository, you may want to test them in sila before publishing aiwrapper to npm. This workflow allows you to quickly link your local aiwrapper development version for testing.
How It Works
We use npm's link mechanism, which creates symlinks in node_modules instead of modifying package.json. This ensures:
- No accidental commits:
package.jsonremains unchanged, so you won't accidentally commit a local file path - Quick switching: Toggle between local and published versions with a single command
- Safe: The version in
package.jsonreflects what will be installed for others and in CI
Requirements
The aiwrapper repository must be located at the same directory level as sila. The scripts expect aiwrapper at ../aiwrapper relative to the sila repository root.
For example:
repos/
├── sila/
└── aiwrapper/
Platform Support
The linking scripts are bash scripts that work on:
- Linux - Full support
- macOS - Full support
- Windows - Requires Git Bash, WSL, or similar Unix-like environment
On Windows, you can also use the npm commands directly:
bash
# In Git Bash or WSL
cd ../aiwrapper && npm link
cd ../sila && npm link aiwrapper
Usage
bash
# Check current status (linked or published)
npm run aiwrapper:status
# Link to local aiwrapper package
npm run aiwrapper:link
# Test new features in sila...
# Switch back to published version
npm run aiwrapper:unlink
What Happens
When linking:
- The local
aiwrapperpackage is registered globally vianpm link - A symlink is created in
node_modules/aiwrapperpointing to your local package - The
"aiwrapper": "^3.0.0-beta.5"entry inpackages/core/package.jsonis ignored while the link is active - New features in your local
aiwrapperpackage are immediately available for testing (rebuild aiwrapper if it has a build step)
When unlinking:
- The symlink is removed
- The published version from npm is reinstalled according to
package.json - Normal npm dependency resolution resumes
Implementation
The scripts are located in scripts/:
scripts/link-aiwrapper-local.sh- Creates the linkscripts/unlink-aiwrapper-local.sh- Removes the link and reinstalls from npmscripts/check-aiwrapper-link.sh- Checks if currently linked to local version