You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a Python CLI package (iclaw) that provides an interactive terminal REPL for chatting with GitHub Copilot.
37
+
### GitHub Actions
38
+
39
+
-**`.github/workflows/test.yaml`** — Runs on push/PR touching `iclaw/**` or `tests/**`. Runs unit tests with `coverage` against `iclaw/*.py`, `iclaw/commands/*.py`, `iclaw/tools/*.py`.
40
+
-**`.github/workflows/integration.yaml`** — Runs on push/PR touching `mini_copilot/**` or `integration_tests/**`. Skips silently if `GITHUB_TOKEN_INTEGRATION` secret is not set.
41
+
42
+
## Architecture
20
43
21
44
**Authentication flow:**
22
-
1.`iclaw-login` runs GitHub OAuth Device Flow, saves the GitHub token to `~/.config/iclaw/config.json`
23
-
2. On startup, `iclaw` reads the GitHub token from `~/.config/iclaw/config.json`, then exchanges it for a short-lived Copilot token via `https://api.github.com/copilot_internal/v2/token`
24
-
3. The Copilot token is refreshed every ~24 minutes during the session
2.`iclaw` startup reads the token via `iclaw/config.py:load_github_token()`, then exchanges it for a short-lived Copilot token (`iclaw/github_api.py:get_copilot_token()`)
47
+
3. The Copilot token is refreshed every `TOKEN_REFRESH_INTERVAL` seconds (24 min) during the session
48
+
49
+
**REPL loop (`iclaw/main.py:main()`):**
50
+
- Uses `prompt_toolkit.PromptSession` with `IclawCompleter` for tab-completion
51
+
- Commands (`/model`, `/copy`, etc.) are handled before messages reach the API
52
+
- User input passes through `resolve_at_mentions()` to expand `@filepath` references into `<file>` XML tags prepended to the message
53
+
- Calls `github_api.chat()` with the full message history and `TOOLS`
54
+
- Handles agentic tool-call loops: the model may return `tool_calls` for `web_search`, `exec`, or `edit`; results are appended as `role: tool` messages and the API is called again until a plain text reply is returned
55
+
56
+
**Tool definitions (`iclaw/tools/defs.py`):**
57
+
-`web_search` — delegates to `iclaw/web_search.py` (DuckDuckGo or Tavily based on `search_provider`)
58
+
-`exec` — delegates to `iclaw/exec_tool.py` (runs shell commands locally)
59
+
-`edit` — delegates to `iclaw/tools/edit_tool.py` (applies unified diffs to files)
0 commit comments