| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- ## @id update-chattolib
- ## @name Update Chattolib
- ## @description Performs a full vendor refresh of chattolib: downloads the newest (or specified) version, refreshes vendor/, updates docs, and verifies.
- ## @usage update-chattolib [SPEC]
- ## e.g.: `update-chattolib "chattolib[realtime]==0.5.0b4"`
- ## `update-chattolib` (uses CHATTOLIB_SPEC from vendor_chattolib.sh)
- ##
- ## This skill wraps the steps from vendor_chattolib.sh + AGENTS.md
- ## so that no vendor files are ever edited manually.
- # --- Configuration ---
- # PLUGIN_DIR is the project root (set by opencode/Paseo)
- PLUGIN_DIR="${PROJECT_DIR:-.}"
- SPEC="${1:-}"
- # --- Execution ---
- # 1. Determine the SPEC value
- if [ -z "$SPEC" ]; then
- SPEC=$(grep 'CHATTOLIB_SPEC=' "$PLUGIN_DIR/vendor_chattolib.sh" | head -1 | sed 's/.*CHATTOLIB_SPEC="\([^"]*\)".*/\1/')
- echo "🔍 No SPEC given — using: $SPEC"
- else
- echo "🔧 Using specified SPEC: $SPEC"
- fi
- # 2. Determine the new version number (for docs)
- VERSION=$(echo "$SPEC" | sed -n 's/.*==\([0-9][^ ]*\).*/\1/p' || true)
- if [ -z "$VERSION" ]; then
- VERSION=$(echo "$SPEC" | sed -n 's/.*>= \([0-9][^ ]*\).*/\1/p' || true)
- if [ -z "$VERSION" ]; then
- VERSION="latest"
- fi
- fi
- echo "📦 New chattolib version: $VERSION"
- # 3. Run the vendor refresh
- echo "🔄 Starting vendor refresh..."
- cd "$PLUGIN_DIR"
- if [ -n "$SPEC" ]; then
- CHATTOLIB_SPEC="$SPEC" ./vendor_chattolib.sh
- else
- ./vendor_chattolib.sh
- fi
- # 4. Update docs (version in AGENTS.md + README.md)
- echo "📝 Updating version in docs..."
- # AGENTS.md
- OLD_VER=$(grep -o '0\.5\.0[^ ]*\.post[0-9]' "$PLUGIN_DIR/AGENTS.md" | head -1)
- if [ -n "$OLD_VER" ]; then
- sed -i "s/chattolib\[realtime\] $OLD_VER/chattolib[realtime] $VERSION/g" "$PLUGIN_DIR/AGENTS.md"
- echo " AGENTS.md: $OLD_VER → $VERSION"
- fi
- # README.md
- OLD_VER=$(grep -o '0\.5\.0[^ ]*\.post[0-9]' "$PLUGIN_DIR/README.md" | head -1)
- if [ -n "$OLD_VER" ]; then
- sed -i "s/chattolib\[realtime\] $OLD_VER/chattolib[realtime] $VERSION/g" "$PLUGIN_DIR/README.md"
- echo " README.md: $OLD_VER → $VERSION"
- fi
- # 5. Check lint + typecheck
- echo "🔍 Lint & typecheck..."
- cd "$PLUGIN_DIR"
- uv run ruff check . 2>&1 | tail -1
- uv run ruff format . 2>&1 | tail -1
- uv run basedpyright 2>&1 | tail -1
- # 6. Run tests (requires hermes-agent PYTHONPATH)
- HERMES_PATH="$HERMES_AGENT_PATH"
- if [ -z "$HERMES_PATH" ]; then
- for d in ../hermes-agent ../../hermes-agent hermes-agent; do
- if [ -d "$d/gateway" ]; then
- HERMES_PATH="$d"
- break
- fi
- done
- fi
- if [ -d "$HERMES_PATH/gateway" ]; then
- echo "🧪 Running tests..."
- PYTHONPATH="$HERMES_PATH" uv run --with pyyaml pytest -x -q 2>&1 | tail -3
- else
- echo " ⚠️ hermes-agent not found at $HERMES_PATH — skipping tests"
- fi
- # 7. Commit note
- echo "✅ Done! Version is $VERSION."
- echo "💡 Now run 'git diff vendor_chattolib.sh' to update the SPEC floor in vendor_chattolib.sh if needed."
|