embedoc 0.11.0 → 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.
- package/README.md +5 -0
- package/cli-contract.yaml +327 -0
- package/dist/cli.js +1 -1
- package/docs/cli-reference.md +260 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -154,6 +154,8 @@ npm run embedoc:build
|
|
|
154
154
|
|
|
155
155
|
## CLI Commands
|
|
156
156
|
|
|
157
|
+
> **Full CLI reference:** [docs/cli-reference.md](./docs/cli-reference.md) | **Machine-readable contract:** [cli-contract.yaml](./cli-contract.yaml)
|
|
158
|
+
|
|
157
159
|
```bash
|
|
158
160
|
# Initialize project (creates config, .embedoc/ directory, updates package.json)
|
|
159
161
|
embedoc init
|
|
@@ -169,6 +171,9 @@ embedoc build ./path/to/file.md
|
|
|
169
171
|
# Generate new files (specific datasource)
|
|
170
172
|
embedoc generate --datasource tables
|
|
171
173
|
|
|
174
|
+
# Generate with specific template
|
|
175
|
+
embedoc generate --datasource tables --generator table_doc.hbs
|
|
176
|
+
|
|
172
177
|
# Run all datasource generators
|
|
173
178
|
embedoc generate --all
|
|
174
179
|
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json
|
|
2
|
+
cliContracts: 0.1.0
|
|
3
|
+
|
|
4
|
+
info:
|
|
5
|
+
title: embedoc CLI
|
|
6
|
+
version: 0.11.1
|
|
7
|
+
description: >-
|
|
8
|
+
In-place document generator that auto-updates marker blocks in documents
|
|
9
|
+
and source code while preserving manually edited sections. Supports
|
|
10
|
+
multiple datasources (SQLite, CSV, JSON, YAML, glob), programmable
|
|
11
|
+
TypeScript renderers, Handlebars file generation, and incremental builds
|
|
12
|
+
with dependency tracking.
|
|
13
|
+
license:
|
|
14
|
+
name: MIT
|
|
15
|
+
contact:
|
|
16
|
+
name: foo-ogawa
|
|
17
|
+
url: https://github.com/foo-ogawa/embedoc
|
|
18
|
+
|
|
19
|
+
commandSets:
|
|
20
|
+
embedoc:
|
|
21
|
+
summary: In-place document generator with marker-based embedding.
|
|
22
|
+
executable: embedoc
|
|
23
|
+
|
|
24
|
+
globalOptions:
|
|
25
|
+
- name: version
|
|
26
|
+
aliases: [V]
|
|
27
|
+
description: Print version and exit.
|
|
28
|
+
schema:
|
|
29
|
+
type: boolean
|
|
30
|
+
|
|
31
|
+
- name: help
|
|
32
|
+
aliases: [h]
|
|
33
|
+
description: Show help and exit.
|
|
34
|
+
schema:
|
|
35
|
+
type: boolean
|
|
36
|
+
|
|
37
|
+
commands:
|
|
38
|
+
# ── init ──────────────────────────────────────────
|
|
39
|
+
init:
|
|
40
|
+
summary: Initialize embedoc in the current project.
|
|
41
|
+
description: >-
|
|
42
|
+
Creates starter configuration and directory structure:
|
|
43
|
+
embedoc.config.yaml, .embedoc/renderers/index.ts,
|
|
44
|
+
.embedoc/datasources/index.ts, and .embedoc/templates/.
|
|
45
|
+
If package.json exists, adds embedoc:build, embedoc:watch,
|
|
46
|
+
and embedoc:generate npm scripts.
|
|
47
|
+
usage:
|
|
48
|
+
- embedoc init
|
|
49
|
+
- embedoc init --force
|
|
50
|
+
|
|
51
|
+
options:
|
|
52
|
+
- name: force
|
|
53
|
+
aliases: [f]
|
|
54
|
+
description: Overwrite existing files.
|
|
55
|
+
schema:
|
|
56
|
+
type: boolean
|
|
57
|
+
default: false
|
|
58
|
+
|
|
59
|
+
exits:
|
|
60
|
+
'0':
|
|
61
|
+
description: Initialization succeeded.
|
|
62
|
+
stdout:
|
|
63
|
+
format: text
|
|
64
|
+
files:
|
|
65
|
+
- path: embedoc.config.yaml
|
|
66
|
+
required: false
|
|
67
|
+
mediaType: application/yaml
|
|
68
|
+
encoding: utf-8
|
|
69
|
+
description: Configuration file.
|
|
70
|
+
- path: .embedoc/renderers/index.ts
|
|
71
|
+
required: false
|
|
72
|
+
mediaType: text/x-typescript
|
|
73
|
+
encoding: utf-8
|
|
74
|
+
description: Renderer registration file.
|
|
75
|
+
- path: .embedoc/datasources/index.ts
|
|
76
|
+
required: false
|
|
77
|
+
mediaType: text/x-typescript
|
|
78
|
+
encoding: utf-8
|
|
79
|
+
description: Custom datasource registration file.
|
|
80
|
+
- path: .embedoc/templates/.gitkeep
|
|
81
|
+
required: false
|
|
82
|
+
description: Templates directory placeholder.
|
|
83
|
+
|
|
84
|
+
'1':
|
|
85
|
+
description: Initialization failed (write error).
|
|
86
|
+
stderr:
|
|
87
|
+
format: text
|
|
88
|
+
|
|
89
|
+
x-agent:
|
|
90
|
+
riskLevel: low
|
|
91
|
+
requiresConfirmation: false
|
|
92
|
+
idempotent: true
|
|
93
|
+
sideEffects:
|
|
94
|
+
- file_write
|
|
95
|
+
- directory_create
|
|
96
|
+
|
|
97
|
+
# ── build ─────────────────────────────────────────
|
|
98
|
+
build:
|
|
99
|
+
summary: Build documents by replacing markers with rendered content.
|
|
100
|
+
description: >-
|
|
101
|
+
Loads configuration, initializes datasources, loads TypeScript
|
|
102
|
+
renderers, and processes all target files (or specific files if
|
|
103
|
+
provided). Each @embedoc marker block is re-rendered and the
|
|
104
|
+
content between start/end markers is replaced in-place.
|
|
105
|
+
usage:
|
|
106
|
+
- embedoc build
|
|
107
|
+
- embedoc build --config embedoc.config.yaml
|
|
108
|
+
- embedoc build ./docs/tables/users.md
|
|
109
|
+
- embedoc build --dry-run --verbose
|
|
110
|
+
|
|
111
|
+
arguments:
|
|
112
|
+
- name: files
|
|
113
|
+
description: Specific file paths to process. If omitted, processes all targets from config.
|
|
114
|
+
schema:
|
|
115
|
+
type: array
|
|
116
|
+
items:
|
|
117
|
+
type: string
|
|
118
|
+
variadic: true
|
|
119
|
+
file:
|
|
120
|
+
mode: readWrite
|
|
121
|
+
exists: true
|
|
122
|
+
|
|
123
|
+
options:
|
|
124
|
+
- name: config
|
|
125
|
+
aliases: [c]
|
|
126
|
+
description: Path to config file (YAML or JSON).
|
|
127
|
+
valueName: path
|
|
128
|
+
schema:
|
|
129
|
+
type: string
|
|
130
|
+
default: embedoc.config.yaml
|
|
131
|
+
file:
|
|
132
|
+
mode: read
|
|
133
|
+
exists: true
|
|
134
|
+
mediaType: application/yaml
|
|
135
|
+
encoding: utf-8
|
|
136
|
+
|
|
137
|
+
- name: dry-run
|
|
138
|
+
aliases: [d]
|
|
139
|
+
description: Preview changes without writing files.
|
|
140
|
+
schema:
|
|
141
|
+
type: boolean
|
|
142
|
+
default: false
|
|
143
|
+
|
|
144
|
+
- name: verbose
|
|
145
|
+
aliases: [v]
|
|
146
|
+
description: Enable verbose output.
|
|
147
|
+
schema:
|
|
148
|
+
type: boolean
|
|
149
|
+
default: false
|
|
150
|
+
|
|
151
|
+
exits:
|
|
152
|
+
'0':
|
|
153
|
+
description: Build succeeded. All markers were processed without errors.
|
|
154
|
+
stdout:
|
|
155
|
+
format: text
|
|
156
|
+
|
|
157
|
+
'1':
|
|
158
|
+
description: Build failed (config not found, datasource error, or marker processing error).
|
|
159
|
+
stderr:
|
|
160
|
+
format: text
|
|
161
|
+
|
|
162
|
+
x-agent:
|
|
163
|
+
riskLevel: medium
|
|
164
|
+
requiresConfirmation: false
|
|
165
|
+
idempotent: true
|
|
166
|
+
sideEffects:
|
|
167
|
+
- file_write
|
|
168
|
+
safeDryRunOption: --dry-run
|
|
169
|
+
recommendedBeforeUse:
|
|
170
|
+
- Ensure embedoc.config.yaml exists (run init if needed).
|
|
171
|
+
- Verify datasource files are accessible.
|
|
172
|
+
|
|
173
|
+
# ── generate ──────────────────────────────────────
|
|
174
|
+
generate:
|
|
175
|
+
summary: Generate new files from datasource records using Handlebars templates.
|
|
176
|
+
description: >-
|
|
177
|
+
Reads datasource records and generates new files using Handlebars
|
|
178
|
+
templates defined in the generators config. Requires either
|
|
179
|
+
--datasource to process a specific datasource or --all to process
|
|
180
|
+
all datasources that have generators configured. Optionally filter
|
|
181
|
+
by generator template name with --generator.
|
|
182
|
+
usage:
|
|
183
|
+
- embedoc generate --datasource tables
|
|
184
|
+
- embedoc generate --all
|
|
185
|
+
- embedoc generate --datasource tables --generator table_doc.hbs
|
|
186
|
+
- embedoc generate --all --dry-run --verbose
|
|
187
|
+
|
|
188
|
+
options:
|
|
189
|
+
- name: config
|
|
190
|
+
aliases: [c]
|
|
191
|
+
description: Path to config file (YAML or JSON).
|
|
192
|
+
valueName: path
|
|
193
|
+
schema:
|
|
194
|
+
type: string
|
|
195
|
+
default: embedoc.config.yaml
|
|
196
|
+
file:
|
|
197
|
+
mode: read
|
|
198
|
+
exists: true
|
|
199
|
+
mediaType: application/yaml
|
|
200
|
+
encoding: utf-8
|
|
201
|
+
|
|
202
|
+
- name: datasource
|
|
203
|
+
aliases: [s]
|
|
204
|
+
description: Specific datasource to process.
|
|
205
|
+
valueName: name
|
|
206
|
+
schema:
|
|
207
|
+
type: string
|
|
208
|
+
|
|
209
|
+
- name: generator
|
|
210
|
+
aliases: [g]
|
|
211
|
+
description: Specific generator template to use.
|
|
212
|
+
valueName: name
|
|
213
|
+
schema:
|
|
214
|
+
type: string
|
|
215
|
+
|
|
216
|
+
- name: all
|
|
217
|
+
aliases: [a]
|
|
218
|
+
description: Process all datasources that have generators configured.
|
|
219
|
+
schema:
|
|
220
|
+
type: boolean
|
|
221
|
+
default: false
|
|
222
|
+
|
|
223
|
+
- name: dry-run
|
|
224
|
+
aliases: [d]
|
|
225
|
+
description: Preview generation without writing files.
|
|
226
|
+
schema:
|
|
227
|
+
type: boolean
|
|
228
|
+
default: false
|
|
229
|
+
|
|
230
|
+
- name: verbose
|
|
231
|
+
aliases: [v]
|
|
232
|
+
description: Enable verbose output.
|
|
233
|
+
schema:
|
|
234
|
+
type: boolean
|
|
235
|
+
default: false
|
|
236
|
+
|
|
237
|
+
exits:
|
|
238
|
+
'0':
|
|
239
|
+
description: Generation succeeded.
|
|
240
|
+
stdout:
|
|
241
|
+
format: text
|
|
242
|
+
|
|
243
|
+
'1':
|
|
244
|
+
description: >-
|
|
245
|
+
Generation failed (missing --datasource/--all, config not found,
|
|
246
|
+
datasource error, or template error).
|
|
247
|
+
stderr:
|
|
248
|
+
format: text
|
|
249
|
+
|
|
250
|
+
x-agent:
|
|
251
|
+
riskLevel: medium
|
|
252
|
+
requiresConfirmation: false
|
|
253
|
+
idempotent: true
|
|
254
|
+
sideEffects:
|
|
255
|
+
- file_write
|
|
256
|
+
safeDryRunOption: --dry-run
|
|
257
|
+
recommendedBeforeUse:
|
|
258
|
+
- Ensure embedoc.config.yaml exists with generators configured.
|
|
259
|
+
- Verify datasource files are accessible.
|
|
260
|
+
- Ensure Handlebars templates exist in templates_dir.
|
|
261
|
+
|
|
262
|
+
# ── watch ─────────────────────────────────────────
|
|
263
|
+
watch:
|
|
264
|
+
summary: Watch files and rebuild on changes with dependency tracking.
|
|
265
|
+
description: >-
|
|
266
|
+
Monitors target files, renderers, and datasource files for changes.
|
|
267
|
+
When a change is detected, rebuilds only affected documents using
|
|
268
|
+
the dependency graph. Renderer changes trigger a full renderer
|
|
269
|
+
reload and dependency graph rebuild. Runs until interrupted with
|
|
270
|
+
SIGINT (Ctrl+C).
|
|
271
|
+
usage:
|
|
272
|
+
- embedoc watch
|
|
273
|
+
- embedoc watch --config embedoc.config.yaml
|
|
274
|
+
- embedoc watch --verbose
|
|
275
|
+
- embedoc watch --debug-deps
|
|
276
|
+
|
|
277
|
+
options:
|
|
278
|
+
- name: config
|
|
279
|
+
aliases: [c]
|
|
280
|
+
description: Path to config file (YAML or JSON).
|
|
281
|
+
valueName: path
|
|
282
|
+
schema:
|
|
283
|
+
type: string
|
|
284
|
+
default: embedoc.config.yaml
|
|
285
|
+
file:
|
|
286
|
+
mode: read
|
|
287
|
+
exists: true
|
|
288
|
+
mediaType: application/yaml
|
|
289
|
+
encoding: utf-8
|
|
290
|
+
|
|
291
|
+
- name: verbose
|
|
292
|
+
aliases: [v]
|
|
293
|
+
description: Enable verbose rebuild output.
|
|
294
|
+
schema:
|
|
295
|
+
type: boolean
|
|
296
|
+
default: false
|
|
297
|
+
|
|
298
|
+
- name: debug-deps
|
|
299
|
+
description: Print dependency graph at startup for debugging.
|
|
300
|
+
schema:
|
|
301
|
+
type: boolean
|
|
302
|
+
default: false
|
|
303
|
+
|
|
304
|
+
signals:
|
|
305
|
+
SIGINT:
|
|
306
|
+
description: Gracefully stops the watcher, closes datasources, and exits.
|
|
307
|
+
|
|
308
|
+
exits:
|
|
309
|
+
'0':
|
|
310
|
+
description: Watcher stopped gracefully (via SIGINT).
|
|
311
|
+
stdout:
|
|
312
|
+
format: text
|
|
313
|
+
|
|
314
|
+
'1':
|
|
315
|
+
description: Watch failed (config not found or initialization error).
|
|
316
|
+
stderr:
|
|
317
|
+
format: text
|
|
318
|
+
|
|
319
|
+
x-agent:
|
|
320
|
+
riskLevel: medium
|
|
321
|
+
requiresConfirmation: false
|
|
322
|
+
idempotent: true
|
|
323
|
+
sideEffects:
|
|
324
|
+
- file_write
|
|
325
|
+
recommendedBeforeUse:
|
|
326
|
+
- Ensure embedoc.config.yaml exists (run init if needed).
|
|
327
|
+
- Verify datasource files are accessible.
|
package/dist/cli.js
CHANGED
|
@@ -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.11.
|
|
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",
|