@codevector/cli 0.3.4 → 0.5.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,11 +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
- | **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 |
38
38
 
39
39
  Each writer emits both Anthropic and OpenAI-compatible provider entries where the tool supports both wire formats. codex is OpenAI-only.
40
40
 
@@ -42,15 +42,18 @@ Each writer emits both Anthropic and OpenAI-compatible provider entries where th
42
42
 
43
43
  ## Scope model
44
44
 
45
- 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:
46
46
 
47
- | Scope | Where the file lives | Committed to git? | Recommended for |
48
- | --------- | ------------------------------------------------------------------------------------------------ | ------------------------------- | --------------------------------------------------------- |
49
- | `user` | your home directory (`~/.claude/…`, `~/.codex/…`, etc.) | no (outside the repo) | your personal default across every project |
50
- | `project` | this repo's config dir (`./.claude/settings.json`, etc.) | **yes** — shared with teammates | base URL only; we never embed the API key here |
51
- | `local` | this repo's local-override file (`./.claude/settings.local.json`, `./opencode.json`) | 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.
52
49
 
53
- `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).
54
57
 
55
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.
56
59
 
@@ -59,13 +62,17 @@ Three scopes, same names across every supported tool that allows more than one:
59
62
  ## Commands
60
63
 
61
64
  ```bash
62
- codevector auth login # sign in — prompts for gateway URL + API key
63
- 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
64
67
  codevector auth whoami # print identity the current API key resolves to
65
- 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)
66
71
  codevector configure claude-code --scope local # non-interactive: scriptable for onboarding
67
- codevector configure --all # every supported tool at once
68
- 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
69
76
  codevector models list # list models you can reach through the gateway
70
77
  codevector models list --kind chat # filter by kind: chat or embedding
71
78
  codevector models list --json # emit raw JSON for scripting
@@ -78,6 +85,7 @@ codevector usage --json # emit raw JSON for scripting
78
85
  codevector status # who am I, where am I pointed, what models can I use
79
86
  codevector doctor # health checks: creds, network, hook install, settings
80
87
  codevector version # print CLI version
88
+ codevector update # update @codevector/cli from npm (use --with pnpm|yarn if needed)
81
89
  codevector init # writes .codevector.json (projectName + ticket pattern)
82
90
  codevector init --project my-app # with explicit project name
83
91
  codevector init --ticket-pattern "JIRA-\d+" # with custom ticket extraction regex
@@ -88,6 +96,7 @@ Every command supports `--help`. Commands that need input will prompt interactiv
88
96
  ### Auth options
89
97
 
90
98
  ```bash
99
+ codevector auth login --profile staging # create or update a named profile
91
100
  codevector auth login --gateway-url https://gateway.corp.com # non-interactive URL
92
101
  codevector auth login --api-key "$GATEWAY_KEY" # non-interactive key
93
102
  codevector auth login --gateway-url https://gateway.corp.com --api-key "$KEY" # fully scriptable
@@ -115,7 +124,14 @@ codevector configure --all --scope local
115
124
 
116
125
  ```bash
117
126
  codevector auth login --gateway-url https://gateway.corp.com --api-key "$GATEWAY_KEY"
118
- 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
119
135
  ```
120
136
 
121
137
  **Inspecting what got written:**
@@ -152,7 +168,7 @@ codevector models sync --scope local # refresh model list after admin adds mod
152
168
 
153
169
  ## Credentials
154
170
 
155
- 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.
156
172
 
157
173
  `codevector doctor` warns if the file mode is looser than `0600`.
158
174
 
@@ -163,8 +179,8 @@ Override the config root with `CODEVECTOR_CONFIG_DIR`.
163
179
  ## Limitations
164
180
 
165
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.
166
- - **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.
167
- - **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`.
168
184
 
169
185
  ---
170
186