Back to home@honoriomelo

dsh-commit-ai

DSH Web GUI plugin: adds a 'Generate with AI' button to the dsh-solution-explorer commit box, filling the commit message from the staged diff using the deployment's default LLM in Conventional Commits format.

Stars
0
Language
JavaScript
Created
Aug 29, 2026
Updated
Aug 29, 2026
GitHub repo

Introduction

dsh-commit-ai

DSH Web GUI plugin. Adds a "✨ Generate with AI" button to the dsh-solution-explorer commit box that fills the commit message from the staged diff using the deployment's default LLM, in Conventional Commits format.

This plugin injects UI into the SCM panel without modifying dsh-solution-explorer source code: it watches for the .sol-exp-commit-box element to appear and inserts a sibling button above the existing Commit button. Updates to dsh-solution-explorer are preserved.

Install

dsh plugin --profile web add link:/path/to/dsh-commit-ai

Then restart dsh web (or refresh the page so the new bundle is picked up).

How it works

  • Client (lib/client.js): a MutationObserver watches the document body; whenever .sol-exp-commit-box shows up, it inserts the AI button as a sibling of .sol-exp-commit-row, with display: block; margin: 6px 0 0 0; width: 100%, so the spacing matches the existing 6px gap between the textarea and the Commit button. A 1-second ctx.timer.interval covers the rare MutationObserver miss during innerHTML rewrites.
  • Host (lib/index.js): a harness.handle("ai-commit-suggest", ...) RPC. Given { root }, it runs git -C <root> diff --cached and git -C <root> status --porcelain -z via ctx.shell, trims the diff to maxDiffChars (default 14 KB), and calls ctx.llm.stream with a Conventional Commits system prompt. The text-delta chunks are concatenated and returned as { ok, message, provider, model }.
  • The button fills the textarea using the native HTMLTextAreaElement.prototype.value setter and dispatches an input event, which is the same path dsh-solution-explorer already listens to (oninput="window.__solExpCommitMsg(this.value)"); the existing Commit button's disabled state is updated automatically.

Configuration

The plugin's config schema (in package.jsondsh.bundle.config once mounted) is:

KeyDefaultDescription
maxOutputTokens220Max output tokens for the commit message model call.
temperature0.2Sampling temperature.
maxDiffChars14000Hard cap on diff size (chars) sent to the model.
maxFilesListed50Max staged file paths listed in the prompt.

Active-repo discovery

The plugin reads the active git root from the DOM:

  • multi-repo: .sol-exp-repo-item.active[data-repo-path]
  • single-repo: the only .sol-exp-repo-item[data-repo-path]
  • fallback: the SCM tab will simply report "no active repo" if neither selector is present (this should not happen with the shipped dsh-solution-explorer).

License

MIT.