cwtools-shared 0.2.3 → 0.2.5
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/dist/generated/mcpTools.d.ts +55 -61
- package/dist/generated/mcpTools.js +63 -82
- package/dist/host/readiness.js +2 -3
- package/dist/host/vanillaCache.js +2 -3
- package/dist/knowledge/diagnosticRouting.js +1 -1
- package/dist/knowledge/rules.js +2 -6
- package/dist/knowledge/workflowHints.js +1 -1
- package/dist/project/profile.d.ts +6 -8
- package/dist/project/profile.js +10 -28
- package/dist/safety/paths.js +1 -1
- package/dist/tools/names.d.ts +2 -2
- package/dist/tools/names.js +2 -3
- package/dist/tools/symbols.d.ts +3 -1
- package/dist/tools/symbols.js +33 -6
- package/dist/tools/toolHandlers.js +12 -12
- package/package.json +1 -1
|
@@ -203,18 +203,21 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
203
203
|
readonly properties: {
|
|
204
204
|
readonly file: {
|
|
205
205
|
readonly type: "string";
|
|
206
|
-
readonly description: "Absolute
|
|
206
|
+
readonly description: "Absolute path inside the workspace or a configured game installation.";
|
|
207
207
|
};
|
|
208
208
|
readonly line: {
|
|
209
|
-
readonly type: "
|
|
209
|
+
readonly type: "integer";
|
|
210
|
+
readonly minimum: 0;
|
|
210
211
|
readonly description: "Line number (0-based)";
|
|
211
212
|
};
|
|
212
213
|
readonly column: {
|
|
213
|
-
readonly type: "
|
|
214
|
+
readonly type: "integer";
|
|
215
|
+
readonly minimum: 0;
|
|
214
216
|
readonly description: "Column number (0-based)";
|
|
215
217
|
};
|
|
216
218
|
};
|
|
217
219
|
readonly required: readonly ["file", "line", "column"];
|
|
220
|
+
readonly additionalProperties: false;
|
|
218
221
|
};
|
|
219
222
|
};
|
|
220
223
|
readonly registry: {
|
|
@@ -292,10 +295,6 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
292
295
|
readonly type: "object";
|
|
293
296
|
readonly description: "Optional raw failed tool result to classify without querying diagnostics again.";
|
|
294
297
|
};
|
|
295
|
-
readonly reflection: {
|
|
296
|
-
readonly type: "string";
|
|
297
|
-
readonly description: "Optional legacy free-form analysis from the model. Kept for backward compatibility; the host still returns deterministic routing advice.";
|
|
298
|
-
};
|
|
299
298
|
};
|
|
300
299
|
readonly required: readonly [];
|
|
301
300
|
};
|
|
@@ -311,19 +310,19 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
311
310
|
}, {
|
|
312
311
|
readonly tool: {
|
|
313
312
|
readonly name: "query_project_profile";
|
|
314
|
-
readonly description: "Read the /init-generated Agent project profile from .cwtools/project/profile.json. Use this before broad scans to get workspace type, key directories, localisation languages/encoding, namespaces, workflow routing, validation hints, and
|
|
313
|
+
readonly description: "Read the /init-generated Agent project profile from .cwtools/project/profile.json. Use this before broad scans to get workspace type, key directories, localisation languages/encoding, namespaces, workflow routing, validation hints, and targeted guidance cards.";
|
|
315
314
|
readonly inputSchema: {
|
|
316
315
|
readonly type: "object";
|
|
317
316
|
readonly properties: {
|
|
318
317
|
readonly section: {
|
|
319
318
|
readonly type: "string";
|
|
320
|
-
readonly enum: readonly ["summary", "routing", "directories", "localisation", "identifiers", "validation", "compatibility", "
|
|
319
|
+
readonly enum: readonly ["summary", "routing", "directories", "localisation", "identifiers", "validation", "compatibility", "guidanceCards", "all"];
|
|
321
320
|
readonly description: "Targeted profile section to return. Default summary. Use all only when you need the whole profile.";
|
|
322
321
|
};
|
|
323
|
-
readonly
|
|
322
|
+
readonly guidance: {
|
|
324
323
|
readonly type: "string";
|
|
325
|
-
readonly enum: readonly ["
|
|
326
|
-
readonly description: "Optional
|
|
324
|
+
readonly enum: readonly ["implementation", "planning", "exploration", "review", "utility", "localisation", "assets", "coordination", "paradox_coordination"];
|
|
325
|
+
readonly description: "Optional guidance card to return for the current task concern.";
|
|
327
326
|
};
|
|
328
327
|
};
|
|
329
328
|
readonly required: readonly [];
|
|
@@ -485,7 +484,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
485
484
|
};
|
|
486
485
|
readonly file: {
|
|
487
486
|
readonly type: "string";
|
|
488
|
-
readonly description: "Optional workspace-relative or absolute
|
|
487
|
+
readonly description: "Optional workspace-relative path or absolute path inside the workspace/configured game installation used to restrict entry points.";
|
|
489
488
|
};
|
|
490
489
|
readonly typeName: {
|
|
491
490
|
readonly type: "string";
|
|
@@ -550,7 +549,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
550
549
|
};
|
|
551
550
|
readonly file: {
|
|
552
551
|
readonly type: "string";
|
|
553
|
-
readonly description: "Caller file; narrows to one invocation.";
|
|
552
|
+
readonly description: "Caller file inside the workspace or a configured game installation; narrows to one invocation.";
|
|
554
553
|
};
|
|
555
554
|
readonly line: {
|
|
556
555
|
readonly type: "number";
|
|
@@ -581,7 +580,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
581
580
|
readonly properties: {
|
|
582
581
|
readonly file: {
|
|
583
582
|
readonly type: "string";
|
|
584
|
-
readonly description: "Optional
|
|
583
|
+
readonly description: "Optional path inside the workspace or a configured game installation; when omitted a definitionId must be given.";
|
|
585
584
|
};
|
|
586
585
|
readonly definitionId: {
|
|
587
586
|
readonly type: "string";
|
|
@@ -700,13 +699,13 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
700
699
|
}, {
|
|
701
700
|
readonly tool: {
|
|
702
701
|
readonly name: "get_pdx_block";
|
|
703
|
-
readonly description: "Extract exactly one complete AST block by symbol name. Works with .txt (events, common), .gui (containerWindowType by name), and .gfx (pdxmesh by name). Returns 1-based startLine/endLine that can be passed directly to replace_lines. If the symbol is not found, the error response includes a full list of available symbols with line ranges so you can retry with the correct name.";
|
|
702
|
+
readonly description: "Extract exactly one complete AST block by symbol name from the workspace or a configured game installation. Works with .txt (events, common), .gui (containerWindowType by name), and .gfx (pdxmesh by name). Returns 1-based startLine/endLine that can be passed directly to replace_lines. If the symbol is not found, the error response includes a full list of available symbols with line ranges so you can retry with the correct name.";
|
|
704
703
|
readonly inputSchema: {
|
|
705
704
|
readonly type: "object";
|
|
706
705
|
readonly properties: {
|
|
707
706
|
readonly file: {
|
|
708
707
|
readonly type: "string";
|
|
709
|
-
readonly description: "Absolute
|
|
708
|
+
readonly description: "Absolute path inside the workspace or a configured game installation.";
|
|
710
709
|
};
|
|
711
710
|
readonly symbol: {
|
|
712
711
|
readonly type: "string";
|
|
@@ -733,7 +732,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
733
732
|
readonly properties: {
|
|
734
733
|
readonly file: {
|
|
735
734
|
readonly type: "string";
|
|
736
|
-
readonly description: "Absolute file path
|
|
735
|
+
readonly description: "Absolute file path inside the workspace or a configured game installation.";
|
|
737
736
|
};
|
|
738
737
|
readonly line: {
|
|
739
738
|
readonly type: "number";
|
|
@@ -768,7 +767,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
768
767
|
readonly properties: {
|
|
769
768
|
readonly file: {
|
|
770
769
|
readonly type: "string";
|
|
771
|
-
readonly description: "Absolute
|
|
770
|
+
readonly description: "Absolute path inside the workspace or a configured game installation.";
|
|
772
771
|
};
|
|
773
772
|
};
|
|
774
773
|
readonly required: readonly ["file"];
|
|
@@ -811,29 +810,34 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
811
810
|
};
|
|
812
811
|
}, {
|
|
813
812
|
readonly tool: {
|
|
814
|
-
readonly name: "
|
|
815
|
-
readonly description: "
|
|
813
|
+
readonly name: "go_to_definition";
|
|
814
|
+
readonly description: "Find a definition by exact symbol name or by a 0-based file position. Uses CWTools semantic lookup when available and falls back to the active VS Code language provider.";
|
|
816
815
|
readonly inputSchema: {
|
|
817
816
|
readonly type: "object";
|
|
818
817
|
readonly properties: {
|
|
818
|
+
readonly symbolName: {
|
|
819
|
+
readonly type: "string";
|
|
820
|
+
readonly description: "Exact symbol name. Use this instead of file/line/column when the identifier is known.";
|
|
821
|
+
};
|
|
819
822
|
readonly file: {
|
|
820
823
|
readonly type: "string";
|
|
821
|
-
readonly description: "Absolute file path";
|
|
824
|
+
readonly description: "Absolute file path inside the workspace or a configured game installation.";
|
|
822
825
|
};
|
|
823
826
|
readonly line: {
|
|
824
827
|
readonly type: "number";
|
|
825
|
-
readonly description: "Line number (0-based)";
|
|
828
|
+
readonly description: "Line number (0-based).";
|
|
826
829
|
};
|
|
827
830
|
readonly column: {
|
|
828
831
|
readonly type: "number";
|
|
829
|
-
readonly description: "Column number (0-based)";
|
|
832
|
+
readonly description: "Column number (0-based).";
|
|
830
833
|
};
|
|
831
834
|
};
|
|
832
|
-
readonly required: readonly [
|
|
835
|
+
readonly required: readonly [];
|
|
836
|
+
readonly additionalProperties: false;
|
|
833
837
|
};
|
|
834
838
|
};
|
|
835
839
|
readonly registry: {
|
|
836
|
-
readonly name: "
|
|
840
|
+
readonly name: "go_to_definition";
|
|
837
841
|
readonly isWrite: false;
|
|
838
842
|
readonly isReadOnly: true;
|
|
839
843
|
readonly effect: "workspace_read";
|
|
@@ -842,48 +846,38 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
842
846
|
};
|
|
843
847
|
}, {
|
|
844
848
|
readonly tool: {
|
|
845
|
-
readonly name: "
|
|
846
|
-
readonly description: "Find
|
|
847
|
-
readonly inputSchema: {
|
|
848
|
-
readonly type: "object";
|
|
849
|
-
readonly properties: {
|
|
850
|
-
readonly symbolName: {
|
|
851
|
-
readonly type: "string";
|
|
852
|
-
readonly description: "The exact name of the symbol to find (e.g. \"samplemod_has_psionic_research\", \"distar.001\")";
|
|
853
|
-
};
|
|
854
|
-
};
|
|
855
|
-
readonly required: readonly ["symbolName"];
|
|
856
|
-
};
|
|
857
|
-
};
|
|
858
|
-
readonly registry: {
|
|
859
|
-
readonly name: "query_definition_by_name";
|
|
860
|
-
readonly isWrite: false;
|
|
861
|
-
readonly isReadOnly: true;
|
|
862
|
-
readonly effect: "workspace_read";
|
|
863
|
-
readonly riskLevel: 0;
|
|
864
|
-
readonly concurrencyClass: "parallel";
|
|
865
|
-
};
|
|
866
|
-
}, {
|
|
867
|
-
readonly tool: {
|
|
868
|
-
readonly name: "query_references";
|
|
869
|
-
readonly description: "Find references to an identifier through the active language provider, with a bounded workspace text-search fallback.";
|
|
849
|
+
readonly name: "find_references";
|
|
850
|
+
readonly description: "Find references by exact identifier or by a 0-based file position. Identifier lookup uses workspace symbols plus a bounded text fallback; position lookup uses the active VS Code language provider.";
|
|
870
851
|
readonly inputSchema: {
|
|
871
852
|
readonly type: "object";
|
|
872
853
|
readonly properties: {
|
|
873
854
|
readonly identifier: {
|
|
874
855
|
readonly type: "string";
|
|
875
|
-
readonly description: "
|
|
856
|
+
readonly description: "Exact identifier. Use this instead of file/line/column when the name is known.";
|
|
876
857
|
};
|
|
877
858
|
readonly file: {
|
|
878
859
|
readonly type: "string";
|
|
879
|
-
readonly description: "
|
|
860
|
+
readonly description: "Absolute file path inside the workspace or a configured game installation.";
|
|
861
|
+
};
|
|
862
|
+
readonly line: {
|
|
863
|
+
readonly type: "number";
|
|
864
|
+
readonly description: "Line number (0-based).";
|
|
865
|
+
};
|
|
866
|
+
readonly column: {
|
|
867
|
+
readonly type: "number";
|
|
868
|
+
readonly description: "Column number (0-based).";
|
|
869
|
+
};
|
|
870
|
+
readonly limit: {
|
|
871
|
+
readonly type: "number";
|
|
872
|
+
readonly description: "Maximum references to return (default 100, max 500).";
|
|
880
873
|
};
|
|
881
874
|
};
|
|
882
|
-
readonly required: readonly [
|
|
875
|
+
readonly required: readonly [];
|
|
876
|
+
readonly additionalProperties: false;
|
|
883
877
|
};
|
|
884
878
|
};
|
|
885
879
|
readonly registry: {
|
|
886
|
-
readonly name: "
|
|
880
|
+
readonly name: "find_references";
|
|
887
881
|
readonly isWrite: false;
|
|
888
882
|
readonly isReadOnly: true;
|
|
889
883
|
readonly effect: "workspace_read";
|
|
@@ -1030,7 +1024,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
1030
1024
|
readonly properties: {
|
|
1031
1025
|
readonly file: {
|
|
1032
1026
|
readonly type: "string";
|
|
1033
|
-
readonly description: "Absolute file
|
|
1027
|
+
readonly description: "Absolute path to a parsed file inside the workspace or a configured game installation.";
|
|
1034
1028
|
};
|
|
1035
1029
|
};
|
|
1036
1030
|
readonly required: readonly ["file"];
|
|
@@ -1089,7 +1083,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
1089
1083
|
readonly properties: {
|
|
1090
1084
|
readonly file: {
|
|
1091
1085
|
readonly type: "string";
|
|
1092
|
-
readonly description: "
|
|
1086
|
+
readonly description: "Workspace-relative path or absolute path inside the workspace/configured game installation.";
|
|
1093
1087
|
};
|
|
1094
1088
|
};
|
|
1095
1089
|
readonly required: readonly ["file"];
|
|
@@ -1112,7 +1106,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
1112
1106
|
readonly properties: {
|
|
1113
1107
|
readonly file: {
|
|
1114
1108
|
readonly type: "string";
|
|
1115
|
-
readonly description: "
|
|
1109
|
+
readonly description: "Workspace-relative path or absolute path inside the workspace/configured game installation.";
|
|
1116
1110
|
};
|
|
1117
1111
|
};
|
|
1118
1112
|
readonly required: readonly ["file"];
|
|
@@ -1166,7 +1160,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
1166
1160
|
};
|
|
1167
1161
|
readonly file: {
|
|
1168
1162
|
readonly type: "string";
|
|
1169
|
-
readonly description: "
|
|
1163
|
+
readonly description: "Workspace-relative path or absolute path inside the workspace/configured game installation; lists its Effects with cursor pagination.";
|
|
1170
1164
|
};
|
|
1171
1165
|
readonly limit: {
|
|
1172
1166
|
readonly type: "number";
|
|
@@ -1197,7 +1191,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
1197
1191
|
readonly properties: {
|
|
1198
1192
|
readonly file: {
|
|
1199
1193
|
readonly type: "string";
|
|
1200
|
-
readonly description: "
|
|
1194
|
+
readonly description: "Workspace-relative path or absolute path inside the workspace/configured game installation.";
|
|
1201
1195
|
};
|
|
1202
1196
|
};
|
|
1203
1197
|
readonly required: readonly ["file"];
|
|
@@ -1224,7 +1218,7 @@ export declare const GENERATED_MCP_TOOLS: readonly [{
|
|
|
1224
1218
|
};
|
|
1225
1219
|
readonly file: {
|
|
1226
1220
|
readonly type: "string";
|
|
1227
|
-
readonly description: "
|
|
1221
|
+
readonly description: "Workspace-relative path or absolute path inside the workspace/configured game installation.";
|
|
1228
1222
|
};
|
|
1229
1223
|
};
|
|
1230
1224
|
readonly required: readonly [];
|
|
@@ -234,14 +234,16 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
234
234
|
"properties": {
|
|
235
235
|
"file": {
|
|
236
236
|
"type": "string",
|
|
237
|
-
"description": "Absolute
|
|
237
|
+
"description": "Absolute path inside the workspace or a configured game installation."
|
|
238
238
|
},
|
|
239
239
|
"line": {
|
|
240
|
-
"type": "
|
|
240
|
+
"type": "integer",
|
|
241
|
+
"minimum": 0,
|
|
241
242
|
"description": "Line number (0-based)"
|
|
242
243
|
},
|
|
243
244
|
"column": {
|
|
244
|
-
"type": "
|
|
245
|
+
"type": "integer",
|
|
246
|
+
"minimum": 0,
|
|
245
247
|
"description": "Column number (0-based)"
|
|
246
248
|
}
|
|
247
249
|
},
|
|
@@ -249,7 +251,8 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
249
251
|
"file",
|
|
250
252
|
"line",
|
|
251
253
|
"column"
|
|
252
|
-
]
|
|
254
|
+
],
|
|
255
|
+
"additionalProperties": false
|
|
253
256
|
}
|
|
254
257
|
},
|
|
255
258
|
"registry": {
|
|
@@ -334,10 +337,6 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
334
337
|
"toolResult": {
|
|
335
338
|
"type": "object",
|
|
336
339
|
"description": "Optional raw failed tool result to classify without querying diagnostics again."
|
|
337
|
-
},
|
|
338
|
-
"reflection": {
|
|
339
|
-
"type": "string",
|
|
340
|
-
"description": "Optional legacy free-form analysis from the model. Kept for backward compatibility; the host still returns deterministic routing advice."
|
|
341
340
|
}
|
|
342
341
|
},
|
|
343
342
|
"required": []
|
|
@@ -355,7 +354,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
355
354
|
{
|
|
356
355
|
"tool": {
|
|
357
356
|
"name": "query_project_profile",
|
|
358
|
-
"description": "Read the /init-generated Agent project profile from .cwtools/project/profile.json. Use this before broad scans to get workspace type, key directories, localisation languages/encoding, namespaces, workflow routing, validation hints, and
|
|
357
|
+
"description": "Read the /init-generated Agent project profile from .cwtools/project/profile.json. Use this before broad scans to get workspace type, key directories, localisation languages/encoding, namespaces, workflow routing, validation hints, and targeted guidance cards.",
|
|
359
358
|
"inputSchema": {
|
|
360
359
|
"type": "object",
|
|
361
360
|
"properties": {
|
|
@@ -369,29 +368,25 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
369
368
|
"identifiers",
|
|
370
369
|
"validation",
|
|
371
370
|
"compatibility",
|
|
372
|
-
"
|
|
371
|
+
"guidanceCards",
|
|
373
372
|
"all"
|
|
374
373
|
],
|
|
375
374
|
"description": "Targeted profile section to return. Default summary. Use all only when you need the whole profile."
|
|
376
375
|
},
|
|
377
|
-
"
|
|
376
|
+
"guidance": {
|
|
378
377
|
"type": "string",
|
|
379
378
|
"enum": [
|
|
380
|
-
"
|
|
381
|
-
"
|
|
382
|
-
"
|
|
383
|
-
"general",
|
|
384
|
-
"utility",
|
|
379
|
+
"implementation",
|
|
380
|
+
"planning",
|
|
381
|
+
"exploration",
|
|
385
382
|
"review",
|
|
386
|
-
"
|
|
387
|
-
"
|
|
388
|
-
"
|
|
389
|
-
"
|
|
390
|
-
"
|
|
391
|
-
"script",
|
|
392
|
-
"asset"
|
|
383
|
+
"utility",
|
|
384
|
+
"localisation",
|
|
385
|
+
"assets",
|
|
386
|
+
"coordination",
|
|
387
|
+
"paradox_coordination"
|
|
393
388
|
],
|
|
394
|
-
"description": "Optional
|
|
389
|
+
"description": "Optional guidance card to return for the current task concern."
|
|
395
390
|
}
|
|
396
391
|
},
|
|
397
392
|
"required": []
|
|
@@ -564,7 +559,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
564
559
|
},
|
|
565
560
|
"file": {
|
|
566
561
|
"type": "string",
|
|
567
|
-
"description": "Optional workspace-relative or absolute
|
|
562
|
+
"description": "Optional workspace-relative path or absolute path inside the workspace/configured game installation used to restrict entry points."
|
|
568
563
|
},
|
|
569
564
|
"typeName": {
|
|
570
565
|
"type": "string",
|
|
@@ -633,7 +628,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
633
628
|
},
|
|
634
629
|
"file": {
|
|
635
630
|
"type": "string",
|
|
636
|
-
"description": "Caller file; narrows to one invocation."
|
|
631
|
+
"description": "Caller file inside the workspace or a configured game installation; narrows to one invocation."
|
|
637
632
|
},
|
|
638
633
|
"line": {
|
|
639
634
|
"type": "number",
|
|
@@ -665,7 +660,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
665
660
|
"properties": {
|
|
666
661
|
"file": {
|
|
667
662
|
"type": "string",
|
|
668
|
-
"description": "Optional
|
|
663
|
+
"description": "Optional path inside the workspace or a configured game installation; when omitted a definitionId must be given."
|
|
669
664
|
},
|
|
670
665
|
"definitionId": {
|
|
671
666
|
"type": "string",
|
|
@@ -790,13 +785,13 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
790
785
|
{
|
|
791
786
|
"tool": {
|
|
792
787
|
"name": "get_pdx_block",
|
|
793
|
-
"description": "Extract exactly one complete AST block by symbol name. Works with .txt (events, common), .gui (containerWindowType by name), and .gfx (pdxmesh by name). Returns 1-based startLine/endLine that can be passed directly to replace_lines. If the symbol is not found, the error response includes a full list of available symbols with line ranges so you can retry with the correct name.",
|
|
788
|
+
"description": "Extract exactly one complete AST block by symbol name from the workspace or a configured game installation. Works with .txt (events, common), .gui (containerWindowType by name), and .gfx (pdxmesh by name). Returns 1-based startLine/endLine that can be passed directly to replace_lines. If the symbol is not found, the error response includes a full list of available symbols with line ranges so you can retry with the correct name.",
|
|
794
789
|
"inputSchema": {
|
|
795
790
|
"type": "object",
|
|
796
791
|
"properties": {
|
|
797
792
|
"file": {
|
|
798
793
|
"type": "string",
|
|
799
|
-
"description": "Absolute
|
|
794
|
+
"description": "Absolute path inside the workspace or a configured game installation."
|
|
800
795
|
},
|
|
801
796
|
"symbol": {
|
|
802
797
|
"type": "string",
|
|
@@ -827,7 +822,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
827
822
|
"properties": {
|
|
828
823
|
"file": {
|
|
829
824
|
"type": "string",
|
|
830
|
-
"description": "Absolute file path
|
|
825
|
+
"description": "Absolute file path inside the workspace or a configured game installation."
|
|
831
826
|
},
|
|
832
827
|
"line": {
|
|
833
828
|
"type": "number",
|
|
@@ -867,7 +862,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
867
862
|
"properties": {
|
|
868
863
|
"file": {
|
|
869
864
|
"type": "string",
|
|
870
|
-
"description": "Absolute
|
|
865
|
+
"description": "Absolute path inside the workspace or a configured game installation."
|
|
871
866
|
}
|
|
872
867
|
},
|
|
873
868
|
"required": [
|
|
@@ -916,33 +911,34 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
916
911
|
},
|
|
917
912
|
{
|
|
918
913
|
"tool": {
|
|
919
|
-
"name": "
|
|
920
|
-
"description": "
|
|
914
|
+
"name": "go_to_definition",
|
|
915
|
+
"description": "Find a definition by exact symbol name or by a 0-based file position. Uses CWTools semantic lookup when available and falls back to the active VS Code language provider.",
|
|
921
916
|
"inputSchema": {
|
|
922
917
|
"type": "object",
|
|
923
918
|
"properties": {
|
|
919
|
+
"symbolName": {
|
|
920
|
+
"type": "string",
|
|
921
|
+
"description": "Exact symbol name. Use this instead of file/line/column when the identifier is known."
|
|
922
|
+
},
|
|
924
923
|
"file": {
|
|
925
924
|
"type": "string",
|
|
926
|
-
"description": "Absolute file path"
|
|
925
|
+
"description": "Absolute file path inside the workspace or a configured game installation."
|
|
927
926
|
},
|
|
928
927
|
"line": {
|
|
929
928
|
"type": "number",
|
|
930
|
-
"description": "Line number (0-based)"
|
|
929
|
+
"description": "Line number (0-based)."
|
|
931
930
|
},
|
|
932
931
|
"column": {
|
|
933
932
|
"type": "number",
|
|
934
|
-
"description": "Column number (0-based)"
|
|
933
|
+
"description": "Column number (0-based)."
|
|
935
934
|
}
|
|
936
935
|
},
|
|
937
|
-
"required": [
|
|
938
|
-
|
|
939
|
-
"line",
|
|
940
|
-
"column"
|
|
941
|
-
]
|
|
936
|
+
"required": [],
|
|
937
|
+
"additionalProperties": false
|
|
942
938
|
}
|
|
943
939
|
},
|
|
944
940
|
"registry": {
|
|
945
|
-
"name": "
|
|
941
|
+
"name": "go_to_definition",
|
|
946
942
|
"isWrite": false,
|
|
947
943
|
"isReadOnly": true,
|
|
948
944
|
"effect": "workspace_read",
|
|
@@ -952,53 +948,38 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
952
948
|
},
|
|
953
949
|
{
|
|
954
950
|
"tool": {
|
|
955
|
-
"name": "
|
|
956
|
-
"description": "Find
|
|
957
|
-
"inputSchema": {
|
|
958
|
-
"type": "object",
|
|
959
|
-
"properties": {
|
|
960
|
-
"symbolName": {
|
|
961
|
-
"type": "string",
|
|
962
|
-
"description": "The exact name of the symbol to find (e.g. \"samplemod_has_psionic_research\", \"distar.001\")"
|
|
963
|
-
}
|
|
964
|
-
},
|
|
965
|
-
"required": [
|
|
966
|
-
"symbolName"
|
|
967
|
-
]
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
"registry": {
|
|
971
|
-
"name": "query_definition_by_name",
|
|
972
|
-
"isWrite": false,
|
|
973
|
-
"isReadOnly": true,
|
|
974
|
-
"effect": "workspace_read",
|
|
975
|
-
"riskLevel": 0,
|
|
976
|
-
"concurrencyClass": "parallel"
|
|
977
|
-
}
|
|
978
|
-
},
|
|
979
|
-
{
|
|
980
|
-
"tool": {
|
|
981
|
-
"name": "query_references",
|
|
982
|
-
"description": "Find references to an identifier through the active language provider, with a bounded workspace text-search fallback.",
|
|
951
|
+
"name": "find_references",
|
|
952
|
+
"description": "Find references by exact identifier or by a 0-based file position. Identifier lookup uses workspace symbols plus a bounded text fallback; position lookup uses the active VS Code language provider.",
|
|
983
953
|
"inputSchema": {
|
|
984
954
|
"type": "object",
|
|
985
955
|
"properties": {
|
|
986
956
|
"identifier": {
|
|
987
957
|
"type": "string",
|
|
988
|
-
"description": "
|
|
958
|
+
"description": "Exact identifier. Use this instead of file/line/column when the name is known."
|
|
989
959
|
},
|
|
990
960
|
"file": {
|
|
991
961
|
"type": "string",
|
|
992
|
-
"description": "
|
|
962
|
+
"description": "Absolute file path inside the workspace or a configured game installation."
|
|
963
|
+
},
|
|
964
|
+
"line": {
|
|
965
|
+
"type": "number",
|
|
966
|
+
"description": "Line number (0-based)."
|
|
967
|
+
},
|
|
968
|
+
"column": {
|
|
969
|
+
"type": "number",
|
|
970
|
+
"description": "Column number (0-based)."
|
|
971
|
+
},
|
|
972
|
+
"limit": {
|
|
973
|
+
"type": "number",
|
|
974
|
+
"description": "Maximum references to return (default 100, max 500)."
|
|
993
975
|
}
|
|
994
976
|
},
|
|
995
|
-
"required": [
|
|
996
|
-
|
|
997
|
-
]
|
|
977
|
+
"required": [],
|
|
978
|
+
"additionalProperties": false
|
|
998
979
|
}
|
|
999
980
|
},
|
|
1000
981
|
"registry": {
|
|
1001
|
-
"name": "
|
|
982
|
+
"name": "find_references",
|
|
1002
983
|
"isWrite": false,
|
|
1003
984
|
"isReadOnly": true,
|
|
1004
985
|
"effect": "workspace_read",
|
|
@@ -1151,7 +1132,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
1151
1132
|
"properties": {
|
|
1152
1133
|
"file": {
|
|
1153
1134
|
"type": "string",
|
|
1154
|
-
"description": "Absolute file
|
|
1135
|
+
"description": "Absolute path to a parsed file inside the workspace or a configured game installation."
|
|
1155
1136
|
}
|
|
1156
1137
|
},
|
|
1157
1138
|
"required": [
|
|
@@ -1220,7 +1201,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
1220
1201
|
"properties": {
|
|
1221
1202
|
"file": {
|
|
1222
1203
|
"type": "string",
|
|
1223
|
-
"description": "
|
|
1204
|
+
"description": "Workspace-relative path or absolute path inside the workspace/configured game installation."
|
|
1224
1205
|
}
|
|
1225
1206
|
},
|
|
1226
1207
|
"required": [
|
|
@@ -1246,7 +1227,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
1246
1227
|
"properties": {
|
|
1247
1228
|
"file": {
|
|
1248
1229
|
"type": "string",
|
|
1249
|
-
"description": "
|
|
1230
|
+
"description": "Workspace-relative path or absolute path inside the workspace/configured game installation."
|
|
1250
1231
|
}
|
|
1251
1232
|
},
|
|
1252
1233
|
"required": [
|
|
@@ -1306,7 +1287,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
1306
1287
|
},
|
|
1307
1288
|
"file": {
|
|
1308
1289
|
"type": "string",
|
|
1309
|
-
"description": "
|
|
1290
|
+
"description": "Workspace-relative path or absolute path inside the workspace/configured game installation; lists its Effects with cursor pagination."
|
|
1310
1291
|
},
|
|
1311
1292
|
"limit": {
|
|
1312
1293
|
"type": "number",
|
|
@@ -1338,7 +1319,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
1338
1319
|
"properties": {
|
|
1339
1320
|
"file": {
|
|
1340
1321
|
"type": "string",
|
|
1341
|
-
"description": "
|
|
1322
|
+
"description": "Workspace-relative path or absolute path inside the workspace/configured game installation."
|
|
1342
1323
|
}
|
|
1343
1324
|
},
|
|
1344
1325
|
"required": [
|
|
@@ -1368,7 +1349,7 @@ exports.GENERATED_MCP_TOOLS = [
|
|
|
1368
1349
|
},
|
|
1369
1350
|
"file": {
|
|
1370
1351
|
"type": "string",
|
|
1371
|
-
"description": "
|
|
1352
|
+
"description": "Workspace-relative path or absolute path inside the workspace/configured game installation."
|
|
1372
1353
|
}
|
|
1373
1354
|
},
|
|
1374
1355
|
"required": []
|
package/dist/host/readiness.js
CHANGED
|
@@ -14,10 +14,9 @@ exports.LOAD_DEPENDENT_TOOLS = new Set([
|
|
|
14
14
|
'parse_pdx_fragment',
|
|
15
15
|
'query_scope',
|
|
16
16
|
'get_completion_at',
|
|
17
|
-
'
|
|
18
|
-
'query_definition_by_name',
|
|
17
|
+
'go_to_definition',
|
|
19
18
|
'explore_pdx_project',
|
|
20
|
-
'
|
|
19
|
+
'find_references',
|
|
21
20
|
'get_diagnostics',
|
|
22
21
|
'query_scripted_effects',
|
|
23
22
|
'query_scripted_triggers',
|
|
@@ -26,11 +26,10 @@ exports.VANILLA_DEPENDENT_TOOLS = new Set([
|
|
|
26
26
|
'query_types',
|
|
27
27
|
'get_completion_at',
|
|
28
28
|
'query_scope',
|
|
29
|
-
'
|
|
30
|
-
'query_definition_by_name',
|
|
29
|
+
'go_to_definition',
|
|
31
30
|
'explore_pdx_project',
|
|
32
31
|
'query_project_knowledge',
|
|
33
|
-
'
|
|
32
|
+
'find_references',
|
|
34
33
|
'get_diagnostics',
|
|
35
34
|
'query_scripted_effects',
|
|
36
35
|
'query_scripted_triggers',
|
|
@@ -48,7 +48,7 @@ function analyzeDiagnosticKnowledge(query) {
|
|
|
48
48
|
code,
|
|
49
49
|
category: 'general',
|
|
50
50
|
explanation: 'No specialized diagnostic route matched; use LSP and indexed evidence before editing.',
|
|
51
|
-
suggestedTools: ['get_diagnostics', 'explore_pdx_project', 'query_cwt_schema', '
|
|
51
|
+
suggestedTools: ['get_diagnostics', 'explore_pdx_project', 'query_cwt_schema', 'go_to_definition', 'query_workspace_index'],
|
|
52
52
|
nextSteps: [
|
|
53
53
|
'Group similar diagnostics and inspect a representative block.',
|
|
54
54
|
'Verify identifiers through indexed tools before making changes.',
|
package/dist/knowledge/rules.js
CHANGED
|
@@ -940,12 +940,8 @@ async function readProjectGameId(host) {
|
|
|
940
940
|
return normalizeGameId(game.id);
|
|
941
941
|
}
|
|
942
942
|
async function readProjectProfileFile(host) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
if (!read.exists) {
|
|
946
|
-
const legacyPath = path.join(host.workspaceRoot, '.cwtools-ai', 'project', 'profile.json');
|
|
947
|
-
read = await host.filesystem.readTextFile(legacyPath).catch(() => ({ exists: false, content: '', hasBom: false }));
|
|
948
|
-
}
|
|
943
|
+
const profilePath = path.join(host.workspaceRoot, '.cwtools', 'project', 'profile.json');
|
|
944
|
+
const read = await host.filesystem.readTextFile(profilePath).catch(() => ({ exists: false, content: '', hasBom: false }));
|
|
949
945
|
if (!read.exists)
|
|
950
946
|
return null;
|
|
951
947
|
try {
|
|
@@ -23,7 +23,7 @@ function queryWorkflowHints() {
|
|
|
23
23
|
id: 'entity-lookup',
|
|
24
24
|
title: 'Verify game identifiers',
|
|
25
25
|
triggers: ['identifier', 'reference', 'definition', 'entity'],
|
|
26
|
-
recommendedTools: ['query_project_knowledge', 'explore_pdx_project', 'query_cwt_schema', 'search_rule_capabilities', 'query_rules', 'query_types', 'query_workspace_index', '
|
|
26
|
+
recommendedTools: ['query_project_knowledge', 'explore_pdx_project', 'query_cwt_schema', 'search_rule_capabilities', 'query_rules', 'query_types', 'query_workspace_index', 'go_to_definition'],
|
|
27
27
|
guardrails: ['Treat empty text search results as inconclusive without indexed verification.', 'Treat semanticHints as retrieval hints, not legality proof.'],
|
|
28
28
|
},
|
|
29
29
|
],
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import type { HostServices } from '../host/hostServices';
|
|
2
2
|
import type { SharedToolResult } from '../tools/schema';
|
|
3
|
-
export type
|
|
3
|
+
export type ProjectGuidanceCard = 'implementation' | 'planning' | 'exploration' | 'review' | 'utility' | 'localisation' | 'assets' | 'coordination' | 'paradox_coordination';
|
|
4
4
|
export interface QueryProjectProfileArgs {
|
|
5
|
-
section?: 'summary' | 'routing' | 'directories' | 'localisation' | 'identifiers' | 'validation' | 'compatibility' | '
|
|
6
|
-
|
|
5
|
+
section?: 'summary' | 'routing' | 'directories' | 'localisation' | 'identifiers' | 'validation' | 'compatibility' | 'guidanceCards' | 'all';
|
|
6
|
+
guidance?: ProjectGuidanceCard;
|
|
7
7
|
}
|
|
8
8
|
export interface ProjectProfile {
|
|
9
|
-
schemaVersion:
|
|
9
|
+
schemaVersion: 4;
|
|
10
10
|
generatedAt: string;
|
|
11
11
|
workspaceRoot: string;
|
|
12
12
|
workspaceKind: string;
|
|
13
13
|
projectName: string;
|
|
14
|
-
/** True when a schemaVersion 1 profile was read and normalized. */
|
|
15
|
-
legacyProfile?: boolean;
|
|
16
14
|
game: {
|
|
17
15
|
id: string;
|
|
18
16
|
displayName: string;
|
|
@@ -46,7 +44,7 @@ export interface ProjectProfile {
|
|
|
46
44
|
validation: Record<string, unknown>;
|
|
47
45
|
freshness?: Record<string, unknown>;
|
|
48
46
|
warnings?: string[];
|
|
49
|
-
|
|
47
|
+
guidanceCards: Partial<Record<ProjectGuidanceCard, string>>;
|
|
50
48
|
efficiencyHints: string[];
|
|
51
49
|
[key: string]: unknown;
|
|
52
50
|
}
|
|
@@ -54,6 +52,6 @@ export declare const PROJECT_PROFILE_RELATIVE_PATH: string;
|
|
|
54
52
|
export declare function getProjectProfilePath(workspaceRoot: string): string;
|
|
55
53
|
export declare function isProjectProfile(value: unknown): value is ProjectProfile;
|
|
56
54
|
export declare function buildProfileSummary(profile: ProjectProfile): string;
|
|
57
|
-
export declare function
|
|
55
|
+
export declare function getGuidanceCard(profile: ProjectProfile, guidance?: ProjectGuidanceCard): string | undefined;
|
|
58
56
|
export declare function selectProfileSection(profile: ProjectProfile, section: NonNullable<QueryProjectProfileArgs['section']>): unknown;
|
|
59
57
|
export declare function queryProjectProfileWithHost(host: HostServices, args?: QueryProjectProfileArgs): Promise<SharedToolResult>;
|
package/dist/project/profile.js
CHANGED
|
@@ -37,30 +37,18 @@ exports.PROJECT_PROFILE_RELATIVE_PATH = void 0;
|
|
|
37
37
|
exports.getProjectProfilePath = getProjectProfilePath;
|
|
38
38
|
exports.isProjectProfile = isProjectProfile;
|
|
39
39
|
exports.buildProfileSummary = buildProfileSummary;
|
|
40
|
-
exports.
|
|
40
|
+
exports.getGuidanceCard = getGuidanceCard;
|
|
41
41
|
exports.selectProfileSection = selectProfileSection;
|
|
42
42
|
exports.queryProjectProfileWithHost = queryProjectProfileWithHost;
|
|
43
43
|
const path = __importStar(require("path"));
|
|
44
44
|
exports.PROJECT_PROFILE_RELATIVE_PATH = path.join('.cwtools', 'project', 'profile.json');
|
|
45
45
|
function getProjectProfilePath(workspaceRoot) {
|
|
46
|
-
|
|
47
|
-
const fs = require('fs');
|
|
48
|
-
const primary = path.join(workspaceRoot, '.cwtools', 'project', 'profile.json');
|
|
49
|
-
if (fs.existsSync(primary))
|
|
50
|
-
return primary;
|
|
51
|
-
const legacy = path.join(workspaceRoot, '.cwtools-ai', 'project', 'profile.json');
|
|
52
|
-
if (fs.existsSync(legacy))
|
|
53
|
-
return legacy;
|
|
54
|
-
return primary;
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
return path.join(workspaceRoot, exports.PROJECT_PROFILE_RELATIVE_PATH);
|
|
58
|
-
}
|
|
46
|
+
return path.join(workspaceRoot, exports.PROJECT_PROFILE_RELATIVE_PATH);
|
|
59
47
|
}
|
|
60
48
|
function isProjectProfile(value) {
|
|
61
49
|
return !!value
|
|
62
50
|
&& typeof value === 'object'
|
|
63
|
-
&&
|
|
51
|
+
&& value.schemaVersion === 4
|
|
64
52
|
&& typeof value.projectName === 'string';
|
|
65
53
|
}
|
|
66
54
|
function buildProfileSummary(profile) {
|
|
@@ -79,16 +67,10 @@ function buildProfileSummary(profile) {
|
|
|
79
67
|
`Localisation: ${languages} (${profile.localisation.encoding})`,
|
|
80
68
|
].join('\n');
|
|
81
69
|
}
|
|
82
|
-
function
|
|
83
|
-
if (!
|
|
70
|
+
function getGuidanceCard(profile, guidance) {
|
|
71
|
+
if (!guidance)
|
|
84
72
|
return undefined;
|
|
85
|
-
|
|
86
|
-
return profile.promptCards.loc_writer ?? profile.promptCards.build;
|
|
87
|
-
if (mode === 'gui_expert')
|
|
88
|
-
return profile.promptCards.asset ?? profile.promptCards.build;
|
|
89
|
-
if (mode === 'script_reviewer')
|
|
90
|
-
return profile.promptCards.review;
|
|
91
|
-
return profile.promptCards[mode] ?? profile.promptCards.build;
|
|
73
|
+
return profile.guidanceCards[guidance] ?? profile.guidanceCards.implementation;
|
|
92
74
|
}
|
|
93
75
|
function selectProfileSection(profile, section) {
|
|
94
76
|
switch (section) {
|
|
@@ -104,7 +86,7 @@ function selectProfileSection(profile, section) {
|
|
|
104
86
|
vanillaCache: profile.validation?.vanillaCache,
|
|
105
87
|
game: profile.game,
|
|
106
88
|
};
|
|
107
|
-
case '
|
|
89
|
+
case 'guidanceCards': return profile.guidanceCards;
|
|
108
90
|
case 'all': return profile;
|
|
109
91
|
case 'summary':
|
|
110
92
|
default:
|
|
@@ -148,7 +130,7 @@ async function queryProjectProfileWithHost(host, args = {}) {
|
|
|
148
130
|
source: 'cwtools-shared',
|
|
149
131
|
error: {
|
|
150
132
|
code: 'invalid_profile',
|
|
151
|
-
message: 'Project profile exists but is not a valid schemaVersion
|
|
133
|
+
message: 'Project profile exists but is not a valid schemaVersion 4 profile.',
|
|
152
134
|
},
|
|
153
135
|
};
|
|
154
136
|
}
|
|
@@ -165,8 +147,8 @@ async function queryProjectProfileWithHost(host, args = {}) {
|
|
|
165
147
|
profile: section === 'all' ? parsed : undefined,
|
|
166
148
|
summary: buildProfileSummary(parsed),
|
|
167
149
|
data: selectProfileSection(parsed, section),
|
|
168
|
-
|
|
169
|
-
_hint: 'Use section="routing", "localisation", "identifiers", or a
|
|
150
|
+
guidanceCard: getGuidanceCard(parsed, args.guidance),
|
|
151
|
+
_hint: 'Use section="routing", "localisation", "identifiers", or a targeted guidance card for focused context.',
|
|
170
152
|
},
|
|
171
153
|
};
|
|
172
154
|
}
|
package/dist/safety/paths.js
CHANGED
|
@@ -76,7 +76,7 @@ function isScratchRelativePath(relativePath) {
|
|
|
76
76
|
.replace(/\\/g, '/')
|
|
77
77
|
.toLowerCase()
|
|
78
78
|
.split('/');
|
|
79
|
-
return parts.includes('.cwtools')
|
|
79
|
+
return parts.includes('.cwtools');
|
|
80
80
|
}
|
|
81
81
|
function validateLocalisationPath(workspaceRoot, inputPath) {
|
|
82
82
|
const resolution = resolveWorkspacePath(workspaceRoot, inputPath);
|
package/dist/tools/names.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const MCP_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "
|
|
1
|
+
export declare const MCP_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "go_to_definition", "find_references", "query_scripted_effects", "query_scripted_triggers", "query_enums", "query_static_modifiers", "query_variables", "get_entity_info", "query_shader_symbol", "query_shader_compile_unit", "query_shader_platform_variants", "query_shader_callers", "explain_shader_reachability", "validate_shader", "compare_shader_with_vanilla"];
|
|
2
2
|
export type McpToolName = typeof MCP_TOOL_NAMES[number];
|
|
3
3
|
export declare const MCP_WRITE_TOOL_NAMES: readonly [];
|
|
4
|
-
export declare const MCP_READONLY_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "
|
|
4
|
+
export declare const MCP_READONLY_TOOL_NAMES: readonly ["query_types", "query_rules", "query_cwt_schema", "search_rule_capabilities", "explain_scope", "parse_pdx_fragment", "query_scope", "get_diagnostics", "analyze_diagnostic_error", "query_project_profile", "query_project_knowledge", "query_workspace_index", "explore_pdx_project", "query_inline_instantiation", "analyze_pdx_flow", "compare_definition_with_vanilla", "query_localisation_index", "get_pdx_block", "get_completion_at", "document_symbols", "workspace_symbols", "go_to_definition", "find_references", "query_scripted_effects", "query_scripted_triggers", "query_enums", "query_static_modifiers", "query_variables", "get_entity_info", "query_shader_symbol", "query_shader_compile_unit", "query_shader_platform_variants", "query_shader_callers", "explain_shader_reachability", "validate_shader", "compare_shader_with_vanilla"];
|
|
5
5
|
export declare function isMcpToolName(value: string): value is McpToolName;
|
|
6
6
|
export declare function isMcpWriteToolName(value: string): value is typeof MCP_WRITE_TOOL_NAMES[number];
|
package/dist/tools/names.js
CHANGED
|
@@ -25,9 +25,8 @@ exports.MCP_TOOL_NAMES = [
|
|
|
25
25
|
'get_completion_at',
|
|
26
26
|
'document_symbols',
|
|
27
27
|
'workspace_symbols',
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'query_references',
|
|
28
|
+
'go_to_definition',
|
|
29
|
+
'find_references',
|
|
31
30
|
'query_scripted_effects',
|
|
32
31
|
'query_scripted_triggers',
|
|
33
32
|
'query_enums',
|
package/dist/tools/symbols.d.ts
CHANGED
|
@@ -53,8 +53,10 @@ export declare function queryDefinitionByNameWithHost(host: HostServices, args:
|
|
|
53
53
|
symbolName: string;
|
|
54
54
|
}): Promise<SharedToolResult>;
|
|
55
55
|
export declare function queryReferencesWithHost(host: HostServices, args: {
|
|
56
|
-
identifier
|
|
56
|
+
identifier?: string;
|
|
57
57
|
file?: string;
|
|
58
|
+
line?: number;
|
|
59
|
+
column?: number;
|
|
58
60
|
limit?: number;
|
|
59
61
|
}): Promise<SharedToolResult>;
|
|
60
62
|
export declare function inferDocumentSymbolsFromText(content: string): DocumentSymbolInfo[];
|
package/dist/tools/symbols.js
CHANGED
|
@@ -205,7 +205,12 @@ async function workspaceSymbolsWithHost(host, args) {
|
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
async function queryDefinitionWithHost(host, args) {
|
|
208
|
-
const
|
|
208
|
+
const file = String(args.file ?? '').trim();
|
|
209
|
+
if (!file || !Number.isInteger(args.line) || args.line < 0
|
|
210
|
+
|| !Number.isInteger(args.column) || args.column < 0) {
|
|
211
|
+
return (0, schema_1.toolDenied)('invalid_arguments', 'go_to_definition requires symbolName or a non-negative file position.');
|
|
212
|
+
}
|
|
213
|
+
const resolution = resolveReadableFile(host, file);
|
|
209
214
|
if ('error' in resolution)
|
|
210
215
|
return resolution.error;
|
|
211
216
|
const fileUri = toFileUri(resolution.resolvedPath);
|
|
@@ -236,7 +241,7 @@ async function queryDefinitionWithHost(host, args) {
|
|
|
236
241
|
async function queryDefinitionByNameWithHost(host, args) {
|
|
237
242
|
const symbolName = String(args.symbolName ?? '').trim();
|
|
238
243
|
if (!symbolName)
|
|
239
|
-
return (0, schema_1.toolDenied)('invalid_arguments', '
|
|
244
|
+
return (0, schema_1.toolDenied)('invalid_arguments', 'go_to_definition requires symbolName or a file position.');
|
|
240
245
|
const commandResult = await host.lsp.executeCommand('cwtools.ai.queryDefinitionByName', [symbolName], { timeoutMs: 10000 });
|
|
241
246
|
if (!isUnavailable(commandResult)) {
|
|
242
247
|
return {
|
|
@@ -264,9 +269,31 @@ async function queryDefinitionByNameWithHost(host, args) {
|
|
|
264
269
|
}
|
|
265
270
|
async function queryReferencesWithHost(host, args) {
|
|
266
271
|
const identifier = String(args.identifier ?? '').trim();
|
|
267
|
-
if (!identifier)
|
|
268
|
-
return (0, schema_1.toolDenied)('invalid_arguments', 'query_references requires identifier.');
|
|
269
272
|
const limit = clampNumber(args.limit, 50, 1, 200);
|
|
273
|
+
if (!identifier) {
|
|
274
|
+
if (!args.file || !Number.isInteger(args.line) || (args.line ?? -1) < 0
|
|
275
|
+
|| !Number.isInteger(args.column) || (args.column ?? -1) < 0) {
|
|
276
|
+
return (0, schema_1.toolDenied)('invalid_arguments', 'find_references requires identifier or file, line, and column.');
|
|
277
|
+
}
|
|
278
|
+
const resolution = resolveReadableFile(host, args.file);
|
|
279
|
+
if ('error' in resolution)
|
|
280
|
+
return resolution.error;
|
|
281
|
+
const requested = await requestLsp(host, 'textDocument/references', {
|
|
282
|
+
textDocument: { uri: toFileUri(resolution.resolvedPath) },
|
|
283
|
+
position: { line: args.line, character: args.column },
|
|
284
|
+
context: { includeDeclaration: true },
|
|
285
|
+
}, 10000);
|
|
286
|
+
const references = normalizeLocations(requested.data, host.workspaceRoot).slice(0, limit);
|
|
287
|
+
return {
|
|
288
|
+
ok: !requested.unavailable,
|
|
289
|
+
status: requested.unavailable ? 'unavailable' : 'ready',
|
|
290
|
+
source: 'cwtools-lsp-references',
|
|
291
|
+
data: { references, total: references.length },
|
|
292
|
+
error: requested.unavailable
|
|
293
|
+
? { code: 'lsp_unavailable', message: requested.message ?? 'Reference provider is unavailable.' }
|
|
294
|
+
: undefined,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
270
297
|
const definition = await queryDefinitionByNameWithHost(host, { symbolName: identifier });
|
|
271
298
|
const firstMatch = definition.data && typeof definition.data === 'object'
|
|
272
299
|
? getFirstDefinitionMatch(definition.data)
|
|
@@ -502,14 +529,14 @@ function classifyOrigin(filePath, workspaceRoot) {
|
|
|
502
529
|
return 'external';
|
|
503
530
|
const normalized = filePath.replace(/\\/g, '/').toLowerCase();
|
|
504
531
|
if ((0, paths_1.isPathInsideOrEqual)(workspaceRoot, filePath)) {
|
|
505
|
-
return normalized.includes('/generated/') || normalized.includes('/.cwtools/')
|
|
532
|
+
return normalized.includes('/generated/') || normalized.includes('/.cwtools/')
|
|
506
533
|
? 'generated'
|
|
507
534
|
: 'workspace';
|
|
508
535
|
}
|
|
509
536
|
if (normalized.includes('/vanilla/') || normalized.includes('/cache/') || normalized.includes('/steamapps/common/')) {
|
|
510
537
|
return 'vanilla';
|
|
511
538
|
}
|
|
512
|
-
if (normalized.includes('/generated/') || normalized.includes('/.cwtools/')
|
|
539
|
+
if (normalized.includes('/generated/') || normalized.includes('/.cwtools/'))
|
|
513
540
|
return 'generated';
|
|
514
541
|
return 'external';
|
|
515
542
|
}
|
|
@@ -230,20 +230,20 @@ const defaultSharedToolDispatcher = async (host, name, rawArgs) => {
|
|
|
230
230
|
query: String(args.query ?? ''),
|
|
231
231
|
limit: typeof args.limit === 'number' ? args.limit : undefined,
|
|
232
232
|
});
|
|
233
|
-
case '
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
});
|
|
243
|
-
case 'query_references':
|
|
233
|
+
case 'go_to_definition':
|
|
234
|
+
return typeof args.symbolName === 'string' && args.symbolName.trim()
|
|
235
|
+
? (0, symbols_1.queryDefinitionByNameWithHost)(host, { symbolName: args.symbolName })
|
|
236
|
+
: (0, symbols_1.queryDefinitionWithHost)(host, {
|
|
237
|
+
file: String(args.file ?? ''),
|
|
238
|
+
line: Number(args.line ?? 0),
|
|
239
|
+
column: Number(args.column ?? 0),
|
|
240
|
+
});
|
|
241
|
+
case 'find_references':
|
|
244
242
|
return (0, symbols_1.queryReferencesWithHost)(host, {
|
|
245
|
-
identifier:
|
|
243
|
+
identifier: typeof args.identifier === 'string' ? args.identifier : undefined,
|
|
246
244
|
file: typeof args.file === 'string' ? args.file : undefined,
|
|
245
|
+
line: typeof args.line === 'number' ? args.line : undefined,
|
|
246
|
+
column: typeof args.column === 'number' ? args.column : undefined,
|
|
247
247
|
limit: typeof args.limit === 'number' ? args.limit : undefined,
|
|
248
248
|
});
|
|
249
249
|
case 'query_scope':
|