@lmzhen/dsh-tool-skill-manage 0.3.66 → 0.3.68
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/lib/index.js +34 -2
- package/package.json +8 -8
package/lib/index.js
CHANGED
|
@@ -94,6 +94,31 @@ function apply(ctx, rawConfig = {}) {
|
|
|
94
94
|
skills: []
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
+
const missing = (action === void 0 ? [] : {
|
|
98
|
+
create: ["name", "content"],
|
|
99
|
+
edit: ["name", "content"],
|
|
100
|
+
update: ["name", "content"],
|
|
101
|
+
patch: [
|
|
102
|
+
"name",
|
|
103
|
+
"old_string",
|
|
104
|
+
"new_string"
|
|
105
|
+
],
|
|
106
|
+
delete: ["name"],
|
|
107
|
+
write_file: [
|
|
108
|
+
"name",
|
|
109
|
+
"file_path",
|
|
110
|
+
"file_content"
|
|
111
|
+
],
|
|
112
|
+
remove_file: ["name", "file_path"],
|
|
113
|
+
restructure: ["name"],
|
|
114
|
+
pin: ["name"],
|
|
115
|
+
unpin: ["name"]
|
|
116
|
+
}[action] ?? []).filter((field) => scalarArgs[field] === void 0 || scalarArgs[field] === null);
|
|
117
|
+
if (missing.length > 0) return {
|
|
118
|
+
ok: false,
|
|
119
|
+
message: `skill_manage ${action} requires ${missing.join(", ")}; the tool description lists the arguments per action.`,
|
|
120
|
+
skills: []
|
|
121
|
+
};
|
|
97
122
|
let feedbackLines = [];
|
|
98
123
|
if ((action === "edit" || action === "update") && typeof args.staged_from_sha256 === "string" && args.staged_from_sha256 !== "") {
|
|
99
124
|
const currentContent = await library.read(name).catch(() => null);
|
|
@@ -125,7 +150,14 @@ function apply(ctx, rawConfig = {}) {
|
|
|
125
150
|
else if (action === "remove_file") result = await library.removeSupportFile(name, args.file_path ?? "", origin);
|
|
126
151
|
else if (action === "restructure") {
|
|
127
152
|
const moves = Array.isArray(args.restructure) ? args.restructure : [];
|
|
128
|
-
|
|
153
|
+
if (moves.some((move) => {
|
|
154
|
+
const raw = move;
|
|
155
|
+
return raw === null || typeof raw !== "object";
|
|
156
|
+
})) result = {
|
|
157
|
+
ok: false,
|
|
158
|
+
message: "Every entry of restructure must be an object with heading and to_file."
|
|
159
|
+
};
|
|
160
|
+
else result = await library.restructure(name, moves.map((move) => ({
|
|
129
161
|
heading: typeof move.heading === "string" ? move.heading : "",
|
|
130
162
|
toFile: typeof move.to_file === "string" ? move.to_file : ""
|
|
131
163
|
})), origin);
|
|
@@ -176,7 +208,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
176
208
|
}
|
|
177
209
|
ctx.tools.register(defineTool({
|
|
178
210
|
name: "skill_manage",
|
|
179
|
-
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/edit/update take full SKILL.md content (edit is an alias of update); patch applies old_string -> new_string; delete archives to .archive (absorbed_into names an umbrella skill); write_file/remove_file add or remove one support file under references/ or scripts/; pin protects a skill from deletion, background review, and the lifecycle (pin/unpin are never allowed from a background review — foreground and delegated subagents may). Protected bundled/hub skills reject any mutation; pinned skills reject deletion and are read-only to the background review.Prefer patching an umbrella over creating narrow skills. restructure moves entire body sections (by their exact \"## heading\" line, via restructure: [{heading, to_file: \"references/<topic>.md\"}]) into a references/ file and replaces each with a pointer line — the skill name and directory never change.Created/edited SKILL.md MUST start with YAML frontmatter (a name/description block), or creation is rejected. " + DSH_AUTHORING_STANDARDS,
|
|
211
|
+
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/edit/update take full SKILL.md content (edit is an alias of update); patch applies old_string -> new_string; delete archives to .archive (absorbed_into names an umbrella skill); write_file/remove_file add or remove one support file under references/ or scripts/; pin protects a skill from deletion, background review, and the lifecycle (pin/unpin are never allowed from a background review — foreground and delegated subagents may). Per-action arguments: patch needs name + old_string + new_string and patches SKILL.md unless file_path names a support file (e.g. \"references/topic.md\"); patch replaces the FIRST occurrence only unless replace_all=true, and the result message reports how many anchors the file carried. write_file needs name + file_path + file_content; remove_file needs name + file_path; create/edit/update need name + content; delete needs name. A rejected patch names the reason and the remedy (missing anchor, stale snapshot, frontmatter that cannot be auto-quoted, byte/char limit). Protected bundled/hub skills reject any mutation; pinned skills reject deletion and are read-only to the background review.Prefer patching an umbrella over creating narrow skills. restructure moves entire body sections (by their exact \"## heading\" line, via restructure: [{heading, to_file: \"references/<topic>.md\"}]) into a references/ file and replaces each with a pointer line — the skill name and directory never change.Created/edited SKILL.md MUST start with YAML frontmatter (a name/description block), or creation is rejected. " + DSH_AUTHORING_STANDARDS,
|
|
180
212
|
parameters: {
|
|
181
213
|
action: {
|
|
182
214
|
type: "string",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-tool-skill-manage",
|
|
3
3
|
"description": "Model-facing skill_manage tool (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.68",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-approval": "^0.3.
|
|
35
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-approval": "^0.3.68",
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.3.68"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
39
39
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
40
40
|
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
|
|
41
41
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
|
|
42
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
43
|
-
"@lmzhen/dsh-skill-usage": "^0.3.
|
|
42
|
+
"@lmzhen/dsh-evolution-io": "^0.3.68",
|
|
43
|
+
"@lmzhen/dsh-skill-usage": "^0.3.68"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.1-rc.2",
|
|
47
47
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
48
48
|
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
|
|
49
49
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
|
|
50
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
51
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
52
|
-
"@lmzhen/dsh-skill-usage": "^0.3.
|
|
50
|
+
"@lmzhen/dsh-evolution-core": "^0.3.68",
|
|
51
|
+
"@lmzhen/dsh-evolution-io": "^0.3.68",
|
|
52
|
+
"@lmzhen/dsh-skill-usage": "^0.3.68"
|
|
53
53
|
}
|
|
54
54
|
}
|