# linkai-cli **Repository Path**: devai/linkai-cli ## Basic Information - **Project Name**: linkai-cli - **Description**: LinkAI CLI 是 LinkAI 平台的命令行工具,让 Agent 和人类都可以在终端中调用 LinkAI 的全部能力(模型、应用、知识库、数据库、工作流、插件、账号等),为 Agent 提供丰富的基础设施资源,扩展 Agent 的能力边界。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: https://www.cnblogs.com/zhayujie/p/21524003/cli-for-agents - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-17 - **Last Updated**: 2026-07-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

LinkAI CLI

The command-line interface for the LinkAI agent platform.

MIT License Go 1.21+ npm

English · 中文

**LinkAI CLI** brings the full LinkAI platform to the terminal for both agents and people — models, apps, knowledge bases, databases, workflows, plugins, and accounts. It gives AI agents a rich set of platform capabilities as infrastructure, extending what they can do. ## Capabilities The CLI exposes two kinds of capabilities: **platform resources** (manage and use the resources you've configured on LinkAI) and **model capabilities** (call models to generate content). **📦 Platform resources** | Resource | Command | Description | |----------|---------|-------------| | Apps | `app` | List, inspect, create, update, and delete AI apps | | Knowledge | `knowledge` | Vector-search private knowledge bases; import files and manage bases | | Database | `database` | Query databases and schemas, run SQL, create builtin databases and tables | | Workflow | `workflow` | Run workflows orchestrated on LinkAI; create, update, and delete them | | Plugin | `plugin` | List, inspect, and run platform plugins | | Account | `account` | Account profile, credits, and recharge | **🧠 Model capabilities** | Capability | Command | Description | |------------|---------|-------------| | Chat | `chat` | Talk to an AI app or language model, with multi-turn sessions | | Image | `image` | Text-to-image; returns an image URL | | Video | `video` | Text-to-video, with built-in polling until the result is ready | | Speech | `audio` | Text-to-speech (TTS), optionally saved to a file | | Models | `model` | List available models (LLM / IMAGE / VIDEO) | > Run `linkai --help` for the full flags of any command. ## Installation ### Option 1 — npm Requires Node.js 16 or later. npm installs the command to its global bin directory, which is already on your `PATH`: ```bash npm i -g linkai-cli ``` ### Option 2 — let an agent install it Send an agent this message; it will install the CLI, fetch the skill, and start using it: > Read https://cdn.link-ai.tech/cli/install.md and follow it to install the CLI and skill, then start using it. ### Option 3 — install script (no dependencies) ```bash # macOS / Linux curl -fsSL https://cdn.link-ai.tech/cli/install.sh | sh # Windows (PowerShell) irm https://cdn.link-ai.tech/cli/install.ps1 | iex ``` The script downloads the pre-built binary, sets up your `PATH`, and installs the agent skill into common AI tool directories (Claude Code, Cursor, Codex, CowAgent, etc.).
Other install methods (Homebrew / Go / Binary / Source) - **Homebrew:** `brew install MinimalFuture/tap/linkai` - **Go:** `go install github.com/MinimalFuture/linkai-cli@latest` - **Binary:** download from [GitHub Releases](https://github.com/MinimalFuture/linkai-cli/releases/latest), extract, and put it on your `PATH`. - **Source:** `git clone`, then `make build && make install`.
Install script environment variables | Variable | Description | Default | |----------|-------------|---------| | `LINKAI_VERSION` | Version to install | `latest` | | `LINKAI_INSTALL_DIR` | Binary install directory | Auto (prefers a directory already on `PATH`) | | `LINKAI_SOURCE` | Download source: `cdn` / `github` | `cdn` (falls back to GitHub if unreachable) | | `LINKAI_NO_SKILL` | Set to `1` to skip installing the skill | — |
## Getting started Three steps to your first call: ```bash linkai auth login # 1. Log in (authorize in the browser) linkai app list # 2. List apps and grab an app_code linkai chat "Hello" --app # 3. Chat with the app ``` Use `auth status` to check your session and `auth logout` to sign out. ## Using with agents Once installed, agents learn how to drive the CLI through its bundled skill — no extra setup required. The skill lives in [`skills/linkai-cli/`](./skills/linkai-cli/SKILL.md). A few notes when calling from an agent: - Add `--json` for structured, easy-to-parse output. - Preview write operations with `--dry-run`; add `--force` to skip confirmations (e.g. `knowledge delete`). - Run `linkai --help` for a command's full flags. ## Command reference | Command | Description | |---------|-------------| | `auth login` / `logout` / `status` | Log in / out / show login status | | `app list` / `detail` / `create` / `update` / `delete` | List and manage apps | | `chat "" --app ` | Chat with an app; `--session` for multi-turn | | `knowledge list` / `files` / `search` / `create` / `import` / `delete` | Query, import, and manage knowledge bases | | `database list` / `tables` / `describe` / `exec` / `create` / `create-table` | Query, run SQL, and create builtin databases/tables | | `workflow list` / `run --input ""` / `create` / `update` / `delete` | List, run, and manage workflows | | `plugin list` / `detail` / `exec ` | List and run plugins | | `image gen ""` | Text-to-image | | `video gen ""` | Text-to-video (waits for completion) | | `audio speech "" [--output a.mp3]` | Text-to-speech, optionally downloaded | | `model list [--type LLM\|IMAGE\|VIDEO]` | List available models | | `account info` | Account profile and credit balance | | `account credits` / `recharge` / `orders` | Credit packages, recharge, and orders | > See `linkai --help` for each command's full flags. ## Permissions Permissions are requested at login via `--scope`, in `resource:action` form. Read and content-generation scopes are granted by default; write scopes must be requested explicitly. | Scope | Description | Default | |-------|-------------|:---:| | `app:read` | List and inspect apps | ✅ | | `app:create` | Create apps | ✅ | | `user:read` | Read user info | ✅ | | `chat:send` | Chat with apps | ✅ | | `knowledge:read` | Query knowledge bases | ✅ | | `knowledge:create` | Create knowledge bases / add files | ✅ | | `db:read` | Query databases / run SELECT | ✅ | | `image:gen` / `video:gen` / `audio:gen` | Generate images / video / speech | ✅ | | `plugin:read` / `plugin:run` | List / run plugins | ✅ | | `workflow:read` / `workflow:run` | List / run workflows | ✅ | | `workflow:create` | Create workflows | ✅ | | `score:read` / `score:buy` | View / purchase credits | ✅ | | `app:update` / `app:delete` | Update / delete apps | ❌ | | `knowledge:update` / `knowledge:delete` | Update / delete knowledge bases | ❌ | | `workflow:update` / `workflow:delete` | Update / delete workflows | ❌ | | `db:write` | Database writes (INSERT/UPDATE/DELETE) | ❌ | Request extra scopes by logging in again, for example: ```bash linkai auth login --scope "db:read db:write knowledge:update knowledge:delete" ``` ## More
Security - **Tokens:** opaque tokens stored server-side and revocable; `access` lasts 2h, `refresh` lasts 7d, refreshed automatically before expiry; `logout` revokes them server-side. - **Device binding:** every request carries `X-Device-ID`, and the server binds tokens to the device. - **Local storage:** tokens go into the macOS Keychain (service `linkai-cli`), with a `0600` file fallback on other platforms; config lives in `~/.linkai/`. - **Input / output hardening:** dangerous Unicode is rejected, DDL is blocked in the database commands, and ANSI is stripped from table output. - **Resilience:** 5xx responses are retried with exponential backoff; exit codes are structured (0 ok / 1 general / 2 validation / 3 auth / 4 network).
Shell completion ```bash source <(linkai completion bash) # Bash source <(linkai completion zsh) # Zsh linkai completion fish | source # Fish ```
Development ```bash make build # build (with version injection) make test # run tests make lint # golangci-lint ``` To add a command, follow the pattern in `cmd/database/`, register it in `cmd/root.go`, and declare its scope via `permission.RequiredKey`.
## License [MIT](./LICENSE)