@adhisang/minecraft-modding-mcp 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +139 -30
- package/dist/cache-registry.d.ts +95 -0
- package/dist/cache-registry.js +541 -0
- package/dist/cli.js +31 -4
- package/dist/compat-stdio-transport.d.ts +2 -7
- package/dist/compat-stdio-transport.js +12 -154
- package/dist/entry-tools/analyze-mod-service.d.ts +207 -0
- package/dist/entry-tools/analyze-mod-service.js +253 -0
- package/dist/entry-tools/analyze-symbol-service.d.ts +209 -0
- package/dist/entry-tools/analyze-symbol-service.js +304 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +210 -0
- package/dist/entry-tools/compare-minecraft-service.js +397 -0
- package/dist/entry-tools/entry-tool-schema.d.ts +6 -0
- package/dist/entry-tools/entry-tool-schema.js +10 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +1953 -0
- package/dist/entry-tools/inspect-minecraft-service.js +876 -0
- package/dist/entry-tools/manage-cache-service.d.ts +130 -0
- package/dist/entry-tools/manage-cache-service.js +229 -0
- package/dist/entry-tools/request-normalizers.d.ts +10 -0
- package/dist/entry-tools/request-normalizers.js +36 -0
- package/dist/entry-tools/response-contract.d.ts +44 -0
- package/dist/entry-tools/response-contract.js +96 -0
- package/dist/entry-tools/validate-project-service.d.ts +543 -0
- package/dist/entry-tools/validate-project-service.js +381 -0
- package/dist/index.js +495 -42
- package/dist/json-rpc-framing.d.ts +22 -0
- package/dist/json-rpc-framing.js +168 -0
- package/dist/mapping-pipeline-service.js +9 -1
- package/dist/mapping-service.d.ts +9 -0
- package/dist/mapping-service.js +183 -60
- package/dist/minecraft-explorer-service.d.ts +0 -1
- package/dist/minecraft-explorer-service.js +119 -23
- package/dist/mixin-validator.d.ts +24 -2
- package/dist/mixin-validator.js +223 -98
- package/dist/mod-decompile-service.d.ts +5 -0
- package/dist/mod-decompile-service.js +40 -5
- package/dist/mod-remap-service.js +142 -30
- package/dist/path-resolver.js +41 -4
- package/dist/registry-service.d.ts +10 -1
- package/dist/registry-service.js +154 -22
- package/dist/search-hit-accumulator.js +23 -2
- package/dist/source-jar-reader.js +16 -2
- package/dist/source-resolver.js +6 -7
- package/dist/source-service.d.ts +42 -4
- package/dist/source-service.js +781 -127
- package/dist/stdio-supervisor.d.ts +46 -0
- package/dist/stdio-supervisor.js +349 -0
- package/dist/storage/files-repo.d.ts +3 -9
- package/dist/storage/files-repo.js +66 -43
- package/dist/symbols/symbol-extractor.js +6 -4
- package/dist/tool-execution-gate.d.ts +15 -0
- package/dist/tool-execution-gate.js +58 -0
- package/dist/version-diff-service.js +10 -5
- package/dist/version-service.js +7 -2
- package/dist/workspace-mapping-service.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CheckSymbolExistsOutput, FindMappingOutput, GetClassApiMatrixOutput, ResolveMethodMappingExactOutput, ResolveWorkspaceSymbolOutput, TraceSymbolLifecycleOutput } from "../source-service.js";
|
|
3
|
+
export declare const analyzeSymbolShape: {
|
|
4
|
+
task: z.ZodEnum<["exists", "map", "exact-map", "lifecycle", "workspace", "api-overview"]>;
|
|
5
|
+
subject: z.ZodObject<{
|
|
6
|
+
kind: z.ZodEnum<["class", "method", "field", "symbol"]>;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
9
|
+
descriptor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
12
|
+
name: string;
|
|
13
|
+
owner?: string | undefined;
|
|
14
|
+
descriptor?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
17
|
+
name: string;
|
|
18
|
+
owner?: string | undefined;
|
|
19
|
+
descriptor?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
version: z.ZodOptional<z.ZodString>;
|
|
22
|
+
sourceMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
23
|
+
targetMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
24
|
+
classNameMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
25
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
26
|
+
signatureMode: z.ZodOptional<z.ZodEnum<["exact", "name-only"]>>;
|
|
27
|
+
nameMode: z.ZodOptional<z.ZodEnum<["fqcn", "auto"]>>;
|
|
28
|
+
includeKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["class", "field", "method"]>, "many">>;
|
|
29
|
+
maxRows: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
maxCandidates: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
32
|
+
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
33
|
+
};
|
|
34
|
+
export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
35
|
+
task: z.ZodEnum<["exists", "map", "exact-map", "lifecycle", "workspace", "api-overview"]>;
|
|
36
|
+
subject: z.ZodObject<{
|
|
37
|
+
kind: z.ZodEnum<["class", "method", "field", "symbol"]>;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
40
|
+
descriptor: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
43
|
+
name: string;
|
|
44
|
+
owner?: string | undefined;
|
|
45
|
+
descriptor?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
48
|
+
name: string;
|
|
49
|
+
owner?: string | undefined;
|
|
50
|
+
descriptor?: string | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
version: z.ZodOptional<z.ZodString>;
|
|
53
|
+
sourceMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
54
|
+
targetMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
55
|
+
classNameMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
56
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
57
|
+
signatureMode: z.ZodOptional<z.ZodEnum<["exact", "name-only"]>>;
|
|
58
|
+
nameMode: z.ZodOptional<z.ZodEnum<["fqcn", "auto"]>>;
|
|
59
|
+
includeKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["class", "field", "method"]>, "many">>;
|
|
60
|
+
maxRows: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
maxCandidates: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
63
|
+
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
66
|
+
subject: {
|
|
67
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
68
|
+
name: string;
|
|
69
|
+
owner?: string | undefined;
|
|
70
|
+
descriptor?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
projectPath?: string | undefined;
|
|
73
|
+
version?: string | undefined;
|
|
74
|
+
sourceMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
75
|
+
targetMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
76
|
+
classNameMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
77
|
+
nameMode?: "auto" | "fqcn" | undefined;
|
|
78
|
+
detail?: "full" | "summary" | "standard" | undefined;
|
|
79
|
+
include?: string[] | undefined;
|
|
80
|
+
signatureMode?: "exact" | "name-only" | undefined;
|
|
81
|
+
includeKinds?: ("class" | "method" | "field")[] | undefined;
|
|
82
|
+
maxRows?: number | undefined;
|
|
83
|
+
maxCandidates?: number | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
86
|
+
subject: {
|
|
87
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
88
|
+
name: string;
|
|
89
|
+
owner?: string | undefined;
|
|
90
|
+
descriptor?: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
projectPath?: string | undefined;
|
|
93
|
+
version?: string | undefined;
|
|
94
|
+
sourceMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
95
|
+
targetMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
96
|
+
classNameMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
97
|
+
nameMode?: "auto" | "fqcn" | undefined;
|
|
98
|
+
detail?: "full" | "summary" | "standard" | undefined;
|
|
99
|
+
include?: string[] | undefined;
|
|
100
|
+
signatureMode?: "exact" | "name-only" | undefined;
|
|
101
|
+
includeKinds?: ("class" | "method" | "field")[] | undefined;
|
|
102
|
+
maxRows?: number | undefined;
|
|
103
|
+
maxCandidates?: number | undefined;
|
|
104
|
+
}>, {
|
|
105
|
+
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
106
|
+
subject: {
|
|
107
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
108
|
+
name: string;
|
|
109
|
+
owner?: string | undefined;
|
|
110
|
+
descriptor?: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
projectPath?: string | undefined;
|
|
113
|
+
version?: string | undefined;
|
|
114
|
+
sourceMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
115
|
+
targetMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
116
|
+
classNameMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
117
|
+
nameMode?: "auto" | "fqcn" | undefined;
|
|
118
|
+
detail?: "full" | "summary" | "standard" | undefined;
|
|
119
|
+
include?: string[] | undefined;
|
|
120
|
+
signatureMode?: "exact" | "name-only" | undefined;
|
|
121
|
+
includeKinds?: ("class" | "method" | "field")[] | undefined;
|
|
122
|
+
maxRows?: number | undefined;
|
|
123
|
+
maxCandidates?: number | undefined;
|
|
124
|
+
}, {
|
|
125
|
+
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
126
|
+
subject: {
|
|
127
|
+
kind: "symbol" | "class" | "method" | "field";
|
|
128
|
+
name: string;
|
|
129
|
+
owner?: string | undefined;
|
|
130
|
+
descriptor?: string | undefined;
|
|
131
|
+
};
|
|
132
|
+
projectPath?: string | undefined;
|
|
133
|
+
version?: string | undefined;
|
|
134
|
+
sourceMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
135
|
+
targetMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
136
|
+
classNameMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
137
|
+
nameMode?: "auto" | "fqcn" | undefined;
|
|
138
|
+
detail?: "full" | "summary" | "standard" | undefined;
|
|
139
|
+
include?: string[] | undefined;
|
|
140
|
+
signatureMode?: "exact" | "name-only" | undefined;
|
|
141
|
+
includeKinds?: ("class" | "method" | "field")[] | undefined;
|
|
142
|
+
maxRows?: number | undefined;
|
|
143
|
+
maxCandidates?: number | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
export type AnalyzeSymbolInput = z.infer<typeof analyzeSymbolSchema>;
|
|
146
|
+
type AnalyzeSymbolDeps = {
|
|
147
|
+
checkSymbolExists: (input: {
|
|
148
|
+
version: string;
|
|
149
|
+
kind: "class" | "field" | "method";
|
|
150
|
+
name: string;
|
|
151
|
+
owner?: string;
|
|
152
|
+
descriptor?: string;
|
|
153
|
+
sourceMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
154
|
+
sourcePriority?: "loom-first" | "maven-first";
|
|
155
|
+
nameMode?: "fqcn" | "auto";
|
|
156
|
+
signatureMode?: "exact" | "name-only";
|
|
157
|
+
maxCandidates?: number;
|
|
158
|
+
}) => Promise<CheckSymbolExistsOutput>;
|
|
159
|
+
findMapping: (input: {
|
|
160
|
+
version: string;
|
|
161
|
+
kind: "class" | "field" | "method";
|
|
162
|
+
name: string;
|
|
163
|
+
owner?: string;
|
|
164
|
+
descriptor?: string;
|
|
165
|
+
sourceMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
166
|
+
targetMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
167
|
+
signatureMode?: "exact" | "name-only";
|
|
168
|
+
maxCandidates?: number;
|
|
169
|
+
}) => Promise<FindMappingOutput>;
|
|
170
|
+
resolveMethodMappingExact: (input: {
|
|
171
|
+
version: string;
|
|
172
|
+
owner: string;
|
|
173
|
+
name: string;
|
|
174
|
+
descriptor: string;
|
|
175
|
+
sourceMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
176
|
+
targetMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
177
|
+
maxCandidates?: number;
|
|
178
|
+
}) => Promise<ResolveMethodMappingExactOutput>;
|
|
179
|
+
traceSymbolLifecycle: (input: {
|
|
180
|
+
symbol: string;
|
|
181
|
+
descriptor?: string;
|
|
182
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
183
|
+
}) => Promise<TraceSymbolLifecycleOutput>;
|
|
184
|
+
resolveWorkspaceSymbol: (input: {
|
|
185
|
+
projectPath: string;
|
|
186
|
+
version: string;
|
|
187
|
+
kind: "class" | "field" | "method";
|
|
188
|
+
name: string;
|
|
189
|
+
owner?: string;
|
|
190
|
+
descriptor?: string;
|
|
191
|
+
sourceMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
192
|
+
maxCandidates?: number;
|
|
193
|
+
}) => Promise<ResolveWorkspaceSymbolOutput>;
|
|
194
|
+
getClassApiMatrix: (input: {
|
|
195
|
+
version: string;
|
|
196
|
+
className: string;
|
|
197
|
+
classNameMapping: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
198
|
+
includeKinds?: ("class" | "field" | "method")[];
|
|
199
|
+
maxRows?: number;
|
|
200
|
+
}) => Promise<GetClassApiMatrixOutput>;
|
|
201
|
+
};
|
|
202
|
+
export declare class AnalyzeSymbolService {
|
|
203
|
+
private readonly deps;
|
|
204
|
+
constructor(deps: AnalyzeSymbolDeps);
|
|
205
|
+
execute(input: AnalyzeSymbolInput): Promise<Record<string, unknown> & {
|
|
206
|
+
warnings?: string[];
|
|
207
|
+
}>;
|
|
208
|
+
}
|
|
209
|
+
export {};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createError, ERROR_CODES } from "../errors.js";
|
|
3
|
+
import { buildIncludeSchema, detailSchema, positiveIntSchema } from "./entry-tool-schema.js";
|
|
4
|
+
import { buildEntryToolResult } from "./response-contract.js";
|
|
5
|
+
import { resolveDetail, resolveInclude } from "./request-normalizers.js";
|
|
6
|
+
const nonEmptyString = z.string().trim().min(1);
|
|
7
|
+
const INCLUDE_GROUPS = ["warnings", "candidates", "matrix", "workspace", "timings"];
|
|
8
|
+
const TASKS = ["exists", "map", "exact-map", "lifecycle", "workspace", "api-overview"];
|
|
9
|
+
export const analyzeSymbolShape = {
|
|
10
|
+
task: z.enum(TASKS),
|
|
11
|
+
subject: z.object({
|
|
12
|
+
kind: z.enum(["class", "method", "field", "symbol"]),
|
|
13
|
+
name: nonEmptyString,
|
|
14
|
+
owner: nonEmptyString.optional(),
|
|
15
|
+
descriptor: nonEmptyString.optional()
|
|
16
|
+
}),
|
|
17
|
+
version: nonEmptyString.optional(),
|
|
18
|
+
sourceMapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
19
|
+
targetMapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
20
|
+
classNameMapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
21
|
+
projectPath: nonEmptyString.optional(),
|
|
22
|
+
signatureMode: z.enum(["exact", "name-only"]).optional(),
|
|
23
|
+
nameMode: z.enum(["fqcn", "auto"]).optional(),
|
|
24
|
+
includeKinds: z.array(z.enum(["class", "field", "method"])).optional(),
|
|
25
|
+
maxRows: positiveIntSchema.optional(),
|
|
26
|
+
maxCandidates: positiveIntSchema.optional(),
|
|
27
|
+
detail: detailSchema.optional(),
|
|
28
|
+
include: buildIncludeSchema(INCLUDE_GROUPS)
|
|
29
|
+
};
|
|
30
|
+
export const analyzeSymbolSchema = z.object(analyzeSymbolShape).superRefine((value, ctx) => {
|
|
31
|
+
if (value.task !== "workspace" && !value.version) {
|
|
32
|
+
ctx.addIssue({
|
|
33
|
+
code: z.ZodIssueCode.custom,
|
|
34
|
+
path: ["version"],
|
|
35
|
+
message: "version is required for non-workspace tasks."
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (value.task === "workspace" && !value.projectPath) {
|
|
39
|
+
ctx.addIssue({
|
|
40
|
+
code: z.ZodIssueCode.custom,
|
|
41
|
+
path: ["projectPath"],
|
|
42
|
+
message: "projectPath is required for task=workspace."
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (value.task === "api-overview" && value.subject.kind !== "class") {
|
|
46
|
+
ctx.addIssue({
|
|
47
|
+
code: z.ZodIssueCode.custom,
|
|
48
|
+
path: ["subject", "kind"],
|
|
49
|
+
message: "task=api-overview requires subject.kind=class."
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (value.task === "api-overview" && value.subject.owner) {
|
|
53
|
+
ctx.addIssue({
|
|
54
|
+
code: z.ZodIssueCode.custom,
|
|
55
|
+
path: ["subject", "owner"],
|
|
56
|
+
message: "task=api-overview does not accept owner or descriptor selectors."
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (value.task === "api-overview" && value.subject.descriptor) {
|
|
60
|
+
ctx.addIssue({
|
|
61
|
+
code: z.ZodIssueCode.custom,
|
|
62
|
+
path: ["subject", "descriptor"],
|
|
63
|
+
message: "task=api-overview does not accept owner or descriptor selectors."
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function summaryStatusFromResolution(status) {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case "resolved":
|
|
70
|
+
return "ok";
|
|
71
|
+
case "not_found":
|
|
72
|
+
return "not_found";
|
|
73
|
+
case "ambiguous":
|
|
74
|
+
return "ambiguous";
|
|
75
|
+
case "mapping_unavailable":
|
|
76
|
+
return "partial";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export class AnalyzeSymbolService {
|
|
80
|
+
deps;
|
|
81
|
+
constructor(deps) {
|
|
82
|
+
this.deps = deps;
|
|
83
|
+
}
|
|
84
|
+
async execute(input) {
|
|
85
|
+
const detail = resolveDetail(input.detail);
|
|
86
|
+
const include = resolveInclude(input.include);
|
|
87
|
+
const subjectKind = input.subject.kind === "symbol"
|
|
88
|
+
? "class"
|
|
89
|
+
: input.subject.kind;
|
|
90
|
+
switch (input.task) {
|
|
91
|
+
case "exists": {
|
|
92
|
+
const output = await this.deps.checkSymbolExists({
|
|
93
|
+
version: input.version,
|
|
94
|
+
kind: subjectKind,
|
|
95
|
+
name: input.subject.name,
|
|
96
|
+
owner: input.subject.owner,
|
|
97
|
+
descriptor: input.subject.descriptor,
|
|
98
|
+
sourceMapping: input.sourceMapping ?? "obfuscated",
|
|
99
|
+
nameMode: input.nameMode,
|
|
100
|
+
signatureMode: input.signatureMode,
|
|
101
|
+
maxCandidates: input.maxCandidates
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
...buildEntryToolResult({
|
|
105
|
+
task: "exists",
|
|
106
|
+
detail,
|
|
107
|
+
include,
|
|
108
|
+
summary: {
|
|
109
|
+
status: summaryStatusFromResolution(output.status),
|
|
110
|
+
headline: output.resolved
|
|
111
|
+
? `The symbol exists in ${output.mappingContext.version}.`
|
|
112
|
+
: `The symbol could not be resolved in ${output.mappingContext.version}.`,
|
|
113
|
+
counts: {
|
|
114
|
+
candidates: output.candidateCount
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
blocks: {
|
|
118
|
+
match: output.resolvedSymbol ?? output.querySymbol,
|
|
119
|
+
candidates: output.candidates,
|
|
120
|
+
ambiguity: output.ambiguityReasons ? { reasons: output.ambiguityReasons } : undefined
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
warnings: output.warnings
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
case "map": {
|
|
127
|
+
const output = await this.deps.findMapping({
|
|
128
|
+
version: input.version,
|
|
129
|
+
kind: subjectKind,
|
|
130
|
+
name: input.subject.name,
|
|
131
|
+
owner: input.subject.owner,
|
|
132
|
+
descriptor: input.subject.descriptor,
|
|
133
|
+
sourceMapping: input.sourceMapping ?? "obfuscated",
|
|
134
|
+
targetMapping: input.targetMapping ?? "mojang",
|
|
135
|
+
signatureMode: input.signatureMode,
|
|
136
|
+
maxCandidates: input.maxCandidates
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
...buildEntryToolResult({
|
|
140
|
+
task: "map",
|
|
141
|
+
detail,
|
|
142
|
+
include,
|
|
143
|
+
summary: {
|
|
144
|
+
status: summaryStatusFromResolution(output.status),
|
|
145
|
+
headline: output.resolved
|
|
146
|
+
? `Mapped the symbol into ${output.mappingContext.targetMapping}.`
|
|
147
|
+
: `Found ${output.candidateCount} candidate mappings.`,
|
|
148
|
+
counts: {
|
|
149
|
+
candidates: output.candidateCount
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
blocks: {
|
|
153
|
+
match: output.resolvedSymbol,
|
|
154
|
+
candidates: output.candidates,
|
|
155
|
+
ambiguity: output.ambiguityReasons ? { reasons: output.ambiguityReasons } : undefined
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
warnings: output.warnings
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
case "exact-map": {
|
|
162
|
+
if (!input.subject.owner || !input.subject.descriptor) {
|
|
163
|
+
throw createError({
|
|
164
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
165
|
+
message: "task=exact-map requires owner and descriptor."
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const output = await this.deps.resolveMethodMappingExact({
|
|
169
|
+
version: input.version,
|
|
170
|
+
owner: input.subject.owner,
|
|
171
|
+
name: input.subject.name,
|
|
172
|
+
descriptor: input.subject.descriptor,
|
|
173
|
+
sourceMapping: input.sourceMapping ?? "obfuscated",
|
|
174
|
+
targetMapping: input.targetMapping ?? "mojang",
|
|
175
|
+
maxCandidates: input.maxCandidates
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
...buildEntryToolResult({
|
|
179
|
+
task: "exact-map",
|
|
180
|
+
detail,
|
|
181
|
+
include,
|
|
182
|
+
summary: {
|
|
183
|
+
status: summaryStatusFromResolution(output.status),
|
|
184
|
+
headline: output.resolved
|
|
185
|
+
? "Resolved the exact method mapping."
|
|
186
|
+
: "Could not resolve the exact method mapping.",
|
|
187
|
+
counts: {
|
|
188
|
+
candidates: output.candidateCount
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
blocks: {
|
|
192
|
+
match: output.resolvedSymbol,
|
|
193
|
+
candidates: output.candidates
|
|
194
|
+
}
|
|
195
|
+
}),
|
|
196
|
+
warnings: output.warnings
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
case "lifecycle": {
|
|
200
|
+
const output = await this.deps.traceSymbolLifecycle({
|
|
201
|
+
symbol: input.subject.owner
|
|
202
|
+
? `${input.subject.owner}.${input.subject.name}`
|
|
203
|
+
: input.subject.name,
|
|
204
|
+
descriptor: input.subject.descriptor,
|
|
205
|
+
mapping: input.sourceMapping
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
...buildEntryToolResult({
|
|
209
|
+
task: "lifecycle",
|
|
210
|
+
detail,
|
|
211
|
+
include,
|
|
212
|
+
summary: {
|
|
213
|
+
status: output.presence.firstSeen ? "ok" : "not_found",
|
|
214
|
+
headline: output.presence.firstSeen
|
|
215
|
+
? `Tracked the symbol from ${output.range.fromVersion} to ${output.range.toVersion}.`
|
|
216
|
+
: "The symbol was not found in the scanned version range.",
|
|
217
|
+
counts: {
|
|
218
|
+
scannedVersions: output.range.scannedCount
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
blocks: {
|
|
222
|
+
match: output.query,
|
|
223
|
+
timeline: output.timeline
|
|
224
|
+
}
|
|
225
|
+
}),
|
|
226
|
+
warnings: output.warnings
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
case "workspace": {
|
|
230
|
+
const output = await this.deps.resolveWorkspaceSymbol({
|
|
231
|
+
projectPath: input.projectPath,
|
|
232
|
+
version: input.version ?? "unknown",
|
|
233
|
+
kind: subjectKind,
|
|
234
|
+
name: input.subject.name,
|
|
235
|
+
owner: input.subject.owner,
|
|
236
|
+
descriptor: input.subject.descriptor,
|
|
237
|
+
sourceMapping: input.sourceMapping ?? "obfuscated",
|
|
238
|
+
maxCandidates: input.maxCandidates
|
|
239
|
+
});
|
|
240
|
+
return {
|
|
241
|
+
...buildEntryToolResult({
|
|
242
|
+
task: "workspace",
|
|
243
|
+
detail,
|
|
244
|
+
include,
|
|
245
|
+
summary: {
|
|
246
|
+
status: summaryStatusFromResolution(output.status),
|
|
247
|
+
headline: output.workspaceDetection.resolved
|
|
248
|
+
? `Resolved compile-visible symbol using ${output.workspaceDetection.mappingApplied} workspace mappings.`
|
|
249
|
+
: "Workspace compile mapping could not be detected confidently.",
|
|
250
|
+
counts: {
|
|
251
|
+
candidates: output.candidateCount
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
blocks: {
|
|
255
|
+
match: output.resolvedSymbol,
|
|
256
|
+
candidates: output.candidates,
|
|
257
|
+
workspace: output.workspaceDetection
|
|
258
|
+
}
|
|
259
|
+
}),
|
|
260
|
+
warnings: [...output.warnings, ...output.workspaceDetection.warnings]
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
case "api-overview": {
|
|
264
|
+
const output = await this.deps.getClassApiMatrix({
|
|
265
|
+
version: input.version,
|
|
266
|
+
className: input.subject.name,
|
|
267
|
+
classNameMapping: input.classNameMapping ?? "obfuscated",
|
|
268
|
+
includeKinds: input.includeKinds,
|
|
269
|
+
maxRows: input.maxRows
|
|
270
|
+
});
|
|
271
|
+
return {
|
|
272
|
+
...buildEntryToolResult({
|
|
273
|
+
task: "api-overview",
|
|
274
|
+
detail,
|
|
275
|
+
include,
|
|
276
|
+
summary: {
|
|
277
|
+
status: "ok",
|
|
278
|
+
headline: `Built an API overview for ${output.className}.`,
|
|
279
|
+
counts: {
|
|
280
|
+
rows: output.rowCount,
|
|
281
|
+
ambiguousRows: output.ambiguousRowCount ?? 0
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
blocks: {
|
|
285
|
+
match: {
|
|
286
|
+
className: output.className,
|
|
287
|
+
classIdentity: output.classIdentity
|
|
288
|
+
},
|
|
289
|
+
matrix: include.includes("matrix") || detail !== "summary"
|
|
290
|
+
? {
|
|
291
|
+
rowCount: output.rowCount,
|
|
292
|
+
rowsTruncated: output.rowsTruncated,
|
|
293
|
+
rows: output.rows.slice(0, 25)
|
|
294
|
+
}
|
|
295
|
+
: undefined
|
|
296
|
+
}
|
|
297
|
+
}),
|
|
298
|
+
warnings: output.warnings
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=analyze-symbol-service.js.map
|