@agent-nexus/cli 0.1.6 → 0.1.7

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.
Files changed (3) hide show
  1. package/README.md +114 -16
  2. package/dist/index.js +5963 -236
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -125,6 +125,80 @@ The CLI resolves the API key in this order (first match wins):
125
125
  | 4 | `NEXUS_ENV` env var | `production` = `https://api.nexusgpt.io`, `dev` = `http://localhost:3001` |
126
126
  | 5 | Default | `https://api.nexusgpt.io` |
127
127
 
128
+ ### Multi-Profile Support
129
+
130
+ The CLI supports multiple named profiles for managing different organizations or environments.
131
+
132
+ #### Create profiles
133
+
134
+ ```bash
135
+ # Interactive (opens browser, prompts for key and profile name)
136
+ nexus auth login
137
+
138
+ # Non-interactive with explicit profile name
139
+ nexus auth login --profile work --api-key nxs_abc123
140
+ nexus auth login --profile personal --api-key nxs_xyz789
141
+ ```
142
+
143
+ #### Switch between profiles
144
+
145
+ ```bash
146
+ nexus auth switch work
147
+ nexus auth switch personal
148
+ ```
149
+
150
+ #### List all profiles
151
+
152
+ ```bash
153
+ nexus auth list
154
+ # PROFILE ORGANIZATION BASE URL
155
+ # ▸ work Acme Corp https://api.nexusgpt.io
156
+ # personal My Startup https://api.nexusgpt.io
157
+ ```
158
+
159
+ #### Pin a directory to a profile
160
+
161
+ Create a `.nexusrc` file in your project directory so the CLI automatically uses the right profile:
162
+
163
+ ```bash
164
+ cd ~/projects/acme
165
+ nexus auth pin work
166
+ # Creates .nexusrc with { "profile": "work" }
167
+
168
+ cd ~/projects/startup
169
+ nexus auth pin personal
170
+ ```
171
+
172
+ #### Check which profile is active
173
+
174
+ ```bash
175
+ nexus auth status
176
+ # Using profile "work" (Acme Corp) — .nexusrc at /Users/you/projects/acme/.nexusrc
177
+ ```
178
+
179
+ #### Profile Resolution Order
180
+
181
+ When determining which profile to use, the CLI checks (first match wins):
182
+
183
+ | Priority | Source | Example |
184
+ |----------|--------|---------|
185
+ | 1 | `--api-key` flag or `NEXUS_API_KEY` env | Bypasses profiles entirely |
186
+ | 2 | `--profile` flag | `nexus agent list --profile work` |
187
+ | 3 | `NEXUS_PROFILE` env var | `export NEXUS_PROFILE=work` |
188
+ | 4 | `.nexusrc` file | Walks up directory tree to find `.nexusrc` |
189
+ | 5 | Active profile | Set by `nexus auth switch` |
190
+ | 6 | `"default"` profile | Fallback |
191
+
192
+ #### Remove profiles
193
+
194
+ ```bash
195
+ nexus auth logout # removes active profile
196
+ nexus auth logout work # removes specific profile
197
+ nexus auth logout --all # removes everything
198
+
199
+ nexus auth unpin # removes .nexusrc from current directory
200
+ ```
201
+
128
202
  ---
129
203
 
130
204
  ## Quick Start
@@ -183,11 +257,13 @@ These flags are available on every command:
183
257
 
184
258
  | Flag | Description |
185
259
  | ------------------ | ------------------------------------------------- |
186
- | `--json` | Output results as JSON (for scripting and piping) |
187
- | `--api-key <key>` | Override the API key for this invocation |
188
- | `--base-url <url>` | Override the API base URL |
189
- | `-v, --version` | Print the CLI version and exit |
190
- | `--help` | Show help for any command or subcommand |
260
+ | `--json` | Output results as JSON (for scripting and piping) |
261
+ | `--api-key <key>` | Override the API key for this invocation |
262
+ | `--base-url <url>` | Override the API base URL |
263
+ | `--profile <name>` | Use a specific named profile |
264
+ | `--no-auto-update` | Disable automatic CLI updates for this invocation |
265
+ | `-v, --version` | Print the CLI version and exit |
266
+ | `--help` | Show help for any command or subcommand |
191
267
 
192
268
  ### Environment Variables
193
269
 
@@ -196,6 +272,7 @@ These flags are available on every command:
196
272
  | `NEXUS_API_KEY` | API key (used when `--api-key` flag and config file are absent) |
197
273
  | `NEXUS_BASE_URL` | API base URL override |
198
274
  | `NEXUS_ENV` | Environment name: `production` (default) or `dev` |
275
+ | `NEXUS_PROFILE` | Profile name override (same as `--profile` flag) |
199
276
  | `NO_COLOR` | Disable all color output ([no-color.org](https://no-color.org)) |
200
277
 
201
278
  ---
@@ -337,7 +414,7 @@ All commands follow the pattern: `nexus <group> <action> [arguments] [options]`
337
414
 
338
415
  | Command | Subcommands | Description |
339
416
  | ---------------------------------------------------------- | ----------------------------------------------------------- | ------------------------- |
340
- | [`auth`](docs/command-reference.md#nexus-auth) | `login` `logout` `whoami` | Authentication |
417
+ | [`auth`](docs/command-reference.md#nexus-auth) | `login` `logout` `switch` `list` `pin` `unpin` `status` `whoami` | Authentication |
341
418
  | [`agent`](docs/command-reference.md#nexus-agent) | `list` `get` `create` `update` `delete` `duplicate` | AI agent management |
342
419
  | [`agent-tool`](docs/command-reference.md#nexus-agent-tool) | `list` `get` `create` `update` `delete` | Agent tool configurations |
343
420
  | [`version`](docs/command-reference.md#nexus-version) | `list` `get` `create` `update` `delete` `restore` `publish` | Prompt version management |
@@ -399,8 +476,9 @@ All commands follow the pattern: `nexus <group> <action> [arguments] [options]`
399
476
 
400
477
  | Command | Subcommands | Description |
401
478
  | ---------------------------------------------------- | ------------- | ------------------------------ |
402
- | [`api`](docs/command-reference.md#nexus-api) | (passthrough) | Call any API endpoint directly |
403
- | [`upgrade`](docs/command-reference.md#nexus-upgrade) | (self-update) | Upgrade the CLI to latest |
479
+ | [`api`](docs/command-reference.md#nexus-api) | (passthrough) | Call any API endpoint directly |
480
+ | [`docs`](docs/command-reference.md#nexus-docs) | (topic browser) | View built-in documentation |
481
+ | [`upgrade`](docs/command-reference.md#nexus-upgrade) | (self-update) | Upgrade the CLI to latest |
404
482
 
405
483
  > **Full reference:** See [docs/command-reference.md](docs/command-reference.md) for complete documentation of every command, option, and example.
406
484
 
@@ -626,22 +704,42 @@ sudo npm install -g @agent-nexus/cli@latest
626
704
 
627
705
  ## Configuration Files
628
706
 
629
- | File | Purpose | Permissions |
630
- | --------------------------------- | ---------------------------------------------------- | ----------- |
631
- | `~/.nexus-mcp/config.json` | API key and base URL (written by `nexus auth login`) | `0600` |
632
- | `~/.nexus-mcp/version-check.json` | Update check cache (auto-managed, checked once/day) | `0600` |
707
+ | File | Purpose | Permissions |
708
+ |------|---------|-------------|
709
+ | `~/.nexus-mcp/config.json` | Profiles with API keys and base URLs | `0600` |
710
+ | `~/.nexus-mcp/version-check.json` | Update check cache (auto-managed, checked once/day) | `0600` |
711
+ | `.nexusrc` | Directory-level profile pinning (created by `nexus auth pin`) | — |
633
712
 
634
- The `~/.nexus-mcp/` directory is created with `0700` permissions. This path is shared with the [`@nexus/mcp-server`](../mcp-server/) package, so logging in via the CLI also authenticates the MCP server.
713
+ The `~/.nexus-mcp/` directory is created with `0700` permissions. This path is shared with the [`@nexus/mcp-server`](../mcp-server/) package.
635
714
 
636
- ### Config File Format
715
+ ### Config File Format (V2)
637
716
 
638
717
  ```json
639
718
  {
640
- "apiKey": "nxs_your_api_key_here",
641
- "baseUrl": "https://api.nexusgpt.io"
719
+ "activeProfile": "work",
720
+ "profiles": {
721
+ "work": {
722
+ "apiKey": "nxs_...",
723
+ "baseUrl": "https://api.nexusgpt.io",
724
+ "orgName": "Acme Corp",
725
+ "orgId": "org_..."
726
+ },
727
+ "personal": {
728
+ "apiKey": "nxs_...",
729
+ "orgName": "My Startup"
730
+ }
731
+ }
642
732
  }
643
733
  ```
644
734
 
735
+ ### .nexusrc Format
736
+
737
+ ```json
738
+ { "profile": "work" }
739
+ ```
740
+
741
+ Place in your project root. The CLI walks up the directory tree to find it. Consider adding `.nexusrc` to `.gitignore`.
742
+
645
743
  ---
646
744
 
647
745
  ## Related Resources