$ show josStorer/genshin-ts
This repository is a developer toolchain for creating custom node graph logic in Genshin Impact's UGC mode (Miliastra Wonderland). It compiles a subset of TypeScript into a binary GIA format (protobuf) and injects it into game map files (.gil). The system includes a CLI (gsts) for build/inject/watch, a multi-stage compiler (TS → GS intermediate → IR JSON → GIA), an injector that patches save files, and a comprehensive set of custom ESLint rules enforcing the supported TypeScript subset. It supports both server-side and client-side node graphs with two modes (classic and beyond), and provides extensive type definitions, bilingual support (Chinese/English), and auto-generated tests covering thousands of node combinations. The codebase demonstrates strong engineering practices: rigorous testing, type safety, i18n, and modular architecture. However, it depends heavily on reverse-engineered game data (node IDs, pin records, protobuf schemas) that must be updated with each game patch, and some components are tightly coupled to internal definitions.
The LLM identified 3 files worth highlighting for reuse:
Low-level binary parser and builder for protobuf wire format. Provides readVarint, encodeVarint, parseMessage, applyReplacements, buildFile. Self-contained and dependency-free, making it reusable for any project requiring custom binary protocol handling.
Typed value model for the intermediate representation, supporting bool, int, float, str, vec3, guid, entity, list, dict, and enum types. Each value class records whether it is a literal or a pin, enabling strict literal-only checks. Well-isolated and could be extracted for other node graph or scripting language runtimes.
Conservative constant expression evaluator that folds TypeScript literal expressions into node graph equivalents. Handles binary ops, unary ops, conditional expressions, array and object literals. A self-contained module suitable for any compiler needing conservative folding.