test(cli): add --version and --help flag tests - #48
Open
blut-agent wants to merge 1 commit into
Open
Conversation
Add vitest tests verifying CLI flag behavior: - --version / -V outputs version from package.json - --help / -h outputs usage information - Subcommand --help works for chat, agent, init, sessions, mcp Closes IHUI-INF-AI#29
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.
Problem
IHUI-AI 的 CLI (
apps/cli) 缺少--version和--help命令的测试覆盖。虽然功能已通过 Commander.js 实现(.version(pkg.version)+ 自动--help),但没有测试验证这些标志在运行时正确工作。Fix
新增
apps/cli/tests/cli-flags.test.ts,使用execFileSync启动 CLI 并验证输出:--version/-V— 输出版本号,与package.json一致--help/-h— 输出包含Usage:、Options:、--version、--help的使用说明--help—chat、agent、init、sessions、mcp五个子命令均支持--helpTest Plan
pnpm --filter @ihui/cli test -- tests/cli-flags.test.ts— 9/9 通过pnpm --filter @ihui/cli typecheck— 无错误prompt-file.test.tslocale 问题、fs-watcherdebounce flake)与 main 分支一致,未引入新失败Closes #29