@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,210 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DiffClassSignaturesOutput } from "../source-service.js";
|
|
3
|
+
import type { CompareVersionsOutput } from "../version-diff-service.js";
|
|
4
|
+
import type { GetRegistryDataOutput } from "../registry-service.js";
|
|
5
|
+
export declare const compareMinecraftShape: {
|
|
6
|
+
task: z.ZodOptional<z.ZodEnum<["auto", "versions", "class-diff", "registry-diff", "migration-overview"]>>;
|
|
7
|
+
subject: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"version-pair">;
|
|
9
|
+
fromVersion: z.ZodString;
|
|
10
|
+
toVersion: z.ZodString;
|
|
11
|
+
packageFilter: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
kind: "version-pair";
|
|
14
|
+
fromVersion: string;
|
|
15
|
+
toVersion: string;
|
|
16
|
+
packageFilter?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
kind: "version-pair";
|
|
19
|
+
fromVersion: string;
|
|
20
|
+
toVersion: string;
|
|
21
|
+
packageFilter?: string | undefined;
|
|
22
|
+
}>, z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"class">;
|
|
24
|
+
className: z.ZodString;
|
|
25
|
+
fromVersion: z.ZodString;
|
|
26
|
+
toVersion: z.ZodString;
|
|
27
|
+
mapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
28
|
+
sourcePriority: z.ZodOptional<z.ZodEnum<["loom-first", "maven-first"]>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
kind: "class";
|
|
31
|
+
className: string;
|
|
32
|
+
fromVersion: string;
|
|
33
|
+
toVersion: string;
|
|
34
|
+
mapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
35
|
+
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
kind: "class";
|
|
38
|
+
className: string;
|
|
39
|
+
fromVersion: string;
|
|
40
|
+
toVersion: string;
|
|
41
|
+
mapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
42
|
+
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
43
|
+
}>, z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"registry">;
|
|
45
|
+
fromVersion: z.ZodString;
|
|
46
|
+
toVersion: z.ZodString;
|
|
47
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
kind: "registry";
|
|
50
|
+
fromVersion: string;
|
|
51
|
+
toVersion: string;
|
|
52
|
+
registry?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
kind: "registry";
|
|
55
|
+
fromVersion: string;
|
|
56
|
+
toVersion: string;
|
|
57
|
+
registry?: string | undefined;
|
|
58
|
+
}>]>;
|
|
59
|
+
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
60
|
+
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
61
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
maxClassResults: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
maxEntriesPerRegistry: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
includeFullDiff: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
};
|
|
66
|
+
export declare const compareMinecraftSchema: z.ZodObject<{
|
|
67
|
+
task: z.ZodOptional<z.ZodEnum<["auto", "versions", "class-diff", "registry-diff", "migration-overview"]>>;
|
|
68
|
+
subject: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"version-pair">;
|
|
70
|
+
fromVersion: z.ZodString;
|
|
71
|
+
toVersion: z.ZodString;
|
|
72
|
+
packageFilter: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
kind: "version-pair";
|
|
75
|
+
fromVersion: string;
|
|
76
|
+
toVersion: string;
|
|
77
|
+
packageFilter?: string | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
kind: "version-pair";
|
|
80
|
+
fromVersion: string;
|
|
81
|
+
toVersion: string;
|
|
82
|
+
packageFilter?: string | undefined;
|
|
83
|
+
}>, z.ZodObject<{
|
|
84
|
+
kind: z.ZodLiteral<"class">;
|
|
85
|
+
className: z.ZodString;
|
|
86
|
+
fromVersion: z.ZodString;
|
|
87
|
+
toVersion: z.ZodString;
|
|
88
|
+
mapping: z.ZodOptional<z.ZodEnum<["obfuscated", "mojang", "intermediary", "yarn"]>>;
|
|
89
|
+
sourcePriority: z.ZodOptional<z.ZodEnum<["loom-first", "maven-first"]>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
kind: "class";
|
|
92
|
+
className: string;
|
|
93
|
+
fromVersion: string;
|
|
94
|
+
toVersion: string;
|
|
95
|
+
mapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
96
|
+
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
kind: "class";
|
|
99
|
+
className: string;
|
|
100
|
+
fromVersion: string;
|
|
101
|
+
toVersion: string;
|
|
102
|
+
mapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
103
|
+
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
104
|
+
}>, z.ZodObject<{
|
|
105
|
+
kind: z.ZodLiteral<"registry">;
|
|
106
|
+
fromVersion: z.ZodString;
|
|
107
|
+
toVersion: z.ZodString;
|
|
108
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
kind: "registry";
|
|
111
|
+
fromVersion: string;
|
|
112
|
+
toVersion: string;
|
|
113
|
+
registry?: string | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
kind: "registry";
|
|
116
|
+
fromVersion: string;
|
|
117
|
+
toVersion: string;
|
|
118
|
+
registry?: string | undefined;
|
|
119
|
+
}>]>;
|
|
120
|
+
detail: z.ZodOptional<z.ZodEnum<["summary", "standard", "full"]>>;
|
|
121
|
+
include: z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
122
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
maxClassResults: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
maxEntriesPerRegistry: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
includeFullDiff: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
subject: {
|
|
128
|
+
kind: "version-pair";
|
|
129
|
+
fromVersion: string;
|
|
130
|
+
toVersion: string;
|
|
131
|
+
packageFilter?: string | undefined;
|
|
132
|
+
} | {
|
|
133
|
+
kind: "class";
|
|
134
|
+
className: string;
|
|
135
|
+
fromVersion: string;
|
|
136
|
+
toVersion: string;
|
|
137
|
+
mapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
138
|
+
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
139
|
+
} | {
|
|
140
|
+
kind: "registry";
|
|
141
|
+
fromVersion: string;
|
|
142
|
+
toVersion: string;
|
|
143
|
+
registry?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
limit?: number | undefined;
|
|
146
|
+
maxClassResults?: number | undefined;
|
|
147
|
+
task?: "auto" | "versions" | "class-diff" | "registry-diff" | "migration-overview" | undefined;
|
|
148
|
+
detail?: "full" | "summary" | "standard" | undefined;
|
|
149
|
+
include?: string[] | undefined;
|
|
150
|
+
maxEntriesPerRegistry?: number | undefined;
|
|
151
|
+
includeFullDiff?: boolean | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
subject: {
|
|
154
|
+
kind: "version-pair";
|
|
155
|
+
fromVersion: string;
|
|
156
|
+
toVersion: string;
|
|
157
|
+
packageFilter?: string | undefined;
|
|
158
|
+
} | {
|
|
159
|
+
kind: "class";
|
|
160
|
+
className: string;
|
|
161
|
+
fromVersion: string;
|
|
162
|
+
toVersion: string;
|
|
163
|
+
mapping?: "intermediary" | "mojang" | "yarn" | "obfuscated" | undefined;
|
|
164
|
+
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
165
|
+
} | {
|
|
166
|
+
kind: "registry";
|
|
167
|
+
fromVersion: string;
|
|
168
|
+
toVersion: string;
|
|
169
|
+
registry?: string | undefined;
|
|
170
|
+
};
|
|
171
|
+
limit?: number | undefined;
|
|
172
|
+
maxClassResults?: number | undefined;
|
|
173
|
+
task?: "auto" | "versions" | "class-diff" | "registry-diff" | "migration-overview" | undefined;
|
|
174
|
+
detail?: "full" | "summary" | "standard" | undefined;
|
|
175
|
+
include?: string[] | undefined;
|
|
176
|
+
maxEntriesPerRegistry?: number | undefined;
|
|
177
|
+
includeFullDiff?: boolean | undefined;
|
|
178
|
+
}>;
|
|
179
|
+
export type CompareMinecraftInput = z.infer<typeof compareMinecraftSchema>;
|
|
180
|
+
type CompareMinecraftDeps = {
|
|
181
|
+
compareVersions: (input: {
|
|
182
|
+
fromVersion: string;
|
|
183
|
+
toVersion: string;
|
|
184
|
+
category?: "classes" | "registry" | "all";
|
|
185
|
+
packageFilter?: string;
|
|
186
|
+
maxClassResults?: number;
|
|
187
|
+
}) => Promise<CompareVersionsOutput>;
|
|
188
|
+
diffClassSignatures: (input: {
|
|
189
|
+
className: string;
|
|
190
|
+
fromVersion: string;
|
|
191
|
+
toVersion: string;
|
|
192
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn";
|
|
193
|
+
sourcePriority?: "loom-first" | "maven-first";
|
|
194
|
+
includeFullDiff?: boolean;
|
|
195
|
+
}) => Promise<DiffClassSignaturesOutput>;
|
|
196
|
+
getRegistryData: (input: {
|
|
197
|
+
version: string;
|
|
198
|
+
registry?: string;
|
|
199
|
+
includeData?: boolean;
|
|
200
|
+
maxEntriesPerRegistry?: number;
|
|
201
|
+
}) => Promise<GetRegistryDataOutput>;
|
|
202
|
+
};
|
|
203
|
+
export declare class CompareMinecraftService {
|
|
204
|
+
private readonly deps;
|
|
205
|
+
constructor(deps: CompareMinecraftDeps);
|
|
206
|
+
execute(input: CompareMinecraftInput): Promise<Record<string, unknown> & {
|
|
207
|
+
warnings?: string[];
|
|
208
|
+
}>;
|
|
209
|
+
}
|
|
210
|
+
export {};
|
|
@@ -0,0 +1,397 @@
|
|
|
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 { buildEntryToolMeta, buildEntryToolResult, createNextAction, createTruncationMeta } from "./response-contract.js";
|
|
5
|
+
import { capArray, resolveDetail, resolveInclude } from "./request-normalizers.js";
|
|
6
|
+
const nonEmptyString = z.string().trim().min(1);
|
|
7
|
+
const INCLUDE_GROUPS = ["warnings", "classes", "registry", "diff", "samples", "timings"];
|
|
8
|
+
const subjectSchema = z.discriminatedUnion("kind", [
|
|
9
|
+
z.object({
|
|
10
|
+
kind: z.literal("version-pair"),
|
|
11
|
+
fromVersion: nonEmptyString,
|
|
12
|
+
toVersion: nonEmptyString,
|
|
13
|
+
packageFilter: nonEmptyString.optional()
|
|
14
|
+
}),
|
|
15
|
+
z.object({
|
|
16
|
+
kind: z.literal("class"),
|
|
17
|
+
className: nonEmptyString,
|
|
18
|
+
fromVersion: nonEmptyString,
|
|
19
|
+
toVersion: nonEmptyString,
|
|
20
|
+
mapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
21
|
+
sourcePriority: z.enum(["loom-first", "maven-first"]).optional()
|
|
22
|
+
}),
|
|
23
|
+
z.object({
|
|
24
|
+
kind: z.literal("registry"),
|
|
25
|
+
fromVersion: nonEmptyString,
|
|
26
|
+
toVersion: nonEmptyString,
|
|
27
|
+
registry: nonEmptyString.optional()
|
|
28
|
+
})
|
|
29
|
+
]);
|
|
30
|
+
export const compareMinecraftShape = {
|
|
31
|
+
task: z.enum(["auto", "versions", "class-diff", "registry-diff", "migration-overview"]).optional(),
|
|
32
|
+
subject: subjectSchema,
|
|
33
|
+
detail: detailSchema.optional(),
|
|
34
|
+
include: buildIncludeSchema(INCLUDE_GROUPS),
|
|
35
|
+
limit: positiveIntSchema.optional(),
|
|
36
|
+
maxClassResults: positiveIntSchema.optional(),
|
|
37
|
+
maxEntriesPerRegistry: positiveIntSchema.optional(),
|
|
38
|
+
includeFullDiff: z.boolean().optional()
|
|
39
|
+
};
|
|
40
|
+
export const compareMinecraftSchema = z.object(compareMinecraftShape);
|
|
41
|
+
function compareStatusFromCounts(changedCount) {
|
|
42
|
+
return changedCount > 0 ? "changed" : "unchanged";
|
|
43
|
+
}
|
|
44
|
+
export class CompareMinecraftService {
|
|
45
|
+
deps;
|
|
46
|
+
constructor(deps) {
|
|
47
|
+
this.deps = deps;
|
|
48
|
+
}
|
|
49
|
+
async execute(input) {
|
|
50
|
+
const task = input.task && input.task !== "auto"
|
|
51
|
+
? input.task
|
|
52
|
+
: input.subject.kind === "class"
|
|
53
|
+
? "class-diff"
|
|
54
|
+
: input.subject.kind === "registry"
|
|
55
|
+
? "registry-diff"
|
|
56
|
+
: "versions";
|
|
57
|
+
const detail = resolveDetail(input.detail);
|
|
58
|
+
const include = resolveInclude(input.include);
|
|
59
|
+
switch (task) {
|
|
60
|
+
case "versions": {
|
|
61
|
+
const subject = input.subject.kind === "version-pair"
|
|
62
|
+
? input.subject
|
|
63
|
+
: {
|
|
64
|
+
fromVersion: input.subject.fromVersion,
|
|
65
|
+
toVersion: input.subject.toVersion,
|
|
66
|
+
packageFilter: input.subject.kind === "class" ? undefined : input.subject.registry
|
|
67
|
+
};
|
|
68
|
+
const output = await this.deps.compareVersions({
|
|
69
|
+
fromVersion: subject.fromVersion,
|
|
70
|
+
toVersion: subject.toVersion,
|
|
71
|
+
category: "all",
|
|
72
|
+
packageFilter: subject.packageFilter,
|
|
73
|
+
maxClassResults: input.maxClassResults
|
|
74
|
+
});
|
|
75
|
+
const changedCount = (output.classes?.addedCount ?? 0) +
|
|
76
|
+
(output.classes?.removedCount ?? 0) +
|
|
77
|
+
(output.registry?.summary.registriesChanged ?? 0);
|
|
78
|
+
const classSamples = capArray(output.classes?.added ?? [], 5);
|
|
79
|
+
const newRegistries = capArray(output.registry?.newRegistries ?? [], 5);
|
|
80
|
+
const removedRegistries = capArray(output.registry?.removedRegistries ?? [], 5);
|
|
81
|
+
const truncatedGroups = [
|
|
82
|
+
...(classSamples.truncated ? ["classes"] : []),
|
|
83
|
+
...(newRegistries.truncated || removedRegistries.truncated ? ["registry"] : [])
|
|
84
|
+
];
|
|
85
|
+
const summaryTruncatedGroups = detail === "summary"
|
|
86
|
+
? truncatedGroups.filter((group) => !include.includes(group))
|
|
87
|
+
: [];
|
|
88
|
+
return {
|
|
89
|
+
...buildEntryToolResult({
|
|
90
|
+
task: "versions",
|
|
91
|
+
detail,
|
|
92
|
+
include,
|
|
93
|
+
summary: {
|
|
94
|
+
status: compareStatusFromCounts(changedCount),
|
|
95
|
+
headline: `Compared ${output.fromVersion} to ${output.toVersion}.`,
|
|
96
|
+
counts: {
|
|
97
|
+
addedClasses: output.classes?.addedCount ?? 0,
|
|
98
|
+
removedClasses: output.classes?.removedCount ?? 0,
|
|
99
|
+
changedRegistries: output.registry?.summary.registriesChanged ?? 0
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
blocks: {
|
|
103
|
+
comparison: {
|
|
104
|
+
fromVersion: output.fromVersion,
|
|
105
|
+
toVersion: output.toVersion
|
|
106
|
+
},
|
|
107
|
+
classes: include.includes("classes") || detail !== "summary"
|
|
108
|
+
? {
|
|
109
|
+
addedCount: output.classes?.addedCount ?? 0,
|
|
110
|
+
removedCount: output.classes?.removedCount ?? 0,
|
|
111
|
+
unchanged: output.classes?.unchanged ?? 0,
|
|
112
|
+
added: output.classes?.added ?? [],
|
|
113
|
+
removed: output.classes?.removed ?? []
|
|
114
|
+
}
|
|
115
|
+
: {
|
|
116
|
+
addedCount: output.classes?.addedCount ?? 0,
|
|
117
|
+
removedCount: output.classes?.removedCount ?? 0,
|
|
118
|
+
unchanged: output.classes?.unchanged ?? 0,
|
|
119
|
+
sampleAdded: classSamples.items
|
|
120
|
+
},
|
|
121
|
+
registry: output.registry
|
|
122
|
+
? {
|
|
123
|
+
summary: output.registry.summary,
|
|
124
|
+
newRegistries: include.includes("registry") || detail !== "summary"
|
|
125
|
+
? output.registry.newRegistries
|
|
126
|
+
: newRegistries.items,
|
|
127
|
+
removedRegistries: include.includes("registry") || detail !== "summary"
|
|
128
|
+
? output.registry.removedRegistries
|
|
129
|
+
: removedRegistries.items
|
|
130
|
+
}
|
|
131
|
+
: undefined
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
warnings: output.warnings,
|
|
135
|
+
...(summaryTruncatedGroups.length > 0
|
|
136
|
+
? {
|
|
137
|
+
meta: buildEntryToolMeta({
|
|
138
|
+
detail,
|
|
139
|
+
include,
|
|
140
|
+
warnings: output.warnings,
|
|
141
|
+
truncated: createTruncationMeta({
|
|
142
|
+
omittedGroups: summaryTruncatedGroups,
|
|
143
|
+
nextActions: [
|
|
144
|
+
createNextAction("compare-minecraft", {
|
|
145
|
+
task: "versions",
|
|
146
|
+
detail: "standard",
|
|
147
|
+
include: resolveInclude([...include, ...summaryTruncatedGroups]),
|
|
148
|
+
subject: input.subject
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
: {})
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
case "class-diff": {
|
|
158
|
+
if (input.subject.kind !== "class") {
|
|
159
|
+
throw createError({
|
|
160
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
161
|
+
message: "task=class-diff requires subject.kind=class."
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const output = await this.deps.diffClassSignatures({
|
|
165
|
+
className: input.subject.className,
|
|
166
|
+
fromVersion: input.subject.fromVersion,
|
|
167
|
+
toVersion: input.subject.toVersion,
|
|
168
|
+
mapping: input.subject.mapping,
|
|
169
|
+
sourcePriority: input.subject.sourcePriority,
|
|
170
|
+
includeFullDiff: input.includeFullDiff
|
|
171
|
+
});
|
|
172
|
+
const changedCount = output.summary.total.added +
|
|
173
|
+
output.summary.total.removed +
|
|
174
|
+
output.summary.total.modified;
|
|
175
|
+
return {
|
|
176
|
+
...buildEntryToolResult({
|
|
177
|
+
task: "class-diff",
|
|
178
|
+
detail,
|
|
179
|
+
include,
|
|
180
|
+
summary: {
|
|
181
|
+
status: compareStatusFromCounts(changedCount),
|
|
182
|
+
headline: `Compared ${output.query.className} between ${output.range.fromVersion} and ${output.range.toVersion}.`,
|
|
183
|
+
counts: output.summary.total
|
|
184
|
+
},
|
|
185
|
+
blocks: {
|
|
186
|
+
comparison: output.query,
|
|
187
|
+
classDiff: include.includes("diff") || detail !== "summary"
|
|
188
|
+
? {
|
|
189
|
+
classChange: output.classChange,
|
|
190
|
+
summary: output.summary,
|
|
191
|
+
constructors: output.constructors,
|
|
192
|
+
methods: output.methods,
|
|
193
|
+
fields: output.fields
|
|
194
|
+
}
|
|
195
|
+
: {
|
|
196
|
+
classChange: output.classChange,
|
|
197
|
+
summary: output.summary
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
warnings: output.warnings
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
case "registry-diff": {
|
|
205
|
+
const subject = input.subject.kind === "registry"
|
|
206
|
+
? input.subject
|
|
207
|
+
: {
|
|
208
|
+
fromVersion: input.subject.fromVersion,
|
|
209
|
+
toVersion: input.subject.toVersion,
|
|
210
|
+
registry: undefined
|
|
211
|
+
};
|
|
212
|
+
const compare = await this.deps.compareVersions({
|
|
213
|
+
fromVersion: subject.fromVersion,
|
|
214
|
+
toVersion: subject.toVersion,
|
|
215
|
+
category: "registry"
|
|
216
|
+
});
|
|
217
|
+
const warnings = [...compare.warnings];
|
|
218
|
+
const registrySummary = compare.registry?.summary ?? {
|
|
219
|
+
registriesChanged: 0,
|
|
220
|
+
totalAdded: 0,
|
|
221
|
+
totalRemoved: 0
|
|
222
|
+
};
|
|
223
|
+
let entries;
|
|
224
|
+
if ((include.includes("registry") || detail === "full") && subject.registry) {
|
|
225
|
+
const [fromData, toData] = await Promise.allSettled([
|
|
226
|
+
this.deps.getRegistryData({
|
|
227
|
+
version: subject.fromVersion,
|
|
228
|
+
registry: subject.registry,
|
|
229
|
+
includeData: true,
|
|
230
|
+
maxEntriesPerRegistry: input.maxEntriesPerRegistry
|
|
231
|
+
}),
|
|
232
|
+
this.deps.getRegistryData({
|
|
233
|
+
version: subject.toVersion,
|
|
234
|
+
registry: subject.registry,
|
|
235
|
+
includeData: true,
|
|
236
|
+
maxEntriesPerRegistry: input.maxEntriesPerRegistry
|
|
237
|
+
})
|
|
238
|
+
]);
|
|
239
|
+
entries = {
|
|
240
|
+
from: fromData.status === "fulfilled" ? fromData.value : undefined,
|
|
241
|
+
to: toData.status === "fulfilled" ? toData.value : undefined
|
|
242
|
+
};
|
|
243
|
+
if (fromData.status === "fulfilled") {
|
|
244
|
+
warnings.push(...fromData.value.warnings);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
warnings.push(`Could not load ${subject.registry} registry details for ${subject.fromVersion}: ${fromData.reason instanceof Error ? fromData.reason.message : String(fromData.reason)}`);
|
|
248
|
+
}
|
|
249
|
+
if (toData.status === "fulfilled") {
|
|
250
|
+
warnings.push(...toData.value.warnings);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
warnings.push(`Could not load ${subject.registry} registry details for ${subject.toVersion}: ${toData.reason instanceof Error ? toData.reason.message : String(toData.reason)}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const partialDetail = Boolean(subject.registry) &&
|
|
257
|
+
(include.includes("registry") || detail === "full") &&
|
|
258
|
+
entries !== undefined &&
|
|
259
|
+
(!entries.from || !entries.to);
|
|
260
|
+
const missingFromDetail = partialDetail && entries != null && !entries.from;
|
|
261
|
+
const missingToDetail = partialDetail && entries != null && !entries.to;
|
|
262
|
+
const summary = {
|
|
263
|
+
status: partialDetail ? "partial" : compareStatusFromCounts(registrySummary.registriesChanged),
|
|
264
|
+
headline: partialDetail
|
|
265
|
+
? `Compared registry changes between ${subject.fromVersion} and ${subject.toVersion} with partial detail.`
|
|
266
|
+
: `Compared registry changes between ${subject.fromVersion} and ${subject.toVersion}.`,
|
|
267
|
+
counts: {
|
|
268
|
+
changedRegistries: registrySummary.registriesChanged,
|
|
269
|
+
addedEntries: registrySummary.totalAdded,
|
|
270
|
+
removedEntries: registrySummary.totalRemoved
|
|
271
|
+
},
|
|
272
|
+
...(partialDetail
|
|
273
|
+
? {
|
|
274
|
+
nextActions: [
|
|
275
|
+
...(missingFromDetail
|
|
276
|
+
? [{
|
|
277
|
+
tool: "get-registry-data",
|
|
278
|
+
params: {
|
|
279
|
+
version: subject.fromVersion,
|
|
280
|
+
registry: subject.registry,
|
|
281
|
+
includeData: true,
|
|
282
|
+
maxEntriesPerRegistry: input.maxEntriesPerRegistry
|
|
283
|
+
}
|
|
284
|
+
}]
|
|
285
|
+
: []),
|
|
286
|
+
...(missingToDetail
|
|
287
|
+
? [{
|
|
288
|
+
tool: "get-registry-data",
|
|
289
|
+
params: {
|
|
290
|
+
version: subject.toVersion,
|
|
291
|
+
registry: subject.registry,
|
|
292
|
+
includeData: true,
|
|
293
|
+
maxEntriesPerRegistry: input.maxEntriesPerRegistry
|
|
294
|
+
}
|
|
295
|
+
}]
|
|
296
|
+
: [])
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
: {})
|
|
300
|
+
};
|
|
301
|
+
return {
|
|
302
|
+
...buildEntryToolResult({
|
|
303
|
+
task: "registry-diff",
|
|
304
|
+
detail,
|
|
305
|
+
include,
|
|
306
|
+
summary,
|
|
307
|
+
blocks: {
|
|
308
|
+
comparison: {
|
|
309
|
+
fromVersion: subject.fromVersion,
|
|
310
|
+
toVersion: subject.toVersion,
|
|
311
|
+
registry: subject.registry
|
|
312
|
+
},
|
|
313
|
+
registry: {
|
|
314
|
+
summary: registrySummary,
|
|
315
|
+
entries
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}),
|
|
319
|
+
warnings
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
case "migration-overview": {
|
|
323
|
+
const subject = input.subject.kind === "version-pair"
|
|
324
|
+
? input.subject
|
|
325
|
+
: {
|
|
326
|
+
fromVersion: input.subject.fromVersion,
|
|
327
|
+
toVersion: input.subject.toVersion
|
|
328
|
+
};
|
|
329
|
+
const compare = await this.deps.compareVersions({
|
|
330
|
+
fromVersion: subject.fromVersion,
|
|
331
|
+
toVersion: subject.toVersion,
|
|
332
|
+
category: "all",
|
|
333
|
+
maxClassResults: input.maxClassResults
|
|
334
|
+
});
|
|
335
|
+
const classSignals = (compare.classes?.addedCount ?? 0) + (compare.classes?.removedCount ?? 0);
|
|
336
|
+
const registrySignals = compare.registry?.summary.registriesChanged ?? 0;
|
|
337
|
+
const status = compareStatusFromCounts(classSignals + registrySignals);
|
|
338
|
+
return {
|
|
339
|
+
...buildEntryToolResult({
|
|
340
|
+
task: "migration-overview",
|
|
341
|
+
detail,
|
|
342
|
+
include,
|
|
343
|
+
summary: {
|
|
344
|
+
status,
|
|
345
|
+
headline: `Summarized migration impact from ${subject.fromVersion} to ${subject.toVersion}.`,
|
|
346
|
+
counts: {
|
|
347
|
+
classSignals,
|
|
348
|
+
registrySignals
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
blocks: {
|
|
352
|
+
comparison: subject,
|
|
353
|
+
migration: {
|
|
354
|
+
impact: classSignals > 0 && registrySignals > 0
|
|
355
|
+
? "classes-and-registry"
|
|
356
|
+
: classSignals > 0
|
|
357
|
+
? "classes"
|
|
358
|
+
: registrySignals > 0
|
|
359
|
+
? "registry"
|
|
360
|
+
: "minimal",
|
|
361
|
+
nextActions: [
|
|
362
|
+
{
|
|
363
|
+
tool: classSignals > 0 ? "compare-minecraft" : "inspect-minecraft",
|
|
364
|
+
params: classSignals > 0
|
|
365
|
+
? {
|
|
366
|
+
task: "class-diff",
|
|
367
|
+
subject: {
|
|
368
|
+
kind: "class",
|
|
369
|
+
className: "net.minecraft.world.item.ItemStack",
|
|
370
|
+
fromVersion: subject.fromVersion,
|
|
371
|
+
toVersion: subject.toVersion
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
: {
|
|
375
|
+
task: "artifact",
|
|
376
|
+
subject: {
|
|
377
|
+
kind: "version",
|
|
378
|
+
version: subject.toVersion
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}),
|
|
386
|
+
warnings: compare.warnings
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
default:
|
|
390
|
+
throw createError({
|
|
391
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
392
|
+
message: `Unsupported compare-minecraft task "${task}".`
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=compare-minecraft-service.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const detailSchema: z.ZodEnum<["summary", "standard", "full"]>;
|
|
3
|
+
export declare const includeGroupSchema: z.ZodEnum<["warnings", "provenance", "candidates", "members", "source", "files", "samples", "diff", "issues", "timeline", "matrix", "entries", "workspace", "health", "recovery", "paths", "owners", "preview", "cacheEntries", "timings", "artifact", "classes", "registry"]>;
|
|
4
|
+
export declare const executionModeSchema: z.ZodEnum<["preview", "apply"]>;
|
|
5
|
+
export declare const positiveIntSchema: z.ZodNumber;
|
|
6
|
+
export declare function buildIncludeSchema(allowed: readonly string[]): z.ZodOptional<z.ZodArray<z.ZodEnum<[string, ...string[]]>, "many">>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CANONICAL_INCLUDE_GROUPS, DETAIL_LEVELS } from "./response-contract.js";
|
|
3
|
+
export const detailSchema = z.enum(DETAIL_LEVELS);
|
|
4
|
+
export const includeGroupSchema = z.enum(CANONICAL_INCLUDE_GROUPS);
|
|
5
|
+
export const executionModeSchema = z.enum(["preview", "apply"]);
|
|
6
|
+
export const positiveIntSchema = z.number().int().positive();
|
|
7
|
+
export function buildIncludeSchema(allowed) {
|
|
8
|
+
return z.array(z.enum(allowed)).optional();
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=entry-tool-schema.js.map
|