Skip to content

Commit db7cd5a

Browse files
committed
docs(dev-mode): document branch preview setup
1 parent 45f20ca commit db7cd5a

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

docs/dev-mode-branch-preview.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Branch Preview Dev Mode
2+
3+
Branch Preview is a local maintainer tool for checking another git branch from the Hermes Web UI. It is intentionally hidden from ordinary users and should be treated as a developer/reviewer feature, not a normal application setting.
4+
5+
## Who should use it
6+
7+
Use Branch Preview only on trusted local instances where a super administrator is reviewing code changes.
8+
9+
Ordinary users should not see this feature. Super administrators can find it under:
10+
11+
```text
12+
Settings → Advanced → Developer tools → Branch preview
13+
```
14+
15+
## Security model
16+
17+
Branch Preview builds code from the selected branch inside a local worktree. Building untrusted branches can execute untrusted build scripts or dependencies.
18+
19+
Keep it disabled unless all of these are true:
20+
21+
- you trust the repository checkout;
22+
- you trust the branch or understand the risk;
23+
- the instance is local/private;
24+
- the current user is a super administrator.
25+
26+
Client-side hiding is only UX. Server-side super-admin guards and persisted Dev Mode checks remain authoritative.
27+
28+
## Requirements
29+
30+
- Hermes Web UI is running from a local git checkout.
31+
- The server process can run `git` in that checkout.
32+
- The server process can create/remove worktrees under the active Hermes profile directory.
33+
- The user is `super_admin`.
34+
- `dev.enabled` is enabled before build/reset actions are allowed.
35+
36+
Read-only branch listing/status can be available before `dev.enabled` is enabled so a maintainer can select a branch without a catch-22. Mutating actions still require persisted Dev Mode to be enabled.
37+
38+
## Generic maintainer setup
39+
40+
Use the normal branch names for your checkout. By default, Branch Preview falls back to `main`.
41+
42+
Example profile config:
43+
44+
```yaml
45+
dev:
46+
enabled: true
47+
review_base: main
48+
preview_branch: main
49+
```
50+
51+
Then open the Web UI as a super administrator and use:
52+
53+
```text
54+
Settings → Advanced → Developer tools → Branch preview
55+
```
56+
57+
## Unavailable states
58+
59+
The UI may show a compact unavailable message instead of controls:
60+
61+
- `not_git_repo` — the Web UI server is not running from a git checkout.
62+
- `repo_path_missing` — a future explicit repo path setting points to a missing checkout.
63+
- `disabled` — branch preview is disabled for this instance/user.
64+
65+
When unavailable, the UI should not render branch/build/reset controls.
66+
67+
## Troubleshooting
68+
69+
1. Confirm the server working directory is a git checkout:
70+
71+
```bash
72+
git rev-parse --is-inside-work-tree
73+
```
74+
75+
2. Confirm branches are visible:
76+
77+
```bash
78+
git for-each-ref --format='%(refname:short)' refs/heads refs/remotes
79+
```
80+
81+
3. Confirm the profile has the intended base branch:
82+
83+
```yaml
84+
dev:
85+
enabled: true
86+
review_base: main
87+
```
88+
89+
4. If build/reset buttons are disabled, save Dev Mode settings first. The UI switch edits draft state; build/reset use the persisted server config.

0 commit comments

Comments
 (0)