@deimoscloud/coreai 0.1.8 → 0.1.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/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/.prettierrc +0 -9
- package/AGENT_SPEC.md +0 -347
- package/ARCHITECTURE.md +0 -547
- package/DRAFT_PRD.md +0 -1440
- package/IMPLEMENTATION_PLAN.md +0 -256
- package/PRODUCT.md +0 -473
- package/WORKFLOWS.md +0 -295
- package/commands/core/check-inbox.md +0 -34
- package/commands/core/delegate.md +0 -30
- package/commands/core/git-commit.md +0 -144
- package/commands/core/pr-create.md +0 -193
- package/commands/core/review.md +0 -56
- package/commands/core/sprint-status.md +0 -65
- package/commands/optional/docs-update.md +0 -200
- package/commands/optional/jira-create.md +0 -200
- package/commands/optional/jira-transition.md +0 -184
- package/commands/optional/worktree-cleanup.md +0 -167
- package/commands/optional/worktree-setup.md +0 -110
- package/eslint.config.js +0 -29
- package/jest.config.js +0 -22
- package/knowledge-library/README.md +0 -118
- package/knowledge-library/android-engineer/context/current.txt +0 -42
- package/knowledge-library/android-engineer/control/decisions.txt +0 -9
- package/knowledge-library/android-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/android-engineer/control/objectives.txt +0 -26
- package/knowledge-library/android-engineer/history/.gitkeep +0 -0
- package/knowledge-library/android-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/android-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/android-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/architecture.txt +0 -61
- package/knowledge-library/backend-engineer/context/current.txt +0 -42
- package/knowledge-library/backend-engineer/control/decisions.txt +0 -9
- package/knowledge-library/backend-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/backend-engineer/control/objectives.txt +0 -26
- package/knowledge-library/backend-engineer/history/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/context.txt +0 -52
- package/knowledge-library/devops-engineer/context/current.txt +0 -42
- package/knowledge-library/devops-engineer/control/decisions.txt +0 -9
- package/knowledge-library/devops-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/devops-engineer/control/objectives.txt +0 -26
- package/knowledge-library/devops-engineer/history/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/context/current.txt +0 -40
- package/knowledge-library/engineering-manager/control/decisions.txt +0 -9
- package/knowledge-library/engineering-manager/control/objectives.txt +0 -27
- package/knowledge-library/engineering-manager/history/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/outbox/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/tech/.gitkeep +0 -0
- package/knowledge-library/prd.txt +0 -81
- package/knowledge-library/product-manager/context/current.txt +0 -42
- package/knowledge-library/product-manager/control/decisions.txt +0 -9
- package/knowledge-library/product-manager/control/dependencies.txt +0 -19
- package/knowledge-library/product-manager/control/objectives.txt +0 -26
- package/knowledge-library/product-manager/history/.gitkeep +0 -0
- package/knowledge-library/product-manager/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/product-manager/outbox/.gitkeep +0 -0
- package/knowledge-library/product-manager/tech/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/context/current.txt +0 -42
- package/knowledge-library/qa-engineer/control/decisions.txt +0 -9
- package/knowledge-library/qa-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/qa-engineer/control/objectives.txt +0 -26
- package/knowledge-library/qa-engineer/history/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/security-engineer/context/current.txt +0 -42
- package/knowledge-library/security-engineer/control/decisions.txt +0 -9
- package/knowledge-library/security-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/security-engineer/control/objectives.txt +0 -26
- package/knowledge-library/security-engineer/history/.gitkeep +0 -0
- package/knowledge-library/security-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/security-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/security-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/context/current.txt +0 -42
- package/knowledge-library/solutions-architect/control/decisions.txt +0 -9
- package/knowledge-library/solutions-architect/control/dependencies.txt +0 -19
- package/knowledge-library/solutions-architect/control/objectives.txt +0 -26
- package/knowledge-library/solutions-architect/history/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/outbox/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/tech/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/context/current.txt +0 -42
- package/knowledge-library/wearos-engineer/control/decisions.txt +0 -9
- package/knowledge-library/wearos-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/wearos-engineer/control/objectives.txt +0 -26
- package/knowledge-library/wearos-engineer/history/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/tech/.gitkeep +0 -0
- package/scripts/add-agent.sh +0 -323
- package/scripts/install.sh +0 -354
- package/src/adapters/factory.test.ts +0 -386
- package/src/adapters/factory.ts +0 -305
- package/src/adapters/index.ts +0 -113
- package/src/adapters/interfaces.ts +0 -268
- package/src/adapters/mcp/client.test.ts +0 -130
- package/src/adapters/mcp/client.ts +0 -451
- package/src/adapters/mcp/discovery.test.ts +0 -315
- package/src/adapters/mcp/discovery.ts +0 -340
- package/src/adapters/mcp/index.ts +0 -66
- package/src/adapters/mcp/mapper.test.ts +0 -218
- package/src/adapters/mcp/mapper.ts +0 -536
- package/src/adapters/mcp/registry.test.ts +0 -433
- package/src/adapters/mcp/registry.ts +0 -550
- package/src/adapters/mcp/types.ts +0 -258
- package/src/adapters/native/filesystem.test.ts +0 -350
- package/src/adapters/native/filesystem.ts +0 -393
- package/src/adapters/native/github.test.ts +0 -173
- package/src/adapters/native/github.ts +0 -627
- package/src/adapters/native/index.ts +0 -22
- package/src/adapters/native/selector.test.ts +0 -224
- package/src/adapters/native/selector.ts +0 -150
- package/src/adapters/types.ts +0 -270
- package/src/agents/compiler.test.ts +0 -399
- package/src/agents/compiler.ts +0 -422
- package/src/agents/index.ts +0 -37
- package/src/agents/loader.test.ts +0 -319
- package/src/agents/loader.ts +0 -143
- package/src/agents/resolver.test.ts +0 -282
- package/src/agents/resolver.ts +0 -262
- package/src/agents/types.ts +0 -97
- package/src/cache/index.ts +0 -38
- package/src/cache/interfaces.ts +0 -283
- package/src/cache/manager.test.ts +0 -266
- package/src/cache/manager.ts +0 -388
- package/src/cache/provider.test.ts +0 -485
- package/src/cache/provider.ts +0 -745
- package/src/cache/types.test.ts +0 -192
- package/src/cache/types.ts +0 -313
- package/src/cli/commands/build.test.ts +0 -248
- package/src/cli/commands/build.ts +0 -284
- package/src/cli/commands/cache.test.ts +0 -221
- package/src/cli/commands/cache.ts +0 -229
- package/src/cli/commands/index.ts +0 -63
- package/src/cli/commands/init.test.ts +0 -173
- package/src/cli/commands/init.ts +0 -296
- package/src/cli/commands/skills.test.ts +0 -272
- package/src/cli/commands/skills.ts +0 -348
- package/src/cli/commands/status.test.ts +0 -392
- package/src/cli/commands/status.ts +0 -332
- package/src/cli/commands/sync.test.ts +0 -213
- package/src/cli/commands/sync.ts +0 -251
- package/src/cli/commands/validate.test.ts +0 -216
- package/src/cli/commands/validate.ts +0 -340
- package/src/cli/index.test.ts +0 -190
- package/src/cli/index.ts +0 -493
- package/src/commands/context.test.ts +0 -163
- package/src/commands/context.ts +0 -111
- package/src/commands/index.ts +0 -56
- package/src/commands/loader.test.ts +0 -273
- package/src/commands/loader.ts +0 -355
- package/src/commands/registry.test.ts +0 -384
- package/src/commands/registry.ts +0 -248
- package/src/commands/runner.test.ts +0 -297
- package/src/commands/runner.ts +0 -222
- package/src/commands/types.ts +0 -361
- package/src/config/index.ts +0 -19
- package/src/config/loader.test.ts +0 -262
- package/src/config/loader.ts +0 -188
- package/src/config/types.ts +0 -154
- package/src/context/index.ts +0 -14
- package/src/context/loader.test.ts +0 -334
- package/src/context/loader.ts +0 -357
- package/src/index.test.ts +0 -13
- package/src/index.ts +0 -268
- package/src/knowledge-library/index.ts +0 -44
- package/src/knowledge-library/manager.test.ts +0 -536
- package/src/knowledge-library/manager.ts +0 -804
- package/src/knowledge-library/types.ts +0 -432
- package/src/skills/generator.test.ts +0 -602
- package/src/skills/generator.ts +0 -491
- package/src/skills/index.ts +0 -27
- package/src/skills/templates.ts +0 -520
- package/src/skills/types.ts +0 -251
- package/templates/completion-report.md +0 -72
- package/templates/feedback.md +0 -56
- package/templates/project-files/CLAUDE.md.template +0 -109
- package/templates/project-files/coreai.json.example +0 -47
- package/templates/project-files/mcp.json.template +0 -20
- package/templates/review-complete.md +0 -64
- package/templates/review-request.md +0 -67
- package/templates/task-assignment.md +0 -51
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -26
- package/tsup.config.ts +0 -23
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool Mapper
|
|
3
|
-
*
|
|
4
|
-
* Maps MCP server tools to adapter interface methods.
|
|
5
|
-
* Provides both pre-defined mappings for known servers and
|
|
6
|
-
* heuristic-based auto-discovery for unknown servers.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { AdapterType } from '../types.js';
|
|
10
|
-
import type { McpTool } from './types.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Mapping from an MCP tool to an adapter method
|
|
14
|
-
*/
|
|
15
|
-
export interface ToolMapping {
|
|
16
|
-
/**
|
|
17
|
-
* The MCP tool name
|
|
18
|
-
*/
|
|
19
|
-
toolName: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The adapter type this tool maps to
|
|
23
|
-
*/
|
|
24
|
-
adapterType: AdapterType;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The adapter method this tool implements
|
|
28
|
-
*/
|
|
29
|
-
method: string;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Parameter mapping from adapter method params to MCP tool args
|
|
33
|
-
*/
|
|
34
|
-
parameterMap?: Record<string, string>;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* How to extract the result from the MCP tool response
|
|
38
|
-
*/
|
|
39
|
-
resultExtractor?: (result: unknown) => unknown;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Confidence score (0-1) for auto-discovered mappings
|
|
43
|
-
*/
|
|
44
|
-
confidence?: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Registry of known MCP server tool mappings
|
|
49
|
-
*/
|
|
50
|
-
export interface ServerMapping {
|
|
51
|
-
/**
|
|
52
|
-
* Server identifier patterns (name or npm package)
|
|
53
|
-
*/
|
|
54
|
-
patterns: string[];
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Tool mappings for this server
|
|
58
|
-
*/
|
|
59
|
-
mappings: ToolMapping[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Known server mappings registry
|
|
64
|
-
*/
|
|
65
|
-
const KNOWN_SERVER_MAPPINGS: ServerMapping[] = [
|
|
66
|
-
// GitHub MCP Server (@modelcontextprotocol/server-github)
|
|
67
|
-
{
|
|
68
|
-
patterns: ['@modelcontextprotocol/server-github', 'github', 'mcp-server-github'],
|
|
69
|
-
mappings: [
|
|
70
|
-
// Git Provider mappings
|
|
71
|
-
{
|
|
72
|
-
toolName: 'create_pull_request',
|
|
73
|
-
adapterType: 'git',
|
|
74
|
-
method: 'createPullRequest',
|
|
75
|
-
parameterMap: {
|
|
76
|
-
title: 'title',
|
|
77
|
-
body: 'description',
|
|
78
|
-
head: 'source_branch',
|
|
79
|
-
base: 'target_branch',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
toolName: 'get_pull_request',
|
|
84
|
-
adapterType: 'git',
|
|
85
|
-
method: 'getPullRequest',
|
|
86
|
-
parameterMap: {
|
|
87
|
-
pull_number: 'idOrNumber',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
toolName: 'list_pull_requests',
|
|
92
|
-
adapterType: 'git',
|
|
93
|
-
method: 'listPullRequests',
|
|
94
|
-
parameterMap: {
|
|
95
|
-
state: 'status',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
toolName: 'merge_pull_request',
|
|
100
|
-
adapterType: 'git',
|
|
101
|
-
method: 'mergePullRequest',
|
|
102
|
-
parameterMap: {
|
|
103
|
-
pull_number: 'idOrNumber',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
toolName: 'create_review',
|
|
108
|
-
adapterType: 'git',
|
|
109
|
-
method: 'addReview',
|
|
110
|
-
parameterMap: {
|
|
111
|
-
pull_number: 'idOrNumber',
|
|
112
|
-
event: 'decision',
|
|
113
|
-
body: 'body',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
// Issue Tracker mappings (GitHub Issues)
|
|
117
|
-
{
|
|
118
|
-
toolName: 'get_issue',
|
|
119
|
-
adapterType: 'issue_tracker',
|
|
120
|
-
method: 'getIssue',
|
|
121
|
-
parameterMap: {
|
|
122
|
-
issue_number: 'idOrKey',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
toolName: 'list_issues',
|
|
127
|
-
adapterType: 'issue_tracker',
|
|
128
|
-
method: 'listIssues',
|
|
129
|
-
parameterMap: {
|
|
130
|
-
state: 'status',
|
|
131
|
-
assignee: 'assignee',
|
|
132
|
-
labels: 'labels',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
toolName: 'create_issue',
|
|
137
|
-
adapterType: 'issue_tracker',
|
|
138
|
-
method: 'createIssue',
|
|
139
|
-
parameterMap: {
|
|
140
|
-
title: 'title',
|
|
141
|
-
body: 'description',
|
|
142
|
-
assignees: 'assignee',
|
|
143
|
-
labels: 'labels',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
toolName: 'update_issue',
|
|
148
|
-
adapterType: 'issue_tracker',
|
|
149
|
-
method: 'updateIssue',
|
|
150
|
-
parameterMap: {
|
|
151
|
-
issue_number: 'idOrKey',
|
|
152
|
-
title: 'title',
|
|
153
|
-
body: 'description',
|
|
154
|
-
state: 'status',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
toolName: 'add_issue_comment',
|
|
159
|
-
adapterType: 'issue_tracker',
|
|
160
|
-
method: 'addComment',
|
|
161
|
-
parameterMap: {
|
|
162
|
-
issue_number: 'idOrKey',
|
|
163
|
-
body: 'comment',
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
// Jira MCP Server (if available)
|
|
170
|
-
{
|
|
171
|
-
patterns: ['jira', 'mcp-server-jira', 'atlassian-jira'],
|
|
172
|
-
mappings: [
|
|
173
|
-
{
|
|
174
|
-
toolName: 'get_issue',
|
|
175
|
-
adapterType: 'issue_tracker',
|
|
176
|
-
method: 'getIssue',
|
|
177
|
-
parameterMap: {
|
|
178
|
-
issue_key: 'idOrKey',
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
toolName: 'search_issues',
|
|
183
|
-
adapterType: 'issue_tracker',
|
|
184
|
-
method: 'listIssues',
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
toolName: 'create_issue',
|
|
188
|
-
adapterType: 'issue_tracker',
|
|
189
|
-
method: 'createIssue',
|
|
190
|
-
parameterMap: {
|
|
191
|
-
summary: 'title',
|
|
192
|
-
description: 'description',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
toolName: 'update_issue',
|
|
197
|
-
adapterType: 'issue_tracker',
|
|
198
|
-
method: 'updateIssue',
|
|
199
|
-
parameterMap: {
|
|
200
|
-
issue_key: 'idOrKey',
|
|
201
|
-
summary: 'title',
|
|
202
|
-
description: 'description',
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
toolName: 'transition_issue',
|
|
207
|
-
adapterType: 'issue_tracker',
|
|
208
|
-
method: 'transitionIssue',
|
|
209
|
-
parameterMap: {
|
|
210
|
-
issue_key: 'idOrKey',
|
|
211
|
-
transition_id: 'status',
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
toolName: 'add_comment',
|
|
216
|
-
adapterType: 'issue_tracker',
|
|
217
|
-
method: 'addComment',
|
|
218
|
-
parameterMap: {
|
|
219
|
-
issue_key: 'idOrKey',
|
|
220
|
-
body: 'comment',
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
// Confluence MCP Server (if available)
|
|
227
|
-
{
|
|
228
|
-
patterns: ['confluence', 'mcp-server-confluence', 'atlassian-confluence'],
|
|
229
|
-
mappings: [
|
|
230
|
-
{
|
|
231
|
-
toolName: 'get_page',
|
|
232
|
-
adapterType: 'documentation',
|
|
233
|
-
method: 'getPage',
|
|
234
|
-
parameterMap: {
|
|
235
|
-
page_id: 'id',
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
toolName: 'get_page_content',
|
|
240
|
-
adapterType: 'documentation',
|
|
241
|
-
method: 'getPageContent',
|
|
242
|
-
parameterMap: {
|
|
243
|
-
page_id: 'id',
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
toolName: 'search_pages',
|
|
248
|
-
adapterType: 'documentation',
|
|
249
|
-
method: 'searchPages',
|
|
250
|
-
parameterMap: {
|
|
251
|
-
query: 'query',
|
|
252
|
-
space_key: 'space',
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
// Filesystem MCP Server
|
|
259
|
-
{
|
|
260
|
-
patterns: ['filesystem', 'mcp-server-filesystem', '@modelcontextprotocol/server-filesystem'],
|
|
261
|
-
mappings: [
|
|
262
|
-
{
|
|
263
|
-
toolName: 'read_file',
|
|
264
|
-
adapterType: 'state',
|
|
265
|
-
method: 'read',
|
|
266
|
-
parameterMap: {
|
|
267
|
-
path: 'path',
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
toolName: 'write_file',
|
|
272
|
-
adapterType: 'state',
|
|
273
|
-
method: 'write',
|
|
274
|
-
parameterMap: {
|
|
275
|
-
path: 'path',
|
|
276
|
-
content: 'content',
|
|
277
|
-
},
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
toolName: 'list_directory',
|
|
281
|
-
adapterType: 'state',
|
|
282
|
-
method: 'list',
|
|
283
|
-
parameterMap: {
|
|
284
|
-
path: 'path',
|
|
285
|
-
},
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
toolName: 'create_directory',
|
|
289
|
-
adapterType: 'state',
|
|
290
|
-
method: 'mkdir',
|
|
291
|
-
parameterMap: {
|
|
292
|
-
path: 'path',
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
];
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Find mappings for a known server
|
|
301
|
-
*/
|
|
302
|
-
export function findKnownServerMappings(serverName: string): ToolMapping[] {
|
|
303
|
-
const normalizedName = serverName.toLowerCase();
|
|
304
|
-
|
|
305
|
-
for (const server of KNOWN_SERVER_MAPPINGS) {
|
|
306
|
-
for (const pattern of server.patterns) {
|
|
307
|
-
if (
|
|
308
|
-
normalizedName.includes(pattern.toLowerCase()) ||
|
|
309
|
-
pattern.toLowerCase().includes(normalizedName)
|
|
310
|
-
) {
|
|
311
|
-
return server.mappings;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return [];
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Auto-discover mappings for tools based on naming conventions
|
|
321
|
-
*/
|
|
322
|
-
export function autoDiscoverMappings(tools: McpTool[]): ToolMapping[] {
|
|
323
|
-
const mappings: ToolMapping[] = [];
|
|
324
|
-
|
|
325
|
-
for (const tool of tools) {
|
|
326
|
-
const discovered = discoverToolMapping(tool);
|
|
327
|
-
if (discovered) {
|
|
328
|
-
mappings.push(discovered);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
return mappings;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Try to discover a mapping for a single tool
|
|
337
|
-
*/
|
|
338
|
-
function discoverToolMapping(tool: McpTool): ToolMapping | null {
|
|
339
|
-
const name = tool.name.toLowerCase();
|
|
340
|
-
const desc = (tool.description ?? '').toLowerCase();
|
|
341
|
-
|
|
342
|
-
// Issue tracker patterns
|
|
343
|
-
if (matchesPatterns(name, desc, ['issue', 'ticket', 'bug', 'task'])) {
|
|
344
|
-
return discoverIssueTrackerMapping(tool);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// Git provider patterns
|
|
348
|
-
if (matchesPatterns(name, desc, ['pull_request', 'pr', 'merge', 'branch', 'commit', 'review'])) {
|
|
349
|
-
return discoverGitMapping(tool);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// Documentation patterns
|
|
353
|
-
if (matchesPatterns(name, desc, ['page', 'doc', 'wiki', 'content', 'article'])) {
|
|
354
|
-
return discoverDocumentationMapping(tool);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// State/filesystem patterns
|
|
358
|
-
if (matchesPatterns(name, desc, ['file', 'directory', 'folder', 'read', 'write', 'path'])) {
|
|
359
|
-
return discoverStateMapping(tool);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return null;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Check if name or description matches any patterns
|
|
367
|
-
*/
|
|
368
|
-
function matchesPatterns(name: string, description: string, patterns: string[]): boolean {
|
|
369
|
-
return patterns.some((p) => name.includes(p) || description.includes(p));
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Discover issue tracker mapping
|
|
374
|
-
*/
|
|
375
|
-
function discoverIssueTrackerMapping(tool: McpTool): ToolMapping | null {
|
|
376
|
-
const name = tool.name.toLowerCase();
|
|
377
|
-
|
|
378
|
-
const methodPatterns: Record<string, string> = {
|
|
379
|
-
get_issue: 'getIssue',
|
|
380
|
-
get_ticket: 'getIssue',
|
|
381
|
-
list_issues: 'listIssues',
|
|
382
|
-
search_issues: 'listIssues',
|
|
383
|
-
create_issue: 'createIssue',
|
|
384
|
-
create_ticket: 'createIssue',
|
|
385
|
-
update_issue: 'updateIssue',
|
|
386
|
-
transition_issue: 'transitionIssue',
|
|
387
|
-
move_issue: 'transitionIssue',
|
|
388
|
-
add_comment: 'addComment',
|
|
389
|
-
comment_issue: 'addComment',
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
for (const [pattern, method] of Object.entries(methodPatterns)) {
|
|
393
|
-
if (name.includes(pattern) || name === pattern.replace(/_/g, '')) {
|
|
394
|
-
return {
|
|
395
|
-
toolName: tool.name,
|
|
396
|
-
adapterType: 'issue_tracker',
|
|
397
|
-
method,
|
|
398
|
-
confidence: 0.7,
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return null;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Discover git provider mapping
|
|
408
|
-
*/
|
|
409
|
-
function discoverGitMapping(tool: McpTool): ToolMapping | null {
|
|
410
|
-
const name = tool.name.toLowerCase();
|
|
411
|
-
|
|
412
|
-
const methodPatterns: Record<string, string> = {
|
|
413
|
-
get_pull_request: 'getPullRequest',
|
|
414
|
-
get_pr: 'getPullRequest',
|
|
415
|
-
list_pull_requests: 'listPullRequests',
|
|
416
|
-
list_prs: 'listPullRequests',
|
|
417
|
-
create_pull_request: 'createPullRequest',
|
|
418
|
-
create_pr: 'createPullRequest',
|
|
419
|
-
merge_pull_request: 'mergePullRequest',
|
|
420
|
-
merge_pr: 'mergePullRequest',
|
|
421
|
-
add_review: 'addReview',
|
|
422
|
-
create_review: 'addReview',
|
|
423
|
-
request_reviewers: 'requestReviewers',
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
for (const [pattern, method] of Object.entries(methodPatterns)) {
|
|
427
|
-
if (name.includes(pattern) || name === pattern.replace(/_/g, '')) {
|
|
428
|
-
return {
|
|
429
|
-
toolName: tool.name,
|
|
430
|
-
adapterType: 'git',
|
|
431
|
-
method,
|
|
432
|
-
confidence: 0.7,
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
return null;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Discover documentation provider mapping
|
|
442
|
-
*/
|
|
443
|
-
function discoverDocumentationMapping(tool: McpTool): ToolMapping | null {
|
|
444
|
-
const name = tool.name.toLowerCase();
|
|
445
|
-
|
|
446
|
-
const methodPatterns: Record<string, string> = {
|
|
447
|
-
get_page: 'getPage',
|
|
448
|
-
get_doc: 'getPage',
|
|
449
|
-
get_page_content: 'getPageContent',
|
|
450
|
-
get_content: 'getPageContent',
|
|
451
|
-
search_pages: 'searchPages',
|
|
452
|
-
search_docs: 'searchPages',
|
|
453
|
-
list_pages: 'listPages',
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
for (const [pattern, method] of Object.entries(methodPatterns)) {
|
|
457
|
-
if (name.includes(pattern) || name === pattern.replace(/_/g, '')) {
|
|
458
|
-
return {
|
|
459
|
-
toolName: tool.name,
|
|
460
|
-
adapterType: 'documentation',
|
|
461
|
-
method,
|
|
462
|
-
confidence: 0.7,
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
return null;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Discover state provider mapping
|
|
472
|
-
*/
|
|
473
|
-
function discoverStateMapping(tool: McpTool): ToolMapping | null {
|
|
474
|
-
const name = tool.name.toLowerCase();
|
|
475
|
-
|
|
476
|
-
const methodPatterns: Record<string, string> = {
|
|
477
|
-
read_file: 'read',
|
|
478
|
-
read: 'read',
|
|
479
|
-
get_file: 'read',
|
|
480
|
-
write_file: 'write',
|
|
481
|
-
write: 'write',
|
|
482
|
-
save_file: 'write',
|
|
483
|
-
list_directory: 'list',
|
|
484
|
-
list_files: 'list',
|
|
485
|
-
ls: 'list',
|
|
486
|
-
delete_file: 'delete',
|
|
487
|
-
remove_file: 'delete',
|
|
488
|
-
create_directory: 'mkdir',
|
|
489
|
-
mkdir: 'mkdir',
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
for (const [pattern, method] of Object.entries(methodPatterns)) {
|
|
493
|
-
if (name.includes(pattern) || name === pattern.replace(/_/g, '')) {
|
|
494
|
-
return {
|
|
495
|
-
toolName: tool.name,
|
|
496
|
-
adapterType: 'state',
|
|
497
|
-
method,
|
|
498
|
-
confidence: 0.7,
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
return null;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Get all mappings for a server (known + auto-discovered)
|
|
508
|
-
*/
|
|
509
|
-
export function getMappingsForServer(serverName: string, tools: McpTool[]): ToolMapping[] {
|
|
510
|
-
// First try known mappings
|
|
511
|
-
const knownMappings = findKnownServerMappings(serverName);
|
|
512
|
-
|
|
513
|
-
if (knownMappings.length > 0) {
|
|
514
|
-
// Filter to only tools that exist
|
|
515
|
-
const toolNames = new Set(tools.map((t) => t.name));
|
|
516
|
-
return knownMappings.filter((m) => toolNames.has(m.toolName));
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// Fall back to auto-discovery
|
|
520
|
-
return autoDiscoverMappings(tools);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Group mappings by adapter type
|
|
525
|
-
*/
|
|
526
|
-
export function groupMappingsByAdapter(mappings: ToolMapping[]): Map<AdapterType, ToolMapping[]> {
|
|
527
|
-
const grouped = new Map<AdapterType, ToolMapping[]>();
|
|
528
|
-
|
|
529
|
-
for (const mapping of mappings) {
|
|
530
|
-
const existing = grouped.get(mapping.adapterType) ?? [];
|
|
531
|
-
existing.push(mapping);
|
|
532
|
-
grouped.set(mapping.adapterType, existing);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return grouped;
|
|
536
|
-
}
|