refactor: extract CLI cachedir magic to cli.cachedir_fit.