Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Run `cargo fmt --all` before the check-only commands when code has changed.

Use standard rustfmt output and four-space indentation. Follow Rust naming conventions: `snake_case` for modules, functions, and tests; `PascalCase` for types and error variants; `SCREAMING_SNAKE_CASE` for constants. Order Rust declarations and imports as: `mod` declarations, `use std::…`, dependency imports, `use crate::…`, `use super::…`, then `use self::…` (omitting `self::` when idiomatic). Keep each import group separated by a blank line. Prefer typed `thiserror` errors and preserve their sources. Keep schema, validation, and rendering behavior in the library; CLI code should handle arguments, files, and user-facing output only.

Use North American English for code identifiers and for the canonical spelling of public interface tokens such as subcommands, flags, configuration keys, and serialised field or variant names. Prefer British English in documentation and other prose. Where practical, accept British spellings as aliases for public interface tokens, while emitting and documenting the North American spelling as canonical.

YAML is the primary human-edited format and JSON is equivalent interchange. Keep Serde schemas strict. Positions must remain two-element `[x, y]` arrays, and `names[locale][0]` is the canonical label.

## Testing Guidelines
Expand Down
35 changes: 23 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[workspace]
resolver = "3"
members = [
"crates/*"
]
members = ["crates/*"]
default-members = ["crates/mtrd"]

[workspace.package]
version = "0.0.0"
Expand All @@ -13,6 +12,7 @@ readme = "README.md"

[workspace.dependencies]
clap = { version = "4.5", features = ["derive"] }
mtrd = { path = "crates/mtrd" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ successful check means the manifest can be processed by the topology renderer.
It validates that:

- station and line IDs are non-empty and unique;
- distinct stations do not have identical positions;
- every station referenced by a line path exists;
- both coordinates of every station are finite and within the renderer's
supported numeric range;
Expand Down Expand Up @@ -209,8 +210,8 @@ options:
```

Geographic axes may be `e-n`, `e-s`, `w-n`, `w-s`, `n-e`, `n-w`, `s-e`, or
`s-w`; `e-n` is the default. For example, Los Angeles is approximately
`[-118.0, 34.0]` with `e-n` and `[34.0, 118.0]` with `n-w`.
`s-w`; `n-e` is the default. For example, Los Angeles is approximately
`[34.0, -118.0]` with `n-e` and `[34.0, 118.0]` with `n-w`.

The renderer finds the direct numeric longitude and latitude bounds, uses their
average as the centre, and applies a local equirectangular projection with the
Expand Down
14 changes: 14 additions & 0 deletions crates/mtrd-devtools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "mtrd-devtools"
version.workspace = true
edition.workspace = true
license.workspace = true
readme = "README.md"
publish = false

[dependencies]
clap.workspace = true
mtrd.workspace = true
serde_json.workspace = true
serde_yaml.workspace = true
thiserror.workspace = true
30 changes: 30 additions & 0 deletions crates/mtrd-devtools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# mtrd developer tools

This private workspace package inspects intermediate stages of the `mtrd`
generation pipeline. It is not published and is excluded from the workspace's
default package set.

Generate a contracted YAML or JSON manifest from a topology manifest:

```sh
cargo run -p mtrd-devtools -- contract topology.yaml
```

This writes `topology.contracted.yaml`. An explicit output path may be given
as the second positional argument.

Render the saved contracted manifest as SVG:

```sh
cargo run -p mtrd-devtools -- render topology.contracted.yaml
```

This writes `topology.contracted.yaml.svg`. To contract and render in one
command, use `-r` or `--render`:

```sh
cargo run -p mtrd-devtools -- contract --render topology.yaml
```

Contracted manifests are unstable debugging artifacts rather than part of
the public manifest contract.
Loading