@aivin-labs/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -0
- package/bin/assets/aivin-icon.png +0 -0
- package/bin/cli.mjs +1256 -0
- package/bin/lib/auth.mjs +355 -0
- package/bin/lib/browserAutomation.mjs +575 -0
- package/bin/lib/codegen.mjs +858 -0
- package/bin/lib/connectors.mjs +217 -0
- package/bin/lib/context.mjs +149 -0
- package/bin/lib/deploy.mjs +350 -0
- package/bin/lib/mcpProxy.mjs +380 -0
- package/bin/lib/mission.mjs +68 -0
- package/bin/lib/missionStream.mjs +656 -0
- package/bin/lib/pluginTrigger.mjs +535 -0
- package/bin/lib/scaffold.mjs +653 -0
- package/bin/lib/store.mjs +204 -0
- package/bin/lib/tasks.mjs +345 -0
- package/bin/lib/util.mjs +40 -0
- package/bin/lib/workspace.mjs +280 -0
- package/docs/CHANGELOG.md +8 -0
- package/docs/CLI.md +1079 -0
- package/docs/GETTING_STARTED.md +234 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# @aivin-labs/cli
|
|
2
|
+
|
|
3
|
+
Building an AI agent that does real work — one that calls an LLM, reasons over your data, uses
|
|
4
|
+
tools, and knows when to hand a decision back to a human — usually means weeks of infrastructure
|
|
5
|
+
before you write a single line of business logic: a service to host it, an SDK to wire the model
|
|
6
|
+
calls, auth, queues, logging, a deploy pipeline. [Aivin](https://aivin.cloud) exists to collapse
|
|
7
|
+
that. Describe what you want built, and get back a real, typed, callable, observable service in
|
|
8
|
+
minutes — not sprints.
|
|
9
|
+
|
|
10
|
+
`@aivin-labs/cli` is your entry point into that platform, and your main tool for working inside
|
|
11
|
+
the Aivin ecosystem day to day. Instead of hand-rolling a service, you run `aivin init`, describe
|
|
12
|
+
what the plugin should do, and get a real, deployable TypeScript project — hot-reloading local dev
|
|
13
|
+
server, typed input/output, and a one-command path to production included. Everything after that —
|
|
14
|
+
testing, logs, connectors, MCP integrations, agents, automation — is one more `aivin` command
|
|
15
|
+
away, so you can build agentic applications that plug straight into the platform without ever
|
|
16
|
+
leaving your terminal or editor.
|
|
17
|
+
|
|
18
|
+
This package is the interactive tooling only; the plugin runtime library your generated code
|
|
19
|
+
actually imports at runtime is
|
|
20
|
+
[`@aivin-labs/sdk`](https://www.npmjs.com/package/@aivin-labs/sdk) (`ai`, `vector`, `store`, ...),
|
|
21
|
+
installed automatically as a dependency of every project this CLI scaffolds. See
|
|
22
|
+
[Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk) below for how the two packages
|
|
23
|
+
divide responsibilities.
|
|
24
|
+
|
|
25
|
+
## The Aivin ecosystem
|
|
26
|
+
|
|
27
|
+
Aivin isn't just a place to host one function — it's a small, composable ecosystem for agentic
|
|
28
|
+
software, and this CLI is how you reach every piece of it:
|
|
29
|
+
|
|
30
|
+
- **Plugins** — the core unit of work: a typed function (`main(mission, input, ctx)`), deployed as
|
|
31
|
+
its own container, callable by name, and searchable by every other plugin or agent in your org
|
|
32
|
+
(`aivin plugin search`, `call()` from the SDK). Write one by hand (`aivin create`), have AI
|
|
33
|
+
generate it from a description (`aivin init` / `aivin plugin make`), or convert an existing
|
|
34
|
+
project into one in place (`aivin plugin convert`).
|
|
35
|
+
- **MCP proxies** — wrap any [Model Context Protocol](https://modelcontextprotocol.io) server's
|
|
36
|
+
tools, resources, or prompts as first-class Aivin plugins with zero code (`aivin mcp <url>`),
|
|
37
|
+
so the growing MCP ecosystem becomes instantly usable by your agents.
|
|
38
|
+
- **Connectors** — shared OAuth apps and credential namespaces (`aivin connector`), so ten plugins
|
|
39
|
+
that all need "the org's Slack" don't each prompt the user for a separate login.
|
|
40
|
+
- **AI Staff agents** — persistent, nameable agents you target with a mission, that use your
|
|
41
|
+
plugins as tools and can pause to ask a human for input mid-task (HIL). Install one from the
|
|
42
|
+
marketplace or build your own (`aivin agent`, `aivin do`).
|
|
43
|
+
- **Automation jobs** — recurring, scheduled work described in plain language
|
|
44
|
+
(`aivin do job "..."`) — no cron syntax to write.
|
|
45
|
+
- **AI Browser** — a self-correcting agent that drives a real browser, yours or a server-side one,
|
|
46
|
+
to complete a goal end-to-end (`aivin browser`).
|
|
47
|
+
- **Workspaces, projects, and tasks** — the organizing structure everything above lives in, plus a
|
|
48
|
+
lightweight task tracker (`aivin task`) for the human side of the work.
|
|
49
|
+
- **Plugin Marketplace** — plugins and MCP proxies you build here aren't limited to your own org:
|
|
50
|
+
submit them for community review and publish to Aivin's public Plugin Marketplace
|
|
51
|
+
(`aivin mcp <url> --publish`), so the AI capabilities you develop become reusable building
|
|
52
|
+
blocks other teams on the platform can search for and call, not just your own.
|
|
53
|
+
- **Local, agent-supervised execution** — this CLI is also how Aivin reaches onto *your* machine to
|
|
54
|
+
get real work done, always under an explicit mission and never as open-ended remote access:
|
|
55
|
+
`aivin browser` drives a dedicated local browser profile (your own cookies/logins, isolated from
|
|
56
|
+
your daily-driver browser) so an agent can act on real logged-in sites, and `aivin start` can run
|
|
57
|
+
your plugin code inside a sandboxed `worker_threads.Worker` (`AIVIN_SANDBOX_WORKER=true`) with no
|
|
58
|
+
direct access to secrets or the filesystem. Every run stays scoped to the mission that started
|
|
59
|
+
it, with human-in-the-loop checkpoints (HIL) whenever an agent needs your go-ahead.
|
|
60
|
+
|
|
61
|
+
Put together: you describe the outcome you want, and Aivin's building blocks — plugins, agents,
|
|
62
|
+
connectors, MCP tools — compose into it. `aivin` is how you author, test, and ship each of those
|
|
63
|
+
pieces from your own terminal, on top of whatever editor/CI workflow you already use.
|
|
64
|
+
|
|
65
|
+
## Table of contents
|
|
66
|
+
|
|
67
|
+
- [The Aivin ecosystem](#the-aivin-ecosystem)
|
|
68
|
+
- [Install](#install)
|
|
69
|
+
- [Quick start](#quick-start)
|
|
70
|
+
- [What you get from a scaffold](#what-you-get-from-a-scaffold)
|
|
71
|
+
- [Command overview](#command-overview)
|
|
72
|
+
- [Environment variables](#environment-variables)
|
|
73
|
+
- [Documentation](#documentation)
|
|
74
|
+
- [Relationship to @aivin-labs/sdk](#relationship-to-aivin-labssdk)
|
|
75
|
+
- [Development](#development)
|
|
76
|
+
- [License](#license)
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install -g @aivin-labs/cli
|
|
82
|
+
aivin --version
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Requires Node.js ≥ 22.0.0 — the SDK relies on Node's native TypeScript execution to load
|
|
86
|
+
`src/main.ts` directly, with no separate build step. `aivin start`/`aivin test` check this up
|
|
87
|
+
front and fail with a clear message (not a cryptic loader error) if your Node is too old.
|
|
88
|
+
|
|
89
|
+
## Quick start
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
aivin init my-plugin # ask what the plugin should do, scaffold + generate working code
|
|
93
|
+
cd my-plugin && npm install
|
|
94
|
+
|
|
95
|
+
aivin start # run it locally - gRPC server + an HTTP test shim on :4001
|
|
96
|
+
|
|
97
|
+
aivin login # save an API key (once per machine)
|
|
98
|
+
aivin test # verify on a non-production instance first
|
|
99
|
+
aivin deploy # ship it
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`aivin init` asks what the plugin should do, then scaffolds the project **and** generates real
|
|
103
|
+
working code from that description in one step. Prefer a blank scaffold you write by hand?
|
|
104
|
+
`aivin create my-plugin` does just the scaffolding, no AI step. Already have a project instead of
|
|
105
|
+
a description? `aivin plugin convert` turns an existing directory into a plugin in place.
|
|
106
|
+
|
|
107
|
+
## What you get from a scaffold
|
|
108
|
+
|
|
109
|
+
Both `aivin init` and `aivin create` produce the same project shape (`init` additionally writes
|
|
110
|
+
`src/service.ts` — see [CLI.md](docs/CLI.md#aivin-init-name)):
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
my-plugin/
|
|
114
|
+
├── manifest.json # shared fields + plugins[] - identity, input/output schema, triggers
|
|
115
|
+
├── src/
|
|
116
|
+
│ └── main.ts # (+ service.ts, if you used `aivin init`)
|
|
117
|
+
├── package.json # depends only on @aivin-labs/sdk; "start" runs `aivin-server` directly
|
|
118
|
+
├── tsconfig.json # editor/type-checking config, not used to build anything at deploy time
|
|
119
|
+
├── AGENTS.md # orientation for a coding agent (Claude Code, Cursor, ...) in this project
|
|
120
|
+
├── test/ # a real, runnable example test using createMockSDK
|
|
121
|
+
├── .env # local-only config (SDK_ENDPOINT, etc.)
|
|
122
|
+
└── .gitignore
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`manifest.json`'s `description` is what the AI planner reads to decide when to use your plugin —
|
|
126
|
+
fill it in precisely. Full field reference lives in
|
|
127
|
+
[MANIFEST.md (sdk repo)](https://github.com/aivin-labs/AIVIN-SDK/blob/main/docs/MANIFEST.md).
|
|
128
|
+
|
|
129
|
+
## Command overview
|
|
130
|
+
|
|
131
|
+
Every command supports `--help` for its full flag list (`aivin <command> --help`). This table is
|
|
132
|
+
a map — see [docs/CLI.md](docs/CLI.md) for the complete reference, including exact flags,
|
|
133
|
+
examples, and behavior notes for each one.
|
|
134
|
+
|
|
135
|
+
| Command | What it does |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| `aivin init [name]` | Scaffold a plugin **and** AI-generate its code from a description, in one step |
|
|
138
|
+
| `aivin create [name]` | Scaffold a blank plugin project, no AI step |
|
|
139
|
+
| `aivin validate` | Validate `manifest.json` (or `--json`/`--stdin`) without touching the network |
|
|
140
|
+
| `aivin start` | Run the plugin locally (real gRPC server + `:4001` HTTP test shim), with hot-reload |
|
|
141
|
+
| `aivin deploy` | Deploy the current plugin to your org |
|
|
142
|
+
| `aivin test` | Deploy to a non-production instance, then smoke-test it and save a report |
|
|
143
|
+
| `aivin plugin search <query>` | Search the platform's plugin ecosystem for something to reuse |
|
|
144
|
+
| `aivin plugin make <description>` | AI-generate `src/main.ts` from a natural-language description |
|
|
145
|
+
| `aivin plugin convert [hint]` | Turn an existing project in the current directory into a plugin |
|
|
146
|
+
| `aivin plugin trigger [mission] [input]` | Invoke a deployed plugin for real and print the result |
|
|
147
|
+
| `aivin plugin logs [pluginId]` | Tail a deployed plugin's live console output |
|
|
148
|
+
| `aivin connector` | Register/search/list reusable OAuth or credential-form connectors |
|
|
149
|
+
| `aivin pluginstore` | Attach a self-hosted `aivin-service` worker to your org as a plugin store |
|
|
150
|
+
| `aivin mcp <url>` | Scan an MCP server and convert everything it finds into deployed plugin(s) |
|
|
151
|
+
| `aivin mcp create <name>` | Scaffold a single manifest-only plugin that proxies one MCP tool/resource/prompt |
|
|
152
|
+
| `aivin login [baseUrl]` | Log in and save an API key for this machine (browser flow by default) |
|
|
153
|
+
| `aivin whoami` | Show which account is logged in on this machine |
|
|
154
|
+
| `aivin key` | Manage named API keys (`gen` / `revoke` / `list`) for your account |
|
|
155
|
+
| `aivin browser [mission]` | Run an AI Browser mission, driving a real local or server-side browser |
|
|
156
|
+
| `aivin do [agentNickname] [mission]` | Have an AI Staff agent work toward a goal in the background |
|
|
157
|
+
| `aivin do job [description]` | Create a recurring automation job from a plain-language description |
|
|
158
|
+
| `aivin task [description]` | Create, list, get, update, or delete tasks in a project |
|
|
159
|
+
| `aivin workspace` | Browse your workspaces/projects and pick one for `--workspace`/`--project` |
|
|
160
|
+
| `aivin agent` | Search, install, create, and publish AI Staff agents |
|
|
161
|
+
| `aivin project` | Create, rename, and delete projects within a workspace |
|
|
162
|
+
|
|
163
|
+
## Environment variables
|
|
164
|
+
|
|
165
|
+
Most projects never need any of these — `aivin login` saves your key once, machine-wide, and
|
|
166
|
+
sensible defaults cover local development. Set them in a project's `.env` (or your shell) to
|
|
167
|
+
override:
|
|
168
|
+
|
|
169
|
+
| Variable | Used by | Default |
|
|
170
|
+
| --- | --- | --- |
|
|
171
|
+
| `SDK_ENDPOINT` | SDK calls, `aivin start` | `sdk.aivin.cloud:443` |
|
|
172
|
+
| `AIVIN_BASE_URL` | `deploy`, `test`, `plugin make/convert/trigger`, `login --basic` | `https://api.aivin.cloud` |
|
|
173
|
+
| `AIVIN_WEB_URL` | `login` (browser flow) | `https://brain.aivin.cloud` |
|
|
174
|
+
| `LOCAL_TEST_PORT` | `aivin start` | `4001` |
|
|
175
|
+
| `LOCAL_TEST_HOST` | `aivin start` | `127.0.0.1` (loopback-only — `/invoke` has no auth) |
|
|
176
|
+
| `AIVIN_SANDBOX_WORKER` | `aivin start`, deployed containers | `false` |
|
|
177
|
+
|
|
178
|
+
Full descriptions and when you'd actually touch each one: [CLI.md#environment-variables](docs/CLI.md#environment-variables).
|
|
179
|
+
|
|
180
|
+
## Documentation
|
|
181
|
+
|
|
182
|
+
- [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) — the full narrative walkthrough: scaffold,
|
|
183
|
+
write, test, deploy, and use a plugin from the CLI, plus everything else `aivin` drives (tasks,
|
|
184
|
+
AI Browser missions, workspaces, agents).
|
|
185
|
+
- [docs/CLI.md](docs/CLI.md) — every command, flag, and environment variable, for lookup.
|
|
186
|
+
- [docs/CHANGELOG.md](docs/CHANGELOG.md) — release history.
|
|
187
|
+
- [`@aivin-labs/sdk`'s own docs](https://github.com/aivin-labs/AIVIN-SDK/tree/main/docs) — the SDK
|
|
188
|
+
API your plugin code calls (`ai`, `vector`, `store`, ...), `manifest.json`'s field reference, and
|
|
189
|
+
`ctx`. This package doesn't duplicate that content.
|
|
190
|
+
|
|
191
|
+
## Relationship to @aivin-labs/sdk
|
|
192
|
+
|
|
193
|
+
- **This package (`@aivin-labs/cli`)** is dev tooling: it never runs inside a deployed plugin
|
|
194
|
+
container, only on your machine (or CI). Its own `aivin --version` is independent of whatever
|
|
195
|
+
`@aivin-labs/sdk` version a given plugin project has installed.
|
|
196
|
+
- **`@aivin-labs/sdk`** is the runtime library (`import { ai, ... } from '@aivin-labs/sdk'`) and
|
|
197
|
+
also ships `bin/server.mjs` (exposed as the `aivin-server` binary) — the actual process a
|
|
198
|
+
deployed plugin container runs via `npm start`. `aivin start`/`aivin test` resolve and run this
|
|
199
|
+
binary from the **current project's own** installed `@aivin-labs/sdk`, not from this CLI's
|
|
200
|
+
install location, so a scaffolded project's `package.json` depends on `@aivin-labs/sdk` directly
|
|
201
|
+
and never needs this CLI package installed inside the container.
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npm install
|
|
207
|
+
npm run lint # eslint .
|
|
208
|
+
npm run format # prettier --write .
|
|
209
|
+
npm test # node --test test/cli.validate.test.mjs
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
MIT
|
|
Binary file
|