ek9_move_file
Answers first: status (applied | ready | conflicts), written and edits[{file, newFile, type:move}] - a pure file-system relocation of any workspace file, contents untouched.
When to use it
You want a file somewhere else or under another name - one call with oldPath + newPath; any file kind, contents untouched. A .ek9 file keeps its module identity (the 'defines module' line, not the directory).
When not to use it
- Moving a CONSTRUCT between files (FQ-name change + reference rewriting), not a whole file - use
ek9_move_construct(symbol:'Name', targetFile). - A .ek9-only rename that must refuse a non-.ek9 destination -
ek9_rename_fileis the same move with that extension check (it performs the rename). - You want a copy + delete (distinct from a move — loses inode identity / VCS history) — use
ek9_write_file+ek9_delete_file. - The file should be REMOVED, not moved — use
ek9_delete_file.
Details
For .ek9 files the 'defines module' line (not the directory) sets module identity, so a move never changes fully-qualified names or breaks references. HARD dev/ exit guard, no override: a .ek9 file leaving a dev/ directory for production is refused (conflict kind 'dev-exit-contains-tests') when it contains @Test or assert*; a marker-free dev/ file is promoted with a 'dev-exit-promotion' advisory. Directory moves are out of scope, and a destination collision (overwrite:false) or missing parent (createIntermediateDirs:false) returns status:error, not conflicts.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
createIntermediateDirs | boolean | When true (default), missing parent directories at the destination are created (mkdir -p). When false, the tool errors if the destination's parent doesn't exist. | |
newPath | string | yes | Destination: may be in a different directory; must not exist unless overwrite:true. Workspace-relative (preferred) or absolute inside the workspace. |
oldPath | string | yes | File path: workspace-relative (preferred) or absolute inside the workspace. The file as it is now; must exist. |
overwrite | boolean | When false (default), the tool errors if a file already exists at newPath. When true, the existing file is replaced (its prior content is lost). Use cautiously. |
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.
Move non ek9 file apply
Request
{
"newPath" : "docs/NOTES.txt",
"oldPath" : "NOTES.txt"
}
Response
{
"conflicts" : [ ],
"edits" : [ {
"file" : "NOTES.txt",
"newFile" : "docs/NOTES.txt",
"type" : "move"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "moderate",
"fileCount" : 2,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "applied",
"summary" : "Moved NOTES.txt → docs/NOTES.txt",
"workspaceHash" : "<workspace-hash>",
"wouldBeDiagnostics" : [ ],
"written" : true
}
Dev exit with tests conflict
Request
{
"dryRun" : true,
"newPath" : "tests.ek9",
"oldPath" : "dev/tests.ek9"
}
Response
{
"conflicts" : [ {
"kind" : "dev-exit-contains-tests",
"message" : "dev/tests.ek9 contains @Test + assert*; a dev/ .ek9 file with @Test or assert* cannot be moved to a production directory. There is no override — strip the test markers to migrate it, or keep it in dev/."
} ],
"edits" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 0,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "conflicts",
"summary" : "Cannot move dev/tests.ek9 out of dev/ — it contains @Test + assert* and is test code that must remain in dev/. Remove the test markers first if this file is genuinely production code.",
"workspaceHash" : "<workspace-hash>",
"wouldBeDiagnostics" : [ ],
"written" : false
}
See also
- Show me in the IDE: Rename File / Move File