smoke_pub.sh 1.5 KB

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. # publish 全链路冒烟:临时库+本地bare远程(不碰真实仓库)
  3. cd "C:/Users/20175/.zcode/mcp-servers/wedo-repo/mcp" || exit 1
  4. export PROTO_REPO="D:/haolou/hanglung/ams/docs/_init_test"
  5. export WEDO_HUB_URL=""
  6. OUT="D:/haolou/hanglung/ams/docs/_smoke"
  7. git init --bare "$OUT/bare.git" -b main 2>/dev/null
  8. git -C "$PROTO_REPO" remote add origin "file:///D:/haolou/hanglung/ams/docs/_smoke/bare.git" 2>/dev/null
  9. git -C "$PROTO_REPO" config user.name lio; git -C "$PROTO_REPO" config user.email lio@wxapp.info
  10. printf '# 测试页\n' > "$PROTO_REPO/工作台/测试页.html"
  11. {
  12. echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"1"}}}'
  13. echo '{"jsonrpc":"2.0","method":"notifications/initialized"}'
  14. echo '{"jsonrpc":"2.0","id":9,"method":"tools/call","params":{"name":"proto_publish","arguments":{"files":["工作台/测试页.html"],"message":"测试页冒烟"}}}'
  15. echo '{"jsonrpc":"2.0","id":10,"method":"tools/call","params":{"name":"proto_sync","arguments":{"pull":false}}}'
  16. sleep 4
  17. } | timeout 40 node index.js 2>/dev/null > "$OUT/pub.jsonl"
  18. python - <<PY
  19. import json
  20. for line in open(r'D:/haolou/hanglung/ams/docs/_smoke/pub.jsonl', encoding='utf-8', errors='replace'):
  21. try: r = json.loads(line)
  22. except: continue
  23. if r.get('id') in (9, 10):
  24. print(f"--- id={r['id']} ---"); print(r['result']['content'][0]['text'][:500])
  25. PY
  26. echo "--- bare远程提交 ---"; git -C "$OUT/bare.git" log --oneline -1 2>/dev/null || echo "(空)"