@o3r/mcp 13.3.0-prerelease.1 → 13.3.0-prerelease.10
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/package.json +9 -9
- package/src/best-practices/index.d.ts +8 -0
- package/src/best-practices/index.d.ts.map +1 -0
- package/src/best-practices/index.js +52 -0
- package/src/best-practices/index.js.map +1 -0
- package/src/mcp-server.d.ts.map +1 -1
- package/src/mcp-server.js +11 -6
- package/src/mcp-server.js.map +1 -1
- package/src/release-notes/index.d.ts +7 -0
- package/src/release-notes/index.d.ts.map +1 -0
- package/src/release-notes/index.js +84 -0
- package/src/release-notes/index.js.map +1 -0
- package/src/tools/find-repositories-using-otter.d.ts.map +1 -1
- package/src/tools/find-repositories-using-otter.js +62 -29
- package/src/tools/find-repositories-using-otter.js.map +1 -1
- package/src/tools/supported-releases.d.ts +7 -0
- package/src/tools/supported-releases.d.ts.map +1 -0
- package/src/tools/supported-releases.js +46 -0
- package/src/tools/supported-releases.js.map +1 -0
- package/src/utils/otter.d.ts +17 -0
- package/src/utils/otter.d.ts.map +1 -0
- package/src/utils/otter.js +25 -0
- package/src/utils/otter.js.map +1 -0
- package/src/utils/resource-registry.d.ts +7 -0
- package/src/utils/resource-registry.d.ts.map +1 -0
- package/src/utils/resource-registry.js +10 -0
- package/src/utils/resource-registry.js.map +1 -0
- package/src/instructions/best-practices.d.ts +0 -8
- package/src/instructions/best-practices.d.ts.map +0 -1
- package/src/instructions/best-practices.js +0 -24
- package/src/instructions/best-practices.js.map +0 -1
- package/src/tools/best-practices.d.ts +0 -8
- package/src/tools/best-practices.d.ts.map +0 -1
- package/src/tools/best-practices.js +0 -27
- package/src/tools/best-practices.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/mcp",
|
|
3
|
-
"version": "13.3.0-prerelease.
|
|
3
|
+
"version": "13.3.0-prerelease.10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"@nx/eslint-plugin": "~21.6.0",
|
|
40
40
|
"@nx/jest": "~21.6.0",
|
|
41
41
|
"@nx/js": "~21.6.0",
|
|
42
|
-
"@o3r/build-helpers": "^13.3.0-prerelease.
|
|
43
|
-
"@o3r/eslint-config": "^13.3.0-prerelease.
|
|
44
|
-
"@o3r/eslint-plugin": "^13.3.0-prerelease.
|
|
45
|
-
"@o3r/test-helpers": "^13.3.0-prerelease.
|
|
46
|
-
"@stylistic/eslint-plugin": "~5.
|
|
42
|
+
"@o3r/build-helpers": "^13.3.0-prerelease.10",
|
|
43
|
+
"@o3r/eslint-config": "^13.3.0-prerelease.10",
|
|
44
|
+
"@o3r/eslint-plugin": "^13.3.0-prerelease.10",
|
|
45
|
+
"@o3r/test-helpers": "^13.3.0-prerelease.10",
|
|
46
|
+
"@stylistic/eslint-plugin": "~5.4.0",
|
|
47
47
|
"@types/jest": "~29.5.2",
|
|
48
48
|
"@types/node": "~22.18.0",
|
|
49
|
-
"@typescript-eslint/parser": "~8.
|
|
49
|
+
"@typescript-eslint/parser": "~8.46.0",
|
|
50
50
|
"angular-eslint": "~20.3.0",
|
|
51
51
|
"cpy-cli": "^6.0.0",
|
|
52
|
-
"eslint": "~9.
|
|
52
|
+
"eslint": "~9.37.0",
|
|
53
53
|
"eslint-import-resolver-node": "~0.3.9",
|
|
54
54
|
"eslint-import-resolver-typescript": "~4.4.0",
|
|
55
55
|
"eslint-plugin-import": "~2.32.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"ts-node": "~10.9.2",
|
|
73
73
|
"type-fest": "^4.30.1",
|
|
74
74
|
"typescript": "~5.9.2",
|
|
75
|
-
"typescript-eslint": "~8.
|
|
75
|
+
"typescript-eslint": "~8.46.0",
|
|
76
76
|
"zone.js": "~0.15.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/**
|
|
3
|
+
* Register the best practices tool and resources.
|
|
4
|
+
* @param server
|
|
5
|
+
* @param resourcesPath
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerBestPracticesToolAndResources(server: McpServer, resourcesPath: string): Promise<[PromiseSettledResult<void>, PromiseSettledResult<void>]>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/best-practices/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,SAAS,EACV,MAAM,yCAAyC,CAAC;AA6DjD;;;;GAIG;AACH,wBAAgB,qCAAqC,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qEAM7F"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerBestPracticesToolAndResources = registerBestPracticesToolAndResources;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const otter_1 = require("../utils/otter");
|
|
7
|
+
const resource_registry_1 = require("../utils/resource-registry");
|
|
8
|
+
const uri = `${otter_1.uriPrefix}best-practices`;
|
|
9
|
+
async function registerBestPracticesResources(server, bestPracticesResourcesPath) {
|
|
10
|
+
const content = await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'output.md'), { encoding: 'utf8' });
|
|
11
|
+
resource_registry_1.resourceRegistry.set(uri, content);
|
|
12
|
+
server.registerResource('Best Practices Guide', uri, {
|
|
13
|
+
title: 'Otter Best Practices and Code Generation Guide',
|
|
14
|
+
description: await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'description.md'), { encoding: 'utf8' }),
|
|
15
|
+
mimeType: 'text/markdown'
|
|
16
|
+
}, () => ({ contents: [{ uri, text: content }] }));
|
|
17
|
+
}
|
|
18
|
+
async function registerBestPracticesTool(server, bestPracticesResourcesPath) {
|
|
19
|
+
server.registerTool('get_best_practices', {
|
|
20
|
+
title: 'Get Otter Coding Best Practices Guide',
|
|
21
|
+
description: await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'description.md'), { encoding: 'utf8' }),
|
|
22
|
+
annotations: {
|
|
23
|
+
readOnlyHint: true,
|
|
24
|
+
openWorldHint: false
|
|
25
|
+
}
|
|
26
|
+
}, () => ({
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: resource_registry_1.resourceRegistry.get(uri) || 'Not found'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'resource_link',
|
|
34
|
+
name: 'Best practices',
|
|
35
|
+
uri
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Register the best practices tool and resources.
|
|
42
|
+
* @param server
|
|
43
|
+
* @param resourcesPath
|
|
44
|
+
*/
|
|
45
|
+
function registerBestPracticesToolAndResources(server, resourcesPath) {
|
|
46
|
+
const bestPracticesResourcesPath = (0, node_path_1.join)(resourcesPath, 'best-practices');
|
|
47
|
+
return Promise.allSettled([
|
|
48
|
+
registerBestPracticesResources(server, bestPracticesResourcesPath),
|
|
49
|
+
registerBestPracticesTool(server, bestPracticesResourcesPath)
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/best-practices/index.ts"],"names":[],"mappings":";;AA0EA,sFAMC;AAhFD,+CAE0B;AAC1B,yCAEmB;AAInB,0CAEwB;AACxB,kEAEoC;AAEpC,MAAM,GAAG,GAAG,GAAG,iBAAS,gBAAgB,C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CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,qCAAqC,CAAC,MAAiB,EAAE,aAAqB;IAC5F,MAAM,0BAA0B,GAAG,IAAA,gBAAI,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IACzE,OAAO,OAAO,CAAC,UAAU,CAAC;QACxB,8BAA8B,CAAC,MAAM,EAAE,0BAA0B,CAAC;QAClE,yBAAyB,CAAC,MAAM,EAAE,0BAA0B,CAAC;KAC9D,CAAC,CAAC;AACL,CAAC"}
|
package/src/mcp-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/mcp-server.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EACV,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/mcp-server.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EACV,MAAM,yCAAyC,CAAC;AAiBjD;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAqB1D"}
|
package/src/mcp-server.js
CHANGED
|
@@ -4,10 +4,11 @@ exports.createMcpServer = createMcpServer;
|
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
7
|
-
const best_practices_1 = require("./
|
|
8
|
-
const
|
|
7
|
+
const best_practices_1 = require("./best-practices");
|
|
8
|
+
const release_notes_1 = require("./release-notes");
|
|
9
9
|
const create_monorepo_with_app_1 = require("./tools/create-monorepo-with-app");
|
|
10
10
|
const find_repositories_using_otter_1 = require("./tools/find-repositories-using-otter");
|
|
11
|
+
const supported_releases_1 = require("./tools/supported-releases");
|
|
11
12
|
/**
|
|
12
13
|
* Create an MCP server instance.
|
|
13
14
|
*/
|
|
@@ -22,10 +23,14 @@ async function createMcpServer() {
|
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
const resourcesPath = (0, node_path_1.join)(__dirname, '..', 'resources');
|
|
25
|
-
await
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
await Promise.allSettled([
|
|
27
|
+
(0, release_notes_1.registerReleaseNotes)(server),
|
|
28
|
+
(0, best_practices_1.registerBestPracticesToolAndResources)(server, resourcesPath),
|
|
29
|
+
(0, create_monorepo_with_app_1.registerCreateMonorepoWithAppTool)(server, resourcesPath),
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/await-thenable -- Awaiting a non-promise value
|
|
31
|
+
(0, find_repositories_using_otter_1.registerGetRepositoriesUsingOtterTool)(server),
|
|
32
|
+
(0, supported_releases_1.registerSupportedReleaseTool)(server)
|
|
33
|
+
]);
|
|
29
34
|
return server;
|
|
30
35
|
}
|
|
31
36
|
//# sourceMappingURL=mcp-server.js.map
|
package/src/mcp-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/mcp-server.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/mcp-server.ts"],"names":[],"mappings":";;AA4BA,0CAqBC;AAjDD,+CAE0B;AAC1B,yCAEmB;AACnB,oEAEiD;AACjD,qDAE0B;AAC1B,mDAEyB;AACzB,+EAE0C;AAC1C,yFAE+C;AAC/C,mEAEoC;AAEpC;;GAEG;AACI,KAAK,UAAU,eAAe;IACnC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,mBAAQ,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAsC,CAAC;IACzI,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3B,IAAI;QACJ,OAAO;QACP,YAAY,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,EAAE;SACV;KACF,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAEzD,MAAM,OAAO,CAAC,UAAU,CAAC;QACvB,IAAA,oCAAoB,EAAC,MAAM,CAAC;QAC5B,IAAA,sDAAqB,EAAC,MAAM,EAAE,aAAa,CAAC;QAC5C,IAAA,4DAAiC,EAAC,MAAM,EAAE,aAAa,CAAC;QACxD,6FAA6F;QAC7F,IAAA,qEAAqC,EAAC,MAAM,CAAC;QAC7C,IAAA,iDAA4B,EAAC,MAAM,CAAC;KACrC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp';
|
|
2
|
+
/**
|
|
3
|
+
* Register the release notes tool and resources.
|
|
4
|
+
* @param server
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerReleaseNotes(server: McpServer): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/release-notes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,sCAAsC,CAAC;AA+F9C;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,SAAS,iBAW3D"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerReleaseNotes = registerReleaseNotes;
|
|
4
|
+
const mcp_1 = require("@modelcontextprotocol/sdk/server/mcp");
|
|
5
|
+
const rest_1 = require("@octokit/rest");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const logger_1 = require("../utils/logger");
|
|
8
|
+
const otter_1 = require("../utils/otter");
|
|
9
|
+
const resource_registry_1 = require("../utils/resource-registry");
|
|
10
|
+
const getUri = (tagName) => `${otter_1.uriPrefix}release-notes/${tagName}`;
|
|
11
|
+
const formatContent = (releaseNote) => `# ${releaseNote.tag_name}\n\n${releaseNote.body}`;
|
|
12
|
+
async function getReleaseNotes(octokit) {
|
|
13
|
+
const minorsReleaseNotes = (await octokit.paginate(octokit.repos.listReleases, { owner: otter_1.owner, repo: otter_1.repo }))
|
|
14
|
+
.filter((release) => /^v\d+\.\d+\.0$/.test(release.tag_name));
|
|
15
|
+
const releaseNotes = new Map(minorsReleaseNotes.map((releaseNote) => [releaseNote.tag_name, releaseNote]));
|
|
16
|
+
releaseNotes.forEach((value) => resource_registry_1.resourceRegistry.set(getUri(value.tag_name), formatContent(value)));
|
|
17
|
+
return releaseNotes;
|
|
18
|
+
}
|
|
19
|
+
function registerReleaseNotesResources(server, releaseNotes) {
|
|
20
|
+
server.registerResource(`Otter release notes`, new mcp_1.ResourceTemplate(getUri('{tagName}'), {
|
|
21
|
+
list: undefined,
|
|
22
|
+
complete: {
|
|
23
|
+
tagName: (value) => {
|
|
24
|
+
const tagNames = Array.from(releaseNotes.keys());
|
|
25
|
+
return tagNames.filter((tagName) => tagName.startsWith(value));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}), {
|
|
29
|
+
description: `${otter_1.owner}/${otter_1.repo}'s release notes`,
|
|
30
|
+
mimeType: 'text/markdown'
|
|
31
|
+
}, (uri, { tagName }) => ({
|
|
32
|
+
contents: [({
|
|
33
|
+
uri: uri.href,
|
|
34
|
+
text: formatContent(releaseNotes.get(tagName)),
|
|
35
|
+
mimeType: 'text/markdown'
|
|
36
|
+
})]
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function registerReleaseNotesTool(server, releaseNotes) {
|
|
40
|
+
server.registerTool('get_release_notes', {
|
|
41
|
+
title: 'Get Otter release notes',
|
|
42
|
+
description: 'Get the release notes for the latest Otter releases',
|
|
43
|
+
annotations: {
|
|
44
|
+
readOnlyHint: true,
|
|
45
|
+
openWorldHint: false
|
|
46
|
+
},
|
|
47
|
+
inputSchema: {
|
|
48
|
+
version: zod_1.z.string().optional()
|
|
49
|
+
.describe('The version of the release notes to get, if not provided all release notes will be returned. Format to use is vX.Y.0, e.g. v13.1.0')
|
|
50
|
+
}
|
|
51
|
+
}, ({ version }) => {
|
|
52
|
+
const targetedReleaseNote = version && releaseNotes.get(version);
|
|
53
|
+
return {
|
|
54
|
+
content: (targetedReleaseNote ? [targetedReleaseNote] : Array.from(releaseNotes.values()))
|
|
55
|
+
.flatMap((releaseNote) => {
|
|
56
|
+
const uri = getUri(releaseNote.tag_name);
|
|
57
|
+
return [{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: resource_registry_1.resourceRegistry.get(uri) || 'Not found'
|
|
60
|
+
}, {
|
|
61
|
+
type: 'resource_link',
|
|
62
|
+
name: `Release note ${releaseNote.tag_name}`,
|
|
63
|
+
uri
|
|
64
|
+
}];
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Register the release notes tool and resources.
|
|
71
|
+
* @param server
|
|
72
|
+
*/
|
|
73
|
+
async function registerReleaseNotes(server) {
|
|
74
|
+
if (!process.env.O3R_MCP_GITHUB_TOKEN) {
|
|
75
|
+
logger_1.logger.error('Missing O3R_MCP_GITHUB_TOKEN environment variable for get_release_notes tool');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const octokit = new rest_1.Octokit({ auth: process.env.O3R_MCP_GITHUB_TOKEN });
|
|
79
|
+
const releaseNotes = await getReleaseNotes(octokit);
|
|
80
|
+
logger_1.logger.info(`Found ${releaseNotes.size} release notes`, releaseNotes);
|
|
81
|
+
registerReleaseNotesResources(server, releaseNotes);
|
|
82
|
+
registerReleaseNotesTool(server, releaseNotes);
|
|
83
|
+
}
|
|
84
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AAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;iBACvF,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;gBACvB,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;gBACzC,OAAO,CAAC;wBACN,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,oCAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,WAAW;qBAC/C,EAAE;wBACD,IAAI,EAAE,eAAe;wBACrB,IAAI,EAAE,gBAAgB,WAAW,CAAC,QAAQ,EAAE;wBAC5C,GAAG;qBACJ,CAAC,CAAC;YACL,CAAC,CAAC;SACL,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CAAC,MAAiB;IAC1D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;QACtC,eAAM,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAC7F,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACxE,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;IACpD,eAAM,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,IAAI,gBAAgB,EAAE,YAAY,CAAC,CAAC;IACtE,6BAA6B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpD,wBAAwB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-repositories-using-otter.d.ts","sourceRoot":"","sources":["../../../src/tools/find-repositories-using-otter.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,SAAS,EACV,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"find-repositories-using-otter.d.ts","sourceRoot":"","sources":["../../../src/tools/find-repositories-using-otter.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,SAAS,EACV,MAAM,yCAAyC,CAAC;AAkLjD;;;GAGG;AACH,wBAAgB,qCAAqC,CAAC,MAAM,EAAE,SAAS,QA4CtE"}
|
|
@@ -5,21 +5,30 @@ const node_fs_1 = require("node:fs");
|
|
|
5
5
|
const promises_1 = require("node:fs/promises");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
const rest_1 = require("@octokit/rest");
|
|
8
|
+
const zod_1 = require("zod");
|
|
8
9
|
const logger_1 = require("../utils/logger");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const otter_1 = require("../utils/otter");
|
|
11
|
+
async function listRepos(octokit) {
|
|
12
|
+
// We use several requests and not only one with OR
|
|
13
|
+
// because GitHub search API has some limitations in the query length and complexity
|
|
14
|
+
// Note: We can do only 10 searches per minute,
|
|
15
|
+
// so we should found another solution if we have more than 10 scopes to look for.
|
|
16
|
+
const search = (await Promise.all(otter_1.OTTER_SCOPES
|
|
17
|
+
.map(async (scope) => {
|
|
18
|
+
const repos = (await octokit.paginate(octokit.search.code, { q: `@${scope}/ filename:package.json`, per_page: 100 }));
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Naming convention from GitHub API
|
|
20
|
+
const reposWithOnlyNeededInfo = repos.map(({ repository: { name, full_name, fork, archived, default_branch } }) => ({ name, full_name, fork, archived, default_branch }));
|
|
21
|
+
const filteredRepos = reposWithOnlyNeededInfo.filter((repo) => !repo.archived && !repo.fork);
|
|
22
|
+
logger_1.logger.info(`Found ${filteredRepos.length} repositories with references to @${scope} in package.json`);
|
|
23
|
+
return filteredRepos;
|
|
24
|
+
}))).flat();
|
|
25
|
+
const repositories = Array.from(new Map(search.map(({ fork, archived, ...repo }) => [repo.full_name, repo])).values());
|
|
26
|
+
logger_1.logger.info(`Found ${repositories.length} repositories with references to Otter`);
|
|
27
|
+
return repositories;
|
|
18
28
|
}
|
|
19
29
|
function findPackageJsonFiles(octokit) {
|
|
20
30
|
return async (repository) => {
|
|
21
|
-
const owner =
|
|
22
|
-
const repo = repository.name;
|
|
31
|
+
const [owner, repo] = repository.full_name.split('/');
|
|
23
32
|
const { data: { commit: { sha } } } = await octokit.repos.getBranch({
|
|
24
33
|
owner,
|
|
25
34
|
repo,
|
|
@@ -33,17 +42,16 @@ function findPackageJsonFiles(octokit) {
|
|
|
33
42
|
return tree.filter((t) => t.type === 'blob' && t.path.endsWith('package.json'));
|
|
34
43
|
};
|
|
35
44
|
}
|
|
36
|
-
const O3R_SCOPE_REGEX =
|
|
45
|
+
const O3R_SCOPE_REGEX = new RegExp(`^@(?:${otter_1.OTTER_SCOPES.join('|')})/`, 'gm');
|
|
37
46
|
function dependsOnOtter(octokit) {
|
|
38
47
|
return async (repository, packageJsonPath) => {
|
|
39
|
-
const owner =
|
|
40
|
-
const repo = repository.name;
|
|
48
|
+
const [owner, repo] = repository.full_name.split('/');
|
|
41
49
|
const { data } = await octokit.repos.getContent({
|
|
42
50
|
owner,
|
|
43
51
|
repo,
|
|
44
52
|
path: packageJsonPath
|
|
45
53
|
});
|
|
46
|
-
if (Array.isArray(data) || data.type !== 'file') {
|
|
54
|
+
if (Array.isArray(data) || data.type !== 'file' || data.encoding !== 'base64') {
|
|
47
55
|
throw new Error('Unexpected content response structure');
|
|
48
56
|
}
|
|
49
57
|
const content = Buffer.from(data.content, 'base64').toString('utf8');
|
|
@@ -54,6 +62,19 @@ function dependsOnOtter(octokit) {
|
|
|
54
62
|
].some((dep) => O3R_SCOPE_REGEX.test(dep));
|
|
55
63
|
};
|
|
56
64
|
}
|
|
65
|
+
const DEFAULT_O3R_MCP_CACHE_MAX_AGE = 90;
|
|
66
|
+
const convertDaysToMs = (days) => days * 1000 * 60 * 60 * 24;
|
|
67
|
+
function validateCache(cachedRepos) {
|
|
68
|
+
const now = Date.now();
|
|
69
|
+
const maxAge = convertDaysToMs(+(process.env.O3R_MCP_CACHE_MAX_AGE || DEFAULT_O3R_MCP_CACHE_MAX_AGE));
|
|
70
|
+
Object.entries(cachedRepos).forEach(([repo, { when }]) => {
|
|
71
|
+
const whenDate = new Date(when);
|
|
72
|
+
if (Number.isNaN(whenDate.getTime()) || (now - whenDate.getTime()) > maxAge) {
|
|
73
|
+
logger_1.logger.info(`Cache for repository ${repo} is outdated or invalid, removing it`);
|
|
74
|
+
delete cachedRepos[repo];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
57
78
|
async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
58
79
|
const cacheFolderPath = process.env.O3R_MCP_CACHE_PATH || '.cache/o3r/mcp';
|
|
59
80
|
const cachePath = (0, node_path_1.resolve)(cacheFolderPath, 'repos-using-otter.json');
|
|
@@ -64,6 +85,7 @@ async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
|
64
85
|
else {
|
|
65
86
|
try {
|
|
66
87
|
cachedRepos = JSON.parse(await (0, promises_1.readFile)(cachePath, { encoding: 'utf8' }));
|
|
88
|
+
validateCache(cachedRepos);
|
|
67
89
|
reposUsingOtter.push(...Object.entries(cachedRepos).filter(([, usesOtter]) => usesOtter).map(([repo]) => repo));
|
|
68
90
|
logger_1.logger.info(`Loaded ${Object.keys(cachedRepos).length} cached repositories, ${reposUsingOtter.length} of them using Otter dependencies.`);
|
|
69
91
|
}
|
|
@@ -71,7 +93,7 @@ async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
|
71
93
|
logger_1.logger.info('No cache file found, starting fresh search for repositories using Otter dependencies.', e);
|
|
72
94
|
}
|
|
73
95
|
}
|
|
74
|
-
const repositories = (await
|
|
96
|
+
const repositories = (await listRepos(octokit)).filter((r) => !cachedRepos[r.full_name]?.dependsOn);
|
|
75
97
|
const findPackageJsonFilesInRepo = findPackageJsonFiles(octokit);
|
|
76
98
|
const dependsOnOtterInRepo = dependsOnOtter(octokit);
|
|
77
99
|
await Promise.allSettled(repositories.map(async (repository) => {
|
|
@@ -85,7 +107,10 @@ async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
|
85
107
|
}
|
|
86
108
|
if (packageJsonFiles.length === 0) {
|
|
87
109
|
logger_1.logger.info(`No package.json files found in repository ${repository.full_name}`);
|
|
88
|
-
cachedRepos[repository.full_name] =
|
|
110
|
+
cachedRepos[repository.full_name] = {
|
|
111
|
+
dependsOn: false,
|
|
112
|
+
when: new Date().toISOString()
|
|
113
|
+
};
|
|
89
114
|
return;
|
|
90
115
|
}
|
|
91
116
|
try {
|
|
@@ -100,7 +125,10 @@ async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
|
100
125
|
if (depFound) {
|
|
101
126
|
reposUsingOtter.push(repository.full_name);
|
|
102
127
|
logger_1.logger.info(`Repository ${repository.full_name} uses Otter dependencies`);
|
|
103
|
-
cachedRepos[repository.full_name] =
|
|
128
|
+
cachedRepos[repository.full_name] = {
|
|
129
|
+
dependsOn: true,
|
|
130
|
+
when: new Date().toISOString()
|
|
131
|
+
};
|
|
104
132
|
}
|
|
105
133
|
else {
|
|
106
134
|
throw new Error('No Otter dependencies found in this package.json');
|
|
@@ -108,9 +136,12 @@ async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
|
108
136
|
}));
|
|
109
137
|
}
|
|
110
138
|
catch { }
|
|
111
|
-
cachedRepos[repository.full_name] ||=
|
|
139
|
+
cachedRepos[repository.full_name] ||= {
|
|
140
|
+
dependsOn: false,
|
|
141
|
+
when: new Date().toISOString()
|
|
142
|
+
};
|
|
112
143
|
}));
|
|
113
|
-
logger_1.logger.info(`Found ${reposUsingOtter.length} repositories using Otter dependencies
|
|
144
|
+
logger_1.logger.info(`Found ${reposUsingOtter.length} repositories using Otter dependencies`);
|
|
114
145
|
if (process.env.O3R_MCP_USE_CACHED_REPOS === 'false') {
|
|
115
146
|
logger_1.logger.info('Not updating cache as O3R_MCP_USE_CACHED_REPOS is set to false');
|
|
116
147
|
}
|
|
@@ -119,7 +150,7 @@ async function findRepositoriesUsingOtter(octokit, reposUsingOtter) {
|
|
|
119
150
|
await (0, promises_1.mkdir)(cacheFolderPath, { recursive: true });
|
|
120
151
|
}
|
|
121
152
|
try {
|
|
122
|
-
await (0, promises_1.writeFile)(cachePath, JSON.stringify(cachedRepos
|
|
153
|
+
await (0, promises_1.writeFile)(cachePath, JSON.stringify(cachedRepos));
|
|
123
154
|
}
|
|
124
155
|
catch (e) {
|
|
125
156
|
logger_1.logger.error('Failed to update cache', e);
|
|
@@ -135,10 +166,6 @@ function registerGetRepositoriesUsingOtterTool(server) {
|
|
|
135
166
|
logger_1.logger.error('Missing O3R_MCP_GITHUB_TOKEN environment variable for search_code_example tool');
|
|
136
167
|
return;
|
|
137
168
|
}
|
|
138
|
-
if (!process.env.O3R_MCP_GITHUB_ORG) {
|
|
139
|
-
logger_1.logger.error('Missing O3R_MCP_GITHUB_ORG environment variable');
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
169
|
const octokit = new rest_1.Octokit({ auth: process.env.O3R_MCP_GITHUB_TOKEN });
|
|
143
170
|
let isLookingForRepos = true;
|
|
144
171
|
const reposUsingOtter = [];
|
|
@@ -148,10 +175,13 @@ function registerGetRepositoriesUsingOtterTool(server) {
|
|
|
148
175
|
isLookingForRepos = false;
|
|
149
176
|
server.registerTool('get_repositories_using_otter', {
|
|
150
177
|
title: 'Get repositories using Otter dependencies',
|
|
151
|
-
description:
|
|
178
|
+
description: `List all repositories that use Otter dependencies (${otter_1.OTTER_SCOPES.map((scope) => `@${scope}`).join(' or ')}) in their package.json files.`,
|
|
152
179
|
annotations: {
|
|
153
180
|
readOnlyHint: true,
|
|
154
181
|
openWorldHint: false
|
|
182
|
+
},
|
|
183
|
+
outputSchema: {
|
|
184
|
+
repositories: zod_1.z.array(zod_1.z.string()).describe('List of repositories using Otter dependencies')
|
|
155
185
|
}
|
|
156
186
|
}, () => ({
|
|
157
187
|
content: [
|
|
@@ -159,11 +189,14 @@ function registerGetRepositoriesUsingOtterTool(server) {
|
|
|
159
189
|
type: 'text',
|
|
160
190
|
text: (isLookingForRepos ? 'I did not finish to look for repositories. For the moment:\n' : '')
|
|
161
191
|
+ reposUsingOtter.length
|
|
162
|
-
? `The following repositories
|
|
192
|
+
? `The following repositories use Otter dependencies:\n`
|
|
163
193
|
+ reposUsingOtter.sort().map((repo) => `- ${repo}`).join('\n')
|
|
164
|
-
: `No repositories
|
|
194
|
+
: `No repositories were found to use Otter dependencies.`
|
|
165
195
|
}
|
|
166
|
-
]
|
|
196
|
+
],
|
|
197
|
+
structuredContent: {
|
|
198
|
+
repositories: reposUsingOtter
|
|
199
|
+
}
|
|
167
200
|
}));
|
|
168
201
|
}
|
|
169
202
|
//# sourceMappingURL=find-repositories-using-otter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-repositories-using-otter.js","sourceRoot":"","sources":["../../../src/tools/find-repositories-using-otter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"find-repositories-using-otter.js","sourceRoot":"","sources":["../../../src/tools/find-repositories-using-otter.ts"],"names":[],"mappings":";;AAmMA,sFA4CC;AA/OD,qCAEiB;AACjB,+CAI0B;AAC1B,yCAEmB;AAInB,wCAEuB;AACvB,6BAEa;AACb,4CAEyB;AACzB,0CAEwB;AAExB,KAAK,UAAU,SAAS,CAAC,OAAgB;IACvC,mDAAmD;IACnD,oFAAoF;IACpF,+CAA+C;IAC/C,kFAAkF;IAClF,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAY;SAC3C,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACnB,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO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C;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,8DAA8D,CAAC,CAAC,CAAC,EAAE,CAAC;sBAC3F,eAAe,CAAC,MAAM;oBACxB,CAAC,CAAC,sDAAsD;0BACtD,eAAe,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC9D,CAAC,CAAC,uDAAuD;aAC5D;SACF;QACD,iBAAiB,EAAE;YACjB,YAAY,EAAE,eAAe;SAC9B;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/**
|
|
3
|
+
* Register the create monorepo with app tool.
|
|
4
|
+
* @param server
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerSupportedReleaseTool(server: McpServer): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=supported-releases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-releases.d.ts","sourceRoot":"","sources":["../../../src/tools/supported-releases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACV,MAAM,yCAAyC,CAAC;AAwBjD;;;GAGG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCnF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerSupportedReleaseTool = registerSupportedReleaseTool;
|
|
4
|
+
const rest_1 = require("@octokit/rest");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const logger_1 = require("../utils/logger");
|
|
7
|
+
const otter_1 = require("../utils/otter");
|
|
8
|
+
async function getSupportedReleases(octokit) {
|
|
9
|
+
const supportedReleases = (await octokit.paginate(octokit.repos.listBranches, { owner: otter_1.owner, repo: otter_1.repo }))
|
|
10
|
+
.filter((branch) => /^release\/\d+\.\d+$/.test(branch.name))
|
|
11
|
+
.map((branch) => branch.name.replace('release/', ''));
|
|
12
|
+
logger_1.logger.info(`Supported releases:\n${supportedReleases.map((r) => ` - ${r}`).join('\n')}`);
|
|
13
|
+
return supportedReleases;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Register the create monorepo with app tool.
|
|
17
|
+
* @param server
|
|
18
|
+
*/
|
|
19
|
+
async function registerSupportedReleaseTool(server) {
|
|
20
|
+
if (!process.env.O3R_MCP_GITHUB_TOKEN) {
|
|
21
|
+
logger_1.logger.error('Missing O3R_MCP_GITHUB_TOKEN environment variable for get_supported_releases tool');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const octokit = new rest_1.Octokit({ auth: process.env.O3R_MCP_GITHUB_TOKEN });
|
|
25
|
+
const supportedReleases = await getSupportedReleases(octokit);
|
|
26
|
+
server.registerTool('get_supported_releases', {
|
|
27
|
+
title: 'Get Otter Supported Releases',
|
|
28
|
+
description: 'Get the list of Otter supported releases',
|
|
29
|
+
outputSchema: {
|
|
30
|
+
releases: zod_1.z.array(zod_1.z.string()).describe('List of supported releases')
|
|
31
|
+
}
|
|
32
|
+
}, () => {
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: `The supported releases for Otter are: \n${supportedReleases.map((r) => ` - ${r}`).join('\n')}`
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
structuredContent: {
|
|
41
|
+
releases: supportedReleases
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=supported-releases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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0CAA0C;QACvD,YAAY,EAAE;YACZ,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;SACrE;KACF,EACD,GAAG,EAAE;QACH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,2CAA2C,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBACvG;aACF;YACD,iBAAiB,EAAE;gBACjB,QAAQ,EAAE,iBAAiB;aAC5B;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Otter repository organization
|
|
3
|
+
*/
|
|
4
|
+
export declare const owner = "AmadeusITGroup";
|
|
5
|
+
/**
|
|
6
|
+
* Otter repository name
|
|
7
|
+
*/
|
|
8
|
+
export declare const repo = "otter";
|
|
9
|
+
/**
|
|
10
|
+
* Otter related scopes
|
|
11
|
+
*/
|
|
12
|
+
export declare const OTTER_SCOPES: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Otter URI prefix
|
|
15
|
+
*/
|
|
16
|
+
export declare const uriPrefix = "o3r://";
|
|
17
|
+
//# sourceMappingURL=otter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otter.d.ts","sourceRoot":"","sources":["../../../src/utils/otter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,KAAK,mBAAmB,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,IAAI,UAAU,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,YAAY,UAKxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,WAAW,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uriPrefix = exports.OTTER_SCOPES = exports.repo = exports.owner = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Otter repository organization
|
|
6
|
+
*/
|
|
7
|
+
exports.owner = 'AmadeusITGroup';
|
|
8
|
+
/**
|
|
9
|
+
* Otter repository name
|
|
10
|
+
*/
|
|
11
|
+
exports.repo = 'otter';
|
|
12
|
+
/**
|
|
13
|
+
* Otter related scopes
|
|
14
|
+
*/
|
|
15
|
+
exports.OTTER_SCOPES = [
|
|
16
|
+
'o3r',
|
|
17
|
+
'ama-styling',
|
|
18
|
+
'ama-mfe',
|
|
19
|
+
'ama-sdk'
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Otter URI prefix
|
|
23
|
+
*/
|
|
24
|
+
exports.uriPrefix = 'o3r://';
|
|
25
|
+
//# sourceMappingURL=otter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otter.js","sourceRoot":"","sources":["../../../src/utils/otter.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,KAAK,GAAG,gBAAgB,CAAC;AAEtC;;GAEG;AACU,QAAA,IAAI,GAAG,OAAO,CAAC;AAE5B;;GAEG;AACU,QAAA,YAAY,GAAG;IAC1B,KAAK;IACL,aAAa;IACb,SAAS;IACT,SAAS;CACV,CAAC;AAEF;;GAEG;AACU,QAAA,SAAS,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-registry.d.ts","sourceRoot":"","sources":["../../../src/utils/resource-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,qBAA4B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resourceRegistry = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A registry to store resources in memory and retrieve them by their URI.
|
|
6
|
+
* key: resource URI
|
|
7
|
+
* value: resource content
|
|
8
|
+
*/
|
|
9
|
+
exports.resourceRegistry = new Map();
|
|
10
|
+
//# sourceMappingURL=resource-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-registry.js","sourceRoot":"","sources":["../../../src/utils/resource-registry.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
/**
|
|
3
|
-
* Register resources for best practices
|
|
4
|
-
* @param server
|
|
5
|
-
* @param resourcesPath
|
|
6
|
-
*/
|
|
7
|
-
export declare function registerBestPracticesResources(server: McpServer, resourcesPath: string): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=best-practices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.d.ts","sourceRoot":"","sources":["../../../src/instructions/best-practices.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,SAAS,EACV,MAAM,yCAAyC,CAAC;AAEjD;;;;GAIG;AACH,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB5G"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerBestPracticesResources = registerBestPracticesResources;
|
|
4
|
-
const promises_1 = require("node:fs/promises");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
/**
|
|
7
|
-
* Register resources for best practices
|
|
8
|
-
* @param server
|
|
9
|
-
* @param resourcesPath
|
|
10
|
-
*/
|
|
11
|
-
async function registerBestPracticesResources(server, resourcesPath) {
|
|
12
|
-
const bestPracticesResourcesPath = (0, node_path_1.join)(resourcesPath, 'best-practices');
|
|
13
|
-
const name = 'instructions';
|
|
14
|
-
const uri = `${name}://best-practices`;
|
|
15
|
-
server.registerResource(name, uri, {
|
|
16
|
-
title: 'Otter Best Practices and Code Generation Guide',
|
|
17
|
-
description: await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'description.md'), { encoding: 'utf8' }),
|
|
18
|
-
mimeType: 'text/markdown'
|
|
19
|
-
}, async () => {
|
|
20
|
-
const text = await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'output.md'), { encoding: 'utf8' });
|
|
21
|
-
return { contents: [{ uri, text }] };
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=best-practices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.js","sourceRoot":"","sources":["../../../src/instructions/best-practices.ts"],"names":[],"mappings":";;AAeA,wEAwBC;AAvCD,+CAE0B;AAC1B,yCAEmB;AAKnB;;;;GAIG;AACI,KAAK,UAAU,8BAA8B,CAAC,MAAiB,EAAE,aAAqB;IAC3F,MAAM,0BAA0B,GAAG,IAAA,gBAAI,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,cAAc,CAAC;IAC5B,MAAM,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAAC;IACvC,MAAM,CAAC,gBAAgB,CACrB,IAAI,EACJ,GAAG,EACH;QACE,KAAK,EAAE,gDAAgD;QACvD,WAAW,EAAE,MAAM,IAAA,mBAAQ,EACzB,IAAA,gBAAI,EAAC,0BAA0B,EAAE,gBAAgB,CAAC,EAClD,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB;QACD,QAAQ,EAAE,eAAe;KAC1B,EACD,KAAK,IAAI,EAAE;QACT,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAQ,EACzB,IAAA,gBAAI,EAAC,0BAA0B,EAAE,WAAW,CAAC,EAC7C,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB,CAAC;QAEF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACvC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
/**
|
|
3
|
-
* Register the best practices tool.
|
|
4
|
-
* @param server
|
|
5
|
-
* @param resourcesPath
|
|
6
|
-
*/
|
|
7
|
-
export declare function registerBestPracticesTool(server: McpServer, resourcesPath: string): Promise<void>;
|
|
8
|
-
//# sourceMappingURL=best-practices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.d.ts","sourceRoot":"","sources":["../../../src/tools/best-practices.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,SAAS,EACV,MAAM,yCAAyC,CAAC;AAEjD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvG"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerBestPracticesTool = registerBestPracticesTool;
|
|
4
|
-
const promises_1 = require("node:fs/promises");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
/**
|
|
7
|
-
* Register the best practices tool.
|
|
8
|
-
* @param server
|
|
9
|
-
* @param resourcesPath
|
|
10
|
-
*/
|
|
11
|
-
async function registerBestPracticesTool(server, resourcesPath) {
|
|
12
|
-
const bestPracticesResourcesPath = (0, node_path_1.join)(resourcesPath, 'best-practices');
|
|
13
|
-
server.registerTool('get_best_practices', {
|
|
14
|
-
title: 'Get Otter Coding Best Practices Guide',
|
|
15
|
-
description: await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'description.md'), { encoding: 'utf8' }),
|
|
16
|
-
annotations: {
|
|
17
|
-
readOnlyHint: true,
|
|
18
|
-
openWorldHint: false
|
|
19
|
-
}
|
|
20
|
-
}, async () => {
|
|
21
|
-
const bestPractices = await (0, promises_1.readFile)((0, node_path_1.join)(bestPracticesResourcesPath, 'output.md'), { encoding: 'utf8' });
|
|
22
|
-
const developer = await (0, promises_1.readFile)((0, node_path_1.join)(resourcesPath, 'developer.md'), { encoding: 'utf8' });
|
|
23
|
-
const text = [developer, bestPractices].join('\n\n');
|
|
24
|
-
return { content: [{ type: 'text', text }] };
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=best-practices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.js","sourceRoot":"","sources":["../../../src/tools/best-practices.ts"],"names":[],"mappings":";;AAeA,8DA+BC;AA9CD,+CAE0B;AAC1B,yCAEmB;AAKnB;;;;GAIG;AACI,KAAK,UAAU,yBAAyB,CAAC,MAAiB,EAAE,aAAqB;IACtF,MAAM,0BAA0B,GAAG,IAAA,gBAAI,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAEzE,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,uCAAuC;QAC9C,WAAW,EAAE,MAAM,IAAA,mBAAQ,EACzB,IAAA,gBAAI,EAAC,0BAA0B,EAAE,gBAAgB,CAAC,EAClD,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,IAAI,EAAE;QACT,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAQ,EAClC,IAAA,gBAAI,EAAC,0BAA0B,EAAE,WAAW,CAAC,EAC7C,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,IAAA,mBAAQ,EAC9B,IAAA,gBAAI,EAAC,aAAa,EAAE,cAAc,CAAC,EACnC,EAAE,QAAQ,EAAE,MAAM,EAAE,CACrB,CAAC;QAEF,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC/C,CAAC,CACF,CAAC;AACJ,CAAC"}
|