bimdown-cli 0.1.5
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 +100 -0
- package/dist/index.js +2028 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# BimDown CLI
|
|
2
|
+
|
|
3
|
+
TypeScript CLI tool that serves as middleware between AI agents and the BimDown file format. Validates project structure, hydrates CSVs + SVGs into DuckDB for relational queries, and syncs changes back.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd cli
|
|
9
|
+
npm install
|
|
10
|
+
npm run build
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
### `bimdown validate <dir>`
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
node dist/index.js validate ../sample_data/architectural
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Output is one issue per line, prefixed with the file path:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
lv-1/door.csv:3 id "x-1" has wrong prefix, expected "d-"
|
|
27
|
+
global/level.csv:5 required field "elevation" is empty
|
|
28
|
+
lv-2/wall.svg forbidden tag <path> found
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### `bimdown query <dir> <sql>`
|
|
32
|
+
|
|
33
|
+
Hydrate the project into an in-memory DuckDB instance and execute SQL. All CSV partitions are unioned into logical tables, and computed geometry columns are injected from SVG files.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Tabular output
|
|
37
|
+
node dist/index.js query ../sample_data/architectural "SELECT id, material, length FROM wall WHERE length > 10 LIMIT 5"
|
|
38
|
+
|
|
39
|
+
# JSON output
|
|
40
|
+
node dist/index.js query ../sample_data/architectural "SELECT id, width FROM door LIMIT 3" --json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `bimdown sync <dir>`
|
|
44
|
+
|
|
45
|
+
Hydrate into DuckDB, then dehydrate back to files — strips computed columns, re-partitions rows by level, and writes CSVs.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node dist/index.js sync ../sample_data/architectural
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### `bimdown info <dir>`
|
|
52
|
+
|
|
53
|
+
Print project summary: levels with elevations, element counts per level, and totals.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
node dist/index.js info ../sample_data/architectural
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `bimdown schema [table]`
|
|
60
|
+
|
|
61
|
+
Print the resolved schema for a table (or all tables), showing CSV fields, computed fields, types, and constraints.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
node dist/index.js schema wall
|
|
65
|
+
node dist/index.js schema # all tables
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run dev # watch mode
|
|
72
|
+
npm test # run vitest
|
|
73
|
+
npm run test:watch # vitest watch mode
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Architecture
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
src/
|
|
80
|
+
index.ts # CLI entry point (commander)
|
|
81
|
+
schema/
|
|
82
|
+
types.ts # TypeScript types for schema definitions
|
|
83
|
+
loader.ts # Parse YAML schemas, resolve mixin inheritance
|
|
84
|
+
registry.ts # Table registry: name -> resolved fields, prefix
|
|
85
|
+
validate/
|
|
86
|
+
index.ts # Orchestrate all validation checks
|
|
87
|
+
structure.ts # Directory structure validation
|
|
88
|
+
csv.ts # CSV header, required field, enum validation
|
|
89
|
+
ids.ts # ID format + uniqueness validation
|
|
90
|
+
svg.ts # SVG strict subset validation
|
|
91
|
+
references.ts # Foreign key / reference validation
|
|
92
|
+
duckdb/
|
|
93
|
+
engine.ts # DuckDB lifecycle and query execution
|
|
94
|
+
hydrate.ts # CSV partition union + SVG geometry injection
|
|
95
|
+
dehydrate.ts # Strip computed columns, re-partition, write CSVs
|
|
96
|
+
utils/
|
|
97
|
+
csv.ts # CSV read/write with BOM and quote handling
|
|
98
|
+
svg.ts # SVG parsing and geometry extraction
|
|
99
|
+
fs.ts # Directory traversal, level discovery
|
|
100
|
+
```
|