Add AST codemod and LSP rename tools for multi-file refactors

Aperta
#59 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, rust, typescript

Direzione di ricerca

The issue names the existing read-only LSP rename in the lsp tool, the session undo mechanism, and the verify/test step as the parts to build on; no source files are named, so locate them first. Decide the design for rename and codemod, including the tree-sitter fallback and rollback, before writing code. Done means the six acceptance criteria pass on the Rust, TypeScript and Python fixtures.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: agent-loop area: tools enhancement priority: P2

Problem

Multi-file refactors are done with grep + edit, one call at a time. The model misses call sites, changes strings that look like identifiers, and leaves imports inconsistent. LSP rename exists as a read-only navigation feature in the lsp tool, but there is no structured rewrite path.

omp routes renames through workspace/willRenameFiles, so re-exports, barrel files and aliased imports update before the file moves. Aider's repo map gives the model a symbol-level view instead of a file list.

Inspiration

  • oh-my-pi: LSP wired into every write, willRenameFiles.
  • Zed: rename and code actions as first-class operations.
  • Aider repo map: ranked symbols, not whole files.
  • tree-sitter: language-agnostic queries for structural rewrites.

Proposal

Add two coding tools:

  1. rename - symbol rename through the language server, with a preview of every affected file. Fall back to a tree-sitter query when no server exists, and say which path was used.
  2. codemod - a named query + rewrite pair (tree-sitter query, replacement template), with --dry-run producing a diff, a file/line report, and a test gate before apply.

Both must:

  • operate only inside the workspace;
  • show the full diff before writing;
  • refuse when the query matches zero nodes or more than a configured cap;
  • run verify/test after apply and roll back on a new failure;
  • record the operation in the session so undo works.

Acceptance criteria

  • Rename updates a Rust re-export, a TypeScript barrel file and a Python import in fixtures.
  • Codemod dry-run produces a diff and no file change.
  • A zero-match or over-cap query refuses with the count.
  • A post-apply test failure rolls back every file.
  • undo reverts the whole operation, not one file.
  • The tool is unavailable in plan and read-only profiles.
Lingua principale
Rust
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GotinhaAzul/LocalHarness

Tutte le issue di GotinhaAzul/LocalHarness

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.