DeepSeek Harness plugin

dsh-file-explorer-preview-code

CodeMirror 6 code preview and editor for DSH Web, overriding dsh-file-explorer's plain-text preview with per-language syntax highlighting

Jump to install

Source facts

Repository
wolfsonliu/dsh-file-explorer-preview-code
Latest update
Aug 19, 2026
Category
Tools & Capabilities
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/wolfsonliu/dsh-file-explorer-preview-code
Plugin: dsh-file-explorer-preview-code
Author: wolfsonliu

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer4 files
README.mdSource · read only
README language

dsh-file-explorer-preview-code

中文 | English

A CodeMirror 6 code preview and editor for DSH Web, built on codemirror (basicSetup) + @codemirror/language-data (per-language highlighting) + @codemirror/theme-one-dark (dark theme). It overrides dsh-file-explorer's built-in plain-text preview (priority 0) at priority 10, giving code files syntax highlighting plus in-place editing with autosave.

Screenshots

Dark themeLight theme
![Code preview in dark theme](assets/dsh-file-explorer-preview-code_dark.png)![Code preview in light theme](assets/dsh-file-explorer-preview-code_light.png)

Features

1. Syntax highlighting: resolves the language from the file name via @codemirror/language-data (~90 languages), so .ts/.tsx/.js/.jsx/.json/.css/.html/.py/.yaml/.yml/.toml/.sh/.go/.rs/.java/.c/.cpp/.h/.xml/.sql/.ini each get the right tokens. 2. In-place editing: the preview is a real CodeMirror editor (line numbers, undo/redo, line wrapping), not a read-only <pre>. 3. Autosave: edits save 500ms after the last keystroke, plus Ctrl/Cmd+S saves immediately. 4. Save status bar: a slim footer shows the language, Ln/Col cursor position, and the save state (Unsaved / Saving… / Saved / Save failed) with a manual Save button. 5. Theme-aware: highlighting follows DSH's dark/light toggle (data-ds-dark-theme) live. 6. Extensible by design: registers through the fileExplorer service, so the core file explorer is untouched.

Dependencies

This plugin requires @dsh-external/dsh-file-explorer — it injects the fileExplorer cordis service, which provides registerPreview and writeFile (the save path). Install and enable dsh-file-explorer before this plugin:

git clone https://github.com/wolfsonliu/dsh-file-explorer.git
cd dsh-file-explorer
npm install && npm run build
dsh plugin --profile web add .

> @dsh-external/dsh-file-explorer is installed from git (github:wolfsonliu/dsh-file-explorer) so tsc resolves its ./client type definitions. To develop against an unpublished local checkout instead, point that dependency at your own path.

Install

From the git repository:

git clone https://github.com/wolfsonliu/dsh-file-explorer-preview-code.git
cd dsh-file-explorer-preview-code
npm install && npm run build
dsh plugin --profile web add .
dsh web

How it works

The client entry injects fileExplorer and locale, then registers one CodePreview component for every code extension at priority 10:

export const inject = ['fileExplorer', 'locale']

export function apply(ctx) {
  ctx.effect(() => {
    const readRaw = typeof ctx.fileExplorer.readRawFile === 'function'
      ? ctx.fileExplorer.readRawFile.bind(ctx.fileExplorer)
      : undefined
    const component = makeCodePreview(ctx.fileExplorer.writeFile, readRaw, ctx.locale.bind(CODE_NS))
    const disposers = CODE_EXTS.map(ext => ctx.fileExplorer.registerPreview(ext, component, 10))
    return () => { for (const d of disposers) d() }
  })
}

Registered extensions (CODE_EXTS): ts tsx js jsx json css html py yaml yml toml env sh go rs java c cpp h xml sql graphql cfg ini.

The editor component handles four preview kinds:

KindBehavior
textUses preview.content directly (files ≤ 2 MiB)
text-largeCalls readRawFile(filePath), decodes the ArrayBuffer as UTF-8, and opens the editor (text files over 2 MiB)
binarySame as text-largereadRawFile + decode
too-largeSame as text-largereadRawFile + decode (images over their cap; not delivered to this plugin's registered code extensions)

When readRawFile is unavailable (older dsh-file-explorer core), text-large and binary files show an upgrade prompt. Edits always flow back through fileExplorer.writeFile(filePath, content).

Configuration

The bundle inserts a single roster row (no host-side configuration):

- insert:
    - id: file-explorer-preview-code
      name: '@dsh-external/dsh-file-explorer-preview-code'

Language coverage

@codemirror/language-data matches 21 of the 24 extensions to a language. env and graphql have no language support and open as a plain (un-highlighted) editable buffer; cfg matches language-data's legacy TTCN_CFG (a matching artifact, not a semantic ini match). All still open in the editor.

Known Limitations

  • Bundle size: all @codemirror/* language packages are inlined into a single lib/client.js (~2.7 MB raw, loaded lazily on demand).
  • No Markdown: .md/.mdx stay with dsh-file-explorer's built-in markdown preview.
  • Write-through: editing writes directly back to the workspace file; there is no diff/preview-before-save or multi-tab.
  • Large files: files above dsh-file-explorer's maxTextBytes (2 MiB) arrive as preview.kind === 'text-large' and are fetched via readRawFile then loaded into the editor. Very large files (hundreds of MiB) may cause browser performance issues due to the single-buffer CodeMirror model. readRawFile is part of the stable service contract (added in v0.1.0).

Developing preview plugins

This repo is the reference implementation for building a preview plugin. See [docs/developing-preview-plugins.md](docs/developing-preview-plugins.md) ([中文](docs/developing-preview-plugins.zh.md)) for the contract, a minimal skeleton, bundling notes, and i18n.

Related

Development

npm install
npm run check     # tsc type check
npm test          # vitest unit tests
npm run build     # tsc + tsdown (host ESM stub + client CJS bundle)

> After npm run build, hard-refresh the browser (Ctrl/Cmd+Shift+R): dsh web may keep serving a cached plugin bundle, so a soft reload can leave your latest build unused.

License

[MIT](LICENSE)