HuanLinOTO/dsh-plugin-better-sidebar-plugin-office 预览 preview

HuanLinOTO/dsh-plugin-better-sidebar-plugin-office

Bundle捆绑包 Native原生 ⭐ 53 NOASSERTION Docs & Writing文档与写作UI & Themes界面与主题

为 better-sidebar 提供Office三件套预览(.docx/.xlsx/.pptx),独立bundle瘦身主体

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness (DSH), designed to add Office file preview capabilities to the better-sidebar DSH extension. It adds support for directly previewing .docx, .xlsx, and .pptx files directly within the DSH sidebar interface. Before this plugin was created, better-sidebar bundled all three preview libraries which pushed the total client bundle size to around 23MB, so this plugin splits them into a separate installable bundle to reduce the core better-sidebar size to just 2.2MB.

To install the plugin, users can run the DSH CLI command dsh plugin --profile web add @huanlin/dsh-plugin-better-sidebar-plugin-office from their terminal, or use a local file link for local development testing. After installation completes, you need to restart the DSH web process and hard refresh your browser page to fully activate the plugin. Once activated, any matching Office file opened in the better-sidebar file manager will automatically use the corresponding previewer added by this plugin.

This plugin requires better-sidebar version 0.6.0 or higher, because that official version removed the built-in Office previewers that would cause an "already registered" conflict error with this plugin. It ships with built-in English and Chinese localization and its own independent CSS styling, so it does not rely on any internal implementation details of the core better-sidebar extension. The license for this codebase is not explicitly declared in the public repository.

这是一款专为 DeepSeek Harness (DSH) 开发的原生插件,用于给 better-sidebar 扩展提供 Office 三件套文件的预览功能,支持 .docx、.xlsx、.pptx 三种格式在 DSH 侧边栏直接预览。原本 better-sidebar 内置这些预览器会导致客户端包体积膨胀到约 23MB,本插件将它们拆分为独立安装包,帮助 better-sidebar 本体压缩到 2.2MB,用户可按需单独安装。

安装插件后,用户只需重启 DSH web 进程并在浏览器按Ctrl+Shift+R硬刷新页面,即可启用功能。在 DSH 侧边栏的文件管理器中打开对应格式的 Office 文件时,预览器会自动加载渲染,用户也可以在侧边卡片设置页的「文件预览」列表中单独启用或禁用每个格式的预览。该插件主要面向需要在 DSH 工作流中直接查看 Office 文件的用户。

本插件要求依赖的 better-sidebar 版本不低于 0.6.0,该版本已经移除了内置的 Office 预览器,否则会出现预览器已注册的冲突报错。用户可以通过 DSH CLI 命令从 npm 安装,也可以使用本地链接进行开发调试。插件自带中英双语本地化和独立样式,不依赖 better-sidebar 的内部实现,许可证未明确声明。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 no risk signal found未发现风险信号
  • This site's static screen found no obvious risk signal (stars, license, activity, manifest)本站静态筛查没发现明显风险信号(星标、许可证、更新活跃度、清单完整度)
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add @huanlin/dsh-plugin-better-sidebar-plugin-office

把 HuanLinOTO/dsh-plugin-better-sidebar-plugin-office 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-plugin-better-sidebar-plugin-office card

dsh-better-sidebar-plugin-office

npm version

DSH web 插件:为 better-sidebar 的编辑器提供 Office 三件套文件预览(.docx / .xlsx / .pptx)。

背景

better-sidebar 曾内置这三个 viewer,但 docx-preview / Univer(+ SheetJS)/ pptx-renderer 会把 client bundle 撑到约 23MB。本插件把它们拆成独立 bundle,better-sidebar 本体不再内联 Office 渲染库(约 5.9MB 全套 → 2.2MB 压缩),需要 Office 预览的用户单独安装本插件即可。

功能

  • 通过 ctx.betterSidebar.registerFileViewer 注册 3 个 viewer(id 与内置一致):
    • docx:.docx,docx-preview 保真渲染(样式/图片/表格,Alt+滚轮缩放)
    • xlsx:.xlsx,Univer sheets 预设(数据 + 公式 + 合并单元格 + 列宽/行高)
    • pptx:.pptx,@aiden0z/pptx-renderer 浏览器原生预览(翻页导航)
  • viewer 描述符形状与原内置完全一致(mediaUrl 策略、priority 0、title/icon),因此:
    • 既有文件路由行为不变(扩展名匹配优先于 binary-download / code 兜底)
    • Side card 设置页自动显示这三个 viewer 的启用开关
    • 加载/渲染失败回退到「下载查看」链接
  • 客户端组件自包含:自带 locale(中/英)与 CSS,不依赖 better-sidebar 的 client 内部实现

依赖 better-sidebar 版本

需要 better-sidebar >= 0.6.0(已移除内置 office viewer 的版本),否则会与内置 docx/xlsx/pptx 注册冲突(already registered)。

开发

pnpm install
pnpm run typecheck   # 类型门禁(需先构建 DSH-better-sidebar 的 lib/types)
pnpm test            # vitest(xlsx→Univer 转换 + 注册描述符)
pnpm run build       # tsdown 双产物(lib/index.js + lib/client.js)

tsdown.config.ts 含 jszip / xlsx 的 browser-entry alias(SheetJS/JSZip 在 CJS 降级后残留 Node builtin 引用)与 import.meta.resolve 空定义(pptx-renderer 的 PDF.js 探测)。改动这些库版本时需一并验证 client bundle 不含 Node builtin。

安装(profile)

# 从 npm 安装(推荐):
dsh plugin --profile web add @huanlin/dsh-plugin-better-sidebar-plugin-office

# 本地开发(link: 热更新)
dsh plugin --profile web add "link:D:/Projects/deepseek-harness/dsh-better-sidebar-plugin-office"

安装后重启 dsh web 进程并浏览器硬刷新(Ctrl+Shift+R)。

运行

  • 打开侧边栏 → 在文件资源管理器中打开任意 .docx / .xlsx / .pptx,预览器自动命中。
  • Side card 设置页 →「文件预览」清单中可见 docx / xlsx / pptx 三张卡片,可单独启用/禁用。

检查

检查项 命令 预期
类型门禁 pnpm run typecheck 0 错误
单元测试 pnpm test 全部通过
构建 pnpm run build lib/client.js 生成,window.__ModuleLoader__.load({ id: '@huanlin/dsh-plugin-better-sidebar-plugin-office', ... }) 包裹
bundle 纯度 产物中搜索 node: 或 require("fs") 不应出现 Node builtin 引用
profile 可见 Test-Path ~/.dsh/profiles/web/node_modules/@huanlin/dsh-plugin-better-sidebar-plugin-office/lib/client.js True
插件加载 重启 dsh web + 硬刷新后侧边栏打开 Office 文件 预览正常渲染
← 上一个 Prev dsh-open-in-vscode 下一个 Next distill-kura →