@kensnzk/koyu 0.19.0 → 0.20.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/README.ja.md +3 -1
- package/README.md +4 -2
- package/dist/analysis/contracts.d.ts +11 -1
- package/dist/analysis/contracts.d.ts.map +1 -1
- package/dist/analysis/contracts.js +11 -1
- package/dist/analysis/contracts.js.map +1 -1
- package/dist/cli.js +15 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/diagnose.d.ts +1 -0
- package/dist/core/diagnose.d.ts.map +1 -1
- package/dist/core/diagnose.js +1 -0
- package/dist/core/diagnose.js.map +1 -1
- package/dist/core/diff.d.ts.map +1 -1
- package/dist/core/diff.js +4 -1
- package/dist/core/diff.js.map +1 -1
- package/dist/core/model.d.ts +157 -6
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/model.js +196 -8
- package/dist/core/model.js.map +1 -1
- package/dist/core/parse.d.ts.map +1 -1
- package/dist/core/parse.js +42 -11
- package/dist/core/parse.js.map +1 -1
- package/dist/form.d.ts +1 -0
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +5 -0
- package/dist/form.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +12 -2
- package/dist/mcp.js.map +1 -1
- package/dist/model.d.ts +1 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +1 -1
- package/dist/model.js.map +1 -1
- package/dist/validate/contracts.d.ts +6 -1
- package/dist/validate/contracts.d.ts.map +1 -1
- package/dist/validate/contracts.js +6 -1
- package/dist/validate/contracts.js.map +1 -1
- package/editors/vscode/package.json +1 -1
- package/editors/vscode/syntaxes/koyu.tmLanguage.json +55 -55
- package/examples/basement/main.muro +1 -1
- package/examples/complex/main.muro +1 -1
- package/examples/house/main.muro +1 -1
- package/examples/house.muro +1 -1
- package/examples/mansion.muro +1 -1
- package/examples/office.muro +1 -1
- package/examples/steps/06-finished.muro +1 -1
- package/examples/tower/main.muro +1 -1
- package/examples/twin/main.muro +1 -1
- package/examples/two-rooms.canonical.json +2 -2
- package/examples/two-rooms.muro +1 -1
- package/package.json +16 -2
- package/src/analysis/contracts.ts +11 -1
- package/src/cli.ts +16 -2
- package/src/core/diagnose.ts +1 -0
- package/src/core/diff.ts +4 -1
- package/src/core/model.ts +207 -7
- package/src/core/parse.ts +57 -9
- package/src/form.ts +13 -0
- package/src/index.ts +5 -0
- package/src/mcp.ts +18 -2
- package/src/model.ts +6 -0
- package/src/validate/contracts.ts +6 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
3
|
-
"name": "
|
|
4
|
-
"scopeName": "source.
|
|
3
|
+
"name": "muro",
|
|
4
|
+
"scopeName": "source.muro",
|
|
5
5
|
"fileTypes": ["muro"],
|
|
6
6
|
"information_for_contributors": [
|
|
7
7
|
"koyu (.muro) の TextMate 文法。VS Code と Shiki (Docusaurus) が同じこの一枚を読む — ADR-0031。",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"repository": {
|
|
40
40
|
"string": {
|
|
41
41
|
"comment": "引用符の中は空白も # も保たれる (tokenize) — コメントより先に食う",
|
|
42
|
-
"name": "string.quoted.double.
|
|
42
|
+
"name": "string.quoted.double.muro",
|
|
43
43
|
"begin": "\"",
|
|
44
44
|
"end": "\"",
|
|
45
45
|
"patterns": [{ "match": "." }]
|
|
@@ -47,180 +47,180 @@
|
|
|
47
47
|
"comment": {
|
|
48
48
|
"comment": "引用符の外の # 以降は行末までコメント",
|
|
49
49
|
"match": "#.*$",
|
|
50
|
-
"name": "comment.line.number-sign.
|
|
50
|
+
"name": "comment.line.number-sign.muro"
|
|
51
51
|
},
|
|
52
52
|
"line-version": {
|
|
53
|
-
"match": "^(koyu)[ \\t]+([0-9][0-9.]*)",
|
|
53
|
+
"match": "^(koyu|muro)[ \\t]+([0-9][0-9.]*)",
|
|
54
54
|
"captures": {
|
|
55
|
-
"1": { "name": "keyword.control.directive.
|
|
56
|
-
"2": { "name": "constant.numeric.version.
|
|
55
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
56
|
+
"2": { "name": "constant.numeric.version.muro" }
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"line-unit": {
|
|
60
60
|
"match": "^(unit)[ \\t]+([^\\s#]+)",
|
|
61
61
|
"captures": {
|
|
62
|
-
"1": { "name": "keyword.control.directive.
|
|
63
|
-
"2": { "name": "constant.language.
|
|
62
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
63
|
+
"2": { "name": "constant.language.muro" }
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"line-name": {
|
|
67
67
|
"comment": "建物の名 — 行の残りが自由語 (日本語可)",
|
|
68
68
|
"match": "^(name)[ \\t]+([^#\\n]*)",
|
|
69
69
|
"captures": {
|
|
70
|
-
"1": { "name": "keyword.control.directive.
|
|
71
|
-
"2": { "name": "string.unquoted.
|
|
70
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
71
|
+
"2": { "name": "string.unquoted.muro" }
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"line-import": {
|
|
75
75
|
"match": "^(import)[ \\t]+([^\\s#]+)",
|
|
76
76
|
"captures": {
|
|
77
|
-
"1": { "name": "keyword.control.import.
|
|
78
|
-
"2": { "name": "string.unquoted.path.
|
|
77
|
+
"1": { "name": "keyword.control.import.muro" },
|
|
78
|
+
"2": { "name": "string.unquoted.path.muro" }
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"line-asset": {
|
|
82
82
|
"comment": "asset <名> door|window ...",
|
|
83
83
|
"match": "^(asset)[ \\t]+(?![^\\s#\"]*:)([^\\s#]+)[ \\t]+(door|window)\\b",
|
|
84
84
|
"captures": {
|
|
85
|
-
"1": { "name": "keyword.control.directive.
|
|
86
|
-
"2": { "name": "entity.name.function.asset.
|
|
87
|
-
"3": { "name": "support.type.
|
|
85
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
86
|
+
"2": { "name": "entity.name.function.asset.muro" },
|
|
87
|
+
"3": { "name": "support.type.muro" }
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"line-grid": {
|
|
91
91
|
"match": "^(grid)[ \\t]+([XY])\\b",
|
|
92
92
|
"captures": {
|
|
93
|
-
"1": { "name": "keyword.control.directive.
|
|
94
|
-
"2": { "name": "constant.language.axis.
|
|
93
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
94
|
+
"2": { "name": "constant.language.axis.muro" }
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"line-level": {
|
|
98
98
|
"comment": "level <名|等差範囲> <z> ... — 名はモデル全体の参照子",
|
|
99
99
|
"match": "^(level)[ \\t]+(?![^\\s#\"]*:)([^\\s#]+)",
|
|
100
100
|
"captures": {
|
|
101
|
-
"1": { "name": "keyword.control.directive.
|
|
102
|
-
"2": { "name": "entity.name.type.level.
|
|
101
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
102
|
+
"2": { "name": "entity.name.type.level.muro" }
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"line-stack": {
|
|
106
106
|
"match": "^(stack)[ \\t]+(?![^\\s#\"]*:)([^\\s#]+)",
|
|
107
107
|
"captures": {
|
|
108
|
-
"1": { "name": "keyword.control.directive.
|
|
109
|
-
"2": { "name": "entity.name.function.stack.
|
|
108
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
109
|
+
"2": { "name": "entity.name.function.stack.muro" }
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"line-band": {
|
|
113
113
|
"match": "^(band)[ \\t]+([XY])\\b",
|
|
114
114
|
"captures": {
|
|
115
|
-
"1": { "name": "keyword.control.directive.
|
|
116
|
-
"2": { "name": "constant.language.axis.
|
|
115
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
116
|
+
"2": { "name": "constant.language.axis.muro" }
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
"line-boundary": {
|
|
120
120
|
"comment": "boundary <パス> <パス> — 壁は物ではなく二つの空間の関係である",
|
|
121
121
|
"match": "^(boundary)[ \\t]+(/[^\\s#\"]+)[ \\t]+(/[^\\s#\"]+)",
|
|
122
122
|
"captures": {
|
|
123
|
-
"1": { "name": "keyword.control.directive.
|
|
124
|
-
"2": { "name": "entity.name.type.path.
|
|
125
|
-
"3": { "name": "entity.name.type.path.
|
|
123
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
124
|
+
"2": { "name": "entity.name.type.path.muro" },
|
|
125
|
+
"3": { "name": "entity.name.type.path.muro" }
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
"line-zone": {
|
|
129
129
|
"match": "^(zone)[ \\t]+(/[^\\s#\"]+)",
|
|
130
130
|
"captures": {
|
|
131
|
-
"1": { "name": "keyword.control.directive.
|
|
132
|
-
"2": { "name": "entity.name.type.path.
|
|
131
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
132
|
+
"2": { "name": "entity.name.type.path.muro" }
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
"line-polygon": {
|
|
136
136
|
"match": "^(polygon)[ \\t]+(/[^\\s#\"]+)",
|
|
137
137
|
"captures": {
|
|
138
|
-
"1": { "name": "keyword.control.directive.
|
|
139
|
-
"2": { "name": "entity.name.type.path.
|
|
138
|
+
"1": { "name": "keyword.control.directive.muro" },
|
|
139
|
+
"2": { "name": "entity.name.type.path.muro" }
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
"line-space": {
|
|
143
143
|
"comment": "space <パス> <型> ... — 字下げした space は帯 (band) の要素。型は開かれた語彙",
|
|
144
144
|
"match": "^([ \\t]*)(space)[ \\t]+(/[^\\s#\"]+)(?:[ \\t]+(?![^\\s#\"]*:)([^\\s#]+))?",
|
|
145
145
|
"captures": {
|
|
146
|
-
"2": { "name": "keyword.control.directive.
|
|
147
|
-
"3": { "name": "entity.name.type.path.
|
|
148
|
-
"4": { "name": "support.type.
|
|
146
|
+
"2": { "name": "keyword.control.directive.muro" },
|
|
147
|
+
"3": { "name": "entity.name.type.path.muro" },
|
|
148
|
+
"4": { "name": "support.type.muro" }
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
"line-opening": {
|
|
152
152
|
"comment": "door/window の第1トークンが k:v でなければアセット参照 (ADR-0010)",
|
|
153
153
|
"match": "^([ \\t]+)(door|window)[ \\t]+(?![^\\s#\"]*:)([^\\s#]+)",
|
|
154
154
|
"captures": {
|
|
155
|
-
"2": { "name": "keyword.other.child.
|
|
156
|
-
"3": { "name": "entity.name.function.asset.
|
|
155
|
+
"2": { "name": "keyword.other.child.muro" },
|
|
156
|
+
"3": { "name": "entity.name.function.asset.muro" }
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
"keyword-child": {
|
|
160
160
|
"comment": "字下げして書く語 — src/core/parse.ts の indented 分岐。+ / - / = は over の下の集合編集 (ADR-0035)",
|
|
161
161
|
"match": "^[ \\t]+(door|window|seg|line|area|space)\\b",
|
|
162
|
-
"captures": { "1": { "name": "keyword.other.child.
|
|
162
|
+
"captures": { "1": { "name": "keyword.other.child.muro" } }
|
|
163
163
|
},
|
|
164
164
|
"keyword-edit": {
|
|
165
165
|
"comment": "over の下の集合編集 — + 追加 / - 削除 / = 置換 (ADR-0035)",
|
|
166
166
|
"match": "^[ \\t]+([+=-])(?=[ \\t])",
|
|
167
|
-
"captures": { "1": { "name": "keyword.operator.edit.
|
|
167
|
+
"captures": { "1": { "name": "keyword.operator.edit.muro" } }
|
|
168
168
|
},
|
|
169
169
|
"keyword-directive": {
|
|
170
170
|
"comment": "行頭に書く語 — src/core/parse.ts の switch (head)",
|
|
171
|
-
"match": "^(koyu|import|over|drop|asset|polygon|origin|azimuth|name|unit|grid|level|column|band|space|boundary|zone|stack)\\b",
|
|
172
|
-
"captures": { "1": { "name": "keyword.control.directive.
|
|
171
|
+
"match": "^(koyu|muro|import|over|drop|asset|polygon|origin|azimuth|name|unit|grid|level|column|band|space|boundary|zone|stack)\\b",
|
|
172
|
+
"captures": { "1": { "name": "keyword.control.directive.muro" } }
|
|
173
173
|
},
|
|
174
174
|
"path": {
|
|
175
175
|
"comment": "空間・ゾーンのパス — /L1/a /out /L2..L9/A",
|
|
176
176
|
"match": "(?:^|[ \\t])(/[^\\s#\"]*)",
|
|
177
|
-
"captures": { "1": { "name": "entity.name.type.path.
|
|
177
|
+
"captures": { "1": { "name": "entity.name.type.path.muro" } }
|
|
178
178
|
},
|
|
179
179
|
"attr-ledger": {
|
|
180
180
|
"comment": "The ledger keys that are not carrier-tier — the attributes the tools act on. ATTR_LEDGER in src/core/vocabulary.ts is the contract; free k:v gets a different colour",
|
|
181
181
|
"match": "\\b(underground|escalator|elevation|daylight|northing|vertical|ceiling|landing|outside|easting|hinge|level|riser|slope|stair|style|swing|tread|pitch|entry|lane|lift|form|road|slab|site|area|turn|type|edge|name|ramp|void|epsg|uid|air|use|at|h|w|t|d|x|y)(:)",
|
|
182
182
|
"captures": {
|
|
183
|
-
"1": { "name": "entity.other.attribute-name.
|
|
184
|
-
"2": { "name": "punctuation.separator.key-value.
|
|
183
|
+
"1": { "name": "entity.other.attribute-name.muro" },
|
|
184
|
+
"2": { "name": "punctuation.separator.key-value.muro" }
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
187
|
"attr-free": {
|
|
188
188
|
"comment": "台帳に無い k:v — 運ばれるが解釈されない (規則2・3)",
|
|
189
189
|
"match": "\\b([A-Za-z_][A-Za-z0-9_-]*)(:)",
|
|
190
190
|
"captures": {
|
|
191
|
-
"1": { "name": "variable.other.property.
|
|
192
|
-
"2": { "name": "punctuation.separator.key-value.
|
|
191
|
+
"1": { "name": "variable.other.property.muro" },
|
|
192
|
+
"2": { "name": "punctuation.separator.key-value.muro" }
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
"gridref": {
|
|
196
196
|
"comment": "通り芯参照とオフセット — X2 / X2+600 / X1..X2 / X1+3200..X2+3200",
|
|
197
197
|
"match": "\\b([XY][0-9]+)((?:[+-][0-9]+)?)(?:(\\.\\.)([XY][0-9]+)((?:[+-][0-9]+)?))?",
|
|
198
198
|
"captures": {
|
|
199
|
-
"1": { "name": "constant.language.gridref.
|
|
200
|
-
"2": { "name": "constant.numeric.offset.
|
|
201
|
-
"3": { "name": "keyword.operator.range.
|
|
202
|
-
"4": { "name": "constant.language.gridref.
|
|
203
|
-
"5": { "name": "constant.numeric.offset.
|
|
199
|
+
"1": { "name": "constant.language.gridref.muro" },
|
|
200
|
+
"2": { "name": "constant.numeric.offset.muro" },
|
|
201
|
+
"3": { "name": "keyword.operator.range.muro" },
|
|
202
|
+
"4": { "name": "constant.language.gridref.muro" },
|
|
203
|
+
"5": { "name": "constant.numeric.offset.muro" }
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
"range": {
|
|
207
207
|
"comment": "レベルの範囲 — B2..L5 L14..L19",
|
|
208
208
|
"match": "\\b([A-Za-z][A-Za-z0-9_]*)(\\.\\.)([A-Za-z][A-Za-z0-9_]*)\\b",
|
|
209
209
|
"captures": {
|
|
210
|
-
"1": { "name": "entity.name.type.level.
|
|
211
|
-
"2": { "name": "keyword.operator.range.
|
|
212
|
-
"3": { "name": "entity.name.type.level.
|
|
210
|
+
"1": { "name": "entity.name.type.level.muro" },
|
|
211
|
+
"2": { "name": "keyword.operator.range.muro" },
|
|
212
|
+
"3": { "name": "entity.name.type.level.muro" }
|
|
213
213
|
}
|
|
214
214
|
},
|
|
215
215
|
"union": {
|
|
216
216
|
"comment": "領域の合併 — L字は矩形を + でつなぐ",
|
|
217
217
|
"match": "(?<=[ \\t])\\+(?=[ \\t])",
|
|
218
|
-
"name": "keyword.operator.union.
|
|
218
|
+
"name": "keyword.operator.union.muro"
|
|
219
219
|
},
|
|
220
220
|
"number": {
|
|
221
221
|
"comment": "長さはmm、面積は㎡、比率は0..1。名の中の数字 (南区画01) は数値ではないので、前後が区切りのときだけ採る",
|
|
222
222
|
"match": "(?<![^\\s,:])-?[0-9]+(?:\\.[0-9]+)?(?![^\\s,#])",
|
|
223
|
-
"name": "constant.numeric.
|
|
223
|
+
"name": "constant.numeric.muro"
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|
package/examples/house/main.muro
CHANGED
package/examples/house.muro
CHANGED
package/examples/mansion.muro
CHANGED
package/examples/office.muro
CHANGED
package/examples/tower/main.muro
CHANGED
package/examples/twin/main.muro
CHANGED
package/examples/two-rooms.muro
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kensnzk/koyu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
|
+
"muro": {
|
|
5
|
+
"reads": [
|
|
6
|
+
"0.1",
|
|
7
|
+
"0.2",
|
|
8
|
+
"0.3",
|
|
9
|
+
"0.4",
|
|
10
|
+
"0.5",
|
|
11
|
+
"1.0",
|
|
12
|
+
"1.1",
|
|
13
|
+
"1.2"
|
|
14
|
+
],
|
|
15
|
+
"newest": "1.2",
|
|
16
|
+
"undeclared": "1.1"
|
|
17
|
+
},
|
|
4
18
|
"description": "空間を一次要素とするテキストネイティブ建築記述の探求 — writing architecture, not buildings",
|
|
5
19
|
"type": "module",
|
|
6
20
|
"main": "./dist/index.js",
|
|
@@ -82,7 +96,7 @@
|
|
|
82
96
|
"gate:examples": "node --import tsx scripts/gate.mjs",
|
|
83
97
|
"plan:examples": "tsx src/cli.ts plan examples/two-rooms.muro -o out/two-rooms.svg",
|
|
84
98
|
"conformance": "node --import tsx --test test/conformance.test.ts",
|
|
85
|
-
"gate:docs": "npm --prefix website run gate:canonical && npm --prefix website run check:navigation"
|
|
99
|
+
"gate:docs": "npm --prefix website run prepare:content && npm --prefix website run gate:canonical && npm --prefix website run check:navigation"
|
|
86
100
|
},
|
|
87
101
|
"devDependencies": {
|
|
88
102
|
"@types/node": "^22.0.0",
|
|
@@ -218,7 +218,17 @@ export interface AnalysisResult<T extends JsonValue = JsonValue> {
|
|
|
218
218
|
readonly artifact: AnalysisArtifact<T>;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
/**
|
|
222
|
+
* The name of the shape an analysis returns. **It carries no version, deliberately.**
|
|
223
|
+
*
|
|
224
|
+
* A version promises that something is worth checking against — and nothing checks this. It
|
|
225
|
+
* is written by `assess` and read by no one; the face it sits on is the one the project
|
|
226
|
+
* declares unfrozen, so a `/1` on it would announce a stability nobody intends to keep.
|
|
227
|
+
*
|
|
228
|
+
* The counter-example is `koyu-context/1`, the input this protocol takes: that one is checked
|
|
229
|
+
* on arrival and refused on mismatch, which is what makes its version worth carrying.
|
|
230
|
+
*/
|
|
231
|
+
export const ANALYSIS_FORMAT = "koyu-analysis" as const;
|
|
222
232
|
|
|
223
233
|
export interface AnalysisReport<T extends JsonValue = JsonValue> {
|
|
224
234
|
readonly schema: typeof ANALYSIS_FORMAT;
|
package/src/cli.ts
CHANGED
|
@@ -35,7 +35,8 @@ import {
|
|
|
35
35
|
type Model,
|
|
36
36
|
srcRef,
|
|
37
37
|
isOutside,
|
|
38
|
-
isVoid
|
|
38
|
+
isVoid,
|
|
39
|
+
versionLine
|
|
39
40
|
} from "./core/model.js";
|
|
40
41
|
import { parseFile } from "./parse-file.js";
|
|
41
42
|
import { svgPlan } from "./draw/plan.js";
|
|
@@ -190,6 +191,18 @@ function firstModelLine(evidence: AssessmentReport["findings"][number]["outcome"
|
|
|
190
191
|
|
|
191
192
|
function main(argv: string[]): number {
|
|
192
193
|
const [cmd, file, ...rest] = argv;
|
|
194
|
+
// Asked before the usage text, because it takes no file and a tool that cannot state its
|
|
195
|
+
// own version sends the reader to package.json to find out what they are running.
|
|
196
|
+
if (cmd === "--version" || cmd === "-v") {
|
|
197
|
+
// It takes no file, so being handed one is a calling mistake like any other. Printing the
|
|
198
|
+
// version and exiting 0 would let a wrapper that passes the wrong flag look like it worked.
|
|
199
|
+
if (file !== undefined) {
|
|
200
|
+
console.error(`--version takes no arguments: ${[file, ...rest].join(" ")}`);
|
|
201
|
+
return 2;
|
|
202
|
+
}
|
|
203
|
+
console.log(versionLine());
|
|
204
|
+
return 0;
|
|
205
|
+
}
|
|
193
206
|
if (!cmd || !file) {
|
|
194
207
|
console.log(
|
|
195
208
|
"Usage: koyu <check|validate|layers|diff|plan|axo|doors|graph|stats|levels|runs|light|site|json> <file.muro> [args...]\n" +
|
|
@@ -240,7 +253,8 @@ function main(argv: string[]): number {
|
|
|
240
253
|
// check --json は構文・合成エラー (SourceError) でも有効JSONを返す — SYN01 の1件に写す (ADR-0016)
|
|
241
254
|
if (cmd === "check" && rest.includes("--json") && e instanceof SourceError) {
|
|
242
255
|
const d: Diagnostic = {
|
|
243
|
-
code
|
|
256
|
+
// A parse failure that named its own condition keeps that code; the rest are syntax.
|
|
257
|
+
code: e.code ?? "SYN01",
|
|
244
258
|
severity: "error",
|
|
245
259
|
message: e.raw,
|
|
246
260
|
...(e.line ? { line: e.line } : {}),
|
package/src/core/diagnose.ts
CHANGED
|
@@ -126,6 +126,7 @@ export const DIAGNOSTIC_CODES = {
|
|
|
126
126
|
VER03: "error", // koyu 0.4以前のファイルに0.5の語 (縦動線・線・柱・地下)
|
|
127
127
|
VER04: "error", // koyu 0.5以前のファイルに1.0の語 (over・drop・集合編集 — ADR-0035/0038)
|
|
128
128
|
VER05: "error", // koyu 1.0以前のファイルの型の位置に exterior / void (ADR-0051)
|
|
129
|
+
VER06: "error", // the file declares a language version newer than this build reads
|
|
129
130
|
SYN01: "error", // 構文・合成エラー (SourceError の写し — check --json のみ)
|
|
130
131
|
} as const satisfies Record<string, "error" | "warning">;
|
|
131
132
|
|
package/src/core/diff.ts
CHANGED
|
@@ -686,7 +686,10 @@ export function renderDiff(d: ModelDiff): string[] {
|
|
|
686
686
|
else if (g.kind === "added") out.push(`+ grid ${g.axis} ${g.name} ${g.to}`);
|
|
687
687
|
else out.push(`− grid ${g.axis} ${g.name} ${g.from}`);
|
|
688
688
|
}
|
|
689
|
-
|
|
689
|
+
// **The label names the language, not the implementation.** It also may not be the written
|
|
690
|
+
// declaration: from 1.2 the word is `muro`, so printing `koyu 1.2` would show a line the
|
|
691
|
+
// parser refuses. This is a label for a change, not a copy of either file's first line.
|
|
692
|
+
if (d.version) out.push(`± muro ${d.version.from} → ${d.version.to}`);
|
|
690
693
|
if (d.name) out.push(`± name ${d.name.from ?? "—"} → ${d.name.to ?? "—"}`);
|
|
691
694
|
for (const n of d.levels.added) out.push(`+ level ${n}`);
|
|
692
695
|
for (const n of d.levels.removed) out.push(`− level ${n}`);
|