@venizia/ignis-docs 0.0.1-3 → 0.0.1-5
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/README.md +408 -2
- 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 +69 -14
- package/mcp-server/dist/common/config.js.map +1 -1
- package/mcp-server/dist/common/index.d.ts +2 -2
- package/mcp-server/dist/common/paths.js +11 -11
- 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 +38 -34
- 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 +3 -2
- 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 +64 -36
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/tools/base.tool.d.ts +8 -12
- 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} +5 -5
- 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} +14 -13
- 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} +5 -5
- 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} +18 -17
- 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} +3 -3
- 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} +10 -9
- 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} +5 -5
- 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} +15 -14
- 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} +5 -5
- 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} +24 -23
- 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 +27 -8
- 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/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/helpers/inversion.md +21 -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/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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchCodeTool = void 0;
|
|
4
|
+
const common_1 = require("@/mcp-server/common");
|
|
5
|
+
const tools_1 = require("@mastra/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const base_tool_1 = require("../base.tool");
|
|
8
|
+
const helpers_1 = require("@/mcp-server/helpers");
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
// DESCRIPTIONS
|
|
11
|
+
// ----------------------------------------------------------------------------
|
|
12
|
+
const TOOL_DESCRIPTION = `
|
|
13
|
+
Searches for code patterns, function names, class definitions, and keywords across the Ignis source code.
|
|
14
|
+
|
|
15
|
+
PURPOSE:
|
|
16
|
+
Find specific code implementations, locate where functions/classes are defined, and discover
|
|
17
|
+
code patterns throughout the repository. Essential for understanding how features are implemented.
|
|
18
|
+
|
|
19
|
+
WHEN TO USE:
|
|
20
|
+
- To find where a specific function or class is defined
|
|
21
|
+
- To locate usages of a particular API or pattern
|
|
22
|
+
- To find configuration files or specific code constructs
|
|
23
|
+
- When you know WHAT you're looking for but not WHERE it is
|
|
24
|
+
- To answer questions like "where is X implemented?" or "how is Y used?"
|
|
25
|
+
|
|
26
|
+
WHEN NOT TO USE:
|
|
27
|
+
- For general project structure exploration (use listProjectFiles instead)
|
|
28
|
+
- For documentation content (use searchDocs instead)
|
|
29
|
+
- When you already know the file path (use viewSourceFile instead)
|
|
30
|
+
|
|
31
|
+
SEARCH TIPS:
|
|
32
|
+
- Use specific terms: "createApplication" instead of "create"
|
|
33
|
+
- Include file extension for targeted results: "extension:ts HttpServer"
|
|
34
|
+
- Search for class/function names: "class DependencyContainer"
|
|
35
|
+
- Combine terms: "inject decorator"
|
|
36
|
+
|
|
37
|
+
OUTPUT:
|
|
38
|
+
Returns matching files with code snippets showing the match context.
|
|
39
|
+
Use viewSourceFile to read the complete file content.
|
|
40
|
+
`;
|
|
41
|
+
const QUERY_DESCRIPTION = `
|
|
42
|
+
Search query to find in the codebase.
|
|
43
|
+
|
|
44
|
+
QUERY SYNTAX:
|
|
45
|
+
- Simple keyword: "HttpServer" - finds files containing HttpServer
|
|
46
|
+
- Multiple terms: "inject service" - files containing both terms
|
|
47
|
+
- Exact phrase: "\\"dependency injection\\"" - exact phrase match
|
|
48
|
+
- File extension: "extension:ts middleware" - only TypeScript files
|
|
49
|
+
- Path filter: "path:packages/core createTool" - search in specific path
|
|
50
|
+
|
|
51
|
+
EXAMPLES:
|
|
52
|
+
- "class Application" - find Application class definition
|
|
53
|
+
- "export function create" - find exported create functions
|
|
54
|
+
- "extension:ts @Injectable" - find Injectable decorators in TS files
|
|
55
|
+
- "path:packages/helpers redis" - find redis usage in helpers package
|
|
56
|
+
- "BaseController extends" - find classes extending BaseController
|
|
57
|
+
|
|
58
|
+
TIPS:
|
|
59
|
+
- Be specific to reduce noise
|
|
60
|
+
- Use class/function names when known
|
|
61
|
+
- Combine with path: or extension: for targeted results
|
|
62
|
+
`;
|
|
63
|
+
const LIMIT_DESCRIPTION = `
|
|
64
|
+
Maximum number of results to return (1-${common_1.MCPConfigs.codeSearch.maxLimit}, default: ${common_1.MCPConfigs.codeSearch.defaultLimit}).
|
|
65
|
+
|
|
66
|
+
RECOMMENDATIONS:
|
|
67
|
+
- Use 5-10 for specific searches (function names, class definitions)
|
|
68
|
+
- Use 15-20 for broader pattern searches
|
|
69
|
+
- Use ${common_1.MCPConfigs.codeSearch.maxLimit} when exploring all usages of a common term
|
|
70
|
+
`;
|
|
71
|
+
// ----------------------------------------------------------------------------
|
|
72
|
+
// SCHEMAS
|
|
73
|
+
// ----------------------------------------------------------------------------
|
|
74
|
+
const SearchResultSchema = zod_1.z.object({
|
|
75
|
+
filePath: zod_1.z.string().describe('Full file path from repository root. Use with viewSourceFile.'),
|
|
76
|
+
fileName: zod_1.z.string().describe('File name for quick reference.'),
|
|
77
|
+
matchSnippet: zod_1.z
|
|
78
|
+
.string()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe('Code snippet showing the match context (if available).'),
|
|
81
|
+
url: zod_1.z.string().optional().describe('GitHub URL to view the file online.'),
|
|
82
|
+
});
|
|
83
|
+
const InputSchema = zod_1.z.object({
|
|
84
|
+
query: zod_1.z.string().min(common_1.MCPConfigs.codeSearch.minQueryLength).describe(QUERY_DESCRIPTION),
|
|
85
|
+
limit: zod_1.z
|
|
86
|
+
.number()
|
|
87
|
+
.int()
|
|
88
|
+
.min(1)
|
|
89
|
+
.max(common_1.MCPConfigs.codeSearch.maxLimit)
|
|
90
|
+
.default(common_1.MCPConfigs.codeSearch.defaultLimit)
|
|
91
|
+
.describe(LIMIT_DESCRIPTION),
|
|
92
|
+
});
|
|
93
|
+
const OutputSchema = zod_1.z.object({
|
|
94
|
+
query: zod_1.z.string().describe('The search query that was executed.'),
|
|
95
|
+
totalCount: zod_1.z.number().int().describe('Total number of matches found.'),
|
|
96
|
+
results: zod_1.z.array(SearchResultSchema).describe('Search results with file paths and snippets.'),
|
|
97
|
+
error: zod_1.z.string().optional().describe('Error message if search failed.'),
|
|
98
|
+
rateLimitWarning: zod_1.z
|
|
99
|
+
.string()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Warning if approaching GitHub API rate limits.'),
|
|
102
|
+
});
|
|
103
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
104
|
+
// ----------------------------------------------------------------------------
|
|
105
|
+
// TOOL CLASS
|
|
106
|
+
// ----------------------------------------------------------------------------
|
|
107
|
+
class SearchCodeTool extends base_tool_1.BaseTool {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(...arguments);
|
|
110
|
+
this.id = 'searchCode';
|
|
111
|
+
this.description = TOOL_DESCRIPTION;
|
|
112
|
+
this.inputSchema = InputSchema;
|
|
113
|
+
this.outputSchema = OutputSchema;
|
|
114
|
+
}
|
|
115
|
+
async execute(opts) {
|
|
116
|
+
const { query, limit } = opts;
|
|
117
|
+
const { apiBase, repoOwner, repoName, userAgent } = common_1.MCPConfigs.github;
|
|
118
|
+
// Build GitHub code search query
|
|
119
|
+
const searchQuery = `${query} repo:${repoOwner}/${repoName}`;
|
|
120
|
+
const url = `${apiBase}/search/code?q=${encodeURIComponent(searchQuery)}&per_page=${limit}`;
|
|
121
|
+
helpers_1.Logger.debug(`Searching code on GitHub: ${url}`);
|
|
122
|
+
try {
|
|
123
|
+
const response = await fetch(url, {
|
|
124
|
+
headers: {
|
|
125
|
+
'User-Agent': userAgent,
|
|
126
|
+
Accept: 'application/vnd.github.text-match+json', // Include text match fragments
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
// Check rate limit headers
|
|
130
|
+
const rateLimitRemaining = response.headers.get('X-RateLimit-Remaining');
|
|
131
|
+
const rateLimitWarning = rateLimitRemaining &&
|
|
132
|
+
parseInt(rateLimitRemaining) < common_1.MCPConfigs.codeSearch.rateLimitWarningThreshold
|
|
133
|
+
? `GitHub API rate limit low: ${rateLimitRemaining} requests remaining. Consider waiting before more searches.`
|
|
134
|
+
: undefined;
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
const errorData = (await response.json().catch(() => ({})));
|
|
137
|
+
helpers_1.Logger.error(`GitHub code search failed: ${response.statusText}`);
|
|
138
|
+
if (response.status === 403) {
|
|
139
|
+
return {
|
|
140
|
+
query,
|
|
141
|
+
totalCount: 0,
|
|
142
|
+
results: [],
|
|
143
|
+
error: 'GitHub API rate limit exceeded. Please wait a moment before searching again. Unauthenticated requests are limited to 10 per minute.',
|
|
144
|
+
rateLimitWarning,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
query,
|
|
149
|
+
totalCount: 0,
|
|
150
|
+
results: [],
|
|
151
|
+
error: errorData.message || `GitHub API error: ${response.statusText}`,
|
|
152
|
+
rateLimitWarning,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const data = (await response.json());
|
|
156
|
+
const results = data.items.map(item => {
|
|
157
|
+
// Extract the best text match snippet
|
|
158
|
+
const matchSnippet = item.text_matches?.[0]?.fragment;
|
|
159
|
+
return {
|
|
160
|
+
filePath: item.path,
|
|
161
|
+
fileName: item.name,
|
|
162
|
+
matchSnippet,
|
|
163
|
+
url: item.html_url,
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
return {
|
|
167
|
+
query,
|
|
168
|
+
totalCount: data.total_count,
|
|
169
|
+
results,
|
|
170
|
+
rateLimitWarning,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
helpers_1.Logger.error('Failed to search code on GitHub:', error);
|
|
175
|
+
return {
|
|
176
|
+
query,
|
|
177
|
+
totalCount: 0,
|
|
178
|
+
results: [],
|
|
179
|
+
error: `Search failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
getTool() {
|
|
184
|
+
return (0, tools_1.createTool)({
|
|
185
|
+
id: this.id,
|
|
186
|
+
description: this.description,
|
|
187
|
+
inputSchema: this.inputSchema,
|
|
188
|
+
outputSchema: this.outputSchema,
|
|
189
|
+
execute: async ({ context }) => this.execute(context),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.SearchCodeTool = SearchCodeTool;
|
|
194
|
+
//# sourceMappingURL=search-code.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-code.tool.js","sourceRoot":"","sources":["../../../tools/github/search-code.tool.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AACjD,8CAAgD;AAChD,6BAAwB;AACxB,4CAAqD;AACrD,kDAA8C;AAE9C,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBzB,CAAC;AAEF,MAAM,iBAAiB,GAAG;yCACe,mBAAU,CAAC,UAAU,CAAC,QAAQ,cAAc,mBAAU,CAAC,UAAU,CAAC,YAAY;;;;;QAK/G,mBAAU,CAAC,UAAU,CAAC,QAAQ;CACrC,CAAC;AAEF,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;IAC9F,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAC/D,YAAY,EAAE,OAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;IACrE,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CAC3E,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,mBAAU,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,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AO,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;CACF;AAhGD,wCAgGC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, TMastraTool } from '../base.tool';
|
|
3
|
+
declare const InputSchema: z.ZodObject<{
|
|
4
|
+
packagePath: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
declare const OutputSchema: z.ZodObject<{
|
|
7
|
+
packageName: z.ZodOptional<z.ZodString>;
|
|
8
|
+
dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
currentVersion: z.ZodString;
|
|
11
|
+
latestVersion: z.ZodString;
|
|
12
|
+
isOutdated: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>>>;
|
|
14
|
+
devDependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
currentVersion: z.ZodString;
|
|
17
|
+
latestVersion: z.ZodString;
|
|
18
|
+
isOutdated: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
error: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare class VerifyDependenciesTool extends BaseTool<typeof InputSchema, typeof OutputSchema> {
|
|
23
|
+
readonly id = "verifyDependencies";
|
|
24
|
+
readonly description = "\nVerifies dependencies of a package within the Ignis monorepo against NPM registry.\n\nPURPOSE:\nCheck for outdated dependencies. Reads package.json from a specific package,\nfetches latest version for each dependency from NPM registry, and reports\nwhich packages may need updating.\n\nWHEN TO USE:\n- To assess maintenance status of a package\n- To identify potential security risks from outdated dependencies\n- Before starting development, to see what needs updating\n- To answer user questions about package dependencies\n\nWHEN NOT TO USE:\n- This tool can be slow as it makes multiple network requests to NPM\n- For workspace dependencies (e.g., \"workspace:*\") - these are internal references\n\nNOTE: Version comparison is simplified (string comparison). Complex version ranges\nor intentionally pinned versions may show as \"outdated\" even when correct.\n";
|
|
25
|
+
readonly inputSchema: z.ZodObject<{
|
|
26
|
+
packagePath: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
readonly outputSchema: z.ZodObject<{
|
|
29
|
+
packageName: z.ZodOptional<z.ZodString>;
|
|
30
|
+
dependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
currentVersion: z.ZodString;
|
|
33
|
+
latestVersion: z.ZodString;
|
|
34
|
+
isOutdated: z.ZodBoolean;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
devDependencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
currentVersion: z.ZodString;
|
|
39
|
+
latestVersion: z.ZodString;
|
|
40
|
+
isOutdated: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>>>;
|
|
42
|
+
error: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
private getLatestVersion;
|
|
45
|
+
/**
|
|
46
|
+
* Extracts a clean semver version from various version specifiers.
|
|
47
|
+
* Returns null for non-standard versions that can't be compared.
|
|
48
|
+
*/
|
|
49
|
+
private parseVersion;
|
|
50
|
+
private processDependencies;
|
|
51
|
+
execute(opts: z.infer<typeof InputSchema>): Promise<z.infer<typeof OutputSchema>>;
|
|
52
|
+
getTool(): TMastraTool;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=verify-dependencies.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-dependencies.tool.d.ts","sourceRoot":"","sources":["../../../tools/github/verify-dependencies.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAkDrD,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;iBAKhB,CAAC;AAWH,qBAAa,sBAAuB,SAAQ,QAAQ,CAAC,OAAO,WAAW,EAAE,OAAO,YAAY,CAAC;IAC3F,QAAQ,CAAC,EAAE,wBAAwB;IACnC,QAAQ,CAAC,WAAW,02BAAoB;IACxC,QAAQ,CAAC,WAAW;;sBAAe;IACnC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;;;sBAAgB;YAEvB,gBAAgB;IAe9B;;;OAGG;IACH,OAAO,CAAC,YAAY;YAsBN,mBAAmB;IA+B3B,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;IA0BvF,OAAO,IAAI,WAAW;CASvB"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VerifyDependenciesTool = void 0;
|
|
4
|
+
const tools_1 = require("@mastra/core/tools");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const base_tool_1 = require("../base.tool");
|
|
7
|
+
const helpers_1 = require("@/mcp-server/helpers");
|
|
8
|
+
// ----------------------------------------------------------------------------
|
|
9
|
+
// DESCRIPTIONS
|
|
10
|
+
// ----------------------------------------------------------------------------
|
|
11
|
+
const TOOL_DESCRIPTION = `
|
|
12
|
+
Verifies dependencies of a package within the Ignis monorepo against NPM registry.
|
|
13
|
+
|
|
14
|
+
PURPOSE:
|
|
15
|
+
Check for outdated dependencies. Reads package.json from a specific package,
|
|
16
|
+
fetches latest version for each dependency from NPM registry, and reports
|
|
17
|
+
which packages may need updating.
|
|
18
|
+
|
|
19
|
+
WHEN TO USE:
|
|
20
|
+
- To assess maintenance status of a package
|
|
21
|
+
- To identify potential security risks from outdated dependencies
|
|
22
|
+
- Before starting development, to see what needs updating
|
|
23
|
+
- To answer user questions about package dependencies
|
|
24
|
+
|
|
25
|
+
WHEN NOT TO USE:
|
|
26
|
+
- This tool can be slow as it makes multiple network requests to NPM
|
|
27
|
+
- For workspace dependencies (e.g., "workspace:*") - these are internal references
|
|
28
|
+
|
|
29
|
+
NOTE: Version comparison is simplified (string comparison). Complex version ranges
|
|
30
|
+
or intentionally pinned versions may show as "outdated" even when correct.
|
|
31
|
+
`;
|
|
32
|
+
const PACKAGE_PATH_DESCRIPTION = `
|
|
33
|
+
The path to the package directory from the repository root.
|
|
34
|
+
This directory must contain a 'package.json' file.
|
|
35
|
+
|
|
36
|
+
EXAMPLES:
|
|
37
|
+
- "packages/core"
|
|
38
|
+
- "packages/helpers"
|
|
39
|
+
- "examples/5-mins-qs"
|
|
40
|
+
`;
|
|
41
|
+
// ----------------------------------------------------------------------------
|
|
42
|
+
// SCHEMAS
|
|
43
|
+
// ----------------------------------------------------------------------------
|
|
44
|
+
const DependencyInfoSchema = zod_1.z.object({
|
|
45
|
+
name: zod_1.z.string(),
|
|
46
|
+
currentVersion: zod_1.z.string(),
|
|
47
|
+
latestVersion: zod_1.z.string(),
|
|
48
|
+
isOutdated: zod_1.z.boolean(),
|
|
49
|
+
});
|
|
50
|
+
const InputSchema = zod_1.z.object({
|
|
51
|
+
packagePath: zod_1.z.string().describe(PACKAGE_PATH_DESCRIPTION),
|
|
52
|
+
});
|
|
53
|
+
const OutputSchema = zod_1.z.object({
|
|
54
|
+
packageName: zod_1.z.string().optional(),
|
|
55
|
+
dependencies: zod_1.z.array(DependencyInfoSchema).optional(),
|
|
56
|
+
devDependencies: zod_1.z.array(DependencyInfoSchema).optional(),
|
|
57
|
+
error: zod_1.z.string().optional(),
|
|
58
|
+
});
|
|
59
|
+
// ----------------------------------------------------------------------------
|
|
60
|
+
// TOOL CLASS
|
|
61
|
+
// ----------------------------------------------------------------------------
|
|
62
|
+
class VerifyDependenciesTool extends base_tool_1.BaseTool {
|
|
63
|
+
constructor() {
|
|
64
|
+
super(...arguments);
|
|
65
|
+
this.id = 'verifyDependencies';
|
|
66
|
+
this.description = TOOL_DESCRIPTION;
|
|
67
|
+
this.inputSchema = InputSchema;
|
|
68
|
+
this.outputSchema = OutputSchema;
|
|
69
|
+
}
|
|
70
|
+
async getLatestVersion(opts) {
|
|
71
|
+
try {
|
|
72
|
+
const url = `https://registry.npmjs.org/${opts.packageName}/latest`;
|
|
73
|
+
const response = await fetch(url);
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
return 'unknown';
|
|
76
|
+
}
|
|
77
|
+
const data = (await response.json());
|
|
78
|
+
return data.version || 'unknown';
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
helpers_1.Logger.warn(`Could not fetch latest version for ${opts.packageName}:`, error);
|
|
82
|
+
return 'unknown';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extracts a clean semver version from various version specifiers.
|
|
87
|
+
* Returns null for non-standard versions that can't be compared.
|
|
88
|
+
*/
|
|
89
|
+
parseVersion(opts) {
|
|
90
|
+
// Skip workspace, file, git, and URL references
|
|
91
|
+
if (opts.version.startsWith('workspace:') ||
|
|
92
|
+
opts.version.startsWith('file:') ||
|
|
93
|
+
opts.version.startsWith('git') ||
|
|
94
|
+
opts.version.startsWith('http') ||
|
|
95
|
+
opts.version === '*' ||
|
|
96
|
+
opts.version === 'latest') {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
// Remove common prefixes: ^, ~, >=, >, <=, <, =
|
|
100
|
+
const cleaned = opts.version.replace(/^[\^~>=<]+/, '').trim();
|
|
101
|
+
// Handle version ranges (e.g., "1.0.0 || 2.0.0", ">=1.0.0 <2.0.0")
|
|
102
|
+
// Just take the first version-like string
|
|
103
|
+
const semverMatch = cleaned.match(/(\d+\.\d+\.\d+(?:-[\w.]+)?)/);
|
|
104
|
+
return semverMatch ? semverMatch[1] : null;
|
|
105
|
+
}
|
|
106
|
+
async processDependencies(opts) {
|
|
107
|
+
if (!opts.deps) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
const results = [];
|
|
111
|
+
for (const [name, version] of Object.entries(opts.deps)) {
|
|
112
|
+
const parsedVersion = this.parseVersion({ version });
|
|
113
|
+
// Skip non-standard versions
|
|
114
|
+
if (!parsedVersion) {
|
|
115
|
+
results.push({
|
|
116
|
+
name,
|
|
117
|
+
currentVersion: version,
|
|
118
|
+
latestVersion: 'N/A',
|
|
119
|
+
isOutdated: false,
|
|
120
|
+
});
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const latestVersion = await this.getLatestVersion({ packageName: name });
|
|
124
|
+
results.push({
|
|
125
|
+
name,
|
|
126
|
+
currentVersion: parsedVersion,
|
|
127
|
+
latestVersion,
|
|
128
|
+
isOutdated: latestVersion !== 'unknown' && parsedVersion !== latestVersion,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return results;
|
|
132
|
+
}
|
|
133
|
+
async execute(opts) {
|
|
134
|
+
const packageJsonPath = `${opts.packagePath}/package.json`;
|
|
135
|
+
const result = await helpers_1.GithubHelper.getFileContent({ filePath: packageJsonPath });
|
|
136
|
+
if ('error' in result) {
|
|
137
|
+
return { error: `Could not read package.json at ${packageJsonPath}. Error: ${result.error}` };
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const packageJson = JSON.parse(result.content);
|
|
141
|
+
const [dependencies, devDependencies] = await Promise.all([
|
|
142
|
+
this.processDependencies({ deps: packageJson.dependencies }),
|
|
143
|
+
this.processDependencies({ deps: packageJson.devDependencies }),
|
|
144
|
+
]);
|
|
145
|
+
return {
|
|
146
|
+
packageName: packageJson.name,
|
|
147
|
+
dependencies,
|
|
148
|
+
devDependencies,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
helpers_1.Logger.error('[execute] Failed to execute | Error: ', error);
|
|
153
|
+
return { error: `Failed to parse package.json at ${packageJsonPath}.` };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
getTool() {
|
|
157
|
+
return (0, tools_1.createTool)({
|
|
158
|
+
id: this.id,
|
|
159
|
+
description: this.description,
|
|
160
|
+
inputSchema: this.inputSchema,
|
|
161
|
+
outputSchema: this.outputSchema,
|
|
162
|
+
execute: async ({ context }) => this.execute(context),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.VerifyDependenciesTool = VerifyDependenciesTool;
|
|
167
|
+
//# sourceMappingURL=verify-dependencies.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-dependencies.tool.js","sourceRoot":"","sources":["../../../tools/github/verify-dependencies.tool.ts"],"names":[],"mappings":";;;AAAA,8CAAgD;AAChD,6BAAwB;AACxB,4CAAqD;AACrD,kDAA4D;AAE5D,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC;AAEF,MAAM,wBAAwB,GAAG;;;;;;;;CAQhC,CAAC;AAEF,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE;CACxB,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5B,WAAW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,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;CACF;AAjHD,wDAiHC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, TMastraTool } from '../base.tool';
|
|
3
|
+
declare const InputSchema: z.ZodObject<{
|
|
4
|
+
filePath: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
declare const OutputSchema: z.ZodObject<{
|
|
7
|
+
filePath: z.ZodString;
|
|
8
|
+
content: z.ZodOptional<z.ZodString>;
|
|
9
|
+
error: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare class ViewSourceFileTool extends BaseTool<typeof InputSchema, typeof OutputSchema> {
|
|
12
|
+
readonly id = "viewSourceFile";
|
|
13
|
+
readonly description = "\nRetrieves the full source code content of a specific file from the Ignis GitHub repository.\n\nPURPOSE:\nRead contents of a source file. Primary method for inspecting implementation details,\nunderstanding logic, and viewing exact code.\n\nWHEN TO USE:\n- After finding a relevant file with listProjectFiles or searchCode\n- When you need to see implementation of a specific class, function, or component\n- To verify details not present in documentation\n- To extract specific code examples or snippets\n\nWHEN NOT TO USE:\n- For discovering files (use listProjectFiles to browse, or searchCode to find by keyword)\n- Do not use on non-text files (images, binaries) or very large files unless necessary\n- For documentation content (use getDocContent instead)\n";
|
|
14
|
+
readonly inputSchema: z.ZodObject<{
|
|
15
|
+
filePath: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
readonly outputSchema: z.ZodObject<{
|
|
18
|
+
filePath: z.ZodString;
|
|
19
|
+
content: z.ZodOptional<z.ZodString>;
|
|
20
|
+
error: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
execute(opts: z.infer<typeof InputSchema>): Promise<z.infer<typeof OutputSchema>>;
|
|
23
|
+
getTool(): TMastraTool;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=view-source-file.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-source-file.tool.d.ts","sourceRoot":"","sources":["../../../tools/github/view-source-file.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA2CrD,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;iBAOhB,CAAC;AAMH,qBAAa,kBAAmB,SAAQ,QAAQ,CAAC,OAAO,WAAW,EAAE,OAAO,YAAY,CAAC;IACvF,QAAQ,CAAC,EAAE,oBAAoB;IAC/B,QAAQ,CAAC,WAAW,kwBAAoB;IACxC,QAAQ,CAAC,WAAW;;sBAAe;IACnC,QAAQ,CAAC,YAAY;;;;sBAAgB;IAE/B,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;IAgBvF,OAAO,IAAI,WAAW;CASvB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewSourceFileTool = void 0;
|
|
4
|
+
const helpers_1 = require("@/mcp-server/helpers");
|
|
5
|
+
const tools_1 = require("@mastra/core/tools");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const base_tool_1 = require("../base.tool");
|
|
8
|
+
// ----------------------------------------------------------------------------
|
|
9
|
+
// DESCRIPTIONS
|
|
10
|
+
// ----------------------------------------------------------------------------
|
|
11
|
+
const TOOL_DESCRIPTION = `
|
|
12
|
+
Retrieves the full source code content of a specific file from the Ignis GitHub repository.
|
|
13
|
+
|
|
14
|
+
PURPOSE:
|
|
15
|
+
Read contents of a source file. Primary method for inspecting implementation details,
|
|
16
|
+
understanding logic, and viewing exact code.
|
|
17
|
+
|
|
18
|
+
WHEN TO USE:
|
|
19
|
+
- After finding a relevant file with listProjectFiles or searchCode
|
|
20
|
+
- When you need to see implementation of a specific class, function, or component
|
|
21
|
+
- To verify details not present in documentation
|
|
22
|
+
- To extract specific code examples or snippets
|
|
23
|
+
|
|
24
|
+
WHEN NOT TO USE:
|
|
25
|
+
- For discovering files (use listProjectFiles to browse, or searchCode to find by keyword)
|
|
26
|
+
- Do not use on non-text files (images, binaries) or very large files unless necessary
|
|
27
|
+
- For documentation content (use getDocContent instead)
|
|
28
|
+
`;
|
|
29
|
+
const FILE_PATH_DESCRIPTION = `
|
|
30
|
+
The full path to the file from the root of the repository.
|
|
31
|
+
|
|
32
|
+
HOW TO OBTAIN:
|
|
33
|
+
- Use listProjectFiles to browse the project and find valid file paths
|
|
34
|
+
- Use searchCode to find files containing specific keywords or patterns
|
|
35
|
+
- Navigate from root directory down to the specific file
|
|
36
|
+
|
|
37
|
+
EXAMPLES:
|
|
38
|
+
- "packages/core/src/application.ts"
|
|
39
|
+
- "examples/5-mins-qs/src/index.ts"
|
|
40
|
+
- "package.json"
|
|
41
|
+
`;
|
|
42
|
+
// ----------------------------------------------------------------------------
|
|
43
|
+
// SCHEMAS
|
|
44
|
+
// ----------------------------------------------------------------------------
|
|
45
|
+
const InputSchema = zod_1.z.object({
|
|
46
|
+
filePath: zod_1.z.string().min(1).describe(FILE_PATH_DESCRIPTION),
|
|
47
|
+
});
|
|
48
|
+
const OutputSchema = zod_1.z.object({
|
|
49
|
+
filePath: zod_1.z.string(),
|
|
50
|
+
content: zod_1.z.string().optional().describe('The full source code content of the file.'),
|
|
51
|
+
error: zod_1.z
|
|
52
|
+
.string()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('An error message if the file could not be read (e.g., not found).'),
|
|
55
|
+
});
|
|
56
|
+
// ----------------------------------------------------------------------------
|
|
57
|
+
// TOOL CLASS
|
|
58
|
+
// ----------------------------------------------------------------------------
|
|
59
|
+
class ViewSourceFileTool extends base_tool_1.BaseTool {
|
|
60
|
+
constructor() {
|
|
61
|
+
super(...arguments);
|
|
62
|
+
this.id = 'viewSourceFile';
|
|
63
|
+
this.description = TOOL_DESCRIPTION;
|
|
64
|
+
this.inputSchema = InputSchema;
|
|
65
|
+
this.outputSchema = OutputSchema;
|
|
66
|
+
}
|
|
67
|
+
async execute(opts) {
|
|
68
|
+
const result = await helpers_1.GithubHelper.getFileContent({ filePath: opts.filePath });
|
|
69
|
+
if ('error' in result) {
|
|
70
|
+
return {
|
|
71
|
+
filePath: opts.filePath,
|
|
72
|
+
error: result.error,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
filePath: opts.filePath,
|
|
77
|
+
content: result.content,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
getTool() {
|
|
81
|
+
return (0, tools_1.createTool)({
|
|
82
|
+
id: this.id,
|
|
83
|
+
description: this.description,
|
|
84
|
+
inputSchema: this.inputSchema,
|
|
85
|
+
outputSchema: this.outputSchema,
|
|
86
|
+
execute: async ({ context }) => this.execute(context),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.ViewSourceFileTool = ViewSourceFileTool;
|
|
91
|
+
//# sourceMappingURL=view-source-file.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-source-file.tool.js","sourceRoot":"","sources":["../../../tools/github/view-source-file.tool.ts"],"names":[],"mappings":";;;AAAA,kDAAoD;AACpD,8CAAgD;AAChD,6BAAwB;AACxB,4CAA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,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,IAAA,kBAAU,EAAC;YAChB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;CACF;AA/BD,gDA+BC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { GetDocContentTool } from "./get-doc-content.tool";
|
|
5
|
-
export { GetDocMetadataTool } from "./get-doc-metadata.tool";
|
|
6
|
-
export { ListDocsTool } from "./list-docs.tool";
|
|
7
|
-
export { ListCategoriesTool } from "./list-categories.tool";
|
|
1
|
+
export * from './base.tool';
|
|
2
|
+
export * from './docs';
|
|
3
|
+
export * from './github';
|
|
8
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListCategoriesTool = exports.ListDocsTool = exports.GetDocMetadataTool = exports.GetDocContentTool = exports.SearchDocsTool = exports.BaseTool = void 0;
|
|
4
17
|
// Base class
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, "BaseTool", { enumerable: true, get: function () { return base_tool_1.BaseTool; } });
|
|
18
|
+
__exportStar(require("./base.tool"), exports);
|
|
7
19
|
// Tool classes
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var get_doc_content_tool_1 = require("./get-doc-content.tool");
|
|
11
|
-
Object.defineProperty(exports, "GetDocContentTool", { enumerable: true, get: function () { return get_doc_content_tool_1.GetDocContentTool; } });
|
|
12
|
-
var get_doc_metadata_tool_1 = require("./get-doc-metadata.tool");
|
|
13
|
-
Object.defineProperty(exports, "GetDocMetadataTool", { enumerable: true, get: function () { return get_doc_metadata_tool_1.GetDocMetadataTool; } });
|
|
14
|
-
var list_docs_tool_1 = require("./list-docs.tool");
|
|
15
|
-
Object.defineProperty(exports, "ListDocsTool", { enumerable: true, get: function () { return list_docs_tool_1.ListDocsTool; } });
|
|
16
|
-
var list_categories_tool_1 = require("./list-categories.tool");
|
|
17
|
-
Object.defineProperty(exports, "ListCategoriesTool", { enumerable: true, get: function () { return list_categories_tool_1.ListCategoriesTool; } });
|
|
20
|
+
__exportStar(require("./docs"), exports);
|
|
21
|
+
__exportStar(require("./github"), exports);
|
|
18
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,aAAa;AACb,8CAA4B;AAE5B,eAAe;AACf,yCAAuB;AACvB,2CAAyB"}
|