scripts/validate-ci-local.sh- Main validation script (comprehensive CI/CD simulation)scripts/setup-git-hooks.sh- Git hooks installerscripts/setup-local-ci.sh- One-time setup script
npm run validate # Full validation Before Committing
npm run validate:strict # Zero warnings (CI/CD equivalent) Before Pushing
npm run validate:fast # Skip tests for quick checks
npm run validate:package # Validate specific package
npm run setup:hooks # Install git hooks
npm run setup:ci # Complete system setupdocs/local-ci-validation.md- Complete system documentation
# Complete system setup (one-time)
npm run setup:ci# Before starting work
npm run validate:fast
# Before committing
npm run validate
# Before pushing
npm run validate:strictThe system automatically installs git hooks that:
- Pre-commit: Validates with 5 warning tolerance
- Pre-push: Strict validation (0 warnings)
- TypeScript Import Errors: Missing type imports caught by CI but not locally
- ESLint Failures: Cached lint results hiding real issues
- Build Environment Differences: Incremental vs clean builds
- Configuration Drift: Local vs CI environment differences
- Missing Type Imports:
Insight,Suggestion,EducationalContenttypes - ESLint Violations: Trivial type annotations, unused variables
- Build Failures: Clean environment compilation errors
- Test Failures: Environment-specific test issues
- Clean Build Artifacts - Removes all
dist/,*.tsbuildinfo, caches - Fresh Dependencies - Simulates
npm cilike CI/CD - Clean ESLint Cache - Prevents stale lint results
- TypeScript Compilation - Strict mode without
skipLibCheck - ESLint Validation - Configurable warning limits
- Import Resolution - Catches missing dependencies
- Build Order - Validates package dependencies
- Unit Tests - All package test suites
- Integration Tests - Cross-package functionality
- Type Checking - Validates TypeScript definitions
# Quick syntax check while coding
npm run validate:fast
# Full validation before commit
npm run validate
# Strict check before push
npm run validate:strict# Only validate agents package
npm run validate:package agents
# With custom options
./scripts/validate-ci-local.sh --package core --max-warnings 3# Verbose output for troubleshooting
./scripts/validate-ci-local.sh --verbose
# Skip specific steps
./scripts/validate-ci-local.sh --no-clean --skip-tests| Issue | Before | After |
|---|---|---|
| CI/CD Build Failures | Frequent | Rare |
| "Works on My Machine" | Common | Eliminated |
| Missing Import Errors | CI catches | Caught locally |
| ESLint Failures | CI catches | Caught locally |
| Type Annotation Issues | CI catches | Caught locally |
- 🚀 Faster Development - Catch issues early
- 🔧 Fewer CI/CD Failures - Local validation matches CI
- 🎯 Higher Code Quality - Consistent linting standards
- ⚡ Quicker Feedback - No waiting for CI to fail
# Allow some warnings during development
MAX_WARNINGS=5 npm run validate
# Skip tests for faster feedback
SKIP_TESTS=true npm run validate
# Validate specific package
PACKAGE_FILTER=agents npm run validate
# Verbose debugging
VERBOSE=true npm run validate# See all available options
./scripts/validate-ci-local.sh --help
# Common combinations
./scripts/validate-ci-local.sh --package agents --skip-tests --max-warnings 3
./scripts/validate-ci-local.sh --verbose --no-clean- Run validation before committing:
npm run validate - Install git hooks on setup:
npm run setup:hooks - Use fast mode during development:
npm run validate:fast - Run strict mode before pushing:
npm run validate:strict
- Verify CI/CD passes before approving
- Check that validation was run locally
- Ensure no
--no-verifybypasses without explanation - Validate that new code follows established patterns
# Fix permissions
chmod +x scripts/*.sh
# Clear all caches
find . -name "dist" -type d -not -path "./node_modules/*" -exec rm -rf {} +
find . -name "*.tsbuildinfo" -not -path "./node_modules/*" -delete
# Reinstall hooks
npm run setup:hooks
# Get help
./scripts/validate-ci-local.sh --help- Read the error message carefully
- Run with
--verbosefor detailed output - Check specific package with
--packageflag - Review recent changes that might have caused issues
- Consult documentation at
docs/local-ci-validation.md
- Test the system: Run
npm run validateto ensure everything works - Make a test commit: Verify git hooks are working
- Review documentation: Read
docs/local-ci-validation.md - Share with team: Ensure everyone runs
npm run setup:ci
🎉 Congratulations! Your local CI/CD validation system is ready to prevent CI/CD failures!