SmartBI CLI
Query model/report data and operate SmartBI APIs Skill: SmartBI CLI Owner: wahsonleung Summary: Query model/report data and operate SmartBI APIs Tags: latest:2.1.0 Version history: v2.1.0 | 2026-09-22T10:33:13.891Z | user **Major update with expanded scenario support and improved agent integration.** - Data query and insight scenarios now have dedicated guides and workflow overrides (scenarios/data-query.md), supporting direct, multi-step query/insight calls. - Add
Rank
62
Safety
84
Downloads
1.3k
Updated
Oct 10, 2026
Version
2.1.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 10, 2026
- Adoption signal
- 1.3K downloadsadoption · observed Oct 10, 2026
- Latest release
- 2.1.0release · observed Sep 22, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17903ewqvyed96apj0ghpecr987c1r3:smartbi-cli- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-wahsonleung-smartbi-cli/snapshot"
Documentation
CLAWHUB
149,157 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: smartbi-cli
description: 广州思迈特软件有限公司(思迈特)提供的 SmartBI 通用业务操作技能。当用户需要连接 SmartBI、查询数据模型或指标模型、对已有报表问数、进行 AI 问数与复杂洞察,或管理智能体、知识库与知识图谱、数据模型、数据源、定时任务与 ETL、消息推送、资源及权限时使用。通过 @smartbi/cli 发现并调用当前环境的 SmartBI API,支持 MQL 与只读 SQL 直接取数。
---
# SmartBI CLI
## 流程概览
- **Step 0 — Scenario Router**(入口):先看用户问句是否命中 Part 2 场景索引。命中 → 加载对应场景文件执行;未命中 → 进入 Part 1。组合请求按业务步骤衔接,不让取数场景覆盖调度、推送或资源操作。
- **Part 1 — Core CLI Workflow**(骨架):任何 `domain.operationId` 的发现→理解→调用→排错流程一致。
- **Part 2 — Scenario Guides**(场景):高频业务场景的端到端模板,按需加载。
- **`references/`**(参考):各 Phase 的详细流程、策略模板与文档路径索引。
数据查询与洞察的扩展路径见 [scenarios/data-query.md](scenarios/data-query.md),按需加载,不改变其他场景的通用调用流程。
命中数据查询与洞察场景后,已知 operationKey 按场景文件的最短可验证调用链执行;资源未知时按该场景定位业务资源。该场景已授权只读调用不执行下文 Phase 3 的逐次确认;下文 Part 1 的通用接口发现与写操作规则继续用于其他业务操作。
## Triggers(触发条件)
当用户描述 **BI 业务动作 + 业务对象**,但未显式给出接口名/operationKey(例如"帮我训练模型资源A""基于模型资源A分析去年销售额")时触发。
当用户问及 BI 相关业务操作(分析、训练、指标查询、报表/问句类需求、定时计划任务等)时触发本 skill。触发后进入 Step 0 路由判断。
`operationKey` 格式为 `${domain}.${operationId}`(如 `demo.createOrder`、`aichat.getAgentItems`)。`list` 输出结果可直接复制作为 `describe`/`call` 的参数。
---
## 全局约定(所有路径共用)
以下规则适用于 **所有** 执行路径(Part 1 通用流程和 Part 2 场景流程)。先读完全局约定,再进入 Step 0 路由判断。
### CLI 安装与配置
- MUST 仅通过 **npm 全局安装** 获得可执行命令 `smartbi`:`npm install -g @smartbi/cli@latest`,随后 `smartbi --version` 验证版本 **≥ 2.0.0**,并执行 `smartbi profile list --help` 确认 profile 命令族可用。
- MUST NOT 使用 `yarn` / `pnpm` / `bun` / `npx` 或其它程序代替上述 `smartbi`。
- 初始化 MUST:由 CLI 全参数生成配置:`smartbi init --server-type <sdk-server|smartbi> --base-url <url> --token <token> [--profile <name>]`;凭证方式按用户选择,可使用字面令牌、环境变量或钥匙串,细节见 `references/init.md`。
- 配置文件路径:默认 **`~/.smartbi/config.yaml`**,或用户在 init 后 **明确指定** 的 `--config <path>`。MUST NOT 在系统中猜测或套用其它文件。config.yaml 可包含多个环境(profiles),默认环境由 `profile:` 字段指定;多环境的选择、配置与错误处理见 `references/profiles.md`。
- CLI 不存在时的处理流程见 `references/init.md`「标准安装」。
### 环境选择(多 profile)
任务开始时在内部确定本次使用的 profile:用户指定连接或客户时按 `references/profiles.md` 匹配或新建,未指定时用默认 profile(config.yaml 的 `profile:` 字段)。普通业务对话不询问或展示 `dev`、profile 名、`--profile` 等内部配置;多个连接无法区分时只按服务器地址或用户熟悉的业务名称澄清。
环境确定后,**所有** `smartbi` 命令(`list`/`search`/`describe`/`call`/`doc`)**一律带 `--profile <name>`**。
完整规范(确定/告知/配置/错误处理/版本约束)见 `references/profiles.md`。
### 首次配置
仅在无配置或所选环境缺少必要信息时补齐配置。复用已知地址、服务器类型、环境名和有效凭证来源(字面令牌、环境变量或钥匙串),只询问缺失项,一次一个问题。已有地址但缺少/失效令牌时只处理凭证,不再推荐体验中心。已有配置的修复见 `references/init.md`,不得用全量初始化覆盖其他环境。以下完整流程用于首次无配置的情况:
1. **先问地址**:用户提供 SmartBI 地址 → `serverType: smartbi`。如果用户只表达“连接 SmartBI”或“连接 SmartBI 地址”但没有提供具体地址,第一问直接说:“是否连接 SmartBI 官网体验中心 https://cloud.smartbi.com.cn/smartbi?如果要连接自己的环境,请提供地址。”不得只问“要连接哪个环境”而遗漏体验中心选项;也不得在用户确认前将体验中心写入配置或发起连接。用户确认后使用该地址和 `serverType: smartbi`。用户拒绝或需要其他环境时,再询问实际 SmartBI 地址;用户无法提供 SmartBI 地址时,询问 SDK Server 地址并使用 `serverType: sdk-server`;两者均无法提供时暂停。
2. **再问令牌**:问令牌时一并说明获取路径和存储方式(仅一句):"请提供 SmartBI 个人访问令牌(登录 SmartBI 后,在「个人中心 → 我的设置 → 个人访问令牌」中新建)。令牌默认直接存进配置;如对安全有更高要求,也可以改用「环境变量」或「系统钥匙串」存储。"首次配置不再询问环境名;若用户选择其他存储方式,步骤 3 按其选择生成。
3. 执行 `smartbi init --server-type <sdk-server|smartbi> README.md
# SmartBI CLI Skill
Skill 版本:**2.1.0**。运行时依赖的 `@smartbi/cli` 版本独立管理,最低要求为 2.0.0。
保留标准 Skill 的业务路由,为数据类请求采用基于模型的直接取数路径:用户问句 → 读取必要模型信息 → 根据模型与 SDK 能力选择 MQL 或只读 SQL → CLI 调用 SDK → 校验数据 → 桌面智能体分析/展示。直接取数不依赖模型训练或 AI 问数,无需额外查询框架。详见 `references/query-routing.md`。
在原版场景索引中新增数据查询与洞察,入口为 `scenarios/data-query.md`;原有通用 API、定时任务和推送保留。外部智能体通过接口定位资源,不依赖 SmartBI 页面预选信息。模型取数按语义选择 MQL/只读 SQL,已有报表按定义与参数查询/导出;正式报告、归因、预测和综合大屏按路由默认白泽,用户指定直接取数或本地分析时遵循其选择。已有数据制图和文件转换继续本地处理;创建或修改 SmartBI 报表仍走资源操作接口。
普通取数依赖 Node/npm 全局安装的 SmartBI CLI(>=2.0.0)。Python 仅用于可选辅助脚本/文件读取,不是 MQL 前置条件。跨桌面客户端需具备命令执行和文件读写能力;不能把单一客户端的实测视为所有客户端已验证。
支持具备命令执行和文件读写能力的桌面智能体,通过 `@smartbi/cli` 发现并调用当前环境开放且有权限的 SmartBI API。
## 目标
```
┌──────────┐
│ 任意 Agent │
└─────┬────┘
│ 自然语言意图
▼
┌───────────────────────────────┐
│ smartbi-cli skill │
│ │
│ 意图 → operationKey → call │
│ │
│ 定时计划任务 / ... │
└───────────────┬───────────────┘
│ smartbi call
▼
┌───────────────────────────────┐
│ SmartBI OpenAPI │
│ (datamodel / scheduletask │
│ tabularmodel / aichat ...) │
└───────────────────────────────┘
```
Skill 提供业务路由与调用规则,实际能力取决于当前 SDK、模型定义和账号权限。
普通“查询XXX数据”默认取齐指定条件和粒度下的结果;`limit`控制单次批量,满批且无结束证据时继续分页。明确TopN/前N条/样本时按指定范围停止。数据默认直接展示,文件按需交付;不能将首批或预览称为全部,执行受容量或耗时限制时明确说明未完成范围。
## 架构
```
SKILL.md ← 入口(agent 加载)
│
├─ 直接取数 ← 必要元数据 → MQL/SQL → 校验 → 本地分析/交付
│ query-routing.md / data-model-query.md
│
├─ Part 1: Core CLI Workflow ← 骨架,所有 OpenAPI 调用通用
│ Phase 0 惰性预检
│ Phase 1 Discover (smartbi list)
│ Phase 2 Contract (smartbi describe + doc)
│ Phase 3 Execute (smartbi call)
│ Phase 4 Diagnose (失败诊断)
│
├─ Part 2: Scenario Guides(索引) ← 按意图路由,命中后加载对应文件
│
├─ scenarios/ ← 场景文件(每个独立验证)
│ ├─ schedule-task.md S1 定时计划任务
│ ├─ push-message.md S2 消息推送
│ └─ data-query.md 数据查询与洞察
│
└─ references/ ← 参考手册(按需加载)
├─ init.md 安装与配置
├─ profiles.md 多环境(profile)规范
├─ discovery.md Phase 1 详细流程
├─ describe.md Phase 2 详细流程
├─ call.md Phase 3 详细流程
├─ strategy.md 策略与常见模式
├─ rhino-template.md MQL 取数 Rhino JS 模板(共用)
└─ doc-index.md domain → 文档路径索引
```
## 当前能力
| 场景 | 能力 | 状态 |
|------|------|------|
| **直接 MQL 取数** | 字段发现、过滤、聚合、排序、分页及按需计算,本地分析与文件交付 | 按目标环境契约、模型字段和查询结果逐次校验 |
| **通用 OpenAPI 调用** | `smartbi list` → `describe` → `call`,按当前注册接口执行 | 保留原标准流程 |
| **S1 定时计划任务 / S2 推送** | 定时任务、脚本及消息推送指南 | 保留原场景,本轮只读验收不代表写操作已复测 |
| **已有报表取数** | 资源发现、元数据、参数、导出与文件校验 | 按报表类型、有效参数和业务结果逐次校验 |
| **SmartBI AI / Baize** | 按数据查询与洞察场景处理显式请求或复杂洞察 | 按需分支,不是普通直接取数前置 |
> 新场景按具体类型和路径完成端到端验收后才声明支持;已加入的扩展说明须保留未验证边界。
## 依赖
- **npm 包**:`@smartbi/cli >= 2.0.0`(`npm install -g @smartbi/cli@lates_meta.json
{
"ownerId": "kn7bgapafkp5xjwz4xafxyynzx87dnfb",
"slug": "smartbi-cli",
"version": "2.1.0",
"publishedAt": 1790073193891
}references/agent-workflows.md
# Agent workflow export and modification
Resolve `<PYTHON>` to an available Python 3 interpreter and `<SKILL_DIR>` to this Skill's absolute directory. Wrapped POSIX examples show argument grouping; adapt continuation characters to the current shell.
## Capability boundary
The standard `aichat` CLI currently exposes Agent discovery and execution but not the full workflow graph lifecycle. Confirm this with `smartbi list --profile <PROFILE> --domain aichat --agent` in the target installation before using internal APIs.
The following internal SmartBI internal contracts are source-confirmed but not stable public SDK commitments:
| Action | Method and path |
| --- | --- |
| Get Agent | `GET /smartbi/smartbix/api/dataagent/graph/{id}` |
| Search Agent graphs | `POST /smartbi/smartbix/api/dataagent/graphs` |
| Create Agent | `POST /smartbi/smartbix/api/dataagent/graph/create/{parentId}` |
| Update Agent | `POST /smartbi/smartbix/api/dataagent/graph/update` |
| Download definition | `GET /smartbi/smartbix/api/dataagent/define/download/{id}` |
| Upload definition | `POST /smartbi/smartbix/api/dataagent/define/upload` |
The raw workflow ID is used here. Remove only the leading `customagent_` that `queryRpc` adds; do not otherwise transform the ID.
## Authentication
Internal calls require an authenticated SmartBI session with `AI_AGENT` permissions. Put the complete header value in an environment variable supplied through a secure channel, for example:
```bash
export SMARTBI_SESSION_COOKIE='<secret value>'
```
Pass only the environment variable name to the helper:
```bash
--header-env Cookie=SMARTBI_SESSION_COOKIE
```
Never place the value in command history, request JSON, source control, or logs.
## Export
```bash
<PYTHON> <SKILL_DIR>/scripts/smartbi_internal.py \
--base-url <BASE_URL> \
--header-env Cookie=SMARTBI_SESSION_COOKIE \
agent-get \
--agent-id <RAW_AGENT_ID> \
--output <EXPORTED_AGENT_JSON>
```
The command reports the graph SHA-256 and node/link counts without printing the full definition.
## Modify safely
Start from the exported object. Preserve every unknown graph field. Change only the required nodes, ports, links, prompts, or settings. Before applying:
- parse `define` as JSON;
- verify every link source/target node exists;
- verify referenced input/output port IDs exist on the corresponding nodes;
- keep node IDs stable unless a new node is genuinely required;
- give each new node and port a collision-free ID;
- ensure finish nodes do not wait for mutually exclusive branches;
- do not put secrets into prompts, node inputs, or settings.
First run a dry-run:
```bash
<PYTHON> <SKILL_DIR>/scripts/smartbi_internal.py \
--base-url <BASE_URL> \
--header-env Cookie=SMARTBI_SESSION_COOKIE \
agent-update \
--agent-id <RAW_AGENT_ID> \
--file <CANDIDATE_OR_PATCH_JSON> \
--backup-dir <BACKUP_DIR>
```
Review `changed_fields`, node/link counts, and `current_sha256`. Apply exactly once using that hash:
```bash
<PYreferences/artifact-handling.md
# Artifact Handling Baize file artifacts are server URIs, not local paths. Inspect the captured SSE stream with `scripts/artifact_io.py`, download artifacts through the configured SmartBI profile, then read and verify the resulting Excel, CSV, or Parquet file. Do not treat a preview table as a complete extract or expose signed URLs. The same reader can inspect downloaded direct-query files. CSV values stay as text, including leading zeros, decimal text and literal `NA`/`NULL`; blank cells remain empty strings. Excel preserves stored cell types, and Parquet uses its schema. Convert numeric measures explicitly from model metadata before calculating; identifier columns must retain their original values. CSV alone cannot distinguish an empty string from an exported null, and Excel number formatting may display zeros that are absent from its stored numeric value. Do not invent missing identifier digits or null semantics.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/wahsonleung/skills/smartbi-cli",
"sourceUrl": "https://clawhub.ai/wahsonleung/skills/smartbi-cli",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T17:15:05.623Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-wahsonleung-smartbi-cli/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-wahsonleung-smartbi-cli/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T17:15:05.623Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.3K downloads",
"href": "https://clawhub.ai/wahsonleung/smartbi-cli",
"sourceUrl": "https://clawhub.ai/wahsonleung/smartbi-cli",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T17:15:05.623Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "2.1.0",
"href": "https://clawhub.ai/wahsonleung/smartbi-cli",
"sourceUrl": "https://clawhub.ai/wahsonleung/smartbi-cli",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-09-22T10:33:13.891Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-wahsonleung-smartbi-cli/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-wahsonleung-smartbi-cli/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 2.1.0",
"description": "**Major update with expanded scenario support and improved agent integration.** - Data query and insight scenarios now have dedicated guides and workflow overrides (`scenarios/data-query.md`), supporting direct, multi-step query/insight calls. - Added comprehensive reference docs for agents, custom tools, artifact handling, agent workflows, data/metric model queries, report queries, troubleshooting, and more. - Improved environment and credential selection: new logic for experience center entry, explicit address/user flow, non-intrusive profile management. - More robust request body file handling (system temp directory, Windows path fallback, enforced clean-up/clarity) and safer credential use (supports environment variable and system keyring with secure handling). - Enhanced agent workflow, agent export/import, and toolkit extension guidance via new reference docs and scripts. - Removed unused or outdated documentation (`skill-card.md`) for better maintainability.",
"href": "https://clawhub.ai/wahsonleung/smartbi-cli",
"sourceUrl": "https://clawhub.ai/wahsonleung/smartbi-cli",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-09-22T10:33:13.891Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
