-
Notifications
You must be signed in to change notification settings - Fork 0
Add mainstream development commands to ObjectQL CLI #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: huangyiirene <[email protected]>
Co-authored-by: huangyiirene <[email protected]>
Co-authored-by: huangyiirene <[email protected]>
Co-authored-by: huangyiirene <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds mainstream framework-style development commands to the ObjectQL CLI, enhancing the developer experience with familiar command patterns inspired by Next.js and NestJS.
Changes:
- Added six new CLI commands:
dev,start,build,test,lint, andformat - Updated the
servecommand description to indicate it's an alias for backward compatibility - Added comprehensive test coverage for the new commands
- Updated CLI documentation with detailed usage instructions for all new commands
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tools/cli/src/index.ts | Registers all six new commands with their options and aliases |
| packages/tools/cli/src/commands/dev.ts | Implements development server command with hot reload support |
| packages/tools/cli/src/commands/start.ts | Implements production server with config loading and graceful shutdown |
| packages/tools/cli/src/commands/build.ts | Implements build command for validation, type generation, and metadata copying |
| packages/tools/cli/src/commands/test.ts | Implements test runner with Jest auto-detection |
| packages/tools/cli/src/commands/lint.ts | Implements metadata validation with naming convention checks |
| packages/tools/cli/src/commands/format.ts | Implements YAML formatting with Prettier integration |
| packages/tools/cli/tests/commands.test.ts | Adds test coverage for build, lint, and format commands |
| packages/tools/cli/README.md | Documents all new commands with usage examples and options |
| console.log(chalk.gray(`Loading schema from: ${rootDir}`)); | ||
|
|
||
| // Try to load configuration | ||
| let config: any = null; |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable config is typed as any, which bypasses TypeScript's type safety. Consider defining an interface in @objectql/types that represents the config structure, or use a more specific type based on the expected configuration schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in de4fca8. Created a LoadedConfig interface that provides type safety while supporting flexible config formats (both datasource and datasources properties).
|
|
||
| // Validate each object | ||
| for (const obj of objects) { | ||
| const objectConfig = obj as any; |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using as any bypasses TypeScript's type safety. Since this is checking object definitions from the metadata, consider importing and using the appropriate type from @objectql/types (such as ObjectDefinition) instead of casting to any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in de4fca8. Now using ObjectConfig type from @objectql/types instead of casting to any.
| hasErrors = true; | ||
| } | ||
|
|
||
| const fieldConfig = field as any; |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using as any bypasses TypeScript's type safety. Consider importing the appropriate field type from @objectql/types instead of casting to any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in de4fca8. Now using FieldConfig type from @objectql/types instead of casting to any.
|
|
||
| // Format with Prettier - use dynamic import for better compatibility | ||
| try { | ||
| const prettier = await import('prettier'); |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Prettier is not installed as a dependency, this dynamic import will fail with an unclear error. Consider adding error handling with a helpful message instructing users to install Prettier if it's missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already handled. The format command includes a try-catch block around the Prettier import that displays a clear error message: "❌ Prettier is not installed. Install it with: npm install --save-dev prettier" and exits gracefully when Prettier is missing.
…t operations, extract constants Co-authored-by: huangyiirene <[email protected]>
|
@copilot fix |
- Use ObjectConfig and FieldConfig types in lint command - Create LoadedConfig interface for start command to handle flexible config formats - Maintain type safety while supporting both datasource and datasources config formats Co-authored-by: huangyiirene <[email protected]>
|
@copilot fix |
Add Development Commands to ObjectQL CLI
This PR adds mainstream framework-style development commands to make ObjectQL more developer-friendly, following conventions from Next.js, NestJS, and other popular frameworks.
✅ Completed Implementation:
devcommand - development server with hot reload supportstartcommand - production server start with config loadingbuildcommand - validates, generates types, copies metadata to disttestcommand - run Jest tests for ObjectQL projectslintcommand - validate metadata files with detailed checksformatcommand - format metadata files with Prettier🆕 New Commands:
objectql dev- Development server (recommended)objectql start- Production serverobjectql build- Build for productionobjectql test- Run testsobjectql lint- Validate metadataobjectql format- Format YAML📝 Code Quality Improvements:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.