@aivin-labs/cli 1.0.5 → 1.0.8

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 (67) hide show
  1. package/README.md +263 -216
  2. package/bin/cli.mjs +1780 -1366
  3. package/bin/lib/browserAutomation.mjs +655 -648
  4. package/bin/lib/browserTui.mjs +276 -251
  5. package/bin/lib/cancellation.mjs +61 -0
  6. package/bin/lib/mcpProxy.mjs +869 -837
  7. package/bin/lib/missionStream.mjs +696 -691
  8. package/bin/lib/releaseKeys.mjs +9 -0
  9. package/bin/lib/remote/activityLog.mjs +68 -0
  10. package/bin/lib/remote/autoStart.mjs +457 -0
  11. package/bin/lib/remote/autoUpdate.mjs +129 -0
  12. package/bin/lib/remote/brand.mjs +60 -0
  13. package/bin/lib/remote/browserTunnel.mjs +292 -0
  14. package/bin/lib/remote/callLedger.mjs +134 -0
  15. package/bin/lib/remote/cdpPolicy.mjs +66 -0
  16. package/bin/lib/remote/client.mjs +726 -0
  17. package/bin/lib/remote/constants.mjs +173 -0
  18. package/bin/lib/remote/credentials.mjs +208 -0
  19. package/bin/lib/remote/daemonLock.mjs +86 -0
  20. package/bin/lib/remote/dailyBrowser.mjs +371 -0
  21. package/bin/lib/remote/deviceMemory.mjs +246 -0
  22. package/bin/lib/remote/deviceProfile.mjs +142 -0
  23. package/bin/lib/remote/deviceWatches.mjs +138 -0
  24. package/bin/lib/remote/docText.mjs +117 -0
  25. package/bin/lib/remote/fileIndexer.mjs +399 -0
  26. package/bin/lib/remote/gui/index.mjs +245 -0
  27. package/bin/lib/remote/gui/officeHostSource.mjs +393 -0
  28. package/bin/lib/remote/gui/windowsHost.mjs +109 -0
  29. package/bin/lib/remote/gui/windowsHostSource.mjs +904 -0
  30. package/bin/lib/remote/httpTransfer.mjs +89 -0
  31. package/bin/lib/remote/idempotency.mjs +135 -0
  32. package/bin/lib/remote/keepAwake.mjs +100 -0
  33. package/bin/lib/remote/localConfirm.mjs +268 -0
  34. package/bin/lib/remote/localPolicy.mjs +249 -0
  35. package/bin/lib/remote/mascot/assets.mjs +218 -0
  36. package/bin/lib/remote/mascot/hostSource.mjs +362 -0
  37. package/bin/lib/remote/mascot/index.mjs +322 -0
  38. package/bin/lib/remote/mascot/labels.mjs +83 -0
  39. package/bin/lib/remote/mascot/strings.mjs +189 -0
  40. package/bin/lib/remote/memberFsPool.mjs +134 -0
  41. package/bin/lib/remote/memberFsWorker.mjs +60 -0
  42. package/bin/lib/remote/mission.mjs +156 -0
  43. package/bin/lib/remote/missionQuestion.mjs +63 -0
  44. package/bin/lib/remote/multiUser.mjs +344 -0
  45. package/bin/lib/remote/netProxy.mjs +145 -0
  46. package/bin/lib/remote/notify.mjs +58 -0
  47. package/bin/lib/remote/office/index.mjs +90 -0
  48. package/bin/lib/remote/policyCommand.mjs +93 -0
  49. package/bin/lib/remote/processes.mjs +217 -0
  50. package/bin/lib/remote/sandbox.mjs +221 -0
  51. package/bin/lib/remote/schedule.mjs +213 -0
  52. package/bin/lib/remote/scheduler.mjs +124 -0
  53. package/bin/lib/remote/textIndex.mjs +131 -0
  54. package/bin/lib/remote/tokenStore.mjs +77 -0
  55. package/bin/lib/remote/toolHandlers.mjs +726 -0
  56. package/bin/lib/remote/undoStore.mjs +242 -0
  57. package/bin/lib/remoteControl.mjs +26 -0
  58. package/bin/lib/scaffold.mjs +654 -653
  59. package/bin/lib/selfUpdate.mjs +71 -0
  60. package/bin/lib/update/binarySwap.mjs +63 -0
  61. package/bin/lib/update/constants.mjs +56 -0
  62. package/bin/lib/update/download.mjs +145 -0
  63. package/bin/lib/update/signature.mjs +42 -0
  64. package/bin/lib/update/state.mjs +205 -0
  65. package/bin/lib/update/versions.mjs +60 -0
  66. package/docs/CLI.md +1353 -1299
  67. package/package.json +71 -62
package/docs/CLI.md CHANGED
@@ -1,1299 +1,1353 @@
1
- # 🖥️ CLI Reference
2
-
3
- `aivin` is built on [Commander](https://github.com/tj/commander.js), so help is always available
4
- without needing this doc:
5
-
6
- ```bash
7
- aivin --help # or: aivin help
8
- aivin <command> --help # or: aivin help <command>
9
- ```
10
-
11
- Every command below is real - this is the exact output of `aivin --help` as of this CLI version.
12
-
13
- ```
14
- Usage: aivin [options] [command]
15
-
16
- aivin CLI - scaffold, run, and deploy Aivin plugins
17
-
18
- Options:
19
- -V, --version output the version number
20
- -h, --help display help for command
21
-
22
- Commands:
23
- create [options] [name] Create new plugin
24
- init [options] [name] Set up a new plugin step by step: asks what it should do, then generates real working code from that description
25
- validate [options] Validate manifest.json in the current directory (or --json/--stdin for scripted use)
26
- start [options] Start plugin server
27
- deploy Deploy plugin to your org on the Aivin server
28
- test [options] Deploy to a non-production test instance, then smoke-test it with generated input and save a report to .test/
29
- plugin AI-assisted plugin authoring
30
- connector Register and discover reusable connectors (OAuth apps / credential-form namespaces)
31
- pluginstore Self-hosted aivin-service worker (Docker) - attach it to your org as a plugin store
32
- mcp [options] [url] MCP proxy plugins - wrap an external MCP server tool/resource/prompt, no code required
33
- login [options] [baseUrl] Log in and save an API key for plugin deployment (opens your browser by default)
34
- whoami Show which account is currently logged in on this machine (reads ~/.aivin/credentials - no server call)
35
- key Manage named API keys for your account
36
- browser [options] [mission] Run an AI Browser mission - by default opens/reuses a local browser window dedicated to AI Browser (own profile, own cookies - log in once, watch missions run live from then on); --remote uses a server-side browser instead
37
- do [options] [agentNickname] [mission] Have <agentNickname> work toward a goal in the background - not a specific deployed plugin
38
- task [options] [description] Create a new task from a plain-language description
39
- workspace [options] Browse your workspaces and projects, and pick one to use with --workspace/--project
40
- agent Search, install, create, and publish AI Staff agents
41
- project Create, update, and delete projects within a workspace
42
- help [command] display help for command
43
- ```
44
-
45
- ## `aivin init [name]`
46
-
47
- The simplest way to start: asks what the plugin should do, then scaffolds the project **and**
48
- generates real working code from that description in one step - no separate `aivin create` +
49
- `aivin plugin make` needed.
50
-
51
- ```bash
52
- aivin init my-plugin
53
- # ? Plugin name: my-plugin
54
- # ? What should this plugin do? (be specific - this is what generates your code)
55
- # > Summarize a support ticket and tag its urgency low/medium/high
56
- ```
57
-
58
- Options:
59
-
60
- ```
61
- Options:
62
- --name <name> Plugin name (if not specified, will prompt)
63
- --model <model> LLM model to use for generation
64
- --provider <provider> LLM provider to use for generation
65
- ```
66
-
67
- Writes two source files instead of one, unlike `aivin create`:
68
-
69
- - **`src/service.ts`** - the actual business logic, AI-generated from your description. A single
70
- exported `execute(input, ctx)` that returns plain result data (or throws a plain `Error`) - no
71
- `PluginResponse`/`PluginStatus` boilerplate to think about.
72
- - **`src/main.ts`** - a thin, static wrapper (not AI-generated, doesn't change between runs). Calls
73
- `execute()` and packages the result into the `PluginResponse` the platform expects. This filename
74
- is fixed - the runtime always loads exactly `src/main.ts`, so it's never regenerated or renamed.
75
-
76
- If code generation fails (network issue, `API_KEY` not set, etc.), `aivin init` still leaves you
77
- with a working, deployable scaffold - it falls back to the same plain placeholder `aivin create`
78
- writes, so nothing is left half-broken.
79
-
80
- Regenerating later: `aivin plugin make "<new description>"` detects `src/service.ts` and targets it
81
- instead of `src/main.ts`, so the split is preserved (see below).
82
-
83
- Prefer no AI step at all? `aivin create` scaffolds the same project structure minus the generation -
84
- one `src/main.ts` you write by hand.
85
-
86
- ## `aivin create`
87
-
88
- Scaffold a new plugin project (`manifest.json`, `src/main.ts`, `package.json`, `tsconfig.json`,
89
- `.env`, `.gitignore`).
90
-
91
- ```
92
- Usage: aivin create [options] [name]
93
-
94
- Options:
95
- --json <config> JSON config (AI mode)
96
- --stdin Read from stdin
97
- --name <name> Plugin name (if not specified, will prompt)
98
- --silent Silent mode
99
- --json-output JSON output
100
- ```
101
-
102
- - `aivin create <name>` (or `--name <name>`) → creates a new `<name>/` subdirectory and scaffolds
103
- into it, no name prompt (description still prompted).
104
- - No name at all → interactive prompts for both name and description, scaffolding into the
105
- **current** directory - `mkdir`/`cd` into your target folder yourself first.
106
- - `--json '<config>'` / `--stdin` → non-interactive/scripted mode for AI tooling, also creates a
107
- `<config.name>/` subdirectory. `config` needs at least `name` and `description`; anything else
108
- (`input`, `output`, `trigger_type`, ...) is merged straight into the generated `manifest.json`.
109
- `config` may also be a path to a JSON file.
110
- - `--json-output` → prints a machine-readable `{ success, pluginDir, name, description, timestamp }`
111
- result instead of the usual colored console output.
112
-
113
- ```bash
114
- aivin create my-plugin
115
- aivin create --json '{"name":"my-plugin","description":"Summarize tickets"}'
116
- ```
117
-
118
- ## `aivin validate`
119
-
120
- Validates a plugin config against the same rules `aivin create` enforces (name format, required
121
- `description`, and - if present - `proxy_config` completeness for MCP proxy plugins). Doesn't touch
122
- the network.
123
-
124
- With no flags, validates `manifest.json` in the current directory - the common case:
125
-
126
- ```bash
127
- cd my-plugin
128
- aivin validate
129
- ```
130
-
131
- ```
132
- Options:
133
- --json <config> JSON config, instead of reading manifest.json from the current directory
134
- --stdin Read JSON config from stdin, instead of reading manifest.json
135
- --json-output JSON output
136
- ```
137
-
138
- `--json`/`--stdin` remain for scripted/CI use where the config isn't a file on disk yet:
139
-
140
- ```bash
141
- aivin validate --json '{"name":"my-plugin","description":"x"}'
142
- ```
143
-
144
- ## `aivin start`
145
-
146
- Runs the current plugin directory (must contain `manifest.json` and `src/main.ts`) against a real
147
- local server - specifically, this project's own installed `@aivin-labs/sdk`'s `bin/server.mjs`
148
- (resolved from *this project's* `node_modules`, not the CLI's own install location - if you see
149
- "Could not find @aivin-labs/sdk installed", run `npm install` first). Starts:
150
-
151
- 1. A real gRPC server (bind `0.0.0.0:50051`) - the same protocol the production host uses to
152
- trigger your handler(s). You don't call this directly.
153
- 2. In development (anything but `NODE_ENV=production`), an HTTP test shim on `:4001` (override with
154
- `LOCAL_TEST_PORT`) for manual `curl` testing.
155
-
156
- ```bash
157
- aivin start
158
- curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
159
- -d '{"input":{"text":"hello"}}'
160
- ```
161
-
162
- With more than one `plugins: []` entry, pass `mission` to pick which entry's `func` runs - it's
163
- matched against each entry's `id`, falling back to `func` (a single-entry manifest, the scaffold
164
- default, always resolves to its one entry - no `mission` needed):
165
-
166
- ```bash
167
- curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
168
- -d '{"mission":"summarize-ticket","input":{"text":"hello"}}'
169
- ```
170
-
171
- SDK calls made while running default to the **production** backend (`api.aivin.cloud`) if
172
- `SDK_ENDPOINT` isn't set in `.env` - point it at a local/dev backend instead if you don't want
173
- that (see [Environment variables](#environment-variables) below).
174
-
175
- ### Hot-reload
176
-
177
- Saving `src/**` or `manifest.json` re-imports the plugin in place - no more Ctrl+C + `aivin start`
178
- again after every edit. Both the real gRPC server and the `:4001` HTTP test shim pick up the change
179
- together. A broken save (syntax error, missing export) is reported and the *previous* working
180
- version keeps serving until you fix it - a typo mid-edit doesn't kill the running server.
181
-
182
- ```
183
- ♻️ Reloaded (src/main.ts): my-plugin (My Plugin) v0.1.0
184
- ```
185
-
186
- On by default in development; disabled automatically inside a real deployed container (detected via
187
- `SDK_SECRET_FILE`, which only a real deploy sets - `NODE_ENV=production` alone doesn't reliably mean
188
- "deployed", the platform's own container build never sets it). This same file is also the
189
- container's entrypoint in production, where the plugin source is also bind-mounted read-only, so
190
- there'd be nothing for the watcher to see even without this check. Turn it off by hand with
191
- `--no-watch` or `AIVIN_START_WATCH=false`.
192
-
193
- ### Live per-call debugging: `--debug` / `--debug-json`
194
-
195
- By default you only see a trace summary once the whole invocation finishes (`AIVIN_TRACE`, on by
196
- default - see [Environment variables](#environment-variables)). To watch each `sdk.*` call as it
197
- happens instead:
198
-
199
- ```bash
200
- aivin start --debug # human-readable: one line per call, live
201
- aivin start --debug-json # same events, one JSON object per line - for a script/coding agent
202
- # to parse instead of pattern-matching free text
203
- ```
204
-
205
- Both are `SDK_DEBUG=true`/`SDK_DEBUG=json` under the hood (settable directly if you're not going
206
- through `aivin start`, e.g. inside `aivin test`'s smoke-test run). Each line/event covers exactly
207
- one `sdk.*` call: `namespace`, `duration_ms`, `attempts`, `success`, `error` (if any).
208
-
209
- ## `aivin deploy`
210
-
211
- Deploys the plugin in the current directory (`manifest.json` + every project file except
212
- `node_modules/`, `.git/`, `.tmp/`, `dist/`, `build/`, `.test/`, `.gitignore`, `yarn.lock`, and
213
- `.env`) to `POST /plugins/deploy`. Always private to your org - there's no CLI-reachable "submit to
214
- the public store" path for regular code/Docker plugins today (that only exists through the browser
215
- CodeEditor's publish flow, a different runtime). **MCP proxy plugins are the one exception** -
216
- `aivin mcp <url> --publish` (below) can submit those to the community store directly from the CLI.
217
-
218
- - `manifest.json` is normally the default `{ ...commonFields, plugins: [...] }` shape (see
219
- [MANIFEST.md#default-shape](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#default-shape)) - common fields are copied onto each
220
- entry in `plugins` before upload, and all entries deploy together, sharing one running
221
- container. The legacy flat single-object shape is still accepted.
222
- - If every entry's `manifest.proxy_config` is set (MCP proxy plugins - see `aivin mcp create`
223
- below), no files are read or sent at all - just the manifest.
224
- - `package-lock.json` is auto-generated (`npm install --package-lock-only`) before upload if missing
225
- - the backend's build runs `npm ci`, which requires one.
226
- - On success, auto-increments `manifest.json`'s patch version(s) and writes back the plugin id(s)
227
- the server assigned.
228
-
229
- ```bash
230
- aivin deploy
231
- ```
232
-
233
- ## `aivin test`
234
-
235
- Same payload/logic as `aivin deploy`, but against `POST /plugins/test/deploy` - a non-production
236
- instance for verifying the plugin runs end-to-end on real infra (real container, real gRPC, real
237
- the SDK) before anyone else can see it. This endpoint is blocked by the backend in production.
238
-
239
- After a successful deploy, it also **smoke-tests** every non-proxy plugin entry: generates sample
240
- input from `manifest.json`'s `input` schema (`POST /code/generate-sample-data`), invokes the plugin
241
- for real (`POST /plugins/execute`) against a workspace, and writes a pass/fail report to
242
- `.test/<timestamp>.json` in the project directory (also excluded from future deploy uploads).
243
-
244
- **MCP proxy entries are skipped by default** - there's no generic "sample input" that makes sense
245
- for a tool schema an external MCP server defines itself, so `aivin test` deploys them but runs no
246
- automated invoke/report unless you opt in with `--verify-proxy`. Use
247
- `aivin plugin trigger --id <pluginId> -a "<prompt>"` (or the interactive "Test now?" step
248
- `aivin mcp <url>` offers right after deploy) to test one by hand instead.
249
-
250
- ```
251
- Options:
252
- --workspace <id> Workspace id to run the smoke test against (default: auto-picks your first one)
253
- --no-smoke-test Only deploy - skip the generated-input invoke test and report
254
- --verify-proxy Also invoke MCP proxy entries for real (empty input) instead of skipping
255
- them - only use if you know the underlying tool(s) have no meaningful side
256
- effects
257
- ```
258
-
259
- ```bash
260
- aivin test # deploy + smoke-test + report
261
- aivin test --workspace <id> # smoke-test against a specific workspace
262
- aivin test --no-smoke-test # deploy only, same as before this flag existed
263
- aivin test --verify-proxy # also invoke proxy entries with empty input, for real
264
- ```
265
-
266
- `--verify-proxy` sends `arguments: {}` (not AI-generated - proxy's `input` schema is the generic
267
- `{ data: object }` passthrough, so there's nothing meaningful to infer a "realistic" sample from)
268
- straight to `/plugins/execute`. This really calls the external MCP server - only use it if the
269
- tool(s) involved are safe to invoke automatically (idempotent/read-only), since a repeated `aivin
270
- test` run means a repeated real call every time.
271
-
272
- Entries the MCP server itself flagged destructive/non-readonly (via the MCP spec's own
273
- `readOnlyHint`/`destructiveHint` tool annotations, surfaced on the manifest as `request_hil: true`)
274
- are skipped even under `--verify-proxy` - that flag means "the caller vetted these tools as safe to
275
- call automatically," which doesn't extend to a tool the server itself is warning isn't. Verify
276
- those by hand instead (`aivin plugin trigger --id <id> -a "..."`).
277
-
278
- ## `aivin plugin make <description>`
279
-
280
- AI-generates a plugin from a natural-language description, via `POST /code/generate-project` -
281
- **complexity-adaptive**: the backend classifies the requirement first, and only escalates beyond a
282
- single `src/main.ts` when it's genuinely complex.
283
-
284
- ```
285
- Options:
286
- --model <model> LLM model to use for generation
287
- --provider <provider> LLM provider to use for generation
288
- ```
289
-
290
- ```bash
291
- aivin plugin make "Summarize a support ticket and tag its urgency"
292
- ```
293
-
294
- - **Simple/moderate** requirement (the common case): exactly one `src/main.ts`, one generation call
295
- - unchanged from before. Same conventions as always (`main(mission, input, ctx)`,
296
- `import { ai } from '@aivin-labs/sdk'`, `PluginResponse`).
297
- - **Complex** requirement (several genuinely independent capabilities, or logic too large for one
298
- flat function): the backend plans a small multi-file project first, generates each file, and - if
299
- the plan calls for it - returns a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
300
- fragment that replaces `manifest.json`'s `plugins[]` with one entry per capability.
301
-
302
- Requires `manifest.json` to already exist (`aivin create` first).
303
-
304
- ### Self-correction loop
305
-
306
- Generation isn't one-shot, and for a multi-file plan it isn't one-file-at-a-time either: files with
307
- no dependency on each other generate in parallel (only a file that genuinely needs to see another
308
- one's content, per the plan's own `depends_on`, waits for it first). After writing every returned
309
- file, if the project's own `typescript` devDependency is installed (`npm install` already run), the
310
- whole project is type-checked with `tsc --noEmit`. Real compiler errors (exact
311
- `file(line,col): error TSxxxx: ...` lines) are attributed back to whichever file they were reported
312
- against and sent to the AI for a surgical fix - up to 2 rounds, across as many files as had errors:
313
-
314
- ```
315
- 🤖 Generating plugin
316
- ✅ 2 file(s) generated (src/main.ts, src/lib/search.ts)
317
- ⚠️ 2 compiler error(s) across 1 file(s) - asking the AI to fix...
318
- ✅ Fixed - clean type-check after 1 attempt(s)
319
- ```
320
-
321
- If `node_modules` isn't installed yet, type-checking (and the self-correction it enables) is skipped
322
- silently - run `npm install` first if you want it. If errors remain after both rounds, every file is
323
- still written, with every remaining error printed for you to fix by hand.
324
-
325
- Review generated code before relying on it either way - self-correction only catches what `tsc`
326
- catches (type errors), not wrong business logic.
327
-
328
- ## `aivin plugin convert [hint]`
329
-
330
- Hands the existing project in the current directory to the backend's agentic project-conversion
331
- pipeline instead of generating locally. Unlike `plugin make`/`plugin init` (a single AI call per
332
- file, run entirely from what you pass it), this command:
333
-
334
- 1. Uploads only the **directory tree** - paths and byte sizes, never file content - so the request
335
- stays cheap no matter how large the project is.
336
- 2. The backend scans it: it decides which files are actually worth reading (entry points,
337
- `package.json`, anything name-suggestive of routes/tools/skills) and asks the CLI to read them
338
- back one at a time, over the same socket connection `aivin plugin logs` uses.
339
- 3. It plans a conversion - single `main()` vs. a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
340
- (one `plugins[]` entry per independent capability), and which files to create vs. adapt in
341
- place - detecting the project's shape (a plain script, an MCP server, an API backend with
342
- routes, a Claude-style skill) from what it actually read, not a fixed regex. If the project isn't
343
- TypeScript/JavaScript (Python, Go, ...), every file becomes a **port** (translated, not edited) -
344
- the plan always uses `create` in that case, never `update`, since there's no existing `.ts` file
345
- to adapt in place.
346
- 4. It generates/updates each planned file, then **verifies with a real `tsc --noEmit` run** on your
347
- machine (via the same tool-call channel) and self-corrects on real compiler errors, up to twice.
348
-
349
- Every step prints live as it happens - this loop can take a while on a real project, so it's never
350
- silent:
351
-
352
- ```bash
353
- cd your-existing-project
354
- aivin plugin convert
355
- # 📂 Scanning project tree...
356
- # 142 file(s) in tree (content read on demand by the server, never uploaded up front)
357
- # 🤖 Converting - this loops (scan → plan → generate → verify), watch for progress below...
358
- #
359
- # [10:32:01] Scanning project tree (142 entries)...
360
- # [10:32:03] Reading 3 file(s): package.json, src/index.ts, src/tools/search.ts
361
- # [10:32:07] Plan ready: mcp_server, 2 file(s) - Two independent MCP tools found (search, fetch);
362
- # splitting into a multi-function manifest so each is separately callable.
363
- # [10:32:15] Generating 2 file(s) in parallel: src/main.ts, src/lib/search.ts
364
- # [10:32:22] Type-checking (attempt 1)...
365
- # [10:32:23] Type-check clean
366
- # [10:32:23] All required exports present
367
- # [10:32:24] Running a smoke test with generated sample input (may make real SDK/AI calls using your credentials)...
368
- # [10:32:31] Smoke test passed
369
- # ✅ Conversion done (mcp_server, 2 file(s))
370
- ```
371
-
372
- The smoke test only runs if the type-check passed first (no point executing code that doesn't even
373
- compile) and `@aivin-labs/sdk` is already installed locally (`npm install`) - skipped, not failed,
374
- otherwise. It spawns the real plugin runtime on your machine on off-default ports (won't collide with
375
- a real `aivin start`) with AI-generated sample input, so a plugin whose logic calls `ai.prompt()` or
376
- other SDK methods will make a real call using your credentials during this step.
377
-
378
- ```
379
- Options:
380
- --model <model> LLM model to use for generation
381
- --provider <provider> LLM provider to use for generation
382
- --force Re-run conversion even if src/main.ts already exists (e.g. redo a
383
- previous bad/stale result)
384
- ```
385
-
386
- - No `manifest.json` needed first - if one doesn't exist, it's created from `package.json` (name,
387
- description) or the directory name.
388
- - Fails if `src/main.ts` already exists, unless `--force` is given - the plain (no-flag) case is
389
- for a project that isn't a plugin yet; `--force` re-runs the whole scan/plan/generate/verify loop
390
- against a project this command already converted before (the earlier plan turned out wrong, the
391
- project changed since, whatever the reason) - `src/main.ts` isn't excluded from what gets scanned,
392
- so the new plan is free to mark it `update`, and the usual per-file overwrite confirmation still
393
- applies to it like any other existing file.
394
- - `[hint]` is optional extra guidance, e.g. which function to focus on - passed straight to the
395
- backend's planning step.
396
- - If the plan is multi-function, `manifest.json`'s `plugins[]` is replaced with one entry per
397
- planned capability (fresh local ids - `aivin deploy` still assigns the real ones).
398
- - Requires a live connection to the Aivin server for the whole duration (it's not a local batch
399
- job) - the socket is what lets the backend read files on demand and stream progress back.
400
- - Only one conversion can run at a time per project - starting a second one against the same
401
- project while the first is still running fails fast instead of racing both against the same
402
- files. If the previous run's process died without cleanly finishing, this frees up on its own
403
- within moments, not stuck for the full run duration.
404
- - The whole run gives up after ~15 minutes regardless of how far it got, so a stuck step can't hold
405
- the connection open forever.
406
-
407
- ### Overwrite safety
408
-
409
- Unlike `plugin make`, this command can touch files that **already exist** in your project - the
410
- backend's plan may mark some as `update` (adapt in place) rather than `create` (new file):
411
-
412
- - Before scanning starts, if the directory is a git repo with uncommitted changes, you're warned
413
- and (in an interactive terminal) asked to confirm before continuing at all.
414
- - Before any individual existing file is actually overwritten, you're prompted per-file (with a
415
- quick `git status` hint - untracked vs. has uncommitted changes - when available) - declining
416
- skips just that file, the rest of the conversion continues.
417
- - Non-interactive runs (CI/scripts) can't prompt, so they proceed automatically - the decision is
418
- still printed to the log either way, it's just not blocking.
419
-
420
- Review the generated code before relying on it - self-correction only catches what `tsc` catches
421
- (type errors), not wrong business logic, and the file/project-kind detection is a best effort, not
422
- a guarantee.
423
-
424
- ## `aivin plugin search <query>`
425
-
426
- Searches the platform's plugin ecosystem before you write new logic - the same relevance-ranked
427
- lookup the platform's own agent uses to auto-select a plugin for a mission (`GET /plugins/search`).
428
- Doesn't need to be run from inside a plugin project.
429
-
430
- ```bash
431
- aivin plugin search "send a slack message"
432
- ```
433
-
434
- Options:
435
-
436
- ```
437
- Options:
438
- --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
439
- --mcp <server_id> List every tool/resource/prompt plugin generated from one MCP server, instead of a text search
440
- --store <store_id> Restrict to plugins hosted on one self-hosted plugin store (id from `aivin pluginstore ls`) - combines with the text query/--mcp
441
- --limit <n> Max results to show
442
- --plain Print a flat list instead of the interactive browser (for scripts/CI)
443
- ```
444
-
445
- In a real terminal, results open in an interactive browser: `↑`/`↓` to move between matches,
446
- `→`/`space`/`enter` to open a plugin's detail view (full description, version, input/output
447
- schema), `←`/`esc`/`backspace` to go back to the list, `q` to quit. Non-TTY contexts (scripts, CI,
448
- piped output) or `--plain` fall back to a flat printed list.
449
-
450
- Call one from your own plugin with `import { call } from '@aivin-labs/sdk'` then
451
- `await call('<plugin_id>', params)`.
452
-
453
- ## `aivin plugin info <id>`
454
-
455
- Detail view for **one already-known plugin id**, without going through `plugin search`'s free-text
456
- ranking first - useful when debugging a specific plugin you already have the id for (copied from
457
- `plugin search --mcp <server_id>`'s listing, from the platform, etc.).
458
-
459
- ```bash
460
- aivin plugin info modelcontextprotocol-servers-src-everything-read_file
461
- ```
462
-
463
- Options:
464
-
465
- ```
466
- Options:
467
- --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
468
- --plain Print flat instead of the interactive browser, if falling back to
469
- closest-match results
470
- ```
471
-
472
- There's no dedicated `GET /plugins/:id` on the backend, so this reuses `/plugins/search` with the
473
- id itself as the query and picks the exact `id` match out of the ranked results. If nothing matches
474
- exactly (typo'd id, or a plugin not visible to you), it prints "no exact match" and falls back to
475
- the same interactive browser over the closest results instead of failing outright.
476
-
477
- ## `aivin plugin ask [mission]`
478
-
479
- One-shot "just simulate the agent" mode: give it a plain-language mission and it does what a
480
- running agent actually does at execution time - searches the plugin ecosystem the same
481
- relevance-ranked way (`plugin search`'s lookup), picks the **top match**, and immediately triggers
482
- it with that same mission auto-mapped onto the input schema (`plugin trigger -a` under the hood).
483
- Where `plugin search` + `plugin trigger --id <id> -a "..."` is a manual two-step "pick, then run"
484
- flow, `ask` collapses both into a single command - no copying an id between them.
485
-
486
- ```bash
487
- aivin plugin ask "send a slack message to #eng saying the deploy is done"
488
- ```
489
-
490
- ```
491
- 🤖 Auto-selected: Slack Notify (87% match) (slack-notify-abc123)
492
- runner-up(s): Slack Post Message, Discord Notify
493
-
494
- 🚀 Triggering Slack Notify...
495
- ...
496
- ```
497
-
498
- Options:
499
-
500
- ```
501
- Options:
502
- --top <n> How many candidates to consider/print as runner-up context
503
- (default 5) - only the top match is ever run
504
- -i, --input <json> Force specific fields (as JSON) alongside the auto-mapped
505
- ones - explicit fields win
506
- --workspace <id> Workspace id to search/run against (default: auto-picks
507
- your first one)
508
- --agent <id> Agent id to run as, if the plugin needs one for
509
- HIL/confirm behavior to be accurate
510
- --watch-logs Also stream the chosen plugin's own live console output inline
511
- --no-auth-prompt Don't offer to connect/configure a missing connector
512
- interactively - just print the needs_auth result and exit
513
- --save Write this run's result to .test/trigger/<ts>.json
514
- --compare <file> Diff this run against a previously --save'd file
515
- ```
516
-
517
- If the auto-pick looks wrong, check the printed runner-up(s) and fall back to the manual flow -
518
- `aivin plugin search "<mission>"` to browse candidates yourself, then
519
- `aivin plugin trigger --id <chosen-id> -a "<mission>"` to run that specific one instead. `ask`
520
- throws (no plugin executed) if the search comes back empty, rather than guessing.
521
-
522
- ## `aivin plugin trigger [mission] [input]`
523
-
524
- Invokes an **already-deployed** plugin for real and prints the result - the same
525
- `POST /plugins/execute` the platform's own Playground ("Thử nghiệm" tab) uses, so it exercises the
526
- exact same code path a running agent would hit. Run it from the plugin's project directory -
527
- `manifest.json` supplies the plugin id (`--func <name>` picks the entry for a multi-function
528
- plugin) - or pass `--id` directly for a plugin with no local project directory (e.g. one built by
529
- `aivin mcp <url>`, which deploys straight from a scan and never writes a `manifest.json` anywhere).
530
-
531
- ```
532
- Options:
533
- -a, --auto <prompt> Natural-language prompt - the platform auto-maps it onto
534
- the input schema for you
535
- --id <pluginId> Plugin id to trigger directly - skips the local
536
- manifest.json lookup entirely
537
- --func <name> Which function to trigger, for a multi-function plugin
538
- (matches name/func/id) - ignored when --id is given
539
- --workspace <id> Workspace id to run against (default: auto-picks your
540
- first one)
541
- --agent <id> Agent id to run as, if the plugin needs one for
542
- HIL/confirm behavior to be accurate
543
- --watch-logs Also stream the plugin's own live console output inline
544
- (same feed as `aivin plugin logs`) - no second terminal
545
- needed. Requires permission to view that plugin's logs;
546
- most store plugins from other orgs just fall back to
547
- the REST result only.
548
- --no-auth-prompt Don't offer to connect/configure a missing connector
549
- interactively - just print the needs_auth result and exit
550
- --save Write this run's result to .test/trigger/<ts>.json
551
- --compare <file> Diff this run against a previously --save'd file
552
- ```
553
-
554
- ```bash
555
- # no local project directory - e.g. an MCP proxy plugin from `aivin mcp <url>`
556
- aivin plugin trigger --id my-mcp-plugin-id -a "search for open issues about login"
557
- ```
558
-
559
- **Direct mode** - `<mission>` (becomes `main()`'s `mission` argument) and `<input>` (a JSON string,
560
- becomes `main()`'s `input` argument) both required:
561
-
562
- ```bash
563
- aivin plugin trigger "summarize this" '{"text":"Aivin plugins are easy to write."}'
564
- ```
565
-
566
- **Auto mode** (`-a`/`--auto <prompt>`) - give it free text instead of structured JSON; the backend's
567
- own input-mapping (`mapDataToSchema`, the same mechanism the Playground's chat-style tester uses)
568
- maps it onto `manifest.json`'s `input` schema for you:
569
-
570
- ```bash
571
- aivin plugin trigger -a "Summarize this ticket: customer can't log in after the last update"
572
- ```
573
-
574
- `<input>` can still be given alongside `-a` for fields you want to force rather than let the AI
575
- infer - explicit values win over auto-mapped ones per field.
576
-
577
- What gets printed:
578
- - `--- Log ---` - the backend's own mapping/execution stage messages (`processing_log`), if any.
579
- This is **not** your plugin's own `console.log()` output from inside `main.ts` - it's everything
580
- the HTTP response itself carries, printed after the call completes.
581
- - `--- Auto-mapped input ---` - what `-a`'s prompt actually got mapped to (`mapped_arguments`),
582
- only present in auto mode.
583
- - `--- Result: <status> ---` - the plugin's real `status`/`message`/`error_code`/`data`.
584
- - `--- Compare ---` (only with `--compare <file>`) - status + data diffed against the saved run.
585
-
586
- Both the workspace lookup and the execute call have a client-side timeout (15s and 3 minutes) - a
587
- hung backend fails with a clear error instead of `trigger` sitting there forever. Override the
588
- execute one with `AIVIN_TRIGGER_TIMEOUT_MS` if you have a legitimately slow plugin.
589
-
590
- ### Watching your plugin's own console output inline: `--watch-logs`
591
-
592
- By default `trigger` only shows what's above - not the plugin's own `console.log()`/`sdk.log()`
593
- calls from inside `main.ts`. Pass `--watch-logs` to subscribe to that live, over the same channel
594
- `aivin plugin logs` uses, right before firing the call - one terminal instead of two:
595
-
596
- ```bash
597
- aivin plugin trigger --watch-logs "summarize this" '{"text":"..."}'
598
- ```
599
-
600
- This is permission-scoped server-side to plugins you can see the container logs for (your own or
601
- your org's deployments). Triggering a plugin from the public store that some other org owns will
602
- print `(--watch-logs: no live console output - ...)` and fall back to the REST result only - there's
603
- no way around that from the CLI, raw container stdout isn't something the platform exposes across
604
- org boundaries.
605
-
606
- ### Missing a connector? `trigger` sets it up for you, right there
607
-
608
- If the plugin needs a connector (OAuth account, or a plain credential form like SMTP
609
- host/user/pass) that isn't configured yet, `/plugins/execute` comes back `needs_auth` instead of
610
- running. In an interactive terminal, `trigger`/`ask` catch that and offer to fix it on the spot
611
- instead of just printing the failure and making you go set it up in the web app:
612
-
613
- - **OAuth connector** - asks "Open your browser to connect now?", then opens the same
614
- authorize-flow the web app's "Connect" button uses (falls back to printing the URL if it can't
615
- launch a browser), and polls in the background until you've finished. No timeout hunting - it
616
- waits up to 3 minutes, then retries the trigger automatically.
617
- - **Credential-form connector** (SMTP, or any custom `credential_form` connector registered via
618
- `aivin connector register`) - prompts for each declared field right in the terminal (masked for
619
- `secret` fields), saves it, then retries.
620
-
621
- Either way, you get exactly one automatic retry after setup - if it still needs auth after that
622
- (e.g. you declined, or the OAuth flow timed out), the `needs_auth` result just prints as-is. Pass
623
- `--no-auth-prompt` to skip all of this and always just print the result (useful for scripts/CI,
624
- where there's no one to answer the prompt anyway - it's also skipped automatically whenever stdin/
625
- stdout isn't a real TTY).
626
-
627
- ### Turning ad-hoc tries into a regression check: `--save` / `--compare`
628
-
629
- ```bash
630
- aivin plugin trigger "summarize this" '{"text":"..."}' --save
631
- # Saved: .test/trigger/2026-01-15T10-30-00-000Z.json
632
-
633
- # ...later, after changing the plugin (or re-testing the same store plugin)...
634
- aivin plugin trigger "summarize this" '{"text":"..."}' \
635
- --compare .test/trigger/2026-01-15T10-30-00-000Z.json
636
- ```
637
-
638
- Lighter-weight than `aivin test`'s full deploy+smoke-test+report flow - useful for a quick "did this
639
- still behave the same way" check on any plugin you can trigger, including ones you don't own.
640
-
641
- ## `aivin plugin logs [pluginId]`
642
-
643
- Tails an **already-deployed** plugin's own container stdout/stderr live - the same real-time feed
644
- the platform's own Playground log panel uses. `pluginId` defaults to the current directory's
645
- `manifest.json` id (`--func <name>` picks the entry for a multi-function plugin), so plain
646
- `aivin plugin logs` works from inside the plugin's own project directory; pass an explicit id to
647
- watch a plugin you're not standing inside.
648
-
649
- ```
650
- Options:
651
- --func <name> Which function's id to resolve, for a multi-function plugin
652
- (only used when pluginId is omitted)
653
- ```
654
-
655
- ```bash
656
- aivin plugin logs
657
- aivin plugin logs my-plugin-id
658
- ```
659
-
660
- Prints each line as it's written (`console.log` → gray, `console.error` → red), with a local
661
- timestamp. Runs until you press Ctrl+C. If the container restarts (redeploy/crash) mid-stream,
662
- the connection ends - re-run the command to resume watching.
663
-
664
- ## `aivin plugin delete [id]`
665
-
666
- Deletes a plugin you own - `DELETE /plugins/store/:pluginId` for a single one, or
667
- `--group <groupId>` for every plugin created by one batch deploy at once (`DELETE
668
- /plugins/group/:groupId`) - e.g. everything `aivin mcp <url>` generated in a single run, which
669
- prints its `group_id` right after deploying specifically so you can pass it here later. Neither can
670
- be undone.
671
-
672
- ```
673
- Options:
674
- --group <groupId> Delete every plugin sharing this group_id instead of a single plugin by id
675
- -y, --yes Skip the confirmation prompt (for scripts/CI)
676
- ```
677
-
678
- ```bash
679
- aivin plugin delete my-plugin-id
680
- aivin plugin delete --group 66f2a1... # everything from one `mcp <url>` run
681
- aivin plugin delete --group 66f2a1... --yes # skip the prompt, for scripts
682
- ```
683
-
684
- Single delete asks a plain yes/no confirmation. `--group` asks you to **type the group id back** to
685
- confirm (same pattern `aivin pluginstore rm` uses) since one typo'd id could otherwise delete many
686
- plugins at once. Both skip the prompt entirely with `-y`/`--yes`. Deleting is scoped to plugins you
687
- own server-side - a wrong/other org's id fails with "not found" rather than revealing whether it
688
- exists.
689
-
690
- ## `aivin connector`
691
-
692
- Connectors are reusable OAuth apps / credential-form namespaces, referenced from `manifest.json`'s
693
- `connection_id` field so multiple plugins can share one set of user-connected credentials instead
694
- of each prompting for the same login separately. Check for an existing one before registering a
695
- new namespace:
696
-
697
- ```bash
698
- aivin connector search "slack"
699
- aivin connector list
700
- ```
701
-
702
- ```
703
- Commands:
704
- register Register a new connector namespace, interactively
705
- search [options] [query] Search connectors for something to reuse instead of registering a new one
706
- list [options] List connectors visible to your org
707
- deprecate [id] Hide a connector you own from search/list without breaking plugins already using it
708
- undeprecate [id] Make a previously-deprecated connector you own discoverable again
709
-
710
- Options for search/list:
711
- --limit <n> Max results to show (search)
712
- --page <n> Page number (list)
713
- --include-deprecated Also show your org's deprecated connectors, hidden by default (list)
714
- --plain Print a flat list instead of the interactive browser - for scripts/CI (both)
715
- ```
716
-
717
- `aivin connector register` walks you through naming the namespace and picking the auth shape
718
- (OAuth vs. a plain credential form) interactively - there's no non-interactive/scripted form, since
719
- registering real OAuth app credentials isn't something to automate blindly. Once registered, put
720
- the connector's id in your plugin's `manifest.json` as `connection_id` - see
721
- [MANIFEST.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#fields) (sdk
722
- repo).
723
-
724
- `aivin connector deprecate`/`undeprecate` only affect discoverability (search/list) - they never
725
- break a plugin that's already using the connector's `connection_id`, so it's safe to deprecate one
726
- you've replaced without migrating existing plugins first.
727
-
728
- ## `aivin pluginstore`
729
-
730
- Manages a **self-hosted `aivin-service` worker** (a Docker container you run yourself) attached to
731
- your org as a *plugin store* - a piece of infrastructure your org's plugins can run against,
732
- independent from Aivin's own hosted infra. A store can have multiple *nodes* (multiple machines
733
- each running their own `aivin-service`, all attached to the same store) for redundancy/scale. This
734
- is unrelated to the **Plugin Marketplace** (`aivin mcp <url> --publish` and the browser
735
- CodeEditor's publish flow) - a plugin store is infrastructure you attach, not a place plugins get
736
- published to.
737
-
738
- ```
739
- Commands:
740
- create [options] [store_id] Create a new plugin store + attach this machine as its first node
741
- attach [options] [store_id] Attach this machine as another node of an existing plugin store
742
- ls List plugin stores visible to your org, with online/offline status per node
743
- enable [store_id] Enable a store for your org (org admin only)
744
- disable [store_id] Disable a store for your org without deleting it (org admin only)
745
- rm [options] [store_id] Delete a store - revokes EVERY node attached to it, not just this machine (org admin only)
746
- detach [options] Remove THIS machine's pairing only (local file only, no BE call)
747
- ```
748
-
749
- ```bash
750
- aivin pluginstore create my-store --label "Production store"
751
- aivin pluginstore ls
752
- ```
753
-
754
- `create`/`attach` both end by writing `worker-identity.json` into a data directory (default
755
- `~/.aivin/service-data`, override with `--data-dir`) - the machine's actually-running
756
- `aivin-service` process watches that directory (`fs.watch`) and pairs itself automatically the
757
- moment the file appears. Neither command needs `aivin-service` to already be running, and neither
758
- restarts any container - the CLI's job ends at writing the file; pairing itself is the worker's own
759
- responsibility.
760
-
761
- ```
762
- Options (create):
763
- --label <label> Display label for the store (defaults to store_id)
764
- --node-label <label> Display label for this node/instance
765
- --data-dir <path> Where to write worker-identity.json (default: ~/.aivin/service-data)
766
-
767
- Options (attach):
768
- --node-label <label> Display label for this node/instance
769
- --data-dir <path> Where worker-identity.json is written (default: ~/.aivin/service-data)
770
- ```
771
-
772
- `aivin pluginstore detach` is the local-only inverse of `attach`/`create`: it deletes
773
- `worker-identity.json` from this machine (`--data-dir` to point at a non-default location) without
774
- calling the backend at all - the running `aivin-service` notices the file is gone and un-pairs on
775
- its own. To actually revoke a node/store server-side (so it can't reattach with an old token), use
776
- `aivin pluginstore rm` instead - **org admin only**, and destructive: it revokes every node attached
777
- to the store, not just this machine, hence the `-y`/`--yes` flag to skip the confirmation prompt in
778
- scripts.
779
-
780
- `enable`/`disable` don't delete anything - they just toggle whether your org's plugins are allowed
781
- to route to the store right now, so you can pull a store out of rotation (e.g. for maintenance)
782
- without losing its configuration or having to re-attach nodes afterward.
783
-
784
- ## `aivin mcp <url> [--publish|--private|--org]`
785
-
786
- The one-shot path from "here's an [MCP](https://modelcontextprotocol.io) server" to deployed
787
- plugin(s) - unlike `aivin mcp create` below (which scaffolds exactly 1 tool/resource/prompt you
788
- already know the transport/command/name for), this scans a whole server and converts everything it
789
- finds, interactively:
790
-
791
- 1. **Scan** (`POST /plugins/scan-mcp`) - `<url>` can be a GitHub/GitLab repo, an npm/Smithery
792
- package, or a live MCP server URL. Reads the repo/README or handshakes the live server directly.
793
- Only scan URLs you actually trust - this step connects to (and, for a live handshake, effectively
794
- runs) whatever's at that address to introspect it, same trust model as installing a dependency
795
- from source. Bounded to 60s (scanning a live server can legitimately take longer than the other
796
- steps, which is why this one gets more headroom) so an unresponsive server fails with a clear
797
- error instead of hanging the CLI indefinitely. The scan response also carries a deterministic
798
- `repo_id` (derived from the source URL, same convention the backend uses for every discovery
799
- path so the same server always converges on one id) - right after a successful scan, this is
800
- used as an exact `plugin search --mcp <repo_id>` lookup, so anything printed here really is from
801
- this exact server, not a fuzzy text guess. Still informational only - never blocks the flow.
802
- 2. **Select** - checkbox prompt lists every tool/resource/prompt found (all checked by default);
803
- space to toggle, enter to continue with only what you actually want as plugins.
804
- 3. **Build manifests** (`POST /plugins/build-mcp-manifests`, 30s timeout) - one `PluginManifest` per
805
- selected item, generated server-side (not typed by hand like `aivin mcp create` requires).
806
- 4. **Edit** (optional) - confirm prompt offers to rename/redescribe any of the generated plugins
807
- before anything is deployed. A second, separate optional prompt offers to attach one connector
808
- (existing or newly registered) as every generated manifest's `connection_id` in one go - see
809
- [`aivin mcp create`](#aivin-mcp-create-name)'s connector section above for what that buys you.
810
- 5. **Confirm** - since the checkbox in step 2 defaults to everything checked, this step asks for an
811
- explicit yes ("Deploy N plugin(s) to your org? This can't be undone from the CLI.", default
812
- **No**) before anything actually goes out. In a non-TTY context (scripts/CI) this step is skipped
813
- entirely - the same as everywhere else in the CLI, only a real terminal gets a confirmation prompt.
814
- 6. **Deploy** (`POST /plugins/deploy`, 60s timeout) - always org-scoped first, regardless of the
815
- visibility flag below (there's no narrower per-workspace scope for plugins today). Prints a
816
- `group_id` afterward - save it if you might want to remove everything from this run later in one
817
- shot with [`aivin plugin delete --group <groupId>`](#aivin-plugin-delete-id).
818
- 7. **Publish** (only with `--publish`, 30s timeout per submission) - submits each deployed plugin for
819
- community review (`POST /plugins/store/submit`) - the backend re-verifies each one LIVE against
820
- the real MCP server before it reaches the review queue, not just whatever got deployed (see the
821
- backend's own `marketplace-catalog.md` docs, §"Tự submit plugin MCP lên store", for the full
822
- gate). A submission can't be withdrawn from this CLI either once sent.
823
-
824
- **Blocked, not just warned**: a manifest whose `proxy_config.auth_secret_key` is set is skipped
825
- entirely at this step (never submitted) instead of being sent as-is. `auth_secret_key` is an
826
- admin-level credential meant to be shared by everyone *within the org that deployed it* -
827
- publishing means other orgs can call this same plugin, and there is no confirmed backend step
828
- that strips or reissues that credential per installing org, so submitting it unchanged would let
829
- another org's calls silently resolve to (and spend/exhaust/expose) your org's credential. Rebuild
830
- the plugin with a connector-bound environment variable instead (`aivin mcp create`'s interactive
831
- auth setup, "one or more environment variables" → bind to a connector) - that path resolves
832
- credentials per the *calling* org/user, not off the shared manifest, and is safe to publish.
833
- 8. Prints ready-to-run `aivin plugin trigger --id <id> -a "..."` / `aivin plugin logs <id>` for
834
- every plugin deployed, and offers to run one right now, interactively - see
835
- [`aivin test`](#aivin-test) above for why this exists (its automated smoke test skips proxy
836
- plugins entirely, so this interactive step is currently the *only* built-in way to verify a
837
- freshly-converted MCP plugin actually works before walking away from the terminal).
838
-
839
- ```
840
- Options:
841
- --publish Deploy to your org, then submit for community store review
842
- (needs admin approval)
843
- --private Deploy to your org only - default
844
- --org Alias of --private - there is no narrower per-workspace scope today
845
- ```
846
-
847
- ```bash
848
- aivin mcp https://github.com/example-org/example-mcp-server
849
- aivin mcp https://github.com/example-org/example-mcp-server --publish
850
- ```
851
-
852
- ## `aivin mcp create <name>`
853
-
854
- Scaffolds a **manifest-only** plugin (`proxy_config.type: "mcp"`) that proxies straight to an
855
- external [MCP](https://modelcontextprotocol.io) server's tool/resource/prompt - no `src/main.ts`,
856
- no `package.json`, nothing to run. `aivin deploy`/`aivin test` detect this automatically.
857
-
858
- ```
859
- Options:
860
- --transport <transport> stdio | sse
861
- --command <command> Command to launch the MCP server (stdio transport)
862
- --args <args> Space-separated args for --command (stdio transport)
863
- --url <url> Remote MCP server URL (sse transport)
864
- --kind <kind> tool | resource | prompt (default: tool)
865
- --tool-name <name> MCP tool name (kind=tool)
866
- --resource-uri <uri> MCP resource URI (kind=resource)
867
- --resource-mime-type <mime> MIME type of the resource (kind=resource)
868
- --prompt-name <name> MCP prompt name (kind=prompt)
869
- --description <description> Plugin description
870
- --auth-secret-key <key> Name of the workspace secret to use as the
871
- token/credential, if the MCP server needs auth
872
- --auth-type <type> auth_type value to send (default: "bearer" when
873
- --auth-secret-key is set) - check your backend
874
- for which values it supports
875
- --connector <id> Existing connector id for this plugin's connection_id
876
- (readiness/"needs login" display only - see below)
877
- ```
878
-
879
- - Fully interactive → run with no flags at all: prompts for everything, in order.
880
- - Fully flagged → fully non-interactive/scriptable, no prompts. `--transport` and `--kind` are
881
- inferred from whichever flags you pass (`--command` implies stdio, `--url` implies sse;
882
- `--tool-name`/`--resource-uri`/`--prompt-name` each imply their own `--kind`) - spell them out
883
- explicitly only if you're scripting this without any of those (unusual).
884
- - **Partially flagged, real terminal** → prompts for exactly what's still missing, not everything -
885
- e.g. `aivin mcp create foo --transport stdio` alone still prompts for `--command` instead of
886
- failing with a generic validation error.
887
- - Passing more than one kind-identifying flag at once (e.g. both `--tool-name` and
888
- `--resource-uri`) without an explicit `--kind` prints a warning and picks one by priority
889
- (tool → resource → prompt) rather than silently dropping the other with no explanation.
890
- - Whatever's still missing once prompting is done (or immediately, outside a real terminal) fails
891
- fast with the exact flag(s) needed, e.g. `Missing required field(s): --command <command>,
892
- --tool-name <name>`.
893
-
894
- ```bash
895
- # stdio (local command)
896
- aivin mcp create fs-tools --command npx --args "-y @modelcontextprotocol/server-filesystem /data" \
897
- --tool-name read_file --description "Read files via MCP"
898
-
899
- # sse (remote server)
900
- aivin mcp create doc-search --url https://example.com/mcp \
901
- --tool-name search_docs --description "Search external docs via MCP"
902
- ```
903
-
904
- See [MANIFEST.md#mcp-proxy-plugins](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#mcp-proxy-plugins) for the full `proxy_config`
905
- field reference.
906
-
907
- **Auth for a `mcp create` plugin, interactively**: leave `--auth-secret-key` off in a real terminal
908
- and you're asked "Does this MCP server need auth?" with three choices:
909
-
910
- - **No auth needed.**
911
- - **One shared token for everyone** (typical for a remote/sse server) - the classic bearer-token
912
- case, sent as `proxy_config.auth_secret_key`/`auth_type`. One value, shared by the whole org.
913
- - **One or more environment variables** (typical for a local/stdio server) - drops into a loop
914
- ("Variable 1 name:", Enter on blank to stop) where each declared name is either left for **every
915
- workspace to configure on its own** later (no OAuth - the platform's own "configure this plugin"
916
- screen collects the value per workspace) or bound to a **connector** (search-as-you-type over
917
- `aivin connector search`'s same endpoint, list your org's if the query is left blank, or register
918
- a brand new one right there - same flow as `aivin connector register`, no separate command
919
- needed) for automatic per-user/per-workspace OAuth resolution.
920
-
921
- This maps onto `manifest.initable`/`manifest.initial[varName].connection_id` - the fields the
922
- backend's plugin execution path (`PluginProxyService.resolveMcpEnv`) actually reads to merge
923
- credentials at call time, in increasing priority: the shared `auth_secret_key` first, then each
924
- workspace's own configured value, then OAuth auto-fill for any field bound to a connector. This is
925
- genuinely three tiers merged per call, not three alternatives to choose between - declaring some
926
- fields as connector-bound and others as "workspace configures it" on the very same plugin is normal
927
- if the MCP server needs more than one kind of credential.
928
-
929
- Only declarable interactively - like `aivin connector register`, there's no non-interactive/scripted
930
- form for the env-var loop (declaring several named fields isn't something to automate blindly).
931
-
932
- **What `--connector <id>` actually does (and doesn't)**: it sets the manifest's top-level
933
- `connection_id` directly, without going through the loop above. That field only drives the
934
- "requires logging in to a connector" readiness badge (see `plugin info`/`plugin search`'s detail
935
- view) - it is **not** read by the MCP execution path at all, so it injects nothing into the running
936
- MCP server by itself. If you use the interactive env-var loop and bind a field to a connector, the
937
- top-level `connection_id` gets set *for* you automatically (derived from whichever connector the
938
- declared field(s) actually use), for consistency with that badge - you shouldn't normally need
939
- `--connector` directly unless you're deliberately setting the readiness badge independently of any
940
- declared env var.
941
-
942
- `aivin mcp <url>` (below) offers a simpler, single-connector version of this same idea - one prompt
943
- to attach a connector to every generated manifest at once, right before the final deploy
944
- confirmation, for when a whole MCP server shares one auth scheme rather than needing individual
945
- per-tool env-var declarations.
946
-
947
- ## `aivin login`
948
-
949
- Saves an API key **once, machine-wide**, to `~/.aivin/credentials` - not the current project's
950
- `.env`. Logging in is a per-machine thing, not a per-project one, so you only need to run this once
951
- regardless of how many plugin projects you work in - every project's `deploy`/`test`/`plugin make`
952
- picks it up automatically.
953
-
954
- ```
955
- Options:
956
- -k, --api-key <key> Set API key directly (skip login entirely)
957
- --basic Log in with email/password directly in the terminal instead of a browser
958
- --google Alias of the default browser flow - pick Google once the page opens
959
- --client <client> Client/org id to use with --basic (default: "aivin.cloud")
960
- ```
961
-
962
- **Default (no flags) - browser flow, recommended:**
963
-
964
- ```bash
965
- aivin login
966
- ```
967
-
968
- Opens your default browser to the platform's actual login page (`https://brain.aivin.cloud`) with
969
- a one-time state token and a `localhost` callback URL. Log in exactly the way you normally would in the
970
- browser - custom-domain org, password, Google, OTP, whatever applies to your account. Once you
971
- confirm on the "Aivin CLI wants to create an API Key" prompt that appears after login, a fresh key
972
- is minted (named after this machine's hostname, replacing any previous key with that same name) and
973
- handed back to a tiny local HTTP server the CLI started for this one request, then saved to
974
- `~/.aivin/credentials`. The browser tab never shows you the raw key - only the CLI does.
975
-
976
- `--google` doesn't change anything technically; it's just documentation that once the page opens
977
- you can pick "Log in with Google" there, same as any other login on that page.
978
-
979
- **`--basic` - no browser, terminal-only:**
980
-
981
- ```bash
982
- aivin login --basic
983
- ```
984
-
985
- Prompts for email/password directly and logs in against the default/shared client only (`--client`,
986
- falls back to `"aivin.cloud"`). If your account belongs to a custom-domain organization, this won't
987
- resolve that domain for you - use the default browser flow instead, which handles it the same way
988
- the web login page does.
989
-
990
- **Already have a key:**
991
-
992
- ```bash
993
- aivin login --api-key <key>
994
- ```
995
-
996
- Skips login entirely - just saves the given key to `~/.aivin/credentials`.
997
-
998
- ## `aivin whoami`
999
-
1000
- Shows which account is currently active on this machine - reads `~/.aivin/credentials` straight
1001
- off disk, **no server call**, so it works offline and never fails due to a network/auth problem
1002
- (if anything, it's the fastest way to check that a previous `aivin login` actually saved
1003
- something).
1004
-
1005
- ```bash
1006
- aivin whoami
1007
- ```
1008
-
1009
- ```
1010
- ✅ Logged in
1011
- Email: jane@example.com
1012
- Name: Jane Doe
1013
- Org: Acme Inc
1014
- Server: https://api.aivin.cloud
1015
- Logged in at: 1/15/2026, 10:30:00 AM
1016
- ```
1017
-
1018
- Email/name/org/login-time only exist at all if the currently-effective `API_KEY` is the exact one
1019
- `aivin login` saved (i.e. `~/.aivin/credentials`, the machine-wide default) - identity is captured
1020
- once, at login time, and cached alongside the key. If a project's own `.env` overrides `API_KEY`
1021
- with a different key, `whoami` says so explicitly instead of guessing:
1022
-
1023
- ```
1024
- (API_KEY is from this project's .env, not `aivin login` - no recorded identity/login time)
1025
- ```
1026
-
1027
- ## `aivin key`
1028
-
1029
- Manages *named* API keys on your account - separate from the one machine-wide key `aivin login`
1030
- saves. Useful for giving a CI pipeline, a teammate's script, or any other caller its own key you can
1031
- revoke independently later.
1032
-
1033
- ```
1034
- Commands:
1035
- gen [options] <name> Create (or replace) a named API key for your account - shown only once
1036
- revoke [options] <name> Revoke a named API key for your account
1037
- list [options] List API keys on your account
1038
- ```
1039
-
1040
- ```bash
1041
- aivin key gen "ci-pipeline" # prompts for your account password, prints the new key once
1042
- aivin key gen "ci-pipeline" --save # also saves it to ~/.aivin/credentials as this machine's default
1043
- aivin key list # see what's on your account
1044
- aivin key revoke "ci-pipeline" # revoke it by name
1045
- ```
1046
-
1047
- All three authenticate with the `API_KEY` `aivin login` already saved - no email/password prompt for
1048
- `list`/`revoke`. `gen` is the exception: it still asks for your **account password** (not email) as
1049
- a step-up check, since minting a new key from an existing one is the one action here that could
1050
- otherwise let an already-leaked key re-provision itself indefinitely even after you revoke it.
1051
- `list`/`revoke` only read or remove access, never grant it, so they need no such check.
1052
-
1053
- `aivin key gen` replaces (not accumulates) any existing key with the same name, the same way
1054
- re-running `aivin login` replaces this machine's own key.
1055
-
1056
- ## `aivin browser [mission]`
1057
-
1058
- Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives an actual browser
1059
- (not this plugin's code) to complete a goal. Two modes, picked by `--remote`:
1060
-
1061
- ```
1062
- Options:
1063
- --remote Use a server-side pooled browser instead of your own local one (no
1064
- local browser needed, no cookies/logins carried over)
1065
- --debug-port <port> Local mode only: port to look for/launch your browser's remote
1066
- debugging on (default: 9222, auto-tries a few nearby ports if that
1067
- one is taken by something else)
1068
- --browser <edge|chrome> Local mode only: which browser to drive - default: auto-detects your
1069
- OS's actual default browser, falling back to whichever of Edge/Chrome
1070
- is installed
1071
- --url <url> Local mode only: open this URL before the mission starts, instead of a
1072
- blank page (auto-guessed for a few well-known sites mentioned by name
1073
- in the mission if omitted)
1074
- --workspace <id> Workspace id to run in (default: your personal workspace)
1075
- --project <id> Project id within the workspace (--remote only)
1076
- --agent <id> Agent id to run as (default: an auto-created/cached agent for local
1077
- mode, or the workspace's default agent for --remote)
1078
- --no-watch Fire the mission and return immediately - skip streaming live
1079
- progress and auto-opening the viewer
1080
- --view Just (re)open the fullscreen interactive viewer for whatever HIL
1081
- session is already active - no mission is started
1082
- ```
1083
-
1084
- **Local mode (default)** - drives your own, already-running browser via its remote-debugging
1085
- protocol (CDP). Uses a dedicated Chrome/Edge profile (`~/.aivin/browser-profile`), not your regular
1086
- daily-driver profile - real cookies/logins persist there across runs, but the first time you use a
1087
- given site you'll need to log in once, same as opening it in a fresh browser. If nothing's
1088
- listening on the debug port yet, `aivin browser` prints the exact launch command for your OS/browser
1089
- instead of failing silently:
1090
-
1091
- ```bash
1092
- aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
1093
- ```
1094
-
1095
- A live viewer window opens automatically once the mission needs human input (HIL) or, by default,
1096
- as soon as it starts - `--no-watch` skips this and just prints progress to the terminal instead.
1097
-
1098
- **Remote mode (`--remote`)** - runs on a server-side pooled browser instead, no local browser
1099
- required, no cookies from your machine carried over. Useful for CI, headless environments, or
1100
- missions that don't need a logged-in session on a specific real account.
1101
-
1102
- ```bash
1103
- aivin browser --remote "Check the current price of BTC on coinmarketcap.com"
1104
- ```
1105
-
1106
- `aivin browser --view` alone (no mission) reopens the interactive viewer for whatever HIL session
1107
- is already active, without starting anything new - handy if you closed the auto-opened window by
1108
- accident.
1109
-
1110
- ## `aivin do <agent_nickname> <mission>`
1111
-
1112
- Has a specific agent start a background mission toward a free-text goal (`POST /agent/start-work`),
1113
- not a specific deployed plugin. The agent runs the mission on its own, checking in via the
1114
- progress stream (see below); this is the CLI-native equivalent of typing into the platform's chat
1115
- and choosing which AI Staff agent should handle it.
1116
-
1117
- ```
1118
- Options:
1119
- --workspace <id> Workspace id to run in (default: your personal workspace)
1120
- --project <id> Project id within the workspace
1121
- --no-watch Fire the mission and return immediately - skip streaming live progress
1122
- ```
1123
-
1124
- ```bash
1125
- aivin do supportbot "Summarize today's support tickets and post the summary to #digest"
1126
- ```
1127
-
1128
- - `<agent_nickname>` is matched against the resolved workspace's already-installed agents (by
1129
- nickname, name, or id). Omit either argument and you'll be prompted interactively - the mission
1130
- prompt if only the agent is given, or a picker over the workspace's agents if only the mission is
1131
- given (in a non-interactive shell, both are required up front).
1132
- - If the nickname doesn't match anything in the workspace, or the workspace has no agents at all
1133
- yet, you're offered a choice: search & install one from the marketplace, or create a brand new
1134
- one - so `aivin do` never dead-ends on an empty workspace (see `aivin agent install`/`aivin agent
1135
- make` below, which this reuses).
1136
-
1137
- By default it then streams the mission's live progress in the terminal (same realtime channel
1138
- `aivin plugin logs` uses under the hood) until the run finishes or you press Ctrl+C - pass
1139
- `--no-watch` to just fire it and return immediately instead.
1140
-
1141
- If `--workspace` is omitted, it runs in your **personal workspace** (the platform always resolves
1142
- that first when no workspace is given).
1143
-
1144
- ### `aivin do job <description>`
1145
-
1146
- Creates a new **automation job** - recurring background work on a cron-style schedule, independent
1147
- of any single chat/mission invocation (`POST /automation/jobs/create`).
1148
-
1149
- ```
1150
- Options:
1151
- --workspace <id> Workspace id to create the job in (default: your personal workspace)
1152
- --project <id> Project id within the workspace
1153
- --agent <id> Agent id the job runs as (default: the workspace's default agent)
1154
- --schedule <condition> Natural-language schedule, e.g. "every Monday at 9am" (default: let the
1155
- platform infer one)
1156
- ```
1157
-
1158
- ```bash
1159
- aivin do job "Compile last week's support tickets into a summary and post it to #digest"
1160
- aivin do job "Send a daily standup reminder" --schedule "every weekday at 9am"
1161
- ```
1162
-
1163
- If `--schedule` is omitted, the platform infers a cadence (or falls back to manual) from the
1164
- description itself - pass it explicitly if you already know the cadence, to skip the extra
1165
- inference call.
1166
-
1167
- ## `aivin task [description]`
1168
-
1169
- Creates a new task (`POST /task/create`) from a plain-language description - the description
1170
- becomes both the task's title (truncated if long) and its full content.
1171
-
1172
- ```
1173
- Options:
1174
- --workspace <id> Workspace id to create the task in (default: your personal workspace)
1175
- --project <id> Project id within the workspace
1176
- --assignee <userId> User id to assign the task to (default: unassigned)
1177
- ```
1178
-
1179
- ```bash
1180
- aivin task "Follow up with the customer about their refund request"
1181
- ```
1182
-
1183
- `aivin task` also has subcommands for the rest of the task lifecycle:
1184
-
1185
- ```
1186
- Commands:
1187
- list [options] List tasks in a project
1188
- mine [options] List tasks assigned to you in a project
1189
- get [id] Get a task by id
1190
- update [options] [id] Update a task
1191
- delete [id] Delete a task
1192
- ```
1193
-
1194
- ```bash
1195
- aivin task list --status todo # list open tasks in your first project
1196
- aivin task list --project <id> --assignee <userId> # filter by project/assignee
1197
- aivin task mine # tasks assigned to you
1198
- aivin task get <id> # full task details (JSON)
1199
- aivin task update <id> --status done # move a task to done
1200
- aivin task update <id> --title "New title" --priority high
1201
- aivin task delete <id>
1202
- ```
1203
-
1204
- `list`/`mine` are scoped to a single project (the backend's real `/task/:projectId/list` route) -
1205
- `--project` defaults to the resolved workspace's first project, and throws if it has none (a
1206
- Personal workspace typically has no projects; pass `--project <id>` explicitly, or run
1207
- `aivin workspace` to find one).
1208
-
1209
- ## `aivin workspace`
1210
-
1211
- Interactive picker: lists your workspaces (personal workspace first), lets you select one, then
1212
- lists that workspace's projects so you can pick the corresponding one - printing the resolved
1213
- `--workspace`/`--project` ids to pass to `aivin do`/`do job`/`task`.
1214
-
1215
- ```
1216
- Options:
1217
- --plain Print a flat list instead of the interactive picker (for scripts/CI)
1218
- ```
1219
-
1220
- ```bash
1221
- aivin workspace
1222
- ```
1223
-
1224
- Non-TTY contexts (scripts, CI, piped output) or `--plain` print a flat listing instead of the
1225
- interactive prompts.
1226
-
1227
- ## `aivin agent`
1228
-
1229
- Search the AI Staff marketplace, install an agent into a workspace, create a brand new one, or
1230
- publish one you own. `aivin do` calls into the same install/create flows automatically when it
1231
- can't resolve `<agent_nickname>`.
1232
-
1233
- ```
1234
- Commands:
1235
- search [options] [query] Search the AI Staff marketplace for an agent
1236
- install [options] [query] Search the marketplace and install an agent into a workspace
1237
- make [options] Create a brand new AI Staff agent
1238
- publish [options] [agentId] Publish an agent you own to the marketplace
1239
- ```
1240
-
1241
- ```bash
1242
- aivin agent search "customer support" # browse the marketplace
1243
- aivin agent install "customer support" # search + pick + install into your personal workspace
1244
- aivin agent install --workspace <id> # no query - opens the same interactive picker `aivin do` uses
1245
- aivin agent make --name "Ada" --nickname ada --email ada@example.com --bio "Support triage bot"
1246
- aivin agent publish <agentId> # make an agent you own visible in the marketplace
1247
- ```
1248
-
1249
- - `install`/`make` default to your personal workspace when `--workspace` is omitted.
1250
- - `make` calls `POST /ai-staff/create`; passing the target workspace at creation time auto-installs
1251
- the new agent there too (no separate `install` call needed).
1252
- - `publish` is a two-step platform operation under the hood (`POST /ai-staff/update` with
1253
- `is_published: true`, then `POST /ai-staff/push` to promote the workspace's local copy to the
1254
- shared master) - both scoped to the workspace the agent actually lives/was authored in.
1255
-
1256
- ## `aivin project`
1257
-
1258
- Create, rename, or delete a project within a workspace (the backend has no separate "list projects"
1259
- endpoint - use `aivin workspace` to browse a workspace's existing projects).
1260
-
1261
- ```
1262
- Commands:
1263
- create [options] [name] Create a new project in a workspace
1264
- update [options] [id] Update a project (currently: rename)
1265
- delete [options] [id] Delete a project
1266
- ```
1267
-
1268
- ```bash
1269
- aivin project create "Q3 Launch"
1270
- aivin project update <id> --name "Q3 Launch (renamed)"
1271
- aivin project delete <id>
1272
- ```
1273
-
1274
- All three default to your personal workspace when `--workspace` is omitted.
1275
-
1276
- ## Environment variables
1277
-
1278
- `aivin login` saves your key once to `~/.aivin/credentials` and every plugin project on the
1279
- machine picks it up automatically - there's no per-project credential to manage.
1280
-
1281
- | Variable | Used by | Default | When you'd touch it |
1282
- | -------------------- | -------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- |
1283
- | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` | Point `main()`'s SDK calls at a local/dev/staging backend instead of production. Staging: `beta-sdk.aivin.vn:50052` (dedicated Cloudflare Tunnel TLS port - production goes through a load balancer on the standard 443 port instead, a different setup). |
1284
- | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` | Only for a self-hosted or staging instance. Staging: `https://beta-api.aivin.vn`. |
1285
- | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` | Only for a self-hosted or staging instance. |
1286
- | `LOCAL_TEST_PORT` | `aivin start` | `4001` | Only if `4001` is already taken on your machine. |
1287
- | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` | Loopback-only by default (`/invoke` has no auth) - only widen this if you deliberately want another device on your network to reach it. See [sdk repo's SECURITY.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SECURITY.md). |
1288
- | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` | Set `true` to run `src/main.ts` inside an isolated `worker_threads.Worker` (no direct access to the container's secret, restricted fs/child_process) instead of loading it in-process. Off by default - see [sdk repo's worker-sandbox.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/draft/plugins/worker-sandbox.md). |
1289
-
1290
- Everything else (`SDK_SECRET`, `SDK_GRPC_SERVER_BIND`, `SDK_GRPC_TLS`, `NODE_ENV`, ...) is
1291
- either injected automatically inside a deployed container or has a working zero-config default -
1292
- not something you're expected to set by hand.
1293
-
1294
- ## See also
1295
-
1296
- - [GETTING_STARTED.md](./GETTING_STARTED.md) - the narrative walkthrough these commands fit into
1297
- - [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md) - every `manifest.json` field, including MCP proxy plugins
1298
- - [PLUGIN_DEVELOPMENT_GUIDE.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/PLUGIN_DEVELOPMENT_GUIDE.md) - writing and testing a handler
1299
- - [SDK.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SDK.md) - everything the SDK exposes inside `main()`
1
+ # 🖥️ CLI Reference
2
+
3
+ `aivin` is built on [Commander](https://github.com/tj/commander.js), so help is always available
4
+ without needing this doc:
5
+
6
+ ```bash
7
+ aivin --help # or: aivin help
8
+ aivin <command> --help # or: aivin help <command>
9
+ ```
10
+
11
+ Every command below is real - this is the exact output of `aivin --help` as of this CLI version.
12
+
13
+ ```
14
+ Usage: aivin [options] [command]
15
+
16
+ aivin CLI - scaffold, run, and deploy Aivin plugins
17
+
18
+ Options:
19
+ -V, --version output the version number
20
+ -h, --help display help for command
21
+
22
+ Commands:
23
+ create [options] [name] Create new plugin
24
+ init [options] [name] Set up a new plugin step by step: asks what it should do, then generates real working code from that description
25
+ validate [options] Validate manifest.json in the current directory (or --json/--stdin for scripted use)
26
+ start [options] Start plugin server
27
+ deploy Deploy plugin to your org on the Aivin server
28
+ test [options] Deploy to a non-production test instance, then smoke-test it with generated input and save a report to .test/
29
+ plugin AI-assisted plugin authoring
30
+ connector Register and discover reusable connectors (OAuth apps / credential-form namespaces)
31
+ pluginstore Self-hosted aivin-service worker (Docker) - attach it to your org as a plugin store
32
+ mcp [options] [url] MCP proxy plugins - wrap an external MCP server tool/resource/prompt, no code required
33
+ login [options] [baseUrl] Log in and save an API key for plugin deployment (opens your browser by default)
34
+ whoami Show which account is currently logged in on this machine (reads ~/.aivin/credentials - no server call)
35
+ key Manage named API keys for your account
36
+ browser [options] [mission] Run an AI Browser mission - by default opens/reuses a local browser window dedicated to AI Browser (own profile, own cookies - log in once, watch missions run live from then on); --remote uses a server-side browser instead
37
+ do [options] [agentNickname] [mission] Have <agentNickname> work toward a goal in the background - not a specific deployed plugin
38
+ task [options] [description] Create a new task from a plain-language description
39
+ workspace [options] Browse your workspaces and projects, and pick one to use with --workspace/--project
40
+ agent Search, install, create, and publish AI Staff agents
41
+ project Create, update, and delete projects within a workspace
42
+ help [command] display help for command
43
+ ```
44
+
45
+ ## `aivin init [name]`
46
+
47
+ The simplest way to start: asks what the plugin should do, then scaffolds the project **and**
48
+ generates real working code from that description in one step - no separate `aivin create` +
49
+ `aivin plugin make` needed.
50
+
51
+ ```bash
52
+ aivin init my-plugin
53
+ # ? Plugin name: my-plugin
54
+ # ? What should this plugin do? (be specific - this is what generates your code)
55
+ # > Summarize a support ticket and tag its urgency low/medium/high
56
+ ```
57
+
58
+ Options:
59
+
60
+ ```
61
+ Options:
62
+ --name <name> Plugin name (if not specified, will prompt)
63
+ --model <model> LLM model to use for generation
64
+ --provider <provider> LLM provider to use for generation
65
+ ```
66
+
67
+ Writes two source files instead of one, unlike `aivin create`:
68
+
69
+ - **`src/service.ts`** - the actual business logic, AI-generated from your description. A single
70
+ exported `execute(input, ctx)` that returns plain result data (or throws a plain `Error`) - no
71
+ `PluginResponse`/`PluginStatus` boilerplate to think about.
72
+ - **`src/main.ts`** - a thin, static wrapper (not AI-generated, doesn't change between runs). Calls
73
+ `execute()` and packages the result into the `PluginResponse` the platform expects. This filename
74
+ is fixed - the runtime always loads exactly `src/main.ts`, so it's never regenerated or renamed.
75
+
76
+ If code generation fails (network issue, `API_KEY` not set, etc.), `aivin init` still leaves you
77
+ with a working, deployable scaffold - it falls back to the same plain placeholder `aivin create`
78
+ writes, so nothing is left half-broken.
79
+
80
+ Regenerating later: `aivin plugin make "<new description>"` detects `src/service.ts` and targets it
81
+ instead of `src/main.ts`, so the split is preserved (see below).
82
+
83
+ Prefer no AI step at all? `aivin create` scaffolds the same project structure minus the generation -
84
+ one `src/main.ts` you write by hand.
85
+
86
+ ## `aivin create`
87
+
88
+ Scaffold a new plugin project (`manifest.json`, `src/main.ts`, `package.json`, `tsconfig.json`,
89
+ `.env`, `.gitignore`).
90
+
91
+ ```
92
+ Usage: aivin create [options] [name]
93
+
94
+ Options:
95
+ --json <config> JSON config (AI mode)
96
+ --stdin Read from stdin
97
+ --name <name> Plugin name (if not specified, will prompt)
98
+ --silent Silent mode
99
+ --json-output JSON output
100
+ ```
101
+
102
+ - `aivin create <name>` (or `--name <name>`) → creates a new `<name>/` subdirectory and scaffolds
103
+ into it, no name prompt (description still prompted).
104
+ - No name at all → interactive prompts for both name and description, scaffolding into the
105
+ **current** directory - `mkdir`/`cd` into your target folder yourself first.
106
+ - `--json '<config>'` / `--stdin` → non-interactive/scripted mode for AI tooling, also creates a
107
+ `<config.name>/` subdirectory. `config` needs at least `name` and `description`; anything else
108
+ (`input`, `output`, `trigger_type`, ...) is merged straight into the generated `manifest.json`.
109
+ `config` may also be a path to a JSON file.
110
+ - `--json-output` → prints a machine-readable `{ success, pluginDir, name, description, timestamp }`
111
+ result instead of the usual colored console output.
112
+
113
+ ```bash
114
+ aivin create my-plugin
115
+ aivin create --json '{"name":"my-plugin","description":"Summarize tickets"}'
116
+ ```
117
+
118
+ ## `aivin validate`
119
+
120
+ Validates a plugin config against the same rules `aivin create` enforces (name format, required
121
+ `description`, and - if present - `proxy_config` completeness for MCP proxy plugins). Doesn't touch
122
+ the network.
123
+
124
+ With no flags, validates `manifest.json` in the current directory - the common case:
125
+
126
+ ```bash
127
+ cd my-plugin
128
+ aivin validate
129
+ ```
130
+
131
+ ```
132
+ Options:
133
+ --json <config> JSON config, instead of reading manifest.json from the current directory
134
+ --stdin Read JSON config from stdin, instead of reading manifest.json
135
+ --json-output JSON output
136
+ ```
137
+
138
+ `--json`/`--stdin` remain for scripted/CI use where the config isn't a file on disk yet:
139
+
140
+ ```bash
141
+ aivin validate --json '{"name":"my-plugin","description":"x"}'
142
+ ```
143
+
144
+ ## `aivin start`
145
+
146
+ Runs the current plugin directory (must contain `manifest.json` and `src/main.ts`) against a real
147
+ local server - specifically, this project's own installed `@aivin-labs/sdk`'s `bin/server.mjs`
148
+ (resolved from *this project's* `node_modules`, not the CLI's own install location - if you see
149
+ "Could not find @aivin-labs/sdk installed", run `npm install` first). Starts:
150
+
151
+ 1. A real gRPC server (bind `0.0.0.0:50051`) - the same protocol the production host uses to
152
+ trigger your handler(s). You don't call this directly.
153
+ 2. In development (anything but `NODE_ENV=production`), an HTTP test shim on `:4001` (override with
154
+ `LOCAL_TEST_PORT`) for manual `curl` testing.
155
+
156
+ ```bash
157
+ aivin start
158
+ curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
159
+ -d '{"input":{"text":"hello"}}'
160
+ ```
161
+
162
+ With more than one `plugins: []` entry, pass `mission` to pick which entry's `func` runs - it's
163
+ matched against each entry's `id`, falling back to `func` (a single-entry manifest, the scaffold
164
+ default, always resolves to its one entry - no `mission` needed):
165
+
166
+ ```bash
167
+ curl -X POST http://localhost:4001/invoke -H 'content-type: application/json' \
168
+ -d '{"mission":"summarize-ticket","input":{"text":"hello"}}'
169
+ ```
170
+
171
+ SDK calls made while running default to the **production** backend (`api.aivin.cloud`) if
172
+ `SDK_ENDPOINT` isn't set in `.env` - point it at a local/dev backend instead if you don't want
173
+ that (see [Environment variables](#environment-variables) below).
174
+
175
+ ### Hot-reload
176
+
177
+ Saving `src/**` or `manifest.json` re-imports the plugin in place - no more Ctrl+C + `aivin start`
178
+ again after every edit. Both the real gRPC server and the `:4001` HTTP test shim pick up the change
179
+ together. A broken save (syntax error, missing export) is reported and the *previous* working
180
+ version keeps serving until you fix it - a typo mid-edit doesn't kill the running server.
181
+
182
+ ```
183
+ ♻️ Reloaded (src/main.ts): my-plugin (My Plugin) v0.1.0
184
+ ```
185
+
186
+ On by default in development; disabled automatically inside a real deployed container (detected via
187
+ `SDK_SECRET_FILE`, which only a real deploy sets - `NODE_ENV=production` alone doesn't reliably mean
188
+ "deployed", the platform's own container build never sets it). This same file is also the
189
+ container's entrypoint in production, where the plugin source is also bind-mounted read-only, so
190
+ there'd be nothing for the watcher to see even without this check. Turn it off by hand with
191
+ `--no-watch` or `AIVIN_START_WATCH=false`.
192
+
193
+ ### Live per-call debugging: `--debug` / `--debug-json`
194
+
195
+ By default you only see a trace summary once the whole invocation finishes (`AIVIN_TRACE`, on by
196
+ default - see [Environment variables](#environment-variables)). To watch each `sdk.*` call as it
197
+ happens instead:
198
+
199
+ ```bash
200
+ aivin start --debug # human-readable: one line per call, live
201
+ aivin start --debug-json # same events, one JSON object per line - for a script/coding agent
202
+ # to parse instead of pattern-matching free text
203
+ ```
204
+
205
+ Both are `SDK_DEBUG=true`/`SDK_DEBUG=json` under the hood (settable directly if you're not going
206
+ through `aivin start`, e.g. inside `aivin test`'s smoke-test run). Each line/event covers exactly
207
+ one `sdk.*` call: `namespace`, `duration_ms`, `attempts`, `success`, `error` (if any).
208
+
209
+ ## `aivin deploy`
210
+
211
+ Deploys the plugin in the current directory (`manifest.json` + every project file except
212
+ `node_modules/`, `.git/`, `.tmp/`, `dist/`, `build/`, `.test/`, `.gitignore`, `yarn.lock`, and
213
+ `.env`) to `POST /plugins/deploy`. Always private to your org - there's no CLI-reachable "submit to
214
+ the public store" path for regular code/Docker plugins today (that only exists through the browser
215
+ CodeEditor's publish flow, a different runtime). **MCP proxy plugins are the one exception** -
216
+ `aivin mcp <url> --publish` (below) can submit those to the community store directly from the CLI.
217
+
218
+ - `manifest.json` is normally the default `{ ...commonFields, plugins: [...] }` shape (see
219
+ [MANIFEST.md#default-shape](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#default-shape)) - common fields are copied onto each
220
+ entry in `plugins` before upload, and all entries deploy together, sharing one running
221
+ container. The legacy flat single-object shape is still accepted.
222
+ - If every entry's `manifest.proxy_config` is set (MCP proxy plugins - see `aivin mcp create`
223
+ below), no files are read or sent at all - just the manifest.
224
+ - `package-lock.json` is auto-generated (`npm install --package-lock-only`) before upload if missing
225
+ - the backend's build runs `npm ci`, which requires one.
226
+ - On success, auto-increments `manifest.json`'s patch version(s) and writes back the plugin id(s)
227
+ the server assigned.
228
+
229
+ ```bash
230
+ aivin deploy
231
+ ```
232
+
233
+ ## `aivin test`
234
+
235
+ Same payload/logic as `aivin deploy`, but against `POST /plugins/test/deploy` - a non-production
236
+ instance for verifying the plugin runs end-to-end on real infra (real container, real gRPC, real
237
+ the SDK) before anyone else can see it. This endpoint is blocked by the backend in production.
238
+
239
+ After a successful deploy, it also **smoke-tests** every non-proxy plugin entry: generates sample
240
+ input from `manifest.json`'s `input` schema (`POST /code/generate-sample-data`), invokes the plugin
241
+ for real (`POST /plugins/execute`) against a workspace, and writes a pass/fail report to
242
+ `.test/<timestamp>.json` in the project directory (also excluded from future deploy uploads).
243
+
244
+ **MCP proxy entries are skipped by default** - there's no generic "sample input" that makes sense
245
+ for a tool schema an external MCP server defines itself, so `aivin test` deploys them but runs no
246
+ automated invoke/report unless you opt in with `--verify-proxy`. Use
247
+ `aivin plugin trigger --id <pluginId> -a "<prompt>"` (or the interactive "Test now?" step
248
+ `aivin mcp <url>` offers right after deploy) to test one by hand instead.
249
+
250
+ ```
251
+ Options:
252
+ --workspace <id> Workspace id to run the smoke test against (default: auto-picks your first one)
253
+ --no-smoke-test Only deploy - skip the generated-input invoke test and report
254
+ --verify-proxy Also invoke MCP proxy entries for real (empty input) instead of skipping
255
+ them - only use if you know the underlying tool(s) have no meaningful side
256
+ effects
257
+ ```
258
+
259
+ ```bash
260
+ aivin test # deploy + smoke-test + report
261
+ aivin test --workspace <id> # smoke-test against a specific workspace
262
+ aivin test --no-smoke-test # deploy only, same as before this flag existed
263
+ aivin test --verify-proxy # also invoke proxy entries with empty input, for real
264
+ ```
265
+
266
+ `--verify-proxy` sends `arguments: {}` (not AI-generated - proxy's `input` schema is the generic
267
+ `{ data: object }` passthrough, so there's nothing meaningful to infer a "realistic" sample from)
268
+ straight to `/plugins/execute`. This really calls the external MCP server - only use it if the
269
+ tool(s) involved are safe to invoke automatically (idempotent/read-only), since a repeated `aivin
270
+ test` run means a repeated real call every time.
271
+
272
+ Entries the MCP server itself flagged destructive/non-readonly (via the MCP spec's own
273
+ `readOnlyHint`/`destructiveHint` tool annotations, surfaced on the manifest as `request_hil: true`)
274
+ are skipped even under `--verify-proxy` - that flag means "the caller vetted these tools as safe to
275
+ call automatically," which doesn't extend to a tool the server itself is warning isn't. Verify
276
+ those by hand instead (`aivin plugin trigger --id <id> -a "..."`).
277
+
278
+ ## `aivin plugin make <description>`
279
+
280
+ AI-generates a plugin from a natural-language description, via `POST /code/generate-project` -
281
+ **complexity-adaptive**: the backend classifies the requirement first, and only escalates beyond a
282
+ single `src/main.ts` when it's genuinely complex.
283
+
284
+ ```
285
+ Options:
286
+ --model <model> LLM model to use for generation
287
+ --provider <provider> LLM provider to use for generation
288
+ ```
289
+
290
+ ```bash
291
+ aivin plugin make "Summarize a support ticket and tag its urgency"
292
+ ```
293
+
294
+ - **Simple/moderate** requirement (the common case): exactly one `src/main.ts`, one generation call
295
+ - unchanged from before. Same conventions as always (`main(mission, input, ctx)`,
296
+ `import { ai } from '@aivin-labs/sdk'`, `PluginResponse`).
297
+ - **Complex** requirement (several genuinely independent capabilities, or logic too large for one
298
+ flat function): the backend plans a small multi-file project first, generates each file, and - if
299
+ the plan calls for it - returns a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
300
+ fragment that replaces `manifest.json`'s `plugins[]` with one entry per capability.
301
+
302
+ Requires `manifest.json` to already exist (`aivin create` first).
303
+
304
+ ### Self-correction loop
305
+
306
+ Generation isn't one-shot, and for a multi-file plan it isn't one-file-at-a-time either: files with
307
+ no dependency on each other generate in parallel (only a file that genuinely needs to see another
308
+ one's content, per the plan's own `depends_on`, waits for it first). After writing every returned
309
+ file, if the project's own `typescript` devDependency is installed (`npm install` already run), the
310
+ whole project is type-checked with `tsc --noEmit`. Real compiler errors (exact
311
+ `file(line,col): error TSxxxx: ...` lines) are attributed back to whichever file they were reported
312
+ against and sent to the AI for a surgical fix - up to 2 rounds, across as many files as had errors:
313
+
314
+ ```
315
+ 🤖 Generating plugin
316
+ ✅ 2 file(s) generated (src/main.ts, src/lib/search.ts)
317
+ ⚠️ 2 compiler error(s) across 1 file(s) - asking the AI to fix...
318
+ ✅ Fixed - clean type-check after 1 attempt(s)
319
+ ```
320
+
321
+ If `node_modules` isn't installed yet, type-checking (and the self-correction it enables) is skipped
322
+ silently - run `npm install` first if you want it. If errors remain after both rounds, every file is
323
+ still written, with every remaining error printed for you to fix by hand.
324
+
325
+ Review generated code before relying on it either way - self-correction only catches what `tsc`
326
+ catches (type errors), not wrong business logic.
327
+
328
+ ## `aivin plugin convert [hint]`
329
+
330
+ Hands the existing project in the current directory to the backend's agentic project-conversion
331
+ pipeline instead of generating locally. Unlike `plugin make`/`plugin init` (a single AI call per
332
+ file, run entirely from what you pass it), this command:
333
+
334
+ 1. Uploads only the **directory tree** - paths and byte sizes, never file content - so the request
335
+ stays cheap no matter how large the project is.
336
+ 2. The backend scans it: it decides which files are actually worth reading (entry points,
337
+ `package.json`, anything name-suggestive of routes/tools/skills) and asks the CLI to read them
338
+ back one at a time, over the same socket connection `aivin plugin logs` uses.
339
+ 3. It plans a conversion - single `main()` vs. a [multi-function manifest](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#multi-function-plugins)
340
+ (one `plugins[]` entry per independent capability), and which files to create vs. adapt in
341
+ place - detecting the project's shape (a plain script, an MCP server, an API backend with
342
+ routes, a Claude-style skill) from what it actually read, not a fixed regex. If the project isn't
343
+ TypeScript/JavaScript (Python, Go, ...), every file becomes a **port** (translated, not edited) -
344
+ the plan always uses `create` in that case, never `update`, since there's no existing `.ts` file
345
+ to adapt in place.
346
+ 4. It generates/updates each planned file, then **verifies with a real `tsc --noEmit` run** on your
347
+ machine (via the same tool-call channel) and self-corrects on real compiler errors, up to twice.
348
+
349
+ Every step prints live as it happens - this loop can take a while on a real project, so it's never
350
+ silent:
351
+
352
+ ```bash
353
+ cd your-existing-project
354
+ aivin plugin convert
355
+ # 📂 Scanning project tree...
356
+ # 142 file(s) in tree (content read on demand by the server, never uploaded up front)
357
+ # 🤖 Converting - this loops (scan → plan → generate → verify), watch for progress below...
358
+ #
359
+ # [10:32:01] Scanning project tree (142 entries)...
360
+ # [10:32:03] Reading 3 file(s): package.json, src/index.ts, src/tools/search.ts
361
+ # [10:32:07] Plan ready: mcp_server, 2 file(s) - Two independent MCP tools found (search, fetch);
362
+ # splitting into a multi-function manifest so each is separately callable.
363
+ # [10:32:15] Generating 2 file(s) in parallel: src/main.ts, src/lib/search.ts
364
+ # [10:32:22] Type-checking (attempt 1)...
365
+ # [10:32:23] Type-check clean
366
+ # [10:32:23] All required exports present
367
+ # [10:32:24] Running a smoke test with generated sample input (may make real SDK/AI calls using your credentials)...
368
+ # [10:32:31] Smoke test passed
369
+ # ✅ Conversion done (mcp_server, 2 file(s))
370
+ ```
371
+
372
+ The smoke test only runs if the type-check passed first (no point executing code that doesn't even
373
+ compile) and `@aivin-labs/sdk` is already installed locally (`npm install`) - skipped, not failed,
374
+ otherwise. It spawns the real plugin runtime on your machine on off-default ports (won't collide with
375
+ a real `aivin start`) with AI-generated sample input, so a plugin whose logic calls `ai.prompt()` or
376
+ other SDK methods will make a real call using your credentials during this step.
377
+
378
+ ```
379
+ Options:
380
+ --model <model> LLM model to use for generation
381
+ --provider <provider> LLM provider to use for generation
382
+ --force Re-run conversion even if src/main.ts already exists (e.g. redo a
383
+ previous bad/stale result)
384
+ ```
385
+
386
+ - No `manifest.json` needed first - if one doesn't exist, it's created from `package.json` (name,
387
+ description) or the directory name.
388
+ - Fails if `src/main.ts` already exists, unless `--force` is given - the plain (no-flag) case is
389
+ for a project that isn't a plugin yet; `--force` re-runs the whole scan/plan/generate/verify loop
390
+ against a project this command already converted before (the earlier plan turned out wrong, the
391
+ project changed since, whatever the reason) - `src/main.ts` isn't excluded from what gets scanned,
392
+ so the new plan is free to mark it `update`, and the usual per-file overwrite confirmation still
393
+ applies to it like any other existing file.
394
+ - `[hint]` is optional extra guidance, e.g. which function to focus on - passed straight to the
395
+ backend's planning step.
396
+ - If the plan is multi-function, `manifest.json`'s `plugins[]` is replaced with one entry per
397
+ planned capability (fresh local ids - `aivin deploy` still assigns the real ones).
398
+ - Requires a live connection to the Aivin server for the whole duration (it's not a local batch
399
+ job) - the socket is what lets the backend read files on demand and stream progress back.
400
+ - Only one conversion can run at a time per project - starting a second one against the same
401
+ project while the first is still running fails fast instead of racing both against the same
402
+ files. If the previous run's process died without cleanly finishing, this frees up on its own
403
+ within moments, not stuck for the full run duration.
404
+ - The whole run gives up after ~15 minutes regardless of how far it got, so a stuck step can't hold
405
+ the connection open forever.
406
+
407
+ ### Overwrite safety
408
+
409
+ Unlike `plugin make`, this command can touch files that **already exist** in your project - the
410
+ backend's plan may mark some as `update` (adapt in place) rather than `create` (new file):
411
+
412
+ - Before scanning starts, if the directory is a git repo with uncommitted changes, you're warned
413
+ and (in an interactive terminal) asked to confirm before continuing at all.
414
+ - Before any individual existing file is actually overwritten, you're prompted per-file (with a
415
+ quick `git status` hint - untracked vs. has uncommitted changes - when available) - declining
416
+ skips just that file, the rest of the conversion continues.
417
+ - Non-interactive runs (CI/scripts) can't prompt, so they proceed automatically - the decision is
418
+ still printed to the log either way, it's just not blocking.
419
+
420
+ Review the generated code before relying on it - self-correction only catches what `tsc` catches
421
+ (type errors), not wrong business logic, and the file/project-kind detection is a best effort, not
422
+ a guarantee.
423
+
424
+ ## `aivin plugin search <query>`
425
+
426
+ Searches the platform's plugin ecosystem before you write new logic - the same relevance-ranked
427
+ lookup the platform's own agent uses to auto-select a plugin for a mission (`GET /plugins/search`).
428
+ Doesn't need to be run from inside a plugin project.
429
+
430
+ ```bash
431
+ aivin plugin search "send a slack message"
432
+ ```
433
+
434
+ Options:
435
+
436
+ ```
437
+ Options:
438
+ --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
439
+ --mcp <server_id> List every tool/resource/prompt plugin generated from one MCP server, instead of a text search
440
+ --store <store_id> Restrict to plugins hosted on one self-hosted plugin store (id from `aivin pluginstore ls`) - combines with the text query/--mcp
441
+ --limit <n> Max results to show
442
+ --plain Print a flat list instead of the interactive browser (for scripts/CI)
443
+ ```
444
+
445
+ In a real terminal, results open in an interactive browser: `↑`/`↓` to move between matches,
446
+ `→`/`space`/`enter` to open a plugin's detail view (full description, version, input/output
447
+ schema), `←`/`esc`/`backspace` to go back to the list, `q` to quit. Non-TTY contexts (scripts, CI,
448
+ piped output) or `--plain` fall back to a flat printed list.
449
+
450
+ Call one from your own plugin with `import { call } from '@aivin-labs/sdk'` then
451
+ `await call('<plugin_id>', params)`.
452
+
453
+ ## `aivin plugin info <id>`
454
+
455
+ Detail view for **one already-known plugin id**, without going through `plugin search`'s free-text
456
+ ranking first - useful when debugging a specific plugin you already have the id for (copied from
457
+ `plugin search --mcp <server_id>`'s listing, from the platform, etc.).
458
+
459
+ ```bash
460
+ aivin plugin info modelcontextprotocol-servers-src-everything-read_file
461
+ ```
462
+
463
+ Options:
464
+
465
+ ```
466
+ Options:
467
+ --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
468
+ --plain Print flat instead of the interactive browser, if falling back to
469
+ closest-match results
470
+ ```
471
+
472
+ There's no dedicated `GET /plugins/:id` on the backend, so this reuses `/plugins/search` with the
473
+ id itself as the query and picks the exact `id` match out of the ranked results. If nothing matches
474
+ exactly (typo'd id, or a plugin not visible to you), it prints "no exact match" and falls back to
475
+ the same interactive browser over the closest results instead of failing outright.
476
+
477
+ ## `aivin plugin ask [mission]`
478
+
479
+ One-shot "just simulate the agent" mode: give it a plain-language mission and it does what a
480
+ running agent actually does at execution time - searches the plugin ecosystem the same
481
+ relevance-ranked way (`plugin search`'s lookup), picks the **top match**, and immediately triggers
482
+ it with that same mission auto-mapped onto the input schema (`plugin trigger -a` under the hood).
483
+ Where `plugin search` + `plugin trigger --id <id> -a "..."` is a manual two-step "pick, then run"
484
+ flow, `ask` collapses both into a single command - no copying an id between them.
485
+
486
+ ```bash
487
+ aivin plugin ask "send a slack message to #eng saying the deploy is done"
488
+ ```
489
+
490
+ ```
491
+ 🤖 Auto-selected: Slack Notify (87% match) (slack-notify-abc123)
492
+ runner-up(s): Slack Post Message, Discord Notify
493
+
494
+ 🚀 Triggering Slack Notify...
495
+ ...
496
+ ```
497
+
498
+ Options:
499
+
500
+ ```
501
+ Options:
502
+ --top <n> How many candidates to consider/print as runner-up context
503
+ (default 5) - only the top match is ever run
504
+ -i, --input <json> Force specific fields (as JSON) alongside the auto-mapped
505
+ ones - explicit fields win
506
+ --workspace <id> Workspace id to search/run against (default: auto-picks
507
+ your first one)
508
+ --agent <id> Agent id to run as, if the plugin needs one for
509
+ HIL/confirm behavior to be accurate
510
+ --watch-logs Also stream the chosen plugin's own live console output inline
511
+ --no-auth-prompt Don't offer to connect/configure a missing connector
512
+ interactively - just print the needs_auth result and exit
513
+ --save Write this run's result to .test/trigger/<ts>.json
514
+ --compare <file> Diff this run against a previously --save'd file
515
+ ```
516
+
517
+ If the auto-pick looks wrong, check the printed runner-up(s) and fall back to the manual flow -
518
+ `aivin plugin search "<mission>"` to browse candidates yourself, then
519
+ `aivin plugin trigger --id <chosen-id> -a "<mission>"` to run that specific one instead. `ask`
520
+ throws (no plugin executed) if the search comes back empty, rather than guessing.
521
+
522
+ ## `aivin plugin trigger [mission] [input]`
523
+
524
+ Invokes an **already-deployed** plugin for real and prints the result - the same
525
+ `POST /plugins/execute` the platform's own Playground ("Thử nghiệm" tab) uses, so it exercises the
526
+ exact same code path a running agent would hit. Run it from the plugin's project directory -
527
+ `manifest.json` supplies the plugin id (`--func <name>` picks the entry for a multi-function
528
+ plugin) - or pass `--id` directly for a plugin with no local project directory (e.g. one built by
529
+ `aivin mcp <url>`, which deploys straight from a scan and never writes a `manifest.json` anywhere).
530
+
531
+ ```
532
+ Options:
533
+ -a, --auto <prompt> Natural-language prompt - the platform auto-maps it onto
534
+ the input schema for you
535
+ --id <pluginId> Plugin id to trigger directly - skips the local
536
+ manifest.json lookup entirely
537
+ --func <name> Which function to trigger, for a multi-function plugin
538
+ (matches name/func/id) - ignored when --id is given
539
+ --workspace <id> Workspace id to run against (default: auto-picks your
540
+ first one)
541
+ --agent <id> Agent id to run as, if the plugin needs one for
542
+ HIL/confirm behavior to be accurate
543
+ --watch-logs Also stream the plugin's own live console output inline
544
+ (same feed as `aivin plugin logs`) - no second terminal
545
+ needed. Requires permission to view that plugin's logs;
546
+ most store plugins from other orgs just fall back to
547
+ the REST result only.
548
+ --no-auth-prompt Don't offer to connect/configure a missing connector
549
+ interactively - just print the needs_auth result and exit
550
+ --save Write this run's result to .test/trigger/<ts>.json
551
+ --compare <file> Diff this run against a previously --save'd file
552
+ ```
553
+
554
+ ```bash
555
+ # no local project directory - e.g. an MCP proxy plugin from `aivin mcp <url>`
556
+ aivin plugin trigger --id my-mcp-plugin-id -a "search for open issues about login"
557
+ ```
558
+
559
+ **Direct mode** - `<mission>` (becomes `main()`'s `mission` argument) and `<input>` (a JSON string,
560
+ becomes `main()`'s `input` argument) both required:
561
+
562
+ ```bash
563
+ aivin plugin trigger "summarize this" '{"text":"Aivin plugins are easy to write."}'
564
+ ```
565
+
566
+ **Auto mode** (`-a`/`--auto <prompt>`) - give it free text instead of structured JSON; the backend's
567
+ own input-mapping (`mapDataToSchema`, the same mechanism the Playground's chat-style tester uses)
568
+ maps it onto `manifest.json`'s `input` schema for you:
569
+
570
+ ```bash
571
+ aivin plugin trigger -a "Summarize this ticket: customer can't log in after the last update"
572
+ ```
573
+
574
+ `<input>` can still be given alongside `-a` for fields you want to force rather than let the AI
575
+ infer - explicit values win over auto-mapped ones per field.
576
+
577
+ What gets printed:
578
+ - `--- Log ---` - the backend's own mapping/execution stage messages (`processing_log`), if any.
579
+ This is **not** your plugin's own `console.log()` output from inside `main.ts` - it's everything
580
+ the HTTP response itself carries, printed after the call completes.
581
+ - `--- Auto-mapped input ---` - what `-a`'s prompt actually got mapped to (`mapped_arguments`),
582
+ only present in auto mode.
583
+ - `--- Result: <status> ---` - the plugin's real `status`/`message`/`error_code`/`data`.
584
+ - `--- Compare ---` (only with `--compare <file>`) - status + data diffed against the saved run.
585
+
586
+ Both the workspace lookup and the execute call have a client-side timeout (15s and 3 minutes) - a
587
+ hung backend fails with a clear error instead of `trigger` sitting there forever. Override the
588
+ execute one with `AIVIN_TRIGGER_TIMEOUT_MS` if you have a legitimately slow plugin.
589
+
590
+ ### Watching your plugin's own console output inline: `--watch-logs`
591
+
592
+ By default `trigger` only shows what's above - not the plugin's own `console.log()`/`sdk.log()`
593
+ calls from inside `main.ts`. Pass `--watch-logs` to subscribe to that live, over the same channel
594
+ `aivin plugin logs` uses, right before firing the call - one terminal instead of two:
595
+
596
+ ```bash
597
+ aivin plugin trigger --watch-logs "summarize this" '{"text":"..."}'
598
+ ```
599
+
600
+ This is permission-scoped server-side to plugins you can see the container logs for (your own or
601
+ your org's deployments). Triggering a plugin from the public store that some other org owns will
602
+ print `(--watch-logs: no live console output - ...)` and fall back to the REST result only - there's
603
+ no way around that from the CLI, raw container stdout isn't something the platform exposes across
604
+ org boundaries.
605
+
606
+ ### Missing a connector? `trigger` sets it up for you, right there
607
+
608
+ If the plugin needs a connector (OAuth account, or a plain credential form like SMTP
609
+ host/user/pass) that isn't configured yet, `/plugins/execute` comes back `needs_auth` instead of
610
+ running. In an interactive terminal, `trigger`/`ask` catch that and offer to fix it on the spot
611
+ instead of just printing the failure and making you go set it up in the web app:
612
+
613
+ - **OAuth connector** - asks "Open your browser to connect now?", then opens the same
614
+ authorize-flow the web app's "Connect" button uses (falls back to printing the URL if it can't
615
+ launch a browser), and polls in the background until you've finished. No timeout hunting - it
616
+ waits up to 3 minutes, then retries the trigger automatically.
617
+ - **Credential-form connector** (SMTP, or any custom `credential_form` connector registered via
618
+ `aivin connector register`) - prompts for each declared field right in the terminal (masked for
619
+ `secret` fields), saves it, then retries.
620
+
621
+ Either way, you get exactly one automatic retry after setup - if it still needs auth after that
622
+ (e.g. you declined, or the OAuth flow timed out), the `needs_auth` result just prints as-is. Pass
623
+ `--no-auth-prompt` to skip all of this and always just print the result (useful for scripts/CI,
624
+ where there's no one to answer the prompt anyway - it's also skipped automatically whenever stdin/
625
+ stdout isn't a real TTY).
626
+
627
+ ### Turning ad-hoc tries into a regression check: `--save` / `--compare`
628
+
629
+ ```bash
630
+ aivin plugin trigger "summarize this" '{"text":"..."}' --save
631
+ # Saved: .test/trigger/2026-01-15T10-30-00-000Z.json
632
+
633
+ # ...later, after changing the plugin (or re-testing the same store plugin)...
634
+ aivin plugin trigger "summarize this" '{"text":"..."}' \
635
+ --compare .test/trigger/2026-01-15T10-30-00-000Z.json
636
+ ```
637
+
638
+ Lighter-weight than `aivin test`'s full deploy+smoke-test+report flow - useful for a quick "did this
639
+ still behave the same way" check on any plugin you can trigger, including ones you don't own.
640
+
641
+ ## `aivin plugin logs [pluginId]`
642
+
643
+ Tails an **already-deployed** plugin's own container stdout/stderr live - the same real-time feed
644
+ the platform's own Playground log panel uses. `pluginId` defaults to the current directory's
645
+ `manifest.json` id (`--func <name>` picks the entry for a multi-function plugin), so plain
646
+ `aivin plugin logs` works from inside the plugin's own project directory; pass an explicit id to
647
+ watch a plugin you're not standing inside.
648
+
649
+ ```
650
+ Options:
651
+ --func <name> Which function's id to resolve, for a multi-function plugin
652
+ (only used when pluginId is omitted)
653
+ ```
654
+
655
+ ```bash
656
+ aivin plugin logs
657
+ aivin plugin logs my-plugin-id
658
+ ```
659
+
660
+ Prints each line as it's written (`console.log` → gray, `console.error` → red), with a local
661
+ timestamp. Runs until you press Ctrl+C. If the container restarts (redeploy/crash) mid-stream,
662
+ the connection ends - re-run the command to resume watching.
663
+
664
+ ## `aivin plugin delete [id]`
665
+
666
+ Deletes a plugin you own - `DELETE /plugins/store/:pluginId` for a single one, or
667
+ `--group <groupId>` for every plugin created by one batch deploy at once (`DELETE
668
+ /plugins/group/:groupId`) - e.g. everything `aivin mcp <url>` generated in a single run, which
669
+ prints its `group_id` right after deploying specifically so you can pass it here later. Neither can
670
+ be undone.
671
+
672
+ ```
673
+ Options:
674
+ --group <groupId> Delete every plugin sharing this group_id instead of a single plugin by id
675
+ -y, --yes Skip the confirmation prompt (for scripts/CI)
676
+ ```
677
+
678
+ ```bash
679
+ aivin plugin delete my-plugin-id
680
+ aivin plugin delete --group 66f2a1... # everything from one `mcp <url>` run
681
+ aivin plugin delete --group 66f2a1... --yes # skip the prompt, for scripts
682
+ ```
683
+
684
+ Single delete asks a plain yes/no confirmation. `--group` asks you to **type the group id back** to
685
+ confirm (same pattern `aivin pluginstore rm` uses) since one typo'd id could otherwise delete many
686
+ plugins at once. Both skip the prompt entirely with `-y`/`--yes`. Deleting is scoped to plugins you
687
+ own server-side - a wrong/other org's id fails with "not found" rather than revealing whether it
688
+ exists.
689
+
690
+ ## `aivin connector`
691
+
692
+ Connectors are reusable OAuth apps / credential-form namespaces, referenced from `manifest.json`'s
693
+ `connection_id` field so multiple plugins can share one set of user-connected credentials instead
694
+ of each prompting for the same login separately. Check for an existing one before registering a
695
+ new namespace:
696
+
697
+ ```bash
698
+ aivin connector search "slack"
699
+ aivin connector list
700
+ ```
701
+
702
+ ```
703
+ Commands:
704
+ register Register a new connector namespace, interactively
705
+ search [options] [query] Search connectors for something to reuse instead of registering a new one
706
+ list [options] List connectors visible to your org
707
+ deprecate [id] Hide a connector you own from search/list without breaking plugins already using it
708
+ undeprecate [id] Make a previously-deprecated connector you own discoverable again
709
+
710
+ Options for search/list:
711
+ --limit <n> Max results to show (search)
712
+ --page <n> Page number (list)
713
+ --include-deprecated Also show your org's deprecated connectors, hidden by default (list)
714
+ --plain Print a flat list instead of the interactive browser - for scripts/CI (both)
715
+ ```
716
+
717
+ `aivin connector register` walks you through naming the namespace and picking the auth shape
718
+ (OAuth vs. a plain credential form) interactively - there's no non-interactive/scripted form, since
719
+ registering real OAuth app credentials isn't something to automate blindly. Once registered, put
720
+ the connector's id in your plugin's `manifest.json` as `connection_id` - see
721
+ [MANIFEST.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#fields) (sdk
722
+ repo).
723
+
724
+ `aivin connector deprecate`/`undeprecate` only affect discoverability (search/list) - they never
725
+ break a plugin that's already using the connector's `connection_id`, so it's safe to deprecate one
726
+ you've replaced without migrating existing plugins first.
727
+
728
+ ## `aivin pluginstore`
729
+
730
+ Manages a **self-hosted `aivin-service` worker** (a Docker container you run yourself) attached to
731
+ your org as a *plugin store* - a piece of infrastructure your org's plugins can run against,
732
+ independent from Aivin's own hosted infra. A store can have multiple *nodes* (multiple machines
733
+ each running their own `aivin-service`, all attached to the same store) for redundancy/scale. This
734
+ is unrelated to the **Plugin Marketplace** (`aivin mcp <url> --publish` and the browser
735
+ CodeEditor's publish flow) - a plugin store is infrastructure you attach, not a place plugins get
736
+ published to.
737
+
738
+ ```
739
+ Commands:
740
+ create [options] [store_id] Create a new plugin store + attach this machine as its first node
741
+ attach [options] [store_id] Attach this machine as another node of an existing plugin store
742
+ ls List plugin stores visible to your org, with online/offline status per node
743
+ enable [store_id] Enable a store for your org (org admin only)
744
+ disable [store_id] Disable a store for your org without deleting it (org admin only)
745
+ rm [options] [store_id] Delete a store - revokes EVERY node attached to it, not just this machine (org admin only)
746
+ detach [options] Remove THIS machine's pairing only (local file only, no BE call)
747
+ ```
748
+
749
+ ```bash
750
+ aivin pluginstore create my-store --label "Production store"
751
+ aivin pluginstore ls
752
+ ```
753
+
754
+ `create`/`attach` both end by writing `worker-identity.json` into a data directory (default
755
+ `~/.aivin/service-data`, override with `--data-dir`) - the machine's actually-running
756
+ `aivin-service` process watches that directory (`fs.watch`) and pairs itself automatically the
757
+ moment the file appears. Neither command needs `aivin-service` to already be running, and neither
758
+ restarts any container - the CLI's job ends at writing the file; pairing itself is the worker's own
759
+ responsibility.
760
+
761
+ ```
762
+ Options (create):
763
+ --label <label> Display label for the store (defaults to store_id)
764
+ --node-label <label> Display label for this node/instance
765
+ --data-dir <path> Where to write worker-identity.json (default: ~/.aivin/service-data)
766
+
767
+ Options (attach):
768
+ --node-label <label> Display label for this node/instance
769
+ --data-dir <path> Where worker-identity.json is written (default: ~/.aivin/service-data)
770
+ ```
771
+
772
+ `aivin pluginstore detach` is the local-only inverse of `attach`/`create`: it deletes
773
+ `worker-identity.json` from this machine (`--data-dir` to point at a non-default location) without
774
+ calling the backend at all - the running `aivin-service` notices the file is gone and un-pairs on
775
+ its own. To actually revoke a node/store server-side (so it can't reattach with an old token), use
776
+ `aivin pluginstore rm` instead - **org admin only**, and destructive: it revokes every node attached
777
+ to the store, not just this machine, hence the `-y`/`--yes` flag to skip the confirmation prompt in
778
+ scripts.
779
+
780
+ `enable`/`disable` don't delete anything - they just toggle whether your org's plugins are allowed
781
+ to route to the store right now, so you can pull a store out of rotation (e.g. for maintenance)
782
+ without losing its configuration or having to re-attach nodes afterward.
783
+
784
+ ## `aivin mcp <url> [--publish|--private|--org]`
785
+
786
+ The one-shot path from "here's an [MCP](https://modelcontextprotocol.io) server" to deployed
787
+ plugin(s) - unlike `aivin mcp create` below (which scaffolds exactly 1 tool/resource/prompt you
788
+ already know the transport/command/name for), this scans a whole server and converts everything it
789
+ finds, interactively:
790
+
791
+ 1. **Scan** (`POST /plugins/scan-mcp`) - `<url>` can be a GitHub/GitLab repo, an npm/Smithery
792
+ package, or a live MCP server URL. Reads the repo/README or handshakes the live server directly.
793
+ Only scan URLs you actually trust - this step connects to (and, for a live handshake, effectively
794
+ runs) whatever's at that address to introspect it, same trust model as installing a dependency
795
+ from source. Bounded to 60s (scanning a live server can legitimately take longer than the other
796
+ steps, which is why this one gets more headroom) so an unresponsive server fails with a clear
797
+ error instead of hanging the CLI indefinitely. The scan response also carries a deterministic
798
+ `repo_id` (derived from the source URL, same convention the backend uses for every discovery
799
+ path so the same server always converges on one id) - right after a successful scan, this is
800
+ used as an exact `plugin search --mcp <repo_id>` lookup, so anything printed here really is from
801
+ this exact server, not a fuzzy text guess. Still informational only - never blocks the flow.
802
+ 2. **Select** - checkbox prompt lists every tool/resource/prompt found (all checked by default);
803
+ space to toggle, enter to continue with only what you actually want as plugins.
804
+ 3. **Build manifests** (`POST /plugins/build-mcp-manifests`, 30s timeout) - one `PluginManifest` per
805
+ selected item, generated server-side (not typed by hand like `aivin mcp create` requires).
806
+ 4. **Edit** (optional) - confirm prompt offers to rename/redescribe any of the generated plugins
807
+ before anything is deployed. A second, separate optional prompt offers to attach one connector
808
+ (existing or newly registered) as every generated manifest's `connection_id` in one go - see
809
+ [`aivin mcp create`](#aivin-mcp-create-name)'s connector section above for what that buys you.
810
+ 5. **Confirm** - since the checkbox in step 2 defaults to everything checked, this step asks for an
811
+ explicit yes ("Deploy N plugin(s) to your org? This can't be undone from the CLI.", default
812
+ **No**) before anything actually goes out. In a non-TTY context (scripts/CI) this step is skipped
813
+ entirely - the same as everywhere else in the CLI, only a real terminal gets a confirmation prompt.
814
+ 6. **Deploy** (`POST /plugins/deploy`, 60s timeout) - always org-scoped first, regardless of the
815
+ visibility flag below (there's no narrower per-workspace scope for plugins today). Prints a
816
+ `group_id` afterward - save it if you might want to remove everything from this run later in one
817
+ shot with [`aivin plugin delete --group <groupId>`](#aivin-plugin-delete-id).
818
+ 7. **Publish** (only with `--publish`, 30s timeout per submission) - submits each deployed plugin for
819
+ community review (`POST /plugins/store/submit`) - the backend re-verifies each one LIVE against
820
+ the real MCP server before it reaches the review queue, not just whatever got deployed (see the
821
+ backend's own `marketplace-catalog.md` docs, §"Tự submit plugin MCP lên store", for the full
822
+ gate). A submission can't be withdrawn from this CLI either once sent.
823
+
824
+ **Blocked, not just warned**: a manifest whose `proxy_config.auth_secret_key` is set is skipped
825
+ entirely at this step (never submitted) instead of being sent as-is. `auth_secret_key` is an
826
+ admin-level credential meant to be shared by everyone *within the org that deployed it* -
827
+ publishing means other orgs can call this same plugin, and there is no confirmed backend step
828
+ that strips or reissues that credential per installing org, so submitting it unchanged would let
829
+ another org's calls silently resolve to (and spend/exhaust/expose) your org's credential. Rebuild
830
+ the plugin with a connector-bound environment variable instead (`aivin mcp create`'s interactive
831
+ auth setup, "one or more environment variables" → bind to a connector) - that path resolves
832
+ credentials per the *calling* org/user, not off the shared manifest, and is safe to publish.
833
+ 8. Prints ready-to-run `aivin plugin trigger --id <id> -a "..."` / `aivin plugin logs <id>` for
834
+ every plugin deployed, and offers to run one right now, interactively - see
835
+ [`aivin test`](#aivin-test) above for why this exists (its automated smoke test skips proxy
836
+ plugins entirely, so this interactive step is currently the *only* built-in way to verify a
837
+ freshly-converted MCP plugin actually works before walking away from the terminal).
838
+
839
+ ```
840
+ Options:
841
+ --publish Deploy to your org, then submit for community store review
842
+ (needs admin approval)
843
+ --private Deploy to your org only - default
844
+ --org Alias of --private - there is no narrower per-workspace scope today
845
+ ```
846
+
847
+ ```bash
848
+ aivin mcp https://github.com/example-org/example-mcp-server
849
+ aivin mcp https://github.com/example-org/example-mcp-server --publish
850
+ ```
851
+
852
+ ## `aivin mcp create <name>`
853
+
854
+ Scaffolds a **manifest-only** plugin (`proxy_config.type: "mcp"`) that proxies straight to an
855
+ external [MCP](https://modelcontextprotocol.io) server's tool/resource/prompt - no `src/main.ts`,
856
+ no `package.json`, nothing to run. `aivin deploy`/`aivin test` detect this automatically.
857
+
858
+ ```
859
+ Options:
860
+ --transport <transport> stdio | sse
861
+ --command <command> Command to launch the MCP server (stdio transport)
862
+ --args <args> Space-separated args for --command (stdio transport)
863
+ --url <url> Remote MCP server URL (sse transport)
864
+ --kind <kind> tool | resource | prompt (default: tool)
865
+ --tool-name <name> MCP tool name (kind=tool)
866
+ --resource-uri <uri> MCP resource URI (kind=resource)
867
+ --resource-mime-type <mime> MIME type of the resource (kind=resource)
868
+ --prompt-name <name> MCP prompt name (kind=prompt)
869
+ --description <description> Plugin description
870
+ --auth-secret-key <key> Name of the workspace secret to use as the
871
+ token/credential, if the MCP server needs auth
872
+ --auth-type <type> auth_type value to send (default: "bearer" when
873
+ --auth-secret-key is set) - check your backend
874
+ for which values it supports
875
+ --connector <id> Existing connector id for this plugin's connection_id
876
+ (readiness/"needs login" display only - see below)
877
+ ```
878
+
879
+ - Fully interactive → run with no flags at all: prompts for everything, in order.
880
+ - Fully flagged → fully non-interactive/scriptable, no prompts. `--transport` and `--kind` are
881
+ inferred from whichever flags you pass (`--command` implies stdio, `--url` implies sse;
882
+ `--tool-name`/`--resource-uri`/`--prompt-name` each imply their own `--kind`) - spell them out
883
+ explicitly only if you're scripting this without any of those (unusual).
884
+ - **Partially flagged, real terminal** → prompts for exactly what's still missing, not everything -
885
+ e.g. `aivin mcp create foo --transport stdio` alone still prompts for `--command` instead of
886
+ failing with a generic validation error.
887
+ - Passing more than one kind-identifying flag at once (e.g. both `--tool-name` and
888
+ `--resource-uri`) without an explicit `--kind` prints a warning and picks one by priority
889
+ (tool → resource → prompt) rather than silently dropping the other with no explanation.
890
+ - Whatever's still missing once prompting is done (or immediately, outside a real terminal) fails
891
+ fast with the exact flag(s) needed, e.g. `Missing required field(s): --command <command>,
892
+ --tool-name <name>`.
893
+
894
+ ```bash
895
+ # stdio (local command)
896
+ aivin mcp create fs-tools --command npx --args "-y @modelcontextprotocol/server-filesystem /data" \
897
+ --tool-name read_file --description "Read files via MCP"
898
+
899
+ # sse (remote server)
900
+ aivin mcp create doc-search --url https://example.com/mcp \
901
+ --tool-name search_docs --description "Search external docs via MCP"
902
+ ```
903
+
904
+ See [MANIFEST.md#mcp-proxy-plugins](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md#mcp-proxy-plugins) for the full `proxy_config`
905
+ field reference.
906
+
907
+ **Auth for a `mcp create` plugin, interactively**: leave `--auth-secret-key` off in a real terminal
908
+ and you're asked "Does this MCP server need auth?" with three choices:
909
+
910
+ - **No auth needed.**
911
+ - **One shared token for everyone** (typical for a remote/sse server) - the classic bearer-token
912
+ case, sent as `proxy_config.auth_secret_key`/`auth_type`. One value, shared by the whole org.
913
+ - **One or more environment variables** (typical for a local/stdio server) - drops into a loop
914
+ ("Variable 1 name:", Enter on blank to stop) where each declared name is either left for **every
915
+ workspace to configure on its own** later (no OAuth - the platform's own "configure this plugin"
916
+ screen collects the value per workspace) or bound to a **connector** (search-as-you-type over
917
+ `aivin connector search`'s same endpoint, list your org's if the query is left blank, or register
918
+ a brand new one right there - same flow as `aivin connector register`, no separate command
919
+ needed) for automatic per-user/per-workspace OAuth resolution.
920
+
921
+ This maps onto `manifest.initable`/`manifest.initial[varName].connection_id` - the fields the
922
+ backend's plugin execution path (`PluginProxyService.resolveMcpEnv`) actually reads to merge
923
+ credentials at call time, in increasing priority: the shared `auth_secret_key` first, then each
924
+ workspace's own configured value, then OAuth auto-fill for any field bound to a connector. This is
925
+ genuinely three tiers merged per call, not three alternatives to choose between - declaring some
926
+ fields as connector-bound and others as "workspace configures it" on the very same plugin is normal
927
+ if the MCP server needs more than one kind of credential.
928
+
929
+ Only declarable interactively - like `aivin connector register`, there's no non-interactive/scripted
930
+ form for the env-var loop (declaring several named fields isn't something to automate blindly).
931
+
932
+ **What `--connector <id>` actually does (and doesn't)**: it sets the manifest's top-level
933
+ `connection_id` directly, without going through the loop above. That field only drives the
934
+ "requires logging in to a connector" readiness badge (see `plugin info`/`plugin search`'s detail
935
+ view) - it is **not** read by the MCP execution path at all, so it injects nothing into the running
936
+ MCP server by itself. If you use the interactive env-var loop and bind a field to a connector, the
937
+ top-level `connection_id` gets set *for* you automatically (derived from whichever connector the
938
+ declared field(s) actually use), for consistency with that badge - you shouldn't normally need
939
+ `--connector` directly unless you're deliberately setting the readiness badge independently of any
940
+ declared env var.
941
+
942
+ `aivin mcp <url>` (below) offers a simpler, single-connector version of this same idea - one prompt
943
+ to attach a connector to every generated manifest at once, right before the final deploy
944
+ confirmation, for when a whole MCP server shares one auth scheme rather than needing individual
945
+ per-tool env-var declarations.
946
+
947
+ ## `aivin login`
948
+
949
+ Saves an API key **once, machine-wide**, to `~/.aivin/credentials` - not the current project's
950
+ `.env`. Logging in is a per-machine thing, not a per-project one, so you only need to run this once
951
+ regardless of how many plugin projects you work in - every project's `deploy`/`test`/`plugin make`
952
+ picks it up automatically.
953
+
954
+ ```
955
+ Options:
956
+ -k, --api-key <key> Set API key directly (skip login entirely)
957
+ --basic Log in with email/password directly in the terminal instead of a browser
958
+ --google Alias of the default browser flow - pick Google once the page opens
959
+ --client <client> Client/org id to use with --basic (default: "aivin.cloud")
960
+ ```
961
+
962
+ **Default (no flags) - browser flow, recommended:**
963
+
964
+ ```bash
965
+ aivin login
966
+ ```
967
+
968
+ Opens your default browser to the platform's actual login page (`https://brain.aivin.cloud`) with
969
+ a one-time state token and a `localhost` callback URL. Log in exactly the way you normally would in the
970
+ browser - custom-domain org, password, Google, OTP, whatever applies to your account. Once you
971
+ confirm on the "Aivin CLI wants to create an API Key" prompt that appears after login, a fresh key
972
+ is minted (named after this machine's hostname, replacing any previous key with that same name) and
973
+ handed back to a tiny local HTTP server the CLI started for this one request, then saved to
974
+ `~/.aivin/credentials`. The browser tab never shows you the raw key - only the CLI does.
975
+
976
+ `--google` doesn't change anything technically; it's just documentation that once the page opens
977
+ you can pick "Log in with Google" there, same as any other login on that page.
978
+
979
+ **`--basic` - no browser, terminal-only:**
980
+
981
+ ```bash
982
+ aivin login --basic
983
+ ```
984
+
985
+ Prompts for email/password directly and logs in against the default/shared client only (`--client`,
986
+ falls back to `"aivin.cloud"`). If your account belongs to a custom-domain organization, this won't
987
+ resolve that domain for you - use the default browser flow instead, which handles it the same way
988
+ the web login page does.
989
+
990
+ **Already have a key:**
991
+
992
+ ```bash
993
+ aivin login --api-key <key>
994
+ ```
995
+
996
+ Skips login entirely - just saves the given key to `~/.aivin/credentials`.
997
+
998
+ ## `aivin whoami`
999
+
1000
+ Shows which account is currently active on this machine - reads `~/.aivin/credentials` straight
1001
+ off disk, **no server call**, so it works offline and never fails due to a network/auth problem
1002
+ (if anything, it's the fastest way to check that a previous `aivin login` actually saved
1003
+ something).
1004
+
1005
+ ```bash
1006
+ aivin whoami
1007
+ ```
1008
+
1009
+ ```
1010
+ ✅ Logged in
1011
+ Email: jane@example.com
1012
+ Name: Jane Doe
1013
+ Org: Acme Inc
1014
+ Server: https://api.aivin.cloud
1015
+ Logged in at: 1/15/2026, 10:30:00 AM
1016
+ ```
1017
+
1018
+ Email/name/org/login-time only exist at all if the currently-effective `API_KEY` is the exact one
1019
+ `aivin login` saved (i.e. `~/.aivin/credentials`, the machine-wide default) - identity is captured
1020
+ once, at login time, and cached alongside the key. If a project's own `.env` overrides `API_KEY`
1021
+ with a different key, `whoami` says so explicitly instead of guessing:
1022
+
1023
+ ```
1024
+ (API_KEY is from this project's .env, not `aivin login` - no recorded identity/login time)
1025
+ ```
1026
+
1027
+ ## `aivin key`
1028
+
1029
+ Manages *named* API keys on your account - separate from the one machine-wide key `aivin login`
1030
+ saves. Useful for giving a CI pipeline, a teammate's script, or any other caller its own key you can
1031
+ revoke independently later.
1032
+
1033
+ ```
1034
+ Commands:
1035
+ gen [options] <name> Create (or replace) a named API key for your account - shown only once
1036
+ revoke [options] <name> Revoke a named API key for your account
1037
+ list [options] List API keys on your account
1038
+ ```
1039
+
1040
+ ```bash
1041
+ aivin key gen "ci-pipeline" # prompts for your account password, prints the new key once
1042
+ aivin key gen "ci-pipeline" --save # also saves it to ~/.aivin/credentials as this machine's default
1043
+ aivin key list # see what's on your account
1044
+ aivin key revoke "ci-pipeline" # revoke it by name
1045
+ ```
1046
+
1047
+ All three authenticate with the `API_KEY` `aivin login` already saved - no email/password prompt for
1048
+ `list`/`revoke`. `gen` is the exception: it still asks for your **account password** (not email) as
1049
+ a step-up check, since minting a new key from an existing one is the one action here that could
1050
+ otherwise let an already-leaked key re-provision itself indefinitely even after you revoke it.
1051
+ `list`/`revoke` only read or remove access, never grant it, so they need no such check.
1052
+
1053
+ `aivin key gen` replaces (not accumulates) any existing key with the same name, the same way
1054
+ re-running `aivin login` replaces this machine's own key.
1055
+
1056
+ ## `aivin browser [mission]`
1057
+
1058
+ Runs an **AI Browser** mission - a multi-step, self-correcting agent that drives an actual browser
1059
+ (not this plugin's code) to complete a goal. Two modes, picked by `--remote`:
1060
+
1061
+ ```
1062
+ Options:
1063
+ --remote Use a server-side pooled browser instead of your own local one (no
1064
+ local browser needed, no cookies/logins carried over)
1065
+ --debug-port <port> Local mode only: port to look for/launch your browser's remote
1066
+ debugging on (default: 9222, auto-tries a few nearby ports if that
1067
+ one is taken by something else)
1068
+ --browser <edge|chrome> Local mode only: which browser to drive - default: auto-detects your
1069
+ OS's actual default browser, falling back to whichever of Edge/Chrome
1070
+ is installed
1071
+ --url <url> Local mode only: open this URL before the mission starts, instead of a
1072
+ blank page (auto-guessed for a few well-known sites mentioned by name
1073
+ in the mission if omitted)
1074
+ --workspace <id> Workspace id to run in (default: your personal workspace)
1075
+ --project <id> Project id within the workspace (--remote only)
1076
+ --agent <id> Agent id to run as (default: an auto-created/cached agent for local
1077
+ mode, or the workspace's default agent for --remote)
1078
+ --no-watch Fire the mission and return immediately - skip streaming live
1079
+ progress and auto-opening the viewer
1080
+ --view Just (re)open the fullscreen interactive viewer for whatever HIL
1081
+ session is already active - no mission is started
1082
+ ```
1083
+
1084
+ **Local mode (default)** - drives your own, already-running browser via its remote-debugging
1085
+ protocol (CDP). Uses a dedicated Chrome/Edge profile (`~/.aivin/browser-profile`), not your regular
1086
+ daily-driver profile - real cookies/logins persist there across runs, but the first time you use a
1087
+ given site you'll need to log in once, same as opening it in a fresh browser. If nothing's
1088
+ listening on the debug port yet, `aivin browser` prints the exact launch command for your OS/browser
1089
+ instead of failing silently:
1090
+
1091
+ ```bash
1092
+ aivin browser "Find the top 3 posts on Hacker News right now and summarize them"
1093
+ ```
1094
+
1095
+ A live viewer window opens automatically once the mission needs human input (HIL) or, by default,
1096
+ as soon as it starts - `--no-watch` skips this and just prints progress to the terminal instead.
1097
+
1098
+ **Remote mode (`--remote`)** - runs on a server-side pooled browser instead, no local browser
1099
+ required, no cookies from your machine carried over. Useful for CI, headless environments, or
1100
+ missions that don't need a logged-in session on a specific real account.
1101
+
1102
+ ```bash
1103
+ aivin browser --remote "Check the current price of BTC on coinmarketcap.com"
1104
+ ```
1105
+
1106
+ `aivin browser --view` alone (no mission) reopens the interactive viewer for whatever HIL session
1107
+ is already active, without starting anything new - handy if you closed the auto-opened window by
1108
+ accident.
1109
+
1110
+ ## `aivin remote` — let your agents work on this computer (Device Agent)
1111
+
1112
+ Turns this computer into a device your Aivin agents can hand jobs to (`official.device_agent`): run commands, read/search/edit
1113
+ files, inspect projects and the system — only inside the folder you allow.
1114
+
1115
+ ```bash
1116
+ aivin remote start --dir D:\code # first run pairs this computer (device token), then listens for work
1117
+ aivin remote do "run the tests of the be project and summarize failures"
1118
+ aivin remote devices # your paired computers + online state
1119
+ aivin remote pause | resume # local kill switch - refuses every remote call while paused
1120
+ aivin remote unpair [deviceId] # revoke (token stops working immediately)
1121
+ aivin remote memory list|search|add|forget|clear # on-device memory, plain YAML in ~/.aivin/memory/
1122
+ aivin remote status | test | logs | reindex | enable | disable | reset-id
1123
+ ```
1124
+
1125
+ - **Device token, not your API key**: pairing (`POST /plugins/device-agent/devices/pair`) gives this machine its own token
1126
+ (`~/.aivin/device-credentials.json`, the server only keeps a hash). Revoking a device never touches your API key.
1127
+ - **Tools per device**: discovered from what is installed (git, ripgrep, node, python, docker…) — `aivin remote status` lists them.
1128
+ - **Permissions come from the agent's own rules** (autonomous decisions / needs approval / must not): every step that changes
1129
+ something goes through the platform policy gate and may ask you to approve. This computer keeps a hard floor the server cannot
1130
+ change: allowed folder (checked with realpath, symlinks can't escape), secrets stripped from command environments, a safety net
1131
+ against system-destroying commands, and the kill switch.
1132
+ - **Memory stays on this computer**: `~/.aivin/memory/<kind>.yaml` (edit by hand if you like) + `vectors.json`; the agent recalls it
1133
+ before planning and saves procedures that worked.
1134
+ - Env: `AIVIN_REMOTE_HOME` (config folder), `AIVIN_REMOTE_LIMIT_<GROUP>` (parallel limit per tool group: fs_read, fs_write, exec, git, system, memory).
1135
+ - **Stays up to date by itself**: the listener checks for a new release about every 6 hours (and right away when the Aivin server
1136
+ asks for a newer minimum version). When started with the computer (`aivin remote enable`), it switches to the new release once the
1137
+ computer has had no remote work for 10 minutes; in a window you started yourself it only tells you to restart. If the new release
1138
+ crashes 3 times before it has run for 10 minutes, the previous release is put back and the bad one is skipped. See `aivin update`.
1139
+
1140
+ ## `aivin update`
1141
+
1142
+ Updates the standalone `aivin` (installed with `install.ps1` / `install.sh`) from the same download site as the installer:
1143
+ reads `latest.txt`, checks the release's Ed25519 signature (`SHA256SUMS.sig`, verified against the release keys built into aivin -
1144
+ an unsigned or wrongly signed release is refused before its build is even downloaded), downloads that release's build for this
1145
+ computer, checks it against the signed `SHA256SUMS`, makes sure the new build starts (`--version`, run without your API key or tokens
1146
+ in its environment), then replaces the installed file. The previous file is kept as `aivin.prev` / `aivin.exe.prev` until the new one
1147
+ has run fine.
1148
+
1149
+ ```bash
1150
+ aivin update # install the latest release
1151
+ aivin update --check # only tell whether a newer release exists
1152
+ aivin update --to v1.0.8 # install a specific release (also goes back)
1153
+ aivin update --auto off # stop background updates of `aivin remote start` on this computer (on: turn them back on)
1154
+ ```
1155
+
1156
+ - npm installs are not replaced; you get the `npm i -g @aivin-labs/cli@latest` command instead.
1157
+ - The download site comes only from this computer's environment, never from the Aivin server or a file: `AIVIN_DOWNLOAD_ROOT`
1158
+ (e.g. an internal mirror - it does not need to be trusted, the signature still is checked), else `https://get.aivin.vn`. Only
1159
+ `https` is accepted (plain `http` only to this computer itself), redirects included.
1160
+ - Releases can be rolled out to a share of running computers first (`rollout.json` on the download site); `aivin update` run by
1161
+ hand ignores that.
1162
+ - Turn background updates off for one run with `aivin remote start --no-auto-update`, or with `AIVIN_AUTO_UPDATE=0`.
1163
+
1164
+ ## `aivin do <agent_nickname> <mission>`
1165
+
1166
+ Has a specific agent start a background mission toward a free-text goal (`POST /agent/start-work`),
1167
+ not a specific deployed plugin. The agent runs the mission on its own, checking in via the
1168
+ progress stream (see below); this is the CLI-native equivalent of typing into the platform's chat
1169
+ and choosing which AI Staff agent should handle it.
1170
+
1171
+ ```
1172
+ Options:
1173
+ --workspace <id> Workspace id to run in (default: your personal workspace)
1174
+ --project <id> Project id within the workspace
1175
+ --no-watch Fire the mission and return immediately - skip streaming live progress
1176
+ ```
1177
+
1178
+ ```bash
1179
+ aivin do supportbot "Summarize today's support tickets and post the summary to #digest"
1180
+ ```
1181
+
1182
+ - `<agent_nickname>` is matched against the resolved workspace's already-installed agents (by
1183
+ nickname, name, or id). Omit either argument and you'll be prompted interactively - the mission
1184
+ prompt if only the agent is given, or a picker over the workspace's agents if only the mission is
1185
+ given (in a non-interactive shell, both are required up front).
1186
+ - If the nickname doesn't match anything in the workspace, or the workspace has no agents at all
1187
+ yet, you're offered a choice: search & install one from the marketplace, or create a brand new
1188
+ one - so `aivin do` never dead-ends on an empty workspace (see `aivin agent install`/`aivin agent
1189
+ make` below, which this reuses).
1190
+
1191
+ By default it then streams the mission's live progress in the terminal (same realtime channel
1192
+ `aivin plugin logs` uses under the hood) until the run finishes or you press Ctrl+C - pass
1193
+ `--no-watch` to just fire it and return immediately instead.
1194
+
1195
+ If `--workspace` is omitted, it runs in your **personal workspace** (the platform always resolves
1196
+ that first when no workspace is given).
1197
+
1198
+ ### `aivin do job <description>`
1199
+
1200
+ Creates a new **automation job** - recurring background work on a cron-style schedule, independent
1201
+ of any single chat/mission invocation (`POST /automation/jobs/create`).
1202
+
1203
+ ```
1204
+ Options:
1205
+ --workspace <id> Workspace id to create the job in (default: your personal workspace)
1206
+ --project <id> Project id within the workspace
1207
+ --agent <id> Agent id the job runs as (default: the workspace's default agent)
1208
+ --schedule <condition> Natural-language schedule, e.g. "every Monday at 9am" (default: let the
1209
+ platform infer one)
1210
+ ```
1211
+
1212
+ ```bash
1213
+ aivin do job "Compile last week's support tickets into a summary and post it to #digest"
1214
+ aivin do job "Send a daily standup reminder" --schedule "every weekday at 9am"
1215
+ ```
1216
+
1217
+ If `--schedule` is omitted, the platform infers a cadence (or falls back to manual) from the
1218
+ description itself - pass it explicitly if you already know the cadence, to skip the extra
1219
+ inference call.
1220
+
1221
+ ## `aivin task [description]`
1222
+
1223
+ Creates a new task (`POST /task/create`) from a plain-language description - the description
1224
+ becomes both the task's title (truncated if long) and its full content.
1225
+
1226
+ ```
1227
+ Options:
1228
+ --workspace <id> Workspace id to create the task in (default: your personal workspace)
1229
+ --project <id> Project id within the workspace
1230
+ --assignee <userId> User id to assign the task to (default: unassigned)
1231
+ ```
1232
+
1233
+ ```bash
1234
+ aivin task "Follow up with the customer about their refund request"
1235
+ ```
1236
+
1237
+ `aivin task` also has subcommands for the rest of the task lifecycle:
1238
+
1239
+ ```
1240
+ Commands:
1241
+ list [options] List tasks in a project
1242
+ mine [options] List tasks assigned to you in a project
1243
+ get [id] Get a task by id
1244
+ update [options] [id] Update a task
1245
+ delete [id] Delete a task
1246
+ ```
1247
+
1248
+ ```bash
1249
+ aivin task list --status todo # list open tasks in your first project
1250
+ aivin task list --project <id> --assignee <userId> # filter by project/assignee
1251
+ aivin task mine # tasks assigned to you
1252
+ aivin task get <id> # full task details (JSON)
1253
+ aivin task update <id> --status done # move a task to done
1254
+ aivin task update <id> --title "New title" --priority high
1255
+ aivin task delete <id>
1256
+ ```
1257
+
1258
+ `list`/`mine` are scoped to a single project (the backend's real `/task/:projectId/list` route) -
1259
+ `--project` defaults to the resolved workspace's first project, and throws if it has none (a
1260
+ Personal workspace typically has no projects; pass `--project <id>` explicitly, or run
1261
+ `aivin workspace` to find one).
1262
+
1263
+ ## `aivin workspace`
1264
+
1265
+ Interactive picker: lists your workspaces (personal workspace first), lets you select one, then
1266
+ lists that workspace's projects so you can pick the corresponding one - printing the resolved
1267
+ `--workspace`/`--project` ids to pass to `aivin do`/`do job`/`task`.
1268
+
1269
+ ```
1270
+ Options:
1271
+ --plain Print a flat list instead of the interactive picker (for scripts/CI)
1272
+ ```
1273
+
1274
+ ```bash
1275
+ aivin workspace
1276
+ ```
1277
+
1278
+ Non-TTY contexts (scripts, CI, piped output) or `--plain` print a flat listing instead of the
1279
+ interactive prompts.
1280
+
1281
+ ## `aivin agent`
1282
+
1283
+ Search the AI Staff marketplace, install an agent into a workspace, create a brand new one, or
1284
+ publish one you own. `aivin do` calls into the same install/create flows automatically when it
1285
+ can't resolve `<agent_nickname>`.
1286
+
1287
+ ```
1288
+ Commands:
1289
+ search [options] [query] Search the AI Staff marketplace for an agent
1290
+ install [options] [query] Search the marketplace and install an agent into a workspace
1291
+ make [options] Create a brand new AI Staff agent
1292
+ publish [options] [agentId] Publish an agent you own to the marketplace
1293
+ ```
1294
+
1295
+ ```bash
1296
+ aivin agent search "customer support" # browse the marketplace
1297
+ aivin agent install "customer support" # search + pick + install into your personal workspace
1298
+ aivin agent install --workspace <id> # no query - opens the same interactive picker `aivin do` uses
1299
+ aivin agent make --name "Ada" --nickname ada --email ada@example.com --bio "Support triage bot"
1300
+ aivin agent publish <agentId> # make an agent you own visible in the marketplace
1301
+ ```
1302
+
1303
+ - `install`/`make` default to your personal workspace when `--workspace` is omitted.
1304
+ - `make` calls `POST /ai-staff/create`; passing the target workspace at creation time auto-installs
1305
+ the new agent there too (no separate `install` call needed).
1306
+ - `publish` is a two-step platform operation under the hood (`POST /ai-staff/update` with
1307
+ `is_published: true`, then `POST /ai-staff/push` to promote the workspace's local copy to the
1308
+ shared master) - both scoped to the workspace the agent actually lives/was authored in.
1309
+
1310
+ ## `aivin project`
1311
+
1312
+ Create, rename, or delete a project within a workspace (the backend has no separate "list projects"
1313
+ endpoint - use `aivin workspace` to browse a workspace's existing projects).
1314
+
1315
+ ```
1316
+ Commands:
1317
+ create [options] [name] Create a new project in a workspace
1318
+ update [options] [id] Update a project (currently: rename)
1319
+ delete [options] [id] Delete a project
1320
+ ```
1321
+
1322
+ ```bash
1323
+ aivin project create "Q3 Launch"
1324
+ aivin project update <id> --name "Q3 Launch (renamed)"
1325
+ aivin project delete <id>
1326
+ ```
1327
+
1328
+ All three default to your personal workspace when `--workspace` is omitted.
1329
+
1330
+ ## Environment variables
1331
+
1332
+ `aivin login` saves your key once to `~/.aivin/credentials` and every plugin project on the
1333
+ machine picks it up automatically - there's no per-project credential to manage.
1334
+
1335
+ | Variable | Used by | Default | When you'd touch it |
1336
+ | -------------------- | -------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- |
1337
+ | `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` | Point `main()`'s SDK calls at a local/dev/staging backend instead of production. Staging: `beta-sdk.aivin.vn:50052` (dedicated Cloudflare Tunnel TLS port - production goes through a load balancer on the standard 443 port instead, a different setup). |
1338
+ | `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` | Only for a self-hosted or staging instance. Staging: `https://beta-api.aivin.vn`. |
1339
+ | `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` | Only for a self-hosted or staging instance. |
1340
+ | `LOCAL_TEST_PORT` | `aivin start` | `4001` | Only if `4001` is already taken on your machine. |
1341
+ | `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` | Loopback-only by default (`/invoke` has no auth) - only widen this if you deliberately want another device on your network to reach it. See [sdk repo's SECURITY.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SECURITY.md). |
1342
+ | `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` | Set `true` to run `src/main.ts` inside an isolated `worker_threads.Worker` (no direct access to the container's secret, restricted fs/child_process) instead of loading it in-process. Off by default - see [sdk repo's worker-sandbox.md](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/draft/plugins/worker-sandbox.md). |
1343
+
1344
+ Everything else (`SDK_SECRET`, `SDK_GRPC_SERVER_BIND`, `SDK_GRPC_TLS`, `NODE_ENV`, ...) is
1345
+ either injected automatically inside a deployed container or has a working zero-config default -
1346
+ not something you're expected to set by hand.
1347
+
1348
+ ## See also
1349
+
1350
+ - [GETTING_STARTED.md](./GETTING_STARTED.md) - the narrative walkthrough these commands fit into
1351
+ - [MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md) - every `manifest.json` field, including MCP proxy plugins
1352
+ - [PLUGIN_DEVELOPMENT_GUIDE.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/PLUGIN_DEVELOPMENT_GUIDE.md) - writing and testing a handler
1353
+ - [SDK.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/SDK.md) - everything the SDK exposes inside `main()`