ek9_prune_empty_sources
Deletes every .ek9 file that is a bare zero-construct module stub (shebang + 'defines module' + //EOF, line comments allowed); answers status, edits[] (one DELETE per file) and skipped[] with a reason per retained candidate.
When to use it
'Delete every empty module stub left after the relocation' is one call with no arguments (narrow with roots and/or moduleFilter:['com.example.i18n']). Use it AFTER a pure-relocation tool has left donor files as bare 'defines module' shells; it needs a prior ek9_compile.
When not to use it
- You know the exact single file to delete - use
ek9_delete_file; this tool is bulk-discovery + filter. - The stub still has block/doc comments you want pruned anyway — run
ek9_remove_commentsfirst to make it eligible, then this tool. - The empty stubs are intentional placeholders (TODO scaffolds, planned module structure) — leave them; do not run this tool.
Details
Two-stage detection: symbol-table walk for zero-construct module scopes, then a lex-only confirmation of the bare `#!ek9 / defines module / //EOF` shape — line `//` comments count as whitespace (pruned); block (`<!- -!>`) and doc (`<?- -?>`) comments are preserving. Pure deletion (only `delete` edits, never rewrites); non-deleted candidates go in `skipped[]` (reason ∈ has-comments | has-unrecognised-content | not-a-stub | module-filter-mismatch | outside-roots) with a `retainedContent` line-slice, while status:conflicts is reserved for a locked/unreadable file (kind:file-locked-or-unreadable). `dirtyOverlay` is V1 schema-accepted but not consumed; when supplied it appears in the response's `deferredParameters[]`.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
moduleFilter | any | Restrict candidates to files declaring this exact `defines module <name>` (an array of one name, or the bare name). When omitted, every module in the scanned roots is considered. | |
roots | array of string | Workspace-relative directories to scan. When omitted, defaults to the watched workspace roots. |
It also takes the arguments every tool takes.