@ladbabynpm/picc-edit
v0.1.1
Published
Claude Code style Edit tool for pi — a faithful port of Claude Code's `Edit` (exact string replacement, quote normalization, read-first guard, replace_all, structured diff).
Downloads
147
Maintainers
Readme
picc-edit
Claude Code style Edit tool for pi — a faithful port of Claude Code's Edit tool, overriding pi's built-in edit.
Part of picc, a pi agent setup mirroring Claude Code's harness.
pi's built-in
editis a thin multi-edit wrapper: inputpath(relative or absolute) +edits: [{oldText, newText}], no "must read first" guard, no quote normalization, noreplace_all. This extension replicates Claude Code'sEdit: thefile_path+old_string/new_string(+ optionalreplace_all) input shape, a session-scoped read-first guard, exact string matching with curly-quote normalization, and a structured diff result.
Usage
Install via pi install npm:@ladbabynpm/picc-edit.
Tool
- Name:
edit(default; overrides pi's built-inedit) orEdit— configurable (see below). - Parameters:
file_path(absolute, required),old_string(required),new_string(required),replace_all(optional, defaultfalse). - Behavior:
- Existing file — must have been read this session (any read tool), and must not
have been modified since that read.
old_stringis matched (with curly-quote normalization) and must be unique unlessreplace_allis set. ReturnsThe file <path> has been updated successfully.(or thereplace_allvariant) with a structured diff. - New file —
old_stringmust be""; creates the file. - Writes with explicit LF handling (the model's sent line endings are respected as-is — no repo resampling).
- Existing file — must have been read this session (any read tool), and must not
have been modified since that read.
- Read-first guard: reads are observed from pi
tool_resultevents for any read tool (read/Read), so it works whether the file was read with pi's built-inreador picc-read'sRead. The map is cleared onsession_start.
Configuration
| Setting | Where | Values | Default |
|---|---|---|---|
| toolName | config.json | "edit" | "Edit" | "edit" |
| PICC_EDIT_TOOL_NAME | env | "edit" | "Edit" | — |
| PICC_EDIT_CONFIG_PATH | env | absolute path to a config.json | ~/.pi/agent/extensions/picc-edit/config.json |
Precedence for the tool name: PICC_EDIT_TOOL_NAME env > config.json > "edit".
What is omitted from the live source
No pi equivalent, so left out: permission checks (checkWritePermissionForTool),
checkTeamMemSecrets, validateInputForSettingsFileEdit, team-memory guards,
skill discovery, diagnosticTracker, fileHistory, LSP didChange/didSave,
notifyVscodeFileUpdated, fetchSingleFileGitDiff, and analytics.
Development
npm install
npm run lint # biome check
npm run typecheck # tsc --noEmit
npm run test # vitest run