mono/packages/kbot/docs_/advanced.md
2025-02-20 14:44:05 +01:00

1.2 KiB

Working on Larger Directories

Since LLMs (Large Language Models) and providers are limited to very small 'context windows', it's necessary to feed them with smaller chunks instead. This document explains how to process larger directories efficiently.

Directory Processing Example

Here's an example of how to walk through files and process them:

osr-cli each --main='kbot \"read ${KEY} and translate to german, save in docs/language code/filename.md\" --include=\"${REL}\" --include=\".kbot/preferences.md\"' --list="./docs/*.md" --cwd=.

Parameter Explanation

  • each: Command to process multiple files iteratively
  • --main: The main command (kbot) to execute for each file
    • --include=\"${REL}\" instructs kbot to include the current selected path
    • --include=\".kbot/preferences.md\" instructs kbot to include additional preferences about the task (eg: translation specifics)
  • --list: Specifies the file pattern to match
    • Supports include patterns (e.g., "./docs/*.md")
  • --cwd: Sets the current working directory for the command execution. Default is the current directory (.)

Note requires @plastichub/osr-cli-commons to be installed globally:

npm i -g @plastichub/osr-cli-commons