Skip to content

Commit 72325c4

Browse files
lzwjavaclaude
andcommitted
rename: /model_provider → /provider_model, /search_provider → /provider_search
Avoid tab-completion prefix conflicts with /model and /search commands. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ba62649 commit 72325c4

8 files changed

Lines changed: 26 additions & 26 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ GITHUB_TOKEN_INTEGRATION=<token> python3 -m unittest discover integration_tests
6262
- `iclaw/completer.py``IclawCompleter`: `@`-mention file completion (via `git ls-files`) and `/`-command completion
6363
- `iclaw/at_mention.py``resolve_at_mentions()`: expands `@path` tokens into file content XML
6464
- `iclaw/github_api.py``get_copilot_token()`, `get_models()`, `chat()`
65-
- `iclaw/commands/` — handlers for `/model_provider`, `/model`, `/search_provider`, `/copy`
65+
- `iclaw/commands/` — handlers for `/provider_model`, `/model`, `/provider_search`, `/copy`
6666
- `iclaw/config.py``CONFIG_PATH`, `TOKEN_REFRESH_INTERVAL`, `load_github_token()`
6767

6868
**API endpoints:**

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ pip install -e .
4040

4141
2. **Authenticate with GitHub** (on first run):
4242
```
43-
/model_provider
43+
/provider_model
4444
```
4545
Select `copilot`, then follow the GitHub device authorization flow. Your token is saved to `~/.config/iclaw/config.json`.
4646

4747
### CLI Commands
48-
- `/model_provider`: Select and authenticate with the model provider.
48+
- `/provider_model`: Select and authenticate with the model provider.
4949
- `/model`: View and switch between available models.
50-
- `/search_provider`: View and switch web search providers (default: DuckDuckGo).
50+
- `/provider_search`: View and switch web search providers (default: DuckDuckGo).
5151
- `/copy`: Copy the last response to your clipboard.
5252
- `/help`: Show available commands.
5353
- `.exit`: Quit the REPL.
@@ -62,7 +62,7 @@ The model has access to three tools it can invoke autonomously:
6262

6363
## Search Providers
6464

65-
Switch providers during a session with `/search_provider`:
65+
Switch providers during a session with `/provider_search`:
6666

6767
| Provider | API Key Required | Notes |
6868
|----------|-----------------|-------|

README_CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ pip install -e .
3232

3333
2. **GitHub 认证(首次运行时)**
3434
```
35-
/model_provider
35+
/provider_model
3636
```
3737
选择 `copilot`,然后按照 GitHub 设备授权流程操作。令牌将保存到 `~/.config/iclaw/config.json`
3838

3939
### 终端命令
40-
- `/model_provider`: 选择并认证模型提供商。
40+
- `/provider_model`: 选择并认证模型提供商。
4141
- `/model`: 查看并切换可用模型。
42-
- `/search_provider`: 查看并切换网页搜索提供商(默认:DuckDuckGo)。
42+
- `/provider_search`: 查看并切换网页搜索提供商(默认:DuckDuckGo)。
4343
- `/copy`: 将最后一条回复复制到剪贴板。
4444
- `/help`: 显示可用命令。
4545
- `.exit`: 退出 REPL。
@@ -54,7 +54,7 @@ pip install -e .
5454

5555
## 搜索引擎
5656

57-
在会话中使用 `/search_provider` 切换搜索引擎:
57+
在会话中使用 `/provider_search` 切换搜索引擎:
5858

5959
| 搜索引擎 | 需要 API Key | 说明 |
6060
|----------|-------------|------|

iclaw/completer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from prompt_toolkit.completion import Completer, Completion
55

66
COMMANDS = [
7-
"/model_provider",
7+
"/provider_model",
88
"/model",
9-
"/search_provider",
9+
"/provider_search",
1010
"/proxy",
1111
"/ca_bundle",
1212
"/copy",

iclaw/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
from iclaw.web_search import web_search
2828

2929
COMMANDS_HELP = [
30-
("/model_provider", "Select and authenticate with the model provider"),
30+
("/provider_model", "Select and authenticate with the model provider"),
3131
("/model", "Select specific model from your provider"),
32-
("/search_provider", "Select the web search provider"),
32+
("/provider_search", "Select the web search provider"),
3333
("/proxy", "Set HTTP/HTTPS proxy (usage: /proxy [url|off])"),
3434
("/ca_bundle", "Set CA bundle for HTTPS (usage: /ca_bundle [path|off])"),
3535
("/copy", "Copy last Copilot response to clipboard"),
@@ -60,7 +60,7 @@ def main():
6060
except Exception as e:
6161
print(f"Warning: {e}", file=sys.stderr)
6262
else:
63-
print("No token found. Type /model_provider to authenticate.\n")
63+
print("No token found. Type /provider_model to authenticate.\n")
6464

6565
messages = []
6666
print("iclaw CLI ready. Available commands:")
@@ -91,7 +91,7 @@ def main():
9191
if user_input == "/copy":
9292
handle_copy_command(last_reply)
9393
continue
94-
if user_input == "/model_provider":
94+
if user_input == "/provider_model":
9595
p, t = handle_model_provider_command(CONFIG_PATH, model_provider)
9696
if t:
9797
model_provider = p
@@ -116,7 +116,7 @@ def main():
116116
ca_bundle=ca_bundle,
117117
)
118118
continue
119-
if user_input == "/search_provider":
119+
if user_input == "/provider_search":
120120
search_provider = handle_search_provider_command(search_provider)
121121
save_session_settings(
122122
model_provider=model_provider,
@@ -163,7 +163,7 @@ def main():
163163
continue
164164

165165
if not copilot_token:
166-
print("Not authenticated. Type /model_provider first.", file=sys.stderr)
166+
print("Not authenticated. Type /provider_model first.", file=sys.stderr)
167167
continue
168168

169169
try:

integration_tests/test_repl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def test_copy_with_no_reply_yet(self):
248248

249249
def test_search_provider_change(self):
250250
_read_until(self.q, "> ")
251-
_send(self.process, "/search_provider")
251+
_send(self.process, "/provider_search")
252252
out, found = _read_until(self.q, "Select search provider", timeout=8)
253253
self.assertTrue(found, f"Search provider prompt not found. Got: {out!r}")
254254
_send(self.process, "2") # select startpage
@@ -258,7 +258,7 @@ def test_search_provider_change(self):
258258

259259
def test_search_provider_keep_current(self):
260260
_read_until(self.q, "> ")
261-
_send(self.process, "/search_provider")
261+
_send(self.process, "/provider_search")
262262
_read_until(self.q, "Select search provider", timeout=8)
263263
_send(self.process, "") # press Enter to keep current
264264
out, found = _read_until(self.q, "> ", timeout=8)
@@ -267,7 +267,7 @@ def test_search_provider_keep_current(self):
267267

268268
def test_search_provider_invalid_selection(self):
269269
_read_until(self.q, "> ")
270-
_send(self.process, "/search_provider")
270+
_send(self.process, "/provider_search")
271271
_read_until(self.q, "Select search provider", timeout=8)
272272
_send(self.process, "99") # out of range
273273
out, found = _read_until(self.q, "> ", timeout=8)
@@ -276,7 +276,7 @@ def test_search_provider_invalid_selection(self):
276276

277277
def test_search_provider_non_digit(self):
278278
_read_until(self.q, "> ")
279-
_send(self.process, "/search_provider")
279+
_send(self.process, "/provider_search")
280280
_read_until(self.q, "Select search provider", timeout=8)
281281
_send(self.process, "bad")
282282
out, found = _read_until(self.q, "> ", timeout=8)

tests/test_at_mention.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ def test_slash_alone_returns_all_commands(self):
153153
completions = self._completions("/")
154154
texts = [c.text for c in completions]
155155
# "/" prefix only matches slash-prefixed commands, not ".exit"
156-
for cmd in ["/model_provider", "/model", "/search_provider", "/copy", "/help"]:
156+
for cmd in ["/provider_model", "/model", "/provider_search", "/copy", "/help"]:
157157
self.assertIn(cmd, texts)
158158
self.assertNotIn(".exit", texts)
159159

160160
def test_slash_partial_filters_commands(self):
161161
completions = self._completions("/mod")
162162
texts = [c.text for c in completions]
163163
self.assertIn("/model", texts)
164-
self.assertIn("/model_provider", texts)
164+
self.assertNotIn("/provider_model", texts)
165165
self.assertNotIn("/copy", texts)
166166
self.assertNotIn("/help", texts)
167167

tests/test_main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_main_copy(self, mock_ps, mock_copy, mock_cp, mock_load, mock_http):
111111
@patch("iclaw.main.handle_model_provider_command", return_value=("copilot", None))
112112
@patch("iclaw.main.PromptSession")
113113
def test_main_model_provider(self, mock_ps, mock_mp, mock_cp, mock_load, mock_http):
114-
mock_ps.return_value = _mock_session("/model_provider", ".exit")
114+
mock_ps.return_value = _mock_session("/provider_model", ".exit")
115115
with patch("sys.stdout"), patch("iclaw.main.time.monotonic", return_value=0):
116116
main.main()
117117

@@ -133,7 +133,7 @@ def test_main_model(self, mock_ps, mock_mc, mock_cp, mock_load, mock_http):
133133
def test_main_search_provider(
134134
self, mock_ps, mock_sp, mock_cp, mock_load, mock_http
135135
):
136-
mock_ps.return_value = _mock_session("/search_provider", ".exit")
136+
mock_ps.return_value = _mock_session("/provider_search", ".exit")
137137
with patch("sys.stdout"), patch("iclaw.main.time.monotonic", return_value=0):
138138
main.main()
139139

@@ -283,7 +283,7 @@ def test_main_token_refresh(
283283
def test_main_model_provider_with_token(
284284
self, mock_ps, mock_mp, mock_cp, mock_load, mock_http
285285
):
286-
mock_ps.return_value = _mock_session("/model_provider", ".exit")
286+
mock_ps.return_value = _mock_session("/provider_model", ".exit")
287287
with patch("sys.stdout"), patch("iclaw.main.time.monotonic", return_value=0):
288288
main.main()
289289

0 commit comments

Comments
 (0)