@kensnzk/koyu 0.17.0 → 0.19.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 +116 -26
- 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 +11 -1
- package/dist/core/diagnose.js.map +1 -1
- package/dist/core/model.d.ts +50 -3
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/model.js +19 -3
- package/dist/core/model.js.map +1 -1
- package/dist/core/parse.d.ts.map +1 -1
- package/dist/core/parse.js +79 -0
- package/dist/core/parse.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/core/vocabulary.d.ts.map +1 -1
- package/dist/core/vocabulary.js +11 -0
- package/dist/core/vocabulary.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/draw/plan.d.ts.map +1 -1
- package/dist/draw/plan.js +24 -0
- package/dist/draw/plan.js.map +1 -1
- 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 +55 -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/editors/vscode/syntaxes/koyu.tmLanguage.json +2 -2
- package/examples/tower/site-geometry.muro +9 -0
- package/examples/two-rooms.canonical.json +1 -1
- 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 +127 -28
- package/src/core/diagnose.ts +11 -1
- package/src/core/model.ts +67 -3
- package/src/core/parse.ts +99 -0
- package/src/core/site.ts +17 -0
- package/src/core/vocabulary.ts +12 -0
- package/src/diagnostics.ts +8 -0
- package/src/diff.ts +14 -0
- package/src/draw/plan.ts +31 -0
- package/src/form.ts +37 -0
- package/src/graph.ts +12 -0
- package/src/index.ts +39 -195
- package/src/mcp.ts +57 -25
- package/src/model.ts +45 -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
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AnalysisDefinition,
|
|
3
|
+
AnalysisArtifact,
|
|
4
|
+
AnalysisRef,
|
|
5
|
+
Evidence,
|
|
6
|
+
SourceRef,
|
|
7
|
+
SubjectRef,
|
|
8
|
+
} from "../../analysis/contracts.js";
|
|
9
|
+
import { envelopeGaps, segmentLength } from "../../core/graph.js";
|
|
10
|
+
import {
|
|
11
|
+
canonicalSpaceOrder,
|
|
12
|
+
isOutside,
|
|
13
|
+
isSemiOutdoor,
|
|
14
|
+
type Model,
|
|
15
|
+
type Space,
|
|
16
|
+
} from "../../core/model.js";
|
|
17
|
+
import type { Rule, RuleEvaluation, RuleOutcome } from "../contracts.js";
|
|
18
|
+
import { freezeBuiltin } from "./freeze.js";
|
|
19
|
+
|
|
20
|
+
export type EnvelopeRunFact = {
|
|
21
|
+
readonly edge: string;
|
|
22
|
+
readonly lengthMm: number;
|
|
23
|
+
readonly segment: {
|
|
24
|
+
readonly x1: number;
|
|
25
|
+
readonly y1: number;
|
|
26
|
+
readonly x2: number;
|
|
27
|
+
readonly y2: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type EnvelopeSpaceFact = {
|
|
32
|
+
readonly ref: string;
|
|
33
|
+
readonly levelRef: string;
|
|
34
|
+
readonly uncoveredLengthMm: number;
|
|
35
|
+
readonly runs: readonly EnvelopeRunFact[];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type EnvelopeAnalysisValue = {
|
|
39
|
+
readonly startedLevels: readonly string[];
|
|
40
|
+
readonly spaces: readonly EnvelopeSpaceFact[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const ENVELOPE_ANALYSIS_ID: AnalysisRef<EnvelopeAnalysisValue> = freezeBuiltin({
|
|
44
|
+
id: "koyu.analysis.envelope",
|
|
45
|
+
revision: "1",
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const ENVELOPE_GAP_RULE_ID = freezeBuiltin({
|
|
49
|
+
id: "koyu.schematic.envelope.gap",
|
|
50
|
+
revision: "1",
|
|
51
|
+
} as const);
|
|
52
|
+
|
|
53
|
+
const VERTICAL_BOUNDARIES = new Set(["stair", "shaft", "void"]);
|
|
54
|
+
|
|
55
|
+
export const ENVELOPE_ANALYSIS: AnalysisDefinition<EnvelopeAnalysisValue> = freezeBuiltin<AnalysisDefinition<EnvelopeAnalysisValue>>({
|
|
56
|
+
...ENVELOPE_ANALYSIS_ID,
|
|
57
|
+
title: "Envelope observations",
|
|
58
|
+
model: "consistent",
|
|
59
|
+
dependencies: [],
|
|
60
|
+
context: [],
|
|
61
|
+
run: ({ model }): AnalysisArtifact<EnvelopeAnalysisValue> => {
|
|
62
|
+
const coreModel = model as unknown as Model;
|
|
63
|
+
const startedLevels = new Set<string>();
|
|
64
|
+
for (const boundary of model.boundaries) {
|
|
65
|
+
if (boundary.derived || VERTICAL_BOUNDARIES.has(boundary.kind)) continue;
|
|
66
|
+
const a = model.spaces.get(boundary.a);
|
|
67
|
+
const b = model.spaces.get(boundary.b);
|
|
68
|
+
if (!a || !b) continue;
|
|
69
|
+
const outer = a.rects.length === 0 ? b : b.rects.length === 0 ? a : undefined;
|
|
70
|
+
if (outer?.level) startedLevels.add(outer.level);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const siteZones = [...model.zones.values()]
|
|
74
|
+
.filter((zone) => zone.attrs["site"] === 1)
|
|
75
|
+
.map((zone) => zone.path)
|
|
76
|
+
.sort(compareText);
|
|
77
|
+
const spaces = canonicalSpaceOrder(coreModel)
|
|
78
|
+
.filter((space) => envelopePopulation(coreModel, space, startedLevels, siteZones))
|
|
79
|
+
.map((space) => envelopeFact(coreModel, space));
|
|
80
|
+
const evidence = spaces.map((space) => envelopeEvidence(space, coreModel.spaces.get(space.ref)!));
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
state: "complete",
|
|
84
|
+
value: {
|
|
85
|
+
startedLevels: [...startedLevels].sort(compareText),
|
|
86
|
+
spaces,
|
|
87
|
+
},
|
|
88
|
+
evidence,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const ENVELOPE_GAP_RULE: Rule = freezeBuiltin<Rule>({
|
|
94
|
+
...ENVELOPE_GAP_RULE_ID,
|
|
95
|
+
title: "Envelope perimeter gap",
|
|
96
|
+
level: "caution",
|
|
97
|
+
model: "consistent",
|
|
98
|
+
analyses: [{ analysis: ENVELOPE_ANALYSIS_ID, accept: "complete" }],
|
|
99
|
+
context: [],
|
|
100
|
+
authority: [],
|
|
101
|
+
evaluate: ({ get }): RuleEvaluation => {
|
|
102
|
+
const artifact = get(ENVELOPE_ANALYSIS_ID);
|
|
103
|
+
if (artifact.state !== "complete") return analysisIndeterminate(artifact);
|
|
104
|
+
if (artifact.value.spaces.length === 0) {
|
|
105
|
+
return {
|
|
106
|
+
applicability: "not-applicable",
|
|
107
|
+
reason: "No enclosed-space population exists on a level whose envelope has been started",
|
|
108
|
+
evidence: [],
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const evidenceById = new Map(artifact.evidence.map((item) => [item.id, item]));
|
|
113
|
+
const outcomes = artifact.value.spaces.map((space): RuleOutcome => {
|
|
114
|
+
const evidence = evidenceById.get(envelopeEvidenceId(space.ref));
|
|
115
|
+
if (!evidence) throw new Error(`missing envelope evidence for ${space.ref}`);
|
|
116
|
+
const status = space.runs.length > 0 ? "fail" : "pass";
|
|
117
|
+
return {
|
|
118
|
+
id: space.ref,
|
|
119
|
+
status,
|
|
120
|
+
subjects: [spaceSubject(space.ref)],
|
|
121
|
+
message: status === "fail"
|
|
122
|
+
? `Perimeter not faced by any envelope: ${space.ref} — ${describeRuns(space.runs)} (${Math.round(space.uncoveredLengthMm)}mm over ${space.runs.length} run(s)). Write a boundary to the exterior`
|
|
123
|
+
: `${space.ref} has no uncovered envelope run`,
|
|
124
|
+
evidence: [evidence],
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
return { applicability: "applicable", outcomes: outcomes as [RuleOutcome, ...RuleOutcome[]] };
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
function envelopePopulation(
|
|
132
|
+
model: Parameters<typeof isSemiOutdoor>[0],
|
|
133
|
+
space: Space,
|
|
134
|
+
startedLevels: ReadonlySet<string>,
|
|
135
|
+
siteZones: readonly string[],
|
|
136
|
+
): boolean {
|
|
137
|
+
if (space.rects.length === 0 || !space.level || !startedLevels.has(space.level)) return false;
|
|
138
|
+
if (isOutside(space) || isSemiOutdoor(model, space)) return false;
|
|
139
|
+
return !siteZones.some((zone) => space.path.startsWith(`${zone}/`));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function envelopeFact(
|
|
143
|
+
model: Parameters<typeof envelopeGaps>[0],
|
|
144
|
+
space: Space,
|
|
145
|
+
): EnvelopeSpaceFact {
|
|
146
|
+
const runs = envelopeGaps(model, space)
|
|
147
|
+
.map((segment): EnvelopeRunFact => ({
|
|
148
|
+
edge: segment.edgeOfA ?? (segment.horizontal ? "N/S" : "E/W"),
|
|
149
|
+
lengthMm: segmentLength(segment),
|
|
150
|
+
segment: {
|
|
151
|
+
x1: segment.x1,
|
|
152
|
+
y1: segment.y1,
|
|
153
|
+
x2: segment.x2,
|
|
154
|
+
y2: segment.y2,
|
|
155
|
+
},
|
|
156
|
+
}))
|
|
157
|
+
.sort(compareRuns);
|
|
158
|
+
return {
|
|
159
|
+
ref: space.path,
|
|
160
|
+
levelRef: space.level!,
|
|
161
|
+
uncoveredLengthMm: runs.reduce((sum, run) => sum + run.lengthMm, 0),
|
|
162
|
+
runs,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function envelopeEvidence(space: EnvelopeSpaceFact, source: Space): Evidence {
|
|
167
|
+
const subject = spaceSubject(space.ref);
|
|
168
|
+
return {
|
|
169
|
+
id: envelopeEvidenceId(space.ref),
|
|
170
|
+
kind: "fact",
|
|
171
|
+
name: "uncoveredEnvelopeRuns",
|
|
172
|
+
value: {
|
|
173
|
+
length: { value: space.uncoveredLengthMm, unit: "mm" },
|
|
174
|
+
runs: space.runs,
|
|
175
|
+
},
|
|
176
|
+
subjects: [subject],
|
|
177
|
+
sources: [modelSource(subject, source)],
|
|
178
|
+
producedBy: ENVELOPE_ANALYSIS_ID,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function modelSource(subject: SubjectRef, source: Space): SourceRef {
|
|
183
|
+
return {
|
|
184
|
+
kind: "model",
|
|
185
|
+
subject,
|
|
186
|
+
location: {
|
|
187
|
+
...(source.file !== undefined ? { file: source.file } : {}),
|
|
188
|
+
line: source.line,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function spaceSubject(ref: string): SubjectRef {
|
|
194
|
+
return { kind: "space", ref };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function envelopeEvidenceId(ref: string): string {
|
|
198
|
+
return `envelope:${ref}`;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function analysisIndeterminate(
|
|
202
|
+
artifact: Exclude<AnalysisArtifact<EnvelopeAnalysisValue>, { state: "complete" }>,
|
|
203
|
+
): Extract<RuleEvaluation, { applicability: "indeterminate" }> {
|
|
204
|
+
return {
|
|
205
|
+
applicability: "indeterminate",
|
|
206
|
+
reason: "Envelope observations are incomplete",
|
|
207
|
+
missing: artifact.missing,
|
|
208
|
+
evidence: artifact.state === "partial" ? artifact.evidence : [],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** `S 3600mm / N 3600mm / W 4500mm` — which way each uncovered run faces, and how long it is. */
|
|
213
|
+
function describeRuns(runs: readonly EnvelopeRunFact[]): string {
|
|
214
|
+
return runs.map((run) => `${run.edge} ${Math.round(run.lengthMm)}mm`).join(" / ");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function compareText(a: string, b: string): number {
|
|
218
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function compareRuns(a: EnvelopeRunFact, b: EnvelopeRunFact): number {
|
|
222
|
+
return compareText(a.edge, b.edge)
|
|
223
|
+
|| a.segment.x1 - b.segment.x1
|
|
224
|
+
|| a.segment.y1 - b.segment.y1
|
|
225
|
+
|| a.segment.x2 - b.segment.x2
|
|
226
|
+
|| a.segment.y2 - b.segment.y2;
|
|
227
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Deep-freeze trusted built-in component values before they cross the public boundary. */
|
|
2
|
+
export function freezeBuiltin<T>(value: T): T {
|
|
3
|
+
const seen = new Set<object>();
|
|
4
|
+
|
|
5
|
+
const visit = (candidate: unknown): void => {
|
|
6
|
+
if ((typeof candidate !== "object" && typeof candidate !== "function") || candidate === null) return;
|
|
7
|
+
const object = candidate as object;
|
|
8
|
+
if (seen.has(object)) return;
|
|
9
|
+
seen.add(object);
|
|
10
|
+
for (const key of Reflect.ownKeys(object)) {
|
|
11
|
+
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
12
|
+
if (descriptor && "value" in descriptor) visit(descriptor.value);
|
|
13
|
+
}
|
|
14
|
+
Object.freeze(object);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
visit(value);
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// koyu — the built-in schematic rule pack
|
|
2
|
+
//
|
|
3
|
+
// **This is design lint, not code compliance.** The constants below recall statute and custom,
|
|
4
|
+
// but nothing here reads a jurisdiction, an effective date, a use-class condition, an exception,
|
|
5
|
+
// or an administrative interpretation. The namespace says so: `koyu.schematic.*`, never `jp.bsl.*`.
|
|
6
|
+
// What it is good for is an early, reproducible screen at schematic resolution.
|
|
7
|
+
//
|
|
8
|
+
// The catalog is a **value**, not a registration. Nothing here mutates a process-global registry
|
|
9
|
+
// and nothing runs at import time beyond building frozen literals — the caller composes a local
|
|
10
|
+
// immutable registry and passes it in.
|
|
11
|
+
|
|
12
|
+
import type { AnalysisDefinition, AnalysisRef } from "../../analysis/contracts.js";
|
|
13
|
+
import type { JsonValue } from "../../analysis/json.js";
|
|
14
|
+
import { createAssessmentRegistry } from "../assessment.js";
|
|
15
|
+
import type {
|
|
16
|
+
AssessmentRegistry,
|
|
17
|
+
Profile,
|
|
18
|
+
ProfileRef,
|
|
19
|
+
Rule,
|
|
20
|
+
RuleSet,
|
|
21
|
+
RuleSetRef,
|
|
22
|
+
} from "../contracts.js";
|
|
23
|
+
import { freezeBuiltin } from "./freeze.js";
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
ACCESS_ANALYSIS,
|
|
27
|
+
ACCESS_ANALYSIS_ID,
|
|
28
|
+
ACCESS_BACKOFHOUSE_RULE,
|
|
29
|
+
ACCESS_PARKING_RULE,
|
|
30
|
+
ACCESS_THROUGHTENANT_RULE,
|
|
31
|
+
ACCESS_UNREACHABLE_RULE,
|
|
32
|
+
ACCESS_VOIDONLY_RULE,
|
|
33
|
+
} from "./access.js";
|
|
34
|
+
import {
|
|
35
|
+
DAYLIGHT_ANALYSIS,
|
|
36
|
+
DAYLIGHT_ANALYSIS_ID,
|
|
37
|
+
DAYLIGHT_RATIO_RULE,
|
|
38
|
+
DAYLIGHT_UNKNOWN_RULE,
|
|
39
|
+
} from "./daylight.js";
|
|
40
|
+
import {
|
|
41
|
+
COLUMN_BLOCKS_DOOR_RULE,
|
|
42
|
+
DOOR_COLUMN_COLLISIONS_ANALYSIS,
|
|
43
|
+
DOOR_COLUMN_COLLISIONS_ANALYSIS_ID,
|
|
44
|
+
} from "./door-column-collisions.js";
|
|
45
|
+
import { ENVELOPE_ANALYSIS, ENVELOPE_ANALYSIS_ID, ENVELOPE_GAP_RULE } from "./envelope.js";
|
|
46
|
+
import {
|
|
47
|
+
SITE_ANALYSIS,
|
|
48
|
+
SITE_ANALYSIS_ID,
|
|
49
|
+
SITE_AREA_RULE,
|
|
50
|
+
SITE_ESCAPE_RULE,
|
|
51
|
+
SITE_FRONTAGE_RULE,
|
|
52
|
+
} from "./site.js";
|
|
53
|
+
import {
|
|
54
|
+
ESCALATOR_USUAL_SLOPE_RULE,
|
|
55
|
+
RAMP_DECLARED_SLOPE_RULE,
|
|
56
|
+
RUN_DISCONNECTED_RULE,
|
|
57
|
+
STAIR_PROPORTION_RULE,
|
|
58
|
+
VERTICAL_RUNS_ANALYSIS,
|
|
59
|
+
VERTICAL_RUNS_ANALYSIS_ID,
|
|
60
|
+
} from "./vertical-runs.js";
|
|
61
|
+
|
|
62
|
+
export * from "./access.js";
|
|
63
|
+
export * from "./daylight.js";
|
|
64
|
+
export * from "./door-column-collisions.js";
|
|
65
|
+
export * from "./envelope.js";
|
|
66
|
+
export * from "./site.js";
|
|
67
|
+
export * from "./vertical-runs.js";
|
|
68
|
+
|
|
69
|
+
export const SCHEMATIC_RULE_SET_ID: RuleSetRef = freezeBuiltin({
|
|
70
|
+
id: "koyu.ruleset.schematic-screen",
|
|
71
|
+
revision: "1",
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const SCHEMATIC_PROFILE_ID: ProfileRef = freezeBuiltin({
|
|
75
|
+
id: "koyu.profile.schematic-screen",
|
|
76
|
+
revision: "1",
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The six analyses, in the order they are declared in the catalog.
|
|
81
|
+
*
|
|
82
|
+
* Each computes facts once and says nothing about pass or fail — no rule identity, no level,
|
|
83
|
+
* no compliance summary. CLI, MCP and eval read these rather than recomputing a ratio,
|
|
84
|
+
* an area tolerance, a frontage, a route or a slope of their own.
|
|
85
|
+
*/
|
|
86
|
+
export const SCHEMATIC_ANALYSES: readonly AnalysisDefinition<JsonValue>[] = freezeBuiltin([
|
|
87
|
+
ENVELOPE_ANALYSIS,
|
|
88
|
+
DAYLIGHT_ANALYSIS,
|
|
89
|
+
VERTICAL_RUNS_ANALYSIS,
|
|
90
|
+
ACCESS_ANALYSIS,
|
|
91
|
+
DOOR_COLUMN_COLLISIONS_ANALYSIS,
|
|
92
|
+
SITE_ANALYSIS,
|
|
93
|
+
] as unknown as AnalysisDefinition<JsonValue>[]);
|
|
94
|
+
|
|
95
|
+
export const SCHEMATIC_ANALYSIS_IDS: readonly AnalysisRef[] = freezeBuiltin([
|
|
96
|
+
ENVELOPE_ANALYSIS_ID,
|
|
97
|
+
DAYLIGHT_ANALYSIS_ID,
|
|
98
|
+
VERTICAL_RUNS_ANALYSIS_ID,
|
|
99
|
+
ACCESS_ANALYSIS_ID,
|
|
100
|
+
DOOR_COLUMN_COLLISIONS_ANALYSIS_ID,
|
|
101
|
+
SITE_ANALYSIS_ID,
|
|
102
|
+
] as unknown as AnalysisRef[]);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The sixteen rules, in the order of the legacy ledger.
|
|
106
|
+
*
|
|
107
|
+
* The one place the order is not a copy is the old `run.slope`, which splits in place into the
|
|
108
|
+
* ramp rule and then the escalator rule: a declared limit and a customary band have different
|
|
109
|
+
* grounds and have to be revisable one without the other.
|
|
110
|
+
*/
|
|
111
|
+
export const SCHEMATIC_RULES: readonly Rule[] = freezeBuiltin([
|
|
112
|
+
ENVELOPE_GAP_RULE,
|
|
113
|
+
DAYLIGHT_RATIO_RULE,
|
|
114
|
+
DAYLIGHT_UNKNOWN_RULE,
|
|
115
|
+
STAIR_PROPORTION_RULE,
|
|
116
|
+
RAMP_DECLARED_SLOPE_RULE,
|
|
117
|
+
ESCALATOR_USUAL_SLOPE_RULE,
|
|
118
|
+
RUN_DISCONNECTED_RULE,
|
|
119
|
+
ACCESS_UNREACHABLE_RULE,
|
|
120
|
+
ACCESS_VOIDONLY_RULE,
|
|
121
|
+
ACCESS_THROUGHTENANT_RULE,
|
|
122
|
+
ACCESS_PARKING_RULE,
|
|
123
|
+
ACCESS_BACKOFHOUSE_RULE,
|
|
124
|
+
COLUMN_BLOCKS_DOOR_RULE,
|
|
125
|
+
SITE_ESCAPE_RULE,
|
|
126
|
+
SITE_AREA_RULE,
|
|
127
|
+
SITE_FRONTAGE_RULE,
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
export const SCHEMATIC_RULE_SET: RuleSet = freezeBuiltin<RuleSet>({
|
|
131
|
+
...SCHEMATIC_RULE_SET_ID,
|
|
132
|
+
title: "koyu schematic screen",
|
|
133
|
+
purpose: "design-lint",
|
|
134
|
+
rules: SCHEMATIC_RULES,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
export const SCHEMATIC_PROFILE: Profile = freezeBuiltin<Profile>({
|
|
138
|
+
...SCHEMATIC_PROFILE_ID,
|
|
139
|
+
title: "koyu schematic screen",
|
|
140
|
+
analyses: SCHEMATIC_ANALYSIS_IDS,
|
|
141
|
+
ruleSets: [SCHEMATIC_RULE_SET_ID],
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Build a local immutable registry holding the built-in pack.
|
|
146
|
+
*
|
|
147
|
+
* A factory rather than a shared singleton: the registry is the caller's value, and composing
|
|
148
|
+
* an external pack alongside these must not be able to reach back into anyone else's catalog.
|
|
149
|
+
*/
|
|
150
|
+
export function createSchematicRegistry(): AssessmentRegistry {
|
|
151
|
+
return createAssessmentRegistry({
|
|
152
|
+
analyses: SCHEMATIC_ANALYSES,
|
|
153
|
+
ruleSets: [SCHEMATIC_RULE_SET],
|
|
154
|
+
profiles: [SCHEMATIC_PROFILE],
|
|
155
|
+
});
|
|
156
|
+
}
|