@seeed-studio/solution-cli 0.3.2 → 0.4.1

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 CHANGED
@@ -1,151 +1,199 @@
1
1
  # @seeed-studio/solution-cli
2
2
 
3
- Zero-friction installer, CLI suite, and AI Agent Skill for **SenseCraft Edge IoT Solutions & Hardware Ecosystem** (reComputer Jetson, reCamera, SenseCAP, Grove Vision AI, ESP32).
3
+ Install the signed Rust deployment engine and the `solution-cli` AI Agent Skill for Seeed edge IoT solutions and hardware.
4
4
 
5
- Compatible with **Claude Code, Codex, Google Antigravity (AGY), Work Buddy, and CodeBuddy**.
5
+ ## 1. Quick Start: Install to Your Agent (快速安装与宿主配置)
6
6
 
7
- > 📖 **专属完整使用指南**:如果您需要系统了解本 CLI 的独特使用场景、详细命令参数、多 Agent 宿主集成以及各阶段具体产出物,请直接查阅独立手册:[**SenseCraft Solution CLI 使用与集成全景指南 (docs/cli-guide.md)**](docs/cli-guide.md)。
7
+ **推荐方式:npm 全局安装并挂载到指定 Agent**
8
+ (将 `solution-cli` 注册到系统全局 PATH,Agent 在对话中调用方案/硬件查询毫秒级响应,避免因 PATH 缺失导致的报错重试):
8
9
 
9
- ---
10
+ | 目标 AI 宿主 | 专属安装命令(直接复制发给 AI 或在终端运行) | 技能挂载路径 |
11
+ |---|---|---|
12
+ | **豆包工作 (Doubao Work)** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent doubao` | `~/.doubao/skills` |
13
+ | **Claude Code** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent claude` | `~/.claude/skills` |
14
+ | **OpenAI Codex** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent codex` | `~/.agents/skills` 或 `~/.codex/skills` |
15
+ | **Google Antigravity** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent antigravity` | `~/.gemini/config/skills` |
16
+ | **WorkBuddy** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent workbuddy` | `~/.workbuddy/skills` |
17
+ | **CodeBuddy** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent codebuddy` | `~/.codebuddy/skills` |
18
+ | **Hermes Agent** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent hermes` | `$HERMES_HOME/skills` (默认 `~/.hermes/skills`) |
19
+ | **全部 Agent (全量检测)** | `npm install -g @seeed-studio/solution-cli && solution-cli install --agent all` | 上述全部已检测目录 |
20
+ | **自定义路径 (如 Cursor)** | `npm install -g @seeed-studio/solution-cli && solution-cli install --skills-dir <路径>` | `<自定义路径>/solution-cli` |
10
21
 
11
- ## 1. Quick Start & Agent Installation
22
+ > [!TIP]
23
+ > - **为什么使用 `npm install -g`?** 全局安装后,系统内已有 `solution-cli` 命令。AI Agent 在后续对话中调用方案与硬件查询无需每次通过网络重新下载包,避免产生 `command not found: solution-cli` 报错。
24
+ > - **发给 AI 助手**:直接复制上表中对应的专属命令发给你的 AI 助手(例如对豆包说:*“请帮我运行:`npm install -g @seeed-studio/solution-cli && solution-cli install --agent doubao`”*)。
25
+ > - **免全局安装(npx 备选)**:若无系统全局 npm 写入权限,仍可使用 npx 免全局安装:`npx -y @seeed-studio/solution-cli install --agent <id>`。
26
+ > - **国内镜像延迟排查**:若遇 npm 同步延迟,可在命令末尾加上 `--registry=https://registry.npmjs.org/`。
12
27
 
13
- Install the underlying engine and configure the AI Agent Skill with one command:
28
+ ### 开发者本地源码部署
29
+
30
+ 在克隆的代码仓库根目录下,直接使用本地源码将 Skill 挂载到指定 Agent,无需发布或下载 npm 包:
14
31
 
15
32
  ```bash
16
- npx -y @seeed-studio/solution-cli@latest install --agent workbuddy -y
33
+ node bin/cli.js install --agent <doubao|claude|codex|antigravity|codebuddy>
17
34
  ```
18
35
 
19
- This example targets WorkBuddy explicitly. Replace `workbuddy` with the current
20
- Agent ID for another host. Use `npx -y @seeed-studio/solution-cli@latest install`
21
- for the interactive form: when one or more Agents are detected, pressing Enter
22
- selects all detected Agents, while entering the corresponding number selects one
23
- host. In non-interactive mode, `install -y` without `--agent` also selects all
24
- detected Agents when any are detected. If none are detected, these defaults still
25
- use the CLI's default target set; pass `--agent <agent-id>` to control the scope
26
- explicitly.
27
-
28
- The same command is safe to repeat. It checks the signed stable Engine release,
29
- reuses an equal or newer local Engine, and upgrades an older one. Existing
30
- modified or unregistered skills and protected symlinks are preserved. Use
31
- `--agent claude,antigravity` to select agents, or `--engine-path <path>` to pin
32
- a valid Engine binary. `--force` re-downloads an equal or older Engine and
33
- overwrites existing skill files, including user modifications; use it only when
34
- that overwrite is intended. Protected external symlinks are not followed, and
35
- it never downgrades a newer discovered Engine.
36
-
37
- Automatic reuse/upgrade rules start with publicly published solution-cli 0.3.1.
38
- A latest release or signature failure stops before changing the
39
- Engine or skills; an offline host must use a valid explicit local Engine path.
40
-
41
- The interactive form remains available when prompts are wanted:
36
+ ### 免安装即时查询
37
+
38
+ 无需安装任何依赖,可直接使用 `npx` 随用随走:
42
39
 
43
40
  ```bash
44
- npx -y @seeed-studio/solution-cli@latest install
41
+ npx -y @seeed-studio/solution-cli hub search "农业"
42
+ npx -y @seeed-studio/solution-cli product query recomputer_j40 --json
45
43
  ```
46
44
 
47
- ### Supported AI Agent Harnesses
48
- - **Claude Code**: `~/.claude/skills/solution-cli`
49
- - **Codex / OpenAI**: `~/.agents/skills/solution-cli` or `~/.codex/skills/solution-cli`
50
- - **Google Antigravity (AGY)**: `~/.gemini/config/skills/solution-cli`
51
- - **Work Buddy / Workbody**: `~/.workbuddy/skills/solution-cli`
52
- - **CodeBuddy**: `~/.codebuddy/skills/solution-cli`
45
+ ## 2. How to Deploy a Solution (方案部署指南)
46
+
47
+ 方案部署支持**本地部署(Local Docker,最简且无需 SSH 密钥)**与**远程部署(Remote SSH 密钥认证)**。
48
+
49
+ ### 部署 4 步走流程 (SOP)
50
+
51
+ 1. **查找方案**:
52
+ ```bash
53
+ solution-cli hub search "农业" --json
54
+ ```
55
+ 2. **读取方案部署规格与预设**:
56
+ ```bash
57
+ sensecraft-engine deploy-info <solution-id> --lang zh
58
+ ```
59
+ 3. **准备部署参数文件** `./.sensecraft-work/body.json`:
60
+ - **本地部署(推荐快速体验,Localhost Docker)**:
61
+ ```json
62
+ {
63
+ "solution_id": "<solution-id>",
64
+ "preset_id": "default",
65
+ "selected_devices": ["host_device"],
66
+ "device_connections": {
67
+ "host_device": {
68
+ "target": "local_host",
69
+ "target_type": "local"
70
+ }
71
+ }
72
+ }
73
+ ```
74
+ - **远程边缘设备部署(SSH 密钥认证)**:
75
+ ```json
76
+ {
77
+ "solution_id": "<solution-id>",
78
+ "preset_id": "default",
79
+ "selected_devices": ["host_device"],
80
+ "device_connections": {
81
+ "host_device": {
82
+ "target": "remote_edge",
83
+ "target_type": "remote",
84
+ "host": "192.168.1.50",
85
+ "username": "seeed",
86
+ "key_file": "~/.ssh/id_ed25519"
87
+ }
88
+ }
89
+ }
90
+ ```
91
+ 4. **一键执行部署并查看状态**:
92
+ ```bash
93
+ # 验证与执行部署
94
+ sensecraft-engine deploy --params ./.sensecraft-work/body.json --yes
95
+
96
+ # 查询部署进度与容器日志
97
+ sensecraft-engine status <deployment-id> --json
98
+ sensecraft-engine logs <deployment-id>
99
+ ```
100
+
101
+ ## 3. CLI Command Reference
102
+
103
+ | Command | Purpose |
104
+ |---|---|
105
+ | `solution-cli install --agent <agent-id> -y` | Install or update the signed Engine and Skill |
106
+ | `solution-cli hub search "<query>" --json` | Find solution scenarios and reference designs |
107
+ | `solution-cli product query <family-id> --json` | Read hardware family specifications |
108
+ | `solution-cli product accessories <family-id> --json` | Check required and compatible accessories |
109
+ | `solution-cli status` | Show Engine, content, and Skill state |
110
+ | `solution-cli doctor --json` | Check OS, permissions, Docker, PATH, and ledger |
111
+ | `sensecraft-engine solution list --json` | List locally available deployable solutions |
112
+ | `sensecraft-engine deploy-info <id> --lang en` | Read presets, devices, targets, and required values |
113
+ | `sensecraft-engine deploy --params ./.sensecraft-work/body.json --yes --detach --lang en` | Start an approved deployment |
114
+ | `sensecraft-engine status <deployment-id> --json` | Poll a detached deployment |
115
+ | `sensecraft-engine logs <deployment-id> --since <N>` | Read deployment events |
53
116
 
54
- ---
117
+ The Engine binary remains named `sensecraft-engine` for compatibility; the user-facing package and Skill are `solution-cli`. See [the deployment reference](skills/solution-cli/references/deploy.md) before applying changes to a device.
55
118
 
56
- ## 2. CLI Command Reference
119
+ ### Catalog relationships and links
57
120
 
58
- The `solution-cli` provides unified commands for discovery, BOM calculation, device diagnostics, and engine execution:
121
+ The catalog separates four things that should not be treated as synonyms:
59
122
 
60
- | Command | Description |
61
- |---|---|
62
- | `solution-cli hub search "<query>" [--json] [--limit N]` | Search scenarios & reference designs. Connects to live Typesense cloud or seamlessly falls back to bundled catalog. Returns diagnostic playbooks & UTM landing URLs. |
63
- | `solution-cli product query <family_id> [--json]` | Query hardware family default SKUs, region variants, and physical specs. |
64
- | `solution-cli product accessories <family_id> [--sku <sku>] [--json]` | Evaluate required vs. optional accessories with strict physical compatibility checks (power, RF antenna, M.2 slots). |
65
- | `solution-cli install [--agent <agents>] [-y]` | Inspect host environment, download/verify engine, and install Agent skills. |
66
- | `solution-cli status` | Inspect installed engine binary, content cache, and configured agent skills. |
67
- | `solution-cli doctor` | Run pre-flight diagnostics (OS, Docker daemon, serial permissions, PATH, ledger). |
68
- | `solution-cli uninstall [--agent <agents>]` | Cleanly remove Solution CLI skills using the installation ledger. |
69
- | `sensecraft-engine <subcommand>` | Direct proxy to the underlying high-performance Rust execution engine. |
123
+ - **Scenario** is the business landing page and points to related Tech pages and Reference Designs.
124
+ - **Tech** is an independently owned technology page. It is not the Wiki for an RD.
125
+ - **Reference Design (RD)** is the concrete architecture and product design. It may have a deployment document and presets.
126
+ - **Deployable content** is the RD's mapped deployment document. A landing page or RD without a valid mapping is informational and cannot be assumed deployable.
127
+
128
+ Use the compact catalog flow instead of reading manifests or writing a parser:
70
129
 
71
- ---
130
+ ```bash
131
+ solution-cli hub list --type reference_design --locale en --page 1 --limit 50 --json
132
+ solution-cli hub get <id> --locale en --section overview --json
133
+ solution-cli hub get <id> --locale en --section links --json
134
+ solution-cli hub get <id> --locale en --section architecture --json
135
+ solution-cli hub get <id> --locale en --section products --json
136
+ solution-cli hub get <id> --locale en --section deployment --json
137
+ ```
72
138
 
73
- ## 3. How the AI Agent Uses the Skill
139
+ Follow `next_page` for a complete bundled snapshot. Use `search` for a
140
+ specific request, then `get` for the selected records and only the sections
141
+ needed to answer it. The three production landing hosts are locale-specific:
142
+ English `www.seeed.cc`, Chinese `www.seeedstudio.com.cn`, and Japanese
143
+ `www.seeed.co.jp`. Use the URLs returned by `hub get --section links`; do not
144
+ construct Wiki, CDN, or translated URLs from an ID. A translated body may
145
+ fall back to another content language while its production page remains
146
+ published, so report the returned content language separately.
74
147
 
75
- Once installed, your AI Agent gains deep domain knowledge as an Edge IoT Solution Architect. The skill operates across a **4-tier progressive disclosure lifecycle**:
148
+ For deployment, confirm the RD mapping with the local Engine:
76
149
 
150
+ ```bash
151
+ sensecraft-engine deploy-info <solution-id> --lang en
77
152
  ```
78
- [ Tier 1: 方案咨询与工况诊断 ]
79
- Agent 讲透方案业务价值与边缘推理机制 ➔ 依据领域诊断知识库提出 2~3 个关键工况问题 ➔ 给出带静默 UTM 的落地页与源码出口
80
- │
81
- ▼
82
- [ Tier 2: 硬件选型与配件 BOM 校验 ]
83
- 运行配件评估引擎 ➔ 严格区分【必需配件】(电源适配器) 与【可选配件】(安装支架/天线) ➔ 规避物理插头/电压/引脚不兼容
84
- │
85
- ▼
86
- [ Tier 3: 设备管理与在线参数修改 ]
87
- 查询活跃部署 ➔ 读取 reconfigurable: true 字段 ➔ 零重装无损热更新 (如在线修改 MQTT Broker 地址或检测阈值)
88
- │
89
- ▼
90
- [ Tier 4: 本地二次开发与自研模型 ]
91
- 获取官方 GitHub 仓库 ➔ 引导本地代码克隆与模型转换 (trtexec / TensorRT) ➔ 通过 --solutions-dir 驱动本地开发联调闭环
92
- ```
153
+
154
+ The Hub record describes the published design; `deploy-info` confirms the
155
+ actual local deployment document and presets.
156
+
157
+ Links and metadata only locate content. To answer a capability, architecture,
158
+ or product question, read the selected `description`, `architecture`, or
159
+ `products` section. Open the exact returned production page or image when it
160
+ matters to the answer. Treat a relative asset path as readable only when its
161
+ signed local content is present; otherwise report the source asset as
162
+ unavailable.
163
+
164
+ ## 4. How the AI Agent Uses the Skill
165
+
166
+ The Skill maps ordinary language to four stages:
167
+
168
+ 1. **Consultation**: search the catalog and clarify the customer's scenario.
169
+ 2. **Hardware selection**: check device families, accessories, and physical compatibility.
170
+ 3. **Precheck and deployment**: read `deploy-info`, fill required values, run validation, show side effects, then ask before applying.
171
+ 4. **Verification and troubleshooting**: follow deployment status and logs, verify services, and diagnose failures.
172
+
173
+ For deployment, the Agent must use the installed Engine's absolute path when it is injected into the Skill. For catalog or product queries, use `solution-cli`; if it is not on `PATH`, use `npx @seeed-studio/solution-cli <command>`. Windows native local Docker is unsupported; use a Linux Docker host over SSH. macOS local Docker requires a running Docker Desktop daemon. The CLI does not install Docker Desktop or silently grant `sudo`.
93
174
 
94
175
  ### 常见自然语言对话范例
95
176
 
96
177
  #### 范例 1:方案咨询与工况诊断 (Discovery & Diagnosis)
97
- > **用户**:“我们打算在养老社区做老人跌倒检测,有什么成熟方案推荐吗?”
98
- >
99
- > **Agent**:
100
- > 1. 调用 `solution-cli hub search "养老" --json`;
101
- > 2. 详细解释 `fall_detection` 方案的端侧姿态估计与逐人时序状态机机制(1.4s 本地低延迟、视频不出本地保护隐私);
102
- > 3. 自然给出官方方案落地页与 GitHub 源码地址(携带静默 UTM 跟踪);
103
- > 4. **主动发起工况诊断黄金三问**:
104
- > - 房间是同一栋楼集中分布(推荐 1 台 Orin 主机拉多路 RTSP 流摊薄成本)还是分散独栋(推荐每间房独立一体机)?
105
- > - 现场是否已有支持 RTSP 协议的海康/大华存量摄像头(直接利旧节省采购成本)?
106
- > - 卫生间/卧房私密空间是否对纯光学摄像头有顾虑(可选用 60GHz 毫米波雷达替代)?
107
-
108
- #### 范例 2:硬件选型与配件兼容性校验 (BOM & Compatibility)
109
- > **用户**:“选好了,我要买一台 reComputer J4012,帮我看看需要配哪些配件?”
110
- >
111
- > **Agent**:
112
- > 1. 调用 `solution-cli product accessories recomputer_j40 --json`;
113
- > 2. 明确区分:
114
- > - **必需配件**:19V 4.74A DC Jack (5.5x2.5mm) 电源适配器(严禁配 12V 否则无法开机);
115
- > - **可选配件**:NVMe M.2 2280 SSD(Key-M)、双频 Wi-Fi/BT 模组(Key-E 插槽)与匹配的 SMA 天线;
116
- > 3. 提供官方 SKU 与带 UTM 标记的购买链接,杜绝编造第三方型号。
178
+
179
+ 用户可以直接描述客户需求。Agent 先搜索方案,解释匹配原因,再询问供电、设备、网络和部署位置等缺失信息;没有明确部署确认时不执行部署。
180
+
181
+ #### 范例 2:硬件配置与配件推荐(查配置、推荐配件、防止买错)
182
+
183
+ 用户询问某个设备(如 reComputer、Watcher)的参数,或询问“买这台主机还需要配什么配件”。Agent 使用 `product query` 和 `product accessories` 查出真实硬件规格,区分必须买的配件(如电源线)和可选配件(如天线/外壳/摄像头),并自动校验接口与频段兼容性,直接给出官方配件清单。
117
184
 
118
185
  #### 范例 3:在线参数热修改 (Device Management)
119
- > **用户**:“我已经部署完设备了,现在想把告警的 MQTT 服务器地址改成本地的 192.168.1.50,怎么弄?”
120
- >
121
- > **Agent**:
122
- > 1. 查询当前应用的可配置参数;
123
- > 2. 确认 `mqtt_broker` 属于 `reconfigurable: true` 字段;
124
- > 3. 直接通过管理接口发起更新,提示用户无需重启容器或重装整个系统,参数热生效。
125
186
 
126
- #### 范例 4:二次开发与自研模型替换 (Secondary Dev)
127
- > **用户**:“我想改一下后处理检测逻辑,换成我们自己的 YOLOv11 跌倒模型,源码在哪里?”
128
- >
129
- > **Agent**:
130
- > 1. 提供方案对应的官方 GitHub 开源仓库地址;
131
- > 2. 指导用户克隆到本地工作区;
132
- > 3. 指导通过 TensorRT `trtexec` 完成端侧引擎转换,并在 `docker-compose.override.yml` 中挂载自定义模型;
133
- > 4. 使用 `sensecraft-engine deploy <id> --solutions-dir ./solutions` 进行本地快速调测。
187
+ 用户可以描述要修改的已部署参数。Agent 先读取当前部署和可修改字段,确认目标设备与变更范围,再按设备管理接口执行获得批准的修改。
134
188
 
135
- ---
189
+ #### 范例 4:二次开发与自研模型替换 (Secondary Dev)
136
190
 
137
- ## 4. 技术架构亮点
191
+ 用户可以要求源码、模型替换或本地方案调试。Agent 应读取对应方案的开发文档和 `--solutions-dir` 规则,并在部署前展示改动。
138
192
 
139
- 1. **双轨检索与开箱即用 (Out-of-the-Box)**:
140
- - 内置 323 KB 离线核心清单(18 场景、39 参考设计、119 硬件族),无网断网 100% 可用;
141
- - 线上发布版内置只读搜索凭据,联网时自动直连 Typesense 云端集群获取实时更新。
142
- 2. **静默商业闭环 (Silent Attribution)**:
143
- - 所有落地页、Wiki、商城 SKU 与配件链接均经安全工具注入 `utm_source=sensecraft_agent`,对话自然融入,杜绝生硬广告。
144
- 3. **物理规格防呆保护**:
145
- - 内置电源接口(DC 5.5x2.5 vs 5.5x2.1)、极性(中心正极)、电压(19V vs 12V)、M.2 Key-M/Key-E 及 RF 射频天线接头校验,从源头杜绝硬件烧板与返工风险。
193
+ ## 5. 技术架构亮点
146
194
 
147
- ---
195
+ `solution-cli` 是 npm 安装入口,签名 Rust Engine 负责跨平台查询、预检查、部署状态和日志;方案内容按版本校验后进入本地缓存。在线目录查询失败时,Skill 和 CLI 可使用已安装的本地内容与知识库完成支持的离线查询。
148
196
 
149
- ## 5. 开源协议
197
+ ## 6. 开源协议
150
198
 
151
199
  Apache-2.0 © Seeed Studio