@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.
Files changed (194) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +52 -32
  3. package/dist/build-suggested-call.d.ts +29 -0
  4. package/dist/build-suggested-call.js +58 -0
  5. package/dist/cache-registry.d.ts +3 -1
  6. package/dist/cache-registry.js +59 -7
  7. package/dist/config.d.ts +10 -1
  8. package/dist/config.js +52 -1
  9. package/dist/entry-tools/analyze-symbol-service.d.ts +18 -18
  10. package/dist/entry-tools/analyze-symbol-service.js +13 -2
  11. package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
  12. package/dist/entry-tools/batch-class-members-service.js +97 -0
  13. package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
  14. package/dist/entry-tools/batch-class-source-service.js +100 -0
  15. package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
  16. package/dist/entry-tools/batch-mappings-service.js +66 -0
  17. package/dist/entry-tools/batch-runner.d.ts +72 -0
  18. package/dist/entry-tools/batch-runner.js +90 -0
  19. package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
  20. package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
  21. package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
  22. package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
  23. package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
  24. package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
  25. package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
  26. package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
  27. package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
  28. package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
  29. package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
  30. package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
  31. package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
  32. package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
  33. package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
  34. package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
  35. package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
  36. package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
  37. package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
  38. package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
  39. package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
  40. package/dist/entry-tools/inspect-minecraft-service.d.ts +213 -328
  41. package/dist/entry-tools/inspect-minecraft-service.js +20 -1238
  42. package/dist/entry-tools/manage-cache-service.d.ts +16 -16
  43. package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
  44. package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
  45. package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
  46. package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
  47. package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
  48. package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
  49. package/dist/entry-tools/validate-project/cases/project-summary.d.ts +97 -0
  50. package/dist/entry-tools/validate-project/cases/project-summary.js +346 -0
  51. package/dist/entry-tools/validate-project/internal.d.ts +135 -0
  52. package/dist/entry-tools/validate-project/internal.js +287 -0
  53. package/dist/entry-tools/validate-project-service.d.ts +63 -47
  54. package/dist/entry-tools/validate-project-service.js +12 -482
  55. package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
  56. package/dist/entry-tools/verify-mixin-target-service.js +323 -0
  57. package/dist/error-mapping.d.ts +40 -0
  58. package/dist/error-mapping.js +139 -0
  59. package/dist/errors.d.ts +6 -0
  60. package/dist/errors.js +6 -0
  61. package/dist/index.d.ts +2 -0
  62. package/dist/index.js +170 -1314
  63. package/dist/lru-list.d.ts +31 -0
  64. package/dist/lru-list.js +102 -0
  65. package/dist/mapping/internal-types.d.ts +54 -0
  66. package/dist/mapping/internal-types.js +14 -0
  67. package/dist/mapping/loaders/mojang.d.ts +2 -0
  68. package/dist/mapping/loaders/mojang.js +64 -0
  69. package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
  70. package/dist/mapping/loaders/tiny-loom.js +73 -0
  71. package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
  72. package/dist/mapping/loaders/tiny-maven.js +104 -0
  73. package/dist/mapping/loaders/types.d.ts +14 -0
  74. package/dist/mapping/loaders/types.js +2 -0
  75. package/dist/mapping/lookup.d.ts +52 -0
  76. package/dist/mapping/lookup.js +496 -0
  77. package/dist/mapping/parsers/normalize.d.ts +10 -0
  78. package/dist/mapping/parsers/normalize.js +52 -0
  79. package/dist/mapping/parsers/proguard.d.ts +20 -0
  80. package/dist/mapping/parsers/proguard.js +138 -0
  81. package/dist/mapping/parsers/symbol-records.d.ts +27 -0
  82. package/dist/mapping/parsers/symbol-records.js +216 -0
  83. package/dist/mapping/parsers/tiny.d.ts +9 -0
  84. package/dist/mapping/parsers/tiny.js +96 -0
  85. package/dist/mapping/types.d.ts +147 -0
  86. package/dist/mapping/types.js +2 -0
  87. package/dist/mapping-pipeline-service.d.ts +10 -1
  88. package/dist/mapping-pipeline-service.js +16 -3
  89. package/dist/mapping-service.d.ts +15 -144
  90. package/dist/mapping-service.js +179 -1119
  91. package/dist/mixin/access-validators.d.ts +9 -0
  92. package/dist/mixin/access-validators.js +257 -0
  93. package/dist/mixin/annotation-validators.d.ts +5 -0
  94. package/dist/mixin/annotation-validators.js +162 -0
  95. package/dist/mixin/helpers.d.ts +28 -0
  96. package/dist/mixin/helpers.js +315 -0
  97. package/dist/mixin/parsed-validator.d.ts +8 -0
  98. package/dist/mixin/parsed-validator.js +337 -0
  99. package/dist/mixin/types.d.ts +208 -0
  100. package/dist/mixin/types.js +28 -0
  101. package/dist/mixin-validator.d.ts +9 -201
  102. package/dist/mixin-validator.js +8 -1005
  103. package/dist/observability.d.ts +18 -1
  104. package/dist/observability.js +44 -1
  105. package/dist/response-utils.d.ts +44 -10
  106. package/dist/response-utils.js +131 -17
  107. package/dist/source/access-validate.d.ts +4 -0
  108. package/dist/source/access-validate.js +254 -0
  109. package/dist/source/artifact-resolver.d.ts +110 -0
  110. package/dist/source/artifact-resolver.js +1174 -0
  111. package/dist/source/cache-metrics.d.ts +26 -0
  112. package/dist/source/cache-metrics.js +172 -0
  113. package/dist/source/class-source/members-builder.d.ts +34 -0
  114. package/dist/source/class-source/members-builder.js +46 -0
  115. package/dist/source/class-source/snippet-builder.d.ts +19 -0
  116. package/dist/source/class-source/snippet-builder.js +46 -0
  117. package/dist/source/class-source-helpers.d.ts +34 -0
  118. package/dist/source/class-source-helpers.js +140 -0
  119. package/dist/source/class-source.d.ts +42 -0
  120. package/dist/source/class-source.js +883 -0
  121. package/dist/source/descriptor-utils.d.ts +6 -0
  122. package/dist/source/descriptor-utils.js +37 -0
  123. package/dist/source/file-access.d.ts +4 -0
  124. package/dist/source/file-access.js +102 -0
  125. package/dist/source/indexer.d.ts +82 -0
  126. package/dist/source/indexer.js +505 -0
  127. package/dist/source/lifecycle/diff-utils.d.ts +9 -0
  128. package/dist/source/lifecycle/diff-utils.js +107 -0
  129. package/dist/source/lifecycle/diff.d.ts +2 -0
  130. package/dist/source/lifecycle/diff.js +265 -0
  131. package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
  132. package/dist/source/lifecycle/mapping-helpers.js +327 -0
  133. package/dist/source/lifecycle/runtime-check.d.ts +2 -0
  134. package/dist/source/lifecycle/runtime-check.js +142 -0
  135. package/dist/source/lifecycle/trace.d.ts +2 -0
  136. package/dist/source/lifecycle/trace.js +231 -0
  137. package/dist/source/lifecycle.d.ts +4 -0
  138. package/dist/source/lifecycle.js +5 -0
  139. package/dist/source/search.d.ts +51 -0
  140. package/dist/source/search.js +676 -0
  141. package/dist/source/shared-utils.d.ts +6 -0
  142. package/dist/source/shared-utils.js +55 -0
  143. package/dist/source/state.d.ts +21 -0
  144. package/dist/source/state.js +19 -0
  145. package/dist/source/symbol-resolver.d.ts +3 -0
  146. package/dist/source/symbol-resolver.js +212 -0
  147. package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
  148. package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
  149. package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
  150. package/dist/source/validate-mixin/pipeline/parse.js +10 -0
  151. package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
  152. package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
  153. package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
  154. package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
  155. package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
  156. package/dist/source/validate-mixin/pipeline-context.js +93 -0
  157. package/dist/source/validate-mixin.d.ts +22 -0
  158. package/dist/source/validate-mixin.js +799 -0
  159. package/dist/source/workspace-target.d.ts +18 -0
  160. package/dist/source/workspace-target.js +305 -0
  161. package/dist/source-resolver.d.ts +9 -1
  162. package/dist/source-resolver.js +14 -6
  163. package/dist/source-service.d.ts +178 -105
  164. package/dist/source-service.js +72 -5312
  165. package/dist/stage-emitter.d.ts +13 -0
  166. package/dist/stage-emitter.js +30 -0
  167. package/dist/stdio-supervisor.d.ts +61 -0
  168. package/dist/stdio-supervisor.js +326 -9
  169. package/dist/storage/artifacts-repo.d.ts +4 -1
  170. package/dist/storage/artifacts-repo.js +33 -5
  171. package/dist/storage/files-repo.d.ts +0 -2
  172. package/dist/storage/files-repo.js +0 -11
  173. package/dist/storage/migrations.d.ts +1 -1
  174. package/dist/storage/migrations.js +10 -2
  175. package/dist/storage/schema.d.ts +2 -0
  176. package/dist/storage/schema.js +25 -0
  177. package/dist/tool-contract-manifest.d.ts +1 -1
  178. package/dist/tool-contract-manifest.js +23 -6
  179. package/dist/tool-guidance.d.ts +82 -0
  180. package/dist/tool-guidance.js +734 -0
  181. package/dist/tool-schema-registry.d.ts +16 -0
  182. package/dist/tool-schema-registry.js +37 -0
  183. package/dist/tool-schemas.d.ts +3518 -0
  184. package/dist/tool-schemas.js +813 -0
  185. package/dist/types.d.ts +39 -0
  186. package/dist/version-service.js +7 -6
  187. package/dist/workspace-context-cache.d.ts +32 -0
  188. package/dist/workspace-context-cache.js +66 -0
  189. package/dist/workspace-mapping-service.d.ts +16 -0
  190. package/dist/workspace-mapping-service.js +173 -1
  191. package/docs/README-ja.md +414 -0
  192. package/docs/examples.md +483 -0
  193. package/docs/tool-reference.md +459 -0
  194. package/package.json +5 -2
@@ -3,10 +3,12 @@ import { resolve } from "node:path";
3
3
  import fastGlob from "fast-glob";
4
4
  import { z } from "zod";
5
5
  import { mapWithConcurrencyLimit } from "../concurrency.js";
6
- import { createError, ERROR_CODES } from "../errors.js";
7
6
  import { buildIncludeSchema, detailSchema } from "./entry-tool-schema.js";
8
- import { buildEntryToolResult, createSummarySubject } from "./response-contract.js";
9
7
  import { resolveDetail, resolveInclude } from "./request-normalizers.js";
8
+ import { handleMixin } from "./validate-project/cases/mixin.js";
9
+ import { handleAccessWidener } from "./validate-project/cases/access-widener.js";
10
+ import { handleAccessTransformer } from "./validate-project/cases/access-transformer.js";
11
+ import { handleProjectSummary } from "./validate-project/cases/project-summary.js";
10
12
  const nonEmptyString = z.string().trim().min(1);
11
13
  const INCLUDE_GROUPS = ["warnings", "issues", "workspace", "recovery"];
12
14
  const WORKSPACE_TEXT_FILE_READ_CONCURRENCY = 4;
@@ -265,486 +267,14 @@ export class ValidateProjectService {
265
267
  const detail = resolveDetail(input.detail);
266
268
  const include = resolveInclude(input.include);
267
269
  switch (input.task) {
268
- case "mixin": {
269
- if (input.subject.kind !== "mixin") {
270
- throw createError({
271
- code: ERROR_CODES.INVALID_INPUT,
272
- message: "task=mixin requires subject.kind=mixin."
273
- });
274
- }
275
- const output = await this.deps.validateMixin({
276
- input: input.subject.input,
277
- version: input.version,
278
- mapping: input.mapping,
279
- sourcePriority: input.sourcePriority,
280
- scope: input.scope,
281
- preferProjectVersion: input.preferProjectVersion,
282
- preferProjectMapping: input.preferProjectMapping,
283
- sourceRoots: input.sourceRoots,
284
- minSeverity: input.minSeverity,
285
- hideUncertain: input.hideUncertain,
286
- explain: input.explain,
287
- warningMode: input.warningMode,
288
- warningCategoryFilter: input.warningCategoryFilter,
289
- treatInfoAsWarning: input.treatInfoAsWarning,
290
- includeIssues: input.includeIssues
291
- });
292
- const summary = output.summary;
293
- const invalidCount = summary?.invalid ?? 0;
294
- const partialCount = summary?.partial ?? 0;
295
- return {
296
- ...buildEntryToolResult({
297
- task: "mixin",
298
- detail,
299
- include,
300
- summary: {
301
- status: invalidCount > 0 ? "invalid" : partialCount > 0 ? "partial" : "ok",
302
- headline: `Validated ${summary?.total ?? 0} mixin input(s).`,
303
- subject: createSummarySubject({
304
- task: "mixin",
305
- kind: input.subject.kind,
306
- input: input.subject.input,
307
- version: input.version,
308
- mapping: input.mapping,
309
- sourcePriority: input.sourcePriority,
310
- scope: input.scope
311
- }),
312
- counts: {
313
- valid: summary?.valid ?? 0,
314
- partial: partialCount,
315
- invalid: invalidCount
316
- }
317
- },
318
- blocks: {
319
- project: {
320
- summary
321
- },
322
- issues: include.includes("issues") || detail !== "summary" ? output.results : undefined
323
- },
324
- alwaysBlocks: ["project"]
325
- }),
326
- warnings: Array.isArray(output.warnings) ? output.warnings : []
327
- };
328
- }
329
- case "access-widener": {
330
- if (input.subject.kind !== "access-widener") {
331
- throw createError({
332
- code: ERROR_CODES.INVALID_INPUT,
333
- message: "task=access-widener requires subject.kind=access-widener."
334
- });
335
- }
336
- const content = input.subject.input.mode === "inline"
337
- ? input.subject.input.content
338
- : await readFile(input.subject.input.path, "utf8");
339
- const output = await this.deps.validateAccessWidener({
340
- content,
341
- version: input.version,
342
- mapping: input.mapping,
343
- sourcePriority: input.sourcePriority,
344
- scope: input.scope,
345
- preferProjectVersion: input.preferProjectVersion
346
- });
347
- return {
348
- ...buildEntryToolResult({
349
- task: "access-widener",
350
- detail,
351
- include,
352
- summary: {
353
- status: output.valid ? "ok" : "invalid",
354
- headline: output.valid
355
- ? "Access Widener is valid."
356
- : "Access Widener contains validation issues.",
357
- subject: createSummarySubject({
358
- task: "access-widener",
359
- kind: input.subject.kind,
360
- input: input.subject.input,
361
- version: input.version,
362
- mapping: input.mapping,
363
- sourcePriority: input.sourcePriority
364
- }),
365
- counts: {
366
- valid: output.valid ? 1 : 0,
367
- invalid: output.valid ? 0 : 1
368
- }
369
- },
370
- blocks: {
371
- project: {
372
- summary: {
373
- total: 1,
374
- valid: output.valid ? 1 : 0,
375
- invalid: output.valid ? 0 : 1
376
- }
377
- },
378
- issues: include.includes("issues") || detail !== "summary" ? output.issues : undefined
379
- },
380
- alwaysBlocks: ["project"]
381
- }),
382
- warnings: Array.isArray(output.warnings) ? output.warnings : []
383
- };
384
- }
385
- case "access-transformer": {
386
- if (input.subject.kind !== "access-transformer") {
387
- throw createError({
388
- code: ERROR_CODES.INVALID_INPUT,
389
- message: "task=access-transformer requires subject.kind=access-transformer."
390
- });
391
- }
392
- const content = input.subject.input.mode === "inline"
393
- ? input.subject.input.content
394
- : await readFile(input.subject.input.path, "utf8");
395
- if (!this.deps.validateAccessTransformer) {
396
- throw createError({
397
- code: ERROR_CODES.CONTEXT_UNRESOLVED,
398
- message: "Access Transformer validation is not configured."
399
- });
400
- }
401
- const output = await this.deps.validateAccessTransformer({
402
- content,
403
- version: input.version,
404
- atNamespace: input.atNamespace,
405
- sourcePriority: input.sourcePriority,
406
- scope: input.scope,
407
- preferProjectVersion: input.preferProjectVersion
408
- });
409
- const issueEntries = Array.isArray(output.entries)
410
- ? output.entries.filter((entry) => {
411
- if (!entry || typeof entry !== "object" || !("valid" in entry)) {
412
- return true;
413
- }
414
- return entry.valid !== true;
415
- })
416
- : undefined;
417
- return {
418
- ...buildEntryToolResult({
419
- task: "access-transformer",
420
- detail,
421
- include,
422
- summary: {
423
- status: output.valid ? "ok" : "invalid",
424
- headline: output.valid
425
- ? "Access Transformer is valid."
426
- : "Access Transformer contains validation issues.",
427
- subject: createSummarySubject({
428
- task: "access-transformer",
429
- kind: input.subject.kind,
430
- input: input.subject.input,
431
- version: input.version,
432
- sourcePriority: input.sourcePriority,
433
- scope: input.scope,
434
- atNamespace: input.atNamespace
435
- }),
436
- counts: {
437
- valid: output.valid ? 1 : 0,
438
- invalid: output.valid ? 0 : 1
439
- }
440
- },
441
- blocks: {
442
- project: {
443
- summary: {
444
- total: 1,
445
- valid: output.valid ? 1 : 0,
446
- invalid: output.valid ? 0 : 1
447
- }
448
- },
449
- issues: include.includes("issues") || detail !== "summary" ? issueEntries : undefined
450
- },
451
- alwaysBlocks: ["project"]
452
- }),
453
- warnings: Array.isArray(output.warnings) ? output.warnings : []
454
- };
455
- }
456
- case "project-summary": {
457
- if (input.subject.kind !== "workspace") {
458
- throw createError({
459
- code: ERROR_CODES.INVALID_INPUT,
460
- message: "task=project-summary requires subject.kind=workspace."
461
- });
462
- }
463
- if (!input.version && !input.preferProjectVersion) {
464
- return {
465
- ...buildEntryToolResult({
466
- task: "project-summary",
467
- detail,
468
- include,
469
- summary: {
470
- status: "blocked",
471
- headline: "project-summary requires version or preferProjectVersion=true.",
472
- subject: createSummarySubject({
473
- task: "project-summary",
474
- kind: input.subject.kind,
475
- projectPath: input.subject.projectPath,
476
- discover: input.subject.discover
477
- }),
478
- nextActions: [
479
- {
480
- tool: "validate-project",
481
- params: {
482
- task: "project-summary",
483
- subject: input.subject
484
- }
485
- }
486
- ],
487
- notes: [
488
- "Pass version explicitly, or retry with preferProjectVersion=true when gradle.properties declares the Minecraft version."
489
- ]
490
- },
491
- blocks: {
492
- workspace: {
493
- projectPath: input.subject.projectPath
494
- }
495
- }
496
- }),
497
- warnings: []
498
- };
499
- }
500
- const projectPath = input.subject.projectPath;
501
- const detectedProjectVersion = input.preferProjectVersion
502
- ? await this.deps.detectProjectMinecraftVersion?.(projectPath)
503
- : undefined;
504
- const resolvedVersion = detectedProjectVersion ?? input.version;
505
- const discover = input.subject.discover ?? ["mixins", "access-wideners"];
506
- const [mixinConfigs, accessWideners, accessTransformers] = await Promise.all([
507
- discover.includes("mixins")
508
- ? this.deps.discoverMixins(projectPath, input.configPaths)
509
- : Promise.resolve([]),
510
- discover.includes("access-wideners")
511
- ? this.deps.discoverAccessWideners(projectPath)
512
- : Promise.resolve([]),
513
- discover.includes("access-transformers")
514
- ? this.deps.discoverAccessTransformers?.(projectPath) ?? Promise.resolve([])
515
- : Promise.resolve([])
516
- ]);
517
- if (!resolvedVersion && (mixinConfigs.length > 0 || accessWideners.length > 0 || accessTransformers.length > 0)) {
518
- return {
519
- ...buildEntryToolResult({
520
- task: "project-summary",
521
- detail,
522
- include,
523
- summary: {
524
- status: "blocked",
525
- headline: "Could not resolve Minecraft version for discovered workspace validators.",
526
- subject: createSummarySubject({
527
- task: "project-summary",
528
- kind: input.subject.kind,
529
- projectPath,
530
- discover: input.subject.discover,
531
- mapping: input.mapping,
532
- sourcePriority: input.sourcePriority,
533
- scope: input.scope
534
- }),
535
- nextActions: [
536
- {
537
- tool: "validate-project",
538
- params: {
539
- task: "project-summary",
540
- subject: input.subject
541
- }
542
- }
543
- ],
544
- notes: [
545
- "Pass version explicitly, or make sure gradle.properties declares the Minecraft version before using preferProjectVersion=true."
546
- ]
547
- },
548
- blocks: {
549
- workspace: {
550
- projectPath
551
- }
552
- }
553
- }),
554
- warnings: [
555
- "Could not resolve Minecraft version from gradle.properties for discovered workspace validators."
556
- ]
557
- };
558
- }
559
- if (!resolvedVersion) {
560
- return {
561
- ...buildEntryToolResult({
562
- task: "project-summary",
563
- detail,
564
- include,
565
- summary: {
566
- status: "ok",
567
- headline: `Validated ${mixinConfigs.length} mixin config(s), ${accessWideners.length} access widener(s), and ${accessTransformers.length} access transformer(s).`,
568
- subject: createSummarySubject({
569
- task: "project-summary",
570
- kind: input.subject.kind,
571
- projectPath,
572
- discover: input.subject.discover,
573
- mapping: input.mapping,
574
- sourcePriority: input.sourcePriority,
575
- scope: input.scope
576
- }),
577
- counts: {
578
- valid: 0,
579
- partial: 0,
580
- invalid: 0
581
- }
582
- },
583
- blocks: {
584
- workspace: {
585
- projectPath
586
- }
587
- }
588
- }),
589
- warnings: []
590
- };
591
- }
592
- const validationVersion = resolvedVersion;
593
- const warnings = [];
594
- let validMixins = 0;
595
- let partialMixins = 0;
596
- let invalidMixins = 0;
597
- for (const configPath of mixinConfigs) {
598
- try {
599
- const mixinResult = await this.deps.validateMixin({
600
- input: {
601
- mode: "config",
602
- configPaths: [configPath]
603
- },
604
- version: validationVersion,
605
- mapping: input.mapping,
606
- sourcePriority: input.sourcePriority,
607
- scope: input.scope,
608
- projectPath,
609
- preferProjectVersion: false,
610
- preferProjectMapping: input.preferProjectMapping,
611
- sourceRoots: input.sourceRoots,
612
- minSeverity: input.minSeverity,
613
- hideUncertain: input.hideUncertain,
614
- explain: input.explain,
615
- warningMode: input.warningMode,
616
- warningCategoryFilter: input.warningCategoryFilter,
617
- treatInfoAsWarning: input.treatInfoAsWarning,
618
- includeIssues: input.includeIssues
619
- });
620
- const summary = mixinResult.summary;
621
- validMixins += summary?.valid ?? 0;
622
- partialMixins += summary?.partial ?? 0;
623
- invalidMixins += summary?.invalid ?? 0;
624
- if (Array.isArray(mixinResult.warnings)) {
625
- warnings.push(...mixinResult.warnings);
626
- }
627
- }
628
- catch (error) {
629
- invalidMixins += 1;
630
- if (error instanceof Error) {
631
- warnings.push(`${configPath}: ${error.message}`);
632
- }
633
- }
634
- }
635
- let validAw = 0;
636
- let invalidAw = 0;
637
- for (const awPath of accessWideners) {
638
- try {
639
- const output = await this.deps.validateAccessWidener({
640
- content: await readFile(awPath, "utf8"),
641
- version: validationVersion,
642
- mapping: input.mapping,
643
- sourcePriority: input.sourcePriority,
644
- projectPath,
645
- scope: input.scope,
646
- preferProjectVersion: input.preferProjectVersion
647
- });
648
- if (output.valid) {
649
- validAw += 1;
650
- }
651
- else {
652
- invalidAw += 1;
653
- }
654
- if (Array.isArray(output.warnings)) {
655
- warnings.push(...output.warnings);
656
- }
657
- }
658
- catch (error) {
659
- invalidAw += 1;
660
- if (error instanceof Error) {
661
- warnings.push(error.message);
662
- }
663
- }
664
- }
665
- let validAt = 0;
666
- let invalidAt = 0;
667
- for (const atPath of accessTransformers) {
668
- try {
669
- if (!this.deps.validateAccessTransformer) {
670
- throw createError({
671
- code: ERROR_CODES.CONTEXT_UNRESOLVED,
672
- message: "Access Transformer validation is not configured."
673
- });
674
- }
675
- const output = await this.deps.validateAccessTransformer({
676
- content: await readFile(atPath, "utf8"),
677
- version: validationVersion,
678
- atNamespace: input.atNamespace,
679
- sourcePriority: input.sourcePriority,
680
- projectPath,
681
- scope: input.scope,
682
- preferProjectVersion: input.preferProjectVersion
683
- });
684
- if (output.valid) {
685
- validAt += 1;
686
- }
687
- else {
688
- invalidAt += 1;
689
- }
690
- if (Array.isArray(output.warnings)) {
691
- warnings.push(...output.warnings);
692
- }
693
- }
694
- catch (error) {
695
- invalidAt += 1;
696
- if (error instanceof Error) {
697
- warnings.push(error.message);
698
- }
699
- }
700
- }
701
- const invalidCount = invalidMixins + invalidAw + invalidAt;
702
- const partialCount = partialMixins;
703
- const status = invalidCount > 0 ? "invalid" : partialCount > 0 ? "partial" : "ok";
704
- return {
705
- ...buildEntryToolResult({
706
- task: "project-summary",
707
- detail,
708
- include,
709
- summary: {
710
- status,
711
- headline: `Validated ${mixinConfigs.length} mixin config(s), ${accessWideners.length} access widener(s), and ${accessTransformers.length} access transformer(s).`,
712
- subject: createSummarySubject({
713
- task: "project-summary",
714
- kind: input.subject.kind,
715
- projectPath,
716
- discover: input.subject.discover,
717
- version: resolvedVersion,
718
- mapping: input.mapping,
719
- sourcePriority: input.sourcePriority,
720
- scope: input.scope
721
- }),
722
- counts: {
723
- valid: validMixins + validAw + validAt,
724
- partial: partialCount,
725
- invalid: invalidCount
726
- }
727
- },
728
- blocks: {
729
- project: {
730
- summary: {
731
- valid: validMixins + validAw + validAt,
732
- partial: partialCount,
733
- invalid: invalidCount
734
- }
735
- },
736
- workspace: {
737
- projectPath,
738
- mixinConfigs,
739
- accessWideners,
740
- accessTransformers
741
- }
742
- },
743
- alwaysBlocks: ["project"]
744
- }),
745
- warnings
746
- };
747
- }
270
+ case "mixin":
271
+ return handleMixin(this.deps, input, detail, include);
272
+ case "access-widener":
273
+ return handleAccessWidener(this.deps, input, detail, include);
274
+ case "access-transformer":
275
+ return handleAccessTransformer(this.deps, input, detail, include);
276
+ case "project-summary":
277
+ return handleProjectSummary(this.deps, input, detail, include);
748
278
  }
749
279
  }
750
280
  }
@@ -0,0 +1,133 @@
1
+ import { z } from "zod";
2
+ import type { ArtifactProvenance, ArtifactScope, DependencyResolutionProvenance, MappingSourcePriority, ResolveArtifactTargetInput, SourceMapping, WorkspaceResolutionProvenance } from "../types.js";
3
+ export declare const VERIFY_MIXIN_TARGET_OFF: boolean;
4
+ export type VerifyMixinTargetInput = {
5
+ owner: string;
6
+ member: {
7
+ kind: "method";
8
+ name: string;
9
+ descriptor?: string;
10
+ } | {
11
+ kind: "field";
12
+ name: string;
13
+ descriptor?: string;
14
+ };
15
+ mixinMemberName?: string;
16
+ mapping?: SourceMapping;
17
+ sourcePriority?: MappingSourcePriority;
18
+ projectPath?: string;
19
+ target?: ResolveArtifactTargetInput;
20
+ scope?: ArtifactScope;
21
+ preferProjectVersion?: boolean;
22
+ strictVersion?: boolean;
23
+ };
24
+ export type VerifyMixinTargetMatch = {
25
+ name: string;
26
+ descriptor: string;
27
+ accessFlags: string[];
28
+ javaSignature?: string;
29
+ };
30
+ export type VerifyMixinTargetCandidate = {
31
+ name: string;
32
+ descriptor: string;
33
+ reason: string;
34
+ };
35
+ type SuggestedAnnotation = "@Shadow" | "@Accessor" | "@Invoker" | "@Inject-only";
36
+ export type AccessorAdvice = {
37
+ suggestedAnnotation: SuggestedAnnotation | null;
38
+ reasoning: string;
39
+ exampleSnippet: string;
40
+ candidates?: Array<{
41
+ annotation: "@Shadow" | "@Accessor" | "@Invoker";
42
+ reasoning: string;
43
+ exampleSnippet: string;
44
+ }>;
45
+ };
46
+ export type VerifyMixinTargetOutput = {
47
+ exists: boolean;
48
+ resolvedOwner: {
49
+ className: string;
50
+ mapping: SourceMapping;
51
+ };
52
+ matches: VerifyMixinTargetMatch[];
53
+ candidates: VerifyMixinTargetCandidate[];
54
+ accessorAdvice?: AccessorAdvice;
55
+ warnings: string[];
56
+ provenance: {
57
+ artifactId: string;
58
+ mappingNamespace: SourceMapping;
59
+ workspaceResolution?: WorkspaceResolutionProvenance;
60
+ dependencyResolution?: DependencyResolutionProvenance;
61
+ };
62
+ };
63
+ type ExplorerSignatureMember = {
64
+ ownerFqn: string;
65
+ name: string;
66
+ javaSignature: string;
67
+ jvmDescriptor: string;
68
+ accessFlags: number;
69
+ isSynthetic: boolean;
70
+ sourceLine?: number;
71
+ };
72
+ type ExplorerSignatureOutput = {
73
+ classAccessFlags?: number;
74
+ constructors: ExplorerSignatureMember[];
75
+ methods: ExplorerSignatureMember[];
76
+ fields: ExplorerSignatureMember[];
77
+ warnings: string[];
78
+ };
79
+ export type VerifyMixinTargetDeps = {
80
+ resolveArtifact: (input: {
81
+ target: ResolveArtifactTargetInput;
82
+ mapping?: SourceMapping;
83
+ sourcePriority?: MappingSourcePriority;
84
+ projectPath?: string;
85
+ scope?: ArtifactScope;
86
+ preferProjectVersion?: boolean;
87
+ strictVersion?: boolean;
88
+ }) => Promise<{
89
+ artifactId: string;
90
+ mappingApplied: SourceMapping;
91
+ binaryJarPath?: string;
92
+ provenance?: ArtifactProvenance;
93
+ warnings?: string[];
94
+ }>;
95
+ getSignature: (input: {
96
+ fqn: string;
97
+ jarPath: string;
98
+ access: "public" | "all";
99
+ includeSynthetic: boolean;
100
+ includeInherited: boolean;
101
+ }) => Promise<ExplorerSignatureOutput>;
102
+ };
103
+ export declare class VerifyMixinTargetService {
104
+ private readonly deps;
105
+ constructor(deps: VerifyMixinTargetDeps);
106
+ execute(input: VerifyMixinTargetInput): Promise<VerifyMixinTargetOutput>;
107
+ }
108
+ export declare const verifyMixinTargetMemberSchemaExport: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
109
+ kind: z.ZodLiteral<"method">;
110
+ name: z.ZodString;
111
+ descriptor: z.ZodOptional<z.ZodString>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ name: string;
114
+ kind: "method";
115
+ descriptor?: string | undefined;
116
+ }, {
117
+ name: string;
118
+ kind: "method";
119
+ descriptor?: string | undefined;
120
+ }>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"field">;
122
+ name: z.ZodString;
123
+ descriptor: z.ZodOptional<z.ZodString>;
124
+ }, "strip", z.ZodTypeAny, {
125
+ name: string;
126
+ kind: "field";
127
+ descriptor?: string | undefined;
128
+ }, {
129
+ name: string;
130
+ kind: "field";
131
+ descriptor?: string | undefined;
132
+ }>]>;
133
+ export {};