@adhisang/minecraft-modding-mcp 1.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 +11 -0
- package/LICENSE +21 -0
- package/README.md +765 -0
- package/dist/access-widener-parser.d.ts +24 -0
- package/dist/access-widener-parser.js +77 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +4 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.js +178 -0
- package/dist/decompiler/vineflower.d.ts +15 -0
- package/dist/decompiler/vineflower.js +185 -0
- package/dist/errors.d.ts +50 -0
- package/dist/errors.js +49 -0
- package/dist/hash.d.ts +1 -0
- package/dist/hash.js +12 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1447 -0
- package/dist/java-process.d.ts +16 -0
- package/dist/java-process.js +120 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +21 -0
- package/dist/mapping-pipeline-service.d.ts +18 -0
- package/dist/mapping-pipeline-service.js +60 -0
- package/dist/mapping-service.d.ts +161 -0
- package/dist/mapping-service.js +1706 -0
- package/dist/maven-resolver.d.ts +22 -0
- package/dist/maven-resolver.js +122 -0
- package/dist/minecraft-explorer-service.d.ts +43 -0
- package/dist/minecraft-explorer-service.js +562 -0
- package/dist/mixin-parser.d.ts +34 -0
- package/dist/mixin-parser.js +194 -0
- package/dist/mixin-validator.d.ts +59 -0
- package/dist/mixin-validator.js +274 -0
- package/dist/mod-analyzer.d.ts +23 -0
- package/dist/mod-analyzer.js +346 -0
- package/dist/mod-decompile-service.d.ts +39 -0
- package/dist/mod-decompile-service.js +136 -0
- package/dist/mod-remap-service.d.ts +17 -0
- package/dist/mod-remap-service.js +186 -0
- package/dist/mod-search-service.d.ts +28 -0
- package/dist/mod-search-service.js +174 -0
- package/dist/mojang-tiny-mapping-service.d.ts +13 -0
- package/dist/mojang-tiny-mapping-service.js +351 -0
- package/dist/nbt/java-nbt-codec.d.ts +3 -0
- package/dist/nbt/java-nbt-codec.js +385 -0
- package/dist/nbt/json-patch.d.ts +3 -0
- package/dist/nbt/json-patch.js +352 -0
- package/dist/nbt/pipeline.d.ts +39 -0
- package/dist/nbt/pipeline.js +173 -0
- package/dist/nbt/typed-json.d.ts +10 -0
- package/dist/nbt/typed-json.js +205 -0
- package/dist/nbt/types.d.ts +66 -0
- package/dist/nbt/types.js +2 -0
- package/dist/observability.d.ts +88 -0
- package/dist/observability.js +165 -0
- package/dist/path-converter.d.ts +12 -0
- package/dist/path-converter.js +161 -0
- package/dist/path-resolver.d.ts +19 -0
- package/dist/path-resolver.js +78 -0
- package/dist/registry-service.d.ts +29 -0
- package/dist/registry-service.js +214 -0
- package/dist/repo-downloader.d.ts +15 -0
- package/dist/repo-downloader.js +111 -0
- package/dist/resources.d.ts +3 -0
- package/dist/resources.js +154 -0
- package/dist/search-hit-accumulator.d.ts +38 -0
- package/dist/search-hit-accumulator.js +153 -0
- package/dist/source-jar-reader.d.ts +13 -0
- package/dist/source-jar-reader.js +216 -0
- package/dist/source-resolver.d.ts +14 -0
- package/dist/source-resolver.js +274 -0
- package/dist/source-service.d.ts +404 -0
- package/dist/source-service.js +2881 -0
- package/dist/storage/artifacts-repo.d.ts +45 -0
- package/dist/storage/artifacts-repo.js +209 -0
- package/dist/storage/db.d.ts +14 -0
- package/dist/storage/db.js +132 -0
- package/dist/storage/files-repo.d.ts +78 -0
- package/dist/storage/files-repo.js +437 -0
- package/dist/storage/index-meta-repo.d.ts +35 -0
- package/dist/storage/index-meta-repo.js +97 -0
- package/dist/storage/migrations.d.ts +11 -0
- package/dist/storage/migrations.js +71 -0
- package/dist/storage/schema.d.ts +1 -0
- package/dist/storage/schema.js +160 -0
- package/dist/storage/sqlite.d.ts +20 -0
- package/dist/storage/sqlite.js +111 -0
- package/dist/storage/symbols-repo.d.ts +63 -0
- package/dist/storage/symbols-repo.js +401 -0
- package/dist/symbols/symbol-extractor.d.ts +7 -0
- package/dist/symbols/symbol-extractor.js +64 -0
- package/dist/tiny-remapper-resolver.d.ts +1 -0
- package/dist/tiny-remapper-resolver.js +62 -0
- package/dist/tiny-remapper-service.d.ts +16 -0
- package/dist/tiny-remapper-service.js +73 -0
- package/dist/types.d.ts +120 -0
- package/dist/types.js +2 -0
- package/dist/version-diff-service.d.ts +41 -0
- package/dist/version-diff-service.js +222 -0
- package/dist/version-service.d.ts +70 -0
- package/dist/version-service.js +411 -0
- package/dist/vineflower-resolver.d.ts +1 -0
- package/dist/vineflower-resolver.js +62 -0
- package/dist/workspace-mapping-service.d.ts +18 -0
- package/dist/workspace-mapping-service.js +89 -0
- package/package.json +61 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface MavenCoordinate {
|
|
2
|
+
groupId: string;
|
|
3
|
+
artifactId: string;
|
|
4
|
+
version: string;
|
|
5
|
+
classifier?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface MavenCandidate {
|
|
8
|
+
coordinate: MavenCoordinate;
|
|
9
|
+
sourceJarPath?: string;
|
|
10
|
+
binaryJarPath?: string;
|
|
11
|
+
sourceUrl?: string;
|
|
12
|
+
binaryUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseCoordinate(coordinate: string): MavenCoordinate;
|
|
15
|
+
export declare function normalizedCoordinateValue(coordinate: string): string;
|
|
16
|
+
export declare function resolveLocalM2Candidate(localM2Path: string, coordinateValue: string): MavenCandidate;
|
|
17
|
+
export declare function localArtifactPathsFromCoordinate(localM2Path: string, coordinate: string): MavenCandidate;
|
|
18
|
+
export declare function hasExistingJar(path: string | undefined): boolean;
|
|
19
|
+
export declare function resolveLocalSourceJar(localM2Path: string, coordinate: string): string | undefined;
|
|
20
|
+
export declare function enumerateLocalAlternativeSourceJars(localM2Path: string, coordinate: string): string[];
|
|
21
|
+
export declare function buildRemoteSourceUrls(repoBaseUrls: string[], coordinate: string): string[];
|
|
22
|
+
export declare function buildRemoteBinaryUrls(repoBaseUrls: string[], coordinate: string): string[];
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { accessSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { ERROR_CODES, createError } from "./errors.js";
|
|
4
|
+
export function parseCoordinate(coordinate) {
|
|
5
|
+
const values = coordinate.trim().split(":");
|
|
6
|
+
if (values.length !== 3 && values.length !== 4) {
|
|
7
|
+
throw createError({
|
|
8
|
+
code: ERROR_CODES.COORDINATE_PARSE_FAILED,
|
|
9
|
+
message: `Invalid maven coordinate "${coordinate}". Expected group:artifact:version[:classifier].`,
|
|
10
|
+
details: { coordinate }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
const [groupId, artifactId, version, classifier] = values;
|
|
14
|
+
if (!groupId || !artifactId || !version) {
|
|
15
|
+
throw createError({
|
|
16
|
+
code: ERROR_CODES.COORDINATE_PARSE_FAILED,
|
|
17
|
+
message: `Invalid maven coordinate "${coordinate}". All fields must be non-empty.`,
|
|
18
|
+
details: { coordinate }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
groupId,
|
|
23
|
+
artifactId,
|
|
24
|
+
version,
|
|
25
|
+
classifier: classifier?.trim() || undefined
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function groupToPath(groupId) {
|
|
29
|
+
return groupId.split(".").filter(Boolean).join("/");
|
|
30
|
+
}
|
|
31
|
+
export function normalizedCoordinateValue(coordinate) {
|
|
32
|
+
const parsed = parseCoordinate(coordinate);
|
|
33
|
+
return `${parsed.groupId}:${parsed.artifactId}:${parsed.version}${parsed.classifier ? `:${parsed.classifier}` : ""}`;
|
|
34
|
+
}
|
|
35
|
+
function localCandidatePaths(root, coordinate) {
|
|
36
|
+
const groupPath = groupToPath(coordinate.groupId);
|
|
37
|
+
const versionDir = join(root, groupPath, coordinate.artifactId, coordinate.version);
|
|
38
|
+
const baseName = `${coordinate.artifactId}-${coordinate.version}`;
|
|
39
|
+
const sourceFile = coordinate.classifier
|
|
40
|
+
? `${baseName}-${coordinate.classifier}-sources.jar`
|
|
41
|
+
: `${baseName}-sources.jar`;
|
|
42
|
+
const binaryFile = coordinate.classifier
|
|
43
|
+
? `${baseName}-${coordinate.classifier}.jar`
|
|
44
|
+
: `${baseName}.jar`;
|
|
45
|
+
return {
|
|
46
|
+
coordinate,
|
|
47
|
+
sourceJarPath: join(versionDir, sourceFile),
|
|
48
|
+
binaryJarPath: join(versionDir, binaryFile)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function resolveLocalM2Candidate(localM2Path, coordinateValue) {
|
|
52
|
+
const parsed = parseCoordinate(coordinateValue);
|
|
53
|
+
return localCandidatePaths(localM2Path, parsed);
|
|
54
|
+
}
|
|
55
|
+
export function localArtifactPathsFromCoordinate(localM2Path, coordinate) {
|
|
56
|
+
return resolveLocalM2Candidate(localM2Path, coordinate);
|
|
57
|
+
}
|
|
58
|
+
export function hasExistingJar(path) {
|
|
59
|
+
if (!path) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
accessSync(path);
|
|
64
|
+
return statSync(path).isFile();
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function resolveLocalSourceJar(localM2Path, coordinate) {
|
|
71
|
+
const candidate = resolveLocalM2Candidate(localM2Path, coordinate);
|
|
72
|
+
if (hasExistingJar(candidate.sourceJarPath)) {
|
|
73
|
+
return candidate.sourceJarPath;
|
|
74
|
+
}
|
|
75
|
+
if (hasExistingJar(candidate.binaryJarPath)) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
export function enumerateLocalAlternativeSourceJars(localM2Path, coordinate) {
|
|
81
|
+
const parsed = parseCoordinate(coordinate);
|
|
82
|
+
const groupPath = groupToPath(parsed.groupId);
|
|
83
|
+
const candidateDir = join(localM2Path, groupPath, parsed.artifactId, parsed.version);
|
|
84
|
+
const exactSourcePrefix = `${parsed.artifactId}-${parsed.version}`;
|
|
85
|
+
try {
|
|
86
|
+
const files = readdirSync(candidateDir);
|
|
87
|
+
const candidates = files
|
|
88
|
+
.filter((fileName) => fileName.toLowerCase().endsWith("-sources.jar"))
|
|
89
|
+
.filter((fileName) => fileName.startsWith(exactSourcePrefix))
|
|
90
|
+
.map((fileName) => join(candidateDir, fileName));
|
|
91
|
+
return candidates;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export function buildRemoteSourceUrls(repoBaseUrls, coordinate) {
|
|
98
|
+
const parsed = parseCoordinate(coordinate);
|
|
99
|
+
const groupPath = groupToPath(parsed.groupId);
|
|
100
|
+
const baseName = `${parsed.artifactId}-${parsed.version}`;
|
|
101
|
+
const classifierSuffix = parsed.classifier ? `-${parsed.classifier}` : "";
|
|
102
|
+
const sourceArtifact = `${baseName}${classifierSuffix}-sources.jar`;
|
|
103
|
+
const fallbackSourceArtifact = `${baseName}-sources.jar`;
|
|
104
|
+
const urls = [];
|
|
105
|
+
for (const repo of repoBaseUrls) {
|
|
106
|
+
const sourceUrl = `${repo.replace(/\/$/, "")}/${groupPath}/${parsed.artifactId}/${parsed.version}/${sourceArtifact}`;
|
|
107
|
+
urls.push(sourceUrl);
|
|
108
|
+
if (fallbackSourceArtifact !== sourceArtifact) {
|
|
109
|
+
urls.push(`${repo.replace(/\/$/, "")}/${groupPath}/${parsed.artifactId}/${parsed.version}/${fallbackSourceArtifact}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return urls;
|
|
113
|
+
}
|
|
114
|
+
export function buildRemoteBinaryUrls(repoBaseUrls, coordinate) {
|
|
115
|
+
const parsed = parseCoordinate(coordinate);
|
|
116
|
+
const groupPath = groupToPath(parsed.groupId);
|
|
117
|
+
const baseName = `${parsed.artifactId}-${parsed.version}`;
|
|
118
|
+
const classifierSuffix = parsed.classifier ? `-${parsed.classifier}` : "";
|
|
119
|
+
const binaryArtifact = `${baseName}${classifierSuffix}.jar`;
|
|
120
|
+
return repoBaseUrls.map((repo) => `${repo.replace(/\/$/, "")}/${groupPath}/${parsed.artifactId}/${parsed.version}/${binaryArtifact}`);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=maven-resolver.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Config } from "./types.js";
|
|
2
|
+
export type MappingNamespace = "official" | "mojang" | "yarn";
|
|
3
|
+
type SignatureAccess = "public" | "all";
|
|
4
|
+
export interface ResponseContext {
|
|
5
|
+
minecraftVersion: string;
|
|
6
|
+
mappingType: string;
|
|
7
|
+
mappingNamespace: MappingNamespace;
|
|
8
|
+
jarHash: string;
|
|
9
|
+
generatedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SignatureMember {
|
|
12
|
+
ownerFqn: string;
|
|
13
|
+
name: string;
|
|
14
|
+
javaSignature: string;
|
|
15
|
+
jvmDescriptor: string;
|
|
16
|
+
accessFlags: number;
|
|
17
|
+
isSynthetic: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface GetSignatureInput {
|
|
20
|
+
fqn: string;
|
|
21
|
+
jarPath: string;
|
|
22
|
+
memberPattern?: string;
|
|
23
|
+
access?: SignatureAccess;
|
|
24
|
+
includeSynthetic?: boolean;
|
|
25
|
+
includeInherited?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface GetSignatureOutput {
|
|
28
|
+
constructors: SignatureMember[];
|
|
29
|
+
methods: SignatureMember[];
|
|
30
|
+
fields: SignatureMember[];
|
|
31
|
+
warnings: string[];
|
|
32
|
+
context: ResponseContext;
|
|
33
|
+
}
|
|
34
|
+
export declare class MinecraftExplorerService {
|
|
35
|
+
private readonly config;
|
|
36
|
+
private readonly signatureCache;
|
|
37
|
+
constructor(explicitConfig?: Config);
|
|
38
|
+
getSignature(input: GetSignatureInput): Promise<GetSignatureOutput>;
|
|
39
|
+
private contextForJar;
|
|
40
|
+
private normalizeJarPathOrThrow;
|
|
41
|
+
private trimSignatureCache;
|
|
42
|
+
}
|
|
43
|
+
export {};
|