@adhisang/minecraft-modding-mcp 6.2.0 → 7.0.0-rc.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 +71 -0
- package/README.md +21 -5
- package/dist/cache-policy.d.ts +71 -0
- package/dist/cache-policy.js +83 -0
- package/dist/cache-registry.js +6 -6
- package/dist/cli.js +74 -3
- package/dist/compat-stdio-transport.d.ts +1 -1
- package/dist/compat-stdio-transport.js +13 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.js +8 -2
- package/dist/decompiler/vineflower.d.ts +1 -0
- package/dist/decompiler/vineflower.js +8 -5
- package/dist/entry-tools/analyze-mod-service.d.ts +70 -136
- package/dist/entry-tools/analyze-symbol-service.d.ts +112 -150
- package/dist/entry-tools/compare-minecraft-service.d.ts +59 -145
- package/dist/entry-tools/entry-tool-schema.d.ts +38 -4
- package/dist/entry-tools/entry-tool-schema.js +4 -1
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +235 -799
- package/dist/entry-tools/inspect-minecraft/internal.js +65 -28
- package/dist/entry-tools/inspect-minecraft-service.d.ts +372 -1736
- package/dist/entry-tools/inspect-minecraft-service.js +1 -1
- package/dist/entry-tools/manage-cache-service.d.ts +81 -91
- package/dist/entry-tools/validate-project/cases/project-summary.d.ts +7 -7
- package/dist/entry-tools/validate-project-service.d.ts +164 -592
- package/dist/entry-tools/verify-mixin-target-service.d.ts +3 -19
- package/dist/era-classifier.d.ts +161 -0
- package/dist/era-classifier.js +292 -0
- package/dist/error-mapping.js +9 -2
- package/dist/index.d.ts +42 -4
- package/dist/index.js +637 -475
- package/dist/java-process.d.ts +2 -0
- package/dist/java-process.js +22 -2
- package/dist/json-rpc-framing.d.ts +77 -1
- package/dist/json-rpc-framing.js +249 -13
- package/dist/mapping/loaders/tiny-loom-selection.d.ts +88 -0
- package/dist/mapping/loaders/tiny-loom-selection.js +223 -0
- package/dist/mapping/loaders/tiny-loom.js +45 -33
- package/dist/mapping/loaders/tiny-maven.js +6 -11
- package/dist/mapping/parsers/tiny.d.ts +57 -0
- package/dist/mapping/parsers/tiny.js +99 -22
- package/dist/mapping-service.d.ts +19 -0
- package/dist/mapping-service.js +93 -9
- package/dist/mcp-helpers.d.ts +19 -2
- package/dist/mcp-helpers.js +48 -6
- package/dist/minecraft-explorer-service.d.ts +1 -1
- package/dist/mixin/types.d.ts +8 -0
- package/dist/mod-analyzer.js +7 -7
- package/dist/mod-decompile-service.js +1 -0
- package/dist/nbt/java-nbt-codec.js +12 -2
- package/dist/nbt/json-patch.js +14 -3
- package/dist/nbt/pipeline.js +40 -3
- package/dist/nbt/typed-json.js +26 -1
- package/dist/registration-adapter.d.ts +32 -0
- package/dist/registration-adapter.js +52 -0
- package/dist/request-context.d.ts +7 -0
- package/dist/request-context.js +9 -0
- package/dist/resources.d.ts +1 -1
- package/dist/resources.js +25 -19
- package/dist/server-identity.d.ts +27 -0
- package/dist/server-identity.js +26 -0
- package/dist/source/access-validate.js +53 -0
- package/dist/source/artifact-resolver.d.ts +69 -1
- package/dist/source/artifact-resolver.js +215 -14
- package/dist/source/class-source.d.ts +22 -0
- package/dist/source/class-source.js +162 -29
- package/dist/source/did-you-mean.d.ts +12 -1
- package/dist/source/did-you-mean.js +6 -2
- package/dist/source/file-access.js +150 -46
- package/dist/source/indexer.js +1 -0
- package/dist/source/nested-jars.d.ts +19 -0
- package/dist/source/nested-jars.js +90 -21
- package/dist/source/shared-utils.d.ts +21 -0
- package/dist/source/shared-utils.js +23 -0
- package/dist/source-service.d.ts +12 -0
- package/dist/source-service.js +3 -0
- package/dist/stdio-supervisor.d.ts +357 -2
- package/dist/stdio-supervisor.js +1031 -80
- package/dist/storage/db.d.ts +2 -1
- package/dist/storage/db.js +15 -8
- package/dist/synthetic-decorator.d.ts +24 -0
- package/dist/synthetic-decorator.js +48 -0
- package/dist/tool-contract-manifest.js +1 -1
- package/dist/tool-guidance.d.ts +17 -1
- package/dist/tool-guidance.js +417 -13
- package/dist/tool-schema-registry.d.ts +2 -0
- package/dist/tool-schema-registry.js +4 -0
- package/dist/tool-schemas.d.ts +2214 -3915
- package/dist/tool-schemas.js +34 -7
- package/dist/types.d.ts +35 -0
- package/dist/v1-parity-schemas.d.ts +7 -0
- package/dist/v1-parity-schemas.js +5584 -0
- package/dist/version-diff-service.d.ts +33 -0
- package/dist/version-diff-service.js +148 -3
- package/dist/version-service.js +36 -14
- package/dist/warning-details.js +18 -1
- package/docs/README-ja.md +9 -3
- package/docs/tool-reference.md +267 -22
- package/package.json +12 -9
|
@@ -30,27 +30,27 @@ export const artifactRefSchema = z.discriminatedUnion("type", [
|
|
|
30
30
|
]);
|
|
31
31
|
export const workspaceFocusSchema = z.discriminatedUnion("kind", [
|
|
32
32
|
z.object({
|
|
33
|
-
kind: z.literal("class"),
|
|
34
|
-
className: nonEmptyString,
|
|
35
|
-
artifact: artifactRefSchema.optional()
|
|
36
|
-
}),
|
|
33
|
+
kind: z.literal("class").describe("Select class inspection."),
|
|
34
|
+
className: nonEmptyString.describe("Fully-qualified class name to inspect."),
|
|
35
|
+
artifact: artifactRefSchema.optional().describe("Optional explicit artifact override; otherwise resolve it from the workspace.")
|
|
36
|
+
}).describe('Class focus object: {"kind":"class","className":"net.minecraft.world.item.Item"}. task=auto dispatches it to class-overview; select class-source or class-members explicitly when needed.'),
|
|
37
37
|
z.object({
|
|
38
|
-
kind: z.literal("file"),
|
|
39
|
-
filePath: nonEmptyString,
|
|
40
|
-
artifact: artifactRefSchema.optional()
|
|
41
|
-
}),
|
|
38
|
+
kind: z.literal("file").describe("Select an artifact-relative file read."),
|
|
39
|
+
filePath: nonEmptyString.describe("Artifact-relative file path to read."),
|
|
40
|
+
artifact: artifactRefSchema.optional().describe("Optional explicit artifact override; otherwise resolve it from the workspace.")
|
|
41
|
+
}).describe('File focus object: {"kind":"file","filePath":"net/minecraft/world/item/Item.java"}. task=auto dispatches it to file.'),
|
|
42
42
|
z.object({
|
|
43
|
-
kind: z.literal("search"),
|
|
44
|
-
query: nonEmptyString,
|
|
45
|
-
artifact: artifactRefSchema.optional(),
|
|
43
|
+
kind: z.literal("search").describe("Select source search."),
|
|
44
|
+
query: nonEmptyString.describe("Source, symbol, or path query to search for."),
|
|
45
|
+
artifact: artifactRefSchema.optional().describe("Optional explicit artifact override; otherwise resolve it from the workspace."),
|
|
46
46
|
intent: z.enum(["symbol", "text", "path"]).optional(),
|
|
47
47
|
match: z.enum(["exact", "prefix", "contains", "regex"]).optional(),
|
|
48
48
|
symbolKind: z.enum(["class", "interface", "enum", "record", "method", "field"]).optional(),
|
|
49
49
|
packagePrefix: nonEmptyString.optional(),
|
|
50
50
|
fileGlob: nonEmptyString.optional(),
|
|
51
51
|
queryMode: z.enum(["auto", "token", "literal"]).default("auto")
|
|
52
|
-
})
|
|
53
|
-
]);
|
|
52
|
+
}).describe('Search focus object: {"kind":"search","query":"CreativeModeTab"}. task=auto dispatches it to search.')
|
|
53
|
+
]).describe('Structured workspace focus. Object, not string. Choose {kind:"class",className}, {kind:"file",filePath}, or {kind:"search",query}.');
|
|
54
54
|
export const subjectSchema = z.discriminatedUnion("kind", [
|
|
55
55
|
z.object({
|
|
56
56
|
kind: z.literal("version"),
|
|
@@ -108,8 +108,16 @@ export const subjectSchema = z.discriminatedUnion("kind", [
|
|
|
108
108
|
preferProjectVersion: z.boolean().optional(),
|
|
109
109
|
strictVersion: z.boolean().optional(),
|
|
110
110
|
focus: workspaceFocusSchema.optional()
|
|
111
|
-
})
|
|
112
|
-
]);
|
|
111
|
+
}).describe("Workspace subject. Resolves Minecraft artifact context from projectPath; add a structured focus object for class, file, or search work.")
|
|
112
|
+
]).describe("Structured inspection subject. Use kind=workspace with a structured focus object when the workspace should resolve artifact context.");
|
|
113
|
+
/**
|
|
114
|
+
* Read at call time, never at module load: tests flip WORKSPACE_TARGET_OFF per
|
|
115
|
+
* case, and resolve-artifact itself rejects target.kind="workspace" while it is
|
|
116
|
+
* set (src/source/workspace-target.ts).
|
|
117
|
+
*/
|
|
118
|
+
function workspaceTargetDisabled() {
|
|
119
|
+
return process.env.WORKSPACE_TARGET_OFF === "1";
|
|
120
|
+
}
|
|
113
121
|
export function hasPartialVanillaCoverage(artifact) {
|
|
114
122
|
return artifact?.qualityFlags.includes("partial-source-no-net-minecraft") === true
|
|
115
123
|
|| artifact?.artifactContents.sourceCoverage === "partial";
|
|
@@ -402,16 +410,20 @@ export async function resolveArtifactReference(deps, subject, task) {
|
|
|
402
410
|
const version = unique.minecraftVersion ??
|
|
403
411
|
(await deps.detectProjectMinecraftVersion(unique.projectPath));
|
|
404
412
|
if (version) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
413
|
+
// Same routing as the workspace subject: a bare {kind:"version"}
|
|
414
|
+
// target here would resolve a different artifact than resolve-artifact
|
|
415
|
+
// does for the same directory. The pre-detected version stays only as
|
|
416
|
+
// the guard that a workspace is usable at all, so an undetectable one
|
|
417
|
+
// still falls through to the actionable artifact-context error below.
|
|
418
|
+
const artifact = await deps.resolveArtifact(workspaceTargetDisabled()
|
|
419
|
+
? { target: { kind: "version", value: version }, projectPath: unique.projectPath }
|
|
420
|
+
: { target: { kind: "workspace" }, projectPath: unique.projectPath });
|
|
409
421
|
return {
|
|
410
422
|
artifactId: artifact.artifactId,
|
|
411
423
|
artifact,
|
|
412
|
-
version,
|
|
424
|
+
version: artifact.version ?? version,
|
|
413
425
|
warnings: [
|
|
414
|
-
`subject.artifact was omitted; auto-resolved through the unique known workspace ${unique.projectPath} (Minecraft ${version}). Pass subject.artifact to target a different artifact.`,
|
|
426
|
+
`subject.artifact was omitted; auto-resolved through the unique known workspace ${unique.projectPath} (Minecraft ${artifact.version ?? version}). Pass subject.artifact to target a different artifact.`,
|
|
415
427
|
...artifact.warnings
|
|
416
428
|
]
|
|
417
429
|
};
|
|
@@ -454,16 +466,41 @@ export async function resolveArtifactReference(deps, subject, task) {
|
|
|
454
466
|
warnings: [...artifact.warnings]
|
|
455
467
|
};
|
|
456
468
|
}
|
|
457
|
-
|
|
458
|
-
|
|
469
|
+
if (workspaceTargetDisabled()) {
|
|
470
|
+
// Kill switch parity: resolve-artifact rejects target.kind="workspace" under
|
|
471
|
+
// WORKSPACE_TARGET_OFF=1, so fall back to the pre-workspace-target routing
|
|
472
|
+
// instead of turning the toggle into a hard failure here.
|
|
473
|
+
const version = await deps.detectProjectMinecraftVersion(subject.projectPath);
|
|
474
|
+
if (!version) {
|
|
475
|
+
return {
|
|
476
|
+
artifactId: "",
|
|
477
|
+
version: undefined,
|
|
478
|
+
warnings: [`Could not infer Minecraft version from ${subject.projectPath}.`]
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
const legacyArtifact = await deps.resolveArtifact({
|
|
482
|
+
target: { kind: "version", value: version },
|
|
483
|
+
mapping: subject.mapping,
|
|
484
|
+
scope: subject.scope,
|
|
485
|
+
projectPath: subject.projectPath,
|
|
486
|
+
...(subject.gradleUserHome !== undefined ? { gradleUserHome: subject.gradleUserHome } : {}),
|
|
487
|
+
preferProjectVersion: subject.preferProjectVersion ?? true,
|
|
488
|
+
strictVersion: subject.strictVersion
|
|
489
|
+
});
|
|
459
490
|
return {
|
|
460
|
-
artifactId:
|
|
461
|
-
|
|
462
|
-
|
|
491
|
+
artifactId: legacyArtifact.artifactId,
|
|
492
|
+
artifact: legacyArtifact,
|
|
493
|
+
version,
|
|
494
|
+
warnings: [...legacyArtifact.warnings]
|
|
463
495
|
};
|
|
464
496
|
}
|
|
497
|
+
// Hand the directory to resolve-artifact as a workspace target so both tools
|
|
498
|
+
// agree on the artifact. A failed version detection now surfaces as
|
|
499
|
+
// ERR_WORKSPACE_VERSION_UNRESOLVED (which carries nextAction + suggestedCall)
|
|
500
|
+
// instead of degrading to an empty artifactId and a misleading
|
|
501
|
+
// "Either artifactId or target must be provided." further down the call chain.
|
|
465
502
|
const artifact = await deps.resolveArtifact({
|
|
466
|
-
target: { kind: "
|
|
503
|
+
target: { kind: "workspace" },
|
|
467
504
|
mapping: subject.mapping,
|
|
468
505
|
scope: subject.scope,
|
|
469
506
|
projectPath: subject.projectPath,
|
|
@@ -474,7 +511,7 @@ export async function resolveArtifactReference(deps, subject, task) {
|
|
|
474
511
|
return {
|
|
475
512
|
artifactId: artifact.artifactId,
|
|
476
513
|
artifact,
|
|
477
|
-
version,
|
|
514
|
+
version: artifact.version,
|
|
478
515
|
warnings: [...artifact.warnings]
|
|
479
516
|
};
|
|
480
517
|
}
|