跳过主要内容
M

pro-202611 (context-broom)

moluotianshen/pro-202611/plugins/context-broom

在 Web 输入框下方的上下文占用读数旁增加一枚扫帚按钮:外框直接画出当前占用比例,随占用升高由绿转黄再转红,提醒语气加重、呼吸与摆动频率加快;点击即压缩会话,已注册原生 compact 或 compress 命令时优先使用,否则由插件 Host 路由折叠最老旧且不含用户消息的区间。

安装

dsh plugin --profile web add github:moluotianshen/pro-202611

该插件位于仓库的 plugins/context-broom 子路径下。

README

pro-202611

2026 年 11 月开的坑,方向还没定。先放一个零依赖、能跑能测的最小骨架, 之后想到要做什么,直接把 src/index.js 换成真正的业务逻辑即可。

环境

  • Node.js >= 18(项目用 ESM,"type": "module")
  • 不需要 npm install,没有任何第三方依赖

快速开始

npm test          # 跑测试,等价于 node --test
npm start         # 从 stdin 读文本
node src/cli.js README.md   # 统计某个文件

也可以当库用:

import { textStats, formatStats, topWord } from './src/index.js';

console.log(formatStats(textStats('Hello 世界 hello')));
// chars=17 words=3 lines=1 uniqueWords=2

现在有什么

文件作用
src/index.js纯函数核心:textStats / formatStats / topWord
src/cli.js命令行入口,读文件或 stdin
test/index.test.jsnode:test 单元测试,覆盖空文本、Unicode、CRLF、高频词
.gitignoreNode / 编辑器 / 本地环境忽略规则

目录约定

  • src/ — 源码
  • test/ — 测试,文件名 *.test.js
  • 新增功能请顺手在 test/ 里加一条断言

关于「还没想好」

骨架故意保持很小:不引入框架、不接数据库、不写构建流程。 等目标明确后,再决定是长成 CLI 工具、库、服务还是别的东西。

相关插件