npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-text-diff

v0.1.0

Published

Line-level text/file diff plugin for DeepSeek Harness: LCS-based unified diff format with configurable context. Pairs with dsh-diff-writer to form a find-and-fix loop.

Readme

dsh-text-diff

两文本 / 两文件的行级 diff 插件(dsh / DeepSeek Harness)。基于 LCS(最长公共子序列)动态规划,输出 unified diff 格式变更块。零依赖,与 dsh-diff-writer 组成找差-修复闭环。

安装

npm install dsh-text-diff

cordis.patch.yml 已随包声明,dsh 宿主加载后自动注册 diff_text。

工具

diff_text — 行级 diff

| 参数 | 类型 | 说明 | |---|---|---| | a_text / a_file | string | 文本或文件路径(A 侧,二选一) | | b_text / b_file | string | 文本或文件路径(B 侧,二选一) | | context | number | 每个变更块的上下文行数(默认 3,0 只显示变更行,上限 50) |

diff_text { a_file: "a.js", b_file: "b.js" }
diff_text { a_text: "old code...", b_text: "new code..." }

输出格式:

diff: +1 -2(8 行未变,1 个变更块,上下文 1 行)

@@ -3,3 +3,2 @@
 keep2
-old-a
-old-b
+new-a
 keep3

一致性时返回 两份内容完全一致(N 行)。;A/B 侧为空时另一侧全部记为 add/del。

约束

  • 输入文本上限 1MB,单行上限 3000 行(LCS 矩阵内存约 9MB)
  • 超长输出截断到 8000 字符并提示
  • CRLF/LF 已归一,跨平台比较无需预处理

与其他插件配合

  • 找差-修复闭环:diff_text 定位差异 → dsh-line-ops extract_lines 查看上下文 → dsh-diff-writer apply_patch 精确修复
  • A/B 均为大文件时复杂 diff 建议改用 git 本地 git diff(可通过 dsh-git-helper 触发)

测试

npm test

Roadmap(v0.2 候选)

  • 文件级别 diff(多文件批量对比)
  • --stat 概览模式(仅统计不显示内容)
  • 忽略空白差异(尾空格 / 前导缩进变化不算变更)
  • 移动检测(同一块被移走记为 move 而非 del+add)