ek9_delete_directory
Answers first: status (applied | ready | conflicts), written and edits[{file, type:delete, kind:directory}] - removes an EMPTY workspace directory, never a populated tree.
When to use it
You want an EMPTY directory gone - one call with path; a directory with any entry is refused (directory-not-empty), there is no recursive delete.
When not to use it
- Removing a FILE, not a directory - use
ek9_delete_file(path). - Relocating the directory's contents rather than deleting the folder — use
ek9_move_file. - Recursively deleting a POPULATED tree — deliberately unsupported; empty the directory first (
ek9_delete_file/ek9_move_fileper entry) then retry, or use shell rm -r / git rm -r outside this tool.
Details
Empty-only is a HARD gate: any entry (including hidden/dot files) yields a directory-not-empty conflict (mechanical — empty the directory, then retry); there is no recursive/force mode. Workspace-bounded: the target must resolve inside a watched root and the root itself is refused. Errors: missing path, not-a-directory, outside-workspace, is-root, disk error.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
dryRun | boolean | When true nothing is deleted; the response shows the would-be deletion or the not-empty conflict. | |
expectedWorkspaceHash | string | The workspaceHash a prior dry run returned; a mismatch adds a drift warning (the delete still proceeds). | |
path | string | yes | Directory path: workspace-relative (preferred) or absolute inside the workspace. Must exist, be a directory, and not be the workspace root itself. |
terse | boolean | Retained alias of verbosity:summary - prefer verbosity. | |
verbosity | string: full | summary | none | full (default) returns the complete response; summary drops each edit's before/after bodies; none collapses edits[] to editCount. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Delete empty directory apply
Request
{
"path" : "obsolete"
}
Response
{
"conflicts" : [ ],
"edits" : [ {
"file" : "obsolete",
"kind" : "directory",
"type" : "delete"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 0,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "applied",
"summary" : "Deleted empty directory obsolete",
"workspaceHash" : "<workspace-hash>",
"wouldBeDiagnostics" : [ ],
"written" : true
}
Delete non empty directory conflict
Request
{
"dryRun" : true,
"path" : "populated"
}
Response
{
"conflicts" : [ {
"kind" : "directory-not-empty",
"message" : "populated contains 1 entry; only an empty directory can be deleted. Remove its contents first (ek9_delete_file / ek9_move_file), then retry."
} ],
"edits" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 0,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "conflicts",
"summary" : "Cannot delete populated — it is not empty (1 entry). Delete or move the contents first; ek9_delete_directory removes empty directories only (there is no recursive delete).",
"workspaceHash" : "<workspace-hash>",
"wouldBeDiagnostics" : [ ],
"written" : false
}
See also
- Show me in the IDE: New EK9 File, New Directory, Delete File, Delete Directory