@specverse/types 4.0.0 → 4.0.2

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.
Files changed (2) hide show
  1. package/README.md +60 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @specverse/types
2
+
3
+ Shared type definitions for all SpecVerse engine packages — AST types, engine interfaces, entity module types, and processor abstractions.
4
+
5
+ ## Purpose
6
+
7
+ This is the foundation package of the SpecVerse engine ecosystem. It defines the TypeScript types and interfaces that all other engine packages depend on, ensuring a consistent type contract across the parser, inference, realize, and entity systems. It also breaks the circular dependency between parser and entities by housing processor abstractions here.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @specverse/types
13
+ ```
14
+
15
+ ## Dependencies
16
+
17
+ None. This package has zero runtime dependencies — it exports only type definitions and a small utilities module.
18
+
19
+ ## Key Exports
20
+
21
+ | Export | Type | Description |
22
+ |--------|------|-------------|
23
+ | `SpecVerseAST` | type | Root AST node produced by the parser |
24
+ | `ComponentSpec`, `ModelSpec` | type | Individual component specifications within the AST |
25
+ | `SpecVerseEngine`, `ParserEngine`, `InferenceEngine`, `RealizeEngine` | interface | Engine contracts for the registry discovery system |
26
+ | `EngineInfo` | type | Metadata returned by `engine.getInfo()` |
27
+ | `ParseResult`, `ParseOptions` | type | Parser input/output types |
28
+ | `ProcessorContext`, `AbstractProcessor` | type/class | Processor abstractions shared between parser and entities |
29
+ | `EntityModule`, `EntityRegistryInterface` | type | Entity module system contracts |
30
+ | `EntityConventionProcessor`, `EntityInferenceRule`, `EntityGenerator` | type | Facet interfaces for entity modules |
31
+ | `pluralize` | function | Naive English pluralizer used across engine packages |
32
+
33
+ ## Usage
34
+
35
+ ```typescript
36
+ import type { SpecVerseAST, ModelSpec, ParserEngine } from '@specverse/types';
37
+
38
+ function inspectModels(ast: SpecVerseAST): void {
39
+ for (const [name, model] of Object.entries(ast.models ?? {})) {
40
+ console.log(`Model: ${name}, fields: ${Object.keys(model.attributes ?? {}).length}`);
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## Architecture
46
+
47
+ ```
48
+ src/
49
+ ├── ast.ts # AST node types (SpecVerseAST, ModelSpec, ComponentSpec, etc.)
50
+ ├── engine.ts # Engine interfaces (ParserEngine, InferenceEngine, RealizeEngine)
51
+ ├── processor.ts # ProcessorContext and AbstractProcessor (breaks parser ↔ entities cycle)
52
+ ├── entity-module.ts # Entity module system types (EntityModule, facet interfaces)
53
+ ├── utils.ts # Small shared utilities (pluralize)
54
+ └── index.ts # Barrel re-export
55
+ ```
56
+
57
+ ## See Also
58
+
59
+ - [@specverse/engine-entities](../entities/) — Entity module system that implements the types defined here
60
+ - [@specverse/engine-parser](../parser/) — Parser engine that produces `SpecVerseAST`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specverse/types",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Shared type definitions for SpecVerse engines \u2014 AST, specs, engine interfaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",