Skip to main content

/component-export

Export CODITECT component data from the database in various formats for backup, migration, analysis, or integration.

Syntax

/component-export [options]

Options

OptionDescriptionExample
--format <fmt>Export format--format json
--type <type>Export only specific type--type agent
--output <path>Output file/directory--output export.json
--include-statsInclude usage statistics--include-stats
--include-relationshipsInclude component relationships--include-relationships
--fullExport all data (stats, relations, etc.)--full
--compressCompress 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

FieldDescription
idUnique identifier
typeComponent type
nameDisplay name
versionVersion string
statusOperational status
pathSource file path
descriptionDescription text
categoryPrimary category
subcategorySub-category
content_hashMD5 hash of content
indexed_atLast index timestamp

A2A Protocol Fields

FieldDescription
llm_providerLLM provider
llm_modelModel identifier
llm_temperatureTemperature setting
llm_max_tokensMax token limit
tools_listAvailable tools
invocation_methodHow to invoke
parallel_safeCan run in parallel

Extended Fields (--full)

FieldDescription
capabilitiesCapability list
triggersWhen-to-use triggers
relationshipsRelated components
usage_statsInvocation 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
)
CommandPurpose
/component-indexRebuild index
/component-searchSearch components
/component-statsView statistics
/backupFull system backup

Script: scripts/component-db-cli.py Database: ~/PROJECTS/.coditect-data/context-storage/platform.db