@kensnzk/koyu 0.19.0 → 0.21.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.
Files changed (92) hide show
  1. package/README.ja.md +7 -5
  2. package/README.md +8 -6
  3. package/dist/analysis/contracts.d.ts +11 -1
  4. package/dist/analysis/contracts.d.ts.map +1 -1
  5. package/dist/analysis/contracts.js +11 -1
  6. package/dist/analysis/contracts.js.map +1 -1
  7. package/dist/cli.js +48 -9
  8. package/dist/cli.js.map +1 -1
  9. package/dist/core/diagnose.d.ts +2 -0
  10. package/dist/core/diagnose.d.ts.map +1 -1
  11. package/dist/core/diagnose.js +20 -1
  12. package/dist/core/diagnose.js.map +1 -1
  13. package/dist/core/diff.d.ts.map +1 -1
  14. package/dist/core/diff.js +4 -1
  15. package/dist/core/diff.js.map +1 -1
  16. package/dist/core/model.d.ts +171 -8
  17. package/dist/core/model.d.ts.map +1 -1
  18. package/dist/core/model.js +219 -15
  19. package/dist/core/model.js.map +1 -1
  20. package/dist/core/parse.d.ts.map +1 -1
  21. package/dist/core/parse.js +42 -11
  22. package/dist/core/parse.js.map +1 -1
  23. package/dist/core/vocabulary.d.ts +16 -0
  24. package/dist/core/vocabulary.d.ts.map +1 -1
  25. package/dist/core/vocabulary.js +11 -2
  26. package/dist/core/vocabulary.js.map +1 -1
  27. package/dist/form.d.ts +1 -0
  28. package/dist/form.d.ts.map +1 -1
  29. package/dist/form.js +5 -0
  30. package/dist/form.js.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +4 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/mcp.js +49 -12
  36. package/dist/mcp.js.map +1 -1
  37. package/dist/model.d.ts +1 -1
  38. package/dist/model.d.ts.map +1 -1
  39. package/dist/model.js +1 -1
  40. package/dist/model.js.map +1 -1
  41. package/dist/validate/builtin/access.js +30 -6
  42. package/dist/validate/builtin/access.js.map +1 -1
  43. package/dist/validate/contracts.d.ts +6 -1
  44. package/dist/validate/contracts.d.ts.map +1 -1
  45. package/dist/validate/contracts.js +6 -1
  46. package/dist/validate/contracts.js.map +1 -1
  47. package/editors/vscode/package.json +1 -1
  48. package/editors/vscode/syntaxes/koyu.tmLanguage.json +55 -55
  49. package/examples/basement/main.muro +9 -9
  50. package/examples/complex/L1.muro +22 -22
  51. package/examples/complex/basement.muro +4 -4
  52. package/examples/complex/core.muro +9 -9
  53. package/examples/complex/hotel.muro +14 -14
  54. package/examples/complex/main.muro +1 -1
  55. package/examples/complex/office.muro +3 -3
  56. package/examples/complex/plant.muro +4 -4
  57. package/examples/complex/podium.muro +23 -23
  58. package/examples/house/main.muro +2 -2
  59. package/examples/house.muro +2 -2
  60. package/examples/mansion.muro +27 -27
  61. package/examples/office.muro +16 -16
  62. package/examples/steps/06-finished.muro +1 -1
  63. package/examples/tower/L1.muro +12 -12
  64. package/examples/tower/L11.muro +4 -4
  65. package/examples/tower/L2.muro +10 -10
  66. package/examples/tower/main.muro +1 -1
  67. package/examples/tower/typical.muro +10 -10
  68. package/examples/twin/L1.muro +29 -29
  69. package/examples/twin/L5.muro +14 -14
  70. package/examples/twin/basement.muro +9 -9
  71. package/examples/twin/core.muro +49 -49
  72. package/examples/twin/hotel.muro +15 -15
  73. package/examples/twin/main.muro +1 -1
  74. package/examples/twin/office.muro +10 -10
  75. package/examples/twin/podium.muro +73 -73
  76. package/examples/twin/residence.muro +10 -10
  77. package/examples/two-rooms.canonical.json +2 -2
  78. package/examples/two-rooms.muro +1 -1
  79. package/package.json +17 -2
  80. package/src/analysis/contracts.ts +11 -1
  81. package/src/cli.ts +50 -10
  82. package/src/core/diagnose.ts +24 -1
  83. package/src/core/diff.ts +4 -1
  84. package/src/core/model.ts +231 -15
  85. package/src/core/parse.ts +57 -9
  86. package/src/core/vocabulary.ts +30 -2
  87. package/src/form.ts +13 -0
  88. package/src/index.ts +5 -0
  89. package/src/mcp.ts +56 -12
  90. package/src/model.ts +7 -1
  91. package/src/validate/builtin/access.ts +32 -6
  92. package/src/validate/contracts.ts +6 -1
@@ -2,20 +2,145 @@ import * as poly from "./poly.js";
2
2
  export type AttrValue = string | number;
3
3
  export type Attrs = Record<string, AttrValue>;
4
4
  /**
5
- * このツールが受理する言語版 (ADR-0017)。旧版は意味保存の場合のみ受理される (checkが検査する)。
6
- * **この並びが版の新旧の順である** — 版の比較はここの添字で行う (辞書順では 0.5 が 1.0 より後になる)
5
+ * The correspondence between the two version lines, and the only place it is recorded.
6
+ *
7
+ * muro is the language; koyu is the implementation that reads it. They are counted
8
+ * separately because they promise different things, and until this ledger existed nothing
9
+ * said which koyu implemented which muro — the published norm asserted the declaration in
10
+ * prose while no such declaration existed on any surface.
11
+ *
12
+ * - `muro` the language version, as written in a `.muro` file
13
+ * - `since` the koyu version that first read it. **A version that shipped** — `1.0.0-rc.1`
14
+ * carried muro 1.0 in the tree but never reached npm, so muro 1.0 arrived for
15
+ * anyone outside this repository at 0.16.0, and that is what this records
16
+ * - `until` the last koyu version that reads it, once a version is retired. Empty on every
17
+ * row: nothing has been retired. The field exists so that retiring is filling in
18
+ * a value rather than reshaping the ledger
19
+ *
20
+ * **The order of this array is the order of the versions, oldest first.** Comparison is by
21
+ * index, never by spelling — as strings, "0.5" sorts after "1.0".
22
+ *
23
+ * Cutting a language version is adding a row here. `test/release.test.ts` holds that: a
24
+ * release that moves the newest version must carry a row whose `since` is its own version.
25
+ */
26
+ export declare const MURO_SUPPORT: readonly {
27
+ muro: string;
28
+ since: string;
29
+ until: string | null;
30
+ }[];
31
+ /** The word a version line is written with from 1.2 on. */
32
+ export declare const MURO_KEYWORD = "muro";
33
+ /**
34
+ * The last version whose line is spelled `koyu`.
35
+ *
36
+ * **One spelling per version, never both.** Up to and including this version a file declares
37
+ * itself `koyu <v>`, and from the next one it declares itself `muro <v>`. Accepting both for
38
+ * the same version would give one declaration two spellings, and the canonical form's
39
+ * uniqueness — which the whole conformance suite rests on — would go with it.
40
+ *
41
+ * Files written before 1.2 keep the old spelling and keep meaning exactly what they meant.
42
+ * Nothing migrates, and nothing has to.
43
+ */
44
+ export declare const LAST_KOYU_SPELLED_VERSION = "1.1";
45
+ /**
46
+ * This implementation's own version — the one npm installs, held in step with `package.json`
47
+ * by `test/release.test.ts`.
48
+ *
49
+ * It sits beside `MURO_SUPPORT` because the two are one fact read from two directions: the
50
+ * `since` column is written in this vocabulary, and every surface that answers "which muro
51
+ * does this build speak" needs both halves at once.
52
+ */
53
+ export declare const KOYU_VERSION = "0.21.0";
54
+ /**
55
+ * Whether `a` names a later language version than `b`.
56
+ *
57
+ * **Not by index in the ledger** — the whole point is to answer for a version the ledger has
58
+ * never heard of, which is what a file from the future carries. Compared as numbers, because
59
+ * as strings `"0.5" > "1.0"`. A spelling that is not `major.minor` is not a version at all
60
+ * and is never "newer": it is unreadable, which is a different answer.
61
+ */
62
+ export declare function isNewerVersion(a: string, b: string): boolean;
63
+ /**
64
+ * What this build reads, what the newest version is, and how an undeclared file is read.
65
+ *
66
+ * The last two are separate facts and only coincide today. Once a newer version exists they
67
+ * differ permanently, and the line has to say both or it is telling half the truth to the
68
+ * person most likely to be surprised by it.
69
+ */
70
+ export declare function versionLine(): string;
71
+ /**
72
+ * The koyu version that first read this muro version, or `undefined` if no such version is
73
+ * accepted. This is the direction a downstream needs: it depends on a language version and
74
+ * has to turn that into a package range.
75
+ */
76
+ export declare function koyuSince(muro: string): string | undefined;
77
+ /**
78
+ * Whether this build reads the given muro version.
79
+ *
80
+ * **What a downstream actually depends on is a language version, not a package range.** An
81
+ * application that writes `muro 1.1` needs a koyu that reads 1.1; which koyu that is, is the
82
+ * ledger's business, not the application's. Asserting this at startup turns a version skew
83
+ * into one sentence instead of a parse error somewhere later.
84
+ */
85
+ export declare function speaksMuro(muro: string): boolean;
86
+ /**
87
+ * Throw unless this build reads the given muro version, naming what would fix it.
88
+ *
89
+ * Separate from `speaksMuro` because the useful thing at a startup check is the message: the
90
+ * caller knows the version it needs and nothing else, and the ledger is the only place that
91
+ * can say which koyu to install for it.
92
+ */
93
+ export declare function requireMuro(muro: string): void;
94
+ /**
95
+ * The language versions this build accepts (ADR-0017). An older version is accepted only
96
+ * where the meaning is preserved; `check` is what decides that.
97
+ *
98
+ * **Derived from `MURO_SUPPORT`, not declared beside it.** Two lists of one fact is how the
99
+ * correspondence drifted in the first place.
7
100
  */
8
101
  export declare const SUPPORTED_LANGUAGE_VERSIONS: readonly string[];
9
- /** 版宣言を省略したときの解釈 — 常に最新版の意味論 (省略はツール版を跨いで意味安定ではない) */
102
+ /**
103
+ * The newest language version this build accepts — what to declare to get everything.
104
+ * Derived, for the same reason as above.
105
+ */
106
+ export declare const NEWEST_LANGUAGE_VERSION: string;
107
+ /**
108
+ * How a file with no version line is read. **Frozen at 1.1, and it does not follow the newest
109
+ * version.**
110
+ *
111
+ * It used to be the newest, which meant an undeclared file was re-read under new semantics
112
+ * every time the tool moved — silently, because nothing reports the absence of a declaration.
113
+ * That is not hypothetical: the 1.0 → 1.1 move read `exterior` out of the type position, and
114
+ * undeclared files written in the old dialect lost their outside spaces without a word.
115
+ *
116
+ * Freezing removes the danger rather than reporting it. **Newer semantics are opt-in: you get
117
+ * them by naming them.** The cost is that an undeclared file never gets new notation, which is
118
+ * the same statement read from the other side.
119
+ *
120
+ * Freezing this was not itself a version bump: at the moment it froze, the frozen value and
121
+ * the newest version were both 1.1, so no file that existed read differently. They part
122
+ * company from 1.2 on, and that gap is the whole point — an old file that names no version
123
+ * does not quietly become a 1.2 file.
124
+ */
10
125
  export declare const DEFAULT_LANGUAGE_VERSION = "1.1";
11
126
  /**
12
127
  * 機械形式 (正準JSON) が自分を名乗る版 (ADR-0036)。**言語版でもツール版でもない** —
13
128
  * 数えるのは綴りだけである。minorはキーが増えたとき、majorは既存のキーの名前・並び・照合順・
14
129
  * 正規化・数の綴りが変わったとき。**minorでも全ての文書のバイトは動く** — この文字列自体が
15
130
  * 第一キーだからで、増えたキーを持たない文書も先頭行だけは変わる (ADR-0051 が実測している)。
16
- * 意味論の版は muro が持つので、`koyu` キー (書かれた版宣言の素通し) とは別の面である
131
+ * 意味論の版は muro が持つので、`muro` キー (書かれた版宣言の素通し) とは別の面である。
132
+ *
133
+ * The format keeps the name `koyu` because it is the implementation's output spelling — the
134
+ * shape koyu writes. The key inside it names the language, and is spelled `muro` for the same
135
+ * reason the version line is.
136
+ *
137
+ * **That rename is why this is 2.0 and not 1.3.** An existing key changed its name, which the
138
+ * rule above puts squarely in major. Shipping it as a minor would have told every reader that
139
+ * `1.x` stays compatible — so a reader expecting `koyu` would have accepted the document and
140
+ * found no language version in it, which is the silent misread the format version exists to
141
+ * prevent.
17
142
  */
18
- export declare const CANONICAL_FORMAT = "koyu-canonical/1.2";
143
+ export declare const CANONICAL_FORMAT = "koyu-canonical/2.0";
19
144
  /** 方位。edge指定は「最初に書いた空間」の矩形から見た辺。N=+Y, S=-Y, E=+X, W=-X */
20
145
  export type Edge = "N" | "E" | "S" | "W";
21
146
  export interface Level {
@@ -390,11 +515,37 @@ export declare class SourceError extends Error {
390
515
  raw: string;
391
516
  /** 出所ファイル (合成時) */
392
517
  file?: string | undefined;
518
+ /**
519
+ * The diagnostic code this failure carries in `check --json`, when it has one of its own.
520
+ *
521
+ * Most parse failures are just syntax and are reported as `SYN01`. A few are a named
522
+ * condition a caller has to be able to act on without matching the message text — a file
523
+ * declaring a language version this build cannot read is the case that forced this: the
524
+ * answer is "upgrade koyu", and a viewer wanting to say so should not be reading English.
525
+ *
526
+ * Narrow on purpose. The diagnostic ledger lives in `diagnose.ts`, which reads this
527
+ * module, so the union cannot be imported here — and widening it to `string` would let
528
+ * a typo reach `check --json` as a code no page documents.
529
+ */
530
+ code?: "VER06" | undefined;
393
531
  constructor(line: number,
394
532
  /** 位置情報を除いた本文 (合成時のファイル付与に使う) */
395
533
  raw: string,
396
534
  /** 出所ファイル (合成時) */
397
- file?: string | undefined);
535
+ file?: string | undefined,
536
+ /**
537
+ * The diagnostic code this failure carries in `check --json`, when it has one of its own.
538
+ *
539
+ * Most parse failures are just syntax and are reported as `SYN01`. A few are a named
540
+ * condition a caller has to be able to act on without matching the message text — a file
541
+ * declaring a language version this build cannot read is the case that forced this: the
542
+ * answer is "upgrade koyu", and a viewer wanting to say so should not be reading English.
543
+ *
544
+ * Narrow on purpose. The diagnostic ledger lives in `diagnose.ts`, which reads this
545
+ * module, so the union cannot be imported here — and widening it to `string` would let
546
+ * a typo reach `check --json` as a code no page documents.
547
+ */
548
+ code?: "VER06" | undefined);
398
549
  }
399
550
  /**
400
551
  * 空間の導出された領域 (ADR-0022 / docs/reference/form/index.md)。**形を読むときの唯一の入口**。
@@ -456,8 +607,20 @@ export declare function zoneAreaM2(model: Model, zonePath: string): number;
456
607
  * 半屋外に落ちるかどうかが変わっていた。母集団は場所ごとに決めるものではない (ADR-0028)。
457
608
  */
458
609
  export declare function isIndoor(model: Model, s: Space): boolean;
459
- /** 実効use属性 — 自分に無ければ、最も深いゾーン祖先から継承する */
460
- export declare function effectiveUse(model: Model, s: Space): string | undefined;
610
+ /**
611
+ * The value a space carries for `key`: its own declaration, else the one on the deepest zone
612
+ * whose path is a prefix of the space's.
613
+ *
614
+ * **The caller names the key, and core forms no opinion about what it means.** That is what
615
+ * makes this legitimate for a carried namespaced key such as `lease.category`: asking is not
616
+ * reading. Core still gives the key no meaning, decides nothing by it, and would answer the
617
+ * same way for a key it has never seen.
618
+ *
619
+ * The resolution is the one `use` had before it was retired, with the literal `"use"` moved out
620
+ * to the caller. Non-string values resolve too — a space that writes `dept.name:2024` now
621
+ * answers with the number rather than falling through to its zone, which is what was written.
622
+ */
623
+ export declare function effectiveAttr(model: Model, s: Space, key: string): AttrValue | undefined;
461
624
  /** 空間の有効天井高 mm (space自身のh属性 → レベルのh の順) */
462
625
  export declare function heff(model: Model, s: Space): number | undefined;
463
626
  /** レベルをzの昇順で返す */
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/core/model.ts"],"names":[],"mappings":"A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AC,KAAK,EAAE,KAAK,GAAG,QAAQ,EAAE,CAK/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,EAAE,CAK5D;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,GAAG,GAAG,EAAE,CAKpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAUvD;AAED,0CAA0C;AAC1C,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CA0FhD;AAWD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAOpD;AAYD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAS7D;AAwCD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAK/C"}
@@ -3,20 +3,194 @@
3
3
  // 形はここには無い。形は生成物である。(docs/writing-architecture.md)
4
4
  import * as poly from "./poly.js";
5
5
  /**
6
- * このツールが受理する言語版 (ADR-0017)。旧版は意味保存の場合のみ受理される (checkが検査する)。
7
- * **この並びが版の新旧の順である** — 版の比較はここの添字で行う (辞書順では 0.5 が 1.0 より後になる)
6
+ * The correspondence between the two version lines, and the only place it is recorded.
7
+ *
8
+ * muro is the language; koyu is the implementation that reads it. They are counted
9
+ * separately because they promise different things, and until this ledger existed nothing
10
+ * said which koyu implemented which muro — the published norm asserted the declaration in
11
+ * prose while no such declaration existed on any surface.
12
+ *
13
+ * - `muro` the language version, as written in a `.muro` file
14
+ * - `since` the koyu version that first read it. **A version that shipped** — `1.0.0-rc.1`
15
+ * carried muro 1.0 in the tree but never reached npm, so muro 1.0 arrived for
16
+ * anyone outside this repository at 0.16.0, and that is what this records
17
+ * - `until` the last koyu version that reads it, once a version is retired. Empty on every
18
+ * row: nothing has been retired. The field exists so that retiring is filling in
19
+ * a value rather than reshaping the ledger
20
+ *
21
+ * **The order of this array is the order of the versions, oldest first.** Comparison is by
22
+ * index, never by spelling — as strings, "0.5" sorts after "1.0".
23
+ *
24
+ * Cutting a language version is adding a row here. `test/release.test.ts` holds that: a
25
+ * release that moves the newest version must carry a row whose `since` is its own version.
26
+ */
27
+ export const MURO_SUPPORT = [
28
+ // The `koyu` keyword was read from the first commit, accepting whatever followed it.
29
+ { muro: "0.1", since: "0.0.1", until: null },
30
+ // 0.9.0 introduced the accepted-version list, and with it the first rejection.
31
+ { muro: "0.2", since: "0.9.0", until: null },
32
+ { muro: "0.3", since: "0.11.0", until: null },
33
+ { muro: "0.4", since: "0.11.0", until: null },
34
+ { muro: "0.5", since: "0.11.0", until: null },
35
+ // Not 1.0.0-rc.1. That version set muro 1.0 in the tree and was never published; the
36
+ // implementation version was returned to the 0.x line and shipped as 0.16.0 instead.
37
+ { muro: "1.0", since: "0.16.0", until: null },
38
+ { muro: "1.1", since: "0.17.0", until: null },
39
+ // The version line stops answering to the implementation's name: `muro 1.2`, not `koyu 1.2`.
40
+ { muro: "1.2", since: "0.20.0", until: null },
41
+ // 1.3 adds no notation. It retires `use`, whose job was never a use — it held one grouping per
42
+ // space, so tenancy, fire compartment and department all competed for it. VER07 stops it here;
43
+ // the ledger row stays so that every version up to 1.2 goes on reading it (ADR-0061).
44
+ { muro: "1.3", since: "0.21.0", until: null },
45
+ ];
46
+ /** The word a version line is written with from 1.2 on. */
47
+ export const MURO_KEYWORD = "muro";
48
+ /**
49
+ * The last version whose line is spelled `koyu`.
50
+ *
51
+ * **One spelling per version, never both.** Up to and including this version a file declares
52
+ * itself `koyu <v>`, and from the next one it declares itself `muro <v>`. Accepting both for
53
+ * the same version would give one declaration two spellings, and the canonical form's
54
+ * uniqueness — which the whole conformance suite rests on — would go with it.
55
+ *
56
+ * Files written before 1.2 keep the old spelling and keep meaning exactly what they meant.
57
+ * Nothing migrates, and nothing has to.
58
+ */
59
+ export const LAST_KOYU_SPELLED_VERSION = "1.1";
60
+ /**
61
+ * This implementation's own version — the one npm installs, held in step with `package.json`
62
+ * by `test/release.test.ts`.
63
+ *
64
+ * It sits beside `MURO_SUPPORT` because the two are one fact read from two directions: the
65
+ * `since` column is written in this vocabulary, and every surface that answers "which muro
66
+ * does this build speak" needs both halves at once.
67
+ */
68
+ export const KOYU_VERSION = "0.21.0";
69
+ /**
70
+ * Whether `a` names a later language version than `b`.
71
+ *
72
+ * **Not by index in the ledger** — the whole point is to answer for a version the ledger has
73
+ * never heard of, which is what a file from the future carries. Compared as numbers, because
74
+ * as strings `"0.5" > "1.0"`. A spelling that is not `major.minor` is not a version at all
75
+ * and is never "newer": it is unreadable, which is a different answer.
76
+ */
77
+ export function isNewerVersion(a, b) {
78
+ const shape = /^(\d+)\.(\d+)$/;
79
+ const pa = shape.exec(a);
80
+ const pb = shape.exec(b);
81
+ if (!pa || !pb)
82
+ return false;
83
+ const major = Number(pa[1]) - Number(pb[1]);
84
+ return major !== 0 ? major > 0 : Number(pa[2]) > Number(pb[2]);
85
+ }
86
+ /**
87
+ * What this build reads, what the newest version is, and how an undeclared file is read.
88
+ *
89
+ * The last two are separate facts and only coincide today. Once a newer version exists they
90
+ * differ permanently, and the line has to say both or it is telling half the truth to the
91
+ * person most likely to be surprised by it.
92
+ */
93
+ export function versionLine() {
94
+ const read = SUPPORTED_LANGUAGE_VERSIONS;
95
+ const range = `${read[0]}–${read[read.length - 1]}`;
96
+ return `koyu ${KOYU_VERSION} — reads muro ${range} (newest ${NEWEST_LANGUAGE_VERSION}; a file with no version line is read as ${DEFAULT_LANGUAGE_VERSION})`;
97
+ }
98
+ /**
99
+ * The koyu version that first read this muro version, or `undefined` if no such version is
100
+ * accepted. This is the direction a downstream needs: it depends on a language version and
101
+ * has to turn that into a package range.
102
+ */
103
+ export function koyuSince(muro) {
104
+ return MURO_SUPPORT.find((r) => r.muro === muro)?.since;
105
+ }
106
+ /**
107
+ * Whether this build reads the given muro version.
108
+ *
109
+ * **What a downstream actually depends on is a language version, not a package range.** An
110
+ * application that writes `muro 1.1` needs a koyu that reads 1.1; which koyu that is, is the
111
+ * ledger's business, not the application's. Asserting this at startup turns a version skew
112
+ * into one sentence instead of a parse error somewhere later.
113
+ */
114
+ export function speaksMuro(muro) {
115
+ return SUPPORTED_LANGUAGE_VERSIONS.includes(muro);
116
+ }
117
+ /**
118
+ * Throw unless this build reads the given muro version, naming what would fix it.
119
+ *
120
+ * Separate from `speaksMuro` because the useful thing at a startup check is the message: the
121
+ * caller knows the version it needs and nothing else, and the ledger is the only place that
122
+ * can say which koyu to install for it.
123
+ */
124
+ export function requireMuro(muro) {
125
+ if (speaksMuro(muro))
126
+ return;
127
+ const row = MURO_SUPPORT.find((r) => r.muro === muro);
128
+ const head = `This build of koyu (${KOYU_VERSION}) does not read muro ${muro}.`;
129
+ // A row with `until` set is retired, and the advice is the opposite of the usual one:
130
+ // a newer koyu will not help, because newer is what dropped it.
131
+ if (row?.until) {
132
+ throw new Error(`${head} It was retired after koyu ${row.until} — migrate the file, or install koyu ${row.until} or earlier.`);
133
+ }
134
+ if (row)
135
+ throw new Error(`${head} It arrived in koyu ${row.since} — install koyu ${row.since} or later.`);
136
+ // **No row is not evidence that no koyu reads it.** A build only carries the rows compiled
137
+ // into it, so a version released after this one looks exactly like a version that never
138
+ // existed. Saying which is which is not this build's to say; saying what it knows is.
139
+ const newer = isNewerVersion(muro, NEWEST_LANGUAGE_VERSION);
140
+ throw new Error(newer
141
+ ? `${head} It is newer than anything this build knows (it reads up to ${NEWEST_LANGUAGE_VERSION}) — upgrade koyu.`
142
+ : `${head} This build reads ${SUPPORTED_LANGUAGE_VERSIONS.join(", ")}.`);
143
+ }
144
+ /**
145
+ * The language versions this build accepts (ADR-0017). An older version is accepted only
146
+ * where the meaning is preserved; `check` is what decides that.
147
+ *
148
+ * **Derived from `MURO_SUPPORT`, not declared beside it.** Two lists of one fact is how the
149
+ * correspondence drifted in the first place.
150
+ */
151
+ export const SUPPORTED_LANGUAGE_VERSIONS = MURO_SUPPORT.filter((r) => r.until === null).map((r) => r.muro);
152
+ /**
153
+ * The newest language version this build accepts — what to declare to get everything.
154
+ * Derived, for the same reason as above.
155
+ */
156
+ export const NEWEST_LANGUAGE_VERSION = SUPPORTED_LANGUAGE_VERSIONS[SUPPORTED_LANGUAGE_VERSIONS.length - 1];
157
+ /**
158
+ * How a file with no version line is read. **Frozen at 1.1, and it does not follow the newest
159
+ * version.**
160
+ *
161
+ * It used to be the newest, which meant an undeclared file was re-read under new semantics
162
+ * every time the tool moved — silently, because nothing reports the absence of a declaration.
163
+ * That is not hypothetical: the 1.0 → 1.1 move read `exterior` out of the type position, and
164
+ * undeclared files written in the old dialect lost their outside spaces without a word.
165
+ *
166
+ * Freezing removes the danger rather than reporting it. **Newer semantics are opt-in: you get
167
+ * them by naming them.** The cost is that an undeclared file never gets new notation, which is
168
+ * the same statement read from the other side.
169
+ *
170
+ * Freezing this was not itself a version bump: at the moment it froze, the frozen value and
171
+ * the newest version were both 1.1, so no file that existed read differently. They part
172
+ * company from 1.2 on, and that gap is the whole point — an old file that names no version
173
+ * does not quietly become a 1.2 file.
8
174
  */
9
- export const SUPPORTED_LANGUAGE_VERSIONS = ["0.1", "0.2", "0.3", "0.4", "0.5", "1.0", "1.1"];
10
- /** 版宣言を省略したときの解釈 — 常に最新版の意味論 (省略はツール版を跨いで意味安定ではない) */
11
175
  export const DEFAULT_LANGUAGE_VERSION = "1.1";
12
176
  /**
13
177
  * 機械形式 (正準JSON) が自分を名乗る版 (ADR-0036)。**言語版でもツール版でもない** —
14
178
  * 数えるのは綴りだけである。minorはキーが増えたとき、majorは既存のキーの名前・並び・照合順・
15
179
  * 正規化・数の綴りが変わったとき。**minorでも全ての文書のバイトは動く** — この文字列自体が
16
180
  * 第一キーだからで、増えたキーを持たない文書も先頭行だけは変わる (ADR-0051 が実測している)。
17
- * 意味論の版は muro が持つので、`koyu` キー (書かれた版宣言の素通し) とは別の面である
181
+ * 意味論の版は muro が持つので、`muro` キー (書かれた版宣言の素通し) とは別の面である。
182
+ *
183
+ * The format keeps the name `koyu` because it is the implementation's output spelling — the
184
+ * shape koyu writes. The key inside it names the language, and is spelled `muro` for the same
185
+ * reason the version line is.
186
+ *
187
+ * **That rename is why this is 2.0 and not 1.3.** An existing key changed its name, which the
188
+ * rule above puts squarely in major. Shipping it as a minor would have told every reader that
189
+ * `1.x` stays compatible — so a reader expecting `koyu` would have accepted the document and
190
+ * found no language version in it, which is the silent misread the format version exists to
191
+ * prevent.
18
192
  */
19
- export const CANONICAL_FORMAT = "koyu-canonical/1.2";
193
+ export const CANONICAL_FORMAT = "koyu-canonical/2.0";
20
194
  /** エラー・警告の位置表記 — 合成時はどのレイヤーのことかを言葉にする (ADR-0010) */
21
195
  export function srcRef(line, file) {
22
196
  return `${file ? `${file}:` : ""}line ${line}`;
@@ -83,15 +257,30 @@ export class SourceError extends Error {
83
257
  line;
84
258
  raw;
85
259
  file;
260
+ code;
86
261
  constructor(line,
87
262
  /** 位置情報を除いた本文 (合成時のファイル付与に使う) */
88
263
  raw,
89
264
  /** 出所ファイル (合成時) */
90
- file) {
265
+ file,
266
+ /**
267
+ * The diagnostic code this failure carries in `check --json`, when it has one of its own.
268
+ *
269
+ * Most parse failures are just syntax and are reported as `SYN01`. A few are a named
270
+ * condition a caller has to be able to act on without matching the message text — a file
271
+ * declaring a language version this build cannot read is the case that forced this: the
272
+ * answer is "upgrade koyu", and a viewer wanting to say so should not be reading English.
273
+ *
274
+ * Narrow on purpose. The diagnostic ledger lives in `diagnose.ts`, which reads this
275
+ * module, so the union cannot be imported here — and widening it to `string` would let
276
+ * a typo reach `check --json` as a code no page documents.
277
+ */
278
+ code) {
91
279
  super(`${file ? `${file}:` : ""}line ${line}: ${raw}`);
92
280
  this.line = line;
93
281
  this.raw = raw;
94
282
  this.file = file;
283
+ this.code = code;
95
284
  this.name = "SourceError";
96
285
  }
97
286
  }
@@ -271,18 +460,30 @@ export function isIndoor(model, s) {
271
460
  return false;
272
461
  return !isSemiOutdoor(model, s);
273
462
  }
274
- /** 実効use属性 — 自分に無ければ、最も深いゾーン祖先から継承する */
275
- export function effectiveUse(model, s) {
276
- const own = s.attrs["use"];
277
- if (typeof own === "string")
463
+ /**
464
+ * The value a space carries for `key`: its own declaration, else the one on the deepest zone
465
+ * whose path is a prefix of the space's.
466
+ *
467
+ * **The caller names the key, and core forms no opinion about what it means.** That is what
468
+ * makes this legitimate for a carried namespaced key such as `lease.category`: asking is not
469
+ * reading. Core still gives the key no meaning, decides nothing by it, and would answer the
470
+ * same way for a key it has never seen.
471
+ *
472
+ * The resolution is the one `use` had before it was retired, with the literal `"use"` moved out
473
+ * to the caller. Non-string values resolve too — a space that writes `dept.name:2024` now
474
+ * answers with the number rather than falling through to its zone, which is what was written.
475
+ */
476
+ export function effectiveAttr(model, s, key) {
477
+ const own = s.attrs[key];
478
+ if (own !== undefined)
278
479
  return own;
279
480
  let best;
280
481
  let bestLen = -1;
281
482
  for (const z of model.zones.values()) {
282
483
  if (s.path.startsWith(z.path + "/") && z.path.length > bestLen) {
283
- const u = z.attrs["use"];
284
- if (typeof u === "string") {
285
- best = u;
484
+ const v = z.attrs[key];
485
+ if (v !== undefined) {
486
+ best = v;
286
487
  bestLen = z.path.length;
287
488
  }
288
489
  }
@@ -550,7 +751,10 @@ export function toCanonical(model) {
550
751
  // 出せば、その版を著者は書いていないのに書いたことになり、しかもツールの既定が動いた日に
551
752
  // 同じ入力のバイトが変わる。決定性は形式の側の約束なので、ツールの既定に預けない
552
753
  format: CANONICAL_FORMAT,
553
- ...(model.versionDeclared ? { koyu: model.version } : {}),
754
+ // **The key names the language, so it is spelled `muro`** — whatever word the file used.
755
+ // A document written `koyu 1.1` still says `"muro": "1.1"` here: the key is the name of
756
+ // the thing being versioned, not a copy of how the author spelled the declaration.
757
+ ...(model.versionDeclared ? { muro: model.version } : {}),
554
758
  ...(model.name ? { name: model.name } : {}),
555
759
  unit: model.unit,
556
760
  // 測地の枠 (ADR-0057) — **単位を言った直後、グリッドを言う前。**この二つは grid が張る