nwnrs 0.0.1

Command-line inspection, conversion, packing, unpacking, and NWScript tooling for Neverwinter Nights resources
Documentation

CLI

The command-line interface for inspecting, converting, packing, unpacking, and managing NWN resources.

Why This Exists

This tool exposes the most common operations — inspect, convert, pack, unpack, and nwsync — behind a single executable so contributors and modders can work with NWN assets from a terminal without writing any code.

Quick Start

Install from the repository:

cargo install --git https://github.com/urothis/nwnrs --bin nwnrs

Build or run the CLI from the workspace root:

cargo run -p nwnrs -- new --kind utc my_creature
cargo run -p nwnrs -- init --kind mod
cargo run -p nwnrs -- inspect path/to/module.mod
cargo run -p nwnrs -- convert path/to/model.mdl out/model_ascii.mdl
cargo run -p nwnrs -- convert out/model_ascii.mdl rebuilt/model.mdl
cargo run -p nwnrs -- convert path/to/model.mdl out/model.obj
cargo run -p nwnrs -- convert --root /path/to/NWN --user /path/to/NWN path/to/creature.utc out/creature.obj
cargo run -p nwnrs -- unpack path/to/module.mod -d out/
cargo run -p nwnrs -- pack out/ rebuilt.mod
cargo run -p nwnrs -- pack --debug path/to/script.nss rebuilt/script.ncs
cargo run -p nwnrs -- pack --include-dir path/to/includes --optimization O2 scripts/ rebuilt.mod
cargo run -p nwnrs -- unpack path/to/script.ncs -d out/
cargo run -p nwnrs -- pack out/ rebuilt.ncs
cargo run -p nwnrs -- pack nwn_base.key docker/data/data
cargo run -p nwnrs -- nwsync print path/to/repository --manifest <sha1>
cargo run -p nwnrs -- nwsync fetch https://example.com/manifest/abc123 -o repo/
cargo run -p nwnrs -- nwsync prune path/to/repository --dry-run
cargo run -p nwnrs -- nwsync prune path/to/repository
cargo run -p nwnrs -- nwsync write path/to/resources/ output.manifest

Useful patterns:

  • scaffold a project with nwproject.toml and nwproject.lock using new or init
  • compile .nss to .ncs with pack using a sibling nwscript.nss, or override it with --langspec
  • pack directories containing .nss in parallel by default; use -j to override the worker count
  • skip entrypoint validation for include-like scripts with --no-entrypoint-check
  • unpack raw .ncs to .ncs.asm, edit it, and pack it back into bytecode
  • lower compiled MDL files to canonical ASCII with convert
  • rebuild compiled MDL bytes from canonical ASCII generated by convert
  • export static MDL geometry to flattened OBJ
  • export equipped player UTC blueprints to flattened OBJ using install-backed model resolution
  • unpack a KEY/BIF set, preserve nwproject.lock, and repack without losing archive ordering
  • package an install-backed resource view into a slim server key/bif set with pack KEY_NAME OUTPUT_DIR
  • open an install with nwnrs-types::install, then query resources through nwnrs_types::resman

CLI Behavior and Supported Commands

Each command is implemented in its own source file:

The NWScript compile helpers now live behind pack and are implemented in: