Preview native WeChat Mini Programs in the DSH sidebar with a local runtime and WXML source locations.
Install
# from a prebuilt release tarball
dsh plugin --profile web add "https://github.com/zhxnix/dsh-wx-preview/releases/latest/download/dsh-wx-preview.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:zhxnix/dsh-wx-preview
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
dsh-wx-preview is a portable DSH plugin for discovering, precompiling, opening, and debugging native WeChat Mini Programs. It reads project.config.json and app.json from the project supplied by the caller, starts a local browser-compatible runtime, and exposes the preview in the DSH right sidebar.
The package has no business-project dependency, fixed project path, fixed port, or machine-specific username. Source projects are read-only. Generated preview state is stored below DSH_WX_PREVIEW_HOME (by default ~/.dsh-wx-preview).
It provides the DSH tools wxpreview_discover, wxpreview_precompile, wxpreview_open, wxpreview_status, wxpreview_logs, wxpreview_update_identity, and wxpreview_stop. When dsh-sidebar-annotations is installed, the panel uses its shared BrowserPanel with panelKind: "dsh-wx-preview"; element comments, context comments, console inspection, and DevTools can then use the same sidebar workflow as web pages. Without that optional plugin, a basic standalone iframe preview remains available.
Every DOM element rendered from WXML receives data-dsh-source-file, data-dsh-source-line, and data-dsh-source-kind="wxml", so an annotation plugin can map a selected element directly back to its WXML source.
Install
Market catalog submission is in progress. The current installation path is the prebuilt package from this repository's GitHub Release; the entry is planned for awesome-dsh-plugin. Non-managed profiles can use the DSH CLI:
dsh plugin --profile web add \
https://github.com/zhxnix/dsh-wx-preview/releases/latest/download/dsh-wx-preview.tgz
Replace web with the non-managed profile you use. DSH Desktop's managed desktop profile should use this repository's checkout installer instead. Restart DSH and open a new session after installing.
The optional annotation plugin can be installed and updated separately.
For a checkout-based install:
git clone https://github.com/zhxnix/dsh-wx-preview.git
cd dsh-wx-preview
npm install
node scripts/install.mjs --profile desktop
Remove it with node scripts/install.mjs --uninstall --profile desktop; the installer only touches this plugin's link and marked loader block.
If you do not use the installer, add this entry manually to the DSH profile's cordis.patch.yml (choose one method; adjust the path to the checkout):
- insert:
- id: dsh-wx-preview
name: './plugins/dsh-wx-preview/lib/index.js'
The dsh.bundle.patch declaration in package.json and the root dsh.bundle.patch file are the standard bundle entry used by the market; the profile entry above is the manual checkout path.
DSH tools
wxpreview_discover({ projectPath, maxDepth? })
wxpreview_precompile({ projectPath, force? })
wxpreview_open({ projectPath, route?, port?, force? })
wxpreview_status({ projectPath?, sessionId? })
wxpreview_logs({ projectPath?, sessionId?, limit? })
wxpreview_update_identity({ projectPath, ...fixturePatch })
wxpreview_stop({ projectPath?, sessionId?, all? })
wxpreview_open returns a local loopback URL. DSH conversation IDs are used for the sidebar configuration lookup, so two sessions cannot accidentally display each other's project.
CLI
npm install
npx dsh-wx-preview discover ./my-mini-program
npx dsh-wx-preview precompile ./my-mini-program --force
npx dsh-wx-preview serve ./my-mini-program --route pages/index/index
The CLI shares the preview engine but does not require DSH or the DSH tool runtime.
Scope and limitations
The project must be a native Mini Program with app.json; project.config.json may set miniprogramRoot. UniApp and Taro projects are rejected explicitly. WXS, plugin components, workers, maps, Bluetooth, payments, Canvas, real authorization, CloudBase, and device-specific behavior remain compatibility warnings or require verification in WeChat DevTools or on a real device.
The local identity and permission values are fixtures. The plugin never performs real WeChat login, reads a WeChat account, writes CloudBase, or edits the target project.
License and provenance
New DSH integration code, session management, examples, and documentation in this repository are MIT licensed. See LICENSE.
The initial generic preview engine was adapted from the local wxpreview package, originally authored by zhao, with authorization to release the adapted version here under the MIT License. See NOTICE for provenance. Dependencies keep their own licenses.
Links
More in this category
yjh051108/dsh-routing-suite★ 7207
One repository, three parts: a runtime injector for DSH plugin packages (inject, hot-reload, unload, promote a dev staging tool to the front, route self-heal, plus a settings-page plugin manager that lists, unloads and drags folders in to internalize), a task-aware reasoning-mode router agent preset (router-standard / router-spec / router-react), and a graded two-level task protocol whose six tools (commit_star, lock_stage, revise_do, edit_plan, mark_task, redteam_verdict) pin task state to disk. The injector implementation ships in-tree, so the install carries its own behaviour rather than a dependency list.
strukto-ai/mirage#dsh★ 3654
Swaps the filesystem and bash providers for a mirage virtual workspace: file tools and shell commands run over mounted resources (RAM, S3, Redis, Slack, Gmail, Notion, Postgres) instead of the host disk, with per-mount read/write/exec modes, per-command sandbox routing (monty, pyodide, quickjs in process; docker, e2b, daytona remote), and installed CLIs (git, gh, slack, linear, ntn, gws, or one you register) as head words in the virtual terminal.
hust-open-atom-club/oh-dsh★ 321
Community distribution: TUI, desktop, and Web UI as one bundle with layered installation.
weijiafu14/pi2dsh★ 204
Pi Host ABI compatibility engine: after one install, unmodified Pi extensions from npm mount as native DSH plugins with `dsh plugin add <pi-package>`. Verified end to end on stock DSH with pi-mcp-adapter (full MCP manager: OAuth, resources, prompts, MCP Apps, elicitation, sampling), @tintinweb/pi-subagents, pi-code, pi-hermes-memory and pi-background-tasks; `pi2dsh inspect` reports a package's compatibility before installing.
lire1131/dsh-undo-savepoint★ 164
Undo/redo & rollback system for DSH: every config change is auto-snapshotted; undo/redo/restore to any version from the WebUI or the offline CLI/GUI tools (works even when DSH fails to boot).
Fishquito7/dsh-skill-mcp-panel★ 147
Manages DSH skills and MCP servers from the web settings: skill cards with hot enable/disable, workspace scopes, groups, batch migration and drag-and-drop import, plus stdio/HTTP MCP CRUD with connection tests, secret redaction and the unified dsh-panel CLI.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.