Files
oh-my-pi/packages/coding-agent/src/prompts/tools/ast-edit.md
T
can1357 af1832af1b feat(coding-agent/prompts): refined tool prompts for shell, browser, and eval workflows
- Simplified `bash` guidance to tighten allowed command patterns, pipeline limits, and launch-based process handling.
- Reworked `browser` instructions into grouped helper sections while preserving selector restrictions and key action semantics.
- Harmonized `eval`, `irc`, `read`, and `todo` prompt wording around state reuse, messaging, selector formats, and task operations.
2026-07-15 03:28:21 +02:00

903 B

Structural AST-aware rewrites via ast-grep. Use for codemods where text replace is unsafe. Narrow each call to one language.

  • Metavariables in pat ($A, $$$ARGS) substitute into out.
  • Patterns match AST structure, not text. $NAME = one node; $_ = unbound; $$$NAME = zero-or-more.
    • Use $$$NAME, NOT $$NAME (invalid). Names UPPERCASE, whole node — partial like prefix$VAR fails.
  • Same metavariable twice → MUST match identical code ($A == $A matches x == x, not x == y).
  • Rewrite patterns MUST parse as single AST node. Non-standalone → wrap: class $_ { … }.
  • TS: tolerate annotations — async function $NAME($$$ARGS): $_ { $$$BODY }. Delete with empty out: {"pat":"console.log($$$)","out":""}.
  • 1:1 substitution — no splitting/merging captures.
  • Parse issues → malformed rewrite, not clean no-op. For one-off text edits, prefer the Edit tool.