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.

Category: Editor · Compare: IntelliJ "Delete" on an empty directory / shell rmdir

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

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

ArgumentTypeRequiredWhat it is
dryRunbooleanWhen true nothing is deleted; the response shows the would-be deletion or the not-empty conflict.
expectedWorkspaceHashstringThe workspaceHash a prior dry run returned; a mismatch adds a drift warning (the delete still proceeds).
pathstringyesDirectory path: workspace-relative (preferred) or absolute inside the workspace. Must exist, be a directory, and not be the workspace root itself.
tersebooleanRetained alias of verbosity:summary - prefer verbosity.
verbositystring: full | summary | nonefull (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