test(e2e): full command-surface coverage + live AI-tool hook integration#87
Closed
jeff-r2026 wants to merge 2 commits into
Closed
test(e2e): full command-surface coverage + live AI-tool hook integration#87jeff-r2026 wants to merge 2 commits into
jeff-r2026 wants to merge 2 commits into
Conversation
Adds two end-to-end suites that close real gaps in the e2e coverage: - command-coverage-e2e.test.ts: spawns the built CLI for every user-facing command + subcommand. Asserts `--help` exits 0 with usage (catches broken dynamic imports / bad option specs), that read-only commands degrade gracefully on an uninitialized HOME without a wiring bug, and that the hook-dispatch backbone appends the expected dashboard events for real hook payloads (no LLM / credentials needed → CI-safe). - tool-integration-e2e.test.ts: runs the real `claude`, `codebuddy`, and `cursor-agent` CLIs against a cheap model and asserts the hooks teamai injects actually fire end-to-end. Reuses teamai's real injectHooks() output, redirecting the dispatch command to an isolated sandbox HOME + the built dist so it never pollutes the developer's ~/.teamai and needs no global install. The CLI keeps its real HOME so auth still works. Gated behind TEAMAI_E2E_LIVE_TOOLS=1 (needs authed CLIs + cheap model calls). Added `npm run test:e2e:live`. Verified locally: claude + codebuddy fire the SessionStart hook with claude-haiku; cursor-agent auto-skips until logged in. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
…wire into CI (#95) Decouple the live claude/codebuddy hook-integration e2e from ambient interactive login by making the Anthropic API key and base URL configurable via TEAMAI_E2E_ANTHROPIC_API_KEY / TEAMAI_E2E_ANTHROPIC_BASE_URL, broaden the assertion to cover the full hook lifecycle (session_start, prompt_submit, tool_use, stop), and add an e2e-live-tools CI job that runs it on GitHub Actions when the corresponding secret is configured. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
补全项目端到端测试的两个真实缺口:(1) 没有覆盖全部 CLI 命令面,(2) 从未真正运行
claude/codebuddy/cursor-agent来验证 teamai 注入的 hook 是否真的触发。新增两个 e2e 套件:
command-coverage-e2e.test.ts(无需凭证 / 网络,CI 可跑)src/index.ts中每一个用户可见命令 + 子命令 spawn 真实 CLI,断言--help退出码 0 且打印 usage(可捕获 dynamic import 损坏、option 规格错误、action handler 缺失等接线问题)。hook-dispatch,断言 dashboard 事件(session_start/prompt_submit)被正确写入——无需 LLM 即可端到端验证 hook 调度骨架。tool-integration-e2e.test.ts(gated:TEAMAI_E2E_LIVE_TOOLS=1)claude/codebuddy/cursor-agent,断言 teamai 注入的 SessionStart hook 端到端真正触发。injectHooks()产物(与生产逐字节一致的 on-disk 形态),仅把 dispatch 命令重定向到隔离 sandbox HOME + 已构建的dist/index.js:~/.teamai;teamai;dashboardReportHandler向 sandbox 的dashboard/events.jsonl追加session_start事件。新增脚本:
npm run test:e2e:live。本地验证结果
claude(claude-haiku-4-5-20251001)—— SessionStart hook 真实触发codebuddy(claude-haiku-4.5)—— SessionStart hook 真实触发cursor-agent—— 已接入(项目级.cursor/hooks.json+--workspace),运行环境未登录时自动跳过;登录后即可npm run test:e2e:live验证。npx tsc --noEmit通过。Test plan
npm run test:e2e(command-coverage + hook-dispatch,无凭证)claude/codebuddy/cursor-agent上跑npm run test:e2e:live备注
TEAMAI_E2E_CLAUDE_MODEL/TEAMAI_E2E_CODEBUDDY_MODEL/TEAMAI_E2E_CURSOR_MODEL覆盖。Made with Cursor