Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Enhance CLI with Complete Development Workflow Commands

Based on the requirement to support mainstream development framework patterns, add the following commands to the Object UI CLI:

Plan

  • Understand current CLI implementation
  • Add dev command - Start development server with hot reload
  • Add build command - Build application for production
  • Add start command - Serve production build
  • Add lint command - Lint the generated application code
  • Add test command - Run tests for the application
  • Extract shared utilities to app-generator module
  • Update CLI README documentation
  • Fix TypeScript and ESLint warnings
  • Address code review feedback
  • Fix CodeQL security issue - Add rate limiting
  • Test all commands work correctly
  • Ensure commands follow mainstream framework patterns (Next.js, Vite, etc.)

Changes Made

  • Created /packages/cli/src/commands/dev.ts - Development server command
  • Created /packages/cli/src/commands/build.ts - Production build command
  • Created /packages/cli/src/commands/start.ts - Production server command with rate limiting
  • Created /packages/cli/src/commands/lint.ts - Linting command with ESLint
  • Created /packages/cli/src/commands/test.ts - Testing command with Vitest
  • Created /packages/cli/src/utils/app-generator.ts - Shared utilities for app generation
  • Updated /packages/cli/src/commands/serve.ts - Refactored to use shared utilities
  • Updated /packages/cli/src/cli.ts - Added new command definitions
  • Updated /packages/cli/README.md - Documented all commands
  • Updated /packages/cli/package.json - Added express-rate-limit dependency
  • Fixed all TypeScript and ESLint warnings
  • Moved all imports to top level for consistency

All Available Commands

  1. objectui init - Initialize a new project
  2. objectui dev - Development server with HMR
  3. objectui build - Production build
  4. objectui start - Serve production build (with rate limiting for security)
  5. objectui lint - Lint code with ESLint
  6. objectui test - Run tests with Vitest
  7. objectui serve - Legacy development server (backward compatible)

Security

  • ✅ Added rate limiting to start command to prevent DoS attacks (1000 requests per IP per 15 minutes)
  • ✅ Fixed CodeQL security alert: "Missing rate limiting" (js/missing-rate-limiting)
  • ✅ Uses express-rate-limit middleware with standard headers

Testing

All commands have been tested and verified to work correctly:

  • objectui init - Creates new projects successfully
  • objectui dev - Starts development server with hot reload
  • objectui build - Builds for production
  • objectui start - Serves production build with rate limiting protection
  • objectui lint - Lints generated application code
  • objectui test - Runs tests with multiple options (watch, coverage, UI)
  • objectui serve - Legacy command still works

The CLI now follows mainstream framework patterns similar to Next.js, Vite, and other modern development tools, with enterprise-grade security features.

Original prompt

参考主流开发框架,Cli应该支持完整的开发流程和命令,包括并不限于dev build start


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
objectui-playground Ready Ready Preview, Comment Jan 15, 2026 3:08am

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@huangyiirene
Copy link
Contributor

看看还需要其他哪些命令,比如说test lint @copilot

Copilot AI changed the title [WIP] Add complete CLI support for dev build start commands Add dev, build, and start commands to CLI Jan 15, 2026
Copilot AI requested a review from huangyiirene January 15, 2026 01:37
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

看看还需要其他哪些命令,比如说test lint @copilot

已添加 linttest 命令! (Added lint and test commands!)

新增命令 / New Commands:

  1. objectui lint - 使用 ESLint 检查代码

    • objectui lint --fix - 自动修复问题
  2. objectui test - 使用 Vitest 运行测试

    • objectui test --watch - 监视模式
    • objectui test --coverage - 生成覆盖率报告
    • objectui test --ui - 使用 Vitest UI

完整的开发工作流程 / Complete Development Workflow:

objectui init my-app      # 初始化项目
cd my-app
objectui dev              # 开发服务器
objectui lint             # 代码检查
objectui test             # 运行测试
objectui build --clean    # 生产构建
objectui start            # 预览生产版本

现在 CLI 支持 7 个命令,与 Next.js/Vite 等主流框架保持一致。

Commit: 5f82b1c

@hotlong
Copy link
Contributor

hotlong commented Jan 15, 2026

@copilot 继续fix and test

@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1719.04KB 345.21KB
core (index.js) 0.18KB 0.11KB
core (index.test.js) 0.14KB 0.14KB
designer (index.js) 0.83KB 0.32KB
plugin-charts (AdvancedChartImpl-CGlEUqvZ.js) 47.44KB 11.16KB
plugin-charts (BarChart-C9og8_1e.js) 525.61KB 132.50KB
plugin-charts (ChartImpl-BO5n60y7.js) 4.87KB 1.95KB
plugin-charts (index-DR7MvR2L.js) 23.55KB 6.93KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-DCiwKyYW.js) 18.97KB 5.77KB
plugin-editor (index-CpP31686.js) 21.90KB 6.66KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-CI3LQYrL.js) 76.88KB 20.43KB
plugin-kanban (index-DNMbL6y1.js) 23.20KB 6.83KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-DcFjhoD-.js) 256.34KB 64.33KB
plugin-markdown (index-D4WUb7Qy.js) 21.42KB 6.50KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.00KB 0.51KB
react (index.js) 0.13KB 0.11KB
react (index.test.js) 0.14KB 0.14KB
types (base.js) 0.24KB 0.19KB
types (complex.js) 0.17KB 0.16KB
types (data-display.js) 0.19KB 0.17KB
types (data.js) 0.23KB 0.18KB
types (disclosure.js) 0.18KB 0.17KB
types (feedback.js) 0.18KB 0.16KB
types (form.js) 0.17KB 0.16KB
types (index.js) 1.46KB 0.74KB
types (layout.js) 0.23KB 0.18KB
types (navigation.js) 0.17KB 0.16KB
types (overlay.js) 0.18KB 0.16KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@github-actions
Copy link

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@huangyiirene
Copy link
Contributor

@copilot fix codeql Missing rate limiting
In pull request in refs/pull/53/merge 17 minutes ago
Code snippet
packages/cli/src/commands/start.ts:44
app.use(express.static(distPath));

// SPA fallback - serve index.html for all routes
app.get('*', (req, res) => {
res.sendFile(indexPath);
});
This route handler performs a file system access, but is not rate-limited.
CodeQL

// Start server
app.listen(port, host, () => {
Rule
Tool
CodeQL
Rule ID
js/missing-rate-limiting
Query

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@hotlong
Copy link
Contributor

hotlong commented Jan 15, 2026

@copilot 继续

@hotlong hotlong marked this pull request as ready for review January 15, 2026 03:05
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot 继续

已完成 CodeQL 安全问题修复! (CodeQL security issue fixed!)

修复内容 / Fixed:

  • start 命令添加了速率限制 (Added rate limiting to start command)
  • 使用 express-rate-limit 防止 DoS 攻击
  • 限制: 每个 IP 每 15 分钟 1000 次请求

代码更改 / Changes:

// Configure rate limiting to prevent abuse
const limiter = rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 1000, // Limit each IP to 1000 requests per windowMs
  message: 'Too many requests from this IP, please try again later.',
  standardHeaders: true,
  legacyHeaders: false,
});

// Apply rate limiting to all routes
app.use(limiter);

✅ Build passing
✅ Lint passing
✅ CodeQL issue resolved

Commits: 2ab0d49, 1d07c74

Copilot AI changed the title Add dev, build, and start commands to CLI Add dev, build, start, lint, and test commands to CLI Jan 15, 2026
Copilot AI requested a review from hotlong January 15, 2026 03:09
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1719.04KB 345.21KB
core (index.js) 0.18KB 0.11KB
core (index.test.js) 0.14KB 0.14KB
designer (index.js) 0.83KB 0.32KB
plugin-charts (AdvancedChartImpl-CGlEUqvZ.js) 47.44KB 11.16KB
plugin-charts (BarChart-C9og8_1e.js) 525.61KB 132.50KB
plugin-charts (ChartImpl-BO5n60y7.js) 4.87KB 1.95KB
plugin-charts (index-DR7MvR2L.js) 23.55KB 6.93KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-DCiwKyYW.js) 18.97KB 5.77KB
plugin-editor (index-CpP31686.js) 21.90KB 6.66KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-CI3LQYrL.js) 76.88KB 20.43KB
plugin-kanban (index-DNMbL6y1.js) 23.20KB 6.83KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-DcFjhoD-.js) 256.34KB 64.33KB
plugin-markdown (index-D4WUb7Qy.js) 21.42KB 6.50KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.00KB 0.51KB
react (index.js) 0.13KB 0.11KB
react (index.test.js) 0.14KB 0.14KB
types (base.js) 0.24KB 0.19KB
types (complex.js) 0.17KB 0.16KB
types (data-display.js) 0.19KB 0.17KB
types (data.js) 0.23KB 0.18KB
types (disclosure.js) 0.18KB 0.17KB
types (feedback.js) 0.18KB 0.16KB
types (form.js) 0.17KB 0.16KB
types (index.js) 1.46KB 0.74KB
types (layout.js) 0.23KB 0.18KB
types (navigation.js) 0.17KB 0.16KB
types (overlay.js) 0.18KB 0.16KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@github-actions
Copy link

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@huangyiirene huangyiirene merged commit caa94aa into main Jan 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants