embedoc 0.10.2 → 0.11.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.
@@ -0,0 +1,260 @@
1
+ # embedoc CLI
2
+
3
+ In-place document generator that auto-updates marker blocks in documents and source code while preserving manually edited sections. Supports multiple datasources (SQLite, CSV, JSON, YAML, glob), programmable TypeScript renderers, Handlebars file generation, and incremental builds with dependency tracking.
4
+
5
+ **Version:** 0.11.1
6
+
7
+ ## Table of Contents
8
+
9
+ - [embedoc](#embedoc)
10
+ - [init](#embedoc-init)
11
+ - [build](#embedoc-build)
12
+ - [generate](#embedoc-generate)
13
+ - [watch](#embedoc-watch)
14
+
15
+ ---
16
+
17
+ ## embedoc
18
+
19
+ In-place document generator with marker-based embedding.
20
+
21
+ ### Global Options
22
+
23
+ | Option | Aliases | Required | Default | Description |
24
+ |---|---|---|---|---|
25
+ | `--version` | -V | No | | Print version and exit. |
26
+ | `--help` | -h | No | | Show help and exit. |
27
+
28
+ ### init
29
+
30
+ Initialize embedoc in the current project.
31
+
32
+ Creates starter configuration and directory structure: embedoc.config.yaml, .embedoc/renderers/index.ts, .embedoc/datasources/index.ts, and .embedoc/templates/. If package.json exists, adds embedoc:build, embedoc:watch, and embedoc:generate npm scripts.
33
+
34
+ **Usage:**
35
+
36
+ ```
37
+ embedoc init
38
+ ```
39
+ ```
40
+ embedoc init --force
41
+ ```
42
+
43
+ #### Options
44
+
45
+ | Option | Aliases | Required | Default | Description |
46
+ |---|---|---|---|---|
47
+ | `--force` | -f | No | `false` | Overwrite existing files. |
48
+
49
+ #### Exit Codes
50
+
51
+ **Exit 0:** Initialization succeeded.
52
+
53
+ - **stdout:** format=`text`
54
+
55
+ - **Generated files:**
56
+ - `embedoc.config.yaml` (application/yaml) *(optional)*
57
+ - `.embedoc/renderers/index.ts` (text/x-typescript) *(optional)*
58
+ - `.embedoc/datasources/index.ts` (text/x-typescript) *(optional)*
59
+ - `.embedoc/templates/.gitkeep` *(optional)*
60
+
61
+ **Exit 1:** Initialization failed (write error).
62
+
63
+ - **stderr:** format=`text`
64
+
65
+ #### Extensions
66
+
67
+ ```yaml
68
+ x-agent:
69
+ riskLevel: low
70
+ requiresConfirmation: false
71
+ idempotent: true
72
+ sideEffects:
73
+ - file_write
74
+ - directory_create
75
+ ```
76
+
77
+ ---
78
+
79
+ ### build
80
+
81
+ Build documents by replacing markers with rendered content.
82
+
83
+ Loads configuration, initializes datasources, loads TypeScript renderers, and processes all target files (or specific files if provided). Each @embedoc marker block is re-rendered and the content between start/end markers is replaced in-place.
84
+
85
+ **Usage:**
86
+
87
+ ```
88
+ embedoc build
89
+ ```
90
+ ```
91
+ embedoc build --config embedoc.config.yaml
92
+ ```
93
+ ```
94
+ embedoc build ./docs/tables/users.md
95
+ ```
96
+ ```
97
+ embedoc build --dry-run --verbose
98
+ ```
99
+
100
+ #### Arguments
101
+
102
+ | Name | Required | Description |
103
+ |---|---|---|
104
+ | `files` *(variadic)* | No | Specific file paths to process. If omitted, processes all targets from config. |
105
+
106
+ #### Options
107
+
108
+ | Option | Aliases | Required | Default | Description |
109
+ |---|---|---|---|---|
110
+ | `--config` | -c | No | `"embedoc.config.yaml"` | Path to config file (YAML or JSON). |
111
+ | `--dry-run` | -d | No | `false` | Preview changes without writing files. |
112
+ | `--verbose` | -v | No | `false` | Enable verbose output. |
113
+
114
+ #### Exit Codes
115
+
116
+ **Exit 0:** Build succeeded. All markers were processed without errors.
117
+
118
+ - **stdout:** format=`text`
119
+
120
+ **Exit 1:** Build failed (config not found, datasource error, or marker processing error).
121
+
122
+ - **stderr:** format=`text`
123
+
124
+ #### Extensions
125
+
126
+ ```yaml
127
+ x-agent:
128
+ riskLevel: medium
129
+ requiresConfirmation: false
130
+ idempotent: true
131
+ sideEffects:
132
+ - file_write
133
+ safeDryRunOption: --dry-run
134
+ recommendedBeforeUse:
135
+ - Ensure embedoc.config.yaml exists (run init if needed).
136
+ - Verify datasource files are accessible.
137
+ ```
138
+
139
+ ---
140
+
141
+ ### generate
142
+
143
+ Generate new files from datasource records using Handlebars templates.
144
+
145
+ Reads datasource records and generates new files using Handlebars templates defined in the generators config. Requires either --datasource to process a specific datasource or --all to process all datasources that have generators configured. Optionally filter by generator template name with --generator.
146
+
147
+ **Usage:**
148
+
149
+ ```
150
+ embedoc generate --datasource tables
151
+ ```
152
+ ```
153
+ embedoc generate --all
154
+ ```
155
+ ```
156
+ embedoc generate --datasource tables --generator table_doc.hbs
157
+ ```
158
+ ```
159
+ embedoc generate --all --dry-run --verbose
160
+ ```
161
+
162
+ #### Options
163
+
164
+ | Option | Aliases | Required | Default | Description |
165
+ |---|---|---|---|---|
166
+ | `--config` | -c | No | `"embedoc.config.yaml"` | Path to config file (YAML or JSON). |
167
+ | `--datasource` | -s | No | | Specific datasource to process. |
168
+ | `--generator` | -g | No | | Specific generator template to use. |
169
+ | `--all` | -a | No | `false` | Process all datasources that have generators configured. |
170
+ | `--dry-run` | -d | No | `false` | Preview generation without writing files. |
171
+ | `--verbose` | -v | No | `false` | Enable verbose output. |
172
+
173
+ #### Exit Codes
174
+
175
+ **Exit 0:** Generation succeeded.
176
+
177
+ - **stdout:** format=`text`
178
+
179
+ **Exit 1:** Generation failed (missing --datasource/--all, config not found, datasource error, or template error).
180
+
181
+ - **stderr:** format=`text`
182
+
183
+ #### Extensions
184
+
185
+ ```yaml
186
+ x-agent:
187
+ riskLevel: medium
188
+ requiresConfirmation: false
189
+ idempotent: true
190
+ sideEffects:
191
+ - file_write
192
+ safeDryRunOption: --dry-run
193
+ recommendedBeforeUse:
194
+ - Ensure embedoc.config.yaml exists with generators configured.
195
+ - Verify datasource files are accessible.
196
+ - Ensure Handlebars templates exist in templates_dir.
197
+ ```
198
+
199
+ ---
200
+
201
+ ### watch
202
+
203
+ Watch files and rebuild on changes with dependency tracking.
204
+
205
+ Monitors target files, renderers, and datasource files for changes. When a change is detected, rebuilds only affected documents using the dependency graph. Renderer changes trigger a full renderer reload and dependency graph rebuild. Runs until interrupted with SIGINT (Ctrl+C).
206
+
207
+ **Usage:**
208
+
209
+ ```
210
+ embedoc watch
211
+ ```
212
+ ```
213
+ embedoc watch --config embedoc.config.yaml
214
+ ```
215
+ ```
216
+ embedoc watch --verbose
217
+ ```
218
+ ```
219
+ embedoc watch --debug-deps
220
+ ```
221
+
222
+ #### Options
223
+
224
+ | Option | Aliases | Required | Default | Description |
225
+ |---|---|---|---|---|
226
+ | `--config` | -c | No | `"embedoc.config.yaml"` | Path to config file (YAML or JSON). |
227
+ | `--verbose` | -v | No | `false` | Enable verbose rebuild output. |
228
+ | `--debug-deps` | | No | `false` | Print dependency graph at startup for debugging. |
229
+
230
+ #### Signals
231
+
232
+ | Signal | Description |
233
+ |---|---|
234
+ | `SIGINT` | Gracefully stops the watcher, closes datasources, and exits. |
235
+
236
+ #### Exit Codes
237
+
238
+ **Exit 0:** Watcher stopped gracefully (via SIGINT).
239
+
240
+ - **stdout:** format=`text`
241
+
242
+ **Exit 1:** Watch failed (config not found or initialization error).
243
+
244
+ - **stderr:** format=`text`
245
+
246
+ #### Extensions
247
+
248
+ ```yaml
249
+ x-agent:
250
+ riskLevel: medium
251
+ requiresConfirmation: false
252
+ idempotent: true
253
+ sideEffects:
254
+ - file_write
255
+ recommendedBeforeUse:
256
+ - Ensure embedoc.config.yaml exists (run init if needed).
257
+ - Verify datasource files are accessible.
258
+ ```
259
+
260
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "embedoc",
3
- "version": "0.10.2",
3
+ "version": "0.11.1",
4
4
  "description": "In-place document generator that auto-updates marker blocks while preserving manual edits. Supports multiple datasources (SQLite, CSV, JSON, YAML, glob), programmable TypeScript embeds, and incremental builds with dependency tracking.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -21,6 +21,7 @@
21
21
  "files": [
22
22
  "dist",
23
23
  "docs",
24
+ "cli-contract.yaml",
24
25
  "README.md",
25
26
  "LICENSE"
26
27
  ],
@@ -34,6 +35,8 @@
34
35
  "test:watch": "vitest",
35
36
  "test:coverage": "vitest run --coverage",
36
37
  "docs": "typedoc",
38
+ "cli-contracts:generate": "cli-contracts generate",
39
+ "cli-contracts:validate": "cli-contracts validate",
37
40
  "prepublishOnly": "npm run lint && npm run build && npm run test"
38
41
  },
39
42
  "keywords": [
@@ -82,6 +85,7 @@
82
85
  },
83
86
  "devDependencies": {
84
87
  "@types/better-sqlite3": "^7.6.12",
88
+ "cli-contracts": "^0.2.0",
85
89
  "@types/js-yaml": "^4.0.9",
86
90
  "@types/node": "^22.10.2",
87
91
  "@typescript-eslint/eslint-plugin": "^8.0.0",