bimdown-cli 0.4.0 → 0.5.1
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.md +24 -3
- package/dist/chunk-4SKM4RHY.js +142 -0
- package/dist/chunk-4SKM4RHY.js.map +1 -0
- package/dist/chunk-4YHVOWS4.js +255 -0
- package/dist/chunk-4YHVOWS4.js.map +1 -0
- package/dist/chunk-AYAXRYGP.js +2129 -0
- package/dist/chunk-AYAXRYGP.js.map +1 -0
- package/dist/chunk-EC5MR5ZH.js +648 -0
- package/dist/chunk-EC5MR5ZH.js.map +1 -0
- package/dist/chunk-HS3PO2LB.js +487 -0
- package/dist/chunk-HS3PO2LB.js.map +1 -0
- package/dist/chunk-IQJA3EFO.js +179 -0
- package/dist/chunk-IQJA3EFO.js.map +1 -0
- package/dist/chunk-JY6KWRDB.js +80 -0
- package/dist/chunk-JY6KWRDB.js.map +1 -0
- package/dist/chunk-KWSGJUMZ.js +2501 -0
- package/dist/chunk-KWSGJUMZ.js.map +1 -0
- package/dist/chunk-LWYIPR64.js +35 -0
- package/dist/chunk-LWYIPR64.js.map +1 -0
- package/dist/chunk-OBY3UYCO.js +44 -0
- package/dist/chunk-OBY3UYCO.js.map +1 -0
- package/dist/chunk-XC6WHJRL.js +29 -0
- package/dist/chunk-XC6WHJRL.js.map +1 -0
- package/dist/chunk-XQU52JKB.js +187 -0
- package/dist/chunk-XQU52JKB.js.map +1 -0
- package/dist/clash-load-D3LNQR6G.js +941 -0
- package/dist/clash-load-D3LNQR6G.js.map +1 -0
- package/dist/cli.js +306 -3377
- package/dist/cli.js.map +1 -1
- package/dist/dehydrate-ZHAGOI7Q.js +90 -0
- package/dist/dehydrate-ZHAGOI7Q.js.map +1 -0
- package/dist/diff-T2KOK2WR.js +89 -0
- package/dist/diff-T2KOK2WR.js.map +1 -0
- package/dist/engine-2TPWJVEQ.js +12 -0
- package/dist/engine-2TPWJVEQ.js.map +1 -0
- package/dist/hydrate-V24H7IF3.js +673 -0
- package/dist/hydrate-V24H7IF3.js.map +1 -0
- package/dist/import-ifc-RCZSXDA6.js +5324 -0
- package/dist/import-ifc-RCZSXDA6.js.map +1 -0
- package/dist/info-QC7YXWNX.js +92 -0
- package/dist/info-QC7YXWNX.js.map +1 -0
- package/dist/init-VWDML3UC.js +112 -0
- package/dist/init-VWDML3UC.js.map +1 -0
- package/dist/lib.d.ts +427 -44
- package/dist/lib.js +6482 -225
- package/dist/lib.js.map +1 -1
- package/dist/mep-W4HJI363.js +25 -0
- package/dist/mep-W4HJI363.js.map +1 -0
- package/dist/merge-ESOPDSA5.js +413 -0
- package/dist/merge-ESOPDSA5.js.map +1 -0
- package/dist/publish-3TAXQCUV.js +80 -0
- package/dist/publish-3TAXQCUV.js.map +1 -0
- package/dist/render-UEWYHPN6.js +1807 -0
- package/dist/render-UEWYHPN6.js.map +1 -0
- package/dist/resolve-topology-AQ2RO3W3.js +338 -0
- package/dist/resolve-topology-AQ2RO3W3.js.map +1 -0
- package/dist/spec/csv-schema/annotation/dimension.yaml +77 -0
- package/dist/spec/csv-schema/annotation/tag.yaml +44 -0
- package/dist/spec/csv-schema/annotation/text_note.yaml +52 -0
- package/dist/spec/csv-schema/architecture/ceiling.yaml +8 -1
- package/dist/spec/csv-schema/architecture/column.yaml +5 -1
- package/dist/spec/csv-schema/architecture/curtain_wall.yaml +45 -5
- package/dist/spec/csv-schema/architecture/door.yaml +5 -0
- package/dist/spec/csv-schema/architecture/furniture.yaml +28 -0
- package/dist/spec/csv-schema/architecture/opening.yaml +27 -6
- package/dist/spec/csv-schema/architecture/railing.yaml +35 -0
- package/dist/spec/csv-schema/architecture/roof.yaml +34 -1
- package/dist/spec/csv-schema/architecture/slab.yaml +19 -0
- package/dist/spec/csv-schema/architecture/space.yaml +11 -1
- package/dist/spec/csv-schema/architecture/stair.yaml +49 -0
- package/dist/spec/csv-schema/architecture/stair_landing.yaml +36 -0
- package/dist/spec/csv-schema/architecture/stair_run.yaml +31 -0
- package/dist/spec/csv-schema/architecture/wall.yaml +14 -1
- package/dist/spec/csv-schema/architecture/window.yaml +19 -0
- package/dist/spec/csv-schema/base/element.yaml +20 -11
- package/dist/spec/csv-schema/base/furniture_params.yaml +60 -0
- package/dist/spec/csv-schema/base/hosted_element.yaml +10 -2
- package/dist/spec/csv-schema/base/mep_connectable.yaml +23 -0
- package/dist/spec/csv-schema/base/mep_design.yaml +24 -0
- package/dist/spec/csv-schema/base/mep_insulated.yaml +9 -0
- package/dist/spec/csv-schema/base/mep_system_tag.yaml +12 -0
- package/dist/spec/csv-schema/base/point_element.yaml +1 -0
- package/dist/spec/csv-schema/base/section_profile.yaml +5 -0
- package/dist/spec/csv-schema/base/spatial_line_element.yaml +4 -2
- package/dist/spec/csv-schema/base/structural_section_profile.yaml +50 -0
- package/dist/spec/csv-schema/base/vertical_span.yaml +5 -4
- package/dist/spec/csv-schema/base/wall_bounded.yaml +21 -0
- package/dist/spec/csv-schema/grid.yaml +5 -0
- package/dist/spec/csv-schema/mep/cable_tray.yaml +10 -3
- package/dist/spec/csv-schema/mep/circuit.yaml +70 -0
- package/dist/spec/csv-schema/mep/conduit.yaml +2 -2
- package/dist/spec/csv-schema/mep/connector.yaml +112 -0
- package/dist/spec/csv-schema/mep/duct.yaml +10 -3
- package/dist/spec/csv-schema/mep/equipment.yaml +18 -1
- package/dist/spec/csv-schema/mep/mep_node.yaml +91 -2
- package/dist/spec/csv-schema/mep/mep_system.yaml +21 -0
- package/dist/spec/csv-schema/mep/pipe.yaml +27 -3
- package/dist/spec/csv-schema/mep/terminal.yaml +22 -1
- package/dist/spec/csv-schema/model_group.yaml +40 -0
- package/dist/spec/csv-schema/sheet/sheet.yaml +50 -0
- package/dist/spec/csv-schema/sheet/sheet_viewport.yaml +86 -0
- package/dist/spec/csv-schema/structure/beam.yaml +29 -1
- package/dist/spec/csv-schema/structure/beam_system.yaml +29 -0
- package/dist/spec/csv-schema/structure/brace.yaml +24 -1
- package/dist/spec/csv-schema/structure/foundation.yaml +40 -7
- package/dist/spec/csv-schema/structure/structure_column.yaml +19 -1
- package/dist/spec/csv-schema/structure/structure_slab.yaml +32 -0
- package/dist/spec/csv-schema/structure/structure_wall.yaml +22 -0
- package/dist/spec/csv-schema/types/beam_type.yaml +11 -0
- package/dist/spec/csv-schema/types/ceiling_type.yaml +6 -0
- package/dist/spec/csv-schema/types/column_type.yaml +12 -0
- package/dist/spec/csv-schema/types/curtain_wall_type.yaml +32 -0
- package/dist/spec/csv-schema/types/door_type.yaml +27 -0
- package/dist/spec/csv-schema/types/element_type.yaml +21 -0
- package/dist/spec/csv-schema/types/fenestration.yaml +16 -0
- package/dist/spec/csv-schema/types/foundation_type.yaml +36 -0
- package/dist/spec/csv-schema/types/furniture_type.yaml +11 -0
- package/dist/spec/csv-schema/types/layered_type.yaml +13 -0
- package/dist/spec/csv-schema/types/railing_type.yaml +40 -0
- package/dist/spec/csv-schema/types/roof_type.yaml +7 -0
- package/dist/spec/csv-schema/types/slab_type.yaml +9 -0
- package/dist/spec/csv-schema/types/type_layer.yaml +47 -0
- package/dist/spec/csv-schema/types/wall_type.yaml +6 -0
- package/dist/spec/csv-schema/types/window_type.yaml +31 -0
- package/dist/spec/csv-schema/underlay.yaml +73 -0
- package/dist/spec/csv-schema/view.yaml +36 -0
- package/dist/spec/duckdb-strategy.md +4 -3
- package/dist/spec/geojson-schema/readme.md +380 -0
- package/dist/spec/mep-port-conventions.md +190 -0
- package/dist/spec/migration-guide.md +1 -1
- package/dist/spec/project_metadata.schema.yaml +52 -4
- package/dist/spec/readme.md +356 -97
- package/dist/spec/starter-types/global/beam_type.csv +5 -0
- package/dist/spec/starter-types/global/ceiling_type.csv +3 -0
- package/dist/spec/starter-types/global/column_type.csv +5 -0
- package/dist/spec/starter-types/global/curtain_wall_type.csv +2 -0
- package/dist/spec/starter-types/global/door_type.csv +6 -0
- package/dist/spec/starter-types/global/foundation_type.csv +7 -0
- package/dist/spec/starter-types/global/furniture_type.csv +11 -0
- package/dist/spec/starter-types/global/railing_type.csv +5 -0
- package/dist/spec/starter-types/global/roof_type.csv +3 -0
- package/dist/spec/starter-types/global/slab_type.csv +4 -0
- package/dist/spec/starter-types/global/type_layer.csv +40 -0
- package/dist/spec/starter-types/global/wall_type.csv +8 -0
- package/dist/spec/starter-types/global/window_type.csv +6 -0
- package/dist/spec/svg-schema/readme.md +47 -1
- package/package.json +6 -3
- package/dist/spec/csv-schema/base/mep_connected_segment.yaml +0 -17
- package/dist/spec/csv-schema/base/mep_system.yaml +0 -7
package/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# BimDown CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Command-line tool for [BimDown](https://bim.jouledown.com), an open building data format (CSV attributes + GeoJSON or SVG geometry, one folder per level). Validates and builds projects, renders plans, loads models into DuckDB for SQL queries, diffs and merges, and publishes share links to bim.jouledown.com. Format spec and agent skill: [NovaShang/BimDown](https://github.com/NovaShang/BimDown).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g bimdown-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
On npm 11+ the install may end with an `npm warn install-scripts … sharp@…` notice. It is harmless: sharp (used only for `bimdown render` PNG output) ships prebuilt binaries, so its skipped install check isn't needed.
|
|
12
|
+
|
|
13
|
+
From source:
|
|
14
|
+
|
|
7
15
|
```bash
|
|
8
16
|
cd cli
|
|
9
17
|
npm install
|
|
@@ -12,6 +20,10 @@ npm run build
|
|
|
12
20
|
|
|
13
21
|
## Commands
|
|
14
22
|
|
|
23
|
+
### `bimdown publish <dir>`
|
|
24
|
+
|
|
25
|
+
Uploads the project anonymously and prints a public share link on bim.jouledown.com (default expiry 7 days, `--expires 24h`). Override the server with `--api <url>` or `BIMDOWN_API`.
|
|
26
|
+
|
|
15
27
|
### `bimdown validate <dir>`
|
|
16
28
|
|
|
17
29
|
Validate a BimDown project directory. Checks directory structure, CSV headers/required fields/enums, ID format and uniqueness, foreign key references, and SVG strict subset compliance.
|
|
@@ -58,11 +70,20 @@ node dist/index.js info ../sample_data/architectural
|
|
|
58
70
|
|
|
59
71
|
### `bimdown schema [table]`
|
|
60
72
|
|
|
61
|
-
Print the resolved schema for a table
|
|
73
|
+
Print the resolved schema for a table, showing CSV fields, computed fields, types, and constraints. Without a table it prints a short index (one line per table with its key fields); `--all` prints every table in full.
|
|
62
74
|
|
|
63
75
|
```bash
|
|
64
76
|
node dist/index.js schema wall
|
|
65
|
-
node dist/index.js schema # all tables
|
|
77
|
+
node dist/index.js schema # index of all tables
|
|
78
|
+
node dist/index.js schema --all # every table in full
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `bimdown import-ifc <file.ifc> <outdir>`
|
|
82
|
+
|
|
83
|
+
Convert an IFC2x3 / IFC4 model (Revit, ArchiCAD, …) into a new BimDown project with web-ifc: storeys become levels; walls (with layered wall types), curtain walls, doors / windows / openings hosted on their walls, slabs, roofs, ceilings, spaces, columns, beams, footings, stairs, railings, grids and MEP runs / fittings / terminals / equipment with their systems become BimDown elements. Wall ends are joined and room separators added so rooms close; then `build` runs and the report lists what was skipped (with reasons) and any room problems. `--json <path>` also writes the report. The same converter runs in the browser (Import IFC in the web app).
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
bimdown import-ifc Duplex_A.ifc ./duplex
|
|
66
87
|
```
|
|
67
88
|
|
|
68
89
|
## Development
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/utils/geojson-core.ts
|
|
4
|
+
function parseGeoJsonText(text, label = "GeoJSON") {
|
|
5
|
+
if (text.charCodeAt(0) === 65279) text = text.slice(1);
|
|
6
|
+
if (text.trim() === "") return { type: "FeatureCollection", features: [] };
|
|
7
|
+
let parsed;
|
|
8
|
+
try {
|
|
9
|
+
parsed = JSON.parse(text);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw new Error(`Failed to parse GeoJSON at ${label}: ${e.message}`);
|
|
12
|
+
}
|
|
13
|
+
if (!parsed || typeof parsed !== "object" || parsed.type !== "FeatureCollection") {
|
|
14
|
+
throw new Error(`Expected FeatureCollection at ${label}, got ${parsed?.type ?? typeof parsed}`);
|
|
15
|
+
}
|
|
16
|
+
const fc = parsed;
|
|
17
|
+
if (!Array.isArray(fc.features)) {
|
|
18
|
+
throw new Error(`FeatureCollection at ${label} has no features array`);
|
|
19
|
+
}
|
|
20
|
+
return fc;
|
|
21
|
+
}
|
|
22
|
+
function stringifyFeatureCollection(fc) {
|
|
23
|
+
const lines = ["{", ' "type": "FeatureCollection",', ' "features": ['];
|
|
24
|
+
for (let i = 0; i < fc.features.length; i++) {
|
|
25
|
+
const sep = i === fc.features.length - 1 ? "" : ",";
|
|
26
|
+
lines.push(" " + JSON.stringify(fc.features[i]) + sep);
|
|
27
|
+
}
|
|
28
|
+
lines.push(" ]", "}");
|
|
29
|
+
return lines.join("\n") + "\n";
|
|
30
|
+
}
|
|
31
|
+
function extractLineGeometry(feature) {
|
|
32
|
+
const g = feature.geometry;
|
|
33
|
+
if (g.type !== "LineString") {
|
|
34
|
+
throw new Error(`Feature ${featureId(feature)} expected LineString, got ${g.type}`);
|
|
35
|
+
}
|
|
36
|
+
const coords = g.coordinates;
|
|
37
|
+
if (coords.length < 2) {
|
|
38
|
+
throw new Error(`Feature ${featureId(feature)} LineString has fewer than 2 coordinates`);
|
|
39
|
+
}
|
|
40
|
+
const first = coords[0];
|
|
41
|
+
const last = coords[coords.length - 1];
|
|
42
|
+
const out = {
|
|
43
|
+
start_x: first[0],
|
|
44
|
+
start_y: first[1],
|
|
45
|
+
end_x: last[0],
|
|
46
|
+
end_y: last[1],
|
|
47
|
+
length: 0
|
|
48
|
+
};
|
|
49
|
+
if (first.length === 3) out.start_z = first[2];
|
|
50
|
+
if (last.length === 3) out.end_z = last[2];
|
|
51
|
+
const arc = feature.properties.arc;
|
|
52
|
+
if (arc) {
|
|
53
|
+
out.arc = arc;
|
|
54
|
+
out.length = arcLength(first[0], first[1], last[0], last[1], arc);
|
|
55
|
+
} else {
|
|
56
|
+
const dx = last[0] - first[0];
|
|
57
|
+
const dy = last[1] - first[1];
|
|
58
|
+
const dz = (last[2] ?? 0) - (first[2] ?? 0);
|
|
59
|
+
out.length = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
function extractPointGeometry(feature) {
|
|
64
|
+
const g = feature.geometry;
|
|
65
|
+
if (g.type !== "Point") {
|
|
66
|
+
throw new Error(`Feature ${featureId(feature)} expected Point, got ${g.type}`);
|
|
67
|
+
}
|
|
68
|
+
const c = g.coordinates;
|
|
69
|
+
return {
|
|
70
|
+
x: c[0],
|
|
71
|
+
y: c[1],
|
|
72
|
+
z: c.length === 3 ? c[2] : void 0,
|
|
73
|
+
rotation: typeof feature.properties.rotation === "number" ? feature.properties.rotation : 0
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function extractPolygonGeometry(feature) {
|
|
77
|
+
const g = feature.geometry;
|
|
78
|
+
if (g.type !== "Polygon") {
|
|
79
|
+
throw new Error(`Feature ${featureId(feature)} expected Polygon, got ${g.type}`);
|
|
80
|
+
}
|
|
81
|
+
const rings = g.coordinates;
|
|
82
|
+
if (rings.length === 0) {
|
|
83
|
+
return { outer: [], holes: [], area: 0 };
|
|
84
|
+
}
|
|
85
|
+
const outer = ringTo2D(rings[0]);
|
|
86
|
+
const holes = rings.slice(1).map(ringTo2D);
|
|
87
|
+
let area = Math.abs(shoelace(outer));
|
|
88
|
+
for (const h of holes) {
|
|
89
|
+
area -= Math.abs(shoelace(h));
|
|
90
|
+
}
|
|
91
|
+
return { outer, holes, area: Math.max(0, area) };
|
|
92
|
+
}
|
|
93
|
+
function ringTo2D(ring) {
|
|
94
|
+
let end = ring.length;
|
|
95
|
+
if (end >= 2) {
|
|
96
|
+
const first = ring[0];
|
|
97
|
+
const last = ring[ring.length - 1];
|
|
98
|
+
if (first[0] === last[0] && first[1] === last[1]) end -= 1;
|
|
99
|
+
}
|
|
100
|
+
const out = [];
|
|
101
|
+
for (let i = 0; i < end; i++) {
|
|
102
|
+
out.push({ x: ring[i][0], y: ring[i][1] });
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
function shoelace(ring) {
|
|
107
|
+
let a = 0;
|
|
108
|
+
for (let i = 0; i < ring.length; i++) {
|
|
109
|
+
const j = (i + 1) % ring.length;
|
|
110
|
+
a += ring[i].x * ring[j].y - ring[j].x * ring[i].y;
|
|
111
|
+
}
|
|
112
|
+
return a / 2;
|
|
113
|
+
}
|
|
114
|
+
function arcLength(x1, y1, x2, y2, arc) {
|
|
115
|
+
const r = Math.abs(arc.radius);
|
|
116
|
+
if (r === 0) return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
|
|
117
|
+
const chord = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
|
|
118
|
+
const half = Math.min(1, chord / (2 * r));
|
|
119
|
+
const sweepAngle = arc.large_arc ? 2 * Math.PI - 2 * Math.asin(half) : 2 * Math.asin(half);
|
|
120
|
+
return r * sweepAngle;
|
|
121
|
+
}
|
|
122
|
+
function featureId(feature) {
|
|
123
|
+
const id = feature.properties?.id;
|
|
124
|
+
return typeof id === "string" ? id : "<unknown>";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/utils/geojson.ts
|
|
128
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
129
|
+
function parseGeoJsonFile(filePath) {
|
|
130
|
+
return parseGeoJsonText(readFileSync(filePath, "utf-8"), filePath);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
parseGeoJsonText,
|
|
135
|
+
stringifyFeatureCollection,
|
|
136
|
+
extractLineGeometry,
|
|
137
|
+
extractPointGeometry,
|
|
138
|
+
extractPolygonGeometry,
|
|
139
|
+
featureId,
|
|
140
|
+
parseGeoJsonFile
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=chunk-4SKM4RHY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/geojson-core.ts","../src/utils/geojson.ts"],"sourcesContent":["/**\n * GeoJSON types, parsing and geometry helpers for BimDown geometry files\n * (no file access: shared with the browser IFC importer; file I/O in geojson.ts).\n *\n * BimDown uses a strict subset of GeoJSON (see spec/geojson-schema/readme.md):\n * - FeatureCollection at the top level\n * - Per Feature: properties.id (matches CSV row) + geometry (Point, LineString, or Polygon)\n * - 2D coords [x, y] for level-anchored elements (walls, slabs, columns, ...)\n * - 3D coords [x, y, z] for spatial elements (beams, ducts, ...)\n *\n * Optional properties carry numeric geometry hints:\n * - base_offset, top_offset (meters): Z offsets for level-anchored elements\n * - arc: { radius, large_arc, sweep } for curved LineStrings\n * - rotation (degrees CCW about +Z) for Point elements\n */\n\nexport type Position = [number, number] | [number, number, number];\n\nexport interface PointGeometryJson {\n type: 'Point';\n coordinates: Position;\n}\n\nexport interface LineStringGeometryJson {\n type: 'LineString';\n coordinates: Position[];\n}\n\nexport interface PolygonGeometryJson {\n type: 'Polygon';\n /** First ring is the outer ring; subsequent rings are holes. */\n coordinates: Position[][];\n}\n\nexport type GeoJsonGeometry = PointGeometryJson | LineStringGeometryJson | PolygonGeometryJson;\n\nexport interface ArcParams {\n radius: number;\n large_arc: boolean;\n sweep: boolean;\n}\n\nexport interface BimDownFeatureProperties {\n id: string;\n base_offset?: number;\n top_offset?: number;\n arc?: ArcParams;\n rotation?: number;\n /** Any additional AI-emitted hints — preserved on round-trip until normalized away. */\n [key: string]: unknown;\n}\n\nexport interface BimDownFeature {\n type: 'Feature';\n properties: BimDownFeatureProperties;\n geometry: GeoJsonGeometry;\n}\n\nexport interface BimDownFeatureCollection {\n type: 'FeatureCollection';\n features: BimDownFeature[];\n}\n\n// ─── Parsing ──────────────────────────────────────────────\n\n/** Parse GeoJSON text (`label` names it in errors). An empty text has no features. */\nexport function parseGeoJsonText(text: string, label = 'GeoJSON'): BimDownFeatureCollection {\n if (text.charCodeAt(0) === 0xfeff) text = text.slice(1);\n // An empty file (e.g. a layer whose last geometry row was removed) has no features.\n if (text.trim() === '') return { type: 'FeatureCollection', features: [] };\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch (e: any) {\n throw new Error(`Failed to parse GeoJSON at ${label}: ${e.message}`);\n }\n\n if (!parsed || typeof parsed !== 'object' || (parsed as any).type !== 'FeatureCollection') {\n throw new Error(`Expected FeatureCollection at ${label}, got ${(parsed as any)?.type ?? typeof parsed}`);\n }\n\n const fc = parsed as BimDownFeatureCollection;\n if (!Array.isArray(fc.features)) {\n throw new Error(`FeatureCollection at ${label} has no features array`);\n }\n\n return fc;\n}\n\n// ─── Serialization ────────────────────────────────────────\n\n/**\n * Pretty-print a FeatureCollection with one feature per line (compact coords)\n * for human readability and clean diffs.\n */\nexport function stringifyFeatureCollection(fc: BimDownFeatureCollection): string {\n const lines: string[] = ['{', ' \"type\": \"FeatureCollection\",', ' \"features\": ['];\n for (let i = 0; i < fc.features.length; i++) {\n const sep = i === fc.features.length - 1 ? '' : ',';\n lines.push(' ' + JSON.stringify(fc.features[i]) + sep);\n }\n lines.push(' ]', '}');\n return lines.join('\\n') + '\\n';\n}\n\n// ─── Geometry extraction (used by hydrate & validate) ─────\n\nexport interface LineGeometry {\n start_x: number;\n start_y: number;\n start_z?: number;\n end_x: number;\n end_y: number;\n end_z?: number;\n length: number;\n arc?: ArcParams;\n}\n\nexport interface PointGeometry {\n x: number;\n y: number;\n z?: number;\n rotation: number;\n}\n\nexport interface PolygonGeometry {\n /** Outer ring, 2D, with closing duplicate vertex removed. */\n outer: { x: number; y: number }[];\n /** Holes, each ring same convention as outer. */\n holes: { x: number; y: number }[][];\n /** Signed area of the outer ring minus holes (always returned as absolute m²). */\n area: number;\n}\n\nexport function extractLineGeometry(feature: BimDownFeature): LineGeometry {\n const g = feature.geometry;\n if (g.type !== 'LineString') {\n throw new Error(`Feature ${featureId(feature)} expected LineString, got ${g.type}`);\n }\n const coords = g.coordinates;\n if (coords.length < 2) {\n throw new Error(`Feature ${featureId(feature)} LineString has fewer than 2 coordinates`);\n }\n // Canonical form is 2 coords; if more, use first and last.\n const first = coords[0];\n const last = coords[coords.length - 1];\n const out: LineGeometry = {\n start_x: first[0],\n start_y: first[1],\n end_x: last[0],\n end_y: last[1],\n length: 0,\n };\n if (first.length === 3) out.start_z = first[2];\n if (last.length === 3) out.end_z = last[2];\n\n const arc = feature.properties.arc;\n if (arc) {\n out.arc = arc;\n out.length = arcLength(first[0], first[1], last[0], last[1], arc);\n } else {\n const dx = last[0] - first[0];\n const dy = last[1] - first[1];\n const dz = (last[2] ?? 0) - (first[2] ?? 0);\n out.length = Math.sqrt(dx * dx + dy * dy + dz * dz);\n }\n return out;\n}\n\nexport function extractPointGeometry(feature: BimDownFeature): PointGeometry {\n const g = feature.geometry;\n if (g.type !== 'Point') {\n throw new Error(`Feature ${featureId(feature)} expected Point, got ${g.type}`);\n }\n const c = g.coordinates;\n return {\n x: c[0],\n y: c[1],\n z: c.length === 3 ? c[2] : undefined,\n rotation: typeof feature.properties.rotation === 'number' ? feature.properties.rotation : 0,\n };\n}\n\nexport function extractPolygonGeometry(feature: BimDownFeature): PolygonGeometry {\n const g = feature.geometry;\n if (g.type !== 'Polygon') {\n throw new Error(`Feature ${featureId(feature)} expected Polygon, got ${g.type}`);\n }\n const rings = g.coordinates;\n if (rings.length === 0) {\n return { outer: [], holes: [], area: 0 };\n }\n const outer = ringTo2D(rings[0]);\n const holes = rings.slice(1).map(ringTo2D);\n let area = Math.abs(shoelace(outer));\n for (const h of holes) {\n area -= Math.abs(shoelace(h));\n }\n return { outer, holes, area: Math.max(0, area) };\n}\n\nfunction ringTo2D(ring: Position[]): { x: number; y: number }[] {\n // Drop the closing duplicate vertex if present.\n let end = ring.length;\n if (end >= 2) {\n const first = ring[0];\n const last = ring[ring.length - 1];\n if (first[0] === last[0] && first[1] === last[1]) end -= 1;\n }\n const out: { x: number; y: number }[] = [];\n for (let i = 0; i < end; i++) {\n out.push({ x: ring[i][0], y: ring[i][1] });\n }\n return out;\n}\n\nfunction shoelace(ring: { x: number; y: number }[]): number {\n let a = 0;\n for (let i = 0; i < ring.length; i++) {\n const j = (i + 1) % ring.length;\n a += ring[i].x * ring[j].y - ring[j].x * ring[i].y;\n }\n return a / 2;\n}\n\n/**\n * Length of an SVG-style arc from (x1,y1) to (x2,y2) with radius r and flags.\n * Used for hydrating `length` on curved walls/ramps.\n */\nexport function arcLength(x1: number, y1: number, x2: number, y2: number, arc: ArcParams): number {\n const r = Math.abs(arc.radius);\n if (r === 0) return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);\n const chord = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);\n const half = Math.min(1, chord / (2 * r));\n const sweepAngle = arc.large_arc ? 2 * Math.PI - 2 * Math.asin(half) : 2 * Math.asin(half);\n return r * sweepAngle;\n}\n\n// ─── Helpers ──────────────────────────────────────────────\n\nexport function featureId(feature: BimDownFeature): string {\n const id = feature.properties?.id;\n return typeof id === 'string' ? id : '<unknown>';\n}\n\n/**\n * Compute axis-aligned bounding box of a geometry. Returns null for empty.\n * Z is included only if all coordinates carry Z.\n */\nexport function geometryBounds(g: GeoJsonGeometry):\n | { minX: number; minY: number; maxX: number; maxY: number; minZ?: number; maxZ?: number }\n | null {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let minZ = Infinity, maxZ = -Infinity;\n let allHaveZ = true;\n let anyCoord = false;\n\n const visit = (p: Position) => {\n anyCoord = true;\n if (p[0] < minX) minX = p[0];\n if (p[0] > maxX) maxX = p[0];\n if (p[1] < minY) minY = p[1];\n if (p[1] > maxY) maxY = p[1];\n if (p.length === 3) {\n if (p[2] < minZ) minZ = p[2];\n if (p[2] > maxZ) maxZ = p[2];\n } else {\n allHaveZ = false;\n }\n };\n\n if (g.type === 'Point') visit(g.coordinates);\n else if (g.type === 'LineString') for (const p of g.coordinates) visit(p);\n else if (g.type === 'Polygon') for (const ring of g.coordinates) for (const p of ring) visit(p);\n\n if (!anyCoord) return null;\n const out: { minX: number; minY: number; maxX: number; maxY: number; minZ?: number; maxZ?: number } = {\n minX, minY, maxX, maxY,\n };\n if (allHaveZ) { out.minZ = minZ; out.maxZ = maxZ; }\n return out;\n}\n","/**\n * GeoJSON file I/O for BimDown geometry files; types and helpers live in\n * geojson-core.ts (no file access).\n */\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { parseGeoJsonText, stringifyFeatureCollection, type BimDownFeatureCollection } from './geojson-core.js';\n\nexport * from './geojson-core.js';\n\nexport function parseGeoJsonFile(filePath: string): BimDownFeatureCollection {\n return parseGeoJsonText(readFileSync(filePath, 'utf-8'), filePath);\n}\n\nexport function writeGeoJsonFile(filePath: string, fc: BimDownFeatureCollection): void {\n const json = stringifyFeatureCollection(fc);\n writeFileSync(filePath, json, 'utf-8');\n}\n"],"mappings":";;;AAkEO,SAAS,iBAAiB,MAAc,QAAQ,WAAqC;AAC1F,MAAI,KAAK,WAAW,CAAC,MAAM,MAAQ,QAAO,KAAK,MAAM,CAAC;AAEtD,MAAI,KAAK,KAAK,MAAM,GAAI,QAAO,EAAE,MAAM,qBAAqB,UAAU,CAAC,EAAE;AAEzE,MAAI;AACJ,MAAI;AACF,aAAS,KAAK,MAAM,IAAI;AAAA,EAC1B,SAAS,GAAQ;AACf,UAAM,IAAI,MAAM,8BAA8B,KAAK,KAAK,EAAE,OAAO,EAAE;AAAA,EACrE;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,YAAa,OAAe,SAAS,qBAAqB;AACzF,UAAM,IAAI,MAAM,iCAAiC,KAAK,SAAU,QAAgB,QAAQ,OAAO,MAAM,EAAE;AAAA,EACzG;AAEA,QAAM,KAAK;AACX,MAAI,CAAC,MAAM,QAAQ,GAAG,QAAQ,GAAG;AAC/B,UAAM,IAAI,MA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AO,OAAO,WAAW,KAAK;AACvC;;;AChPA,SAAS,cAAc,qBAAqB;AAKrC,SAAS,iBAAiB,UAA4C;AAC3E,SAAO,iBAAiB,aAAa,UAAU,OAAO,GAAG,QAAQ;AACnE;","names":[]}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/schema/prefixes.ts
|
|
4
|
+
var ID_PREFIXES = {
|
|
5
|
+
level: "lv",
|
|
6
|
+
grid: "gr",
|
|
7
|
+
wall: "w",
|
|
8
|
+
column: "c",
|
|
9
|
+
slab: "sl",
|
|
10
|
+
space: "sp",
|
|
11
|
+
door: "d",
|
|
12
|
+
window: "wn",
|
|
13
|
+
stair: "st",
|
|
14
|
+
stair_run: "sr",
|
|
15
|
+
stair_landing: "sl_land",
|
|
16
|
+
ramp: "rp",
|
|
17
|
+
railing: "rl",
|
|
18
|
+
room_separator: "rs",
|
|
19
|
+
curtain_wall: "cw",
|
|
20
|
+
roof: "ro",
|
|
21
|
+
ceiling: "cl",
|
|
22
|
+
opening: "op",
|
|
23
|
+
structure_wall: "sw",
|
|
24
|
+
structure_column: "sc",
|
|
25
|
+
structure_slab: "ss",
|
|
26
|
+
beam: "bm",
|
|
27
|
+
brace: "br",
|
|
28
|
+
foundation: "f",
|
|
29
|
+
beam_system: "bs",
|
|
30
|
+
duct: "du",
|
|
31
|
+
pipe: "pi",
|
|
32
|
+
cable_tray: "ct",
|
|
33
|
+
conduit: "co",
|
|
34
|
+
equipment: "eq",
|
|
35
|
+
terminal: "tm",
|
|
36
|
+
mep_node: "mn",
|
|
37
|
+
connector: "cn",
|
|
38
|
+
circuit: "ci",
|
|
39
|
+
mep_system: "sys",
|
|
40
|
+
view: "vw",
|
|
41
|
+
mesh: "ms",
|
|
42
|
+
// Element types (global/ only) and the layers of layered types
|
|
43
|
+
wall_type: "wt",
|
|
44
|
+
slab_type: "slt",
|
|
45
|
+
roof_type: "rot",
|
|
46
|
+
ceiling_type: "clt",
|
|
47
|
+
door_type: "dt",
|
|
48
|
+
window_type: "wnt",
|
|
49
|
+
curtain_wall_type: "cwt",
|
|
50
|
+
column_type: "colt",
|
|
51
|
+
beam_type: "bmt",
|
|
52
|
+
furniture_type: "fut",
|
|
53
|
+
railing_type: "rlt",
|
|
54
|
+
foundation_type: "fdt",
|
|
55
|
+
type_layer: "tl",
|
|
56
|
+
// Annotations
|
|
57
|
+
dimension: "dm",
|
|
58
|
+
text_note: "tx",
|
|
59
|
+
tag: "tg",
|
|
60
|
+
// Tracing references
|
|
61
|
+
underlay: "ul",
|
|
62
|
+
furniture: "fu",
|
|
63
|
+
// Drawing sheets and the views placed on them
|
|
64
|
+
sheet: "sh",
|
|
65
|
+
sheet_viewport: "vp",
|
|
66
|
+
// Model group instances (members carry group_id)
|
|
67
|
+
model_group: "mg"
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/schema/registry.ts
|
|
71
|
+
import { join as join2, dirname } from "path";
|
|
72
|
+
import { existsSync } from "fs";
|
|
73
|
+
import { fileURLToPath } from "url";
|
|
74
|
+
|
|
75
|
+
// src/schema/loader.ts
|
|
76
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
77
|
+
import { join } from "path";
|
|
78
|
+
import { parse as parseYaml } from "yaml";
|
|
79
|
+
function loadAllSchemas(specDir) {
|
|
80
|
+
const schemas = /* @__PURE__ */ new Map();
|
|
81
|
+
walkYaml(specDir, schemas);
|
|
82
|
+
return schemas;
|
|
83
|
+
}
|
|
84
|
+
function walkYaml(dir, schemas) {
|
|
85
|
+
for (const entry of readdirSync(dir)) {
|
|
86
|
+
const full = join(dir, entry);
|
|
87
|
+
if (statSync(full).isDirectory()) {
|
|
88
|
+
walkYaml(full, schemas);
|
|
89
|
+
} else if (entry.endsWith(".yaml") || entry.endsWith(".yml")) {
|
|
90
|
+
const raw = parseYaml(readFileSync(full, "utf-8"));
|
|
91
|
+
if (raw?.name) schemas.set(raw.name, raw);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function resolveFields(name, schemas, resolved = /* @__PURE__ */ new Map()) {
|
|
96
|
+
if (resolved.has(name)) return resolved.get(name);
|
|
97
|
+
const schema = schemas.get(name);
|
|
98
|
+
if (!schema) throw new Error(`Unknown schema: ${name}`);
|
|
99
|
+
const fields = [];
|
|
100
|
+
const seen = /* @__PURE__ */ new Set();
|
|
101
|
+
for (const baseName of schema.bases ?? []) {
|
|
102
|
+
for (const f of resolveFields(baseName, schemas, resolved)) {
|
|
103
|
+
if (!seen.has(f.name)) {
|
|
104
|
+
seen.add(f.name);
|
|
105
|
+
fields.push(f);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const raw of schema.fields ?? []) {
|
|
110
|
+
const rf = normalizeField(raw);
|
|
111
|
+
const idx = fields.findIndex((f) => f.name === rf.name);
|
|
112
|
+
if (idx >= 0) {
|
|
113
|
+
fields[idx] = rf;
|
|
114
|
+
} else {
|
|
115
|
+
fields.push(rf);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
resolved.set(name, fields);
|
|
119
|
+
return fields;
|
|
120
|
+
}
|
|
121
|
+
function normalizeField(raw) {
|
|
122
|
+
return {
|
|
123
|
+
name: raw.name,
|
|
124
|
+
type: raw.type,
|
|
125
|
+
required: raw.required ?? false,
|
|
126
|
+
computed: raw.computed ?? false,
|
|
127
|
+
storage: raw.storage ?? "csv",
|
|
128
|
+
reference: raw.reference,
|
|
129
|
+
values: raw.values,
|
|
130
|
+
description: raw.description,
|
|
131
|
+
default: raw.default,
|
|
132
|
+
unit: raw.unit
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/schema/registry.ts
|
|
137
|
+
var TYPE_TABLES = /* @__PURE__ */ new Set([
|
|
138
|
+
"wall_type",
|
|
139
|
+
"slab_type",
|
|
140
|
+
"roof_type",
|
|
141
|
+
"ceiling_type",
|
|
142
|
+
"door_type",
|
|
143
|
+
"window_type",
|
|
144
|
+
"curtain_wall_type",
|
|
145
|
+
"column_type",
|
|
146
|
+
"beam_type",
|
|
147
|
+
"furniture_type",
|
|
148
|
+
"railing_type",
|
|
149
|
+
"foundation_type"
|
|
150
|
+
]);
|
|
151
|
+
var LAYERED_TYPE_TABLES = /* @__PURE__ */ new Set(["wall_type", "slab_type", "roof_type", "ceiling_type"]);
|
|
152
|
+
var ANNOTATION_TABLES = /* @__PURE__ */ new Set(["dimension", "text_note", "tag"]);
|
|
153
|
+
var VIEW_ANNOTATION_TABLES = /* @__PURE__ */ new Set(["dimension", "text_note"]);
|
|
154
|
+
var SHEET_TABLES = /* @__PURE__ */ new Set(["sheet", "sheet_viewport"]);
|
|
155
|
+
var LEVEL_ONLY_TABLES = /* @__PURE__ */ new Set(["model_group"]);
|
|
156
|
+
var GLOBAL_ONLY_TABLES = /* @__PURE__ */ new Set(["level", "grid", "mesh", "mep_system", "view", "underlay", ...SHEET_TABLES, ...TYPE_TABLES, "type_layer"]);
|
|
157
|
+
var TABLES_WITHOUT_GEOMETRY = /* @__PURE__ */ new Set([
|
|
158
|
+
"level",
|
|
159
|
+
"grid",
|
|
160
|
+
"door",
|
|
161
|
+
"window",
|
|
162
|
+
"mesh",
|
|
163
|
+
"mep_system",
|
|
164
|
+
"connector",
|
|
165
|
+
"view",
|
|
166
|
+
"underlay",
|
|
167
|
+
"circuit",
|
|
168
|
+
...SHEET_TABLES,
|
|
169
|
+
...TYPE_TABLES,
|
|
170
|
+
"type_layer",
|
|
171
|
+
...ANNOTATION_TABLES,
|
|
172
|
+
"model_group"
|
|
173
|
+
]);
|
|
174
|
+
var GEOJSON_FILE_NAMES = Object.fromEntries(
|
|
175
|
+
Object.keys(ID_PREFIXES).filter((k) => !TABLES_WITHOUT_GEOMETRY.has(k)).map((k) => [k, k])
|
|
176
|
+
);
|
|
177
|
+
var TABLES_WITH_GEOMETRY = new Set(Object.keys(GEOJSON_FILE_NAMES));
|
|
178
|
+
var SPATIAL_3D_TABLES = /* @__PURE__ */ new Set([
|
|
179
|
+
"stair",
|
|
180
|
+
"stair_run",
|
|
181
|
+
"ramp",
|
|
182
|
+
"railing",
|
|
183
|
+
"beam",
|
|
184
|
+
"brace",
|
|
185
|
+
"duct",
|
|
186
|
+
"pipe",
|
|
187
|
+
"cable_tray",
|
|
188
|
+
"conduit",
|
|
189
|
+
"equipment",
|
|
190
|
+
"terminal",
|
|
191
|
+
"mep_node"
|
|
192
|
+
]);
|
|
193
|
+
var _registry = null;
|
|
194
|
+
var _specDir = null;
|
|
195
|
+
function buildRegistry(specDir) {
|
|
196
|
+
if (_registry && _specDir === specDir) return _registry;
|
|
197
|
+
const schemas = loadAllSchemas(join2(specDir, "csv-schema"));
|
|
198
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
199
|
+
const registry = /* @__PURE__ */ new Map();
|
|
200
|
+
for (const [name, schema] of schemas) {
|
|
201
|
+
if (schema.abstract) continue;
|
|
202
|
+
const prefix = ID_PREFIXES[name];
|
|
203
|
+
if (!prefix) continue;
|
|
204
|
+
const allFields = resolveFields(name, schemas, resolved);
|
|
205
|
+
const csvFields = allFields.filter((f) => !f.computed && f.storage === "csv");
|
|
206
|
+
const geojsonPropertyFields = allFields.filter((f) => !f.computed && f.storage === "geojson_property");
|
|
207
|
+
const computedFields = allFields.filter((f) => f.computed);
|
|
208
|
+
const typeRef = allFields.find((f) => f.name === "type_id" && f.type === "reference")?.reference;
|
|
209
|
+
registry.set(name, {
|
|
210
|
+
name,
|
|
211
|
+
prefix,
|
|
212
|
+
description: schema.description,
|
|
213
|
+
hostType: schema.host_type,
|
|
214
|
+
typeTable: typeRef && TYPE_TABLES.has(typeRef) ? typeRef : void 0,
|
|
215
|
+
typeOf: schema.type_of,
|
|
216
|
+
allFields,
|
|
217
|
+
csvFields,
|
|
218
|
+
geojsonPropertyFields,
|
|
219
|
+
computedFields
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
_registry = registry;
|
|
223
|
+
_specDir = specDir;
|
|
224
|
+
return registry;
|
|
225
|
+
}
|
|
226
|
+
function getSpecDir() {
|
|
227
|
+
if (process.env.SPEC_DIR) return process.env.SPEC_DIR;
|
|
228
|
+
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
229
|
+
const bundledPath = join2(thisDir, "spec");
|
|
230
|
+
if (existsSync(bundledPath)) return bundledPath;
|
|
231
|
+
let current = thisDir;
|
|
232
|
+
for (let i = 0; i < 5; i++) {
|
|
233
|
+
const candidate = join2(current, "spec");
|
|
234
|
+
if (existsSync(candidate)) return candidate;
|
|
235
|
+
const parent = dirname(current);
|
|
236
|
+
if (parent === current) break;
|
|
237
|
+
current = parent;
|
|
238
|
+
}
|
|
239
|
+
return join2(process.cwd(), "spec");
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export {
|
|
243
|
+
ID_PREFIXES,
|
|
244
|
+
TYPE_TABLES,
|
|
245
|
+
LAYERED_TYPE_TABLES,
|
|
246
|
+
ANNOTATION_TABLES,
|
|
247
|
+
VIEW_ANNOTATION_TABLES,
|
|
248
|
+
LEVEL_ONLY_TABLES,
|
|
249
|
+
GLOBAL_ONLY_TABLES,
|
|
250
|
+
GEOJSON_FILE_NAMES,
|
|
251
|
+
SPATIAL_3D_TABLES,
|
|
252
|
+
buildRegistry,
|
|
253
|
+
getSpecDir
|
|
254
|
+
};
|
|
255
|
+
//# sourceMappingURL=chunk-4YHVOWS4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema/prefixes.ts","../src/schema/registry.ts","../src/schema/loader.ts"],"sourcesContent":["/** Short-id prefix per BimDown table: `{prefix}-{n}`. */\nexport const ID_PREFIXES: Record<string, string> = {\n level: 'lv', grid: 'gr', wall: 'w', column: 'c', slab: 'sl',\n space: 'sp', door: 'd', window: 'wn', stair: 'st',\n stair_run: 'sr', stair_landing: 'sl_land',\n ramp: 'rp', railing: 'rl', room_separator: 'rs',\n curtain_wall: 'cw', roof: 'ro', ceiling: 'cl', opening: 'op',\n structure_wall: 'sw', structure_column: 'sc', structure_slab: 'ss',\n beam: 'bm', brace: 'br', foundation: 'f', beam_system: 'bs',\n duct: 'du', pipe: 'pi', cable_tray: 'ct', conduit: 'co',\n equipment: 'eq', terminal: 'tm', mep_node: 'mn',\n connector: 'cn', circuit: 'ci',\n mep_system: 'sys',\n view: 'vw',\n mesh: 'ms',\n // Element types (global/ only) and the layers of layered types\n wall_type: 'wt', slab_type: 'slt', roof_type: 'rot', ceiling_type: 'clt',\n door_type: 'dt', window_type: 'wnt', curtain_wall_type: 'cwt',\n column_type: 'colt', beam_type: 'bmt', furniture_type: 'fut', railing_type: 'rlt',\n foundation_type: 'fdt',\n type_layer: 'tl',\n // Annotations\n dimension: 'dm', text_note: 'tx', tag: 'tg',\n // Tracing references\n underlay: 'ul',\n furniture: 'fu',\n // Drawing sheets and the views placed on them\n sheet: 'sh', sheet_viewport: 'vp',\n // Model group instances (members carry group_id)\n model_group: 'mg',\n};\n","import { join, dirname } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport type { ResolvedTable, ResolvedField } from './types.js';\nimport { loadAllSchemas, resolveFields } from './loader.js';\nimport { ID_PREFIXES } from './prefixes.js';\n\n// Short-id prefix per table (in a node-free module so browser code can use it too).\nexport { ID_PREFIXES };\n\n/** Type tables (Revit \"family types\"). Each lists the instance tables that may reference it via `type_id`. */\nexport const TYPE_TABLES = new Set([\n 'wall_type', 'slab_type', 'roof_type', 'ceiling_type',\n 'door_type', 'window_type', 'curtain_wall_type',\n 'column_type', 'beam_type', 'furniture_type', 'railing_type', 'foundation_type',\n]);\n\n/** Type tables whose build-up is a stack of type_layer rows. */\nexport const LAYERED_TYPE_TABLES = new Set(['wall_type', 'slab_type', 'roof_type', 'ceiling_type']);\n\n// Annotation tables: CSV-only plan annotations in level directories; dimension and\n// text_note rows with a view_id (drawn on a section / elevation) live in global/.\nexport const ANNOTATION_TABLES = new Set(['dimension', 'text_note', 'tag']);\nexport const VIEW_ANNOTATION_TABLES = new Set(['dimension', 'text_note']);\n\n// Drawing sheets: title block + placed views, global/ only, ignored by build / render / query.\nexport const SHEET_TABLES = new Set(['sheet', 'sheet_viewport']);\n\n// Tables allowed in level directories only (never global/); plan annotations are\n// checked on their own (view annotations may sit in global/).\nexport const LEVEL_ONLY_TABLES = new Set(['model_group']);\n\n// Tables whose CSV lives only in global/ (not per-level)\nexport const GLOBAL_ONLY_TABLES = new Set(['level', 'grid', 'mesh', 'mep_system', 'view', 'underlay', ...SHEET_TABLES, ...TYPE_TABLES, 'type_layer']);\n\n// Tables that can appear in global/ (cross-floor elements)\nexport const GLOBAL_ALLOWED_TABLES = new Set([\n 'level', 'grid', 'view', 'stair', 'stair_run', 'stair_landing', 'railing',\n 'duct', 'pipe', 'cable_tray', 'conduit',\n 'equipment', 'terminal', 'mep_node',\n 'connector', 'circuit',\n 'structure_column', 'beam', 'brace',\n 'foundation',\n]);\n\n// Tables without a geometry file (level/grid use CSV inline; door/window are hosted; mesh is GLB;\n// mep_system is a project-wide lookup table with no geometry; connector is a CSV-only port\n// on its host equipment / terminal / mep_node, position is derived from host + offsets;\n// view rows carry their plan line inline like grid; underlay is a tracing reference\n// whose source file lives in underlays/; circuit is a CSV-only electrical circuit)\nconst TABLES_WITHOUT_GEOMETRY = new Set([\n 'level', 'grid', 'door', 'window', 'mesh', 'mep_system', 'connector', 'view', 'underlay', 'circuit',\n ...SHEET_TABLES, ...TYPE_TABLES, 'type_layer',\n ...ANNOTATION_TABLES,\n 'model_group',\n]);\n\n// GeoJSON file name mapping: table name -> geojson file name (without extension)\n// GeoJSON files use the same name as the CSV (both singular): wall.csv + wall.geojson\nexport const GEOJSON_FILE_NAMES: Record<string, string> = Object.fromEntries(\n Object.keys(ID_PREFIXES)\n .filter((k) => !TABLES_WITHOUT_GEOMETRY.has(k))\n .map((k) => [k, k]),\n);\n\n// Tables that have a GeoJSON geometry file\nexport const TABLES_WITH_GEOMETRY = new Set(Object.keys(GEOJSON_FILE_NAMES));\n\n// Tables whose elements use 3D coordinates (spatial line elements).\n// Level-anchored tables (wall, slab, column, etc.) use 2D coordinates + Z properties.\nexport const SPATIAL_3D_TABLES = new Set([\n 'stair', 'stair_run', 'ramp', 'railing',\n 'beam', 'brace',\n 'duct', 'pipe', 'cable_tray', 'conduit',\n 'equipment', 'terminal', 'mep_node',\n]);\n\nlet _registry: Map<string, ResolvedTable> | null = null;\nlet _specDir: string | null = null;\n\nexport function buildRegistry(specDir: string): Map<string, ResolvedTable> {\n if (_registry && _specDir === specDir) return _registry;\n\n const schemas = loadAllSchemas(join(specDir, 'csv-schema'));\n const resolved = new Map<string, ResolvedField[]>();\n const registry = new Map<string, ResolvedTable>();\n\n for (const [name, schema] of schemas) {\n if (schema.abstract) continue;\n\n const prefix = ID_PREFIXES[name];\n if (!prefix) continue; // skip unknown concrete schemas\n\n const allFields = resolveFields(name, schemas, resolved);\n const csvFields = allFields.filter((f) => !f.computed && f.storage === 'csv');\n const geojsonPropertyFields = allFields.filter((f) => !f.computed && f.storage === 'geojson_property');\n const computedFields = allFields.filter((f) => f.computed);\n\n const typeRef = allFields.find((f) => f.name === 'type_id' && f.type === 'reference')?.reference;\n registry.set(name, {\n name,\n prefix,\n description: schema.description,\n hostType: schema.host_type,\n typeTable: typeRef && TYPE_TABLES.has(typeRef) ? typeRef : undefined,\n typeOf: schema.type_of,\n allFields,\n csvFields,\n geojsonPropertyFields,\n computedFields,\n });\n }\n\n _registry = registry;\n _specDir = specDir;\n return registry;\n}\n\nexport function getSpecDir(): string {\n if (process.env.SPEC_DIR) return process.env.SPEC_DIR;\n\n const thisDir = dirname(fileURLToPath(import.meta.url));\n\n // 1. In bundled/installed mode: spec is a sibling to index.js (copied by tsup)\n const bundledPath = join(thisDir, 'spec');\n if (existsSync(bundledPath)) return bundledPath;\n\n // 2. In local dev mode: thisDir is cli/src/schema or cli/dist/spec/.. (if nested)\n // We need to go up until we find where 'spec' is.\n let current = thisDir;\n for (let i = 0; i < 5; i++) {\n const candidate = join(current, 'spec');\n if (existsSync(candidate)) return candidate;\n const parent = dirname(current);\n if (parent === current) break;\n current = parent;\n }\n\n // Fallback to project root spec if all else fails\n return join(process.cwd(), 'spec');\n}\n","import { readFileSync, readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport type { RawSchema, RawField, ResolvedField } from './types.js';\n\nexport function loadAllSchemas(specDir: string): Map<string, RawSchema> {\n const schemas = new Map<string, RawSchema>();\n walkYaml(specDir, schemas);\n return schemas;\n}\n\nfunction walkYaml(dir: string, schemas: Map<string, RawSchema>) {\n for (const entry of readdirSync(dir)) {\n const full = join(dir, entry);\n if (statSync(full).isDirectory()) {\n walkYaml(full, schemas);\n } else if (entry.endsWith('.yaml') || entry.endsWith('.yml')) {\n const raw = parseYaml(readFileSync(full, 'utf-8')) as RawSchema;\n if (raw?.name) schemas.set(raw.name, raw);\n }\n }\n}\n\nexport function resolveFields(\n name: string,\n schemas: Map<string, RawSchema>,\n resolved: Map<string, ResolvedField[]> = new Map(),\n): ResolvedField[] {\n if (resolved.has(name)) return resolved.get(name)!;\n\n const schema = schemas.get(name);\n if (!schema) throw new Error(`Unknown schema: ${name}`);\n\n const fields: ResolvedField[] = [];\n const seen = new Set<string>();\n\n // Resolve bases first (depth-first)\n for (const baseName of schema.bases ?? []) {\n for (const f of resolveFields(baseName, schemas, resolved)) {\n if (!seen.has(f.name)) {\n seen.add(f.name);\n fields.push(f);\n }\n }\n }\n\n // Add own fields (may override base fields)\n for (const raw of schema.fields ?? []) {\n const rf = normalizeField(raw);\n const idx = fields.findIndex((f) => f.name === rf.name);\n if (idx >= 0) {\n fields[idx] = rf;\n } else {\n fields.push(rf);\n }\n }\n\n resolved.set(name, fields);\n return fields;\n}\n\nfunction normalizeField(raw: RawField): ResolvedField {\n return {\n name: raw.name,\n type: raw.type,\n required: raw.required ?? false,\n computed: raw.computed ?? false,\n storage: raw.storage ?? 'csv',\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