Support instances that serve SSH from another hostname
CI / Tests (push) Successful in 36s
CI / Generated images (push) Successful in 1m1s

Discovery matched a git remote's host against the instance URL's host, so
a server answering SSH on a different name than its web UI resolved to
nothing — and said so only in a debug log.

Resolution now runs in three stages. A remote host is matched directly,
then against configured aliases, and failing both the instances are asked
for the repository: Gitea publishes its SSH hostname in a repository's
ssh_url, so the right instance identifies itself. What that turns up is
saved as a host alias, so later repositories on the same host resolve
with no lookup at all, and the mapping is visible and editable rather
than hidden. Each unknown host is probed at most once per session.

When nothing resolves the sidebar now names the unmatched host and offers
Add Host Alias, instead of showing an empty section.

Aliases can also be written by hand as "remote-host = instance URL",
accepting =, -> and =>, ignoring ports, and skipping # comments. List
preferences now merge workspace entries onto global ones rather than
letting an empty global array mask them.

Adds Tests/host-aliases.test.js covering both directions: unmatched hosts
reported and nothing persisted, a hand-written alias, detection from
ssh_url, and a later repository resolving from the stored alias without a
probe. 131 checks across three suites.

Also adds CLAUDE.md, and .gitea/workflows/ci.yml running the suites,
script syntax checks, manifest validation, and a generated-image check.
Tools/make-icons.py gains --check, which compares decompressed pixels so
a differing zlib version cannot fail it spuriously.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MQuusXgZC2dzwpJJ1qhtti
This commit is contained in:
2026-08-28 20:10:05 -03:00
co-authored by Claude Opus 5
parent 694609a3cc
commit 87851de921
22 changed files with 870 additions and 41 deletions
+38 -3
View File
@@ -42,6 +42,32 @@ workspace. A remote is matched to an instance by its host, so
`https://gitea.example.com`. Set **Discovery Mode** to *All Accessible
Repositories* to list everything your token can reach instead.
### When SSH uses a different hostname
Some instances answer SSH on a different hostname than the web UI — remotes look
like `[email protected]:acme/widget.git` while the instance is at
`https://git.example.com`. The hosts do not match, so those repositories would
not be found.
The extension resolves this on its own: the first time it sees an unknown remote
host, it asks each configured instance for the repository and compares the
`ssh_url` that instance advertises. On a match it records the alias in the
**Host Aliases** preference, so every later repository on that host resolves
immediately, with no further lookups and nothing to configure.
That needs a token, and the repository has to be one your token can read. If it
cannot be worked out, the sidebar shows the unresolved host with an **Add Host
Alias…** action instead of failing silently. You can also add one by hand, as
`remote-host = instance URL`, one per line:
```
ssh.example.net = https://git.example.com
```
Aliases show under their instance in the **Settings** section, so a detected one
is visible rather than invisible magic. `=`, `->`, and `=>` all work as
separators, ports are ignored, and lines starting with `#` are comments.
## Sidebar sections
**Current Branch** — pull requests and workflow runs for the branch checked out
@@ -110,6 +136,7 @@ features are shaped differently:
| --- | --- | --- |
| Default Instance URL | `https://gitea.com` | Instance used when no other matches a remote |
| Additional Instances | — | Extra instance URLs |
| Host Aliases | — | Map alternate remote hosts onto an instance; filled in automatically when detected |
| Discovery Mode | `workspace` | Workspace git remotes, or all accessible repositories |
| Max Runs per Repository | 20 | How many runs to load |
| Max Jobs per Run | 50 | How many jobs to load |
@@ -144,19 +171,27 @@ Turn on **Enable Debug Logging** and watch the extension console
Tests/run.sh
```
Two suites run the extension's real code under plain Node against a stubbed Nova
Three suites run the extension's real code under plain Node against a stubbed Nova
runtime and a canned Gitea instance — no install step, no network, and nothing
written inside the repository. See [Tests/README.md](Tests/README.md).
### Images
`Images/` is generated. To change an icon, edit the shapes in
`Tools/make-icons.py` and re-run it from the extension root:
`Tools/make-icons.py` and re-run it:
```sh
python3 Tools/make-icons.py
python3 Tools/make-icons.py # regenerate
python3 Tools/make-icons.py --check # verify, without writing
```
### Continuous integration
`.gitea/workflows/ci.yml` runs the suites, syntax-checks every script,
validates the manifest, and verifies the generated images on each push and pull
request. Adjust `runs-on` if your runner registers a label other than
`ubuntu-latest`; the jobs need only node, python3, and git.
## License
MIT