|
| 1 | +--- |
| 2 | +title: LLM Export Command |
| 3 | +permalink: /cli/commands/llm/export/ |
| 4 | +--- |
| 5 | + |
| 6 | +* TOC |
| 7 | +{:toc} |
| 8 | + |
| 9 | +<div class="alert alert-info" role="alert"> |
| 10 | +<strong>BETA:</strong> The LLM commands are currently in beta. Features and output format may change. |
| 11 | +</div> |
| 12 | + |
| 13 | +**Export project data to AI-optimized twin format directory structure.** |
| 14 | + |
| 15 | +``` |
| 16 | +kbc llm export [flags] |
| 17 | +``` |
| 18 | + |
| 19 | +The command must be run in a directory initialized with [kbc llm init](/cli/commands/llm/init/). |
| 20 | + |
| 21 | +## Description |
| 22 | + |
| 23 | +The twin format is designed for AI assistants to understand and work with Keboola projects directly from Git repositories. The export includes: |
| 24 | + |
| 25 | +- **Bucket and table metadata** with schema information |
| 26 | +- **Transformation configurations** with platform detection |
| 27 | +- **Component configurations** organized by type |
| 28 | +- **Job execution history** and statistics |
| 29 | +- **Lineage graph** showing data flow dependencies |
| 30 | +- **Optional data samples** (controlled by flags) |
| 31 | + |
| 32 | +The export creates output files containing JSON with inline documentation (`_comment`, `_purpose`, `_update_frequency` fields) to help AI assistants understand the data structure. |
| 33 | + |
| 34 | +### Security Features |
| 35 | + |
| 36 | +- **Public repository detection** - Automatically detects if the directory is a public Git repository |
| 37 | +- **Sample export disabled by default** - Data samples must be explicitly enabled with `--with-samples` |
| 38 | +- **Encrypted secrets** - Fields starting with `#` are encrypted in the output |
| 39 | + |
| 40 | +## Options |
| 41 | + |
| 42 | +`-H, --storage-api-host <string>` |
| 43 | +: Keboola instance URL, e.g., "connection.keboola.com" |
| 44 | + |
| 45 | +`-t, --storage-api-token <string>` |
| 46 | +: Storage API token from your project |
| 47 | + |
| 48 | +`-f, --force` |
| 49 | +: Skip confirmation when directory contains existing files |
| 50 | + |
| 51 | +`--with-samples` |
| 52 | +: Include table data samples in the export |
| 53 | + |
| 54 | +`--sample-limit <int>` |
| 55 | +: Maximum number of rows per table sample (default: 100, max: 1000) |
| 56 | + |
| 57 | +`--max-samples <int>` |
| 58 | +: Maximum number of tables to sample (default: 50, max: 100) |
| 59 | + |
| 60 | +[Global Options](/cli/commands/#global-options) |
| 61 | + |
| 62 | +## Output Structure |
| 63 | + |
| 64 | +The export creates the following directory structure: |
| 65 | + |
| 66 | +``` |
| 67 | +. |
| 68 | +├── buckets/ # Bucket and table metadata |
| 69 | +│ └── index.json |
| 70 | +├── transformations/ # Transformation configurations |
| 71 | +├── components/ # Component configurations by type |
| 72 | +├── jobs/ # Job execution history |
| 73 | +│ ├── recent/ |
| 74 | +│ └── by-component/ |
| 75 | +├── indices/ # Query indices and lookups |
| 76 | +│ └── queries/ |
| 77 | +├── ai/ # AI assistant guides |
| 78 | +├── samples/ # Table data samples (if --with-samples) |
| 79 | +├── lineage.json # Data flow dependencies |
| 80 | +└── metadata.json # Project metadata |
| 81 | +``` |
| 82 | + |
| 83 | +## Examples |
| 84 | + |
| 85 | +### Basic Export |
| 86 | + |
| 87 | +``` |
| 88 | +➜ kbc llm export |
| 89 | +
|
| 90 | +[1/5] Getting default branch... |
| 91 | +Using branch: Main (ID: 1234) |
| 92 | +[2/5] Fetching project data from APIs... |
| 93 | +Fetched: 5 buckets, 23 tables, 150 jobs |
| 94 | +[3/5] Processing data (lineage, platforms, sources)... |
| 95 | +Processed: 5 buckets, 23 tables, 8 transformations, 45 lineage edges |
| 96 | +[4/5] Generating twin format output... |
| 97 | +[5/5] Skipping samples (not requested) |
| 98 | +Twin format exported to: /path/to/project |
| 99 | +Export completed successfully. |
| 100 | +``` |
| 101 | + |
| 102 | +### Export with Data Samples |
| 103 | + |
| 104 | +``` |
| 105 | +➜ kbc llm export --with-samples --sample-limit 50 --max-samples 20 |
| 106 | +
|
| 107 | +[1/5] Getting default branch... |
| 108 | +Using branch: Main (ID: 1234) |
| 109 | +[2/5] Fetching project data from APIs... |
| 110 | +Fetched: 5 buckets, 23 tables, 150 jobs |
| 111 | +[3/5] Processing data (lineage, platforms, sources)... |
| 112 | +Processed: 5 buckets, 23 tables, 8 transformations, 45 lineage edges |
| 113 | +[4/5] Generating twin format output... |
| 114 | +[5/5] Fetching and generating table samples... |
| 115 | +Twin format exported to: /path/to/project |
| 116 | +Export completed successfully. |
| 117 | +``` |
| 118 | + |
| 119 | +## Next Steps |
| 120 | + |
| 121 | +- [LLM Init](/cli/commands/llm/init/) |
| 122 | +- [All Commands](/cli/commands/) |
0 commit comments