Skip to content

refactor: decouple flag parsing, extract status-bar, cleanup dead code#12

Merged
RyanLee-Dev merged 1 commit intomainfrom
refactor/arch-cleanup
Apr 1, 2026
Merged

refactor: decouple flag parsing, extract status-bar, cleanup dead code#12
RyanLee-Dev merged 1 commit intomainfrom
refactor/arch-cleanup

Conversation

@RyanLee-Dev
Copy link
Copy Markdown
Collaborator

Summary

  • args.ts: 两遍解析架构。scanCommandPath 快速扫位置参数,parseFlags(argv, OptionDef[]) 从 schema 推导 flag 类型(boolean/number/array),消除原有硬编码列表——加新 flag 不再需要改解析器
  • command.ts: 新增 GLOBAL_OPTIONS 作为全局 flag 类型的唯一来源,main.ts 合并命令 options 后一起传入解析器
  • output/status-bar.ts: 将状态栏渲染从 http.ts 中剥离,HTTP client 不再含任何 UI 代码
  • registry.ts: 删除注释掉的 File API 死代码
  • package.json: 新增 build:dev 脚本,用 bun build --compile --minify 产出当前平台独立二进制
  • commands: 为 text/chat、speech/synthesize、music/generate、video/generate、image/generate 的数值和数组 flag 补充 type 字段

Test plan

  • bun run typecheck 通过
  • minimax --help 正常输出
  • minimax text chat --help flag 列表正确
  • bun run build:dev 产出 dist/minimax 可执行文件
  • 所有命令功能测试

🤖 Generated with Claude Code

- args.ts: replace hardcoded boolean/number/array lists with schema-driven
  parseFlags(argv, OptionDef[]) + scanCommandPath(); adding a new flag no
  longer requires touching the parser
- command.ts: add GLOBAL_OPTIONS as the single source of truth for global
  flag types; main.ts merges with command options for two-pass parsing
- output/status-bar.ts: extract status-bar rendering out of http.ts;
  HTTP client is now pure transport with no UI concerns
- registry.ts: remove commented-out File API dead code
- package.json: add build:dev for single-platform Bun standalone binary
- commands: annotate numeric (type:'number') and array (type:'array') flags
  in text/chat, speech/synthesize, music/generate, video/generate, image/generate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@RyanLee-Dev RyanLee-Dev merged commit f3265f8 into main Apr 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant