chainlesschain 0.43.2 → 0.44.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.md +123 -18
- package/bin/chainlesschain.js +0 -0
- package/package.json +4 -2
- package/src/commands/init.js +2306 -1
- package/src/commands/skill.js +166 -0
- package/src/lib/skill-loader.js +4 -0
- package/src/lib/skill-packs/generator.js +630 -0
- package/src/lib/skill-packs/schema.js +462 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Command Skill Pack — Domain Schema
|
|
3
|
+
*
|
|
4
|
+
* Defines the 9 domain packs that wrap CLI commands as agent-callable skills.
|
|
5
|
+
* Each pack groups related commands by functional domain.
|
|
6
|
+
*
|
|
7
|
+
* execution-mode values:
|
|
8
|
+
* direct — spawnSync execution, no LLM required
|
|
9
|
+
* llm-query — single-shot LLM call, non-interactive
|
|
10
|
+
* agent — requires interactive REPL (cannot be spawnSync'd)
|
|
11
|
+
* hybrid — mix of direct + optional LLM
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const CLI_PACK_DOMAINS = {
|
|
15
|
+
"cli-knowledge-pack": {
|
|
16
|
+
displayName: "知识管理技能包",
|
|
17
|
+
description:
|
|
18
|
+
"笔记增删改查、全文混合搜索(BM25+向量)、Markdown/PDF/Evernote导入导出、Git集成、Token用量、会话管理",
|
|
19
|
+
executionMode: "direct",
|
|
20
|
+
category: "cli-direct",
|
|
21
|
+
tags: ["note", "search", "import", "export", "git", "knowledge", "memory"],
|
|
22
|
+
commands: {
|
|
23
|
+
note: {
|
|
24
|
+
description: "笔记管理",
|
|
25
|
+
subcommands: ["add", "list", "show", "search", "delete", "export"],
|
|
26
|
+
example: 'note add "标题" -c "内容" -t "标签1,标签2"',
|
|
27
|
+
},
|
|
28
|
+
search: {
|
|
29
|
+
description: "全文混合搜索 (BM25 + 向量)",
|
|
30
|
+
example: 'search "关键词"',
|
|
31
|
+
},
|
|
32
|
+
import: {
|
|
33
|
+
description: "导入内容 (markdown目录/pdf文件/evernote备份)",
|
|
34
|
+
example: "import markdown ./docs",
|
|
35
|
+
},
|
|
36
|
+
export: {
|
|
37
|
+
description: "导出笔记为静态网站或ZIP",
|
|
38
|
+
example: "export site -o ./output",
|
|
39
|
+
},
|
|
40
|
+
git: {
|
|
41
|
+
description: "Git集成 (状态查看/自动提交)",
|
|
42
|
+
example: "git status",
|
|
43
|
+
},
|
|
44
|
+
tokens: {
|
|
45
|
+
description: "Token用量追踪与统计",
|
|
46
|
+
example: "tokens show",
|
|
47
|
+
},
|
|
48
|
+
memory: {
|
|
49
|
+
description: "持久化记忆管理",
|
|
50
|
+
example: 'memory add "需要记住的内容"',
|
|
51
|
+
},
|
|
52
|
+
session: {
|
|
53
|
+
description: "会话列表管理",
|
|
54
|
+
example: "session list",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
"cli-identity-pack": {
|
|
60
|
+
displayName: "身份安全技能包",
|
|
61
|
+
description:
|
|
62
|
+
"DID去中心化身份(Ed25519)、AES-256-GCM文件加密解密、RBAC权限检查、审计日志",
|
|
63
|
+
executionMode: "direct",
|
|
64
|
+
category: "cli-direct",
|
|
65
|
+
tags: ["did", "encrypt", "auth", "audit", "identity", "security", "crypto"],
|
|
66
|
+
commands: {
|
|
67
|
+
did: {
|
|
68
|
+
description: "DID去中心化身份管理",
|
|
69
|
+
subcommands: [
|
|
70
|
+
"create",
|
|
71
|
+
"show",
|
|
72
|
+
"list",
|
|
73
|
+
"sign",
|
|
74
|
+
"verify",
|
|
75
|
+
"export",
|
|
76
|
+
"delete",
|
|
77
|
+
"set-default",
|
|
78
|
+
],
|
|
79
|
+
example: "did create",
|
|
80
|
+
},
|
|
81
|
+
encrypt: {
|
|
82
|
+
description: "AES-256-GCM文件加密",
|
|
83
|
+
example: "encrypt file secret.txt",
|
|
84
|
+
},
|
|
85
|
+
decrypt: {
|
|
86
|
+
description: "解密加密文件",
|
|
87
|
+
example: "decrypt file secret.txt.enc",
|
|
88
|
+
},
|
|
89
|
+
auth: {
|
|
90
|
+
description: "RBAC权限角色与检查",
|
|
91
|
+
subcommands: ["roles", "check"],
|
|
92
|
+
example: 'auth check user1 "note:read"',
|
|
93
|
+
},
|
|
94
|
+
audit: {
|
|
95
|
+
description: "审计日志查看与统计",
|
|
96
|
+
subcommands: ["log", "stats"],
|
|
97
|
+
example: "audit log",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
"cli-infra-pack": {
|
|
103
|
+
displayName: "基础设施技能包",
|
|
104
|
+
description:
|
|
105
|
+
"系统启停、数据库生命周期管理、配置管理、Docker服务编排、环境诊断、版本更新",
|
|
106
|
+
executionMode: "direct",
|
|
107
|
+
category: "cli-direct",
|
|
108
|
+
tags: ["db", "config", "docker", "infra", "system", "setup", "doctor"],
|
|
109
|
+
commands: {
|
|
110
|
+
setup: {
|
|
111
|
+
description: "交互式安装向导",
|
|
112
|
+
example: "setup",
|
|
113
|
+
},
|
|
114
|
+
start: {
|
|
115
|
+
description: "启动桌面应用",
|
|
116
|
+
example: "start",
|
|
117
|
+
},
|
|
118
|
+
stop: {
|
|
119
|
+
description: "停止应用",
|
|
120
|
+
example: "stop",
|
|
121
|
+
},
|
|
122
|
+
status: {
|
|
123
|
+
description: "查看系统运行状态",
|
|
124
|
+
example: "status",
|
|
125
|
+
},
|
|
126
|
+
services: {
|
|
127
|
+
description: "Docker服务管理",
|
|
128
|
+
subcommands: ["up", "down", "logs", "ps"],
|
|
129
|
+
example: "services up",
|
|
130
|
+
},
|
|
131
|
+
config: {
|
|
132
|
+
description: "配置项管理",
|
|
133
|
+
subcommands: ["list", "get", "set", "reset"],
|
|
134
|
+
example: "config list",
|
|
135
|
+
},
|
|
136
|
+
update: {
|
|
137
|
+
description: "检查并更新CLI版本",
|
|
138
|
+
example: "update",
|
|
139
|
+
},
|
|
140
|
+
doctor: {
|
|
141
|
+
description: "诊断运行环境 (Node/Docker/Ollama等)",
|
|
142
|
+
example: "doctor",
|
|
143
|
+
},
|
|
144
|
+
db: {
|
|
145
|
+
description: "数据库生命周期管理",
|
|
146
|
+
subcommands: ["init", "info", "backup", "restore", "migrate"],
|
|
147
|
+
example: "db info",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
"cli-ai-query-pack": {
|
|
153
|
+
displayName: "AI查询技能包",
|
|
154
|
+
description:
|
|
155
|
+
"单次LLM问答、LLM提供商管理(10+)、偏好学习、多视角代码评审、A/B方案对比、代码分析",
|
|
156
|
+
executionMode: "llm-query",
|
|
157
|
+
category: "cli-direct",
|
|
158
|
+
tags: ["ask", "llm", "cowork", "ai", "query", "instinct"],
|
|
159
|
+
commands: {
|
|
160
|
+
ask: {
|
|
161
|
+
description: "单次AI问答 (非交互式,支持10+提供商)",
|
|
162
|
+
example: 'ask "如何优化这段代码?"',
|
|
163
|
+
},
|
|
164
|
+
llm: {
|
|
165
|
+
description: "LLM提供商管理",
|
|
166
|
+
subcommands: ["models", "test", "providers", "add-provider", "switch"],
|
|
167
|
+
example: "llm models",
|
|
168
|
+
},
|
|
169
|
+
instinct: {
|
|
170
|
+
description: "偏好学习与行为建议",
|
|
171
|
+
subcommands: ["show", "learn", "reset"],
|
|
172
|
+
example: "instinct show",
|
|
173
|
+
},
|
|
174
|
+
cowork: {
|
|
175
|
+
description: "多视角AI协作分析",
|
|
176
|
+
subcommands: ["debate", "compare", "analyze", "status"],
|
|
177
|
+
example: "cowork debate src/main.js",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
"cli-agent-mode-pack": {
|
|
183
|
+
displayName: "Agent模式技能包",
|
|
184
|
+
description:
|
|
185
|
+
"交互式AI对话(流式输出)、全工具访问的Agent会话(文件读写/命令执行/138技能)。注意:此类指令需要在终端中直接运行,无法被子进程调用。",
|
|
186
|
+
executionMode: "agent",
|
|
187
|
+
category: "cli-agent",
|
|
188
|
+
tags: ["agent", "chat", "interactive", "repl", "session"],
|
|
189
|
+
commands: {
|
|
190
|
+
chat: {
|
|
191
|
+
description: "交互式AI多轮对话 (流式输出,支持会话恢复)",
|
|
192
|
+
example: "chat --provider ollama --model qwen2:7b",
|
|
193
|
+
isAgentMode: false,
|
|
194
|
+
},
|
|
195
|
+
agent: {
|
|
196
|
+
description:
|
|
197
|
+
"Agent会话 (完整工具访问: 文件读写/命令执行/138技能/Plan Mode)",
|
|
198
|
+
example: "agent --session <id>",
|
|
199
|
+
isAgentMode: true,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
"cli-web3-pack": {
|
|
205
|
+
displayName: "Web3与社交技能包",
|
|
206
|
+
description:
|
|
207
|
+
"P2P加密通讯、数字资产钱包、组织协作管理、DAO治理(二次方投票)、Agent微支付、去中心化社交、Nostr/Matrix桥接",
|
|
208
|
+
executionMode: "direct",
|
|
209
|
+
category: "cli-direct",
|
|
210
|
+
tags: ["p2p", "wallet", "dao", "web3", "social", "blockchain", "nostr"],
|
|
211
|
+
commands: {
|
|
212
|
+
p2p: {
|
|
213
|
+
description: "P2P点对点加密通讯管理",
|
|
214
|
+
subcommands: ["peers", "send", "pair"],
|
|
215
|
+
example: 'p2p send <peer> "消息"',
|
|
216
|
+
},
|
|
217
|
+
sync: {
|
|
218
|
+
description: "跨设备数据同步",
|
|
219
|
+
subcommands: ["status", "push", "pull"],
|
|
220
|
+
example: "sync status",
|
|
221
|
+
},
|
|
222
|
+
wallet: {
|
|
223
|
+
description: "数字资产钱包管理",
|
|
224
|
+
subcommands: ["create", "assets", "transfer"],
|
|
225
|
+
example: 'wallet create --name "主钱包"',
|
|
226
|
+
},
|
|
227
|
+
org: {
|
|
228
|
+
description: "组织管理与成员协作",
|
|
229
|
+
subcommands: ["create", "invite", "approve"],
|
|
230
|
+
example: 'org create "Acme Corp"',
|
|
231
|
+
},
|
|
232
|
+
dao: {
|
|
233
|
+
description: "DAO治理提案与投票 (二次方投票)",
|
|
234
|
+
subcommands: [
|
|
235
|
+
"propose",
|
|
236
|
+
"vote",
|
|
237
|
+
"delegate",
|
|
238
|
+
"execute",
|
|
239
|
+
"treasury",
|
|
240
|
+
"stats",
|
|
241
|
+
],
|
|
242
|
+
example: "dao propose '提案标题'",
|
|
243
|
+
},
|
|
244
|
+
economy: {
|
|
245
|
+
description: "Agent微支付与贡献NFT",
|
|
246
|
+
subcommands: ["pay", "market", "nft"],
|
|
247
|
+
example: "economy market list",
|
|
248
|
+
},
|
|
249
|
+
nostr: {
|
|
250
|
+
description: "Nostr协议中继与事件发布",
|
|
251
|
+
subcommands: ["relays", "publish", "keygen", "map-did"],
|
|
252
|
+
example: 'nostr publish "Hello World"',
|
|
253
|
+
},
|
|
254
|
+
matrix: {
|
|
255
|
+
description: "Matrix聊天桥接",
|
|
256
|
+
subcommands: ["login", "rooms", "send"],
|
|
257
|
+
example: 'matrix send <room> "消息"',
|
|
258
|
+
},
|
|
259
|
+
social: {
|
|
260
|
+
description: "去中心化社交网络管理",
|
|
261
|
+
subcommands: ["contact", "friend", "post", "chat", "stats"],
|
|
262
|
+
example: 'social post publish "帖子内容"',
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
"cli-security-pack": {
|
|
268
|
+
displayName: "安全合规技能包",
|
|
269
|
+
description:
|
|
270
|
+
"GDPR/HIPAA/SOC2合规证据、DLP数据防泄漏、SIEM日志导出、后量子密码学(ML-KEM)、ZKP零知识证明、沙箱执行、安全基线",
|
|
271
|
+
executionMode: "direct",
|
|
272
|
+
category: "cli-direct",
|
|
273
|
+
tags: [
|
|
274
|
+
"compliance",
|
|
275
|
+
"security",
|
|
276
|
+
"dlp",
|
|
277
|
+
"siem",
|
|
278
|
+
"pqc",
|
|
279
|
+
"zkp",
|
|
280
|
+
"sandbox",
|
|
281
|
+
"hipaa",
|
|
282
|
+
"gdpr",
|
|
283
|
+
],
|
|
284
|
+
commands: {
|
|
285
|
+
compliance: {
|
|
286
|
+
description: "合规证据收集与报告生成",
|
|
287
|
+
subcommands: ["evidence", "report", "classify", "scan"],
|
|
288
|
+
example: "compliance evidence gdpr",
|
|
289
|
+
},
|
|
290
|
+
dlp: {
|
|
291
|
+
description: "DLP数据防泄漏扫描与策略",
|
|
292
|
+
subcommands: ["scan", "incidents", "policy"],
|
|
293
|
+
example: 'dlp scan "内容文本"',
|
|
294
|
+
},
|
|
295
|
+
siem: {
|
|
296
|
+
description: "SIEM安全信息与事件管理",
|
|
297
|
+
subcommands: ["targets", "add-target", "export"],
|
|
298
|
+
example: "siem targets",
|
|
299
|
+
},
|
|
300
|
+
pqc: {
|
|
301
|
+
description: "后量子密码学密钥管理 (ML-KEM-768)",
|
|
302
|
+
subcommands: ["keys", "generate", "migration-status", "migrate"],
|
|
303
|
+
example: "pqc generate ML-KEM-768",
|
|
304
|
+
},
|
|
305
|
+
zkp: {
|
|
306
|
+
description: "零知识证明电路编译与验证",
|
|
307
|
+
subcommands: ["compile", "prove", "verify"],
|
|
308
|
+
example: "zkp compile --name age-proof",
|
|
309
|
+
},
|
|
310
|
+
sandbox: {
|
|
311
|
+
description: "沙箱创建与安全隔离执行",
|
|
312
|
+
subcommands: ["create", "exec", "audit"],
|
|
313
|
+
example: 'sandbox exec <id> "command"',
|
|
314
|
+
},
|
|
315
|
+
hardening: {
|
|
316
|
+
description: "安全基线采集与回归对比",
|
|
317
|
+
subcommands: ["baseline", "audit"],
|
|
318
|
+
example: 'hardening baseline collect "v1"',
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
"cli-enterprise-pack": {
|
|
324
|
+
displayName: "企业级技能包",
|
|
325
|
+
description:
|
|
326
|
+
"BI商业智能(NL→SQL)、低代码平台、Terraform工作空间、SCIM用户同步、Webhook事件、DAG工作流、Agent间协议、层次化记忆",
|
|
327
|
+
executionMode: "direct",
|
|
328
|
+
category: "cli-direct",
|
|
329
|
+
tags: ["bi", "lowcode", "enterprise", "workflow", "hook", "a2a", "hmemory"],
|
|
330
|
+
commands: {
|
|
331
|
+
bi: {
|
|
332
|
+
description: "BI商业智能查询与仪表盘",
|
|
333
|
+
subcommands: ["query", "dashboard", "anomaly"],
|
|
334
|
+
example: 'bi query "显示月度销售额"',
|
|
335
|
+
},
|
|
336
|
+
lowcode: {
|
|
337
|
+
description: "低代码应用创建与发布",
|
|
338
|
+
subcommands: ["create", "components", "publish"],
|
|
339
|
+
example: 'lowcode create --name "app1"',
|
|
340
|
+
},
|
|
341
|
+
terraform: {
|
|
342
|
+
description: "Terraform工作空间管理",
|
|
343
|
+
subcommands: ["workspaces", "create", "plan"],
|
|
344
|
+
example: 'terraform create "prod"',
|
|
345
|
+
},
|
|
346
|
+
scim: {
|
|
347
|
+
description: "SCIM用户目录同步",
|
|
348
|
+
subcommands: ["users", "sync"],
|
|
349
|
+
example: "scim users list",
|
|
350
|
+
},
|
|
351
|
+
hook: {
|
|
352
|
+
description: "Webhook事件注册与触发",
|
|
353
|
+
subcommands: ["list", "add", "run", "stats"],
|
|
354
|
+
example: "hook list",
|
|
355
|
+
},
|
|
356
|
+
workflow: {
|
|
357
|
+
description: "DAG工作流编排与执行",
|
|
358
|
+
subcommands: ["create", "run", "templates"],
|
|
359
|
+
example: "workflow templates",
|
|
360
|
+
},
|
|
361
|
+
a2a: {
|
|
362
|
+
description: "Agent间协议注册与任务分发",
|
|
363
|
+
subcommands: ["register", "discover", "submit"],
|
|
364
|
+
example: 'a2a register --name "agent1" --capabilities \'["code"]\'',
|
|
365
|
+
},
|
|
366
|
+
hmemory: {
|
|
367
|
+
description: "层次化记忆存储与召回",
|
|
368
|
+
subcommands: ["store", "recall", "consolidate"],
|
|
369
|
+
example: 'hmemory store "事实" --importance 0.8',
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
"cli-integration-pack": {
|
|
375
|
+
displayName: "集成扩展技能包",
|
|
376
|
+
description:
|
|
377
|
+
"MCP工具服务器管理、浏览器自动化与抓取、插件生态市场、CLI工具桥接(Python)、EvoMap基因交换、WebSocket服务器、AI自演化、项目初始化与Persona",
|
|
378
|
+
executionMode: "hybrid",
|
|
379
|
+
category: "cli-direct",
|
|
380
|
+
tags: [
|
|
381
|
+
"mcp",
|
|
382
|
+
"browser",
|
|
383
|
+
"plugin",
|
|
384
|
+
"cli-anything",
|
|
385
|
+
"evomap",
|
|
386
|
+
"serve",
|
|
387
|
+
"evolution",
|
|
388
|
+
"init",
|
|
389
|
+
"persona",
|
|
390
|
+
],
|
|
391
|
+
commands: {
|
|
392
|
+
mcp: {
|
|
393
|
+
description: "MCP工具服务器管理",
|
|
394
|
+
subcommands: ["servers", "add", "tools"],
|
|
395
|
+
example:
|
|
396
|
+
'mcp add fs -c npx -a "-y,@modelcontextprotocol/server-filesystem"',
|
|
397
|
+
},
|
|
398
|
+
browse: {
|
|
399
|
+
description: "浏览器自动化 (抓取/元素提取)",
|
|
400
|
+
subcommands: ["fetch", "scrape"],
|
|
401
|
+
example: "browse fetch https://example.com",
|
|
402
|
+
},
|
|
403
|
+
plugin: {
|
|
404
|
+
description: "插件生态市场",
|
|
405
|
+
subcommands: ["list", "install", "search"],
|
|
406
|
+
example: "plugin list",
|
|
407
|
+
},
|
|
408
|
+
"cli-anything": {
|
|
409
|
+
description: "CLI工具桥接 (Python + cli-anything)",
|
|
410
|
+
subcommands: ["doctor", "scan", "register", "list", "remove"],
|
|
411
|
+
example: "cli-anything scan",
|
|
412
|
+
},
|
|
413
|
+
evomap: {
|
|
414
|
+
description: "EvoMap基因交换与联邦",
|
|
415
|
+
subcommands: [
|
|
416
|
+
"search",
|
|
417
|
+
"download",
|
|
418
|
+
"publish",
|
|
419
|
+
"list",
|
|
420
|
+
"hubs",
|
|
421
|
+
"federation",
|
|
422
|
+
"gov",
|
|
423
|
+
],
|
|
424
|
+
example: "evomap list",
|
|
425
|
+
},
|
|
426
|
+
serve: {
|
|
427
|
+
description: "启动WebSocket服务器 (默认端口18800)",
|
|
428
|
+
example: "serve --port 9000",
|
|
429
|
+
},
|
|
430
|
+
evolution: {
|
|
431
|
+
description: "AI能力自演化评估与诊断",
|
|
432
|
+
subcommands: ["assess", "diagnose", "learn"],
|
|
433
|
+
example: "evolution diagnose",
|
|
434
|
+
},
|
|
435
|
+
init: {
|
|
436
|
+
description: "交互式项目初始化 (含Persona模板)",
|
|
437
|
+
subcommands: ["--template", "--bare", "--yes"],
|
|
438
|
+
example: "init --template code-project --yes",
|
|
439
|
+
},
|
|
440
|
+
persona: {
|
|
441
|
+
description: "项目Persona个性配置",
|
|
442
|
+
subcommands: ["show", "set", "reset"],
|
|
443
|
+
example: "persona show",
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
/** 执行模式说明 */
|
|
450
|
+
export const EXECUTION_MODE_DESCRIPTIONS = {
|
|
451
|
+
direct: "直接执行 — 通过子进程调用CLI指令,无需LLM参与,毫秒级响应",
|
|
452
|
+
"llm-query": "LLM查询 — 单次非交互式LLM调用,需要配置LLM提供商,30秒内完成",
|
|
453
|
+
agent:
|
|
454
|
+
"Agent模式 — 需要交互式终端,不可被子进程调用。请直接在终端运行对应指令",
|
|
455
|
+
hybrid: "混合模式 — 大部分子指令直接执行,部分复杂子指令需要Agent模式",
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
/** Agent模式下需要特殊处理的指令列表 */
|
|
459
|
+
export const AGENT_MODE_COMMANDS = new Set(["chat", "agent"]);
|
|
460
|
+
|
|
461
|
+
/** 版本信息 — 用于sync检测 */
|
|
462
|
+
export const PACK_SCHEMA_VERSION = "1.0.0";
|