ruvector/scripts/validate-packages-simple.sh
Claude 3be7020c23 feat: Prepare packages for npm publishing with comprehensive validation
Package 1: @ruvector/psycho-symbolic-integration
- Add npm publishing metadata (repository, bugs, homepage, publishConfig)
- Include LICENSE file
- Create .npmignore for clean package distribution
- Configure files array for selective publishing
- Package size: 9.3 KB tarball, 32.7 KB unpacked (6 files)

Package 2: @ruvector/psycho-synth-examples
- Add npm publishing metadata with bin entries
- Include LICENSE file
- Create .npmignore for clean package distribution
- Configure files array (dist, bin, examples, src, README, LICENSE)
- Package size: 26.9 KB tarball, 112.7 KB unpacked (11 files)
- CLI binaries: psycho-synth-examples, pse (short alias)

Validation & Documentation:
- Create comprehensive PUBLISHING-GUIDE.md with step-by-step instructions
- Create detailed PACKAGE-VALIDATION-REPORT.md with all validation results
- Add validation scripts (validate-packages.sh, validate-packages-simple.sh)
- Verify npm pack --dry-run for both packages
- Test CLI functionality (list command working)

Publishing Status:
 All metadata complete
 Documentation comprehensive
 LICENSE files included
 .npmignore configured
 npm pack validation passed
 CLI tested and working
 READY FOR PUBLISHING

Next Steps:
1. npm login
2. npm publish --access public (both packages)
3. Verify with npm view and npx commands
2025-11-23 04:44:45 +00:00

100 lines
4.5 KiB
Bash
Executable file

#!/bin/bash
# Pre-publish validation script for ruvector packages (without jq dependency)
set -e
echo "🔍 Validating ruvector packages for npm publishing..."
echo ""
PASSED=0
FAILED=0
WARNINGS=0
pass() { echo "$1"; ((PASSED++)); }
fail() { echo "$1"; ((FAILED++)); }
warn() { echo "$1"; ((WARNINGS++)); }
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " @ruvector/psycho-symbolic-integration"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
cd packages/psycho-symbolic-integration
[ -f "package.json" ] && pass "package.json exists" || fail "package.json missing"
[ -f "README.md" ] && pass "README.md exists" || fail "README.md missing"
[ -f "LICENSE" ] && pass "LICENSE exists" || warn "LICENSE missing"
[ -f ".npmignore" ] && pass ".npmignore exists" || warn ".npmignore missing"
[ -f "tsconfig.json" ] && pass "tsconfig.json exists" || warn "tsconfig.json missing"
[ -d "src" ] && pass "src/ directory exists" || fail "src/ directory missing"
[ -d "node_modules" ] && pass "dependencies installed" || warn "run npm install first"
grep -q '"name":' package.json && pass "name field exists" || fail "name field missing"
grep -q '"version":' package.json && pass "version field exists" || fail "version field missing"
grep -q '"description":' package.json && pass "description field exists" || fail "description field missing"
grep -q '"repository":' package.json && pass "repository field exists" || warn "repository field missing"
grep -q '"publishConfig":' package.json && pass "publishConfig exists" || warn "publishConfig missing"
cd ../..
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " @ruvector/psycho-synth-examples"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
cd packages/psycho-synth-examples
[ -f "package.json" ] && pass "package.json exists" || fail "package.json missing"
[ -f "README.md" ] && pass "README.md exists" || fail "README.md missing"
[ -f "LICENSE" ] && pass "LICENSE exists" || warn "LICENSE missing"
[ -f ".npmignore" ] && pass ".npmignore exists" || warn ".npmignore missing"
[ -f "tsconfig.json" ] && pass "tsconfig.json exists" || warn "tsconfig.json missing"
[ -d "src" ] && pass "src/ directory exists" || fail "src/ directory missing"
[ -d "bin" ] && pass "bin/ directory exists" || fail "bin/ directory missing"
[ -d "examples" ] && pass "examples/ directory exists" || fail "examples/ directory missing"
[ -d "node_modules" ] && pass "dependencies installed" || warn "run npm install first"
[ -f "bin/cli.js" ] && pass "CLI file exists" || fail "CLI file missing"
[ -x "bin/cli.js" ] && pass "CLI is executable" || warn "CLI not executable"
if head -1 bin/cli.js | grep -q "^#!/usr/bin/env node"; then
pass "CLI has correct shebang"
else
fail "CLI missing shebang"
fi
grep -q '"name":' package.json && pass "name field exists" || fail "name field missing"
grep -q '"version":' package.json && pass "version field exists" || fail "version field missing"
grep -q '"bin":' package.json && pass "bin field exists" || fail "bin field missing"
grep -q '"repository":' package.json && pass "repository field exists" || warn "repository field missing"
grep -q '"publishConfig":' package.json && pass "publishConfig exists" || warn "publishConfig missing"
# Test CLI
echo ""
if node bin/cli.js list > /dev/null 2>&1; then
pass "CLI 'list' command works"
else
fail "CLI 'list' command failed"
fi
cd ../..
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Summary"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Passed: $PASSED"
echo "Warnings: $WARNINGS"
echo "Failed: $FAILED"
echo ""
if [ $FAILED -gt 0 ]; then
echo "❌ Validation failed with $FAILED errors"
exit 1
elif [ $WARNINGS -gt 0 ]; then
echo "⚠️ Validation passed with $WARNINGS warnings"
exit 0
else
echo "✅ All validations passed!"
exit 0
fi