Describe the bug
apm marketplace add OWNER/REPO always contacts api.github.com regardless of the
GITHUB_HOST environment variable. When the marketplace repository lives on a GitHub
Enterprise (GHES or *.ghe.com) instance, the command fails with a misleading error:
[x] No marketplace.json found in 'OWNER/REPO'. Checked: marketplace.json,
.github/plugin/marketplace.json, .claude-plugin/marketplace.json
The file exists in the repository; it is simply unreachable because the wrong host is
contacted.
To Reproduce
- Set
GITHUB_HOST to a GHE hostname, e.g. export GITHUB_HOST=myghe.example.com
- Authenticate:
export GITHUB_APM_PAT_MYORG=<ghe-pat>
- Run:
apm marketplace add myorg/my-marketplace
- Observe error — "No marketplace.json found" — even though the file is present at
.github/plugin/marketplace.json in the repository
Expected behavior
apm marketplace add should resolve the bare OWNER/REPO against GITHUB_HOST (same
as all other APM commands), contact the correct GHE API endpoint, and register the
marketplace successfully.
Root cause (identified)
In src/apm_cli/commands/marketplace.py, the add command constructs MarketplaceSource
without a host field:
probe_source = MarketplaceSource(
name=display_name,
owner=owner,
repo=repo_name,
branch=branch,
# host is omitted → defaults to "github.com"
)
MarketplaceSource.host defaults to "github.com" (see models.py), so
_auto_detect_path builds GitHub Contents API URLs against api.github.com instead of
the configured enterprise host.
All other APM commands use default_host() from apm_cli.utils.github_host, which
correctly reads GITHUB_HOST. The marketplace add command simply never calls it.
Proposed fix
Add a new "--host" parameter, to get the specific host get_host() that override the default host of the marketplace when constructing MarketplaceSource in the add command:
probe_source = MarketplaceSource(
name=display_name,
owner=owner,
repo=repo_name,
branch=branch,
host=get_host(), # ← respects GITHUB_HOST, and override from the "--host" parameter
)
The same fix should be applied to the final source = MarketplaceSource(...) constructed
after path detection, to ensure the persisted entry in marketplaces.json also carries
the correct host.
Environment
- OS: Windows
- APM Version: 0.8.10
Additional context
The authentication docs
correctly state that GITHUB_HOST controls which host bare package names resolve against.
Describe the bug
apm marketplace add OWNER/REPOalways contactsapi.github.comregardless of theGITHUB_HOSTenvironment variable. When the marketplace repository lives on a GitHubEnterprise (GHES or
*.ghe.com) instance, the command fails with a misleading error:The file exists in the repository; it is simply unreachable because the wrong host is
contacted.
To Reproduce
GITHUB_HOSTto a GHE hostname, e.g.export GITHUB_HOST=myghe.example.comexport GITHUB_APM_PAT_MYORG=<ghe-pat>apm marketplace add myorg/my-marketplace.github/plugin/marketplace.jsonin the repositoryExpected behavior
apm marketplace addshould resolve the bareOWNER/REPOagainstGITHUB_HOST(sameas all other APM commands), contact the correct GHE API endpoint, and register the
marketplace successfully.
Root cause (identified)
In
src/apm_cli/commands/marketplace.py, theaddcommand constructsMarketplaceSourcewithout a
hostfield:MarketplaceSource.hostdefaults to"github.com"(seemodels.py), so_auto_detect_pathbuilds GitHub Contents API URLs againstapi.github.cominstead ofthe configured enterprise host.
All other APM commands use
default_host()fromapm_cli.utils.github_host, whichcorrectly reads
GITHUB_HOST. Themarketplace addcommand simply never calls it.Proposed fix
Add a new "--host" parameter, to get the specific host
get_host()that override the default host of the marketplace when constructingMarketplaceSourcein theaddcommand:The same fix should be applied to the final
source = MarketplaceSource(...)constructedafter path detection, to ensure the persisted entry in
marketplaces.jsonalso carriesthe correct host.
Environment
Additional context
The authentication docs
correctly state that
GITHUB_HOSTcontrols which host bare package names resolve against.