8276390877
- Standardized XML tag naming from snake_case to kebab-case across 50+ prompt files for consistency. - Replaced imperative language with RFC 2119 keywords (MUST/SHOULD/MAY/MUST NOT) throughout system and tool prompts for clarity. - Removed artifactsDir parameter from Python executor and simplified environment variable handling to use PI_SESSION_FILE only. - Renamed read_path.md to read-path.md and updated memory guidance with hierarchy rules and conflict resolution workflow. - Added noEscape option to bash URL expansion and extracted cwd parameter from leading cd commands for improved path handling. - Exported NO_PAGER_ENV constant from bash-interactive module for centralized environment variable management.
1.6 KiB
1.6 KiB
Edit (Replace)
String replacements in files with fuzzy whitespace matching.
- You MUST use the smallest edit that uniquely identifies the change - If `old_text` not unique, you MUST expand to include more context or use `all: true` to replace all occurrences - Fuzzy matching handles minor whitespace/indentation differences automatically - You SHOULD prefer editing existing files over creating new ones Returns success/failure status. On success, file modified in place with replacement applied. On failure (e.g., `old_text` not found or matches multiple locations without `all: true`), returns error describing issue. - You MUST read the file at least once in the conversation before editing. Tool errors if you attempt edit without reading file first. Replace for content-addressed changes—you identify \_what* to change by its text.For position-addressed or pattern-addressed changes, bash more efficient:
| Operation | Command |
|---|---|
| Append to file | cat >> file <<'EOF'...EOF |
| Prepend to file | { cat - file; } <<'EOF' > tmp && mv tmp file |
| Delete lines N-M | sed -i 'N,Md' file |
| Insert after line N | sed -i 'Na\text' file |
| Regex replace | sd 'pattern' 'replacement' file |
| Bulk replace across files | sd 'pattern' 'replacement' **/*.ts |
| Copy lines N-M to another file | sed -n 'N,Mp' src >> dest |
| Move lines N-M to another file | sed -n 'N,Mp' src >> dest && sed -i 'N,Md' src |
Use Replace when content itself identifies location. Use bash when position or pattern identifies what to change.