Fs Grep

Search text files under scenarios/<world_name>/fs and return match snippets.

bdambrosio dabee58 3 files · 8.4 KB Updated

File contents

fs-grep

Search text files for a regex pattern and return match snippets as Notes.

Input

  • path: Relative path under scenarios/<world_name>/fs (default: root)
  • pattern: Regex pattern to search for (required)
  • recursive: Recurse into subdirectories (default: true)
  • max_matches: Max matches to return (default: 20)
  • context: Context lines before/after each match (default: 0)
  • case_insensitive: Case-insensitive regex (default: false)

Output

Success returns:

  • resource_id: Collection ID of match Notes
  • Match Notes are text with:
    • metadata Note linked by meta Relation (path/line/pattern/context and file metadata)
    • body text snippet for the match

Examples

{"type":"fs-grep","path":"src","pattern":"TODO","recursive":true,"out":"$todos"}
{"type":"fs-grep","pattern":"error","context":2,"out":"$errors"}

bdambrosio/cognitive_workbench/tree/main/src/world-tools/fs/fs-grep commit dabee58e03

Frequently asked questions

npx skillmds@latest add bdambrosio/fs-grep