Thanks for helping improve NMS Copilot. The project is a Rust 2024 workspace with a minimum supported Rust version of 1.91. See AGENTS.md for repository conventions and the crate layout in the README.
A fresh clone contains the implementation checkout. To attach the separate planning documents, run:
make planningmake planning-worktree is an alias. Setup needs Git and Bash (including the
Bash 3.2 shipped with macOS), plus access to origin; it does not need Rust.
The helper fetches origin/planning and attaches it at .worktrees/planning.
A clean local planning branch can fast-forward, and a local branch ahead of the
remote is preserved without pushing its newer commits.
If the remote planning branch is absent, the helper publishes an existing local
planning branch, or creates and publishes an empty orphan root when neither
exists. That initialization requires a configured Git name/email and permission
to push to origin. New planning history starts without implementation files.
The implementation branch, working files, and staging index are preserved.
Repeated setup reuses the registered worktree. Dirty, locked, misplaced, or divergent planning worktrees are left for manual reconciliation; the helper does not reset or clean them. A remote access failure is reported as an error rather than treated as an absent branch. Existing directories and tracked source paths are protected against accidental reuse as a planning checkout.
Keep plans and project records in .worktrees/planning; user-facing guides
remain in docs/. Run the helper's tests without contacting any remote service:
make test-toolsThe tests use disposable repositories and local bare remotes. The underlying
scripts/planning-worktree.sh --help also describes direct helper options for a
different remote, branch, or worktree path.
From the repository root, the normal local sequence is:
make format
make lint
make testFor a focused change, run the relevant crate or test target as well as the full required checks for the change. For example:
cargo test -p nms-save
cargo test -p nms-cli --test export_integration
cargo test -p nms-copilot --docTo build the workspace and preview its generated API documentation, run:
cargo build --workspace --all-features
cargo doc --workspace --lib --all-features --no-deps
cargo doc -p nms-cli --bin nms --document-private-items --all-features --no-deps --target-dir target/cli-docsLibrary documentation starts at target/doc/nms_copilot/index.html; the
umbrella crate has its own page at target/doc/nms/index.html. The CLI's
internal documentation starts at target/cli-docs/doc/nms/index.html.
Keeping the CLI output in its own target directory prevents it from sharing
the umbrella crate's nms documentation namespace.
Name new tests test_<function>_<scenario>_<expectation> so their purpose is
clear in test output.
The workspace's make coverage target covers the nms-copilot library with
default features disabled; it is not a workspace-wide coverage measurement.
The project has a 95% coverage target, not a claim that this target has already
been measured or reached. Review the Makefile before using make check or
make check-all: those convenience targets can provision tools. Dependency
installation, publication, and release commands are separate from ordinary
validation and should only be used when a task explicitly calls for them.
Tests use committed synthetic fixtures such as
data/test/save56_multi_system.json.
The fixture contains constructed systems, planets, and bases for repeatable
tests; it is not a player's save. Other committed legacy fixtures exercise
compatibility with historical input formats and should remain unchanged unless
a task specifically owns them.
Never add a personal save, account data, or an automatically discovered
machine-local save to a test or documentation change. Use an explicit
--save PATH argument when demonstrating or testing a command. NMS Copilot is
read-only: it reads the selected save and does not edit it.
Keep command examples aligned with the actual CLI and REPL interfaces. Label illustrative transcripts as examples and distinguish them from output captured by running a command. Documentation that uses the synthetic fixture should pass its path explicitly and should not depend on a developer's local save directory.
Rendered CLI examples and their reproduction notes live in
docs/captures/README.md. Regenerating those images
uses the optional Python Pillow package and an explicitly supplied font file;
neither is an application dependency. Do not add generated captures unless
their raw command output and provenance are retained with them.
crates/nms-corecontains shared types and address handling.crates/nms-saveparses save data.crates/nms-compatcontains compatibility helpers for JSON inputs.crates/nms-graphbuilds the galaxy model and spatial indexes.crates/nms-queryformats and runs shared queries.crates/nms-watchobserves save-file changes and publishes updates.crates/nms-cachestores the serialized galaxy model.crates/nms-cliimplements the one-shotnmscommand.crates/nms-mcpimplements the reusable MCP server, tools, and resources.crates/nms-copilotimplements the interactive REPL and composes the MCP server.crates/nmsis the workspace umbrella metadata/documentation crate; it does not re-export the other crates or provide an executable.
Follow the existing APIs and tests when changing a crate. Keep user data private, retain meaningful negative controls, and report which checks were actually run when proposing a change.