@adhisang/minecraft-modding-mcp 4.0.0 → 4.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 +61 -0
- package/README.md +40 -23
- package/dist/build-suggested-call.d.ts +29 -0
- package/dist/build-suggested-call.js +58 -0
- package/dist/cache-registry.d.ts +3 -1
- package/dist/cache-registry.js +50 -6
- package/dist/entry-tools/analyze-symbol-service.d.ts +16 -16
- package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
- package/dist/entry-tools/batch-class-members-service.js +97 -0
- package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
- package/dist/entry-tools/batch-class-source-service.js +100 -0
- package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
- package/dist/entry-tools/batch-mappings-service.js +66 -0
- package/dist/entry-tools/batch-runner.d.ts +72 -0
- package/dist/entry-tools/batch-runner.js +90 -0
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
- package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
- package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +193 -308
- package/dist/entry-tools/inspect-minecraft-service.js +20 -1244
- package/dist/entry-tools/manage-cache-service.d.ts +16 -16
- package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
- package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
- package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
- package/dist/entry-tools/validate-project/cases/project-summary.d.ts +102 -0
- package/dist/entry-tools/validate-project/cases/project-summary.js +415 -0
- package/dist/entry-tools/validate-project/internal.d.ts +142 -0
- package/dist/entry-tools/validate-project/internal.js +303 -0
- package/dist/entry-tools/validate-project-service.d.ts +67 -47
- package/dist/entry-tools/validate-project-service.js +13 -563
- package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
- package/dist/entry-tools/verify-mixin-target-service.js +323 -0
- package/dist/error-mapping.d.ts +40 -0
- package/dist/error-mapping.js +139 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +147 -1354
- package/dist/mapping/internal-types.d.ts +54 -0
- package/dist/mapping/internal-types.js +14 -0
- package/dist/mapping/loaders/mojang.d.ts +2 -0
- package/dist/mapping/loaders/mojang.js +64 -0
- package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
- package/dist/mapping/loaders/tiny-loom.js +73 -0
- package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
- package/dist/mapping/loaders/tiny-maven.js +104 -0
- package/dist/mapping/loaders/types.d.ts +14 -0
- package/dist/mapping/loaders/types.js +2 -0
- package/dist/mapping/lookup.d.ts +52 -0
- package/dist/mapping/lookup.js +496 -0
- package/dist/mapping/parsers/normalize.d.ts +10 -0
- package/dist/mapping/parsers/normalize.js +52 -0
- package/dist/mapping/parsers/proguard.d.ts +20 -0
- package/dist/mapping/parsers/proguard.js +138 -0
- package/dist/mapping/parsers/symbol-records.d.ts +27 -0
- package/dist/mapping/parsers/symbol-records.js +216 -0
- package/dist/mapping/parsers/tiny.d.ts +9 -0
- package/dist/mapping/parsers/tiny.js +96 -0
- package/dist/mapping/types.d.ts +147 -0
- package/dist/mapping/types.js +2 -0
- package/dist/mapping-pipeline-service.js +3 -2
- package/dist/mapping-service.d.ts +8 -145
- package/dist/mapping-service.js +30 -1207
- package/dist/mixin/access-validators.d.ts +9 -0
- package/dist/mixin/access-validators.js +257 -0
- package/dist/mixin/annotation-validators.d.ts +5 -0
- package/dist/mixin/annotation-validators.js +162 -0
- package/dist/mixin/helpers.d.ts +28 -0
- package/dist/mixin/helpers.js +315 -0
- package/dist/mixin/parsed-validator.d.ts +8 -0
- package/dist/mixin/parsed-validator.js +337 -0
- package/dist/mixin/types.d.ts +208 -0
- package/dist/mixin/types.js +28 -0
- package/dist/mixin-validator.d.ts +9 -201
- package/dist/mixin-validator.js +8 -1020
- package/dist/source/access-validate.d.ts +4 -0
- package/dist/source/access-validate.js +254 -0
- package/dist/source/artifact-resolver.d.ts +111 -0
- package/dist/source/artifact-resolver.js +1271 -0
- package/dist/source/cache-metrics.d.ts +26 -0
- package/dist/source/cache-metrics.js +172 -0
- package/dist/source/class-source/members-builder.d.ts +34 -0
- package/dist/source/class-source/members-builder.js +46 -0
- package/dist/source/class-source/snippet-builder.d.ts +19 -0
- package/dist/source/class-source/snippet-builder.js +46 -0
- package/dist/source/class-source-helpers.d.ts +34 -0
- package/dist/source/class-source-helpers.js +140 -0
- package/dist/source/class-source.d.ts +42 -0
- package/dist/source/class-source.js +883 -0
- package/dist/source/descriptor-utils.d.ts +6 -0
- package/dist/source/descriptor-utils.js +37 -0
- package/dist/source/file-access.d.ts +4 -0
- package/dist/source/file-access.js +102 -0
- package/dist/source/indexer.d.ts +82 -0
- package/dist/source/indexer.js +522 -0
- package/dist/source/lifecycle/diff-utils.d.ts +9 -0
- package/dist/source/lifecycle/diff-utils.js +107 -0
- package/dist/source/lifecycle/diff.d.ts +2 -0
- package/dist/source/lifecycle/diff.js +265 -0
- package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
- package/dist/source/lifecycle/mapping-helpers.js +327 -0
- package/dist/source/lifecycle/runtime-check.d.ts +2 -0
- package/dist/source/lifecycle/runtime-check.js +142 -0
- package/dist/source/lifecycle/trace.d.ts +2 -0
- package/dist/source/lifecycle/trace.js +231 -0
- package/dist/source/lifecycle.d.ts +4 -0
- package/dist/source/lifecycle.js +5 -0
- package/dist/source/search.d.ts +51 -0
- package/dist/source/search.js +676 -0
- package/dist/source/shared-utils.d.ts +6 -0
- package/dist/source/shared-utils.js +55 -0
- package/dist/source/state.d.ts +26 -0
- package/dist/source/state.js +24 -0
- package/dist/source/symbol-resolver.d.ts +3 -0
- package/dist/source/symbol-resolver.js +212 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
- package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
- package/dist/source/validate-mixin/pipeline/parse.js +10 -0
- package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
- package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
- package/dist/source/validate-mixin/pipeline-context.js +93 -0
- package/dist/source/validate-mixin.d.ts +22 -0
- package/dist/source/validate-mixin.js +799 -0
- package/dist/source/workspace-target.d.ts +18 -0
- package/dist/source/workspace-target.js +305 -0
- package/dist/source-resolver.d.ts +1 -0
- package/dist/source-resolver.js +1 -1
- package/dist/source-service.d.ts +164 -170
- package/dist/source-service.js +70 -6116
- package/dist/stage-emitter.d.ts +13 -0
- package/dist/stage-emitter.js +30 -0
- package/dist/stdio-supervisor.d.ts +61 -0
- package/dist/stdio-supervisor.js +326 -9
- package/dist/tool-contract-manifest.d.ts +1 -1
- package/dist/tool-contract-manifest.js +23 -6
- package/dist/tool-guidance.d.ts +82 -0
- package/dist/tool-guidance.js +734 -0
- package/dist/tool-schema-registry.d.ts +16 -0
- package/dist/tool-schema-registry.js +37 -0
- package/dist/tool-schemas.d.ts +3518 -0
- package/dist/tool-schemas.js +813 -0
- package/dist/types.d.ts +36 -0
- package/dist/version-service.js +7 -6
- package/dist/workspace-context-cache.d.ts +32 -0
- package/dist/workspace-context-cache.js +66 -0
- package/dist/workspace-mapping-service.d.ts +16 -0
- package/dist/workspace-mapping-service.js +173 -1
- package/docs/README-ja.md +416 -0
- package/docs/examples.md +483 -0
- package/docs/tool-reference.md +462 -0
- package/package.json +17 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { buildSuggestedCall } from "../build-suggested-call.js";
|
|
3
|
+
import { ERROR_CODES, createError } from "../errors.js";
|
|
4
|
+
export function normalizePathStyle(path) {
|
|
5
|
+
return path.replaceAll("\\", "/");
|
|
6
|
+
}
|
|
7
|
+
export function normalizeOptionalString(value) {
|
|
8
|
+
if (value == null) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const trimmed = value.trim();
|
|
12
|
+
return trimmed ? trimmed : undefined;
|
|
13
|
+
}
|
|
14
|
+
export function normalizeMapping(mapping) {
|
|
15
|
+
if (mapping == null) {
|
|
16
|
+
return "obfuscated";
|
|
17
|
+
}
|
|
18
|
+
if (mapping === "obfuscated" ||
|
|
19
|
+
mapping === "mojang" ||
|
|
20
|
+
mapping === "intermediary" ||
|
|
21
|
+
mapping === "yarn") {
|
|
22
|
+
return mapping;
|
|
23
|
+
}
|
|
24
|
+
throw createError({
|
|
25
|
+
code: ERROR_CODES.MAPPING_UNAVAILABLE,
|
|
26
|
+
message: `Unsupported mapping "${mapping}".`,
|
|
27
|
+
details: {
|
|
28
|
+
mapping,
|
|
29
|
+
nextAction: "Try mapping=obfuscated which is always available.",
|
|
30
|
+
...buildSuggestedCall({ tool: "resolve-artifact", params: { mapping: "obfuscated" } })
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export async function pathExists(filePath) {
|
|
35
|
+
try {
|
|
36
|
+
await access(filePath);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function dedupeQualityFlags(qualityFlags) {
|
|
44
|
+
const seen = new Set();
|
|
45
|
+
const deduped = [];
|
|
46
|
+
for (const qualityFlag of qualityFlags) {
|
|
47
|
+
if (seen.has(qualityFlag)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
seen.add(qualityFlag);
|
|
51
|
+
deduped.push(qualityFlag);
|
|
52
|
+
}
|
|
53
|
+
return deduped;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=shared-utils.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutable per-instance state shared across SourceService domain modules
|
|
3
|
+
* (cache metrics, indexer, binary remap). Wrapped in a small class so
|
|
4
|
+
* sibling modules can read and reassign fields without dropping `private`
|
|
5
|
+
* on every individual member of `SourceService`.
|
|
6
|
+
*/
|
|
7
|
+
import { LruList } from "../lru-list.js";
|
|
8
|
+
export declare class SourceServiceState {
|
|
9
|
+
cacheTotalContentBytes: number;
|
|
10
|
+
readonly remappedJarBytes: Map<string, number>;
|
|
11
|
+
/**
|
|
12
|
+
* In-flight binary-remap jobs keyed by remapped jar path so concurrent
|
|
13
|
+
* resolveArtifact calls for the same artifactId share a single
|
|
14
|
+
* tiny-remapper run.
|
|
15
|
+
*/
|
|
16
|
+
readonly inflightRemaps: Map<string, Promise<string>>;
|
|
17
|
+
/**
|
|
18
|
+
* Process-local artifact ingest jobs keyed by artifactId. This collapses
|
|
19
|
+
* concurrent class source/member lookups inside one MCP server process.
|
|
20
|
+
*/
|
|
21
|
+
readonly inflightArtifactIngests: Map<string, Promise<void>>;
|
|
22
|
+
readonly lru: LruList<{
|
|
23
|
+
totalContentBytes: number;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutable per-instance state shared across SourceService domain modules
|
|
3
|
+
* (cache metrics, indexer, binary remap). Wrapped in a small class so
|
|
4
|
+
* sibling modules can read and reassign fields without dropping `private`
|
|
5
|
+
* on every individual member of `SourceService`.
|
|
6
|
+
*/
|
|
7
|
+
import { LruList } from "../lru-list.js";
|
|
8
|
+
export class SourceServiceState {
|
|
9
|
+
cacheTotalContentBytes = 0;
|
|
10
|
+
remappedJarBytes = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* In-flight binary-remap jobs keyed by remapped jar path so concurrent
|
|
13
|
+
* resolveArtifact calls for the same artifactId share a single
|
|
14
|
+
* tiny-remapper run.
|
|
15
|
+
*/
|
|
16
|
+
inflightRemaps = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* Process-local artifact ingest jobs keyed by artifactId. This collapses
|
|
19
|
+
* concurrent class source/member lookups inside one MCP server process.
|
|
20
|
+
*/
|
|
21
|
+
inflightArtifactIngests = new Map();
|
|
22
|
+
lru = new LruList();
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SourceService } from "../source-service.js";
|
|
2
|
+
import type { ResolveWorkspaceSymbolInput, ResolveWorkspaceSymbolOutput } from "../source-service.js";
|
|
3
|
+
export declare function resolveWorkspaceSymbol(svc: SourceService, input: ResolveWorkspaceSymbolInput): Promise<ResolveWorkspaceSymbolOutput>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { ERROR_CODES, createError } from "../errors.js";
|
|
2
|
+
export async function resolveWorkspaceSymbol(svc, input) {
|
|
3
|
+
const projectPath = input.projectPath?.trim();
|
|
4
|
+
const version = input.version?.trim();
|
|
5
|
+
const kind = input.kind;
|
|
6
|
+
const name = input.name?.trim();
|
|
7
|
+
const owner = input.owner?.trim();
|
|
8
|
+
const descriptor = input.descriptor?.trim();
|
|
9
|
+
if (!projectPath || !version || !name) {
|
|
10
|
+
throw createError({
|
|
11
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
12
|
+
message: "projectPath, version, and name must be non-empty strings.",
|
|
13
|
+
details: {
|
|
14
|
+
projectPath: input.projectPath,
|
|
15
|
+
version: input.version,
|
|
16
|
+
name: input.name
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (kind !== "class" && kind !== "field" && kind !== "method") {
|
|
21
|
+
throw createError({
|
|
22
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
23
|
+
message: `Unsupported symbol kind "${kind}".`,
|
|
24
|
+
details: { kind }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (kind === "class") {
|
|
28
|
+
if (owner) {
|
|
29
|
+
throw createError({
|
|
30
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
31
|
+
message: "owner is not allowed when kind=class. Use name as FQCN.",
|
|
32
|
+
details: { owner: input.owner, name: input.name }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (descriptor) {
|
|
36
|
+
throw createError({
|
|
37
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
38
|
+
message: "descriptor is not allowed when kind=class.",
|
|
39
|
+
details: { descriptor: input.descriptor }
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (!owner) {
|
|
44
|
+
throw createError({
|
|
45
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
46
|
+
message: "owner is required when kind is field or method.",
|
|
47
|
+
details: { kind, owner: input.owner }
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (kind === "field" && descriptor) {
|
|
51
|
+
throw createError({
|
|
52
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
53
|
+
message: "descriptor is not allowed when kind=field.",
|
|
54
|
+
details: { descriptor: input.descriptor }
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (kind === "method" && !descriptor) {
|
|
58
|
+
throw createError({
|
|
59
|
+
code: ERROR_CODES.INVALID_INPUT,
|
|
60
|
+
message: "descriptor is required when kind=method."
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const querySymbol = kind === "class"
|
|
64
|
+
? {
|
|
65
|
+
kind,
|
|
66
|
+
name: name.replace(/\//g, "."),
|
|
67
|
+
symbol: name.replace(/\//g, ".")
|
|
68
|
+
}
|
|
69
|
+
: {
|
|
70
|
+
kind,
|
|
71
|
+
name,
|
|
72
|
+
owner: owner?.replace(/\//g, "."),
|
|
73
|
+
descriptor: kind === "method" ? descriptor : undefined,
|
|
74
|
+
symbol: `${owner?.replace(/\//g, ".")}.${name}${kind === "method" ? descriptor : ""}`
|
|
75
|
+
};
|
|
76
|
+
const sourcePriorityApplied = input.sourcePriority ?? svc.config.mappingSourcePriority;
|
|
77
|
+
const workspaceDetection = await svc.workspaceMappingService.detectCompileMapping({
|
|
78
|
+
projectPath
|
|
79
|
+
});
|
|
80
|
+
const warnings = [...workspaceDetection.warnings];
|
|
81
|
+
if (!workspaceDetection.resolved || !workspaceDetection.mappingApplied) {
|
|
82
|
+
return {
|
|
83
|
+
querySymbol,
|
|
84
|
+
mappingContext: {
|
|
85
|
+
version,
|
|
86
|
+
sourceMapping: input.sourceMapping,
|
|
87
|
+
sourcePriorityApplied
|
|
88
|
+
},
|
|
89
|
+
resolved: false,
|
|
90
|
+
status: "mapping_unavailable",
|
|
91
|
+
candidates: [],
|
|
92
|
+
candidateCount: 0,
|
|
93
|
+
workspaceDetection,
|
|
94
|
+
warnings
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const mappingApplied = workspaceDetection.mappingApplied;
|
|
98
|
+
if (kind === "method") {
|
|
99
|
+
const methodOwner = owner;
|
|
100
|
+
const methodDescriptor = descriptor;
|
|
101
|
+
const exact = await svc.mappingService.resolveMethodMappingExact({
|
|
102
|
+
version,
|
|
103
|
+
owner: methodOwner,
|
|
104
|
+
name,
|
|
105
|
+
descriptor: methodDescriptor,
|
|
106
|
+
sourceMapping: input.sourceMapping,
|
|
107
|
+
targetMapping: mappingApplied,
|
|
108
|
+
sourcePriority: input.sourcePriority,
|
|
109
|
+
maxCandidates: input.maxCandidates
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
...exact,
|
|
113
|
+
workspaceDetection,
|
|
114
|
+
warnings: [...warnings, ...exact.warnings]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (kind === "class") {
|
|
118
|
+
const className = name.replace(/\//g, ".");
|
|
119
|
+
const matrix = await svc.mappingService.getClassApiMatrix({
|
|
120
|
+
version,
|
|
121
|
+
className,
|
|
122
|
+
classNameMapping: input.sourceMapping,
|
|
123
|
+
includeKinds: ["class"],
|
|
124
|
+
sourcePriority: input.sourcePriority
|
|
125
|
+
});
|
|
126
|
+
const resolvedClass = matrix.classIdentity[mappingApplied];
|
|
127
|
+
if (!resolvedClass) {
|
|
128
|
+
return {
|
|
129
|
+
querySymbol,
|
|
130
|
+
mappingContext: {
|
|
131
|
+
version,
|
|
132
|
+
sourceMapping: input.sourceMapping,
|
|
133
|
+
targetMapping: mappingApplied,
|
|
134
|
+
sourcePriorityApplied
|
|
135
|
+
},
|
|
136
|
+
resolved: false,
|
|
137
|
+
status: "not_found",
|
|
138
|
+
candidates: [],
|
|
139
|
+
candidateCount: 0,
|
|
140
|
+
workspaceDetection,
|
|
141
|
+
warnings: [...warnings, ...matrix.warnings]
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const normalizedClass = resolvedClass.replace(/\//g, ".");
|
|
145
|
+
const resolvedSymbol = {
|
|
146
|
+
kind: "class",
|
|
147
|
+
name: normalizedClass,
|
|
148
|
+
symbol: normalizedClass
|
|
149
|
+
};
|
|
150
|
+
const resolvedCandidate = {
|
|
151
|
+
...resolvedSymbol,
|
|
152
|
+
matchKind: "exact",
|
|
153
|
+
confidence: 1
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
querySymbol,
|
|
157
|
+
mappingContext: {
|
|
158
|
+
version,
|
|
159
|
+
sourceMapping: input.sourceMapping,
|
|
160
|
+
targetMapping: mappingApplied,
|
|
161
|
+
sourcePriorityApplied
|
|
162
|
+
},
|
|
163
|
+
resolved: true,
|
|
164
|
+
status: "resolved",
|
|
165
|
+
resolvedSymbol,
|
|
166
|
+
candidates: [resolvedCandidate],
|
|
167
|
+
candidateCount: 1,
|
|
168
|
+
workspaceDetection,
|
|
169
|
+
warnings: [...warnings, ...matrix.warnings]
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// By this point the method and class branches have already returned; only the field
|
|
173
|
+
// branch reaches the generic findMapping fallthrough.
|
|
174
|
+
const mapped = await svc.mappingService.findMapping({
|
|
175
|
+
version,
|
|
176
|
+
kind,
|
|
177
|
+
name,
|
|
178
|
+
owner,
|
|
179
|
+
descriptor,
|
|
180
|
+
sourceMapping: input.sourceMapping,
|
|
181
|
+
targetMapping: mappingApplied,
|
|
182
|
+
sourcePriority: input.sourcePriority,
|
|
183
|
+
maxCandidates: input.maxCandidates
|
|
184
|
+
});
|
|
185
|
+
const filtered = mapped.candidates.filter((candidate) => candidate.kind === kind);
|
|
186
|
+
let status;
|
|
187
|
+
if (mapped.status === "mapping_unavailable") {
|
|
188
|
+
status = "mapping_unavailable";
|
|
189
|
+
}
|
|
190
|
+
else if (filtered.length === 1) {
|
|
191
|
+
status = "resolved";
|
|
192
|
+
}
|
|
193
|
+
else if (filtered.length > 1) {
|
|
194
|
+
status = "ambiguous";
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
status = "not_found";
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
querySymbol: mapped.querySymbol,
|
|
201
|
+
mappingContext: mapped.mappingContext,
|
|
202
|
+
resolved: status === "resolved",
|
|
203
|
+
status,
|
|
204
|
+
resolvedSymbol: status === "resolved" ? filtered[0] : undefined,
|
|
205
|
+
candidates: filtered,
|
|
206
|
+
candidateCount: mapped.candidateCount,
|
|
207
|
+
candidatesTruncated: mapped.candidatesTruncated,
|
|
208
|
+
workspaceDetection,
|
|
209
|
+
warnings: [...warnings, ...mapped.warnings]
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=symbol-resolver.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
export async function runMappingHealthStage(svc, ctx) {
|
|
3
|
+
const mappingHealthStartedAt = await ctx.enterStage("mapping-health");
|
|
4
|
+
try {
|
|
5
|
+
const health = await svc.mappingService.checkMappingHealth({
|
|
6
|
+
version: ctx.version,
|
|
7
|
+
requestedMapping: ctx.requestedMapping,
|
|
8
|
+
sourcePriority: ctx.currentSourcePriority
|
|
9
|
+
});
|
|
10
|
+
const jarAvailable = existsSync(ctx.jarPath);
|
|
11
|
+
ctx.healthReport = {
|
|
12
|
+
jarAvailable,
|
|
13
|
+
jarPath: ctx.jarPath,
|
|
14
|
+
mojangMappingsAvailable: health.mojangMappingsAvailable,
|
|
15
|
+
tinyMappingsAvailable: health.tinyMappingsAvailable,
|
|
16
|
+
memberRemapAvailable: health.memberRemapAvailable,
|
|
17
|
+
overallHealthy: jarAvailable && health.mojangMappingsAvailable,
|
|
18
|
+
degradations: [
|
|
19
|
+
...(jarAvailable ? [] : ["Game jar not found."]),
|
|
20
|
+
...health.degradations
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
26
|
+
ctx.healthReport = {
|
|
27
|
+
jarAvailable: existsSync(ctx.jarPath),
|
|
28
|
+
jarPath: ctx.jarPath,
|
|
29
|
+
mojangMappingsAvailable: false,
|
|
30
|
+
tinyMappingsAvailable: false,
|
|
31
|
+
memberRemapAvailable: false,
|
|
32
|
+
overallHealthy: false,
|
|
33
|
+
degradations: [`Mapping health probe failed: ${reason}`]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (ctx.testHooks?.afterMappingHealth) {
|
|
37
|
+
await ctx.testHooks.afterMappingHealth();
|
|
38
|
+
}
|
|
39
|
+
ctx.checkPreParseBudget("mapping-health", mappingHealthStartedAt, ctx.stageBudgets.mappingHealth);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=mapping-health.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { parseMixinSource } from "../../../mixin-parser.js";
|
|
2
|
+
export async function runParseStage(ctx) {
|
|
3
|
+
const parseStartedAt = await ctx.enterStage("parse");
|
|
4
|
+
ctx.parsed = parseMixinSource(ctx.source);
|
|
5
|
+
if (ctx.testHooks?.afterParse) {
|
|
6
|
+
await ctx.testHooks.afterParse();
|
|
7
|
+
}
|
|
8
|
+
ctx.checkPreParseBudget("parse", parseStartedAt, ctx.stageBudgets.parse);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { normalizeMapping } from "../pipeline-context.js";
|
|
2
|
+
export async function runResolveStage(svc, ctx) {
|
|
3
|
+
const resolveStartedAt = await ctx.enterStage("resolve");
|
|
4
|
+
let detectedMapping;
|
|
5
|
+
if ((!ctx.input.mapping || ctx.input.preferProjectMapping) && ctx.input.projectPath) {
|
|
6
|
+
try {
|
|
7
|
+
const detection = await svc.workspaceMappingService.detectCompileMapping({ projectPath: ctx.input.projectPath });
|
|
8
|
+
if (detection.resolved && detection.mappingApplied) {
|
|
9
|
+
detectedMapping = detection.mappingApplied;
|
|
10
|
+
ctx.mappingAutoDetected = true;
|
|
11
|
+
ctx.warnings.push(`Auto-detected mapping '${detectedMapping}' from project configuration.`);
|
|
12
|
+
ctx.warnings.push(...detection.warnings);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
ctx.warnings.push(...detection.warnings);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// Detection failed — fall through to default
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
ctx.requestedMapping = normalizeMapping(detectedMapping ?? ctx.input.mapping);
|
|
23
|
+
ctx.mappingApplied = ctx.requestedMapping;
|
|
24
|
+
if (ctx.input.preferProjectVersion && ctx.input.projectPath) {
|
|
25
|
+
const detected = await svc.workspaceMappingService.detectProjectMinecraftVersion(ctx.input.projectPath);
|
|
26
|
+
if (detected && detected !== ctx.version) {
|
|
27
|
+
ctx.warnings.push(`Overriding version "${ctx.version}" with project version "${detected}" from gradle.properties.`);
|
|
28
|
+
}
|
|
29
|
+
ctx.version = detected ?? ctx.version;
|
|
30
|
+
}
|
|
31
|
+
ctx.signatureLookupMapping = "obfuscated";
|
|
32
|
+
if (ctx.input.scope && ctx.input.scope !== "vanilla" && ctx.input.projectPath) {
|
|
33
|
+
try {
|
|
34
|
+
ctx.resolvedArtifact = await svc.resolveArtifact({
|
|
35
|
+
target: { kind: "version", value: ctx.version },
|
|
36
|
+
mapping: ctx.requestedMapping,
|
|
37
|
+
sourcePriority: ctx.currentSourcePriority,
|
|
38
|
+
projectPath: ctx.input.projectPath,
|
|
39
|
+
scope: ctx.input.scope,
|
|
40
|
+
preferProjectVersion: false
|
|
41
|
+
});
|
|
42
|
+
ctx.jarPath = ctx.resolvedArtifact.binaryJarPath ?? (await svc.versionService.resolveVersionJar(ctx.version)).jarPath;
|
|
43
|
+
ctx.warnings.push(...ctx.resolvedArtifact.warnings);
|
|
44
|
+
ctx.mappingApplied = ctx.resolvedArtifact.mappingApplied;
|
|
45
|
+
ctx.signatureLookupMapping = ctx.resolvedArtifact.mappingApplied;
|
|
46
|
+
if (ctx.resolvedArtifact.version) {
|
|
47
|
+
ctx.version = ctx.resolvedArtifact.version;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (scopeErr) {
|
|
51
|
+
ctx.scopeFallback = {
|
|
52
|
+
requested: ctx.input.scope,
|
|
53
|
+
applied: "vanilla",
|
|
54
|
+
reason: `Loom cache unavailable: ${scopeErr instanceof Error ? scopeErr.message : String(scopeErr)}`
|
|
55
|
+
};
|
|
56
|
+
ctx.warnings.push(`Scope "${ctx.input.scope}" resolution failed; falling back to vanilla. ${ctx.scopeFallback.reason}`);
|
|
57
|
+
ctx.jarPath = (await svc.versionService.resolveVersionJar(ctx.version)).jarPath;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
ctx.jarPath = (await svc.versionService.resolveVersionJar(ctx.version)).jarPath;
|
|
62
|
+
}
|
|
63
|
+
if (ctx.jarPath.includes("-sources.jar")) {
|
|
64
|
+
ctx.warnings.push(`Resolved jar appears to be a sources jar. Falling back to vanilla client jar.`);
|
|
65
|
+
ctx.jarPath = (await svc.versionService.resolveVersionJar(ctx.version)).jarPath;
|
|
66
|
+
ctx.signatureLookupMapping = "obfuscated";
|
|
67
|
+
ctx.scopeFallback = {
|
|
68
|
+
requested: ctx.input.scope ?? "vanilla",
|
|
69
|
+
applied: "vanilla",
|
|
70
|
+
reason: "Resolved jar was a sources jar, not a binary class jar."
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (ctx.testHooks?.afterResolve) {
|
|
74
|
+
await ctx.testHooks.afterResolve();
|
|
75
|
+
}
|
|
76
|
+
ctx.checkPreParseBudget("resolve", resolveStartedAt, ctx.stageBudgets.resolve);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParsedMixinTarget } from "../../../mixin-parser.js";
|
|
2
|
+
import type { TargetOutcome as MixinTargetOutcome } from "../../../mixin-validator.js";
|
|
3
|
+
import type { SourceService } from "../../../source-service.js";
|
|
4
|
+
import type { MutableMixinPipelineContext } from "../pipeline-context.js";
|
|
5
|
+
export declare function processSingleMixinTarget(svc: SourceService, ctx: MutableMixinPipelineContext, target: ParsedMixinTarget, targetIndex: number): Promise<MixinTargetOutcome>;
|
|
6
|
+
export declare function runTargetLookupStage(svc: SourceService, ctx: MutableMixinPipelineContext): Promise<void>;
|