Skip to content

Commit 11a032f

Browse files
committed
refactor(skill): streamline Xget skill documentation and remove deprecated test cases
1 parent ba9d2f6 commit 11a032f

File tree

4 files changed

+24
-98
lines changed

4 files changed

+24
-98
lines changed

skills/xget/SKILL.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ description:
66
self-hosted Xget instance. Use this skill when a task involves Xget URL
77
rewriting, registry acceleration, proxy base URLs, self-hosting, or choosing
88
the correct Xget prefix for Git, packages, OCI images, or inference APIs.
9-
Prefer the user's own Xget domain; treat the public demo as a last-resort
10-
fallback.
119
license: GPL-3.0-or-later
1210
compatibility:
1311
Requires network access to refresh the live platform map. Optional Node.js 18+
@@ -17,10 +15,7 @@ allowed-tools: Bash(node:*) Bash(curl:*) Read
1715

1816
# Xget
1917

20-
Use this skill for Xget-specific tasks only. Default to the user's self-hosted
21-
Xget domain or an explicit internal instance. Do not default to
22-
`https://xget.xi-xu.me` unless the user explicitly wants the public demo or no
23-
self-hosted option exists.
18+
Use this skill for Xget-specific tasks only.
2419

2520
## Defaults
2621

@@ -29,10 +24,8 @@ self-hosted option exists.
2924
- `XGET_BASE_URL` from the environment
3025
- if neither exists and the task is not just writing docs, ask the user for
3126
their self-hosted Xget domain and configure `XGET_BASE_URL`
32-
- `https://xget.example.com` only for docs or templates when a real domain is
33-
not available yet
34-
- `https://xget.xi-xu.me` only as an explicitly labeled fallback after the
35-
user declines or cannot provide a self-hosted domain
27+
- `https://xget.example.com` only as a placeholder in docs or templates when
28+
a real domain is not available yet
3629
2. Keep platform data fresh. Do not hardcode the full prefix list from memory.
3730
Run:
3831

@@ -97,5 +90,6 @@ node scripts/xget.mjs platforms --format table
9790
Report that no current Xget mapping was found.
9891
- The default pip snippet should omit `trusted-host`; add it only when the
9992
deployment really needs it and keep it aligned with the actual host.
100-
- When generating docs or templates without a real domain, prefer
101-
`https://xget.example.com` over the public demo.
93+
- When generating docs or templates without a real domain, use
94+
`https://xget.example.com` as a clearly labeled placeholder rather than a
95+
default instance.

skills/xget/references/REFERENCE.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ Use these defaults in order:
66

77
1. User-provided Xget base URL
88
2. `XGET_BASE_URL` from the environment
9-
3. `https://xget.example.com` only for templates and docs
10-
4. `https://xget.xi-xu.me` only as a clearly labeled public-demo fallback
9+
3. `https://xget.example.com` only as a placeholder in templates and docs
1110

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`.
11+
This skill should not surface or assume a public demo domain. Prefer
12+
self-hosted guidance and custom-domain examples such as `xget.example.com`.
1513

1614
## Live platform source
1715

skills/xget/scripts/xget.mjs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import vm from 'node:vm';
88
const DEFAULT_SOURCE_URL = 'https://raw.gitcode.com/xixu-me/xget/raw/main/src/config/platforms.js';
99

1010
const DEFAULT_BASE_PLACEHOLDER = 'https://xget.example.com';
11+
const MISSING_BASE_URL_HINT = `Missing --base-url and XGET_BASE_URL. For docs, use ${DEFAULT_BASE_PLACEHOLDER}.`;
1112

1213
const CRATES_API_PREFIX = '/api/v1/crates';
1314

@@ -245,6 +246,16 @@ function normalizeBaseUrl(value) {
245246
}
246247
}
247248

249+
/**
250+
* Resolve an explicit or environment-provided base URL without inventing a fallback instance.
251+
* @param {string | undefined} optionValue
252+
* @param {string | undefined} envValue
253+
* @returns {string | null}
254+
*/
255+
export function resolveBaseUrl(optionValue, envValue) {
256+
return normalizeBaseUrl(optionValue ?? envValue);
257+
}
258+
248259
/**
249260
* @param {string} value
250261
* @param {string} flagName
@@ -590,8 +601,8 @@ async function main() {
590601

591602
if (command === 'convert') {
592603
const baseUrl =
593-
normalizeBaseUrl(getStringOption(options, 'base-url') ?? process.env.XGET_BASE_URL) ??
594-
fail(`Missing --base-url and XGET_BASE_URL. For docs, use ${DEFAULT_BASE_PLACEHOLDER}.`, 2);
604+
resolveBaseUrl(getStringOption(options, 'base-url'), process.env.XGET_BASE_URL) ??
605+
fail(MISSING_BASE_URL_HINT, 2);
595606

596607
const rawUrl = getStringOption(options, 'url');
597608
if (!rawUrl) {
@@ -630,8 +641,8 @@ async function main() {
630641

631642
if (command === 'snippet') {
632643
const baseUrl =
633-
normalizeBaseUrl(getStringOption(options, 'base-url') ?? process.env.XGET_BASE_URL) ??
634-
fail(`Missing --base-url and XGET_BASE_URL. For docs, use ${DEFAULT_BASE_PLACEHOLDER}.`, 2);
644+
resolveBaseUrl(getStringOption(options, 'base-url'), process.env.XGET_BASE_URL) ??
645+
fail(MISSING_BASE_URL_HINT, 2);
635646

636647
const preset = getStringOption(options, 'preset');
637648
if (!preset) {

test/unit/xget-skill.test.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)