Skip to content

Commit 8bac6b7

Browse files
committed
feat: add Grok support and redesign the TUI
1 parent 897b937 commit 8bac6b7

28 files changed

Lines changed: 1765 additions & 250 deletions

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cc-switchy"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
edition = "2021"
55
rust-version = "1.95"
66

@@ -34,6 +34,8 @@ tokio = { version = "1", features = ["fs", "io-util", "macros", "rt-multi-thread
3434
tokio-util = { version = "0.7", features = ["rt"] }
3535
toml = "0.9"
3636
toml_edit = "0.23"
37+
unicode-segmentation = "1"
38+
unicode-width = "0.2"
3739
url = "2.5"
3840
zip = { version = "8", default-features = false, features = ["deflate-flate2-zlib-rs"] }
3941

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
`cc-switchy` is a download-only Rust CLI and Ratatui application for restoring
66
CC Switch cloud snapshots from WebDAV or S3-compatible storage. It can manage
77
multiple sources, restore the latest selected snapshot, and apply providers,
8-
MCP servers, and Skills to supported local Agents.
8+
MCP servers, and Skills to supported local Agents, including Grok Build.
99

1010
> `cc-switchy --sync` always downloads and applies the current snapshot from
1111
> the selected source. It does not upload, merge, or delete remote data.
@@ -18,6 +18,7 @@ MCP servers, and Skills to supported local Agents.
1818
- 通过向导管理多个 WebDAV 与 S3 同步源:列表、新增、查看、编辑、删除、测试和设置默认源。
1919
- `cc-switchy --sync` 一键重新下载并恢复默认源的最新快照。
2020
- 安全恢复 CC Switch v2/db-v6 的 `manifest.json``db.sql``skills.zip`,兼容 WebDAV db-v5 旧路径回退。
21+
- 兼容 CC Switch v3.18 的 SQLite schema v16,并支持 Grok Build 的供应商、MCP 和 Skills 投影。
2122
- 将供应商、MCP 和 Skills 应用到本地 Agent,并在 TUI 中切换独占式 Agent 的供应商。
2223
- CLI、向导、TUI、进度与错误均支持简体中文和英文。
2324
- 全程显示阶段、下载字节、耗时、警告和备份位置。
@@ -82,11 +83,12 @@ cc-switchy --lang en
8283

8384
### TUI 按键
8485

85-
- `1` 供应商,`2` Skills,`3` 活动,`4` 同步源
86-
- `↑/↓``j/k` 移动,`Tab/Shift+Tab` 切换焦点,`←/→``h/l` 切换面板
87-
- `[`/`]` 切换 Agent;此操作只浏览,不会切换供应商
86+
- 顶栏持续显示当前 Agent、供应商、默认同步源和操作状态。
87+
- `1` 切换,`2` 同步,`3` Skills,`4` 活动。
88+
- `↑/↓``j/k` 移动,`Tab/Shift+Tab` 切换焦点。
89+
- Agent 工作区获得焦点时,`←/→``h/l` 切换 Agent;`[`/`]` 可在任意主界面切换 Agent。此操作只浏览,不会切换供应商。
8890
- `Enter` 切换独占式 Agent 的供应商,或重新应用累加式 Agent 的受管供应商集合
89-
- `s` 同步默认源;在“同步源”页同步当前选中源
91+
- `s` 同步默认源;在“同步”页同步当前选中源
9092
- `t` 测试选中源,`m` 设置默认源,`w` 打开向导,`L` 切换语言
9193
- `Esc` 在本地恢复开始前请求取消,`q` 安全退出
9294

@@ -174,6 +176,7 @@ ZIP 路径和 SQL。备份开启时,程序会先创建完整本地备份、执
174176
| Claude Desktop | 独占;仅 macOS/Windows,代理模式为警告 | 不支持 | 不支持 |
175177
| Codex | 独占 | 支持 | 支持 |
176178
| Gemini | 独占 | 支持 | 支持 |
179+
| Grok Build | 独占 | 支持 | 支持 |
177180
| OpenCode | 累加 | 支持 | 支持 |
178181
| OpenClaw | 累加 | 不支持 | 不支持 |
179182
| Hermes | 累加 | 支持 | 支持 |
@@ -199,6 +202,7 @@ ZIP 路径和 SQL。备份开启时,程序会先创建完整本地备份、执
199202
- Manages multiple WebDAV and S3 sources with CRUD, connection tests, and one default source.
200203
- Re-fetches and restores the current selected CC Switch snapshot with one `--sync` command.
201204
- Safely validates and restores CC Switch v2/db-v6 `manifest.json`, `db.sql`, and `skills.zip` artifacts.
205+
- Supports the CC Switch v3.18 SQLite schema v16 and projects Grok Build providers, MCP servers, and Skills.
202206
- Projects providers, MCP servers, and Skills to supported local Agents and switches exclusive providers from the TUI.
203207
- Renders CLI, Wizard, TUI, progress, and errors in English or Simplified Chinese.
204208

@@ -231,11 +235,13 @@ backup settings, and `L` changes language. Backup settings provide an explicit
231235
creation switch and retention count; `0` means unlimited. `Esc` discards a form
232236
or goes back, `q` exits outside forms, and `Ctrl+C` exits from every Wizard screen.
233237

234-
Main TUI keys: `1` Providers, `2` Skills, `3` Activity, `4` Sources,
235-
`j/k` or arrows to move, `Tab` to change focus, `[`/`]` to browse Agents,
236-
`Enter` to switch/reapply providers, `s` to sync, `t` to test a source, `m` to
237-
make it default, `w` to open the Wizard, `L` to change language, and `q` to
238-
quit safely.
238+
The TUI header always shows the selected Agent, its current provider, the
239+
default sync source, and operation state. Main keys are `1` Switch, `2` Sync,
240+
`3` Skills, and `4` Activity. Use `j/k` or arrows to move, `Tab` to change
241+
focus, left/right while the Agent workspace is focused, or `[`/`]` anywhere to
242+
browse Agents. `Enter` switches or reapplies providers, `s` syncs, `t` tests a
243+
source, `m` makes it default, `w` opens the Wizard, `L` changes language, and
244+
`q` quits safely.
239245

240246
### Storage and results
241247

@@ -274,7 +280,8 @@ binary inherits the build runner's glibc baseline.
274280

275281
`cc-switchy` is MIT licensed. CC Switch compatibility behavior was studied and
276282
adapted from [CC Switch](https://github.com/farion1231/cc-switch) at commits
277-
`c6197ae32450cd70e2bf03b35e3f5f53ac12044c` and
278-
`3d176b98cc0bfd151a42882e88ab59b62083b92f` (`v3.17.0` schema). See
283+
`c6197ae32450cd70e2bf03b35e3f5f53ac12044c`,
284+
`3d176b98cc0bfd151a42882e88ab59b62083b92f` (`v3.17.0`, SQLite schema v13),
285+
and `a377d79303bc1e592d2783d559ca5bd6b8ba1417` (`v3.18.0`, SQLite schema v16 and Grok Build). See
279286
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for attribution and the
280287
upstream MIT notice.

THIRD_PARTY_NOTICES.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ behavior by studying and adapting portions of CC Switch.
88
- Project: CC Switch
99
- Source: https://github.com/farion1231/cc-switch
1010
- Protocol/projection reference: `c6197ae32450cd70e2bf03b35e3f5f53ac12044c`
11-
- Database schema reference: `3d176b98cc0bfd151a42882e88ab59b62083b92f` (`v3.17.0`)
11+
- Database schema v13 reference: `3d176b98cc0bfd151a42882e88ab59b62083b92f` (`v3.17.0`)
12+
- Database schema v16 and Grok Build reference: `a377d79303bc1e592d2783d559ca5bd6b8ba1417` (`v3.18.0`)
1213
- License: MIT
1314

1415
Adapted areas include:
1516

1617
- the `cc-switch-webdav-sync` v2 protocol and WebDAV/S3 object layout;
1718
- CC Switch SQLite export validation, db-v5 migration, and db-v6 restore behavior;
18-
- provider projection for Claude, Codex, Gemini, OpenCode, OpenClaw, Hermes,
19-
and the supported Claude Desktop boundary;
19+
- provider projection for Claude, Codex, Gemini, Grok Build, OpenCode,
20+
OpenClaw, Hermes, and the supported Claude Desktop boundary;
2021
- MCP projection and preservation of unknown local entries;
2122
- Skills SSOT, symlink/copy, enablement, and managed-target reconciliation.
2223

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
{
2+
"meta": {
3+
"name": "Agent Switchboard Terminal",
4+
"description": "A compact, status-first terminal interface for switching Agent providers and synchronizing CC Switch state.",
5+
"source_references": [
6+
"Existing cc-switchy Ratatui interface",
7+
"User brief: Agent configuration switching and synchronization are the primary jobs"
8+
],
9+
"created_at": "2026-07-23"
10+
},
11+
"design_system": {
12+
"color": {
13+
"palette_type": "complementary",
14+
"primary": {
15+
"hex": "#5FD7D7",
16+
"role": "focus, selected workspace, and primary action"
17+
},
18+
"secondary": {
19+
"hex": "#87AFC7",
20+
"role": "metadata and secondary navigation"
21+
},
22+
"accent": {
23+
"hex": "#FFD75F",
24+
"role": "sync activity, warnings, and attention"
25+
},
26+
"neutral": {
27+
"scale": ["#101418", "#1B2229", "#3A4650", "#87939D", "#D7DEE3", "#F4F7F9"],
28+
"usage": "Terminal background, subdued borders, secondary text, and primary text"
29+
},
30+
"semantic": {
31+
"success": "#5FD787",
32+
"warning": "#FFD75F",
33+
"error": "#FF5F5F",
34+
"info": "#5FAFFF"
35+
},
36+
"surface": {
37+
"background": "#101418",
38+
"card": "#1B2229",
39+
"elevated": "#27313A"
40+
},
41+
"contrast_strategy": "High-contrast foreground with muted structural chrome; color is reserved for state and focus"
42+
},
43+
"typography": {
44+
"type_scale": {
45+
"display": {"size": "1 terminal cell", "weight": "bold", "line_height": "1", "tracking": "0"},
46+
"heading_1": {"size": "1 terminal cell", "weight": "bold", "line_height": "1", "tracking": "0"},
47+
"heading_2": {"size": "1 terminal cell", "weight": "bold", "line_height": "1", "tracking": "0"},
48+
"heading_3": {"size": "1 terminal cell", "weight": "medium", "line_height": "1", "tracking": "0"},
49+
"body": {"size": "1 terminal cell", "weight": "regular", "line_height": "1", "tracking": "0"},
50+
"body_small": {"size": "1 terminal cell", "weight": "regular", "line_height": "1", "tracking": "0"},
51+
"caption": {"size": "1 terminal cell", "weight": "regular", "line_height": "1", "tracking": "0"},
52+
"overline": {"size": "1 terminal cell", "weight": "bold", "line_height": "1", "tracking": "1 cell between groups"}
53+
},
54+
"font_families": {
55+
"heading": "terminal monospace",
56+
"body": "terminal monospace",
57+
"mono": "terminal monospace"
58+
},
59+
"font_style_notes": "Use weight and color, never simulated font-size, to express hierarchy in a terminal"
60+
},
61+
"spacing": {
62+
"base_unit": "1 cell",
63+
"scale": ["0", "1", "2", "3", "4"],
64+
"content_density": "compact",
65+
"section_rhythm": "One-cell internal padding; blank lines only inside detail panes where they improve scanning"
66+
},
67+
"layout": {
68+
"grid_system": "Responsive Ratatui constraints with a persistent status header and contextual footer",
69+
"max_content_width": "terminal width",
70+
"columns": "Wide: provider list plus details; medium: one primary pane plus status rail; narrow: one focused pane",
71+
"gutter": "0-1 terminal cell",
72+
"breakpoints": ["60 columns minimum", "80 columns medium", "120 columns wide"],
73+
"alignment_tendency": "strict grid"
74+
},
75+
"shape": {
76+
"border_radius": {"small": "0", "medium": "0", "large": "0", "pill": "0"},
77+
"border_usage": "Subtle single-line borders on major work areas; selected rows use a filled marker rather than extra boxes",
78+
"divider_style": "Single terminal rule with muted color"
79+
},
80+
"elevation": {
81+
"shadow_style": "none",
82+
"levels": {"low": "color contrast only", "medium": "focused border plus color", "high": "modal overlay only"},
83+
"depth_cues": "Color intensity, border emphasis, and spatial grouping"
84+
},
85+
"iconography": {
86+
"style": "single-cell Unicode status glyphs with ASCII-safe text labels",
87+
"stroke_weight": "single-cell",
88+
"size_scale": ["1 cell"],
89+
"preferred_set": "● ○ ✓ ! × ◌ ›"
90+
},
91+
"motion": {
92+
"easing": "state-driven",
93+
"duration_scale": {"micro": "100ms redraw tick", "normal": "operation event", "macro": "operation completion"},
94+
"entrance_pattern": "Immediate redraw with focus relocation",
95+
"exit_pattern": "Immediate redraw; active operations require cancellation",
96+
"philosophy": "minimal functional"
97+
},
98+
"components": {
99+
"button_style": "Key hints formatted as highlighted key plus plain-language action",
100+
"input_style": "Existing wizard fields retained with focused border and explicit validation",
101+
"card_style": "Bordered terminal panes with short uppercase-like titles and state badges",
102+
"navigation_pattern": "Four numbered jobs: Switch, Sync, Skills, Activity; Agents are a horizontal workspace selector",
103+
"modal_style": "Full-context wizard overlay with preserved terminal state",
104+
"list_style": "One-line rows, leading selection marker, trailing state badge, stable column alignment",
105+
"component_notes": "Keep the current provider and default sync source visible in the header; put destructive or long-running state in the status line"
106+
}
107+
},
108+
"design_style": {
109+
"aesthetic": {
110+
"mood": ["focused", "operational", "calm", "trustworthy"],
111+
"visual_metaphor": "A compact switchboard for routing Agent configurations",
112+
"era_influence": "Modern terminal operations tooling",
113+
"genre": "developer productivity TUI",
114+
"personality_traits": ["direct", "precise", "reassuring", "efficient"],
115+
"adjectives": ["status-first", "keyboard-native", "compact", "legible"]
116+
},
117+
"visual_language": {
118+
"complexity": "moderate",
119+
"ornamentation": "none",
120+
"whitespace_usage": "tight but grouped",
121+
"visual_weight_distribution": "Current Agent/provider and sync readiness carry the most weight",
122+
"focal_strategy": "One primary job per screen with persistent global status",
123+
"contrast_level": "high",
124+
"texture_usage": "none"
125+
},
126+
"composition": {
127+
"hierarchy_method": "color weight plus spatial isolation",
128+
"balance_type": "asymmetric",
129+
"flow_direction": "top status to workspace selector to actionable list to contextual help",
130+
"grouping_strategy": "Group by user job, then Agent, then provider/source",
131+
"negative_space_role": "Separates state summaries from actionable rows"
132+
},
133+
"imagery": {
134+
"photo_treatment": "none",
135+
"illustration_style": "none",
136+
"graphic_elements": "status glyphs, rules, and progress bars",
137+
"pattern_usage": "none",
138+
"image_shape": "not applicable"
139+
},
140+
"interaction_feel": {
141+
"feedback_style": "Immediate focus/state change with activity-log confirmation for operations",
142+
"hover_behavior": "not applicable; keyboard focus is explicit",
143+
"transition_personality": "snappy",
144+
"loading_style": "Live stage, elapsed time, artifact progress, and cancellable working badge",
145+
"microinteraction_density": "low"
146+
},
147+
"brand_voice_in_ui": {
148+
"tone": "concise and operational",
149+
"formality": "neutral professional",
150+
"cta_style": "direct imperative",
151+
"empty_state_approach": "Explain the missing prerequisite and name the next key to press",
152+
"error_tone": "Specific, recoverable, and free of blame"
153+
}
154+
},
155+
"visual_effects": {
156+
"overview": {
157+
"effect_intensity": "none",
158+
"performance_tier": "lightweight",
159+
"fallback_strategy": "Use ASCII-compatible labels when Unicode glyph width is unreliable",
160+
"primary_technology": "Ratatui terminal rendering"
161+
},
162+
"background_effects": {
163+
"type": "none",
164+
"description": "No decorative background effect",
165+
"technology": "none",
166+
"params": {"color_palette": [], "speed": "0", "density": "0", "opacity": "0", "blend_mode": "none"}
167+
},
168+
"particle_systems": {
169+
"enabled": false,
170+
"type": "none",
171+
"description": "Disabled",
172+
"technology": "none",
173+
"params": {"count": 0, "shape": "none", "size_range": "0", "movement_pattern": "none", "color_behavior": "none", "interaction": "none", "spawn_area": "none"}
174+
},
175+
"3d_elements": {
176+
"enabled": false,
177+
"type": "none",
178+
"description": "Disabled",
179+
"technology": "none",
180+
"params": {"renderer": "none", "lighting": "none", "camera": "none", "materials": [], "geometry": [], "post_processing": [], "interaction_model": "none"}
181+
},
182+
"shader_effects": {
183+
"enabled": false,
184+
"type": "none",
185+
"description": "Disabled",
186+
"technology": "none",
187+
"params": {"uniforms": {}, "vertex_manipulation": "none", "fragment_output": "none", "noise_type": "none", "distortion": "none"}
188+
},
189+
"scroll_effects": {
190+
"parallax": {"enabled": false, "layers": "0", "depth_range": "0", "speed_curve": "none"},
191+
"scroll_triggered_animations": {"enabled": false, "trigger_points": [], "animation_type": "none", "scrub_behavior": "none"},
192+
"scroll_morphing": {"enabled": false, "description": "Disabled"}
193+
},
194+
"text_effects": {
195+
"type": "none",
196+
"description": "Only state-driven color and weight changes",
197+
"technology": "Ratatui styles",
198+
"params": {"split_strategy": "none", "animation_per_unit": "none", "stagger": "0", "effect_style": "none"}
199+
},
200+
"cursor_effects": {
201+
"enabled": false,
202+
"type": "none",
203+
"description": "Terminal cursor is hidden while the TUI is active",
204+
"params": {"shape": "none", "size": "0", "blend_mode": "none", "trail": "none", "interaction_zone": "none"}
205+
},
206+
"image_effects": {
207+
"type": "none",
208+
"description": "No images",
209+
"technology": "none",
210+
"params": {"filter_pipeline": [], "hover_transform": "none", "reveal_animation": "none", "distortion_type": "none"}
211+
},
212+
"glassmorphism_neumorphism": {
213+
"enabled": false,
214+
"style": "none",
215+
"params": {"blur_radius": "0", "transparency": "0", "border_treatment": "none", "shadow_type": "none", "light_source_angle": "none"}
216+
},
217+
"canvas_drawings": {
218+
"enabled": false,
219+
"type": "none",
220+
"description": "Disabled",
221+
"technology": "none",
222+
"params": {"draw_method": "none", "animation_loop": "none", "color_scheme": [], "responsiveness": "none", "interaction": "none"}
223+
},
224+
"svg_animations": {
225+
"enabled": false,
226+
"type": "none",
227+
"description": "Disabled",
228+
"params": {"animation_method": "none", "path_morphing": "none", "stroke_animation": "none", "filter_effects": []}
229+
},
230+
"composite_notes": "Terminal effects are intentionally limited to focus color, semantic status glyphs, progress redraws, and operation state. There are no decorative loops or time-based animations."
231+
}
232+
}

docs/release-notes/v0.4.0.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# cc-switchy v0.4.0
2+
3+
## English
4+
5+
### New Features
6+
7+
1. Grok Build now supports provider switching plus MCP and Skills projection through `~/.grok`.
8+
2. The TUI now centers its four main jobs around Switch, Sync, Skills, and Activity, with the selected Agent, provider, source, and operation state always visible.
9+
10+
### Fixes & Improvements
11+
12+
1. Snapshot restore and existing local databases now accept the CC Switch v3.18 SQLite schema v16 while keeping the remote sync protocol on db-v6.
13+
14+
## 简体中文
15+
16+
### 新功能
17+
18+
1. Grok Build 现已支持供应商切换,以及通过 `~/.grok` 投影 MCP 和 Skills。
19+
2. TUI 现在围绕切换、同步、Skills 和活动四项主要任务组织,并持续显示当前 Agent、供应商、同步源和操作状态。
20+
21+
### 修复与改进
22+
23+
1. 快照恢复和现有本地数据库现已兼容 CC Switch v3.18 的 SQLite schema v16,远端同步协议仍保持 db-v6。

0 commit comments

Comments
 (0)