Deregister service instances from Consul via the HTTP API.
User: Deregister service my-service-id on consul-agent-1, consul-agent-2, and consul-agent-3
AI executes:
python3 /Users/shiheng/.qclaw/workspace/skills/consul-deregister/scripts/deregister.py \
--service-id my-service-id \
--agents http://<CONSUL_HOST_1>:8500 http://<CONSUL_HOST_2>:8500 http://<CONSUL_HOST_3>:8500
User pastes existing curl commands, AI parses and replays them:
User: Execute these deregister commands:
curl -XPUT http://<CONSUL_HOST_1>:8500/v1/agent/service/deregister/<SERVICE_ID>
curl -XPUT http://<CONSUL_HOST_2>:8500/v1/agent/service/deregister/<SERVICE_ID>
AI executes:
python3 /Users/shiheng/.qclaw/workspace/skills/consul-deregister/scripts/deregister.py \
--from-curl "curl -XPUT http://<CONSUL_HOST>:8500/v1/agent/service/deregister/<SERVICE_ID> ..."
python3 /Users/shiheng/.qclaw/workspace/skills/consul-deregister/scripts/deregister.py \
--service-id my-service-id \
--agents-file ./agents.txt
agents.txt format (supports # comments):
# Consul Agent node list
<CONSUL_HOST_1>:8500
<CONSUL_HOST_2>:8500
<CONSUL_HOST_3>:8500
Add --dry-run to any mode to preview the requests without actually sending them:
python3 /Users/shiheng/.qclaw/workspace/skills/consul-deregister/scripts/deregister.py \
--service-id my-service-id \
--agents http://<CONSUL_HOST_1>:8500 http://<CONSUL_HOST_2>:8500 \
--dry-run
python3 /Users/shiheng/.qclaw/workspace/skills/consul-deregister/scripts/deregister.py \
--service-id my-service-id \
--agents http://<CONSUL_HOST>:8500 \
--token your-consul-acl-token
Scenario 1: Batch Deregister Gray Nodes
User provides a service ID and multiple IP:port pairs.
Scenario 2: Release Rollback
User triggers rollback; AI finds the old version's service ID from config/docs and deregisters.
Scenario 3: Service Migration
Moving a service from old cluster to new cluster — deregister from all old cluster nodes first.
service-id must exactly match the ID registered in Consul (no extra spaces)host:port and full URL (http://host:port) — auto-completed--json for JSON output suitable for scripting / pipeline integration共 1 个版本