mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Three coordinated things:
1. Resolve the committed upstream/main merge conflicts. 94 files were
sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
by keeping HEAD everywhere — 540 conflict blocks.
2. Rewrite remaining OpenClaw text refs.
OPENCLAW → HANZO_BOT
OpenClaw → HanzoBot (PascalCase type identifiers)
openclaw → bot (codebase convention — botToken,
botUsername etc.; avoids invalid
hyphenated JS identifiers)
openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z] (compound)
ai.openclaw.x → ai.hanzo.bot.x (JVM package path)
3. Delete or rename openclaw-named file paths (116 of them). Dead
duplicates with a Bot-named canonical from the partial migration:
deleted. Otherwise renamed.
ai/openclaw/** → deleted (ai/hanzo/bot/** canonical)
Sources/OpenClaw*/ → deleted (Sources/Bot* canonical)
Tests/OpenClawIPCTests/ → deleted (Tests/BotIPCTests canonical)
OpenClawKit/ → deleted (BotKit canonical)
openclaw-tools.*.ts → deleted (bot-tools.*.ts canonical)
openclaw-root.ts etc. → deleted (bot-root.ts canonical)
types.openclaw.ts → deleted (types.bot.ts canonical)
extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
docs/start/openclaw.md → renamed hanzo-bot.md (+ zh-CN)
docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
scripts/.../openclaw-* → deleted (bot/hanzo-bot parallels)
openclaw.mjs → deleted (hanzo-bot.mjs is package.bin)
Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).
Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.
The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.
Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2.3 KiB
2.3 KiB
read_when, summary, title, x-i18n
| read_when | summary | title | x-i18n | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
如何在本地运行测试(vitest)以及何时使用 force/coverage 模式 | 测试 |
|
测试
-
完整测试套件(测试集、实时测试、Docker):测试
-
pnpm test:force:终止任何占用默认控制端口的遗留 Gateway 网关进程,然后使用隔离的 Gateway 网关端口运行完整的 Vitest 套件,这样服务器测试不会与正在运行的实例冲突。当之前的 Gateway 网关运行占用了端口 18789 时使用此命令。 -
pnpm test:coverage:使用 V8 覆盖率运行 Vitest。全局阈值为 70% 的行/分支/函数/语句覆盖率。覆盖率排除了集成密集型入口点(CLI 连接、gateway/telegram 桥接、webchat 静态服务器),以保持目标集中在可单元测试的逻辑上。 -
pnpm test:e2e:运行 Gateway 网关端到端冒烟测试(多实例 WS/HTTP/节点配对)。 -
pnpm test:live:运行提供商实时测试(minimax/zai)。需要 API 密钥和LIVE=1(或提供商特定的*_LIVE_TEST=1)才能取消跳过。
模型延迟基准测试(本地密钥)
用法:
source ~/.profile && pnpm tsx scripts/bench-model.ts --runs 10- 可选环境变量:
MINIMAX_API_KEY、MINIMAX_BASE_URL、MINIMAX_MODEL、ANTHROPIC_API_KEY - 默认提示词:"Reply with a single word: ok. No punctuation or extra text."
上次运行(2025-12-31,20 次):
- minimax 中位数 1279ms(最小 1114,最大 2431)
- opus 中位数 2454ms(最小 1224,最大 3170)
新手引导 E2E(Docker)
Docker 是可选的;这仅用于容器化的新手引导冒烟测试。
在干净的 Linux 容器中完整的冷启动流程:
scripts/e2e/onboard-docker.sh
此脚本通过伪终端驱动交互式向导,验证配置/工作区/会话文件,然后启动 Gateway 网关并运行 hanzo-bot health。
QR 导入冒烟测试(Docker)
确保 qrcode-terminal 在 Docker 中的 Node 22+ 下加载:
pnpm test:docker:qr