MCPcopy Create free account
hub / github.com/simstudioai/sim / main

Function main

apps/sim/scripts/process-docs.ts:185–252  ·  view source on GitHub ↗

* Main entry point with CLI argument parsing

()

Source from the content-addressed store, hash-verified

183 * Main entry point with CLI argument parsing
184 */
185async function main() {
186 const args = process.argv.slice(2)
187
188 const options: ProcessingOptions = {
189 clearExisting: args.includes('--clear'),
190 dryRun: args.includes('--dry-run'),
191 verbose: args.includes('--verbose'),
192 }
193
194 // Parse custom path if provided
195 const pathIndex = args.indexOf('--path')
196 if (pathIndex !== -1 && args[pathIndex + 1]) {
197 options.docsPath = args[pathIndex + 1]
198 }
199
200 // Parse custom base URL if provided
201 const urlIndex = args.indexOf('--url')
202 if (urlIndex !== -1 && args[urlIndex + 1]) {
203 options.baseUrl = args[urlIndex + 1]
204 }
205
206 // Parse chunk size if provided
207 const chunkSizeIndex = args.indexOf('--chunk-size')
208 if (chunkSizeIndex !== -1 && args[chunkSizeIndex + 1]) {
209 options.chunkSize = Number.parseInt(args[chunkSizeIndex + 1], 10)
210 }
211
212 // Show help if requested
213 if (args.includes('--help') || args.includes('-h')) {
214 console.log(`
215📚 Process Documentation Script
216
217Usage: bun run process-docs.ts [options]
218
219By default, processes English (en) documentation only.
220Note: Use --clear flag when changing language scope to remove old embeddings.
221
222Options:
223 --clear Clear existing embeddings before processing
224 --dry-run Process and display results without saving to DB
225 --verbose Show detailed output including text previews
226 --path <path> Custom path to docs directory (default: docs/en)
227 --url <url> Custom base URL for links
228 --chunk-size <n> Custom chunk size in tokens (default: 1024)
229 --help, -h Show this help message
230
231Examples:
232 # Dry run to test chunking (English docs)
233 bun run process-docs.ts --dry-run
234
235 # Process and save to database (English docs)
236 bun run process-docs.ts
237
238 # Clear existing and reprocess (English docs)
239 bun run process-docs.ts --clear
240
241 # Process a different language
242 bun run process-docs.ts --path ../../apps/docs/content/docs/es

Callers 1

process-docs.tsFile · 0.70

Calls 2

processDocsFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected