360 Secure SkillHub
360 安全技能中心

git-fast-content-search

该 Skill 接收目录或文件路径与字面文本,递归遍历非 Git 目录,并在 Git worktree 中用 git grep 搜索已跟踪文件,随后搜索未跟踪文件。结果以 JSON 行输出,包含绝对路径、是否为 Git 项目文件及搜索方式;会跳过 Git 元数据、符号链接和疑似二进制文件。

分类:搜索
selectxx
selectxx
热度 5.22
最近更新 2026-11-20 22:14:59

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add selectxx/git-fast-content-search
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
git-fast-content-search
description
Search Git projects and normal files for literal text quickly.
triggers
git content search, git grep nested directories, search files for text, fast content search
source
custom

git-fast-content-search

When to use

Use this skill when given a file or directory and a literal string to find. It supports Windows and macOS through Python 3.

Steps

  1. Run the script with Python 3:

    python scripts/fast_content_search.py "<directory-or-file>" "<text>"
    
  2. Return each JSON line as one match. path is absolute.

  3. Read is_git_project_file to identify a file found in Git.

  4. Read search_method to identify git-grep or filesystem-untracked.

The script walks non-Git directories recursively. When it finds a Git worktree, it runs git grep -I -l -z -F for tracked files. It then finds every untracked file with git status --porcelain=v1 -z --untracked-files=all and searches those files normally. Git metadata, symlinks, and likely binary files are skipped. A UTF-16 BOM is supported.

Gotchas

  • The search is literal. It does not interpret regular expressions.
  • Git results include files Git searches in that worktree, normally tracked files.
  • Files with NUL bytes are skipped unless they start with a UTF-16 BOM.
  • Permission errors and unreadable files are skipped.
  • Use --format lines for tab-separated human-readable output.