## @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."