@finedesign/cli 0.2.0-rc.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +47 -159
- package/data/1.25.0/catalog.json +1 -1
- package/data/1.25.0/manifest.json +5 -6
- package/package.json +1 -1
- package/skills/fine-design/references/imports-and-setup.md +8 -8
- package/src/cli.mjs +18 -4
- package/src/core/contracts.mjs +2 -0
- package/src/core/html.cjs +32 -0
- package/src/core/runtime.mjs +62 -0
- package/src/mcp.mjs +7 -3
- package/skills/fine-design/references/browser-runtime-legacy.json +0 -71
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"version": "1.25.0",
|
|
4
4
|
"sourceKind": "repository-snapshot",
|
|
5
|
-
"sourceRevision": "
|
|
6
|
-
"sourceDirty":
|
|
7
|
-
"contentHash": "
|
|
8
|
-
"catalogSha256": "
|
|
5
|
+
"sourceRevision": "cd0e18216c5c827cadb64a71a947a643394d15ac",
|
|
6
|
+
"sourceDirty": false,
|
|
7
|
+
"contentHash": "c64aec628caee0ee14cbaeb68bbe7e0d3bea0362590d94ac8f3da983f054a348",
|
|
8
|
+
"catalogSha256": "8dd9a17aafcb42a07667d9ee50e9398a7f229fa1855efbf86a466baf819ee661",
|
|
9
9
|
"skillFiles": {
|
|
10
|
-
"references/browser-runtime-legacy.json": "7e9ab5da90c0797813cd206f30575f53f0305e3e5817af0a46f03d193615b543",
|
|
11
10
|
"references/component-guide.md": "fd18509f7b304bb3073736c514c1b43d41284499a5616cb4fcba95bf849094cb",
|
|
12
11
|
"references/docs-slug-map.md": "440ce5cf137fd22eabfcc5b51c3f55b85174aa643773ef0cedd5df542e77bbc2",
|
|
13
|
-
"references/imports-and-setup.md": "
|
|
12
|
+
"references/imports-and-setup.md": "5bd9024770a77ddeb0f4dce94ebd103f327c2513b52f165e371da9c4dbdcd98f",
|
|
14
13
|
"references/theme-and-dark-mode.md": "2eccae4930ea993e7088eee03a4b4a0f1c839033079db5f21f8c60e0fe8168d1",
|
|
15
14
|
"SKILL.md": "035ce9e23c7c1f78addcb08198f02b3b482c61d8a9b3b939e8b5f12511058750"
|
|
16
15
|
}
|
package/package.json
CHANGED
|
@@ -47,16 +47,16 @@ Use browser/CDN mode for standalone pages, embedded pages and previews without a
|
|
|
47
47
|
|
|
48
48
|
### Select Resources
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
2. Resolve each resource's `path` relative to that release manifest; resources with `url` use that exact URL. Read package versions from resource metadata. Do not infer them from the CLI version, a broad peer range or today's website.
|
|
52
|
-
3. If the manifest has not been deployed or cannot be retrieved, use the [legacy resource snapshot](browser-runtime-legacy.json). Its Fine Design version is explicitly unknown: verify required exports and interactions, and do not claim it matches an exact npm version. If exact version matching is required, obtain a matching release instead of guessing. Report inaccessible or changed resources; do not silently switch runtime versions.
|
|
53
|
-
4. Resolve resources once when generating the page and write their exact URLs and `integrity` values into the output. Keep React and ReactDOM as the paired resources in that manifest; do not replace them with `latest`. Newer React releases may not provide UMD files.
|
|
50
|
+
With CLI `0.2.0` or newer, use `fine-design runtime list --format json` and `fine-design runtime --fd-version <exact-version> --format json` (MCP: `list_browser_runtimes` / `get_browser_runtime`). Use `fine-design runtime --fd-version <exact-version> --format html > demo.html` for a runnable standalone example (add `--runtime-url` for an explicitly selected preview). Only the currently hosted version is available; offline documentation may include more versions. An unavailable version is an error, not a reason to change the requested version.
|
|
54
51
|
|
|
55
|
-
|
|
52
|
+
1. Read the public [runtime manifest](https://fine-design-runtime.pages.dev/manifest.json). In this repository it is generated under `tools/fine-design/public/assets/react/fine-design-runtime/`. The manifest directly contains `version` and `resources`; there is no discovery pointer or historical version index.
|
|
53
|
+
2. Resolve resource `path` relative to that manifest; `url` is used exactly. Hosted paths include the precise package version, such as `fine-design/1.25.0/fine-design.min.js`. There is no hash directory or releaseId. Resource SHA-256 and SRI still verify the exact bytes.
|
|
54
|
+
3. The host retains only the current release files. Old URLs may disappear on upgrade; save matching resources yourself for long-lived standalone pages. Do not claim historical runtime availability from the CLI's offline catalog.
|
|
55
|
+
4. If the manifest cannot be retrieved, report the failure and use an explicitly selected verified host or previously saved matching resources. The old unversioned website resources have been removed; do not fall back to them or substitute another component version.
|
|
56
56
|
|
|
57
|
-
Load `fineDesignCss`, then
|
|
57
|
+
Load `fineDesignCss`, then `react`, `reactDOM`, `fineDesign`. Pin exact URLs and integrity in generated HTML and use `crossorigin="anonymous"`; the host must provide CORS. Do not drop SRI from a selected versioned runtime to hide an error. Avoid async scripts and conflicting second React instances. If an embedding host lacks compatible React globals, use a separate document/iframe.
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Use `--runtime-url <verified-base-url>` only for a clearly selected host. The default public host is `https://fine-design-runtime.pages.dev/`, verified after production deployment; local testing alone does not prove a host is live. Optional chart resources are loaded only for chart requests.
|
|
60
60
|
|
|
61
61
|
### Mount And Verify
|
|
62
62
|
|
|
@@ -72,4 +72,4 @@ ReactDOM.createRoot(document.getElementById('root')).render(
|
|
|
72
72
|
);
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
The repository's `npm run build:public-assets` builds the component
|
|
75
|
+
The repository's `npm run build:public-assets` builds the production component before generating the single latest manifest and browser example under tools. Deploy only the generated runtime directory with CORS; do not relabel a stale component build. Full local release checks are in `tools/fine-design/README.md`.
|
package/src/cli.mjs
CHANGED
|
@@ -6,6 +6,8 @@ import { queryCatalog } from './core/catalog.mjs';
|
|
|
6
6
|
import { loadCatalog, readIndex } from './core/data.mjs';
|
|
7
7
|
import { resolveVersion } from './core/version.mjs';
|
|
8
8
|
import { ToolError, errorResult } from './core/errors.mjs';
|
|
9
|
+
import { listRuntimes, resolveRuntime } from './core/runtime.mjs';
|
|
10
|
+
import html from './core/html.cjs';
|
|
9
11
|
|
|
10
12
|
const help = `Usage: fine-design <command> [arguments] [options]
|
|
11
13
|
|
|
@@ -14,12 +16,14 @@ Commands:
|
|
|
14
16
|
doc <component> Read component documentation
|
|
15
17
|
example <component> <id> Read source files and asset metadata
|
|
16
18
|
doctor Inspect detected version, available catalogs and bundled Skill
|
|
19
|
+
runtime [list] Resolve a versioned online UMD runtime or list published versions
|
|
17
20
|
mcp Start the stdio MCP server
|
|
18
21
|
|
|
19
22
|
Options:
|
|
20
23
|
--fd-version <version> Exact Fine Design component version
|
|
21
24
|
--project <directory> Project used to detect the installed version
|
|
22
|
-
--
|
|
25
|
+
--runtime-url <url> Runtime hosting base URL (runtime command only)
|
|
26
|
+
--format <text|json|markdown|html> Output format (markdown: doc; html: runtime)
|
|
23
27
|
--section <heading> Doc section heading (exact or case-insensitive)
|
|
24
28
|
--toc, --summary Show only doc metadata, section headings and example IDs
|
|
25
29
|
--offset <number> Search pagination offset
|
|
@@ -48,7 +52,7 @@ function runDoctor(values) {
|
|
|
48
52
|
}
|
|
49
53
|
} catch (error) {
|
|
50
54
|
if (error instanceof ToolError && error.code === 'VERSION_NOT_DETECTED') {
|
|
51
|
-
suggestions = error.
|
|
55
|
+
suggestions = error.context?.suggestions || [];
|
|
52
56
|
} else {
|
|
53
57
|
throw error;
|
|
54
58
|
}
|
|
@@ -73,18 +77,28 @@ export async function main(argv) {
|
|
|
73
77
|
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, strict: true, options: {
|
|
74
78
|
help: { type: 'boolean' }, version: { type: 'boolean' }, 'fd-version': { type: 'string' }, project: { type: 'string' },
|
|
75
79
|
format: { type: 'string' }, section: { type: 'string' }, toc: { type: 'boolean' }, summary: { type: 'boolean' },
|
|
76
|
-
offset: { type: 'string' }, 'include-assets': { type: 'boolean' }
|
|
80
|
+
offset: { type: 'string' }, 'include-assets': { type: 'boolean' },
|
|
81
|
+
'runtime-url': { type: 'string' }
|
|
77
82
|
}});
|
|
78
83
|
format = values.format || 'text';
|
|
79
|
-
if (!['text', 'json', 'markdown'].includes(format)) throw new ToolError('INVALID_ARGUMENT', 'Unknown output format.', 2);
|
|
84
|
+
if (!['text', 'json', 'markdown', 'html'].includes(format)) throw new ToolError('INVALID_ARGUMENT', 'Unknown output format.', 2);
|
|
80
85
|
if (values.help || (!positionals.length && !values.version && !argv.length)) { console.log(help); return; }
|
|
81
86
|
if (values.version && argv.length === 1) { console.log(JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version); return; }
|
|
82
87
|
const [command, ...args] = positionals;
|
|
83
88
|
if (command === 'mcp' && args.length === 0 && argv.length === 1) { await (await import('./mcp.mjs')).startMcp(); return; }
|
|
84
89
|
const summaryFlag = Boolean(values.toc || values.summary);
|
|
90
|
+
if (command !== 'runtime' && (values['runtime-url'] !== undefined)) throw new ToolError('INVALID_ARGUMENT', 'Runtime options are only supported for runtime.', 2);
|
|
85
91
|
if (format === 'markdown' && command !== 'doc') {
|
|
86
92
|
throw new ToolError('INVALID_ARGUMENT', 'Markdown output format is only supported for the doc command.', 2);
|
|
87
93
|
}
|
|
94
|
+
if (format === 'html' && (command !== 'runtime' || args.length)) throw new ToolError('INVALID_ARGUMENT', 'HTML output format is only supported for runtime resolution.', 2);
|
|
95
|
+
if (command === 'runtime') {
|
|
96
|
+
const list = args.length === 1 && args[0] === 'list';
|
|
97
|
+
if ((!list && args.length) || values.version || values.section !== undefined || summaryFlag || values.offset !== undefined || values['include-assets'] !== undefined || (list && (values['fd-version'] !== undefined || values.project !== undefined))) throw new ToolError('INVALID_ARGUMENT', 'Use runtime [list] with --fd-version and --runtime-url as applicable.', 2);
|
|
98
|
+
const result = list ? await listRuntimes(values['runtime-url']) : await resolveRuntime({ version: resolveVersion(values['fd-version'], values.project), runtimeURL: values['runtime-url'] });
|
|
99
|
+
console.log(format === 'html' ? html.exampleHTML(result.resources, './').trimEnd() : format === 'json' ? JSON.stringify(result) : list ? result.versions.join('\n') : `Fine Design ${result.version} (offline docs: ${result.docsAvailable ? 'available' : 'not bundled'})\n${result.tags}\nExample: ${result.exampleURL}`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
88
102
|
if (command === 'doctor') {
|
|
89
103
|
if (values.version || args.length > 0 || values.section !== undefined || summaryFlag || values.offset !== undefined || values['include-assets'] !== undefined) {
|
|
90
104
|
throw new ToolError('INVALID_ARGUMENT', 'Invalid options for doctor. Use --help for usage.', 2);
|
package/src/core/contracts.mjs
CHANGED
|
@@ -11,6 +11,8 @@ export const schemas = {
|
|
|
11
11
|
section: z.string().min(1).max(200).optional(),
|
|
12
12
|
summary: z.boolean().optional().describe('Return only metadata, section headings and example IDs without full markdown.')
|
|
13
13
|
}).strict(),
|
|
14
|
+
list_browser_runtimes: z.object({ runtimeURL: z.string().max(2048).optional() }).strict(),
|
|
15
|
+
get_browser_runtime: z.object({ version, runtimeURL: z.string().max(2048).optional() }).strict(),
|
|
14
16
|
get_component_example: z.object({
|
|
15
17
|
version,
|
|
16
18
|
component,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function exampleHTML(resources, prefix) {
|
|
2
|
+
const url = (entry) => entry.url || `${prefix}${entry.path}`;
|
|
3
|
+
const css = resources.fineDesignCss;
|
|
4
|
+
const scripts = ['react', 'reactDOM', 'fineDesign'].map((name) => {
|
|
5
|
+
const entry = resources[name];
|
|
6
|
+
return `<script src="${url(entry)}" integrity="${entry.integrity}" crossorigin="anonymous" onerror="(window.runtimeLoadErrors ||= []).push(this.src)"></script>`;
|
|
7
|
+
}).join('\n');
|
|
8
|
+
return `<!doctype html>
|
|
9
|
+
<html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
10
|
+
<title>Fine Design 浏览器示例</title>
|
|
11
|
+
<link rel="stylesheet" href="${url(css)}" integrity="${css.integrity}" crossorigin="anonymous" onerror="(window.runtimeLoadErrors ||= []).push(this.href)">
|
|
12
|
+
<body style="margin:48px"><h1>Fine Design</h1><p>浏览器接入示例</p>
|
|
13
|
+
<p id="error" role="alert" hidden>资源加载失败,请检查网络或资源地址。</p><div id="root"></div>
|
|
14
|
+
${scripts}
|
|
15
|
+
<script>
|
|
16
|
+
try {
|
|
17
|
+
if (window.runtimeLoadErrors || !window.FineDesign || !window.ReactDOM || typeof ReactDOM.createRoot !== 'function') throw new Error('Missing runtime');
|
|
18
|
+
const h = React.createElement;
|
|
19
|
+
function App() {
|
|
20
|
+
const [count, setCount] = React.useState(0);
|
|
21
|
+
return h(FineDesign.Button, { type: 'primary', onClick: () => setCount(count + 1) }, '已点击 ' + count + ' 次');
|
|
22
|
+
}
|
|
23
|
+
ReactDOM.createRoot(document.getElementById('root')).render(h(App));
|
|
24
|
+
} catch (error) {
|
|
25
|
+
const message = document.getElementById('error');
|
|
26
|
+
message.hidden = false;
|
|
27
|
+
message.textContent = window.runtimeLoadErrors ? '资源加载失败:' + window.runtimeLoadErrors.join(',') : '页面启动失败:' + error.message;
|
|
28
|
+
}
|
|
29
|
+
</script></body></html>\n`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = { exampleHTML };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { exactVersion, readIndex } from './data.mjs';
|
|
2
|
+
import { ToolError } from './errors.mjs';
|
|
3
|
+
|
|
4
|
+
export const defaultRuntimeURL = 'https://fine-design-runtime.pages.dev/';
|
|
5
|
+
const hosted = { fineDesign: ['@fx-ui/fine-design', 'fine-design', 'fine-design.min.js'], fineDesignCss: ['@fx-ui/fine-design', 'fine-design', 'fine-design.min.css'], vanAnalysis: ['@van/analysis', 'van-analysis', 'van-analysis.min.js'], vanAnalysisCss: ['@van/analysis', 'van-analysis', 'van-analysis.min.css'] };
|
|
6
|
+
const invalid = (message) => { throw new ToolError('RUNTIME_INVALID', message, 1); };
|
|
7
|
+
|
|
8
|
+
export function validateRuntimeManifest(manifest) {
|
|
9
|
+
if (manifest?.schemaVersion !== 1 || !exactVersion.test(manifest.version) || !manifest.resources || Object.keys(manifest.resources).sort().join(',') !== ['react', 'reactDOM', ...Object.keys(hosted)].sort().join(',')) invalid('Invalid current runtime manifest.');
|
|
10
|
+
for (const [key, entry] of Object.entries(manifest.resources)) {
|
|
11
|
+
if (!entry || !exactVersion.test(entry.version) || !/^[a-f0-9]{64}$/.test(entry.sha256) || entry.integrity !== `sha256-${Buffer.from(entry.sha256, 'hex').toString('base64')}` || !Number.isSafeInteger(entry.size) || entry.size <= 0 || entry.type !== (key.endsWith('Css') ? 'style' : 'script')) invalid(`Invalid runtime resource: ${key}`);
|
|
12
|
+
if (hosted[key]) {
|
|
13
|
+
const [pkg, directory, filename] = hosted[key];
|
|
14
|
+
if (entry.package !== pkg || entry.path !== `${directory}/${entry.version}/${filename}` || entry.url) invalid(`Unexpected versioned resource path: ${key}`);
|
|
15
|
+
} else {
|
|
16
|
+
const pkg = key === 'react' ? 'react' : 'react-dom';
|
|
17
|
+
if (entry.package !== pkg || entry.path || entry.url !== `https://cdn.jsdelivr.net/npm/${pkg}@${entry.version}/umd/${pkg}.production.min.js`) invalid(`Unexpected React runtime: ${key}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const r = manifest.resources;
|
|
21
|
+
if (r.fineDesign.version !== manifest.version || r.fineDesignCss.version !== manifest.version || r.react.version !== r.reactDOM.version || r.vanAnalysis.version !== r.vanAnalysisCss.version) invalid('Runtime package versions do not match.');
|
|
22
|
+
return manifest;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function readRuntime(value = defaultRuntimeURL) {
|
|
26
|
+
let base;
|
|
27
|
+
try { base = new URL(value); } catch { invalid('Invalid runtime URL.'); }
|
|
28
|
+
if ((base.protocol !== 'https:' && !(base.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(base.hostname))) || base.username || base.password || base.search || base.hash) invalid('Use an HTTPS runtime URL without credentials, query or fragment; HTTP is allowed on loopback.');
|
|
29
|
+
if (!base.pathname.endsWith('/')) base.pathname += '/';
|
|
30
|
+
const manifestURL = new URL('manifest.json', base);
|
|
31
|
+
let manifest;
|
|
32
|
+
try {
|
|
33
|
+
const response = await fetch(manifestURL, { redirect: 'error', signal: AbortSignal.timeout(15000), headers: { Accept: 'application/json' } });
|
|
34
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
35
|
+
if (!/application\/json/i.test(response.headers.get('content-type') || '')) throw new Error('Expected JSON MIME type');
|
|
36
|
+
const chunks = []; let size = 0;
|
|
37
|
+
for await (const chunk of response.body) {
|
|
38
|
+
size += chunk.length;
|
|
39
|
+
if (size > 1024 * 1024) throw new Error('Runtime metadata exceeds 1 MB');
|
|
40
|
+
chunks.push(chunk);
|
|
41
|
+
}
|
|
42
|
+
manifest = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
43
|
+
} catch (error) { throw new ToolError('RUNTIME_UNAVAILABLE', `Cannot read ${manifestURL}: ${error.message}. No other version was selected.`, 1); }
|
|
44
|
+
return { runtimeURL: base.href, manifestURL: manifestURL.href, manifest: validateRuntimeManifest(manifest) };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function listRuntimes(runtimeURL) {
|
|
48
|
+
const current = await readRuntime(runtimeURL);
|
|
49
|
+
return { runtimeURL: current.runtimeURL, schemaVersion: 1, versions: [current.manifest.version] };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function resolveRuntime({ version, runtimeURL }) {
|
|
53
|
+
if (!exactVersion.test(version)) throw new ToolError('INVALID_ARGUMENT', 'Specify an exact component version.', 2);
|
|
54
|
+
const current = await readRuntime(runtimeURL);
|
|
55
|
+
if (current.manifest.version !== version) throw new ToolError('RUNTIME_VERSION_NOT_FOUND', `Only Fine Design ${current.manifest.version} is currently hosted; ${version} is unavailable. Historical UMD files are not retained.`, 3, { availableVersions: [current.manifest.version] });
|
|
56
|
+
const resources = Object.fromEntries(Object.entries(current.manifest.resources).map(([key, entry]) => [key, { ...entry, url: entry.url || new URL(entry.path, current.manifestURL).href }]));
|
|
57
|
+
const tags = ['fineDesignCss', 'react', 'reactDOM', 'fineDesign'].map((key) => {
|
|
58
|
+
const entry = resources[key];
|
|
59
|
+
return entry.type === 'style' ? `<link rel="stylesheet" href="${entry.url}" integrity="${entry.integrity}" crossorigin="anonymous">` : `<script src="${entry.url}" integrity="${entry.integrity}" crossorigin="anonymous"></script>`;
|
|
60
|
+
}).join('\n');
|
|
61
|
+
return { version, docsAvailable: Object.hasOwn(readIndex().versions, version), manifestURL: current.manifestURL, exampleURL: new URL('index.html', current.runtimeURL).href, resources, tags };
|
|
62
|
+
}
|
package/src/mcp.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { queryCatalog } from './core/catalog.mjs';
|
|
|
7
7
|
import { loadCatalog } from './core/data.mjs';
|
|
8
8
|
import { schemas, validateInput } from './core/contracts.mjs';
|
|
9
9
|
import { errorResult } from './core/errors.mjs';
|
|
10
|
+
import { listRuntimes, resolveRuntime } from './core/runtime.mjs';
|
|
10
11
|
|
|
11
12
|
export async function startMcp() {
|
|
12
13
|
const packageInfo = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
@@ -14,17 +15,20 @@ export async function startMcp() {
|
|
|
14
15
|
const descriptions = {
|
|
15
16
|
search_components: 'Search components, subcomponents and built-in icons; use nextOffset to browse subsequent pages.',
|
|
16
17
|
get_component_doc: 'Read component documentation, or pass summary: true to list section headings and example IDs first.',
|
|
17
|
-
get_component_example: 'Read example source files, dependencies and asset metadata. Set includeAssets to include binary base64 and oversized JSON fixture content.'
|
|
18
|
+
get_component_example: 'Read example source files, dependencies and asset metadata. Set includeAssets to include binary base64 and oversized JSON fixture content.',
|
|
19
|
+
list_browser_runtimes: 'Read the one currently hosted UMD version from its online manifest. Requires network access.',
|
|
20
|
+
get_browser_runtime: 'Resolve an exact component version to versioned current UMD URLs and SRI loading tags. Requires network access; never falls back to another version.'
|
|
18
21
|
};
|
|
19
22
|
server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: Object.entries(schemas).map(([name, schema]) => ({
|
|
20
23
|
name, description: descriptions[name], inputSchema: z.toJSONSchema(schema, { target: 'draft-07' }),
|
|
21
|
-
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint:
|
|
24
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: name === 'get_browser_runtime' || name === 'list_browser_runtimes' }
|
|
22
25
|
})) }));
|
|
23
26
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
24
27
|
try {
|
|
25
28
|
const { name, arguments: input } = request.params;
|
|
26
29
|
const args = validateInput(name, input);
|
|
27
|
-
|
|
30
|
+
const result = name === 'get_browser_runtime' ? await resolveRuntime(args) : name === 'list_browser_runtimes' ? await listRuntimes(args.runtimeURL) : queryCatalog(loadCatalog(args.version), name, args);
|
|
31
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
28
32
|
} catch (error) {
|
|
29
33
|
return { isError: true, content: [{ type: 'text', text: JSON.stringify(errorResult(error)) }] };
|
|
30
34
|
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": 1,
|
|
3
|
-
"sourceState": "legacy-unversioned",
|
|
4
|
-
"checkedOn": "2026-11-02",
|
|
5
|
-
"resources": {
|
|
6
|
-
"react": {
|
|
7
|
-
"package": "react",
|
|
8
|
-
"version": "18.3.1",
|
|
9
|
-
"type": "script",
|
|
10
|
-
"global": "React",
|
|
11
|
-
"url": "https://cdn.jsdelivr.net/npm/react@18.3.1/umd/react.production.min.js",
|
|
12
|
-
"cors": true,
|
|
13
|
-
"size": 10751,
|
|
14
|
-
"sha256": "d949f1c3687aedadcedac85261865f29b17cd273997e7f6b2bfc53b2f9d4c4dd",
|
|
15
|
-
"integrity": "sha256-2Unxw2h67a3O2shSYYZfKbF80nOZfn9rK/xTsvnUxN0="
|
|
16
|
-
},
|
|
17
|
-
"reactDOM": {
|
|
18
|
-
"package": "react-dom",
|
|
19
|
-
"version": "18.3.1",
|
|
20
|
-
"type": "script",
|
|
21
|
-
"global": "ReactDOM",
|
|
22
|
-
"url": "https://cdn.jsdelivr.net/npm/react-dom@18.3.1/umd/react-dom.production.min.js",
|
|
23
|
-
"cors": true,
|
|
24
|
-
"size": 131835,
|
|
25
|
-
"sha256": "35f4f974f4b2bcd44da73963347f8952e341f83909e4498227d4e26b98f66f0d",
|
|
26
|
-
"integrity": "sha256-NfT5dPSyvNRNpzljNH+JUuNB+DkJ5EmCJ9Tia5j2bw0="
|
|
27
|
-
},
|
|
28
|
-
"fineDesign": {
|
|
29
|
-
"package": "@fx-ui/fine-design",
|
|
30
|
-
"version": null,
|
|
31
|
-
"type": "script",
|
|
32
|
-
"global": "FineDesign",
|
|
33
|
-
"url": "https://docs.fanruan.design/assets/react/fine-design-runtime/fine-design/fine-design.min.js",
|
|
34
|
-
"cors": false,
|
|
35
|
-
"size": 953541,
|
|
36
|
-
"sha256": "f2d13832e2102c1b14661e7b493cc40deefb074177ea711ffde03a782cad0cbe",
|
|
37
|
-
"integrity": "sha256-8tE4MuIQLBsUZh57STzEDe77B0F36nEf/eA6eCytDL4="
|
|
38
|
-
},
|
|
39
|
-
"fineDesignCss": {
|
|
40
|
-
"package": "@fx-ui/fine-design",
|
|
41
|
-
"version": null,
|
|
42
|
-
"type": "style",
|
|
43
|
-
"url": "https://docs.fanruan.design/assets/react/fine-design-runtime/fine-design/fine-design.min.css",
|
|
44
|
-
"cors": false,
|
|
45
|
-
"size": 534135,
|
|
46
|
-
"sha256": "099aa50dd23f91ebd7bba853dac37087a5e54fbc9609d6563ffc7a1659c57e1d",
|
|
47
|
-
"integrity": "sha256-CZqlDdI/kevXu6hT2sNwh6XlT7yWCdZWP/x6FlnFfh0="
|
|
48
|
-
},
|
|
49
|
-
"vanAnalysis": {
|
|
50
|
-
"package": "@van/analysis",
|
|
51
|
-
"version": null,
|
|
52
|
-
"type": "script",
|
|
53
|
-
"global": "VanNext",
|
|
54
|
-
"url": "https://docs.fanruan.design/assets/react/fine-design-runtime/van-analysis/van-analysis.min.js",
|
|
55
|
-
"cors": false,
|
|
56
|
-
"size": 1050632,
|
|
57
|
-
"sha256": "45ef12733c41ac3e13fe6b4a264d3e7a79403b93b2a88e6aa966598beaaac740",
|
|
58
|
-
"integrity": "sha256-Re8SczxBrD4T/mtKJk0+enlAO5OyqI5qqWZZi+qqx0A="
|
|
59
|
-
},
|
|
60
|
-
"vanAnalysisCss": {
|
|
61
|
-
"package": "@van/analysis",
|
|
62
|
-
"version": null,
|
|
63
|
-
"type": "style",
|
|
64
|
-
"url": "https://docs.fanruan.design/assets/react/fine-design-runtime/van-analysis/van-analysis.min.css",
|
|
65
|
-
"cors": false,
|
|
66
|
-
"size": 20787,
|
|
67
|
-
"sha256": "aebde3aecbe4f89cc459e7ce9e9f978290b538d6e90ed8aa0cbf74cf9227e25e",
|
|
68
|
-
"integrity": "sha256-rr3jrsvk+JzEWefOnp+XgpC1ONbpDtiqDL90z5In4l4="
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|