@aivin-labs/cli 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/CLI.md CHANGED
@@ -241,23 +241,40 @@ input from `manifest.json`'s `input` schema (`POST /code/generate-sample-data`),
241
241
  for real (`POST /plugins/execute`) against a workspace, and writes a pass/fail report to
242
242
  `.test/<timestamp>.json` in the project directory (also excluded from future deploy uploads).
243
243
 
244
- **MCP proxy entries are skipped** - there's no generic "sample input" that makes sense for a tool
245
- schema an external MCP server defines itself, so `aivin test` deploys them but runs no automated
246
- invoke/report. Use `aivin plugin trigger --id <pluginId> -a "<prompt>"` (or the interactive "Test
247
- now?" step `aivin mcp <url>` offers right after deploy) to test one by hand instead.
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.
248
249
 
249
250
  ```
250
251
  Options:
251
252
  --workspace <id> Workspace id to run the smoke test against (default: auto-picks your first one)
252
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
253
257
  ```
254
258
 
255
259
  ```bash
256
260
  aivin test # deploy + smoke-test + report
257
261
  aivin test --workspace <id> # smoke-test against a specific workspace
258
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
259
264
  ```
260
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
+
261
278
  ## `aivin plugin make <description>`
262
279
 
263
280
  AI-generates a plugin from a natural-language description, via `POST /code/generate-project` -
@@ -418,19 +435,88 @@ Options:
418
435
 
419
436
  ```
420
437
  Options:
421
- --workspace <id> Restrict to plugins visible in this workspace (default: your whole org)
422
- --limit <n> Max results to show
423
- --plain Print a flat list instead of the interactive browser (for scripts/CI)
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)
424
443
  ```
425
444
 
426
445
  In a real terminal, results open in an interactive browser: `↑`/`↓` to move between matches,
427
- `space`/`enter` to open a plugin's detail view (full description, version, input/output schema),
428
- `esc`/`backspace` to go back to the list, `q` to quit. Non-TTY contexts (scripts, CI, piped
429
- output) or `--plain` fall back to a flat printed list.
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.
430
449
 
431
450
  Call one from your own plugin with `import { call } from '@aivin-labs/sdk'` then
432
451
  `await call('<plugin_id>', params)`.
433
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
+ --save Write this run's result to .test/trigger/<ts>.json
512
+ --compare <file> Diff this run against a previously --save'd file
513
+ ```
514
+
515
+ If the auto-pick looks wrong, check the printed runner-up(s) and fall back to the manual flow -
516
+ `aivin plugin search "<mission>"` to browse candidates yourself, then
517
+ `aivin plugin trigger --id <chosen-id> -a "<mission>"` to run that specific one instead. `ask`
518
+ throws (no plugin executed) if the search comes back empty, rather than guessing.
519
+
434
520
  ## `aivin plugin trigger [mission] [input]`
435
521
 
436
522
  Invokes an **already-deployed** plugin for real and prints the result - the same
@@ -550,6 +636,32 @@ Prints each line as it's written (`console.log` → gray, `console.error` → re
550
636
  timestamp. Runs until you press Ctrl+C. If the container restarts (redeploy/crash) mid-stream,
551
637
  the connection ends - re-run the command to resume watching.
552
638
 
639
+ ## `aivin plugin delete [id]`
640
+
641
+ Deletes a plugin you own - `DELETE /plugins/store/:pluginId` for a single one, or
642
+ `--group <groupId>` for every plugin created by one batch deploy at once (`DELETE
643
+ /plugins/group/:groupId`) - e.g. everything `aivin mcp <url>` generated in a single run, which
644
+ prints its `group_id` right after deploying specifically so you can pass it here later. Neither can
645
+ be undone.
646
+
647
+ ```
648
+ Options:
649
+ --group <groupId> Delete every plugin sharing this group_id instead of a single plugin by id
650
+ -y, --yes Skip the confirmation prompt (for scripts/CI)
651
+ ```
652
+
653
+ ```bash
654
+ aivin plugin delete my-plugin-id
655
+ aivin plugin delete --group 66f2a1... # everything from one `mcp <url>` run
656
+ aivin plugin delete --group 66f2a1... --yes # skip the prompt, for scripts
657
+ ```
658
+
659
+ Single delete asks a plain yes/no confirmation. `--group` asks you to **type the group id back** to
660
+ confirm (same pattern `aivin pluginstore rm` uses) since one typo'd id could otherwise delete many
661
+ plugins at once. Both skip the prompt entirely with `-y`/`--yes`. Deleting is scoped to plugins you
662
+ own server-side - a wrong/other org's id fails with "not found" rather than revealing whether it
663
+ exists.
664
+
553
665
  ## `aivin connector`
554
666
 
555
667
  Connectors are reusable OAuth apps / credential-form namespaces, referenced from `manifest.json`'s
@@ -653,22 +765,51 @@ finds, interactively:
653
765
 
654
766
  1. **Scan** (`POST /plugins/scan-mcp`) - `<url>` can be a GitHub/GitLab repo, an npm/Smithery
655
767
  package, or a live MCP server URL. Reads the repo/README or handshakes the live server directly.
768
+ Only scan URLs you actually trust - this step connects to (and, for a live handshake, effectively
769
+ runs) whatever's at that address to introspect it, same trust model as installing a dependency
770
+ from source. Bounded to 60s (scanning a live server can legitimately take longer than the other
771
+ steps, which is why this one gets more headroom) so an unresponsive server fails with a clear
772
+ error instead of hanging the CLI indefinitely. The scan response also carries a deterministic
773
+ `repo_id` (derived from the source URL, same convention the backend uses for every discovery
774
+ path so the same server always converges on one id) - right after a successful scan, this is
775
+ used as an exact `plugin search --mcp <repo_id>` lookup, so anything printed here really is from
776
+ this exact server, not a fuzzy text guess. Still informational only - never blocks the flow.
656
777
  2. **Select** - checkbox prompt lists every tool/resource/prompt found (all checked by default);
657
778
  space to toggle, enter to continue with only what you actually want as plugins.
658
- 3. **Build manifests** (`POST /plugins/build-mcp-manifests`) - one `PluginManifest` per selected
659
- item, generated server-side (not typed by hand like `aivin mcp create` requires).
779
+ 3. **Build manifests** (`POST /plugins/build-mcp-manifests`, 30s timeout) - one `PluginManifest` per
780
+ selected item, generated server-side (not typed by hand like `aivin mcp create` requires).
660
781
  4. **Edit** (optional) - confirm prompt offers to rename/redescribe any of the generated plugins
661
- before anything is deployed.
662
- 5. **Deploy** (`POST /plugins/deploy`) - always org-scoped first, regardless of the visibility flag
663
- below (there's no narrower per-workspace scope for plugins today).
664
- 6. **Publish** (only with `--publish`) - submits each deployed plugin for community review
665
- (`POST /plugins/store/submit`) - the backend re-verifies each one LIVE against the real MCP
666
- server before it reaches the review queue, not just whatever got deployed (see the backend's own
667
- `marketplace-catalog.md` docs, §"Tự submit plugin MCP lên store", for the full gate).
668
- 7. Prints ready-to-run `aivin plugin trigger --id <id> -a "..."` / `aivin plugin logs <id>` for
782
+ before anything is deployed. A second, separate optional prompt offers to attach one connector
783
+ (existing or newly registered) as every generated manifest's `connection_id` in one go - see
784
+ [`aivin mcp create`](#aivin-mcp-create-name)'s connector section above for what that buys you.
785
+ 5. **Confirm** - since the checkbox in step 2 defaults to everything checked, this step asks for an
786
+ explicit yes ("Deploy N plugin(s) to your org? This can't be undone from the CLI.", default
787
+ **No**) before anything actually goes out. In a non-TTY context (scripts/CI) this step is skipped
788
+ entirely - the same as everywhere else in the CLI, only a real terminal gets a confirmation prompt.
789
+ 6. **Deploy** (`POST /plugins/deploy`, 60s timeout) - always org-scoped first, regardless of the
790
+ visibility flag below (there's no narrower per-workspace scope for plugins today). Prints a
791
+ `group_id` afterward - save it if you might want to remove everything from this run later in one
792
+ shot with [`aivin plugin delete --group <groupId>`](#aivin-plugin-delete-id).
793
+ 7. **Publish** (only with `--publish`, 30s timeout per submission) - submits each deployed plugin for
794
+ community review (`POST /plugins/store/submit`) - the backend re-verifies each one LIVE against
795
+ the real MCP server before it reaches the review queue, not just whatever got deployed (see the
796
+ backend's own `marketplace-catalog.md` docs, §"Tự submit plugin MCP lên store", for the full
797
+ gate). A submission can't be withdrawn from this CLI either once sent.
798
+
799
+ **Blocked, not just warned**: a manifest whose `proxy_config.auth_secret_key` is set is skipped
800
+ entirely at this step (never submitted) instead of being sent as-is. `auth_secret_key` is an
801
+ admin-level credential meant to be shared by everyone *within the org that deployed it* -
802
+ publishing means other orgs can call this same plugin, and there is no confirmed backend step
803
+ that strips or reissues that credential per installing org, so submitting it unchanged would let
804
+ another org's calls silently resolve to (and spend/exhaust/expose) your org's credential. Rebuild
805
+ the plugin with a connector-bound environment variable instead (`aivin mcp create`'s interactive
806
+ auth setup, "one or more environment variables" → bind to a connector) - that path resolves
807
+ credentials per the *calling* org/user, not off the shared manifest, and is safe to publish.
808
+ 8. Prints ready-to-run `aivin plugin trigger --id <id> -a "..."` / `aivin plugin logs <id>` for
669
809
  every plugin deployed, and offers to run one right now, interactively - see
670
810
  [`aivin test`](#aivin-test) above for why this exists (its automated smoke test skips proxy
671
- plugins entirely).
811
+ plugins entirely, so this interactive step is currently the *only* built-in way to verify a
812
+ freshly-converted MCP plugin actually works before walking away from the terminal).
672
813
 
673
814
  ```
674
815
  Options:
@@ -701,15 +842,29 @@ Options:
701
842
  --resource-mime-type <mime> MIME type of the resource (kind=resource)
702
843
  --prompt-name <name> MCP prompt name (kind=prompt)
703
844
  --description <description> Plugin description
704
- --auth-secret-key <key> Name of the workspace secret to use as the Bearer
705
- token, if the MCP server needs auth
845
+ --auth-secret-key <key> Name of the workspace secret to use as the
846
+ token/credential, if the MCP server needs auth
847
+ --auth-type <type> auth_type value to send (default: "bearer" when
848
+ --auth-secret-key is set) - check your backend
849
+ for which values it supports
850
+ --connector <id> Existing connector id for this plugin's connection_id
851
+ (readiness/"needs login" display only - see below)
706
852
  ```
707
853
 
708
- - No `--command`/`--url` → interactive prompts for everything.
709
- - `--command`/`--url` given → fully non-interactive/scriptable. `--transport` and `--kind` are
854
+ - Fully interactive → run with no flags at all: prompts for everything, in order.
855
+ - Fully flagged → fully non-interactive/scriptable, no prompts. `--transport` and `--kind` are
710
856
  inferred from whichever flags you pass (`--command` implies stdio, `--url` implies sse;
711
857
  `--tool-name`/`--resource-uri`/`--prompt-name` each imply their own `--kind`) - spell them out
712
858
  explicitly only if you're scripting this without any of those (unusual).
859
+ - **Partially flagged, real terminal** → prompts for exactly what's still missing, not everything -
860
+ e.g. `aivin mcp create foo --transport stdio` alone still prompts for `--command` instead of
861
+ failing with a generic validation error.
862
+ - Passing more than one kind-identifying flag at once (e.g. both `--tool-name` and
863
+ `--resource-uri`) without an explicit `--kind` prints a warning and picks one by priority
864
+ (tool → resource → prompt) rather than silently dropping the other with no explanation.
865
+ - Whatever's still missing once prompting is done (or immediately, outside a real terminal) fails
866
+ fast with the exact flag(s) needed, e.g. `Missing required field(s): --command <command>,
867
+ --tool-name <name>`.
713
868
 
714
869
  ```bash
715
870
  # stdio (local command)
@@ -724,6 +879,46 @@ aivin mcp create doc-search --url https://example.com/mcp \
724
879
  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`
725
880
  field reference.
726
881
 
882
+ **Auth for a `mcp create` plugin, interactively**: leave `--auth-secret-key` off in a real terminal
883
+ and you're asked "Does this MCP server need auth?" with three choices:
884
+
885
+ - **No auth needed.**
886
+ - **One shared token for everyone** (typical for a remote/sse server) - the classic bearer-token
887
+ case, sent as `proxy_config.auth_secret_key`/`auth_type`. One value, shared by the whole org.
888
+ - **One or more environment variables** (typical for a local/stdio server) - drops into a loop
889
+ ("Variable 1 name:", Enter on blank to stop) where each declared name is either left for **every
890
+ workspace to configure on its own** later (no OAuth - the platform's own "configure this plugin"
891
+ screen collects the value per workspace) or bound to a **connector** (search-as-you-type over
892
+ `aivin connector search`'s same endpoint, list your org's if the query is left blank, or register
893
+ a brand new one right there - same flow as `aivin connector register`, no separate command
894
+ needed) for automatic per-user/per-workspace OAuth resolution.
895
+
896
+ This maps onto `manifest.initable`/`manifest.initial[varName].connection_id` - the fields the
897
+ backend's plugin execution path (`PluginProxyService.resolveMcpEnv`) actually reads to merge
898
+ credentials at call time, in increasing priority: the shared `auth_secret_key` first, then each
899
+ workspace's own configured value, then OAuth auto-fill for any field bound to a connector. This is
900
+ genuinely three tiers merged per call, not three alternatives to choose between - declaring some
901
+ fields as connector-bound and others as "workspace configures it" on the very same plugin is normal
902
+ if the MCP server needs more than one kind of credential.
903
+
904
+ Only declarable interactively - like `aivin connector register`, there's no non-interactive/scripted
905
+ form for the env-var loop (declaring several named fields isn't something to automate blindly).
906
+
907
+ **What `--connector <id>` actually does (and doesn't)**: it sets the manifest's top-level
908
+ `connection_id` directly, without going through the loop above. That field only drives the
909
+ "requires logging in to a connector" readiness badge (see `plugin info`/`plugin search`'s detail
910
+ view) - it is **not** read by the MCP execution path at all, so it injects nothing into the running
911
+ MCP server by itself. If you use the interactive env-var loop and bind a field to a connector, the
912
+ top-level `connection_id` gets set *for* you automatically (derived from whichever connector the
913
+ declared field(s) actually use), for consistency with that badge - you shouldn't normally need
914
+ `--connector` directly unless you're deliberately setting the readiness badge independently of any
915
+ declared env var.
916
+
917
+ `aivin mcp <url>` (below) offers a simpler, single-connector version of this same idea - one prompt
918
+ to attach a connector to every generated manifest at once, right before the final deploy
919
+ confirmation, for when a whole MCP server shares one auth scheme rather than needing individual
920
+ per-tool env-var declarations.
921
+
727
922
  ## `aivin login`
728
923
 
729
924
  Saves an API key **once, machine-wide**, to `~/.aivin/credentials` - not the current project's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aivin-labs/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "aivin CLI - scaffold, run, and deploy Aivin plugins built on @aivin-labs/sdk",
5
5
  "type": "module",
6
6
  "bin": {