Printable idea sheet
refactor_file_moves
reqlan rq/extension/mutation/refactor_support.rq:16
Katz 0.106
The extension should watch for file moves and renames, including a renamed folder.
A folder rename is expanded to every file inside it, then the index is migrated for moved
. rq files, and imports and path references are updated both inside the moved file ( outbound )
and in other files that pointed at it or at the folder ( inbound ), including comment paths in code files
( comment_reference_refactor_support ).
Import-root aliases such as `@/old/file.rq` are rewritten when that target moves ( `@/new/file.rq` ).
There should be a single prompt per batch asking whether to apply path updates,
aligned with move_file and rename_file.
While a rename is in flight, the index file watcher must not delete the pre-move URI
before inbound import planning runs — `onWillRenameFiles` marks pending paths and
`migrateRenamedFile` clears the old URI after path edits are planned.
Implemented by register-file-mutation-hooks.ts, expand-renamed-paths.ts, file-move-plan.ts, file-mutation-gate.ts, collect-inbound-referencers-core.ts, pending-rename-paths.ts, index-service.ts, file-path-rewrite.ts, and reqlan-path-references.ts.
- tests
- file-path-rewrite.test.ts:updates inbound import path when the target file moves, file-path-rewrite.test.ts:preserves extensionless inbound paths, file-path-rewrite.test.ts:buildInboundPathRewriteEdits quotes replacement paths, file-path-rewrite.test.ts:updates paths when a file moves to a sibling directory, file-path-rewrite.test.ts:finds comment paths in moved rq files together with imports, file-path-rewrite.test.ts:updates a folder reference when the folder is renamed, file-path-rewrite.test.ts:updates an aliased path when the target folder is renamed, collect-inbound-referencers.test.ts:includes comment_link target files when an rq file moves, expand-renamed-paths.test.ts:pairs each file under a renamed folder with its old path, pending-rename-paths.test.ts:suppresses watcher delete of the pre-move file until cleared, pending-rename-paths.test.ts:suppresses deletes under a renamed folder
Interactive page: refactor_file_moves