@unispechq/unispec-platform 0.1.0 → 0.1.4
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 +224 -225
- package/package.json +39 -39
package/README.md
CHANGED
|
@@ -1,225 +1,224 @@
|
|
|
1
|
-
# UniSpec Platform
|
|
2
|
-
|
|
3
|
-
**CLI and local orchestrator for the UniSpec ecosystem**
|
|
4
|
-
|
|
5
|
-
This repository contains the official UniSpec CLI and the foundation for a local orchestrator.
|
|
6
|
-
It builds on top of:
|
|
7
|
-
|
|
8
|
-
- `unispec-spec` — the UniSpec format definition (schemas, examples, reference docs)
|
|
9
|
-
- `@unispechq/unispec-core` — the Core Engine (loader, validator, normalizer, diff, converters)
|
|
10
|
-
|
|
11
|
-
UniSpec is a modern, multi-protocol API specification format designed to unify:
|
|
12
|
-
|
|
13
|
-
- REST
|
|
14
|
-
- GraphQL
|
|
15
|
-
- WebSocket
|
|
16
|
-
- (future) event-driven APIs
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Repository Status
|
|
21
|
-
|
|
22
|
-
This repository is in early development.
|
|
23
|
-
Current focus:
|
|
24
|
-
|
|
25
|
-
- Provide a stable CLI surface for `validate`, `normalize`, `diff`, `convert`
|
|
26
|
-
- Lay groundwork for `dev` (local orchestrator)
|
|
27
|
-
- Prepare integration points for the future `unispec-registry` (publish/read)
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Repository Structure
|
|
32
|
-
|
|
33
|
-
```text
|
|
34
|
-
unispec-platform/
|
|
35
|
-
├─ src/
|
|
36
|
-
│ ├─ cli.ts # CLI entrypoint
|
|
37
|
-
│ ├─ commands/ # Command registration (validate/normalize/diff/convert/dev)
|
|
38
|
-
│ ├─ io/ # File IO + output helpers
|
|
39
|
-
│ └─ config/ # Config loading (future dev/orchestrator mode)
|
|
40
|
-
├─
|
|
41
|
-
├─
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
- `--
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- `--
|
|
67
|
-
- `--
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- `--
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- `
|
|
84
|
-
- `
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- `--
|
|
90
|
-
- `--
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
- `--
|
|
99
|
-
- `--
|
|
100
|
-
- `--
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- `GET /
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
- `http://127.0.0.1:4141/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
| `unispec-
|
|
209
|
-
| `unispec-
|
|
210
|
-
| `unispec-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
MIT
|
|
1
|
+
# UniSpec Platform
|
|
2
|
+
|
|
3
|
+
**CLI and local orchestrator for the UniSpec ecosystem**
|
|
4
|
+
|
|
5
|
+
This repository contains the official UniSpec CLI and the foundation for a local orchestrator.
|
|
6
|
+
It builds on top of:
|
|
7
|
+
|
|
8
|
+
- `unispec-spec` — the UniSpec format definition (schemas, examples, reference docs)
|
|
9
|
+
- `@unispechq/unispec-core` — the Core Engine (loader, validator, normalizer, diff, converters)
|
|
10
|
+
|
|
11
|
+
UniSpec is a modern, multi-protocol API specification format designed to unify:
|
|
12
|
+
|
|
13
|
+
- REST
|
|
14
|
+
- GraphQL
|
|
15
|
+
- WebSocket
|
|
16
|
+
- (future) event-driven APIs
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Repository Status
|
|
21
|
+
|
|
22
|
+
This repository is in early development.
|
|
23
|
+
Current focus:
|
|
24
|
+
|
|
25
|
+
- Provide a stable CLI surface for `validate`, `normalize`, `diff`, `convert`
|
|
26
|
+
- Lay groundwork for `dev` (local orchestrator)
|
|
27
|
+
- Prepare integration points for the future `unispec-registry` (publish/read)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Repository Structure
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
unispec-platform/
|
|
35
|
+
├─ src/
|
|
36
|
+
│ ├─ cli.ts # CLI entrypoint
|
|
37
|
+
│ ├─ commands/ # Command registration (validate/normalize/diff/convert/dev)
|
|
38
|
+
│ ├─ io/ # File IO + output helpers
|
|
39
|
+
│ └─ config/ # Config loading (future dev/orchestrator mode)
|
|
40
|
+
├─ package.json
|
|
41
|
+
├─ tsconfig.json
|
|
42
|
+
└─ README.md
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## CLI Commands
|
|
46
|
+
|
|
47
|
+
Global flags:
|
|
48
|
+
|
|
49
|
+
- `-q, --quiet` — suppress non-essential output
|
|
50
|
+
- `--verbose` — enable diagnostic output (stderr)
|
|
51
|
+
- `--json-errors` — output errors as JSON (stderr)
|
|
52
|
+
|
|
53
|
+
### `unispec validate [file]`
|
|
54
|
+
Validates a UniSpec document against the official JSON Schemas.
|
|
55
|
+
|
|
56
|
+
Options:
|
|
57
|
+
|
|
58
|
+
- `--stdin` — read spec from stdin (or pass `-` as file)
|
|
59
|
+
|
|
60
|
+
### `unispec normalize [file]`
|
|
61
|
+
Normalizes a UniSpec document into deterministic canonical form.
|
|
62
|
+
|
|
63
|
+
Options:
|
|
64
|
+
|
|
65
|
+
- `--stdin` — read spec from stdin (or pass `-` as file)
|
|
66
|
+
- `--format <format>` — `json|yaml`
|
|
67
|
+
- `--output <file>` — write output to file (use `-` for stdout)
|
|
68
|
+
|
|
69
|
+
### `unispec diff <oldFile> <newFile>`
|
|
70
|
+
Computes a structural diff between two UniSpec documents.
|
|
71
|
+
|
|
72
|
+
Options:
|
|
73
|
+
|
|
74
|
+
- `--format <format>` — `json|yaml`
|
|
75
|
+
- `--output <file>` — write output to file (use `-` for stdout)
|
|
76
|
+
|
|
77
|
+
### `unispec convert [file] --to <target>`
|
|
78
|
+
Converts UniSpec into other representations.
|
|
79
|
+
|
|
80
|
+
Targets:
|
|
81
|
+
|
|
82
|
+
- `openapi` — outputs OpenAPI 3.1 JSON/YAML
|
|
83
|
+
- `graphql-sdl` — outputs GraphQL SDL
|
|
84
|
+
- `ws-model` — outputs a dashboard-friendly WebSocket model
|
|
85
|
+
|
|
86
|
+
Options:
|
|
87
|
+
|
|
88
|
+
- `--stdin` — read spec from stdin (or pass `-` as file)
|
|
89
|
+
- `--format <format>` — `json|yaml` (for JSON-like targets)
|
|
90
|
+
- `--output <file>` — write output to file (use `-` for stdout)
|
|
91
|
+
|
|
92
|
+
### `unispec dev`
|
|
93
|
+
Local orchestrator mode.
|
|
94
|
+
|
|
95
|
+
Options:
|
|
96
|
+
|
|
97
|
+
- `--config <path>` — path to config file (default: `unispec.config.json|yaml|yml`)
|
|
98
|
+
- `--host <host>` — bind host (default: `127.0.0.1`)
|
|
99
|
+
- `--port <port>` — bind port (default: `4141`)
|
|
100
|
+
- `--watch` — watch config/spec files and refresh aggregated snapshot
|
|
101
|
+
|
|
102
|
+
Planned responsibilities:
|
|
103
|
+
|
|
104
|
+
- Watch local specs and/or connected services
|
|
105
|
+
- Aggregate multiple UniSpec documents (microservices mode)
|
|
106
|
+
- Serve a local dashboard and endpoints (e.g. `/unispec.json` for aggregated view)
|
|
107
|
+
- Provide a single workflow to validate/normalize/diff before publishing to Registry
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Dev server (local orchestrator)
|
|
112
|
+
|
|
113
|
+
`unispec dev` starts a local HTTP API that aggregates multiple UniSpec documents.
|
|
114
|
+
|
|
115
|
+
Default bind:
|
|
116
|
+
|
|
117
|
+
- Host: `127.0.0.1`
|
|
118
|
+
- Port: `4141`
|
|
119
|
+
|
|
120
|
+
Endpoints:
|
|
121
|
+
|
|
122
|
+
- `GET /health` -> `OK`
|
|
123
|
+
- `GET /unispec.json` -> aggregated JSON
|
|
124
|
+
|
|
125
|
+
Aggregation format (A):
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"version": 1,
|
|
130
|
+
"generatedAt": "2025-12-28T12:00:00.000Z",
|
|
131
|
+
"services": [
|
|
132
|
+
{
|
|
133
|
+
"name": "users",
|
|
134
|
+
"specPath": "./services/users/unispec.yaml",
|
|
135
|
+
"valid": true,
|
|
136
|
+
"spec": {}
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
If at least one service is invalid, `/unispec.json` responds with status `422` and includes per-service errors.
|
|
143
|
+
|
|
144
|
+
### Example
|
|
145
|
+
|
|
146
|
+
Create `unispec.config.json` (see `unispec.config.example.json`):
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
cp unispec.config.example.json unispec.config.json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Start the server:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npm run dev -- dev --verbose
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Run using the bundled examples:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm run dev -- dev -- --config example/unispec.config.json --verbose
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Then open:
|
|
165
|
+
|
|
166
|
+
- `http://127.0.0.1:4141/health`
|
|
167
|
+
- `http://127.0.0.1:4141/unispec.json`
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Development
|
|
172
|
+
|
|
173
|
+
### Requirements
|
|
174
|
+
|
|
175
|
+
- Node.js >= 18
|
|
176
|
+
|
|
177
|
+
### Install
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm install
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Run CLI in dev mode
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm run dev -- --help
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Build
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm run build
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Run built CLI
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npm run start -- --help
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Related Repositories
|
|
204
|
+
|
|
205
|
+
| Repository | Purpose |
|
|
206
|
+
|---|---|
|
|
207
|
+
| `unispec-spec` | UniSpec format definition (schemas, examples) |
|
|
208
|
+
| `unispec-core` | Core Engine (loader/validator/normalizer/diff/converters) |
|
|
209
|
+
| `unispec-js-adapters` | Framework integrations (Express/NestJS/etc.) |
|
|
210
|
+
| `unispec-registry` | (Future) publishing/reading specs and version history |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Contributing
|
|
215
|
+
|
|
216
|
+
Contributions are welcome.
|
|
217
|
+
|
|
218
|
+
Please read `windsurfrules.yml` before making changes.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@unispechq/unispec-platform",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI and local orchestrator for UniSpec (validate/normalize/diff/convert/dev).",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"unispec": "dist/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"dev": "tsx src/cli.ts",
|
|
17
|
-
"start": "node dist/cli.js",
|
|
18
|
-
"test": "npm run build && node --test tests/*.test.mjs",
|
|
19
|
-
"release:patch": "node scripts/release.js patch",
|
|
20
|
-
"release:minor": "node scripts/release.js minor",
|
|
21
|
-
"release:major": "node scripts/release.js major"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@unispechq/unispec-core": "^0.2.2",
|
|
25
|
-
"commander": "^12.1.0",
|
|
26
|
-
"yaml": "^2.6.1"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@types/node": "^24.10.1",
|
|
30
|
-
"tsx": "^4.19.2",
|
|
31
|
-
"typescript": "^5.0.0"
|
|
32
|
-
},
|
|
33
|
-
"engines": {
|
|
34
|
-
"node": ">=18"
|
|
35
|
-
},
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@unispechq/unispec-platform",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "CLI and local orchestrator for UniSpec (validate/normalize/diff/convert/dev).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"unispec": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"dev": "tsx src/cli.ts",
|
|
17
|
+
"start": "node dist/cli.js",
|
|
18
|
+
"test": "npm run build && node --test tests/*.test.mjs",
|
|
19
|
+
"release:patch": "node scripts/release.js patch",
|
|
20
|
+
"release:minor": "node scripts/release.js minor",
|
|
21
|
+
"release:major": "node scripts/release.js major"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@unispechq/unispec-core": "^0.2.2",
|
|
25
|
+
"commander": "^12.1.0",
|
|
26
|
+
"yaml": "^2.6.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^24.10.1",
|
|
30
|
+
"tsx": "^4.19.2",
|
|
31
|
+
"typescript": "^5.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|