Merge proposal CLI commands missing --hub flag
Add --hub Flag to Merge Proposal CLI Reference Commands
Current Behavior
The "Muse CLI" section of every open merge proposal generates copy-paste merge
commands without a --hub flag:
muse hub proposal merge sha256:e83b2606... --strategy overlay --history merge
Running this command from a repo that has a different hub configured (e.g.
https://localhost:1337 when the proposal lives on https://staging.musehub.ai)
produces a misleading 404:
❌ MuseHub API error 404: Proposal sha256:e83b2606f750a38f5064d2adb51473e2d6afa4b936e328aa9924f61e01b2d873
not found in repo sha256:fb945af0b49bf75483236f8d100b82f080a0ed0d7c4218436df9c667eca8f88b
Adding --hub resolves it immediately:
muse hub proposal merge sha256:e83b2606... --strategy overlay --history merge --hub https://staging.musehub.ai
✅ Proposal merged → sha256:01e18975...
Root Cause
When --hub is omitted, the CLI resolves the hub via
get_hub_url(root) in muse/cli/commands/hub/_core.py line 909 and 974.
This reads [hub] url from .muse/config.toml in the current repo — which
is almost always the repo's configured local or default hub, not staging.
The proposal lives on a different hub, so the lookup fails.
The generated CLI commands in the proposal template do not include --hub,
so every user who copy-pastes from the UI will hit this if they have any
hub configuration at all.
Fix — Two Parts
1. Template (musehub/templates/musehub/pages/proposal_detail.html lines 557-571)
Pass hub_base_url from the view and append --hub {{ hub_base_url }} to
every generated merge command:
<code class="proposal-cli-cmd proposal-cli-cmd--block">
muse hub proposal merge {{ proposal_id }} --strategy overlay --history merge --hub {{ hub_base_url }}
</code>
The view already computes embed_url and raw_url from request.base_url — the
same value can be passed as hub_base_url.
2. Error message (muse/cli/commands/hub/_core.py)
When a proposal 404s, detect the case and surface a --hub hint:
❌ Proposal sha256:e83b... not found.
The proposal may live on a different hub. Try passing --hub <url>.
Current hub: https://localhost:1337/gabriel/musehub
Relevant Code
| File | Symbol / Line | Notes |
|---|---|---|
musehub/templates/musehub/pages/proposal_detail.html |
lines 557–571 | all three merge command variants missing --hub |
musehub/api/routes/musehub/ui_proposals.py |
view that renders proposal_detail.html |
needs to pass hub_base_url to template context |
muse/cli/commands/hub/_core.py |
_get_hub_and_identity (line 974), _get_hub_and_optional_identity (line 909) |
hub URL resolution fallback chain |
muse/cli/config.py |
get_hub_url |
reads [hub] url from .muse/config.toml |
Acceptance Criteria
- All three merge commands in the CLI reference section include
--hub <hub_url>pointing to the current hub - Copy-pasting any generated command from a proposal page works without modification
- The 404 error message for a missing proposal includes a
--hubhint
Fixed. The merge CLI section now shows a single command:\n\n
\nmuse hub proposal merge \<proposal_id\> --hub \<hub_url\>\n\n\nThe three-variant block (overlay·merge, overlay·squash, rebase) is gone.hub_urlis injected fromstr(request.base_url).rstrip('/')so it always reflects the actual hub serving the page. The 'docs ↗' link now points to/muse/mergefor advanced merge engine options. Deployed to staging.