litedbmodel-gen 0.1.1 → 0.1.3

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 CHANGED
@@ -166,6 +166,8 @@ If your datasource is not named `schema`, specify it:
166
166
 
167
167
  ## CLI
168
168
 
169
+ **[📖 CLI Reference](./docs/cli-reference.md)** | **[📄 CLI Contract](./cli-contract.yaml)**
170
+
169
171
  ```bash
170
172
  # Initialize litedbmodel-gen in an embedoc project
171
173
  npx litedbmodel-gen init [config-path]
@@ -0,0 +1,94 @@
1
+ # yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json
2
+ cliContracts: 0.1.0
3
+
4
+ info:
5
+ title: litedbmodel-gen CLI
6
+ version: 0.1.2
7
+ description: >-
8
+ embedoc-based model code generator for litedbmodel.
9
+ Parses SQL DDL (PostgreSQL / MySQL / SQLite) and generates
10
+ TypeScript column definitions that stay in sync with your schema.
11
+ license:
12
+ name: MIT
13
+ contact:
14
+ name: foo-ogawa
15
+ url: https://github.com/foo-ogawa/litedbmodel.ts
16
+
17
+ commandSets:
18
+ litedbmodel-gen:
19
+ summary: embedoc-based model code generator for litedbmodel.
20
+ executable: litedbmodel-gen
21
+
22
+ globalOptions:
23
+ - name: version
24
+ aliases: [V]
25
+ description: Print version and exit.
26
+ schema:
27
+ type: boolean
28
+
29
+ - name: help
30
+ aliases: [h]
31
+ description: Show help and exit.
32
+ schema:
33
+ type: boolean
34
+
35
+ commands:
36
+ # ── init ────────────────────────────────────────────
37
+ init:
38
+ summary: Set up litedbmodel-gen in an embedoc project.
39
+ description: >-
40
+ Registers the sql_schema datasource, litedbmodel_columns renderer,
41
+ and model.hbs template into an existing embedoc project.
42
+ Copies the starter Handlebars template, updates
43
+ .embedoc/renderers/index.ts and .embedoc/datasources/index.ts,
44
+ and adds a schema datasource entry to embedoc.config.yaml.
45
+ usage:
46
+ - litedbmodel-gen init
47
+ - litedbmodel-gen init path/to/embedoc.config.yaml
48
+
49
+ arguments:
50
+ - name: config
51
+ index: 0
52
+ required: false
53
+ description: >-
54
+ Path to embedoc.config.yaml.
55
+ Defaults to embedoc.config.yaml in the current directory.
56
+ schema:
57
+ type: string
58
+ default: embedoc.config.yaml
59
+ file:
60
+ mode: read
61
+ exists: true
62
+ mediaType: application/yaml
63
+ encoding: utf-8
64
+
65
+ exits:
66
+ '0':
67
+ description: >-
68
+ litedbmodel-gen set up successfully.
69
+ Template copied, renderers/datasources registered,
70
+ and embedoc config updated.
71
+ stdout:
72
+ format: text
73
+ files:
74
+ - path: .embedoc/templates/model.hbs
75
+ required: false
76
+ mediaType: text/x-handlebars-template
77
+ encoding: utf-8
78
+ description: Starter Handlebars template for model files (skipped if already exists).
79
+
80
+ '1':
81
+ description: >-
82
+ Setup failed. The embedoc config file was not found
83
+ or a file operation failed.
84
+ stderr:
85
+ format: text
86
+
87
+ x-agent:
88
+ riskLevel: low
89
+ requiresConfirmation: false
90
+ idempotent: true
91
+ sideEffects:
92
+ - file_write
93
+ recommendedBeforeUse:
94
+ - Run "npx embedoc init" first to create embedoc.config.yaml.
@@ -0,0 +1,72 @@
1
+ # litedbmodel-gen CLI
2
+
3
+ embedoc-based model code generator for litedbmodel. Parses SQL DDL (PostgreSQL / MySQL / SQLite) and generates TypeScript column definitions that stay in sync with your schema.
4
+
5
+ **Version:** 0.1.2
6
+
7
+ ## Table of Contents
8
+
9
+ - [litedbmodel-gen](#litedbmodel-gen)
10
+ - [init](#litedbmodel-gen-init)
11
+
12
+ ---
13
+
14
+ ## litedbmodel-gen
15
+
16
+ embedoc-based model code generator for litedbmodel.
17
+
18
+ ### Global Options
19
+
20
+ | Option | Aliases | Required | Default | Description |
21
+ |---|---|---|---|---|
22
+ | `--version` | -V | No | | Print version and exit. |
23
+ | `--help` | -h | No | | Show help and exit. |
24
+
25
+ ### init
26
+
27
+ Set up litedbmodel-gen in an embedoc project.
28
+
29
+ Registers the sql_schema datasource, litedbmodel_columns renderer, and model.hbs template into an existing embedoc project. Copies the starter Handlebars template, updates .embedoc/renderers/index.ts and .embedoc/datasources/index.ts, and adds a schema datasource entry to embedoc.config.yaml.
30
+
31
+ **Usage:**
32
+
33
+ ```
34
+ litedbmodel-gen init
35
+ ```
36
+ ```
37
+ litedbmodel-gen init path/to/embedoc.config.yaml
38
+ ```
39
+
40
+ #### Arguments
41
+
42
+ | Name | Required | Description |
43
+ |---|---|---|
44
+ | `config` | No | Path to embedoc.config.yaml. Defaults to embedoc.config.yaml in the current directory. |
45
+
46
+ #### Exit Codes
47
+
48
+ **Exit 0:** litedbmodel-gen set up successfully. Template copied, renderers/datasources registered, and embedoc config updated.
49
+
50
+ - **stdout:** format=`text`
51
+
52
+ - **Generated files:**
53
+ - `.embedoc/templates/model.hbs` (text/x-handlebars-template) *(optional)*
54
+
55
+ **Exit 1:** Setup failed. The embedoc config file was not found or a file operation failed.
56
+
57
+ - **stderr:** format=`text`
58
+
59
+ #### Extensions
60
+
61
+ ```yaml
62
+ x-agent:
63
+ riskLevel: low
64
+ requiresConfirmation: false
65
+ idempotent: true
66
+ sideEffects:
67
+ - file_write
68
+ recommendedBeforeUse:
69
+ - Run "npx embedoc init" first to create embedoc.config.yaml.
70
+ ```
71
+
72
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litedbmodel-gen",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "embedoc-based model code generator for litedbmodel — generates TypeScript column definitions from SQL DDL (PostgreSQL/MySQL/SQLite)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,9 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
- "templates"
19
+ "templates",
20
+ "docs",
21
+ "cli-contract.yaml"
20
22
  ],
21
23
  "scripts": {
22
24
  "build": "tsup",
@@ -49,6 +51,7 @@
49
51
  "devDependencies": {
50
52
  "@types/js-yaml": "^4.0.9",
51
53
  "@types/node": "^25.3.3",
54
+ "cli-contracts": "^0.7.2",
52
55
  "embedoc": "^0.11.0",
53
56
  "tsup": "^8.0.1",
54
57
  "typescript": "^5.3.0",