@profullstack/dbml 0.1.0 → 0.3.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.
Files changed (2) hide show
  1. package/bin/dbml.js +13 -1
  2. package/package.json +1 -1
package/bin/dbml.js CHANGED
@@ -17,6 +17,7 @@ usage:
17
17
  dbml validate <file|-> syntax + semantic errors with line:column
18
18
  dbml parse <file|-> JSON model (tables, columns, refs, enums)
19
19
  dbml summary <file|-> counts and a per-table outline
20
+ dbml diagram <file|-> > schema.svg ER diagram as SVG
20
21
  dbml review <file|-> [--rules a,b] deterministic schema review, score 0-100
21
22
  dbml format <file|-> canonical DBML
22
23
  dbml to-sql <file|-> [--dialect postgres|mysql|mssql|oracle]
@@ -157,6 +158,13 @@ async function main() {
157
158
  else console.log(JSON.stringify(cmd === 'parse' && !json ? r.model : r, null, 2));
158
159
  return 0;
159
160
  }
161
+ case 'diagram': {
162
+ const r = await call('POST', '/api/v1/diagram', { dbml: await readSource(file) });
163
+ if (!r.valid) return printErrors(r.errors, file), 1;
164
+ if (json) console.log(JSON.stringify(r, null, 2));
165
+ else process.stdout.write(r.svg + '\n');
166
+ return 0;
167
+ }
160
168
  case 'review': {
161
169
  const rules = typeof flags.rules === 'string' ? flags.rules.split(',') : undefined;
162
170
  const r = await call('POST', '/api/v1/review', { dbml: await readSource(file), rules });
@@ -195,7 +203,11 @@ async function main() {
195
203
  }
196
204
  case 'from-sql': {
197
205
  const r = await call('POST', '/api/v1/sql-to-dbml', { sql: await readSource(file), dialect });
198
- if (!r.ok) return printErrors(r.errors, file), 1;
206
+ if (!r.ok) {
207
+ printErrors(r.errors, file);
208
+ if (r.hint) console.error(`hint: that file looks like DBML, not SQL. Use: dbml to-sql ${file || '-'}`);
209
+ return 1;
210
+ }
199
211
  process.stdout.write(json ? JSON.stringify(r, null, 2) + '\n' : r.dbml);
200
212
  return 0;
201
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/dbml",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "CLI and MCP stdio bridge for dbml.db: validate, review and convert DBML database schemas (DBML to SQL and back) from the terminal or an AI agent.",
5
5
  "type": "module",
6
6
  "bin": {