Skip to content

Commit ff3e61a

Browse files
committed
fix(skills): harden URL conversion
1 parent e8eba96 commit ff3e61a

File tree

4 files changed

+429
-48
lines changed

4 files changed

+429
-48
lines changed

skills/xget/SKILL.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ self-hosted option exists.
2929
- `XGET_BASE_URL` from the environment
3030
- if neither exists and the task is not just writing docs, ask the user for
3131
their self-hosted Xget domain and configure `XGET_BASE_URL`
32-
- `https://xget.example.com` only for docs or templates when a real domain
33-
is not available yet
32+
- `https://xget.example.com` only for docs or templates when a real domain is
33+
not available yet
3434
- `https://xget.xi-xu.me` only as an explicitly labeled fallback after the
3535
user declines or cannot provide a self-hosted domain
3636
2. Keep platform data fresh. Do not hardcode the full prefix list from memory.
@@ -51,7 +51,8 @@ node scripts/xget.mjs convert --base-url https://xget.example.com --url https://
5151

5252
1. Identify the user's goal:
5353
- convert one or more upstream URLs
54-
- generate config snippets for npm, pip, Go, NuGet, Cargo, Docker, or AI SDKs
54+
- generate config snippets for npm, pip, Go, NuGet, Docker, or AI SDKs
55+
- explain the current Cargo limitation for registry source replacement
5556
- explain which Xget prefix to use
5657
- propose or document a self-hosted deployment
5758
2. Refresh the live platform map with `scripts/xget.mjs` if the answer depends
@@ -62,6 +63,7 @@ node scripts/xget.mjs convert --base-url https://xget.example.com --url https://
6263
5. Before finishing, sanity-check that every example uses the right Xget path
6364
shape:
6465
- repo/content: `/{prefix}/...`
66+
- crates.io HTTP URLs: `/crates/...` rather than `/crates/api/v1/crates/...`
6567
- inference APIs: `/ip/{provider}/...`
6668
- OCI registries: `/cr/{registry}/...`
6769

@@ -94,7 +96,10 @@ node scripts/xget.mjs platforms --format table
9496
[references/REFERENCE.md](references/REFERENCE.md).
9597
- If an upstream URL does not match any known platform, do not invent a prefix.
9698
Report that no current Xget mapping was found.
97-
- When writing pip config for HTTPS domains, keep `trusted-host` aligned with
98-
the actual host only if the user really needs it.
99+
- The default pip snippet should omit `trusted-host`; add it only when the
100+
deployment really needs it and keep it aligned with the actual host.
101+
- The `cargo` preset is informational for now. Xget can rewrite direct
102+
`crates.io` HTTP URLs under `/crates/...`, but this skill should not emit
103+
Cargo source replacement config until Xget exposes a registry index endpoint.
99104
- When generating docs or templates without a real domain, prefer
100105
`https://xget.example.com` over the public demo.

skills/xget/references/REFERENCE.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Use these defaults in order:
99
3. `https://xget.example.com` only for templates and docs
1010
4. `https://xget.xi-xu.me` only as a clearly labeled public-demo fallback
1111

12-
The Xget README explicitly labels `xget.xi-xu.me` as a pre-deployed instance with no reliability guarantee, while the self-hosting docs and DigitalOcean guide show recommended self-hosted domains such as `xget.example.com`.
12+
The Xget README explicitly labels `xget.xi-xu.me` as a pre-deployed instance
13+
with no reliability guarantee, while the self-hosting docs and DigitalOcean
14+
guide show recommended self-hosted domains such as `xget.example.com`.
1315

1416
## Live platform source
1517

@@ -44,7 +46,11 @@ The script derives these path shapes from platform keys:
4446
- pip simple index: `https://{base}/pypi/simple/`
4547
- Go proxy: `https://{base}/golang`
4648
- NuGet v3 index: `https://{base}/nuget/v3/index.json`
47-
- Cargo registry: `https://{base}/crates/`
49+
- Direct crates.io HTTP URLs: `https://{base}/crates/...`
50+
51+
Cargo registry source replacement is not currently emitted by this skill. Xget's
52+
`/crates/...` route rewrites direct crates.io HTTP API and download URLs, but it
53+
does not expose a Cargo registry index endpoint.
4854

4955
### Container registries
5056

@@ -76,7 +82,7 @@ Representative presets:
7682
- `pip`
7783
- `go`
7884
- `nuget`
79-
- `cargo`
85+
- `cargo` (returns the current limitation instead of source replacement config)
8086
- `docker-ghcr`
8187
- `openai`
8288
- `anthropic`
@@ -98,7 +104,7 @@ services:
98104
image: ghcr.io/xixu-me/xget:latest
99105
container_name: xget
100106
ports:
101-
- "127.0.0.1:8080:8080"
107+
- '127.0.0.1:8080:8080'
102108
restart: unless-stopped
103109
```
104110
@@ -109,8 +115,14 @@ Representative reverse-proxy outcome:
109115

110116
## Troubleshooting heuristics
111117

112-
- `404` on converted URLs often means the wrong prefix or an unmatched upstream platform.
113-
- pip issues often come from mixing the right `index-url` with the wrong host in `trusted-host`.
118+
- `404` on converted URLs often means the wrong prefix or an unmatched upstream
119+
platform.
120+
- crates.io conversions should strip the upstream `/api/v1/crates` prefix before
121+
adding `/crates/...`.
122+
- pip issues often come from adding `trusted-host` unnecessarily or pointing it
123+
at the wrong host.
114124
- Docker examples must use `/cr/{registry}` prefixes, not plain `/{prefix}`.
115-
- AI SDK examples usually need the Xget base URL changed but keep the original API key behavior.
116-
- If the user asks for the “latest” supported platform, refresh the live platform map before answering.
125+
- AI SDK examples usually need the Xget base URL changed but keep the original
126+
API key behavior.
127+
- If the user asks for the “latest” supported platform, refresh the live
128+
platform map before answering.

0 commit comments

Comments
 (0)