kweaver-core
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKWeaver CLI
KWeaver CLI
KWeaver 平台的命令行工具,覆盖认证、平台业务域()、知识网络管理与查询、Agent CRUD 与对话、数据源管理。
configCommand-line tool for the KWeaver platform, covering authentication, platform business domain (), knowledge network management and query, Agent CRUD and conversation, data source management.
config安装
Installation
bash
npm install -g @kweaver-ai/kweaver-sdk需 Node.js 22+。也可用 临时运行。
npx kweaverbash
npm install -g @kweaver-ai/kweaver-sdkRequires Node.js 22+. You can also run it temporarily with .
npx kweaver使用方式
Usage
bash
kweaver [--user <userId|username>] <command> [subcommand] [options]完整子命令与参数以当前安装的 CLI 为准:运行 (或 )查看与代码同步的用法列表;查版本用 / / 。子命令细节用 (例如 、)。
kweaver --help-hkweaver --version-Vkweaver versionkweaver <group> <subcommand> --helpkweaver auth --helpkweaver bkn push --help本 skill 下的 与 CLI 行为对齐;表格与 reference 为速查,新增标志(如 的 、BKN / 的编码选项)在 reference 中有说明。
references/*.mdauth--aliasvalidatepush别名: 等同于 ; 等同于 。
kweaver curlkweaver callkweaver contextkweaver context-loader业务域(business domain):多数请求依赖 。 后应优先执行 ;列表为空时用 查看平台可选域,再 。详见 。
x-business-domainkweaver auth loginkweaver config showconfig list-bdconfig set-bd <uuid>references/config.mdbash
kweaver [--user <userId|username>] <command> [subcommand] [options]Complete subcommands and parameters are subject to the currently installed CLI: Run (or ) to view the usage list synchronized with the code; check the version with / / . For details of subcommands, use (e.g., , ).
kweaver --help-hkweaver --version-Vkweaver versionkweaver <group> <subcommand> --helpkweaver auth --helpkweaver bkn push --helpThe files under this skill align with CLI behaviors; tables and references are quick references, and new flags (such as for , encoding options for BKN /) are explained in the references.
references/*.md--aliasauthvalidatepushAliases: is equivalent to ; is equivalent to .
kweaver curlkweaver callkweaver contextkweaver context-loaderBusiness domain: Most requests depend on . After , you should first execute ; if the list is empty, use to view optional domains on the platform, then . See for details.
x-business-domainkweaver auth loginkweaver config showconfig list-bdconfig set-bd <uuid>references/config.md使用前提
Prerequisites
认证凭据通过 管理。默认操作:在存在 时,用 OAuth2 授权换发新的 (过期或临近过期时自动执行,无需额外参数)。禁止提前检查环境变量,禁止询问用户提供密码或 Token。
~/.kweaver/refresh_tokenrefresh_tokenaccess_tokenAuthentication credentials are managed via . Default behavior: When a exists, use OAuth2 authorization to obtain a new (automatically executed when expired or nearly expired, no additional parameters required). Prohibited to check environment variables in advance, prohibited to ask users for passwords or Tokens.
~/.kweaver/refresh_tokenrefresh_tokenaccess_token认证优先级
Authentication Priority
- +
KWEAVER_TOKEN环境变量 → 静态 Token(如存在则优先使用,不会用 refresh 换发)KWEAVER_BASE_URL - 凭据(
~/.kweaver/写入)→ 默认用 refresh_token 换发 access_token(推荐)kweaver auth login - 环境变量(或全局
KWEAVER_USER参数)→ 使用指定用户的凭证,不切换活跃用户--user
- +
KWEAVER_TOKENenvironment variables → Static Token (used preferentially if present, will not use refresh to obtain a new token)KWEAVER_BASE_URL - Credentials in (written by
~/.kweaver/) → Default use refresh_token to obtain access_token (recommended)kweaver auth login - environment variable (or global
KWEAVER_USERparameter) → Use credentials of the specified user, do not switch active users--user
业务域优先级(与认证独立)
Business Domain Priority (Independent of Authentication)
- 环境变量
KWEAVER_BUSINESS_DOMAIN - 当前平台 中的
config.json(businessDomain)kweaver config set-bd - 默认 (首次登录后 CLI 可能已自动写入更合适的值)
bd_public
- environment variable
KWEAVER_BUSINESS_DOMAIN - in the current platform's
businessDomain(set viaconfig.json)kweaver config set-bd - Default (the CLI may have automatically written a more appropriate value after the first login)
bd_public
命令组总览
Command Group Overview
| 命令组 | 说明 | 常用命令 | 详细参考 |
|---|---|---|---|
| 认证管理(支持多账号) | | |
| 打印当前 access token(自动刷新) | | — |
| 平台业务域(优先于多数 bkn/agent/ds 操作) | | |
| BKN 知识网络管理、Schema、查询、Action | | |
| Agent CRUD、发布、对话、Trace、模板、分类 | | |
| 数据源管理 | | |
| 数据视图(mdl-data-model / vega-backend) | | |
| Dataflow 文档流程 | | |
| Skill 注册、市场查找、渐进式读取、下载与安装 | | |
| 平台工具箱(toolbox)管理 | | |
| 工具箱内 tool 注册与启停(OpenAPI) | | |
| Vega 可观测平台 | | |
| MCP 分层检索 | | |
| 通用 API 调用 | | |
| Command Group | Description | Common Commands | Detailed Reference |
|---|---|---|---|
| Authentication management (supports multiple accounts) | | |
| Print current access token (auto-refreshed) | | — |
| Platform business domain (prioritized over most bkn/agent/ds operations) | | |
| BKN knowledge network management, Schema, query, Action | | |
| Agent CRUD, publish, conversation, Trace, templates, categories | | |
| Data source management | | |
| Data view (mdl-data-model / vega-backend) | | |
| Dataflow document processes | | |
| Skill registration, market search, progressive reading, download and installation | | |
| Platform toolbox management | | |
| Tool registration, start and stop in toolbox (OpenAPI) | | |
| Vega observability platform | | |
| MCP hierarchical retrieval | | |
| General API call | | |
操作指南
Operation Guide
| 场景 | 说明 | 详细参考 |
|---|---|---|
| 登录后确认业务域 | | references/config.md |
| 从数据库/CSV 构建 KN | 连接数据源 → CSV 导入 → 创建 KN → 构建索引 → 查询验证 → 绑定 Agent | references/build-kn-from-db.md |
| CLI 排障速查 | 权限、pull、build、import、dataview SQL 等 | references/troubleshooting.md |
| 列/查数据视图 | | references/dataview.md |
| 管理 Dataflow 文档流程 | | references/dataflow.md |
| Trace 数据分析 | | — |
| 管理 Skill | | references/skill.md |
| 注册外部工具 | | references/toolbox.md · references/tool.md |
按需阅读:需要子命令完整参数或编排示例时,读取对应的 reference 文件。
| Scenario | Description | Detailed Reference |
|---|---|---|
| Confirm business domain after login | | references/config.md |
| Build KN from database/CSV | Connect data source → Import CSV → Create KN → Build index → Query verification → Bind Agent | references/build-kn-from-db.md |
| CLI troubleshooting quick reference | Permissions, pull, build, import, dataview SQL, etc. | references/troubleshooting.md |
| List/query data views | | references/dataview.md |
| Manage Dataflow document processes | | references/dataflow.md |
| Trace data analysis | | — |
| Manage Skill | | references/skill.md |
| Register external tools | | references/toolbox.md · references/tool.md |
Read on demand: When you need complete parameters of subcommands or orchestration examples, read the corresponding reference files.
调用示例
Call Examples
/kweaver-core 列出所有知识网络
/kweaver-core 查看 Vega 健康状况
/kweaver-core 有哪些 Agent
/kweaver-core 跟 Agent xxx 对话,问他"今天库存情况"
/kweaver-core 搜索知识网络 xxx 中关于"供应链"的内容
/kweaver-core 用 dataview find 模糊搜索名字含 BOM 的数据视图
/kweaver-core 列出所有 dataflow
/kweaver-core 触发 dataflow 123,上传本地文件 ./demo.pdf
/kweaver-core 查看 dataflow 123 在 2026-04-01 的运行记录
/kweaver-core 查看 dataflow 123 的实例 456 日志,并展开 input output
/kweaver-core 列出所有 Agent 模板
/kweaver-core 基于 "数据分析助手" 模板创建一个新的 Agent
/kweaver-core 在 skill market 里查找名字包含 kweaver 的 skill
/kweaver-core 读取 skill xxx 的 SKILL.md 并保存到本地目录
/kweaver-core 创建一个名为 weather-svc 的 toolbox,对接 https://weather.example.com
/kweaver-core 把 ./openapi.json 上传到 toolbox 1234567890 并启用所有工具,最后发布/kweaver-core List all knowledge networks
/kweaver-core Check Vega health status
/kweaver-core What Agents are there
/kweaver-core Converse with Agent xxx and ask "Today's inventory status"
/kweaver-core Search for content about "supply chain" in knowledge network xxx
/kweaver-core Use dataview find to fuzzy search data views whose names contain BOM
/kweaver-core List all dataflows
/kweaver-core Trigger dataflow 123 and upload local file ./demo.pdf
/kweaver-core View run records of dataflow 123 on 2026-04-01
/kweaver-core View logs of instance 456 of dataflow 123 and expand input output
/kweaver-core List all Agent templates
/kweaver-core Create a new Agent based on the "Data Analysis Assistant" template
/kweaver-core Search for skills containing kweaver in the skill market
/kweaver-core Read SKILL.md of skill xxx and save it to local directory
/kweaver-core Create a toolbox named weather-svc connected to https://weather.example.com
/kweaver-core Upload ./openapi.json to toolbox 1234567890, enable all tools, and finally publish注意事项
Notes
- 不要自行猜测 business_domain 值。首次使用时运行 或
kweaver config show确认当前 business domain。如果返回kweaver config list-bd但命令结果为空,可能需要用bd_public (default)设置正确的值(也可用kweaver config set-bd <uuid>从平台列出后再config list-bd,或从平台 UI 请求头中获取set-bd)X-Business-Domain - Action 执行有副作用,执行前向用户确认
- 禁止运行 做预检。直接执行目标命令,CLI 会自动处理认证和 token 刷新
kweaver auth status - Token 1 小时过期。当 中存在
~/.kweaver/(通过 OAuth2 登录获得)时,CLI 会自动刷新;遇到 401 错误时 CLI 会自动尝试刷新,刷新失败才提示用户重新运行refresh_tokenkweaver auth login <url>
- Do not guess business_domain values. When using for the first time, run or
kweaver config showto confirm the current business domain. If it returnskweaver config list-bdbut the command result is empty, you may need to usebd_public (default)to set the correct value (you can also list from the platform withkweaver config set-bd <uuid>thenconfig list-bd, or getset-bdfrom the platform UI request header)X-Business-Domain - Action execution has side effects, confirm with users before execution
- Prohibited to run for pre-check. Execute the target command directly, and the CLI will automatically handle authentication and token refresh
kweaver auth status - Token expires in 1 hour. When a exists in
refresh_token(obtained via OAuth2 login), the CLI will automatically refresh; when encountering a 401 error, the CLI will automatically attempt to refresh, and only prompt the user to re-run~/.kweaver/if the refresh failskweaver auth login <url>
查询策略(object-type query)
Query Strategy (object-type query)
调用 时必须限制 、用 分页、用 过滤,避免宽表 JSON 截断。完整规则与示例见 。
object-type querylimitsearch_afterconditionreferences/bkn.mdWhen calling , you must limit , use for pagination, and use for filtering to avoid wide table JSON truncation. Complete rules and examples can be found in .
object-type querylimitsearch_afterconditionreferences/bkn.md