diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3725e0d..c948ef7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,13 @@ surface, and the HTTP API may change in any minor release.
## [Unreleased]
+## [0.15.0] - 2026-11-04
+
+### Added
+
+- **Open in editor.** A toolbar button beside the GitHub link opens the repo in your
+ editor. Defaults to VS Code (`code`); set any other command in Settings → Editor command.
+
## [0.14.0] - 2026-10-21
### Added
@@ -330,7 +337,9 @@ First public release.
- Windows (arm64, x64): builds and runs, but untested on real hardware — recursive `fs.watch` crashes the test worker there, so auto-refresh is not covered by CI
- Linux: everything except the terminal — node-pty is an optionalDependency with no Linux prebuild, and the terminal button is hidden when it is unavailable
-[Unreleased]: https://github.com/vuongvu1/megit/compare/v0.13.0...HEAD
+[Unreleased]: https://github.com/vuongvu1/megit/compare/v0.15.0...HEAD
+[0.15.0]: https://github.com/vuongvu1/megit/compare/v0.14.0...v0.15.0
+[0.14.0]: https://github.com/vuongvu1/megit/compare/v0.13.0...v0.14.0
[0.13.0]: https://github.com/vuongvu1/megit/compare/v0.12.2...v0.13.0
[0.12.2]: https://github.com/vuongvu1/megit/compare/v0.12.1...v0.12.2
[0.12.1]: https://github.com/vuongvu1/megit/compare/v0.12.0...v0.12.1
diff --git a/README.md b/README.md
index 56c7eff..5629a8b 100644
--- a/README.md
+++ b/README.md
@@ -107,7 +107,7 @@ If what you want is further back than the rows you've loaded, the globe button r
megit started as a viewer, but the common operations are here:
-- **Toolbar** — pull (fast-forward only), push, create branch, stash all, pop latest stash, undo last commit (soft reset, keeps changes staged)
+- **Toolbar** — pull (fast-forward only), push, create branch, stash all, pop latest stash, undo last commit (soft reset, keeps changes staged), open the repo in your editor
- **Ref chips** — checkout, create branch here, rename, delete, set upstream, merge, rebase, delete tag, copy name, copy GitHub link
- **Commit rows** — checkout, cherry-pick, revert, reset (soft / mixed / hard), copy hash, copy GitHub link
- **Files** — stage, unstage, discard, commit, amend the last commit (message, staged changes, or both)
@@ -126,7 +126,7 @@ The cog at the right end of the tab bar opens font (bundled Ubuntu Mono, your sy
monospace, or your system UI face), text size in four steps from 80% to 140%, the theme, the default diff
view, how many commits each graph request loads (100–1000, default 150), and a toggle for
author avatars — off stops the GitHub and Gravatar lookups megit otherwise makes per commit
-author. The same dialog lists every keyboard shortcut below, and the two mouse gestures:
+author, and the editor command the toolbar's editor button runs (default `code`). The same dialog lists every keyboard shortcut below, and the two mouse gestures:
double-click a branch chip to check it out, right-click a row for its actions.
### Keyboard
diff --git a/package.json b/package.json
index 2cbac3f..fdb35cf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "megit-app",
- "version": "0.14.0",
+ "version": "0.15.0",
"description": "Git repository viewer in the browser: commit graph with branch lanes, diffs, stashes and WIP",
"license": "MIT",
"author": "Hoang Vuong Vu",
diff --git a/server/index.ts b/server/index.ts
index 8c8b461..55eccf6 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -1,5 +1,5 @@
import { createApp, serveStatic, type Handler } from './http.ts'
-import { execFile } from 'node:child_process'
+import { execFile, spawn } from 'node:child_process'
import { existsSync, readdirSync, readFileSync } from 'node:fs'
import { readFile, realpath, writeFile } from 'node:fs/promises'
import { homedir } from 'node:os'
@@ -297,6 +297,30 @@ app.get('/api/worktrees', repoGuard, async (req, res) => {
}
})
+// Opens the repo in the user's editor. The command comes from the client's
+// settings — no new capability, /api/term already runs anything, and the Host pin
+// keeps foreign pages out. No shell: the command splits on whitespace and the repo
+// path is its own argv entry, so neither can inject. Answers once the process has
+// either spawned or failed, so a missing `code` reaches the user as an error.
+// ponytail: whitespace split — an editor path containing spaces needs a PATH entry
+// instead. Windows .cmd shims (code.cmd) can't spawn without a shell; unverified there.
+app.post('/api/open-editor', repoGuard, (req, res) => {
+ const argv = typeof req.body.cmd === 'string' ? req.body.cmd.trim().split(/\s+/).filter(Boolean) : []
+ if (!argv.length) {
+ res.status(400).json({ error: 'no editor command set' })
+ return
+ }
+ const child = spawn(argv[0], [...argv.slice(1), String(req.query.repo)], { detached: true, stdio: 'ignore' })
+ child.once('spawn', () => {
+ child.unref()
+ res.json({ ok: true })
+ })
+ child.once('error', e => {
+ const notFound = (e as NodeJS.ErrnoException).code === 'ENOENT'
+ res.status(notFound ? 404 : 500).json({ error: notFound ? `"${argv[0]}" not found — set your editor in Settings` : e.message })
+ })
+})
+
// Removes a linked worktree. The path is allow-listed against git's own list, minus
// [0] (the main worktree, which git can't remove). Without force, git refuses a
// worktree with uncommitted or untracked files — the client only sends force after
diff --git a/src/RepoView.tsx b/src/RepoView.tsx
index 3986a7d..e762abd 100644
--- a/src/RepoView.tsx
+++ b/src/RepoView.tsx
@@ -13,7 +13,7 @@ import type { Worktree } from '../server/worktrees.ts'
import WorktreeStrip from './WorktreeStrip'
import { label, matchLocal, stepMatch } from './search'
import { toastErr } from './Toast'
-import { useSetting } from './settingsStore'
+import { getSettings, useSetting } from './settingsStore'
import { tilde } from './paths'
// diff2html + highlight.js (~1 MB, 82% of the old main bundle) stay out until a
@@ -442,6 +442,16 @@ export default function RepoView({ repo, home, linked, onOpen, onRemove, hasTerm
)}
+