ek9_rename_file
Answers first: status (applied | ready | conflicts), written and edits[{file, newFile, type:move}] - a pure file-system rename of a .ek9 source, contents and module identity untouched.
When to use it
You want a .ek9 file under another name or path, contents untouched - one call with oldPath + newPath (both .ek9). The directory does not affect module membership.
When not to use it
- Renaming a non-.ek9 file, or moving any file - use
ek9_move_file(the same move without the .ek9 extension check). - Changing the MODULE of the contained constructs — use
ek9_move_construct(mode=cross-module) per construct; that edits the 'defines module' line and rewrites references. - Renaming a CONSTRUCT (identifier) inside the file rather than the file — use
ek9_rename_symbol. - Relocating a construct between files — use
ek9_move_construct.
Details
The only structural refusal is the HARD dev/ exit guard (no override flag): a dev/ file containing @Test or assert* cannot be renamed into a production directory (conflict kind dev-exit-contains-tests) — strip the markers first or keep it in dev/; a markerless dev→production rename is permitted (dev-exit-promotion advisory). A destination collision is an error (no overwrite flag) — pick another name or ek9_delete_file first. Crossing a sourceRoot boundary is a source-root-crossed warning, not a failure; edits[] carries a single rename entry with no before/after content since nothing in the file changed.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
newPath | string | yes | Destination: must end in .ek9; may be in a different directory (the directory does NOT affect module membership). Workspace-relative (preferred) or absolute inside the workspace. |
oldPath | string | yes | File path: workspace-relative (preferred) or absolute inside the workspace. The .ek9 file as it is now; must exist. |
It also takes the arguments every tool takes.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Rename ek9 file apply
Request
{
"newPath" : "helpers.ek9",
"oldPath" : "helper.ek9"
}
Response
{
"advisories" : [ {
"kind" : "module-identity-unchanged",
"message" : "EK9 module identity is set by the file's 'defines module' line, not its directory — every construct's fully-qualified name is unchanged by this move and workspace references continue to resolve."
} ],
"conflicts" : [ ],
"edits" : [ {
"file" : "helper.ek9",
"newFile" : "helpers.ek9",
"type" : "move"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "moderate",
"fileCount" : 2,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "applied",
"summary" : "Moved helper.ek9 → helpers.ek9",
...
Cut short here: 4 more lines. The whole recorded call.
See also
- Show me in the IDE: Rename File / Move File