hosby-cli
v0.3.6
Published
A powerful CLI tool for generating and managing database schemas and services for front-end, mobile, and desktop projects
Downloads
13
Maintainers
Readme
Hosby CLI
Overview
Hosby CLI is a sophisticated command-line interface tool designed to streamline the development workflow for modern web, mobile, and desktop applications. It analyzes your project's codebase to automatically generate optimized JSON schemas data models, create type-safe API clients, and manage your data models efficiently. With powerful AI integration, Hosby CLI intelligently interprets your code structure to create schemas that perfectly match your application's needs.
Installation
# Install globally
npm install -g hosby-cli
# Or use with npx
npx hosby-cli
# Check installation
hosby --versionFeatures
Core Capabilities
- Intelligent Schema Generation: Automatically analyze TypeScript/JavaScript projects to create optimized JSON schemas data models
- AI-Powered Analysis: Leverage advanced AI models (OpenAI or Claude) to interpret complex codebases
- Cloud Synchronization: Seamlessly push and pull schemas between local development and Hosby cloud
- TypeScript Client Generation: Auto-generate type-safe API clients for your schemas
- CRUD Service Generation: Create ready-to-use service modules for your data models
Technical Excellence
- Robust Error Handling: Comprehensive error management with detailed diagnostics
- Configurable Timeouts: Prevent hanging operations with customizable network timeouts
- Automatic Updates: Version checking system to keep your CLI up-to-date
- Advanced Logging: Multi-level logging system with configurable verbosity
- Schema Validation: Thorough validation to ensure data integrity
Getting Started
Prerequisites
- Node.js 14.x or higher
- TypeScript project (for optimal results)
- Hosby account (for cloud features)(optional)
Quick Start
Install the CLI
npm install -g hosby-cliLog in to your Hosby account
hosby loginConfigure your project
hosby config projectScan your project to generate a schema
hosby scan --aiPush your schema to the Hosby cloud
hosby push
Commands
Authentication
hosby loginAuthenticate with the Hosby platform to access cloud features and synchronization.
Project Management
# Scan project and generate schema
hosby scan [path] [--ai] [--timeout <ms>]
# Push local schema to Hosby server
hosby push [--force]
# Pull latest schema from Hosby server
hosby pullConfiguration
# Configure project settings
hosby config project
# Configure AI provider settings
hosby config aiDevelopment Tools
# Generate a CRUD service for a specific table
hosby create-service [tableName]
# AI-specific operations
hosby aiGlobal Options
# Enable debug logging
hosby [command] --debug
# Minimize output (error logs only)
hosby [command] --quietAI Integration
Hosby CLI integrates with leading AI providers to deliver intelligent code analysis and schema generation:
Supported AI Providers
- OpenAI: Utilizes GPT models for advanced code understanding
- Claude AI: Leverages Anthropic's Claude models for nuanced code analysis
Configuring AI
hosby config aiThis interactive command allows you to:
- Select your preferred AI provider
- Configure your API key
- Save your preferences for future use
AI-Powered Schema Generation
When using the --ai flag with the scan command, Hosby CLI:
- Analyzes your project's code structure
- Identifies data models and business entities
- Intelligently generates an optimized schema
- Filters out irrelevant UI components and presentation logic
Configuration
Project Configuration
Configure your project settings with:
hosby config projectThis will prompt you for:
- Project ID
- Project Name
Environment Variables
Hosby CLI supports the following environment variables:
HOSBY_API_URL: Custom API endpointHOSBY_LOG_LEVEL: Logging verbosity (debug, info, warn, error)OPENAI_API_KEY: OpenAI API keyANTHROPIC_API_KEY: Claude AI API keyOPENAI_MODEL: Custom OpenAI model nameANTHROPIC_MODEL: Custom Claude model name
Logging Levels
Control output verbosity with:
# For detailed debugging information
export HOSBY_LOG_LEVEL=debug
# For minimal output
export HOSBY_LOG_LEVEL=errorOr use command flags:
hosby [command] --debug
hosby [command] --quietDevelopment
Building from Source
# Clone the repository
git clone https://github.com/hosby/hosby-cli.git
cd hosby-cli
# Install dependencies
npm install
# Build the project
npm run buildDevelopment Guidelines
- Language: All user-facing messages must be in English
- Documentation: Add proper JSDoc documentation for all functions
- Error Handling: Implement comprehensive error handling
- Timeouts: Include timeouts for all network operations
- Logging: Use the built-in logging system for all messages
Architecture
Hosby CLI follows a modular architecture with clear separation of concerns:
- Commands: Interface with the user and orchestrate operations
- Services: Implement business logic and core functionality
- Core: Provide fundamental utilities and shared functionality
- Helpers: Offer supporting utilities and helper functions
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions:
- Open an issue on GitHub
- Contact support at [email protected]
- Visit our documentation
