modwright 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.
- package/LICENSE +35 -0
- package/README.md +212 -0
- package/assets/claude/agents/mw-explore.md +46 -0
- package/assets/claude/agents/mw-fixture.md +33 -0
- package/assets/claude/agents/mw-rule-author.md +51 -0
- package/assets/claude/agents/mw-scaffold-author.md +48 -0
- package/assets/claude/skills/mw-author.md +59 -0
- package/assets/claude/skills/mw-new-item.md +51 -0
- package/assets/claude/skills/mw-new-spell.md +50 -0
- package/assets/claude/skills/mw-scaffold.md +59 -0
- package/assets/claude/skills/mw-ship.md +57 -0
- package/assets/claude/skills/mw-validate.md +51 -0
- package/assets/claude/skills/mw-verify.md +59 -0
- package/assets/nivalisnights/extract_resources.py +177 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Config.json +5 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/BootstrapClient.lua +55 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/BootstrapServer.lua +81 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/ModWrightBridge/Log.lua +96 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/ModWrightBridge/Probes.lua +1038 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/ModWrightBridge/ProbesClient.lua +74 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/ModWrightBridge/Protocol.lua +985 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/ScriptExtender/Lua/ModWrightBridge/Watch.lua +175 -0
- package/bridges/bg3-se/Mods/ModWrightBridge/meta.lsx +45 -0
- package/bridges/bg3-se/README.md +99 -0
- package/bridges/bg3-se/bridge.json +68 -0
- package/bridges/cp2077-cet/ModWrightBridge/init.lua +375 -0
- package/bridges/cp2077-cet/ModWrightBridge/probes.lua +1104 -0
- package/bridges/cp2077-cet/ModWrightBridge/protocol.lua +1306 -0
- package/bridges/cp2077-cet/README.md +165 -0
- package/bridges/cp2077-cet/bridge.json +53 -0
- package/dist/core/bridge/arm.js +175 -0
- package/dist/core/bridge/cet-console.js +26 -0
- package/dist/core/bridge/cet-log.js +362 -0
- package/dist/core/bridge/index.js +11 -0
- package/dist/core/bridge/locate.js +35 -0
- package/dist/core/bridge/paths.js +34 -0
- package/dist/core/bridge/pending.js +89 -0
- package/dist/core/bridge/poll.js +155 -0
- package/dist/core/bridge/stage.js +100 -0
- package/dist/core/bridge/status.js +97 -0
- package/dist/core/bridge/types.js +145 -0
- package/dist/core/bridge/validate.js +107 -0
- package/dist/core/build/index.js +6 -0
- package/dist/core/build/manifest.js +47 -0
- package/dist/core/build/paths.js +32 -0
- package/dist/core/build/run.js +342 -0
- package/dist/core/build/stage.js +265 -0
- package/dist/core/build/steps/bg3.js +129 -0
- package/dist/core/build/steps/core.js +195 -0
- package/dist/core/build/steps/cyberpunk.js +95 -0
- package/dist/core/build/steps/listing.js +35 -0
- package/dist/core/build/types.js +13 -0
- package/dist/core/build/zip.js +148 -0
- package/dist/core/compat/check.js +113 -0
- package/dist/core/compat/pe.js +220 -0
- package/dist/core/compat/types.js +1 -0
- package/dist/core/compat/version.js +70 -0
- package/dist/core/deploy/guards.js +292 -0
- package/dist/core/deploy/index.js +5 -0
- package/dist/core/deploy/plan.js +696 -0
- package/dist/core/deploy/reload-apply.js +361 -0
- package/dist/core/deploy/reload.js +358 -0
- package/dist/core/deploy/sources.js +169 -0
- package/dist/core/deploy/types.js +1 -0
- package/dist/core/epic.js +54 -0
- package/dist/core/fsutil.js +191 -0
- package/dist/core/home.js +70 -0
- package/dist/core/knowledge/facts.js +229 -0
- package/dist/core/knowledge/index.js +4 -0
- package/dist/core/knowledge/search.js +112 -0
- package/dist/core/knowledge/store.js +123 -0
- package/dist/core/knowledge/types.js +1 -0
- package/dist/core/ledger/check.js +42 -0
- package/dist/core/ledger/hooks.js +80 -0
- package/dist/core/ledger/index.js +7 -0
- package/dist/core/ledger/query.js +17 -0
- package/dist/core/ledger/record.js +84 -0
- package/dist/core/ledger/status.js +53 -0
- package/dist/core/ledger/store.js +98 -0
- package/dist/core/ledger/types.js +108 -0
- package/dist/core/logs/index.js +4 -0
- package/dist/core/logs/registry.js +50 -0
- package/dist/core/logs/scan.js +195 -0
- package/dist/core/logs/triage.js +160 -0
- package/dist/core/logs/types.js +1 -0
- package/dist/core/lsx.js +10 -0
- package/dist/core/lz4.js +66 -0
- package/dist/core/mods.js +229 -0
- package/dist/core/process.js +49 -0
- package/dist/core/project/build-steps.js +83 -0
- package/dist/core/project/describe.js +74 -0
- package/dist/core/project/index.js +5 -0
- package/dist/core/project/load.js +146 -0
- package/dist/core/project/schema.js +264 -0
- package/dist/core/project/types.js +3 -0
- package/dist/core/prompts.js +72 -0
- package/dist/core/registry.js +35 -0
- package/dist/core/safety/backup.js +206 -0
- package/dist/core/safety/execute.js +188 -0
- package/dist/core/safety/index.js +5 -0
- package/dist/core/safety/plan.js +122 -0
- package/dist/core/safety/restore.js +172 -0
- package/dist/core/safety/types.js +1 -0
- package/dist/core/scaffold/bootstrap.js +7 -0
- package/dist/core/scaffold/catalog.js +28 -0
- package/dist/core/scaffold/claude-assets.js +271 -0
- package/dist/core/scaffold/collisions.js +64 -0
- package/dist/core/scaffold/emit.js +356 -0
- package/dist/core/scaffold/engine.js +680 -0
- package/dist/core/scaffold/ids.js +78 -0
- package/dist/core/scaffold/index.js +10 -0
- package/dist/core/scaffold/jsonpath.js +121 -0
- package/dist/core/scaffold/load.js +81 -0
- package/dist/core/scaffold/render.js +85 -0
- package/dist/core/scaffold/sequence.js +396 -0
- package/dist/core/scaffold/types.js +309 -0
- package/dist/core/steam.js +63 -0
- package/dist/core/surfaceutil.js +36 -0
- package/dist/core/testplan/check.js +67 -0
- package/dist/core/testplan/index.js +5 -0
- package/dist/core/testplan/load.js +100 -0
- package/dist/core/testplan/registry.js +317 -0
- package/dist/core/testplan/run.js +389 -0
- package/dist/core/testplan/types.js +82 -0
- package/dist/core/text/converters/bg3.js +50 -0
- package/dist/core/text/converters/cyberpunk.js +36 -0
- package/dist/core/text/converters/index.js +261 -0
- package/dist/core/text/diff/cr2w.js +180 -0
- package/dist/core/text/diff/index.js +16 -0
- package/dist/core/text/diff/loca.js +43 -0
- package/dist/core/text/diff/lsx.js +126 -0
- package/dist/core/text/handles.js +86 -0
- package/dist/core/text/index.js +6 -0
- package/dist/core/text/json.js +46 -0
- package/dist/core/text/templates/cache.js +71 -0
- package/dist/core/text/templates/index.js +3 -0
- package/dist/core/text/templates/library.js +245 -0
- package/dist/core/text/templates/types.js +51 -0
- package/dist/core/text/toolchain.js +16 -0
- package/dist/core/text/types.js +1 -0
- package/dist/core/text/validate.js +149 -0
- package/dist/core/text/xml.js +58 -0
- package/dist/core/toolchain/datafetch.js +151 -0
- package/dist/core/toolchain/env.js +63 -0
- package/dist/core/toolchain/features.js +170 -0
- package/dist/core/toolchain/index.js +8 -0
- package/dist/core/toolchain/install.js +191 -0
- package/dist/core/toolchain/locate.js +275 -0
- package/dist/core/toolchain/remember.js +84 -0
- package/dist/core/toolchain/run.js +318 -0
- package/dist/core/toolchain/specs.js +351 -0
- package/dist/core/toolchain/types.js +1 -0
- package/dist/core/types.js +1 -0
- package/dist/core/userconfig.js +66 -0
- package/dist/core/validate/context.js +139 -0
- package/dist/core/validate/index.js +5 -0
- package/dist/core/validate/registry.js +58 -0
- package/dist/core/validate/run.js +131 -0
- package/dist/core/validate/suppressions.js +91 -0
- package/dist/core/validate/types.js +2 -0
- package/dist/core/yamledit.js +51 -0
- package/dist/index.js +389 -0
- package/dist/server.js +1914 -0
- package/dist/surfaces/baldursgate3/compat.js +164 -0
- package/dist/surfaces/baldursgate3/identity.js +110 -0
- package/dist/surfaces/baldursgate3/index/build.js +331 -0
- package/dist/surfaces/baldursgate3/index/index.js +17 -0
- package/dist/surfaces/baldursgate3/index/info.js +40 -0
- package/dist/surfaces/baldursgate3/index/parsers/loca.js +41 -0
- package/dist/surfaces/baldursgate3/index/parsers/lsx.js +137 -0
- package/dist/surfaces/baldursgate3/index/parsers/stats.js +45 -0
- package/dist/surfaces/baldursgate3/index/parsers/treasuretable.js +57 -0
- package/dist/surfaces/baldursgate3/index/parsers/xmlutil.js +142 -0
- package/dist/surfaces/baldursgate3/index/queries.js +327 -0
- package/dist/surfaces/baldursgate3/index/schema.js +62 -0
- package/dist/surfaces/baldursgate3/index.js +3 -0
- package/dist/surfaces/baldursgate3/logs.js +278 -0
- package/dist/surfaces/baldursgate3/modsettings.js +115 -0
- package/dist/surfaces/baldursgate3/pak.js +153 -0
- package/dist/surfaces/baldursgate3/settings.js +49 -0
- package/dist/surfaces/baldursgate3/surface.js +232 -0
- package/dist/surfaces/baldursgate3/validators/bridge.js +7 -0
- package/dist/surfaces/baldursgate3/validators/files.js +476 -0
- package/dist/surfaces/baldursgate3/validators/items.js +1001 -0
- package/dist/surfaces/baldursgate3/validators/progression.js +734 -0
- package/dist/surfaces/baldursgate3/validators/stats.js +1076 -0
- package/dist/surfaces/baldursgate3/validators/story.js +790 -0
- package/dist/surfaces/baldursgate3/validators/templates.js +7 -0
- package/dist/surfaces/cyberpunk2077/compat.js +223 -0
- package/dist/surfaces/cyberpunk2077/index/build.js +231 -0
- package/dist/surfaces/cyberpunk2077/index/index.js +17 -0
- package/dist/surfaces/cyberpunk2077/index/info.js +51 -0
- package/dist/surfaces/cyberpunk2077/index/model.js +52 -0
- package/dist/surfaces/cyberpunk2077/index/parsers/tweak.js +483 -0
- package/dist/surfaces/cyberpunk2077/index/parsers/tweakxl-yaml.js +183 -0
- package/dist/surfaces/cyberpunk2077/index/queries.js +504 -0
- package/dist/surfaces/cyberpunk2077/index/resource.js +135 -0
- package/dist/surfaces/cyberpunk2077/index/schema.js +90 -0
- package/dist/surfaces/cyberpunk2077/index.js +3 -0
- package/dist/surfaces/cyberpunk2077/logs.js +742 -0
- package/dist/surfaces/cyberpunk2077/paths.js +12 -0
- package/dist/surfaces/cyberpunk2077/surface.js +218 -0
- package/dist/surfaces/cyberpunk2077/validators/bridge.js +7 -0
- package/dist/surfaces/cyberpunk2077/validators/cr2w.js +349 -0
- package/dist/surfaces/cyberpunk2077/validators/garments.js +1181 -0
- package/dist/surfaces/cyberpunk2077/validators/mesh.js +338 -0
- package/dist/surfaces/cyberpunk2077/validators/modsettings.js +120 -0
- package/dist/surfaces/cyberpunk2077/validators/packaging.js +463 -0
- package/dist/surfaces/cyberpunk2077/validators/red4ext.js +318 -0
- package/dist/surfaces/cyberpunk2077/validators/redscript.js +193 -0
- package/dist/surfaces/cyberpunk2077/validators/templates.js +7 -0
- package/dist/surfaces/cyberpunk2077/validators/tweaks.js +768 -0
- package/dist/surfaces/cyberpunk2077/validators/vehicles.js +531 -0
- package/dist/surfaces/cyberpunk2077/validators/xl.js +308 -0
- package/dist/surfaces/eldenring/binders.js +111 -0
- package/dist/surfaces/eldenring/compat.js +166 -0
- package/dist/surfaces/eldenring/dcx.js +49 -0
- package/dist/surfaces/eldenring/index.js +13 -0
- package/dist/surfaces/eldenring/loaders.js +132 -0
- package/dist/surfaces/eldenring/logs.js +67 -0
- package/dist/surfaces/eldenring/paramdef.js +256 -0
- package/dist/surfaces/eldenring/params.js +129 -0
- package/dist/surfaces/eldenring/surface.js +121 -0
- package/dist/surfaces/eldenring/tools.js +52 -0
- package/dist/surfaces/eldenring/validators/binders.js +193 -0
- package/dist/surfaces/eldenring/validators/packages.js +159 -0
- package/dist/surfaces/eldenring/validators/params.js +334 -0
- package/dist/surfaces/eldenring/validators/profiles.js +287 -0
- package/dist/surfaces/index.js +34 -0
- package/dist/surfaces/nivalisnights/compat.js +229 -0
- package/dist/surfaces/nivalisnights/index/build.js +310 -0
- package/dist/surfaces/nivalisnights/index/index.js +5 -0
- package/dist/surfaces/nivalisnights/index/queries.js +231 -0
- package/dist/surfaces/nivalisnights/index.js +4 -0
- package/dist/surfaces/nivalisnights/logs.js +473 -0
- package/dist/surfaces/nivalisnights/surface.js +195 -0
- package/dist/surfaces/skyrimse/archives.js +229 -0
- package/dist/surfaces/skyrimse/compat.js +163 -0
- package/dist/surfaces/skyrimse/index.js +12 -0
- package/dist/surfaces/skyrimse/loadorder.js +174 -0
- package/dist/surfaces/skyrimse/logs.js +241 -0
- package/dist/surfaces/skyrimse/plugins.js +149 -0
- package/dist/surfaces/skyrimse/records.js +94 -0
- package/dist/surfaces/skyrimse/surface.js +240 -0
- package/dist/surfaces/skyrimse/validators/archive-records.js +165 -0
- package/dist/surfaces/skyrimse/validators/archives.js +110 -0
- package/dist/surfaces/skyrimse/validators/plugins.js +374 -0
- package/dist/surfaces/skyrimse/validators/records.js +117 -0
- package/dist/surfaces/stardewvalley/compat.js +190 -0
- package/dist/surfaces/stardewvalley/config.js +42 -0
- package/dist/surfaces/stardewvalley/contentpatcher.js +203 -0
- package/dist/surfaces/stardewvalley/index/index.js +229 -0
- package/dist/surfaces/stardewvalley/index/wiki.js +190 -0
- package/dist/surfaces/stardewvalley/index.js +12 -0
- package/dist/surfaces/stardewvalley/logs.js +307 -0
- package/dist/surfaces/stardewvalley/mods.js +182 -0
- package/dist/surfaces/stardewvalley/surface.js +244 -0
- package/dist/surfaces/stardewvalley/validators/content.js +321 -0
- package/dist/surfaces/stardewvalley/validators/fields.js +147 -0
- package/dist/surfaces/stardewvalley/validators/loadorder.js +69 -0
- package/dist/surfaces/stardewvalley/validators/manifest.js +221 -0
- package/dist/surfaces/subnautica2/compat.js +138 -0
- package/dist/surfaces/subnautica2/index.js +5 -0
- package/dist/surfaces/subnautica2/logs.js +129 -0
- package/dist/surfaces/subnautica2/paks.js +173 -0
- package/dist/surfaces/subnautica2/surface.js +151 -0
- package/dist/surfaces/subnautica2/validators/packaging.js +298 -0
- package/dist/surfaces/valheim/compat.js +171 -0
- package/dist/surfaces/valheim/index/index.js +301 -0
- package/dist/surfaces/valheim/index/tables.js +103 -0
- package/dist/surfaces/valheim/index.js +11 -0
- package/dist/surfaces/valheim/logs.js +197 -0
- package/dist/surfaces/valheim/packaging.js +131 -0
- package/dist/surfaces/valheim/plugins.js +270 -0
- package/dist/surfaces/valheim/references.js +121 -0
- package/dist/surfaces/valheim/surface.js +223 -0
- package/dist/surfaces/valheim/validators/packaging.js +218 -0
- package/dist/surfaces/valheim/validators/plugins.js +287 -0
- package/dist/surfaces/valheim/validators/references.js +169 -0
- package/knowledge/baldursgate3/animations.gr2.yaml +166 -0
- package/knowledge/baldursgate3/audio.voice.yaml +182 -0
- package/knowledge/baldursgate3/audio.wwise.yaml +104 -0
- package/knowledge/baldursgate3/charactercreation.heads-hair.yaml +193 -0
- package/knowledge/baldursgate3/communitylibrary.shared-content.yaml +129 -0
- package/knowledge/baldursgate3/compatibilityframework.api.yaml +176 -0
- package/knowledge/baldursgate3/crash.causes.yaml +90 -0
- package/knowledge/baldursgate3/dialogue.dialogbank.yaml +120 -0
- package/knowledge/baldursgate3/dialogue.files.yaml +236 -0
- package/knowledge/baldursgate3/dialogue.osiris-goals.yaml +386 -0
- package/knowledge/baldursgate3/dialogue.yaml +122 -0
- package/knowledge/baldursgate3/feats.classes.yaml +164 -0
- package/knowledge/baldursgate3/items.cloth-physics.yaml +167 -0
- package/knowledge/baldursgate3/items.roottemplates.yaml +320 -0
- package/knowledge/baldursgate3/items.visualbank.yaml +628 -0
- package/knowledge/baldursgate3/journal.quests.yaml +214 -0
- package/knowledge/baldursgate3/loadorder.modsettings.yaml +128 -0
- package/knowledge/baldursgate3/localization.handles.yaml +92 -0
- package/knowledge/baldursgate3/misc.encoding-and-practice.yaml +111 -0
- package/knowledge/baldursgate3/origins.companions.yaml +144 -0
- package/knowledge/baldursgate3/osiris.signatures.yaml +211 -0
- package/knowledge/baldursgate3/packaging.meta.yaml +155 -0
- package/knowledge/baldursgate3/packaging.paks.yaml +79 -0
- package/knowledge/baldursgate3/process.launch.yaml +34 -0
- package/knowledge/baldursgate3/progressions.yaml +92 -0
- package/knowledge/baldursgate3/publishing.modio-nexus.yaml +170 -0
- package/knowledge/baldursgate3/publishing.toolkit-modio.yaml +135 -0
- package/knowledge/baldursgate3/races.progression.yaml +228 -0
- package/knowledge/baldursgate3/scriptextender.console.yaml +257 -0
- package/knowledge/baldursgate3/scriptextender.yaml +252 -0
- package/knowledge/baldursgate3/stats.boosts.yaml +293 -0
- package/knowledge/baldursgate3/stats.equipment-kits.yaml +69 -0
- package/knowledge/baldursgate3/stats.interrupts.yaml +45 -0
- package/knowledge/baldursgate3/stats.itemcombos.yaml +65 -0
- package/knowledge/baldursgate3/stats.spells.yaml +293 -0
- package/knowledge/baldursgate3/stats.weapons.yaml +210 -0
- package/knowledge/baldursgate3/toolchain.divine.yaml +179 -0
- package/knowledge/baldursgate3/toolchain.lslib-formats.yaml +242 -0
- package/knowledge/baldursgate3/toolkit.levels.yaml +177 -0
- package/knowledge/baldursgate3/ui.icons-atlas.yaml +78 -0
- package/knowledge/baldursgate3/ui.icons.yaml +412 -0
- package/knowledge/baldursgate3/ui.mcm.yaml +161 -0
- package/knowledge/baldursgate3/vfx.materials.yaml +174 -0
- package/knowledge/baldursgate3/visuals.characterfix.yaml +73 -0
- package/knowledge/cyberpunk2077/animations.anims.yaml +118 -0
- package/knowledge/cyberpunk2077/anims.archivexl.yaml +163 -0
- package/knowledge/cyberpunk2077/anims.authoring.yaml +579 -0
- package/knowledge/cyberpunk2077/anims.encoder.yaml +156 -0
- package/knowledge/cyberpunk2077/anims.graph.yaml +629 -0
- package/knowledge/cyberpunk2077/anims.method.yaml +360 -0
- package/knowledge/cyberpunk2077/anims.pipeline.yaml +352 -0
- package/knowledge/cyberpunk2077/anims.roundtrip.yaml +222 -0
- package/knowledge/cyberpunk2077/anims.sets.yaml +176 -0
- package/knowledge/cyberpunk2077/archivexl.bodytypes.yaml +149 -0
- package/knowledge/cyberpunk2077/archivexl.dynamic-appearances.yaml +218 -0
- package/knowledge/cyberpunk2077/archivexl.manifest.yaml +214 -0
- package/knowledge/cyberpunk2077/audio.events.yaml +168 -0
- package/knowledge/cyberpunk2077/audio.sounds.yaml +164 -0
- package/knowledge/cyberpunk2077/audio.voicesets.yaml +146 -0
- package/knowledge/cyberpunk2077/cet.sandbox.yaml +219 -0
- package/knowledge/cyberpunk2077/clothing.garments.yaml +283 -0
- package/knowledge/cyberpunk2077/clothing.refits.yaml +215 -0
- package/knowledge/cyberpunk2077/codeware.overview.yaml +111 -0
- package/knowledge/cyberpunk2077/codeware.systems.yaml +192 -0
- package/knowledge/cyberpunk2077/drones.combat.yaml +416 -0
- package/knowledge/cyberpunk2077/drones.control.yaml +552 -0
- package/knowledge/cyberpunk2077/entities.appearance.yaml +166 -0
- package/knowledge/cyberpunk2077/equipmentex.slots.yaml +151 -0
- package/knowledge/cyberpunk2077/fx.effects.yaml +246 -0
- package/knowledge/cyberpunk2077/fx.lights.yaml +171 -0
- package/knowledge/cyberpunk2077/hair.modding.yaml +145 -0
- package/knowledge/cyberpunk2077/items.wiring.yaml +246 -0
- package/knowledge/cyberpunk2077/loadorder.archives.yaml +71 -0
- package/knowledge/cyberpunk2077/mesh.blender.yaml +209 -0
- package/knowledge/cyberpunk2077/nativedb.dump.yaml +98 -0
- package/knowledge/cyberpunk2077/npc.appearance.yaml +275 -0
- package/knowledge/cyberpunk2077/npc.behaviour.yaml +128 -0
- package/knowledge/cyberpunk2077/npc.locomotion.yaml +490 -0
- package/knowledge/cyberpunk2077/packaging.deploy.yaml +175 -0
- package/knowledge/cyberpunk2077/packaging.variants.yaml +176 -0
- package/knowledge/cyberpunk2077/player.control.yaml +918 -0
- package/knowledge/cyberpunk2077/process.assetbuild.yaml +154 -0
- package/knowledge/cyberpunk2077/process.lessons.yaml +276 -0
- package/knowledge/cyberpunk2077/quests.minor.yaml +46 -0
- package/knowledge/cyberpunk2077/quests.scenes.yaml +282 -0
- package/knowledge/cyberpunk2077/quickhacks.tiers.yaml +41 -0
- package/knowledge/cyberpunk2077/red4ext.api.yaml +645 -0
- package/knowledge/cyberpunk2077/red4ext.plugins.yaml +124 -0
- package/knowledge/cyberpunk2077/redhottools.hotreload.yaml +245 -0
- package/knowledge/cyberpunk2077/redscript.compile-log.yaml +76 -0
- package/knowledge/cyberpunk2077/redscript.modules.yaml +118 -0
- package/knowledge/cyberpunk2077/toolchain.wolvenkit.yaml +163 -0
- package/knowledge/cyberpunk2077/tweakdb.loot-recipes.yaml +184 -0
- package/knowledge/cyberpunk2077/tweakdb.melee.yaml +352 -0
- package/knowledge/cyberpunk2077/tweakdb.weapons.yaml +325 -0
- package/knowledge/cyberpunk2077/tweakxl.hotreload.yaml +151 -0
- package/knowledge/cyberpunk2077/tweakxl.yaml-syntax.yaml +208 -0
- package/knowledge/cyberpunk2077/ui.icons.yaml +259 -0
- package/knowledge/cyberpunk2077/ui.inkatlas.yaml +81 -0
- package/knowledge/cyberpunk2077/ui.modsettings.yaml +204 -0
- package/knowledge/cyberpunk2077/vehicles.control.yaml +475 -0
- package/knowledge/cyberpunk2077/vehicles.dashboard-ui.yaml +203 -0
- package/knowledge/cyberpunk2077/vehicles.entities.yaml +195 -0
- package/knowledge/cyberpunk2077/vehicles.wiring.yaml +137 -0
- package/knowledge/cyberpunk2077/wolvenkit.cli.yaml +167 -0
- package/knowledge/cyberpunk2077/workspot.system.yaml +55 -0
- package/knowledge/cyberpunk2077/world.interactions.yaml +41 -0
- package/knowledge/cyberpunk2077/world.loot-container.yaml +167 -0
- package/knowledge/cyberpunk2077/world.sectors.yaml +233 -0
- package/knowledge/eldenring/formats.binders.yaml +237 -0
- package/knowledge/eldenring/launcher.me3.yaml +230 -0
- package/knowledge/eldenring/launcher.modengine2.yaml +119 -0
- package/knowledge/eldenring/params.paramdef.yaml +149 -0
- package/knowledge/eldenring/params.regulation.yaml +142 -0
- package/knowledge/eldenring/saves.online.yaml +118 -0
- package/knowledge/eldenring/toolchain.cli.yaml +256 -0
- package/knowledge/nivalisnights/modding.runtime.yaml +157 -0
- package/knowledge/skyrimse/archives.bsa.yaml +212 -0
- package/knowledge/skyrimse/install.detection.yaml +41 -0
- package/knowledge/skyrimse/loadorder.files.yaml +242 -0
- package/knowledge/skyrimse/plugins.esl.yaml +189 -0
- package/knowledge/skyrimse/plugins.format.yaml +224 -0
- package/knowledge/skyrimse/skse.runtime.yaml +283 -0
- package/knowledge/skyrimse/toolchain.xedit-spriggit.yaml +336 -0
- package/knowledge/stardewvalley/contentpatcher.format.yaml +338 -0
- package/knowledge/stardewvalley/distribution.channels.yaml +236 -0
- package/knowledge/stardewvalley/game.versions.yaml +202 -0
- package/knowledge/stardewvalley/install.layout.yaml +277 -0
- package/knowledge/stardewvalley/smapi.loader.yaml +284 -0
- package/knowledge/stardewvalley/smapi.logs.yaml +329 -0
- package/knowledge/stardewvalley/smapi.manifest.yaml +293 -0
- package/knowledge/stardewvalley/toolchain.build.yaml +261 -0
- package/knowledge/stardewvalley/wiki.dataformat.yaml +130 -0
- package/knowledge/subnautica2/game.build.yaml +331 -0
- package/knowledge/subnautica2/modding.state.yaml +210 -0
- package/knowledge/subnautica2/ue5.containers.yaml +72 -0
- package/knowledge/subnautica2/ue5.paks.yaml +203 -0
- package/knowledge/subnautica2/ue5.tooling.yaml +175 -0
- package/knowledge/subnautica2/ue5.ue4ss.yaml +203 -0
- package/knowledge/valheim/bepinex.loader.yaml +247 -0
- package/knowledge/valheim/bepinex.plugins.yaml +251 -0
- package/knowledge/valheim/game.versions.yaml +321 -0
- package/knowledge/valheim/install.layout.yaml +216 -0
- package/knowledge/valheim/jotunn.library.yaml +334 -0
- package/knowledge/valheim/thunderstore.packaging.yaml +217 -0
- package/knowledge/valheim/toolchain.build.yaml +111 -0
- package/package.json +29 -0
- package/scaffolds/baldursgate3/new-class-injection.yaml +148 -0
- package/scaffolds/baldursgate3/new-item.yaml +264 -0
- package/scaffolds/baldursgate3/new-mod.yaml +174 -0
- package/scaffolds/baldursgate3/new-passive.yaml +100 -0
- package/scaffolds/baldursgate3/new-project.yaml +118 -0
- package/scaffolds/baldursgate3/new-quest-stub.yaml +159 -0
- package/scaffolds/baldursgate3/new-spell.yaml +102 -0
- package/scaffolds/baldursgate3/new-status.yaml +119 -0
- package/scaffolds/baldursgate3/sequences/subclass-kit.yaml +50 -0
- package/scaffolds/cyberpunk2077/edit-tweak.yaml +70 -0
- package/scaffolds/cyberpunk2077/mesh-export-preset.yaml +170 -0
- package/scaffolds/cyberpunk2077/new-entity-patch.yaml +255 -0
- package/scaffolds/cyberpunk2077/new-garment-refit.yaml +279 -0
- package/scaffolds/cyberpunk2077/new-item-chain.yaml +548 -0
- package/scaffolds/cyberpunk2077/new-localization.yaml +130 -0
- package/scaffolds/cyberpunk2077/new-mod-settings.yaml +133 -0
- package/scaffolds/cyberpunk2077/new-player-replacer.yaml +1003 -0
- package/scaffolds/cyberpunk2077/new-project.yaml +157 -0
- package/scaffolds/cyberpunk2077/new-sector-node.yaml +156 -0
- package/scaffolds/cyberpunk2077/new-tweak.yaml +121 -0
- package/scaffolds/cyberpunk2077/new-vehicle-livery.yaml +148 -0
- package/scaffolds/cyberpunk2077/new-workspot-entity.yaml +177 -0
- package/scaffolds/cyberpunk2077/sequences/iconic-weapon.yaml +72 -0
- package/scaffolds/cyberpunk2077/sequences/quickhack-takeover.yaml +213 -0
- package/scaffolds/stardewvalley/new-cp-patch.yaml +106 -0
- package/scaffolds/stardewvalley/new-csharp-mod.yaml +195 -0
- package/scaffolds/stardewvalley/new-project.yaml +184 -0
- package/scaffolds/stardewvalley/sequences/content-pack.yaml +31 -0
- package/scripts/mw-tool.mjs +184 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { parse as parseYaml } from "yaml";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { findScaffold, scaffoldsRoot } from "./load.js";
|
|
6
|
+
const assetSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
name: z.string().min(1),
|
|
9
|
+
prompt: z.string().min(1),
|
|
10
|
+
inputs: z.array(z.string().min(1)).default([]),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
const stepSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
id: z.string().regex(/^[a-z][a-z0-9-]*$/, "step ids are lowercase slugs"),
|
|
16
|
+
scaffold: z.string().min(1),
|
|
17
|
+
title: z.string().min(1),
|
|
18
|
+
skipIf: z.enum(["project-exists"]).optional(),
|
|
19
|
+
inputs: z.record(z.string()).default({}),
|
|
20
|
+
assets: z.array(assetSchema).default([]),
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
export const sequenceSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
id: z.string().regex(/^[a-z0-9]+\.[a-z][a-z0-9-]*$/, "sequence ids are <game>.<slug>"),
|
|
26
|
+
game: z.enum(["baldursgate3", "cyberpunk2077", "stardewvalley"]),
|
|
27
|
+
title: z.string().min(1),
|
|
28
|
+
summary: z.string().min(1),
|
|
29
|
+
modType: z.string().min(1),
|
|
30
|
+
inputs: z.array(z.object({ name: z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/), prompt: z.string().min(1) }).strict()).default([]),
|
|
31
|
+
steps: z.array(stepSchema).min(1),
|
|
32
|
+
evidence: z.array(z.string()).default([]),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
const TOKEN_RE = /\$\{(sequence|steps|project)\.([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*)\}/g;
|
|
36
|
+
function formatPath(segments) {
|
|
37
|
+
if (segments.length === 0)
|
|
38
|
+
return "(root)";
|
|
39
|
+
let out = "";
|
|
40
|
+
for (const segment of segments)
|
|
41
|
+
out += typeof segment === "number" ? `[${segment}]` : out ? `.${segment}` : segment;
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
export function checkSequence(def, catalog) {
|
|
45
|
+
const problems = [];
|
|
46
|
+
const sequenceInputs = new Set(def.inputs.map((i) => i.name));
|
|
47
|
+
if (sequenceInputs.size !== def.inputs.length)
|
|
48
|
+
problems.push("sequence inputs must have unique names");
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
const earlier = new Map();
|
|
51
|
+
for (const step of def.steps) {
|
|
52
|
+
const where = `step "${step.id}"`;
|
|
53
|
+
if (seen.has(step.id))
|
|
54
|
+
problems.push(`${where}: duplicate step id`);
|
|
55
|
+
seen.add(step.id);
|
|
56
|
+
const found = findScaffold(catalog, step.scaffold);
|
|
57
|
+
if (!found) {
|
|
58
|
+
problems.push(`${where}: unknown scaffold "${step.scaffold}"`);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (found.definition.game !== def.game)
|
|
62
|
+
problems.push(`${where}: "${step.scaffold}" is a ${found.definition.game} scaffold in a ${def.game} sequence`);
|
|
63
|
+
const inputNames = new Set(found.definition.inputs.map((i) => i.name));
|
|
64
|
+
for (const name of Object.keys(step.inputs)) {
|
|
65
|
+
if (!inputNames.has(name))
|
|
66
|
+
problems.push(`${where}: "${step.scaffold}" has no input "${name}"`);
|
|
67
|
+
}
|
|
68
|
+
const assetNames = new Set();
|
|
69
|
+
for (const asset of step.assets) {
|
|
70
|
+
if (assetNames.has(asset.name))
|
|
71
|
+
problems.push(`${where}: duplicate asset "${asset.name}"`);
|
|
72
|
+
assetNames.add(asset.name);
|
|
73
|
+
for (const name of asset.inputs) {
|
|
74
|
+
if (!inputNames.has(name))
|
|
75
|
+
problems.push(`${where}: asset "${asset.name}" fills input "${name}", which "${step.scaffold}" does not have`);
|
|
76
|
+
if (name in step.inputs)
|
|
77
|
+
problems.push(`${where}: asset "${asset.name}" fills input "${name}", which the step also fixes`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const [name, value] of Object.entries(step.inputs)) {
|
|
81
|
+
for (const match of value.matchAll(TOKEN_RE)) {
|
|
82
|
+
const [, ns, key] = match;
|
|
83
|
+
if (ns === "sequence" && !sequenceInputs.has(key))
|
|
84
|
+
problems.push(`${where}: input "${name}" names \${sequence.${key}}, which the sequence does not declare`);
|
|
85
|
+
if (ns === "project" && !["name", "game", "version"].includes(key))
|
|
86
|
+
problems.push(`${where}: input "${name}" names \${project.${key}}; only name, game and version exist`);
|
|
87
|
+
if (ns === "steps") {
|
|
88
|
+
const [stepId, kind, ...rest] = key.split(".");
|
|
89
|
+
const ref = stepId ? earlier.get(stepId) : undefined;
|
|
90
|
+
if (!ref) {
|
|
91
|
+
problems.push(`${where}: input "${name}" names \${steps.${key}}, which is not an earlier step`);
|
|
92
|
+
}
|
|
93
|
+
else if (kind === "ids") {
|
|
94
|
+
if (!ref.definition.ids.some((i) => i.name === rest.join(".")))
|
|
95
|
+
problems.push(`${where}: input "${name}" names \${steps.${key}}, but "${ref.definition.id}" allocates no id "${rest.join(".")}"`);
|
|
96
|
+
}
|
|
97
|
+
else if (kind === "inputs") {
|
|
98
|
+
if (!ref.definition.inputs.some((i) => i.name === rest.join(".")))
|
|
99
|
+
problems.push(`${where}: input "${name}" names \${steps.${key}}, but "${ref.definition.id}" has no input "${rest.join(".")}"`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
problems.push(`${where}: input "${name}" names \${steps.${key}}; only ids.<name> and inputs.<name> exist`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
earlier.set(step.id, found);
|
|
108
|
+
}
|
|
109
|
+
return problems;
|
|
110
|
+
}
|
|
111
|
+
export function parseSequenceDefinition(raw, sourcePath) {
|
|
112
|
+
const result = sequenceSchema.safeParse(raw);
|
|
113
|
+
if (result.success)
|
|
114
|
+
return result.data;
|
|
115
|
+
const lines = result.error.issues.map((issue) => `${formatPath(issue.path)}: ${issue.message}`);
|
|
116
|
+
throw new Error(`Invalid sequence definition at ${sourcePath}:\n${lines.join("\n")}`);
|
|
117
|
+
}
|
|
118
|
+
export async function loadSequenceFile(filePath, catalog) {
|
|
119
|
+
const text = await fs.readFile(filePath, "utf8");
|
|
120
|
+
let raw;
|
|
121
|
+
try {
|
|
122
|
+
raw = parseYaml(text);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
throw new Error(`${filePath}: YAML parse error: ${err.message}`);
|
|
126
|
+
}
|
|
127
|
+
const def = parseSequenceDefinition(raw, filePath);
|
|
128
|
+
const problems = checkSequence(def, catalog);
|
|
129
|
+
if (problems.length > 0)
|
|
130
|
+
throw new Error(`${filePath}: sequence "${def.id}" does not fit the scaffold catalogue:\n${problems.join("\n")}`);
|
|
131
|
+
return def;
|
|
132
|
+
}
|
|
133
|
+
export async function listSequenceFiles(root = scaffoldsRoot()) {
|
|
134
|
+
const out = [];
|
|
135
|
+
let games;
|
|
136
|
+
try {
|
|
137
|
+
games = (await fs.readdir(root, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
for (const game of games) {
|
|
143
|
+
const dir = path.join(root, game, "sequences");
|
|
144
|
+
let files;
|
|
145
|
+
try {
|
|
146
|
+
files = (await fs.readdir(dir)).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"));
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
for (const file of files.sort())
|
|
152
|
+
out.push({ file: path.join(dir, file), game });
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
export async function loadAllSequences(catalog, root = scaffoldsRoot()) {
|
|
157
|
+
const loaded = [];
|
|
158
|
+
const problems = [];
|
|
159
|
+
for (const entry of await listSequenceFiles(root)) {
|
|
160
|
+
try {
|
|
161
|
+
loaded.push({ file: entry.file, definition: await loadSequenceFile(entry.file, catalog) });
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
problems.push(err.message);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { loaded, problems };
|
|
168
|
+
}
|
|
169
|
+
export function findSequence(loaded, id) {
|
|
170
|
+
return loaded.find((s) => s.definition.id === id);
|
|
171
|
+
}
|
|
172
|
+
export function summarizeSequences(loaded) {
|
|
173
|
+
return loaded.map(({ definition }) => ({
|
|
174
|
+
id: definition.id,
|
|
175
|
+
game: definition.game,
|
|
176
|
+
title: definition.title,
|
|
177
|
+
summary: definition.summary,
|
|
178
|
+
modType: definition.modType,
|
|
179
|
+
steps: definition.steps.map((s) => ({ id: s.id, scaffold: s.scaffold, title: s.title, assets: s.assets.length })),
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
async function readScaffoldManifests(projectRoot) {
|
|
183
|
+
const dir = path.join(projectRoot, ".modwright", "scaffolds");
|
|
184
|
+
let names;
|
|
185
|
+
try {
|
|
186
|
+
names = (await fs.readdir(dir)).filter((n) => n.endsWith(".json")).sort();
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const out = [];
|
|
192
|
+
for (const name of names) {
|
|
193
|
+
try {
|
|
194
|
+
const raw = JSON.parse(await fs.readFile(path.join(dir, name), "utf8"));
|
|
195
|
+
if (typeof raw.scaffold !== "string")
|
|
196
|
+
continue;
|
|
197
|
+
out.push({
|
|
198
|
+
scaffold: raw.scaffold,
|
|
199
|
+
inputs: raw.inputs && typeof raw.inputs === "object" ? raw.inputs : {},
|
|
200
|
+
generatedIds: Array.isArray(raw.generatedIds) ? raw.generatedIds : [],
|
|
201
|
+
file: path.join(dir, name),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return out;
|
|
208
|
+
}
|
|
209
|
+
function requiredInput(spec) {
|
|
210
|
+
if (spec.type === "string" || spec.type === "list")
|
|
211
|
+
return spec.default === undefined;
|
|
212
|
+
if (spec.type === "number")
|
|
213
|
+
return spec.default === undefined;
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
function resolveValue(value, scope) {
|
|
217
|
+
let waitingOn;
|
|
218
|
+
let unresolved;
|
|
219
|
+
const out = value.replace(TOKEN_RE, (whole, ns, key) => {
|
|
220
|
+
if (ns === "sequence") {
|
|
221
|
+
const v = scope.sequence[key];
|
|
222
|
+
if (v === undefined)
|
|
223
|
+
unresolved ??= whole;
|
|
224
|
+
return v ?? whole;
|
|
225
|
+
}
|
|
226
|
+
if (ns === "project") {
|
|
227
|
+
const v = scope.project[key];
|
|
228
|
+
if (v === undefined)
|
|
229
|
+
unresolved ??= whole;
|
|
230
|
+
return v ?? whole;
|
|
231
|
+
}
|
|
232
|
+
const [stepId, kind, ...rest] = key.split(".");
|
|
233
|
+
const manifest = stepId ? scope.steps.get(stepId) : undefined;
|
|
234
|
+
if (!manifest) {
|
|
235
|
+
waitingOn ??= stepId;
|
|
236
|
+
return whole;
|
|
237
|
+
}
|
|
238
|
+
const name = rest.join(".");
|
|
239
|
+
const v = kind === "ids" ? manifest.generatedIds.find((g) => g.name === name)?.value : manifest.inputs[name];
|
|
240
|
+
if (v === undefined)
|
|
241
|
+
unresolved ??= whole;
|
|
242
|
+
return v ?? whole;
|
|
243
|
+
});
|
|
244
|
+
if (waitingOn)
|
|
245
|
+
return { waitingOn };
|
|
246
|
+
if (unresolved)
|
|
247
|
+
return { unresolved };
|
|
248
|
+
return { value: out };
|
|
249
|
+
}
|
|
250
|
+
function manifestMatches(manifest, step, fixed) {
|
|
251
|
+
if (manifest.scaffold !== step.scaffold)
|
|
252
|
+
return false;
|
|
253
|
+
for (const [name, value] of Object.entries(fixed)) {
|
|
254
|
+
if (manifest.inputs[name] !== value)
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
export async function planSequence(options) {
|
|
260
|
+
const { definition, catalog, project } = options;
|
|
261
|
+
const given = options.inputs ?? {};
|
|
262
|
+
const answers = options.assets ?? {};
|
|
263
|
+
const manifests = project ? await readScaffoldManifests(project.root) : [];
|
|
264
|
+
const sequenceScope = {};
|
|
265
|
+
const missingSequence = [];
|
|
266
|
+
for (const input of definition.inputs) {
|
|
267
|
+
const v = given[input.name];
|
|
268
|
+
if (v !== undefined && v !== "")
|
|
269
|
+
sequenceScope[input.name] = v;
|
|
270
|
+
else
|
|
271
|
+
missingSequence.push({ kind: "input", name: input.name, prompt: input.prompt, answerAs: input.name });
|
|
272
|
+
}
|
|
273
|
+
const projectScope = project
|
|
274
|
+
? { name: project.project.name, game: project.project.game, ...(project.project.version ? { version: project.project.version } : {}) }
|
|
275
|
+
: {};
|
|
276
|
+
const doneSteps = new Map();
|
|
277
|
+
const steps = [];
|
|
278
|
+
let blockedEarlier;
|
|
279
|
+
for (const step of definition.steps) {
|
|
280
|
+
const found = findScaffold(catalog, step.scaffold);
|
|
281
|
+
const specs = found.definition.inputs;
|
|
282
|
+
const plan = { id: step.id, scaffold: step.scaffold, title: step.title, status: "waiting", inputs: {}, missing: [] };
|
|
283
|
+
steps.push(plan);
|
|
284
|
+
if (step.skipIf === "project-exists" && project) {
|
|
285
|
+
plan.status = "skipped";
|
|
286
|
+
plan.reason = `a project already exists (${project.project.name}); this step creates one.`;
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (!project && step.skipIf !== "project-exists") {
|
|
290
|
+
plan.status = "waiting";
|
|
291
|
+
plan.reason = "no modwright.json yet; the project step comes first.";
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
const fixed = {};
|
|
295
|
+
let waitingOn;
|
|
296
|
+
const unresolved = new Map();
|
|
297
|
+
for (const [name, raw] of Object.entries(step.inputs)) {
|
|
298
|
+
const r = resolveValue(raw, { sequence: sequenceScope, project: projectScope, steps: doneSteps });
|
|
299
|
+
if (r.waitingOn)
|
|
300
|
+
waitingOn ??= r.waitingOn;
|
|
301
|
+
else if (r.unresolved)
|
|
302
|
+
unresolved.set(name, r.unresolved);
|
|
303
|
+
else
|
|
304
|
+
fixed[name] = r.value;
|
|
305
|
+
}
|
|
306
|
+
const proof = manifests.find((m) => manifestMatches(m, step, fixed));
|
|
307
|
+
if (proof) {
|
|
308
|
+
plan.status = "done";
|
|
309
|
+
plan.manifest = proof.file;
|
|
310
|
+
plan.inputs = proof.inputs;
|
|
311
|
+
doneSteps.set(step.id, proof);
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
if (blockedEarlier) {
|
|
315
|
+
plan.status = "waiting";
|
|
316
|
+
plan.reason = `step "${blockedEarlier}" comes first.`;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
if (waitingOn) {
|
|
320
|
+
plan.status = "waiting";
|
|
321
|
+
plan.reason = `carries a value from step "${waitingOn}", which has not been applied yet.`;
|
|
322
|
+
blockedEarlier = step.id;
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
const filledByAssets = {};
|
|
326
|
+
for (const asset of step.assets) {
|
|
327
|
+
const key = `${step.id}.${asset.name}`;
|
|
328
|
+
const answer = answers[key];
|
|
329
|
+
if (answer === undefined || answer === "") {
|
|
330
|
+
plan.missing.push({ kind: "asset", name: asset.name, prompt: asset.prompt, fills: asset.inputs, answerAs: key });
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
for (const name of asset.inputs)
|
|
334
|
+
filledByAssets[name] = answer;
|
|
335
|
+
}
|
|
336
|
+
const inputs = {};
|
|
337
|
+
const fixedNames = new Set(Object.keys(step.inputs));
|
|
338
|
+
const oneOfGroups = found.definition.oneOf;
|
|
339
|
+
const valueByName = (name) => given[`${step.id}.${name}`] ?? fixed[name] ?? filledByAssets[name];
|
|
340
|
+
for (const spec of specs) {
|
|
341
|
+
const override = given[`${step.id}.${spec.name}`];
|
|
342
|
+
const value = override ?? fixed[spec.name] ?? filledByAssets[spec.name];
|
|
343
|
+
if (value !== undefined) {
|
|
344
|
+
inputs[spec.name] = value;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
const group = oneOfGroups.find((g) => g.includes(spec.name));
|
|
348
|
+
if (group && group.some((n) => n !== spec.name && valueByName(n) !== undefined))
|
|
349
|
+
continue;
|
|
350
|
+
const token = unresolved.get(spec.name);
|
|
351
|
+
if (fixedNames.has(spec.name) && token?.startsWith("${sequence."))
|
|
352
|
+
continue;
|
|
353
|
+
if (requiredInput(spec) || token) {
|
|
354
|
+
plan.missing.push({ kind: "input", name: spec.name, prompt: spec.prompt, answerAs: `${step.id}.${spec.name}` });
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
for (const token of unresolved.values()) {
|
|
358
|
+
const name = /^\$\{sequence\.([^}]+)\}$/.exec(token)?.[1];
|
|
359
|
+
if (name && !plan.missing.some((m) => m.answerAs === name)) {
|
|
360
|
+
const seqInput = definition.inputs.find((i) => i.name === name);
|
|
361
|
+
plan.missing.push({ kind: "input", name, prompt: seqInput?.prompt ?? token, answerAs: name });
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
plan.inputs = inputs;
|
|
365
|
+
if (plan.missing.length > 0) {
|
|
366
|
+
plan.status = "blocked";
|
|
367
|
+
blockedEarlier = step.id;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
plan.status = "ready";
|
|
371
|
+
plan.run = { action: "run", scaffoldId: step.scaffold, inputs, mode: "dry-run" };
|
|
372
|
+
blockedEarlier = step.id;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const next = steps.find((s) => s.status === "ready" || s.status === "blocked");
|
|
376
|
+
const complete = steps.every((s) => s.status === "done" || s.status === "skipped");
|
|
377
|
+
const doneCount = steps.filter((s) => s.status === "done" || s.status === "skipped").length;
|
|
378
|
+
const summary = complete
|
|
379
|
+
? `every step is done (${doneCount}/${steps.length}); what remains is each step's own manual checklist and the in-game check.`
|
|
380
|
+
: next
|
|
381
|
+
? next.status === "ready"
|
|
382
|
+
? `${doneCount}/${steps.length} done; step "${next.id}" (${next.scaffold}) is ready: run it dry-run, then apply.`
|
|
383
|
+
: `${doneCount}/${steps.length} done; step "${next.id}" (${next.scaffold}) needs ${next.missing.length} answer(s) first.`
|
|
384
|
+
: `${doneCount}/${steps.length} done; the remaining steps wait on a project.`;
|
|
385
|
+
return {
|
|
386
|
+
sequence: definition.id,
|
|
387
|
+
game: definition.game,
|
|
388
|
+
title: definition.title,
|
|
389
|
+
project: project ? { name: project.project.name, game: project.project.game, root: project.root } : undefined,
|
|
390
|
+
missing: missingSequence,
|
|
391
|
+
steps,
|
|
392
|
+
next: next ? { stepId: next.id, status: next.status, missing: next.missing, run: next.run } : undefined,
|
|
393
|
+
complete,
|
|
394
|
+
summary,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { probeExpectSchema } from "../bridge/types.js";
|
|
3
|
+
export const inputSpecSchema = z.discriminatedUnion("type", [
|
|
4
|
+
z
|
|
5
|
+
.object({
|
|
6
|
+
type: z.literal("string"),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
prompt: z.string(),
|
|
9
|
+
pattern: z.string().optional(),
|
|
10
|
+
default: z.string().optional(),
|
|
11
|
+
reindent: z.number().int().min(0).optional(),
|
|
12
|
+
})
|
|
13
|
+
.strict(),
|
|
14
|
+
z
|
|
15
|
+
.object({
|
|
16
|
+
type: z.literal("enum"),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
prompt: z.string(),
|
|
19
|
+
values: z.array(z.string()).min(1),
|
|
20
|
+
})
|
|
21
|
+
.strict(),
|
|
22
|
+
z
|
|
23
|
+
.object({
|
|
24
|
+
type: z.literal("number"),
|
|
25
|
+
name: z.string(),
|
|
26
|
+
prompt: z.string(),
|
|
27
|
+
default: z.number().optional(),
|
|
28
|
+
min: z.number().optional(),
|
|
29
|
+
max: z.number().optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict(),
|
|
32
|
+
z
|
|
33
|
+
.object({
|
|
34
|
+
type: z.literal("list"),
|
|
35
|
+
name: z.string(),
|
|
36
|
+
prompt: z.string(),
|
|
37
|
+
itemPattern: z.string().optional(),
|
|
38
|
+
minItems: z.number().int().nonnegative().default(1),
|
|
39
|
+
default: z.string().optional(),
|
|
40
|
+
})
|
|
41
|
+
.strict(),
|
|
42
|
+
z
|
|
43
|
+
.object({
|
|
44
|
+
type: z.literal("path"),
|
|
45
|
+
name: z.string(),
|
|
46
|
+
prompt: z.string(),
|
|
47
|
+
mustExist: z.boolean().default(false),
|
|
48
|
+
})
|
|
49
|
+
.strict(),
|
|
50
|
+
z
|
|
51
|
+
.object({
|
|
52
|
+
type: z.literal("index-ref"),
|
|
53
|
+
name: z.string(),
|
|
54
|
+
prompt: z.string(),
|
|
55
|
+
lookup: z.object({ kind: z.string(), params: z.record(z.string()) }).strict(),
|
|
56
|
+
requires: z
|
|
57
|
+
.array(z
|
|
58
|
+
.object({
|
|
59
|
+
path: z.string(),
|
|
60
|
+
matches: z.string().optional(),
|
|
61
|
+
reason: z.string(),
|
|
62
|
+
through: z
|
|
63
|
+
.object({
|
|
64
|
+
kind: z.string(),
|
|
65
|
+
param: z.string(),
|
|
66
|
+
path: z.string(),
|
|
67
|
+
params: z.record(z.string()).optional(),
|
|
68
|
+
expose: z.string().optional(),
|
|
69
|
+
})
|
|
70
|
+
.strict()
|
|
71
|
+
.optional(),
|
|
72
|
+
expose: z.string().optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict())
|
|
75
|
+
.default([]),
|
|
76
|
+
})
|
|
77
|
+
.strict(),
|
|
78
|
+
z
|
|
79
|
+
.object({
|
|
80
|
+
type: z.literal("template-record"),
|
|
81
|
+
name: z.string(),
|
|
82
|
+
prompt: z.string(),
|
|
83
|
+
expectKind: z
|
|
84
|
+
.object({ by: z.string(), map: z.record(z.string()), reason: z.string() })
|
|
85
|
+
.strict()
|
|
86
|
+
.optional(),
|
|
87
|
+
})
|
|
88
|
+
.strict(),
|
|
89
|
+
]);
|
|
90
|
+
export const ID_FORMS = ["uuid", "bg3-handle", "bg3-handle-bare", "dashed-uuid", "tweak-record", "slug", "map-key", "fnv1a64", "fixed-point"];
|
|
91
|
+
export const DERIVED_ID_FORMS = new Set(["fnv1a64", "fixed-point"]);
|
|
92
|
+
export const NUMERIC_ID_FORMS = new Set(["fixed-point"]);
|
|
93
|
+
export const idSpecSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
name: z.string(),
|
|
96
|
+
slot: z.string(),
|
|
97
|
+
form: z.enum(ID_FORMS),
|
|
98
|
+
fractionBits: z.number().int().min(0).max(40).optional(),
|
|
99
|
+
collision: z
|
|
100
|
+
.object({
|
|
101
|
+
project: z.boolean().default(true),
|
|
102
|
+
loadOrder: z.boolean().default(false),
|
|
103
|
+
index: z.object({ kind: z.string(), param: z.string() }).strict().optional(),
|
|
104
|
+
})
|
|
105
|
+
.strict()
|
|
106
|
+
.default({}),
|
|
107
|
+
})
|
|
108
|
+
.strict();
|
|
109
|
+
const requiredValueSchema = z.unknown().refine((v) => v !== undefined, { message: "value is required" });
|
|
110
|
+
const emitWhenSchema = z.union([
|
|
111
|
+
z.object({ templateDefined: z.string() }).strict(),
|
|
112
|
+
z.object({ templateUndefined: z.string() }).strict(),
|
|
113
|
+
z.object({ inputDefined: z.string() }).strict(),
|
|
114
|
+
z.object({ inputUndefined: z.string() }).strict(),
|
|
115
|
+
]);
|
|
116
|
+
export const emitSchema = z.discriminatedUnion("op", [
|
|
117
|
+
z.object({ op: z.literal("ensure-dir"), path: z.string(), when: emitWhenSchema.optional() }).strict(),
|
|
118
|
+
z
|
|
119
|
+
.object({
|
|
120
|
+
op: z.literal("write-text"),
|
|
121
|
+
path: z.string(),
|
|
122
|
+
body: z.string(),
|
|
123
|
+
bom: z.boolean().default(false),
|
|
124
|
+
ifExists: z.enum(["fail", "skip", "overwrite"]).default("fail"),
|
|
125
|
+
when: emitWhenSchema.optional(),
|
|
126
|
+
})
|
|
127
|
+
.strict(),
|
|
128
|
+
z
|
|
129
|
+
.object({
|
|
130
|
+
op: z.literal("write-json"),
|
|
131
|
+
path: z.string(),
|
|
132
|
+
value: requiredValueSchema,
|
|
133
|
+
renumberHandles: z.boolean().default(true),
|
|
134
|
+
ifExists: z.enum(["fail", "skip", "overwrite"]).default("fail"),
|
|
135
|
+
when: emitWhenSchema.optional(),
|
|
136
|
+
})
|
|
137
|
+
.strict(),
|
|
138
|
+
z
|
|
139
|
+
.object({
|
|
140
|
+
op: z.literal("write-json-from-template"),
|
|
141
|
+
path: z.string(),
|
|
142
|
+
template: z.string(),
|
|
143
|
+
rewrite: z.array(z
|
|
144
|
+
.object({
|
|
145
|
+
path: z.string(),
|
|
146
|
+
value: requiredValueSchema,
|
|
147
|
+
match: z.record(z.string()).optional(),
|
|
148
|
+
minMatches: z.number().int().min(0).optional(),
|
|
149
|
+
})
|
|
150
|
+
.strict()),
|
|
151
|
+
require: z
|
|
152
|
+
.array(z.object({ match: z.record(z.string()), minMatches: z.number().int().min(1).optional(), reason: z.string() }).strict())
|
|
153
|
+
.default([]),
|
|
154
|
+
strip: z.array(z.string()).default([]),
|
|
155
|
+
renumberHandles: z.boolean().default(true),
|
|
156
|
+
when: emitWhenSchema.optional(),
|
|
157
|
+
})
|
|
158
|
+
.strict(),
|
|
159
|
+
z
|
|
160
|
+
.object({
|
|
161
|
+
op: z.literal("insert-block"),
|
|
162
|
+
path: z.string(),
|
|
163
|
+
body: z.string(),
|
|
164
|
+
anchor: z.enum(["append", "before-first-entry", "before-last-line"]).default("append"),
|
|
165
|
+
anchorPattern: z.string().optional(),
|
|
166
|
+
indent: z.number().int().min(0).optional(),
|
|
167
|
+
createIfMissing: z.string().optional(),
|
|
168
|
+
when: emitWhenSchema.optional(),
|
|
169
|
+
})
|
|
170
|
+
.strict(),
|
|
171
|
+
z
|
|
172
|
+
.object({
|
|
173
|
+
op: z.literal("insert-loca-row"),
|
|
174
|
+
path: z.string(),
|
|
175
|
+
handle: z.string(),
|
|
176
|
+
text: z.string(),
|
|
177
|
+
version: z.number().int().default(1),
|
|
178
|
+
when: emitWhenSchema.optional(),
|
|
179
|
+
})
|
|
180
|
+
.strict(),
|
|
181
|
+
z
|
|
182
|
+
.object({
|
|
183
|
+
op: z.literal("insert-xl-entry"),
|
|
184
|
+
path: z.string(),
|
|
185
|
+
pointer: z.string(),
|
|
186
|
+
value: z.unknown(),
|
|
187
|
+
unique: z.boolean().default(false),
|
|
188
|
+
when: emitWhenSchema.optional(),
|
|
189
|
+
})
|
|
190
|
+
.strict(),
|
|
191
|
+
z.object({ op: z.literal("insert-csv-row"), path: z.string(), row: z.record(z.string()), when: emitWhenSchema.optional() }).strict(),
|
|
192
|
+
z
|
|
193
|
+
.object({
|
|
194
|
+
op: z.literal("patch-project"),
|
|
195
|
+
when: emitWhenSchema.optional(),
|
|
196
|
+
add: z
|
|
197
|
+
.object({
|
|
198
|
+
sources: z.array(z.unknown()).default([]),
|
|
199
|
+
steps: z.array(z.unknown()).default([]),
|
|
200
|
+
deployTargets: z.array(z.unknown()).default([]),
|
|
201
|
+
dependencies: z.array(z.unknown()).default([]),
|
|
202
|
+
outDir: z.string().optional(),
|
|
203
|
+
toolchain: z.record(z.string()).optional(),
|
|
204
|
+
})
|
|
205
|
+
.strict(),
|
|
206
|
+
})
|
|
207
|
+
.strict(),
|
|
208
|
+
]);
|
|
209
|
+
export const testRowProbeSchema = z
|
|
210
|
+
.object({
|
|
211
|
+
kind: z.string().min(1),
|
|
212
|
+
params: z.record(z.unknown()),
|
|
213
|
+
expect: probeExpectSchema.optional(),
|
|
214
|
+
})
|
|
215
|
+
.strict();
|
|
216
|
+
export const scaffoldSchema = z
|
|
217
|
+
.object({
|
|
218
|
+
id: z.string(),
|
|
219
|
+
game: z.enum(["baldursgate3", "cyberpunk2077", "stardewvalley"]),
|
|
220
|
+
title: z.string(),
|
|
221
|
+
summary: z.string(),
|
|
222
|
+
modTypes: z.array(z.string()).min(1),
|
|
223
|
+
needs: z
|
|
224
|
+
.object({
|
|
225
|
+
index: z.boolean().default(false),
|
|
226
|
+
install: z.boolean().default(false),
|
|
227
|
+
toolchain: z.array(z.string()).default([]),
|
|
228
|
+
})
|
|
229
|
+
.strict()
|
|
230
|
+
.default({}),
|
|
231
|
+
inputs: z.array(inputSpecSchema),
|
|
232
|
+
oneOf: z.array(z.array(z.string()).min(2)).default([]),
|
|
233
|
+
ids: z.array(idSpecSchema).default([]),
|
|
234
|
+
emits: z.array(emitSchema).min(1),
|
|
235
|
+
templates: z
|
|
236
|
+
.array(z
|
|
237
|
+
.object({
|
|
238
|
+
ref: z.string(),
|
|
239
|
+
from: z.string(),
|
|
240
|
+
conversion: z.string().optional(),
|
|
241
|
+
provenanceFrom: z.string().optional(),
|
|
242
|
+
})
|
|
243
|
+
.strict())
|
|
244
|
+
.default([]),
|
|
245
|
+
satisfies: z.array(z.string()).min(1),
|
|
246
|
+
manual: z.array(z.object({ title: z.string(), steps: z.array(z.string()), expected: z.string() }).strict()).default([]),
|
|
247
|
+
claim: z.object({ idSuffix: z.string(), claim: z.string() }).strict(),
|
|
248
|
+
testRows: z
|
|
249
|
+
.array(z
|
|
250
|
+
.object({
|
|
251
|
+
gate: z.string(),
|
|
252
|
+
title: z.string(),
|
|
253
|
+
expected: z.string(),
|
|
254
|
+
manual: z.boolean().default(true),
|
|
255
|
+
probeKinds: z.array(z.string()).default([]),
|
|
256
|
+
probes: z.array(testRowProbeSchema).min(1).optional(),
|
|
257
|
+
})
|
|
258
|
+
.strict()
|
|
259
|
+
.transform((row) => row.probes && row.probes.length > 0 && row.probeKinds.length === 0
|
|
260
|
+
? { ...row, probeKinds: row.probes.map((p) => p.kind) }
|
|
261
|
+
: row))
|
|
262
|
+
.default([]),
|
|
263
|
+
evidence: z.array(z.string()).min(1),
|
|
264
|
+
})
|
|
265
|
+
.strict()
|
|
266
|
+
.superRefine((def, ctx) => {
|
|
267
|
+
def.ids.forEach((id, i) => {
|
|
268
|
+
if (id.fractionBits !== undefined && id.form !== "fixed-point") {
|
|
269
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["ids", i, "fractionBits"], message: `only the fixed-point form takes fractionBits (this id is "${id.form}")` });
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
const byName = new Map(def.inputs.map((i) => [i.name, i]));
|
|
273
|
+
const groupOf = new Map();
|
|
274
|
+
def.oneOf.forEach((group, gi) => {
|
|
275
|
+
group.forEach((name, ni) => {
|
|
276
|
+
const spec = byName.get(name);
|
|
277
|
+
if (!spec) {
|
|
278
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["oneOf", gi, ni], message: `names input "${name}", which is not declared in inputs[]` });
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if ((spec.type === "string" || spec.type === "number" || spec.type === "list") && spec.default !== undefined) {
|
|
282
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["oneOf", gi, ni], message: `input "${name}" has a default, so it can never be absent — a oneOf member must be genuinely optional` });
|
|
283
|
+
}
|
|
284
|
+
const prev = groupOf.get(name);
|
|
285
|
+
if (prev !== undefined) {
|
|
286
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["oneOf", gi, ni], message: `input "${name}" appears in more than one oneOf group (already in group ${prev})` });
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
groupOf.set(name, gi);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
function formatPath(segments) {
|
|
295
|
+
if (segments.length === 0)
|
|
296
|
+
return "(root)";
|
|
297
|
+
let out = "";
|
|
298
|
+
for (const segment of segments) {
|
|
299
|
+
out += typeof segment === "number" ? `[${segment}]` : out ? `.${segment}` : segment;
|
|
300
|
+
}
|
|
301
|
+
return out;
|
|
302
|
+
}
|
|
303
|
+
export function parseScaffoldDefinition(raw, sourcePath) {
|
|
304
|
+
const result = scaffoldSchema.safeParse(raw);
|
|
305
|
+
if (result.success)
|
|
306
|
+
return result.data;
|
|
307
|
+
const lines = result.error.issues.map((issue) => `${formatPath(issue.path)}: ${issue.message}`);
|
|
308
|
+
throw new Error(`Invalid scaffold definition at ${sourcePath}:\n${lines.join("\n")}`);
|
|
309
|
+
}
|