grep and glob tools: forward exclude to the module
Summary
The module's grep command accepts an exclude list, but the OpenCode grep tool does not forward it. The glob command and tool have no exclude field.
Source locations (v0.68.0 source and the @cortexkit/aft-opencode 0.68.1 package)
crates/aft/src/commands/grep.rs:161-162readsincludeandexcludefrom the request.packages/opencode-plugin/src/tools/search.ts:205-208: thegreptool sends onlypattern,include,pathandoffset. The published 0.68.1dist/index.jshas the same code, and the tool's argument schema has noexclude.packages/opencode-plugin/src/tools/search.ts:314-315: theglobtool sends onlypatternandpath.crates/aft/src/commands/glob.rs:51,80: theglobcommand reads onlypatternandpath.
Effect
A host plugin that applies read rules to search results can only remove denied matches after the search. Those matches use the result cap, the ranking and the truncation. When a denied subtree has many matches, a search can give fewer permitted matches than it could, or none. If the plugin can set exclude before the call (for example in its tool.execute.before hook), the module skips the denied subtrees before it counts and ranks.
Request
- Forward an
excludeargument from thegreptool to the module when the argument is set. An entry in the tool schema is optional, because a host hook can set the argument. - Add the same
excludefield to theglobcommand and theglobtool.
Thanks for tracing this through both the module and the plugin.
Rather than a new argument, grep's include and glob's pattern will accept ! entries in their comma-separated lists, the way ripgrep's -g '!…' does, on every host. For example, include: "**/*.ts,!**/vendor/**". Excluded paths are skipped during the walk, before matches are counted, capped and ranked, which is the ordering you're after. A plugin hook that adds a ! entry before the call gets the same result. It's queued for an upcoming release.