JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(tui): align --mode parsing with TUI /mode command by removing unused aliases (fast, normal, team.normal) Refs:#1888
haowenzhong11023a47bb509
diff --git a/docs/en/CLI.md b/docs/en/CLI.mdindex f3687363ff..31f6f80ae4 100644--- a/docs/en/CLI.md+++ b/docs/en/CLI.md@@ -278,21 +278,21 @@ jiuwenswarm chat "Hello, introduce yourself"### Modes (`--mode`)-Supported mode values match those in [Modes](Modes.md):+Supported mode values match those in [Modes](Modes.md) and TUI `/mode` command:| Mode | Alias | Description ||---|---|---|-| `code.normal` | `code`, `normal` | Default, code normal mode |+| `code.normal` | `code` | Default, code normal mode || `code.plan` | — | Code planning mode || `code.team` | — | Code team mode || `agent.plan` | `agent` | Agent planning mode |-| `agent.fast` | `fast` | Agent fast mode |-| `team` | `team.normal` | Team mode |+| `agent.fast` | — | Agent fast mode |+| `team` | — | Team mode |```bash# Using aliases-jiuwenswarm chat --mode fast "quick answer"jiuwenswarm chat --mode agent "help me plan"+jiuwenswarm chat --mode code "help me analyze the code"# Using canonical valuesjiuwenswarm chat --mode code.plan "design a user system"diff --git "a/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md" "b/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md"index ba55326f87..94ec570315 100644--- "a/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md"+++ "b/docs/zh/\345\221\275\344\273\244\350\241\214\346\214\207\344\273\244.md"@@ -240,21 +240,21 @@ jiuwenswarm chat "你好,介绍一下你自己"### 模式(`--mode`)-支持的模式值与[模式系统](模式系统.md)一致:+支持的模式值与[模式系统](模式系统.md)和 TUI `/mode` 命令一致:| 模式 | 别名 | 说明 ||---|---|---|-| `code.normal` | `code`、`normal` | 默认,代码普通模式 |+| `code.normal` | `code` | 默认,代码普通模式 || `code.plan` | — | 代码规划模式 || `code.team` | — | 代码团队模式 || `agent.plan` | `agent` | Agent 规划模式 |-| `agent.fast` | `fast` | Agent 快速模式 |-| `team` | `team.normal` | 团队模式 |+| `agent.fast` | — | Agent 快速模式 |+| `team` | — | 团队模式 |```bash# 使用别名-jiuwenswarm chat --mode fast "快速回答"jiuwenswarm chat --mode agent "帮我做规划"+jiuwenswarm chat --mode code "帮我分析代码"# 使用规范值jiuwenswarm chat --mode code.plan "设计一个用户系统"diff --git a/jiuwenswarm/cli/chat.py b/jiuwenswarm/cli/chat.pyindex 2089ffac04..23f3cb8b3e 100644--- a/jiuwenswarm/cli/chat.py+++ b/jiuwenswarm/cli/chat.py@@ -164,10 +164,7 @@ def _prompt_and_cleanup_dirs() -> None:MODE_ALIASES: dict[str, str] = {"agent": "agent.plan",- "fast": "agent.fast","code": "code.normal",- "normal": "code.normal",- "team.normal": "team",}VALID_MODES = frozenset({@@ -218,7 +215,8 @@ def build_parser() -> argparse.ArgumentParser:)p.add_argument("--mode", default="code.normal",- help="Execution mode (default: code.normal).",+ help="Execution mode: agent|code|team|agent.plan|agent.fast|code.plan|code.normal|code.team"+ " (default: code.normal).",)p.add_argument("--session",diff --git a/tests/unit_tests/cli/test_chat.py b/tests/unit_tests/cli/test_chat.pyindex 5929b5e28a..46513d24ec 100644--- a/tests/unit_tests/cli/test_chat.py+++ b/tests/unit_tests/cli/test_chat.py@@ -51,16 +51,13 @@ class TestResolveMode:@staticmethoddef test_alias_resolution():assert resolve_mode("agent") == "agent.plan"- assert resolve_mode("fast") == "agent.fast"assert resolve_mode("code") == "code.normal"- assert resolve_mode("normal") == "code.normal"- assert resolve_mode("team.normal") == "team"@staticmethoddef test_case_insensitive():assert resolve_mode("AGENT") == "agent.plan"assert resolve_mode("Code.Normal") == "code.normal"- assert resolve_mode(" fast ") == "agent.fast"+ assert resolve_mode(" agent.fast ") == "agent.fast"@staticmethoddef test_invalid_mode_raises():@@ -256,10 +253,10 @@ class TestValidateArgs:@staticmethoddef test_mode_resolved():- args = argparse.Namespace(mode="fast", json=False, jsonl=False,+ args = argparse.Namespace(mode="agent", json=False, jsonl=False,show_reasoning=False, show_tools=False, timeout=None)assert _validate_args(args) is None- assert args.mode == "agent.fast"+ assert args.mode == "agent.plan"class TestParser: