DSH Plugin Store
Back to home

Xiaooooo434680

dsh-tool-tdd

TDD test-runner tool plugin for DeepSeek Harness: run test commands, parse structured failures (Jest/Vitest/Pytest/Go/Rust/TAP/tsc), drive a red-green loop

Stars
0
Language
JavaScript
Created
Aug 14, 2026
Updated
Aug 14, 2026
Other
GitHub repo

Introduction

dsh-tool-tdd

TDD 测试运行工具插件 for DeepSeek Harness (DSH)

运行测试命令、自动解析失败输出(Jest / Vitest / Pytest / Go test / Rust cargo test / Node 内置 test runner / TypeScript 编译错误),输出结构化失败报告(文件:行号、期望 vs 实际、失败分类),驱动 红 → 绿 → 重构 循环。

dsh-plugin · deepseek-harness · tdd · testing

功能

工具作用
tdd_test运行测试命令(经 ctx.subprocess),捕获输出,解析为结构化失败报告
tdd_parse解析一段已有的测试输出文本(用户粘贴或其它命令产生)

结构化失败报告包含

  • passed / exitCode / runner(自动检测:node / vitest / pytest / go / rust / tap / tsc
  • 每条失败:filelinetestNameexpectedreceivedmessage
  • summary:测试统计摘要

安装

插件是零编译的 ESM JavaScript,无需构建。依赖由 DSH profile 提供(@deepseek-ai/dsh-tools@deepseek-ai/dsh-subprocess 等)。

方式 A:npm 安装(发布后可用)

dsh plugin --profile web add dsh-tool-tdd

方式 B:本地路径 / git 引用

dsh plugin --profile web add <path-to-this-repo>
# 或
dsh plugin --profile web add https://github.com/Xiaooooo434680/dsh-tool-tdd

方式 C:手动 patch(cordis.patch.yml)

在 profile 的 cordis.patch.yml 追加:

- insert:
    - id: tool-tdd
      name: 'dsh-tool-tdd'
      config:
        timeoutMs: 120000

web 表面会自动 HMR 热重载。

使用示例

# 运行并解析
tdd_test command="npm test"
tdd_test command="pnpm test -- --runInBand" cwd="/path/to/project"
tdd_test command="pytest -q" timeoutMs=60000

# 解析已捕获的输出
tdd_parse output="<paste test output>"

配合技能插件使用更佳:把本仓库的 tdd 技能SKILL.md)放入 ~/.agents/skills/tdd/,模型就会按红绿重构方法论调用 tdd_test 循环。

插件结构

dsh-tool-tdd/
├── package.json          # ESM,peerDependencies 指向 @deepseek-ai/* 包
├── lib/
│   ├── index.js          # 插件主体:name / inject / Config / apply(零编译)
│   └── types/index.d.ts  # 类型声明
└── test/
    └── manual-test.mjs   # 端到端冒烟测试(mock ctx.subprocess)
  • name = "tool-tdd"inject = ["tools", "systemPrompt", "subprocess"]
  • Config(schemastery):timeoutMs(默认 120s)、maxOutputBytes(默认 2MB)、defaultCommand(默认空)
  • apply(ctx, config) 注册两个工具 + 一段 systemPrompt.section

开发 / 验证

# 冒烟:跑一个真实失败测试(无需 dsh 环境)
node test/manual-test.mjs

# 语法与导出检查
node -e "import('./lib/index.js').then(m => console.log(Object.keys(m)))"

本地开发时 node_modules 是指向 ~/.dsh/profiles/node_modules 的 junction(仅供本地验证,已加入 .gitignore,不会被提交)。

支持

  • 解析器支持:Jest、Vitest、Mocha、Pytest、Go test、Rust cargo test、Node 内置 test runner(TAP)、TypeScript 编译错误
  • 提交 issue / PR 前请先跑 node test/manual-test.mjs 确认不破坏现有解析

License

MIT