@contractspec/module.examples 3.10.0 → 4.0.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.
- package/README.md +26 -9
- package/dist/builtins.d.ts +1574 -2
- package/dist/catalog.d.ts +8 -0
- package/dist/catalog.js +2 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.js +1 -18
- package/dist/node/catalog.js +1 -0
- package/dist/node/index.js +1 -18
- package/dist/node/runtime/index.js +18 -0
- package/dist/preview-catalog.d.ts +38 -0
- package/dist/preview-catalog.generated.d.ts +5 -0
- package/dist/registry.d.ts +11 -0
- package/dist/runtime/ExampleWebPreview.d.ts +11 -0
- package/dist/runtime/index.d.ts +11 -0
- package/dist/runtime/index.js +19 -0
- package/dist/runtime/previews.d.ts +3 -11
- package/package.json +30 -59
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Website: https://contractspec.io
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Catalog-first ContractSpec example metadata, with optional runtime helpers for rich example surfaces.**
|
|
6
6
|
|
|
7
7
|
## What It Provides
|
|
8
8
|
|
|
9
9
|
- **Layer**: module.
|
|
10
|
-
- **Consumers**:
|
|
10
|
+
- **Consumers**: CLIs, editor bridges, apps, docs, and rich sandbox/template surfaces.
|
|
11
11
|
- Related ContractSpec packages include `@contractspec/example.agent-console`, `@contractspec/example.ai-chat-assistant`, `@contractspec/example.ai-support-bot`, `@contractspec/example.analytics-dashboard`, `@contractspec/example.calendar-google`, `@contractspec/example.content-generation`, ...
|
|
12
12
|
- `agent-console` is the default autonomous-agent showcase surfaced through `/sandbox`.
|
|
13
13
|
- `data-grid-showcase` is the canonical ContractSpec table showcase surfaced through `/sandbox?template=data-grid-showcase` and `/docs/examples/data-grid-showcase`.
|
|
@@ -22,19 +22,36 @@ or
|
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Use the root entrypoint or `@contractspec/module.examples/catalog` for metadata-only discovery. Use `@contractspec/module.examples/runtime` only when rendering rich template previews or sandbox runtime surfaces. The catalog also exposes shared preview-surface helpers so apps can show every discoverable example while loading rich UI only for packages that export `./ui`.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { getExample, listExamples } from '@contractspec/module.examples/catalog';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { ExampleWebPreview, TemplateRuntimeProvider, listTemplates } from '@contractspec/module.examples/runtime';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The catalog contains source metadata for each example. CLI users can fetch a full example only when needed:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
contractspec examples download minimal --out-dir ./examples/minimal
|
|
39
|
+
```
|
|
26
40
|
|
|
27
41
|
## Architecture
|
|
28
42
|
|
|
29
|
-
- `src/builtins.ts` is
|
|
43
|
+
- `src/builtins.ts` is a generated literal catalog and must not statically import `@contractspec/example.*` packages.
|
|
44
|
+
- `src/catalog.ts` is the metadata-only public surface.
|
|
30
45
|
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
31
46
|
- `src/registry.test.ts` is part of the package's public or composition surface.
|
|
32
47
|
- `src/registry.ts` is part of the package's public or composition surface.
|
|
33
|
-
- `src/runtime` is
|
|
48
|
+
- `src/runtime` is the optional rich runtime surface for consumers that intentionally install example packages.
|
|
34
49
|
|
|
35
50
|
## Public Entry Points
|
|
36
51
|
|
|
37
|
-
- Export `.` resolves through `./src/index.ts
|
|
52
|
+
- Export `.` resolves through `./src/index.ts` and is catalog-only.
|
|
53
|
+
- Export `./catalog` resolves through `./src/catalog.ts`.
|
|
54
|
+
- Export `./runtime` resolves through `./src/runtime/index.ts`.
|
|
38
55
|
|
|
39
56
|
## Local Commands
|
|
40
57
|
|
|
@@ -62,8 +79,8 @@ Import the root entrypoint from `@contractspec/module.examples`, or choose a doc
|
|
|
62
79
|
|
|
63
80
|
## Notes
|
|
64
81
|
|
|
65
|
-
- This module is a thin
|
|
66
|
-
- Adding a new example requires
|
|
67
|
-
-
|
|
82
|
+
- This module is a thin catalog/runtime bridge -- business logic belongs in individual example packages under `packages/examples/`.
|
|
83
|
+
- Adding a new example requires creating the example package and regenerating the catalog with `bun run generate:registry`; do not add it as a direct dependency here.
|
|
84
|
+
- Root/catalog imports must remain metadata-only. Rich runtime consumers should import `@contractspec/module.examples/runtime` and own any required `@contractspec/example.*` dependencies directly.
|
|
68
85
|
- The meetup-ready autonomous-agent path is the deterministic `agent-console` sandbox plus its replay proof lane.
|
|
69
86
|
- The shared ContractSpec table stack is demonstrated directly by `data-grid-showcase` and reused in `analytics-dashboard`, `crm-pipeline`, `integration-hub`, and `agent-console`.
|