cdx-dir
v0.1.6
Published
Interactive directory navigator for quickly drilling into folders from your shell.
Downloads
46
Maintainers
Readme
cdx-dir
cdx-dir is an Ink-based directory navigator. It lets you drill into child directories with the keyboard, then returns the selected path so a shell wrapper can cd into it.
Install From npm
npm install -g cdx-dircdx-dir prints the selected directory path. To actually change your current shell directory, add a cdx shell function.
Bash/Zsh Wrapper
Add this function to ~/.bashrc, ~/.zshrc, or another shell profile:
cdx() {
local dir
dir="$(cdx-dir "$@")" || return
[ -n "$dir" ] && cd "$dir"
}Reload your shell profile, then run:
cdxPowerShell Wrapper
$oldProfile = $PROFILE
$backup = "$PROFILE.bak"
if (Test-Path $oldProfile) {
Copy-Item $oldProfile $backup -Force
Remove-Item $oldProfile -Force
}
New-Item -ItemType File -Path $oldProfile -ForceAdd this function to your PowerShell profile:
@'
function cdx {
$dir = cdx-dir @args
if ($dir) {
Set-Location -LiteralPath $dir
}
}
'@ | Set-Content -Path $PROFILE -Encoding UTF8
Reload your profile:
. $PROFILEThen run:
cdxKeys
- Type text: filter child directories by name
Up/Down: move selectionk/j: move selectionTab: enter highlighted directoryBackspace: delete search text; when search is empty, go to parent directoryEnter: confirm current directoryEsc: clear search text; when search is empty, cancelCtrl+C: cancel
The directory list shows a fixed six-row window. When there are more matches, moving past the top or bottom automatically scrolls the window.
Dot folders such as .config, .codex, and .ssh are shown by default.
Local Development
bun install
bun run test
bun run typecheck
bun run buildRun the built CLI directly:
node dist/cli.jsDirect CLI execution prints the selected path. Use the wrapper above when you want the parent shell to change directories.
