@codevector/cli 0.6.0 → 0.8.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 +61 -22
- package/dist/index.js +543 -1285
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,11 +4,13 @@ Wire your AI coding tools through a corporate gateway in one command. One API ke
|
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm i -g @codevector/cli # or: pnpm add -g @codevector/cli
|
|
7
|
-
codevector auth login
|
|
8
|
-
codevector
|
|
7
|
+
codevector auth login # once, to store your gateway + API key
|
|
8
|
+
codevector init # per repo: pin the gateway, name the project, wire your tools
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
That's the whole onboarding.
|
|
11
|
+
That's the whole onboarding. `init` is the per-repo entry point - it pins a gateway,
|
|
12
|
+
writes a `.codevector.json`, and offers to run `configure` for you. Add the shell hook
|
|
13
|
+
(below) and your credentials auto-activate as you `cd` between repos.
|
|
12
14
|
|
|
13
15
|
---
|
|
14
16
|
|
|
@@ -21,22 +23,22 @@ That's the whole onboarding. Pick a tool, pick a scope, done.
|
|
|
21
23
|
## What it does
|
|
22
24
|
|
|
23
25
|
- **Signs you in** with a per-seat API key issued by your gateway admin.
|
|
26
|
+
- **Initializes a repo** with `codevector init`: pins a gateway, names the project for attribution, and offers to wire your tools in one pass.
|
|
24
27
|
- **Writes the right config file** for each supported coding tool so its model traffic routes through the gateway instead of calling upstream providers directly.
|
|
25
28
|
- **Picks the right scope** (global, project-wide, or per-machine) based on what you want and what the tool supports.
|
|
26
|
-
- **
|
|
29
|
+
- **Auto-activates credentials on cd** via an optional shell hook, so each repo gets the gateway env vars for its pinned gateway without a per-tool config file.
|
|
27
30
|
- **Stays out of your way.** Idempotent writes. Deep-merges into existing settings files — won't clobber your theme, your other hooks, your existing env vars.
|
|
28
31
|
|
|
29
32
|
---
|
|
30
33
|
|
|
31
34
|
## Supported tools
|
|
32
35
|
|
|
33
|
-
| Tool | Config path (user scope) | Scopes (`configure` writes project/local; `system configure` writes user) | Key storage |
|
|
34
|
-
| -------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
35
|
-
| **Claude Code** | `~/.claude/settings.json` | user / project / local | literal in JSON (`ANTHROPIC_AUTH_TOKEN`) |
|
|
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 |
|
|
36
|
+
| Tool | Config path (user scope) | Scopes (`configure` writes project/local; `system configure` writes user) | Key storage |
|
|
37
|
+
| -------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
38
|
+
| **Claude Code** | `~/.claude/settings.json` | user / project / local | literal in JSON (`ANTHROPIC_AUTH_TOKEN`) |
|
|
39
|
+
| **opencode** (sst/opencode) | `~/.config/opencode/opencode.json` | user / project / local | literal (user + local); env-var reference in project scope |
|
|
38
40
|
|
|
39
|
-
Each writer emits both Anthropic and OpenAI-compatible provider entries where the tool supports both wire formats.
|
|
41
|
+
Each writer emits both Anthropic and OpenAI-compatible provider entries where the tool supports both wire formats.
|
|
40
42
|
|
|
41
43
|
---
|
|
42
44
|
|
|
@@ -49,11 +51,11 @@ Scopes are split across two commands so global state can't get clobbered by acci
|
|
|
49
51
|
|
|
50
52
|
| Scope | Where the file lives | Committed to git? | Written by | Recommended for |
|
|
51
53
|
| --------- | ------------------------------------------------------------------------------------------------ | ------------------------------- | --------------------------- | --------------------------------------------------------- |
|
|
52
|
-
| `user` | your home directory (`~/.claude/…`, `~/.
|
|
53
|
-
| `project` | this repo's config dir (`./.claude/settings.json`,
|
|
54
|
-
| `local` | this repo's local-override file (`./.claude/settings.local.json`, `./opencode.json
|
|
54
|
+
| `user` | your home directory (`~/.claude/…`, `~/.config/opencode/…`, etc.) | no (outside the repo) | `codevector system configure` | your personal default across every project |
|
|
55
|
+
| `project` | this repo's config dir (`./.claude/settings.json`, `./opencode.json`, etc.) | **yes** — shared with teammates | `codevector configure` | base URL only; we never embed the API key here |
|
|
56
|
+
| `local` | this repo's local-override file (`./.claude/settings.local.json`, `./opencode.json` + .gitignore) | no — auto-gitignored | `codevector configure` | the usual default: per-seat API key stays on your machine |
|
|
55
57
|
|
|
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
|
|
58
|
+
`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).
|
|
57
59
|
|
|
58
60
|
**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.
|
|
59
61
|
|
|
@@ -86,9 +88,14 @@ codevector status # who am I, where am I pointed, wh
|
|
|
86
88
|
codevector doctor # health checks: creds, network, hook install, settings
|
|
87
89
|
codevector version # print CLI version
|
|
88
90
|
codevector update # update @codevector/cli from npm (use --with pnpm|yarn if needed)
|
|
89
|
-
codevector init #
|
|
90
|
-
codevector init --project my-app #
|
|
91
|
-
codevector init --
|
|
91
|
+
codevector init # per-repo: pin gateway, name project, offer to wire tools
|
|
92
|
+
codevector init --project my-app # explicit project name
|
|
93
|
+
codevector init --gateway https://gw.corp.com # pin a gateway non-interactively
|
|
94
|
+
codevector init --ticket-pattern "JIRA-\d+" # custom ticket extraction regex
|
|
95
|
+
codevector init --skip-configure # write .codevector.json, don't wire tools
|
|
96
|
+
codevector init --force # overwrite an existing .codevector.json
|
|
97
|
+
codevector hook bash # print the shell-hook snippet (bash|zsh|fish)
|
|
98
|
+
codevector env --shell bash # print env exports for the current repo (used by the hook)
|
|
92
99
|
```
|
|
93
100
|
|
|
94
101
|
Every command supports `--help`. Commands that need input will prompt interactively when flags are missing, but every flag still works for scripting.
|
|
@@ -110,10 +117,18 @@ codevector auth login --gateway-url https://gateway.corp.com --api-key "$KEY" #
|
|
|
110
117
|
|
|
111
118
|
```bash
|
|
112
119
|
codevector auth login # paste the gateway URL + API key your admin emailed you
|
|
113
|
-
codevector
|
|
120
|
+
codevector init # in the repo: pins the gateway, names the project, wires your tools
|
|
114
121
|
codevector doctor # confirm everything's wired
|
|
115
122
|
```
|
|
116
123
|
|
|
124
|
+
**Auto-activate credentials as you move between repos:**
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# add to ~/.zshrc (or ~/.bashrc; fish: codevector hook fish | source)
|
|
128
|
+
eval "$(codevector hook zsh)"
|
|
129
|
+
# then: cd into any repo with a .codevector.json and its gateway env vars load automatically
|
|
130
|
+
```
|
|
131
|
+
|
|
117
132
|
**Configuring multiple tools in one go:**
|
|
118
133
|
|
|
119
134
|
```bash
|
|
@@ -130,7 +145,7 @@ codevector configure claude-code --scope local
|
|
|
130
145
|
**Set global defaults across every editor for this machine:**
|
|
131
146
|
|
|
132
147
|
```bash
|
|
133
|
-
codevector system configure # writes user-scope config for Claude Code
|
|
148
|
+
codevector system configure # writes user-scope config for Claude Code and opencode
|
|
134
149
|
codevector system restore --latest # roll back the most recent run if needed
|
|
135
150
|
```
|
|
136
151
|
|
|
@@ -156,6 +171,32 @@ codevector models sync --scope local # refresh model list after admin adds mod
|
|
|
156
171
|
|
|
157
172
|
---
|
|
158
173
|
|
|
174
|
+
## Shell hook
|
|
175
|
+
|
|
176
|
+
`codevector init` pins a gateway to a repo in `.codevector.json`. The shell hook reads
|
|
177
|
+
that pin and exports the matching profile's gateway env vars whenever you `cd` into the
|
|
178
|
+
repo, then clears them when you leave. Install it once:
|
|
179
|
+
|
|
180
|
+
| Shell | rc file | Line to add |
|
|
181
|
+
| ----- | ---------------------------- | -------------------------------- |
|
|
182
|
+
| bash | `~/.bashrc` | `eval "$(codevector hook bash)"` |
|
|
183
|
+
| zsh | `~/.zshrc` | `eval "$(codevector hook zsh)"` |
|
|
184
|
+
| fish | `~/.config/fish/config.fish` | `codevector hook fish \| source` |
|
|
185
|
+
|
|
186
|
+
On macOS, login shells read `~/.bash_profile` instead of `~/.bashrc`.
|
|
187
|
+
|
|
188
|
+
After restarting your shell, entering a repo with a pinned gateway exports
|
|
189
|
+
`ANTHROPIC_BASE_URL`, `ANTHROPIC_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_API_KEY`, and
|
|
190
|
+
`ANTHROPIC_CUSTOM_HEADERS` (the `x-project` attribution header). The CLI walks up the
|
|
191
|
+
directory tree, so a subdirectory of the repo resolves the same pin. If no saved profile
|
|
192
|
+
matches the pinned gateway, the hook prints a hint to run `codevector auth login`.
|
|
193
|
+
`codevector doctor` reports whether the hook is installed.
|
|
194
|
+
|
|
195
|
+
`codevector env --shell <shell>` is the command the hook evaluates on each `cd` — you
|
|
196
|
+
don't run it directly.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
159
200
|
## Safe config merging
|
|
160
201
|
|
|
161
202
|
`codevector configure` adds the gateway settings to your existing config files without overwriting what's already there:
|
|
@@ -179,7 +220,6 @@ Override the config root with `CODEVECTOR_CONFIG_DIR`.
|
|
|
179
220
|
## Limitations
|
|
180
221
|
|
|
181
222
|
- **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.
|
|
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
223
|
- **`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`.
|
|
184
224
|
|
|
185
225
|
---
|
|
@@ -190,6 +230,5 @@ Override the config root with `CODEVECTOR_CONFIG_DIR`.
|
|
|
190
230
|
| ---------------------- | --------------------------------------------------------- | ---------------------- |
|
|
191
231
|
| Claude Code | `~/.claude/settings.json` / `.claude/settings.local.json` | JSON |
|
|
192
232
|
| opencode | `~/.config/opencode/opencode.json` / `./opencode.json` | JSON (JSONC tolerated) |
|
|
193
|
-
| codex | `~/.codex/config.toml` | TOML |
|
|
194
233
|
| codevector credentials | `~/.config/codevector/credentials.json` | JSON (chmod 0600) |
|
|
195
|
-
| codevector
|
|
234
|
+
| codevector project pin | `<repo>/.codevector.json` | JSON (no secrets) |
|