@venizia/ignis-docs 0.0.1-4 → 0.0.1-6
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/mcp-server/dist/common/config.d.ts +58 -21
- package/mcp-server/dist/common/config.d.ts.map +1 -1
- package/mcp-server/dist/common/config.js +67 -12
- package/mcp-server/dist/common/config.js.map +1 -1
- package/mcp-server/dist/helpers/docs.helper.d.ts +5 -5
- package/mcp-server/dist/helpers/docs.helper.d.ts.map +1 -1
- package/mcp-server/dist/helpers/docs.helper.js +31 -27
- package/mcp-server/dist/helpers/docs.helper.js.map +1 -1
- package/mcp-server/dist/helpers/github.helper.d.ts +37 -0
- package/mcp-server/dist/helpers/github.helper.d.ts.map +1 -0
- package/mcp-server/dist/helpers/github.helper.js +100 -0
- package/mcp-server/dist/helpers/github.helper.js.map +1 -0
- package/mcp-server/dist/helpers/index.d.ts +1 -0
- package/mcp-server/dist/helpers/index.d.ts.map +1 -1
- package/mcp-server/dist/helpers/index.js +1 -0
- package/mcp-server/dist/helpers/index.js.map +1 -1
- package/mcp-server/dist/index.js +60 -32
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/tools/base.tool.d.ts +6 -10
- package/mcp-server/dist/tools/base.tool.d.ts.map +1 -1
- package/mcp-server/dist/tools/base.tool.js +3 -5
- package/mcp-server/dist/tools/base.tool.js.map +1 -1
- package/mcp-server/dist/tools/{get-doc-content.tool.d.ts → docs/get-document-content.tool.d.ts} +4 -4
- package/mcp-server/dist/tools/docs/get-document-content.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{get-doc-content.tool.js → docs/get-document-content.tool.js} +12 -11
- package/mcp-server/dist/tools/docs/get-document-content.tool.js.map +1 -0
- package/mcp-server/dist/tools/{get-doc-metadata.tool.d.ts → docs/get-document-metadata.tool.d.ts} +4 -4
- package/mcp-server/dist/tools/docs/get-document-metadata.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{get-doc-metadata.tool.js → docs/get-document-metadata.tool.js} +11 -10
- package/mcp-server/dist/tools/docs/get-document-metadata.tool.js.map +1 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.d.ts +50 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.js +221 -0
- package/mcp-server/dist/tools/docs/get-package-overview.tool.js.map +1 -0
- package/mcp-server/dist/tools/docs/index.d.ts +7 -0
- package/mcp-server/dist/tools/docs/index.d.ts.map +1 -0
- package/mcp-server/dist/tools/docs/index.js +23 -0
- package/mcp-server/dist/tools/docs/index.js.map +1 -0
- package/mcp-server/dist/tools/{list-categories.tool.d.ts → docs/list-categories.tool.d.ts} +2 -2
- package/mcp-server/dist/tools/docs/list-categories.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{list-categories.tool.js → docs/list-categories.tool.js} +7 -6
- package/mcp-server/dist/tools/docs/list-categories.tool.js.map +1 -0
- package/mcp-server/dist/tools/{list-docs.tool.d.ts → docs/list-documents.tool.d.ts} +4 -4
- package/mcp-server/dist/tools/docs/list-documents.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{list-docs.tool.js → docs/list-documents.tool.js} +10 -9
- package/mcp-server/dist/tools/docs/list-documents.tool.js.map +1 -0
- package/mcp-server/dist/tools/{search-docs.tool.d.ts → docs/search-documents.tool.d.ts} +4 -4
- package/mcp-server/dist/tools/docs/search-documents.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/{search-docs.tool.js → docs/search-documents.tool.js} +19 -18
- package/mcp-server/dist/tools/docs/search-documents.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/index.d.ts +5 -0
- package/mcp-server/dist/tools/github/index.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/index.js +21 -0
- package/mcp-server/dist/tools/github/index.js.map +1 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.d.ts +28 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.js +98 -0
- package/mcp-server/dist/tools/github/list-project-files.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/search-code.tool.d.ts +42 -0
- package/mcp-server/dist/tools/github/search-code.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/search-code.tool.js +194 -0
- package/mcp-server/dist/tools/github/search-code.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.d.ts +55 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.js +167 -0
- package/mcp-server/dist/tools/github/verify-dependencies.tool.js.map +1 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.d.ts +26 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.d.ts.map +1 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.js +91 -0
- package/mcp-server/dist/tools/github/view-source-file.tool.js.map +1 -0
- package/mcp-server/dist/tools/index.d.ts +3 -7
- package/mcp-server/dist/tools/index.d.ts.map +1 -1
- package/mcp-server/dist/tools/index.js +17 -13
- package/mcp-server/dist/tools/index.js.map +1 -1
- package/package.json +25 -6
- package/wiki/get-started/best-practices/api-usage-examples.md +42 -0
- package/wiki/get-started/best-practices/architectural-patterns.md +42 -1
- package/wiki/get-started/best-practices/code-style-standards.md +41 -0
- package/wiki/get-started/best-practices/contribution-workflow.md +40 -6
- package/wiki/get-started/best-practices/data-modeling.md +126 -0
- package/wiki/get-started/core-concepts/dependency-injection.md +13 -1
- package/wiki/get-started/mcp-docs-server.md +130 -32
- package/wiki/get-started/philosophy.md +198 -25
- package/wiki/public/logo.svg +1 -0
- package/wiki/references/base/application.md +5 -5
- package/wiki/references/base/controllers.md +3 -1
- package/wiki/references/base/dependency-injection.md +6 -5
- package/wiki/references/base/models.md +319 -1
- package/wiki/references/components/index.md +3 -1
- package/wiki/references/components/static-asset.md +1289 -0
- package/wiki/references/helpers/inversion.md +21 -11
- package/wiki/references/helpers/storage.md +538 -11
- package/wiki/references/src-details/core.md +15 -1
- package/wiki/references/src-details/docs.md +19 -9
- package/wiki/references/src-details/mcp-server.md +185 -234
- package/wiki/references/utilities/index.md +1 -1
- package/wiki/references/utilities/request.md +150 -0
- package/mcp-server/dist/tools/get-doc-content.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/get-doc-content.tool.js.map +0 -1
- package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/get-doc-metadata.tool.js.map +0 -1
- package/mcp-server/dist/tools/list-categories.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/list-categories.tool.js.map +0 -1
- package/mcp-server/dist/tools/list-docs.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/list-docs.tool.js.map +0 -1
- package/mcp-server/dist/tools/search-docs.tool.d.ts.map +0 -1
- package/mcp-server/dist/tools/search-docs.tool.js.map +0 -1
|
@@ -1,27 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Centralized configuration for the Ignis MCP Documentation Server.
|
|
3
|
+
* All tool constants and settings are defined here for easy maintenance.
|
|
4
|
+
*/
|
|
5
|
+
export declare class MCPConfigs {
|
|
6
|
+
static readonly server: {
|
|
3
7
|
readonly name: "ignis-docs";
|
|
4
8
|
readonly version: "0.0.1";
|
|
5
9
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/** Runtime-configurable branch (set via CLI argument) */
|
|
11
|
+
private static _branch;
|
|
12
|
+
static readonly github: {
|
|
13
|
+
apiBase: string;
|
|
14
|
+
rawContentBase: string;
|
|
15
|
+
repoOwner: string;
|
|
16
|
+
repoPath: string;
|
|
17
|
+
repoName: string;
|
|
18
|
+
userAgent: string;
|
|
19
|
+
/** Get current branch (configurable at runtime) */
|
|
20
|
+
readonly branch: string;
|
|
11
21
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Set the GitHub branch to use for fetching source code.
|
|
24
|
+
* Call this before starting the server.
|
|
25
|
+
* @param branch - Branch name (e.g., 'main', 'develop', 'feature/xyz')
|
|
26
|
+
*/
|
|
27
|
+
static setBranch(opts: {
|
|
28
|
+
branch: string;
|
|
29
|
+
}): void;
|
|
30
|
+
static readonly search: {
|
|
31
|
+
/** Maximum characters for content snippet in search results */
|
|
32
|
+
snippetLength: number;
|
|
33
|
+
/** Default number of results to return */
|
|
34
|
+
defaultLimit: number;
|
|
35
|
+
/** Maximum allowed results per search */
|
|
36
|
+
maxLimit: number;
|
|
37
|
+
/** Minimum query length required */
|
|
38
|
+
minQueryLength: number;
|
|
25
39
|
};
|
|
26
|
-
|
|
40
|
+
static readonly codeSearch: {
|
|
41
|
+
/** Default number of results to return */
|
|
42
|
+
defaultLimit: number;
|
|
43
|
+
/** Maximum allowed results per search (GitHub API limit) */
|
|
44
|
+
maxLimit: number;
|
|
45
|
+
/** Minimum query length required */
|
|
46
|
+
minQueryLength: number;
|
|
47
|
+
/** Rate limit warning threshold */
|
|
48
|
+
rateLimitWarningThreshold: number;
|
|
49
|
+
};
|
|
50
|
+
static readonly fuse: {
|
|
51
|
+
includeScore: boolean;
|
|
52
|
+
/** Lower threshold = stricter matching (0.0 = exact, 1.0 = match anything) */
|
|
53
|
+
threshold: number;
|
|
54
|
+
minMatchCharLength: number;
|
|
55
|
+
findAllMatches: boolean;
|
|
56
|
+
ignoreLocation: boolean;
|
|
57
|
+
/** Search field weights: title matches are prioritized over content */
|
|
58
|
+
keys: {
|
|
59
|
+
name: string;
|
|
60
|
+
weight: number;
|
|
61
|
+
}[];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
27
64
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../common/config.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../common/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,UAAU;IAIrB,MAAM,CAAC,QAAQ,CAAC,MAAM;;;MAAqD;IAM3E,yDAAyD;IACzD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAkB;IAExC,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;QAQpB,mDAAmD;yBACrC,MAAM;MAGpB;IAEF;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAOzC,MAAM,CAAC,QAAQ,CAAC,MAAM;QACpB,+DAA+D;;QAE/D,0CAA0C;;QAE1C,yCAAyC;;QAEzC,oCAAoC;;MAEpC;IAKF,MAAM,CAAC,QAAQ,CAAC,UAAU;QACxB,0CAA0C;;QAE1C,4DAA4D;;QAE5D,oCAAoC;;QAEpC,mCAAmC;;MAEnC;IAKF,MAAM,CAAC,QAAQ,CAAC,IAAI;;QAElB,8EAA8E;;;;;QAK9E,uEAAuE;;;;;MAKvE;CACH"}
|
|
@@ -1,27 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
exports.MCPConfigs = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Centralized configuration for the Ignis MCP Documentation Server.
|
|
6
|
+
* All tool constants and settings are defined here for easy maintenance.
|
|
7
|
+
*/
|
|
8
|
+
class MCPConfigs {
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
// SERVER CONFIGURATION
|
|
11
|
+
// ----------------------------------------------------------------------------
|
|
12
|
+
static { this.server = { name: 'ignis-docs', version: '0.0.1' }; }
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
// GITHUB CONFIGURATION
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
/** Runtime-configurable branch (set via CLI argument) */
|
|
17
|
+
static { this._branch = 'main'; }
|
|
18
|
+
static { this.github = {
|
|
19
|
+
apiBase: 'https://api.github.com',
|
|
20
|
+
rawContentBase: 'https://raw.githubusercontent.com',
|
|
21
|
+
repoOwner: 'VENIZIA-AI',
|
|
22
|
+
repoPath: 'repos',
|
|
23
|
+
repoName: 'ignis',
|
|
24
|
+
userAgent: 'Ignis-MCP-Server',
|
|
25
|
+
/** Get current branch (configurable at runtime) */
|
|
26
|
+
get branch() {
|
|
27
|
+
return MCPConfigs._branch;
|
|
28
|
+
},
|
|
29
|
+
}; }
|
|
30
|
+
/**
|
|
31
|
+
* Set the GitHub branch to use for fetching source code.
|
|
32
|
+
* Call this before starting the server.
|
|
33
|
+
* @param branch - Branch name (e.g., 'main', 'develop', 'feature/xyz')
|
|
34
|
+
*/
|
|
35
|
+
static setBranch(opts) {
|
|
36
|
+
MCPConfigs._branch = opts.branch;
|
|
37
|
+
}
|
|
38
|
+
// ----------------------------------------------------------------------------
|
|
39
|
+
// DOCUMENTATION SEARCH CONFIGURATION
|
|
40
|
+
// ----------------------------------------------------------------------------
|
|
41
|
+
static { this.search = {
|
|
42
|
+
/** Maximum characters for content snippet in search results */
|
|
43
|
+
snippetLength: 320,
|
|
44
|
+
/** Default number of results to return */
|
|
11
45
|
defaultLimit: 10,
|
|
46
|
+
/** Maximum allowed results per search */
|
|
12
47
|
maxLimit: 50,
|
|
48
|
+
/** Minimum query length required */
|
|
13
49
|
minQueryLength: 2,
|
|
14
|
-
}
|
|
15
|
-
|
|
50
|
+
}; }
|
|
51
|
+
// ----------------------------------------------------------------------------
|
|
52
|
+
// CODE SEARCH CONFIGURATION
|
|
53
|
+
// ----------------------------------------------------------------------------
|
|
54
|
+
static { this.codeSearch = {
|
|
55
|
+
/** Default number of results to return */
|
|
56
|
+
defaultLimit: 10,
|
|
57
|
+
/** Maximum allowed results per search (GitHub API limit) */
|
|
58
|
+
maxLimit: 30,
|
|
59
|
+
/** Minimum query length required */
|
|
60
|
+
minQueryLength: 2,
|
|
61
|
+
/** Rate limit warning threshold */
|
|
62
|
+
rateLimitWarningThreshold: 5,
|
|
63
|
+
}; }
|
|
64
|
+
// ----------------------------------------------------------------------------
|
|
65
|
+
// FUSE.JS SEARCH ENGINE CONFIGURATION
|
|
66
|
+
// ----------------------------------------------------------------------------
|
|
67
|
+
static { this.fuse = {
|
|
16
68
|
includeScore: true,
|
|
69
|
+
/** Lower threshold = stricter matching (0.0 = exact, 1.0 = match anything) */
|
|
17
70
|
threshold: 0.4,
|
|
18
71
|
minMatchCharLength: 2,
|
|
19
72
|
findAllMatches: true,
|
|
20
73
|
ignoreLocation: true,
|
|
74
|
+
/** Search field weights: title matches are prioritized over content */
|
|
21
75
|
keys: [
|
|
22
76
|
{ name: 'title', weight: 0.7 },
|
|
23
77
|
{ name: 'content', weight: 0.3 },
|
|
24
78
|
],
|
|
25
|
-
}
|
|
26
|
-
}
|
|
79
|
+
}; }
|
|
80
|
+
}
|
|
81
|
+
exports.MCPConfigs = MCPConfigs;
|
|
27
82
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../common/config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../common/config.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,UAAU;IACrB,+EAA+E;IAC/E,uBAAuB;IACvB,+EAA+E;aAC/D,WAAM,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAW,CAAC;IAE3E,+EAA+E;IAC/E,uBAAuB;IACvB,+EAA+E;I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AAM,EAAE,GAAG,EAAE;SACjC;KACF,CAAC;;AA/EJ,gCAgFC"}
|
|
@@ -15,7 +15,7 @@ export declare class DocsHelper {
|
|
|
15
15
|
/**
|
|
16
16
|
* Loads and caches documentation from the wiki.
|
|
17
17
|
*/
|
|
18
|
-
static
|
|
18
|
+
static load(): Promise<IDoc[]>;
|
|
19
19
|
/**
|
|
20
20
|
* Clears the documentation cache.
|
|
21
21
|
*/
|
|
@@ -27,7 +27,7 @@ export declare class DocsHelper {
|
|
|
27
27
|
/**
|
|
28
28
|
* Searches the loaded documentation.
|
|
29
29
|
*/
|
|
30
|
-
static
|
|
30
|
+
static searchDocuments(opts: ISearchOptions): Promise<{
|
|
31
31
|
id: string;
|
|
32
32
|
title: string;
|
|
33
33
|
category: string;
|
|
@@ -37,13 +37,13 @@ export declare class DocsHelper {
|
|
|
37
37
|
/**
|
|
38
38
|
* Gets the full content of a specific document.
|
|
39
39
|
*/
|
|
40
|
-
static
|
|
40
|
+
static getDocumentContent(opts: {
|
|
41
41
|
id: string;
|
|
42
42
|
}): Promise<string | null>;
|
|
43
43
|
/**
|
|
44
44
|
* Lists all available documentation files.
|
|
45
45
|
*/
|
|
46
|
-
static
|
|
46
|
+
static listDocumentFiles(opts: {
|
|
47
47
|
category?: string;
|
|
48
48
|
}): Promise<{
|
|
49
49
|
id: string;
|
|
@@ -57,7 +57,7 @@ export declare class DocsHelper {
|
|
|
57
57
|
/**
|
|
58
58
|
* Gets metadata about a specific document.
|
|
59
59
|
*/
|
|
60
|
-
static
|
|
60
|
+
static getDocumentMetadata(opts: {
|
|
61
61
|
id: string;
|
|
62
62
|
}): Promise<{
|
|
63
63
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.helper.d.ts","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":"AAQA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EA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"}
|
|
@@ -11,13 +11,14 @@ const promises_1 = __importDefault(require("node:fs/promises"));
|
|
|
11
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
12
|
const common_1 = require("../common");
|
|
13
13
|
const logger_helper_1 = require("./logger.helper");
|
|
14
|
+
// --------------------------------------------------------------------------------------------------
|
|
14
15
|
class DocsHelper {
|
|
15
16
|
static { this._docs = []; }
|
|
16
17
|
static { this._fuse = null; }
|
|
17
18
|
/**
|
|
18
19
|
* Loads and caches documentation from the wiki.
|
|
19
20
|
*/
|
|
20
|
-
static async
|
|
21
|
+
static async load() {
|
|
21
22
|
if (this._docs.length > 0) {
|
|
22
23
|
return this._docs;
|
|
23
24
|
}
|
|
@@ -31,21 +32,23 @@ class DocsHelper {
|
|
|
31
32
|
logger_helper_1.Logger.warn(`No documentation files found in ${common_1.Paths.WIKI}`);
|
|
32
33
|
return [];
|
|
33
34
|
}
|
|
34
|
-
this._docs = await Promise.all(files.map(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
this._docs = await Promise.all(files.map(file => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
promises_1.default.readFile(file, 'utf-8')
|
|
38
|
+
.then(rawContent => {
|
|
39
|
+
const { data, content } = (0, gray_matter_1.default)(rawContent);
|
|
40
|
+
resolve({
|
|
41
|
+
id: node_path_1.default.relative(common_1.Paths.WIKI, file),
|
|
42
|
+
title: data.title || node_path_1.default.basename(file, '.md'),
|
|
43
|
+
content,
|
|
44
|
+
category: data.category || 'Uncategorized',
|
|
45
|
+
filePath: file,
|
|
46
|
+
});
|
|
47
|
+
})
|
|
48
|
+
.catch(reject);
|
|
49
|
+
});
|
|
44
50
|
}));
|
|
45
|
-
this._fuse = new fuse_js_1.default(this._docs, {
|
|
46
|
-
...common_1.MCP_CONFIG.fuse,
|
|
47
|
-
keys: common_1.MCP_CONFIG.fuse.keys,
|
|
48
|
-
});
|
|
51
|
+
this._fuse = new fuse_js_1.default(this._docs, { ...common_1.MCPConfigs.fuse, keys: common_1.MCPConfigs.fuse.keys });
|
|
49
52
|
logger_helper_1.Logger.info(`Loaded ${this._docs.length} documentation files`);
|
|
50
53
|
return this._docs;
|
|
51
54
|
}
|
|
@@ -65,7 +68,8 @@ class DocsHelper {
|
|
|
65
68
|
/**
|
|
66
69
|
* Generates a smart snippet from content.
|
|
67
70
|
*/
|
|
68
|
-
static generateSnippet(
|
|
71
|
+
static generateSnippet(opts) {
|
|
72
|
+
const { content, maxLength = common_1.MCPConfigs.search.snippetLength } = opts;
|
|
69
73
|
if (content.length <= maxLength) {
|
|
70
74
|
return content;
|
|
71
75
|
}
|
|
@@ -76,29 +80,29 @@ class DocsHelper {
|
|
|
76
80
|
/**
|
|
77
81
|
* Searches the loaded documentation.
|
|
78
82
|
*/
|
|
79
|
-
static async
|
|
83
|
+
static async searchDocuments(opts) {
|
|
80
84
|
if (!this._fuse) {
|
|
81
|
-
await this.
|
|
85
|
+
await this.load();
|
|
82
86
|
}
|
|
83
87
|
if (!this._fuse) {
|
|
84
88
|
return [];
|
|
85
89
|
}
|
|
86
|
-
const limit = opts.limit ?? common_1.
|
|
90
|
+
const limit = opts.limit ?? common_1.MCPConfigs.search.defaultLimit;
|
|
87
91
|
const results = this._fuse.search(opts.query).slice(0, limit);
|
|
88
92
|
return results.map(result => ({
|
|
89
93
|
id: result.item.id,
|
|
90
94
|
title: result.item.title,
|
|
91
95
|
category: result.item.category,
|
|
92
|
-
snippet: this.generateSnippet(result.item.content),
|
|
96
|
+
snippet: this.generateSnippet({ content: result.item.content }),
|
|
93
97
|
score: result.score,
|
|
94
98
|
}));
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
101
|
* Gets the full content of a specific document.
|
|
98
102
|
*/
|
|
99
|
-
static async
|
|
103
|
+
static async getDocumentContent(opts) {
|
|
100
104
|
if (this._docs.length === 0) {
|
|
101
|
-
await this.
|
|
105
|
+
await this.load();
|
|
102
106
|
}
|
|
103
107
|
const doc = this._docs.find(d => d.id === opts.id);
|
|
104
108
|
if (doc) {
|
|
@@ -109,9 +113,9 @@ class DocsHelper {
|
|
|
109
113
|
/**
|
|
110
114
|
* Lists all available documentation files.
|
|
111
115
|
*/
|
|
112
|
-
static async
|
|
116
|
+
static async listDocumentFiles(opts) {
|
|
113
117
|
if (this._docs.length === 0) {
|
|
114
|
-
await this.
|
|
118
|
+
await this.load();
|
|
115
119
|
}
|
|
116
120
|
const filteredDocs = opts.category
|
|
117
121
|
? this._docs.filter(d => d.category === opts.category)
|
|
@@ -127,7 +131,7 @@ class DocsHelper {
|
|
|
127
131
|
*/
|
|
128
132
|
static async listCategories() {
|
|
129
133
|
if (this._docs.length === 0) {
|
|
130
|
-
await this.
|
|
134
|
+
await this.load();
|
|
131
135
|
}
|
|
132
136
|
const categories = new Set(this._docs.map(d => d.category));
|
|
133
137
|
return Array.from(categories).sort();
|
|
@@ -135,9 +139,9 @@ class DocsHelper {
|
|
|
135
139
|
/**
|
|
136
140
|
* Gets metadata about a specific document.
|
|
137
141
|
*/
|
|
138
|
-
static async
|
|
142
|
+
static async getDocumentMetadata(opts) {
|
|
139
143
|
if (this._docs.length === 0) {
|
|
140
|
-
await this.
|
|
144
|
+
await this.load();
|
|
141
145
|
}
|
|
142
146
|
const doc = this._docs.find(d => d.id === opts.id);
|
|
143
147
|
if (!doc) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.helper.js","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA2B;AAC3B,sDAA2B;AAC3B,8DAAiC;AACjC,gEAAkC;AAClC,0DAA6B;AAC7B,sCAA8C;AAC9C,mDAAyC;AAezC,MAAa,UAAU;aACN,UAAK,GAAW,EAAE,CAAC;aACnB,UAAK,GAAsB,IAAI,CAAC;IAE/C;;OAEG;IACH,MAAM,CAAC,KAAK,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9D,OAAO;gBACL,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM;gBAC1D,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;;AAzLH,gCA0LC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface IGithubError {
|
|
2
|
+
error: string;
|
|
3
|
+
status: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IGithubFile {
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
type: 'file' | 'dir';
|
|
9
|
+
size: number;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IGithubContent {
|
|
13
|
+
content: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A helper class for interacting with the VENIZIA-AI/ignis GitHub repository.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GithubHelper {
|
|
19
|
+
private static getApiUrl;
|
|
20
|
+
/**
|
|
21
|
+
* Fetches the contents of a directory from the GitHub repository.
|
|
22
|
+
* @param opts.path - The path to the directory from the repository root.
|
|
23
|
+
* @returns A promise that resolves to the directory content or an error object.
|
|
24
|
+
*/
|
|
25
|
+
static getDirectoryContents(opts?: {
|
|
26
|
+
path?: string;
|
|
27
|
+
}): Promise<IGithubFile[] | IGithubError>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetches the content of a specific file from the GitHub repository.
|
|
30
|
+
* @param opts.filePath - The path to the file from the repository root.
|
|
31
|
+
* @returns A promise that resolves to the file content or an error object.
|
|
32
|
+
*/
|
|
33
|
+
static getFileContent(opts: {
|
|
34
|
+
filePath: string;
|
|
35
|
+
}): Promise<IGithubContent | IGithubError>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=github.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.helper.d.ts","sourceRoot":"","sources":["../../helpers/github.helper.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,SAAS;IAKxB;;;;OAIG;WACU,oBAAoB,CAC/B,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAC3B,OAAO,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC;IA8CxC;;;;OAIG;WACU,cAAc,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,GAAG,YAAY,CAAC;CA8BhG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GithubHelper = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const logger_helper_1 = require("./logger.helper");
|
|
6
|
+
// --------------------------------------------------------------------------------------------------
|
|
7
|
+
// Helper function to create a standardized error response
|
|
8
|
+
const getError = (opts) => ({
|
|
9
|
+
error: opts.message,
|
|
10
|
+
status: opts.status || 500,
|
|
11
|
+
});
|
|
12
|
+
// --------------------------------------------------------------------------------------------------
|
|
13
|
+
/**
|
|
14
|
+
* A helper class for interacting with the VENIZIA-AI/ignis GitHub repository.
|
|
15
|
+
*/
|
|
16
|
+
class GithubHelper {
|
|
17
|
+
static getApiUrl(opts) {
|
|
18
|
+
const { apiBase, repoOwner, repoName } = common_1.MCPConfigs.github;
|
|
19
|
+
return [apiBase, common_1.MCPConfigs.github.repoPath, repoOwner, repoName, opts.path].join('/');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetches the contents of a directory from the GitHub repository.
|
|
23
|
+
* @param opts.path - The path to the directory from the repository root.
|
|
24
|
+
* @returns A promise that resolves to the directory content or an error object.
|
|
25
|
+
*/
|
|
26
|
+
static async getDirectoryContents(opts = {}) {
|
|
27
|
+
const dirPath = opts.path ?? '';
|
|
28
|
+
const { branch, userAgent } = common_1.MCPConfigs.github;
|
|
29
|
+
const url = this.getApiUrl({ path: `contents/${dirPath}?ref=${branch}` });
|
|
30
|
+
logger_helper_1.Logger.debug(`Fetching directory from GitHub: ${url}`);
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch(url, {
|
|
33
|
+
headers: {
|
|
34
|
+
'User-Agent': userAgent,
|
|
35
|
+
Accept: 'application/vnd.github.v3+json',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
logger_helper_1.Logger.error(`GitHub API error for path "${dirPath}": ${response.statusText}`);
|
|
40
|
+
return getError({ message: response.statusText, status: response.status });
|
|
41
|
+
}
|
|
42
|
+
const data = (await response.json());
|
|
43
|
+
if (!Array.isArray(data)) {
|
|
44
|
+
if (data.message) {
|
|
45
|
+
logger_helper_1.Logger.error(`GitHub API error for path "${dirPath}": ${data.message}`);
|
|
46
|
+
return getError({ message: data.message, status: 404 });
|
|
47
|
+
}
|
|
48
|
+
return getError({ message: 'Invalid response from GitHub API', status: 500 });
|
|
49
|
+
}
|
|
50
|
+
return data.map(item => ({
|
|
51
|
+
name: item.name,
|
|
52
|
+
path: item.path,
|
|
53
|
+
type: item.type, // 'file' or 'dir'
|
|
54
|
+
size: item.size,
|
|
55
|
+
url: item.html_url,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger_helper_1.Logger.error(`Failed to fetch directory "${dirPath}" from GitHub:`, error);
|
|
60
|
+
return getError({
|
|
61
|
+
message: `Failed to fetch directory content. ${error instanceof Error ? error.message : ''}`,
|
|
62
|
+
status: 500,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fetches the content of a specific file from the GitHub repository.
|
|
68
|
+
* @param opts.filePath - The path to the file from the repository root.
|
|
69
|
+
* @returns A promise that resolves to the file content or an error object.
|
|
70
|
+
*/
|
|
71
|
+
static async getFileContent(opts) {
|
|
72
|
+
const { rawContentBase, repoOwner, repoName, branch } = common_1.MCPConfigs.github;
|
|
73
|
+
// We use the raw content URL for files to avoid API rate limits and base64 decoding.
|
|
74
|
+
const url = [rawContentBase, repoOwner, repoName, branch, opts.filePath].join('/');
|
|
75
|
+
logger_helper_1.Logger.debug(`Fetching file content from GitHub: ${url}`);
|
|
76
|
+
try {
|
|
77
|
+
const response = await fetch(url);
|
|
78
|
+
const content = await response.text();
|
|
79
|
+
// Check if the fetch was successful. GitHub returns a "404: Not Found" string for missing files
|
|
80
|
+
// when using raw.githubusercontent.com, OR returns 404 status.
|
|
81
|
+
if (response.status === 404 || (typeof content === 'string' && content.startsWith('404'))) {
|
|
82
|
+
logger_helper_1.Logger.warn(`File not found on GitHub: ${opts.filePath}`);
|
|
83
|
+
return getError({ message: 'File not found', status: 404 });
|
|
84
|
+
}
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
return getError({ message: response.statusText, status: response.status });
|
|
87
|
+
}
|
|
88
|
+
return { content };
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
logger_helper_1.Logger.error(`Failed to fetch file "${opts.filePath}" from GitHub:`, error);
|
|
92
|
+
return getError({
|
|
93
|
+
message: `Failed to fetch file content. ${error instanceof Error ? error.message : ''}`,
|
|
94
|
+
status: 500,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.GithubHelper = GithubHelper;
|
|
100
|
+
//# sourceMappingURL=github.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.helper.js","sourceRoot":"","sources":["../../helpers/github.helper.ts"],"names":[],"mappings":";;;AAAA,sCAAuC;AACvC,mDAAyC;AAwBzC,qGAAqG;AACrG,0DAA0D;AAC1D,MAAM,QAAQ,GAAG,CAAC,IAA0C,EAAgB,EAAE,CAAC,CAAC;IAC9E,KAAK,EAAE,IAAI,CAAC,OAAO;IACnB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,GAAG;CAC3B,CAAC,CAAC;AAEH,qGAAqG;AACrG;;GAEG;AACH,MAAa,YAAY;IACf,MAAM,CAAC,SAAS,CAAC,IAAsB;QAC7C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,mBAAU,CAAC,MAAM,CAAC;QAC3D,OAAO,CAAC,OAAO,EAAE,mBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAC/B,OAA0B,EAAE;QAE5B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAChC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAU,CAAC,MAAM,CAAC;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,OAAO,QAAQ,MAAM,EAAE,EAAE,CAAC,CAAC;QAC1E,sBAAM,CAAC,KAAK,CAAC,mCAAmC,GAAG,EAAE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Q,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7E,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,sBAAM,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,QAAQ,gBAAgB,EAAE,KAAK,CAAC,CAAC;YAC5E,OAAO,QAAQ,CAAC;gBACd,OAAO,EAAE,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACvF,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA9FD,oCA8FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./docs.helper"), exports);
|
|
18
18
|
__exportStar(require("./logger.helper"), exports);
|
|
19
|
+
__exportStar(require("./github.helper"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,kDAAgC"}
|