@archships/dim-plugin-grep-glob
v0.0.9
Published
Official grep-glob plugin for dim-agent-sdk.
Readme
@archships/dim-plugin-grep-glob
Official supported filesystem search plugin for dim-agent-sdk.
What it adds
glob: list files that match a glob patterngrep: regex-first content search with grouped output, pagination, and file/count modes
Permissions
- requests
fs: 'read'
Usage
import { createAgent, createModel } from '@archships/dim-agent-sdk'
import { createGrepGlobPlugin } from '@archships/dim-plugin-grep-glob'
const agent = createAgent({
model: createModel(adapter),
plugins: [createGrepGlobPlugin()],
includeBuiltinTools: false,
})Path overrides
path accepts relative and absolute file or directory paths. Relative paths resolve against the active session cwd; absolute paths keep their absolute location. File paths are converted to their parent directory plus a basename filter so grep and glob can target one file.
Glob behavior
glob now returns richer discovery metadata and accepts:
pattern: glob pattern to matchpath: optional file or directory pathlimit: optional maximum number of returned files; defaults to100sortBy:mtimeorpath; defaults tomtime
The tool renders a summary line plus file paths in text output, and exposes files, numFiles, truncated, durationMs, resolved path, and sortBy in structuredContent.
Example:
{
"pattern": "src/**/*.ts",
"path": ".",
"limit": 20,
"sortBy": "mtime"
}Grep behavior
grep now defaults to grouped content output and accepts:
pattern: regex pattern to search forpath: optional file or directory pathincludeorglob: optional file glob filteroutputMode:content,files, orcountbeforeContext,afterContext,contextignoreCase,lineNumbers,headLimit,offset,multiline,timeoutMs
It also accepts compatibility aliases such as output_mode, head_limit, -A, -B, -C, -i, and -n.
Example:
{
"pattern": "createAgent\\(",
"include": "*.{ts,tsx}",
"outputMode": "content",
"context": 1,
"headLimit": 20,
"timeoutMs": 3000
}Notes
- tool execution uses the standard file system gateway
- official
glob/greptool path overrides resolve relative paths against the activecwdand accept absolute paths grepremains regex-first, but now defaultstimeoutMsto3000and forwards it to the filesystem gatewaycontentmode pre-bounds regex scanning whenheadLimit > 0, so early pages do not always scan the full repository- regex mode rejects high-risk constructs such as lookbehind, backreferences, and broad repeated groups, and uses bounded regex search budgets with input-size caps
- the plugin also injects prompt guidance that tells models to narrow
path/include, preferglobbefore open-endedgrep, and reduce scope after timeouts - this plugin is covered by the centralized plugin integration smoke tests
