/component-export
Export CODITECT component data from the database in various formats for backup, migration, analysis, or integration.
Syntax
/component-export [options]
Options
| Option | Description | Example |
|---|---|---|
--format <fmt> | Export format | --format json |
--type <type> | Export only specific type | --type agent |
--output <path> | Output file/directory | --output export.json |
--include-stats | Include usage statistics | --include-stats |
--include-relationships | Include component relationships | --include-relationships |
--full | Export all data (stats, relations, etc.) | --full |
--compress | Compress output (gzip) | --compress |
--since <date> | Export changes since date | --since 2026-01-01 |
--query <sql> | Custom SQL query export | --query "SELECT..." |
Export Formats
JSON (Default)
/component-export --format json --output components.json
Output structure:
{
"version": "1.0.0",
"exported_at": "2026-01-22T14:30:00Z",
"total_count": 3027,
"components": [
{
"id": "agent/senior-architect",
"type": "agent",
"name": "Senior Architect",
"version": "1.0.0",
"description": "...",
"capabilities": ["review", "design"],
"llm_model": "sonnet",
"path": "agents/senior-architect.md"
}
]
}
CSV
/component-export --format csv --output components.csv
Flat table format for spreadsheet analysis.
JSONL (JSON Lines)
/component-export --format jsonl --output components.jsonl
One JSON object per line, ideal for streaming/processing.
SQL
/component-export --format sql --output backup.sql
SQL INSERT statements for database restoration.
YAML
/component-export --format yaml --output components.yaml
Human-readable YAML format.
Markdown
/component-export --format markdown --output COMPONENT-REFERENCE.md
Formatted markdown documentation.
Examples
Backup Operations
# Full backup with compression
/component-export --full --compress --output backup-$(date +%Y%m%d).json.gz
# SQL dump for database restoration
/component-export --format sql --output backup.sql
Filtered Exports
# Export only agents
/component-export --type agent --output agents.json
# Export agents with Sonnet model
/component-export --query "SELECT * FROM components WHERE llm_model='sonnet'" \
--output sonnet-agents.json
# Export components modified this week
/component-export --since "$(date -v-7d +%Y-%m-%d)" --output recent.json
Analysis Exports
# Export with usage statistics for analysis
/component-export --include-stats --format csv --output component-usage.csv
# Export relationship graph for visualization
/component-export --include-relationships --format json --output graph.json
Integration Exports
# Export for A2A Protocol registry
/component-export --type agent --format json \
--output a2a-registry.json
# Export for documentation site
/component-export --format markdown \
--output docs/reference/COMPONENT-CATALOG.md
Output Fields
Core Fields
| Field | Description |
|---|---|
id | Unique identifier |
type | Component type |
name | Display name |
version | Version string |
status | Operational status |
path | Source file path |
description | Description text |
category | Primary category |
subcategory | Sub-category |
content_hash | MD5 hash of content |
indexed_at | Last index timestamp |
A2A Protocol Fields
| Field | Description |
|---|---|
llm_provider | LLM provider |
llm_model | Model identifier |
llm_temperature | Temperature setting |
llm_max_tokens | Max token limit |
tools_list | Available tools |
invocation_method | How to invoke |
parallel_safe | Can run in parallel |
Extended Fields (--full)
| Field | Description |
|---|---|
capabilities | Capability list |
triggers | When-to-use triggers |
relationships | Related components |
usage_stats | Invocation statistics |
Import (Reverse Operation)
To import exported data:
# Import JSON export
python3 scripts/component-db-cli.py import components.json
# Import SQL dump
sqlite3 ~/PROJECTS/.coditect-data/context-storage/platform.db < backup.sql
Automation
Scheduled Backup
Add to crontab:
# Daily backup at 2 AM
0 2 * * * /component-export --full --compress \
--output ~/.coditect/backups/components-$(date +\%Y\%m\%d).json.gz
GCS Backup
# Export and upload to GCS
/component-export --full --compress --output /tmp/components.json.gz
gsutil cp /tmp/components.json.gz gs://coditect-backups/components/
Implementation
# Underlying script
python3 scripts/component-db-cli.py export [options]
# Python API
from scripts.component_db_cli import export_components
export_components(
format="json",
output="components.json",
include_stats=True
)
Related Commands
| Command | Purpose |
|---|---|
/component-index | Rebuild index |
/component-search | Search components |
/component-stats | View statistics |
/backup | Full system backup |
Script: scripts/component-db-cli.py
Database: ~/PROJECTS/.coditect-data/context-storage/platform.db