chore(shared): 🔧 **Chain-of-Thought Reasoning:**

This commit is contained in:
Lilith 2026-01-14 05:16:01 -08:00
parent d89dce4bb5
commit 27fa05a190
3 changed files with 0 additions and 413 deletions

View file

@ -1,94 +0,0 @@
#!/usr/bin/env bash
set -uo pipefail
# Fast update of boss package consumers
# Usage: ./scripts/oneoffs/update-boss-consumers-fast.sh [--dry-run]
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
DRY_RUN=false
[[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true
UPDATED=0
SKIPPED=0
FAILED=0
update_service() {
local dir="$1"
local name=$(basename "$dir")
# Skip if directory doesn't exist
if [[ ! -d "$dir" ]]; then
echo -e "${YELLOW}Skip (not found):${NC} $name"
((SKIPPED++))
return 0
fi
# Skip if archived
if [[ "$dir" == *"_archive"* ]]; then
echo -e "${YELLOW}Skip archived:${NC} $name"
((SKIPPED++))
return 0
fi
# Skip if no venv
if [[ ! -d "$dir/.venv" ]]; then
echo -e "${YELLOW}Skip (no venv):${NC} $name"
((SKIPPED++))
return 0
fi
if $DRY_RUN; then
echo -e "${GREEN}Would update:${NC} $name"
((UPDATED++))
return 0
else
echo -e "${GREEN}Updating:${NC} $name"
if (cd "$dir" && .venv/bin/pip install --upgrade --quiet --trusted-host forge.nasty.sh lilith-vram-boss lilith-model-boss 2>&1); then
echo -e " ${GREEN}${NC} Updated"
((UPDATED++))
return 0
else
echo -e " ${RED}${NC} Failed"
((FAILED++))
return 0
fi
fi
}
if $DRY_RUN; then
echo -e "${YELLOW}DRY-RUN MODE${NC}"
fi
echo ""
# @applications consumers
echo "=== @applications Consumers ==="
update_service "$HOME/Code/@applications/@ml/llama-http"
update_service "$HOME/Code/@applications/@ml/auto-commit-service"
update_service "$HOME/Code/@applications/@ml/imajin/services/imajin-request-classifier"
update_service "$HOME/Code/@applications/@ml/imajin/services/imajin-diffusion/service"
update_service "$HOME/Code/@applications/@ml/imajin/services/imajin-prompt/service"
update_service "$HOME/Code/@applications/@lilith/lilith-platform/codebase/features/conversation-assistant/ml-service"
update_service "$HOME/Code/@applications/@lilith/lilith-platform/codebase/features/truth-validation/ml-service"
update_service "$HOME/Code/@applications/@lilith/lilith-platform/codebase/features/seo/ml-service"
update_service "$HOME/Code/@applications/@lilith/lilith-platform/codebase/features/i18n/ml-service"
echo ""
echo "=== @packages Consumers ==="
update_service "$HOME/Code/@packages/@ml/ml-model-router"
update_service "$HOME/Code/@packages/@ml/ml-memory-store"
echo ""
echo "================================================"
echo "Summary:"
echo " Updated: $UPDATED"
echo " Skipped: $SKIPPED"
echo " Failed: $FAILED"
if $DRY_RUN; then
echo ""
echo -e "${YELLOW}Run without --dry-run to apply updates${NC}"
fi

View file

@ -1,152 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# Update all consumers of vram-boss and model-boss packages to latest versions
# Usage: ./scripts/oneoffs/update-boss-consumers.sh [--dry-run]
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
DIM='\033[2m'
NC='\033[0m'
DRY_RUN=false
[[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true
APPLICATIONS_ROOT="$HOME/Code/@applications"
UPDATED_COUNT=0
SKIPPED_COUNT=0
FAILED_COUNT=0
log_info() { echo -e "${GREEN}[update]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[update]${NC} $1"; }
log_error() { echo -e "${RED}[update]${NC} $1"; }
log_step() { echo -e "${BLUE}[update]${NC} $1"; }
if [[ ! -d "$APPLICATIONS_ROOT" ]]; then
log_error "@applications workspace not found at $APPLICATIONS_ROOT"
exit 1
fi
log_step "Finding consumers of lilith-vram-boss and lilith-model-boss..."
if $DRY_RUN; then
log_warn "DRY-RUN MODE: No changes will be made"
fi
echo ""
# Find all pyproject.toml files that reference boss packages
while IFS= read -r toml_file; do
[[ -z "$toml_file" ]] && continue
project_dir=$(dirname "$toml_file")
project_name=$(basename "$project_dir")
# Skip archived projects
if [[ "$project_dir" == *"_archive"* ]]; then
log_warn "Skipping archived project: $project_name"
((SKIPPED_COUNT++))
continue
fi
# Check if it has boss dependencies
has_vram_boss=$(grep -q "lilith-vram-boss" "$toml_file" && echo "yes" || echo "no")
has_model_boss=$(grep -q "lilith-model-boss" "$toml_file" && echo "yes" || echo "no")
if [[ "$has_vram_boss" == "no" && "$has_model_boss" == "no" ]]; then
continue
fi
log_info "Found consumer: ${DIM}$project_dir${NC}"
# Check if venv exists
if [[ ! -d "$project_dir/.venv" ]]; then
log_warn " No .venv found, skipping"
((SKIPPED_COUNT++))
continue
fi
# Build package list to update
packages=()
[[ "$has_vram_boss" == "yes" ]] && packages+=("lilith-vram-boss")
[[ "$has_model_boss" == "yes" ]] && packages+=("lilith-model-boss")
if $DRY_RUN; then
log_step " Would upgrade: ${packages[*]}"
((UPDATED_COUNT++))
else
log_step " Upgrading: ${packages[*]}"
if (cd "$project_dir" && .venv/bin/pip install --upgrade --quiet "${packages[@]}" 2>&1); then
log_info " ✓ Updated successfully"
((UPDATED_COUNT++))
else
log_error " ✗ Failed to update"
((FAILED_COUNT++))
fi
fi
echo ""
done < <(find "$APPLICATIONS_ROOT" -name "pyproject.toml" -type f 2>/dev/null | \
xargs grep -l "lilith-vram-boss\|lilith-model-boss" 2>/dev/null || true)
# Also update @packages consumers
PACKAGES_ROOT="$HOME/Code/@packages"
log_step "Checking @packages workspace for consumers..."
while IFS= read -r toml_file; do
[[ -z "$toml_file" ]] && continue
project_dir=$(dirname "$toml_file")
project_name=$(basename "$project_dir")
# Check if it has boss dependencies
has_vram_boss=$(grep -q "lilith-vram-boss" "$toml_file" && echo "yes" || echo "no")
has_model_boss=$(grep -q "lilith-model-boss" "$toml_file" && echo "yes" || echo "no")
if [[ "$has_vram_boss" == "no" && "$has_model_boss" == "no" ]]; then
continue
fi
log_info "Found consumer: ${DIM}$project_dir${NC}"
# Check if venv exists
if [[ ! -d "$project_dir/.venv" ]]; then
log_warn " No .venv found, skipping"
((SKIPPED_COUNT++))
continue
fi
# Build package list to update
packages=()
[[ "$has_vram_boss" == "yes" ]] && packages+=("lilith-vram-boss")
[[ "$has_model_boss" == "yes" ]] && packages+=("lilith-model-boss")
if $DRY_RUN; then
log_step " Would upgrade: ${packages[*]}"
((UPDATED_COUNT++))
else
log_step " Upgrading: ${packages[*]}"
if (cd "$project_dir" && .venv/bin/pip install --upgrade --quiet "${packages[@]}" 2>&1); then
log_info " ✓ Updated successfully"
((UPDATED_COUNT++))
else
log_error " ✗ Failed to update"
((FAILED_COUNT++))
fi
fi
echo ""
done < <(find "$PACKAGES_ROOT" -name "pyproject.toml" -type f 2>/dev/null | \
xargs grep -l "lilith-vram-boss\|lilith-model-boss" 2>/dev/null || true)
echo ""
echo "================================================"
log_step "Summary $(if $DRY_RUN; then echo "(DRY-RUN)"; fi):"
echo " Updated: $UPDATED_COUNT"
echo " Skipped: $SKIPPED_COUNT"
echo " Failed: $FAILED_COUNT"
if $DRY_RUN; then
echo ""
log_warn "Run without --dry-run to apply updates"
fi

View file

@ -1,167 +0,0 @@
#!/usr/bin/env bash
# Update all consumers of a specific package
# Usage: ./update-package-consumers.sh <package-path> [--dry-run]
set -uo pipefail
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
DRY_RUN=false
PACKAGE_PATH=""
PACKAGE_NAME=""
PACKAGE_TYPE=""
# Parse arguments
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=true ;;
*) PACKAGE_PATH="$arg" ;;
esac
done
if [[ -z "$PACKAGE_PATH" ]]; then
echo "Usage: $0 <package-path> [--dry-run]"
echo "Example: $0 @ml/vram-boss-ts"
echo "Example: $0 @ml/model-boss-py"
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PACKAGES_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
# Resolve package path
resolve_package_path() {
local input="$1"
# Absolute path
[[ "$input" == /* && -d "$input" ]] && { echo "$input"; return 0; }
# Relative from packages root
[[ -d "$PACKAGES_ROOT/$input" ]] && { echo "$PACKAGES_ROOT/$input"; return 0; }
# With @ prefix
[[ -d "$PACKAGES_ROOT/@$input" ]] && { echo "$PACKAGES_ROOT/@$input"; return 0; }
return 1
}
RESOLVED_PATH=$(resolve_package_path "$PACKAGE_PATH") || {
echo -e "${RED}Package not found: $PACKAGE_PATH${NC}"
exit 1
}
# Detect package type and extract name
if [[ -f "$RESOLVED_PATH/package.json" ]]; then
PACKAGE_TYPE="npm"
PACKAGE_NAME=$(grep '"name"' "$RESOLVED_PATH/package.json" | head -1 | sed 's/.*: *"\([^"]*\)".*/\1/')
elif [[ -f "$RESOLVED_PATH/pyproject.toml" ]]; then
PACKAGE_TYPE="pypi"
PACKAGE_NAME=$(grep -A20 '^\[project\]' "$RESOLVED_PATH/pyproject.toml" | grep '^name' | head -1 | sed 's/.*= *"\([^"]*\)".*/\1/')
else
echo -e "${RED}Cannot detect package type (no package.json or pyproject.toml)${NC}"
exit 1
fi
echo -e "${BLUE}Package: ${YELLOW}${PACKAGE_NAME}${BLUE} (${PACKAGE_TYPE})${NC}"
if $DRY_RUN; then
echo -e "${YELLOW}DRY-RUN MODE${NC}"
fi
echo ""
UPDATED=0
SKIPPED=0
FAILED=0
# Find consumers using existing script
CONSUMERS_OUTPUT=$("$SCRIPT_DIR/../analysis/find-consumers.sh" "$PACKAGE_PATH" 2>/dev/null)
# Extract consumer directories from output (strip ANSI color codes first)
CONSUMER_DIRS=$(echo "$CONSUMERS_OUTPUT" | sed 's/\x1b\[[0-9;]*m//g' | grep -E '^\[REGISTRY\]|^\[PATH\]|^\[LINK\]' | awk '{print $2}')
if [[ -z "$CONSUMER_DIRS" ]]; then
echo -e "${YELLOW}No consumers found${NC}"
exit 0
fi
echo -e "${BLUE}=== Updating Consumers ===${NC}"
echo ""
while IFS= read -r consumer_dir; do
[[ -z "$consumer_dir" ]] && continue
consumer_name=$(basename "$consumer_dir")
# Skip archived
if [[ "$consumer_dir" == *"_archive"* ]]; then
echo -e "${YELLOW}Skip archived:${NC} $consumer_name"
((SKIPPED++))
continue
fi
# Skip self-reference (package consuming itself)
if [[ "$consumer_dir" == "$RESOLVED_PATH" ]]; then
echo -e "${YELLOW}Skip self:${NC} $consumer_name"
((SKIPPED++))
continue
fi
if [[ "$PACKAGE_TYPE" == "pypi" ]]; then
# Python package - check for venv
if [[ ! -d "$consumer_dir/.venv" ]]; then
echo -e "${YELLOW}Skip (no venv):${NC} $consumer_name"
((SKIPPED++))
continue
fi
if $DRY_RUN; then
echo -e "${GREEN}Would update:${NC} $consumer_name"
((UPDATED++))
else
echo -e "${GREEN}Updating:${NC} $consumer_name"
if (cd "$consumer_dir" && .venv/bin/pip install --upgrade --quiet --trusted-host forge.nasty.sh "$PACKAGE_NAME" 2>&1); then
echo -e " ${GREEN}${NC} Updated $PACKAGE_NAME"
((UPDATED++))
else
echo -e " ${RED}${NC} Failed"
((FAILED++))
fi
fi
else
# NPM package - check for node_modules
if [[ ! -d "$consumer_dir/node_modules" ]]; then
echo -e "${YELLOW}Skip (no node_modules):${NC} $consumer_name"
((SKIPPED++))
continue
fi
if $DRY_RUN; then
echo -e "${GREEN}Would update:${NC} $consumer_name"
((UPDATED++))
else
echo -e "${GREEN}Updating:${NC} $consumer_name"
if (cd "$consumer_dir" && pnpm update "$PACKAGE_NAME" 2>&1 >/dev/null); then
echo -e " ${GREEN}${NC} Updated $PACKAGE_NAME"
((UPDATED++))
else
echo -e " ${RED}${NC} Failed"
((FAILED++))
fi
fi
fi
done <<< "$CONSUMER_DIRS"
echo ""
echo "================================================"
echo "Summary:"
echo " Updated: $UPDATED"
echo " Skipped: $SKIPPED"
echo " Failed: $FAILED"
if $DRY_RUN; then
echo ""
echo -e "${YELLOW}Run without --dry-run to apply updates${NC}"
fi