@adhisang/minecraft-modding-mcp 3.2.0 → 4.1.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 +72 -0
- package/README.md +52 -32
- 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 +59 -7
- package/dist/config.d.ts +10 -1
- package/dist/config.js +52 -1
- package/dist/entry-tools/analyze-symbol-service.d.ts +18 -18
- package/dist/entry-tools/analyze-symbol-service.js +13 -2
- 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 +213 -328
- package/dist/entry-tools/inspect-minecraft-service.js +20 -1238
- 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 +97 -0
- package/dist/entry-tools/validate-project/cases/project-summary.js +346 -0
- package/dist/entry-tools/validate-project/internal.d.ts +135 -0
- package/dist/entry-tools/validate-project/internal.js +287 -0
- package/dist/entry-tools/validate-project-service.d.ts +63 -47
- package/dist/entry-tools/validate-project-service.js +12 -482
- 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 +170 -1314
- package/dist/lru-list.d.ts +31 -0
- package/dist/lru-list.js +102 -0
- 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.d.ts +10 -1
- package/dist/mapping-pipeline-service.js +16 -3
- package/dist/mapping-service.d.ts +15 -144
- package/dist/mapping-service.js +179 -1119
- 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 -1005
- package/dist/observability.d.ts +18 -1
- package/dist/observability.js +44 -1
- package/dist/response-utils.d.ts +44 -10
- package/dist/response-utils.js +131 -17
- package/dist/source/access-validate.d.ts +4 -0
- package/dist/source/access-validate.js +254 -0
- package/dist/source/artifact-resolver.d.ts +110 -0
- package/dist/source/artifact-resolver.js +1174 -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 +505 -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 +21 -0
- package/dist/source/state.js +19 -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 +9 -1
- package/dist/source-resolver.js +14 -6
- package/dist/source-service.d.ts +178 -105
- package/dist/source-service.js +72 -5312
- 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/storage/artifacts-repo.d.ts +4 -1
- package/dist/storage/artifacts-repo.js +33 -5
- package/dist/storage/files-repo.d.ts +0 -2
- package/dist/storage/files-repo.js +0 -11
- package/dist/storage/migrations.d.ts +1 -1
- package/dist/storage/migrations.js +10 -2
- package/dist/storage/schema.d.ts +2 -0
- package/dist/storage/schema.js +25 -0
- 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 +39 -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 +414 -0
- package/docs/examples.md +483 -0
- package/docs/tool-reference.md +459 -0
- package/package.json +5 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CheckSymbolExistsInput, CheckSymbolExistsOutput, ResolveArtifactInput, ResolveArtifactOutput } from "../source-service.js";
|
|
2
|
+
import type { ArtifactScope, MappingSourcePriority, SourceMapping, WorkspaceTargetInput, SourceTargetInput } from "../types.js";
|
|
3
|
+
export type BatchSymbolExistsDeps = {
|
|
4
|
+
resolveArtifact: (input: ResolveArtifactInput) => Promise<ResolveArtifactOutput>;
|
|
5
|
+
checkSymbolExists: (input: CheckSymbolExistsInput) => Promise<CheckSymbolExistsOutput>;
|
|
6
|
+
};
|
|
7
|
+
import { type BatchOutput } from "./batch-runner.js";
|
|
8
|
+
type SymbolKind = "class" | "field" | "method";
|
|
9
|
+
export type BatchSymbolExistsEntry = {
|
|
10
|
+
kind: SymbolKind;
|
|
11
|
+
name: string;
|
|
12
|
+
owner?: string;
|
|
13
|
+
descriptor?: string;
|
|
14
|
+
nameMode?: "fqcn" | "auto";
|
|
15
|
+
signatureMode?: "exact" | "name-only";
|
|
16
|
+
maxCandidates?: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Subset of `ResolveArtifactTargetInput` accepted by `batch-symbol-exists`.
|
|
20
|
+
* Library/jar/coordinate targets carry the library's own version, not the
|
|
21
|
+
* Minecraft version, so querying the Minecraft mapping graph with that value
|
|
22
|
+
* would be a category error. The zod schema rejects the disallowed kinds.
|
|
23
|
+
*/
|
|
24
|
+
export type BatchSymbolExistsTarget = (SourceTargetInput & {
|
|
25
|
+
kind: "version";
|
|
26
|
+
}) | WorkspaceTargetInput;
|
|
27
|
+
export type BatchSymbolExistsInput = {
|
|
28
|
+
target: BatchSymbolExistsTarget;
|
|
29
|
+
mapping?: SourceMapping;
|
|
30
|
+
sourcePriority?: MappingSourcePriority;
|
|
31
|
+
allowDecompile?: boolean;
|
|
32
|
+
projectPath?: string;
|
|
33
|
+
scope?: ArtifactScope;
|
|
34
|
+
preferProjectVersion?: boolean;
|
|
35
|
+
strictVersion?: boolean;
|
|
36
|
+
concurrency?: number;
|
|
37
|
+
failFast?: boolean;
|
|
38
|
+
compact?: boolean;
|
|
39
|
+
entries: readonly BatchSymbolExistsEntry[];
|
|
40
|
+
};
|
|
41
|
+
export declare class BatchSymbolExistsService {
|
|
42
|
+
private readonly deps;
|
|
43
|
+
constructor(deps: BatchSymbolExistsDeps);
|
|
44
|
+
execute(input: BatchSymbolExistsInput): Promise<BatchOutput<Record<string, unknown>>>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { buildSuggestedCall } from "../build-suggested-call.js";
|
|
2
|
+
import { createError, ERROR_CODES } from "../errors.js";
|
|
3
|
+
import { compactResponse, compactMappingResponse } from "../response-utils.js";
|
|
4
|
+
import { runBatch, splitEntryWarnings } from "./batch-runner.js";
|
|
5
|
+
function deriveMinecraftVersion(resolvedVersion, workspaceVersion) {
|
|
6
|
+
const candidate = resolvedVersion?.trim() || workspaceVersion?.trim();
|
|
7
|
+
if (!candidate) {
|
|
8
|
+
throw createError({
|
|
9
|
+
code: ERROR_CODES.WORKSPACE_VERSION_UNRESOLVED,
|
|
10
|
+
message: "batch-symbol-exists could not derive a Minecraft version from the shared artifact (use target.kind=version or set projectPath so the workspace resolution detects it).",
|
|
11
|
+
details: {
|
|
12
|
+
nextAction: "Pass target.kind=\"version\" with the desired Minecraft version, or ensure target.kind=\"workspace\" projectPath points to a Loom/Forge project whose gradle.properties carries minecraft_version."
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return candidate;
|
|
17
|
+
}
|
|
18
|
+
export class BatchSymbolExistsService {
|
|
19
|
+
deps;
|
|
20
|
+
constructor(deps) {
|
|
21
|
+
this.deps = deps;
|
|
22
|
+
}
|
|
23
|
+
async execute(input) {
|
|
24
|
+
const concurrency = input.concurrency ?? 4;
|
|
25
|
+
const failFast = input.failFast ?? false;
|
|
26
|
+
const compact = input.compact ?? true;
|
|
27
|
+
return runBatch({
|
|
28
|
+
entries: input.entries,
|
|
29
|
+
concurrency,
|
|
30
|
+
failFast,
|
|
31
|
+
resolveSharedArtifact: async () => {
|
|
32
|
+
const resolved = await this.deps.resolveArtifact({
|
|
33
|
+
target: input.target,
|
|
34
|
+
mapping: input.mapping,
|
|
35
|
+
sourcePriority: input.sourcePriority,
|
|
36
|
+
allowDecompile: input.allowDecompile,
|
|
37
|
+
projectPath: input.projectPath,
|
|
38
|
+
scope: input.scope,
|
|
39
|
+
preferProjectVersion: input.preferProjectVersion,
|
|
40
|
+
strictVersion: input.strictVersion
|
|
41
|
+
});
|
|
42
|
+
const provenance = resolved.provenance;
|
|
43
|
+
const workspaceVersion = provenance?.workspaceResolution?.detected?.minecraftVersion;
|
|
44
|
+
const version = deriveMinecraftVersion(resolved.version, workspaceVersion);
|
|
45
|
+
return {
|
|
46
|
+
artifactId: resolved.artifactId,
|
|
47
|
+
provenance: resolved.provenance,
|
|
48
|
+
version,
|
|
49
|
+
sourceMapping: resolved.mappingApplied,
|
|
50
|
+
...(Array.isArray(resolved.warnings) && resolved.warnings.length > 0
|
|
51
|
+
? { warnings: [...resolved.warnings] }
|
|
52
|
+
: {})
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
artifactSummary: (artifact) => ({
|
|
56
|
+
sharedArtifactId: artifact.artifactId,
|
|
57
|
+
...(artifact.provenance ? { sharedArtifactProvenance: artifact.provenance } : {}),
|
|
58
|
+
...(artifact.warnings && artifact.warnings.length > 0
|
|
59
|
+
? { sharedArtifactWarnings: artifact.warnings }
|
|
60
|
+
: {})
|
|
61
|
+
}),
|
|
62
|
+
perEntry: async (entry, _index, sharedArtifact) => {
|
|
63
|
+
if (!sharedArtifact) {
|
|
64
|
+
throw new Error("shared artifact not resolved");
|
|
65
|
+
}
|
|
66
|
+
const raw = (await this.deps.checkSymbolExists({
|
|
67
|
+
version: sharedArtifact.version,
|
|
68
|
+
kind: entry.kind,
|
|
69
|
+
name: entry.name,
|
|
70
|
+
owner: entry.owner,
|
|
71
|
+
descriptor: entry.descriptor,
|
|
72
|
+
sourceMapping: sharedArtifact.sourceMapping,
|
|
73
|
+
sourcePriority: input.sourcePriority,
|
|
74
|
+
nameMode: entry.nameMode,
|
|
75
|
+
signatureMode: entry.signatureMode,
|
|
76
|
+
maxCandidates: entry.maxCandidates,
|
|
77
|
+
projectPath: input.projectPath
|
|
78
|
+
}));
|
|
79
|
+
const { result, warnings } = splitEntryWarnings(raw);
|
|
80
|
+
const projected = compact
|
|
81
|
+
? compactResponse(compactMappingResponse(result))
|
|
82
|
+
: result;
|
|
83
|
+
return { result: projected, warnings };
|
|
84
|
+
},
|
|
85
|
+
buildErrorSuggestedCall: (entry, sharedArtifact) => {
|
|
86
|
+
if (!sharedArtifact)
|
|
87
|
+
return undefined;
|
|
88
|
+
const params = {
|
|
89
|
+
version: sharedArtifact.version,
|
|
90
|
+
kind: entry.kind,
|
|
91
|
+
name: entry.name,
|
|
92
|
+
sourceMapping: sharedArtifact.sourceMapping
|
|
93
|
+
};
|
|
94
|
+
if (entry.owner !== undefined)
|
|
95
|
+
params.owner = entry.owner;
|
|
96
|
+
if (entry.descriptor !== undefined)
|
|
97
|
+
params.descriptor = entry.descriptor;
|
|
98
|
+
if (entry.nameMode !== undefined)
|
|
99
|
+
params.nameMode = entry.nameMode;
|
|
100
|
+
if (entry.signatureMode !== undefined)
|
|
101
|
+
params.signatureMode = entry.signatureMode;
|
|
102
|
+
if (entry.maxCandidates !== undefined)
|
|
103
|
+
params.maxCandidates = entry.maxCandidates;
|
|
104
|
+
const { suggestedCall } = buildSuggestedCall({
|
|
105
|
+
tool: "check-symbol-exists",
|
|
106
|
+
params
|
|
107
|
+
});
|
|
108
|
+
return suggestedCall;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=batch-symbol-exists-service.js.map
|
|
@@ -31,14 +31,14 @@ export declare const compareMinecraftShape: {
|
|
|
31
31
|
className: string;
|
|
32
32
|
fromVersion: string;
|
|
33
33
|
toVersion: string;
|
|
34
|
-
mapping?: "
|
|
34
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
35
35
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
36
36
|
}, {
|
|
37
37
|
kind: "class";
|
|
38
38
|
className: string;
|
|
39
39
|
fromVersion: string;
|
|
40
40
|
toVersion: string;
|
|
41
|
-
mapping?: "
|
|
41
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
42
42
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
43
43
|
}>, z.ZodObject<{
|
|
44
44
|
kind: z.ZodLiteral<"registry">;
|
|
@@ -92,14 +92,14 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
92
92
|
className: string;
|
|
93
93
|
fromVersion: string;
|
|
94
94
|
toVersion: string;
|
|
95
|
-
mapping?: "
|
|
95
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
96
96
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
97
97
|
}, {
|
|
98
98
|
kind: "class";
|
|
99
99
|
className: string;
|
|
100
100
|
fromVersion: string;
|
|
101
101
|
toVersion: string;
|
|
102
|
-
mapping?: "
|
|
102
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
103
103
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
104
104
|
}>, z.ZodObject<{
|
|
105
105
|
kind: z.ZodLiteral<"registry">;
|
|
@@ -135,7 +135,7 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
135
135
|
className: string;
|
|
136
136
|
fromVersion: string;
|
|
137
137
|
toVersion: string;
|
|
138
|
-
mapping?: "
|
|
138
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
139
139
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
140
140
|
} | {
|
|
141
141
|
kind: "registry";
|
|
@@ -160,7 +160,7 @@ export declare const compareMinecraftSchema: z.ZodObject<{
|
|
|
160
160
|
className: string;
|
|
161
161
|
fromVersion: string;
|
|
162
162
|
toVersion: string;
|
|
163
|
-
mapping?: "
|
|
163
|
+
mapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
164
164
|
sourcePriority?: "loom-first" | "maven-first" | undefined;
|
|
165
165
|
} | {
|
|
166
166
|
kind: "registry";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleArtifact(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { buildEntryToolResult, createNextAction, createSummarySubject } from "../../response-contract.js";
|
|
2
|
+
import { nextActionsOrUndefined } from "../../request-normalizers.js";
|
|
3
|
+
import { resolveArtifactReference } from "../internal.js";
|
|
4
|
+
export async function handleArtifact(deps, subject, detail, include) {
|
|
5
|
+
const resolved = await resolveArtifactReference(deps, subject);
|
|
6
|
+
if (!resolved.artifactId) {
|
|
7
|
+
const summary = {
|
|
8
|
+
status: "blocked",
|
|
9
|
+
headline: "Could not resolve an artifact without a Minecraft version.",
|
|
10
|
+
subject: createSummarySubject({
|
|
11
|
+
task: "artifact",
|
|
12
|
+
requested: subject
|
|
13
|
+
}),
|
|
14
|
+
nextActions: nextActionsOrUndefined([
|
|
15
|
+
createNextAction("inspect-minecraft", {
|
|
16
|
+
task: "artifact",
|
|
17
|
+
subject: {
|
|
18
|
+
kind: "version",
|
|
19
|
+
version: "1.21.10"
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
])
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
...buildEntryToolResult({
|
|
26
|
+
task: "artifact",
|
|
27
|
+
summary,
|
|
28
|
+
detail,
|
|
29
|
+
include,
|
|
30
|
+
blocks: {
|
|
31
|
+
subject: {
|
|
32
|
+
requested: subject
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
alwaysBlocks: ["subject"]
|
|
36
|
+
}),
|
|
37
|
+
warnings: resolved.warnings
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const summary = {
|
|
41
|
+
status: "ok",
|
|
42
|
+
headline: `Resolved artifact ${resolved.artifactId}.`,
|
|
43
|
+
subject: createSummarySubject({
|
|
44
|
+
task: "artifact",
|
|
45
|
+
requested: subject,
|
|
46
|
+
artifactId: resolved.artifactId,
|
|
47
|
+
version: resolved.version
|
|
48
|
+
}),
|
|
49
|
+
counts: {
|
|
50
|
+
warnings: resolved.warnings.length
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
...buildEntryToolResult({
|
|
55
|
+
task: "artifact",
|
|
56
|
+
summary,
|
|
57
|
+
detail,
|
|
58
|
+
include,
|
|
59
|
+
blocks: {
|
|
60
|
+
subject: {
|
|
61
|
+
requested: subject,
|
|
62
|
+
resolved: {
|
|
63
|
+
artifactId: resolved.artifactId,
|
|
64
|
+
version: resolved.version
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
artifact: resolved.artifact
|
|
68
|
+
? {
|
|
69
|
+
artifactId: resolved.artifact.artifactId,
|
|
70
|
+
artifactAlias: resolved.artifact.artifactAlias,
|
|
71
|
+
origin: resolved.artifact.origin,
|
|
72
|
+
mappingApplied: resolved.artifact.mappingApplied,
|
|
73
|
+
version: resolved.artifact.version,
|
|
74
|
+
artifactContents: resolved.artifact.artifactContents
|
|
75
|
+
}
|
|
76
|
+
: { artifactId: resolved.artifactId }
|
|
77
|
+
},
|
|
78
|
+
alwaysBlocks: ["subject"]
|
|
79
|
+
}),
|
|
80
|
+
warnings: resolved.warnings
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleClassMembers(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[], limit: number | undefined): Promise<{
|
|
4
|
+
meta?: Record<string, unknown> | undefined;
|
|
5
|
+
warnings: string[];
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { buildEntryToolResult, buildEntryToolMeta, createNextAction, createSummarySubject, createTruncationMeta } from "../../response-contract.js";
|
|
2
|
+
import { buildClassSubject, resolveClassArtifactReference, invalidTaskSubjectError } from "../internal.js";
|
|
3
|
+
export async function handleClassMembers(deps, subject, detail, include, limit) {
|
|
4
|
+
if (subject.kind !== "class" && !(subject.kind === "workspace" && subject.focus?.kind === "class")) {
|
|
5
|
+
invalidTaskSubjectError("class-members", subject);
|
|
6
|
+
}
|
|
7
|
+
const classSubject = buildClassSubject(subject);
|
|
8
|
+
const artifact = await resolveClassArtifactReference(deps, subject, classSubject, "class-members");
|
|
9
|
+
const members = await deps.getClassMembers({
|
|
10
|
+
className: classSubject.className,
|
|
11
|
+
artifactId: artifact.artifactId || undefined,
|
|
12
|
+
mapping: classSubject.mapping,
|
|
13
|
+
scope: classSubject.scope,
|
|
14
|
+
projectPath: classSubject.projectPath,
|
|
15
|
+
preferProjectVersion: classSubject.preferProjectVersion,
|
|
16
|
+
strictVersion: classSubject.strictVersion,
|
|
17
|
+
maxMembers: limit
|
|
18
|
+
});
|
|
19
|
+
const summary = {
|
|
20
|
+
status: members.truncated ? "partial" : "ok",
|
|
21
|
+
headline: `Collected ${members.counts.total} members for ${members.className}.`,
|
|
22
|
+
subject: createSummarySubject({
|
|
23
|
+
task: "class-members",
|
|
24
|
+
requested: subject,
|
|
25
|
+
className: members.className,
|
|
26
|
+
artifactId: members.artifactId
|
|
27
|
+
}),
|
|
28
|
+
counts: members.counts
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
...buildEntryToolResult({
|
|
32
|
+
task: "class-members",
|
|
33
|
+
summary,
|
|
34
|
+
detail,
|
|
35
|
+
include,
|
|
36
|
+
blocks: {
|
|
37
|
+
subject: {
|
|
38
|
+
requested: subject,
|
|
39
|
+
resolved: {
|
|
40
|
+
artifactId: members.artifactId,
|
|
41
|
+
className: members.className
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
members: include.includes("members") || detail !== "summary"
|
|
45
|
+
? {
|
|
46
|
+
...members.members,
|
|
47
|
+
...(members.decompiledFallback ? { decompiledFallback: members.decompiledFallback } : {}),
|
|
48
|
+
...(members.decompiledMemberCounts ? { decompiledMemberCounts: members.decompiledMemberCounts } : {})
|
|
49
|
+
}
|
|
50
|
+
: {
|
|
51
|
+
counts: members.counts,
|
|
52
|
+
...(members.decompiledMemberCounts ? { decompiledMemberCounts: members.decompiledMemberCounts } : {})
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
alwaysBlocks: ["subject"]
|
|
56
|
+
}),
|
|
57
|
+
warnings: [...artifact.warnings, ...members.warnings],
|
|
58
|
+
...(members.truncated
|
|
59
|
+
? {
|
|
60
|
+
meta: buildEntryToolMeta({
|
|
61
|
+
detail,
|
|
62
|
+
include,
|
|
63
|
+
warnings: [...artifact.warnings, ...members.warnings],
|
|
64
|
+
truncated: createTruncationMeta({
|
|
65
|
+
omittedGroups: ["members"],
|
|
66
|
+
nextActions: [
|
|
67
|
+
createNextAction("inspect-minecraft", {
|
|
68
|
+
task: "class-members",
|
|
69
|
+
detail: "full",
|
|
70
|
+
include: ["members"],
|
|
71
|
+
subject
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
: {})
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=class-members.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleClassOverview(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { buildEntryToolResult, createNextAction, createSummarySubject } from "../../response-contract.js";
|
|
2
|
+
import { nextActionsOrUndefined } from "../../request-normalizers.js";
|
|
3
|
+
import { hasPartialVanillaCoverage, buildClassSubject, resolveClassArtifactReference, invalidTaskSubjectError, resolveBinaryBackedClass } from "../internal.js";
|
|
4
|
+
export async function handleClassOverview(deps, subject, detail, include) {
|
|
5
|
+
if (subject.kind !== "class" && !(subject.kind === "workspace" && subject.focus?.kind === "class")) {
|
|
6
|
+
invalidTaskSubjectError("class-overview", subject);
|
|
7
|
+
}
|
|
8
|
+
const classSubject = buildClassSubject(subject);
|
|
9
|
+
const className = classSubject.className;
|
|
10
|
+
const artifact = await resolveClassArtifactReference(deps, subject, classSubject, "class-overview");
|
|
11
|
+
if (!artifact.artifactId) {
|
|
12
|
+
const summary = {
|
|
13
|
+
status: "blocked",
|
|
14
|
+
headline: `Could not resolve artifact context for ${className}.`,
|
|
15
|
+
subject: createSummarySubject({
|
|
16
|
+
task: "class-overview",
|
|
17
|
+
requested: subject,
|
|
18
|
+
className
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
...buildEntryToolResult({
|
|
23
|
+
task: "class-overview",
|
|
24
|
+
summary,
|
|
25
|
+
detail,
|
|
26
|
+
include,
|
|
27
|
+
blocks: {
|
|
28
|
+
subject: {
|
|
29
|
+
requested: subject
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
alwaysBlocks: ["subject"]
|
|
33
|
+
}),
|
|
34
|
+
warnings: artifact.warnings
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const matches = await deps.findClass({
|
|
38
|
+
artifactId: artifact.artifactId,
|
|
39
|
+
className,
|
|
40
|
+
limit: 10
|
|
41
|
+
});
|
|
42
|
+
if (matches.total === 0) {
|
|
43
|
+
const partialSourceFallback = subject.kind === "workspace" && hasPartialVanillaCoverage(artifact.artifact)
|
|
44
|
+
? await resolveBinaryBackedClass(deps, className, {
|
|
45
|
+
version: artifact.version,
|
|
46
|
+
mapping: classSubject.mapping
|
|
47
|
+
})
|
|
48
|
+
: undefined;
|
|
49
|
+
if (partialSourceFallback) {
|
|
50
|
+
const metadata = await deps.getClassSource({
|
|
51
|
+
className: partialSourceFallback.className,
|
|
52
|
+
artifactId: artifact.artifactId,
|
|
53
|
+
mapping: classSubject.mapping,
|
|
54
|
+
scope: classSubject.scope,
|
|
55
|
+
projectPath: classSubject.projectPath,
|
|
56
|
+
preferProjectVersion: classSubject.preferProjectVersion,
|
|
57
|
+
strictVersion: classSubject.strictVersion,
|
|
58
|
+
mode: "metadata"
|
|
59
|
+
});
|
|
60
|
+
const summary = {
|
|
61
|
+
status: "ok",
|
|
62
|
+
headline: `Resolved class overview for ${partialSourceFallback.className}.`,
|
|
63
|
+
subject: createSummarySubject({
|
|
64
|
+
task: "class-overview",
|
|
65
|
+
requested: subject,
|
|
66
|
+
className: partialSourceFallback.className,
|
|
67
|
+
artifactId: metadata.artifactId
|
|
68
|
+
}),
|
|
69
|
+
counts: {
|
|
70
|
+
totalLines: metadata.totalLines
|
|
71
|
+
},
|
|
72
|
+
notes: [
|
|
73
|
+
"Source coverage was partial, so inspect-minecraft confirmed the vanilla class through binary-backed symbol lookup."
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
...buildEntryToolResult({
|
|
78
|
+
task: "class-overview",
|
|
79
|
+
summary,
|
|
80
|
+
detail,
|
|
81
|
+
include,
|
|
82
|
+
blocks: {
|
|
83
|
+
subject: {
|
|
84
|
+
requested: subject,
|
|
85
|
+
resolved: {
|
|
86
|
+
artifactId: metadata.artifactId,
|
|
87
|
+
className: partialSourceFallback.className
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
class: {
|
|
91
|
+
className: partialSourceFallback.className,
|
|
92
|
+
totalLines: metadata.totalLines,
|
|
93
|
+
returnedNamespace: metadata.returnedNamespace
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
alwaysBlocks: ["subject"]
|
|
97
|
+
}),
|
|
98
|
+
warnings: [
|
|
99
|
+
...artifact.warnings,
|
|
100
|
+
...matches.warnings,
|
|
101
|
+
...partialSourceFallback.warnings,
|
|
102
|
+
...metadata.warnings
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const summary = {
|
|
107
|
+
status: "not_found",
|
|
108
|
+
headline: `No class match was found for ${className}.`,
|
|
109
|
+
subject: createSummarySubject({
|
|
110
|
+
task: "class-overview",
|
|
111
|
+
requested: subject,
|
|
112
|
+
className,
|
|
113
|
+
artifactId: artifact.artifactId
|
|
114
|
+
})
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
...buildEntryToolResult({
|
|
118
|
+
task: "class-overview",
|
|
119
|
+
summary,
|
|
120
|
+
detail,
|
|
121
|
+
include,
|
|
122
|
+
blocks: {
|
|
123
|
+
subject: {
|
|
124
|
+
requested: subject,
|
|
125
|
+
resolved: {
|
|
126
|
+
artifactId: artifact.artifactId
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
alwaysBlocks: ["subject"]
|
|
131
|
+
}),
|
|
132
|
+
warnings: [...artifact.warnings, ...matches.warnings]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (matches.total > 1) {
|
|
136
|
+
const candidateActions = matches.matches.slice(0, 3).map((match) => createNextAction("inspect-minecraft", {
|
|
137
|
+
task: "class-source",
|
|
138
|
+
subject: {
|
|
139
|
+
kind: "class",
|
|
140
|
+
className: match.qualifiedName,
|
|
141
|
+
artifact: {
|
|
142
|
+
type: "resolved-id",
|
|
143
|
+
artifactId: artifact.artifactId
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
include: ["source"]
|
|
147
|
+
}));
|
|
148
|
+
const summary = {
|
|
149
|
+
status: "ambiguous",
|
|
150
|
+
headline: `Found ${matches.total} class matches for ${className}.`,
|
|
151
|
+
subject: createSummarySubject({
|
|
152
|
+
task: "class-overview",
|
|
153
|
+
requested: subject,
|
|
154
|
+
className,
|
|
155
|
+
artifactId: artifact.artifactId
|
|
156
|
+
}),
|
|
157
|
+
counts: {
|
|
158
|
+
matches: matches.total
|
|
159
|
+
},
|
|
160
|
+
nextActions: nextActionsOrUndefined(candidateActions)
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
...buildEntryToolResult({
|
|
164
|
+
task: "class-overview",
|
|
165
|
+
summary,
|
|
166
|
+
detail,
|
|
167
|
+
include,
|
|
168
|
+
blocks: {
|
|
169
|
+
subject: {
|
|
170
|
+
requested: subject,
|
|
171
|
+
resolved: {
|
|
172
|
+
artifactId: artifact.artifactId
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
candidates: matches.matches
|
|
176
|
+
},
|
|
177
|
+
alwaysBlocks: ["subject"]
|
|
178
|
+
}),
|
|
179
|
+
warnings: [...artifact.warnings, ...matches.warnings]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
const match = matches.matches[0];
|
|
183
|
+
const metadata = await deps.getClassSource({
|
|
184
|
+
className: match.qualifiedName,
|
|
185
|
+
artifactId: artifact.artifactId,
|
|
186
|
+
mode: "metadata"
|
|
187
|
+
});
|
|
188
|
+
const summary = {
|
|
189
|
+
status: "ok",
|
|
190
|
+
headline: `Resolved class overview for ${match.qualifiedName}.`,
|
|
191
|
+
subject: createSummarySubject({
|
|
192
|
+
task: "class-overview",
|
|
193
|
+
requested: subject,
|
|
194
|
+
className: match.qualifiedName,
|
|
195
|
+
artifactId: artifact.artifactId
|
|
196
|
+
}),
|
|
197
|
+
counts: {
|
|
198
|
+
totalLines: metadata.totalLines
|
|
199
|
+
},
|
|
200
|
+
nextActions: nextActionsOrUndefined([
|
|
201
|
+
createNextAction("inspect-minecraft", {
|
|
202
|
+
task: "class-source",
|
|
203
|
+
subject: {
|
|
204
|
+
kind: "class",
|
|
205
|
+
className: match.qualifiedName,
|
|
206
|
+
artifact: {
|
|
207
|
+
type: "resolved-id",
|
|
208
|
+
artifactId: artifact.artifactId
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
include: ["source"]
|
|
212
|
+
})
|
|
213
|
+
])
|
|
214
|
+
};
|
|
215
|
+
return {
|
|
216
|
+
...buildEntryToolResult({
|
|
217
|
+
task: "class-overview",
|
|
218
|
+
summary,
|
|
219
|
+
detail,
|
|
220
|
+
include,
|
|
221
|
+
blocks: {
|
|
222
|
+
subject: {
|
|
223
|
+
requested: subject,
|
|
224
|
+
resolved: {
|
|
225
|
+
artifactId: artifact.artifactId,
|
|
226
|
+
className: match.qualifiedName
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
artifact: artifact.artifact
|
|
230
|
+
? {
|
|
231
|
+
artifactId: artifact.artifact.artifactId,
|
|
232
|
+
version: artifact.artifact.version,
|
|
233
|
+
origin: artifact.artifact.origin
|
|
234
|
+
}
|
|
235
|
+
: { artifactId: artifact.artifactId },
|
|
236
|
+
class: {
|
|
237
|
+
className: match.qualifiedName,
|
|
238
|
+
filePath: match.filePath,
|
|
239
|
+
totalLines: metadata.totalLines,
|
|
240
|
+
returnedNamespace: metadata.returnedNamespace
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
alwaysBlocks: ["subject"]
|
|
244
|
+
}),
|
|
245
|
+
warnings: [...artifact.warnings, ...matches.warnings, ...metadata.warnings]
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=class-overview.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DetailLevel } from "../../response-contract.js";
|
|
2
|
+
import { type Subject, type InspectMinecraftDeps } from "../internal.js";
|
|
3
|
+
export declare function handleClassSource(deps: InspectMinecraftDeps, subject: Subject, detail: DetailLevel, include: string[]): Promise<{
|
|
4
|
+
warnings: string[];
|
|
5
|
+
}>;
|