@codevector/cli 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,12 +30,11 @@ That's the whole onboarding. Pick a tool, pick a scope, done.
30
30
 
31
31
  ## Supported tools
32
32
 
33
- | Tool | Config path (user scope) | Scopes | Key storage | Hooks wired |
34
- | -------------------------------- | ---------------------------------------- | ---------------------- | ---------------------------------------------------------- | --------------------- |
35
- | **Claude Code** | `~/.claude/settings.json` | user / project / local | literal in JSON (`ANTHROPIC_AUTH_TOKEN`) | `Stop` + `SessionEnd` |
36
- | **opencode** (sst/opencode) | `~/.config/opencode/opencode.json` | user / project / local | literal (user + local); env-var reference in project scope | — |
37
- | **qwen-code** (Alibaba Qwen CLI) | `~/.qwen/settings.json` + `~/.qwen/.env` | user / project / local | `.env` file alongside settings (`envKey` reference) | `Stop` + `SessionEnd` |
38
- | **codex** (OpenAI codex CLI) | `~/.codex/config.toml` | **user only** | shell env var (codex does not auto-load `.env`) | not wired |
33
+ | Tool | Config path (user scope) | Scopes (`configure` writes project/local; `system configure` writes user) | Key storage | Hooks wired |
34
+ | -------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------- |
35
+ | **Claude Code** | `~/.claude/settings.json` | user / project / local | literal in JSON (`ANTHROPIC_AUTH_TOKEN`) | `Stop` + `SessionEnd` |
36
+ | **opencode** (sst/opencode) | `~/.config/opencode/opencode.json` | user / project / local | literal (user + local); env-var reference in project scope | — |
37
+ | **codex** (OpenAI codex CLI) | `~/.codex/config.toml` | user / project / local | shell env var (codex does not auto-load `.env`) | not wired |
39
38
 
40
39
  Each writer emits both Anthropic and OpenAI-compatible provider entries where the tool supports both wire formats. codex is OpenAI-only.
41
40
 
@@ -43,15 +42,18 @@ Each writer emits both Anthropic and OpenAI-compatible provider entries where th
43
42
 
44
43
  ## Scope model
45
44
 
46
- Three scopes, same names across every supported tool that allows more than one:
45
+ Scopes are split across two commands so global state can't get clobbered by accident:
47
46
 
48
- | Scope | Where the file lives | Committed to git? | Recommended for |
49
- | --------- | ------------------------------------------------------------------------------------------------ | ------------------------------- | --------------------------------------------------------- |
50
- | `user` | your home directory (`~/.claude/…`, `~/.codex/…`, etc.) | no (outside the repo) | your personal default across every project |
51
- | `project` | this repo's config dir (`./.claude/settings.json`, etc.) | **yes** — shared with teammates | base URL only; we never embed the API key here |
52
- | `local` | this repo's local-override file (`./.claude/settings.local.json`, `./opencode.json`, `./.qwen/`) | no — auto-gitignored | the usual default: per-seat API key stays on your machine |
47
+ - `codevector configure` writes **`local`** (default, gitignored, per-seat) or **`project`** (committed, shared with team) only. It never touches files outside the repo.
48
+ - `codevector system configure` writes the **`user`** scope for every supported editor at once, and backs up any pre-existing files to `~/.codevector/backups/<timestamp>/<tool>/` so `system restore` can roll back.
53
49
 
54
- `local` is the default when you don't pass `--scope`. The CLI adds gitignore entries automatically for tools that don't natively ignore their local file.
50
+ | Scope | Where the file lives | Committed to git? | Written by | Recommended for |
51
+ | --------- | ------------------------------------------------------------------------------------------------ | ------------------------------- | --------------------------- | --------------------------------------------------------- |
52
+ | `user` | your home directory (`~/.claude/…`, `~/.codex/…`, etc.) | no (outside the repo) | `codevector system configure` | your personal default across every project |
53
+ | `project` | this repo's config dir (`./.claude/settings.json`, `./.codex/config.toml`, etc.) | **yes** — shared with teammates | `codevector configure` | base URL only; we never embed the API key here |
54
+ | `local` | this repo's local-override file (`./.claude/settings.local.json`, `./opencode.json`, `./.codex/config.toml` + .gitignore) | no — auto-gitignored | `codevector configure` | the usual default: per-seat API key stays on your machine |
55
+
56
+ `local` is the default when you don't pass `--scope` to `configure`. The CLI adds gitignore entries automatically for tools that don't natively ignore their local file (opencode, codex).
55
57
 
56
58
  **Secret hygiene:** `project` scope will never write your API key to disk. It writes an env-var reference (`{env:CODEVECTOR_GATEWAY_KEY}` or an `envKey` field) and prints a note telling you to export the variable yourself. This is the only safe way to commit a config file.
57
59
 
@@ -60,13 +62,17 @@ Three scopes, same names across every supported tool that allows more than one:
60
62
  ## Commands
61
63
 
62
64
  ```bash
63
- codevector auth login # sign in — prompts for gateway URL + API key
64
- codevector auth logout # delete local credentials; hooks are left in place
65
+ codevector auth login # sign in — prompts for profile, gateway URL + API key
66
+ codevector auth logout # delete local credentials for a profile; hooks are left in place
65
67
  codevector auth whoami # print identity the current API key resolves to
66
- codevector configure # interactive: pick tools, pick scope
68
+ codevector profile list # list configured profiles (default pinned at top)
69
+ codevector profile switch # interactively switch the active profile
70
+ codevector configure # interactive: pick tools, pick scope (local|project)
67
71
  codevector configure claude-code --scope local # non-interactive: scriptable for onboarding
68
- codevector configure --all # every supported tool at once
69
- codevector configure opencode --scope user # wire up opencode globally
72
+ codevector configure --all # every supported tool at once (local|project)
73
+ codevector system configure # user-scope: write global defaults for all editors, with backups
74
+ codevector system restore # roll back the most recent (or chosen) system configure run
75
+ codevector system restore --latest --yes # non-interactive rollback
70
76
  codevector models list # list models you can reach through the gateway
71
77
  codevector models list --kind chat # filter by kind: chat or embedding
72
78
  codevector models list --json # emit raw JSON for scripting
@@ -79,6 +85,7 @@ codevector usage --json # emit raw JSON for scripting
79
85
  codevector status # who am I, where am I pointed, what models can I use
80
86
  codevector doctor # health checks: creds, network, hook install, settings
81
87
  codevector version # print CLI version
88
+ codevector update # update @codevector/cli from npm (use --with pnpm|yarn if needed)
82
89
  codevector init # writes .codevector.json (projectName + ticket pattern)
83
90
  codevector init --project my-app # with explicit project name
84
91
  codevector init --ticket-pattern "JIRA-\d+" # with custom ticket extraction regex
@@ -89,6 +96,7 @@ Every command supports `--help`. Commands that need input will prompt interactiv
89
96
  ### Auth options
90
97
 
91
98
  ```bash
99
+ codevector auth login --profile staging # create or update a named profile
92
100
  codevector auth login --gateway-url https://gateway.corp.com # non-interactive URL
93
101
  codevector auth login --api-key "$GATEWAY_KEY" # non-interactive key
94
102
  codevector auth login --gateway-url https://gateway.corp.com --api-key "$KEY" # fully scriptable
@@ -116,7 +124,14 @@ codevector configure --all --scope local
116
124
 
117
125
  ```bash
118
126
  codevector auth login --gateway-url https://gateway.corp.com --api-key "$GATEWAY_KEY"
119
- codevector configure claude-code --scope user
127
+ codevector configure claude-code --scope local
128
+ ```
129
+
130
+ **Set global defaults across every editor for this machine:**
131
+
132
+ ```bash
133
+ codevector system configure # writes user-scope config for Claude Code, opencode, and codex
134
+ codevector system restore --latest # roll back the most recent run if needed
120
135
  ```
121
136
 
122
137
  **Inspecting what got written:**
@@ -153,7 +168,7 @@ codevector models sync --scope local # refresh model list after admin adds mod
153
168
 
154
169
  ## Credentials
155
170
 
156
- Stored at `~/.config/codevector/credentials.json` (chmod `0600`). Contains gateway URL, API key, user ID, email, and a timestamp. `codevector auth logout` deletes this file.
171
+ Stored at `~/.config/codevector/credentials.json` (chmod `0600`). Contains one or more named profiles, each with a gateway URL, API key, user ID, email, and a timestamp. One profile is marked active and is used by all commands. `codevector auth logout` removes the active (or chosen) profile. `codevector profile list` and `codevector profile switch` manage profiles interactively.
157
172
 
158
173
  `codevector doctor` warns if the file mode is looser than `0600`.
159
174
 
@@ -164,8 +179,8 @@ Override the config root with `CODEVECTOR_CONFIG_DIR`.
164
179
  ## Limitations
165
180
 
166
181
  - **Cursor requires manual setup.** Cursor stores its settings in an internal database, so the CLI can't configure it automatically. Find step-by-step instructions on your gateway dashboard.
167
- - **codex is user-scope only.** codex (OpenAI's CLI) has no project or local config. `codevector configure codex --scope project` returns a skipped status with a clear message.
168
- - **codex doesn't auto-load `.env`.** After configuring codex, export `CODEVECTOR_GATEWAY_KEY` in your shell rc yourself. The CLI prints the line to paste.
182
+ - **codex doesn't auto-load `.env`.** After configuring codex at any scope, export `CODEVECTOR_GATEWAY_KEY` in your shell rc yourself. The CLI prints the line to paste.
183
+ - **`configure --scope user` is no longer accepted.** Use `codevector system configure` for machine-wide setup; it writes every editor in one pass and backs up existing files for rollback via `system restore`.
169
184
 
170
185
  ---
171
186
 
@@ -175,8 +190,6 @@ Override the config root with `CODEVECTOR_CONFIG_DIR`.
175
190
  | ---------------------- | --------------------------------------------------------- | ---------------------- |
176
191
  | Claude Code | `~/.claude/settings.json` / `.claude/settings.local.json` | JSON |
177
192
  | opencode | `~/.config/opencode/opencode.json` / `./opencode.json` | JSON (JSONC tolerated) |
178
- | qwen-code | `~/.qwen/settings.json` / `.qwen/settings.json` | JSON |
179
- | qwen-code secrets | `~/.qwen/.env` / `.qwen/.env` | dotenv |
180
193
  | codex | `~/.codex/config.toml` | TOML |
181
194
  | codevector credentials | `~/.config/codevector/credentials.json` | JSON (chmod 0600) |
182
195
  | codevector hook script | `~/.config/codevector/hooks/acceptance.sh` | shell |