@uncarved/jade 0.2.1 → 0.3.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 +64 -2
- package/assets/logo.svg +1 -0
- package/bin/jade.js +4 -0
- package/dist/api.d.ts +5 -250
- package/dist/api.js +5 -7
- package/dist/api.js.map +1 -1
- package/dist/fetch.d.ts +8 -0
- package/dist/fetch.js +19 -17
- package/dist/fetch.js.map +1 -1
- package/dist/host.d.ts +12 -1
- package/dist/host.js +49 -1
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +26 -4
- package/dist/main.js.map +1 -1
- package/dist/remote.js +4 -0
- package/dist/remote.js.map +1 -1
- package/dist/session.d.ts +2 -0
- package/dist/session.js +133 -13
- package/dist/session.js.map +1 -1
- package/dist/source.d.ts +2 -10
- package/dist/source.js.map +1 -1
- package/dist/update.d.ts +8 -20
- package/dist/update.js +12 -1
- package/dist/update.js.map +1 -1
- package/package.json +4 -2
- package/plugins/approval/index.ts +233 -85
- package/plugins/approval/plugin.json +1 -1
- package/plugins/approval/policy.ts +2 -1
- package/plugins/approval/review.ts +1 -1
- package/plugins/ask/index.ts +2 -2
- package/plugins/budget/index.ts +1 -1
- package/plugins/checks/checks.ts +3 -2
- package/plugins/checks/index.ts +2 -5
- package/plugins/commands/index.ts +2 -44
- package/plugins/compact/compact.ts +8 -3
- package/plugins/compact/index.ts +13 -16
- package/plugins/continue/index.ts +1 -1
- package/plugins/cost/index.ts +143 -0
- package/plugins/cost/plugin.json +13 -0
- package/plugins/custom-commands/index.ts +85 -0
- package/plugins/custom-commands/plugin.json +8 -0
- package/plugins/editor/index.ts +88 -0
- package/plugins/editor/plugin.json +17 -0
- package/plugins/fs/fs.ts +33 -6
- package/plugins/fs/grep.ts +6 -4
- package/plugins/fs/index.ts +2 -3
- package/plugins/fs/renderers.ts +1 -1
- package/plugins/hooks/index.ts +152 -0
- package/plugins/hooks/plugin.json +14 -0
- package/plugins/keys/index.ts +2 -18
- package/plugins/mcp/index.ts +40 -12
- package/plugins/mcp/install.ts +139 -0
- package/plugins/mcp/mcp.ts +2 -1
- package/plugins/mcp/plugin.json +1 -1
- package/plugins/mcp/project.ts +37 -1
- package/plugins/memory/index.ts +4 -9
- package/plugins/memory/plugin.json +1 -1
- package/plugins/mentions/index.ts +2 -2
- package/plugins/models/configure.ts +258 -150
- package/plugins/models/context.ts +2 -2
- package/plugins/models/index.ts +35 -42
- package/plugins/models/plugin.json +1 -1
- package/plugins/models/provider.ts +22 -4
- package/plugins/models/saved.ts +8 -4
- package/plugins/modes/index.ts +2 -17
- package/plugins/plugins/index.ts +2 -2
- package/plugins/print/index.ts +36 -6
- package/plugins/print/plugin.json +1 -0
- package/plugins/prompts/index.ts +22 -14
- package/plugins/{memory → prompts}/notes.ts +21 -9
- package/plugins/prompts/plugin.json +8 -2
- package/plugins/prompts/prompts.ts +5 -4
- package/plugins/renderers/index.ts +2 -43
- package/plugins/repeats/index.ts +1 -1
- package/plugins/schedule/index.ts +2 -2
- package/plugins/scratch/index.ts +2 -3
- package/plugins/screenshot/index.ts +26 -13
- package/plugins/screenshot/plugin.json +1 -1
- package/plugins/sessions/index.ts +2 -17
- package/plugins/shell/index.ts +56 -6
- package/plugins/shell/plugin.json +3 -1
- package/plugins/shell/renderers.ts +1 -1
- package/plugins/shell/service.ts +2 -13
- package/plugins/shell/shell.ts +31 -16
- package/plugins/skills/index.ts +172 -37
- package/plugins/skills/install.ts +212 -0
- package/plugins/skills/plugin.json +3 -2
- package/plugins/skills/project.ts +38 -1
- package/plugins/skills/skills.ts +28 -9
- package/plugins/steer/index.ts +142 -0
- package/plugins/steer/plugin.json +8 -0
- package/plugins/suggest/index.ts +16 -11
- package/plugins/suggest/plugin.json +1 -1
- package/plugins/task/index.ts +7 -16
- package/plugins/task/plugin.json +9 -2
- package/plugins/task/subagent.ts +23 -5
- package/plugins/todo/index.ts +2 -2
- package/plugins/tui/editor.ts +10 -2
- package/plugins/tui/frontend.ts +103 -21
- package/plugins/tui/index.ts +3 -8
- package/plugins/tui/markdown.ts +51 -6
- package/plugins/tui/mascot.ts +505 -0
- package/plugins/tui/plugin.json +2 -2
- package/plugins/tui/screen.ts +6 -0
- package/plugins/tui/transcript.ts +17 -2
- package/plugins/tui/tui.ts +321 -90
- package/plugins/undo/checkpoint.ts +2 -2
- package/plugins/undo/index.ts +84 -26
- package/plugins/undo/plugin.json +8 -2
- package/plugins/undo/snapshot.ts +129 -0
- package/plugins/update/index.ts +11 -15
- package/plugins/update/plugin.json +2 -1
- package/plugins/web/index.ts +2 -5
- package/plugins/web/renderers.ts +1 -1
- package/plugins-dist/approval/index.js +217 -51
- package/plugins-dist/approval/plugin.json +1 -1
- package/plugins-dist/ask/index.js +1 -1
- package/plugins-dist/budget/index.js +1 -1
- package/plugins-dist/checks/checks.js +2 -1
- package/plugins-dist/checks/index.js +1 -1
- package/plugins-dist/commands/index.js +1 -1
- package/plugins-dist/compact/compact.js +6 -1
- package/plugins-dist/compact/index.js +12 -8
- package/plugins-dist/continue/index.js +1 -1
- package/plugins-dist/cost/index.js +135 -0
- package/plugins-dist/cost/plugin.json +16 -0
- package/plugins-dist/custom-commands/index.js +86 -0
- package/plugins-dist/custom-commands/plugin.json +12 -0
- package/plugins-dist/editor/index.js +89 -0
- package/plugins-dist/editor/plugin.json +21 -0
- package/plugins-dist/fs/fs.js +34 -6
- package/plugins-dist/fs/grep.js +5 -3
- package/plugins-dist/fs/index.js +1 -1
- package/plugins-dist/hooks/index.js +145 -0
- package/plugins-dist/hooks/plugin.json +19 -0
- package/plugins-dist/keys/index.js +1 -1
- package/plugins-dist/mcp/index.js +41 -9
- package/plugins-dist/mcp/install.js +160 -0
- package/plugins-dist/mcp/mcp.js +2 -1
- package/plugins-dist/mcp/plugin.json +2 -1
- package/plugins-dist/mcp/project.js +42 -1
- package/plugins-dist/memory/index.js +3 -5
- package/plugins-dist/memory/plugin.json +1 -1
- package/plugins-dist/mentions/index.js +1 -1
- package/plugins-dist/models/configure.js +252 -151
- package/plugins-dist/models/context.js +2 -2
- package/plugins-dist/models/index.js +37 -14
- package/plugins-dist/models/plugin.json +1 -1
- package/plugins-dist/models/provider.js +4 -2
- package/plugins-dist/models/saved.js +9 -4
- package/plugins-dist/modes/index.js +1 -1
- package/plugins-dist/plugins/index.js +1 -1
- package/plugins-dist/print/index.js +37 -3
- package/plugins-dist/print/plugin.json +3 -0
- package/plugins-dist/prompts/index.js +22 -3
- package/plugins-dist/{memory → prompts}/notes.js +10 -7
- package/plugins-dist/prompts/plugin.json +8 -2
- package/plugins-dist/prompts/prompts.js +5 -4
- package/plugins-dist/renderers/index.js +1 -1
- package/plugins-dist/repeats/index.js +1 -1
- package/plugins-dist/schedule/index.js +1 -1
- package/plugins-dist/scratch/index.js +1 -1
- package/plugins-dist/screenshot/index.js +25 -11
- package/plugins-dist/screenshot/plugin.json +1 -1
- package/plugins-dist/sessions/index.js +1 -1
- package/plugins-dist/shell/index.js +55 -3
- package/plugins-dist/shell/plugin.json +3 -1
- package/plugins-dist/shell/shell.js +26 -8
- package/plugins-dist/skills/index.js +184 -35
- package/plugins-dist/skills/install.js +178 -0
- package/plugins-dist/skills/plugin.json +6 -2
- package/plugins-dist/skills/project.js +43 -1
- package/plugins-dist/skills/skills.js +27 -10
- package/plugins-dist/steer/index.js +135 -0
- package/plugins-dist/steer/plugin.json +12 -0
- package/plugins-dist/suggest/index.js +15 -9
- package/plugins-dist/suggest/plugin.json +1 -1
- package/plugins-dist/task/index.js +6 -4
- package/plugins-dist/task/plugin.json +10 -2
- package/plugins-dist/task/subagent.js +20 -5
- package/plugins-dist/todo/index.js +1 -1
- package/plugins-dist/tui/editor.js +7 -2
- package/plugins-dist/tui/frontend.js +107 -13
- package/plugins-dist/tui/index.js +2 -1
- package/plugins-dist/tui/markdown.js +48 -6
- package/plugins-dist/tui/mascot.js +439 -0
- package/plugins-dist/tui/plugin.json +3 -2
- package/plugins-dist/tui/screen.js +2 -0
- package/plugins-dist/tui/transcript.js +16 -1
- package/plugins-dist/tui/tui.js +302 -81
- package/plugins-dist/undo/checkpoint.js +1 -1
- package/plugins-dist/undo/index.js +91 -24
- package/plugins-dist/undo/plugin.json +10 -3
- package/plugins-dist/undo/snapshot.js +111 -0
- package/plugins-dist/update/index.js +9 -10
- package/plugins-dist/update/plugin.json +4 -1
- package/plugins-dist/web/index.js +1 -1
- package/sdk/python/__pycache__/jade_plugin.cpython-312.pyc +0 -0
- package/sdk/python/jade_plugin.py +8 -0
- package/src/api.ts +7 -262
- package/src/fetch.ts +18 -16
- package/src/host.ts +49 -1
- package/src/index.ts +1 -1
- package/src/main.ts +23 -5
- package/src/remote.ts +2 -0
- package/src/session.ts +134 -15
- package/src/source.ts +2 -11
- package/src/update.ts +16 -10
- package/plugins/undo/notes.ts +0 -43
- package/plugins-dist/undo/notes.js +0 -36
|
@@ -1,16 +1,105 @@
|
|
|
1
|
-
// jade/skills:skill 工具、系统提示词里的 skill 列表、/skills
|
|
1
|
+
// jade/skills:skill 工具、系统提示词里的 skill 列表、/skills(列出,以及 add / update / remove,见 install.ts;
|
|
2
|
+
// 终端里是 jade skills …),以及每个 skill 一条 /<skill 名> 命令。
|
|
2
3
|
//
|
|
3
|
-
//
|
|
4
|
+
// 每次调用模型之前重新查找 skill:会话中途装的马上能用,不用 /clear 或重启。随仓库分发的 skill(项目层)不用确认:
|
|
4
5
|
// 它只是给模型看的文字,不执行代码;和旧 jade 一样,列表里有项目层的 skill 时整段标为不可信。
|
|
5
6
|
import path from "node:path";
|
|
6
|
-
import { definePlugin } from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { definePlugin } from "@uncarved/jade-api";
|
|
8
|
+
import { addSkill, removeSkill, skillsRoot, updateSkills } from "./install.js";
|
|
9
|
+
import { bold, clip, dim, display, estimateTokens, realPath, red, repoRoot, splitArgs } from "./project.js";
|
|
10
|
+
import { loadSkills, skillLine, skillsPrompt, skillTool } from "./skills.js";
|
|
9
11
|
const ID = "jade/skills";
|
|
10
12
|
/** /<skill> 发给模型的消息:让它先加载这个 skill */
|
|
11
13
|
export function skillMessage(name, args) {
|
|
12
14
|
return `Use the "${name}" skill${args.trim() ? ` for this: ${args.trim()}` : "."}`;
|
|
13
15
|
}
|
|
16
|
+
const errorText = (e) => (e instanceof Error ? e.message : String(e));
|
|
17
|
+
/** cmd 是 "/skills" 或 "jade skills" */
|
|
18
|
+
export const manageUsage = (cmd) => `usage: ${cmd} [list]
|
|
19
|
+
${cmd} add <source> [--project] [--path <dir>] [--force]
|
|
20
|
+
${cmd} update [name…] [--project] [--force]
|
|
21
|
+
${cmd} remove <name> [--project]
|
|
22
|
+
|
|
23
|
+
<source> a git repository (https://…, git@…, github:user/repo, user/repo; #branch, #tag or #commit at the end),
|
|
24
|
+
an npm package, or a local directory
|
|
25
|
+
--project use <cwd>/.jade/skills instead of $JADE_HOME/skills
|
|
26
|
+
--path the skill's directory inside the source (for repositories with several skills)
|
|
27
|
+
--force replace a skill with the same name, or overwrite local changes on update`;
|
|
28
|
+
/** list / add / update / remove,参数已经切好;返回给用户看的结果,用法错误或失败时抛错。cmd 用在提示里 */
|
|
29
|
+
export async function manageSkills(argv, env) {
|
|
30
|
+
const usage = manageUsage(env.cmd);
|
|
31
|
+
const [sub, ...tail] = argv;
|
|
32
|
+
if (sub === "-h" || sub === "--help" || tail.includes("-h") || tail.includes("--help"))
|
|
33
|
+
return usage;
|
|
34
|
+
if (sub === undefined || sub === "list") {
|
|
35
|
+
if (tail.length)
|
|
36
|
+
throw new Error(usage);
|
|
37
|
+
const skills = env.skills ?? (await find(env.home, env.cwd)).skills;
|
|
38
|
+
// 每次请求都带着的:skill 工具的定义(总是注册),和提示词里的 skill 列表。skill 的正文用到时才读入,不算
|
|
39
|
+
const tool = skillTool(() => skills, async () => { }, { user: skillsRoot(env.home, env.cwd, false), project: skillsRoot(env.home, env.cwd, true) });
|
|
40
|
+
const toolTokens = estimateTokens(JSON.stringify({ name: tool.name, description: tool.description, input_schema: tool.inputSchema }));
|
|
41
|
+
if (skills.length === 0) {
|
|
42
|
+
return dim(`(no skills) install one with ${env.cmd} add <source>, or put it in ${display(env.cwd, path.join(env.home, "skills"))}/<name>/SKILL.md or .jade/skills/<name>/SKILL.md\nthe skill tool itself takes ≈${toolTokens} tokens in every request`);
|
|
43
|
+
}
|
|
44
|
+
const total = toolTokens + estimateTokens(skillsPrompt(skills));
|
|
45
|
+
return [
|
|
46
|
+
...skills.map((sk) => `${bold(sk.name)} ${dim(`${sk.layer} · ${display(env.cwd, sk.dir)} · ≈${estimateTokens(skillLine(sk))} tokens`)}\n ${clip(sk.description.replace(/\s+/g, " "), 300)}`),
|
|
47
|
+
dim(`≈${total} tokens in every request (the skill list and the skill tool); a skill's instructions are read only when it is used`),
|
|
48
|
+
].join("\n");
|
|
49
|
+
}
|
|
50
|
+
const positionals = [];
|
|
51
|
+
let project = false;
|
|
52
|
+
let force = false;
|
|
53
|
+
let subdir;
|
|
54
|
+
for (let i = 0; i < tail.length; i++) {
|
|
55
|
+
const a = tail[i];
|
|
56
|
+
if (a === "--project")
|
|
57
|
+
project = true;
|
|
58
|
+
else if (a === "--force" || a === "-f")
|
|
59
|
+
force = true;
|
|
60
|
+
else if (a === "--path") {
|
|
61
|
+
subdir = tail[++i];
|
|
62
|
+
if (subdir === undefined)
|
|
63
|
+
throw new Error(`--path needs a value\n${usage}`);
|
|
64
|
+
}
|
|
65
|
+
else if (a.startsWith("--path="))
|
|
66
|
+
subdir = a.slice("--path=".length);
|
|
67
|
+
else if (a.startsWith("-"))
|
|
68
|
+
throw new Error(`unknown option ${a}\n${usage}`);
|
|
69
|
+
else
|
|
70
|
+
positionals.push(a);
|
|
71
|
+
}
|
|
72
|
+
const root = skillsRoot(env.home, env.cwd, project);
|
|
73
|
+
const later = "a running jade can use it from its next step";
|
|
74
|
+
switch (sub) {
|
|
75
|
+
case "add":
|
|
76
|
+
case "install": {
|
|
77
|
+
if (positionals.length !== 1)
|
|
78
|
+
throw new Error(usage);
|
|
79
|
+
const { name, dir } = await addSkill(positionals[0], { sources: env.sources, root, cwd: env.cwd, force, ...(subdir ? { subdir } : {}), ...(env.log ? { log: env.log } : {}) });
|
|
80
|
+
return `installed skill ${name} into ${display(env.cwd, dir)}; ${later}`;
|
|
81
|
+
}
|
|
82
|
+
case "update": {
|
|
83
|
+
if (subdir)
|
|
84
|
+
throw new Error(usage);
|
|
85
|
+
const lines = await updateSkills(positionals, { sources: env.sources, root, cwd: env.cwd, force, ...(env.log ? { log: env.log } : {}) });
|
|
86
|
+
if (lines.length === 0)
|
|
87
|
+
return `no skills in ${display(env.cwd, root)} were installed with "${env.cmd} add"`;
|
|
88
|
+
if (lines.some((l) => l.startsWith("updated ")))
|
|
89
|
+
lines.push("a running jade uses the updated skills from its next step");
|
|
90
|
+
return lines.join("\n");
|
|
91
|
+
}
|
|
92
|
+
case "remove":
|
|
93
|
+
case "rm": {
|
|
94
|
+
if (positionals.length !== 1 || subdir || force)
|
|
95
|
+
throw new Error(usage);
|
|
96
|
+
const dir = await removeSkill(positionals[0], root);
|
|
97
|
+
return `removed skill ${positionals[0]} (${display(env.cwd, dir)})`;
|
|
98
|
+
}
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(usage);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
14
103
|
async function find(home, cwd) {
|
|
15
104
|
const here = realPath(cwd);
|
|
16
105
|
return loadSkills({ home, root: realPath(repoRoot(here)), cwd: here });
|
|
@@ -23,50 +112,90 @@ const skillCommands = new Map();
|
|
|
23
112
|
const warned = new Set();
|
|
24
113
|
export default definePlugin({
|
|
25
114
|
process(ctx) {
|
|
115
|
+
const sources = ctx.require("sources@1");
|
|
26
116
|
latest = undefined;
|
|
27
117
|
skillCommands.clear();
|
|
28
118
|
ctx.service("commands@1")?.register({
|
|
29
119
|
name: "skills",
|
|
30
|
-
|
|
120
|
+
args: "[add <source> | update [name…] | remove <name>] [--project]",
|
|
121
|
+
description: "skills the agent can use; install them from git, npm or a directory",
|
|
31
122
|
instant: true,
|
|
32
|
-
async run() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
123
|
+
async run(args, cctx) {
|
|
124
|
+
let argv;
|
|
125
|
+
try {
|
|
126
|
+
argv = splitArgs(args);
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
return red(errorText(e));
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
return await manageSkills(argv, { home: ctx.home, cwd: ctx.cwd, cmd: "/skills", sources, log: (t) => cctx.print(dim(t)), ...(latest ? { skills: latest } : {}) });
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
return red(errorText(e));
|
|
36
136
|
}
|
|
37
|
-
return skills
|
|
38
|
-
.map((sk) => `${bold(sk.name)} ${dim(`${sk.layer} · ${display(ctx.cwd, sk.dir)}`)}\n ${clip(sk.description.replace(/\s+/g, " "), 300)}`)
|
|
39
|
-
.join("\n");
|
|
40
137
|
},
|
|
41
138
|
});
|
|
139
|
+
// 同样的事也能在终端里做:jade skills add <source> [--project](cli@1,核心提供)
|
|
140
|
+
ctx.service("cli@1")?.register({
|
|
141
|
+
name: "skills",
|
|
142
|
+
run: (argv, cli) => manageSkills(argv, { home: ctx.home, cwd: ctx.cwd, cmd: "jade skills", sources, log: cli.log }),
|
|
143
|
+
});
|
|
42
144
|
},
|
|
43
145
|
async session(ctx) {
|
|
44
|
-
const { skills, warnings } = await find(ctx.home, ctx.cwd);
|
|
45
|
-
latest = skills;
|
|
46
146
|
const ui = ctx.service("ui@1");
|
|
47
|
-
for (const w of warnings) {
|
|
48
|
-
if (warned.has(w))
|
|
49
|
-
continue;
|
|
50
|
-
warned.add(w);
|
|
51
|
-
ui?.notify(`${ID}: ${w}`, "warning");
|
|
52
|
-
}
|
|
53
|
-
if (skills.length === 0)
|
|
54
|
-
return;
|
|
55
|
-
ctx.kernel.tool(skillTool(skills));
|
|
56
|
-
const text = skillsPrompt(skills);
|
|
57
|
-
// 读 skill 目录里的文件(脚本、参考资料)不用问;会话关闭时撤销
|
|
58
147
|
const approval = ctx.service("approval@1");
|
|
59
|
-
|
|
60
|
-
approval?.allowRead(sk.dir);
|
|
61
|
-
// 有随仓库分发的 skill 时整段不可信
|
|
62
|
-
ctx.service("prompts@1")?.add({ text, untrusted: !skills.every((s) => s.layer === "user") });
|
|
63
|
-
// skill 也可以当命令用:/<skill 名> [要做的事]。挂在会话作用域上,随会话撤销。
|
|
64
|
-
// 新会话在旧会话关闭之前打开:旧会话注册的同名命令先撤销,换成这个会话的。
|
|
65
|
-
// 名字已被别的插件的命令占用时让给它(会话级的注册总在进程级的命令之后)
|
|
148
|
+
const prompts = ctx.service("prompts@1");
|
|
66
149
|
const commands = ctx.service("commands@1");
|
|
67
|
-
|
|
150
|
+
/** 这个会话现在的 skill,和据此加上的东西(都挂在会话作用域上,随会话撤销) */
|
|
151
|
+
let current = [];
|
|
152
|
+
let shown = "";
|
|
153
|
+
let removeSection;
|
|
154
|
+
const readable = new Map();
|
|
155
|
+
/** 这个会话注册过的 /<skill> 命令 */
|
|
156
|
+
const mine = new Set();
|
|
157
|
+
/** 用新找到的 skill 更新提示词里的列表、可读目录和 /<skill> 命令;没变时什么也不做(不让提示缓存失效) */
|
|
158
|
+
const apply = (skills, warnings) => {
|
|
159
|
+
for (const w of warnings) {
|
|
160
|
+
if (warned.has(w))
|
|
161
|
+
continue;
|
|
162
|
+
warned.add(w);
|
|
163
|
+
ui?.notify(`${ID}: ${w}`, "warning");
|
|
164
|
+
}
|
|
165
|
+
current = skills;
|
|
166
|
+
latest = skills;
|
|
167
|
+
const key = JSON.stringify(skills.map((s) => [s.name, s.description, s.dir, s.layer]));
|
|
168
|
+
if (key === shown)
|
|
169
|
+
return;
|
|
170
|
+
shown = key;
|
|
171
|
+
// 有随仓库分发的 skill 时整段不可信
|
|
172
|
+
removeSection?.();
|
|
173
|
+
removeSection = skills.length ? prompts?.add({ text: skillsPrompt(skills), untrusted: !skills.every((s) => s.layer === "user") }) : undefined;
|
|
174
|
+
// 读 skill 目录里的文件(脚本、参考资料)不用问
|
|
175
|
+
const dirs = new Set(skills.map((s) => s.dir));
|
|
176
|
+
for (const [dir, revoke] of readable)
|
|
177
|
+
if (!dirs.has(dir))
|
|
178
|
+
(revoke(), readable.delete(dir));
|
|
179
|
+
for (const dir of dirs)
|
|
180
|
+
if (!readable.has(dir) && approval)
|
|
181
|
+
readable.set(dir, approval.allowRead(dir));
|
|
182
|
+
// skill 也可以当命令用:/<skill 名> [要做的事]。
|
|
183
|
+
// 新会话在旧会话关闭之前打开:旧会话注册的同名命令先撤销,换成这个会话的。
|
|
184
|
+
// 名字已被别的插件的命令占用时让给它(会话级的注册总在进程级的命令之后)
|
|
185
|
+
if (!commands)
|
|
186
|
+
return;
|
|
187
|
+
const names = new Set(skills.map((s) => s.name.toLowerCase()));
|
|
188
|
+
for (const [key, revoke] of skillCommands) {
|
|
189
|
+
if (names.has(key))
|
|
190
|
+
continue;
|
|
191
|
+
revoke();
|
|
192
|
+
skillCommands.delete(key);
|
|
193
|
+
mine.delete(key);
|
|
194
|
+
}
|
|
68
195
|
for (const sk of skills) {
|
|
69
196
|
const key = sk.name.toLowerCase();
|
|
197
|
+
if (mine.has(key))
|
|
198
|
+
continue;
|
|
70
199
|
const taken = commands.get(sk.name);
|
|
71
200
|
if (taken && taken.plugin !== ID)
|
|
72
201
|
continue;
|
|
@@ -80,11 +209,31 @@ export default definePlugin({
|
|
|
80
209
|
run: (args) => ({ prompt: skillMessage(sk.name, args) }),
|
|
81
210
|
});
|
|
82
211
|
skillCommands.set(key, revoke);
|
|
212
|
+
mine.add(key);
|
|
83
213
|
}
|
|
84
214
|
catch {
|
|
85
215
|
// 名字不能当命令名(commands@1 的规则更严)或刚被占用:只是少一条快捷命令
|
|
86
216
|
}
|
|
87
217
|
}
|
|
88
|
-
}
|
|
218
|
+
};
|
|
219
|
+
const refresh = async () => {
|
|
220
|
+
const { skills, warnings } = await find(ctx.home, ctx.cwd);
|
|
221
|
+
apply(skills, warnings);
|
|
222
|
+
};
|
|
223
|
+
await refresh();
|
|
224
|
+
// 会话中途装的 skill(/skills add、jade skills add,或模型自己装的)马上能用:
|
|
225
|
+
// 工具列表在会话创建时就定了,所以 skill 工具总是注册;每次调用模型之前重新查找一次,
|
|
226
|
+
// 列表变了才更新提示词。context.project 在 context.build(jade/prompts 拼提示词)之前执行
|
|
227
|
+
ctx.kernel.tool(skillTool(() => current, refresh, { user: skillsRoot(ctx.home, ctx.cwd, false), project: skillsRoot(ctx.home, ctx.cwd, true) }));
|
|
228
|
+
ctx.kernel.hook({
|
|
229
|
+
kind: "transform",
|
|
230
|
+
point: "context.project",
|
|
231
|
+
// 查找出错时沿用上一次的列表,不让这一轮失败
|
|
232
|
+
optional: true,
|
|
233
|
+
fn: async (messages) => {
|
|
234
|
+
await refresh();
|
|
235
|
+
return messages;
|
|
236
|
+
},
|
|
237
|
+
});
|
|
89
238
|
},
|
|
90
239
|
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// /skills add|update|remove:从 git 仓库、npm 包或本地目录安装 skill。
|
|
2
|
+
//
|
|
3
|
+
// 不加 --project 装到 $JADE_HOME/skills/<名字>,加了装到 <工作目录>/.jade/skills/<名字>。
|
|
4
|
+
// 来源的写法和下载经核心的 sources@1 服务(和 jade plugins add 同一份):先下到 skills 目录里的 .staging-*
|
|
5
|
+
// (以 . 开头,查找 skill 时跳过),找到 SKILL.md 后再换进正式目录。
|
|
6
|
+
// 安装记录在 skills 目录的 .installed.json(按名字),update 按它重新下载;记录里有安装时的内容哈希,
|
|
7
|
+
// 装好后手动改过的默认不覆盖,要加 --force。skill 只是文字和附带的文件:安装不执行任何东西,也不装依赖。
|
|
8
|
+
import { randomBytes } from "node:crypto";
|
|
9
|
+
import { mkdir, readdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { NAME, parseSkill } from "./skills.js";
|
|
12
|
+
/** 不加 --project 装到 $JADE_HOME/skills,加了装到 <工作目录>/.jade/skills */
|
|
13
|
+
export const skillsRoot = (home, cwd, project) => (project ? path.join(cwd, ".jade", "skills") : path.join(home, "skills"));
|
|
14
|
+
const RECORDS = ".installed.json";
|
|
15
|
+
export async function readRecords(root) {
|
|
16
|
+
let text;
|
|
17
|
+
try {
|
|
18
|
+
text = await readFile(path.join(root, RECORDS), "utf8");
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(text);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
throw new Error(`${path.join(root, RECORDS)}: ${e instanceof Error ? e.message : String(e)}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function writeRecords(root, records) {
|
|
31
|
+
await writeFile(path.join(root, RECORDS), JSON.stringify(records, null, 2) + "\n");
|
|
32
|
+
}
|
|
33
|
+
const exists = (p) => stat(p).then(() => true, () => false);
|
|
34
|
+
/** 把 --path 限制在来源目录里,不能跑到外面去 */
|
|
35
|
+
function inSubdir(root, subdir) {
|
|
36
|
+
const full = path.resolve(root, subdir);
|
|
37
|
+
const rel = path.relative(root, full);
|
|
38
|
+
if (rel === ".." || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel))
|
|
39
|
+
throw new Error(`--path ${subdir} points outside the source`);
|
|
40
|
+
return full;
|
|
41
|
+
}
|
|
42
|
+
/** 服务里抛出的错误带着 "plugin jade (sources@1.fetch): " 的前缀;给用户看的只要原来那句 */
|
|
43
|
+
async function plain(call) {
|
|
44
|
+
try {
|
|
45
|
+
return await call;
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
throw e instanceof Error && e.name === "PluginError" && e.cause instanceof Error ? e.cause : e;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** 安装一个 skill,返回它的名字和目录 */
|
|
52
|
+
export async function addSkill(spec, opts) {
|
|
53
|
+
const source = await plain(opts.sources.parse(spec, opts.cwd));
|
|
54
|
+
const record = await install(source, opts);
|
|
55
|
+
return { name: record.name, dir: path.join(path.resolve(opts.root), record.name) };
|
|
56
|
+
}
|
|
57
|
+
/** 按安装记录重新下载;没给名字时更新这个目录里所有装过的 skill。返回每个 skill 一行结果 */
|
|
58
|
+
export async function updateSkills(names, opts) {
|
|
59
|
+
const root = path.resolve(opts.root);
|
|
60
|
+
const records = await readRecords(root);
|
|
61
|
+
const lines = [];
|
|
62
|
+
for (const name of names.length ? names : Object.keys(records).sort()) {
|
|
63
|
+
const rec = records[name];
|
|
64
|
+
if (!rec) {
|
|
65
|
+
lines.push(`${name}: not installed with "/skills add"${(await exists(path.join(root, name))) ? "; update it by hand" : ""}`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const dir = path.join(root, name);
|
|
70
|
+
if (!opts.force && (await exists(dir)) && (await opts.sources.hash(dir)) !== rec.hash) {
|
|
71
|
+
lines.push(`${name}: changed since it was installed; add --force to overwrite the changes`);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const source = { kind: rec.kind, location: rec.location, spec: rec.source, ...(rec.ref ? { ref: rec.ref } : {}) };
|
|
75
|
+
const next = await install(source, { ...opts, force: true, ...(rec.subdir ? { subdir: rec.subdir } : {}) }, rec);
|
|
76
|
+
lines.push(next.hash === rec.hash ? `current ${name}` : `updated ${name}`);
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
lines.push(`${name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return lines;
|
|
83
|
+
}
|
|
84
|
+
/** 删掉一个 skill 目录和它的安装记录;手动放进去的也能删 */
|
|
85
|
+
export async function removeSkill(name, root) {
|
|
86
|
+
if (!NAME.test(name))
|
|
87
|
+
throw new Error(`invalid skill name ${JSON.stringify(name)}`);
|
|
88
|
+
root = path.resolve(root);
|
|
89
|
+
const dir = path.join(root, name);
|
|
90
|
+
if (!(await exists(path.join(dir, "SKILL.md"))))
|
|
91
|
+
throw new Error(`there is no skill ${name} in ${root}`);
|
|
92
|
+
await rm(dir, { recursive: true, force: true });
|
|
93
|
+
const records = await readRecords(root);
|
|
94
|
+
if (records[name]) {
|
|
95
|
+
delete records[name];
|
|
96
|
+
await writeRecords(root, records);
|
|
97
|
+
}
|
|
98
|
+
return dir;
|
|
99
|
+
}
|
|
100
|
+
/** 下载、找到 SKILL.md、换进正式目录、写安装记录。更新时 prev 给出原来的记录(名字不变) */
|
|
101
|
+
async function install(source, opts, prev) {
|
|
102
|
+
const root = path.resolve(opts.root);
|
|
103
|
+
// 本地来源包含 skills 目录时,staging 会被复制进去(甚至递归复制自己)
|
|
104
|
+
if (source.kind === "local") {
|
|
105
|
+
const from = opts.subdir ? inSubdir(source.location, opts.subdir) : source.location;
|
|
106
|
+
const rel = path.relative(from, root);
|
|
107
|
+
if (rel === "" || (rel !== ".." && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel))) {
|
|
108
|
+
throw new Error(`${source.location} contains the skills directory; give the skill's own directory, or use --path`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
await mkdir(root, { recursive: true });
|
|
112
|
+
const records = await readRecords(root);
|
|
113
|
+
const staging = path.join(root, `.staging-${randomBytes(4).toString("hex")}`);
|
|
114
|
+
try {
|
|
115
|
+
const { root: fetched, commit } = await plain(opts.sources.fetch(source, staging, opts.log));
|
|
116
|
+
const dir = opts.subdir ? inSubdir(fetched, opts.subdir) : fetched;
|
|
117
|
+
if (!(await exists(path.join(dir, "SKILL.md"))))
|
|
118
|
+
throw new Error(await noSkillMessage(source.spec, dir, fetched));
|
|
119
|
+
const name = prev?.name ?? skillName(parseSkill(await readFile(path.join(dir, "SKILL.md"), "utf8")).meta.name, source, opts.subdir);
|
|
120
|
+
const target = path.join(root, name);
|
|
121
|
+
if (!opts.force && (await exists(target))) {
|
|
122
|
+
throw new Error(`skill ${name} is already installed in ${target}; run "/skills update ${name}", or add --force to replace it`);
|
|
123
|
+
}
|
|
124
|
+
const hash = await opts.sources.hash(dir);
|
|
125
|
+
await rm(target, { recursive: true, force: true });
|
|
126
|
+
await rename(dir, target);
|
|
127
|
+
const now = new Date().toISOString();
|
|
128
|
+
const record = {
|
|
129
|
+
name,
|
|
130
|
+
source: source.spec,
|
|
131
|
+
location: source.location,
|
|
132
|
+
kind: source.kind,
|
|
133
|
+
...(source.ref ? { ref: source.ref } : {}),
|
|
134
|
+
...(opts.subdir ? { subdir: opts.subdir } : {}),
|
|
135
|
+
...(commit ? { commit } : {}),
|
|
136
|
+
hash,
|
|
137
|
+
installedAt: prev?.installedAt ?? now,
|
|
138
|
+
...(prev ? { updatedAt: now } : {}),
|
|
139
|
+
};
|
|
140
|
+
records[name] = record;
|
|
141
|
+
await writeRecords(root, records);
|
|
142
|
+
return record;
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
await rm(staging, { recursive: true, force: true }).catch(() => { });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** SKILL.md 里的 name;没有时用 --path 的最后一段,再没有就用仓库名、包名或目录名 */
|
|
149
|
+
function skillName(declared, source, subdir) {
|
|
150
|
+
const fromSource = source.kind === "npm"
|
|
151
|
+
? source.location.replace(/^@[^/]+\//, "").replace(/@.*$/, "").replace(/\.(tgz|tar\.gz)$/i, "")
|
|
152
|
+
: source.location.replace(/[\\/]+$/, "").replace(/\.git$/, "");
|
|
153
|
+
const candidates = [declared, subdir && path.basename(subdir.replace(/[\\/]+$/, "")), path.basename(fromSource)];
|
|
154
|
+
const name = candidates.find((c) => c && NAME.test(c));
|
|
155
|
+
if (!name)
|
|
156
|
+
throw new Error(`could not tell the skill's name; give it a "name:" in SKILL.md`);
|
|
157
|
+
return name;
|
|
158
|
+
}
|
|
159
|
+
/** 来源里没有 SKILL.md 时:列出它里面的 skill,提示用 --path 选一个 */
|
|
160
|
+
async function noSkillMessage(spec, dir, fetched) {
|
|
161
|
+
let found = [];
|
|
162
|
+
try {
|
|
163
|
+
found = (await readdir(fetched, { recursive: true, withFileTypes: true }))
|
|
164
|
+
.filter((e) => e.isFile() && e.name === "SKILL.md")
|
|
165
|
+
.map((e) => path.relative(fetched, e.parentPath).split(path.sep).join("/"))
|
|
166
|
+
.filter((d) => d && !d.split("/").some((seg) => seg === "node_modules" || seg.startsWith(".")))
|
|
167
|
+
.sort();
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
// 没有可列的
|
|
171
|
+
}
|
|
172
|
+
const where = path.relative(fetched, dir).split(path.sep).join("/");
|
|
173
|
+
const head = `${spec}${where ? ` (--path ${where})` : ""} has no SKILL.md`;
|
|
174
|
+
if (found.length === 0)
|
|
175
|
+
return `${head}; it is not a skill`;
|
|
176
|
+
const shown = found.slice(0, 20).map((d) => ` ${d}`).join("\n") + (found.length > 20 ? `\n … ${found.length - 20} more` : "");
|
|
177
|
+
return `${head}. It contains these skills; pick one with --path <dir>:\n${shown}`;
|
|
178
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "jade/skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"api": "^1",
|
|
5
5
|
"entry": "./index.js",
|
|
6
|
+
"requires": [
|
|
7
|
+
"sources@1"
|
|
8
|
+
],
|
|
6
9
|
"optional": [
|
|
7
10
|
"ui@1",
|
|
8
11
|
"prompts@1",
|
|
9
12
|
"commands@1",
|
|
10
|
-
"approval@1"
|
|
13
|
+
"approval@1",
|
|
14
|
+
"cli@1"
|
|
11
15
|
]
|
|
12
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// 仓库目录、显示用的小工具、斜杠命令参数的切分、token 估算。插件之间不共享代码(只能共享类型),jade/mcp、jade/checks 各有一份。
|
|
2
2
|
import { existsSync, realpathSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
export function realPath(p) {
|
|
@@ -44,4 +44,46 @@ export const clip = (s, n) => (s.length > n ? s.slice(0, n) + "…" : s);
|
|
|
44
44
|
const colors = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR;
|
|
45
45
|
const paint = (open, close) => (s) => colors ? `\x1b[${open}m${s.replaceAll(`\x1b[${close}m`, `\x1b[${close}m\x1b[${open}m`)}\x1b[${close}m` : s;
|
|
46
46
|
export const dim = paint("2", "22");
|
|
47
|
+
export const red = paint("31", "39");
|
|
47
48
|
export const bold = paint("1", "22");
|
|
49
|
+
/** 斜杠命令的参数按空白切开;"…" 或 '…' 里的空白不切(不处理反斜杠,Windows 路径照写) */
|
|
50
|
+
export function splitArgs(text) {
|
|
51
|
+
const out = [];
|
|
52
|
+
let cur = "";
|
|
53
|
+
let started = false;
|
|
54
|
+
let quote;
|
|
55
|
+
for (const ch of text) {
|
|
56
|
+
if (quote) {
|
|
57
|
+
if (ch === quote)
|
|
58
|
+
quote = undefined;
|
|
59
|
+
else
|
|
60
|
+
cur += ch;
|
|
61
|
+
}
|
|
62
|
+
else if (ch === '"' || ch === "'") {
|
|
63
|
+
quote = ch;
|
|
64
|
+
started = true;
|
|
65
|
+
}
|
|
66
|
+
else if (/\s/.test(ch)) {
|
|
67
|
+
if (started)
|
|
68
|
+
out.push(cur);
|
|
69
|
+
cur = "";
|
|
70
|
+
started = false;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
cur += ch;
|
|
74
|
+
started = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (quote)
|
|
78
|
+
throw new Error(`unclosed ${quote}`);
|
|
79
|
+
if (started)
|
|
80
|
+
out.push(cur);
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
/** 中日韩文字和全角符号:大约一个字一个 token(和 jade/compact 的估算一致) */
|
|
84
|
+
const WIDE = /[ -鿿가-豈--]/g;
|
|
85
|
+
/** 粗略估算一段文字发给模型时占多少 token:英文和代码约 4 个字符 1 个,中日韩文字每字约 1 个 */
|
|
86
|
+
export function estimateTokens(text) {
|
|
87
|
+
const wide = text.match(WIDE)?.length ?? 0;
|
|
88
|
+
return Math.ceil((text.length - wide) / 4 + wide);
|
|
89
|
+
}
|
|
@@ -16,7 +16,7 @@ import { readdir, readFile, stat } from "node:fs/promises";
|
|
|
16
16
|
import os from "node:os";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { projectDirs } from "./project.js";
|
|
19
|
-
const NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
19
|
+
export const NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
20
20
|
/** 系统提示词里每个描述的上限 */
|
|
21
21
|
const MAX_DESCRIPTION = 400;
|
|
22
22
|
/** skill 工具列出的目录内文件数上限 */
|
|
@@ -104,6 +104,8 @@ export function parseSkill(text) {
|
|
|
104
104
|
}
|
|
105
105
|
return { meta, body: body.trim() };
|
|
106
106
|
}
|
|
107
|
+
/** 系统提示词的 skill 列表里这个 skill 的一行(/skills 按它估算占用) */
|
|
108
|
+
export const skillLine = (s) => `- ${s.name}: ${s.description.replace(/\s+/g, " ")}`;
|
|
107
109
|
/** 系统提示词里的 skill 列表;没有 skill 时为 undefined */
|
|
108
110
|
export function skillsPrompt(skills) {
|
|
109
111
|
if (skills.length === 0)
|
|
@@ -114,18 +116,27 @@ export function skillsPrompt(skills) {
|
|
|
114
116
|
"When a task matches a skill's description, call the skill tool with its name before starting, then follow the instructions it returns. " +
|
|
115
117
|
"Files a skill refers to are relative to its directory, which the skill tool tells you.",
|
|
116
118
|
"",
|
|
117
|
-
...skills.map(
|
|
119
|
+
...skills.map(skillLine),
|
|
118
120
|
].join("\n");
|
|
119
121
|
}
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
/**
|
|
123
|
+
* skill 工具:读入某个 skill 的正文,以及它目录里的文件。
|
|
124
|
+
* 会话里的工具列表在会话创建时就定了,所以不管有没有 skill 都注册它,名字也不写成 enum:
|
|
125
|
+
* 会话中途装的 skill 用 current() 取最新的列表,找不到时先 refresh() 重新查找一次。
|
|
126
|
+
* 说明里告诉模型怎么装 skill(装到 install 给的目录),否则它会照别的工具的习惯放进 .claude/skills
|
|
127
|
+
*/
|
|
128
|
+
export function skillTool(current, refresh, install) {
|
|
129
|
+
const lookup = (name) => current().find((s) => s.name.toLowerCase() === name.toLowerCase());
|
|
123
130
|
return {
|
|
124
131
|
name: "skill",
|
|
125
|
-
description:
|
|
132
|
+
description: 'Load the instructions of a skill listed in the system prompt under "# Skills". Call it when a task matches the skill\'s description, then follow the instructions. ' +
|
|
133
|
+
"To install a new skill, run `jade skills add <source>` in the shell (<source>: a git repository such as user/repo or a URL, an npm package, or a local directory; " +
|
|
134
|
+
"add `--path <dir>` for one skill inside a repository with several). It installs into " +
|
|
135
|
+
`${install.user}; add \`--project\` to install into ${install.project} for this project only. ` +
|
|
136
|
+
"Do not copy skills into .claude/skills. A newly installed skill can be used right away.",
|
|
126
137
|
inputSchema: {
|
|
127
138
|
type: "object",
|
|
128
|
-
properties: { name: { type: "string",
|
|
139
|
+
properties: { name: { type: "string", description: "the skill's name" } },
|
|
129
140
|
required: ["name"],
|
|
130
141
|
additionalProperties: false,
|
|
131
142
|
},
|
|
@@ -134,9 +145,15 @@ export function skillTool(skills) {
|
|
|
134
145
|
idempotent: true,
|
|
135
146
|
async execute(input) {
|
|
136
147
|
const name = String(input.name ?? "");
|
|
137
|
-
|
|
138
|
-
if (!skill)
|
|
139
|
-
|
|
148
|
+
let skill = lookup(name);
|
|
149
|
+
if (!skill) {
|
|
150
|
+
await refresh();
|
|
151
|
+
skill = lookup(name);
|
|
152
|
+
}
|
|
153
|
+
if (!skill) {
|
|
154
|
+
const names = current().map((s) => s.name);
|
|
155
|
+
return { content: `There is no skill named ${JSON.stringify(name)}. ${names.length ? `Available: ${names.join(", ")}.` : "No skills are installed."}`, isError: true };
|
|
156
|
+
}
|
|
140
157
|
let text;
|
|
141
158
|
try {
|
|
142
159
|
text = await readFile(path.join(skill.dir, "SKILL.md"), "utf8");
|