@lmzhen/dsh-tool-skill-manage 0.23.0 → 0.25.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.
Files changed (2) hide show
  1. package/lib/index.js +23 -23
  2. package/package.json +8 -8
package/lib/index.js CHANGED
@@ -31,7 +31,7 @@ import { DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_REFE
31
31
  * can never be read as the answer to a later one. */
32
32
  const CONFIRM_QUESTION_ID = "evolution-skill-write";
33
33
  /** The cancel label every confirm question offers. */
34
- const CANCEL_LABEL = "Cancel";
34
+ const CANCEL_LABEL = "取消";
35
35
  /** What a `timeout`-mode deadline settles with: comparable by identity against the seam's
36
36
  * boolean, so the two outcomes stay distinguishable without a mutable flag (which a linter
37
37
  * cannot follow through a timer callback, and a reader cannot either). */
@@ -151,7 +151,7 @@ const GATES = [
151
151
  warn("skill_manage: no confirmation channel is mounted, so the write proceeds unconfirmed.");
152
152
  return null;
153
153
  }
154
- const confirmLabel = action === "create" ? "Create" : "Delete";
154
+ const confirmLabel = action === "create" ? "创建" : "删除";
155
155
  const seconds = timeoutSecondsOf(confirmTimeoutSeconds);
156
156
  const cancel = new AbortController();
157
157
  let timer;
@@ -163,15 +163,15 @@ const GATES = [
163
163
  timer.unref();
164
164
  }) : void 0;
165
165
  const context = await describeTarget?.();
166
- const details = [context?.description === void 0 || context.description === "" ? null : "What it does: " + context.description, context?.versions === void 0 ? null : "Content versions recorded: " + String(context.versions)].filter((line) => line !== null);
167
- const consequence = action === "create" ? `Create skill "${view.name}"? A new skill directory is written into the family tree.` : `Delete skill "${view.name}"? It is archived under .archive and leaves the catalog.`;
166
+ const details = [context?.description === void 0 || context.description === "" ? null : "功能:" + context.description, context?.versions === void 0 ? null : "已记录的内容版本数:" + String(context.versions)].filter((line) => line !== null);
167
+ const consequence = action === "create" ? `创建技能 "${view.name}"?会在家族目录树里新建一个技能目录。` : `删除技能 "${view.name}"?它会被归档到 .archive 并离开目录。`;
168
168
  const asked = confirm({
169
169
  action,
170
170
  name: view.name,
171
171
  confirmLabel,
172
172
  question: {
173
173
  id: CONFIRM_QUESTION_ID,
174
- header: "Confirm",
174
+ header: "确认",
175
175
  question: details.length === 0 ? consequence : consequence + " " + details.join(" · "),
176
176
  options: [{ label: confirmLabel }, { label: CANCEL_LABEL }]
177
177
  },
@@ -186,12 +186,12 @@ const GATES = [
186
186
  if (outcome === true) return null;
187
187
  if (outcome === CONFIRM_TIMED_OUT || cancel.signal.aborted) return errorText("e-319-skill-write-confirm-timed-out", {
188
188
  a1: view.name,
189
- a2: action === "create" ? "created" : "deleted",
189
+ a2: action === "create" ? "创建" : "删除",
190
190
  a3: String(seconds)
191
191
  });
192
192
  return errorText("e-317-skill-write-not-confirmed", {
193
193
  a1: view.name,
194
- a2: action === "create" ? "created" : "deleted"
194
+ a2: action === "create" ? "创建" : "删除"
195
195
  });
196
196
  }
197
197
  }
@@ -328,7 +328,7 @@ async function previewSkillWrite(library, args) {
328
328
  const name = typeof operation.name === "string" ? operation.name.trim() : "";
329
329
  if (name === "") return {
330
330
  available: false,
331
- reason: "the staged write names no skill"
331
+ reason: "这条暂存写入没有指明技能"
332
332
  };
333
333
  const filePath = typeof operation.file_path === "string" && operation.file_path !== "" ? operation.file_path : null;
334
334
  const path = filePath ?? "SKILL.md";
@@ -336,7 +336,7 @@ async function previewSkillWrite(library, args) {
336
336
  const staged = operation.staged_from_sha256;
337
337
  if (anchorVerdict(typeof staged === "string" && staged !== "" ? staged === "absent" ? { absent: true } : { sha256: staged } : void 0, before) !== "match") return {
338
338
  available: false,
339
- reason: "the target changed after this write was staged — approving it would be refused"
339
+ reason: "目标在这次写入暂存之后发生了变化 —— 批准它会被拒绝"
340
340
  };
341
341
  const action = typeof operation.action === "string" ? operation.action : "";
342
342
  /**
@@ -360,7 +360,7 @@ async function previewSkillWrite(library, args) {
360
360
  const norm = normalizeFrontmatter(content);
361
361
  if (norm.issues.length > 0) return {
362
362
  available: false,
363
- reason: "frontmatter cannot be auto-fixed: " + norm.issues.join("; ")
363
+ reason: "frontmatter 无法自动修复:" + norm.issues.join("; ")
364
364
  };
365
365
  return {
366
366
  available: true,
@@ -371,23 +371,23 @@ async function previewSkillWrite(library, args) {
371
371
  };
372
372
  if (action === "create" || action === "update") return typeof operation.content === "string" ? bodyOnDisk(operation.content) : {
373
373
  available: false,
374
- reason: "\"" + action + "\" carries no content"
374
+ reason: "\"" + action + "\" 没有携带内容"
375
375
  };
376
376
  if (action === "patch") {
377
377
  if (before === null) return {
378
378
  available: false,
379
- reason: "the skill has no body to patch"
379
+ reason: "该技能没有可修补的正文"
380
380
  };
381
381
  const patched = fuzzyPatch(before, operation.old_string ?? "", operation.new_string ?? "", operation.replace_all === true);
382
382
  return patched === null ? {
383
383
  available: false,
384
- reason: "the staged old text is not in the current body — approving it would be refused"
384
+ reason: "暂存的旧文本不在当前正文里 —— 批准它会被拒绝"
385
385
  } : bodyOnDisk(patched);
386
386
  }
387
387
  if (action === "write_file") {
388
388
  if (typeof operation.file_content !== "string") return {
389
389
  available: false,
390
- reason: "\"write_file\" carries no content"
390
+ reason: "\"write_file\" 没有携带内容"
391
391
  };
392
392
  return {
393
393
  available: true,
@@ -398,7 +398,7 @@ async function previewSkillWrite(library, args) {
398
398
  }
399
399
  if (action === "remove_file") return before === null ? {
400
400
  available: false,
401
- reason: "that support file is not there to remove"
401
+ reason: "该支撑文件不存在,无法移除"
402
402
  } : {
403
403
  available: true,
404
404
  path,
@@ -703,7 +703,7 @@ function apply(ctx, rawConfig = {}) {
703
703
  } catch (error) {
704
704
  return {
705
705
  ok: false,
706
- message: `skill_manage review: skill tree scan failed (${error instanceof Error ? error.message : String(error)}).`,
706
+ message: `skill_manage review:技能目录树扫描失败(${error instanceof Error ? error.message : String(error)})。`,
707
707
  skills: []
708
708
  };
709
709
  }
@@ -711,13 +711,13 @@ function apply(ctx, rawConfig = {}) {
711
711
  const list = await library.list();
712
712
  return {
713
713
  ok: true,
714
- message: `Listed ${list.length} skills.`,
714
+ message: `已列出 ${list.length} 个技能。`,
715
715
  skills: list.map((s) => s.name)
716
716
  };
717
717
  } catch (error) {
718
718
  return {
719
719
  ok: false,
720
- message: `skill_manage list: skill tree scan failed (${error instanceof Error ? error.message : String(error)}).`,
720
+ message: `skill_manage list:技能目录树扫描失败(${error instanceof Error ? error.message : String(error)})。`,
721
721
  skills: []
722
722
  };
723
723
  }
@@ -746,7 +746,7 @@ function apply(ctx, rawConfig = {}) {
746
746
  feedbackLines = feedback.lines;
747
747
  if (settings().descriptionStrict && feedback.over60) return {
748
748
  ok: false,
749
- message: `Authoring check: description ${feedback.descriptionChars}/60 characters exceeds the strict bar; tighten it to <=60 or set descriptionStrict=false.`,
749
+ message: `作者检查:description 为 ${feedback.descriptionChars}/60 个字符,超过严格上限;请压到 60 以内,或设置 descriptionStrict=false。`,
750
750
  skills: []
751
751
  };
752
752
  }
@@ -767,7 +767,7 @@ function apply(ctx, rawConfig = {}) {
767
767
  return raw === null || typeof raw !== "object";
768
768
  })) result = {
769
769
  ok: false,
770
- message: "Every entry of restructure must be an object with heading and to_file."
770
+ message: "restructure 的每一项都必须是带 heading 与 to_file 的对象。"
771
771
  };
772
772
  else result = await library.restructure(name, moves.map((move) => ({
773
773
  heading: typeof move.heading === "string" ? move.heading : "",
@@ -777,11 +777,11 @@ function apply(ctx, rawConfig = {}) {
777
777
  else if (action === "unpin") result = await library.setPinned(name, false, origin);
778
778
  else result = {
779
779
  ok: false,
780
- message: `Unknown action "${action}".`
780
+ message: `未知动作「${action}」。`
781
781
  };
782
782
  if (result.stale === true) return {
783
783
  ok: false,
784
- message: action === "write_file" || action === "remove_file" ? `Support file "${args.file_path ?? ""}" of "${name}" changed after this write was staged (or its state could not be verified).` : `Skill "${name}" changed after this write was staged (content ${result.anchor === "missing" ? "no longer exists" : "hash mismatch"}).`,
784
+ message: action === "write_file" || action === "remove_file" ? `技能「${name}」的支撑文件「${args.file_path ?? ""}」在这次写入暂存之后发生了变化(或其状态无法验证)。` : `技能「${name}」在这次写入暂存之后发生了变化(内容${result.anchor === "missing" ? "已不存在" : "哈希不匹配"})。`,
785
785
  skills: []
786
786
  };
787
787
  if (result.ok) {
@@ -1035,7 +1035,7 @@ function apply(ctx, rawConfig = {}) {
1035
1035
  if (!isReadOnlyAction(replayAction)) return crossSourceRefusal(operation.name, "replay").then((gate) => {
1036
1036
  if (gate.refusal !== null) return {
1037
1037
  ok: false,
1038
- message: `${gate.refusal} (re-checked at approve time: the catalog ranking changed while the write was staged)`,
1038
+ message: `${gate.refusal}(在批准时重新检查:该写入暂存期间目录排名发生了变化)`,
1039
1039
  skills: []
1040
1040
  };
1041
1041
  return executeCore(operation, wrapped.libraryOrigin ?? wrapped.origin ?? "background_review", gate.view ?? void 0);
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.23.0",
4
+ "version": "0.25.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,24 +27,24 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.4",
30
- "@lmzhen/dsh-evolution-approval": "^0.23.0",
31
- "@lmzhen/dsh-evolution-core": "^0.23.0"
30
+ "@lmzhen/dsh-evolution-approval": "^0.25.0",
31
+ "@lmzhen/dsh-evolution-core": "^0.25.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@deepseek-ai/cordis": "^4.0.1",
35
35
  "@deepseek-ai/dsh-skill": "^0.2.0-rc.1",
36
36
  "@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.1",
37
37
  "@deepseek-ai/dsh-tools": "^0.2.0-rc.1",
38
- "@lmzhen/dsh-evolution-io": "^0.23.0",
39
- "@lmzhen/dsh-skill-usage": "^0.23.0"
38
+ "@lmzhen/dsh-evolution-io": "^0.25.0",
39
+ "@lmzhen/dsh-skill-usage": "^0.25.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@deepseek-ai/dsh-agent-loop-testkit": "^0.2.0-rc.1",
43
43
  "@deepseek-ai/dsh-skill": "^0.2.0-rc.1",
44
44
  "@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.1",
45
45
  "@deepseek-ai/dsh-tools": "^0.2.0-rc.1",
46
- "@lmzhen/dsh-evolution-core": "^0.23.0",
47
- "@lmzhen/dsh-evolution-io": "^0.23.0",
48
- "@lmzhen/dsh-skill-usage": "^0.23.0"
46
+ "@lmzhen/dsh-evolution-core": "^0.25.0",
47
+ "@lmzhen/dsh-evolution-io": "^0.25.0",
48
+ "@lmzhen/dsh-skill-usage": "^0.25.0"
49
49
  }
50
50
  }