@tiens.nguyen/gu-cli 1.0.748 → 1.0.749

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8020,13 +8020,19 @@ def run_agent_chat(cfg):
8020
8020
  # ORDER to use them in and the CONSTRAINTS that bite — so keep those, drop the third
8021
8021
  # retelling. Every rule below is a scar: token waste (#63/#79), no-shell/no-sudo,
8022
8022
  # key-only deploys (#57).
8023
- " THE EDIT LOOP: grep_repo to LOCATE → read_file_lines around the hit (a SMALL "
8024
- "range; never re-read the whole file or the same range twice — large reads are "
8025
- "truncated and slow every later step) → edit_lines to change it → run_command to "
8026
- "VERIFY. edit_file only for a byte-exact unique string; create_file(overwrite=True) "
8023
+ # Task #48 (GitHub): string edits are the default, like Claude Code's Edit tool. A
8024
+ # line-number edit needs a fresh read before every edit (each one shifts the numbers):
8025
+ # a measured turn spent 12 of its 43 steps on read → edit_lines → read → edit_lines.
8026
+ " THE EDIT LOOP: LOCATE (explore, grep_repo) → read_file_lines ONCE around what you will "
8027
+ "change (a SMALL range; never re-read the whole file or the same range twice) → make ALL "
8028
+ "of that file's edits in ONE block with edit_file(path, old_string, new_string), quoting "
8029
+ "a short UNIQUE snippet from what you read — no line numbers, so no re-read between "
8030
+ "edits → VERIFY with run_command (in the same block when you can). edit_lines only when "
8031
+ "you cannot quote a unique string (e.g. replacing a long range); create_file(overwrite=True) "
8027
8032
  "replaces a whole file in ONE call (no read+edit just to rewrite it).\n"
8028
- " EXPLORE FIRST — before CHANGING code you have not seen yet in this conversation, and "
8029
- "for any broad question (where is X handled, how does Y work, what would a change to Z "
8033
+ " EXPLORE FIRST — before CHANGING code you have not seen yet in this conversation "
8034
+ "(always for a change that spans several files or layers — frontend + backend, UI + API), "
8035
+ "and for any broad question (where is X handled, how does Y work, what would a change to Z "
8030
8036
  "touch): call explore(question) ONCE to map the files and lines involved. It searches in "
8031
8037
  "a SEPARATE context and returns a short summary with path:line references, so its greps "
8032
8038
  "and reads do not pile up here and are not re-sent on every later step. Then read only "
@@ -8071,12 +8077,11 @@ def run_agent_chat(cfg):
8071
8077
  "- user asks to FIX A BUG / MODIFY / ADD CODE in a workspace -> "
8072
8078
  "grep_repo(pattern) when you know the exact string, or rag_search_workspace(query) "
8073
8079
  "when you do not, to FIND the file, THEN "
8074
- "read_file_lines(file, around the hit) to see exact lines, THEN "
8075
- "edit_lines(file, start, end, new_content) to change them, THEN "
8080
+ "read_file_lines(file, around the hit) ONCE, THEN edit_file(file, old_string, new_string) "
8081
+ "for EACH change to that file — all in ONE block —, THEN "
8076
8082
  "run_command('…test…') to VERIFY if run permission exists — read failures and fix, "
8077
8083
  "iterate. Finish with final_answer summarizing WHAT you changed (files + lines). "
8078
- "AFTER editing, re-read with grep_repo/read_file_lines (an indexed knowledge base may be "
8079
- "stale — do not trust rag_search for freshly edited code).\n"
8084
+ "Do not trust rag_search for freshly edited code (the index may be stale).\n"
8080
8085
  ) if _WS_AVAILABLE else ""
8081
8086
  _email_choose_line = (
8082
8087
  "- 'email …' / 'send an email to …' -> send_email(to, subject, body) "
@@ -8261,7 +8266,8 @@ def run_agent_chat(cfg):
8261
8266
  + ("Remember: FINISH what was asked yourself — fix blockers, VERIFY the outcome, then "
8262
8267
  "final_answer with evidence; never hand the task back. If it only asks to RECORD work "
8263
8268
  "(create a task, a note, a plan), recording it IS the task — do not start the work. "
8264
- "To change code you have not seen yet, map it with ONE explore() call first.\n"
8269
+ "To change code you have not seen yet — especially across several files — map it with "
8270
+ "ONE explore() call first, then make each file's edits in ONE block with edit_file.\n"
8265
8271
  if _WS_AVAILABLE else "")
8266
8272
  + "\nTASK (answer THIS, choose the tool that fits it):\n"
8267
8273
  f"{task_text}\n"
@@ -11601,7 +11607,7 @@ def run_agent_chat(cfg):
11601
11607
 
11602
11608
  @tool
11603
11609
  def edit_lines(path: str, start_line: int, end_line: int, new_content: str) -> str:
11604
- """Replace lines start_line..end_line (inclusive, 1-based) of a workspace file with new_content. The PRIMARY edit tool — get exact line numbers from grep_repo/read_file_lines first. A backup is saved automatically.
11610
+ """Replace lines start_line..end_line (inclusive, 1-based) of a workspace file with new_content. Use it only when you cannot quote a unique string for edit_file (e.g. replacing a long range). Line numbers shift after every edit, so re-read before another edit_lines in the same file. A backup is saved automatically.
11605
11611
 
11606
11612
  Args:
11607
11613
  path: file inside a registered workspace.
@@ -11658,7 +11664,7 @@ def run_agent_chat(cfg):
11658
11664
 
11659
11665
  @tool
11660
11666
  def edit_file(path: str, old_string: str, new_string: str) -> str:
11661
- """Replace an EXACT unique text occurrence in a workspace file (must match byte-for-byte incl. whitespace). Prefer edit_lines when you have line numbers. A backup is saved automatically.
11667
+ """The PRIMARY edit tool: replace an EXACT, unique text occurrence in a workspace file (byte-for-byte, incl. whitespace). It needs no line numbers, so several edit_file calls to one file go in ONE block after a single read. A backup is saved automatically.
11662
11668
 
11663
11669
  Args:
11664
11670
  path: file inside a registered workspace.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gu-cli",
3
- "version": "1.0.748",
3
+ "version": "1.0.749",
4
4
  "description": "Gu CLI — the gu terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
5
5
  "type": "module",
6
6
  "license": "MIT",