@fernforestgames/mcp-server-godot-docs 0.1.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -0
  3. package/dist/config.d.ts +4 -0
  4. package/dist/config.d.ts.map +1 -0
  5. package/dist/config.js +10 -0
  6. package/dist/config.js.map +1 -0
  7. package/dist/docs/fetcher.d.ts +18 -0
  8. package/dist/docs/fetcher.d.ts.map +1 -0
  9. package/dist/docs/fetcher.js +129 -0
  10. package/dist/docs/fetcher.js.map +1 -0
  11. package/dist/docs/format.d.ts +6 -0
  12. package/dist/docs/format.d.ts.map +1 -0
  13. package/dist/docs/format.js +153 -0
  14. package/dist/docs/format.js.map +1 -0
  15. package/dist/docs/index.d.ts +44 -0
  16. package/dist/docs/index.d.ts.map +1 -0
  17. package/dist/docs/index.js +99 -0
  18. package/dist/docs/index.js.map +1 -0
  19. package/dist/docs/parser.d.ts +6 -0
  20. package/dist/docs/parser.d.ts.map +1 -0
  21. package/dist/docs/parser.js +206 -0
  22. package/dist/docs/parser.js.map +1 -0
  23. package/dist/docs/search.d.ts +14 -0
  24. package/dist/docs/search.d.ts.map +1 -0
  25. package/dist/docs/search.js +195 -0
  26. package/dist/docs/search.js.map +1 -0
  27. package/dist/docs/types.d.ts +62 -0
  28. package/dist/docs/types.d.ts.map +1 -0
  29. package/dist/docs/types.js +3 -0
  30. package/dist/docs/types.js.map +1 -0
  31. package/dist/docs/version.d.ts +25 -0
  32. package/dist/docs/version.d.ts.map +1 -0
  33. package/dist/docs/version.js +76 -0
  34. package/dist/docs/version.js.map +1 -0
  35. package/dist/handlers/tools/get-class.d.ts +9 -0
  36. package/dist/handlers/tools/get-class.d.ts.map +1 -0
  37. package/dist/handlers/tools/get-class.js +52 -0
  38. package/dist/handlers/tools/get-class.js.map +1 -0
  39. package/dist/handlers/tools/search-docs.d.ts +10 -0
  40. package/dist/handlers/tools/search-docs.d.ts.map +1 -0
  41. package/dist/handlers/tools/search-docs.js +62 -0
  42. package/dist/handlers/tools/search-docs.js.map +1 -0
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +31 -0
  46. package/dist/index.js.map +1 -0
  47. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fern Forest Games Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Godot Docs MCP Server ![NPM Version](https://img.shields.io/npm/v/%40fernforestgames%2Fmcp-server-godot-docs)
2
+
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that provides AI assistants with access to [Godot](https://godotengine.org) engine documentation.
4
+
5
+ ## Features
6
+
7
+ - **search_godot_docs**: Search across all Godot classes, methods, properties, signals, and constants
8
+ - **get_godot_class**: Get complete documentation for a specific class including all members
9
+
10
+ Documentation is automatically downloaded and cached on first use, matching your installed Godot version.
11
+
12
+ ## Prerequisites
13
+
14
+ - Node 22+
15
+ - Godot must be installed and accessible
16
+ - `GODOT_PATH` environment variable must be configured
17
+
18
+ ## MCP configuration
19
+
20
+ Add this server to your `.mcp.json`:
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "godot-docs": {
26
+ "type": "stdio",
27
+ "command": "npx",
28
+ "args": ["@fernforestgames/mcp-server-godot-docs"],
29
+ "env": {
30
+ "GODOT_PATH": "/path/to/godot/executable"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ ## License
38
+
39
+ Released under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,4 @@
1
+ import 'dotenv/config';
2
+ declare const godotPath: string | undefined;
3
+ export { godotPath };
4
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAGvB,QAAA,MAAM,SAAS,oBAA4B,CAAC;AAM5C,OAAO,EAAE,SAAS,EAAE,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,10 @@
1
+ // Configuration validation and setup
2
+ import 'dotenv/config';
3
+ // Get Godot executable path from environment variable
4
+ const godotPath = process.env['GODOT_PATH'];
5
+ if (!godotPath) {
6
+ console.error("Error: GODOT_PATH environment variable must be set");
7
+ process.exit(1);
8
+ }
9
+ export { godotPath };
10
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,eAAe,CAAC;AAEvB,sDAAsD;AACtD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC5C,IAAI,CAAC,SAAS,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Get the cache directory for a specific Godot version
3
+ */
4
+ export declare function getCacheDir(versionKey: string): string;
5
+ /**
6
+ * Check if docs are cached for a version
7
+ */
8
+ export declare function isCached(versionKey: string): boolean;
9
+ /**
10
+ * Fetch documentation for a specific Godot version
11
+ * Downloads from GitHub as a tarball and extracts doc/classes/*.xml
12
+ */
13
+ export declare function fetchDocs(versionKey?: string): Promise<string>;
14
+ /**
15
+ * List all XML files in the cache directory
16
+ */
17
+ export declare function listCachedDocs(cacheDir: string): string[];
18
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../src/docs/fetcher.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAUpD;AAoCD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8DpE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAQzD"}
@@ -0,0 +1,129 @@
1
+ // Download and cache Godot documentation from GitHub
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+ import * as https from 'https';
5
+ import { createWriteStream } from 'fs';
6
+ import { pipeline } from 'stream/promises';
7
+ import envPaths from 'env-paths';
8
+ import { getGodotVersion, versionToGitRef, versionToCacheKey } from './version.js';
9
+ const paths = envPaths('mcp-server-godot', { suffix: '' });
10
+ /**
11
+ * Get the cache directory for a specific Godot version
12
+ */
13
+ export function getCacheDir(versionKey) {
14
+ return path.join(paths.cache, 'docs', versionKey);
15
+ }
16
+ /**
17
+ * Check if docs are cached for a version
18
+ */
19
+ export function isCached(versionKey) {
20
+ const cacheDir = getCacheDir(versionKey);
21
+ if (!fs.existsSync(cacheDir)) {
22
+ return false;
23
+ }
24
+ // Check if we have at least some XML files
25
+ const files = fs.readdirSync(cacheDir);
26
+ const xmlFiles = files.filter(f => f.endsWith('.xml'));
27
+ return xmlFiles.length > 100; // Expect 1000+ files, but 100 is a sanity check
28
+ }
29
+ /**
30
+ * Download file with streaming (for large files)
31
+ */
32
+ async function downloadFile(url, destPath) {
33
+ return new Promise((resolve, reject) => {
34
+ const request = (urlString) => {
35
+ https.get(urlString, { headers: { 'User-Agent': 'mcp-server-godot' } }, async (res) => {
36
+ // Handle redirects
37
+ if (res.statusCode === 301 || res.statusCode === 302) {
38
+ const redirectUrl = res.headers.location;
39
+ if (redirectUrl) {
40
+ request(redirectUrl);
41
+ return;
42
+ }
43
+ }
44
+ if (res.statusCode !== 200) {
45
+ reject(new Error(`HTTP ${res.statusCode}: ${res.statusMessage}`));
46
+ return;
47
+ }
48
+ try {
49
+ const fileStream = createWriteStream(destPath);
50
+ await pipeline(res, fileStream);
51
+ resolve();
52
+ }
53
+ catch (err) {
54
+ reject(err);
55
+ }
56
+ }).on('error', reject);
57
+ };
58
+ request(url);
59
+ });
60
+ }
61
+ /**
62
+ * Fetch documentation for a specific Godot version
63
+ * Downloads from GitHub as a tarball and extracts doc/classes/*.xml
64
+ */
65
+ export async function fetchDocs(versionKey) {
66
+ const version = getGodotVersion();
67
+ const gitRef = versionToGitRef(version);
68
+ const cacheKey = versionKey || versionToCacheKey(version);
69
+ const cacheDir = getCacheDir(cacheKey);
70
+ // Check if already cached
71
+ if (isCached(cacheKey)) {
72
+ console.log(`Using cached docs for ${cacheKey}`);
73
+ return cacheDir;
74
+ }
75
+ console.log(`Fetching Godot docs for version ${version.full} (ref: ${gitRef})...`);
76
+ // Create cache directory
77
+ fs.mkdirSync(cacheDir, { recursive: true });
78
+ // Download tarball from GitHub
79
+ // For tags: https://github.com/godotengine/godot/archive/refs/tags/4.5.1-stable.tar.gz
80
+ // For branches (master): https://github.com/godotengine/godot/archive/refs/heads/master.tar.gz
81
+ const refType = gitRef === 'master' ? 'heads' : 'tags';
82
+ const tarballUrl = `https://github.com/godotengine/godot/archive/refs/${refType}/${gitRef}.tar.gz`;
83
+ const tarballPath = path.join(paths.temp, `godot-docs-${cacheKey}.tar.gz`);
84
+ // Ensure temp directory exists
85
+ fs.mkdirSync(paths.temp, { recursive: true });
86
+ try {
87
+ console.log(`Downloading from ${tarballUrl}...`);
88
+ await downloadFile(tarballUrl, tarballPath);
89
+ console.log('Extracting documentation files...');
90
+ // Extract just the doc/classes directory
91
+ // The tarball structure is: godot-4.3-stable/doc/classes/*.xml
92
+ const tar = await import('tar');
93
+ await tar.extract({
94
+ file: tarballPath,
95
+ cwd: cacheDir,
96
+ strip: 3, // Remove "godot-X.Y-stable/doc/classes/" prefix
97
+ filter: (entryPath) => {
98
+ // Only extract files from doc/classes/
99
+ return entryPath.includes('/doc/classes/') && entryPath.endsWith('.xml');
100
+ },
101
+ });
102
+ // Verify extraction
103
+ const files = fs.readdirSync(cacheDir);
104
+ const xmlFiles = files.filter(f => f.endsWith('.xml'));
105
+ console.log(`Extracted ${xmlFiles.length} documentation files`);
106
+ if (xmlFiles.length === 0) {
107
+ throw new Error('No XML files were extracted from the archive');
108
+ }
109
+ return cacheDir;
110
+ }
111
+ finally {
112
+ // Clean up tarball
113
+ if (fs.existsSync(tarballPath)) {
114
+ fs.unlinkSync(tarballPath);
115
+ }
116
+ }
117
+ }
118
+ /**
119
+ * List all XML files in the cache directory
120
+ */
121
+ export function listCachedDocs(cacheDir) {
122
+ if (!fs.existsSync(cacheDir)) {
123
+ return [];
124
+ }
125
+ return fs.readdirSync(cacheDir)
126
+ .filter(f => f.endsWith('.xml'))
127
+ .map(f => path.join(cacheDir, f));
128
+ }
129
+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CAAC,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { GodotClass } from './types.js';
2
+ /**
3
+ * Format a GodotClass as compact, LLM-friendly text
4
+ */
5
+ export declare function formatClassAsText(cls: GodotClass): string;
6
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/docs/format.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAA0D,MAAM,YAAY,CAAC;AAqGrG;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CA8DzD"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Strip BBCode-style tags from Godot documentation text
3
+ */
4
+ function stripBBCode(text) {
5
+ return text
6
+ // Convert [code]x[/code] to `x`
7
+ .replace(/\[code\](.*?)\[\/code\]/g, '`$1`')
8
+ // Convert [codeblock]...[/codeblock] to indented block
9
+ .replace(/\[codeblock\]([\s\S]*?)\[\/codeblock\]/g, (_, code) => {
10
+ const lines = code.trim().split('\n');
11
+ return '\n' + lines.map((l) => ' ' + l).join('\n') + '\n';
12
+ })
13
+ // Convert [b]x[/b] to *x*
14
+ .replace(/\[b\](.*?)\[\/b\]/g, '*$1*')
15
+ // Convert [i]x[/i] to _x_
16
+ .replace(/\[i\](.*?)\[\/i\]/g, '_$1_')
17
+ // Convert [param x] to `x`
18
+ .replace(/\[param\s+(\w+)\]/g, '`$1`')
19
+ // Convert [member x] to `x`
20
+ .replace(/\[member\s+(\w+)\]/g, '`$1`')
21
+ // Convert [method x] to `x()`
22
+ .replace(/\[method\s+(\w+)\]/g, '`$1()`')
23
+ // Convert [signal x] to `x` signal
24
+ .replace(/\[signal\s+(\w+)\]/g, '`$1` signal')
25
+ // Convert [constant x] to `x`
26
+ .replace(/\[constant\s+([^\]]+)\]/g, '`$1`')
27
+ // Convert [ClassName] to ClassName
28
+ .replace(/\[([A-Z]\w+)\]/g, '$1')
29
+ // Convert [enum X.Y] to X.Y
30
+ .replace(/\[enum\s+([^\]]+)\]/g, '$1')
31
+ // Remove other tags
32
+ .replace(/\[url[^\]]*\](.*?)\[\/url\]/g, '$1')
33
+ .replace(/\[color[^\]]*\](.*?)\[\/color\]/g, '$1')
34
+ .replace(/\[\/?[a-z_]+\]/g, '')
35
+ // Clean up whitespace
36
+ .replace(/\t+/g, ' ')
37
+ .replace(/\n{3,}/g, '\n\n')
38
+ .trim();
39
+ }
40
+ /**
41
+ * Truncate description to a reasonable length
42
+ */
43
+ function truncate(text, maxLen = 200) {
44
+ const cleaned = stripBBCode(text).replace(/\n/g, ' ').replace(/\s+/g, ' ');
45
+ if (cleaned.length <= maxLen)
46
+ return cleaned;
47
+ return cleaned.slice(0, maxLen - 3).replace(/\s+\S*$/, '') + '...';
48
+ }
49
+ /**
50
+ * Format a method signature
51
+ */
52
+ function formatMethod(m) {
53
+ const params = m.params.map(p => {
54
+ let s = `${p.name}: ${p.type}`;
55
+ if (p.default !== undefined)
56
+ s += ` = ${p.default}`;
57
+ return s;
58
+ }).join(', ');
59
+ let sig = `${m.name}(${params}) -> ${m.returnType}`;
60
+ if (m.qualifiers)
61
+ sig += ` [${m.qualifiers}]`;
62
+ const desc = truncate(m.description);
63
+ return desc ? `- ${sig} — ${desc}` : `- ${sig}`;
64
+ }
65
+ /**
66
+ * Format a property
67
+ */
68
+ function formatProperty(p) {
69
+ let sig = `${p.name}: ${p.type}`;
70
+ if (p.default !== undefined)
71
+ sig += ` = ${p.default}`;
72
+ const desc = truncate(p.description);
73
+ return desc ? `- ${sig} — ${desc}` : `- ${sig}`;
74
+ }
75
+ /**
76
+ * Format a signal
77
+ */
78
+ function formatSignal(s) {
79
+ const params = s.params.map(p => `${p.name}: ${p.type}`).join(', ');
80
+ const sig = `${s.name}(${params})`;
81
+ const desc = truncate(s.description);
82
+ return desc ? `- ${sig} — ${desc}` : `- ${sig}`;
83
+ }
84
+ /**
85
+ * Format a constant
86
+ */
87
+ function formatConstant(c) {
88
+ let sig = `${c.name} = ${c.value}`;
89
+ if (c.enum)
90
+ sig += ` (${c.enum})`;
91
+ const desc = truncate(c.description, 100);
92
+ return desc ? `- ${sig} — ${desc}` : `- ${sig}`;
93
+ }
94
+ /**
95
+ * Format a GodotClass as compact, LLM-friendly text
96
+ */
97
+ export function formatClassAsText(cls) {
98
+ const lines = [];
99
+ // Header
100
+ const inheritance = cls.inherits ? ` (extends ${cls.inherits})` : '';
101
+ lines.push(`# ${cls.name}${inheritance}`);
102
+ lines.push('');
103
+ // Brief description
104
+ if (cls.brief) {
105
+ lines.push(stripBBCode(cls.brief));
106
+ lines.push('');
107
+ }
108
+ // Full description (truncated for very long ones)
109
+ if (cls.description && cls.description !== cls.brief) {
110
+ const desc = stripBBCode(cls.description);
111
+ if (desc.length > 500) {
112
+ lines.push(desc.slice(0, 500).replace(/\s+\S*$/, '') + '...');
113
+ }
114
+ else {
115
+ lines.push(desc);
116
+ }
117
+ lines.push('');
118
+ }
119
+ // Properties
120
+ if (cls.properties.length > 0) {
121
+ lines.push('## Properties');
122
+ for (const p of cls.properties) {
123
+ lines.push(formatProperty(p));
124
+ }
125
+ lines.push('');
126
+ }
127
+ // Methods
128
+ if (cls.methods.length > 0) {
129
+ lines.push('## Methods');
130
+ for (const m of cls.methods) {
131
+ lines.push(formatMethod(m));
132
+ }
133
+ lines.push('');
134
+ }
135
+ // Signals
136
+ if (cls.signals.length > 0) {
137
+ lines.push('## Signals');
138
+ for (const s of cls.signals) {
139
+ lines.push(formatSignal(s));
140
+ }
141
+ lines.push('');
142
+ }
143
+ // Constants (group by enum if possible)
144
+ if (cls.constants.length > 0) {
145
+ lines.push('## Constants');
146
+ for (const c of cls.constants) {
147
+ lines.push(formatConstant(c));
148
+ }
149
+ lines.push('');
150
+ }
151
+ return lines.join('\n').trim();
152
+ }
153
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/docs/format.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,IAAI;QACT,gCAAgC;SAC/B,OAAO,CAAC,0BAA0B,EAAE,MAAM,CAAC;QAC5C,uDAAuD;SACtD,OAAO,CAAC,yCAAyC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvE,CAAC,CAAC;QACF,0BAA0B;SACzB,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,0BAA0B;SACzB,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,2BAA2B;SAC1B,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,4BAA4B;SAC3B,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC;QACvC,8BAA8B;SAC7B,OAAO,CAAC,qBAAqB,EAAE,QAAQ,CAAC;QACzC,mCAAmC;SAClC,OAAO,CAAC,qBAAqB,EAAE,aAAa,CAAC;QAC9C,8BAA8B;SAC7B,OAAO,CAAC,0BAA0B,EAAE,MAAM,CAAC;QAC5C,mCAAmC;SAClC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;QACjC,4BAA4B;SAC3B,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC;QACtC,oBAAoB;SACnB,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC;SAC7C,OAAO,CAAC,kCAAkC,EAAE,IAAI,CAAC;SACjD,OAA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AC;QAChC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { GodotClass } from './types.js';
2
+ /**
3
+ * Singleton documentation index
4
+ * Lazily initialized on first access
5
+ */
6
+ declare class DocsIndex {
7
+ private classes;
8
+ private initialized;
9
+ private initializing;
10
+ private versionKey;
11
+ /**
12
+ * Ensure the index is initialized
13
+ * Safe to call multiple times - will only initialize once
14
+ */
15
+ ensureInitialized(): Promise<void>;
16
+ private initialize;
17
+ /**
18
+ * Get all class names
19
+ */
20
+ getAllClassNames(): string[];
21
+ /**
22
+ * Get a specific class by name
23
+ */
24
+ getClass(name: string): GodotClass | undefined;
25
+ /**
26
+ * Get all classes
27
+ */
28
+ getAllClasses(): GodotClass[];
29
+ /**
30
+ * Check if initialized
31
+ */
32
+ isInitialized(): boolean;
33
+ /**
34
+ * Get the version key
35
+ */
36
+ getVersionKey(): string | null;
37
+ /**
38
+ * Get class count
39
+ */
40
+ getClassCount(): number;
41
+ }
42
+ export declare const docsIndex: DocsIndex;
43
+ export {};
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAK7C;;;GAGG;AACH,cAAM,SAAS;IACb,OAAO,CAAC,OAAO,CAAsC;IACrD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,UAAU,CAAuB;IAEzC;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;YAc1B,UAAU;IAqCxB;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI9C;;OAEG;IACH,aAAa,IAAI,UAAU,EAAE;IAI7B;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,aAAa,IAAI,MAAM;CAGxB;AAGD,eAAO,MAAM,SAAS,WAAkB,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { fetchDocs, listCachedDocs } from './fetcher.js';
2
+ import { getGodotVersion, versionToCacheKey } from './version.js';
3
+ import { parseClassXml } from './parser.js';
4
+ /**
5
+ * Singleton documentation index
6
+ * Lazily initialized on first access
7
+ */
8
+ class DocsIndex {
9
+ classes = new Map();
10
+ initialized = false;
11
+ initializing = null;
12
+ versionKey = null;
13
+ /**
14
+ * Ensure the index is initialized
15
+ * Safe to call multiple times - will only initialize once
16
+ */
17
+ async ensureInitialized() {
18
+ if (this.initialized) {
19
+ return;
20
+ }
21
+ // If already initializing, wait for it
22
+ if (this.initializing) {
23
+ return this.initializing;
24
+ }
25
+ this.initializing = this.initialize();
26
+ await this.initializing;
27
+ }
28
+ async initialize() {
29
+ try {
30
+ console.log('Initializing Godot documentation index...');
31
+ // Detect version and get cache key
32
+ const version = getGodotVersion();
33
+ this.versionKey = versionToCacheKey(version);
34
+ console.log(`Godot version: ${version.full} (cache key: ${this.versionKey})`);
35
+ // Fetch docs if needed
36
+ const cacheDir = await fetchDocs(this.versionKey);
37
+ // Parse all XML files
38
+ const xmlFiles = listCachedDocs(cacheDir);
39
+ console.log(`Parsing ${xmlFiles.length} documentation files...`);
40
+ let parsed = 0;
41
+ let failed = 0;
42
+ for (const xmlPath of xmlFiles) {
43
+ const godotClass = parseClassXml(xmlPath);
44
+ if (godotClass) {
45
+ this.classes.set(godotClass.name, godotClass);
46
+ parsed++;
47
+ }
48
+ else {
49
+ failed++;
50
+ }
51
+ }
52
+ console.log(`Parsed ${parsed} classes (${failed} failed)`);
53
+ this.initialized = true;
54
+ }
55
+ catch (error) {
56
+ console.error('Failed to initialize documentation index:', error);
57
+ throw error;
58
+ }
59
+ }
60
+ /**
61
+ * Get all class names
62
+ */
63
+ getAllClassNames() {
64
+ return Array.from(this.classes.keys()).sort();
65
+ }
66
+ /**
67
+ * Get a specific class by name
68
+ */
69
+ getClass(name) {
70
+ return this.classes.get(name);
71
+ }
72
+ /**
73
+ * Get all classes
74
+ */
75
+ getAllClasses() {
76
+ return Array.from(this.classes.values());
77
+ }
78
+ /**
79
+ * Check if initialized
80
+ */
81
+ isInitialized() {
82
+ return this.initialized;
83
+ }
84
+ /**
85
+ * Get the version key
86
+ */
87
+ getVersionKey() {
88
+ return this.versionKey;
89
+ }
90
+ /**
91
+ * Get class count
92
+ */
93
+ getClassCount() {
94
+ return this.classes.size;
95
+ }
96
+ }
97
+ // Export singleton instance
98
+ export const docsIndex = new DocsIndex();
99
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,MAAM,SAAS;IACL,OAAO,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC7C,WAAW,GAAG,KAAK,CAAC;IACpB,YAAY,GAAyB,IAAI,CAAC;IAC1C,UAAU,GAAkB,IAAI,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,iBAAiB;QACrB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;QACT,CAAC;QAED,uCAAuC;QACvC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;QAED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AC,2CAA2C,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { GodotClass } from './types.js';
2
+ /**
3
+ * Parse a single Godot XML documentation file
4
+ */
5
+ export declare function parseClassXml(xmlPath: string): GodotClass | null;
6
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/docs/parser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EAOX,MAAM,YAAY,CAAC;AAapB;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA2BhE"}