How kelvinauta/contexo works
ConteXo is a CLI that scans a project, reads and transforms its files, then emits token-aware, configurable context to stdout. Its main workflow runs from CLI configuration through scanning, reading, processing, formatting, and output pagination; summary statistics and skipped-path reporting are additional output branches. The README documents filtering, ignore rules, comment/whitespace cleaning, truncation, line numbering, and model comparison. Some orchestration details and subsystem internals are unsampled, so uncertain links are omitted.
Main entry points: index.ts CLI workflow · measure.ts Text metrics · scanner.ts Project scanner · processor.ts Text processor
Components 19
CLI and orchestration
- CLI workflow
src/index.ts - Argument parsing
src/cli/index.ts - Default config
src/config/defaults.ts
Project discovery
- Project scanner
src/core/scanner.ts - File reader
src/core/reader.ts
Content transformation
- Text processor
src/core/processor.ts - Comment cleaner
src/core/cleaners/comment-stripper.ts - Truncation
src/core/truncate.ts - Context formatter
src/core/formatter.ts
Output and analysis
- Text metrics
src/core/measure.ts - Token estimates
src/core/tokenizer.ts - Model cache
src/core/model-cache.ts - Summary rendering
src/core/section-templates.ts - Output document
src/core/document.ts - Output pagination
src/core/paginator.ts
Other components
- CLI user
- Project files
- Models.dev data
- Standard output
Connections 23
- CLI user → CLI workflow: invokes
- CLI workflow → Argument parsing: parses options
- Argument parsing → Default config: uses defaults
- CLI workflow → Project scanner: scans project
- Project scanner → Project files: inspects entries
- Project scanner → File reader: provides file list
- File reader → Project files: reads content
- CLI workflow → File reader: reads files
- CLI workflow → Text processor: processes files
- Text processor → Comment cleaner: strips comments
- Text processor → Truncation: truncates content
- CLI workflow → Context formatter: formats context
- CLI workflow → Text metrics: measures output
- CLI workflow → Token estimates: estimates tokens
- Token estimates → Text metrics: measures text
- Token estimates → Model cache: loads model data
- Model cache → Models.dev data: uses cached model data
- CLI workflow → Summary rendering: renders summaries
- Summary rendering → Text metrics: formats metrics
- CLI workflow → Output document: assembles sections
- CLI workflow → Output pagination: paginates output
- Output pagination → Text metrics: measures pages
- CLI workflow → Standard output: writes output