colregs 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 +34 -0
- package/PROVENANCE.md +65 -0
- package/README.md +50 -0
- package/data/applicability.json +1108 -0
- package/data/facts.json +308 -0
- package/data/geometry.json +372 -0
- package/data/images.json +876 -0
- package/data/lights.json +229 -0
- package/data/rules.json +843 -0
- package/fixtures/applicability-fixtures.json +412 -0
- package/images/NRHB_23_Intl_dii.png +0 -0
- package/images/NRHB_23_a.png +0 -0
- package/images/NRHB_23_aii.png +0 -0
- package/images/NRHB_23_b.png +0 -0
- package/images/NRHB_23_di.png +0 -0
- package/images/NRHB_23_e.png +0 -0
- package/images/NRHB_24_a.png +0 -0
- package/images/NRHB_24_av.png +0 -0
- package/images/NRHB_24_d.png +0 -0
- package/images/NRHB_24_e.png +0 -0
- package/images/NRHB_24_eiii.png +0 -0
- package/images/NRHB_24_f.png +0 -0
- package/images/NRHB_24_j.png +0 -0
- package/images/NRHB_25_a.png +0 -0
- package/images/NRHB_25_b.png +0 -0
- package/images/NRHB_25_c.png +0 -0
- package/images/NRHB_25_d.png +0 -0
- package/images/NRHB_25_dii.png +0 -0
- package/images/NRHB_25_e.png +0 -0
- package/images/NRHB_26_b.png +0 -0
- package/images/NRHB_26_biii.png +0 -0
- package/images/NRHB_26_ciii.png +0 -0
- package/images/NRHB_27_a.png +0 -0
- package/images/NRHB_27_aiii.png +0 -0
- package/images/NRHB_27_biii.png +0 -0
- package/images/NRHB_27_biv.png +0 -0
- package/images/NRHB_27_c.png +0 -0
- package/images/NRHB_27_d.png +0 -0
- package/images/NRHB_27_diii.png +0 -0
- package/images/NRHB_27_ei.png +0 -0
- package/images/NRHB_27_eii.png +0 -0
- package/images/NRHB_27_f.png +0 -0
- package/images/NRHB_28.png +0 -0
- package/images/NRHB_29_a.png +0 -0
- package/images/NRHB_29_aiii.png +0 -0
- package/images/NRHB_30_a.png +0 -0
- package/images/NRHB_30_d.png +0 -0
- package/images/NRHB_30_dii.png +0 -0
- package/images/mastheadarc.gif +0 -0
- package/images/portarc.gif +0 -0
- package/images/stbdarc.gif +0 -0
- package/images/sternarc.gif +0 -0
- package/images/towingarc.gif +0 -0
- package/package.json +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Brannan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF
|
|
20
|
+
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The MIT licence above covers this compilation: the JSON structure, the
|
|
26
|
+
predicates, the fixtures and the tests.
|
|
27
|
+
|
|
28
|
+
The rule text in `data/rules.json` and the diagrams in `images/NRHB_*.png` are
|
|
29
|
+
works of the United States Government and are not subject to copyright in the
|
|
30
|
+
United States (17 U.S.C. 105). The `*arc.gif` files have unverified
|
|
31
|
+
provenance — see PROVENANCE.md.
|
|
32
|
+
|
|
33
|
+
This package is not authoritative and is not endorsed by the US Coast Guard.
|
|
34
|
+
Navigate by the published rules.
|
package/PROVENANCE.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
Everything in this package is transcribed or copied from US Government
|
|
4
|
+
publications. Nothing here is authoritative: consult the published rules.
|
|
5
|
+
|
|
6
|
+
## Rule text — `data/rules.json`
|
|
7
|
+
|
|
8
|
+
- **Source:** USCG Navigation Center, *Navigation Rules, International —
|
|
9
|
+
Inland* (amalgamated), <https://www.navcen.uscg.gov/navigation-rules-amalgamated>
|
|
10
|
+
- **Retrieved:** 2026-08-29
|
|
11
|
+
- **Scope:** the **International** text only. The amalgamated page marks
|
|
12
|
+
inland-only inserts and international-only variants inline; inland text was
|
|
13
|
+
removed and international variants kept. Nothing was paraphrased.
|
|
14
|
+
- **Rights:** a work of the US Government, not subject to copyright in the
|
|
15
|
+
United States (17 U.S.C. 105).
|
|
16
|
+
- **Known hole:** Rule 24(g)(i) is absent from the source page. Rather than
|
|
17
|
+
reconstruct it from memory, `rules.json` records it under `gaps` and the
|
|
18
|
+
paragraph is omitted. 24(g) covers inconspicuous, partly submerged tows and
|
|
19
|
+
is outside the applicability table in this release.
|
|
20
|
+
|
|
21
|
+
## Diagrams — `images/NRHB_*.png`
|
|
22
|
+
|
|
23
|
+
- **Source:** the same USCG page, at
|
|
24
|
+
`https://www.navcen.uscg.gov/sites/default/files/images/navrules/<name>`
|
|
25
|
+
- **Retrieved:** 2026-08-29 — fetched from the live USCG server, not scanned
|
|
26
|
+
from the PDF handbook and not recovered from an archive.
|
|
27
|
+
- **Rights:** US Government work, public domain (17 U.S.C. 105).
|
|
28
|
+
- Per-file URL, byte count, SHA-256 and pixel dimensions are recorded in
|
|
29
|
+
`data/images.json`, along with the USCG's own caption text and the
|
|
30
|
+
paragraphs and applicability entries each image illustrates.
|
|
31
|
+
|
|
32
|
+
Two of the 38 (`NRHB_25_b.png`, `NRHB_27_ei.png`) are served by the USCG but
|
|
33
|
+
not linked from the page; they were fetched by name. Two more
|
|
34
|
+
(`NRHB_23_e.png`, `NRHB_24_j.png`) illustrate Great Lakes and Western Rivers
|
|
35
|
+
paragraphs and are unmapped in this international-only release — they are kept
|
|
36
|
+
because the inland ruleset will want them.
|
|
37
|
+
|
|
38
|
+
### The `NR_*` / `NRHB_*` prefix question, resolved
|
|
39
|
+
|
|
40
|
+
`mark-brannan/signalk-auto-nav-lights` carried images under two prefixes with
|
|
41
|
+
no provenance recorded. `NR_25_b.png` and `NR_27_ei.png` are the same two
|
|
42
|
+
diagrams the USCG now serves as `NRHB_25_b.png` and `NRHB_27_ei.png` — an
|
|
43
|
+
older filename for the same images, not a different source. This package uses
|
|
44
|
+
the current USCG names throughout.
|
|
45
|
+
|
|
46
|
+
## Arc diagrams — `images/*arc.gif` — **unresolved**
|
|
47
|
+
|
|
48
|
+
`mastheadarc.gif`, `portarc.gif`, `stbdarc.gif`, `sternarc.gif` and
|
|
49
|
+
`towingarc.gif` were carried over from `signalk-auto-nav-lights`. They are
|
|
50
|
+
believed to be USCG illustrations, but the page that served them no longer
|
|
51
|
+
exists and no archived original has been located, so their provenance and
|
|
52
|
+
rights are **unverified**. `data/images.json` marks them
|
|
53
|
+
`"provenance_status": "unresolved"`.
|
|
54
|
+
|
|
55
|
+
They are decorative here: the arcs themselves are data, in `data/lights.json`
|
|
56
|
+
under each light's `arc`. If provenance cannot be established, delete the GIFs;
|
|
57
|
+
nothing in the package depends on them.
|
|
58
|
+
|
|
59
|
+
## SignalK paths
|
|
60
|
+
|
|
61
|
+
`data/facts.json` records which SignalK path, if any, publishes each fact.
|
|
62
|
+
Verified 2026-08-29 against the installed `@signalk/signalk-schema`
|
|
63
|
+
(`schemas/groups/navigation.json`, `schemas/groups/design.json`). The
|
|
64
|
+
`navigation.state` enum values in the decode table are copied verbatim from
|
|
65
|
+
that schema, spelling included.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# colregs
|
|
2
|
+
|
|
3
|
+
The international collision regulations, and the national amalgamations derived
|
|
4
|
+
from them, as language-neutral JSON — with the provenance to check every line
|
|
5
|
+
against its source and fixtures a second implementation can verify against.
|
|
6
|
+
|
|
7
|
+
Data only. No runtime, no dependencies, no inference.
|
|
8
|
+
|
|
9
|
+
> **Status: pre-release.** Nothing here is complete, and nothing here is fit for
|
|
10
|
+
> navigation. See [`docs/requirements.md`](docs/requirements.md) for what it is
|
|
11
|
+
> meant to become.
|
|
12
|
+
|
|
13
|
+
## Coverage
|
|
14
|
+
|
|
15
|
+
| | |
|
|
16
|
+
|---|---|
|
|
17
|
+
| **Rules** | Part C, lights (Rules 20–31). Day shapes and Part D signals are not here. |
|
|
18
|
+
| **Jurisdictions** | `intl` only. US Inland, Canada and the rest are modelled for but not present. |
|
|
19
|
+
| **Conditions** | Night. |
|
|
20
|
+
|
|
21
|
+
Coverage is stated because silence must not imply it (REQ-SCOPE-6).
|
|
22
|
+
|
|
23
|
+
## Design
|
|
24
|
+
|
|
25
|
+
This repo is requirements-first. Coding sessions work against numbered
|
|
26
|
+
requirements and cite them; decisions that shaped the design are recorded as
|
|
27
|
+
ADRs rather than argued again.
|
|
28
|
+
|
|
29
|
+
- [`docs/requirements.md`](docs/requirements.md) — the source of truth
|
|
30
|
+
- [`docs/adr/`](docs/adr/) — decisions, with the reasoning that produced them
|
|
31
|
+
|
|
32
|
+
Three ideas carry most of the design:
|
|
33
|
+
|
|
34
|
+
**The paragraph is the unit.** Rule text, citations and composition all key on
|
|
35
|
+
the paragraph path — `27(a)(i)`, not "Rule 27". Citation unit and composition
|
|
36
|
+
unit turn out to be the same thing.
|
|
37
|
+
|
|
38
|
+
**Predicates, not enumerations.** Gates are `length_m < 7`, never a pre-built
|
|
39
|
+
list of configurations. Enumerated tables are where prior art silently loses
|
|
40
|
+
rules; a predicate cannot omit a case it was never asked about.
|
|
41
|
+
|
|
42
|
+
**Alternatives are first-class.** COLREGS routinely permits a choice — a
|
|
43
|
+
tricolor *in lieu of* separate sidelights, a torch *in lieu of* either. The data
|
|
44
|
+
carries every lawful option with its modality and gate, and picks none of them.
|
|
45
|
+
Selection belongs to the consumer.
|
|
46
|
+
|
|
47
|
+
## Licence
|
|
48
|
+
|
|
49
|
+
Code and fixtures: see `LICENSE`. Rule text and diagrams carry their own terms,
|
|
50
|
+
recorded per asset — see `PROVENANCE.md` once data lands.
|