Skip to content

dsh-ast-viewer

Verified

@wendy_whm/dsh-ast-viewer · v0.1.0 · MIT · Web UI

Paste JSON, JavaScript, HTML, CSS or Markdown into DeepSeek Harness and inspect the syntax tree it parses to.

Install

dsh plugin add @wendy_whm/dsh-ast-viewer

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Creators

Readme

dsh-ast-viewer

把任意文本粘贴进 DeepSeek Harness 的输入框下方,实时查看它解析出的语法树(AST)。

Paste any text into DeepSeek Harness and inspect the syntax tree it parses to.

安装

dsh plugin add dsh-ast-viewer

装好后在 设置 → 插件 里能看到「AST 树查看器」,会话输入框下方的 dock 区出现一行同名入口,点开展开。

支持的内容

格式 解析方式
JSON 递归下降解析器
JavaScript 手写词法分析 + Pratt 表达式解析,覆盖语句、函数、类、箭头函数、模板字符串、可选链、正则字面量、for…of/in、try/catch、switch
HTML 浏览器原生 DOMParser,保留元素、属性、文本、注释
CSS 规则、声明、@media 等嵌套 at-rule
Markdown 块级(标题/列表/引用/围栏码)+ 行内(粗体/斜体/链接/行内代码)

自动识别格式,也可以手动切换;输入超过 200 KB 停止解析;JavaScript 暂不支持 JSX 与 TypeScript。

开发

npm run build     # src/*.js -> client.js + cordis.patch.yml
npm test          # 解析器与模块加载器测试
npm pack --dry-run

client.js 与 cordis.patch.yml 是构建产物,不要手改;包名只有 package.json 一个来源:

npm pkg set name=@your-scope/dsh-ast-viewer
npm run build

结构

package.json          # dsh.bundle 与 dsh.client 清单
cordis.patch.yml      # 生成:插入一行 ast-viewer
index.js              # Host 半边(空实现)
client.js             # 生成:浏览器端模块
src/                  # 解析器与 UI 源码
scripts/check-publish.mjs

License

MIT