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-code-collector

v0.3.0

Published

Code collector for DeepSeek Harness: a composer-side panel that gathers every code block the model produced in the current session, with by-language / by-file views, version history, live search, one-click copy, download-all, and click-to-jump back to the

Readme

dsh-code-collector

DeepSeek Harness(dsh)会话代码收集器插件:把当前会话里模型产出的全部代码块汇总到一个面板——按语言或按文件分组、同一文件的多次迭代合并为版本历史、实时搜索过滤、一键复制/全部复制/下载合并 Markdown,点击任意条目直接跳转到产出该代码的回合

背景:dsh 长会话(尤其让 AI 改代码的场景)会散落大量代码块,想回头找某段代码、对比某个文件的修改版本,只能手动翻聊天记录。本插件把"会话内所有代码"变成可检索、可分组、可复制的资源清单。

功能

| 能力 | 说明 | | --- | --- | | 收集按钮 | 输入框右侧(conversation.input.right 插槽)常驻按钮,实时显示当前会话代码块总数徽标;Alt+Shift+C 快捷开关面板(避开生态内 Ctrl+Alt+C 占用)。 | | 双视图 | 按语言(色点 + 语言名 + 条数/总行数)与按文件(同名文件聚合,AI 迭代修改同一文件时自动形成版本历史,显示最新版,可展开查看/复制/跳转任意历史版本);视图偏好按浏览器记忆(localStorage)。 | | 实时搜索 | 面板内搜索框,按文件名 / 语言 / 代码内容实时过滤,大小写不敏感;无匹配时明确提示。 | | 代码提取 | 遍历会话快照全部 assistant 节点:显式 code 块(language/filename 多字段防御)+ text 块内 fence 代码段,均被收集;语言名自动归一化(Python/TypeScript/Shell…)。 | | 批量操作 | 单条复制、复制全部(带文件名头注释)、下载全部为单个 Markdown(session-code.md,按 --- 分隔)。 | | 点击跳转 | 点击条目/版本 → 平滑滚动到该回合第一条消息并高亮(复用 data-chat-anchor-key 语义锚点机制)。 | | i18n | 中英双语词典(跟随 dsh 语言环境)。 |

安装

# npm 源(推荐,市场内一键安装体验一致)
dsh plugin --profile web add dsh-code-collector

# 或本地目录源
dsh plugin --profile web add file:/Users/bycall/Documents/GitHub/dsh-code-collector

然后在 ~/.dsh/profiles/web/package.jsondsh.profile.bundles 数组中加入 "dsh-code-collector",重启 DSH.app(或硬刷新浏览器窗口)生效。

卸载

dsh plugin --profile web remove dsh-code-collector

工作原理

  • 插槽注册(客户端):通过 ctx.slots 注册会话级插槽 conversation.input.right(id code-collector-btn)。
  • 数据来源:插槽组件拿到会话快照,读取 snapshot.chat.order / snapshot.chat.nodes(assistant 节点的 data.blockscode 块直接取 language/filename/codetext 块用围栏正则 ```lang\n…\n``` 提取代码段;location.turn.turn 定位所属回合)。
  • 文件版本历史:同名文件的代码块按回合升序排列,最新版默认展示,展开后可见全部历史版本(回合号 + 行数 + 最新标记),任意版本可复制或跳转。
  • 搜索:文件名 / 语言标签 / 代码内容三路包含匹配。
  • 跳转机制:每条消息行 DOM 带 data-chat-anchor-key="<Context key>",跳转 = 找到该行 → scrollIntoView + 高亮。

目录结构

dsh-code-collector/
├── package.json          # dsh.bundle.patch + dsh.client + exports["./client"]
├── cordis.patch.yml      # bundle 挂载声明
├── lib/
│   ├── index.js          # 服务端挂载入口(UI-only,空实现)
│   └── client.js         # 全部功能(client bundle,单文件自包含)
├── test/
│   └── smoke.cjs         # 冒烟测试(factory/slot/提取/分组/搜索断言)
├── release/
│   └── dshmarket-submission.yml
├── README.md
└── LICENSE               # MIT

验证

npm run verify            # node --check(client/index)+ 冒烟测试
# 等价于:node test/smoke.cjs   # ALL CHECKS PASSED
npm pack --dry-run         # 检查发布到 npm 的文件清单

CI 在每次 push / PR 时于 Node 18/20/22 上自动跑 npm run verify

License

MIT