@adhisang/minecraft-modding-mcp 3.0.0 → 3.1.1
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 +52 -29
- package/README.md +209 -849
- package/dist/config.js +19 -11
- package/dist/entry-tools/analyze-mod-service.d.ts +16 -16
- package/dist/entry-tools/analyze-mod-service.js +69 -13
- package/dist/entry-tools/analyze-symbol-service.d.ts +14 -12
- package/dist/entry-tools/analyze-symbol-service.js +64 -6
- package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
- package/dist/entry-tools/compare-minecraft-service.js +58 -26
- package/dist/entry-tools/inspect-minecraft-service.d.ts +37 -19
- package/dist/entry-tools/inspect-minecraft-service.js +468 -51
- package/dist/entry-tools/manage-cache-service.d.ts +6 -6
- package/dist/entry-tools/manage-cache-service.js +40 -5
- package/dist/entry-tools/response-contract.d.ts +1 -0
- package/dist/entry-tools/response-contract.js +3 -0
- package/dist/entry-tools/validate-project-service.d.ts +24 -24
- package/dist/entry-tools/validate-project-service.js +40 -7
- package/dist/index.js +290 -51
- package/dist/mapping-service.d.ts +1 -0
- package/dist/mapping-service.js +55 -34
- package/dist/observability.d.ts +18 -2
- package/dist/observability.js +47 -10
- package/dist/source-service.d.ts +2 -1
- package/dist/source-service.js +206 -112
- package/dist/storage/files-repo.d.ts +1 -0
- package/dist/storage/files-repo.js +29 -5
- package/dist/tool-contract-manifest.d.ts +4 -0
- package/dist/tool-contract-manifest.js +137 -0
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -52,6 +52,17 @@ function expandHome(pathValue) {
|
|
|
52
52
|
const withoutTilde = pathValue.startsWith("~/") ? pathValue.slice(2) : pathValue.slice(1);
|
|
53
53
|
return resolve(homedir(), withoutTilde);
|
|
54
54
|
}
|
|
55
|
+
function normalizeOptionalPathEnvValue(pathValue) {
|
|
56
|
+
if (!pathValue) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const trimmed = pathValue.trim();
|
|
60
|
+
if (!trimmed) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const normalized = trimmed.toLowerCase();
|
|
64
|
+
return normalized === "undefined" || normalized === "null" ? undefined : trimmed;
|
|
65
|
+
}
|
|
55
66
|
function normalizePath(pathValue, field) {
|
|
56
67
|
const expanded = expandHome(pathValue.trim());
|
|
57
68
|
const normalizedForHost = normalizePathForHost(expanded, undefined, field);
|
|
@@ -120,14 +131,11 @@ function parseMappingSourcePriority(envValue) {
|
|
|
120
131
|
return DEFAULTS.mappingSourcePriority;
|
|
121
132
|
}
|
|
122
133
|
function parseOptionalJarPath(envValue, field) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
130
|
-
return normalizePath(trimmed, field);
|
|
134
|
+
const trimmed = normalizeOptionalPathEnvValue(envValue);
|
|
135
|
+
return trimmed ? normalizePath(trimmed, field) : undefined;
|
|
136
|
+
}
|
|
137
|
+
function parseRequiredPath(envValue, fallback, field) {
|
|
138
|
+
return normalizePath(normalizeOptionalPathEnvValue(envValue) ?? fallback, field);
|
|
131
139
|
}
|
|
132
140
|
function parseVineflowerPath(envValue) {
|
|
133
141
|
return parseOptionalJarPath(envValue, "MCP_VINEFLOWER_JAR_PATH");
|
|
@@ -137,12 +145,12 @@ function buildArtifactsDirectory(cacheDir) {
|
|
|
137
145
|
return normalizePath(input, "MCP_SQLITE_PATH");
|
|
138
146
|
}
|
|
139
147
|
export function loadConfig() {
|
|
140
|
-
const cacheDir =
|
|
141
|
-
const localM2Path =
|
|
148
|
+
const cacheDir = parseRequiredPath(process.env.MCP_CACHE_DIR, DEFAULTS.cacheDir, "MCP_CACHE_DIR");
|
|
149
|
+
const localM2Path = parseRequiredPath(process.env.MCP_LOCAL_M2, DEFAULTS.localM2Path, "MCP_LOCAL_M2");
|
|
142
150
|
const sourceRepos = parseRepos(process.env.MCP_SOURCE_REPOS);
|
|
143
151
|
return {
|
|
144
152
|
cacheDir,
|
|
145
|
-
sqlitePath:
|
|
153
|
+
sqlitePath: parseRequiredPath(process.env.MCP_SQLITE_PATH, buildArtifactsDirectory(cacheDir), "MCP_SQLITE_PATH"),
|
|
146
154
|
sourceRepos,
|
|
147
155
|
localM2Path,
|
|
148
156
|
vineflowerJarPath: parseVineflowerPath(process.env.MCP_VINEFLOWER_JAR_PATH),
|
|
@@ -25,15 +25,15 @@ export declare const analyzeModShape: {
|
|
|
25
25
|
className: string;
|
|
26
26
|
}>]>;
|
|
27
27
|
query: z.ZodOptional<z.ZodString>;
|
|
28
|
-
searchType: z.
|
|
29
|
-
limit: z.
|
|
30
|
-
includeFiles: z.
|
|
28
|
+
searchType: z.ZodDefault<z.ZodEnum<["class", "method", "field", "content", "all"]>>;
|
|
29
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
includeFiles: z.ZodDefault<z.ZodBoolean>;
|
|
31
31
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
32
32
|
maxLines: z.ZodOptional<z.ZodNumber>;
|
|
33
33
|
maxChars: z.ZodOptional<z.ZodNumber>;
|
|
34
34
|
targetMapping: z.ZodOptional<z.ZodEnum<["yarn", "mojang"]>>;
|
|
35
35
|
outputJar: z.ZodOptional<z.ZodString>;
|
|
36
|
-
executionMode: z.
|
|
36
|
+
executionMode: z.ZodDefault<z.ZodEnum<["preview", "apply"]>>;
|
|
37
37
|
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
38
38
|
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
39
39
|
};
|
|
@@ -62,18 +62,20 @@ export declare const analyzeModSchema: z.ZodEffects<z.ZodObject<{
|
|
|
62
62
|
className: string;
|
|
63
63
|
}>]>;
|
|
64
64
|
query: z.ZodOptional<z.ZodString>;
|
|
65
|
-
searchType: z.
|
|
66
|
-
limit: z.
|
|
67
|
-
includeFiles: z.
|
|
65
|
+
searchType: z.ZodDefault<z.ZodEnum<["class", "method", "field", "content", "all"]>>;
|
|
66
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
67
|
+
includeFiles: z.ZodDefault<z.ZodBoolean>;
|
|
68
68
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
69
69
|
maxLines: z.ZodOptional<z.ZodNumber>;
|
|
70
70
|
maxChars: z.ZodOptional<z.ZodNumber>;
|
|
71
71
|
targetMapping: z.ZodOptional<z.ZodEnum<["yarn", "mojang"]>>;
|
|
72
72
|
outputJar: z.ZodOptional<z.ZodString>;
|
|
73
|
-
executionMode: z.
|
|
73
|
+
executionMode: z.ZodDefault<z.ZodEnum<["preview", "apply"]>>;
|
|
74
74
|
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
75
75
|
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
76
76
|
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
limit: number;
|
|
78
|
+
searchType: "class" | "method" | "field" | "all" | "content";
|
|
77
79
|
task: "search" | "remap" | "summary" | "class-source" | "decompile";
|
|
78
80
|
subject: {
|
|
79
81
|
kind: "jar";
|
|
@@ -83,18 +85,16 @@ export declare const analyzeModSchema: z.ZodEffects<z.ZodObject<{
|
|
|
83
85
|
jarPath: string;
|
|
84
86
|
className: string;
|
|
85
87
|
};
|
|
86
|
-
|
|
88
|
+
includeFiles: boolean;
|
|
89
|
+
executionMode: "preview" | "apply";
|
|
87
90
|
maxLines?: number | undefined;
|
|
88
91
|
maxChars?: number | undefined;
|
|
89
92
|
targetMapping?: "mojang" | "yarn" | undefined;
|
|
90
93
|
outputJar?: string | undefined;
|
|
91
94
|
query?: string | undefined;
|
|
92
|
-
searchType?: "class" | "method" | "field" | "all" | "content" | undefined;
|
|
93
95
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
94
96
|
include?: string[] | undefined;
|
|
95
|
-
includeFiles?: boolean | undefined;
|
|
96
97
|
maxFiles?: number | undefined;
|
|
97
|
-
executionMode?: "preview" | "apply" | undefined;
|
|
98
98
|
}, {
|
|
99
99
|
task: "search" | "remap" | "summary" | "class-source" | "decompile";
|
|
100
100
|
subject: {
|
|
@@ -118,6 +118,8 @@ export declare const analyzeModSchema: z.ZodEffects<z.ZodObject<{
|
|
|
118
118
|
maxFiles?: number | undefined;
|
|
119
119
|
executionMode?: "preview" | "apply" | undefined;
|
|
120
120
|
}>, {
|
|
121
|
+
limit: number;
|
|
122
|
+
searchType: "class" | "method" | "field" | "all" | "content";
|
|
121
123
|
task: "search" | "remap" | "summary" | "class-source" | "decompile";
|
|
122
124
|
subject: {
|
|
123
125
|
kind: "jar";
|
|
@@ -127,18 +129,16 @@ export declare const analyzeModSchema: z.ZodEffects<z.ZodObject<{
|
|
|
127
129
|
jarPath: string;
|
|
128
130
|
className: string;
|
|
129
131
|
};
|
|
130
|
-
|
|
132
|
+
includeFiles: boolean;
|
|
133
|
+
executionMode: "preview" | "apply";
|
|
131
134
|
maxLines?: number | undefined;
|
|
132
135
|
maxChars?: number | undefined;
|
|
133
136
|
targetMapping?: "mojang" | "yarn" | undefined;
|
|
134
137
|
outputJar?: string | undefined;
|
|
135
138
|
query?: string | undefined;
|
|
136
|
-
searchType?: "class" | "method" | "field" | "all" | "content" | undefined;
|
|
137
139
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
138
140
|
include?: string[] | undefined;
|
|
139
|
-
includeFiles?: boolean | undefined;
|
|
140
141
|
maxFiles?: number | undefined;
|
|
141
|
-
executionMode?: "preview" | "apply" | undefined;
|
|
142
142
|
}, {
|
|
143
143
|
task: "search" | "remap" | "summary" | "class-source" | "decompile";
|
|
144
144
|
subject: {
|
|
@@ -4,7 +4,7 @@ import { normalizePathForHost } from "../path-converter.js";
|
|
|
4
4
|
import { createError, ERROR_CODES } from "../errors.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { buildIncludeSchema, detailSchema, executionModeSchema, positiveIntSchema } from "./entry-tool-schema.js";
|
|
7
|
-
import { buildEntryToolResult } from "./response-contract.js";
|
|
7
|
+
import { buildEntryToolResult, createNextAction, createSummarySubject } from "./response-contract.js";
|
|
8
8
|
import { resolveDetail, resolveInclude } from "./request-normalizers.js";
|
|
9
9
|
const nonEmptyString = z.string().trim().min(1);
|
|
10
10
|
const INCLUDE_GROUPS = ["warnings", "files", "source", "samples", "timings"];
|
|
@@ -23,15 +23,15 @@ export const analyzeModShape = {
|
|
|
23
23
|
task: z.enum(["summary", "decompile", "search", "class-source", "remap"]),
|
|
24
24
|
subject: subjectSchema,
|
|
25
25
|
query: nonEmptyString.optional(),
|
|
26
|
-
searchType: z.enum(["class", "method", "field", "content", "all"]).
|
|
27
|
-
limit: positiveIntSchema.
|
|
28
|
-
includeFiles: z.boolean().
|
|
26
|
+
searchType: z.enum(["class", "method", "field", "content", "all"]).default("all"),
|
|
27
|
+
limit: positiveIntSchema.default(50),
|
|
28
|
+
includeFiles: z.boolean().default(true),
|
|
29
29
|
maxFiles: positiveIntSchema.optional(),
|
|
30
30
|
maxLines: positiveIntSchema.optional(),
|
|
31
31
|
maxChars: positiveIntSchema.optional(),
|
|
32
32
|
targetMapping: z.enum(["yarn", "mojang"]).optional(),
|
|
33
33
|
outputJar: nonEmptyString.optional(),
|
|
34
|
-
executionMode: executionModeSchema.
|
|
34
|
+
executionMode: executionModeSchema.default("preview"),
|
|
35
35
|
detail: detailSchema.optional(),
|
|
36
36
|
include: buildIncludeSchema(INCLUDE_GROUPS)
|
|
37
37
|
};
|
|
@@ -89,6 +89,11 @@ export class AnalyzeModService {
|
|
|
89
89
|
summary: {
|
|
90
90
|
status: "ok",
|
|
91
91
|
headline: `Summarized ${analysis.loader} mod metadata.`,
|
|
92
|
+
subject: createSummarySubject({
|
|
93
|
+
task: "summary",
|
|
94
|
+
kind: input.subject.kind,
|
|
95
|
+
jarPath: input.subject.jarPath
|
|
96
|
+
}),
|
|
92
97
|
counts: {
|
|
93
98
|
classes: analysis.classCount,
|
|
94
99
|
dependencies: analysis.dependencies?.length ?? 0
|
|
@@ -102,9 +107,10 @@ export class AnalyzeModService {
|
|
|
102
107
|
};
|
|
103
108
|
}
|
|
104
109
|
case "decompile": {
|
|
110
|
+
const includeFiles = input.includeFiles ?? true;
|
|
105
111
|
const output = await this.deps.decompileModJar({
|
|
106
112
|
jarPath: input.subject.jarPath,
|
|
107
|
-
includeFiles
|
|
113
|
+
includeFiles,
|
|
108
114
|
maxFiles: input.maxFiles
|
|
109
115
|
});
|
|
110
116
|
return {
|
|
@@ -114,7 +120,14 @@ export class AnalyzeModService {
|
|
|
114
120
|
include,
|
|
115
121
|
summary: {
|
|
116
122
|
status: "ok",
|
|
117
|
-
headline: `Decompiled ${input.subject.jarPath}
|
|
123
|
+
headline: `Decompiled ${input.subject.jarPath}.`,
|
|
124
|
+
subject: createSummarySubject({
|
|
125
|
+
task: "decompile",
|
|
126
|
+
kind: input.subject.kind,
|
|
127
|
+
jarPath: input.subject.jarPath,
|
|
128
|
+
includeFiles: includeFiles === true ? undefined : includeFiles,
|
|
129
|
+
maxFiles: input.maxFiles
|
|
130
|
+
})
|
|
118
131
|
},
|
|
119
132
|
blocks: {
|
|
120
133
|
decompile: output
|
|
@@ -124,11 +137,13 @@ export class AnalyzeModService {
|
|
|
124
137
|
};
|
|
125
138
|
}
|
|
126
139
|
case "search": {
|
|
140
|
+
const searchType = input.searchType ?? "all";
|
|
141
|
+
const limit = input.limit ?? 50;
|
|
127
142
|
const output = await this.deps.searchModSource({
|
|
128
143
|
jarPath: input.subject.jarPath,
|
|
129
144
|
query: input.query,
|
|
130
|
-
searchType
|
|
131
|
-
limit
|
|
145
|
+
searchType,
|
|
146
|
+
limit
|
|
132
147
|
});
|
|
133
148
|
return {
|
|
134
149
|
...buildEntryToolResult({
|
|
@@ -137,7 +152,15 @@ export class AnalyzeModService {
|
|
|
137
152
|
include,
|
|
138
153
|
summary: {
|
|
139
154
|
status: "ok",
|
|
140
|
-
headline: `Searched ${input.subject.jarPath} for ${input.query}
|
|
155
|
+
headline: `Searched ${input.subject.jarPath} for ${input.query}.`,
|
|
156
|
+
subject: createSummarySubject({
|
|
157
|
+
task: "search",
|
|
158
|
+
kind: input.subject.kind,
|
|
159
|
+
jarPath: input.subject.jarPath,
|
|
160
|
+
query: input.query,
|
|
161
|
+
searchType: searchType === "all" ? undefined : searchType,
|
|
162
|
+
limit: limit === 50 ? undefined : limit
|
|
163
|
+
})
|
|
141
164
|
},
|
|
142
165
|
blocks: {
|
|
143
166
|
hits: output
|
|
@@ -166,7 +189,15 @@ export class AnalyzeModService {
|
|
|
166
189
|
include,
|
|
167
190
|
summary: {
|
|
168
191
|
status: "ok",
|
|
169
|
-
headline: `Loaded class source for ${input.subject.className}
|
|
192
|
+
headline: `Loaded class source for ${input.subject.className}.`,
|
|
193
|
+
subject: createSummarySubject({
|
|
194
|
+
task: "class-source",
|
|
195
|
+
kind: input.subject.kind,
|
|
196
|
+
jarPath: input.subject.jarPath,
|
|
197
|
+
className: input.subject.className,
|
|
198
|
+
maxLines: input.maxLines,
|
|
199
|
+
maxChars: input.maxChars
|
|
200
|
+
})
|
|
170
201
|
},
|
|
171
202
|
blocks: {
|
|
172
203
|
source: output
|
|
@@ -201,7 +232,25 @@ export class AnalyzeModService {
|
|
|
201
232
|
include,
|
|
202
233
|
summary: {
|
|
203
234
|
status: "unchanged",
|
|
204
|
-
headline: `Previewed remap output for ${normalizedInputJar}
|
|
235
|
+
headline: `Previewed remap output for ${normalizedInputJar}.`,
|
|
236
|
+
subject: createSummarySubject({
|
|
237
|
+
task: "remap",
|
|
238
|
+
kind: input.subject.kind,
|
|
239
|
+
jarPath: normalizedInputJar,
|
|
240
|
+
executionMode: "preview",
|
|
241
|
+
targetMapping: input.targetMapping
|
|
242
|
+
}),
|
|
243
|
+
nextActions: [
|
|
244
|
+
createNextAction("analyze-mod", {
|
|
245
|
+
task: "remap",
|
|
246
|
+
subject: {
|
|
247
|
+
kind: input.subject.kind,
|
|
248
|
+
jarPath: input.subject.jarPath
|
|
249
|
+
},
|
|
250
|
+
executionMode: "apply",
|
|
251
|
+
targetMapping: input.targetMapping
|
|
252
|
+
})
|
|
253
|
+
]
|
|
205
254
|
},
|
|
206
255
|
blocks: {
|
|
207
256
|
metadata: {
|
|
@@ -232,7 +281,14 @@ export class AnalyzeModService {
|
|
|
232
281
|
include,
|
|
233
282
|
summary: {
|
|
234
283
|
status: "changed",
|
|
235
|
-
headline: `Remapped ${normalizedInputJar} to ${input.targetMapping}
|
|
284
|
+
headline: `Remapped ${normalizedInputJar} to ${input.targetMapping}.`,
|
|
285
|
+
subject: createSummarySubject({
|
|
286
|
+
task: "remap",
|
|
287
|
+
kind: input.subject.kind,
|
|
288
|
+
jarPath: normalizedInputJar,
|
|
289
|
+
executionMode: "apply",
|
|
290
|
+
targetMapping: input.targetMapping
|
|
291
|
+
})
|
|
236
292
|
},
|
|
237
293
|
blocks: {
|
|
238
294
|
operation: {
|
|
@@ -23,11 +23,11 @@ export declare const analyzeSymbolShape: {
|
|
|
23
23
|
targetMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
24
24
|
classNameMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
25
25
|
projectPath: z.ZodOptional<z.ZodString>;
|
|
26
|
-
signatureMode: z.
|
|
27
|
-
nameMode: z.
|
|
26
|
+
signatureMode: z.ZodDefault<z.ZodEnum<["exact", "name-only"]>>;
|
|
27
|
+
nameMode: z.ZodDefault<z.ZodEnum<["fqcn", "auto"]>>;
|
|
28
28
|
includeKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["class", "field", "method"]>, "many">>;
|
|
29
29
|
maxRows: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
maxCandidates: z.
|
|
30
|
+
maxCandidates: z.ZodDefault<z.ZodNumber>;
|
|
31
31
|
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
32
32
|
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
33
33
|
};
|
|
@@ -54,14 +54,15 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
54
54
|
targetMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
55
55
|
classNameMapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
56
56
|
projectPath: z.ZodOptional<z.ZodString>;
|
|
57
|
-
signatureMode: z.
|
|
58
|
-
nameMode: z.
|
|
57
|
+
signatureMode: z.ZodDefault<z.ZodEnum<["exact", "name-only"]>>;
|
|
58
|
+
nameMode: z.ZodDefault<z.ZodEnum<["fqcn", "auto"]>>;
|
|
59
59
|
includeKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["class", "field", "method"]>, "many">>;
|
|
60
60
|
maxRows: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
maxCandidates: z.
|
|
61
|
+
maxCandidates: z.ZodDefault<z.ZodNumber>;
|
|
62
62
|
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
63
63
|
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
64
64
|
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
nameMode: "auto" | "fqcn";
|
|
65
66
|
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
66
67
|
subject: {
|
|
67
68
|
kind: "symbol" | "class" | "method" | "field";
|
|
@@ -69,18 +70,17 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
69
70
|
owner?: string | undefined;
|
|
70
71
|
descriptor?: string | undefined;
|
|
71
72
|
};
|
|
73
|
+
signatureMode: "exact" | "name-only";
|
|
74
|
+
maxCandidates: number;
|
|
72
75
|
projectPath?: string | undefined;
|
|
73
76
|
version?: string | undefined;
|
|
74
77
|
sourceMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
75
78
|
targetMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
76
79
|
classNameMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
77
|
-
nameMode?: "auto" | "fqcn" | undefined;
|
|
78
80
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
79
81
|
include?: string[] | undefined;
|
|
80
|
-
signatureMode?: "exact" | "name-only" | undefined;
|
|
81
82
|
includeKinds?: ("class" | "method" | "field")[] | undefined;
|
|
82
83
|
maxRows?: number | undefined;
|
|
83
|
-
maxCandidates?: number | undefined;
|
|
84
84
|
}, {
|
|
85
85
|
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
86
86
|
subject: {
|
|
@@ -102,6 +102,7 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
102
102
|
maxRows?: number | undefined;
|
|
103
103
|
maxCandidates?: number | undefined;
|
|
104
104
|
}>, {
|
|
105
|
+
nameMode: "auto" | "fqcn";
|
|
105
106
|
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
106
107
|
subject: {
|
|
107
108
|
kind: "symbol" | "class" | "method" | "field";
|
|
@@ -109,18 +110,17 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
109
110
|
owner?: string | undefined;
|
|
110
111
|
descriptor?: string | undefined;
|
|
111
112
|
};
|
|
113
|
+
signatureMode: "exact" | "name-only";
|
|
114
|
+
maxCandidates: number;
|
|
112
115
|
projectPath?: string | undefined;
|
|
113
116
|
version?: string | undefined;
|
|
114
117
|
sourceMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
115
118
|
targetMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
116
119
|
classNameMapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
117
|
-
nameMode?: "auto" | "fqcn" | undefined;
|
|
118
120
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
119
121
|
include?: string[] | undefined;
|
|
120
|
-
signatureMode?: "exact" | "name-only" | undefined;
|
|
121
122
|
includeKinds?: ("class" | "method" | "field")[] | undefined;
|
|
122
123
|
maxRows?: number | undefined;
|
|
123
|
-
maxCandidates?: number | undefined;
|
|
124
124
|
}, {
|
|
125
125
|
task: "map" | "workspace" | "exists" | "exact-map" | "lifecycle" | "api-overview";
|
|
126
126
|
subject: {
|
|
@@ -180,6 +180,8 @@ type AnalyzeSymbolDeps = {
|
|
|
180
180
|
symbol: string;
|
|
181
181
|
descriptor?: string;
|
|
182
182
|
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
183
|
+
toVersion?: string;
|
|
184
|
+
maxVersions?: number;
|
|
183
185
|
}) => Promise<TraceSymbolLifecycleOutput>;
|
|
184
186
|
resolveWorkspaceSymbol: (input: {
|
|
185
187
|
projectPath: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { createError, ERROR_CODES } from "../errors.js";
|
|
3
3
|
import { buildIncludeSchema, detailSchema, positiveIntSchema } from "./entry-tool-schema.js";
|
|
4
|
-
import { buildEntryToolResult } from "./response-contract.js";
|
|
4
|
+
import { buildEntryToolResult, createSummarySubject } from "./response-contract.js";
|
|
5
5
|
import { resolveDetail, resolveInclude } from "./request-normalizers.js";
|
|
6
6
|
const nonEmptyString = z.string().trim().min(1);
|
|
7
7
|
const INCLUDE_GROUPS = ["warnings", "candidates", "matrix", "workspace", "timings"];
|
|
@@ -19,11 +19,11 @@ export const analyzeSymbolShape = {
|
|
|
19
19
|
targetMapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
20
20
|
classNameMapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
21
21
|
projectPath: nonEmptyString.optional(),
|
|
22
|
-
signatureMode: z.enum(["exact", "name-only"]).
|
|
23
|
-
nameMode: z.enum(["fqcn", "auto"]).
|
|
22
|
+
signatureMode: z.enum(["exact", "name-only"]).default("exact"),
|
|
23
|
+
nameMode: z.enum(["fqcn", "auto"]).default("fqcn"),
|
|
24
24
|
includeKinds: z.array(z.enum(["class", "field", "method"])).optional(),
|
|
25
25
|
maxRows: positiveIntSchema.optional(),
|
|
26
|
-
maxCandidates: positiveIntSchema.
|
|
26
|
+
maxCandidates: positiveIntSchema.default(200),
|
|
27
27
|
detail: detailSchema.optional(),
|
|
28
28
|
include: buildIncludeSchema(INCLUDE_GROUPS)
|
|
29
29
|
};
|
|
@@ -110,6 +110,15 @@ export class AnalyzeSymbolService {
|
|
|
110
110
|
headline: output.resolved
|
|
111
111
|
? `The symbol exists in ${output.mappingContext.version}.`
|
|
112
112
|
: `The symbol could not be resolved in ${output.mappingContext.version}.`,
|
|
113
|
+
subject: createSummarySubject({
|
|
114
|
+
task: "exists",
|
|
115
|
+
kind: input.subject.kind,
|
|
116
|
+
name: input.subject.name,
|
|
117
|
+
owner: input.subject.owner,
|
|
118
|
+
descriptor: input.subject.descriptor,
|
|
119
|
+
version: input.version,
|
|
120
|
+
sourceMapping: input.sourceMapping ?? "obfuscated"
|
|
121
|
+
}),
|
|
113
122
|
counts: {
|
|
114
123
|
candidates: output.candidateCount
|
|
115
124
|
}
|
|
@@ -145,6 +154,16 @@ export class AnalyzeSymbolService {
|
|
|
145
154
|
headline: output.resolved
|
|
146
155
|
? `Mapped the symbol into ${output.mappingContext.targetMapping}.`
|
|
147
156
|
: `Found ${output.candidateCount} candidate mappings.`,
|
|
157
|
+
subject: createSummarySubject({
|
|
158
|
+
task: "map",
|
|
159
|
+
kind: input.subject.kind,
|
|
160
|
+
name: input.subject.name,
|
|
161
|
+
owner: input.subject.owner,
|
|
162
|
+
descriptor: input.subject.descriptor,
|
|
163
|
+
version: input.version,
|
|
164
|
+
sourceMapping: input.sourceMapping ?? "obfuscated",
|
|
165
|
+
targetMapping: input.targetMapping ?? "mojang"
|
|
166
|
+
}),
|
|
148
167
|
counts: {
|
|
149
168
|
candidates: output.candidateCount
|
|
150
169
|
}
|
|
@@ -184,6 +203,16 @@ export class AnalyzeSymbolService {
|
|
|
184
203
|
headline: output.resolved
|
|
185
204
|
? "Resolved the exact method mapping."
|
|
186
205
|
: "Could not resolve the exact method mapping.",
|
|
206
|
+
subject: createSummarySubject({
|
|
207
|
+
task: "exact-map",
|
|
208
|
+
kind: input.subject.kind,
|
|
209
|
+
name: input.subject.name,
|
|
210
|
+
owner: input.subject.owner,
|
|
211
|
+
descriptor: input.subject.descriptor,
|
|
212
|
+
version: input.version,
|
|
213
|
+
sourceMapping: input.sourceMapping ?? "obfuscated",
|
|
214
|
+
targetMapping: input.targetMapping ?? "mojang"
|
|
215
|
+
}),
|
|
187
216
|
counts: {
|
|
188
217
|
candidates: output.candidateCount
|
|
189
218
|
}
|
|
@@ -202,7 +231,9 @@ export class AnalyzeSymbolService {
|
|
|
202
231
|
? `${input.subject.owner}.${input.subject.name}`
|
|
203
232
|
: input.subject.name,
|
|
204
233
|
descriptor: input.subject.descriptor,
|
|
205
|
-
mapping: input.sourceMapping
|
|
234
|
+
mapping: input.sourceMapping,
|
|
235
|
+
toVersion: input.version,
|
|
236
|
+
maxVersions: 5
|
|
206
237
|
});
|
|
207
238
|
return {
|
|
208
239
|
...buildEntryToolResult({
|
|
@@ -214,6 +245,15 @@ export class AnalyzeSymbolService {
|
|
|
214
245
|
headline: output.presence.firstSeen
|
|
215
246
|
? `Tracked the symbol from ${output.range.fromVersion} to ${output.range.toVersion}.`
|
|
216
247
|
: "The symbol was not found in the scanned version range.",
|
|
248
|
+
subject: createSummarySubject({
|
|
249
|
+
task: "lifecycle",
|
|
250
|
+
kind: input.subject.kind,
|
|
251
|
+
name: input.subject.name,
|
|
252
|
+
owner: input.subject.owner,
|
|
253
|
+
descriptor: input.subject.descriptor,
|
|
254
|
+
version: input.version,
|
|
255
|
+
sourceMapping: input.sourceMapping ?? "obfuscated"
|
|
256
|
+
}),
|
|
217
257
|
counts: {
|
|
218
258
|
scannedVersions: output.range.scannedCount
|
|
219
259
|
}
|
|
@@ -247,6 +287,16 @@ export class AnalyzeSymbolService {
|
|
|
247
287
|
headline: output.workspaceDetection.resolved
|
|
248
288
|
? `Resolved compile-visible symbol using ${output.workspaceDetection.mappingApplied} workspace mappings.`
|
|
249
289
|
: "Workspace compile mapping could not be detected confidently.",
|
|
290
|
+
subject: createSummarySubject({
|
|
291
|
+
task: "workspace",
|
|
292
|
+
kind: input.subject.kind,
|
|
293
|
+
name: input.subject.name,
|
|
294
|
+
owner: input.subject.owner,
|
|
295
|
+
descriptor: input.subject.descriptor,
|
|
296
|
+
projectPath: input.projectPath,
|
|
297
|
+
version: input.version ?? "unknown",
|
|
298
|
+
sourceMapping: input.sourceMapping ?? "obfuscated"
|
|
299
|
+
}),
|
|
250
300
|
counts: {
|
|
251
301
|
candidates: output.candidateCount
|
|
252
302
|
}
|
|
@@ -261,10 +311,11 @@ export class AnalyzeSymbolService {
|
|
|
261
311
|
};
|
|
262
312
|
}
|
|
263
313
|
case "api-overview": {
|
|
314
|
+
const classNameMapping = input.classNameMapping ?? input.sourceMapping ?? "obfuscated";
|
|
264
315
|
const output = await this.deps.getClassApiMatrix({
|
|
265
316
|
version: input.version,
|
|
266
317
|
className: input.subject.name,
|
|
267
|
-
classNameMapping
|
|
318
|
+
classNameMapping,
|
|
268
319
|
includeKinds: input.includeKinds,
|
|
269
320
|
maxRows: input.maxRows
|
|
270
321
|
});
|
|
@@ -276,6 +327,13 @@ export class AnalyzeSymbolService {
|
|
|
276
327
|
summary: {
|
|
277
328
|
status: "ok",
|
|
278
329
|
headline: `Built an API overview for ${output.className}.`,
|
|
330
|
+
subject: createSummarySubject({
|
|
331
|
+
task: "api-overview",
|
|
332
|
+
kind: input.subject.kind,
|
|
333
|
+
name: input.subject.name,
|
|
334
|
+
version: input.version,
|
|
335
|
+
classNameMapping
|
|
336
|
+
}),
|
|
279
337
|
counts: {
|
|
280
338
|
rows: output.rowCount,
|
|
281
339
|
ambiguousRows: output.ambiguousRowCount ?? 0
|
|
@@ -59,9 +59,9 @@ export declare const compareMinecraftShape: {
|
|
|
59
59
|
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
60
60
|
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
61
61
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
62
|
-
maxClassResults: z.
|
|
62
|
+
maxClassResults: z.ZodDefault<z.ZodNumber>;
|
|
63
63
|
maxEntriesPerRegistry: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
includeFullDiff: z.
|
|
64
|
+
includeFullDiff: z.ZodDefault<z.ZodBoolean>;
|
|
65
65
|
};
|
|
66
66
|
export declare const compareMinecraftSchema: z.ZodObject<{
|
|
67
67
|
task: z.ZodOptional<z.ZodEnum<["auto", "versions", "class-diff", "registry-diff", "migration-overview"]>>;
|
|
@@ -120,10 +120,11 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
120
120
|
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
121
121
|
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
122
122
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
123
|
-
maxClassResults: z.
|
|
123
|
+
maxClassResults: z.ZodDefault<z.ZodNumber>;
|
|
124
124
|
maxEntriesPerRegistry: z.ZodOptional<z.ZodNumber>;
|
|
125
|
-
includeFullDiff: z.
|
|
125
|
+
includeFullDiff: z.ZodDefault<z.ZodBoolean>;
|
|
126
126
|
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
maxClassResults: number;
|
|
127
128
|
subject: {
|
|
128
129
|
kind: "version-pair";
|
|
129
130
|
fromVersion: string;
|
|
@@ -142,13 +143,12 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
142
143
|
toVersion: string;
|
|
143
144
|
registry?: string | undefined;
|
|
144
145
|
};
|
|
146
|
+
includeFullDiff: boolean;
|
|
145
147
|
limit?: number | undefined;
|
|
146
|
-
maxClassResults?: number | undefined;
|
|
147
148
|
task?: "auto" | "versions" | "class-diff" | "registry-diff" | "migration-overview" | undefined;
|
|
148
149
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
149
150
|
include?: string[] | undefined;
|
|
150
151
|
maxEntriesPerRegistry?: number | undefined;
|
|
151
|
-
includeFullDiff?: boolean | undefined;
|
|
152
152
|
}, {
|
|
153
153
|
subject: {
|
|
154
154
|
kind: "version-pair";
|