Add a glob tool to Omni/Agent/Tools.hs that finds files by glob pattern.
data GlobArgs = GlobArgs
{ globPattern :: Text -- Glob pattern, e.g., "**/*.hs", "src/**/*.py"
, globPath :: Maybe Text -- Optional: directory to search in (default: ".")
, globLimit :: Maybe Int -- Max results (default: 100)
}
deriving (Show, Eq, Generic)
1. Add GlobArgs data type with FromJSON instance
2. Create globTool :: Engine.Tool with:
3. Implement executeGlob by shelling out to fd:
bash
fd --glob "<pattern>" --type f "<path>" | head -n <limit>
4. Add globTool to allTools list
5. Update the test that checks tool count (currently expects 6, will be 7)
6. Add globTool to the exports list in the module header
{
"type": "object",
"properties": {
"pattern": { "type": "string", "description": "Glob pattern like **/*.hs or src/**/*.py" },
"path": { "type": "string", "description": "Directory to search in (default: current directory)" },
"limit": { "type": "integer", "description": "Maximum number of results (default: 100)" }
},
"required": ["pattern"]
}
Add a unit test that runs glob with pattern "*.hs" and verifies it returns results.
fd is available in the NixOS environmentfd is not found, fall back to find . -name "<pattern>"
CHANGES REQUESTED: ## Code Review: Implement glob tool for file pattern matching
Task Compliance
✅
GlobArgsdata type added with correct fields (globPattern,globPath,globLimit) ✅FromJSONinstance implemented correctly ✅globTool :: Engine.Toolcreated with correct name, description, and schema ✅executeGlobimplemented usingfdcommand ✅ Fallback tofindwhenfdfails ✅globTooladded toallToolslist ✅ Test count updated from 6 to 7 ✅globToolandGlobArgsadded to exports ✅ Unit tests added for schema validation, args parsing, and actual glob executionIssues Found
1. Lint warning: There's a redundant bracket that hlint flagged:
haskell (not (Text.null (toolResultOutput tr))) Test.@=? TrueShould be:haskell not (Text.null (toolResultOutput tr)) Test.@=? True2. Description mismatch: The tool description says "sorted by modification time (most recent first)" but the
fdcommand doesn't include--changed-withinor sorting options. The defaultfdoutput is not sorted by modification time. Either the description should be updated or--exec-batch stat --printf '%Y %p\n'with sorting should be added.3. Minor: The fallback
findcommand uses-namewhich only matches the filename, not a full glob path like**/*.hs. This is noted in the task as acceptable fallback behavior, but worth noting the semantic difference.Build & Test Status
✅ Build passes ✅ All 22 tests pass ⚠️ Lint has 1 warning (redundant bracket)
Code Quality
<|,<*>,Text.pack, etc.)mkSuccessandmkErrorSummary
The implementation is functional and accomplishes the core task. However, there are two issues that should be addressed:
1. The lint warning about redundant brackets needs to be fixed 2. The description claims sorting by modification time which isn't implemented