@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.
Files changed (2) hide show
  1. package/README.md +224 -225
  2. 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
- ├─ windsurfrules.yml # WindSurf rules (stored without dotfile)
41
- ├─ package.json
42
- ├─ tsconfig.json
43
- └─ README.md
44
- ```
45
-
46
- ## CLI Commands
47
-
48
- Global flags:
49
-
50
- - `-q, --quiet` — suppress non-essential output
51
- - `--verbose` — enable diagnostic output (stderr)
52
- - `--json-errors` — output errors as JSON (stderr)
53
-
54
- ### `unispec validate [file]`
55
- Validates a UniSpec document against the official JSON Schemas.
56
-
57
- Options:
58
-
59
- - `--stdin` — read spec from stdin (or pass `-` as file)
60
-
61
- ### `unispec normalize [file]`
62
- Normalizes a UniSpec document into deterministic canonical form.
63
-
64
- Options:
65
-
66
- - `--stdin`read spec from stdin (or pass `-` as file)
67
- - `--format <format>` — `json|yaml`
68
- - `--output <file>` — write output to file (use `-` for stdout)
69
-
70
- ### `unispec diff <oldFile> <newFile>`
71
- Computes a structural diff between two UniSpec documents.
72
-
73
- Options:
74
-
75
- - `--format <format>` — `json|yaml`
76
- - `--output <file>` — write output to file (use `-` for stdout)
77
-
78
- ### `unispec convert [file] --to <target>`
79
- Converts UniSpec into other representations.
80
-
81
- Targets:
82
-
83
- - `openapi` — outputs OpenAPI 3.1 JSON/YAML
84
- - `graphql-sdl` — outputs GraphQL SDL
85
- - `ws-model` — outputs a dashboard-friendly WebSocket model
86
-
87
- Options:
88
-
89
- - `--stdin`read spec from stdin (or pass `-` as file)
90
- - `--format <format>` — `json|yaml` (for JSON-like targets)
91
- - `--output <file>` — write output to file (use `-` for stdout)
92
-
93
- ### `unispec dev`
94
- Local orchestrator mode.
95
-
96
- Options:
97
-
98
- - `--config <path>` — path to config file (default: `unispec.config.json|yaml|yml`)
99
- - `--host <host>` — bind host (default: `127.0.0.1`)
100
- - `--port <port>` bind port (default: `4141`)
101
- - `--watch` — watch config/spec files and refresh aggregated snapshot
102
-
103
- Planned responsibilities:
104
-
105
- - Watch local specs and/or connected services
106
- - Aggregate multiple UniSpec documents (microservices mode)
107
- - Serve a local dashboard and endpoints (e.g. `/unispec.json` for aggregated view)
108
- - Provide a single workflow to validate/normalize/diff before publishing to Registry
109
-
110
- ---
111
-
112
- ## Dev server (local orchestrator)
113
-
114
- `unispec dev` starts a local HTTP API that aggregates multiple UniSpec documents.
115
-
116
- Default bind:
117
-
118
- - Host: `127.0.0.1`
119
- - Port: `4141`
120
-
121
- Endpoints:
122
-
123
- - `GET /health` -> `OK`
124
- - `GET /unispec.json` -> aggregated JSON
125
-
126
- Aggregation format (A):
127
-
128
- ```json
129
- {
130
- "version": 1,
131
- "generatedAt": "2025-12-28T12:00:00.000Z",
132
- "services": [
133
- {
134
- "name": "users",
135
- "specPath": "./services/users/unispec.yaml",
136
- "valid": true,
137
- "spec": {}
138
- }
139
- ]
140
- }
141
- ```
142
-
143
- If at least one service is invalid, `/unispec.json` responds with status `422` and includes per-service errors.
144
-
145
- ### Example
146
-
147
- Create `unispec.config.json` (see `unispec.config.example.json`):
148
-
149
- ```bash
150
- cp unispec.config.example.json unispec.config.json
151
- ```
152
-
153
- Start the server:
154
-
155
- ```bash
156
- npm run dev -- dev --verbose
157
- ```
158
-
159
- Run using the bundled examples:
160
-
161
- ```bash
162
- npm run dev -- dev -- --config example/unispec.config.json --verbose
163
- ```
164
-
165
- Then open:
166
-
167
- - `http://127.0.0.1:4141/health`
168
- - `http://127.0.0.1:4141/unispec.json`
169
-
170
- ---
171
-
172
- ## Development
173
-
174
- ### Requirements
175
-
176
- - Node.js >= 18
177
-
178
- ### Install
179
-
180
- ```bash
181
- npm install
182
- ```
183
-
184
- ### Run CLI in dev mode
185
-
186
- ```bash
187
- npm run dev -- --help
188
- ```
189
-
190
- ### Build
191
-
192
- ```bash
193
- npm run build
194
- ```
195
-
196
- ### Run built CLI
197
-
198
- ```bash
199
- npm run start -- --help
200
- ```
201
-
202
- ---
203
-
204
- ## Related Repositories
205
-
206
- | Repository | Purpose |
207
- |---|---|
208
- | `unispec-spec` | UniSpec format definition (schemas, examples) |
209
- | `unispec-core` | Core Engine (loader/validator/normalizer/diff/converters) |
210
- | `unispec-js-adapters` | Framework integrations (Express/NestJS/etc.) |
211
- | `unispec-registry` | (Future) publishing/reading specs and version history |
212
-
213
- ---
214
-
215
- ## Contributing
216
-
217
- Contributions are welcome.
218
-
219
- Please read `windsurfrules.yml` before making changes.
220
-
221
- ---
222
-
223
- ## License
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.0",
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
+ }