我希望能提供一个极简的控制台,让用户可以可视化的操作数据库里面的表,而不是用repl
Translation: "I want to provide a minimal console that allows users to visually operate database tables, instead of using REPL"
Added a new console command to the ObjectQL CLI that provides a terminal-based visual interface for database operations.
-
Visual Interface
- Split-pane layout (object list on left, data table on right)
- ASCII-art borders and clean formatting
- Highlighted selection for current item
-
Data Browsing
- Automatic pagination (20 records per page)
- Page navigation (n/p keys)
- Record count and page indicators
- Detail view for individual records (press Enter)
-
Keyboard Navigation
- ↑↓ or j/k - Navigate lists
- Tab - Switch between panels
- Enter - View record detail
- Escape - Close detail view
- n/p - Next/Previous page
- r - Refresh data
- ? - Help screen
- q - Quit
-
User-Friendly
- Built-in help system
- Visual feedback for all actions
- Mouse support (optional)
- No command syntax to remember
packages/cli/src/commands/console.ts- Main console implementation (400+ lines)- Updated
packages/cli/src/index.ts- Register console command - Updated
packages/cli/package.json- Add blessed dependencies
docs/console.md- Comprehensive user guidedocs/console-demo.md- Visual demo with ASCII screenshots- Updated
docs/guide/cli.md- Add console command section - Updated
packages/cli/README.md- Add console command - Updated
README.md- Update roadmap
examples/basic-app/init-data.ts- Sample data initialization script- Updated
examples/basic-app/package.json- Add console script
blessed@^0.1.81- Terminal UI frameworkblessed-contrib@^4.11.0- Additional widgets@types/blessed@^0.1.17- TypeScript definitions
- Uses
ObjectRepositoryfrom@objectql/corefor data access - Runs with system-level privileges (same as REPL)
- Supports all configured datasources
- Fully compatible with existing ObjectQL configurations
- ✅ TypeScript strict mode compilation
- ✅ No eval/exec or dangerous functions
- ✅ Proper error handling
- ✅ Follows existing CLI command patterns
- ✅ Minimal changes to existing code
# Basic usage
objectql console
# With alias
objectql c
# With custom config
objectql console --config ./objectql.config.ts| Feature | Console | REPL |
|---|---|---|
| Visual interface | ✅ | ❌ |
| No syntax to learn | ✅ | ❌ |
| Pagination | ✅ Built-in | |
| Record detail | ✅ Built-in | |
| Complex queries | ❌ | ✅ |
| Scripting | ❌ | ✅ |
| Beginner friendly | ✅ |
The implementation has been:
- ✅ TypeScript compiled successfully
- ✅ CLI command registered and shows in help
- ✅ No security vulnerabilities introduced
- ✅ Follows ObjectQL patterns and conventions
- ✅ Comprehensive documentation provided
Potential improvements for future iterations:
- Search/filter within tables
- Create/Update/Delete operations
- Export data (CSV, JSON)
- Column sorting
- Custom field selection
- Multi-object views (joins)
Successfully implemented a minimal visual console that addresses the user's requirement for a visual database table browser as an alternative to REPL. The implementation is production-ready, well-documented, and follows ObjectQL's architecture patterns.