@adhisang/minecraft-modding-mcp 1.2.1 → 2.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 (51) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +184 -64
  3. package/dist/cli.js +31 -4
  4. package/dist/compat-stdio-transport.d.ts +2 -7
  5. package/dist/compat-stdio-transport.js +12 -154
  6. package/dist/index.js +537 -202
  7. package/dist/json-rpc-framing.d.ts +22 -0
  8. package/dist/json-rpc-framing.js +168 -0
  9. package/dist/mapping-pipeline-service.d.ts +1 -1
  10. package/dist/mapping-pipeline-service.js +13 -5
  11. package/dist/mapping-service.d.ts +12 -4
  12. package/dist/mapping-service.js +222 -105
  13. package/dist/mcp-helpers.d.ts +10 -2
  14. package/dist/mcp-helpers.js +59 -5
  15. package/dist/minecraft-explorer-service.d.ts +1 -2
  16. package/dist/minecraft-explorer-service.js +120 -24
  17. package/dist/mixin-validator.d.ts +24 -2
  18. package/dist/mixin-validator.js +228 -103
  19. package/dist/mod-decompile-service.d.ts +5 -0
  20. package/dist/mod-decompile-service.js +40 -5
  21. package/dist/mod-remap-service.js +142 -30
  22. package/dist/mojang-tiny-mapping-service.js +26 -26
  23. package/dist/path-resolver.js +41 -4
  24. package/dist/registry-service.d.ts +10 -1
  25. package/dist/registry-service.js +154 -22
  26. package/dist/resources.js +7 -7
  27. package/dist/search-hit-accumulator.d.ts +0 -3
  28. package/dist/search-hit-accumulator.js +27 -6
  29. package/dist/source-jar-reader.js +16 -2
  30. package/dist/source-resolver.d.ts +1 -0
  31. package/dist/source-resolver.js +93 -2
  32. package/dist/source-service.d.ts +76 -47
  33. package/dist/source-service.js +1344 -763
  34. package/dist/stdio-supervisor.d.ts +46 -0
  35. package/dist/stdio-supervisor.js +349 -0
  36. package/dist/storage/files-repo.d.ts +3 -0
  37. package/dist/storage/files-repo.js +66 -1
  38. package/dist/storage/migrations.d.ts +1 -1
  39. package/dist/storage/migrations.js +6 -2
  40. package/dist/storage/schema.d.ts +1 -0
  41. package/dist/storage/schema.js +7 -0
  42. package/dist/symbols/symbol-extractor.js +6 -4
  43. package/dist/tool-execution-gate.d.ts +15 -0
  44. package/dist/tool-execution-gate.js +58 -0
  45. package/dist/tool-input.d.ts +6 -0
  46. package/dist/tool-input.js +64 -0
  47. package/dist/types.d.ts +1 -1
  48. package/dist/version-diff-service.js +10 -5
  49. package/dist/version-service.js +7 -2
  50. package/dist/workspace-mapping-service.js +12 -0
  51. package/package.json +4 -1
@@ -1,5 +1,5 @@
1
1
  import { type ResponseContext as ExplorerResponseContext, type SignatureMember } from "./minecraft-explorer-service.js";
2
- import { type MixinValidationResult, type MappingHealthReport, type AccessWidenerValidationResult } from "./mixin-validator.js";
2
+ import { type MixinValidationResult, type MixinValidationProvenance, type MappingHealthReport, type AccessWidenerValidationResult } from "./mixin-validator.js";
3
3
  import { type ClassApiMatrixInput as MappingClassApiMatrixInput, type ClassApiMatrixOutput as MappingClassApiMatrixOutput, type FindMappingInput as MappingFindMappingInput, type FindMappingOutput as MappingFindMappingOutput, type ResolveMethodMappingExactInput as MappingResolveMethodMappingExactInput, type ResolveMethodMappingExactOutput as MappingResolveMethodMappingExactOutput, type SymbolResolutionOutput as MappingSymbolResolutionOutput, type SymbolExistenceInput as MappingSymbolExistenceInput, type SymbolExistenceOutput as MappingSymbolExistenceOutput } from "./mapping-service.js";
4
4
  import { RuntimeMetrics, type RuntimeMetricSnapshot } from "./observability.js";
5
5
  import { type WorkspaceCompileMappingOutput } from "./workspace-mapping-service.js";
@@ -33,9 +33,16 @@ export type ResolveArtifactOutput = {
33
33
  provenance: ArtifactProvenance;
34
34
  qualityFlags: string[];
35
35
  repoUrl?: string;
36
+ artifactContents: ArtifactContentsSummary;
36
37
  warnings: string[];
37
38
  sampleEntries?: string[];
38
39
  };
40
+ export type ArtifactContentsSummary = {
41
+ sourceKind: "source-jar" | "decompiled-binary";
42
+ indexedContentKinds: string[];
43
+ resourcesIncluded: boolean;
44
+ sourceCoverage: "full" | "partial";
45
+ };
39
46
  type SymbolKind = "class" | "interface" | "enum" | "record" | "method" | "field";
40
47
  type SearchIntent = "symbol" | "text" | "path";
41
48
  type SearchMatch = "exact" | "prefix" | "contains" | "regex";
@@ -44,11 +51,6 @@ export type SearchScope = {
44
51
  fileGlob?: string;
45
52
  symbolKind?: SymbolKind;
46
53
  };
47
- export type SearchInclude = {
48
- snippetLines?: number;
49
- includeDefinition?: boolean;
50
- includeOneHop?: boolean;
51
- };
52
54
  export type SearchResultSymbol = {
53
55
  symbolKind: SymbolKind;
54
56
  symbolName: string;
@@ -59,27 +61,9 @@ export type SearchSourceHit = {
59
61
  filePath: string;
60
62
  score: number;
61
63
  matchedIn: "symbol" | "path" | "content";
62
- startLine: number;
63
- endLine: number;
64
- snippet: string;
65
64
  reasonCodes: string[];
66
65
  symbol?: SearchResultSymbol;
67
66
  };
68
- export type SearchRelation = {
69
- fromSymbol: {
70
- symbolKind: SymbolKind;
71
- symbolName: string;
72
- filePath: string;
73
- line: number;
74
- };
75
- toSymbol: {
76
- symbolKind: SymbolKind;
77
- symbolName: string;
78
- filePath: string;
79
- line: number;
80
- };
81
- relation: "calls" | "uses-type" | "imports";
82
- };
83
67
  export type QueryMode = "auto" | "token" | "literal";
84
68
  export type SearchClassSourceInput = {
85
69
  artifactId: string;
@@ -87,17 +71,16 @@ export type SearchClassSourceInput = {
87
71
  intent?: SearchIntent;
88
72
  match?: SearchMatch;
89
73
  scope?: SearchScope;
90
- include?: SearchInclude;
91
74
  queryMode?: QueryMode;
92
75
  limit?: number;
93
76
  cursor?: string;
94
77
  };
95
78
  export type SearchClassSourceOutput = {
96
79
  hits: SearchSourceHit[];
97
- relations?: SearchRelation[];
98
80
  nextCursor?: string;
99
- totalApprox: number;
100
81
  mappingApplied: SourceMapping;
82
+ returnedNamespace: SourceMapping;
83
+ artifactContents: ArtifactContentsSummary;
101
84
  };
102
85
  export type GetArtifactFileInput = {
103
86
  artifactId: string;
@@ -110,6 +93,8 @@ export type GetArtifactFileOutput = {
110
93
  contentBytes: number;
111
94
  truncated: boolean;
112
95
  mappingApplied: SourceMapping;
96
+ returnedNamespace: SourceMapping;
97
+ artifactContents: ArtifactContentsSummary;
113
98
  };
114
99
  export type ListArtifactFilesInput = {
115
100
  artifactId: string;
@@ -121,6 +106,8 @@ export type ListArtifactFilesOutput = {
121
106
  items: string[];
122
107
  nextCursor?: string;
123
108
  mappingApplied: SourceMapping;
109
+ artifactContents: ArtifactContentsSummary;
110
+ warnings: string[];
124
111
  };
125
112
  export type FindMappingInput = MappingFindMappingInput;
126
113
  export type FindMappingOutput = MappingFindMappingOutput;
@@ -140,6 +127,7 @@ export type ResolveWorkspaceSymbolInput = {
140
127
  descriptor?: string;
141
128
  sourceMapping: SourceMapping;
142
129
  sourcePriority?: MappingSourcePriority;
130
+ maxCandidates?: number;
143
131
  };
144
132
  export type ResolveWorkspaceSymbolOutput = MappingSymbolResolutionOutput & {
145
133
  workspaceDetection: WorkspaceCompileMappingOutput;
@@ -178,8 +166,10 @@ export type GetClassSourceOutput = {
178
166
  artifactId: string;
179
167
  requestedMapping: SourceMapping;
180
168
  mappingApplied: SourceMapping;
169
+ returnedNamespace: SourceMapping;
181
170
  provenance: ArtifactProvenance;
182
171
  qualityFlags: string[];
172
+ artifactContents: ArtifactContentsSummary;
183
173
  outputFile?: string;
184
174
  warnings: string[];
185
175
  };
@@ -236,8 +226,10 @@ export type GetClassMembersOutput = {
236
226
  artifactId: string;
237
227
  requestedMapping: SourceMapping;
238
228
  mappingApplied: SourceMapping;
229
+ returnedNamespace: SourceMapping;
239
230
  provenance: ArtifactProvenance;
240
231
  qualityFlags: string[];
232
+ artifactContents: ArtifactContentsSummary;
241
233
  warnings: string[];
242
234
  };
243
235
  export type TraceSymbolLifecycleInput = {
@@ -282,9 +274,9 @@ type DiffMemberChangedField = "accessFlags" | "isSynthetic" | "javaSignature" |
282
274
  export type DiffMember = SignatureMember;
283
275
  export type DiffMemberChange = {
284
276
  key: string;
285
- from: DiffMember;
286
- to: DiffMember;
287
277
  changed: DiffMemberChangedField[];
278
+ from?: DiffMember;
279
+ to?: DiffMember;
288
280
  };
289
281
  export type DiffClassMemberDelta = {
290
282
  added: DiffMember[];
@@ -297,6 +289,7 @@ export type DiffClassSignaturesInput = {
297
289
  toVersion: string;
298
290
  mapping?: SourceMapping;
299
291
  sourcePriority?: MappingSourcePriority;
292
+ includeFullDiff?: boolean;
300
293
  };
301
294
  export type DiffClassSignaturesOutput = {
302
295
  query: {
@@ -356,11 +349,22 @@ export type IndexArtifactOutput = {
356
349
  mappingApplied: SourceMapping;
357
350
  };
358
351
  export type ValidateMixinInput = {
359
- source?: string;
360
- sourcePath?: string;
361
- sourcePaths?: string[];
362
- mixinConfigPath?: string | string[];
363
- sourceRoot?: string;
352
+ input: {
353
+ mode: "inline";
354
+ source: string;
355
+ } | {
356
+ mode: "path";
357
+ path: string;
358
+ } | {
359
+ mode: "paths";
360
+ paths: string[];
361
+ } | {
362
+ mode: "config";
363
+ configPaths: string[];
364
+ } | {
365
+ mode: "project";
366
+ path: string;
367
+ };
364
368
  sourceRoots?: string[];
365
369
  version: string;
366
370
  mapping?: SourceMapping;
@@ -373,12 +377,19 @@ export type ValidateMixinInput = {
373
377
  explain?: boolean;
374
378
  warningMode?: "full" | "aggregated";
375
379
  preferProjectMapping?: boolean;
376
- reportMode?: "compact" | "full";
380
+ reportMode?: "compact" | "full" | "summary-first";
377
381
  warningCategoryFilter?: ("mapping" | "configuration" | "validation" | "resolution" | "parse")[];
378
382
  treatInfoAsWarning?: boolean;
383
+ includeIssues?: boolean;
384
+ };
385
+ export type ValidateMixinResultSource = {
386
+ kind: "inline" | "path" | "config";
387
+ label: string;
388
+ path?: string;
389
+ configPath?: string;
379
390
  };
380
391
  export type ValidateMixinBatchResult = {
381
- sourcePath: string;
392
+ source: ValidateMixinResultSource;
382
393
  result?: MixinValidationResult;
383
394
  error?: string;
384
395
  };
@@ -389,23 +400,25 @@ export type ValidateMixinBatchIssueSummaryItem = {
389
400
  count: number;
390
401
  sampleTargets: string[];
391
402
  };
392
- export type ValidateMixinBatchOutput = {
403
+ export type ValidateMixinOutput = {
404
+ mode: ValidateMixinInput["input"]["mode"];
393
405
  results: ValidateMixinBatchResult[];
394
406
  summary: {
395
407
  total: number;
396
408
  valid: number;
409
+ partial: number;
397
410
  invalid: number;
398
- /** @deprecated Use processingErrors instead */
399
- errors: number;
400
411
  processingErrors: number;
401
412
  totalValidationErrors: number;
402
413
  totalValidationWarnings: number;
403
- confidenceScore?: number;
404
414
  };
405
415
  issueSummary?: ValidateMixinBatchIssueSummaryItem[];
416
+ provenance?: MixinValidationProvenance;
417
+ incompleteReasons?: string[];
406
418
  toolHealth?: MappingHealthReport;
419
+ confidenceScore?: number;
420
+ warnings: string[];
407
421
  };
408
- export type ValidateMixinOutput = MixinValidationResult | ValidateMixinBatchOutput;
409
422
  export type ValidateAccessWidenerInput = {
410
423
  content: string;
411
424
  version: string;
@@ -429,9 +442,13 @@ export declare class SourceService {
429
442
  private readonly versionDiffService;
430
443
  private readonly modDecompileService;
431
444
  private readonly modSearchService;
445
+ private cacheMetricsState;
432
446
  constructor(explicitConfig?: Config, metrics?: RuntimeMetrics);
433
447
  private discoverVersionSourceJar;
434
448
  private buildVersionSourceRecoveryCommand;
449
+ private buildArtifactContentsSummary;
450
+ private inferVersionFromContext;
451
+ private resolveVersionContext;
435
452
  resolveArtifact(input: ResolveArtifactInput): Promise<ResolveArtifactOutput>;
436
453
  searchClassSource(input: SearchClassSourceInput): Promise<SearchClassSourceOutput>;
437
454
  getArtifactFile(input: GetArtifactFileInput): Promise<GetArtifactFileOutput>;
@@ -453,7 +470,15 @@ export declare class SourceService {
453
470
  getClassSource(input: GetClassSourceInput): Promise<GetClassSourceOutput>;
454
471
  getClassMembers(input: GetClassMembersInput): Promise<GetClassMembersOutput>;
455
472
  validateMixin(input: ValidateMixinInput): Promise<ValidateMixinOutput>;
456
- private validateMixinBatch;
473
+ private createProjectValidateMixinConfigInput;
474
+ private shouldRetryValidateMixinWithMavenFirst;
475
+ private findValidateMixinClassMapping;
476
+ private validateMixinSingle;
477
+ private resolveMixinInputPath;
478
+ private resolveMixinConfigSources;
479
+ private validateMixinMany;
480
+ private applyValidateMixinOutputCompaction;
481
+ private buildValidateMixinOutput;
457
482
  validateAccessWidener(input: ValidateAccessWidenerInput): Promise<ValidateAccessWidenerOutput>;
458
483
  getRuntimeMetrics(): RuntimeMetricSnapshot;
459
484
  indexArtifact(input: IndexArtifactInput): Promise<IndexArtifactOutput>;
@@ -468,13 +493,13 @@ export declare class SourceService {
468
493
  private indexedCandidateLimitForMatch;
469
494
  private extractClassMetadata;
470
495
  private resolveClassFilePath;
471
- private findNearestSymbolForLine;
472
- private findNearestSymbolFromList;
473
- private buildOneHopRelations;
496
+ private resolveBinaryFallbackArtifact;
474
497
  private buildProvenance;
475
498
  private buildFallbackProvenance;
476
- private resolveToOfficialClassName;
477
- private resolveToOfficialMemberName;
499
+ private resolveClassNameForLookup;
500
+ private buildClassSourceNotFoundError;
501
+ private resolveToObfuscatedClassName;
502
+ private resolveToObfuscatedMemberName;
478
503
  private remapSignatureMembers;
479
504
  private fallbackArtifactSignature;
480
505
  private resolveIndexRebuildReason;
@@ -487,5 +512,9 @@ export declare class SourceService {
487
512
  private hasAnyFiles;
488
513
  private enforceCacheLimits;
489
514
  private refreshCacheMetrics;
515
+ private touchCacheMetrics;
516
+ private upsertCacheMetrics;
517
+ private removeCacheMetrics;
518
+ private publishCacheMetrics;
490
519
  }
491
520
  export {};