@kensnzk/koyu 0.5.0 → 0.13.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 (160) hide show
  1. package/README.ja.md +43 -11
  2. package/README.md +51 -11
  3. package/dist/axo.d.ts +16 -0
  4. package/dist/axo.d.ts.map +1 -0
  5. package/dist/axo.js +211 -0
  6. package/dist/axo.js.map +1 -0
  7. package/dist/check.d.ts +109 -0
  8. package/dist/check.d.ts.map +1 -0
  9. package/dist/check.js +957 -0
  10. package/dist/check.js.map +1 -0
  11. package/dist/cli.d.ts +3 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +410 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/diff.d.ts +105 -0
  16. package/dist/diff.d.ts.map +1 -0
  17. package/dist/diff.js +583 -0
  18. package/dist/diff.js.map +1 -0
  19. package/dist/fabric.d.ts +28 -0
  20. package/dist/fabric.d.ts.map +1 -0
  21. package/dist/fabric.js +105 -0
  22. package/dist/fabric.js.map +1 -0
  23. package/dist/graph.d.ts +118 -0
  24. package/dist/graph.d.ts.map +1 -0
  25. package/dist/graph.js +627 -0
  26. package/dist/graph.js.map +1 -0
  27. package/dist/index.d.ts +12 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +13 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/light.d.ts +15 -0
  32. package/dist/light.d.ts.map +1 -0
  33. package/dist/light.js +53 -0
  34. package/dist/light.js.map +1 -0
  35. package/dist/mcp.d.ts +3 -0
  36. package/dist/mcp.d.ts.map +1 -0
  37. package/dist/mcp.js +361 -0
  38. package/dist/mcp.js.map +1 -0
  39. package/dist/model.d.ts +379 -0
  40. package/dist/model.d.ts.map +1 -0
  41. package/dist/model.js +464 -0
  42. package/dist/model.js.map +1 -0
  43. package/dist/parse-file.d.ts +9 -0
  44. package/dist/parse-file.d.ts.map +1 -0
  45. package/dist/parse-file.js +22 -0
  46. package/dist/parse-file.js.map +1 -0
  47. package/dist/parse.d.ts +16 -0
  48. package/dist/parse.d.ts.map +1 -0
  49. package/dist/parse.js +1040 -0
  50. package/dist/parse.js.map +1 -0
  51. package/dist/plan.d.ts +10 -0
  52. package/dist/plan.d.ts.map +1 -0
  53. package/dist/plan.js +354 -0
  54. package/dist/plan.js.map +1 -0
  55. package/dist/poly.d.ts +78 -0
  56. package/dist/poly.d.ts.map +1 -0
  57. package/dist/poly.js +277 -0
  58. package/dist/poly.js.map +1 -0
  59. package/dist/site.d.ts +24 -0
  60. package/dist/site.d.ts.map +1 -0
  61. package/dist/site.js +54 -0
  62. package/dist/site.js.map +1 -0
  63. package/dist/vertical.d.ts +176 -0
  64. package/dist/vertical.d.ts.map +1 -0
  65. package/dist/vertical.js +669 -0
  66. package/dist/vertical.js.map +1 -0
  67. package/examples/basement/main.muro +84 -0
  68. package/examples/comparison/README.md +64 -1
  69. package/examples/comparison/gen-ifc4.ts +1 -1
  70. package/examples/comparison/gen-ifcx.ts +2 -2
  71. package/examples/comparison/two-rooms.ifcx +1 -1
  72. package/examples/complex/L1.muro +132 -0
  73. package/examples/complex/assets.muro +17 -0
  74. package/examples/complex/basement.muro +40 -0
  75. package/examples/complex/core.muro +40 -0
  76. package/examples/complex/hotel.muro +117 -0
  77. package/examples/complex/main.muro +67 -0
  78. package/examples/complex/office.muro +41 -0
  79. package/examples/complex/plant.muro +34 -0
  80. package/examples/complex/podium.muro +140 -0
  81. package/examples/complex/site.muro +18 -0
  82. package/examples/house/L1.muro +16 -0
  83. package/examples/house/L2.muro +19 -0
  84. package/examples/house/assets.muro +9 -0
  85. package/examples/house/main.muro +27 -0
  86. package/examples/house/site.muro +31 -0
  87. package/examples/house.muro +3 -3
  88. package/examples/mansion.muro +18 -13
  89. package/examples/office.muro +1 -1
  90. package/examples/steps/01-one-room.muro +4 -0
  91. package/examples/steps/02-two-rooms.muro +5 -0
  92. package/examples/steps/03-door.muro +9 -0
  93. package/examples/steps/04-exterior.muro +15 -0
  94. package/examples/steps/05-two-storeys.muro +27 -0
  95. package/examples/steps/06-finished.muro +30 -0
  96. package/examples/steps/README.md +25 -0
  97. package/examples/tower/L1.muro +80 -0
  98. package/examples/tower/L11.muro +49 -0
  99. package/examples/tower/L2.muro +71 -0
  100. package/examples/tower/L3.muro +31 -0
  101. package/examples/tower/assets.muro +14 -0
  102. package/examples/tower/main.muro +37 -0
  103. package/examples/tower/site-geometry.muro +7 -0
  104. package/examples/tower/site.muro +33 -0
  105. package/examples/tower/typical.muro +131 -0
  106. package/examples/two-rooms.canonical.json +30 -3
  107. package/examples/two-rooms.muro +11 -7
  108. package/package.json +29 -2
  109. package/src/axo.ts +258 -0
  110. package/src/check.ts +948 -122
  111. package/src/cli.ts +175 -12
  112. package/src/diff.ts +676 -0
  113. package/src/fabric.ts +123 -0
  114. package/src/graph.ts +451 -61
  115. package/src/index.ts +38 -2
  116. package/src/light.ts +4 -7
  117. package/src/mcp.ts +397 -0
  118. package/src/model.ts +462 -67
  119. package/src/parse-file.ts +28 -0
  120. package/src/parse.ts +682 -45
  121. package/src/plan.ts +152 -14
  122. package/src/poly.ts +295 -0
  123. package/src/site.ts +19 -11
  124. package/src/vertical.ts +884 -0
  125. package/.github/workflows/ci.yml +0 -16
  126. package/.zenodo.json +0 -20
  127. package/CITATION.cff +0 -26
  128. package/docs/decisions/0001-notation-v0.md +0 -29
  129. package/docs/decisions/0002-height-and-offsets.md +0 -27
  130. package/docs/decisions/0003-uncounted-divisions.md +0 -36
  131. package/docs/decisions/0004-typical-floors.md +0 -21
  132. package/docs/decisions/0005-zones-and-unions.md +0 -23
  133. package/docs/decisions/0006-voids-and-light.md +0 -31
  134. package/docs/decisions/0007-semi-outdoor-air.md +0 -27
  135. package/docs/decisions/0008-vocabulary-and-level-attr.md +0 -23
  136. package/docs/decisions/0009-site-and-exterior.md +0 -29
  137. package/docs/ifc-coverage.md +0 -82
  138. package/docs/ifcx-notes.md +0 -25
  139. package/docs/img/house-L1.svg +0 -80
  140. package/docs/img/house-L2.svg +0 -53
  141. package/docs/img/mansion-L1.svg +0 -113
  142. package/docs/img/mansion-L10.svg +0 -111
  143. package/docs/img/mansion-L5.svg +0 -160
  144. package/docs/img/office-L1.svg +0 -116
  145. package/docs/img/office-L2.svg +0 -109
  146. package/docs/img/two-rooms.svg +0 -39
  147. package/docs/log/2026-07-22.md +0 -13
  148. package/docs/log/2026-07-23.md +0 -51
  149. package/docs/roadmap.md +0 -55
  150. package/docs/writing-architecture.md +0 -119
  151. package/spec/notation-v0.md +0 -164
  152. package/spec/vocabulary.md +0 -62
  153. package/test/core.test.ts +0 -171
  154. package/test/design2.test.ts +0 -97
  155. package/test/house.test.ts +0 -74
  156. package/test/mansion.test.ts +0 -99
  157. package/test/office.test.ts +0 -71
  158. package/test/uncounted.test.ts +0 -120
  159. package/test/vertical.test.ts +0 -75
  160. package/tsconfig.json +0 -13
package/README.ja.md CHANGED
@@ -4,31 +4,56 @@
4
4
 
5
5
  > 鑿戸牖以為室、当其無、有室之用 — 老子 第十一章
6
6
 
7
- 空間を一次要素とするテキストネイティブな建築記述の探求。壁は物ではなく二つの空間の境界という関係であり、形はソースではなく生成物である。建物一棟を数百行のテキストで書き、git・LLM・都市データと同じ土俵に載せることを狙う。主張の全文は [docs/writing-architecture.md](docs/writing-architecture.md)。
7
+ 空間を一次要素とするテキストネイティブな建築記述の探求。壁は物ではなく二つの空間の境界という関係である。原本に書かれるのは空間の領域と境界の関係であり、部材の形はソースではなく生成物である。建物一棟を数百行のテキストで書き、git・LLMと同じ土俵に載せ、都市接続の候補になる軽さを狙う。主張の全文は [docs/writing-architecture.md](docs/writing-architecture.md)。
8
8
 
9
- 二室一扉はこう書く (全文 [examples/two-rooms.muro](examples/two-rooms.muro)):
9
+ ## ドキュメント
10
10
 
11
+ 文書は二冊に分かれている。**[guide/](guide/README.md) が最初の扉**で、[spec/](spec/README.md) が規範である。
12
+
13
+ - **[guide/](guide/README.md)** — 学ぶ本。チュートリアル・六つの考え・how-to・診断コード事典・CLI/APIリファレンス。**koyu を初めて書くなら [guide/start.md](guide/start.md) から** (30〜45分で二階建て一棟と平面図まで届く)
14
+ - **[spec/](spec/README.md)** — 規範リファレンス。文法・意味論・語彙の台帳・正準JSON・ツール契約を現在形で
15
+ - **[docs/decisions/](docs/decisions/)** — ADR。なぜそう決めたか、何を棄却したか
16
+ - **[AGENTS.md](AGENTS.md)** — このリポジトリで作業するLLMエージェントの入口
17
+
18
+ 一室はこう書く。4行で、これで完全なファイルである。
19
+
20
+ ```muro
21
+ grid X 0 3600
22
+ grid Y 0 4000
23
+ level L1 0
24
+ space /L1/a room X1..X2 Y1..Y2
11
25
  ```
12
- space /L1/a room X1..X2 Y1..Y2 name:居室A
13
- space /L1/b room X2..X3 Y1..Y2 name:居室B
14
- space /out exterior name:外部
15
26
 
16
- boundary /L1/a /L1/b t:120 spec:PW1
17
- door w:780 h:2000
27
+ `koyu plan` が平面図を出す。壁は一本も描かれていない — 空間はあるが、境界が一つも無いからである。
28
+
29
+ ![一室の平面図](guide/img/start-01-one-room.svg)
30
+
31
+ `space` をもう一行足す。他は何も変えない。
32
+
33
+ ```muro
34
+ grid X 0 3600 5400
35
+ grid Y 0 4000
36
+ level L1 0
37
+ space /L1/a room X1..X2 Y1..Y2
38
+ space /L1/b room X2..X3 Y1..Y2
18
39
  ```
19
40
 
20
- ここから平面図が生成される。壁を描く操作はどこにも無い — 壁は空間の割付から導出される。
41
+ ![二室の平面図。中央に壁が一枚立っている](guide/img/start-02-two-rooms.svg)
21
42
 
22
- ![二室一扉の平面図](docs/img/two-rooms.svg)
43
+ **壁が一枚現れる。壁を描く操作はどこにも無い。** 壁は二つの空間の境界という関係であり、空間の割付から導出される。接する空間の組に宣言が無ければ、それは「未定義」ではなく「壁」を意味する。
23
44
 
24
45
  2フロアのオフィス (廊下・コア・通り芯オフセット壁・階段/EV・高さの整合つき) でも約100行 ([examples/office.muro](examples/office.muro))。解像度は基本計画レベル — 垂れ壁を表現しないのは省略ではなく抽象度の選択で、計画初期にBIMが重すぎたという弱点の裏側がこの記述の主戦場である。高さ方向の一貫性は「天井高+上階slab ≤ 階高」という宣言された不変量の検査で担保する (ADR-0002)。
25
46
 
26
47
  ![オフィス1階平面図](docs/img/office-L1.svg)
27
48
 
28
- 10階建て内廊下型集合住宅 (43戸、EV+屋外階段、屋上、Aタイプは間取り込み) は **183行** ([examples/mansion.muro](examples/mansion.muro))。基準階は一度だけ書き、`/L2..L9/A` のスパンが8フロアへ展開される (ADR-0004)。L字のLDKは矩形の合併、住戸は `zone` (数える集約) で間取りに割っても専有面積の言葉を保つ (ADR-0005)。吹抜けは `type:void` の垂直境界 — 床の不在も境界で書く (ADR-0006)。`doors` が「9階のLDKから地上まで扉3枚」に、`light` が住居系居室の1/7採光に即答する。
49
+ 10階建て内廊下型集合住宅 (43戸、EV+屋外階段、屋上、Aタイプは間取り込み) は **187行** ([examples/mansion.muro](examples/mansion.muro))。基準階は一度だけ書き、`/L2..L9/A` のスパンが8フロアへ展開される (ADR-0004)。L字のLDKは矩形の合併、住戸は `zone` (数える集約) で間取りに割っても専有面積の言葉を保つ (ADR-0005)。吹抜けは `type:void` の垂直境界 — 床の不在も境界で書く (ADR-0006)。`doors` が「9階のLDKから地上まで扉3枚」に、`light` が居室 (`daylight:1` と宣言した室) の1/7採光に即答する。
29
50
 
30
51
  ![集合住宅基準階平面図](docs/img/mansion-L5.svg)
31
52
 
53
+ 全機能のショーケースが **[examples/tower/](examples/tower/)** — 低層商業+高層住宅の11階建て複合ビル (PH付き、延床約4,786㎡) を9ファイルで合成したもの。敷地は不整形の五角形で、敷地形状はこの記法で唯一「書かれる形」(`polygon`、ADR-0011) — 敷地の形は測量由来の所与であって設計の生成物ではないから。隔離レイヤー (site-geometry.muro) に置かれ、導出面積・建物のはみ出し検査・配置図の敷地境界線がそこから出る。他は記法の全部が一棟に載っている: 2層吹抜け、噛み合うL字住戸、バルコニー、例外階の**差分レイヤー**として書かれた低層部屋根のテラス、自動ドア入りの建具アセット、通り芯基準の明示位置、間取りまで割った住戸タイプ。178空間・543境界が警告ゼロ、居室66室が採光1/7を満たし、「9階のLDKから道路まで扉何枚?」に4枚と答える。
54
+
55
+ 一棟はファイル群としても書ける — USDに着想を得た加算合成で、黙った上書きは無い (レイヤー強度は不採用 — ADR-0010) ([examples/house/](examples/house/))。base層が共有の基盤 (通り芯・レベル) を一度だけ宣言し、建具アセット・敷地・各フロアを `import` で重ねる。分担して書かれた層は加算で合成され、衝突 (パスやアセット名の重複、gridの再宣言) は出所 (ファイル:行) つきのビルドエラーになる。`koyu check main.muro` が一棟のビルドの門番。建具の型は `asset` (RevitのFamily、USDのReference) — インスタンスが参照して上書きし (`door SD1 sill:800`)、開口の位置は通り芯の言葉で書けて (`at:Y2+1820`) はみ出し・重なりが検査される (ADR-0010)。
56
+
32
57
  ## 使い方
33
58
 
34
59
  ```sh
@@ -41,6 +66,7 @@ npm run koyu -- doors examples/two-rooms.muro /L1/a /out # → 2枚
41
66
  npm run koyu -- graph examples/two-rooms.muro # 空間グラフ
42
67
  npm run koyu -- stats examples/two-rooms.muro # 面積 (壁芯)
43
68
  npm run koyu -- json examples/two-rooms.muro # 正準JSON (機械形式)
69
+ npm run koyu -- diff a.muro b.muro # 構成の言葉のsemantic diff
44
70
 
45
71
  npm run koyu -- plan examples/office.muro -l L2 # レベル別の平面図
46
72
  npm run koyu -- levels examples/office.muro # テキストの矩計 (高さの積み上がり)
@@ -48,11 +74,17 @@ npm run koyu -- doors examples/office.muro /L2/office /out # → 4枚 (階段
48
74
  npm run koyu -- stats examples/mansion.muro # 面積・ゾーン集計・専有率
49
75
  npm run koyu -- light examples/mansion.muro # 採光 1/7 の粗い判定
50
76
  npm run koyu -- site examples/house.muro # 敷地面積・接道・建蔽率・容積率
77
+ npm run koyu -- check examples/house/main.muro # 複数ファイル合成のビルド門番
78
+ npm run koyu -- site examples/tower/main.muro # ショーケース: polygon敷地・2道路・容積率
51
79
  ```
52
80
 
81
+ ## LLM接続
82
+
83
+ `koyu-mcp` は依存ゼロのMCPサーバー (stdio、ADR-0012)。LLMエージェントが建物を読み (`layers`)、編集し (`write_layer`)、`check` がビルドの門番になる — エラーは出所レイヤー:行つき。`doors` / `light` / `site` は同じ記述への異なる問い。延床4,786㎡のショーケース一棟が原本8,099トークン (実測 — IFC4は14倍、IFCXは25倍: [examples/comparison/](examples/comparison/README.md)) なので、一棟がコンテキストに余裕で載る。エージェントが正しく*編集*できるかは次の分水嶺 — 編集evalは計画段階でまだ実施していない ([docs/horizon.md](docs/horizon.md))。三軸の構想 (デジタルツイン・W3C BOTへのオントロジー整列・都市接続) も同文書。
84
+
53
85
  ## 構成
54
86
 
55
- 記法の仕様と書き比べは [spec/notation-v0.md](spec/notation-v0.md)、属性の付け方の契約は [spec/vocabulary.md](spec/vocabulary.md)、IFC4とのカバレッジ照合は [docs/ifc-coverage.md](docs/ifc-coverage.md)、設計判断の記録は [docs/decisions/](docs/decisions/)、行程は [docs/roadmap.md](docs/roadmap.md) (Linear: [koyu](https://linear.app/munipersonal/project/koyu-2789f588a03a/overview) と対応)、日々の記録は [docs/log/](docs/log/)。実装は src/ に約900行 (パーサ・グラフ・チェック・平面図生成・CLI)、テストは test/。IFCXの読解メモは [docs/ifcx-notes.md](docs/ifcx-notes.md)、同じ二室一扉をIFC4・IFCXで書いた三方比較は [examples/comparison/](examples/comparison/README.md)。
87
+ 現在の仕様は [spec/](spec/README.md) に体系化した — 言語リファレンス ([language.md](spec/language.md))・意味論 ([semantics.md](spec/semantics.md))・語彙の台帳 ([vocabulary.md](spec/vocabulary.md))・正準JSON・ツールリファレンス (CLI/MCP/API)。ADRは「なぜ」を、specは「いま何が真か」を持つ。記法の成立記録 (DSL/YAML/JSON書き比べ) は [spec/notation-v0.md](spec/notation-v0.md)、IFC4とのカバレッジ照合は [docs/ifc-coverage.md](docs/ifc-coverage.md)、設計判断の記録は [docs/decisions/](docs/decisions/)、行程は [docs/roadmap.md](docs/roadmap.md) (Linear: [koyu](https://linear.app/munipersonal/project/koyu-2789f588a03a/overview) と対応)、日々の記録は [docs/log/](docs/log/)。実装は src/ に約7,500行 (パーサ・グラフ・チェック・平面図生成・CLI・MCPサーバー)、テストは test/。IFCXの読解メモは [docs/ifcx-notes.md](docs/ifcx-notes.md)、同じ二室をIFC4・IFCXで書いた三方比較は [examples/comparison/](examples/comparison/README.md)。
56
88
 
57
89
  ## 技術方針
58
90
 
package/README.md CHANGED
@@ -5,31 +5,64 @@
5
5
 
6
6
  [日本語](README.ja.md)
7
7
 
8
- An exploration of text-native architectural description with **space as the primary element**. A wall is not a thing — it is the boundary between two spaces. An opening is a connection cut into a boundary. Form is not source — it is generated. A whole building fits in a few hundred lines of text, which puts architecture on the same ground as git, LLMs, and city-scale data. The full argument (in Japanese) is in [docs/writing-architecture.md](docs/writing-architecture.md).
8
+ An exploration of text-native architectural description with **space as the primary element**. A wall is not a thing — it is the boundary between two spaces. An opening is a connection cut into a boundary. What is authored is spatial regions and the boundary relations between them; the form of building components is not source — it is generated. A whole building fits in a few hundred lines of text, which puts architecture on the same ground as git and LLMs, and makes it light enough to be a candidate for city-scale connection. The full argument (in Japanese) is in [docs/writing-architecture.md](docs/writing-architecture.md).
9
9
 
10
- Two rooms and one door are written like this (full file: [examples/two-rooms.muro](examples/two-rooms.muro)):
10
+ ## Documentation
11
11
 
12
+ The prose is split into two books, in Japanese. Start at the guide; consult the reference.
13
+
14
+ - **[guide/](guide/README.md)** — the guide: a tutorial that goes from one room to a two-storey house in 30–45 minutes, the six concepts, how-to recipes, the diagnostic-code handbook, and the CLI and API references. **If you are learning koyu, start at [guide/start.md](guide/start.md).**
15
+ - **[spec/](spec/README.md)** — the normative reference: grammar, semantics, the attribute ledger, canonical JSON, tool contracts. Present tense, no history.
16
+ - **[docs/decisions/](docs/decisions/)** — the ADRs: why each decision was made and what was rejected.
17
+ - **[AGENTS.md](AGENTS.md)** — the entry point for LLM agents working in this repository.
18
+
19
+ One room is written like this. Four lines, and it is a complete file.
20
+
21
+ ```muro
22
+ grid X 0 3600
23
+ grid Y 0 4000
24
+ level L1 0
25
+ space /L1/a room X1..X2 Y1..Y2
12
26
  ```
13
- space /L1/a room X1..X2 Y1..Y2 name:居室A
14
- space /L1/b room X2..X3 Y1..Y2 name:居室B
15
- space /out exterior name:外部
16
27
 
17
- boundary /L1/a /L1/b t:120 spec:PW1
18
- door w:780 h:2000
28
+ `koyu plan` produces the floor plan. Not one wall is drawn — there is a space, but not one boundary.
29
+
30
+ ![Plan of a single room](guide/img/start-01-one-room.svg)
31
+
32
+ Add one more `space` line. Change nothing else.
33
+
34
+ ```muro
35
+ grid X 0 3600 5400
36
+ grid Y 0 4000
37
+ level L1 0
38
+ space /L1/a room X1..X2 Y1..Y2
39
+ space /L1/b room X2..X3 Y1..Y2
19
40
  ```
20
41
 
21
- The floor plan is generated from this. There is no operation that draws a wall — walls are derived from the layout of spaces.
42
+ ![Plan of two rooms, with a wall standing between them](guide/img/start-02-two-rooms.svg)
22
43
 
23
- ![Plan of two rooms and one door](docs/img/two-rooms.svg)
44
+ **A wall appears. There is no operation anywhere that draws a wall.** A wall is the boundary relation between two spaces, derived from the layout of those spaces. Where a pair of touching spaces has no declaration, that means "wall" rather than "undefined".
24
45
 
25
46
  A two-story office — corridor, core, offset walls off the grid lines, stairs/elevator, vertical consistency — is about 100 lines ([examples/office.muro](examples/office.muro)). The resolution is schematic-design level. Not modeling downstand beams is not an omission but a chosen level of abstraction: the early design phase, where BIM has always been too heavy, is exactly where this notation lives. Vertical consistency is enforced as a declared invariant — ceiling height + slab above ≤ floor-to-floor height (ADR-0002).
26
47
 
27
48
  ![Office level 1 plan](docs/img/office-L1.svg)
28
49
 
29
- A 10-story double-loaded apartment building — 43 units, elevator + exterior stair, roof, unit type A with its interior layout — is **183 lines** ([examples/mansion.muro](examples/mansion.muro)). The typical floor is written once and the span `/L2..L9/A` expands it across eight floors (ADR-0004). An L-shaped living room is a union of rectangles; units are `zone`s (counted aggregation), so subdividing a unit into rooms never loses the language of net area (ADR-0005). A double-height void is a vertical boundary of `type:void` — even the absence of a floor is written as a boundary (ADR-0006). `doors` answers "how many doors from the 9th-floor living room to the street"; `light` gives a first-pass check of the 1/7 daylighting ratio for habitable rooms.
50
+ A 10-story double-loaded apartment building — 43 units, elevator + exterior stair, roof, unit type A with its interior layout — is **187 lines** ([examples/mansion.muro](examples/mansion.muro)). The typical floor is written once and the span `/L2..L9/A` expands it across eight floors (ADR-0004). An L-shaped living room is a union of rectangles; units are `zone`s (counted aggregation), so subdividing a unit into rooms never loses the language of net area (ADR-0005). A double-height void is a vertical boundary of `type:void` — even the absence of a floor is written as a boundary (ADR-0006). `doors` answers "how many doors from the 9th-floor living room to the street"; `light` gives a first-pass check of the 1/7 daylighting ratio for habitable rooms.
30
51
 
31
52
  ![Apartment typical floor plan](docs/img/mansion-L5.svg)
32
53
 
54
+ The full-feature showcase is **[examples/tower/](examples/tower/)** — an 11-storey mixed-use corner building (retail below, housing above, a penthouse floor, ~4,786m² GFA) composed from 9 files. Its site is an irregular pentagon: site shape is the one thing this notation allows to be *written* as geometry (`polygon`, ADR-0011), because a site's shape is surveyed input from the world, not designed form — it lives in its own quarantined layer (site-geometry.muro) and the derived area, building containment, and the site boundary line on the plan all follow from it. Everything else demonstrates the rest of the notation at once: a two-storey entrance void, interlocking L-shaped units, balconies, a low-rise roof terrace written as an exception-floor *diff layer*, door/window assets with an auto-door, explicit grid-referenced positions, and one unit type subdivided into rooms. 178 spaces / 543 boundaries check clean; 66 habitable rooms pass the 1/7 daylight test; "how many doors from the 9th-floor living room to the street" answers 4.
55
+
56
+ A building can also be written as a set of files and composed — additive layering inspired by USD, with no silent overrides (layer strength is deliberately not adopted, ADR-0010) ([examples/house/](examples/house/)): a base layer declares the shared foundation (grid, levels) exactly once and `import`s the door/window assets, the site, and each floor — authored separately, merged additively, with conflicts (duplicate paths, duplicate asset names, re-declared grids) rejected at build time with file:line provenance. `koyu check main.muro` is the build gate for the whole building. Door/window types are `asset`s — Revit's Family, USD's Reference — referenced by instances that override their defaults (`door SD1 sill:800`), and opening positions can be written against the grid (`at:Y2+1820`) with overflow and overlap validated (ADR-0010).
57
+
58
+ ## Getting started
59
+
60
+ 1. **Install.** Clone this repository and run `npm install`.
61
+ 2. **Write the four lines above** into `first.muro`, then run `npx tsx src/cli.ts check first.muro` and `npx tsx src/cli.ts plan first.muro -o out/first.svg`.
62
+ 3. **Read a bundled example.** `npx tsx src/cli.ts check examples/two-rooms.muro` prints `✔ 整合 — 空間 3 / 境界 3`; `stats`, `graph`, and `doors` answer about the same file.
63
+
64
+ `grid` and `level` must be declared before anything that refers to them, and the type (`room`, the second positional word) is required; everything else — the `koyu` version line, `unit`, `name`, heights — is optional. From here, [guide/start.md](guide/start.md) (Japanese) is a managed path from this one room to a two-storey house with per-floor plans, a circulation check, and a daylight check.
65
+
33
66
  ## Usage
34
67
 
35
68
  ```sh
@@ -42,6 +75,7 @@ npm run koyu -- doors examples/two-rooms.muro /L1/a /out # → 2 doors
42
75
  npm run koyu -- graph examples/two-rooms.muro # the space graph
43
76
  npm run koyu -- stats examples/two-rooms.muro # areas (centerline)
44
77
  npm run koyu -- json examples/two-rooms.muro # canonical JSON (machine form)
78
+ npm run koyu -- diff a.muro b.muro # semantic diff, in the language of composition
45
79
 
46
80
  npm run koyu -- plan examples/office.muro -l L2 # per-level plans
47
81
  npm run koyu -- levels examples/office.muro # a textual section (height stack-up)
@@ -49,11 +83,17 @@ npm run koyu -- doors examples/office.muro /L2/office /out # → 4 doors (via
49
83
  npm run koyu -- stats examples/mansion.muro # areas, zone rollups, efficiency ratio
50
84
  npm run koyu -- light examples/mansion.muro # rough 1/7 daylight check
51
85
  npm run koyu -- site examples/house.muro # site area, frontage, coverage, FAR
86
+ npm run koyu -- check examples/house/main.muro # multi-file composition: the build gate
87
+ npm run koyu -- site examples/tower/main.muro # showcase: polygon site, two roads, FAR
52
88
  ```
53
89
 
90
+ ## LLM connection
91
+
92
+ `koyu-mcp` is a zero-dependency MCP server over stdio (ADR-0012): an LLM agent reads the building (`layers`), edits it (`write_layer`), and `check` acts as the build gate — errors come back with layer:line provenance. `doors` / `light` / `site` / `stats` are the same description read different ways. The whole 4,786m² showcase is 8,099 tokens as source (measured; IFC4 is 14x, IFCX 25x — see [examples/comparison/](examples/comparison/README.md)), so a whole building fits in one context with room to work. Whether an agent can *edit* it correctly is the next watershed — an edit eval is planned, not yet run ([docs/horizon.md](docs/horizon.md)). The horizon design (digital twin, ontology alignment via W3C BOT, city connection) is in the same document.
93
+
54
94
  ## Layout
55
95
 
56
- The notation spec and side-by-side comparisons are in [spec/notation-v0.md](spec/notation-v0.md); the contract for attributes is [spec/vocabulary.md](spec/vocabulary.md); coverage against the IFC4 architectural core is [docs/ifc-coverage.md](docs/ifc-coverage.md); design decisions are recorded in [docs/decisions/](docs/decisions/); the roadmap is [docs/roadmap.md](docs/roadmap.md); daily logs are in [docs/log/](docs/log/). The implementation is ~900 lines in src/ (parser, graph, checks, plan generation, CLI), tests in test/. Reading notes on IFCX are in [docs/ifcx-notes.md](docs/ifcx-notes.md); the same two-rooms-one-door written three ways (this notation, IFC4, IFCX) is in [examples/comparison/](examples/comparison/README.md).
96
+ The learning material lives in [guide/](guide/README.md) — tutorial, concepts, how-to, diagnostics, CLI/API. The current specification lives in [spec/](spec/README.md) — language reference, semantics (derivations, checks, queries), the attribute ledger, the canonical JSON format, and the tool reference (CLI / MCP / API). ADRs record why decisions were made; spec/ states what is true now. The historical record of how the notation was chosen (with the DSL/YAML/JSON comparison) is [spec/notation-v0.md](spec/notation-v0.md); coverage against the IFC4 architectural core is [docs/ifc-coverage.md](docs/ifc-coverage.md); design decisions are recorded in [docs/decisions/](docs/decisions/); the roadmap is [docs/roadmap.md](docs/roadmap.md); daily logs are in [docs/log/](docs/log/). The implementation is ~7,500 lines in src/ (parser, graph, checks, plan generation, CLI, MCP server), tests in test/. Reading notes on IFCX are in [docs/ifcx-notes.md](docs/ifcx-notes.md); the same two rooms written three ways (this notation, IFC4, IFCX) is in [examples/comparison/](examples/comparison/README.md).
57
97
 
58
98
  ## Technical stance
59
99
 
package/dist/axo.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { type Model } from "./model.js";
2
+ export interface AxoOptions {
3
+ /** 見る向き — 建物のどの隅から見下ろすか (既定 SE) */
4
+ dir?: "NE" | "NW" | "SE" | "SW";
5
+ /** px per mm (既定 0.02) */
6
+ scale?: number;
7
+ /** 描くレベル (既定すべて) */
8
+ levels?: string[];
9
+ /** 天井も描く (既定 false — 描くと中が見えない) */
10
+ ceilings?: boolean;
11
+ /** 壁を描く (既定 true) */
12
+ walls?: boolean;
13
+ }
14
+ /** 軸測図のSVG。ソースに形は無い — ここに出るものはすべて規則からの生成物である */
15
+ export declare function svgAxo(model: Model, opts?: AxoOptions): string;
16
+ //# sourceMappingURL=axo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axo.d.ts","sourceRoot":"","sources":["../src/axo.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,KAAK,EAEX,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyBD,gDAAgD;AAChD,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM,CA6JlE"}
package/dist/axo.js ADDED
@@ -0,0 +1,211 @@
1
+ // koyu — 軸測図 (アクソメ) の生成 (ADR-0026)
2
+ // 平面図が「そのレベルで切った断面」であるのに対し、これは立体をそのまま投影した図である。
3
+ // WebGLも実行環境も要らない — 平面と同じく SVG のテキストが出るので、
4
+ // 生成して見る、という同じ手で立体を確かめられる。
5
+ //
6
+ // 描くのは**生成物だけ**である。床・屋根 (fabric.ts)、壁 (境界から)、柱 (通りの交点から)、
7
+ // 縦動線 (vertical.ts)。どれもソースには無く、規則から現れる。
8
+ import { slabs } from "./fabric.js";
9
+ import { segmentsFor } from "./graph.js";
10
+ import { columnsFor, levelsSorted, rectToPoly, } from "./model.js";
11
+ import { runSolids, verticalRuns } from "./vertical.js";
12
+ const INK = "#1f1f1f";
13
+ const PAPER = "#faf8f4";
14
+ const C = {
15
+ floor: "#cfc7b6",
16
+ roof: "#8d8577",
17
+ ceiling: "#e2dbca",
18
+ wall: "#b8b0a0",
19
+ column: "#5d574d",
20
+ run: "#7f8f8a",
21
+ ground: "#eceadf",
22
+ opening: "#f2efe6",
23
+ };
24
+ /** 軸測図のSVG。ソースに形は無い — ここに出るものはすべて規則からの生成物である */
25
+ export function svgAxo(model, opts = {}) {
26
+ const scale = opts.scale ?? 0.02;
27
+ const dir = opts.dir ?? "SE";
28
+ const levels = levelsSorted(model).filter((l) => !opts.levels || opts.levels.includes(l.name));
29
+ const names = new Set(levels.map((l) => l.name));
30
+ // 見る向き: 平面を90度ずつ回してから等角に落とす
31
+ const turn = { NE: 0, NW: 1, SW: 2, SE: 3 }[dir];
32
+ const rot = (p) => {
33
+ let { x, y } = p;
34
+ for (let i = 0; i < turn; i++)
35
+ [x, y] = [y, -x];
36
+ return { x, y };
37
+ };
38
+ const K = Math.cos(Math.PI / 6);
39
+ const S = Math.sin(Math.PI / 6);
40
+ const proj = (p, z) => {
41
+ const q = rot(p);
42
+ return [(q.x - q.y) * K, (q.x + q.y) * S - z];
43
+ };
44
+ /** 手前ほど大きい。等角の視線は (1,1,1) なので x+y+z で並べる */
45
+ const depthOf = (p, z) => {
46
+ const q = rot(p);
47
+ return q.x + q.y + z;
48
+ };
49
+ const prisms = [];
50
+ const add = (poly, bottom, top, fill) => {
51
+ if (poly.length < 3)
52
+ return;
53
+ const b = Array.isArray(bottom) ? bottom : poly.map(() => bottom);
54
+ const t = Array.isArray(top) ? top : poly.map(() => top);
55
+ const cx = poly.reduce((a, p) => a + p.x, 0) / poly.length;
56
+ const cy = poly.reduce((a, p) => a + p.y, 0) / poly.length;
57
+ const cz = t.reduce((a, v) => a + v, 0) / t.length;
58
+ prisms.push({ poly, bottom: b, top: t, fill, depth: depthOf({ x: cx, y: cy }, cz) });
59
+ };
60
+ // ---- 敷地 (地盤面) ----
61
+ for (const poly of model.polygons.values())
62
+ add(poly.points, -400, -100, C.ground);
63
+ // ---- 床・屋根 (ADR-0024) ----
64
+ for (const sl of slabs(model)) {
65
+ if (!names.has(sl.level))
66
+ continue;
67
+ if (sl.kind === "ceiling" && !opts.ceilings)
68
+ continue;
69
+ add(sl.outline, sl.z0, sl.z1, sl.kind === "roof" ? C.roof : sl.kind === "floor" ? C.floor : C.ceiling);
70
+ }
71
+ // ---- 壁 (境界から生成) と開口 ----
72
+ if (opts.walls !== false) {
73
+ for (const b of model.boundaries) {
74
+ if (b.kind !== "wall")
75
+ continue;
76
+ const sa = model.spaces.get(b.a);
77
+ const sb = model.spaces.get(b.b);
78
+ const room = sa && sa.rects.length > 0 ? sa : sb;
79
+ if (!room?.level || !names.has(room.level))
80
+ continue;
81
+ const z0 = model.levels[room.level].z;
82
+ const h = pitchOf(model, room.level);
83
+ const t = b.air ? Math.min(b.t ?? 60, 80) : (b.t ?? 100);
84
+ const top = b.air ? z0 + (typeof b.attrs["h"] === "number" ? b.attrs["h"] : 1100) : z0 + h;
85
+ for (const seg of segmentsFor(model, b))
86
+ add(thicken(seg, t), z0, top, C.wall);
87
+ }
88
+ }
89
+ // ---- 柱 (ADR-0023) ----
90
+ for (const l of levels) {
91
+ const h = pitchOf(model, l.name);
92
+ for (const c of columnsFor(model, l.name)) {
93
+ add(rectToPoly({ x1: c.x - c.w / 2, y1: c.y - c.d / 2, x2: c.x + c.w / 2, y2: c.y + c.d / 2 }), l.z, l.z + h, C.column);
94
+ }
95
+ }
96
+ // ---- 縦動線 (ADR-0021) — 段は段として、斜路は傾いた版として ----
97
+ for (const run of verticalRuns(model)) {
98
+ if (!names.has(run.level))
99
+ continue;
100
+ for (const s of runSolids(run)) {
101
+ if (s.kind === "box") {
102
+ add(rectToPoly(s.rect), s.z0, s.z1, C.run);
103
+ continue;
104
+ }
105
+ // 傾いた版: 四隅の高さを走る向きに線形で振る
106
+ const poly = rectToPoly(s.rect);
107
+ const f = (p) => {
108
+ const r = s.rect;
109
+ const u = s.up === "E"
110
+ ? (p.x - r.x1) / Math.max(1, r.x2 - r.x1)
111
+ : s.up === "W"
112
+ ? (r.x2 - p.x) / Math.max(1, r.x2 - r.x1)
113
+ : s.up === "N"
114
+ ? (p.y - r.y1) / Math.max(1, r.y2 - r.y1)
115
+ : (r.y2 - p.y) / Math.max(1, r.y2 - r.y1);
116
+ return s.z0 + u * (s.z1 - s.z0);
117
+ };
118
+ add(poly, poly.map((p) => f(p) - s.t), poly.map(f), C.run);
119
+ }
120
+ }
121
+ if (prisms.length === 0)
122
+ throw new Error("描くものがありません");
123
+ // ---- 投影して奥から描く (画家のアルゴリズム) ----
124
+ prisms.sort((a, b) => a.depth - b.depth);
125
+ const pts = [];
126
+ for (const pr of prisms) {
127
+ for (let i = 0; i < pr.poly.length; i++) {
128
+ pts.push(proj(pr.poly[i], pr.top[i]), proj(pr.poly[i], pr.bottom[i]));
129
+ }
130
+ }
131
+ const minX = Math.min(...pts.map((p) => p[0]));
132
+ const maxX = Math.max(...pts.map((p) => p[0]));
133
+ const minY = Math.min(...pts.map((p) => p[1]));
134
+ const maxY = Math.max(...pts.map((p) => p[1]));
135
+ const M = 40;
136
+ const W = (maxX - minX) * scale + M * 2;
137
+ const H = (maxY - minY) * scale + M * 2;
138
+ const sx = (v) => (v - minX) * scale + M;
139
+ const sy = (v) => (v - minY) * scale + M;
140
+ const out = [
141
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" font-family="'Hiragino Sans','Noto Sans JP',sans-serif">`,
142
+ `<rect width="${W}" height="${H}" fill="${PAPER}"/>`,
143
+ ];
144
+ const face = (ring, fill, shade) => {
145
+ const d = ring.map(([x, y], i) => `${i === 0 ? "M" : "L"} ${r2(sx(x))} ${r2(sy(y))}`).join(" ");
146
+ return `<path d="${d} Z" fill="${tint(fill, shade)}" stroke="${INK}" stroke-width="0.35" stroke-opacity="0.5"/>`;
147
+ };
148
+ for (const pr of prisms) {
149
+ const n = pr.poly.length;
150
+ // 側面: 投影して時計回り (面積が負) のものだけが手前を向く
151
+ for (let i = 0; i < n; i++) {
152
+ const j = (i + 1) % n;
153
+ const quad = [
154
+ proj(pr.poly[i], pr.top[i]),
155
+ proj(pr.poly[j], pr.top[j]),
156
+ proj(pr.poly[j], pr.bottom[j]),
157
+ proj(pr.poly[i], pr.bottom[i]),
158
+ ];
159
+ if (signedArea(quad) <= 0)
160
+ continue;
161
+ // 面の向きで陰影を変える (東西面と南北面)
162
+ const dx = pr.poly[j].x - pr.poly[i].x;
163
+ const dy = pr.poly[j].y - pr.poly[i].y;
164
+ out.push(face(quad, pr.fill, Math.abs(dx) > Math.abs(dy) ? 0.82 : 0.68));
165
+ }
166
+ const top = pr.poly.map((p, i) => proj(p, pr.top[i]));
167
+ out.push(face(top, pr.fill, 1));
168
+ }
169
+ out.push(`<text x="${M - 24}" y="${H - 12}" font-size="11" fill="${INK}">${esc(model.name ?? "無題")} — 軸測 (${dir}から)</text>`, `<text x="${W - M + 24}" y="${H - 12}" text-anchor="end" font-size="8.5" fill="#a49b8a">koyu — 空間から生成 (床・屋根・壁・柱・縦動線)</text>`, "</svg>");
170
+ return out.join("\n") + "\n";
171
+ }
172
+ /** レベルの階高 (次のレベルまで)。最上階は天井高+slabで近似 */
173
+ function pitchOf(model, level) {
174
+ const l = model.levels[level];
175
+ const up = Object.values(model.levels)
176
+ .filter((o) => o.z > l.z)
177
+ .sort((a, b) => a.z - b.z)[0];
178
+ return up ? up.z - l.z : (l.h ?? 2400) + (l.slab ?? 0);
179
+ }
180
+ /** 壁芯線分を厚みのある四角形へ (斜めの線分もそのまま扱える) */
181
+ function thicken(seg, t) {
182
+ const dx = seg.x2 - seg.x1;
183
+ const dy = seg.y2 - seg.y1;
184
+ const len = Math.hypot(dx, dy) || 1;
185
+ const nx = (-dy / len) * (t / 2);
186
+ const ny = (dx / len) * (t / 2);
187
+ return [
188
+ { x: seg.x1 + nx, y: seg.y1 + ny },
189
+ { x: seg.x2 + nx, y: seg.y2 + ny },
190
+ { x: seg.x2 - nx, y: seg.y2 - ny },
191
+ { x: seg.x1 - nx, y: seg.y1 - ny },
192
+ ];
193
+ }
194
+ function signedArea(ring) {
195
+ let a = 0;
196
+ for (let i = 0; i < ring.length; i++) {
197
+ const p = ring[i];
198
+ const q = ring[(i + 1) % ring.length];
199
+ a += p[0] * q[1] - q[0] * p[1];
200
+ }
201
+ return a / 2;
202
+ }
203
+ /** 面の向きによる陰影 */
204
+ function tint(hex, k) {
205
+ const n = parseInt(hex.slice(1), 16);
206
+ const ch = [n >> 16, (n >> 8) & 255, n & 255].map((v) => Math.round(Math.min(255, v * k)));
207
+ return `#${ch.map((v) => v.toString(16).padStart(2, "0")).join("")}`;
208
+ }
209
+ const r2 = (v) => Math.round(v * 100) / 100;
210
+ const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
211
+ //# sourceMappingURL=axo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axo.js","sourceRoot":"","sources":["../src/axo.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAC/C,2CAA2C;AAC3C,2BAA2B;AAC3B,EAAE;AACF,0DAA0D;AAC1D,wCAAwC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAC;AACvD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,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G,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,MAAM,EAAE,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC5D,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { type Model } from "./model.js";
2
+ export interface CheckResult {
3
+ errors: string[];
4
+ warnings: string[];
5
+ }
6
+ /** 構造化診断 (ADR-0016)。message は本文のみ — 位置接頭辞「file:N行目: 」を含まない */
7
+ export interface Diagnostic {
8
+ /** 台帳 DIAGNOSTIC_CODES のコード (領域2-3字 + 2桁連番) */
9
+ code: DiagnosticCode;
10
+ severity: "error" | "warning";
11
+ /** 日本語の本文 (位置接頭辞なし) */
12
+ message: string;
13
+ /** 出所の行 (位置を持たない診断は省略) */
14
+ line?: number;
15
+ /** 出所レイヤー (合成時) */
16
+ file?: string;
17
+ /** 対象の空間/ゾーン/polygonのパス (境界は両パス) */
18
+ path?: string[];
19
+ /** 関連位置 (重複の既出側・重なりの相手など) */
20
+ related?: Array<{
21
+ line: number;
22
+ file?: string;
23
+ }>;
24
+ }
25
+ /**
26
+ * 診断コードの台帳 — 全コードと規範severity。specの表 (semantics.md §5) とテストで一致を守る。
27
+ * BND07 は欠番 — 「接しているのに境界が無い」警告はADR-0014 (既定境界) で廃止された。
28
+ * SYN01 は構文・合成エラー (SourceError) の写し — checkは例外を診断にしない。CLIの check --json だけが写す。
29
+ */
30
+ export declare const DIAGNOSTIC_CODES: {
31
+ readonly REF01: "error";
32
+ readonly BND01: "error";
33
+ readonly BND02: "error";
34
+ readonly BND03: "error";
35
+ readonly BND04: "error";
36
+ readonly BND05: "warning";
37
+ readonly BND06: "warning";
38
+ readonly LVL01: "error";
39
+ readonly GEO01: "error";
40
+ readonly GEO02: "error";
41
+ readonly VRT01: "error";
42
+ readonly VRT02: "error";
43
+ readonly VRT03: "error";
44
+ readonly VRT04: "warning";
45
+ readonly VRT05: "warning";
46
+ readonly VRT06: "warning";
47
+ readonly OPN01: "error";
48
+ readonly OPN02: "error";
49
+ readonly OPN03: "warning";
50
+ readonly OPN04: "error";
51
+ readonly OPN05: "error";
52
+ readonly OPN06: "error";
53
+ readonly OPN07: "error";
54
+ readonly OPN08: "error";
55
+ readonly SEG01: "error";
56
+ readonly SEG02: "warning";
57
+ readonly SEG03: "warning";
58
+ readonly SEG04: "error";
59
+ readonly SEG05: "error";
60
+ readonly SEG06: "error";
61
+ readonly SEG07: "error";
62
+ readonly SEG08: "error";
63
+ readonly ZON01: "warning";
64
+ readonly ZON02: "warning";
65
+ readonly HGT01: "error";
66
+ readonly HGT02: "error";
67
+ readonly HGT03: "warning";
68
+ readonly HGT04: "warning";
69
+ readonly HGT05: "warning";
70
+ readonly SIT01: "error";
71
+ readonly SIT02: "error";
72
+ readonly SIT03: "error";
73
+ readonly SIT04: "warning";
74
+ readonly SIT05: "warning";
75
+ readonly UID01: "error";
76
+ readonly UID02: "error";
77
+ readonly UID03: "error";
78
+ readonly ATT01: "error";
79
+ readonly ATT02: "error";
80
+ readonly DAY01: "error";
81
+ readonly RUN01: "error";
82
+ readonly RUN02: "error";
83
+ readonly RUN03: "error";
84
+ readonly RUN04: "warning";
85
+ readonly RUN05: "error";
86
+ readonly RUN06: "warning";
87
+ readonly RUN07: "warning";
88
+ readonly RUN08: "warning";
89
+ readonly LIN01: "error";
90
+ readonly LIN02: "error";
91
+ readonly LIN03: "warning";
92
+ readonly ENV01: "warning";
93
+ readonly COL01: "warning";
94
+ readonly COL02: "warning";
95
+ readonly VER01: "error";
96
+ readonly VER02: "error";
97
+ readonly VER03: "error";
98
+ readonly SYN01: "error";
99
+ };
100
+ /**
101
+ * 診断コードの型 (ADR-0016)。台帳が唯一の出所であり、**登録していないコードは型が通らない**。
102
+ * 以前は Record<string, ...> だったので、台帳に無いコードを emit すると severity が
103
+ * undefined になり、error が黙って warning に落ち、--strict でも終了コード0になった。
104
+ * 「忘れる自由は無い」という契約を、文ではなく型が守る。
105
+ */
106
+ export type DiagnosticCode = keyof typeof DIAGNOSTIC_CODES;
107
+ export declare function check(model: Model): CheckResult;
108
+ export declare function checkDiagnostics(model: Model): Diagnostic[];
109
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAuF,KAAK,KAAK,EAUvG,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,8DAA8D;AAC9D,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE2B,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAyE3D,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAQ/C;AA+BD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CA0D3D"}