Rust-Kondo: Kondo - CLI & GUI tool for deleting software project artifacts and reclaiming disk space

Kondo ?

Kondo Tests Kondo Lints

Cleans unneeded directories and files from your system.

image

It will identify the disk space savings you would get from deleting temporary/unnecessary files from project directories, such as target from Cargo projects and node_modules from Node projects.

Supports:

Installation

Graphic User Interface

Windows and Mac builds are available on the Releases page as kondo-ui.

You can install kondo-ui via Cargo with cargo install kondo-ui. Note you'll still need druid's platform specific dependencies on mac and linux.

Command line

Windows, Mac, and Linux builds are available on the Releases page as kondo.

You can install kondo via Cargo with cargo install kondo.

Operation

Graphic User Interface

Launch kondo-ui, select a directory to be scanned, evaluate & clean directories as needed.

Command Line Interface

Running kondo without a directory specified will run in the current directory.

$ kondo

Supplying an argument will tell kondo where to start.

$ kondo code/my_project

Example Output

$ kondo ~
Scanning "C:/Users/Trent"
3 projects found
Calculating savings per project
  (redacted 1000~ lines)
  385.6MB UnityTestApp (Unity) C:\Users\Trent\code\UnityTestApp
  458.7MB tokio (Cargo) C:\Users\Trent\code\tokio
    1.5GB ui-testing (Node) C:\Users\Trent\code\ui-testing
    4.0GB rust-analyzer (Cargo) C:\Users\Trent\code\rust-analyzer
9.5GB possible savings

Options/Flags

Artifact Dirs

kondo -a will output a line-separated list of artifact directories you can delete to reclaim space.

$ kondo test_dir -a
C:\Users\Trent\code\kondo\test_dir\node_project\node_modules
C:\Users\Trent\code\kondo\test_dir\rust_project\target
C:\Users\Trent\code\kondo\test_dir\health-dots\Temp
C:\Users\Trent\code\kondo\test_dir\health-dots\Obj
C:\Users\Trent\code\kondo\test_dir\health-dots\MemoryCaptures
C:\Users\Trent\code\kondo\test_dir\health-dots\Build

Command

kondo -c <COMMAND> will run your supplied command for each artifact directory.

$ kondo test_dir -c echo
C:\Users\Trent\code\kondo\test_dir\node_project\node_modules
C:\Users\Trent\code\kondo\test_dir\rust_project\target
C:\Users\Trent\code\kondo\test_dir\health-dots\Temp
C:\Users\Trent\code\kondo\test_dir\health-dots\Obj
C:\Users\Trent\code\kondo\test_dir\health-dots\MemoryCaptures
C:\Users\Trent\code\kondo\test_dir\health-dots\Build

Building/Development

To build kondo you can run cargo build from the projects root directory.

To build kondo-ui you must first navigate into the kondo-ui directory, then you can run cargo build. Because we use druid for the interface you'll need to satisfy druid's platform specific dependencies.

Similar Projects

Comments

  • Keep looking inside project
    Keep looking inside project

    Sep 25, 2020

    For example, the target dir at <rust_project>/examples/<example>/target is ignored, only <rust_project>/target is removed. And if all examples were built for test purposes, the sum of those targets can often exceed the crate's main target

    Reply
  • .gitignore
    .gitignore

    Sep 29, 2020

    Would deleting things that fall under explicit .gitignore globs (as opposed to plain untracked files, which is wildly dangerous) be a useful thing for most people?

    Reply
  • Make parsing Maven projects recursive, and check if the same dir cont…
    Make parsing Maven projects recursive, and check if the same dir cont…

    Jan 29, 2021

    …ains multipe projects, for example Maven and Node

    Reply
  • "kondo ." does not work inside $HOME

    Jan 6, 2022

    When cwd is the root of my home directory (~) and I run kondo or kondo ., it just displays Total bytes deleted: 0.0B and does not even start searching through any directories it looks like.

    kondo 0.4.0

    edit: same with kondo @ 71d75390f1aa3d5a298e0c086643805cd032c664

    Reply
  • Bump structopt from 0.3.23 to 0.3.26
    Bump structopt from 0.3.23 to 0.3.26

    Jan 19, 2022

    Bumps structopt from 0.3.23 to 0.3.26.

    Changelog

    Sourced from structopt's changelog.

    v0.3.25 (2021-10-18)

    • Fix duplication of aliases in subcommands #504

    v0.3.25 (2021-10-18)

    • No changes
    Commits
    • 97e92a3 v0.3.26
    • 2bdd6b4 Clarification on maintenance since clap v3 is out
    • 2736281 Upgrade heck
    • 358cccf [docs] Add output to all examples
    • 4c1a8fc Link to the clap API in the documentation that says all clap methods can be used
    • ffd4772 Typo
    • da1fff8 v0.3.25
    • e83b0fc Merge branch 'master' of github.com:TeXitoi/structopt
    • 6dc2963 v0.4.17
    • ddb51cb Fix duplication of aliases in subcommands
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    Reply
  • Add support for Composer (PHP) projects
    Add support for Composer (PHP) projects

    Jan 19, 2022

    Hey, thanks for this project!

    This pull requests adds Composer support to Kondo.

    Reply
  • is it possible to run kondo recursively?
    is it possible to run kondo recursively?

    Dec 18, 2021

    I would like to run kondo in all directories below a directory (say dir). Is there something like kondo -r dir?

    Reply
  • kondo-ui hung and crashed on macOS (after working well for a while)
    kondo-ui hung and crashed on macOS (after working well for a while)

    Jun 3, 2021

    Details here from Apple's crash reporter tool: https://gist.github.com/atroche/12272ee32ac71ff20fed9bcf2226ab46

    It wasn't in response to anything I did in the UI btw -- it seemed to happen while I was in another window.

    Thanks for making this :) You freed up a bunch of space on my machine.

    Reply
  • Publish kondo-ui
    Publish kondo-ui

    Mar 17, 2020

    Kondo-ui doesn't seem to be published yet. At least cargo install kondo-ui fails. I can't find a way starting kondo-ui without downloading the binary directly or building it myself. Could you publish kondo-ui to crates.io so installing via cargo is straight forward?

    Reply
  • add support for pycache and jupyter-notebook checkpoints
    add support for pycache and jupyter-notebook checkpoints

    Feb 7, 2021

                                                                                                                                                                                                           
    Reply
  • App paniked on
    App paniked on "Select Directory" button press

    Jan 20, 2021

    OS: Linux Kubuntu 18.04 Kernel: 4.15.0-128-generic AppVersion: 0.1.0 (the last from Cargo)

    Terminal output (verbose):

    [email protected] ~> env RUST_BACKTRACE=1 RUST_BACKTRACE=full /home/popov/.cargo/bin/kondo-ui
    DEBUG [druid::localization] available locales [], current en-US
    DEBUG [druid::localization] resolved: [en-US]
    WARN  [druid::menu] MenuDesc::platform_default is not implemented for this platform.
    INFO  [druid_shell::platform::gtk::application] gtk: Activated application
    thread 'main' panicked at 'already borrowed: BorrowMutError', /home/popov/.cargo/registry/src/github.com-1ecc6299db9ec823/druid-shell-0.5.0/src/platform/gtk/window.rs:345:22
    stack backtrace:
       0:     0x558f6fa08355 - std::backtrace_rs::backtrace::libunwind::trace::h577ea05e9ca4629a
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
       1:     0x558f6fa08355 - std::backtrace_rs::backtrace::trace_unsynchronized::h50b9b72b84c7dd56
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/../../backtrace/src/backtrace/mod.rs:66
       2:     0x558f6fa08355 - std::sys_common::backtrace::_print_fmt::h6541cf9823837fac
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys_common/backtrace.rs:79
       3:     0x558f6fa08355 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf64fbff071026df5
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys_common/backtrace.rs:58
       4:     0x558f6f9cfe9c - core::fmt::write::h9ddafa4860d8adff
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/fmt/mod.rs:1082
       5:     0x558f6fa079b6 - std::io::Write::write_fmt::h1d2ee292d2b65481
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/io/mod.rs:1514
       6:     0x558f6fa07340 - std::sys_common::backtrace::_print::ha25f9ff5080d886d
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys_common/backtrace.rs:61
       7:     0x558f6fa07340 - std::sys_common::backtrace::print::h213e8aa8dc5405c0
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys_common/backtrace.rs:48
       8:     0x558f6fa07340 - std::panicking::default_hook::{{closure}}::h6482fae49ef9d963
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:200
       9:     0x558f6fa06a53 - std::panicking::default_hook::he30ad7589e0970f9
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:219
      10:     0x558f6fa06a53 - std::panicking::rust_panic_with_hook::haa1ed36ada4ffb03
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:569
      11:     0x558f6fa066f8 - std::panicking::begin_panic_handler::{{closure}}::h7001af1bb21aeaeb
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:476
      12:     0x558f6fa066c4 - std::sys_common::backtrace::__rust_end_short_backtrace::h39910f557f5f2367
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys_common/backtrace.rs:153
      13:     0x558f6fa0667d - rust_begin_unwind
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:475
      14:     0x558f6f9ce240 - core::panicking::panic_fmt::h4e2659771ebc78eb
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/panicking.rs:85
      15:     0x558f6f9d1082 - core::option::expect_none_failed::h448b58a024c2c33a
                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/option.rs:1221
      16:     0x558f6f9e8253 - core::cell::RefCell<T>::borrow_mut::h3603befb390e1563
      17:     0x558f6f9e97b1 - <O as gtk::auto::widget::WidgetExt>::connect_leave_notify_event::leave_notify_event_trampoline::h75875ed0bb521cbe
      18:     0x7f6e198508f7 - <unknown>
      19:     0x7f6e18a29346 - <unknown>
      20:     0x7f6e18a443cd - g_signal_emit_valist
      21:     0x7f6e18a4512f - g_signal_emit
      22:     0x7f6e19998534 - <unknown>
      23:     0x7f6e1999883d - <unknown>
      24:     0x7f6e1999e707 - <unknown>
      25:     0x7f6e1984da30 - <unknown>
      26:     0x7f6e1984dd30 - <unknown>
      27:     0x7f6e1973f3d0 - <unknown>
      28:     0x7f6e1984dc01 - <unknown>
      29:     0x7f6e199ad4c9 - <unknown>
      30:     0x7f6e1984dc01 - <unknown>
      31:     0x7f6e1984dea7 - <unknown>
      32:     0x7f6e18a2910d - g_closure_invoke
      33:     0x7f6e18a3c12e - <unknown>
      34:     0x7f6e18a44715 - g_signal_emit_valist
      35:     0x7f6e18a4512f - g_signal_emit
      36:     0x7f6e199a10c6 - gtk_widget_show
      37:     0x7f6e19879e20 - gtk_native_dialog_show
      38:     0x7f6e1987a5fa - gtk_native_dialog_run
      39:     0x558f6f9ebd6f - druid_shell::platform::gtk::window::WindowHandle::file_dialog::h61890d67b1dfd6d5
      40:     0x558f6f9ba465 - druid::win_handler::AppState<T>::handle_cmd::hc2abc37aad9a458d
      41:     0x558f6f9bab2f - druid::win_handler::AppState<T>::process_commands::h088db73c09277ecc
      42:     0x558f6f9baa1e - druid::win_handler::AppState<T>::do_window_event::h72282a694bc2956c
      43:     0x558f6f9c5125 - <druid::win_handler::DruidHandler<T> as druid_shell::window::WinHandler>::mouse_up::h6dea4b8b5390d8cc
      44:     0x558f6f9e9a31 - <O as gtk::auto::widget::WidgetExt>::connect_button_release_event::button_release_event_trampoline::h50bb8aa8b40ec165
      45:     0x7f6e198507fb - <unknown>
      46:     0x7f6e18a2910d - g_closure_invoke
      47:     0x7f6e18a3c05e - <unknown>
      48:     0x7f6e18a440af - g_signal_emit_valist
      49:     0x7f6e18a4512f - g_signal_emit
      50:     0x7f6e19998534 - <unknown>
      51:     0x7f6e1984d86e - <unknown>
      52:     0x7f6e1984f948 - gtk_main_do_event
      53:     0x7f6e19360765 - <unknown>
      54:     0x7f6e19390f92 - <unknown>
      55:     0x7f6e1874e417 - g_main_context_dispatch
      56:     0x7f6e1874e650 - <unknown>
      57:     0x7f6e1874e6dc - g_main_context_iteration
      58:     0x7f6e18d0fefd - g_application_run
      59:     0x558f6f9cb2d0 - kondo_ui::main::h725d4d5bbde190fc
      60:     0x558f6f9b314c - std::sys_common::backtrace::__rust_begin_short_backtrace::h4fefc5af64538c72
      61:     0x558f6f9cca0b - main
      62:     0x7f6e17aefbf7 - __libc_start_main
      63:     0x558f6f9ad3ea - _start
      64:                0x0 - <unknown>
    
    Reply
  • Moving build dir to another directory
    Moving build dir to another directory

    Jan 27, 2020

    Here's some weird thing I do: I have a directory outside home where I put my target, node_modules etc, and I put symlinks on the project dirs. Those "shadow" directories are arranged in the same directory tree as the home directory. When I delete such build artifacts, I don't delete the directory that contains it (so I do not break the symlink). I do this to keep backups small.

    I think your tool can help automate this workflow. I could pass a directory to it and it would move build dirs and set up symlinks. I may send a PR if you wish.

    Anyway, thanks for this tool!

    Reply