micro-contracts 0.17.15 → 0.17.17
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 +17 -5
- package/cli-contract.yaml +22 -5
- package/dist/micro-contracts.bundle.mjs +327 -470
- package/dist/micro-contracts.bundle.mjs.map +4 -4
- package/docs/cli-reference.md +6 -5
- package/docs/screen-spec.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -207,6 +207,11 @@ project/
|
|
|
207
207
|
| `x-micro-contracts-published` | boolean | Include in `contract-published` (compatibility SLA) |
|
|
208
208
|
| `x-micro-contracts-non-exportable` | boolean | Mark as non-exportable (fails if used in published endpoints) |
|
|
209
209
|
| `x-micro-contracts-depend-on` | string[] | Explicit dependencies on other modules' published APIs |
|
|
210
|
+
| `x-private` | boolean | Schema-level. A published endpoint that can reach it fails linting (`PUBLIC_ENDPOINT_PRIVATE_RESPONSE`) |
|
|
211
|
+
|
|
212
|
+
"Can reach it" covers every way one schema refers to another: properties, array
|
|
213
|
+
items, `additionalProperties`, `allOf`/`oneOf`/`anyOf`, and `$ref` targets — the
|
|
214
|
+
same traversal that decides what `contract-published` contains.
|
|
210
215
|
|
|
211
216
|
### Screen Spec Extensions
|
|
212
217
|
|
|
@@ -278,11 +283,12 @@ Create `micro-contracts.config.yaml`. All paths support `{module}` placeholder.
|
|
|
278
283
|
| `contract.serviceTemplate` | string | no | Custom Handlebars template for service interface generation |
|
|
279
284
|
| `contractPublic.output` | string | yes | Output directory for public contract packages |
|
|
280
285
|
| `outputs.<id>.output` | string | yes | Output file path |
|
|
281
|
-
| `outputs.<id>.template` | string | yes | Handlebars template file path |
|
|
286
|
+
| `outputs.<id>.template` | string | yes | Handlebars template file path, used as written (resolved from the working directory) |
|
|
282
287
|
| `outputs.<id>.overwrite` | boolean | no | Overwrite existing files (default: `true`) |
|
|
283
288
|
| `outputs.<id>.condition` | string | no | `hasPublicEndpoints` \| `hasOverlays` \| `always` (default: `always`) |
|
|
284
289
|
| `outputs.<id>.enabled` | boolean | no | Enable/disable this output (default: `true`) |
|
|
285
290
|
| `outputs.<id>.config` | object | no | Template-specific configuration passed to context |
|
|
291
|
+
|
|
286
292
|
| `overlays.shared` | string[] | no | Overlay files applied to all modules |
|
|
287
293
|
| `overlays.collision` | string | no | `error` \| `warn` \| `last-wins` (default: `error`) |
|
|
288
294
|
| `docs.enabled` | boolean | no | Enable documentation generation (default: `true`) |
|
|
@@ -300,6 +306,10 @@ Create `micro-contracts.config.yaml`. All paths support `{module}` placeholder.
|
|
|
300
306
|
existing configs. They generate only when declared, and only when no `outputs` entry
|
|
301
307
|
is configured — `outputs` supersedes them for a module. Prefer `outputs`.
|
|
302
308
|
|
|
309
|
+
An `outputs` entry is a template rendered to a path — nothing about it is
|
|
310
|
+
server-specific or frontend-specific — so `--server-only` / `--frontend-only`
|
|
311
|
+
apply to the built-in sections only. Select outputs with `--output`.
|
|
312
|
+
|
|
303
313
|
### modules.\<name\>
|
|
304
314
|
|
|
305
315
|
| Key | Type | Required | Description |
|
|
@@ -368,8 +378,9 @@ Generate code from OpenAPI specifications.
|
|
|
368
378
|
| `-c, --config <path>` | Path to config file |
|
|
369
379
|
| `-m, --module <names>` | Module names, comma-separated (default: all) |
|
|
370
380
|
| `--contracts-only` | Generate contract packages only |
|
|
371
|
-
| `--
|
|
372
|
-
| `--
|
|
381
|
+
| `--output <ids>` | Output ids to generate, comma-separated; glob patterns allowed (e.g. `'*routes*'`). Fails when a pattern matches no output |
|
|
382
|
+
| `--server-only` | Generate the built-in `server` section only (not valid with an `outputs` configuration) |
|
|
383
|
+
| `--frontend-only` | Generate the built-in `frontend` section only (not valid with an `outputs` configuration) |
|
|
373
384
|
| `--docs-only` | Generate documentation only |
|
|
374
385
|
| `--skip-lint` | Skip linting before generation |
|
|
375
386
|
| `--no-manifest` | Skip manifest generation |
|
|
@@ -437,8 +448,9 @@ Run full guardrails pipeline: **Gate 1,2 → Generate → Gate 3,4,5**.
|
|
|
437
448
|
| `--no-manifest` | Skip manifest generation |
|
|
438
449
|
| `--skip-lint` | Skip linting before generation |
|
|
439
450
|
| `--contracts-only` | Generate contract packages only |
|
|
440
|
-
| `--
|
|
441
|
-
| `--
|
|
451
|
+
| `--output <ids>` | Output ids to generate, comma-separated; glob patterns allowed (e.g. `'*routes*'`). Fails when a pattern matches no output |
|
|
452
|
+
| `--server-only` | Generate the built-in `server` section only (not valid with an `outputs` configuration) |
|
|
453
|
+
| `--frontend-only` | Generate the built-in `frontend` section only (not valid with an `outputs` configuration) |
|
|
442
454
|
| `--docs-only` | Generate documentation only |
|
|
443
455
|
| `--force` | Bypass input hash cache and always regenerate |
|
|
444
456
|
| `--no-cache` | Run without reading or writing input hash cache |
|
package/cli-contract.yaml
CHANGED
|
@@ -3,7 +3,7 @@ cli_contracts: 0.1.0
|
|
|
3
3
|
|
|
4
4
|
info:
|
|
5
5
|
title: micro-contracts CLI
|
|
6
|
-
version: 0.17.
|
|
6
|
+
version: 0.17.17
|
|
7
7
|
description: >-
|
|
8
8
|
Contract-first OpenAPI toolchain for TypeScript Web/API systems.
|
|
9
9
|
Generates contract packages, server routes, and frontend clients
|
|
@@ -85,6 +85,15 @@ command_sets:
|
|
|
85
85
|
schema:
|
|
86
86
|
type: string
|
|
87
87
|
|
|
88
|
+
- name: output
|
|
89
|
+
description: >-
|
|
90
|
+
Output ids to generate, comma-separated. Supports glob patterns
|
|
91
|
+
(e.g. '*routes*'). Generates all configured outputs if omitted.
|
|
92
|
+
Fails when a pattern matches no output.
|
|
93
|
+
value_name: ids
|
|
94
|
+
schema:
|
|
95
|
+
type: string
|
|
96
|
+
|
|
88
97
|
- name: contracts-only
|
|
89
98
|
description: Generate contract packages only.
|
|
90
99
|
schema:
|
|
@@ -92,13 +101,17 @@ command_sets:
|
|
|
92
101
|
default: false
|
|
93
102
|
|
|
94
103
|
- name: server-only
|
|
95
|
-
description:
|
|
104
|
+
description: >-
|
|
105
|
+
Generate the built-in server section only. Not valid with an
|
|
106
|
+
outputs configuration — select outputs with --output instead.
|
|
96
107
|
schema:
|
|
97
108
|
type: boolean
|
|
98
109
|
default: false
|
|
99
110
|
|
|
100
111
|
- name: frontend-only
|
|
101
|
-
description:
|
|
112
|
+
description: >-
|
|
113
|
+
Generate the built-in frontend section only. Not valid with an
|
|
114
|
+
outputs configuration — select outputs with --output instead.
|
|
102
115
|
schema:
|
|
103
116
|
type: boolean
|
|
104
117
|
default: false
|
|
@@ -519,13 +532,17 @@ command_sets:
|
|
|
519
532
|
default: false
|
|
520
533
|
|
|
521
534
|
- name: server-only
|
|
522
|
-
description:
|
|
535
|
+
description: >-
|
|
536
|
+
Generate the built-in server section only. Not valid with an
|
|
537
|
+
outputs configuration — select outputs with --output instead.
|
|
523
538
|
schema:
|
|
524
539
|
type: boolean
|
|
525
540
|
default: false
|
|
526
541
|
|
|
527
542
|
- name: frontend-only
|
|
528
|
-
description:
|
|
543
|
+
description: >-
|
|
544
|
+
Generate the built-in frontend section only. Not valid with an
|
|
545
|
+
outputs configuration — select outputs with --output instead.
|
|
529
546
|
schema:
|
|
530
547
|
type: boolean
|
|
531
548
|
default: false
|