@lmzhen/dsh-tool-skill-manage 0.3.62 → 0.3.63
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 +10 -11
- package/package.json +10 -8
package/lib/index.js
CHANGED
|
@@ -69,11 +69,6 @@ function apply(ctx, rawConfig = {}) {
|
|
|
69
69
|
message: await buildSkillReviewText(),
|
|
70
70
|
skills: []
|
|
71
71
|
};
|
|
72
|
-
if (action === "skip") return {
|
|
73
|
-
ok: true,
|
|
74
|
-
message: "Skipped; no skill changes this pass.",
|
|
75
|
-
skills: []
|
|
76
|
-
};
|
|
77
72
|
if (action === "list") {
|
|
78
73
|
const list = await library.list();
|
|
79
74
|
return {
|
|
@@ -116,7 +111,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
116
111
|
};
|
|
117
112
|
if (result.ok) {
|
|
118
113
|
if (result.normalizedFrontmatterFields && result.normalizedFrontmatterFields.length > 0) feedbackLines.push(`frontmatter auto-quoted (YAML compatibility): ${result.normalizedFrontmatterFields.join(", ")}`);
|
|
119
|
-
const mutating = action !== "list" && action !== "review" && action !== "
|
|
114
|
+
const mutating = action !== "list" && action !== "review" && action !== "pin" && action !== "unpin";
|
|
120
115
|
if (name && action === "create") await ctx.skillUsage.ensureRecordCreated(name, origin !== "foreground");
|
|
121
116
|
if (name && action === "delete") await ctx.skillUsage.markArchived(name);
|
|
122
117
|
else if (name && mutating && action !== "create" && result.noop !== true) await ctx.skillUsage.record(name, "patch");
|
|
@@ -130,14 +125,19 @@ function apply(ctx, rawConfig = {}) {
|
|
|
130
125
|
async function buildSkillReviewText() {
|
|
131
126
|
const list = await library.list();
|
|
132
127
|
const report = await ctx.skillUsage.report();
|
|
128
|
+
const warnedFlag = (name) => {
|
|
129
|
+
const record = report.get(name);
|
|
130
|
+
return record?.quality_warn === true || record?.feedback_warn === true;
|
|
131
|
+
};
|
|
133
132
|
const lines = list.map((summary) => {
|
|
134
133
|
const record = report.get(summary.name);
|
|
135
|
-
const
|
|
134
|
+
const warned = warnedFlag(summary.name);
|
|
135
|
+
const quality = record?.quality_score !== void 0 ? ` quality:${record.quality_score.toFixed(2)}${warned ? "⚠" : ""}` : warned ? " quality:⚠" : "";
|
|
136
136
|
return `- ${summary.name} | ${record?.state ?? "active"} | use:${record?.use_count ?? 0} view:${record?.view_count ?? 0} patch:${record?.patch_count ?? 0}${quality}${summary.protectedBy ? ` [${summary.protectedBy}]` : ""}`;
|
|
137
137
|
});
|
|
138
138
|
const groups = computeDedupGroups({ contents: new Map(await Promise.all(list.map(async (summary) => [summary.name, await library.read(summary.name) ?? ""]))) });
|
|
139
139
|
const dedupLines = groups.slice(0, MAX_DEDUP_GROUPS_IN_REVIEW).map((group) => `- ${group.join(" ~ ")}`);
|
|
140
|
-
const warned = list.filter((summary) =>
|
|
140
|
+
const warned = list.filter((summary) => warnedFlag(summary.name)).map((summary) => summary.name);
|
|
141
141
|
const warningLine = warned.length === 0 ? "" : `\nWarning skills (${warned.length}): ${warned.join(", ")} — low quality; consider consolidating them before authoring new skills.`;
|
|
142
142
|
return [
|
|
143
143
|
list.length === 0 ? "No skills yet. Create one with action=create, or it is safe to author a new class-level umbrella." : `Skills: ${list.length} total. Below each name: state, use/view/patch counts, quality (0-1, ⚠ = low) and protection.${groups.length > 0 ? `\n\nNear-duplicate groups (${groups.length}):` : ""}`,
|
|
@@ -149,7 +149,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
149
149
|
}
|
|
150
150
|
ctx.tools.register(defineTool({
|
|
151
151
|
name: "skill_manage",
|
|
152
|
-
description: "Manage reusable skills. review returns the library review text (state/usage/quality per skill); list returns names only; create/edit take full SKILL.md content; patch applies old_string -> new_string; delete archives to .archive; 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,
|
|
152
|
+
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,
|
|
153
153
|
parameters: {
|
|
154
154
|
action: {
|
|
155
155
|
type: "string",
|
|
@@ -165,7 +165,6 @@ function apply(ctx, rawConfig = {}) {
|
|
|
165
165
|
"write_file",
|
|
166
166
|
"remove_file",
|
|
167
167
|
"restructure",
|
|
168
|
-
"skip",
|
|
169
168
|
"pin",
|
|
170
169
|
"unpin"
|
|
171
170
|
]
|
|
@@ -223,7 +222,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
223
222
|
const libraryOrigin = origins.library;
|
|
224
223
|
const sessionPolicy = effectiveSessionPolicy(ctx, exec.agent?.session);
|
|
225
224
|
const approval = ctx.get("evolutionApproval");
|
|
226
|
-
if (approval && args.action !== "list" && args.action !== "review" && args.action !== "
|
|
225
|
+
if (approval && args.action !== "list" && args.action !== "review" && args.action !== "pin" && args.action !== "unpin") {
|
|
227
226
|
const decision = await approval.request({
|
|
228
227
|
kind: "skill",
|
|
229
228
|
summary: `skill ${args.action ?? "?"} ${args.name ?? ""}`.trim(),
|
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.63",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,22 +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.63",
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.3.63"
|
|
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
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
|
|
40
41
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
|
|
41
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
42
|
-
"@lmzhen/dsh-skill-usage": "^0.3.
|
|
42
|
+
"@lmzhen/dsh-evolution-io": "^0.3.63",
|
|
43
|
+
"@lmzhen/dsh-skill-usage": "^0.3.63"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.1-rc.2",
|
|
46
47
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
|
|
47
49
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
|
|
48
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
49
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
50
|
-
"@lmzhen/dsh-skill-usage": "^0.3.
|
|
50
|
+
"@lmzhen/dsh-evolution-core": "^0.3.63",
|
|
51
|
+
"@lmzhen/dsh-evolution-io": "^0.3.63",
|
|
52
|
+
"@lmzhen/dsh-skill-usage": "^0.3.63"
|
|
51
53
|
}
|
|
52
54
|
}
|