CH4ACKO3/dsh-render-engine--packages-diff-engine0

@ch4acko3/dsh-diff-engine

为 DeepSeek Harness Web 插件提供的归一化 Diff 引擎服务。

AI 分析

核心用途是将文件快照、DSH 差异片段或 Git 补丁统一解析并归一化为结构化 Diff 文档。适合需要处理和对比文件差异的 Web 插件开发者。

包名
@ch4acko3/dsh-diff-engine
版本
0.1.1
许可证
MIT
最近更新
2026年8月21日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:CH4ACKO3/dsh-render-engine#8401d60319cc256b73167e14460c12cec647db4f&path:packages/diff-engine

@ch4acko3/dsh-diff-engine

A browser-side Cordis service that normalizes complete file snapshots, DSH FileDiff fragments, and unified or Git patches into one structured diff document.

export const inject = ['diffEngine']

export function apply(ctx) {
  const document = ctx.diffEngine.diff({
    kind: 'files',
    before: { path: 'app.ts', content: 'const value = 1\n' },
    after: { path: 'app.ts', content: 'const value = 2\n', language: 'ts' },
  })
  console.log(document.files[0].hunks)
}

The engine performs no file IO and runs no Git commands. Callers provide the content or patch explicitly. Complete snapshots retain their original source text, including LF, CRLF, or CR separators, so downstream renderers can map source-language tokens back to diff lines. Patch and DSH fragment inputs are marked as fragment-complete because they may omit surrounding source context.