Skip to content

Add --max-depth flag to grep for recursive search depth limiting #18

@github-actions

Description

@github-actions

Description

aict grep -r currently walks the entire directory tree with no depth limit. On large monorepos this produces excessive output and is slow.

Proposed Solution

Add --max-depth N flag mirroring find's -maxdepth behavior.

Usage:

aict grep "func" . -r --max-depth 2

This would search only 2 levels deep from the search root.

XML Output Change

Add max_depth attribute to the root <grep> element:

<grep pattern="func" recursive="true" max_depth="2" ...>

Motivation

  • Consistency with find tool which already has -maxdepth
  • Faster targeted searches in large codebases
  • Reduces token count for AI agents that only need shallow results

Related

  • tools/grep/grep.go searchDirectory function
  • tools/find/find.go MaxDepth implementation (reference)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions