← 返回 CLI 目录
ack
$ ack 社区开源 低风险 Beyondgrep · 文件检索与编辑 · Artistic-2.0 · macos / linux / windows
ack 是基于 Perl 的源代码搜索工具,默认跳过 .git/.svn 与二进制文件,并提供 --python、--js 等语言类型过滤器。配合 --nocolor 可稳定用于非交互管道,但仅输出纯文本而不支持 JSON。
FCRS-1.0 综合评分
80 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install ack CLI vs MCP 选型建议 仅 CLI 可用
纯本地文件搜索场景直接调用 CLI 远比任何 MCP 封装更快更简洁。
Agent 友好度体检单
— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
✓ 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
Agent 友好度 17 / 25
支持无交互运行、--nocolor、-l 文件列表与标准退出码(0/1/2),但缺少 --json 输出。
- Supports
--nocolor,-l, and--help-types - Plain-text line output only; no
--jsonflag
安全与权限边界 24 / 25
严格只读的 Perl 搜索工具,无任何写入或破坏性模式。
- Read-only source search; reads
.ackrcconfig files if present
安装与运行摩擦 13 / 15
可通过 brew install ack、Linux 包管理器或单文件 Perl 脚本部署在任意支持 Perl 5 的主机上。
- Packaged on Homebrew, apt/dnf, and standalone Perl script
能力覆盖与边际价值 10 / 15
提供方便的语言过滤器(--python、--perl)与 Perl 正则,但在速度与 .gitignore 支持上不如 ripgrep。
- Skips VCS dirs by default, but does not honor
.gitignorerules
维护与来源背书 8 / 10
由 Andy Lester / Beyondgrep 团队持续维护,采用 Artistic-2.0 协议。
- Official
beyondgrep/ack3repository
文档与可验证性 8 / 10
官网文档、FAQ 与 --help / --man 说明完善。
- Complete manual at beyondgrep.com/documentation
安全边界、鉴权与放权指南
鉴权方式
无需鉴权
凭证存储位置
无需凭据;本地只读文件系统搜索工具。
潜在副作用
只读查询
费用与配额提示
100% 免费、离线、开源(Artistic-2.0)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# ack Agent Rules - Prefer `rg --json` when available; use `ack --nocolor` when `ack` is the installed code-search tool. - Always pass `--nocolor` and narrow by type (`--python`, `--js`) or subdirectory to bound output size.
Agent 高频安全命令配方
只读查询(安全推荐)
列出匹配指定模式的 Python 文件
ack --python -l --nocolor "def authenticate" src/
限定为 Python 源文件并跳过版本控制元数据,输出无 ANSI 颜色的匹配文件路径。
带上下文行与文件名搜索
ack -H -C 2 --nocolor "DEPRECATED" lib/
输出文件路径、行号以及每个匹配项上下各 2 行上下文。
核心优势
- + 内置语言类型选择器(
--python、--ruby、--sql)便于快速限定检索范围。 - + 在缺少原生编译搜索器的环境中可作为单文件 Perl 脚本运行。
注意事项与踩坑点
- ! 不支持
--json输出,且不读取.gitignore(仅跳过常见 VCS 与构建目录)。 - ! 在大型单体仓库中的搜索速度明显慢于
ripgrep(rg)。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI