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