cwtools-shared 0.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 (53) hide show
  1. package/dist/generated/mcpTools.d.ts +1112 -0
  2. package/dist/generated/mcpTools.js +1247 -0
  3. package/dist/host/diagnostics.d.ts +41 -0
  4. package/dist/host/diagnostics.js +18 -0
  5. package/dist/host/filesystem.d.ts +18 -0
  6. package/dist/host/filesystem.js +2 -0
  7. package/dist/host/hostServices.d.ts +49 -0
  8. package/dist/host/hostServices.js +2 -0
  9. package/dist/host/indexing.d.ts +54 -0
  10. package/dist/host/indexing.js +2 -0
  11. package/dist/host/lsp.d.ts +8 -0
  12. package/dist/host/lsp.js +27 -0
  13. package/dist/host/readiness.d.ts +11 -0
  14. package/dist/host/readiness.js +71 -0
  15. package/dist/host/vanillaCache.d.ts +12 -0
  16. package/dist/host/vanillaCache.js +56 -0
  17. package/dist/host/vsCodeHostServices.d.ts +27 -0
  18. package/dist/host/vsCodeHostServices.js +30 -0
  19. package/dist/index.d.ts +25 -0
  20. package/dist/index.js +41 -0
  21. package/dist/knowledge/diagnosticRouting.d.ts +13 -0
  22. package/dist/knowledge/diagnosticRouting.js +57 -0
  23. package/dist/knowledge/gameKnowledge.d.ts +20 -0
  24. package/dist/knowledge/gameKnowledge.js +52 -0
  25. package/dist/knowledge/rules.d.ts +162 -0
  26. package/dist/knowledge/rules.js +1383 -0
  27. package/dist/knowledge/workflowHints.d.ts +11 -0
  28. package/dist/knowledge/workflowHints.js +31 -0
  29. package/dist/project/knowledge.d.ts +15 -0
  30. package/dist/project/knowledge.js +209 -0
  31. package/dist/project/profile.d.ts +45 -0
  32. package/dist/project/profile.js +177 -0
  33. package/dist/safety/localisation.d.ts +33 -0
  34. package/dist/safety/localisation.js +105 -0
  35. package/dist/safety/paths.d.ts +21 -0
  36. package/dist/safety/paths.js +122 -0
  37. package/dist/safety/writes.d.ts +3 -0
  38. package/dist/safety/writes.js +19 -0
  39. package/dist/tools/mcpSchema.d.ts +5 -0
  40. package/dist/tools/mcpSchema.js +19 -0
  41. package/dist/tools/names.d.ts +6 -0
  42. package/dist/tools/names.js +51 -0
  43. package/dist/tools/pdxBlock.d.ts +17 -0
  44. package/dist/tools/pdxBlock.js +140 -0
  45. package/dist/tools/registry.d.ts +10 -0
  46. package/dist/tools/registry.js +2 -0
  47. package/dist/tools/schema.d.ts +36 -0
  48. package/dist/tools/schema.js +21 -0
  49. package/dist/tools/symbols.d.ts +60 -0
  50. package/dist/tools/symbols.js +625 -0
  51. package/dist/tools/toolHandlers.d.ts +4 -0
  52. package/dist/tools/toolHandlers.js +291 -0
  53. package/package.json +24 -0
@@ -0,0 +1,162 @@
1
+ import type { HostServices } from '../host/hostServices';
2
+ import type { SharedToolResult } from '../tools/schema';
3
+ export interface RuleInfo {
4
+ name: string;
5
+ description: string;
6
+ scopes: string[];
7
+ syntax: string;
8
+ category?: QueryRulesArgs['category'];
9
+ sourceFile?: string;
10
+ sourceLine?: number;
11
+ hardFacts?: RuleHardFacts;
12
+ semanticHints?: RuleSemanticHint[];
13
+ }
14
+ export interface QueryRulesArgs {
15
+ category: 'trigger' | 'effect' | 'scope_change' | 'modifier';
16
+ name?: string;
17
+ scope?: string;
18
+ }
19
+ export interface QueryRulesResult {
20
+ rules: RuleInfo[];
21
+ totalCount: number;
22
+ truncated: boolean;
23
+ source: 'cwtools-node-rules';
24
+ warnings?: string[];
25
+ /**
26
+ * Cache lifecycle metadata (plan §7.4): monotonic per-host reload counter
27
+ * plus a content hash of the rule files, so evidence consumers can detect
28
+ * stale rule data. `generation` 0 means the memoization lifecycle is
29
+ * unavailable (no fs access to compute a freshness signature).
30
+ */
31
+ rulesGeneration?: number;
32
+ /** sha256 (16 hex chars) over the rule file contents; see computeRulesContentHash. */
33
+ rulesContentHash?: string;
34
+ }
35
+ export interface QueryCwtSchemaArgs {
36
+ target?: string;
37
+ file?: string;
38
+ directory?: string;
39
+ name?: string;
40
+ includeContent?: boolean;
41
+ limit?: number;
42
+ }
43
+ export interface CwtSchemaMatch {
44
+ ruleFile: string;
45
+ relativeRuleFile: string;
46
+ sourceRoot: string;
47
+ score: number;
48
+ matchedBy: string[];
49
+ snippet?: string;
50
+ startLine?: number;
51
+ endLine?: number;
52
+ truncated?: boolean;
53
+ }
54
+ export interface CwtSchemaEntitySummary {
55
+ name: string;
56
+ path?: string;
57
+ nameField?: string;
58
+ ruleFile: string;
59
+ relativeRuleFile: string;
60
+ sourceRoot: string;
61
+ line: number;
62
+ subtypes: string[];
63
+ typeKeyFilters?: string[];
64
+ schemaKeys: string[];
65
+ graphRelatedTypes?: string[];
66
+ shaderReferences?: Array<{
67
+ argumentPath: string;
68
+ referenceKind: 'shader_effect' | 'shader_file';
69
+ dynamicValuePolicy: 'allow_expression' | 'literal_or_parameter';
70
+ pathPrefix?: string;
71
+ extension?: string;
72
+ }>;
73
+ matchedBy: string[];
74
+ snippet?: string;
75
+ truncated?: boolean;
76
+ }
77
+ export interface QueryCwtSchemaResult {
78
+ status: 'ready' | 'not_found';
79
+ target?: string;
80
+ normalizedTarget?: string;
81
+ name?: string;
82
+ rulesRoots: string[];
83
+ matches: CwtSchemaMatch[];
84
+ entities: CwtSchemaEntitySummary[];
85
+ entityCount: number;
86
+ warnings?: string[];
87
+ _hint?: string;
88
+ }
89
+ export interface SearchRuleCapabilitiesArgs {
90
+ intent?: string;
91
+ category?: QueryRulesArgs['category'] | 'all';
92
+ currentScope?: string;
93
+ desiredPushScope?: string;
94
+ limit?: number;
95
+ }
96
+ export interface RuleCapabilityCandidate {
97
+ rule: RuleInfo;
98
+ score: number;
99
+ reasons: string[];
100
+ }
101
+ export interface SearchRuleCapabilitiesResult {
102
+ status: 'ready';
103
+ candidates: RuleCapabilityCandidate[];
104
+ totalConsidered: number;
105
+ source: 'cwtools-node-rules';
106
+ warnings?: string[];
107
+ /** Cache lifecycle metadata (plan §7.4); see QueryRulesResult. */
108
+ rulesGeneration?: number;
109
+ rulesContentHash?: string;
110
+ }
111
+ export interface ExplainScopeArgs {
112
+ scope: string;
113
+ }
114
+ export interface ExplainScopeResult {
115
+ status: 'ready' | 'not_found';
116
+ scope: string;
117
+ canonicalName?: string;
118
+ aliases?: string[];
119
+ isSubscopeOf?: string[];
120
+ description?: string;
121
+ source?: {
122
+ file: string;
123
+ line: number;
124
+ };
125
+ semanticHints?: RuleSemanticHint[];
126
+ suggestions?: string[];
127
+ /** Cache lifecycle metadata (plan §7.4); see QueryRulesResult. */
128
+ rulesGeneration?: number;
129
+ rulesContentHash?: string;
130
+ }
131
+ export interface RuleHardFacts {
132
+ category: QueryRulesArgs['category'];
133
+ supportedScopes?: string[];
134
+ pushScope?: string;
135
+ typeKeyFilter?: string;
136
+ valueReferences?: CwtRuleValueReference[];
137
+ syntax?: string;
138
+ cwtSource?: {
139
+ file: string;
140
+ line: number;
141
+ };
142
+ }
143
+ export interface CwtRuleValueReference {
144
+ argumentPath: string;
145
+ access: 'value' | 'value_set' | 'scope' | 'type';
146
+ typeName: string;
147
+ }
148
+ export interface RuleSemanticHint {
149
+ text: string;
150
+ source: 'trigger_docs.log' | 'scopes.cwt' | 'cwt-comment' | 'modifiers.log';
151
+ file?: string;
152
+ line?: number;
153
+ confidence: 'hint';
154
+ }
155
+ export declare function queryRulesWithHost(host: HostServices, args: QueryRulesArgs): Promise<SharedToolResult<QueryRulesResult>>;
156
+ export declare function queryCwtSchemaWithHost(host: HostServices, args?: QueryCwtSchemaArgs): Promise<SharedToolResult<QueryCwtSchemaResult>>;
157
+ export declare function searchRuleCapabilitiesWithHost(host: HostServices, args?: SearchRuleCapabilitiesArgs): Promise<SharedToolResult<SearchRuleCapabilitiesResult>>;
158
+ export declare function explainScopeWithHost(host: HostServices, args: ExplainScopeArgs): Promise<SharedToolResult<ExplainScopeResult>>;
159
+ export interface CwtRulesCacheMeta {
160
+ generation: number;
161
+ contentHash: string;
162
+ }