✨ New Features: - sync-lockfile.sh: Auto-sync lock file with package.json changes - install-hooks.sh: Install git pre-commit hooks - ci-sync-lockfile.sh: CI/CD auto-fix for lock file issues - Pre-commit hook: Automatically runs on git commit - validate-lockfile.yml: GitHub Actions workflow for validation 📚 Documentation: - CONTRIBUTING.md: Complete contribution guide - scripts/README.md: Automation scripts documentation 🎯 Benefits: - Prevents "lock file out of sync" CI/CD failures - Automatic staging of lock file changes - Zero manual intervention needed - Works with any workflow (hooks, manual, CI/CD) 🔧 Usage: 1. Install hooks: ./scripts/install-hooks.sh 2. Add dependencies normally 3. Commit - hook auto-syncs lock file 4. CI validates automatically Resolves the recurring package-lock.json sync issues.
4.6 KiB
Contributing to RuVector
Thank you for your interest in contributing to RuVector!
Development Setup
1. Clone the Repository
git clone https://github.com/ruvnet/ruvector.git
cd ruvector
2. Install Dependencies
cd npm
npm install
3. Install Git Hooks (Recommended)
We provide git hooks that automatically keep package-lock.json in sync:
./scripts/install-hooks.sh
This will:
- Automatically run
npm installwhen you modifypackage.json - Stage the updated
package-lock.jsonautomatically - Prevent CI/CD failures due to lock file mismatches
Package Management
Adding Dependencies
When adding new dependencies to any package:
cd npm/packages/<package-name>
npm install <dependency>
Important: Always commit the updated package-lock.json with your changes!
Manual Lock File Sync
If you forget to sync the lock file, you can use our helper script:
./scripts/sync-lockfile.sh
Common Issues
CI/CD Fails with "Lock file out of sync"
Problem: npm ci fails with:
npm error `npm ci` can only install packages when your package.json and package-lock.json are in sync
Solution:
cd npm
npm install
git add package-lock.json
git commit -m "fix: Sync package-lock.json"
git push
Or use the automated script:
./scripts/sync-lockfile.sh
Pre-commit Hook Not Working
If the git hook isn't triggering:
# Reinstall hooks
./scripts/install-hooks.sh
# Verify hook is executable
ls -la .git/hooks/pre-commit
Development Workflow
-
Create a feature branch
git checkout -b feat/your-feature-name -
Make your changes
- Write code in the appropriate package
- Add tests for new features
- Update documentation
-
Build and test
cd npm npm run build npm test -
Commit your changes
git add . git commit -m "feat: Your descriptive commit message"The pre-commit hook will automatically sync the lock file if needed.
-
Push and create PR
git push origin feat/your-feature-name
Package Structure
ruvector/
├── npm/
│ ├── core/ # @ruvector/core - Native Rust bindings
│ ├── packages/
│ │ ├── ruvector/ # ruvector - Wrapper package
│ │ └── ruvector-extensions/ # ruvector-extensions - Feature extensions
│ └── package-lock.json # Workspace lock file
├── scripts/
│ ├── sync-lockfile.sh # Auto-sync lock file
│ ├── install-hooks.sh # Install git hooks
│ └── ci-sync-lockfile.sh # CI/CD lock file sync
└── .githooks/
└── pre-commit # Pre-commit hook script
Testing
Run All Tests
cd npm
npm test
Test Specific Package
cd npm/packages/ruvector-extensions
npm test
Manual Testing
cd npm/packages/ruvector-extensions/examples
tsx complete-integration.ts
Code Style
- TypeScript: Use strict mode, full type annotations
- Formatting: 2 spaces, semicolons, single quotes
- Comments: JSDoc for public APIs
- Naming: camelCase for variables/functions, PascalCase for classes
Commit Messages
Follow Conventional Commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesrefactor:- Code refactoringtest:- Test updateschore:- Build/tooling changes
Examples:
feat: Add OpenAI embeddings provider
fix: Resolve CommonJS export issue
docs: Update embeddings API documentation
chore: Sync package-lock.json
Pull Request Process
-
Ensure CI passes
- All tests pass
- Build succeeds
- No linting errors
-
Update documentation
- README.md if public API changes
- JSDoc comments for new functions
- CHANGELOG.md with notable changes
-
Describe your changes
- Clear PR title and description
- Reference related issues
- Include examples if applicable
-
Request review
- Maintainers will review within 48 hours
- Address feedback promptly
- Keep discussion focused and professional
Release Process
Releases are handled by maintainers:
- Version bump in package.json
- Update CHANGELOG.md
- Create git tag
- Publish to npm
- Create GitHub release
Questions?
- 📖 Check the documentation
- 🐛 Report bugs in Issues
- 💬 Ask questions in Discussions
License
By contributing, you agree that your contributions will be licensed under the MIT License.