hoi4-agent-tools 4.11.1 → 4.13.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.
- package/CHANGELOG.md +21 -0
- package/README.md +3 -3
- package/dist/bin/setup.js +38 -0
- package/dist/bin/stdio.js +12 -10
- package/dist/hoi4_agent_tools/core/configuration.js +29 -0
- package/dist/hoi4_agent_tools/core/domain-tools.js +4 -0
- package/dist/hoi4_agent_tools/core/engine-check.js +87 -0
- package/dist/hoi4_agent_tools/core/engine-client.js +1 -1
- package/dist/hoi4_agent_tools/core/engine.js +18 -2
- package/dist/hoi4_agent_tools/core/job-operation-registration.js +2 -0
- package/dist/hoi4_agent_tools/core/job-store.js +1 -1
- package/dist/hoi4_agent_tools/focus/native-effects.js +1 -1
- package/dist/hoi4_agent_tools/localisation/job-operations.js +42 -0
- package/dist/hoi4_agent_tools/localisation/write-diff.js +96 -0
- package/dist/hoi4_agent_tools/localisation/write-format.js +329 -0
- package/dist/hoi4_agent_tools/localisation/write-operations.js +213 -0
- package/dist/hoi4_agent_tools/localisation/write-plan.js +557 -0
- package/dist/hoi4_agent_tools/map/gameplay/crossing-validation.js +17 -0
- package/dist/hoi4_agent_tools/map/model.js +31 -1
- package/dist/hoi4_agent_tools/map/operations.js +37 -8
- package/dist/hoi4_agent_tools/map/references.js +87 -0
- package/dist/hoi4_agent_tools/map/relief/hydrology.js +7 -2
- package/dist/hoi4_agent_tools/map/relief/terrain-synthesis.js +1 -0
- package/dist/hoi4_agent_tools/map/service.js +13 -4
- package/dist/hoi4_agent_tools/map/tool-operations.js +6 -0
- package/dist/hoi4_agent_tools/map/world-edge.js +0 -25
- package/dist/hoi4_agent_tools/map/world.js +181 -64
- package/dist/hoi4_agent_tools/mcp/plugins.js +74 -0
- package/dist/hoi4_agent_tools/mcp/server/argument-errors.js +5 -0
- package/dist/hoi4_agent_tools/mcp/server/create-modern-operations.js +15 -21
- package/dist/hoi4_agent_tools/mcp/server/create.js +5 -1
- package/dist/hoi4_agent_tools/mcp/server/request-lifecycle.js +10 -2
- package/dist/hoi4_agent_tools/mcp/server/task-tool-catalog.js +2 -0
- package/dist/hoi4_agent_tools/mcp/server/tool-profiles.js +83 -0
- package/dist/hoi4_agent_tools/mcp/tools/localisation-write.js +21 -0
- package/dist/hoi4_agent_tools/mcp/tools/reference.js +34 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.js +6 -1
- package/dist/hoi4_agent_tools/mcp/transports/negotiated-stdio.js +64 -6
- package/dist/hoi4_agent_tools/probability/model.js +4 -4
- package/dist/hoi4_agent_tools/reference/compat-patch.js +555 -0
- package/dist/hoi4_agent_tools/reference/compat.js +255 -0
- package/dist/hoi4_agent_tools/reference/docs-pack.js +164 -0
- package/dist/hoi4_agent_tools/reference/docs-pack.json +339 -0
- package/dist/hoi4_agent_tools/reference/documented-commands.js +26 -0
- package/dist/hoi4_agent_tools/reference/error-explain.js +235 -0
- package/dist/hoi4_agent_tools/reference/error-explanations.json +262 -0
- package/dist/hoi4_agent_tools/reference/error-log.js +30 -10
- package/dist/hoi4_agent_tools/reference/mod-health.js +255 -0
- package/dist/hoi4_agent_tools/reference/mod-index.js +63 -65
- package/dist/hoi4_agent_tools/reference/operations.js +435 -21
- package/dist/hoi4_agent_tools/reference/script-guard.js +109 -0
- package/dist/hoi4_agent_tools/reference/service.js +58 -20
- package/dist/hoi4_agent_tools/runtime.js +17 -2
- package/dist/hoi4_agent_tools/schemas/compat.js +153 -0
- package/dist/hoi4_agent_tools/schemas/localisation-write.js +154 -0
- package/dist/hoi4_agent_tools/schemas/map.js +5 -1
- package/dist/hoi4_agent_tools/schemas/mod-tools.js +50 -0
- package/dist/hoi4_agent_tools/schemas/modder-tools.js +191 -0
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/configuration.md +14 -11
- package/docs/development.md +2 -0
- package/docs/jobs.md +3 -1
- package/docs/map.md +8 -4
- package/docs/reference.md +47 -5
- package/docs/research/probability-adapter-evidence.md +11 -1
- package/docs/setup.md +23 -3
- package/docs/tools.md +18 -4
- package/docs/troubleshooting.md +1 -1
- package/engine/bin/darwin-arm64/hoi4-engine +0 -0
- package/engine/bin/linux-arm64/hoi4-engine +0 -0
- package/engine/bin/linux-x64/hoi4-engine +0 -0
- package/engine/bin/manifest.json +8 -8
- package/engine/bin/win32-x64/hoi4-engine.exe +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/schemas/configuration.schema.json +181 -138
- package/schemas/continuous-focus-palette.schema.json +1 -1
- package/schemas/custom-weighted-pool.schema.json +1 -1
- package/schemas/decision-inspect-input.schema.json +1 -1
- package/schemas/error-log-input.schema.json +1 -1
- package/schemas/event-feature-manifest.schema.json +1 -1
- package/schemas/focus-plan.schema.json +1 -1
- package/schemas/focus-planning-sidecar.schema.json +1 -1
- package/schemas/geography-model.schema.json +1 -1
- package/schemas/gui-animation-source.schema.json +1 -1
- package/schemas/gui-helper.schema.json +1 -1
- package/schemas/gui-scenario.schema.json +1 -1
- package/schemas/helper-expansion-request.schema.json +1 -1
- package/schemas/helper-expansion-summary.schema.json +1 -1
- package/schemas/impact-inspect-input.schema.json +1 -1
- package/schemas/map-operation.schema.json +153 -139
- package/schemas/mechanic-test-input.schema.json +1 -1
- package/schemas/mod-index-input.schema.json +1 -1
- package/schemas/operation-result.schema.json +1 -1
- package/schemas/package-check-input.schema.json +1 -1
- package/schemas/package-manifest.schema.json +1 -1
- package/schemas/probability-analysis-result.schema.json +1 -1
- package/schemas/probability-compare-input.schema.json +1 -1
- package/schemas/probability-evaluate-input.schema.json +1 -1
- package/schemas/probability-inspect-input.schema.json +1 -1
- package/schemas/probability-render-input.schema.json +1 -1
- package/schemas/probability-scenario-set.schema.json +1 -1
- package/schemas/probability-sequence-input.schema.json +1 -1
- package/schemas/probability-simulate-input.schema.json +1 -1
- package/schemas/probability-sweep-input.schema.json +1 -1
- package/schemas/reference-context-input.schema.json +1 -1
- package/schemas/reference-read-input.schema.json +1 -1
- package/schemas/reference-search-input.schema.json +1 -1
- package/schemas/reference-sheets.schema.json +1 -1
- package/schemas/scenario-suite.schema.json +1 -1
- package/schemas/scenario-test-input.schema.json +1 -1
- package/schemas/script-validate-input.schema.json +1 -1
- package/schemas/shared-scenario.schema.json +1 -1
- package/schemas/source-lookup-input.schema.json +1 -1
- package/server.json +2 -2
- package/dist/hoi4_agent_tools/mcp/tools/chaosx.js +0 -509
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"repository": "klimPaskov/Agentic-HOI4-Modding",
|
|
4
|
+
"commit": "4fc9fe4d7661574657c85ee0431ee51c4cb24420",
|
|
5
|
+
"folder": "hoi4_wiki",
|
|
6
|
+
"license": "HOI4 wiki text under CC BY-SA 3.0; kit text under the same terms. Sources and attribution: LICENSE.txt and SOURCES.json in the pack.",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"path": "LICENSE.txt",
|
|
10
|
+
"sha256": "75d813f7981af94e3d81595ea7df8a2edf7a1c0ad49963a7665d707a5aca6912",
|
|
11
|
+
"bytes": 2695
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"path": "SOURCES.json",
|
|
15
|
+
"sha256": "ae3434c463b93de06fadb42b9ad28a1a814104ec835289adebd527f7c290093d",
|
|
16
|
+
"bytes": 18632
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"path": "achievement_modding.md",
|
|
20
|
+
"sha256": "68d90f53d0b5c199f73c62cf079915d732433d028799d6392bc19955043a148d",
|
|
21
|
+
"bytes": 12262
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "ai_focuses.md",
|
|
25
|
+
"sha256": "43ba060db0942295e7181ada0e8ea5bb725a366553174dcda518e6579758bbe8",
|
|
26
|
+
"bytes": 8484
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"path": "ai_modding.md",
|
|
30
|
+
"sha256": "05aaa690a6b28735b560763591c2c06b9135db9f1418a8f5cea77f45c2aa95a0",
|
|
31
|
+
"bytes": 107207
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "autonomy_state_modding.md",
|
|
35
|
+
"sha256": "971aa27714204bf4c25520822592ab787caf982ffb6bc4882b0a3bdfb0b4f802",
|
|
36
|
+
"bytes": 25683
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "balance_of_power_modding.md",
|
|
40
|
+
"sha256": "64feaed300fe3e418012979e473b4f1a313c8d8c2f6baea7dbc569ffe0fa6f26",
|
|
41
|
+
"bytes": 28601
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"path": "bookmark_modding.md",
|
|
45
|
+
"sha256": "b80e0172d6814656e897217243c92d967b64573457b383786030d7c27f3955e2",
|
|
46
|
+
"bytes": 31958
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "building_modding.md",
|
|
50
|
+
"sha256": "617336f99037330f8fff5982bdeecffd6985f3fdeffd74db03de371bab443d1d",
|
|
51
|
+
"bytes": 41994
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "character_modding.md",
|
|
55
|
+
"sha256": "b3da410bdd6a6267a50391143aac11829fa6c797418079d88c8d0aee3c249272",
|
|
56
|
+
"bytes": 84847
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"path": "collection_modding.md",
|
|
60
|
+
"sha256": "1ac9efb48dbf51c0134d90378e91e382173bd17265e5f8fd5eaf237b0a762d88",
|
|
61
|
+
"bytes": 25763
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"path": "console_commands.md",
|
|
65
|
+
"sha256": "b1f9f5192043026cf04b043034f8d5fc9fa20e2afe9a188c0634088e0b412f8d",
|
|
66
|
+
"bytes": 72189
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "cosmetic_tag_modding.md",
|
|
70
|
+
"sha256": "695d1f0bc642af2cf4965af4f24c4bb0d0d099402f69d5d8278014056a99a87f",
|
|
71
|
+
"bytes": 14657
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "country_creation.md",
|
|
75
|
+
"sha256": "641b9d6e385a13d0a56cf53ddfc5b530a690c212aefaec192074af5f559ea00c",
|
|
76
|
+
"bytes": 67934
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"path": "data_structures.md",
|
|
80
|
+
"sha256": "4aba022459430e43b52a171a2003f663eab2aac4cccb74f522bb8a125b1cef8e",
|
|
81
|
+
"bytes": 170312
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "decision_modding.md",
|
|
85
|
+
"sha256": "7467befc292260b7ac9651cd7fac992f2e1a93213f57ff57f72c56a3b0f4b0f0",
|
|
86
|
+
"bytes": 48092
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"path": "defines.md",
|
|
90
|
+
"sha256": "1b10b493c5cb21206a3c49428cbcba07ae2b96cbe46c6b7081053913a1dcc5c7",
|
|
91
|
+
"bytes": 443227
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "defines_additions.md",
|
|
95
|
+
"sha256": "fe2d3ce5d77a3791c6292794b369f47ef1cc515e68657ae807cd1efecac0d371",
|
|
96
|
+
"bytes": 99261
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "division_modding.md",
|
|
100
|
+
"sha256": "8921d1234159c098fd40946b5eefbcdf1ea0dcbaac599f67c58823da288110d1",
|
|
101
|
+
"bytes": 35549
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"path": "doctrine_modding.md",
|
|
105
|
+
"sha256": "48e885cb63518905dab9a9f5a39958e19c8e1b14b83b7bab796b53e3fac67aba",
|
|
106
|
+
"bytes": 31669
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"path": "effects.md",
|
|
110
|
+
"sha256": "e24934c914a8a18977ae9d452bd6c2f94a4c5d7691d88bf97a0577fa1bb465a6",
|
|
111
|
+
"bytes": 324045
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"path": "entity_modding.md",
|
|
115
|
+
"sha256": "621a72f5aa49ce0349f70e6f5c56b50557d458de3d576738810c4960eba65f6f",
|
|
116
|
+
"bytes": 13160
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"path": "equipment_modding.md",
|
|
120
|
+
"sha256": "893c440282d93f03b07803105aa614352bfd3e3a75dec2a516d518bc2706ebdd",
|
|
121
|
+
"bytes": 31677
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"path": "event_modding.md",
|
|
125
|
+
"sha256": "22c91d5b6a517672fa4afad1150047a3b06c99269b0b042c70f7cf2b42855baf",
|
|
126
|
+
"bytes": 57635
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"path": "faction_modding.md",
|
|
130
|
+
"sha256": "1b65e5eba3ccde6b7c01cdd6af0e94ca70c6899d28d62b4c0d4e98ec9fb39aeb",
|
|
131
|
+
"bytes": 48236
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"path": "font_modding.md",
|
|
135
|
+
"sha256": "0b9a848d6da78248ce042d2141df2c6d89b2884aa015f685e9eab3f5178d3504",
|
|
136
|
+
"bytes": 15737
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"path": "game_rule_modding.md",
|
|
140
|
+
"sha256": "b45788ee3f832ccf51c767f726feb6bfae50035560e3650d151a20aa93460906",
|
|
141
|
+
"bytes": 12035
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"path": "graphical_asset_modding.md",
|
|
145
|
+
"sha256": "130c39f5899e87583df1c22fd8a66ea0790d0bedae7c2f4c21e78b37ef776ec9",
|
|
146
|
+
"bytes": 24599
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"path": "idea_modding.md",
|
|
150
|
+
"sha256": "0e59af57b62e6d4deb01c677751ef3dd4a1eb6161ab6543d6376d8a172ed0841",
|
|
151
|
+
"bytes": 45082
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"path": "ideology_modding.md",
|
|
155
|
+
"sha256": "cf1221ed9408dfba595fca6cd10a91b10834624361a0fc08bfa328b0369f1fc1",
|
|
156
|
+
"bytes": 25332
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"path": "intelligence_agency_modding.md",
|
|
160
|
+
"sha256": "51cf170f9fc2234ba58a389b6d0f0b5356b17c2b6b8deb8b03c0c213a1e6e241",
|
|
161
|
+
"bytes": 18007
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"path": "intelligence_operation_modding.md",
|
|
165
|
+
"sha256": "4743574623289175365d5b9beba53e011354b0278b38e8569e2132064b00cb4e",
|
|
166
|
+
"bytes": 28971
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"path": "interface_modding.md",
|
|
170
|
+
"sha256": "0985d0a21be7d77ec62708f287ec26a41759e91a16653d2e29e87c29f1aaf0c5",
|
|
171
|
+
"bytes": 41626
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"path": "list_of_modifiers.md",
|
|
175
|
+
"sha256": "a3dd3191ee1f6b7e5fb57f05033b2d044e46c236cfb57ac59b4f95224e95ed40",
|
|
176
|
+
"bytes": 94018
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"path": "localisation.md",
|
|
180
|
+
"sha256": "04aef4d1598a5b679475eef85bfe09db894d586f9bb215f17b76eab7b674bda2",
|
|
181
|
+
"bytes": 77993
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"path": "map_modding.md",
|
|
185
|
+
"sha256": "8bf48bcbf21800323f3c41e36f8026dbbb6a9752d63c9cf2844571271c30d95e",
|
|
186
|
+
"bytes": 94866
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"path": "map_mode_modding.md",
|
|
190
|
+
"sha256": "73b0e045833bc38a08bc58a26ed3de763a5d8b8ede93e7f1e7611e4e58a0c441",
|
|
191
|
+
"bytes": 10496
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"path": "military_industrial_organization_modding.md",
|
|
195
|
+
"sha256": "ab39f894aca8727bdbd89b6c5b17d49363cb3522c7d68ebf483598f3fdfc071e",
|
|
196
|
+
"bytes": 54276
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"path": "mod_structure.md",
|
|
200
|
+
"sha256": "c753d2ce3cef4782121c525eed56748a203502dd07f3c59d689ddfe699592b6d",
|
|
201
|
+
"bytes": 26953
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"path": "modding.md",
|
|
205
|
+
"sha256": "3eb086d081f2bfb2ef8037106de30a3bcbc6ed36e82c960576327c9223b34073",
|
|
206
|
+
"bytes": 86882
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"path": "modifiers.md",
|
|
210
|
+
"sha256": "72d88d203368f97b929ec4538e3dc892685b315e82e1b0afe6f4be2db44d5593",
|
|
211
|
+
"bytes": 174630
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"path": "mods.md",
|
|
215
|
+
"sha256": "b56b57f74138b4f3bcc1f89677d40bfb789cf5241669efc11e7c3a3485296960",
|
|
216
|
+
"bytes": 2511
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"path": "music_modding.md",
|
|
220
|
+
"sha256": "6fd0f6cc16eb1521cb59af2bc62f3f436455a1a48c2bc87fb11c1e9db55dee2e",
|
|
221
|
+
"bytes": 9785
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"path": "namelist_modding.md",
|
|
225
|
+
"sha256": "8f053d08185d08d59d86e937653a68400a9a8a6495b7be9e9d4aac72454fa3b6",
|
|
226
|
+
"bytes": 12191
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"path": "national_focus_modding.md",
|
|
230
|
+
"sha256": "196264a13b00eaf229a7a6fada641146bdbe5a5f0d372557ae4ef61f5aae9543",
|
|
231
|
+
"bytes": 99638
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"path": "nudger.md",
|
|
235
|
+
"sha256": "449149b6dc661c1c6a2ec467936a4ba7371d344f1ce6894aeeff25d8204695f4",
|
|
236
|
+
"bytes": 32335
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"path": "occupation_and_resistance_modding.md",
|
|
240
|
+
"sha256": "bd87613848bafa90493390ad0330767f91792e63f0661f481deaeb7e0482f7e9",
|
|
241
|
+
"bytes": 27505
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"path": "on_actions.md",
|
|
245
|
+
"sha256": "8a7021ccd9a973cfaf28e33563ff8537fbe8d29b8611f64320ac7bc18d50981b",
|
|
246
|
+
"bytes": 46410
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"path": "particle_modding.md",
|
|
250
|
+
"sha256": "4e308e246530dd5ae07fb5d7849a80a160b5881a30dfe04a7e94357e697c4114",
|
|
251
|
+
"bytes": 11094
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"path": "peace_conference_modding.md",
|
|
255
|
+
"sha256": "7be4e277e8889bae2dbb99848ef94af59cd465d2589d3d6f823bce448b1afd1d",
|
|
256
|
+
"bytes": 36824
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"path": "portrait_modding.md",
|
|
260
|
+
"sha256": "e7993be4f18416af37385247bf4c08e8817e3855df0dc89a1d61251a4544a1a7",
|
|
261
|
+
"bytes": 7185
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"path": "posteffect_modding.md",
|
|
265
|
+
"sha256": "e428e96290403fd2e9776eca9e86071da07af44d0040b4d31c70a6f577f8c3a1",
|
|
266
|
+
"bytes": 8414
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"path": "raid_modding.md",
|
|
270
|
+
"sha256": "bf93430fc2af038497efac896f35013ebf4d683ce39c841a088059e2fe2bfd4c",
|
|
271
|
+
"bytes": 42453
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"path": "resources_modding.md",
|
|
275
|
+
"sha256": "8a7bb4676e6ef7c453ebb7e368bf839beb7b359ab41ca0bed9d98ce34614fbba",
|
|
276
|
+
"bytes": 9028
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"path": "scopes.md",
|
|
280
|
+
"sha256": "6fb5c23ae3ea2d6ef2b273d9fa74b6fc91d56126dc1423c371b4ca11b6556903",
|
|
281
|
+
"bytes": 80243
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"path": "script_constant_modding.md",
|
|
285
|
+
"sha256": "cafa1532f431db65ac690e1e6e4f321430f7a49dfc800d412668a9fdbf0b6dee",
|
|
286
|
+
"bytes": 16308
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"path": "scripted_gui_modding.md",
|
|
290
|
+
"sha256": "856c86be1e0ab3b0bd34a93edabd6e11dca9525e455e7c76ee3f374eeada9ab5",
|
|
291
|
+
"bytes": 38038
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"path": "sound_modding.md",
|
|
295
|
+
"sha256": "b284342c474eeb343feffc97bd046ee21fac6d754fbe4125c4c5919ec32b7747",
|
|
296
|
+
"bytes": 11179
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"path": "special_project_modding.md",
|
|
300
|
+
"sha256": "18cf155a65bd5a6a7ca9bf18c63f44a8e50df10ffe4c470decdf57653c757575",
|
|
301
|
+
"bytes": 52432
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"path": "state_modding.md",
|
|
305
|
+
"sha256": "38bf8af7600716e94d8cf723cff5b2b059e7d179e29b4f90df453258b0e755ce",
|
|
306
|
+
"bytes": 35530
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"path": "strategic_region_modding.md",
|
|
310
|
+
"sha256": "7bb15767557046f110d976be3d14d4f01861ec58d2d7031d68bab9a09e8d8d2b",
|
|
311
|
+
"bytes": 8771
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"path": "supply_areas_modding.md",
|
|
315
|
+
"sha256": "74375d9208fa47983dc7ee183aaab3b418a07f942daa1e76cd9a7e8fe9f1e3bd",
|
|
316
|
+
"bytes": 5169
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"path": "technology_modding.md",
|
|
320
|
+
"sha256": "da0719dbe76a15c87a514633f8c80fe39041f0a317ae5cfc9a0cdf0c0d7bbf74",
|
|
321
|
+
"bytes": 66668
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"path": "triggers.md",
|
|
325
|
+
"sha256": "7d6088eca325c9f7ce0db25b01452976ed4cce4f70f563a4b5f33cf8df7ccd33",
|
|
326
|
+
"bytes": 221524
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"path": "troubleshooting.md",
|
|
330
|
+
"sha256": "65615ab07d88dc9763c61dc6368049745dec2cb0bb04fae606b4d839ce72ca87",
|
|
331
|
+
"bytes": 40167
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"path": "unit_modding.md",
|
|
335
|
+
"sha256": "197eb9adc03cd0b360fda4dd82161450381f2f4e6cc28d092b1c34076fc2e039",
|
|
336
|
+
"bytes": 29091
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const files = {
|
|
3
|
+
'effects_documentation.md': 'effect',
|
|
4
|
+
'triggers_documentation.md': 'trigger',
|
|
5
|
+
'modifiers_documentation.md': 'modifier',
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Read the names from the `## name` sections of the installed game's documentation, which each
|
|
9
|
+
* game version ships, so names a patch adds are known without a tool update. Undefined when the
|
|
10
|
+
* workspace has no game documentation.
|
|
11
|
+
*/
|
|
12
|
+
export async function documentedNames(references, workspace, signal) {
|
|
13
|
+
const inventory = await references.inventory(workspace, signal, ['game_doc']);
|
|
14
|
+
const names = {
|
|
15
|
+
effect: new Set(),
|
|
16
|
+
trigger: new Set(),
|
|
17
|
+
modifier: new Set(),
|
|
18
|
+
};
|
|
19
|
+
for (const section of inventory.sections) {
|
|
20
|
+
const kind = files[path.basename(section.path).toLowerCase()];
|
|
21
|
+
if (kind === undefined || !/^[a-z_][a-z0-9_]{0,255}$/u.test(section.heading))
|
|
22
|
+
continue;
|
|
23
|
+
names[kind].add(section.heading);
|
|
24
|
+
}
|
|
25
|
+
return names.effect.size === 0 && names.trigger.size === 0 ? undefined : names;
|
|
26
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
import { errorLogCategorySchema } from '../schemas/mod-tools.js';
|
|
5
|
+
import catalogueFile from './error-explanations.json' with { type: 'json' };
|
|
6
|
+
import { categoryHints, classifyLogMessage, locateLogSource, sourceLayerOf } from './error-log.js';
|
|
7
|
+
import { knownMistakeForLogMessage } from './known-mistakes.js';
|
|
8
|
+
import { nearestNames } from './suggestions.js';
|
|
9
|
+
const explanationSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
id: z.string().regex(/^[a-z][a-z0-9_]{2,63}$/u),
|
|
12
|
+
category: errorLogCategorySchema,
|
|
13
|
+
pattern: z.string().min(1).max(300),
|
|
14
|
+
rule: z.string().min(1).max(400),
|
|
15
|
+
fix: z.string().min(1).max(400),
|
|
16
|
+
evidence: z.string().min(1).max(300),
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
const catalogueSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
version: z.literal(1),
|
|
22
|
+
reviewed: z.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
|
|
23
|
+
explanations: z.array(explanationSchema).min(1),
|
|
24
|
+
})
|
|
25
|
+
.strict()
|
|
26
|
+
.superRefine((catalogue, context) => {
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
for (const [index, entry] of catalogue.explanations.entries()) {
|
|
29
|
+
if (seen.has(entry.id))
|
|
30
|
+
context.addIssue({
|
|
31
|
+
code: 'custom',
|
|
32
|
+
path: ['explanations', index, 'id'],
|
|
33
|
+
message: 'duplicate id',
|
|
34
|
+
});
|
|
35
|
+
seen.add(entry.id);
|
|
36
|
+
try {
|
|
37
|
+
new RegExp(entry.pattern, 'u');
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
context.addIssue({
|
|
41
|
+
code: 'custom',
|
|
42
|
+
path: ['explanations', index, 'pattern'],
|
|
43
|
+
message: 'invalid pattern',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
/** The reviewed catalogue, validated once; a malformed file fails when the server loads. */
|
|
49
|
+
export const errorExplanations = catalogueSchema
|
|
50
|
+
.parse(catalogueFile)
|
|
51
|
+
.explanations.map((entry) => ({ ...entry, regex: new RegExp(entry.pattern, 'u') }));
|
|
52
|
+
const headerPattern = /^\s*\[[^\]]*\](?:\[[^\]]*\])?:\s?/u;
|
|
53
|
+
const wrapperPattern = /^Error:\s*"(?<inner>[\s\S]+?)"\s*in file:\s*"(?<file>[^"]+)"\s*near line:\s*(?<line>\d+)\s*$/u;
|
|
54
|
+
/** One message inside a wrapper ends at its own `near line: N`. */
|
|
55
|
+
const innerMessagePattern = /[\s\S]*?near line:\s*\d+/gu;
|
|
56
|
+
/**
|
|
57
|
+
* The messages of one log line. The game wraps parser errors as `Error: "<messages>" in file:
|
|
58
|
+
* "<file>" near line: <n>`, with one or more messages, each ending in its own `near line`.
|
|
59
|
+
*/
|
|
60
|
+
export function splitLogLine(raw) {
|
|
61
|
+
const message = raw.replace(headerPattern, '').replace(/\s+/gu, ' ').trim();
|
|
62
|
+
const wrapped = wrapperPattern.exec(message);
|
|
63
|
+
if (wrapped?.groups === undefined)
|
|
64
|
+
return message === '' ? [] : [{ message }];
|
|
65
|
+
const file = wrapped.groups.file;
|
|
66
|
+
const inner = wrapped.groups.inner.trim();
|
|
67
|
+
const parts = [...inner.matchAll(innerMessagePattern)].map((match) => match[0].trim());
|
|
68
|
+
const messages = parts.length === 0 ? [inner] : parts;
|
|
69
|
+
return messages.map((part) => {
|
|
70
|
+
const own = /near line:\s*(\d+)\s*$/u.exec(part);
|
|
71
|
+
return { message: part, file, line: Number(own?.[1] ?? wrapped.groups.line) };
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function fill(template, groups) {
|
|
75
|
+
return template.replace(/\{([a-z]+)\}/gu, (whole, name) => groups[name] ?? whole);
|
|
76
|
+
}
|
|
77
|
+
const MAX_EXCERPT_LINES = 5;
|
|
78
|
+
const MAX_EXCERPT_CHARACTERS = 200;
|
|
79
|
+
async function excerptOf(root, relativePath, line) {
|
|
80
|
+
const file = path.resolve(root, relativePath);
|
|
81
|
+
if (!file.startsWith(path.resolve(root) + path.sep))
|
|
82
|
+
return undefined;
|
|
83
|
+
const info = await stat(file).catch(() => undefined);
|
|
84
|
+
if (info?.isFile() !== true || info.size > 8 * 1024 * 1024)
|
|
85
|
+
return undefined;
|
|
86
|
+
const lines = (await readFile(file, 'utf8')).replace(/^\uFEFF/u, '').split(/\r?\n/u);
|
|
87
|
+
const first = Math.max(1, line - 2);
|
|
88
|
+
const last = Math.min(lines.length, first + MAX_EXCERPT_LINES - 1);
|
|
89
|
+
const excerpt = [];
|
|
90
|
+
for (let number = first; number <= last; number += 1)
|
|
91
|
+
excerpt.push({ line: number, text: lines[number - 1].slice(0, MAX_EXCERPT_CHARACTERS) });
|
|
92
|
+
return excerpt.length === 0 ? undefined : excerpt;
|
|
93
|
+
}
|
|
94
|
+
/** Whether the game documents a name, and the closest documented names of the kind expected. */
|
|
95
|
+
function commandFacts(name, expected, context) {
|
|
96
|
+
const documented = context.documented;
|
|
97
|
+
if (documented === undefined)
|
|
98
|
+
return {};
|
|
99
|
+
const documentedAs = ['effect', 'trigger', 'modifier'].filter((kind) => documented[kind].has(name));
|
|
100
|
+
const helpers = context.helpers;
|
|
101
|
+
const definedBy = helpers === undefined
|
|
102
|
+
? []
|
|
103
|
+
: ['effect', 'trigger']
|
|
104
|
+
.filter((kind) => helpers[kind].has(name))
|
|
105
|
+
.map((kind) => (kind === 'effect' ? 'scripted_effect' : 'scripted_trigger'));
|
|
106
|
+
const pool = expected === undefined
|
|
107
|
+
? [...documented.effect, ...documented.trigger]
|
|
108
|
+
: [...documented[expected], ...(helpers?.[expected] ?? [])];
|
|
109
|
+
const close = nearestNames(name, pool, { limit: 3 });
|
|
110
|
+
// A value read as a trigger usually has a `has_` trigger that tests it.
|
|
111
|
+
const prefixed = `has_${name}`;
|
|
112
|
+
const suggestions = expected === 'trigger' && documented.trigger.has(prefixed)
|
|
113
|
+
? [prefixed, ...close.filter((candidate) => candidate !== prefixed)].slice(0, 3)
|
|
114
|
+
: close;
|
|
115
|
+
return {
|
|
116
|
+
...(documentedAs.length === 0 ? {} : { documentedAs }),
|
|
117
|
+
...(definedBy.length === 0 ? {} : { definedBy }),
|
|
118
|
+
...(suggestions.length === 0 ? {} : { suggestions }),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function expectedKind(id) {
|
|
122
|
+
if (id === 'invalid_effect' || id === 'unknown_effect_type')
|
|
123
|
+
return 'effect';
|
|
124
|
+
if (id === 'invalid_trigger' || id === 'unknown_trigger_type')
|
|
125
|
+
return 'trigger';
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
const SCRIPT_FOLDERS = /^(?:events|common|history)\//u;
|
|
129
|
+
/** `an effect`, `a trigger`. */
|
|
130
|
+
function withArticle(word) {
|
|
131
|
+
return `${/^[aeiou]/u.test(word) ? 'an' : 'a'} ${word}`;
|
|
132
|
+
}
|
|
133
|
+
const COUNTRY_TAG = /^[A-Z][A-Z0-9]{2}$/u;
|
|
134
|
+
async function explainPart(part, context) {
|
|
135
|
+
const { workspace } = context;
|
|
136
|
+
const matched = errorExplanations.find((entry) => entry.regex.test(part.message));
|
|
137
|
+
const groups = (matched === undefined ? undefined : matched.regex.exec(part.message)?.groups) ?? {};
|
|
138
|
+
const known = knownMistakeForLogMessage(part.message);
|
|
139
|
+
const roots = [workspace.modRoot, ...workspace.dependencyRoots, workspace.gameRoot ?? ''].filter(Boolean);
|
|
140
|
+
const located = groups.file !== undefined
|
|
141
|
+
? locateLogSource(`file: "${groups.file}"`, roots)
|
|
142
|
+
: part.file !== undefined
|
|
143
|
+
? locateLogSource(`file: "${part.file}"`, roots)
|
|
144
|
+
: locateLogSource(part.message, roots);
|
|
145
|
+
const line = Number(groups.line ?? part.line ?? located?.line ?? Number.NaN);
|
|
146
|
+
const layer = located === undefined ? undefined : await sourceLayerOf(workspace, located.relativePath);
|
|
147
|
+
const source = located === undefined || layer === undefined
|
|
148
|
+
? undefined
|
|
149
|
+
: {
|
|
150
|
+
relativePath: located.relativePath.slice(0, 1024),
|
|
151
|
+
...(Number.isFinite(line) && line > 0 ? { line } : {}),
|
|
152
|
+
layer: layer.layer,
|
|
153
|
+
};
|
|
154
|
+
const excerpt = source?.line === undefined || layer?.root === undefined
|
|
155
|
+
? undefined
|
|
156
|
+
: await excerptOf(layer.root, source.relativePath, source.line);
|
|
157
|
+
const subject = groups.name ?? groups.key ?? groups.tag;
|
|
158
|
+
// A country tag is not a misspelled command, so it gets no command suggestions.
|
|
159
|
+
const facts = subject === undefined || !/^[A-Za-z_][\w.]*$/u.test(subject) || COUNTRY_TAG.test(subject)
|
|
160
|
+
? {}
|
|
161
|
+
: commandFacts(subject, expectedKind(matched?.id ?? ''), context);
|
|
162
|
+
const category = matched?.category ?? classifyLogMessage('', part.message);
|
|
163
|
+
const next = source?.layer === 'mod' && SCRIPT_FOLDERS.test(source.relativePath)
|
|
164
|
+
? { tool: 'hoi4.script_validate', arguments: { path: source.relativePath } }
|
|
165
|
+
: undefined;
|
|
166
|
+
const note = noteFor(subject, expectedKind(matched?.id ?? ''), facts, source?.layer, {
|
|
167
|
+
documented: context.documented !== undefined,
|
|
168
|
+
helpers: context.helpers !== undefined,
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
message: part.message.slice(0, 600),
|
|
172
|
+
category,
|
|
173
|
+
...(matched === undefined
|
|
174
|
+
? known === undefined
|
|
175
|
+
? {
|
|
176
|
+
matched: 'category',
|
|
177
|
+
rule: 'No reviewed explanation matches this message; the advice for its category follows.',
|
|
178
|
+
fix: categoryHints[category],
|
|
179
|
+
}
|
|
180
|
+
: { matched: 'known_mistake', id: known.id, rule: known.mistake, fix: known.fix }
|
|
181
|
+
: {
|
|
182
|
+
matched: 'catalogue',
|
|
183
|
+
id: matched.id,
|
|
184
|
+
rule: fill(matched.rule, groups),
|
|
185
|
+
fix: fill(matched.fix, groups),
|
|
186
|
+
}),
|
|
187
|
+
...(subject === undefined ? {} : { subject: subject.slice(0, 256) }),
|
|
188
|
+
...facts,
|
|
189
|
+
...(source === undefined
|
|
190
|
+
? {}
|
|
191
|
+
: { source: { ...source, ...(excerpt === undefined ? {} : { excerpt }) } }),
|
|
192
|
+
...(note === undefined ? {} : { note }),
|
|
193
|
+
...(next === undefined ? {} : { next }),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/** What the documentation and the loaded files say about the subject, in one sentence. */
|
|
197
|
+
function noteFor(subject, expected, facts, layer, known) {
|
|
198
|
+
if (layer === 'game')
|
|
199
|
+
return 'The game files cause this line, not the mod: it appears without the mod too, unless the mod replaces that file.';
|
|
200
|
+
if (subject === undefined || expected === undefined)
|
|
201
|
+
return undefined;
|
|
202
|
+
if (COUNTRY_TAG.test(subject))
|
|
203
|
+
return `\`${subject}\` looks like a country tag: a tag scope works only where the block accepts a scope change, and only for a tag that common/country_tags/ defines.`;
|
|
204
|
+
if (!known.documented)
|
|
205
|
+
return undefined;
|
|
206
|
+
const other = expected === 'effect' ? 'trigger' : 'effect';
|
|
207
|
+
if (facts.definedBy !== undefined)
|
|
208
|
+
return `\`${subject}\` is a scripted helper that a loaded file defines: check that the file defining it loads without errors and that it is used as ${withArticle(expected)}.`;
|
|
209
|
+
if (facts.documentedAs?.includes(expected) === true)
|
|
210
|
+
return `\`${subject}\` is a documented ${expected}, so the problem is where it is used: a scope it does not support, or a block that does not accept it.`;
|
|
211
|
+
if (facts.documentedAs?.includes(other) === true)
|
|
212
|
+
return `\`${subject}\` is a documented ${other}, not ${withArticle(expected)}: move it to ${withArticle(other)} block.`;
|
|
213
|
+
if (facts.documentedAs?.includes('modifier') === true)
|
|
214
|
+
return `\`${subject}\` is a modifier: it belongs in a modifier block, not among ${expected}s.`;
|
|
215
|
+
return known.helpers
|
|
216
|
+
? `The game's documentation does not list \`${subject}\`, and no loaded file defines it as a scripted ${expected}.`
|
|
217
|
+
: `The game's documentation does not list \`${subject}\`.`;
|
|
218
|
+
}
|
|
219
|
+
export async function explainErrors(input, context) {
|
|
220
|
+
const lines = input.lines ?? (input.line === undefined ? [] : [input.line]);
|
|
221
|
+
const explanations = [];
|
|
222
|
+
for (const raw of lines) {
|
|
223
|
+
context.signal?.throwIfAborted();
|
|
224
|
+
for (const part of splitLogLine(raw)) {
|
|
225
|
+
if (explanations.length >= 20)
|
|
226
|
+
break;
|
|
227
|
+
explanations.push(await explainPart(part, context));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
explanations,
|
|
232
|
+
explained: explanations.filter(({ matched }) => matched !== 'category').length,
|
|
233
|
+
catalogue: errorExplanations.length,
|
|
234
|
+
};
|
|
235
|
+
}
|