Files
pentagi/scripts/generate-licenses.sh
Dmitry Ng 600419bed3 feat: add license compliance documentation and reporting tools
- Introduce CONTRIBUTING.md for license compliance guidelines for developers.
- Update Dockerfile to generate license reports for frontend and backend dependencies.
- Add scripts for generating license reports and include them in the Docker build process.
- Create README.md and .gitignore files in the licenses directory for better organization.
- Update go.mod and go.sum to use the latest versions of vxcontrol dependencies.

This enhances the project's compliance with licensing requirements and improves dependency management.
2026-03-29 18:48:06 +03:00

51 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#
# Generate license reports for PentAGI dependencies
#
set -e
cd "$(dirname "$0")/.."
LICENSES_DIR="./licenses"
mkdir -p "$LICENSES_DIR"
echo "Generating license reports..."
# Backend (Go)
echo "→ Backend..."
cd backend
# Generate module list
go list -m all > "../$LICENSES_DIR/backend-dependencies.txt"
# Generate detailed license report using go-licenses
if command -v go-licenses &> /dev/null; then
echo " Generating detailed license report with go-licenses..."
GOROOT=$(go env GOROOT) GOTOOLCHAIN=auto go-licenses csv ./cmd/pentagi > "../$LICENSES_DIR/backend-licenses.csv" 2>/dev/null || {
echo " go-licenses failed, install it with: go install github.com/google/go-licenses@latest"
}
else
echo " go-licenses not found, install it with: go install github.com/google/go-licenses@latest"
fi
cd ..
# Frontend (npm)
echo "→ Frontend..."
cd frontend
if [ -d "node_modules" ]; then
npm ls --production --json > "../$LICENSES_DIR/frontend-dependencies.json" 2>/dev/null || true
if command -v license-checker &> /dev/null; then
license-checker --production --json > "../$LICENSES_DIR/frontend-licenses.json" 2>/dev/null || true
license-checker --production --csv > "../$LICENSES_DIR/frontend-licenses.csv" 2>/dev/null || true
fi
else
echo " Run 'npm ci' in frontend/ for detailed reports"
fi
cd ..
echo "Done! Reports saved in: $LICENSES_DIR/"
ls -1 "$LICENSES_DIR/" | grep -v -E "(README|gitignore)" | sed 's/^/ - /'