Development and maintenance
Testing
npm cinode --test test/ # run the testsThe tests include a docs link check (test/docs-links.test.mjs): relative links and anchors inside the README, docs/*.md, skills/, commands/ and site/index.html must point to existing files and headings. Run it after adding or renaming docs or headings.
CI: .github/workflows/test.yml runs npm test on Linux, macOS and Windows (the current LTS Node) for every push and PR. All three must pass. POSIX-only semantics are skipped explicitly, with a reason, in the tests: process groups and SIGTERM/SIGKILL (stop.test.mjs; Windows uses taskkill), file permission bits (assertMode; Windows uses icacls), and a podman that execFile can run directly (the container tests in podman*.test.mjs and cli-admin.test.mjs; the fake podman is a shebang script and Windows has no matching .exe). Fake external commands such as orca are written as .cmd wrappers on Windows (writeFakeBin in test/platform-helpers.mjs). .gitattributes pins LF so CRLF can’t break the core-file hash and doc-format tests. The Windows acceptance run is still tracked in windows-acceptance.md.
In integration tests, whenever you wait for a condition to become true, always use waitFor(fn, {timeout, what}) from test/wait.mjs (it polls until the condition holds or throws on timeout); don’t use a fixed sleep or a bounded loop: under high load the former is merely slower, while the latter fails intermittently.
File layout
Source files are grouped by purpose under src/: src/server/ (server only), src/cli/ (CLI and MCP), src/shared/ (shared by the CLI and the server) and src/ui/ (the admin UI, including the modules shared by the browser and tests). The repository root keeps only the files that agents expect at fixed locations, plus devhub.mjs. Every .mjs path in the table below is under src/ unless it says otherwise.
| File | Description |
|---|---|
devhub.mjs, src/server/main.mjs |
Main program: HTTP server, management API, process management, stacks, proxy startup order. The root devhub.mjs is a two-line shim (the long-term entry point: node devhub.mjs, the runtime copy and process detection all rely on it); the implementation is src/server/main.mjs |
src/ui/index.html, src/ui/tokens.css, src/ui/assets/ |
Admin UI (a single file, no build step), design tokens and icons |
src/ui/i18n.mjs, src/ui/i18n/*.mjs |
Admin UI i18n: t(), language detection, and the zh-TW/en/ja/ko locale files (see Admin UI i18n) |
src/shared/platform.mjs |
Platform layer: operating-system differences (POSIX/Windows) in port listeners, process names, start/stop, paths, file permissions and bind addresses |
src/server/worktreeinit.mjs |
Automatic initialization of new worktrees (zero dependencies, git, filesystem and install command are injectable): pattern validation, matching “ignored and matching a pattern” files through git, safe copying, auto-suggest, node_modules link/install switching; the API and CLI (worktree-init) live in src/server/main.mjs and src/cli/cli.mjs |
src/server/suggest.mjs |
Detection for a project not in devhub yet (read-only, filesystem injectable): scans package.json, launchSettings.json, Python, compose, Procfile and PORT in .env, producing candidate configs with evidence and confidence; dependency detection reuses detectDep from worktreeinit.mjs; used by devhub service suggest and the SessionStart hook |
src/server/worktrees.mjs |
Without Orca, gets worktrees from the configured repos through git worktree list --porcelain |
src/server/proxy.mjs |
Built-in reverse proxy: route matching, HTTP/WebSocket forwarding |
src/server/proxypages.mjs |
Proxy explanation pages (no route, backend unreachable): minimal four-language dictionary, Accept-Language selection, self-contained HTML |
src/server/certs.mjs |
Let’s Encrypt (DNS-01) certificate issuance, storage and renewal; the Cloudflare provider |
src/server/dnsproviders.mjs |
DNS provider selection and the DuckDNS implementation (set/clear TXT and the A record, wait for propagation), A record lookup over public DoH |
src/server/dnswire.mjs |
Minimal DNS packet query: asks the local DNS resolver directly for the rcode and SOA, to tell negative caching from rebinding protection |
src/server/netproxy.mjs |
HTTPS_PROXY/HTTP_PROXY/NO_PROXY support |
src/shared/config.mjs |
Config file location and first-time creation |
src/server/security.mjs |
Host/Origin/header checks for the management API |
src/server/svc.mjs |
Service edit validation, prestart decisions |
src/shared/health.mjs |
dependsOn resolution and dependency ordering, healthcheck validation and probing, continuous health state |
src/cli/cli.mjs, bin/devhub.mjs |
The devhub CLI (a thin client of the management API) and its entry point |
src/cli/cli-admin.mjs, src/cli/cliutil.mjs, src/cli/clihelp.mjs |
The CLI’s proxy/certificate/machine/config commands, shared helpers (exit codes, --set, --yes confirmation) and grouped help; the CLI imports only these zero-dependency files |
src/cli/mcp.mjs |
devhub mcp: a stdio MCP server whose category-grouped tools (an action parameter selects the sub-operation) build CLI arguments and then call main in src/cli/cli.mjs; zero dependencies (the official SDK is used only as a client in test/mcp.test.mjs) |
src/shared/release.mjs, src/server/assets.mjs, src/server/migrate.mjs |
The three pieces behind restart-free updates: src/shared/release.mjs (the core file list and hash, coreVersion comparison, management API protocol version and gate), src/server/assets.mjs (the server serves UI assets from the newest installed, core-compatible version directory), src/server/migrate.mjs (schemaVersion and migrations for services.json/state.json, backups, refusing newer formats); scripts/core-hash.mjs bumps coreVersion |
src/shared/paths.mjs |
The single source of the project root (ROOT): walks up from the file to find package.json, so moving files into subdirectories needs no change; other files should not derive the root from import.meta.url themselves |
src/shared/serverctl.mjs |
The logic of devhub server: server.json, single-instance detection, background start/stop, autoStart; shared by the CLI and the server, zero dependencies |
src/ui/notify.mjs |
The pure logic of browser notifications (shared by the browser and tests): diffState produces events from the before and after states, createNotifier decides whether to send by preference/tab visibility/debounce, and notifySupport checks availability; the Notification calls and preference storage are in src/ui/index.html |
src/server/updatecheck.mjs |
The admin UI’s new-version check service: runs src/cli/pluginupdate.mjs --refresh in a child process (without blocking the event loop) and provides GET /api/update and POST /api/update/check; automatic checks run once an hour and manual ones are spaced 10 seconds apart, and DEVHUB_NO_UPDATE_CHECK=1 turns it off |
src/cli/pluginupdate.mjs |
Plugin auto-update: the autoUpdate switch in Claude Code’s settings.json (idempotent, with backup) and the remote version check (cached, in the background); shared by the CLI devhub plugin and the SessionStart hook, zero dependencies |
src/server/plugins.mjs |
Detecting and updating the devhub plugin of each agent (Claude Code, Codex, Antigravity, git clone): detects versions and the server’s source by reading files only, and runs the official CLI (claude, codex, agy, git) to update, without modifying any agent settings file; provides GET /api/plugins and POST /api/plugins/update, shared by the CLI devhub plugin list / update and the MCP devhub_plugin; zero dependencies |
packages/installer/ |
npm package @vantist/devhub (npx @vantist/devhub install): finds claude, codex and agy on PATH and runs the official plugin install, update and removal commands, editing no config file; its own package.json, zero dependencies, independent of the rest of the repo (only bin/ and src/ are published), tested in test/installer.test.mjs |
scripts/session-hint.mjs |
Claude Code’s SessionStart hook: hints at devhub’s state and starts it when autoStart is on |
src/server/audit.mjs, src/server/claims.mjs |
Operation audit log, agent claims |
skills/devhub/SKILL.md, skills/devhub/references/ |
The skill for agents: the main file holds the always-needed flow and rules, the rest lives in references (English) |
src/shared/lib.mjs, src/ui/stackstate.mjs |
Pure logic for stack expansion, start/stop planning, GitLab names and so on |
config/services.example.json |
Config example |
docs-site/ |
The docs site (Astro Starlight, a separate package; it reads docs/ directly): astro.config.mjs (languages, sidebar), src/plugins/remark-docs.mjs (link rewriting), scripts/check-dist.mjs (checks the build output); see Docs site |
site/index.html, site/en/index.html |
The intro page: one complete static page each in Traditional Chinese (/) and English (/en/), sharing site/site.css, site/site.js and the images, with no external resources |
test/ |
Unit and integration tests (test/fixtures holds generic example routes) |
Personal settings, certificates, cf.env and .devhub/ (state, logs, cache) are either outside the repo or listed in .gitignore.
Security model
Threat model: devhub is a long-running local service that can start arbitrary commands, so what it guards is “who can give commands to the management API”.
| Who | What they can reach | Protection |
|---|---|---|
| Machines on the same network segment | The management API binds only 127.0.0.1; on macOS the proxy binds all interfaces (an OS limitation), and the connection layer drops sources other than 127.0.0.1/::1 | Cannot connect |
| Any website in the browser | Can send fetch/forms/img/iframe to http://127.0.0.1:4999 |
Origin, Sec-Fetch-Site, a custom header plus JSON, frame-ancestors, and no CORS headers sent |
| A DNS-rebinding website | A domain resolving to 127.0.0.1 | Host allowlist; the proxy’s TLS certificate contains no other domains |
| Other local processes/other users on the same machine | Can connect directly to 127.0.0.1:4999 | Not protected by default (equivalent to owner privileges); on shared hosts enable server.requireToken (see “Admin API token”) |
Other dev services under the same domain (proxy /other-path) |
Same origin as /devhub/ |
Not protected by default; set server.adminViaProxy: false to turn off the proxy entry, or enable the token (the cookie is limited to the /devhub path) (see below) |
Start commands can be set from the web page, which amounts to local remote execution, so every management API request must pass:
- Local sources only: the admin UI binds only 127.0.0.1; both the proxy’s
/devhuband the whole proxy accept only connections from 127.0.0.1. - Host check: only
127.0.0.1:<port>,localhost:<port>and the configuredproxy.hostare accepted (against DNS rebinding). - Cross-site protection: a non-navigation request from a browser that carries
Sec-Fetch-Sitewith a value other thansame-origin/noneis always rejected (this also blocks cross-site GETs without anOrigin); whenOriginis present it must be the same origin as Host; state-changing requests (POST/PUT/DELETE) must carryX-Devhub: 1andContent-Type: application/json, which a cross-site simple request can’t do. When calling with curl, send both headers. - Response headers: every response of the admin UI carries
Content-Security-Policy(same-origin resources, same-origin connections,frame-ancestors 'none', no<base>/forms/<object>),X-Frame-Options: DENY,nosniff,Referrer-Policy: no-referrerandCross-Origin-Resource-Policy: same-origin; the page can’t be embedded, which prevents tricking someone into clicking “Restart” or “Stop” (clickjacking). The page is a single file, so the CSP still allows inline script/style. - Actor and session are only labels:
X-Devhub-ActorandX-Devhub-Sessionare used for display, audit and claim coordination between agents; they aren’t a basis for authorization, which still comes from the local-source and header checks above. - Allowlist: the API accepts only the service keys in the config and the worktree paths Orca lists; external commands all have timeouts.
- Path validation:
cwd,envFile, thecwd/watchofprestart, thecontext/fileofbuild, andcomposeFilemust be relative paths inside the worktree:.., a leading/or\, Windows drive letters (C:) and NUL are rejected. Symbolic links aren’t resolved and aren’t guarded against (the config is written by the owner, and a worktree is a directory whose code gets executed anyway). The exception is the copying inworktreeInit, which writes files: it additionally checks that no symbolic link along the destination points outside the worktree, never overwrites an existing file, and skips a source that is a symbolic link;worktreeInit.deps[].pathand thecopypatterns likewise reject..and absolute paths.deps[].cmdgoes through the shell likeprestartand is owner input. - Where commands bypass the shell: external commands (git, podman, docker, orca, glab, lsof) are always argument arrays; only the owner’s own
cmd,prestartandhealthcheck.execgo through a shell, which is the feature itself. A container’screateArgs,volumesandbuild.argsare likewise owner input (createArgscan carry--privileged), and whoever can change the config can already run commands, so the protection sits on “who can call the API”. - Secret masking:
GET /api/config/devhub config exportand the environment snapshot (devhub env, the UI, MCPdevhub_observeenv) mask values whose names look like secrets (token, secret, password, api key, credential, private key, auth, dsn, jwt, cookie, bearer, salt, signing, connection string) as***, and mask the credentials in URLs inside other values asuser:***(for examplepostgres://app:***@db). The audit log records only field names; the proxy log records only paths, not queries. - File permissions: the state and log directories are 0700,
state.jsonand log files 0600 (existing log files keep their permissions, shielded by the 0700 directory); the config file, audit log and claims are 0600; the local CA private key, the ACME account key and the token file are 0600. - Token protection: the Cloudflare token is read only when requesting a certificate and never appears in logs, the UI or API responses. GitLab lookups reuse
glab’s login, and devhub never touches a GitLab token.
Admin API token (optional)
Off by default, with behavior exactly as before (a personal development machine is equivalent to “you yourself”). Enable it on shared hosts or when untrusted processes run on the same machine:
devhub server token on # writes server.requireToken: true and creates a 0600 admin.token (in the config directory)devhub server token url # prints the web login URL http://127.0.0.1:4999/?token=… (open it once)devhub server token regenerate # new token; the old token and browser cookies become invalid immediatelydevhub server token off # turns it off and deletes the token file- The CLI/MCP/plugin send it automatically: the CLI reads
admin.tokenon every request (DEVHUB_TOKEN_FILEcan set the path) and sendsX-Devhub-Token; MCP and the SessionStart hook go through the same CLI/serverctl, so no setup is needed. When calling with curl, send the header yourself:curl -H "X-Devhub: 1" -H "X-Devhub-Token: $(cat ~/.config/devhub/admin.token)" …. - The web page: the first time, open it with
?token=; the server exchanges it for anHttpOnly; SameSite=Strictcookie (through the proxy domain it addsSecureand limits the path to/devhub, so other dev services on the same domain don’t receive it) and redirects to a URL without the token.?token=works only for GET. - A missing or wrong token returns 401 with a message explaining how to get one (
devhub server token url); a browser opening the page sees the same explanation page.GET /api/serverwithout a token still returns minimal information (devhub: true), so thatdevhub server status/startrecognizes it as devhub. - This is an additional layer: the Host/Origin/
Sec-Fetch-Site/custom header checks still pass first; the token is 32 random bytes, compared in constant time.server.requireTokenis reread on every request, so changes take effect immediately; if the config file is broken but the token file is still there, a token is still required. - The UI offers no switch (after enabling, the UI would immediately be locked out, and a login URL is needed first); the Settings panel only shows that it is enabled and where the token file is.
- Trade-off: the cookie is scoped to the host name (127.0.0.1) regardless of port, so other local services on other ports of the same host will see it in requests (HttpOnly only blocks page JS); to avoid that, use the header approach (the CLI), or don’t run untrusted services on other ports of 127.0.0.1.
Disabling the proxy entry (server.adminViaProxy)
Default true (keeping https://<host>/devhub/ available). With false (devhub server proxy-admin off or the checkbox in the Settings panel), /devhub on the proxy domain always returns 404, and the admin UI is only at http://127.0.0.1:4999; being a different origin, a dev website with an XSS hole under the same domain can’t reach it. It takes effect immediately. After turning it off, admin pages already open on the proxy domain stop working; open the 127.0.0.1 URL instead.
Masking env values (reveal)
The conf of each service returned by GET /api/state masks the values of env, the container environment and build.args by the secret rules by default (see “Secret masking” above), and devhub service show does the same. For the original values add ?reveal=1 to the API or --reveal to the CLI; the UI’s edit form fetches the originals with reveal automatically when opened. Saving (POST/PUT /api/services, service add/update) rejects fields whose value is *** (or has :***@ inside a URL) with an explanation, to avoid writing masked display values back and overwriting real secrets; with only --set, service update automatically builds on the original values and is unaffected. MCP has no tool that shows configuration (devhub_env always masks), so an agent can’t get the originals through MCP.
Known trade-offs (not addressed)
- Without
server.requireToken, other processes or users on the same machine can call 127.0.0.1:4999 directly and run commands; withoutserver.adminViaProxy: false, other dev services of the same origin under the proxy domain can call the management API. Both are optional and off by default to keep existing usage. --revealhas no extra authorization: anyone who can call the API (including an agent’s CLI) can get the originals; to block that, enable the token and don’t let the agent read the token file. Sensitive values can also go inenvFileinstead (not in the config file, and masked in the environment snapshot).- Version probing on Windows:
requiresruns<tool> --versionby tool name (a fixed list such as node and python); on Windows it looks in the service’s cwd first, so an executable with the same name in the project directory would be run. Project code is run by the start command anyway, so it isn’t guarded separately.
State snapshot and performance
GET /api/statereturns a background snapshot (refreshed about every 2.5 seconds, with only one computation running at a time; paused after 15 seconds with no reader) and doesn’t compute within the request;?refresh=1waits for one forced recomputation. Before and after any non-GET operation it recomputes immediately, so a read after an operation always sees the new state; changes that happen outside devhub (such as a manually started process) are delayed by about 2.5 seconds at most.- External holders: the listeners of all ports are queried at once (on POSIX a single
lsof -nP -iTCP -sTCP:LISTEN, on Windows a singlenetstat -ano), shared with a 3-second TTL; stop/takeover still query each port live. - Profiling: with
DEVHUB_PROFILE=1 node devhub.mjs, the time of every external command andcomputeStatesub-step, and event loop delays over 50ms, are written to stderr ([profile] …). - The UI keeps its 3-second polling (it reads only the snapshot, at almost zero cost; SSE would need separate handling of reconnection and proxy buffering, which isn’t worth it), pauses while the tab is hidden, and catches up immediately when you switch back.
Design system
The design tokens shared by the UI and the intro page are in src/ui/tokens.css, and the design rules are in docs/design-system/devhub/MASTER.md.
Deploying the intro page
The intro page is site/index.html (Traditional Chinese) and site/en/index.html (English): two complete static pages that share site/site.css, site/site.js and site/img/, with no external resources and no runtime translation. The language switch is a single dropdown in the header navigation (a globe icon plus the current language code; it lists Traditional Chinese, English, Japanese and Korean, each in its own language) and links to the same page, and the same anchor, in the other language; the Japanese and Korean pages (site/ja/, site/ko/) are complete pages in the same way, and the changelog and “what to tell your agent” pages are generated for all four languages; <html lang>, canonical and hreflang are set, and there is no automatic redirect by browser language (to avoid confusing search engines and shared links; users click the switch themselves).
- Local preview: run
npm run build:sitefirst (the version label and changelog pages are generated at build time), thenpython3 -m http.server -d public 8000and open http://127.0.0.1:8000 (English at http://127.0.0.1:8000/en/). Openingsite/index.htmldirectly shows__VERSION__in the version label and has no changelog page. - Live page: https://devhub.vantist.dev, published with GitHub Pages (Settings → Pages with the source set to GitHub Actions and the custom domain
devhub.vantist.dev). - Updating the page: pushing to
mainwith changes undersite/,src/ui/,package.json,CHANGELOG*.mdor the build scripts triggers.github/workflows/pages.yml(or run it by hand withworkflow_dispatch). The workflow first runsnpm run build:site, which copiessite/intopublic/andsrc/ui/tokens.csstopublic/ui/tokens.css(site/has noui/and no symlink) and checks that there is no symlink,preview/,package.json,*.mjs,design-system,testor sensitive information, and that both language home pages and changelog pages exist, before uploading. The version label next to thedevhubbrand at the top left of the header (v0.8.0) comes frompackage.json, and the changelog pages (/changelog/,/en/changelog/) are generated fromCHANGELOG.mdandCHANGELOG.en.md(scripts/sitegen.mjs), so a release only needs the version bump and changelog entry from the process below; the page follows automatically andsite/needs no edit. The(#PR number)at the end of each changelog entry is matched to a commit link bygit logat build time (so the workflow’s checkout needsfetch-depth: 0; see Writing the changelog). You can run the same command locally; thepublic/output is in.gitignore. With Actions deployment GitHub neither needs nor reads aCNAMEfile; the domain is set in the repo settings.
Docs site
The docs site (https://devhub.vantist.dev/docs/) is built with Astro Starlight; its sources are in docs-site/. It lives under /docs/ of the intro site, with the same languages as the intro page (Traditional Chinese at the root, then /docs/en/, /docs/ja/, /docs/ko/). There is only one copy of the content: the repo’s docs/ (docs/*.md in Traditional Chinese, docs/{en,ja,ko}/*.md). Starlight reads it directly and it stays readable on GitHub. The intro page’s “what to tell your agent” page (/agents/) and the changelog (/changelog/) are still generated by scripts/sitegen.mjs and stay on the intro site; the docs header links back to the intro page and the changelog.
- Page format: every page starts with
---frontmatter containing onlytitle: "…"(it must equal the H1; a test compares them). Starlight usestitlefor the heading and the sidebar, so the site hides the first-line navigation, the H1 and the “Contents:” line (removed bydocs-site/src/plugins/remark-docs.mjs); they stay in the source for readers on GitHub. - Links: keep writing relative links
other-page.md#anchor; the plugin turns them into site URLs at build time, and links to files outsidedocs/(../src/…,../README.md) into GitHub links. The README, the intro page and the “what to tell your agent” pages link to docs with site URLs (https://devhub.vantist.dev/docs/…), never to files on GitHub; only the install prompt meant for agents still points at the Markdown on GitHub (an agent reads source more easily than HTML). - Adding or renaming a page: add a same-named file in each of the four languages with frontmatter, and add it to the sidebar in
docs-site/astro.config.mjsand to the navigation tables indocs/README.mdandREADME*.md; for a language that has no translation yet, Starlight falls back to the English page and says so. - Screenshots: keep using relative paths in Markdown: Traditional Chinese pages use
docs/*.png, English, Japanese and Korean pages usedocs/images/en/*.png(see the two screenshot sets in Admin UI i18n); Astro converts them to WebP at build time. - Local preview: after
npm ci --prefix docs-site, runnpm run build:pages(builds the intro site, then the docs site intopublic/docs/and checks links), thenpython3 -m http.server -d public 8000and open http://127.0.0.1:8000/docs/; to edit docs only,npm run dev --prefix docs-site(http://localhost:4321/docs/, live reload). - Relation to the plugin: the docs site’s dependencies (Astro, Starlight) live only in
docs-site/package.json; the rootpackage.jsonand the plugin runtime don’t depend on them at all (test/docs-site.test.mjschecks this). A plugin install brings the whole repo, and the sources indocs-site/are about 280 KB (252 KB of that is the lockfile);node_modulesand build output aren’t in version control. - Deploy and checks: a push to
mainthat changesdocs/,docs-site/or intro-page files makes.github/workflows/pages.ymlrunnpm run build:siteand thennpm run build:docsand deploy both; thedocs-sitejob on PRs runs the same build.docs-site/scripts/check-dist.mjschecks the output: the four languages have the same pages, and every internal link and anchor exists.
Documentation i18n
The intro page and the docs support Traditional Chinese (zh-TW, the default and the primary source), English (en), Japanese (ja) and Korean (ko). How the docs site is built and structured is in Docs site. For the admin UI see Admin UI i18n.
| Content | Traditional Chinese | English |
|---|---|---|
| Intro page | site/index.html |
site/en/index.html |
| README | README.md |
README.en.md |
| Japanese and Korean | site/ja/index.html, site/ko/index.html, scripts/pages/agents.ja.html, scripts/pages/agents.ko.html, CHANGELOG.ja.md, CHANGELOG.ko.md, README.ja.md, README.ko.md (docs links go to the docs site of their own language, /docs/ja/ and /docs/ko/; the changelog and “what to tell your agent” pages exist in every language) |
Same; the English version is the translation source |
| “What to tell your agent” page | scripts/pages/agents.zh.html |
scripts/pages/agents.en.html |
| Docs | docs/*.md |
docs/en/*.md (same file name; Japanese docs/ja/*.md and Korean docs/ko/*.md use the same names, translated from the English, with links pointing to the docs site of their own language) |
| Changelog | CHANGELOG.md |
CHANGELOG.en.md (same version headings and item counts; the Traditional Chinese one is authoritative; CHANGELOG.ja.md and CHANGELOG.ko.md must match too) |
When you change the Chinese, update the other three languages too. When you add, rename or delete docs/*.md, handle the same-named files in docs/en/, docs/ja/ and docs/ko/ as well (the four languages must have the same pages); when you add or adjust a section (id) on the intro page, change both languages. English should read naturally and be technically precise, not word-for-word; code, commands, config fields and file names aren’t translated, and the admin UI’s button names are translated into English in the English docs.
Translation workflow: change Traditional Chinese first (the primary source) → update English → translate Japanese and Korean from the English (technical terms, commands and code stay in the original; use the strings of each language’s admin UI for button names, see src/ui/i18n/<code>.mjs) → add the frontmatter title and fix the anchors of heading links → confirm locally with npm run build:pages, then run node --test test/. Screenshots aren’t retaken: Traditional Chinese pages use the Traditional Chinese screenshots, English, Japanese and Korean pages share the English ones.
- Terminology: Traditional Chinese uses Taiwan usage, with fixed translations in the glossary; add new terms to the glossary before writing docs.
- Language switch: the docs site has a language menu in its header, so no in-page link is needed; the first line of the source (for GitHub readers) ends with links to the other languages; the first line of an English doc is
[← Back to README](../../README.en.md)|[Docs index](README.md)|[繁體中文](../<file name>). - Anchors: headings differ per language, so links inside a language’s docs must point to anchors of that language’s docs, never reuse Chinese anchors.
- Checks:
test/i18n.test.mjsconfirms that everydocs/*.mdhas a counterpart indocs/en/(and vice versa), that the navigation tables in both languages have the same rows in the same order, that the intro page’s sectionids and link counts match across both languages, and that the language switch links exist;test/changelog.test.mjsbuilds the site and checks that all four languages have every page, that each page’s language menu points to the same page in the other three languages, and that no link in the built output is broken or falls into another language;test/docs-links.test.mjsalso checks the links and anchors of the docs in every language (including the site URLs the README and the intro page use to point at the docs);test/docs-site.test.mjsconfirms that the four languages have all the pages, that each frontmatter title equals its H1 and that the sidebar covers every page; thedocs-siteCI job then checks the internal links of the built output. A missed translation makes the tests fail.
Admin UI i18n
The admin UI (src/ui/index.html) supports Traditional Chinese (zh-TW, the base locale), English (en), Japanese (ja) and Korean (ko).
- Strings: all in
src/ui/i18n/<code>.mjs(a flatexport defaultobject;{name}is a parameter andxxx.oneis the English singular form). Code callst('key', { params })(src/ui/i18n.mjs); static HTML usesdata-i18n="key"anddata-i18n-attr="attribute:key,…".src/ui/stackstate.mjs,src/ui/headerstate.mjsandsrc/ui/notify.mjsalso go throught(); tests run inzh-TWby default, so their assertions stay in Chinese. - Adding or changing a string: edit
zh-TW.mjsfirst, then the other three locales. Japanese and Korean use natural interface wording, not word-for-word translation, and terms are fixed bysrc/ui/i18n/GLOSSARY.md. Numbers and dates go throughIntl(num(),Intl.DateTimeFormat) rather than hand-built strings; identifiers such as ports and versions must not be formatted. - Language choice: the default follows
navigator.languages(any Chinese maps tozh-TW, anything unrecognized falls back toen); the choice is stored inlocalStorageasdevhub.lang. Switching redraws the page and sets<html lang>. - Server messages: the
messageof anHttpErrorstays Traditional Chinese (the CLI, MCP, the API and agents all read it). Common user-visible errors also carry{ code, params }(HttpError(status, message, { code: 'svcNotFound', params: { key } })), which the UI translates througherr.<code>; with no matching key the original message is shown. When adding an error with acode, adderr.<code>to all four locales, and make thezh-TWtext identical to themessage. - Checks:
test/i18n-ui.test.mjsrequires the four locales to have the same keys and{parameters}, every key used in code to exist, no hard-coded Chinese in the UI code (comments excluded; exceptions are in the file’sALLOW), and a translation for everyHttpErrorcode. - Two screenshot sets: only two, with no separate Japanese or Korean set.
- Traditional Chinese UI images:
docs/*.pngandsite/img/*.png(paths unchanged), forREADME.md,docs/*.mdand the Chinese intro page. - English UI images (switch the UI language to
en):docs/images/en/*.pngandsite/img/en/*.png, shared byREADME.en.md,README.ja.md,README.ko.md,docs/en/*.mdand the English, Japanese and Korean intro pages; the Japanese and Korean pages still write theiralttext in their own language. - Both sets use the same demo data, screen, state, light/dark theme and size (the
width/heightattributes of intro-page images must match the file). Demo data uses neutral names (acme-shop,Shop DB), never real project names, user paths or domains. - The proxy explanation pages (
no-route.png,proxy-error.png) are rendered by the server in four languages by the browser language; their screenshots are still only taken in the Chinese and English sets (render the page fromsrc/server/proxypages.mjsor with anAccept-Languageheader, then capture). - Retaking: when the UI visibly changes, retake both sets. Start a separate devhub with a throwaway config (
DEVHUB_CONFIG,DEVHUB_STATE_DIR,DEVHUB_PORT,DEVHUB_PROXY=off), withtest/testdata/fakepodman.mjsfor containers and fakeorca/npm; setdevhub.langinlocalStoragetozh-TWorento switch the UI language; capture with browser automation at the original image size, cropping dialogs at the dialog’s bottom edge. Then runnode --test test/i18n.test.mjs. - Check:
test/i18n.test.mjsverifies that every Traditional Chinese screenshot has an English version, that English, Japanese and Korean pages and READMEs never reference Chinese screenshots, and that Chinese pages never reference English ones. Add new screenshots to both sets together.
- Traditional Chinese UI images:
Release and versioning
A plugin user’s automatic and manual updates both decide whether there is a new version by the plugin’s version string, and don’t update when the version is unchanged (observed: changing only content without a version bump makes claude plugin update report already at the latest version). So any change you want users to receive (code, skill, commands, hooks) needs a version bump:
- Change
versioninpackage.json, the rootplugin.json,.claude-plugin/plugin.json,.codex-plugin/plugin.json,.antigravity-plugin/plugin.jsonandpackages/installer/package.json(the npm installer) together; tests (test/plugin.test.mjs,test/installer.test.mjs) check that all six match. - The plugin entry in
.claude-plugin/marketplace.jsondoesn’t carry aversion, so that it can’t disagree withplugin.jsonand overwrite it. - The remote version check (
src/cli/pluginupdate.mjs) goes by.claude-plugin/plugin.jsonandpackage.jsononmain(read withfetchfromraw.githubusercontent.com, falling back to a git shallow fetch), soversiononmainmust equal the released version: bump it only when you are about to release. When bumping, also add an entry toCHANGELOG.mdandCHANGELOG.en.md; users get the notice once it is pushed tomain. - Releasing: no manual tag after merging to
main. When thetestworkflow is green on all three platforms for a push tomainandpackage.json’s version has nov<version>tag yet,.github/workflows/release.yml(triggered byworkflow_run) checks that the six versions agree, thatCHANGELOG.mdhas a section for it, and thatnpm testpasses, then creates the tag and the GitHub Release in that same workflow (notes come from that version’s section ofCHANGELOG.md; a tag created withGITHUB_TOKENdoes not trigger other workflows, so it can’t be split in two). It skips when the version already has a tag or the commit only touchessite/;contents: writeis granted only to the final publish job. If a check fails (red tests, mismatched versions, missing CHANGELOG section) nothing is published; fix it and re-runtest. Pushing a tagvX.Y.Zby hand still works and goes through the same checks. Claude Code doesn’t require tags; they are only for pinning (vantist/DevHub#v0.7.0) and Release records.- npm installer: after the Release is created, the
npmjob in the same workflow publishespackages/installeras@vantist/devhubthrough npm Trusted Publishing (OIDC,id-token: write) with automatic provenance and no long-livedNPM_TOKEN. The whole job is skipped unless the repo variableNPM_PUBLISHistrue; the job hascontinue-on-error, so an npm failure doesn’t affect the tag or Release, and you re-run the job once fixed. A version already on npm is skipped, so re-running is safe. - Enabling npm publishing (one-time owner setup): ① on npm, create or confirm that the
vantistaccount owns the@vantistscope, with 2FA on; ② a trusted publisher can only be set on an existing package, so publish once by hand withnpm publish --access publicinpackages/installer(2FA); ③ package settings → Trusted Publisher → GitHub Actions: Organization or uservantist, RepositoryDevHub, Workflow filenamerelease.yml, Environment empty; ④ on the same page set Publishing access to “Require two-factor authentication and disallow tokens”; ⑤ GitHub repo → Settings → Secrets and variables → Actions → Variables: addNPM_PUBLISH=true.
- npm installer: after the Release is created, the
- For the user-side update mechanism see Automatic updates.
Writing the changelog
The readers of CHANGELOG*.md are users, not developers:
- User-facing: each entry says in plain words what was added, improved or fixed, how it affects the user and what they need to do (restart the devhub server? reopen agent sessions? is the config converted? did behavior change?). No implementation details: no file, function or module names, no
coreVersion/schemaVersion, no internal data structures, nothing about how tests are written. Commands, setting fields and links to docs that users will actually use may stay. - Version headings carry the release date:
## 0.14.1 — 2026-12-01(identical in all four languages, newest first). The date is the day the tag is pushed; put the planned date in the PR and check it before tagging, fixing it if it differs. The old format (no date) and Keep a Changelog’s## [0.14.1] - 2026-12-01still parse. - Upgrade notes: one paragraph at the start of each version, with a bold “requires restarting the devhub server” or “no restart needed” (
src/cli/pluginupdate.mjsand the admin UI look for the boldrequires restarting; Traditional Chinese uses需要重啟, Japanese…再起動が必要and Korean…재시작해야 합니다). A core change must bumpcoreVersion, but the changelog only says “restart required” and never the version number. - Every entry carries its source, written as the PR number: an entry starts with a bold title (the admin UI and CLI summaries use it) and ends with
(#PR number), for example- **Added X**: description. (#30). The squash-merge commit hash is unknown before the PR merges, so do not write hashes by hand: the site build (scripts/build-site.mjs) matches the(#N)at the end of commit subjects withgit logand renders([`abc1234`](commit link)); the admin UI and CLI have no git and link to the PR page; when no commit is found (PR not merged yet, shallow clone) the site also falls back to the PR page. So the PR title (the commit subject after squash) must keep the(#N)GitHub appends. Entries of released versions already use explicit commit links and need no change. - Only DevHub repo links are allowed: when the admin UI shows what changed, it accepts only commit, PR, Release and file links under
github.com/vantist/DevHub; any other URL is shown as plain text. - Keep the four languages in sync: after changing
CHANGELOG.md, updateCHANGELOG.en.md,CHANGELOG.ja.mdandCHANGELOG.ko.md(same version headings, dates and item counts; copy(#N)and links as they are, do not translate them).test/changelog.test.mjschecks the heading dates, that every entry has a source and thatcoreVersiondoes not appear.
Compatibility and migration checklist before releasing
Whether an update needs the devhub server restarted is declared by the devhub field in package.json: coreVersion (an integer), coreHash (a hash of the core files’ contents), configSchema and stateSchema (the format versions of services.json and state.json). The core files are the .mjs files reachable by import from devhub.mjs (node scripts/core-hash.mjs lists them); the UI (src/ui/), the CLI, MCP, hooks and the skill are not core.
- You changed a core file: run
node scripts/core-hash.mjs --bump(coreVersion+1,coreHashupdated).test/release.test.mjscompares the hash and fails if you forget. Changes only to the UI, CLI or docs need no bump, and users don’t have to restart after updating. - You changed the format of the config or state file (adding, renaming or moving fields): add a migration to
src/server/migrate.mjs, incrementCONFIG_SCHEMA/STATE_SCHEMA, then run--bump(it also writesconfigSchemaandstateSchema, which the update notice uses to say “the config will be converted automatically”). A migration must be idempotent and must not mutate its input; put fixtures of old formats intest/fixtures/legacy/, andtest/migrate.test.mjschecks that each loads, is idempotent, and behaves the same before and after conversion. - Backward compatibility: when the server loads an old format it converts it automatically after backing it up as
<file name>.bak-<time>; when it meets a format newer than its own it refuses to start, writes nothing and tells you to upgrade. Don’t add ad-hoc old-field handling outside migrations (readyCmdandrewriteHeadersare already folded into a migration). - Management API: adding fields or new APIs doesn’t need a protocol bump, but a new CLI calling a new API against an old server must get a clear message (handled centrally: 404 “API not found” → run
devhub server restart); bumpAPI_VERSION(src/shared/release.mjs) only when removing an API or changing the meaning of an existing one, and useMIN_CLI_APIto decide whether old CLIs are still accepted (old CLIs get a 426 with upgrade instructions). - Verify:
node --test test/(includingtest/update-flow.test.mjs, which simulates two plugin version directories and checks that a UI-only change doesn’t restart, that only a core change prompts a restart while the managed process keeps its pid, that old formats are converted automatically and that newer formats are refused). If you changed Windows behavior, also run the manual acceptance in windows-acceptance.md. - Bump the version and the four changelogs
CHANGELOG.md/CHANGELOG.en.md/CHANGELOG.ja.md/CHANGELOG.ko.mdas above, following Writing the changelog (same version headings, dates and item counts, enforced bytest/changelog.test.mjs); note in the changelog whether this update “needs a restart” and “converts the config”.