Install
Install with PiG
pig install npm:@ladbabynpm/picc-grepInstall with Pi
pi install npm:@ladbabynpm/picc-grepPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.2.0 (README.md). PiG does not review it.
picc-grep
Claude Code style Grep (content search) tool for pi — a faithful port of Claude Code's Grep tool, backed by ripgrep.
Part of picc, a pi agent setup mirroring Claude Code's harness.
pi's built-in
grepalways uses--jsoncontent mode, has no output modes and no multiline support. This extension replicates Claude Code'sGrepexactly: three output modes, rich flags, andhead_limit/offsetpagination.
Usage
Install via pi install npm:@ladbabynpm/picc-grep.
Tool
- Name:
grep(default) orGrep— configurable (see below). - Parameters:
pattern(required), pluspath,glob,type,output_mode(content|files_with_matches(default) |count),-A,-B,-C,context,-n,-i,-o,head_limit,offset,multiline. - Behavior: exact Claude Code arg order
(
--hidden, VCS-dir excludes,--max-columns 500, mode flags, pattern,--type,--glob), per-mode result templates, path relativization against cwd, andhead_limit(default 250,0= unlimited) +offsetpagination. - Tool-result text matches Claude Code byte-for-byte. Content mode rewrites the path
in place on every ripgrep line —
relpath:num:contentfor a match,relpath-num-contentfor a context line,--group separators preserved — so no file-header line is inserted.files_with_matchesreportsFound N files limit: N, andcountreportsFound N total occurrences across M files.(including for zero matches). A missingpathfails withPath does not exist: <path>. Note: your current working directory is <cwd>., plus aDid you mean <path>?hint when the same relative path exists under cwd. - Deliberate deviations from the live Claude Code source:
- the
-o(only-matching) parameter is an extension — it is in the localGrep_schema.jsonbut not in Claude Code's live source. In content mode it maps torg -o/--only-matching. - the path/content boundary is verified against the filesystem, so a
:N:inside content or a Windows drive letter cannot be mistaken for the boundary. - permission-based read-ignore patterns (
getFileReadIgnorePatterns) and orphaned plugin-cache exclusions (getGlobExclusionsForPluginCache) are omitted — they have no pi equivalent (same as picc-glob).
- the
Ripgrep resolution
rg is resolved in this order, and downloaded automatically when it is missing
anywhere — no manual install needed:
PICC_GREP_RG_PATH— an explicit binary path (must exist, else the call fails).~/.pi/agent/bin/rg(rg.exeon Windows) — the directory pi's own tools-manager uses, so one download serves pi's built-in tools and this one. HonorsPI_CODING_AGENT_DIR.rgonPATH.- Download the latest official BurntSushi/ripgrep
release into
~/.pi/agent/binand use it. The download is announced in the tool's partial result and the footer status line, runs once per process (concurrent calls share it), and is retried on the next call if it fails. Archives are extracted withtar/unzip(System32\tar.exethen PowerShellExpand-Archiveon Windows).
PI_OFFLINE=1 (or true/yes) disables the download, matching pi's own behavior. On
Android/Termux the tool asks for pkg install ripgrep instead, since the official Linux
binaries don't run on Bionic libc.
Configuration
| Setting | Where | Values | Default |
|---|---|---|---|
toolName | config.json | "grep" | "Grep" | "grep" |
PICC_GREP_TOOL_NAME | env | "grep" | "Grep" | — |
PICC_GREP_CONFIG_PATH | env | absolute path to a config.json | sibling of index.ts |
PICC_GREP_RG_PATH | env | absolute path to an rg binary | — |
PI_OFFLINE | env | 1 | true | yes disables the rg download | — |
Precedence for the tool name: PICC_GREP_TOOL_NAME env > config.json > "grep".
config.json is read from ~/.pi/agent/extensions/picc-grep/config.json by
default.
{ "toolName": "grep" }
Development
npm run lint— biome checknpm run lint:fix— biome check --writenpm run typecheck— tsc --noEmit
No any; top-level imports only; strict TypeScript (ES2022, bundler resolution).
Dependencies beyond node:* are limited to typebox and
@earendil-works/pi-coding-agent (both bundled with pi).