dsh-hiss-plugins 1.0.0 → 1.2.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 +74 -14
- package/cordis.patch.yml +11 -2
- package/lib/client.js +9 -0
- package/lib/init/index.js +72 -0
- package/lib/init/prompt.js +92 -0
- package/lib/ponytail/index.js +125 -0
- package/lib/ponytail/mode.js +113 -0
- package/lib/superpowers/index.js +59 -0
- package/locale/en.json +5 -2
- package/locale/zh.json +5 -2
- package/package.json +14 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# dsh-hiss-plugins
|
|
2
2
|
|
|
3
|
-
一个 DeepSeek Harness **bundle
|
|
3
|
+
一个 DeepSeek Harness **bundle 插件**,把七个功能装在一个包里:**colgrep**(语义代码检索)、**codegraph**(代码图 MCP)、**project-mcp**(项目 `.mcp.json`)、**git-bash**(Windows 上的 Git Bash shell)、**superpowers**(superpowers 技能常驻引导)、**ponytail**(ponytail 采纳提示与 `/ponytail` 等级切换)、**init**(读项目生成 `AGENTS.md`)。七个功能各占一条顶层行,可以在 **Plugins 页**里单独开关;包还带一个管理标签,就挂在那个页面上。
|
|
4
4
|
|
|
5
5
|
安装后对 `web`、`headless` 等任意 profile 的**所有 preset、所有会话**生效。
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 八条行与七个开关
|
|
8
8
|
|
|
9
|
-
`cordis.patch.yml` 只做一件事:`insert`
|
|
9
|
+
`cordis.patch.yml` 只做一件事:`insert` 八条**顶层行**。宿主用 `name`(模块说明符)解析模块,用 `id` 记住开关状态。
|
|
10
10
|
|
|
11
11
|
| 行 id | 模块 | 作用 | 默认 |
|
|
12
12
|
|---|---|---|---|
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
| `dsh-hiss-plugins-codegraph` | `dsh-hiss-plugins/codegraph` | 经 MCP 注册 `mcp__codegraph__*` 工具 + 使用引导 | 开 |
|
|
16
16
|
| `dsh-hiss-plugins-project-mcp` | `dsh-hiss-plugins/project-mcp` | 读会话项目根的 `.mcp.json`,把其中的 MCP server 挂进该 agent 自己的 scope | 开 |
|
|
17
17
|
| `dsh-hiss-plugins-gitbash` | `dsh-hiss-plugins/gitbash` | Windows 上接入 Git Bash:提供 `ctx.shell` + 宿主 `bash` 工具 | 非 Windows 关 |
|
|
18
|
+
| `dsh-hiss-plugins-superpowers` | `dsh-hiss-plugins/superpowers` | superpowers 技能常驻引导:任何回复前先检查有没有适用的技能,有就先加载(技能集本身由 DSH 原生发现) | 开 |
|
|
19
|
+
| `dsh-hiss-plugins-ponytail` | `dsh-hiss-plugins/ponytail` | ponytail 采纳提示(随等级变化)+ 宿主 `/ponytail` 等级命令 | 开 |
|
|
20
|
+
| `dsh-hiss-plugins-init` | `dsh-hiss-plugins/init` | 宿主 `/init` 命令:读项目、生成/更新 `AGENTS.md` | 开 |
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
**七条功能行就是 Plugins 页里那七个开关。** 载体行不在标签的开关列表里 —— 它是空的 host 半,但只有它在,浏览器半才会被送进页面;关掉它,管理标签本身就没了。
|
|
20
23
|
|
|
21
24
|
为什么必须是顶层行:插件管理器只为「组合后的 patch 里存在同 `id`、同 `name`,且挂载后父 entry 就是 profile 的 `include`」的行持久化开关。包在 `cordis:group` 里的子行在 `listPlugins()` 里被判为 `unaddressable`,**永远不会有开关**。所以这里没有组:git-bash 行把 realm 隔离写在自己身上(见下)。
|
|
22
25
|
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
- 宿主把 `{ id: <行 id>, disabled: <bool> }` 覆盖写进 **profile 自己的** `cordis.patch.yml`(保留注释、原子写)—— 只影响这个 profile,不动包内的 `cordis.patch.yml`,所以升级/重装不会丢开关。
|
|
29
32
|
- **带 HMR 的 profile 立即生效**(远程结果 `application: "applied"`);**没有 HMR 的 profile 返回 `application: "restart-required"`(`restartReason: "no-hmr"`),重启 dsh 才生效**。
|
|
30
33
|
- 行不可开关时,`listPlugins()` 会给出 `readOnlyReason`:`unaddressable`(不是顶层行 / 名字对不上)或 `management-required`(插件管理器自己的行或受保护模块)。
|
|
31
|
-
-
|
|
34
|
+
- 关掉一条功能行只是让那条行不激活:另外六条行不受影响,管理标签仍在(载体行开着)。
|
|
32
35
|
|
|
33
36
|
## 安装 / 卸载
|
|
34
37
|
|
|
@@ -37,7 +40,7 @@ dsh plugin --profile web add dsh-hiss-plugins
|
|
|
37
40
|
# 或从本仓 checkout:dsh plugin --profile web add link:./dsh-hiss-plugins
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
把 `web` 换成你的 profile 名(例如 `headless`),然后**重启 dsh**。`dsh plugin` 会把本包装进 profile 的 `node_modules`;因为 `package.json` 声明了 `dsh.bundle.patch`,profile 的 bundle 列表会自动追加 `dsh-hiss-plugins
|
|
43
|
+
把 `web` 换成你的 profile 名(例如 `headless`),然后**重启 dsh**。`dsh plugin` 会把本包装进 profile 的 `node_modules`;因为 `package.json` 声明了 `dsh.bundle.patch`,profile 的 bundle 列表会自动追加 `dsh-hiss-plugins`,重启后八条行一起激活。
|
|
41
44
|
|
|
42
45
|
```powershell
|
|
43
46
|
dsh plugin --profile web remove dsh-hiss-plugins
|
|
@@ -47,7 +50,7 @@ dsh plugin --profile web remove dsh-hiss-plugins
|
|
|
47
50
|
|
|
48
51
|
## 管理标签(浏览器半)
|
|
49
52
|
|
|
50
|
-
Plugins 页(侧边栏 **插件**)里多出一个 `dsh-hiss-plugins`
|
|
53
|
+
Plugins 页(侧边栏 **插件**)里多出一个 `dsh-hiss-plugins` 标签,列出上面七条功能行与它们的开关。
|
|
51
54
|
|
|
52
55
|
- 浏览器半是 **`lib/client.js`** —— 手写的 lazy-CJS bundle,没有构建步骤:`window.__ModuleLoader__.load({ id: "dsh-hiss-plugins", factory })` 只注册工厂,模块体(slot 注册、locale 字典)在首次被 require 时执行。`id` 必须逐字等于包名(客户端图里的行 id 就是包名)。
|
|
53
56
|
- `package.json` 里 `dsh.client.platform = "web"`、`exports["./client"]` 指向 `lib/client.js`;客户端模块系统按 Loader 行扫描,**只有本包有行挂载,这个文件才会被送进浏览器**。
|
|
@@ -266,6 +269,60 @@ colgrep command:"init" / command:"status" / command:"clear"
|
|
|
266
269
|
- **只解析常规 Git for Windows 布局** —— 便携版/自定义布局请显式设 `DSH_GIT_BASH`。
|
|
267
270
|
- **依赖宿主包内部接缝** —— 执行器继承 `dsh-bash-sandbox` 的 `confine(command, policy)`。DSH 升级若改动该形状,插件会失效(`test/gitbash/` 里的接线断言会在契约变化时暴露)。
|
|
268
271
|
|
|
272
|
+
## 功能:superpowers(常驻引导)
|
|
273
|
+
|
|
274
|
+
把 superpowers 技能集的**常驻引导**接回来:只注册一个全局提示词段 `superpowers:adoption`(`order: 5`,排在人格前缀之后、各策略与工具段之前)。段文本是上游 bootstrap 原文,外层包着 `<EXTREMELY_IMPORTANT>`;技能从插件里移出来后有两处必须改,也写在这里 —— 技能改用裸名寻址、技能集没装时忽略本段:
|
|
275
|
+
|
|
276
|
+
- **任何回复或动作之前**先检查有没有适用的 superpowers 技能,有就先调 `skill` 工具加载;
|
|
277
|
+
- 过程类技能(`brainstorming`、`systematic-debugging`)先于实现类技能;
|
|
278
|
+
- 技能用**裸 kebab-case 名**寻址(`brainstorming`、`writing-plans`、`test-driven-development`、`verification-before-completion`),不是上游的 `superpowers:<name>` 形式;
|
|
279
|
+
- 技能目录里没有任何 superpowers 技能时,忽略这一段;
|
|
280
|
+
- 完整指令在 `using-superpowers` 技能里,用 `skill` 工具加载。
|
|
281
|
+
|
|
282
|
+
没有技能 provider,没有命令。系统提示词每回合重新组装,所以这条常驻指令在上下文压缩之后依然在。
|
|
283
|
+
|
|
284
|
+
**技能本身由 DSH 原生发现**:它们就在被扫描的技能根里(`dsh-skill-filesystem` 的 `user-agents` 根,默认共享根 `~/.agents/skills`,rank 500),本插件不安装、不内置、不搬运任何技能文件。上游把「回答前先查技能」这条指令放进会话启动钩子,而 DSH 不读插件的 hook 文件 —— 缺的只有这条**常驻指令**,这也正是这个功能行存在的理由。
|
|
285
|
+
|
|
286
|
+
前置要求:superpowers 技能集装在一个 DSH 会扫描的技能根里(本机惯例是共享根 `~/.agents/skills`)。
|
|
287
|
+
|
|
288
|
+
验证:重启后给一个会命中 superpowers 技能的任务,看模型是否先调 `skill` 再动手。技能集没装时这段引导按它自己的判据被忽略,不影响其它行。
|
|
289
|
+
|
|
290
|
+
## 功能:ponytail(采纳提示与 /ponytail 等级切换)
|
|
291
|
+
|
|
292
|
+
把 ponytail 技能集的**等级状态**接回来:一个全局提示词段 `ponytail:adoption`(`order: 5`)加一个宿主命令 `/ponytail`。
|
|
293
|
+
|
|
294
|
+
- **提示词段随等级变化**:等级为 `off` 时文本是空串(等于不注入);否则是采纳提示(任何编码任务 —— 写、改、重构、修、评审、选依赖 —— 先用 `skill` 工具加载 `ponytail` 技能并按它执行)再加当前等级。当前等级写进文本里,所以重启后默认等级重新生效时这段话仍然是真的。
|
|
295
|
+
- **`/ponytail` 命令**(本插件注册的宿主命令,跟同名的 `ponytail` 技能是两回事):参数取 `lite` / `full` / `ultra` / `off`,不带参数等于 `full`。
|
|
296
|
+
- `lite` / `full` / `ultra`:把该 agent 的等级设为这一档,**并立刻把渲染好的 `ponytail` SKILL.md 正文作为一条持久 user 消息交给模型**(下一步就读到),返回 `Ponytail mode set to <level>.`;
|
|
297
|
+
- `off`:关掉该 agent 的等级,并注入一条「忽略 ponytail 指令」的消息,返回 `Ponytail off.`(不需要技能在场);
|
|
298
|
+
- 其它输入:返回用法错误 `Usage: /ponytail [lite|full|ultra|off]`,**不改任何状态**;
|
|
299
|
+
- `ponytail` 技能缺失或读不出来:返回错误,**不改任何状态** —— 等级不能设在一个模型执行不了的技能上。
|
|
300
|
+
- **默认等级**按上游的顺序解析:`PONYTAIL_DEFAULT_MODE` 环境变量 → `%APPDATA%\ponytail\config.json`(非 Windows:`$XDG_CONFIG_HOME` 或 `~/.config` 下的 `ponytail/config.json`)里的 `defaultMode` → `full`。配置缺失、读不了、坏 JSON、值非法都不是错误,直接往下走。
|
|
301
|
+
- **等级状态在进程内、按 agent 分开(WeakMap),不落盘**:`/ponytail` 的设定在 dsh 重启后回到默认等级;要持久就写环境变量或配置文件。
|
|
302
|
+
- 输入框里敲 `/` 会出现**两条 `ponytail`**:宿主命令(本插件注册,用来切等级)和 `ponytail` 技能(DSH 原生发现,用来加载技能正文);`/ponytail-review` 这类手势本来就由 `dsh-tool-skill` 原生处理。
|
|
303
|
+
|
|
304
|
+
**技能本身由 DSH 原生发现**:`ponytail`、`ponytail-review` 等技能就在被扫描的技能根里(默认共享根 `~/.agents/skills`,rank 500),本插件不安装、不内置任何技能,也不为每个技能注册命令。缺的只有等级 —— 一个让技能持续在线的常驻提示,和一个改变它施加力度的开关。
|
|
305
|
+
|
|
306
|
+
前置要求:`ponytail` 技能装在一个 DSH 会扫描的技能根里(本机惯例是共享根 `~/.agents/skills`)。
|
|
307
|
+
|
|
308
|
+
验证:`/ponytail ultra` 后给一个编码任务,模型应加载 `ponytail` 技能并按 ultra 档执行;`/ponytail off` 后该提示词段变空。
|
|
309
|
+
|
|
310
|
+
## 功能:init(读项目生成 AGENTS.md)
|
|
311
|
+
|
|
312
|
+
注册宿主命令 **`/init`**:把一条固定的、面向仓库调研的指令作为持久 user 消息交给模型,让智能体先读项目、再在项目根写 `AGENTS.md`。插件本身不读文件、不生成内容 —— 阅读、检索、写入都走智能体已有的工具,指令的质量就是功能的全部。
|
|
313
|
+
|
|
314
|
+
- **目标位置**:从会话工作目录向上找最近的、含 `.git` 的祖先目录作为项目根,写 `<项目根>/AGENTS.md`;找不到 `.git` 时用工作目录本身。
|
|
315
|
+
- **已有文件按增量合并**:先读 `AGENTS.md`,保留仍然正确的内容与维护者手写的规则,只删除错误或重复的部分并说明删了什么。没有 `AGENTS.md` 但有 `CLAUDE.md` / `AGENT.md` 时,读它作为上下文、新建 `AGENTS.md`,不改写旧文件。
|
|
316
|
+
- **命令必须有证据**:只允许记录 manifest、脚本、Makefile、CI 文件或文档里真实存在的命令;提示词明确禁止编造命令/路径/脚本名/版本,也禁止为了“发现”事实去跑安装、构建、测试、网络或破坏性命令。
|
|
317
|
+
- **结构**:项目概览、安装/首次运行、构建/测试/lint(含单测跑法)、架构地图、仓库特有约定、测试要求、Git/PR 规则、安全与陷阱;没有内容的段直接省略。目标 80–150 行,约 200 行是硬上限;用仓库现有文档的语言写;不写泛泛而谈的建议、不抄 README、不含密钥或个人路径。
|
|
318
|
+
- **完成前自检**:重新从磁盘读文件,逐条核对命令、路径、环境变量和配置名;确认文件回答了“怎么装、怎么验、核心代码在哪、什么不能碰”,并报告无法确认或刻意省略的内容。
|
|
319
|
+
- 命令**不接受参数**(`/init foo` 返回 `Usage: /init (no arguments)`),也不提交任何改动。
|
|
320
|
+
- 提示词在 `lib/init/prompt.js`(纯逻辑、无宿主导入),命令接缝在 `lib/init/index.js`(`commands` + `workingDirectory`,经 `invocation.agent.followup(createUserMessage(...))` 注入)。
|
|
321
|
+
|
|
322
|
+
前置要求:无 —— 只用宿主已有的 `commands`、`workingDirectory` 服务,以及 `@deepseek-ai/dsh-llm` 的 `createUserMessage`。
|
|
323
|
+
|
|
324
|
+
验证:在任意项目里执行 `/init`,模型应开始读仓库并写出 `AGENTS.md`;下一个会话由 DSH 的 `dsh-agent-instructions` 自动加载它。
|
|
325
|
+
|
|
269
326
|
## 开发与测试
|
|
270
327
|
|
|
271
328
|
```powershell
|
|
@@ -276,25 +333,28 @@ pnpm test # 在包目录内也可:node --test-isolation=none --test
|
|
|
276
333
|
结构:
|
|
277
334
|
|
|
278
335
|
```text
|
|
279
|
-
package.json
|
|
280
|
-
cordis.patch.yml
|
|
336
|
+
package.json 八条行的 bundle 声明(dsh.bundle.patch)+ 浏览器半声明(dsh.client)+ exports/files
|
|
337
|
+
cordis.patch.yml 八条顶层行(载体 + 七个功能)
|
|
281
338
|
lib/index.js 载体行:空 host 半
|
|
282
339
|
lib/client.js 浏览器半:Plugins 页管理标签(手写 lazy-CJS,无构建步骤)
|
|
283
340
|
lib/colgrep/ colgrep 工具
|
|
284
341
|
lib/codegraph/ codegraph MCP 桥 + 引导
|
|
285
342
|
lib/project-mcp/ lib/config.js 纯逻辑(无宿主依赖)+ lib/index.js 接线
|
|
286
343
|
lib/gitbash/ lib/resolve.js 纯逻辑 + lib/gitbash-executor.js 执行器 + lib/index.js 组合根
|
|
344
|
+
lib/superpowers/ 常驻引导提示词段(只注册 systemPrompt 段,不导入宿主包)
|
|
345
|
+
lib/ponytail/ lib/mode.js 纯逻辑(等级解析与默认值)+ lib/index.js 提示词段与 /ponytail 命令
|
|
346
|
+
lib/init/ lib/prompt.js 纯逻辑(/init 指令正文)+ lib/index.js 命令接缝
|
|
287
347
|
locale/*.json 管理标签的文案字典
|
|
288
|
-
test/ node:test:<feature>/
|
|
348
|
+
test/ node:test:<feature>/ 七个目录 + manifest / patch / client 三个契约测试
|
|
289
349
|
```
|
|
290
350
|
|
|
291
|
-
`lib/project-mcp/config.js` 与 `lib/
|
|
351
|
+
`lib/project-mcp/config.js`、`lib/gitbash/resolve.js`、`lib/ponytail/mode.js` 与 `lib/init/prompt.js` 刻意不导入任何宿主包,所以这些纯逻辑分支可以在没有 dsh 安装的环境里完整跑测试;宿主接缝由各功能的 `index.js` 承担。浏览器半用 fake `window.__ModuleLoader__` + fake `ctx` 测注册与远程调用,不启动浏览器。测试全部离线,不联网、不依赖 `colgrep`/`codegraph` CLI。
|
|
292
352
|
|
|
293
353
|
## 发布(给维护者)
|
|
294
354
|
|
|
295
355
|
```powershell
|
|
296
|
-
git tag dsh-hiss-plugins@1.
|
|
297
|
-
git push origin dsh-hiss-plugins@1.
|
|
356
|
+
git tag dsh-hiss-plugins@1.2.0 # 必须与本目录 package.json 的 version 逐字一致
|
|
357
|
+
git push origin dsh-hiss-plugins@1.2.0
|
|
298
358
|
```
|
|
299
359
|
|
|
300
360
|
CI(`.github/workflows/publish.yml`,Windows runner)解析 tag、跑全量测试,再用 **npm trusted publishing(OIDC,无需任何 token)** 发布;包内 `prepublishOnly` 会再跑一次 `npm test`。手工发布:`npm publish`(`publishConfig.access` 已设为 public),发版前先 `node ../scripts/smoke-profile.mjs` 走一遍真实安装 + 真启动。发布新版本前记得递增 `package.json` 的 `version`。
|
|
@@ -303,4 +363,4 @@ CI(`.github/workflows/publish.yml`,Windows runner)解析 tag、跑全量
|
|
|
303
363
|
|
|
304
364
|
MIT,见 [LICENSE](LICENSE)。本包只调用外部的 `colgrep` 与 `codegraph` CLI(未内置它们的源码),通过 MCP 连接 CodeGraph、通过宿主 MCP 桥读取 `.mcp.json`;上游项目与许可分别见 [lightonai/next-plaid](https://github.com/lightonai/next-plaid)、[colbymchenry/codegraph](https://github.com/colbymchenry/codegraph)。沙箱行为、拒绝方言与升级流程均来自 DSH 自身(`@deepseek-ai/dsh-shell` / `dsh-bash-sandbox` / `dsh-sandbox-*`),git-bash 功能只提供执行器接线与 Git Bash 解析。
|
|
305
365
|
|
|
306
|
-
> `@deepseek-ai/dsh-tools`、`@deepseek-ai/dsh-mcp-client`、`@deepseek-ai/dsh-bash-sandbox`、`@deepseek-ai/dsh-tool-bash` 由**正在运行的 dsh 安装**提供,本包只在 `peerDependencies` 里声明(`devDependencies` 供本仓安装与测试)。**不要**把它们写进 `dependencies` —— 那会让 pnpm 往 profile 里塞一份自己的副本,遮蔽安装目录里的同名包,两代混装会让整棵插件树启动失败。升级 dsh 后先跑 `node ../scripts/smoke-profile.mjs` 再发版。
|
|
366
|
+
> `@deepseek-ai/dsh-tools`、`@deepseek-ai/dsh-mcp-client`、`@deepseek-ai/dsh-bash-sandbox`、`@deepseek-ai/dsh-tool-bash`、`@deepseek-ai/dsh-llm`、`@deepseek-ai/dsh-skill` 由**正在运行的 dsh 安装**提供,本包只在 `peerDependencies` 里声明(`devDependencies` 供本仓安装与测试)。**不要**把它们写进 `dependencies` —— 那会让 pnpm 往 profile 里塞一份自己的副本,遮蔽安装目录里的同名包,两代混装会让整棵插件树启动失败。升级 dsh 后先跑 `node ../scripts/smoke-profile.mjs` 再发版。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# dsh-hiss-plugins bundle patch: one package,
|
|
1
|
+
# dsh-hiss-plugins bundle patch: one package, eight top-level rows.
|
|
2
2
|
#
|
|
3
3
|
# The carrier row (`dsh-hiss-plugins`) is an empty host half: it exists so the package
|
|
4
4
|
# holds a Loader row, which is what the client module system serves the browser half
|
|
5
5
|
# (`lib/client.js`, the Plugins-page management tab) for.
|
|
6
6
|
#
|
|
7
|
-
# The
|
|
7
|
+
# The seven feature rows are deliberate TOP-LEVEL rows, never a `cordis:group` with
|
|
8
8
|
# children: the plugin manager can only persist enablement for an entry whose parent
|
|
9
9
|
# tree is the profile's include and that it can address by row id (see
|
|
10
10
|
# `dsh-plugin-manager`'s `listPlugins()`), so a nested row can never be switched from
|
|
@@ -31,3 +31,12 @@
|
|
|
31
31
|
isolate:
|
|
32
32
|
shell: true
|
|
33
33
|
settings: true
|
|
34
|
+
|
|
35
|
+
- id: dsh-hiss-plugins-superpowers
|
|
36
|
+
name: 'dsh-hiss-plugins/superpowers'
|
|
37
|
+
|
|
38
|
+
- id: dsh-hiss-plugins-ponytail
|
|
39
|
+
name: 'dsh-hiss-plugins/ponytail'
|
|
40
|
+
|
|
41
|
+
- id: dsh-hiss-plugins-init
|
|
42
|
+
name: 'dsh-hiss-plugins/init'
|
package/lib/client.js
CHANGED
|
@@ -32,6 +32,9 @@ window.__ModuleLoader__.load({
|
|
|
32
32
|
{ key: "codegraph", moduleName: `${PACKAGE_ID}/codegraph`, description: "featureCodegraphDescription" },
|
|
33
33
|
{ key: "project-mcp", moduleName: `${PACKAGE_ID}/project-mcp`, description: "featureProjectMcpDescription" },
|
|
34
34
|
{ key: "gitbash", moduleName: `${PACKAGE_ID}/gitbash`, description: "featureGitbashDescription" },
|
|
35
|
+
{ key: "superpowers", moduleName: `${PACKAGE_ID}/superpowers`, description: "featureSuperpowersDescription" },
|
|
36
|
+
{ key: "ponytail", moduleName: `${PACKAGE_ID}/ponytail`, description: "featurePonytailDescription" },
|
|
37
|
+
{ key: "init", moduleName: `${PACKAGE_ID}/init`, description: "featureInitDescription" },
|
|
35
38
|
];
|
|
36
39
|
/** The same features keyed by the name a card shows. */
|
|
37
40
|
const FEATURE_BY_KEY = new Map(FEATURES.map((feature) => [feature.key, feature]));
|
|
@@ -71,6 +74,9 @@ window.__ModuleLoader__.load({
|
|
|
71
74
|
featureCodegraphDescription: "代码图 MCP 工具",
|
|
72
75
|
featureProjectMcpDescription: "按会话挂载项目 .mcp.json",
|
|
73
76
|
featureGitbashDescription: "Windows 上的 Git Bash shell",
|
|
77
|
+
featureSuperpowersDescription: "superpowers 技能常驻引导(任何回复前先检查并加载技能)",
|
|
78
|
+
featurePonytailDescription: "ponytail 采纳提示与 /ponytail 等级切换",
|
|
79
|
+
featureInitDescription: "生成或更新项目 AGENTS.md(/init)",
|
|
74
80
|
};
|
|
75
81
|
/** English dictionary checked against the Chinese key set. */
|
|
76
82
|
const en = {
|
|
@@ -90,6 +96,9 @@ window.__ModuleLoader__.load({
|
|
|
90
96
|
featureCodegraphDescription: "CodeGraph MCP tools",
|
|
91
97
|
featureProjectMcpDescription: "mounts the project's .mcp.json per session",
|
|
92
98
|
featureGitbashDescription: "Git Bash shell on Windows",
|
|
99
|
+
featureSuperpowersDescription: "always-on superpowers skill mandate",
|
|
100
|
+
featurePonytailDescription: "ponytail adoption hint and /ponytail level switching",
|
|
101
|
+
featureInitDescription: "generates or updates the project's AGENTS.md (/init)",
|
|
93
102
|
};
|
|
94
103
|
|
|
95
104
|
/** Read one thrown value as text. */
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/init` command: hand the model one self-contained instruction to read the
|
|
3
|
+
* repository and write its AGENTS.md.
|
|
4
|
+
*
|
|
5
|
+
* The row does no filesystem work of its own. The agent already has the reading,
|
|
6
|
+
* search, and writing tools, and the prompt is the product; a generator here would
|
|
7
|
+
* duplicate those tools and still guess at the repository's commands. The thin seam
|
|
8
|
+
* also keeps the command usable from every UI that composes `commands`.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-hiss-plugins/init
|
|
11
|
+
*/
|
|
12
|
+
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
13
|
+
import { buildInitPrompt } from "./prompt.js";
|
|
14
|
+
|
|
15
|
+
export const name = "init";
|
|
16
|
+
export const inject = ["commands", "workingDirectory"];
|
|
17
|
+
|
|
18
|
+
/** The command is argument-free; extra input is a usage error, not a silent no-op. */
|
|
19
|
+
const USAGE = "Usage: /init (no arguments)";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Register the `/init` command.
|
|
23
|
+
*
|
|
24
|
+
* @param {import("@deepseek-ai/cordis").Context} ctx - host context carrying
|
|
25
|
+
* `commands` and `workingDirectory`.
|
|
26
|
+
*/
|
|
27
|
+
export function apply(ctx) {
|
|
28
|
+
ctx.commands.register({
|
|
29
|
+
name: "init",
|
|
30
|
+
description: "Read this project and write AGENTS.md",
|
|
31
|
+
handler: (invocation) => runInit(ctx, invocation),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Execute one `/init` invocation.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} ctx host context.
|
|
39
|
+
* @param {object} invocation the command invocation.
|
|
40
|
+
* @returns {Promise<{ kind: "success" | "error", text: string }>} the command result.
|
|
41
|
+
*/
|
|
42
|
+
async function runInit(ctx, invocation) {
|
|
43
|
+
if (invocation.rawInput.trim().length > 0) return { kind: "error", text: USAGE };
|
|
44
|
+
const cwd = await resolveCwd(ctx, invocation);
|
|
45
|
+
invocation.agent.followup(createUserMessage({
|
|
46
|
+
content: [{ type: "text", text: buildInitPrompt(cwd) }],
|
|
47
|
+
source: { kind: "user" },
|
|
48
|
+
}));
|
|
49
|
+
return { kind: "success", text: "Reading this project and writing AGENTS.md." };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Name the session directory in the prompt, best effort.
|
|
54
|
+
*
|
|
55
|
+
* A failed lookup is not a reason to refuse: the agent's own tools still resolve
|
|
56
|
+
* relative paths against the session cwd, so the prompt simply omits the absolute
|
|
57
|
+
* path and lets the agent find the project root itself.
|
|
58
|
+
*
|
|
59
|
+
* @param {object} ctx host context.
|
|
60
|
+
* @param {object} invocation the command invocation.
|
|
61
|
+
* @returns {Promise<string | undefined>} the session working directory, when known.
|
|
62
|
+
*/
|
|
63
|
+
async function resolveCwd(ctx, invocation) {
|
|
64
|
+
try {
|
|
65
|
+
return await ctx.workingDirectory.ensure(invocation.agent, invocation.signal);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
// A cancellation is not a bookkeeping failure: never enqueue a prompt the
|
|
68
|
+
// user has already withdrawn.
|
|
69
|
+
if (invocation.signal.aborted) throw error;
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/init` instruction: the evidence the model must collect, the sections a
|
|
3
|
+
* useful AGENTS.md carries, and the checks that keep it honest.
|
|
4
|
+
*
|
|
5
|
+
* Kept free of host imports so the text is testable under this repo's own
|
|
6
|
+
* `node --test` (the same split `lib/ponytail/mode.js` and
|
|
7
|
+
* `lib/project-mcp/config.js` use).
|
|
8
|
+
*
|
|
9
|
+
* @module dsh-hiss-plugins/init/prompt
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** The file this command produces. */
|
|
13
|
+
export const TARGET = "AGENTS.md";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The sections the prompt suggests, in order. Each entry is one source of truth:
|
|
17
|
+
* the prompt renders the same headings, and the tests assert every one survives.
|
|
18
|
+
*/
|
|
19
|
+
export const SECTIONS = [
|
|
20
|
+
{ heading: "Project overview", guidance: "what the project is, the stack and key versions, and the top-level layout (2–3 sentences)." },
|
|
21
|
+
{ heading: "Setup", guidance: "install and first-run commands, required runtime and tool versions, environment-file steps." },
|
|
22
|
+
{ heading: "Build, test, and lint", guidance: "exact commands, including how to run one test or one file, and what must pass before a change is done." },
|
|
23
|
+
{ heading: "Architecture", guidance: "where the core code lives and the rules that keep the parts separate." },
|
|
24
|
+
{ heading: "Conventions", guidance: "repository-specific style and patterns, not universal advice; one short real example when it beats prose." },
|
|
25
|
+
{ heading: "Testing", guidance: "what to add or update, fixtures, and the checks CI runs." },
|
|
26
|
+
{ heading: "Git and pull requests", guidance: "branch, commit message, pull request, and release or migration rules." },
|
|
27
|
+
{ heading: "Security and gotchas", guidance: "secrets, dangerous commands, generated files, and do-not-touch areas; state what is always done, what needs asking first, and what is never done." },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Build the user message `/init` hands the model.
|
|
32
|
+
*
|
|
33
|
+
* @param {string | undefined} cwd the session working directory, when the host resolved one.
|
|
34
|
+
* @returns {string} the complete instruction.
|
|
35
|
+
*/
|
|
36
|
+
export function buildInitPrompt(cwd) {
|
|
37
|
+
const start = typeof cwd === "string" && cwd !== ""
|
|
38
|
+
? `\`${cwd}\``
|
|
39
|
+
: "the current session working directory";
|
|
40
|
+
const sections = SECTIONS
|
|
41
|
+
.map((section, index) => `${index + 1}. **${section.heading}** — ${section.guidance}`)
|
|
42
|
+
.join("\n");
|
|
43
|
+
return [
|
|
44
|
+
"Generate or update `AGENTS.md` for this repository.",
|
|
45
|
+
"",
|
|
46
|
+
"DSH loads this file at the start of future sessions, so write it to be read cold: the reader is a capable coding agent with no prior context. After reading this one file it should know how to set the project up, run the checks that matter, find the code, follow the house rules, and avoid the traps. Write for that reader, not for a human browsing the README.",
|
|
47
|
+
"",
|
|
48
|
+
"## 1. Locate the target",
|
|
49
|
+
`- Start from ${start}.`,
|
|
50
|
+
"- The project root is the nearest ancestor that contains `.git`; if there is none, use the working directory itself.",
|
|
51
|
+
"- The target is `<project root>/AGENTS.md`.",
|
|
52
|
+
"- If it already exists, read it first and update it in place. Keep accurate content and rules written by the maintainers; remove only what is wrong or redundant, and say what you removed.",
|
|
53
|
+
"- If it does not exist but `AGENT.md` or `CLAUDE.md` does, read that file for context and write a new `AGENTS.md`. Do not delete or rewrite the other file.",
|
|
54
|
+
"",
|
|
55
|
+
"## 2. Gather evidence",
|
|
56
|
+
"Read the files that tell a new teammate what to do. Check what exists:",
|
|
57
|
+
"- README and contributor docs; package manifests and workspace config (`package.json`, `pnpm-workspace.yaml`, `pyproject.toml`, `Cargo.toml`, `go.mod`, ...); lockfiles and toolchain pins; `Makefile` / `Taskfile` / `justfile` / `scripts/`; CI workflows; lint, format, type-check, and test config.",
|
|
58
|
+
"- The entry points, one or two representative source files, and the tests around them.",
|
|
59
|
+
"- Release, migration, and deployment notes when the repository has them.",
|
|
60
|
+
"",
|
|
61
|
+
"Extract:",
|
|
62
|
+
"- The exact install, setup, build, test, lint, and single-test commands the repository really uses. A command may appear only if it is written in a manifest, script, Makefile, CI file, or documentation, or you ran it successfully and it is cheap and safe. Never invent a command, path, script name, or version.",
|
|
63
|
+
"- The small set of directories and files that carry the core behavior, and the boundaries between them. Write a map, not a full tree.",
|
|
64
|
+
"- Conventions a newcomer cannot infer from a glance: module system and language level, formatting and lint rules, naming, error handling, layering, generated code, migrations, platform assumptions.",
|
|
65
|
+
"- The traps: setup steps that are easy to miss, ordering constraints, checks CI runs that differ from local ones, environment variables, platform quirks, known failures, generated files, and paths that must not be edited by hand.",
|
|
66
|
+
"",
|
|
67
|
+
"Change only `AGENTS.md` files — no source, configuration, or other documentation edits. Do not commit anything. Do not run installs, builds, test suites, network calls, or destructive commands merely to discover facts; inspect the repository instead.",
|
|
68
|
+
"",
|
|
69
|
+
"## 3. Write the file",
|
|
70
|
+
"Use only the sections this repository needs; omit empty ones. A useful order:",
|
|
71
|
+
sections,
|
|
72
|
+
"",
|
|
73
|
+
"Quality bar:",
|
|
74
|
+
"- Put the commands early: setup and build/test before deeper explanation, so the reader does not have to hunt.",
|
|
75
|
+
"- Be specific: `pnpm --filter web test` beats a vague instruction to run the tests; name the package, file, or test when it matters.",
|
|
76
|
+
"- Keep it tight: aim for 80–150 lines and treat about 200 as a hard ceiling unless the repository genuinely needs more. Prefer bullets and short tables to prose.",
|
|
77
|
+
"- Include only what is true for this repository. No generic advice, no marketing, no full API documentation, and no copying the README.",
|
|
78
|
+
"- Prefer facts the agent cannot get from one quick look; leave out obvious file lists.",
|
|
79
|
+
"- Write for any future agent, not just this run: no references to this conversation, the `/init` command, or the fact that the file was generated.",
|
|
80
|
+
"- Write in the language of the repository's existing documentation. If there is none, use the language of this conversation.",
|
|
81
|
+
"- In a monorepo, one root `AGENTS.md` is still the default. Add a short per-package section instead of creating nested files unless a package genuinely needs its own file.",
|
|
82
|
+
"- Never include secrets, tokens, personal paths, or values that only work on your machine.",
|
|
83
|
+
"",
|
|
84
|
+
"## 4. Verify before you finish",
|
|
85
|
+
"- Re-read the file from disk.",
|
|
86
|
+
"- Check every command, path, environment variable, and config name against the repository; fix or delete anything you cannot confirm.",
|
|
87
|
+
"- Check that the file answers: how to set up, how to run the relevant checks, where the core code lives, and what not to touch.",
|
|
88
|
+
"- Do not claim the file was written until it exists on disk.",
|
|
89
|
+
"",
|
|
90
|
+
"Finish with a short report: the absolute path, the line count, the evidence behind each command, and anything you could not verify or deliberately left out.",
|
|
91
|
+
].join("\n");
|
|
92
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ponytail adoption layer: the mode-aware prompt section and the `/ponytail`
|
|
3
|
+
* level switch.
|
|
4
|
+
*
|
|
5
|
+
* This restores the half of the deleted `@hilariouhiss/dsh-ponytail` plugin that DSH
|
|
6
|
+
* cannot supply natively. The six ponytail skills are discovered from a scanned root
|
|
7
|
+
* (`~/.agents/skills` by default) and `/ponytail-review` and friends already work
|
|
8
|
+
* through the harness's own user-invocation path, so this row vendors nothing and
|
|
9
|
+
* registers no skill provider and no per-skill commands. What is missing without it
|
|
10
|
+
* is the *level*: an always-on hint that keeps the skill in play, and a switch that
|
|
11
|
+
* changes how hard it applies.
|
|
12
|
+
*
|
|
13
|
+
* @module dsh-hiss-plugins/ponytail
|
|
14
|
+
*/
|
|
15
|
+
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
16
|
+
import { renderSkillContent } from "@deepseek-ai/dsh-skill";
|
|
17
|
+
import { currentMode, parseLevel, resolveDefaultMode, setMode } from "./mode.js";
|
|
18
|
+
|
|
19
|
+
export const name = "ponytail";
|
|
20
|
+
export const inject = ["commands", "skills", "systemPrompt", "workingDirectory"];
|
|
21
|
+
|
|
22
|
+
/** The skill this layer adopts. */
|
|
23
|
+
const SKILL = "ponytail";
|
|
24
|
+
|
|
25
|
+
/** The adoption hint, unchanged from the plugin this replaces. */
|
|
26
|
+
export const HINT_TEXT = [
|
|
27
|
+
"Ponytail lazy-mode is available for coding work. ",
|
|
28
|
+
"Before any coding task — writing, editing, refactoring, fixing, reviewing, or choosing libraries/dependencies — ",
|
|
29
|
+
"load the `ponytail` skill with the `skill` tool (unless already loaded) and follow it: ",
|
|
30
|
+
"the simplest solution that works, reuse what already exists, standard library and platform features before new dependencies, ",
|
|
31
|
+
"fewest files, shortest working diff. ",
|
|
32
|
+
"Switch intensity with /ponytail lite|full|ultra; turn off with /ponytail off or by saying \"stop ponytail\".",
|
|
33
|
+
].join("");
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The section text for one assembly scope.
|
|
37
|
+
*
|
|
38
|
+
* The level is part of the hint so the text stays true after a restart, when the
|
|
39
|
+
* per-agent override is gone and the default is back in force.
|
|
40
|
+
*
|
|
41
|
+
* @param {object | undefined} scope the assembling agent, when there is one.
|
|
42
|
+
* @param {"off" | "lite" | "full" | "ultra"} fallback the resolved default level.
|
|
43
|
+
* @returns {string} the hint, or `''` when ponytail is off.
|
|
44
|
+
*/
|
|
45
|
+
export function hintFor(scope, fallback) {
|
|
46
|
+
const level = currentMode(scope, fallback);
|
|
47
|
+
return level === "off" ? "" : `${HINT_TEXT} Current level: ${level}.`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Register the global adoption section and the `/ponytail` command.
|
|
52
|
+
*
|
|
53
|
+
* @param {import("@deepseek-ai/cordis").Context} ctx - host context carrying
|
|
54
|
+
* `systemPrompt`, `commands`, `skills`, and `workingDirectory`.
|
|
55
|
+
*/
|
|
56
|
+
export function apply(ctx) {
|
|
57
|
+
const defaultMode = resolveDefaultMode();
|
|
58
|
+
ctx.systemPrompt.section({
|
|
59
|
+
name: "ponytail:adoption",
|
|
60
|
+
order: 5,
|
|
61
|
+
text: (context) => hintFor(context.scope, defaultMode),
|
|
62
|
+
});
|
|
63
|
+
ctx.commands.register({
|
|
64
|
+
name: SKILL,
|
|
65
|
+
description: "switch ponytail lazy-mode intensity (lite|full|ultra|off)",
|
|
66
|
+
input: { hint: "[lite|full|ultra|off]" },
|
|
67
|
+
handler: (invocation) => runPonytail(ctx, invocation),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Execute one `/ponytail` invocation.
|
|
73
|
+
*
|
|
74
|
+
* The skill loads *before* the level changes: a level the model cannot act on is
|
|
75
|
+
* worse than no level at all, so a missing or unreadable skill leaves the state
|
|
76
|
+
* untouched.
|
|
77
|
+
*
|
|
78
|
+
* @param {object} ctx host context.
|
|
79
|
+
* @param {object} invocation the command invocation.
|
|
80
|
+
* @returns {Promise<{ kind: "success" | "error", text: string }>} the command result.
|
|
81
|
+
*/
|
|
82
|
+
async function runPonytail(ctx, invocation) {
|
|
83
|
+
const level = parseLevel(invocation.rawInput);
|
|
84
|
+
if (level === undefined) {
|
|
85
|
+
return { kind: "error", text: "Usage: /ponytail [lite|full|ultra|off]" };
|
|
86
|
+
}
|
|
87
|
+
if (level === "off") {
|
|
88
|
+
setMode(invocation.agent, "off");
|
|
89
|
+
followup(invocation, "Ponytail off — revert to normal mode. Ignore the ponytail instructions until it is turned back on with /ponytail.");
|
|
90
|
+
return { kind: "success", text: "Ponytail off." };
|
|
91
|
+
}
|
|
92
|
+
let skill;
|
|
93
|
+
try {
|
|
94
|
+
skill = await ctx.skills.get(SKILL, {
|
|
95
|
+
cwd: await ctx.workingDirectory.ensure(invocation.agent, invocation.signal),
|
|
96
|
+
signal: invocation.signal,
|
|
97
|
+
scope: invocation.agent,
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
return { kind: "error", text: `Could not load the "${SKILL}" skill: ${error instanceof Error ? error.message : String(error)}` };
|
|
101
|
+
}
|
|
102
|
+
if (skill === undefined) {
|
|
103
|
+
return {
|
|
104
|
+
kind: "error",
|
|
105
|
+
text: `The "${SKILL}" skill is not available. Install it into a skills root DSH scans (for example the shared ~/.agents/skills root) and retry.`,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
setMode(invocation.agent, level);
|
|
109
|
+
followup(invocation, `${renderSkillContent(skill)}\n\nPonytail level: ${level}. Apply the ${level} column of the Intensity table from now on.`);
|
|
110
|
+
return { kind: "success", text: `Ponytail mode set to ${level}.` };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Hand the model a durable user message through the same seam `/goal` uses, so the
|
|
115
|
+
* instructions are read on the very next step.
|
|
116
|
+
*
|
|
117
|
+
* @param {object} invocation the command invocation.
|
|
118
|
+
* @param {string} text the message text.
|
|
119
|
+
*/
|
|
120
|
+
function followup(invocation, text) {
|
|
121
|
+
invocation.agent.followup(createUserMessage({
|
|
122
|
+
content: [{ type: "text", text }],
|
|
123
|
+
source: { kind: "skill-invocation", name: SKILL, form: "instructions" },
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ponytail level logic: the level grammar, the default-level resolution, and the
|
|
3
|
+
* per-agent override table.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately free of host imports, so every branch here runs under this repo's own
|
|
6
|
+
* `node --test` without a DSH context (the same split `lib/gitbash/resolve.js` and
|
|
7
|
+
* `lib/project-mcp/config.js` use).
|
|
8
|
+
*
|
|
9
|
+
* @module dsh-hiss-plugins/ponytail/mode
|
|
10
|
+
*/
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
|
|
15
|
+
/** The levels the upstream skill documents, plus `off`. */
|
|
16
|
+
export const LEVELS = new Set(["lite", "full", "ultra", "off"]);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Per-agent level overrides.
|
|
20
|
+
*
|
|
21
|
+
* In-process and keyed by the agent object, exactly like the plugin this replaces:
|
|
22
|
+
* the level is a property of the running session, while the *default* is the
|
|
23
|
+
* durable value and comes from the environment or the upstream config file.
|
|
24
|
+
*/
|
|
25
|
+
const modes = new WeakMap();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The level currently in force for one agent.
|
|
29
|
+
*
|
|
30
|
+
* @param {object | undefined} agent the agent (an assembly scope) or nothing.
|
|
31
|
+
* @param {"off" | "lite" | "full" | "ultra"} fallback the resolved default level.
|
|
32
|
+
* @returns {"off" | "lite" | "full" | "ultra"} the override, or the fallback.
|
|
33
|
+
*/
|
|
34
|
+
export function currentMode(agent, fallback) {
|
|
35
|
+
return modes.get(agent) ?? fallback;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Record one agent's level override.
|
|
40
|
+
*
|
|
41
|
+
* @param {object} agent the agent whose level changes.
|
|
42
|
+
* @param {"off" | "lite" | "full" | "ultra"} level the new level.
|
|
43
|
+
*/
|
|
44
|
+
export function setMode(agent, level) {
|
|
45
|
+
modes.set(agent, level);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Parse the `/ponytail` argument.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} rawInput the exact text following the command name.
|
|
52
|
+
* @returns {"off" | "lite" | "full" | "ultra" | undefined} the level, a bare
|
|
53
|
+
* invocation meaning `full`, or `undefined` for anything the grammar rejects.
|
|
54
|
+
*/
|
|
55
|
+
export function parseLevel(rawInput) {
|
|
56
|
+
if (typeof rawInput !== "string") return undefined;
|
|
57
|
+
const input = rawInput.trim().toLowerCase();
|
|
58
|
+
if (input.length === 0) return "full";
|
|
59
|
+
return LEVELS.has(input) ? input : undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Normalize one candidate level from an environment variable or config file.
|
|
64
|
+
*
|
|
65
|
+
* @param {unknown} value the raw candidate.
|
|
66
|
+
* @returns {"off" | "lite" | "full" | "ultra" | undefined} the level, or nothing.
|
|
67
|
+
*/
|
|
68
|
+
export function normalizeMode(value) {
|
|
69
|
+
if (typeof value !== "string") return undefined;
|
|
70
|
+
const mode = value.trim().toLowerCase();
|
|
71
|
+
return LEVELS.has(mode) ? mode : undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The upstream-compatible config path: `%APPDATA%\ponytail\config.json` on Windows,
|
|
76
|
+
* `$XDG_CONFIG_HOME/ponytail/config.json` (default `~/.config`) elsewhere.
|
|
77
|
+
*
|
|
78
|
+
* @param {Record<string, string | undefined>} [env] environment to read.
|
|
79
|
+
* @returns {string} absolute path to the config file.
|
|
80
|
+
*/
|
|
81
|
+
export function defaultConfigPath(env = process.env) {
|
|
82
|
+
if (process.platform === "win32" && typeof env.APPDATA === "string" && env.APPDATA !== "") {
|
|
83
|
+
return join(env.APPDATA, "ponytail", "config.json");
|
|
84
|
+
}
|
|
85
|
+
const xdg = typeof env.XDG_CONFIG_HOME === "string" && env.XDG_CONFIG_HOME !== ""
|
|
86
|
+
? env.XDG_CONFIG_HOME
|
|
87
|
+
: join(homedir(), ".config");
|
|
88
|
+
return join(xdg, "ponytail", "config.json");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Resolve the default level the way upstream does: `PONYTAIL_DEFAULT_MODE` first,
|
|
93
|
+
* then the config file's `defaultMode`, then `full`. An unreadable, missing, or
|
|
94
|
+
* malformed config file is not an error — it just falls through.
|
|
95
|
+
*
|
|
96
|
+
* @param {Record<string, string | undefined>} [env] environment to read.
|
|
97
|
+
* @param {string} [configPath] config file to read.
|
|
98
|
+
* @returns {"off" | "lite" | "full" | "ultra"} the resolved default.
|
|
99
|
+
*/
|
|
100
|
+
export function resolveDefaultMode(env = process.env, configPath = defaultConfigPath(env)) {
|
|
101
|
+
const fromEnv = normalizeMode(env.PONYTAIL_DEFAULT_MODE);
|
|
102
|
+
if (fromEnv !== undefined) return fromEnv;
|
|
103
|
+
try {
|
|
104
|
+
const parsed = JSON.parse(readFileSync(configPath, "utf8"));
|
|
105
|
+
if (parsed !== null && typeof parsed === "object") {
|
|
106
|
+
const fromFile = normalizeMode(parsed.defaultMode);
|
|
107
|
+
if (fromFile !== undefined) return fromFile;
|
|
108
|
+
}
|
|
109
|
+
} catch {
|
|
110
|
+
// Missing, unreadable, or malformed config: fall through to the default.
|
|
111
|
+
}
|
|
112
|
+
return "full";
|
|
113
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The superpowers adoption layer: one always-on system-prompt section.
|
|
3
|
+
*
|
|
4
|
+
* This restores the half of the deleted `@hilariouhiss/dsh-superpowers` plugin that
|
|
5
|
+
* DSH cannot supply natively. The skills themselves are ordinary skills discovered
|
|
6
|
+
* from a scanned root (`~/.agents/skills` by default), so this row vendors nothing
|
|
7
|
+
* and registers no skill provider. What is missing without it is the *mandate*:
|
|
8
|
+
* upstream delivers "check for an applicable skill before you answer" through a
|
|
9
|
+
* SessionStart hook, and a harness that does not read plugin hook files — DSH does
|
|
10
|
+
* not — has no other way to keep that instruction in front of the model.
|
|
11
|
+
*
|
|
12
|
+
* The section re-assembles every turn, so the mandate survives compaction, while
|
|
13
|
+
* the full instructions stay in the `using-superpowers` skill and load on demand.
|
|
14
|
+
*
|
|
15
|
+
* @module dsh-hiss-plugins/superpowers
|
|
16
|
+
*/
|
|
17
|
+
export const name = "superpowers";
|
|
18
|
+
export const inject = ["systemPrompt"];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The prior plugin's mandate, verbatim, plus the two facts that changed when the
|
|
22
|
+
* skills moved out of the plugin: DSH addresses skills by their bare name, and the
|
|
23
|
+
* section has to stay honest when the collection is not installed after all.
|
|
24
|
+
*/
|
|
25
|
+
const MANDATE = [
|
|
26
|
+
"Before ANY response or action, check whether a superpowers skill applies and, if so, invoke it with the `skill` tool first.",
|
|
27
|
+
"Process skills (brainstorming, systematic-debugging) come before implementation skills.",
|
|
28
|
+
"Load the current SKILL.md via the `skill` tool; never follow a skill from memory alone.",
|
|
29
|
+
].join(" ");
|
|
30
|
+
|
|
31
|
+
/** The complete section text. Exported so the text itself is testable. */
|
|
32
|
+
export const BOOTSTRAP = [
|
|
33
|
+
"<EXTREMELY_IMPORTANT>",
|
|
34
|
+
"You have superpowers.",
|
|
35
|
+
"",
|
|
36
|
+
MANDATE,
|
|
37
|
+
"",
|
|
38
|
+
"Superpowers skills are ordinary DSH skills: address them by their bare kebab-case name (`brainstorming`, `writing-plans`, `test-driven-development`, `verification-before-completion`), not the upstream `superpowers:<name>` form.",
|
|
39
|
+
"If the skill catalog lists no superpowers skills, ignore this section — the collection is not installed.",
|
|
40
|
+
"For the full instructions, load the `using-superpowers` skill with the `skill` tool.",
|
|
41
|
+
"</EXTREMELY_IMPORTANT>",
|
|
42
|
+
].join("\n");
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Register the global adoption section.
|
|
46
|
+
*
|
|
47
|
+
* `order: 5` places it after the deployment persona prefix (order 0) and before
|
|
48
|
+
* every policy and tool section (`PLAN_POLICY` is 500): an instruction to check for
|
|
49
|
+
* a skill before doing anything else is only useful ahead of the rest.
|
|
50
|
+
*
|
|
51
|
+
* @param {import("@deepseek-ai/cordis").Context} ctx - host context carrying `systemPrompt`.
|
|
52
|
+
*/
|
|
53
|
+
export function apply(ctx) {
|
|
54
|
+
ctx.systemPrompt.section({
|
|
55
|
+
name: "superpowers:adoption",
|
|
56
|
+
order: 5,
|
|
57
|
+
text: BOOTSTRAP,
|
|
58
|
+
});
|
|
59
|
+
}
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "dsh-hiss-plugins",
|
|
4
|
-
"description": "One DeepSeek Harness bundle carrying
|
|
4
|
+
"description": "One DeepSeek Harness bundle carrying seven switchable plugins — colgrep, codegraph, project-mcp, git-bash, superpowers, ponytail and init — managed from a tab in the Plugins page."
|
|
5
5
|
},
|
|
6
6
|
"loading": "Reading plugins…",
|
|
7
7
|
"error": "Plugins are unavailable: {error}",
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
"featureColgrepDescription": "semantic code search tool",
|
|
19
19
|
"featureCodegraphDescription": "CodeGraph MCP tools",
|
|
20
20
|
"featureProjectMcpDescription": "mounts the project's .mcp.json per session",
|
|
21
|
-
"featureGitbashDescription": "Git Bash shell on Windows"
|
|
21
|
+
"featureGitbashDescription": "Git Bash shell on Windows",
|
|
22
|
+
"featureSuperpowersDescription": "always-on superpowers skill mandate",
|
|
23
|
+
"featurePonytailDescription": "ponytail adoption hint and /ponytail level switching",
|
|
24
|
+
"featureInitDescription": "generates or updates the project's AGENTS.md (/init)"
|
|
22
25
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "dsh-hiss-plugins",
|
|
4
|
-
"description": "一个 DeepSeek Harness 组合包,携带 colgrep、codegraph、project-mcp、git-bash
|
|
4
|
+
"description": "一个 DeepSeek Harness 组合包,携带 colgrep、codegraph、project-mcp、git-bash、superpowers、ponytail、init 七个可独立开关的插件,并在插件页提供管理标签。"
|
|
5
5
|
},
|
|
6
6
|
"loading": "正在读取插件…",
|
|
7
7
|
"error": "暂时无法读取插件:{error}",
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
"featureColgrepDescription": "语义代码检索工具",
|
|
19
19
|
"featureCodegraphDescription": "代码图 MCP 工具",
|
|
20
20
|
"featureProjectMcpDescription": "按会话挂载项目 .mcp.json",
|
|
21
|
-
"featureGitbashDescription": "Windows 上的 Git Bash shell"
|
|
21
|
+
"featureGitbashDescription": "Windows 上的 Git Bash shell",
|
|
22
|
+
"featureSuperpowersDescription": "superpowers 技能常驻引导(任何回复前先检查并加载技能)",
|
|
23
|
+
"featurePonytailDescription": "ponytail 采纳提示与 /ponytail 等级切换",
|
|
24
|
+
"featureInitDescription": "生成或更新项目 AGENTS.md(/init)"
|
|
22
25
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-hiss-plugins",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "dsh-hiss-plugins — one DeepSeek Harness bundle carrying
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "dsh-hiss-plugins — one DeepSeek Harness bundle carrying seven independently switchable plugins (colgrep, codegraph, project-mcp, git-bash, superpowers, ponytail, init) plus a management tab in the Plugins page.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"deepseek-harness",
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
"codegraph",
|
|
11
11
|
"mcp",
|
|
12
12
|
"git-bash",
|
|
13
|
-
"semantic-search"
|
|
13
|
+
"semantic-search",
|
|
14
|
+
"superpowers",
|
|
15
|
+
"ponytail",
|
|
16
|
+
"agents-md",
|
|
17
|
+
"init"
|
|
14
18
|
],
|
|
15
19
|
"license": "MIT",
|
|
16
20
|
"author": {
|
|
@@ -33,6 +37,9 @@
|
|
|
33
37
|
"./codegraph": "./lib/codegraph/index.js",
|
|
34
38
|
"./project-mcp": "./lib/project-mcp/index.js",
|
|
35
39
|
"./gitbash": "./lib/gitbash/index.js",
|
|
40
|
+
"./superpowers": "./lib/superpowers/index.js",
|
|
41
|
+
"./ponytail": "./lib/ponytail/index.js",
|
|
42
|
+
"./init": "./lib/init/index.js",
|
|
36
43
|
"./client": "./lib/client.js",
|
|
37
44
|
"./locale/*.json": "./locale/*.json",
|
|
38
45
|
"./package.json": "./package.json"
|
|
@@ -46,13 +53,17 @@
|
|
|
46
53
|
],
|
|
47
54
|
"peerDependencies": {
|
|
48
55
|
"@deepseek-ai/dsh-bash-sandbox": "^0.2.1-alpha.4",
|
|
56
|
+
"@deepseek-ai/dsh-llm": "^0.2.1-alpha.4",
|
|
49
57
|
"@deepseek-ai/dsh-mcp-client": "^0.2.1-alpha.4",
|
|
58
|
+
"@deepseek-ai/dsh-skill": "^0.2.1-alpha.4",
|
|
50
59
|
"@deepseek-ai/dsh-tool-bash": "^0.2.1-alpha.4",
|
|
51
60
|
"@deepseek-ai/dsh-tools": "^0.2.1-alpha.4"
|
|
52
61
|
},
|
|
53
62
|
"devDependencies": {
|
|
54
63
|
"@deepseek-ai/dsh-bash-sandbox": "0.2.1-alpha.4",
|
|
64
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.4",
|
|
55
65
|
"@deepseek-ai/dsh-mcp-client": "0.2.1-alpha.4",
|
|
66
|
+
"@deepseek-ai/dsh-skill": "0.2.1-alpha.4",
|
|
56
67
|
"@deepseek-ai/dsh-tool-bash": "0.2.1-alpha.4",
|
|
57
68
|
"@deepseek-ai/dsh-tools": "0.2.1-alpha.4"
|
|
58
69
|
},
|