dsh-plugin-prompt-tool 0.4.1 → 0.4.2

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 CHANGED
@@ -128,8 +128,9 @@ dsh --profile web
128
128
  dsh plugin --profile prompt-tool remove dsh-plugin-prompt-tool
129
129
  ```
130
130
 
131
- 首次启动还会把包内 `skills/` 增量复制到当前 profile 目录下的
132
- `$DSH_HOME/profiles/<profile>/skills`,并优先使用这份副本:已有同名文件不覆盖,
131
+ 首次启动还会把包内 `skills/` 增量复制到**本插件自己的 profile** 目录下的
132
+ `$DSH_HOME/profiles/prompt-tool/skills`,并优先使用这份副本(从 `dsh web`
133
+ 或 `dsh-tui` 启动也一样写这里,不会写到 web/dsh-tui profile):已有同名文件不覆盖,
133
134
  用户对副本的编辑会保留;包内新增技能文件会在下次启动补齐。想改回包内原始
134
135
  skills,删除该 `skills` 目录后重启即可(或在配置里显式设置 `skillsDir`)。
135
136
 
@@ -203,7 +204,7 @@ pnpm sync:anchored # 从上游 main 刷新内联快照(可加 ref 参数)
203
204
  subagentFlashModel: 'deepseek-v4-flash'
204
205
  bootstrapMaxTokens: 0 # 首轮输出封顶:0=关闭;正整数=请求 #1 maxTokens
205
206
  usePtcMode: true # 使用 PTC 模式:true=晋升后切换为 Code Mode(run_code);false=恢复原生完整目录
206
- skillsDir: '' # 用户自定义技能目录;空 = 自动使用 profile 下 skills/ 副本
207
+ skillsDir: '' # 用户自定义技能目录;空 = 自动使用 prompt-tool profile 下 skills/ 副本
207
208
  skillRankBase: 250 # 技能候选排序基数
208
209
  residentAgentsPath: '' # 默认 ~/.dsh/AGENTS.md
209
210
  presetDir: '' # 默认 ~/.dsh/.agent-presets/prompt-tool/
package/lib/index.mjs CHANGED
@@ -193,14 +193,18 @@ function ensureWebSurface(ctx, warn) {
193
193
  *
194
194
  * 安装命令 `dsh plugin add` 是官方的 pnpm 转发器,插件代码不会在该命令中
195
195
  * 执行(本项目也不修改官方源码)。因此复制动作放在插件首次 apply 时:
196
- * 把包内 `skills/` 增量复制到当前 profile 目录下的 `skills/`
197
- * (`$DSH_HOME/profiles/<profile>/skills`),并且后续启动优先使用这份副本。
196
+ * 把包内 `skills/` 增量复制到**本插件自己的 profile** 目录下的 `skills/`
197
+ * (`$DSH_HOME/profiles/prompt-tool/skills`),并且后续启动优先使用这份副本。
198
+ * 即使本插件从 `dsh web` / `dsh-tui` 启动,也固定写到 prompt-tool profile,
199
+ * 不会写到 web / dsh-tui 的 profile 下。
198
200
  *
199
201
  * 合并规则:
200
202
  * - 只补缺失项,绝不覆盖已存在文件——用户在 profile 副本里的修改会保留;
201
203
  * - 包内新增的技能目录/文件会在下次启动补进副本;
202
204
  * - 副本目录不可写或 profile 定位失败时回退到包内目录,只告警不阻断。
203
205
  */
206
+ /** 本插件专属 profile 名;skills 副本固定放这里。 */
207
+ const PLUGIN_PROFILE = "prompt-tool";
204
208
  /** 递归把 src 中缺失的目录/文件补到 dst,已有项保持不动。 */
205
209
  function mergeMissing(src, dst) {
206
210
  mkdirSync(dst, { recursive: true });
@@ -211,13 +215,21 @@ function mergeMissing(src, dst) {
211
215
  else if (entry.isDirectory()) mergeMissing(srcEntry, dstEntry);
212
216
  }
213
217
  }
218
+ /** 定位本插件自己的 profile 目录;不存在时回退到当前 profile。 */
219
+ function resolvePluginProfileDir(ctx) {
220
+ const currentDir = resolveProfileDir(ctx);
221
+ if (currentDir === void 0) return void 0;
222
+ const profilesDir = join(currentDir, "..");
223
+ const pluginDir = join(profilesDir, PLUGIN_PROFILE);
224
+ return existsSync(join(pluginDir, "package.json")) ? pluginDir : currentDir;
225
+ }
214
226
  /**
215
227
  * 返回本插件应使用的 skills 目录:
216
- * 优先当前 profile 下的 `skills/` 副本;无法确定 profile 或复制失败时
217
- * 回退到 sourceDir(默认包内 `skills/`)。
228
+ * 优先本插件 profile(prompt-tool)下的 `skills/` 副本;无法确定 profile
229
+ * 或复制失败时回退到 sourceDir(默认包内 `skills/`)。
218
230
  */
219
231
  function resolveProfileSkillsDir(ctx, sourceDir, warn) {
220
- const profileDir = resolveProfileDir(ctx);
232
+ const profileDir = resolvePluginProfileDir(ctx);
221
233
  if (profileDir === void 0) return sourceDir;
222
234
  const targetDir = join(profileDir, "skills");
223
235
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-prompt-tool",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "DSH 插件:提示词工具,规范模型的思维链与回答内容,提供 Web UI 编辑 preset.md 与 AGENTS.md,并按 skills 目录注册可开关技能。",
5
5
  "license": "MIT",
6
6
  "repository": {