Token导航 LogoToken导航TokenDH.com
dirgrep (Astra Bert) logo
开发工具未说明官方级别未说明来源级核验

dirgrep (Astra Bert)

MCP Server

dirgrep是一个基于Go语言开发的CLI工具,用于在目录中执行并发grep操作。

工具数

0

提示词数

0

GitHub Stars

5

资源数

0
命令行工具Go开发工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

AstraBert

提供方

AstraBert

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

dirgrep

dirgrep 是一个CLI工具,用于按目录执行grep操作。

它用Go编写,利用语言内置的并发特性对目录中的所有文件并发执行grep操作(甚至递归!)。

安装

为了安装 dirgrep 有三种方法:

  1. 使用 go:如果你已经有了 go 1.23+已安装在您的环境中,正在安装 dirgrep 毫不费力
go install github.com/AstraBert/dirgrep
  1. 使用 npm:
npm install @cle-does-things/dirgrep
  1. 正在从下载可执行文件 发布页面:您可以直接从GitHub存储库下载,或者,如果您不想离开您的终端,可以使用 curl:
curl -L -o dirgrep https://github.com/AstraBert/dirgrep/releases/download//dirgrep___
.tar.gz ## e.g. https://github.com/AstraBert/dirgrep/releases/download/0.1.1/dirgrep_0.1.1_darwin_amd64.tar.gz

# make sure the downloaded binary is executable (not needed for Windows)
chmod +x dirgrep

在最后一种情况下,请注意指定您的操作系统(支持:linux、windows、macos)和处理器类型(支持:amd、arm)。

用法

dirgrep [command] [flags]

命令

  • mcp:通过stdio传输启动MCP服务器

旗帜

  • -c, --context int\

匹配项周围要包含的上下文字符数。默认为 0.

  • -d, --directory string\

用于搜索模式的目录。默认为当前工作目录(".").

  • -h, --help\

显示帮助消息并退出。

  • -p, --pattern string\

在给定目录中搜索的模式。 必修的。

  • -r, --recursive\

递归搜索文件。默认为 false.

  • -s, --skip strings\

要跳过的一个或多个子目录。可以多次指定,也可以指定为逗号分隔的值。默认为空列表。

  • -x, --no-pretty

停用控制台上比赛的漂亮打印。

例子

# search for 'package main' in the current directory, excluding .git and .gitub
dirgrep --pattern 'package main' --skip .git --skip .github --recursive
# search in a specific directory non-recursively
dirgrep --pattern 'root' --directory cmd/
# add a context of 200 charachters around the match
dirgrep --pattern '202\d' --context 200
# deactivate pretty-printing
dirgrep --pattern '202\d' --context 100 --no-pretty
# start MCP server
dirgrep mcp

基准

_运行基准测试需要Python 3.9+_

你可以运行 基准 dirgrep (VS其他工具)使用:

cd benchmark
bash run.sh

这将:

  • 在下面创建100万个文件(约4GB) benchmark/files 目录,每行包含三个随机行。
  • 开始 ./dirgrep 搜索模式 A password forgot itself at dawn. (随机行之一),将标准输出重定向到 benchmark_dirgrep.txt
  • 开始 grep 递归搜索相同的模式,将标准输出重定向到 benchmark_grep.txt
  • 开始 ripgrep 递归搜索相同的模式,将标准输出重定向到 benchmark_ripgrep.txt
  • 一旦程序完成,您将获得它的时间输出。

在最近一次运行中, dirgrep VS其他工具执行如下:

度量dirgrepgrepripgrep描述
用户35.58s1.53s2.06s用户模式下的CPU时间(程序代码)
系统454.60s27.67s38.44s系统模式下的CPU时间(内核操作)
cpu1166%17%312%所有内核的cpu利用率
总计42.037秒166.34秒12时40分实际挂钟时间

贡献

我们欢迎捐款!请阅读我们的 贡献指南 开始吧。

许可证

该项目根据 MIT许可证

目录标签

目录标签

命令行工具Go开发工具CLI工具本地部署并发处理文本搜索目录操作

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP