mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 15:37:55 +08:00
docs: describe read-line edit guard in tool playbook
This commit is contained in:
@@ -19,7 +19,8 @@ DEFAULT_DIRECTIVE_REMINDER_TEXT = """\
|
||||
Tool playbook still applies (see system). Hard constraints:
|
||||
- Prefer file tools over shell; several `run_command` calls may run in parallel; \
|
||||
use `run_command_batch` for ordered pipelines.
|
||||
- `edit_replace`: fix match / `max_replaces`; `read_file` with_lineno before `edit_lineno`.
|
||||
- `edit_replace`: fix match / `max_replaces`; `edit_lineno` edits only lines read via \
|
||||
`read_file(with_lineno=true)`, and line numbers reset after any file write.
|
||||
- Prefer `fetch` for HTTP(S); private/LAN hosts need human policy allow (not YOLO).
|
||||
- PTY secrets only via `ask_into_pty`; denylists and confirms still apply.
|
||||
- Todo stack: open items mean unfinished work.
|
||||
|
||||
@@ -21,7 +21,9 @@ DEFAULT_TOOL_DIRECTIVES = """\
|
||||
fix `old_string` or `max_replaces`; shell workarounds rarely help.
|
||||
- `edit_replace` defaults to the first match; if remaining matches are reported, \
|
||||
raise `max_replaces` or narrow `old_string`.
|
||||
- Before `edit_lineno`, `read_file` with `with_lineno=true`.
|
||||
- `edit_lineno` edits only lines you read via `read_file(path, with_lineno=true)`; \
|
||||
re-read with line numbers after any `edit_*` / `write_file` / copy/move/delete, \
|
||||
since line numbers go stale.
|
||||
|
||||
### Commands
|
||||
- Prefer `run_command` / `run_command_batch` (argv, no shell) over `bash -c` or similar.
|
||||
|
||||
@@ -29,7 +29,8 @@ async def read_file(
|
||||
|
||||
``offset`` is 0-based line start; ``limit`` is max lines (None = rest of file).
|
||||
When ``with_lineno`` is true, each line is prefixed with its 1-based file line
|
||||
number (`` N|…``), matching ``edit_lineno`` numbering.
|
||||
number (`` N|…``), matching ``edit_lineno`` numbering, and those lines are
|
||||
marked readable for ``edit_lineno`` this turn.
|
||||
"""
|
||||
target = resolve_path(path)
|
||||
if not target.is_file():
|
||||
|
||||
Reference in New Issue
Block a user