Skip to content

Latest commit

 

History

History
104 lines (74 loc) · 2.23 KB

File metadata and controls

104 lines (74 loc) · 2.23 KB

scd

scd is a Go-based directory jumper for exact folder-name navigation. It indexes configured roots, resolves a directory by its final folder name, and relies on a small shell wrapper so scd my-folder can change the current shell directory.

Why the shell wrapper exists

A child process cannot change the working directory of the shell process that launched it. The Go executable therefore resolves a target path, and a small zsh function runs cd against that result.

CLI commands

scd <query>
scd resolve <query>
scd refresh
scd list
scd init-config
scd install zsh
scd version

Quick start

If you use just, the shortest setup flow is:

just test
just install
scd init-config
scd refresh
scd install zsh
source ~/.zshrc

After that, you can jump directly with commands such as:

scd scd
scd my-project

Configuration

scd loads roots from one of these sources, in order:

  1. SCD_PATHS as a colon-separated list.
  2. ~/.config/scd/config.json.
  3. Built-in defaults under your home directory such as ~/Documents, ~/Projects, and ~/GitHub.

Example config:

{
  "roots": [
    "/Users/you/Documents",
    "/Users/you/GitHub",
    "/Users/you/work"
  ],
  "excludeHidden": true,
  "maxDepth": 6
}

Matching behavior

Matching only considers the final folder name, not the parent path.

scd foo only matches directories whose final name is exactly foo.

If multiple folders share the same exact name, scd opens an interactive terminal picker so you can choose the correct directory instead of guessing.

Development

This repository includes a justfile with the core developer actions.

just --list

Core recipes:

just fmt
just test
just bench
just build
just install
just run -- version
just init-config
just refresh

just build writes the binary to dist/scd.

If just is not installed, on macOS you can install it with:

brew install just

Implementation notes

The cached index precomputes a case-insensitive basename lookup, so exact-name resolution avoids scanning every indexed directory on each call.

If the cache was built with different roots or different indexing settings, scd automatically refreshes it before resolving.