pub async fn apply_token_budget_selection(
files: Vec<FileInfo>,
token_budget: usize,
config: &Config,
) -> Result<Vec<FileInfo>, ScribeError>Expand description
Apply the library’s tiered token budget selection to a set of files.
The selector prioritizes files in multiple tiers:
- Mandatory project metadata (README, config files, entrypoints)
- Source files ordered by graph centrality with demotion fallback
- Documentation with preference for design/architecture material
- Any remaining files while budget remains
The function loads file content and token estimates for the selected files and will attempt demotion (chunk/signature extraction) when a source file would otherwise exceed the available budget.