@objectstack/cli 3.0.5 → 3.0.7

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 (141) hide show
  1. package/.turbo/turbo-build.log +2 -26
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +98 -54
  4. package/bin/run-dev.js +5 -0
  5. package/bin/run.js +5 -0
  6. package/dist/bin.d.ts +11 -0
  7. package/dist/bin.d.ts.map +1 -0
  8. package/dist/bin.js +12 -3759
  9. package/dist/bin.js.map +1 -0
  10. package/dist/commands/codemod/v2-to-v3.d.ts +10 -0
  11. package/dist/commands/codemod/v2-to-v3.d.ts.map +1 -0
  12. package/dist/commands/codemod/v2-to-v3.js +145 -0
  13. package/dist/commands/codemod/v2-to-v3.js.map +1 -0
  14. package/dist/commands/compile.d.ts +13 -0
  15. package/dist/commands/compile.d.ts.map +1 -0
  16. package/dist/commands/compile.js +91 -0
  17. package/dist/commands/compile.js.map +1 -0
  18. package/dist/commands/create.d.ts +91 -0
  19. package/dist/commands/create.d.ts.map +1 -0
  20. package/dist/commands/create.js +259 -0
  21. package/dist/commands/create.js.map +1 -0
  22. package/dist/commands/dev.d.ts +14 -0
  23. package/dist/commands/dev.d.ts.map +1 -0
  24. package/dist/commands/dev.js +67 -0
  25. package/dist/commands/dev.js.map +1 -0
  26. package/dist/commands/diff.d.ts +16 -0
  27. package/dist/commands/diff.d.ts.map +1 -0
  28. package/dist/commands/diff.js +239 -0
  29. package/dist/commands/diff.js.map +1 -0
  30. package/dist/commands/doctor.d.ts +10 -0
  31. package/dist/commands/doctor.d.ts.map +1 -0
  32. package/dist/commands/doctor.js +532 -0
  33. package/dist/commands/doctor.js.map +1 -0
  34. package/dist/commands/explain.d.ts +12 -0
  35. package/dist/commands/explain.d.ts.map +1 -0
  36. package/dist/commands/explain.js +368 -0
  37. package/dist/commands/explain.js.map +1 -0
  38. package/dist/commands/generate.d.ts +17 -0
  39. package/dist/commands/generate.d.ts.map +1 -0
  40. package/dist/commands/generate.js +833 -0
  41. package/dist/commands/generate.js.map +1 -0
  42. package/dist/commands/info.d.ts +12 -0
  43. package/dist/commands/info.d.ts.map +1 -0
  44. package/dist/commands/info.js +100 -0
  45. package/dist/commands/info.js.map +1 -0
  46. package/dist/commands/init.d.ts +22 -0
  47. package/dist/commands/init.d.ts.map +1 -0
  48. package/dist/commands/init.js +295 -0
  49. package/dist/commands/init.js.map +1 -0
  50. package/dist/commands/lint.d.ts +13 -0
  51. package/dist/commands/lint.d.ts.map +1 -0
  52. package/dist/commands/lint.js +255 -0
  53. package/dist/commands/lint.js.map +1 -0
  54. package/dist/commands/plugin/add.d.ts +22 -0
  55. package/dist/commands/plugin/add.d.ts.map +1 -0
  56. package/dist/commands/plugin/add.js +93 -0
  57. package/dist/commands/plugin/add.js.map +1 -0
  58. package/dist/commands/plugin/info.d.ts +10 -0
  59. package/dist/commands/plugin/info.d.ts.map +1 -0
  60. package/dist/commands/plugin/info.js +65 -0
  61. package/dist/commands/plugin/info.js.map +1 -0
  62. package/dist/commands/plugin/list.d.ts +13 -0
  63. package/dist/commands/plugin/list.d.ts.map +1 -0
  64. package/dist/commands/plugin/list.js +78 -0
  65. package/dist/commands/plugin/list.js.map +1 -0
  66. package/dist/commands/plugin/remove.d.ts +20 -0
  67. package/dist/commands/plugin/remove.d.ts.map +1 -0
  68. package/dist/commands/plugin/remove.js +79 -0
  69. package/dist/commands/plugin/remove.js.map +1 -0
  70. package/dist/commands/serve.d.ts +15 -0
  71. package/dist/commands/serve.d.ts.map +1 -0
  72. package/dist/commands/serve.js +286 -0
  73. package/dist/commands/serve.js.map +1 -0
  74. package/dist/commands/studio.d.ts +19 -0
  75. package/dist/commands/studio.d.ts.map +1 -0
  76. package/dist/commands/studio.js +43 -0
  77. package/dist/commands/studio.js.map +1 -0
  78. package/dist/commands/test.d.ts +13 -0
  79. package/dist/commands/test.d.ts.map +1 -0
  80. package/dist/commands/test.js +120 -0
  81. package/dist/commands/test.js.map +1 -0
  82. package/dist/commands/validate.d.ts +13 -0
  83. package/dist/commands/validate.d.ts.map +1 -0
  84. package/dist/commands/validate.js +115 -0
  85. package/dist/commands/validate.js.map +1 -0
  86. package/dist/index.d.ts +15 -114
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +20 -2799
  89. package/dist/index.js.map +1 -0
  90. package/dist/utils/config.d.ts +21 -0
  91. package/dist/utils/config.d.ts.map +1 -0
  92. package/dist/utils/config.js +66 -0
  93. package/dist/utils/config.js.map +1 -0
  94. package/dist/utils/format.d.ts +52 -0
  95. package/dist/utils/format.d.ts.map +1 -0
  96. package/dist/utils/format.js +202 -0
  97. package/dist/utils/format.js.map +1 -0
  98. package/dist/utils/plugin-helpers.d.ts +14 -0
  99. package/dist/utils/plugin-helpers.d.ts.map +1 -0
  100. package/dist/utils/plugin-helpers.js +40 -0
  101. package/dist/utils/plugin-helpers.js.map +1 -0
  102. package/dist/utils/studio.d.ts +58 -0
  103. package/dist/utils/studio.d.ts.map +1 -0
  104. package/dist/utils/studio.js +288 -0
  105. package/dist/utils/studio.js.map +1 -0
  106. package/package.json +33 -15
  107. package/src/bin.ts +11 -104
  108. package/src/commands/{codemod.ts → codemod/v2-to-v3.ts} +21 -28
  109. package/src/commands/compile.ts +35 -25
  110. package/src/commands/create.ts +29 -19
  111. package/src/commands/dev.ts +21 -10
  112. package/src/commands/diff.ts +28 -19
  113. package/src/commands/doctor.ts +20 -11
  114. package/src/commands/explain.ts +20 -10
  115. package/src/commands/generate.ts +81 -90
  116. package/src/commands/info.ts +22 -11
  117. package/src/commands/init.ts +32 -20
  118. package/src/commands/lint.ts +27 -15
  119. package/src/commands/plugin/add.ts +112 -0
  120. package/src/commands/plugin/info.ts +79 -0
  121. package/src/commands/plugin/list.ts +93 -0
  122. package/src/commands/plugin/remove.ts +97 -0
  123. package/src/commands/serve.ts +30 -20
  124. package/src/commands/studio.ts +21 -11
  125. package/src/commands/test.ts +21 -10
  126. package/src/commands/validate.ts +36 -25
  127. package/src/index.ts +20 -12
  128. package/src/utils/format.ts +10 -6
  129. package/src/utils/plugin-helpers.ts +37 -0
  130. package/src/utils/studio.ts +0 -1
  131. package/test/commands.test.ts +76 -37
  132. package/test/plugin-commands.test.ts +42 -160
  133. package/test/plugin.test.ts +19 -23
  134. package/tsconfig.build.json +18 -0
  135. package/bin/objectstack.js +0 -2
  136. package/dist/chunk-CSHQEILI.js +0 -246
  137. package/dist/chunk-Q74JNWKD.js +0 -248
  138. package/dist/config-A7BN6UIT.js +0 -11
  139. package/dist/config-UN34WBHT.js +0 -10
  140. package/src/commands/plugin.ts +0 -372
  141. package/src/utils/plugin-commands.ts +0 -163
@@ -1,28 +1,4 @@
1
1
 
2
- > @objectstack/cli@3.0.5 build /home/runner/work/spec/spec/packages/cli
3
- > tsup
2
+ > @objectstack/cli@3.0.7 build /home/runner/work/spec/spec/packages/cli
3
+ > tsc -p tsconfig.build.json
4
4
 
5
- CLI Building entry: src/bin.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Using tsup config: /home/runner/work/spec/spec/packages/cli/tsup.config.ts
9
- CLI Building entry: src/index.ts
10
- CLI Using tsconfig: tsconfig.json
11
- CLI tsup v8.5.1
12
- CLI Using tsup config: /home/runner/work/spec/spec/packages/cli/tsup.config.ts
13
- CLI Target: es2022
14
- CLI Target: es2022
15
- ESM Build start
16
- CLI Cleaning output folder
17
- ESM Build start
18
- ESM dist/index.js 94.66 KB
19
- ESM dist/config-UN34WBHT.js 151.00 B
20
- ESM dist/chunk-CSHQEILI.js 7.29 KB
21
- ESM ⚡️ Build success in 186ms
22
- ESM dist/bin.js 131.47 KB
23
- ESM dist/config-A7BN6UIT.js 171.00 B
24
- ESM dist/chunk-Q74JNWKD.js 7.31 KB
25
- ESM ⚡️ Build success in 186ms
26
- DTS Build start
27
- DTS ⚡️ Build success in 14521ms
28
- DTS dist/index.d.ts 3.42 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @objectstack/cli
2
2
 
3
+ ## 3.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0119bd7]
8
+ - Updated dependencies [5426bdf]
9
+ - @objectstack/spec@3.0.7
10
+ - @objectstack/core@3.0.7
11
+ - @objectstack/objectql@3.0.7
12
+ - @objectstack/driver-memory@3.0.7
13
+ - @objectstack/plugin-hono-server@3.0.7
14
+ - @objectstack/rest@3.0.7
15
+ - @objectstack/runtime@3.0.7
16
+
17
+ ## 3.0.6
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [5df254c]
22
+ - @objectstack/spec@3.0.6
23
+ - @objectstack/core@3.0.6
24
+ - @objectstack/objectql@3.0.6
25
+ - @objectstack/driver-memory@3.0.6
26
+ - @objectstack/plugin-hono-server@3.0.6
27
+ - @objectstack/rest@3.0.6
28
+ - @objectstack/runtime@3.0.6
29
+
3
30
  ## 3.0.5
4
31
 
5
32
  ### Patch Changes
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Command Line Interface for building metadata-driven applications with the ObjectStack Protocol.
4
4
 
5
+ Built on [oclif](https://oclif.io/) — commands are auto-discovered, and plugins can extend the CLI without modifying the main package.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -40,6 +42,7 @@ os compile
40
42
  | `os init [name]` | Initialize a new ObjectStack project in the current directory |
41
43
  | `os dev [package]` | Start development mode with hot reload |
42
44
  | `os serve [config]` | Start the ObjectStack server with plugin auto-detection |
45
+ | `os studio [config]` | Launch Studio UI with development server |
43
46
 
44
47
  ### Build & Validate
45
48
 
@@ -73,6 +76,20 @@ Available generate types: `object`, `view`, `action`, `flow`, `agent`, `dashboar
73
76
  |---------|-------------|
74
77
  | `os test [files]` | Run Quality Protocol test scenarios against a running server |
75
78
  | `os doctor` | Check development environment health |
79
+ | `os lint [config]` | Check configuration for style and convention issues |
80
+ | `os diff [before] [after]` | Compare two configurations and detect breaking changes |
81
+
82
+ ### Reference
83
+
84
+ | Command | Description |
85
+ |---------|-------------|
86
+ | `os explain [schema]` | Display human-readable explanation of an ObjectStack schema |
87
+
88
+ ### Code Transforms
89
+
90
+ | Command | Description |
91
+ |---------|-------------|
92
+ | `os codemod v2-to-v3` | Migrate ObjectStack v2 config to v3 format |
76
93
 
77
94
  ## Configuration
78
95
 
@@ -120,12 +137,12 @@ export default defineStack({
120
137
 
121
138
  - `-p, --port <port>` — Server port (default: `3000`)
122
139
  - `--dev` — Run in development mode (load devPlugins, pretty logging)
140
+ - `--ui` — Enable Studio UI
123
141
  - `--no-server` — Skip starting HTTP server plugin
124
142
 
125
143
  ### `os generate`
126
144
 
127
145
  - `-d, --dir <directory>` — Override target directory
128
- - `--dry-run` — Preview without writing files
129
146
 
130
147
  ### `os plugin list`
131
148
 
@@ -140,75 +157,78 @@ export default defineStack({
140
157
 
141
158
  - `-c, --config <path>` — Configuration file path
142
159
 
143
- ## Plugin CLI Extensions
160
+ ### `os info`
161
+
162
+ - `--json` — Output as JSON
144
163
 
145
- Plugins can extend the CLI with custom commands via the `contributes.commands` manifest field. The CLI automatically discovers and loads these commands at startup.
164
+ ### `os doctor`
146
165
 
147
- ### How to Create a CLI Plugin
166
+ - `-v, --verbose` Show fix suggestions for warnings
167
+ - `--scan-deprecations` — Scan for deprecated patterns
148
168
 
149
- **1. Declare commands in the plugin manifest:**
169
+ ## oclif Plugin System
150
170
 
151
- ```typescript
152
- export default defineStack({
153
- manifest: {
154
- id: 'com.acme.marketplace',
155
- version: '1.0.0',
156
- type: 'plugin',
157
- name: 'Marketplace Plugin',
158
- contributes: {
159
- commands: [
160
- {
161
- name: 'marketplace',
162
- description: 'Manage marketplace applications',
163
- module: './dist/cli.js',
164
- },
165
- ],
166
- },
167
- },
168
- });
171
+ The CLI uses oclif's built-in plugin system for extensibility. Third-party plugins (e.g., cloud commands, marketplace tools) can extend the CLI without modifying the main package.
172
+
173
+ ### How Plugin Extension Works
174
+
175
+ 1. **Create an oclif plugin package** with its own `oclif` config in `package.json`
176
+ 2. **Export oclif Command classes** from the plugin's `src/commands/` directory
177
+ 3. **Install the plugin** via `os plugins install <package>` or declare it in the main CLI's `oclif.plugins`
178
+
179
+ ### Creating a CLI Plugin
180
+
181
+ **1. Configure the plugin's `package.json`:**
182
+
183
+ ```json
184
+ {
185
+ "name": "@acme/plugin-marketplace",
186
+ "oclif": {
187
+ "commands": {
188
+ "strategy": "pattern",
189
+ "target": "./dist/commands",
190
+ "glob": "**/*.js"
191
+ }
192
+ }
193
+ }
169
194
  ```
170
195
 
171
- **2. Export Commander.js commands from the module:**
196
+ **2. Create oclif Command classes:**
172
197
 
173
198
  ```typescript
174
- // src/cli.ts
175
- import { Command } from 'commander';
176
-
177
- const marketplaceCommand = new Command('marketplace')
178
- .description('Manage marketplace applications')
179
- .addCommand(
180
- new Command('search')
181
- .argument('<query>')
182
- .action(async (query) => { /* ... */ })
183
- )
184
- .addCommand(
185
- new Command('install')
186
- .argument('<app>')
187
- .action(async (app) => { /* ... */ })
188
- );
189
-
190
- // Named export (recommended)
191
- export const commands = [marketplaceCommand];
192
- // Also supports: export default Command | Command[]
199
+ // src/commands/marketplace/search.ts
200
+ import { Args, Command, Flags } from '@oclif/core';
201
+
202
+ export default class MarketplaceSearch extends Command {
203
+ static override description = 'Search marketplace applications';
204
+
205
+ static override args = {
206
+ query: Args.string({ description: 'Search query', required: true }),
207
+ };
208
+
209
+ async run() {
210
+ const { args } = await this.parse(MarketplaceSearch);
211
+ // Implementation...
212
+ }
213
+ }
193
214
  ```
194
215
 
195
- **3. Register the plugin in the host project and use:**
216
+ **3. Install and use:**
196
217
 
197
218
  ```bash
198
- os plugin add @acme/plugin-marketplace
219
+ os plugins install @acme/plugin-marketplace
199
220
  os marketplace search "crm"
200
- os marketplace install com.acme.crm
201
221
  ```
202
222
 
203
- For a complete guide, see the [Plugin CLI Extensions](/docs/guides/plugins#cli-command-extensions) section in the Plugins guide.
223
+ ### Key Differences from Previous Plugin Model
204
224
 
205
- ### `os info`
206
-
207
- - `--json` Output as JSON
208
-
209
- ### `os doctor`
210
-
211
- - `-v, --verbose` Show fix suggestions for warnings
225
+ | Before (Commander.js) | After (oclif) |
226
+ |---|---|
227
+ | Plugins declared in `objectstack.config.ts` | Plugins installed via `os plugins install` or `oclif.plugins` |
228
+ | Custom `loadPluginCommands` mechanism | oclif's built-in plugin discovery |
229
+ | `contributes.commands` in manifest | `oclif.commands` in `package.json` |
230
+ | Commander.js `new Command(...)` exports | oclif `class extends Command` exports |
231
+ | Project config determines CLI commands | CLI commands available without project init |
212
232
 
213
233
  ## Typical Workflow
214
234
 
@@ -223,6 +243,30 @@ os dev # 7. Start dev server
223
243
  os compile # 8. Build for production
224
244
  ```
225
245
 
246
+ ## Architecture
247
+
248
+ ```
249
+ @objectstack/cli (oclif)
250
+ ├── bin/run.js # Entry point (os / objectstack)
251
+ ├── src/commands/ # Auto-discovered command classes
252
+ │ ├── init.ts # os init
253
+ │ ├── dev.ts # os dev
254
+ │ ├── serve.ts # os serve
255
+ │ ├── compile.ts # os compile
256
+ │ ├── validate.ts # os validate
257
+ │ ├── generate.ts # os generate (alias: g)
258
+ │ ├── plugin/ # os plugin <subcommand>
259
+ │ │ ├── list.ts
260
+ │ │ ├── info.ts
261
+ │ │ ├── add.ts
262
+ │ │ └── remove.ts
263
+ │ ├── codemod/ # os codemod <subcommand>
264
+ │ │ └── v2-to-v3.ts
265
+ │ └── ...
266
+ ├── src/utils/ # Shared utilities
267
+ └── package.json # oclif config under "oclif" key
268
+ ```
269
+
226
270
  ## License
227
271
 
228
272
  Apache-2.0
package/bin/run-dev.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env tsx
2
+
3
+ import { execute } from '@oclif/core';
4
+
5
+ await execute({ type: 'esm', development: true, dir: import.meta.url });
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execute } from '@oclif/core';
4
+
5
+ await execute({ type: 'esm', dir: import.meta.url });
package/dist/bin.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ObjectStack CLI — oclif-based entry point.
3
+ *
4
+ * All commands are auto-discovered from `src/commands/` by oclif.
5
+ * Plugins extend the CLI via oclif's built-in plugin system
6
+ * (configured in package.json under "oclif.plugins").
7
+ *
8
+ * Run `os --help` for available commands.
9
+ */
10
+ export { execute } from '@oclif/core';
11
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}