@objectstack/cli 0.9.2 โ 1.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/CHANGELOG.md +19 -0
- package/README.md +12 -483
- package/dist/bin.js +9 -8
- package/package.json +9 -9
- package/src/commands/compile.ts +1 -1
- package/src/commands/serve.ts +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @objectstack/cli
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Major version release for ObjectStack Protocol v1.0.
|
|
8
|
+
- Stabilized Protocol Definitions
|
|
9
|
+
- Enhanced Runtime Plugin Support
|
|
10
|
+
- Fixed Type Compliance across Monorepo
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @objectstack/spec@1.0.0
|
|
16
|
+
- @objectstack/core@1.0.0
|
|
17
|
+
- @objectstack/runtime@1.0.0
|
|
18
|
+
- @objectstack/objectql@1.0.0
|
|
19
|
+
- @objectstack/driver-memory@1.0.0
|
|
20
|
+
- @objectstack/plugin-hono-server@1.0.0
|
|
21
|
+
|
|
3
22
|
## 0.9.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,495 +1,24 @@
|
|
|
1
1
|
# @objectstack/cli
|
|
2
2
|
|
|
3
|
-
Command Line Interface for
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- ๐ **Development Server** - Hot-reload development server with auto-discovery
|
|
8
|
-
- ๐จ **Build & Compile** - Validate and compile ObjectStack configurations to JSON
|
|
9
|
-
- ๐ฅ **Environment Check** - Health check for development environment
|
|
10
|
-
- ๐ฆ **Project Scaffolding** - Generate plugins and examples from templates
|
|
11
|
-
- ๐งช **Test Runner** - Execute Quality Protocol test scenarios
|
|
12
|
-
- โก **Auto-Configuration** - Smart defaults with minimal configuration
|
|
13
|
-
|
|
14
|
-
## ๐ค AI Development Context
|
|
15
|
-
|
|
16
|
-
**Role**: Developer Tools & Terminal Interface
|
|
17
|
-
**Usage**:
|
|
18
|
-
- Runs the development server (`serve` command).
|
|
19
|
-
- Compiles metadata.
|
|
20
|
-
- Scaffolds new projects (`create`).
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
### Global Installation (Recommended)
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install -g @objectstack/cli
|
|
28
|
-
# or
|
|
29
|
-
pnpm add -g @objectstack/cli
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### Local Development
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
pnpm add -D @objectstack/cli
|
|
36
|
-
```
|
|
3
|
+
Command Line Interface for developing ObjectStack applications.
|
|
37
4
|
|
|
38
5
|
## Commands
|
|
39
6
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
objectstack serve
|
|
7
|
+
- **`os serve`**: Start the backend server.
|
|
8
|
+
- Auto-detects configuration.
|
|
9
|
+
- Auto-loads `ObjectQL` and `InMemoryDriver` if not specified.
|
|
10
|
+
- **`os dev`**: Start in development mode (with watch).
|
|
11
|
+
- **`os doctor`**: Check environment health.
|
|
12
|
+
- **`os create`**: Scaffold new projects.
|
|
47
13
|
|
|
48
|
-
|
|
49
|
-
objectstack serve my-config.ts
|
|
14
|
+
## Configuration
|
|
50
15
|
|
|
51
|
-
|
|
52
|
-
objectstack serve --port 8080
|
|
53
|
-
|
|
54
|
-
# Development mode (loads devPlugins)
|
|
55
|
-
objectstack serve --dev
|
|
56
|
-
|
|
57
|
-
# Skip HTTP server plugin
|
|
58
|
-
objectstack serve --no-server
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Features:**
|
|
62
|
-
- Auto-detects and loads `objectstack.config.ts`
|
|
63
|
-
- Auto-injects ObjectQL Engine if objects are defined
|
|
64
|
-
- Auto-injects Memory Driver in development mode
|
|
65
|
-
- Auto-registers AppPlugin for app configurations
|
|
66
|
-
- Finds available port if requested port is in use
|
|
67
|
-
- Pretty logging in development mode
|
|
68
|
-
- Graceful shutdown on SIGINT (Ctrl+C)
|
|
69
|
-
|
|
70
|
-
**Example:**
|
|
16
|
+
The CLI looks for `objectstack.config.ts` in the current directory.
|
|
71
17
|
|
|
72
18
|
```typescript
|
|
73
19
|
// objectstack.config.ts
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
manifest: {
|
|
78
|
-
name: 'my-app',
|
|
79
|
-
version: '1.0.0'
|
|
80
|
-
},
|
|
81
|
-
objects: [
|
|
82
|
-
{
|
|
83
|
-
name: 'todo_task',
|
|
84
|
-
fields: {
|
|
85
|
-
subject: { type: 'text', label: 'Subject' },
|
|
86
|
-
completed: { type: 'boolean', default: false }
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
$ objectstack serve --dev
|
|
95
|
-
|
|
96
|
-
๐ ObjectStack Server
|
|
97
|
-
------------------------
|
|
98
|
-
๐ Config: objectstack.config.ts
|
|
99
|
-
๐ Port: 3000
|
|
100
|
-
|
|
101
|
-
๐ฆ Loading configuration...
|
|
102
|
-
โ Configuration loaded
|
|
103
|
-
๐ง Initializing ObjectStack kernel...
|
|
104
|
-
Auto-injecting ObjectQL Engine...
|
|
105
|
-
โ Registered ObjectQL Plugin (auto-detected)
|
|
106
|
-
Auto-injecting Memory Driver (Dev Mode)...
|
|
107
|
-
โ Registered Memory Driver (auto-detected)
|
|
108
|
-
โ Registered App Plugin (auto-detected)
|
|
109
|
-
โ Registered HTTP server plugin (port: 3000)
|
|
110
|
-
|
|
111
|
-
๐ Starting ObjectStack...
|
|
112
|
-
|
|
113
|
-
โ
ObjectStack server is running!
|
|
114
|
-
Press Ctrl+C to stop
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### `objectstack dev`
|
|
118
|
-
|
|
119
|
-
Start development mode with watch and hot-reload capabilities.
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Single package mode (if objectstack.config.ts exists in CWD)
|
|
123
|
-
objectstack dev
|
|
124
|
-
|
|
125
|
-
# Monorepo mode - run dev for all packages
|
|
126
|
-
objectstack dev
|
|
127
|
-
|
|
128
|
-
# Monorepo mode - filter specific package
|
|
129
|
-
objectstack dev @objectstack/core
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**Behavior:**
|
|
133
|
-
- **Single Package Mode**: If `objectstack.config.ts` exists in current directory, delegates to `objectstack serve --dev` to start a development server with hot reload
|
|
134
|
-
- **Monorepo Mode**: If `pnpm-workspace.yaml` exists in current directory (workspace root), executes `pnpm dev` with optional package filter to run development builds across multiple packages in the workspace. The command uses pnpm's workspace filtering to target specific packages or all packages.
|
|
135
|
-
|
|
136
|
-
### `objectstack compile`
|
|
137
|
-
|
|
138
|
-
Compile and validate ObjectStack configuration files.
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
# Compile default config
|
|
142
|
-
objectstack compile
|
|
143
|
-
|
|
144
|
-
# Custom source and output
|
|
145
|
-
objectstack compile src/config.ts build/app.json
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Features:**
|
|
149
|
-
- Bundles TypeScript configuration files
|
|
150
|
-
- Validates against ObjectStack Protocol using Zod schemas
|
|
151
|
-
- Outputs optimized JSON artifact
|
|
152
|
-
- Shows validation errors with exact field paths
|
|
153
|
-
- Build time and artifact size reporting
|
|
154
|
-
|
|
155
|
-
**Example:**
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
$ objectstack compile
|
|
159
|
-
|
|
160
|
-
๐น ObjectStack Compiler v0.1
|
|
161
|
-
------------------------------
|
|
162
|
-
๐ Source: objectstack.config.ts
|
|
163
|
-
๐ฆ Bundling Configuration...
|
|
164
|
-
๐ Validating Protocol Compliance...
|
|
165
|
-
|
|
166
|
-
โ
Build Success (234ms)
|
|
167
|
-
๐ฆ Artifact: dist/objectstack.json (12.45 KB)
|
|
168
|
-
โจ Ready for Deployment
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### `objectstack doctor`
|
|
172
|
-
|
|
173
|
-
Check development environment health and dependencies.
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
# Quick health check
|
|
177
|
-
objectstack doctor
|
|
178
|
-
|
|
179
|
-
# Detailed information with fix suggestions
|
|
180
|
-
objectstack doctor --verbose
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**Checks:**
|
|
184
|
-
- โ Node.js version (>= 18.0.0 required)
|
|
185
|
-
- โ pnpm package manager
|
|
186
|
-
- โ TypeScript compiler
|
|
187
|
-
- โ Dependencies installation status
|
|
188
|
-
- โ @objectstack/spec build status
|
|
189
|
-
- โ Git installation
|
|
190
|
-
|
|
191
|
-
**Example Output:**
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
$ objectstack doctor
|
|
195
|
-
|
|
196
|
-
๐ฅ ObjectStack Environment Health Check
|
|
197
|
-
-----------------------------------------
|
|
198
|
-
|
|
199
|
-
โ Node.js Version v20.10.0
|
|
200
|
-
โ pnpm Version 10.28.1
|
|
201
|
-
โ TypeScript Version 5.3.3
|
|
202
|
-
โ Dependencies Installed
|
|
203
|
-
โ @objectstack/spec Built
|
|
204
|
-
โ Git git version 2.39.0
|
|
205
|
-
|
|
206
|
-
โ
Environment is healthy and ready for development!
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### `objectstack create`
|
|
210
|
-
|
|
211
|
-
Create new plugins or examples from templates.
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
# Create a plugin
|
|
215
|
-
objectstack create plugin my-feature
|
|
216
|
-
|
|
217
|
-
# Create an example
|
|
218
|
-
objectstack create example todo-app
|
|
219
|
-
|
|
220
|
-
# Custom directory
|
|
221
|
-
objectstack create plugin auth --dir custom/path
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
**Templates:**
|
|
225
|
-
|
|
226
|
-
#### Plugin Template
|
|
227
|
-
Creates a fully-configured ObjectStack plugin with:
|
|
228
|
-
- `package.json` with dependencies
|
|
229
|
-
- TypeScript configuration
|
|
230
|
-
- Plugin implementation boilerplate
|
|
231
|
-
- README with usage examples
|
|
232
|
-
- Test setup with Vitest
|
|
233
|
-
|
|
234
|
-
#### Example Template
|
|
235
|
-
Creates an ObjectStack example application with:
|
|
236
|
-
- `objectstack.config.ts` configuration
|
|
237
|
-
- Build and dev scripts
|
|
238
|
-
- TypeScript configuration
|
|
239
|
-
- Example README
|
|
240
|
-
|
|
241
|
-
**Example:**
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
$ objectstack create plugin authentication
|
|
245
|
-
|
|
246
|
-
๐ฆ ObjectStack Project Creator
|
|
247
|
-
-------------------------------
|
|
248
|
-
๐ Creating plugin: authentication
|
|
249
|
-
๐ Location: packages/plugins/plugin-authentication
|
|
250
|
-
|
|
251
|
-
โ Created package.json
|
|
252
|
-
โ Created tsconfig.json
|
|
253
|
-
โ Created src/index.ts
|
|
254
|
-
โ Created README.md
|
|
255
|
-
|
|
256
|
-
โ
Project created successfully!
|
|
257
|
-
|
|
258
|
-
Next steps:
|
|
259
|
-
cd packages/plugins/plugin-authentication
|
|
260
|
-
pnpm install
|
|
261
|
-
pnpm build
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### `objectstack test:run`
|
|
265
|
-
|
|
266
|
-
Run Quality Protocol test scenarios against your ObjectStack server.
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
# Run all tests in qa/ directory
|
|
270
|
-
objectstack test:run
|
|
271
|
-
|
|
272
|
-
# Specific test file or pattern
|
|
273
|
-
objectstack test:run qa/api-tests.json
|
|
274
|
-
|
|
275
|
-
# Custom target URL
|
|
276
|
-
objectstack test:run --url http://staging.example.com
|
|
277
|
-
|
|
278
|
-
# With authentication
|
|
279
|
-
objectstack test:run --token "Bearer xyz..."
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
**Features:**
|
|
283
|
-
- Executes test scenarios from JSON files
|
|
284
|
-
- HTTP-based test adapter
|
|
285
|
-
- Detailed step-by-step output
|
|
286
|
-
- Pass/fail reporting with timing
|
|
287
|
-
- Authentication support
|
|
288
|
-
|
|
289
|
-
## Configuration File
|
|
290
|
-
|
|
291
|
-
The CLI expects an `objectstack.config.ts` file in your project root:
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
import { defineStack } from '@objectstack/spec';
|
|
295
|
-
import type { ObjectStackDefinition } from '@objectstack/spec';
|
|
296
|
-
|
|
297
|
-
export default defineStack({
|
|
298
|
-
// App metadata
|
|
299
|
-
manifest: {
|
|
300
|
-
name: 'my-app',
|
|
301
|
-
version: '1.0.0',
|
|
302
|
-
description: 'My ObjectStack Application'
|
|
303
|
-
},
|
|
304
|
-
|
|
305
|
-
// Data objects
|
|
306
|
-
objects: [
|
|
307
|
-
{
|
|
308
|
-
name: 'customer',
|
|
309
|
-
label: 'Customer',
|
|
310
|
-
fields: {
|
|
311
|
-
name: { type: 'text', label: 'Name', required: true },
|
|
312
|
-
email: { type: 'email', label: 'Email' },
|
|
313
|
-
phone: { type: 'phone', label: 'Phone' }
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
],
|
|
317
|
-
|
|
318
|
-
// UI applications
|
|
319
|
-
apps: [
|
|
320
|
-
{
|
|
321
|
-
id: 'crm',
|
|
322
|
-
name: 'CRM',
|
|
323
|
-
objects: ['customer', 'opportunity']
|
|
324
|
-
}
|
|
325
|
-
],
|
|
326
|
-
|
|
327
|
-
// Runtime plugins
|
|
328
|
-
plugins: [
|
|
329
|
-
// Your production plugins
|
|
330
|
-
],
|
|
331
|
-
|
|
332
|
-
// Development-only plugins
|
|
333
|
-
devPlugins: [
|
|
334
|
-
// Loaded only with --dev flag
|
|
335
|
-
]
|
|
336
|
-
});
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
## Usage in Monorepo
|
|
340
|
-
|
|
341
|
-
The CLI is monorepo-aware and works seamlessly in pnpm workspaces:
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
# From workspace root
|
|
345
|
-
pnpm --filter @objectstack/spec build
|
|
346
|
-
pnpm --filter my-app dev
|
|
347
|
-
|
|
348
|
-
# Or use the CLI shorthand
|
|
349
|
-
objectstack dev @objectstack/spec
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
## Environment Variables
|
|
353
|
-
|
|
354
|
-
```bash
|
|
355
|
-
# Server port (overridden by --port flag)
|
|
356
|
-
PORT=3000
|
|
357
|
-
|
|
358
|
-
# Node environment
|
|
359
|
-
NODE_ENV=development|production
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
## Aliases
|
|
363
|
-
|
|
364
|
-
The CLI binary is available as both `objectstack` and `os`:
|
|
365
|
-
|
|
366
|
-
```bash
|
|
367
|
-
objectstack serve
|
|
368
|
-
# or
|
|
369
|
-
os serve
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
## Development Workflow
|
|
373
|
-
|
|
374
|
-
### New Project Setup
|
|
375
|
-
|
|
376
|
-
```bash
|
|
377
|
-
# 1. Create a new example
|
|
378
|
-
objectstack create example my-project
|
|
379
|
-
|
|
380
|
-
# 2. Navigate to project
|
|
381
|
-
cd examples/my-project
|
|
382
|
-
|
|
383
|
-
# 3. Install dependencies
|
|
384
|
-
pnpm install
|
|
385
|
-
|
|
386
|
-
# 4. Start development server
|
|
387
|
-
objectstack dev
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
### Plugin Development
|
|
391
|
-
|
|
392
|
-
```bash
|
|
393
|
-
# 1. Create plugin
|
|
394
|
-
objectstack create plugin my-feature
|
|
395
|
-
|
|
396
|
-
# 2. Implement plugin logic
|
|
397
|
-
# Edit packages/plugins/plugin-my-feature/src/index.ts
|
|
398
|
-
|
|
399
|
-
# 3. Build and test
|
|
400
|
-
cd packages/plugins/plugin-my-feature
|
|
401
|
-
pnpm build
|
|
402
|
-
pnpm test
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
### Production Build
|
|
406
|
-
|
|
407
|
-
```bash
|
|
408
|
-
# 1. Compile configuration
|
|
409
|
-
objectstack compile
|
|
410
|
-
|
|
411
|
-
# 2. Run production server
|
|
412
|
-
NODE_ENV=production objectstack serve --port 8080
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
## Integration with Package Scripts
|
|
416
|
-
|
|
417
|
-
Add CLI commands to your `package.json`:
|
|
418
|
-
|
|
419
|
-
```json
|
|
420
|
-
{
|
|
421
|
-
"scripts": {
|
|
422
|
-
"build": "objectstack compile",
|
|
423
|
-
"dev": "objectstack dev",
|
|
424
|
-
"serve": "objectstack serve",
|
|
425
|
-
"test": "objectstack test:run",
|
|
426
|
-
"doctor": "objectstack doctor"
|
|
427
|
-
}
|
|
20
|
+
export default {
|
|
21
|
+
metadata: { ... },
|
|
22
|
+
plugins: [ ... ]
|
|
428
23
|
}
|
|
429
24
|
```
|
|
430
|
-
|
|
431
|
-
## Troubleshooting
|
|
432
|
-
|
|
433
|
-
### Port Already in Use
|
|
434
|
-
|
|
435
|
-
The CLI automatically finds an available port if the requested port is in use:
|
|
436
|
-
|
|
437
|
-
```bash
|
|
438
|
-
๐ Port: 3001 (requested: 3000 in use)
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
### Configuration Not Found
|
|
442
|
-
|
|
443
|
-
Ensure your config file exists and is properly named:
|
|
444
|
-
|
|
445
|
-
```bash
|
|
446
|
-
โ Configuration file not found: /path/to/objectstack.config.ts
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
Default file name: `objectstack.config.ts`
|
|
450
|
-
|
|
451
|
-
### Validation Errors
|
|
452
|
-
|
|
453
|
-
The compiler will show detailed validation errors:
|
|
454
|
-
|
|
455
|
-
```bash
|
|
456
|
-
โ Validation Failed!
|
|
457
|
-
- [objects.0.name] Expected snake_case, received "MyObject"
|
|
458
|
-
- [objects.0.fields.name.type] Invalid enum value. Expected 'text' | 'number' | ...
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### Environment Issues
|
|
462
|
-
|
|
463
|
-
Run the doctor command to diagnose:
|
|
464
|
-
|
|
465
|
-
```bash
|
|
466
|
-
objectstack doctor --verbose
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
## API Reference
|
|
470
|
-
|
|
471
|
-
### Command Options
|
|
472
|
-
|
|
473
|
-
All commands support `--help` for detailed usage:
|
|
474
|
-
|
|
475
|
-
```bash
|
|
476
|
-
objectstack --help
|
|
477
|
-
objectstack serve --help
|
|
478
|
-
objectstack compile --help
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
### Exit Codes
|
|
482
|
-
|
|
483
|
-
- `0` - Success
|
|
484
|
-
- `1` - Error (validation failed, file not found, etc.)
|
|
485
|
-
|
|
486
|
-
## Related Packages
|
|
487
|
-
|
|
488
|
-
- [@objectstack/spec](../spec) - Protocol definitions and schemas
|
|
489
|
-
- [@objectstack/core](../core) - Microkernel runtime
|
|
490
|
-
- [@objectstack/objectql](../objectql) - Data query engine
|
|
491
|
-
- [@objectstack/runtime](../runtime) - Runtime utilities and plugins
|
|
492
|
-
|
|
493
|
-
## License
|
|
494
|
-
|
|
495
|
-
MIT
|
package/dist/bin.js
CHANGED
|
@@ -500,15 +500,16 @@ var serveCommand = new Command4("serve").description("Start ObjectStack server w
|
|
|
500
500
|
throw new Error(`Default export not found in ${configPath}`);
|
|
501
501
|
}
|
|
502
502
|
console.log(chalk4.green(`\u2713 Configuration loaded`));
|
|
503
|
-
const {
|
|
504
|
-
console.log(chalk4.yellow(`\u{1F527} Initializing ObjectStack
|
|
503
|
+
const { Runtime } = await import("@objectstack/runtime");
|
|
504
|
+
console.log(chalk4.yellow(`\u{1F527} Initializing ObjectStack runtime...`));
|
|
505
505
|
const isDev = options.dev || process.env.NODE_ENV === "development";
|
|
506
506
|
const loggerConfig = isDev ? { format: "pretty" } : void 0;
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
const runtime = new Runtime({
|
|
508
|
+
kernel: {
|
|
509
|
+
logger: loggerConfig
|
|
510
|
+
}
|
|
511
511
|
});
|
|
512
|
+
const kernel = runtime.getKernel();
|
|
512
513
|
let plugins = config.plugins || [];
|
|
513
514
|
if (options.dev && config.devPlugins) {
|
|
514
515
|
console.log(chalk4.blue(`\u{1F4E6} Loading development plugins...`));
|
|
@@ -580,7 +581,7 @@ var serveCommand = new Command4("serve").description("Start ObjectStack server w
|
|
|
580
581
|
}
|
|
581
582
|
console.log(chalk4.yellow(`
|
|
582
583
|
\u{1F680} Starting ObjectStack...`));
|
|
583
|
-
await
|
|
584
|
+
await runtime.start();
|
|
584
585
|
console.log(chalk4.green(`
|
|
585
586
|
\u2705 ObjectStack server is running!`));
|
|
586
587
|
console.log(chalk4.dim(` Press Ctrl+C to stop
|
|
@@ -589,7 +590,7 @@ var serveCommand = new Command4("serve").description("Start ObjectStack server w
|
|
|
589
590
|
console.log(chalk4.yellow(`
|
|
590
591
|
|
|
591
592
|
\u23F9 Stopping server...`));
|
|
592
|
-
await
|
|
593
|
+
await runtime.getKernel().shutdown();
|
|
593
594
|
console.log(chalk4.green(`\u2705 Server stopped`));
|
|
594
595
|
process.exit(0);
|
|
595
596
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Command Line Interface for ObjectStack Protocol",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
],
|
|
16
16
|
"type": "module",
|
|
17
17
|
"author": "Steedos",
|
|
18
|
-
"license": "
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"bundle-require": "^5.1.0",
|
|
21
21
|
"chalk": "^5.3.0",
|
|
22
22
|
"commander": "^11.1.0",
|
|
23
23
|
"tsx": "^4.7.1",
|
|
24
24
|
"zod": "^4.3.6",
|
|
25
|
-
"@objectstack/core": "0.
|
|
26
|
-
"@objectstack/driver-memory": "^0.
|
|
27
|
-
"@objectstack/objectql": "^0.
|
|
28
|
-
"@objectstack/plugin-hono-server": "0.
|
|
29
|
-
"@objectstack/runtime": "^0.
|
|
30
|
-
"@objectstack/spec": "0.
|
|
25
|
+
"@objectstack/core": "1.0.0",
|
|
26
|
+
"@objectstack/driver-memory": "^1.0.0",
|
|
27
|
+
"@objectstack/objectql": "^1.0.0",
|
|
28
|
+
"@objectstack/plugin-hono-server": "1.0.0",
|
|
29
|
+
"@objectstack/runtime": "^1.0.0",
|
|
30
|
+
"@objectstack/spec": "1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@objectstack/core": "^0.
|
|
33
|
+
"@objectstack/core": "^1.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.1.0",
|
package/src/commands/compile.ts
CHANGED
|
@@ -43,7 +43,7 @@ export const compileCommand = new Command('compile')
|
|
|
43
43
|
if (!result.success) {
|
|
44
44
|
console.error(chalk.red(`\nโ Validation Failed!`));
|
|
45
45
|
|
|
46
|
-
const error = result.error as ZodError;
|
|
46
|
+
const error = result.error as unknown as ZodError;
|
|
47
47
|
error.issues.forEach((e: any) => {
|
|
48
48
|
console.error(chalk.red(` - [${e.path.join('.')}] ${e.message}`));
|
|
49
49
|
});
|
package/src/commands/serve.ts
CHANGED
|
@@ -81,20 +81,21 @@ export const serveCommand = new Command('serve')
|
|
|
81
81
|
console.log(chalk.green(`โ Configuration loaded`));
|
|
82
82
|
|
|
83
83
|
// Import ObjectStack runtime
|
|
84
|
-
const {
|
|
84
|
+
const { Runtime } = await import('@objectstack/runtime');
|
|
85
85
|
|
|
86
|
-
// Create
|
|
87
|
-
console.log(chalk.yellow(`๐ง Initializing ObjectStack
|
|
86
|
+
// Create runtime instance
|
|
87
|
+
console.log(chalk.yellow(`๐ง Initializing ObjectStack runtime...`));
|
|
88
88
|
|
|
89
89
|
// Auto-configure pretty logging in development mode
|
|
90
90
|
const isDev = options.dev || process.env.NODE_ENV === 'development';
|
|
91
91
|
const loggerConfig = isDev ? { format: 'pretty' } : undefined;
|
|
92
92
|
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
const runtime = new Runtime({
|
|
94
|
+
kernel: {
|
|
95
|
+
logger: loggerConfig
|
|
96
|
+
}
|
|
97
97
|
});
|
|
98
|
+
const kernel = runtime.getKernel();
|
|
98
99
|
|
|
99
100
|
// Load plugins from configuration
|
|
100
101
|
let plugins = config.plugins || [];
|
|
@@ -186,9 +187,9 @@ export const serveCommand = new Command('serve')
|
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
// Boot the
|
|
190
|
+
// Boot the runtime
|
|
190
191
|
console.log(chalk.yellow(`\n๐ Starting ObjectStack...`));
|
|
191
|
-
await
|
|
192
|
+
await runtime.start();
|
|
192
193
|
|
|
193
194
|
console.log(chalk.green(`\nโ
ObjectStack server is running!`));
|
|
194
195
|
console.log(chalk.dim(` Press Ctrl+C to stop\n`));
|
|
@@ -196,7 +197,7 @@ export const serveCommand = new Command('serve')
|
|
|
196
197
|
// Keep process alive
|
|
197
198
|
process.on('SIGINT', async () => {
|
|
198
199
|
console.log(chalk.yellow(`\n\nโน Stopping server...`));
|
|
199
|
-
await
|
|
200
|
+
await runtime.getKernel().shutdown();
|
|
200
201
|
console.log(chalk.green(`โ
Server stopped`));
|
|
201
202
|
process.exit(0);
|
|
202
203
|
});
|