HN 표시: Yawn – 또 다른 Worktree Navigator(CLI, Fzf로 파이프)

hackernews | | 💼 비즈니스
#cli #fzf #git #worktree #개발도구
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

AI 코딩 에이전트 사용 증가로 늘어난 git worktree 관리를 위해, 개발자는 'yawn'이라는 CLI 도구를 개발했습니다. 이 도구는 저장소를 자동으로 발견하고 퍼지 검색(fzf 등)을 통해 신속하게 프로젝트를 전환하는 기능을 제공합니다. 특히 worktree 생성 시 브랜치 해결, .env 파일 복사 및 설정 명령 자동 실행 같은 실용적인 기능을 지원하여, 별도의 AI 통합 없이도 개발 환경 관리 효율성을 극대화하는 데 중점을 두었습니다.

본문

A fast project switcher and worktree manager for git. Fuzzy-find any project on your machine and open it: terminal, IDE, whatever you want. Also makes git worktrees painless. - Fuzzy-find and open projects with any finder (fzf, rofi, dmenu...) - Create worktrees with automatic branch resolution and one-step setup - Auto-initialize worktrees: copy .env , runnpm install , etc. - Discover all git repos recursively, displayed as a tree with worktrees grouped under their parent - Bind to a WM hotkey, works great with i3/sway/hyprland - JSON/porcelain output for scripting cargo install git-yawn yawn pick -F fzf ~/projects yawn pick discovers projects, pipes them into a fuzzy finder, resolves the selection, and opens it. One command. yawn pick -F fzf ~/projects yawn pick -F "rofi -dmenu -p project -i" ~ Bind it to a hotkey in your window manager: # sway / i3 bindsym $mod+p exec yawn pick -F "rofi -dmenu -p project -i" ~/projects You can also set a default finder in your config and just run yawn pick . Under the hood, yawn pick is equivalent to: yawn open "$(yawn resolve -P ~ "$(yawn list ~ --porcelain | fzf)")" yawn resolve maps a pretty display name back to an absolute path. yawn prettify does the inverse — maps an absolute path to its pretty name: yawn resolve "feature @myapp" -P ~/projects # → /home/user/worktrees/myapp--feature yawn prettify /home/user/worktrees/myapp--feature -P ~/projects # → feature @myapp # The manual way: git worktree add ~/worktrees/my-app--feature-x -b feature-x origin/main cd ~/worktrees/my-app--feature-x cp ../my-app/.env . npm install # With yawn: yawn create feature-x --init --open Worktrees are created under a configurable root directory (default: ~/worktrees ) using the convention -- . yawn create feature-x # new branch from default branch yawn create feature-x --source develop # branch from a specific base yawn create feature-x --init --open # setup + open cd "$(yawn create feature-x)" # create and cd into the worktree yawn delete feature-x # remove (prompts for branch deletion) yawn delete feature-x --branch --force # remove worktree + branch, no prompts Branch resolution: checks out existing local branches, tracks remote branches, or creates a new branch from --source or the default branch. Place a .yawn.toml at the repo root to configure what happens during yawn init or yawn create --init : [init] include = [".env", ".env.local", "config/*.toml"] commands = ["npm install", "cargo build"] include : files, directories, or glob patterns to copy from the main repo into worktrees. Directories are copied recursively.commands : shell commands to run sequentially in the target directory. Stops on first failure. yawn list recursively finds git projects. In a terminal, they're shown as a colored tree: my-app ├─ fix-branch └─ feature-x dotfiles notes (personal) notes (work) When piped, output falls back to flat names compatible with fzf and other tools. Use --raw for absolute paths or --json for structured output. yawn list ~/projects # tree in terminal, flat when piped yawn list --porcelain # flat pretty names (stable for scripts) yawn list --raw # absolute paths yawn list --json # structured JSON Global config lives at ~/.config/yawn/config.toml . All fields are optional. [discovery] max_depth = 3 ignore = [".*", "node_modules", "target", "vendor"] [session] opener = "code {dir}" finder = "fzf" [worktree] root = "~/worktrees" auto_init = false discovery.max_depth : recursion depth when searching for projects (default:5 )discovery.ignore : directory name patterns to skip (default:[".*", "node_modules"] )session.opener : command template to open a project.{dir} and{name} are shell-quoted automatically. Examples:code {dir} ,kitty --directory {dir} . Falls back to$TERMINAL , thenTerminal.app (macOS) orxterm (Linux).session.finder : default finder foryawn pick (overridden by-F )worktree.root : where worktrees are created (default:~/worktrees )worktree.auto_init : always run init after creating a worktree (default:false ) cargo install git-yawn Download a binary from the releases page, or use the shell installer: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ComeBertrand/yawn/releases/latest/download/yawn-installer.sh | sh inputs.yawn.url = "github:ComeBertrand/yawn"; # then in your packages: inputs.yawn.packages.${system}.default Shell completions are included: # Bash cp completions/yawn.bash ~/.local/share/bash-completion/completions/yawn # Zsh (or place it anywhere in your $fpath) cp completions/yawn.zsh ~/.local/share/zsh/site-functions/_yawn # Fish cp completions/yawn.fish ~/.config/fish/completions/yawn.fish A man page is generated at build time: man target/*/build/git-yawn-*/out/man/yawn.1 MIT

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →