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.

Category: Editor · Compare: IntelliJ "Refactor → Move" (file-level) / shell mv

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

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

ArgumentTypeRequiredWhat it is
createIntermediateDirsbooleanWhen 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.
newPathstringyesDestination: may be in a different directory; must not exist unless overwrite:true. Workspace-relative (preferred) or absolute inside the workspace.
oldPathstringyesFile path: workspace-relative (preferred) or absolute inside the workspace. The file as it is now; must exist.
overwritebooleanWhen 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