@zleap-ai/sag-cli 0.5.0 → 0.6.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.en.md +41 -9
- package/README.md +31 -9
- package/dist/cli.js +2906 -330
- package/dist/cli.js.map +1 -1
- package/dist/sag-knowledge.zip +0 -0
- package/dist/skill-cli.cjs +172 -0
- package/package.json +2 -2
- package/skill/SKILL.md +48 -46
- package/skill/manifest.json +8 -0
- package/skill/references/citation-rules.md +5 -83
- package/skill/references/cli-reference.md +31 -205
- package/skill/references/ndjson-contract.md +38 -0
- package/skill/references/safety.md +17 -0
- package/skill/references/search-strategies.md +5 -71
- package/skill/scripts/sag-knowledge.cjs +172 -0
- package/skills/sag-mcp/SKILL.md +4 -0
package/README.en.md
CHANGED
|
@@ -38,7 +38,7 @@ sag version
|
|
|
38
38
|
|
|
39
39
|
## Quick start: pick the path that fits you
|
|
40
40
|
|
|
41
|
-
The CLI offers
|
|
41
|
+
The CLI offers three independent paths. Pick one based on your situation.
|
|
42
42
|
|
|
43
43
|
### Path A: Local Docker, no token required (recommended for local dev)
|
|
44
44
|
|
|
@@ -129,19 +129,48 @@ Add `--dry-run` to preview changes. Use `sag mcp detach <agent>` to remove an Ag
|
|
|
129
129
|
|
|
130
130
|
## Use with the Skill
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
`sag-knowledge` ships in this package. Install it for an explicit Agent target;
|
|
133
|
+
an explicit target is useful in automation even when its host cannot be
|
|
134
|
+
auto-detected:
|
|
133
135
|
|
|
134
136
|
```bash
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
sag skill install --origin https://sag.example.com --agent codex --yes --output ndjson
|
|
138
|
+
sag skill status --agent codex --output ndjson
|
|
139
|
+
sag skill update --agent codex --yes --output ndjson
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`update` resolves a newly downloaded `@zleap-ai/sag-cli@latest` bundle; it does
|
|
143
|
+
not silently reuse the running or cached bundle. `--yes` only skips the local
|
|
144
|
+
install/update/remove confirmation. It never bypasses browser approval, drift
|
|
145
|
+
checks, or conflict checks.
|
|
146
|
+
|
|
147
|
+
Installation only copies the verified bundle and is not authorization.
|
|
148
|
+
`--origin` saves the enterprise SAG address in shared `~/.sag/config.json`.
|
|
149
|
+
A manually installed ZIP asks for the full HTTP or HTTPS address on first use.
|
|
150
|
+
Authorization covers the current SAG account, not an Agent, device, capability
|
|
151
|
+
set, or one Knowledge Base:
|
|
138
152
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
```bash
|
|
154
|
+
sag skill auth login --origin https://sag.example.com --output ndjson
|
|
155
|
+
sag skill auth status --origin https://sag.example.com --output ndjson
|
|
156
|
+
sag skill auth logout --origin https://sag.example.com --output ndjson
|
|
142
157
|
```
|
|
143
158
|
|
|
144
|
-
|
|
159
|
+
The browser asks only to allow or deny. The CLI stores and refreshes the account
|
|
160
|
+
session as plaintext JSON but never emits credentials. Machine-readable output
|
|
161
|
+
uses NDJSON v1 (`sag.skill.ndjson.v1`), one JSON event per stdout line.
|
|
162
|
+
|
|
163
|
+
`sag skill knowledge` lists Knowledge Bases and documents, asks globally or in
|
|
164
|
+
one Knowledge Base, uploads one file with progress, renames, and soft-deletes.
|
|
165
|
+
Global questions omit the Knowledge Base identifier and use SAG's current
|
|
166
|
+
strategy. Writes require an exact ID, alias, or unique name. Upload accepts one
|
|
167
|
+
regular file with an effective limit of at most 25 MiB, never a folder or batch.
|
|
168
|
+
|
|
169
|
+
Enterprise MCP uses the separate, compatible `skills/sag-mcp` Skill;
|
|
170
|
+
`sag-knowledge` uses the account Knowledge API. The two integration paths are
|
|
171
|
+
independent, and installing either one does not remove or rewrite the other.
|
|
172
|
+
Only selected, successfully attached Agents get the default `sag-mcp` Skill. With no Agent selected, connect saves only the connection and installs no Skill.
|
|
173
|
+
You can also manage it directly:
|
|
145
174
|
|
|
146
175
|
```bash
|
|
147
176
|
sag mcp skill install --agent claude-code
|
|
@@ -160,6 +189,9 @@ sag source list | get | status
|
|
|
160
189
|
sag document list | get | status
|
|
161
190
|
sag search <query>
|
|
162
191
|
sag mcp test
|
|
192
|
+
sag skill install | status | update | uninstall
|
|
193
|
+
sag skill auth login | status | logout
|
|
194
|
+
sag skill knowledge list | documents | ask | upload | upload-status | rename | delete
|
|
163
195
|
sag agent list
|
|
164
196
|
sag agent connect <codex | claude-code>
|
|
165
197
|
sag agent status [codex | claude-code]
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ sag version
|
|
|
38
38
|
|
|
39
39
|
## 快速上手:选一条适合你的路径
|
|
40
40
|
|
|
41
|
-
CLI
|
|
41
|
+
CLI 提供三条互相独立的路径,按你的场景选。
|
|
42
42
|
|
|
43
43
|
### 路径 A:本机 Docker,免 Token(推荐给本地开发者)
|
|
44
44
|
|
|
@@ -129,19 +129,38 @@ sag mcp status
|
|
|
129
129
|
|
|
130
130
|
## 搭配 Skill 使用
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
`sag-knowledge` 随本包发布。可显式指定 Agent 安装;即使自动探测不到宿主,这也适合自动化场景:
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
sag skill install --origin https://sag.example.com --agent codex --yes --output ndjson
|
|
136
|
+
sag skill status --agent codex --output ndjson
|
|
137
|
+
sag skill update --agent codex --yes --output ndjson
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`update` 会新下载并解析 `@zleap-ai/sag-cli@latest`,不会静默复用当前运行中或缓存中的
|
|
141
|
+
Bundle。`--yes` 只跳过本地安装、更新、删除确认;不会跳过浏览器授权、漂移检查或冲突检查。
|
|
142
|
+
|
|
143
|
+
安装只复制已校验 Bundle,**不等于已授权**。`--origin` 会把企业 SAG 地址保存到共享的
|
|
144
|
+
`~/.sag/config.json`;手动安装 ZIP 时,Agent 会在首次使用时询问完整的 HTTP/HTTPS 地址。
|
|
145
|
+
授权使用当前 SAG 登录账号,不绑定 Agent、设备、能力集合或单个知识库:
|
|
138
146
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
```bash
|
|
148
|
+
sag skill auth login --origin https://sag.example.com --output ndjson
|
|
149
|
+
sag skill auth status --origin https://sag.example.com --output ndjson
|
|
150
|
+
sag skill auth logout --origin https://sag.example.com --output ndjson
|
|
142
151
|
```
|
|
143
152
|
|
|
144
|
-
|
|
153
|
+
浏览器页面只要求用户允许或拒绝;CLI 把账号会话以明文 JSON 保存并自动刷新,不在输出中
|
|
154
|
+
展示凭据。供程序读取的 Skill 输出为 NDJSON v1(`sag.skill.ndjson.v1`),stdout 每行一个
|
|
155
|
+
JSON event。
|
|
156
|
+
|
|
157
|
+
`sag skill knowledge` 提供知识库列表、文档列表、全局/指定知识库问答、单文件上传与进度、
|
|
158
|
+
重命名和软删除。全局问答不传知识库标识,沿用 SAG 当前检索策略。写操作要求精确的知识库
|
|
159
|
+
ID、alias 或唯一名称。上传只接受一个普通文件,有效上限不超过 25 MiB;不支持文件夹或批量。
|
|
160
|
+
|
|
161
|
+
企业 MCP 使用独立且兼容的 `skills/sag-mcp` Skill;`sag-knowledge` 使用账号级知识库
|
|
162
|
+
接口。两种接入方式彼此独立,安装其中一种不会移除或改写另一种。
|
|
163
|
+
仅为本次成功接入的所选 Agent 默认安装 `sag-mcp` Skill;不选 Agent 时只保存连接,不安装 Skill。也可以单独管理:
|
|
145
164
|
|
|
146
165
|
```bash
|
|
147
166
|
sag mcp skill install --agent claude-code
|
|
@@ -160,6 +179,9 @@ sag source list | get | status
|
|
|
160
179
|
sag document list | get | status
|
|
161
180
|
sag search <query>
|
|
162
181
|
sag mcp test
|
|
182
|
+
sag skill install | status | update | uninstall
|
|
183
|
+
sag skill auth login | status | logout
|
|
184
|
+
sag skill knowledge list | documents | ask | upload | upload-status | rename | delete
|
|
163
185
|
sag agent list
|
|
164
186
|
sag agent connect <codex | claude-code>
|
|
165
187
|
sag agent status [codex | claude-code]
|