Untangle codebase structure
Run xpd enhance untangle to find code that changes together in separate files, needless module links, and dead weight using source files and Git history without running project code.
Map module coupling and health
Section titled “Map module coupling and health”Print a Mermaid coupling map for Python packages, Go packages, Rust crates, and JavaScript or TypeScript modules, including mixed selections, or pass --format json to inspect nodes, directed edges, import cycles, orphans, and hidden co-change links.
xpd enhance untangle src/ --mapxpd enhance untangle src/ --map --format jsonIn an editor running xpd lsp, workspace-level structural findings such as untangle/import-cycle, untangle/orphaned-module, and untangle/single-use-module appear as HINT diagnostics.
Preview and apply mechanical Python refactors
Section titled “Preview and apply mechanical Python refactors”Use --move to relocate a Python module and rewrite every importing caller, or --inline-facade to collapse a re-export shim directly onto its defining modules. Both flags print a unified diff in dry-run mode first and validate every edited file with libcst before writing when --apply is passed.
xpd enhance untangle --move pkg/old_module.py pkg/new_module.pyxpd enhance untangle --move pkg/old_module.py pkg/new_module.py --apply
xpd enhance untangle --inline-facade pkg/compat_shim.pyxpd enhance untangle --inline-facade pkg/compat_shim.py --applyRun a recorded untangle ledger
Section titled “Run a recorded untangle ledger”Record structural cleanups in a Duroxide ledger so every commit must pass your checks and lower or settle findings.
| Stage | Command | Purpose |
|---|---|---|
| Start | xpd enhance untangle start src/ --check "<cmd>" |
Record the baseline commit, paths, and project checks |
| Survey | xpd enhance untangle src/ --format json |
Read the stable ID of each finding, all of them advice that no run has to clear |
| Plan | xpd enhance untangle plan plan.json |
Register the ordered fixes, each naming the findings it removes or setting the shorter goal |
| Gate | xpd enhance untangle gate <fix-id> |
Verify checks pass, findings do not regress, and goal constraints hold |
| Finish | xpd enhance untangle finish |
Confirm no fix is open, since advice that is left needs no reason |
See xpd enhance untangle for every finding kind and stage command.