Skip to content

Commit 06a55b8

Browse files
authored
Merge pull request #584 from objectstack-ai/copilot/refactor-cli-to-oclif-plugin
2 parents aac7bf3 + 845a259 commit 06a55b8

25 files changed

Lines changed: 1149 additions & 540 deletions

ROADMAP.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ All 4 phases complete across 5 designers (Page, View, DataModel, Process, Report
102102
| Documentation Pages | 134 | .mdx/.md files across 8 categories |
103103
| Test Files | 200+ | 3,235+ tests, 80% coverage |
104104
| Examples | 4 | todo, crm, kitchen-sink, msw-todo |
105-
| CLI Commands | 11 | init, build, dev, serve, doctor, etc. |
105+
| CLI Commands | 15 | init, build, dev, serve, doctor, etc. (oclif plugin) |
106106
| I18n Locales | 11 | ar, de, en, es, fr, ja, ko, pt, ru, zh + RTL |
107107
| CI Workflows | 13 | CI, CodeQL, Storybook, perf budget, etc. |
108108

@@ -112,7 +112,7 @@ All 4 phases complete across 5 designers (Page, View, DataModel, Process, Report
112112
- Solid architecture with clear layer separation (spec → types → core → react → components)
113113
- Excellent quick-start guide (`content/docs/guide/quick-start.md`, 197 lines)
114114
- Clean app bootstrapping (`apps/console/src/main.tsx`, 44 lines, well-commented)
115-
- 11 CLI commands with `doctor` for environment diagnosis
115+
- 15 CLI commands with `doctor` for environment diagnosis (oclif plugin architecture)
116116
- Per-component error boundaries with retry (SchemaErrorBoundary)
117117
- 13 CI/CD workflows including performance budgets and visual regression
118118

@@ -252,7 +252,15 @@ All 4 phases complete across 5 designers (Page, View, DataModel, Process, Report
252252
- [x] Add `objectui validate <schema.json>` command
253253
- [x] Resolve TODO/FIXME items in CLI code
254254

255-
#### P3.5 Package READMEs ✅
255+
#### P3.5 CLI oclif Migration ✅
256+
- [x] Refactor `@object-ui/cli` to oclif plugin `@objectstack/plugin-ui`
257+
- [x] Migrate all 15 commands to oclif Command classes under `src/commands/ui/`
258+
- [x] Add `@oclif/core` dependency and oclif plugin configuration
259+
- [x] Preserve backward-compatible `objectui` bin entry
260+
- [x] Add 55 tests for oclif command classes
261+
- [x] Create migration documentation (`packages/cli/MIGRATION.md`)
262+
263+
#### P3.6 Package READMEs ✅
256264
- [x] All 37 packages now have READMEs
257265

258266
### P4. User Experience 🎨 (Completed Foundation)
@@ -525,7 +533,7 @@ Each plugin view must work seamlessly from 320px (small phone) to 2560px (ultraw
525533
526534
### Ecosystem & Marketplace
527535
- Plugin marketplace website with search, ratings, and install count
528-
- Plugin publishing CLI (`objectui publish`) with automated validation
536+
- Plugin publishing CLI (`os ui publish`) with automated validation
529537
- 25+ official plugins
530538
- Plugin contract enforcement via contracts module
531539

@@ -571,7 +579,7 @@ Each plugin view must work seamlessly from 320px (small phone) to 2560px (ultraw
571579
| **Hooks with JSDoc** | 20+/20+ (100%) | 20+/20+ (100%) | Grep `/** */` in hooks |
572580
| **Console i18n Coverage** | 100% | 100% | No hardcoded strings |
573581
| **WCAG AA Compliance** | Full Console pages | Full Console pages | axe-core audit |
574-
| **CLI Commands Working** | 11 | 11 (all verified) | `objectui doctor` |
582+
| **CLI Commands Working** | 15 | 15 (all verified, oclif plugin) | `os ui --help` |
575583
| **TODO/FIXME Count** | 0 files | 0 | Grep `TODO\|FIXME\|HACK` |
576584

577585
### DX Success Criteria ✅

packages/cli/MIGRATION.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Migration Guide: `@object-ui/cli``@objectstack/plugin-ui`
2+
3+
> **Date:** February 2026
4+
> **Affects:** All users of the `objectui` CLI command
5+
6+
## Overview
7+
8+
The ObjectUI CLI has been refactored from a standalone Commander.js-based CLI (`@object-ui/cli`) to an **oclif plugin** (`@objectstack/plugin-ui`). This enables integration with the unified ObjectStack CLI (`os`) ecosystem while maintaining full backward compatibility.
9+
10+
## What Changed
11+
12+
| Before | After |
13+
|--------|-------|
14+
| Package: `@object-ui/cli` | Package: `@objectstack/plugin-ui` |
15+
| Standalone bin: `objectui` | oclif plugin: auto-registered under `os ui` |
16+
| Commander.js-based | oclif Command classes |
17+
| `objectui dev` | `os ui dev` (preferred) or `objectui dev` (still works) |
18+
19+
## Command Mapping
20+
21+
All 15 commands are available under the `os ui` namespace:
22+
23+
| Legacy Command | New Command | Status |
24+
|---------------|-------------|--------|
25+
| `objectui init` | `os ui init` ||
26+
| `objectui dev` | `os ui dev` ||
27+
| `objectui build` | `os ui build` ||
28+
| `objectui start` | `os ui start` ||
29+
| `objectui serve` | `os ui serve` ||
30+
| `objectui lint` | `os ui lint` ||
31+
| `objectui test` | `os ui test` ||
32+
| `objectui generate <type> <name>` | `os ui generate <type> <name>` ||
33+
| `objectui doctor` | `os ui doctor` ||
34+
| `objectui add <component>` | `os ui add <component>` ||
35+
| `objectui studio` | `os ui studio` ||
36+
| `objectui check` | `os ui check` ||
37+
| `objectui validate [schema]` | `os ui validate [schema]` ||
38+
| `objectui create plugin <name>` | `os ui create-plugin <name>` ||
39+
| `objectui analyze` | `os ui analyze` ||
40+
41+
## Installation
42+
43+
### With the unified ObjectStack CLI (recommended)
44+
45+
```bash
46+
# Install the main CLI + UI plugin
47+
npm install -g @objectstack/cli @objectstack/plugin-ui
48+
49+
# All UI commands are now available under `os ui`
50+
os ui dev
51+
os ui build
52+
os ui --help
53+
```
54+
55+
### Standalone (backward compatible)
56+
57+
```bash
58+
# The objectui bin entry is preserved for backward compatibility
59+
npm install -g @objectstack/plugin-ui
60+
61+
# Legacy commands still work
62+
objectui dev
63+
objectui build
64+
```
65+
66+
## Flag Changes
67+
68+
Most flags are identical. The only notable differences:
69+
70+
| Command | Old Flag | New Flag | Notes |
71+
|---------|----------|----------|-------|
72+
| `dev` | `-h, --host` | `-H, --host` | Short flag changed to avoid conflict with oclif's built-in `-h` (help) |
73+
| `serve` | `-h, --host` | `-H, --host` | Same as above |
74+
| `start` | `-h, --host` | `-H, --host` | Same as above |
75+
76+
## Programmatic API
77+
78+
The programmatic exports remain unchanged:
79+
80+
```typescript
81+
import { serve, init } from '@objectstack/plugin-ui';
82+
83+
// These functions work exactly as before
84+
await serve('app.json', { port: '3000', host: 'localhost' });
85+
await init('my-app', { template: 'dashboard' });
86+
```
87+
88+
## Plugin Architecture
89+
90+
The package now follows oclif plugin conventions:
91+
92+
```
93+
packages/cli/
94+
├── src/
95+
│ ├── cli.ts # Legacy Commander.js entry (backward compat)
96+
│ ├── index.ts # Programmatic exports
97+
│ ├── commands/
98+
│ │ ├── serve.ts # Original command logic (unchanged)
99+
│ │ ├── dev.ts # Original command logic (unchanged)
100+
│ │ ├── ... # All 15 original command implementations
101+
│ │ └── ui/ # oclif Command classes
102+
│ │ ├── init.ts # → wraps commands/init.ts
103+
│ │ ├── dev.ts # → wraps commands/dev.ts
104+
│ │ ├── build.ts # → wraps commands/build.ts
105+
│ │ └── ... # All 15 oclif wrappers
106+
│ └── utils/
107+
│ └── app-generator.ts # Shared utility (unchanged)
108+
└── package.json # oclif plugin config
109+
```
110+
111+
The `package.json` includes the oclif plugin declaration:
112+
113+
```json
114+
{
115+
"oclif": {
116+
"commands": "./dist/commands",
117+
"hooks": {}
118+
}
119+
}
120+
```
121+
122+
## Deprecation Timeline
123+
124+
| Phase | Timeline | Details |
125+
|-------|----------|---------|
126+
| **Current** | Now | Both `objectui` and `os ui` work |
127+
| **Phase 1** | v4.0 | `objectui` shows deprecation warning |
128+
| **Phase 2** | v5.0 | `objectui` bin removed; `os ui` is the only entry |

packages/cli/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
# Object UI CLI
1+
# @objectstack/plugin-ui
22

3-
CLI tool for Object UI - Build applications from JSON schemas.
3+
> **oclif plugin** for Object UI — Build applications from JSON schemas.
4+
>
5+
> Previously published as `@object-ui/cli`. See [MIGRATION.md](./MIGRATION.md) for upgrade details.
46
57
## Installation
68

9+
### With ObjectStack CLI (recommended)
10+
711
```bash
8-
npm install -g @object-ui/cli
12+
npm install -g @objectstack/cli @objectstack/plugin-ui
13+
14+
# Commands are auto-discovered under `os ui`
15+
os ui dev
16+
os ui build --help
917
```
1018

11-
Or use with npx:
19+
### Standalone (backward compatible)
1220

1321
```bash
14-
npx @object-ui/cli serve app.json
22+
npm install -g @objectstack/plugin-ui
23+
24+
# Legacy bin still works
25+
objectui dev app.json
1526
```
1627

1728
## Commands

packages/cli/package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@object-ui/cli",
2+
"name": "@objectstack/plugin-ui",
33
"version": "3.0.3",
4-
"description": "CLI tool for Object UI - Build applications from JSON schemas",
4+
"description": "ObjectStack CLI plugin for Object UI — oclif-based UI toolchain commands (os ui dev, os ui build, etc.)",
55
"type": "module",
66
"homepage": "https://www.objectui.org",
77
"repository": {
@@ -28,21 +28,29 @@
2828
"scripts": {
2929
"build": "tsup",
3030
"dev": "tsup --watch",
31-
"lint": "eslint src"
31+
"lint": "eslint src",
32+
"test": "vitest run"
3233
},
3334
"keywords": [
35+
"objectstack",
3436
"object-ui",
37+
"oclif-plugin",
3538
"cli",
3639
"schema-driven",
3740
"ui-builder",
3841
"json"
3942
],
40-
"author": "ObjectQL Team",
43+
"author": "ObjectStack Team",
4144
"license": "MIT",
45+
"oclif": {
46+
"commands": "./dist/commands",
47+
"hooks": {}
48+
},
4249
"dependencies": {
4350
"@object-ui/components": "workspace:*",
4451
"@object-ui/react": "workspace:*",
4552
"@object-ui/types": "workspace:*",
53+
"@oclif/core": "^4.8.0",
4654
"@types/glob": "^9.0.0",
4755
"@vitejs/plugin-react": "^5.1.4",
4856
"chalk": "^5.6.2",
@@ -58,6 +66,7 @@
5866
"@types/js-yaml": "^4.0.9",
5967
"@types/node": "^25.2.3",
6068
"tsup": "^8.5.1",
61-
"typescript": "^5.9.3"
69+
"typescript": "^5.9.3",
70+
"vitest": "^4.0.18"
6271
}
6372
}

0 commit comments

Comments
 (0)