* feat: introduce hindsight-api-slim and hindsight-all-slim packages Closes #552 - Move all source code from hindsight-api/ to new hindsight-api-slim/ - hindsight-api-slim has heavy ML deps (torch, sentence-transformers, transformers, einops, flashrank, mlx, mlx-lm, safetensors) and pg0-embedded as optional extras: [local-ml], [embedded-db], [all] - hindsight-api becomes a zero-code meta-package depending on hindsight-api-slim[all] for full backward compatibility - Add hindsight-all-slim meta-package: hindsight-api-slim + client + embed - hindsight-all updated to depend on hindsight-api-slim[all] - pg0.py: lazy-import pg0 with clear ImportError pointing to [embedded-db] - Dockerfile: replace sed hack with proper uv sync --extra flags - Update release.yml, test.yml, lint.sh, release.sh, CLAUDE.md and all path references throughout the repo * refactor: rename hindsight/ directory to hindsight-all/ * docs: document hindsight-api-slim and hindsight-all-slim package variants Add package variants table and extras explanation to installation.md * docs: remove emojis from installation.md, use professional tone * docs: link Docker slim variant to pip package variants section * docs: consolidate Docker image variants into single table * ci: fix working-directory paths after package restructure - Replace all hindsight-api → hindsight-api-slim in test.yml - Replace hindsight → hindsight-all in test.yml - Add --extra embedded-db to test-embed API install step * ci: add local-ml and embedded-db extras to API sync steps These extras were previously implicit in the old hindsight-api package (which bundled everything). Now that hindsight-api-slim uses optional extras, we must explicitly request local-ml and embedded-db in CI. * ci: add API install step with embedded-db to test-embed smoke test The smoke test starts hindsight-api as a daemon, which requires pg0-embedded. Add a dedicated install step for hindsight-api-slim with embedded-db extra so the daemon can start successfully. * ci: remove --no-install-project when using optional extras When --no-install-project is combined with --extra, the optional deps are not installed because extras require the project to be active. Remove --no-install-project from steps that need local-ml or embedded-db. * ci: fix ordering of uv sync steps to preserve optional extras When uv sync runs for a different workspace member, it removes optional extras installed for other members. Fix by always running extra-requiring API sync last, after other workspace member syncs. Also remove --no-install-project from embedded-db sync in test-embed, as --no-install-project prevents optional extras from being active. * ci: add local-ml extra to test-embed API install for smoke test The smoke test starts the full API server which needs sentence-transformers for local embeddings (default provider). Add local-ml extra to the install. * ci: simplify extras with --all-extras and add slim pip smoke test - Replace explicit --extra local-ml --extra embedded-db with --all-extras for cleaner, more maintainable sync steps - Add test-pip-slim job: tests hindsight-api-slim[embedded-db] without local ML models, using Cohere for embeddings/reranking (mirrors Docker slim smoke test approach) * ci: simplify slim smoke test to health check only (mirrors Docker test)
251 lines
7.9 KiB
Bash
Executable file
251 lines
7.9 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Function to print colored output
|
|
print_info() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_warn() {
|
|
echo -e "${YELLOW}[WARN]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
# Check if version is provided
|
|
if [ -z "$1" ]; then
|
|
print_error "Usage: $0 <version>"
|
|
print_info "Example: $0 0.2.0"
|
|
exit 1
|
|
fi
|
|
|
|
VERSION=$1
|
|
|
|
# Validate version format (semantic versioning)
|
|
if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
print_error "Invalid version format. Please use semantic versioning (e.g., 0.2.0)"
|
|
exit 1
|
|
fi
|
|
|
|
print_info "Starting release process for version $VERSION"
|
|
|
|
# Check if we're on main branch
|
|
CURRENT_BRANCH=$(git branch --show-current)
|
|
if [ "$CURRENT_BRANCH" != "main" ]; then
|
|
print_warn "You are not on the main branch (current: $CURRENT_BRANCH)"
|
|
read -p "Do you want to continue? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
print_error "Release cancelled"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Check if working directory is clean
|
|
if [[ -n $(git status -s) ]]; then
|
|
print_error "Working directory is not clean. Please commit or stash your changes."
|
|
git status -s
|
|
exit 1
|
|
fi
|
|
|
|
# Check if tag already exists
|
|
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
print_error "Tag v$VERSION already exists"
|
|
exit 1
|
|
fi
|
|
|
|
print_info "Updating version in all components..."
|
|
|
|
# Update Python packages
|
|
PYTHON_PACKAGES=("hindsight-api" "hindsight-api-slim" "hindsight-all-slim" "hindsight-dev" "hindsight-all" "hindsight-integrations/litellm" "hindsight-integrations/crewai" "hindsight-integrations/pydantic-ai" "hindsight-embed")
|
|
for package in "${PYTHON_PACKAGES[@]}"; do
|
|
PYPROJECT_FILE="$package/pyproject.toml"
|
|
if [ -f "$PYPROJECT_FILE" ]; then
|
|
print_info "Updating $PYPROJECT_FILE"
|
|
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" "$PYPROJECT_FILE"
|
|
rm "${PYPROJECT_FILE}.bak"
|
|
else
|
|
print_warn "File $PYPROJECT_FILE not found, skipping"
|
|
fi
|
|
done
|
|
|
|
# Update __version__ in Python __init__.py files
|
|
PYTHON_INIT_FILES=(
|
|
"hindsight-api-slim/hindsight_api/__init__.py"
|
|
"hindsight-embed/hindsight_embed/__init__.py"
|
|
"hindsight-clients/python/hindsight_client_api/__init__.py"
|
|
)
|
|
for init_file in "${PYTHON_INIT_FILES[@]}"; do
|
|
if [ -f "$init_file" ]; then
|
|
print_info "Updating __version__ in $init_file"
|
|
sed -i.bak "s/^__version__ = \".*\"/__version__ = \"$VERSION\"/" "$init_file"
|
|
rm "${init_file}.bak"
|
|
else
|
|
print_warn "File $init_file not found, skipping"
|
|
fi
|
|
done
|
|
|
|
# Update Rust CLI
|
|
CARGO_FILE="hindsight-cli/Cargo.toml"
|
|
if [ -f "$CARGO_FILE" ]; then
|
|
print_info "Updating $CARGO_FILE"
|
|
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" "$CARGO_FILE"
|
|
rm "${CARGO_FILE}.bak"
|
|
else
|
|
print_warn "File $CARGO_FILE not found, skipping"
|
|
fi
|
|
|
|
# Update Helm chart
|
|
HELM_CHART_FILE="helm/hindsight/Chart.yaml"
|
|
if [ -f "$HELM_CHART_FILE" ]; then
|
|
print_info "Updating $HELM_CHART_FILE"
|
|
sed -i.bak "s/^version: .*/version: $VERSION/" "$HELM_CHART_FILE"
|
|
sed -i.bak "s/^appVersion: .*/appVersion: \"$VERSION\"/" "$HELM_CHART_FILE"
|
|
rm "${HELM_CHART_FILE}.bak"
|
|
else
|
|
print_warn "File $HELM_CHART_FILE not found, skipping"
|
|
fi
|
|
|
|
# Update Control Plane package.json
|
|
CONTROL_PLANE_PKG="hindsight-control-plane/package.json"
|
|
if [ -f "$CONTROL_PLANE_PKG" ]; then
|
|
print_info "Updating $CONTROL_PLANE_PKG"
|
|
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$CONTROL_PLANE_PKG"
|
|
rm "${CONTROL_PLANE_PKG}.bak"
|
|
else
|
|
print_warn "File $CONTROL_PLANE_PKG not found, skipping"
|
|
fi
|
|
|
|
# Update Python API client
|
|
PYTHON_CLIENT_PKG="hindsight-clients/python/pyproject.toml"
|
|
if [ -f "$PYTHON_CLIENT_PKG" ]; then
|
|
print_info "Updating $PYTHON_CLIENT_PKG"
|
|
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" "$PYTHON_CLIENT_PKG"
|
|
rm "${PYTHON_CLIENT_PKG}.bak"
|
|
else
|
|
print_warn "File $PYTHON_CLIENT_PKG not found, skipping"
|
|
fi
|
|
|
|
# Update TypeScript API client
|
|
TYPESCRIPT_CLIENT_PKG="hindsight-clients/typescript/package.json"
|
|
if [ -f "$TYPESCRIPT_CLIENT_PKG" ]; then
|
|
print_info "Updating $TYPESCRIPT_CLIENT_PKG"
|
|
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$TYPESCRIPT_CLIENT_PKG"
|
|
rm "${TYPESCRIPT_CLIENT_PKG}.bak"
|
|
else
|
|
print_warn "File $TYPESCRIPT_CLIENT_PKG not found, skipping"
|
|
fi
|
|
|
|
# Update OpenClaw integration
|
|
OPENCLAW_PKG="hindsight-integrations/openclaw/package.json"
|
|
if [ -f "$OPENCLAW_PKG" ]; then
|
|
print_info "Updating $OPENCLAW_PKG"
|
|
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$OPENCLAW_PKG"
|
|
rm "${OPENCLAW_PKG}.bak"
|
|
else
|
|
print_warn "File $OPENCLAW_PKG not found, skipping"
|
|
fi
|
|
|
|
# Update AI SDK integration
|
|
AI_SDK_PKG="hindsight-integrations/ai-sdk/package.json"
|
|
if [ -f "$AI_SDK_PKG" ]; then
|
|
print_info "Updating $AI_SDK_PKG"
|
|
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$AI_SDK_PKG"
|
|
rm "${AI_SDK_PKG}.bak"
|
|
else
|
|
print_warn "File $AI_SDK_PKG not found, skipping"
|
|
fi
|
|
|
|
# Update Chat SDK integration
|
|
CHAT_SDK_PKG="hindsight-integrations/chat/package.json"
|
|
if [ -f "$CHAT_SDK_PKG" ]; then
|
|
print_info "Updating $CHAT_SDK_PKG"
|
|
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "$CHAT_SDK_PKG"
|
|
rm "${CHAT_SDK_PKG}.bak"
|
|
else
|
|
print_warn "File $CHAT_SDK_PKG not found, skipping"
|
|
fi
|
|
|
|
# Update documentation version (creates new version or syncs to existing)
|
|
print_info "Updating documentation for version $VERSION..."
|
|
if [ -f "scripts/update-docs-version.sh" ]; then
|
|
./scripts/update-docs-version.sh "$VERSION" 2>&1 | grep -E "✓|IMPORTANT|Error" || true
|
|
if [ ${PIPESTATUS[0]} -eq 0 ]; then
|
|
print_info "✓ Documentation updated"
|
|
else
|
|
print_warn "Failed to update documentation, but continuing..."
|
|
fi
|
|
else
|
|
print_warn "update-docs-version.sh not found, skipping docs update"
|
|
fi
|
|
|
|
# Regenerate OpenAPI spec and clients with new version
|
|
print_info "Regenerating OpenAPI spec and client SDKs..."
|
|
if ./scripts/generate-openapi.sh && ./scripts/generate-clients.sh; then
|
|
print_info "✓ OpenAPI spec and clients regenerated"
|
|
else
|
|
print_error "Failed to regenerate clients"
|
|
print_warn "You may need to fix this manually before committing"
|
|
read -p "Continue anyway? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
print_error "Release cancelled. Rolling back changes..."
|
|
git checkout .
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Commit changes
|
|
print_info "Committing version changes..."
|
|
git add -A
|
|
|
|
# Extract major.minor and patch for commit message
|
|
MAJOR_MINOR=$(echo "$VERSION" | sed -E 's/^([0-9]+\.[0-9]+)\.[0-9]+$/\1/')
|
|
PATCH_VERSION=$(echo "$VERSION" | sed -E 's/^[0-9]+\.[0-9]+\.([0-9]+)$/\1/')
|
|
|
|
# Build commit message
|
|
COMMIT_MSG="Release v$VERSION
|
|
|
|
- Update version to $VERSION in all components
|
|
- Regenerate OpenAPI spec and client SDKs
|
|
- Python packages: hindsight-api, hindsight-dev, hindsight-all, hindsight-litellm, hindsight-crewai, hindsight-pydantic-ai, hindsight-embed
|
|
- Python client: hindsight-clients/python
|
|
- TypeScript client: hindsight-clients/typescript
|
|
- Rust CLI: hindsight-cli
|
|
- Control Plane: hindsight-control-plane
|
|
- OpenClaw integration: hindsight-integrations/openclaw
|
|
- AI SDK integration: hindsight-integrations/ai-sdk
|
|
- Chat SDK integration: hindsight-integrations/chat
|
|
- Helm chart"
|
|
|
|
# Add docs update note
|
|
if [ "$PATCH_VERSION" != "0" ]; then
|
|
COMMIT_MSG="$COMMIT_MSG
|
|
- Sync documentation to version-$MAJOR_MINOR"
|
|
else
|
|
COMMIT_MSG="$COMMIT_MSG
|
|
- Create documentation version-$MAJOR_MINOR"
|
|
fi
|
|
|
|
git commit --no-verify -m "$COMMIT_MSG"
|
|
|
|
# Create tag
|
|
print_info "Creating tag v$VERSION..."
|
|
git tag -a "v$VERSION" -m "Release v$VERSION"
|
|
|
|
# Push changes
|
|
print_info "Pushing changes and tag to remote..."
|
|
git push origin "$CURRENT_BRANCH"
|
|
git push origin "v$VERSION"
|
|
|
|
print_info "✅ Release v$VERSION completed successfully!"
|
|
print_info "GitHub Actions will now build the release artifacts."
|
|
print_info "Tag: v$VERSION"
|