sed-cli
v1.0.7
Published
SED (Semantic Entity Design) - Connect AI to Your Database with Easy Integration
Maintainers
Readme
SED (Semantic Entities Designs)
SED automatically converts your raw database into an AI-ready semantic layer with intelligent business rules.
SED creates a semantic layer that makes AI understand your business data instantly, with automatic business rule generation for security and compliance.
Overview
SED is a local-first database intelligence layer that bridges the gap between technical database schemas and business understanding. It automatically discovers your database structure, generates semantic mappings, and enforces business rules for AI applications.
What SED Does
1. Semantic Layer Generation
SED analyzes your database schema and creates business-friendly semantic mappings:
{
"entities": [
{
"name": "Customer",
"description": "A person who can place orders and has an account",
"databaseTable": "users",
"attributes": [
{
"name": "email",
"description": "Email address",
"databaseColumn": "email"
}
]
}
]
}2. Business Rules Engine
SED automatically generates and enforces business rules:
- PII Protection: Blocks access to sensitive data
- Data Validation: Ensures data quality standards
- Access Control: Role-based permissions
- Metric Definitions: Standardized calculations
- Custom Rules: Add your own business logic
3. Local-First Architecture
- 100% Local Processing: No data leaves your machine
- No API Keys Required: Works offline with pattern matching
- Privacy-First: Your database schema stays private
Quick Start
1. Install SED
npm install -g sed-cli2. Initialize Everything
npx sedql initThis interactive command will:
- Set up your database connection
- Build your semantic layer
- Generate business rules automatically
- Enable rules by default
Supported Databases:
- PostgreSQL
- MySQL
- SQLite
3. Query Your Data
npx sedql query "show me customer orders from last month"Use natural language to query your database. SED automatically:
- Translates your request to SQL
- Applies business rules for safety
- Returns results with compliance
4. Manage Business Rules
# List all rules
npx sedql rules --list
# Disable a rule temporarily
npx sedql rules --disable pii-protection
# Add custom rules
npx sedql rules --add custom-rules.jsonCLI Commands
Core Commands
sedql init- Initialize SED with database connection and setup everythingsedql build- Rebuild semantic layer and business rulessedql query <query>- Query database using natural languagesedql validate- Validate semantic layer and business rulessedql status- Show current SED status and configuration
Business Rules Management
sedql rules --list- List all business rulessedql rules --add <file>- Add custom rules from JSON filesedql rules --disable <rule-id>- Disable a specific rulesedql rules --enable <rule-id>- Enable a specific rule
Export & Import
sedql export- Export semantic layer and configurationsedql import <file>- Import configuration from file
Architecture
Database Support
- PostgreSQL: Full support with schema discovery
- MySQL: Comprehensive table and relationship analysis
- SQLite: Lightweight file-based database support
Core Components
- Connectors: Database-specific connection management
- Semantic Layer: Business entity mapping and discovery
- Business Logic Engine: Automatic rule generation and enforcement
- Security Module: PII detection and access control
- Cache Management: Performance optimization and connection pooling
Security & Privacy
- Local Processing: All analysis happens on your machine
- External Calls Off by Default: Anonymous usage analytics are opt-in via
SED_ANALYTICS=true - Business Rules: Automatic PII protection and data validation
- Environment Variables: Secure credential management
- Input Validation: SQL injection protection
Business Rules Engine
Auto-Generated Rules
SED automatically creates business rules based on your database:
{
"id": "pii-protection",
"name": "PII Protection",
"type": "access_policy",
"severity": "block",
"condition": {
"type": "pattern",
"pattern": ".*(ssn|password|email).*"
},
"action": {
"type": "deny",
"message": "Access to PII columns is not allowed"
}
}Rule Types
- Access Policy: Control who can access what data
- Data Validation: Enforce data quality standards
- Metric Definitions: Standardize business calculations
- Join Rules: Ensure proper table relationships
- Custom Rules: Your own business logic
Rule Management
# See what rules exist
sedql rules --list
# Filter rules by type
sedql rules --list --type access_policy
# Add custom business hours rule
sedql rules --add business-hours.json
# Disable PII protection temporarily
sedql rules --disable pii-protectionUse Cases
AI Integration
- Provide semantic context to LLMs
- Enable natural language database queries
- Bridge the gap between technical and business terminology
Data Governance
- Automatic PII protection
- Data quality enforcement
- Compliance rule management
Development
- Understand complex database schemas
- Discover business entities and relationships
- Generate semantic layer for applications
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
git clone https://github.com/holy182/sed-cli.git
cd sed-cli
npm install
npm run build
npm testRunning Tests
npm test
npm run test:securityLicense
GNU Affero General Public License v3.0 (AGPL-3.0) - see LICENSE file for details.
Important: This software is licensed under the AGPL-3.0 license. If you modify and distribute this software, you must make your source code available under the same license. This ensures that improvements to SED's security and governance capabilities are shared back with the community.
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
