@kensnzk/koyu 0.17.0 → 0.18.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/dist/analysis/contracts.d.ts +217 -0
- package/dist/analysis/contracts.d.ts.map +1 -0
- package/dist/analysis/contracts.js +27 -0
- package/dist/analysis/contracts.js.map +1 -0
- package/dist/analysis/index.d.ts +5 -0
- package/dist/analysis/index.d.ts.map +1 -0
- package/dist/analysis/index.js +17 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/analysis/json.d.ts +21 -0
- package/dist/analysis/json.d.ts.map +1 -0
- package/dist/analysis/json.js +111 -0
- package/dist/analysis/json.js.map +1 -0
- package/dist/cli.js +94 -26
- package/dist/cli.js.map +1 -1
- package/dist/core/site.d.ts +9 -0
- package/dist/core/site.d.ts.map +1 -1
- package/dist/core/site.js +6 -0
- package/dist/core/site.js.map +1 -1
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +3 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/diff.d.ts +2 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +3 -0
- package/dist/diff.js.map +1 -0
- package/dist/form.d.ts +5 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +4 -0
- package/dist/form.js.map +1 -0
- package/dist/graph.d.ts +2 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +3 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +2 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -50
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +40 -20
- package/dist/mcp.js.map +1 -1
- package/dist/model.d.ts +3 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +3 -0
- package/dist/model.js.map +1 -0
- package/dist/validate/assessment.d.ts +8 -0
- package/dist/validate/assessment.d.ts.map +1 -0
- package/dist/validate/assessment.js +1738 -0
- package/dist/validate/assessment.js.map +1 -0
- package/dist/validate/builtin/access.d.ts +55 -0
- package/dist/validate/builtin/access.d.ts.map +1 -0
- package/dist/validate/builtin/access.js +494 -0
- package/dist/validate/builtin/access.js.map +1 -0
- package/dist/validate/builtin/daylight.d.ts +44 -0
- package/dist/validate/builtin/daylight.d.ts.map +1 -0
- package/dist/validate/builtin/daylight.js +233 -0
- package/dist/validate/builtin/daylight.js.map +1 -0
- package/dist/validate/builtin/door-column-collisions.d.ts +47 -0
- package/dist/validate/builtin/door-column-collisions.d.ts.map +1 -0
- package/dist/validate/builtin/door-column-collisions.js +189 -0
- package/dist/validate/builtin/door-column-collisions.js.map +1 -0
- package/dist/validate/builtin/envelope.d.ts +30 -0
- package/dist/validate/builtin/envelope.d.ts.map +1 -0
- package/dist/validate/builtin/envelope.js +169 -0
- package/dist/validate/builtin/envelope.js.map +1 -0
- package/dist/validate/builtin/freeze.d.ts +3 -0
- package/dist/validate/builtin/freeze.d.ts.map +1 -0
- package/dist/validate/builtin/freeze.js +21 -0
- package/dist/validate/builtin/freeze.js.map +1 -0
- package/dist/validate/builtin/index.d.ts +38 -0
- package/dist/validate/builtin/index.d.ts.map +1 -0
- package/dist/validate/builtin/index.js +106 -0
- package/dist/validate/builtin/index.js.map +1 -0
- package/dist/validate/builtin/site.d.ts +62 -0
- package/dist/validate/builtin/site.d.ts.map +1 -0
- package/dist/validate/builtin/site.js +333 -0
- package/dist/validate/builtin/site.js.map +1 -0
- package/dist/validate/builtin/vertical-runs.d.ts +53 -0
- package/dist/validate/builtin/vertical-runs.d.ts.map +1 -0
- package/dist/validate/builtin/vertical-runs.js +290 -0
- package/dist/validate/builtin/vertical-runs.js.map +1 -0
- package/dist/validate/contracts.d.ts +188 -0
- package/dist/validate/contracts.d.ts.map +1 -0
- package/dist/validate/contracts.js +28 -0
- package/dist/validate/contracts.js.map +1 -0
- package/dist/validate/index.d.ts +2 -59
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +22 -70
- package/dist/validate/index.js.map +1 -1
- package/dist/vocabulary.d.ts +2 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +3 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +37 -5
- package/src/analysis/contracts.ts +234 -0
- package/src/analysis/index.ts +61 -0
- package/src/analysis/json.ts +117 -0
- package/src/cli.ts +103 -28
- package/src/core/site.ts +17 -0
- package/src/diagnostics.ts +8 -0
- package/src/diff.ts +14 -0
- package/src/form.ts +37 -0
- package/src/graph.ts +12 -0
- package/src/index.ts +39 -195
- package/src/mcp.ts +42 -25
- package/src/model.ts +43 -0
- package/src/validate/assessment.ts +1934 -0
- package/src/validate/builtin/access.ts +642 -0
- package/src/validate/builtin/daylight.ts +321 -0
- package/src/validate/builtin/door-column-collisions.ts +266 -0
- package/src/validate/builtin/envelope.ts +227 -0
- package/src/validate/builtin/freeze.ts +19 -0
- package/src/validate/builtin/index.ts +156 -0
- package/src/validate/builtin/site.ts +445 -0
- package/src/validate/builtin/vertical-runs.ts +390 -0
- package/src/validate/contracts.ts +240 -0
- package/src/validate/index.ts +45 -99
- package/src/vocabulary.ts +9 -0
- package/dist/validate/access.d.ts +0 -6
- package/dist/validate/access.d.ts.map +0 -1
- package/dist/validate/access.js +0 -248
- package/dist/validate/access.js.map +0 -1
- package/dist/validate/envelope.d.ts +0 -4
- package/dist/validate/envelope.d.ts.map +0 -1
- package/dist/validate/envelope.js +0 -55
- package/dist/validate/envelope.js.map +0 -1
- package/dist/validate/light.d.ts +0 -6
- package/dist/validate/light.d.ts.map +0 -1
- package/dist/validate/light.js +0 -28
- package/dist/validate/light.js.map +0 -1
- package/dist/validate/runs.d.ts +0 -16
- package/dist/validate/runs.d.ts.map +0 -1
- package/dist/validate/runs.js +0 -60
- package/dist/validate/runs.js.map +0 -1
- package/dist/validate/site.d.ts +0 -6
- package/dist/validate/site.d.ts.map +0 -1
- package/dist/validate/site.js +0 -63
- package/dist/validate/site.js.map +0 -1
- package/src/validate/access.ts +0 -291
- package/src/validate/envelope.ts +0 -59
- package/src/validate/light.ts +0 -43
- package/src/validate/runs.ts +0 -87
- package/src/validate/site.ts +0 -84
package/src/cli.ts
CHANGED
|
@@ -18,7 +18,9 @@ import { check, checkDiagnostics, type Diagnostic } from "./core/diagnose.js";
|
|
|
18
18
|
import { renderDiff, semanticDiff } from "./core/diff.js";
|
|
19
19
|
import { doorsBetween, neighbors } from "./core/graph.js";
|
|
20
20
|
import { daylightInputs } from "./core/light.js";
|
|
21
|
-
import {
|
|
21
|
+
import { assess } from "./validate/assessment.js";
|
|
22
|
+
import { AssessmentConfigError, type AssessmentReport } from "./validate/contracts.js";
|
|
23
|
+
import { createSchematicRegistry, SCHEMATIC_PROFILE_ID } from "./validate/builtin/index.js";
|
|
22
24
|
import { siteReport } from "./core/site.js";
|
|
23
25
|
import {
|
|
24
26
|
areaM2,
|
|
@@ -119,13 +121,80 @@ function enumOpt<T extends string>(
|
|
|
119
121
|
return raw as T;
|
|
120
122
|
}
|
|
121
123
|
|
|
124
|
+
/** The one profile koyu ships. Any other name is the caller's, and this build cannot resolve it. */
|
|
125
|
+
const BUILTIN_PROFILE = SCHEMATIC_PROFILE_ID.id;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Run a rule set over the model.
|
|
129
|
+
*
|
|
130
|
+
* The profile and the effective date are **required**. Neither is guessed from the filename,
|
|
131
|
+
* the locale, the environment or the clock: a judgement whose grounds were inferred cannot be
|
|
132
|
+
* reproduced, and one that quietly picked a default is worse than one that refused to start.
|
|
133
|
+
*/
|
|
134
|
+
function runAssessment(model: Model, rest: string[]): AssessmentReport {
|
|
135
|
+
const profile = opt(rest, "-p", "--profile");
|
|
136
|
+
if (!profile) {
|
|
137
|
+
die(
|
|
138
|
+
"validate needs an explicit profile: --profile <id>\n" +
|
|
139
|
+
` koyu ships one: ${BUILTIN_PROFILE}`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (profile !== BUILTIN_PROFILE) {
|
|
143
|
+
die(`Unknown profile: ${profile}\n koyu ships one: ${BUILTIN_PROFILE}`);
|
|
144
|
+
}
|
|
145
|
+
const asOf = opt(rest, "--as-of");
|
|
146
|
+
if (!asOf) {
|
|
147
|
+
die(
|
|
148
|
+
"validate needs an explicit effective date: --as-of YYYY-MM-DD\n" +
|
|
149
|
+
" the date is not read from the clock, so that the same file judges the same way twice",
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
return assess(model, {
|
|
155
|
+
registry: createSchematicRegistry(),
|
|
156
|
+
profile: SCHEMATIC_PROFILE_ID,
|
|
157
|
+
context: { schema: "koyu-context/1", asOf, values: {} },
|
|
158
|
+
});
|
|
159
|
+
} catch (e) {
|
|
160
|
+
// Configuration is the caller's problem, so it exits like a usage error rather than a verdict.
|
|
161
|
+
if (e instanceof AssessmentConfigError) die(`✖ ${e.message}`);
|
|
162
|
+
throw e;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 0 only when the whole set ran and nothing was violated.
|
|
168
|
+
*
|
|
169
|
+
* A caution that failed still exits 0 — it is a doubt, not a breach. But an indeterminate rule,
|
|
170
|
+
* a rule that errored, or an inconsistent model exits 1: **not being able to judge is not the
|
|
171
|
+
* same as passing**, and silence there is exactly what this exit code exists to prevent.
|
|
172
|
+
*/
|
|
173
|
+
function assessmentExit(report: AssessmentReport): number {
|
|
174
|
+
if (report.summary.state !== "complete") return 1;
|
|
175
|
+
if (report.model.state !== "consistent") return 1;
|
|
176
|
+
return report.findings.some((f) => f.level === "violation") ? 1 : 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** The first model-anchored line among a finding's evidence, formatted like every other locator. */
|
|
180
|
+
function firstModelLine(evidence: AssessmentReport["findings"][number]["outcome"]["evidence"]): string {
|
|
181
|
+
for (const item of evidence) {
|
|
182
|
+
for (const source of item.sources) {
|
|
183
|
+
if (source.kind === "model" && source.location?.line !== undefined) {
|
|
184
|
+
return `${srcRef(source.location.line, source.location.file)}: `;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return "";
|
|
189
|
+
}
|
|
190
|
+
|
|
122
191
|
function main(argv: string[]): number {
|
|
123
192
|
const [cmd, file, ...rest] = argv;
|
|
124
193
|
if (!cmd || !file) {
|
|
125
194
|
console.log(
|
|
126
195
|
"Usage: koyu <check|validate|layers|diff|plan|axo|doors|graph|stats|levels|runs|light|site|json> <file.muro> [args...]\n" +
|
|
127
196
|
" check: --json (emit Diagnostic[] as JSON) / --strict (exit 1 if there are warnings) — structural consistency only\n" +
|
|
128
|
-
" validate: --
|
|
197
|
+
" validate: --profile <id> --as-of <YYYY-MM-DD> [--json] — architectural judgement (not what check guarantees)\n" +
|
|
129
198
|
" layers: the layers that took part in composition, weakest first. --attrs for the provenance of each attribute\n" +
|
|
130
199
|
" diff: koyu diff <a.muro> <b.muro> [--json] — the difference in the language of composition (0=no difference / 1=differences / 2=the input is broken)",
|
|
131
200
|
);
|
|
@@ -210,26 +279,37 @@ function main(argv: string[]): number {
|
|
|
210
279
|
return 1;
|
|
211
280
|
}
|
|
212
281
|
case "validate": {
|
|
213
|
-
// 建築的な判定 (docs/reference/scope.md)。**check の保証ではない** —
|
|
214
|
-
//
|
|
215
|
-
|
|
282
|
+
// 建築的な判定 (docs/reference/scope.md)。**check の保証ではない** — 型も綴りも別である。
|
|
283
|
+
//
|
|
284
|
+
// profile と基準日は呼び出し側が明示する。管轄も基準日も推測せず、内蔵 profile を
|
|
285
|
+
// 黙って選ばない — 無根拠に成功して見える判定より、入力不足で止まる方を採る。
|
|
286
|
+
const report = runAssessment(model, rest);
|
|
216
287
|
if (rest.includes("--json")) {
|
|
217
|
-
console.log(JSON.stringify(
|
|
218
|
-
return
|
|
288
|
+
console.log(JSON.stringify(report, null, 1));
|
|
289
|
+
return assessmentExit(report);
|
|
219
290
|
}
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
291
|
+
for (const f of report.findings) {
|
|
292
|
+
const where = firstModelLine(f.outcome.evidence);
|
|
293
|
+
console.log(
|
|
294
|
+
`${f.level === "violation" ? "✖" : "⚠"} [${f.rule.id}] ${where}${f.outcome.message}`,
|
|
295
|
+
);
|
|
224
296
|
}
|
|
225
|
-
const violations = findings.filter((f) => f.level === "violation").length;
|
|
226
|
-
const cautions = findings.length - violations;
|
|
297
|
+
const violations = report.findings.filter((f) => f.level === "violation").length;
|
|
298
|
+
const cautions = report.findings.length - violations;
|
|
227
299
|
console.log(
|
|
228
|
-
findings.length === 0
|
|
300
|
+
report.findings.length === 0
|
|
229
301
|
? "✔ Nothing caught by validation (this is a judgement, not a guarantee about the composition)"
|
|
230
302
|
: `Validation — ${qty(violations, "violation", "violations")} / ${qty(cautions, "caution", "cautions")}`,
|
|
231
303
|
);
|
|
232
|
-
|
|
304
|
+
console.log(
|
|
305
|
+
` ${report.profile.id}@${report.profile.revision} — ` +
|
|
306
|
+
`${report.summary.rules.evaluated} evaluated / ${report.summary.rules.notApplicable} not applicable / ` +
|
|
307
|
+
`${report.summary.rules.indeterminate} indeterminate / ${report.summary.rules.error} error`,
|
|
308
|
+
);
|
|
309
|
+
if (report.summary.state === "incomplete") {
|
|
310
|
+
console.log(" Incomplete — something could not be judged, which is not the same as passing");
|
|
311
|
+
}
|
|
312
|
+
return assessmentExit(report);
|
|
233
313
|
}
|
|
234
314
|
case "layers": {
|
|
235
315
|
// 合成の規則1と6 (docs/reference/muro/import.md) — 強度順序を見せ、最終値の出所を言う。
|
|
@@ -381,30 +461,25 @@ function main(argv: string[]): number {
|
|
|
381
461
|
return 0;
|
|
382
462
|
}
|
|
383
463
|
case "light": {
|
|
384
|
-
//
|
|
385
|
-
//
|
|
464
|
+
// **数だけを返す。**床面積と有効窓面積は模型から出る事実であり、そこへ線を引くのは
|
|
465
|
+
// 規則の側の仕事である。閾値をここに書けば validate と二重になり、片方だけが古くなる
|
|
466
|
+
// (docs/reference/scope.md)。合否は koyu validate が言う
|
|
386
467
|
const inputs = daylightInputs(model);
|
|
387
468
|
if (inputs.length === 0) {
|
|
388
469
|
console.log("Nothing is in daylight scope (write daylight:1 on the rooms to be judged)");
|
|
389
470
|
return 0;
|
|
390
471
|
}
|
|
391
|
-
const failing = new Set(
|
|
392
|
-
validate(model).filter((f) => f.rule === "daylight.ratio").flatMap((f) => f.path ?? []),
|
|
393
|
-
);
|
|
394
472
|
for (const d of inputs) {
|
|
395
|
-
const ok = !failing.has(d.space.path);
|
|
396
473
|
const ratio = d.window > 0 ? `1/${(d.floor / d.window).toFixed(1)}` : "no window";
|
|
397
474
|
console.log(
|
|
398
|
-
|
|
475
|
+
` ${d.space.path}\t${displayName(d.space)}\twindow ${d.window.toFixed(2)} m2 / floor ${d.floor.toFixed(2)} m2 = ${ratio}` +
|
|
399
476
|
(d.missingH ? " ⚠ windows without h: are not counted" : ""),
|
|
400
477
|
);
|
|
401
478
|
}
|
|
402
479
|
console.log(
|
|
403
|
-
|
|
404
|
-
? `✔ Every room meets 1/7 — ${qty(inputs.length, "room", "rooms")} in scope (a rough judgement with no correction factor — this is validation, not what check guarantees)`
|
|
405
|
-
: `✖ Short of 1/7: ${failing.size} of ${qty(inputs.length, "room", "rooms")} (this is a validation judgement)`,
|
|
480
|
+
`${qty(inputs.length, "room", "rooms")} in daylight scope — these are numbers, not a verdict (koyu validate applies the rule)`,
|
|
406
481
|
);
|
|
407
|
-
return
|
|
482
|
+
return 0;
|
|
408
483
|
}
|
|
409
484
|
case "site": {
|
|
410
485
|
// 敷地の問い: 敷地面積・接道・建蔽率・容積率 (基本計画のボリューム検討の数字)
|
|
@@ -434,8 +509,8 @@ function main(argv: string[]): number {
|
|
|
434
509
|
` Road: ${road.road.path}${typeof nm === "string" ? ` (${nm})` : ""} width ${road.width}mm / frontage ${road.frontage}mm`,
|
|
435
510
|
);
|
|
436
511
|
}
|
|
437
|
-
console.log(` Building footprint (horizontal projection, rough): ${r.footprint.toFixed(2)} m2 → building coverage ratio ${
|
|
438
|
-
console.log(` Total floor area: ${r.totalFloor.toFixed(2)} m2 → floor area ratio ${
|
|
512
|
+
console.log(` Building footprint (horizontal projection, rough): ${r.footprint.toFixed(2)} m2 → building coverage ratio ${r.coveragePercent ?? "—"}%`);
|
|
513
|
+
console.log(` Total floor area: ${r.totalFloor.toFixed(2)} m2 → floor area ratio ${r.floorAreaRatioPercent ?? "—"}%`);
|
|
439
514
|
return 0;
|
|
440
515
|
}
|
|
441
516
|
case "axo": {
|
package/src/core/site.ts
CHANGED
|
@@ -38,6 +38,15 @@ export interface SiteReport {
|
|
|
38
38
|
footprint: number;
|
|
39
39
|
/** 延べ面積 m² (屋内床面積の合計) */
|
|
40
40
|
totalFloor: number;
|
|
41
|
+
/** 面積率の分母 — 宣言があれば宣言、無ければ導出 */
|
|
42
|
+
areaBasis: number;
|
|
43
|
+
/**
|
|
44
|
+
* 建蔽率 % (建築面積 ÷ 分母、小数第1位)。分母が 0 なら `undefined`。
|
|
45
|
+
* **数であって合否ではない** — 指定建蔽率と比べるのは規則の側の仕事である
|
|
46
|
+
*/
|
|
47
|
+
coveragePercent?: number;
|
|
48
|
+
/** 容積率 % (延べ面積 ÷ 分母、小数第1位)。分母が 0 なら `undefined` */
|
|
49
|
+
floorAreaRatioPercent?: number;
|
|
41
50
|
roads: RoadFrontage[];
|
|
42
51
|
}
|
|
43
52
|
|
|
@@ -78,6 +87,11 @@ export function siteReport(model: Model): SiteReport {
|
|
|
78
87
|
roads.push({ road, width: road.attrs["road"], frontage: Math.round(frontage) });
|
|
79
88
|
}
|
|
80
89
|
|
|
90
|
+
// 面積率は一箇所でだけ丸める。CLI・MCP・規則が各々で割れば、いずれ片方だけがずれる
|
|
91
|
+
const areaBasis = typeof declared === "number" ? declared : derivedArea;
|
|
92
|
+
const percent = (part: number): number | undefined =>
|
|
93
|
+
areaBasis === 0 ? undefined : Math.round((part / areaBasis) * 1000) / 10;
|
|
94
|
+
|
|
81
95
|
return {
|
|
82
96
|
...(siteZone ? { siteZone } : {}),
|
|
83
97
|
...(polygon ? { polygon } : {}),
|
|
@@ -85,6 +99,9 @@ export function siteReport(model: Model): SiteReport {
|
|
|
85
99
|
derivedArea,
|
|
86
100
|
footprint,
|
|
87
101
|
totalFloor,
|
|
102
|
+
areaBasis,
|
|
103
|
+
...(percent(footprint) !== undefined ? { coveragePercent: percent(footprint) } : {}),
|
|
104
|
+
...(percent(totalFloor) !== undefined ? { floorAreaRatioPercent: percent(totalFloor) } : {}),
|
|
88
105
|
roads,
|
|
89
106
|
};
|
|
90
107
|
}
|
package/src/diff.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Public semantic-diff surface. Text rendering remains a presentation concern.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
semanticDiff,
|
|
5
|
+
type BoundaryChange,
|
|
6
|
+
type BoundaryItem,
|
|
7
|
+
type ChangedItem,
|
|
8
|
+
type ColumnItem,
|
|
9
|
+
type FieldChange,
|
|
10
|
+
type GridChange,
|
|
11
|
+
type ModelDiff,
|
|
12
|
+
type RenamedItem,
|
|
13
|
+
type SpaceItem,
|
|
14
|
+
} from "./core/diff.js";
|
package/src/form.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Public Form surface. derive() is the only public operation that assembles shape.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
derive,
|
|
5
|
+
DERIVATION_CONSTANTS,
|
|
6
|
+
type DeriveOptions,
|
|
7
|
+
type Form,
|
|
8
|
+
type FormBoundary,
|
|
9
|
+
type FormColumn,
|
|
10
|
+
type FormInput,
|
|
11
|
+
type FormLevel,
|
|
12
|
+
type FormOpening,
|
|
13
|
+
type FormPanel,
|
|
14
|
+
type FormPlan,
|
|
15
|
+
type FormRun,
|
|
16
|
+
type FormSeg,
|
|
17
|
+
type FormSite,
|
|
18
|
+
type FormSpace,
|
|
19
|
+
type FormSwing,
|
|
20
|
+
type PlanClass,
|
|
21
|
+
type PlanEntity,
|
|
22
|
+
type PlanRole,
|
|
23
|
+
type PlanSubject,
|
|
24
|
+
} from "./core/derive.js";
|
|
25
|
+
|
|
26
|
+
export { TOLERANCES } from "./core/tolerance.js";
|
|
27
|
+
|
|
28
|
+
export type { Slab, SlabKind } from "./core/fabric.js";
|
|
29
|
+
|
|
30
|
+
export type {
|
|
31
|
+
RunDevice,
|
|
32
|
+
RunForm,
|
|
33
|
+
RunPart,
|
|
34
|
+
RunSolid,
|
|
35
|
+
Seg2,
|
|
36
|
+
VerticalRun,
|
|
37
|
+
} from "./core/vertical.js";
|
package/src/graph.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -1,211 +1,55 @@
|
|
|
1
|
-
// koyu —
|
|
1
|
+
// koyu — the root surface (`@kensnzk/koyu`)
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// export
|
|
5
|
-
//
|
|
3
|
+
// **Only the names written down here are promised.** `export *` is never used: the moment a
|
|
4
|
+
// module gains an export, a promise nobody declared would freeze into the surface. A surface
|
|
5
|
+
// that freezes has to be written out by hand (docs/reference/scope.md).
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
7
|
+
// **root is not a shorthand for every subpath.** What lives here is the minimum needed to begin
|
|
8
|
+
// the standard loop — read a `.muro`, confirm it is not self-contradictory, and take the
|
|
9
|
+
// canonical form — plus the types those signatures cannot be written without. Domain names
|
|
10
|
+
// (`model`, `graph`, `form`, `analysis`, `validate`, `draw`, `node`) are **not** re-exported
|
|
11
|
+
// from here. A caller who needs a domain names that domain, and the import line then says which
|
|
12
|
+
// contract is being relied on: the face that freezes, the face that computes from external
|
|
13
|
+
// conditions, the face that concludes, the presentation that may change freely, and the
|
|
14
|
+
// Node-specific adapter never get mixed together.
|
|
15
15
|
//
|
|
16
|
-
//
|
|
16
|
+
// root is browser-safe: nothing reachable from here pulls a Node builtin.
|
|
17
|
+
//
|
|
18
|
+
// The twelve entry points:
|
|
19
|
+
//
|
|
20
|
+
// @kensnzk/koyu this file — compose, check, canonicalise
|
|
21
|
+
// @kensnzk/koyu/model Model, and the questions the model answers alone
|
|
22
|
+
// @kensnzk/koyu/diagnostics structural-consistency diagnostics
|
|
23
|
+
// @kensnzk/koyu/graph adjacency, passability, routes, boundary segments
|
|
24
|
+
// @kensnzk/koyu/form the one derivation of shape
|
|
25
|
+
// @kensnzk/koyu/analysis facts made under an explicit context and profile
|
|
26
|
+
// @kensnzk/koyu/diff the semantic difference between two models
|
|
27
|
+
// @kensnzk/koyu/vocabulary the attribute ledger
|
|
28
|
+
// @kensnzk/koyu/validate the rule SPI, the runner, AssessmentReport
|
|
29
|
+
// @kensnzk/koyu/validate/builtin the rules, rule set and profile koyu ships
|
|
30
|
+
// @kensnzk/koyu/draw presentation of the Form
|
|
31
|
+
// @kensnzk/koyu/node filesystem and other Node-specific adapters
|
|
32
|
+
//
|
|
33
|
+
// This list and the table in docs/reference/api/index.md agree as sets — test/public-api.test.ts
|
|
34
|
+
// binds them.
|
|
17
35
|
|
|
18
36
|
// ---- 解析と合成 (docs/reference/muro/import.md) ----
|
|
19
37
|
export { parse, parseFiles, parseWith, tokenize, type LayerLoader } from "./core/parse.js";
|
|
20
38
|
|
|
21
|
-
// ----
|
|
22
|
-
export type {
|
|
23
|
-
Area,
|
|
24
|
-
Asset,
|
|
25
|
-
Attrs,
|
|
26
|
-
AttrValue,
|
|
27
|
-
Boundary,
|
|
28
|
-
BoundaryKind,
|
|
29
|
-
Column,
|
|
30
|
-
ColumnDecl,
|
|
31
|
-
DrawnLine,
|
|
32
|
-
Edge,
|
|
33
|
-
GridAxis,
|
|
34
|
-
GridRef,
|
|
35
|
-
Level,
|
|
36
|
-
Model,
|
|
37
|
-
Opening,
|
|
38
|
-
Pt,
|
|
39
|
-
Rect,
|
|
40
|
-
Seg,
|
|
41
|
-
SitePolygon,
|
|
42
|
-
Space,
|
|
43
|
-
Zone,
|
|
44
|
-
} from "./core/model.js";
|
|
45
|
-
|
|
46
|
-
// ---- モデルへの問い・導出・機械形式 ----
|
|
47
|
-
// **合否は言わない** (docs/reference/scope.md)。数と形を返すところまでが core である
|
|
48
|
-
export {
|
|
49
|
-
areaM2,
|
|
50
|
-
canonicalBoundaryOrder,
|
|
51
|
-
columnsFor,
|
|
52
|
-
DEFAULT_LANGUAGE_VERSION,
|
|
53
|
-
displayName,
|
|
54
|
-
effectiveUse,
|
|
55
|
-
heff,
|
|
56
|
-
isCoveredAbove,
|
|
57
|
-
isIndoor,
|
|
58
|
-
isOutside,
|
|
59
|
-
isSemiOutdoor,
|
|
60
|
-
isVoid,
|
|
61
|
-
levelsSorted,
|
|
62
|
-
newUids,
|
|
63
|
-
pointInPolygon,
|
|
64
|
-
polyBounds,
|
|
65
|
-
polygonAreaM2,
|
|
66
|
-
rectToPoly,
|
|
67
|
-
SourceError,
|
|
68
|
-
srcRef,
|
|
69
|
-
SUPPORTED_LANGUAGE_VERSIONS,
|
|
70
|
-
toCanonical,
|
|
71
|
-
unionAreaM2,
|
|
72
|
-
zoneAreaM2,
|
|
73
|
-
} from "./core/model.js";
|
|
74
|
-
|
|
75
|
-
// ---- 構造整合の診断 (ADR-0016) ----
|
|
39
|
+
// ---- 構造整合の確認 — **合否は言わない。**書かれたものが矛盾していないかまで ----
|
|
76
40
|
export {
|
|
77
41
|
check,
|
|
78
42
|
checkDiagnostics,
|
|
79
|
-
DIAGNOSTIC_CODES,
|
|
80
43
|
type CheckResult,
|
|
81
44
|
type Diagnostic,
|
|
82
45
|
type DiagnosticCode,
|
|
83
46
|
} from "./core/diagnose.js";
|
|
84
47
|
|
|
85
|
-
// ----
|
|
86
|
-
export {
|
|
87
|
-
deriveDefaultBoundaries,
|
|
88
|
-
doorsBetween,
|
|
89
|
-
envelopeGaps,
|
|
90
|
-
neighbors,
|
|
91
|
-
passable,
|
|
92
|
-
placeBand,
|
|
93
|
-
placeOpening,
|
|
94
|
-
segmentsFor,
|
|
95
|
-
type Band,
|
|
96
|
-
type BandCode,
|
|
97
|
-
type BandError,
|
|
98
|
-
type NeighborInfo,
|
|
99
|
-
type PlacedBand,
|
|
100
|
-
type Route,
|
|
101
|
-
type Segment,
|
|
102
|
-
} from "./core/graph.js";
|
|
103
|
-
|
|
104
|
-
// ---- 形の参照実装 (ADR-0040) — **これが形の唯一の入口である** ----
|
|
105
|
-
// Form は見た目を持たない (docs/reference/scope.md)。規則は docs/reference/form/index.md が持つ
|
|
106
|
-
// 実体の構成子 (thicken / bandLine / band / columnRect / runPrism) も core が唯一の実装を
|
|
107
|
-
// 持つ — 芯線と厚みから四辺形や角柱を起こす規則も導出の一部だからである
|
|
108
|
-
export {
|
|
109
|
-
band,
|
|
110
|
-
bandLine,
|
|
111
|
-
columnRect,
|
|
112
|
-
derive,
|
|
113
|
-
DERIVATION_CONSTANTS,
|
|
114
|
-
levelPitch,
|
|
115
|
-
runPrism,
|
|
116
|
-
thicken,
|
|
117
|
-
type DeriveOptions,
|
|
118
|
-
type Form,
|
|
119
|
-
type FormBoundary,
|
|
120
|
-
type FormColumn,
|
|
121
|
-
type FormInput,
|
|
122
|
-
type FormLevel,
|
|
123
|
-
type FormOpening,
|
|
124
|
-
type FormPanel,
|
|
125
|
-
type FormPlan,
|
|
126
|
-
type FormPrism,
|
|
127
|
-
type FormRun,
|
|
128
|
-
type FormSeg,
|
|
129
|
-
type FormSite,
|
|
130
|
-
type FormSpace,
|
|
131
|
-
type FormSwing,
|
|
132
|
-
type PlanClass,
|
|
133
|
-
type PlanEntity,
|
|
134
|
-
type PlanRole,
|
|
135
|
-
type PlanSubject,
|
|
136
|
-
} from "./core/derive.js";
|
|
137
|
-
export { TOLERANCES } from "./core/tolerance.js";
|
|
138
|
-
|
|
139
|
-
// ---- 床・天井・屋根 (ADR-0024) ----
|
|
140
|
-
export { slabs, type Slab, type SlabKind } from "./core/fabric.js";
|
|
141
|
-
|
|
142
|
-
// ---- 採光の入力 (ADR-0020) ----
|
|
143
|
-
export { daylightInputs, type DaylightInput } from "./core/light.js";
|
|
144
|
-
|
|
145
|
-
// ---- 縦動線 (ADR-0021) ----
|
|
146
|
-
export {
|
|
147
|
-
RUN_KEYS,
|
|
148
|
-
runDecls,
|
|
149
|
-
runDrawsForLevel,
|
|
150
|
-
runSolids,
|
|
151
|
-
slopeText,
|
|
152
|
-
verticalRuns,
|
|
153
|
-
type RunArrow,
|
|
154
|
-
type RunDecl,
|
|
155
|
-
type RunDevice,
|
|
156
|
-
type RunDraw,
|
|
157
|
-
type RunForm,
|
|
158
|
-
type RunPart,
|
|
159
|
-
type RunSolid,
|
|
160
|
-
type Seg2,
|
|
161
|
-
type VerticalRun,
|
|
162
|
-
} from "./core/vertical.js";
|
|
163
|
-
|
|
164
|
-
// ---- 敷地 (ADR-0009 / ADR-0011) ----
|
|
165
|
-
export { siteReport, type RoadFrontage, type SiteReport } from "./core/site.js";
|
|
166
|
-
|
|
167
|
-
// ---- 構成の言葉の差分 (ADR-0018) ----
|
|
168
|
-
export {
|
|
169
|
-
renderDiff,
|
|
170
|
-
semanticDiff,
|
|
171
|
-
type BoundaryChange,
|
|
172
|
-
type BoundaryItem,
|
|
173
|
-
type ChangedItem,
|
|
174
|
-
type ColumnItem,
|
|
175
|
-
type FieldChange,
|
|
176
|
-
type GridChange,
|
|
177
|
-
type ModelDiff,
|
|
178
|
-
type RenamedItem,
|
|
179
|
-
type SpaceItem,
|
|
180
|
-
} from "./core/diff.js";
|
|
181
|
-
|
|
182
|
-
// ---- 属性の台帳 — **書いてよいキーの一覧であって、読むキーの一覧ではない** ----
|
|
183
|
-
//
|
|
184
|
-
// 利用者の側にも境界が要る。台帳を出していなかった間、消費側のアプリは
|
|
185
|
-
// 「この鍵はこの要素に書けるか」を答えるために台帳を手で写すしかなく、写しは必ずずれる。
|
|
186
|
-
// `outside` と `void` を型の位置から台帳へ移した以上、その台帳は読めなければ意味がない。
|
|
48
|
+
// ---- 機械形式と、版 ----
|
|
187
49
|
export {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
type AttrSpec,
|
|
195
|
-
type AttrTier,
|
|
196
|
-
} from "./core/vocabulary.js";
|
|
197
|
-
|
|
198
|
-
// ---- 生成 — **凍らない** (docs/reference/scope.md)。SVGの中身は約束の外にある ----
|
|
199
|
-
// 領域としては `@kensnzk/koyu/draw` にも分けてある
|
|
200
|
-
export { svgPlan, type PlanOptions } from "./draw/plan.js";
|
|
201
|
-
export { svgAxo, type AxoOptions } from "./draw/axo.js";
|
|
202
|
-
|
|
203
|
-
// ---- 検証 — **core ではない。**凍らない・増える・合否を言う (docs/reference/scope.md) ----
|
|
204
|
-
// Finding は Diagnostic と別の型で、フィールド名から違う (rule/level と code/severity)。
|
|
205
|
-
// 領域としては `@kensnzk/koyu/validate` にも分けてある
|
|
206
|
-
export {
|
|
207
|
-
validate,
|
|
208
|
-
VALIDATION_RULES,
|
|
209
|
-
type Finding,
|
|
210
|
-
type ValidationRule,
|
|
211
|
-
} from "./validate/index.js";
|
|
50
|
+
DEFAULT_LANGUAGE_VERSION,
|
|
51
|
+
SourceError,
|
|
52
|
+
SUPPORTED_LANGUAGE_VERSIONS,
|
|
53
|
+
toCanonical,
|
|
54
|
+
type Model,
|
|
55
|
+
} from "./core/model.js";
|