@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.
Files changed (98) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +21 -5
  3. package/dist/cache-policy.d.ts +71 -0
  4. package/dist/cache-policy.js +83 -0
  5. package/dist/cache-registry.js +6 -6
  6. package/dist/cli.js +74 -3
  7. package/dist/compat-stdio-transport.d.ts +1 -1
  8. package/dist/compat-stdio-transport.js +13 -1
  9. package/dist/config.d.ts +3 -0
  10. package/dist/config.js +8 -2
  11. package/dist/decompiler/vineflower.d.ts +1 -0
  12. package/dist/decompiler/vineflower.js +8 -5
  13. package/dist/entry-tools/analyze-mod-service.d.ts +70 -136
  14. package/dist/entry-tools/analyze-symbol-service.d.ts +112 -150
  15. package/dist/entry-tools/compare-minecraft-service.d.ts +59 -145
  16. package/dist/entry-tools/entry-tool-schema.d.ts +38 -4
  17. package/dist/entry-tools/entry-tool-schema.js +4 -1
  18. package/dist/entry-tools/inspect-minecraft/internal.d.ts +235 -799
  19. package/dist/entry-tools/inspect-minecraft/internal.js +65 -28
  20. package/dist/entry-tools/inspect-minecraft-service.d.ts +372 -1736
  21. package/dist/entry-tools/inspect-minecraft-service.js +1 -1
  22. package/dist/entry-tools/manage-cache-service.d.ts +81 -91
  23. package/dist/entry-tools/validate-project/cases/project-summary.d.ts +7 -7
  24. package/dist/entry-tools/validate-project-service.d.ts +164 -592
  25. package/dist/entry-tools/verify-mixin-target-service.d.ts +3 -19
  26. package/dist/era-classifier.d.ts +161 -0
  27. package/dist/era-classifier.js +292 -0
  28. package/dist/error-mapping.js +9 -2
  29. package/dist/index.d.ts +42 -4
  30. package/dist/index.js +637 -475
  31. package/dist/java-process.d.ts +2 -0
  32. package/dist/java-process.js +22 -2
  33. package/dist/json-rpc-framing.d.ts +77 -1
  34. package/dist/json-rpc-framing.js +249 -13
  35. package/dist/mapping/loaders/tiny-loom-selection.d.ts +88 -0
  36. package/dist/mapping/loaders/tiny-loom-selection.js +223 -0
  37. package/dist/mapping/loaders/tiny-loom.js +45 -33
  38. package/dist/mapping/loaders/tiny-maven.js +6 -11
  39. package/dist/mapping/parsers/tiny.d.ts +57 -0
  40. package/dist/mapping/parsers/tiny.js +99 -22
  41. package/dist/mapping-service.d.ts +19 -0
  42. package/dist/mapping-service.js +93 -9
  43. package/dist/mcp-helpers.d.ts +19 -2
  44. package/dist/mcp-helpers.js +48 -6
  45. package/dist/minecraft-explorer-service.d.ts +1 -1
  46. package/dist/mixin/types.d.ts +8 -0
  47. package/dist/mod-analyzer.js +7 -7
  48. package/dist/mod-decompile-service.js +1 -0
  49. package/dist/nbt/java-nbt-codec.js +12 -2
  50. package/dist/nbt/json-patch.js +14 -3
  51. package/dist/nbt/pipeline.js +40 -3
  52. package/dist/nbt/typed-json.js +26 -1
  53. package/dist/registration-adapter.d.ts +32 -0
  54. package/dist/registration-adapter.js +52 -0
  55. package/dist/request-context.d.ts +7 -0
  56. package/dist/request-context.js +9 -0
  57. package/dist/resources.d.ts +1 -1
  58. package/dist/resources.js +25 -19
  59. package/dist/server-identity.d.ts +27 -0
  60. package/dist/server-identity.js +26 -0
  61. package/dist/source/access-validate.js +53 -0
  62. package/dist/source/artifact-resolver.d.ts +69 -1
  63. package/dist/source/artifact-resolver.js +215 -14
  64. package/dist/source/class-source.d.ts +22 -0
  65. package/dist/source/class-source.js +162 -29
  66. package/dist/source/did-you-mean.d.ts +12 -1
  67. package/dist/source/did-you-mean.js +6 -2
  68. package/dist/source/file-access.js +150 -46
  69. package/dist/source/indexer.js +1 -0
  70. package/dist/source/nested-jars.d.ts +19 -0
  71. package/dist/source/nested-jars.js +90 -21
  72. package/dist/source/shared-utils.d.ts +21 -0
  73. package/dist/source/shared-utils.js +23 -0
  74. package/dist/source-service.d.ts +12 -0
  75. package/dist/source-service.js +3 -0
  76. package/dist/stdio-supervisor.d.ts +357 -2
  77. package/dist/stdio-supervisor.js +1031 -80
  78. package/dist/storage/db.d.ts +2 -1
  79. package/dist/storage/db.js +15 -8
  80. package/dist/synthetic-decorator.d.ts +24 -0
  81. package/dist/synthetic-decorator.js +48 -0
  82. package/dist/tool-contract-manifest.js +1 -1
  83. package/dist/tool-guidance.d.ts +17 -1
  84. package/dist/tool-guidance.js +417 -13
  85. package/dist/tool-schema-registry.d.ts +2 -0
  86. package/dist/tool-schema-registry.js +4 -0
  87. package/dist/tool-schemas.d.ts +2214 -3915
  88. package/dist/tool-schemas.js +34 -7
  89. package/dist/types.d.ts +35 -0
  90. package/dist/v1-parity-schemas.d.ts +7 -0
  91. package/dist/v1-parity-schemas.js +5584 -0
  92. package/dist/version-diff-service.d.ts +33 -0
  93. package/dist/version-diff-service.js +148 -3
  94. package/dist/version-service.js +36 -14
  95. package/dist/warning-details.js +18 -1
  96. package/docs/README-ja.md +9 -3
  97. package/docs/tool-reference.md +267 -22
  98. 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
- const artifact = await deps.resolveArtifact({
406
- target: { kind: "version", value: version },
407
- projectPath: unique.projectPath
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
- const version = await deps.detectProjectMinecraftVersion(subject.projectPath);
458
- if (!version) {
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
- version: undefined,
462
- warnings: [`Could not infer Minecraft version from ${subject.projectPath}.`]
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: "version", value: version },
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
  }