Skip to content

Commit cc70d65

Browse files
committed
refactor: restructure CLI commands with profile/config grouping and aliases
- Add `profile` parent command (alias: pf) grouping add/select/test/list/remove - Absorb defaultbehavior/skippermissions/terminal into `config` (alias: c) with set/get/reset/list subcommands and kebab-case keys - Add aliases: start→s, project→p, config→c, remote→r, profile→pf - Simplify `project add` to accept 0/1/2 args (cwd/path/name+path) - Hide `completion` command from help (still functional) - Remove 12 top-level command variables (DefaultBehavior*, SkipPermissions*, Terminal*) - Update all help text references to new command paths - Update CI smoke tests and README documentation
1 parent 1ab9209 commit cc70d65

5 files changed

Lines changed: 407 additions & 313 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ jobs:
4545
run: |
4646
./codes version
4747
./codes --help
48-
./codes add --help
49-
./codes terminal list
48+
./codes profile add --help
49+
./codes config list terminal
5050
5151
- name: Smoke test (Windows)
5252
if: runner.os == 'Windows'
5353
run: |
5454
.\codes.exe version
5555
.\codes.exe --help
56-
.\codes.exe add --help
57-
.\codes.exe terminal list
56+
.\codes.exe profile add --help
57+
.\codes.exe config list terminal

README.md

Lines changed: 35 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -135,88 +135,58 @@ Initialize the CLI: install binary, set up shell completion, run health checks.
135135
codes init
136136
```
137137

138-
### `codes add`
138+
### `codes profile` (alias: `pf`)
139139

140-
Interactively add a new API profile.
140+
Manage API profiles.
141141

142142
```bash
143-
codes add
143+
codes profile add # interactively add a new profile
144+
codes profile select # select active profile
145+
codes profile test # test all profiles
146+
codes profile test work # test specific profile
147+
codes profile list # list all profiles
148+
codes profile remove work # remove a profile
149+
codes pf list # alias shorthand
144150
```
145151
146-
### `codes select`
147-
148-
Display all profiles and interactively select one.
149-
150-
```bash
151-
codes select
152-
```
153-
154-
### `codes test [profile-name]`
155-
156-
Test API connectivity for all profiles or a specific one.
157-
158-
```bash
159-
codes test # test all
160-
codes test work # test specific profile
161-
```
162-
163-
### `codes start [path-or-project]`
152+
### `codes start [path]` (alias: `s`)
164153
165154
Start Claude in a specific directory or project alias.
166155
167156
```bash
168157
codes start . # current directory
169158
codes start /path/to/dir # specific path
170159
codes start my-project # project alias
160+
codes s my-project # alias shorthand
171161
```
172162
173-
### `codes project`
163+
### `codes project` (alias: `p`)
174164
175165
Manage project aliases.
176166
177167
```bash
178-
codes project add my-app /path/to/my-app
168+
codes project add # add cwd as project (auto-name)
169+
codes project add /path/to/my-app # add path (auto-name from dir)
170+
codes project add my-app /path/to/my-app # add with explicit name
179171
codes project list
180172
codes project remove my-app
173+
codes p add . # alias shorthand
181174
```
182175
183-
### `codes terminal`
184-
185-
Configure which terminal emulator to use for sessions.
186-
187-
```bash
188-
codes terminal get # show current
189-
codes terminal set iterm # set to iTerm2
190-
codes terminal list # list options
191-
```
192-
193-
### `codes defaultbehavior`
194-
195-
Control where Claude starts when no arguments are provided.
196-
197-
```bash
198-
codes defaultbehavior get
199-
codes defaultbehavior set last # current | last | home
200-
codes defaultbehavior reset
201-
```
202-
203-
### `codes skippermissions`
204-
205-
Manage the global `--dangerously-skip-permissions` flag.
206-
207-
```bash
208-
codes skippermissions get
209-
codes skippermissions set true
210-
codes skippermissions reset
211-
```
212-
213-
### `codes config`
176+
### `codes config` (alias: `c`)
214177
215-
Manage global CLI configuration.
178+
Manage CLI configuration. Replaces the old `defaultbehavior`, `skippermissions`, and `terminal` commands.
216179
217180
```bash
218-
codes config get
219-
codes config set defaultBehavior last
181+
codes config get # show all settings
182+
codes config get default-behavior # show specific setting
183+
codes config set default-behavior last # current | last | home
184+
codes config set skip-permissions true # true | false
185+
codes config set terminal iterm # terminal emulator
186+
codes config list terminal # list available values
187+
codes config reset skip-permissions # reset to default
188+
codes config reset # reset all settings
189+
codes c set terminal warp # alias shorthand
220190
```
221191
222192
### `codes update`
@@ -235,14 +205,17 @@ Start MCP server over stdio.
235205
codes serve
236206
```
237207
238-
### `codes completion [shell]`
208+
### `codes remote` (alias: `r`)
239209
240-
Generate shell completion scripts.
210+
Manage remote SSH hosts for running Claude Code remotely.
241211
242212
```bash
243-
source <(codes completion zsh) # Zsh
244-
source <(codes completion bash) # Bash
245-
codes completion fish | source # Fish
213+
codes remote add myhost user@example.com
214+
codes remote list
215+
codes remote status myhost
216+
codes remote setup myhost
217+
codes remote ssh myhost
218+
codes r list # alias shorthand
246219
```
247220
248221
### `codes version`

cmd/codes/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,14 @@ func init() {
2424
rootCmd.PersistentFlags().BoolVar(&jsonFlag, "json", false, "Output in JSON format")
2525

2626
rootCmd.AddCommand(commands.InitCmd)
27-
rootCmd.AddCommand(commands.AddCmd)
28-
rootCmd.AddCommand(commands.SelectCmd)
29-
rootCmd.AddCommand(commands.TestCmd)
3027
rootCmd.AddCommand(commands.UpdateCmd)
3128
rootCmd.AddCommand(commands.VersionCmd)
3229
rootCmd.AddCommand(commands.StartCmd)
30+
rootCmd.AddCommand(commands.ProfileCmd)
3331
rootCmd.AddCommand(commands.ProjectCmd)
3432
rootCmd.AddCommand(commands.ConfigCmd)
35-
rootCmd.AddCommand(commands.DefaultBehaviorCmd)
36-
rootCmd.AddCommand(commands.SkipPermissionsCmd)
3733
rootCmd.AddCommand(commands.CompletionCmd)
3834
rootCmd.AddCommand(commands.ServeCmd)
39-
rootCmd.AddCommand(commands.TerminalCmd)
4035
rootCmd.AddCommand(commands.RemoteCmd)
4136

4237
// 设置默认运行时行为

0 commit comments

Comments
 (0)