colregs 0.1.1 → 0.2.2

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.
Files changed (37) hide show
  1. package/LICENSE +194 -26
  2. package/PROVENANCE.md +45 -12
  3. package/README.md +222 -23
  4. package/data/applicability.json +1252 -190
  5. package/data/deprecated-identifiers.json +7 -0
  6. package/data/facts.json +556 -113
  7. package/data/geometry.json +33 -33
  8. package/data/images.json +51 -25
  9. package/data/lights.json +35 -35
  10. package/data/rules.json +787 -3
  11. package/docs/adr/0001-name-and-jurisdiction-model.md +119 -1
  12. package/docs/adr/0003-language-as-a-dimension.md +220 -0
  13. package/docs/adr/0004-licence-layering.md +78 -0
  14. package/docs/adr/0005-rule-categories-and-the-situation-record.md +323 -0
  15. package/docs/adr/0006-json-schema-and-identifier-diff.md +95 -0
  16. package/docs/adr/0007-rule26-overrides-and-aground.md +68 -0
  17. package/docs/adr/0008-mooring-buoy-modifier.md +87 -0
  18. package/docs/budgets.json +162 -0
  19. package/docs/conventions.md +27 -0
  20. package/docs/gates.json +84 -0
  21. package/docs/identifiers.md +435 -0
  22. package/docs/part-b-invariants.md +922 -0
  23. package/docs/requirements.md +1251 -23
  24. package/docs/verification/2026-08-30-q6-q8.md +278 -0
  25. package/docs/verification/2026-09-05-rule27f-rule28-anchor-scenarios.md +330 -0
  26. package/fixtures/applicability-fixtures.json +361 -227
  27. package/fixtures/situation-fixtures.json +3673 -0
  28. package/package.json +16 -4
  29. package/schema/applicability-fixtures.schema.json +49 -0
  30. package/schema/applicability.schema.json +401 -0
  31. package/schema/deprecated-identifiers.schema.json +29 -0
  32. package/schema/facts.schema.json +793 -0
  33. package/schema/geometry.schema.json +239 -0
  34. package/schema/images.schema.json +53 -0
  35. package/schema/lights.schema.json +131 -0
  36. package/schema/rules.schema.json +50 -0
  37. package/schema/situation-fixtures.schema.json +325 -0
@@ -0,0 +1,325 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mark-brannan/colregs/schema/situation-fixtures.schema.json",
4
+ "title": "fixtures/situation-fixtures.json",
5
+ "description": "Two-subject situation fixtures (ADR 0005, REQ-CAT-5). Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md. Namespace resolution (every kin:/geo:/hist: key declared in facts.json) stays in the tests.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema",
10
+ "jurisdiction",
11
+ "case_status",
12
+ "cases"
13
+ ],
14
+ "$defs": {
15
+ "entryId": {
16
+ "type": "string",
17
+ "pattern": "^[0-9]+[a-z0-9]*(-[a-z0-9]+)*$"
18
+ },
19
+ "modality": {
20
+ "type": "string",
21
+ "enum": [
22
+ "shall",
23
+ "may",
24
+ "shall-if-practicable",
25
+ "conditional",
26
+ "exempt",
27
+ "shall-not",
28
+ "shall-not-impede"
29
+ ]
30
+ },
31
+ "expectItem": {
32
+ "oneOf": [
33
+ {
34
+ "$ref": "#/$defs/entryId"
35
+ },
36
+ {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "required": [
40
+ "entry",
41
+ "modality"
42
+ ],
43
+ "properties": {
44
+ "entry": {
45
+ "$ref": "#/$defs/entryId"
46
+ },
47
+ "modality": {
48
+ "$ref": "#/$defs/modality"
49
+ }
50
+ }
51
+ }
52
+ ]
53
+ },
54
+ "scalar": {
55
+ "oneOf": [
56
+ {
57
+ "type": "string",
58
+ "pattern": "^[a-z][a-z0-9_]*:[a-z0-9_]+$"
59
+ },
60
+ {
61
+ "type": "number"
62
+ },
63
+ {
64
+ "type": "boolean"
65
+ },
66
+ {
67
+ "type": "null"
68
+ },
69
+ {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "latitude",
74
+ "longitude"
75
+ ],
76
+ "properties": {
77
+ "latitude": {
78
+ "type": "number",
79
+ "minimum": -90,
80
+ "maximum": 90
81
+ },
82
+ "longitude": {
83
+ "type": "number",
84
+ "minimum": -180,
85
+ "maximum": 180
86
+ }
87
+ }
88
+ }
89
+ ]
90
+ },
91
+ "factRecord": {
92
+ "type": "object",
93
+ "additionalProperties": false,
94
+ "patternProperties": {
95
+ "^fact:[a-z0-9_]+$": {
96
+ "$ref": "#/$defs/scalar"
97
+ }
98
+ }
99
+ },
100
+ "kinRecord": {
101
+ "type": "object",
102
+ "additionalProperties": false,
103
+ "patternProperties": {
104
+ "^kin:[a-z0-9_]+$": {
105
+ "$ref": "#/$defs/scalar"
106
+ }
107
+ }
108
+ },
109
+ "geoRecord": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "patternProperties": {
113
+ "^geo:[a-z0-9_]+$": {
114
+ "$ref": "#/$defs/scalar"
115
+ }
116
+ }
117
+ },
118
+ "histRecord": {
119
+ "type": "object",
120
+ "additionalProperties": false,
121
+ "patternProperties": {
122
+ "^hist:[a-z0-9_]+$": {
123
+ "$ref": "#/$defs/scalar"
124
+ }
125
+ }
126
+ },
127
+ "envRecord": {
128
+ "type": "object",
129
+ "additionalProperties": false,
130
+ "patternProperties": {
131
+ "^env:[a-z0-9_]+$": {
132
+ "$ref": "#/$defs/scalar"
133
+ }
134
+ }
135
+ },
136
+ "vessel": {
137
+ "type": "object",
138
+ "additionalProperties": false,
139
+ "required": [
140
+ "fact"
141
+ ],
142
+ "properties": {
143
+ "fact": {
144
+ "$ref": "#/$defs/factRecord"
145
+ },
146
+ "kin": {
147
+ "$ref": "#/$defs/kinRecord"
148
+ },
149
+ "geo": {
150
+ "$ref": "#/$defs/geoRecord"
151
+ },
152
+ "hist": {
153
+ "$ref": "#/$defs/histRecord"
154
+ }
155
+ }
156
+ }
157
+ },
158
+ "properties": {
159
+ "note": {
160
+ "type": "string"
161
+ },
162
+ "schema": {
163
+ "type": "string",
164
+ "const": "situation/1"
165
+ },
166
+ "status": {
167
+ "type": "string",
168
+ "enum": [
169
+ "ink",
170
+ "pencil",
171
+ "open"
172
+ ]
173
+ },
174
+ "adr": {
175
+ "type": "string",
176
+ "pattern": "^[0-9]{4}$"
177
+ },
178
+ "requirements": {
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string",
182
+ "pattern": "^REQ-[A-Z]+-[0-9]+$"
183
+ }
184
+ },
185
+ "jurisdiction": {
186
+ "type": "string",
187
+ "pattern": "^[a-z]+(/[a-z]+)*$"
188
+ },
189
+ "override_note": {
190
+ "type": "string"
191
+ },
192
+ "expect_scope": {
193
+ "type": "string"
194
+ },
195
+ "expect_form": {
196
+ "type": "object",
197
+ "additionalProperties": false,
198
+ "properties": {
199
+ "note": {
200
+ "type": "string"
201
+ },
202
+ "bare": {
203
+ "$ref": "#/$defs/entryId"
204
+ },
205
+ "with_modality": {
206
+ "type": "object",
207
+ "additionalProperties": false,
208
+ "required": [
209
+ "entry",
210
+ "modality"
211
+ ],
212
+ "properties": {
213
+ "entry": {
214
+ "$ref": "#/$defs/entryId"
215
+ },
216
+ "modality": {
217
+ "$ref": "#/$defs/modality"
218
+ }
219
+ }
220
+ }
221
+ }
222
+ },
223
+ "case_status": {
224
+ "type": "object",
225
+ "additionalProperties": false,
226
+ "required": [
227
+ "values"
228
+ ],
229
+ "properties": {
230
+ "note": {
231
+ "type": "string"
232
+ },
233
+ "values": {
234
+ "type": "array",
235
+ "minItems": 1,
236
+ "items": {
237
+ "type": "string",
238
+ "enum": [
239
+ "illustrative",
240
+ "binding"
241
+ ]
242
+ }
243
+ }
244
+ }
245
+ },
246
+ "cases": {
247
+ "type": "array",
248
+ "minItems": 1,
249
+ "items": {
250
+ "type": "object",
251
+ "additionalProperties": false,
252
+ "required": [
253
+ "name",
254
+ "status",
255
+ "expect",
256
+ "situation"
257
+ ],
258
+ "properties": {
259
+ "name": {
260
+ "type": "string",
261
+ "minLength": 1
262
+ },
263
+ "status": {
264
+ "type": "string",
265
+ "enum": [
266
+ "illustrative",
267
+ "binding"
268
+ ]
269
+ },
270
+ "narrative": {
271
+ "type": "string"
272
+ },
273
+ "gap": {
274
+ "type": "string"
275
+ },
276
+ "expect_when_modelled": {
277
+ "type": "array",
278
+ "items": {
279
+ "type": "string"
280
+ }
281
+ },
282
+ "expect": {
283
+ "type": "array",
284
+ "items": {
285
+ "$ref": "#/$defs/expectItem"
286
+ }
287
+ },
288
+ "situation": {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "required": [
292
+ "own"
293
+ ],
294
+ "properties": {
295
+ "own": {
296
+ "$ref": "#/$defs/vessel"
297
+ },
298
+ "other": {
299
+ "$ref": "#/$defs/vessel"
300
+ },
301
+ "pair": {
302
+ "type": "object",
303
+ "additionalProperties": false,
304
+ "properties": {
305
+ "geo": {
306
+ "$ref": "#/$defs/geoRecord"
307
+ },
308
+ "env": {
309
+ "$ref": "#/$defs/envRecord"
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ }
316
+ }
317
+ },
318
+ "collapse_note": {
319
+ "type": "string"
320
+ },
321
+ "geometry_note": {
322
+ "type": "string"
323
+ }
324
+ }
325
+ }