Token导航 LogoToken导航

Agent Skill · 研究检索

daft-worktree-workflow(愚蠢的工作树工作流程)

daft-worktree-workflow 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

daft-worktree-workflow 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 42,847。

总安装 1,035周安装 44GitHub Stars 3下载 363核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:daft-worktree-workflow(愚蠢的工作树工作流程)
来源仓库:https://github.com/avihut/daft
仓库路径:skills/daft-worktree-workflow
安装命令:
npx skills add https://github.com/avihut/daft --skill daft-worktree-workflow
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/avihut/daft --skill daft-worktree-workflow

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

daft-worktree-workflow 将 Git worktree 视为完全隔离的开发环境进行管理。每个 worktree 拥有独立的工作文件、依赖包、构建产物和 IDE 配置。适用于多分支并行开发和实验性功能的安全隔离场景。使用时需注意环境变量和全局配置的冲突问题,推荐使用容器化隔离。

该技能强调工作树的完整生命周期管理,包括依赖安装和状态持久化。

来源仓库内路径:skills/daft-worktree-workflow

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/avihut/daft --skill daft-worktree-workflow;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

daft-worktree-workflow 怎么安装?

在终端执行 npx skills add https://github.com/avihut/daft --skill daft-worktree-workflow。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

daft-worktree-workflow 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

daft-worktree-workflow 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/avihut/daft --skill daft-worktree-workflow 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

daft-worktree-workflow 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

daft-worktree-workflow 用的人多吗?

公开数据是累计安装 1,035 次,近一周安装 44 次,下载 363 次,GitHub 3 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

daft-worktree-workflow 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
daft-worktree-workflow

愚蠢的工作树工作流程 · 本页

1,0353执行命令未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

daft Worktree Workflow

Core Philosophy

daft treats each Git worktree as a compartmentalized workspace, not just a branch checked out to disk. Each worktree is a fully isolated environment with its own:

  • Working files and Git index
  • Build artifacts (node_modules/, target/, venv/, .build/)
  • IDE state and configuration (.vscode/, .idea/)
  • Environment files (.envrc, .env)
  • Running processes (dev servers, watchers, test runners)
  • Installed dependencies (potentially different versions per branch)

This means creating a new worktree is not just "checking out a branch" -- it is spinning up a new development environment. Automation (via daft.yml hooks) should install dependencies, configure environment tools, and prepare the workspace so the developer can start working immediately.

Never use git checkout or git switch to change branches in a daft-managed repo. Navigate between worktree directories instead.

Detecting a daft-managed Repository

daft supports multiple layouts. The most common is the contained layout:

my-project/
+-- .git/                    # Bare repository (shared Git metadata)
+-- main/                    # Worktree for the default branch
|   +-- src/
|   +-- package.json
+-- feature/auth/            # Worktree for a feature branch
|   +-- src/
|   +-- package.json
+-- bugfix/login/            # Worktree for a bugfix branch

Other layouts you may encounter:

  • Sibling (default): my-project/ + my-project.feature-auth/ as siblings
  • Nested: my-project/.worktrees/feature-auth/ hidden inside the repo
  • Centralized: worktrees stored in ~/.local/share/daft/worktrees/

Key indicators of any daft-managed repository:

  • Use git rev-parse --git-common-dir from any worktree to find the shared Git directory
  • Run daft layout show to see which layout the repo uses
  • For contained layout: .git/ at the project root is a bare repository (directory, not a file) with branch worktrees as sibling directories
  • For other layouts: the main checkout looks like a normal Git repo, but worktrees are managed by daft elsewhere

If you see any of these patterns, the user is using daft. Apply worktree-aware guidance throughout the session.

Layouts

daft supports four built-in layouts that control where worktrees are placed:

LayoutTemplateDescription
contained{{repo_path}}/{{branch}}Worktrees inside the repo directory
sibling`{{repo}}.{{branch \sanitize}}`Worktrees next to the repo (default)
nested`{{repo}}/.worktrees/{{branch \sanitize}}`Worktrees in a hidden subdirectory
centralized`{{daft_data_dir}}/worktrees/{{repo}}/{{branch \sanitize}}`Worktrees in a central data directory

Layout commands:

CommandDescription
daft layout showShow resolved layout for the current repo
daft layout listList all available layouts
daft layout transform <layout>Convert repo to a different layout
daft layout default [layout]View or set global default layout

Layout is selected at clone time via --layout flag, daft.yml layout field, global config default, or the built-in default (sibling). Users can also define custom layouts with templates in ~/.config/daft/config.toml.

The daft.yml file can specify a layout field alongside hooks to set the team-recommended layout:

layout: contained

hooks:
  worktree-post-create:
    jobs:
      - name: install-deps
        run: npm install

Invocation Forms

daft commands can be invoked in three ways:

FormExampleRequires
Git subcommandgit worktree-checkout feature/authgit-worktree-checkout symlink on PATH
Direct binarydaft worktree-checkout feature/authOnly the daft binary
Verb aliasdaft go feature/authOnly the daft binary
Shortcut aliasgwtco feature/authShortcut symlink on PATH

The git subcommand form (git worktree-*) is what users type in their terminals and what documentation references. Shortcuts are optional short aliases managed via daft setup shortcuts.

Verb Aliases

daft provides short verb aliases for common commands:

Verb AliasEquivalent Command
daft godaft worktree-checkout
daft startdaft worktree-checkout -b
daft clonedaft worktree-clone
daft initdaft worktree-init
daft carrydaft worktree-carry
daft listdaft worktree-list
daft updatedaft worktree-fetch
daft prunedaft worktree-prune
daft removedaft worktree-branch -d
daft renamedaft worktree-branch -m
daft syncdaft git-worktree-sync
daft adoptdaft worktree-flow-adopt
daft ejectdaft worktree-flow-eject

Agent execution rule: When running daft commands, always use the direct binary form (daft <subcommand>) or verb aliases. The git subcommand form requires symlinks and shell wrappers that are not available in most agent shell sandboxes. When explaining daft usage to users, reference the git subcommand form (git worktree-*), verb aliases, or shortcuts, as these are what users interact with in their configured terminals.

After creating a worktree with daft, the shell does not automatically cd into it (that requires shell wrappers). Navigate to the new worktree using the layout convention: cd../<branch-name>/ relative to any existing worktree.

Command Reference

All commands below use the daft binary form for agent execution. Users know these as git subcommands (e.g., daft worktree-checkout is git worktree-checkout to the user).

Worktree Lifecycle

CommandDescription
daft worktree-clone <url> [--layout <LAYOUT>]Clone a remote repository into daft's worktree layout (use --layout to choose: contained, sibling, nested, centralized, or custom)
daft worktree-init <name> [--layout <LAYOUT>]Initialize a new local repository in worktree layout (use --layout to choose layout)
daft worktree-checkout <branch>Create a worktree for an existing local or remote branch; pass --local to skip the remote fetch even when daft.checkout.fetch is enabled
daft worktree-checkout -- -Switch to the previous worktree (cd - style toggle)
daft worktree-checkout -s <branch>Same as above, but auto-creates branch if not found (also daft.go.autoStart)
daft worktree-checkout -b <new-branch> [base]Create a new branch and worktree from current or specified base; by default does not push (see daft.checkout.push); pass --local to skip remote even when push is enabled
daft worktree-branch -d <branch>Safely delete a branch: its worktree and local branch ref; remote branch is deleted only when daft.branchDelete.remote is enabled; pass --local to skip remote, --remote to delete only the remote branch
daft worktree-branch -D <branch>Force-delete a branch bypassing safety checks; for the default branch, removes worktree only (preserves branch ref and remote)
`daft worktree-prune [-f] [-v\-vv] [--stat summary\lines]`Remove worktrees whose remote branches have been deleted (-v hook details, -vv full sequential)
daft worktree-carry <targets>Transfer uncommitted changes to one or more other worktrees
daft worktree-fetch [targets]Update worktree branches from remote (supports refspec syntax source:destination)
daft worktree-branch -m <source> <new-branch>Rename a branch, move its worktree, and rename the remote branch
`daft git-worktree-sync [-f] [-v\-vv] [--rebase BRANCH [--autostash]] [--push [--force-with-lease]] [--include VALUE]... [--stat summary\lines]`Synchronize all worktrees: prune stale + update all + optional rebase + optional push (-f/--prune-dirty for dirty worktrees, -v hook details, -vv full sequential). By default, rebase and push apply only to branches you own (matching git config user.email). Use --include to add more branches: unowned for all, an email address for a teammate's branches, or a branch name for one specific branch.

Adoption and Ejection

CommandDescription
daft worktree-flow-adopt [path]Convert a traditional repository to daft's worktree layout
daft worktree-flow-ejectConvert back to a traditional repository layout

Management

CommandDescription
`daft worktree-list [--json] [-b\-r\-a] [--stat summary\lines] [--columns COLS]`List all worktrees with branch (✦ = default), path (relative to cwd), base ahead/behind, file status (+N staged, -N unstaged,?N untracked), remote status (⇡N unpushed, ⇣N unpulled), branch age, and commit info. Use -b/-r/-a to include local/remote branches without worktrees. JSON includes is_default_branch, staged, unstaged, untracked, remote_ahead, remote_behind, branch_age, owner_email fields. When user.email is configured, output is split into two sections (your branches / other branches). Use --columns owner or --columns +owner to show the Owner column (tip commit author email).
`daft config remote-sync [--on\--off\--status\--global]`Configure remote sync behavior: toggle fetch, push, and remote delete globally or per-repo; no args opens interactive TUI
`daft layout [show\list\transform\default]`Manage worktree layouts: show current, list available, transform between layouts, set global default
daft hooks <subcommand>Manage hooks trust and configuration (trust, prompt, deny, status, run, install, validate, dump, migrate)
daft doctorDiagnose installation and configuration issues; --fix auto-repairs symlinks, shortcuts, refspecs, hooks; --fix --dry-run previews fixes
daft setup shortcuts <subcommand>Manage command shortcut symlinks
daft shell-init <shell>Generate shell integration wrappers
daft completions <shell>Generate shell tab completions

All worktree commands can be run from any directory within any worktree. They find the project root automatically via git rev-parse --git-common-dir.

Post-setup Command Execution (-x/--exec)

The clone, init, and checkout commands support -x/--exec to run commands in the new worktree immediately after setup:

daft worktree-clone https://github.com/org/repo -x 'mise install' -x 'npm run dev'
daft worktree-checkout -b my-feature -x claude
daft worktree-init my-project -x 'echo "ready"'

The option is repeatable -- commands run sequentially in the worktree directory, after hooks complete. Execution stops on first failure. Interactive programs (claude, vim) work because stdio is fully inherited.

Shell Integration

Shell integration is important because the daft binary creates worktrees internally, but the parent shell stays in the original directory. Shell wrappers solve this by reading the CD target from a temp file (DAFT_CD_FILE) and running cd in the parent shell.

# Bash / Zsh -- add to ~/.bashrc or ~/.zshrc
eval "$(daft shell-init bash)"

# Fish -- add to ~/.config/fish/config.fish
daft shell-init fish | source

# With short aliases (gwco, gwcob, gwcobd) -- gwcob maps to checkout -b
eval "$(daft shell-init bash --aliases)"

Disable auto-cd per-command with --no-cd or globally with git config daft.autocd false.

Hooks System (daft.yml)

Hooks automate worktree lifecycle events. The recommended approach is a daft.yml file at the repository root.

Hook Types

HookTriggerRuns From
post-cloneAfter daft worktree-cloneNew default branch worktree
worktree-pre-createBefore new worktree is addedSource worktree
worktree-post-createAfter new worktree is createdNew worktree
worktree-pre-removeBefore worktree is removedWorktree being removed
worktree-post-removeAfter worktree is removedCurrent worktree

During daft worktree-clone, hooks fire in this order: post-clone first (one-time repo bootstrap), then worktree-post-create (per-worktree setup). This lets post-clone install foundational tools that worktree-post-create may depend on.

daft.yml Format

min_version: "1.5.0" # Optional: minimum daft version
hooks:
  worktree-post-create:
    parallel: true # Run jobs concurrently (default)
    jobs:
      - name: install-deps
        run: npm install
      - name: setup-env
        run: cp .env.example .env

Config File Locations (first match wins)

daft.yml, daft.yaml, .daft.yml, .daft.yaml, .config/daft.yml, .config/daft.yaml

Additionally: daft-local.yml for machine-specific overrides (not committed), and per-hook files like worktree-post-create.yml.

Execution Modes

Set one per hook (default is parallel):

ModeFieldBehavior
Parallelparallel: trueAll jobs run concurrently
Pipedpiped: trueSequential; stop on first failure
Followfollow: trueSequential; continue on failure

Job Fields

- name: job-name # Display name and dependency reference
  description: "Install npm dependencies" # Human-readable description
  run: "npm install" # Inline command (or use script: "setup.sh")
  runner: "bash" # Interpreter for script files
  root: "frontend" # Working directory relative to worktree
  env: # Extra environment variables
    NODE_ENV: development
  tags: ["build"] # Tags for filtering
  skip: CI # Skip when $CI is set
  only: DEPLOY_ENABLED # Only run when $DEPLOY_ENABLED is set
  os: linux # Target OS: macos, linux, windows (or list)
  arch: x86_64 # Target arch: x86_64, aarch64 (or list)
  needs: [install-npm] # Wait for these jobs to complete first
  tracks: [path, branch] # Worktree attributes this job depends on (for move hooks)
  interactive: true # Needs TTY (forces sequential)
  priority: 1 # Lower runs first
  fail_text: "Setup failed" # Custom failure message

Job Dependencies

hooks:
  worktree-post-create:
    jobs:
      - name: install-npm
        run: npm install
      - name: install-pip
        run: pip install -r requirements.txt
      - name: build
        run: npm run build
        needs: [install-npm]
      - name: test
        run: npm test
        needs: [build, install-pip]

Independent jobs (install-npm, install-pip) run in parallel. Dependent jobs wait for their dependencies.

Groups

A job can contain a nested group with its own execution mode:

- name: checks
  group:
    parallel: true
    jobs:
      - name: lint
        run: cargo clippy
      - name: format
        run: cargo fmt --check

Template Variables

Available in run commands:

VariableDescription
{branch}Target branch name
{worktree_path}Path to the target worktree
{worktree_root}Project root directory
{source_worktree}Path to the source worktree
{git_dir}Path to the .git directory
{remote}Remote name (usually origin)
{job_name}Name of the current job
{base_branch}Base branch (for checkout -b commands)
{repository_url}Repository URL (for post-clone)
{default_branch}Default branch name (for post-clone)
{old_worktree_path}Previous worktree path (move hooks only)
{old_branch}Previous branch name (move hooks only)

Skip and Only Conditions

skip: CI                         # Skip when env var is truthy
skip: true                       # Always skip
skip:
  - merge                        # Skip during merge
  - rebase                       # Skip during rebase
  - ref: "release/*"             # Skip if branch matches glob
  - env: SKIP_HOOKS              # Skip if env var is truthy
  - run: "test -f .skip-hooks"   # Skip if command exits 0
    desc: "Skip file exists"     # Human-readable reason for the skip

only:
  - env: DEPLOY_ENABLED          # Only run when env var is set
  - ref: "main"                  # Only run on main branch

Trust Management

Hooks from untrusted repos do not run automatically. Manage trust with:

daft hooks trust        # Allow hooks to run
daft hooks prompt       # Prompt before each execution
daft hooks deny         # Never run hooks (default)
daft hooks status       # Check current trust level
daft hooks install      # Scaffold a daft.yml with placeholders
daft hooks validate     # Validate configuration syntax
daft hooks dump         # Show fully merged configuration
daft hooks run <type>   # Manually run a hook (bypasses trust)

Manual Hook Execution

Run hooks on demand, bypassing trust checks (the user is explicitly invoking):

daft hooks run worktree-post-create              # Run all jobs
daft hooks run worktree-post-create --job "mise" # Run a single job
daft hooks run worktree-post-create --tag setup  # Run jobs tagged "setup"
daft hooks run worktree-post-create --dry-run    # Preview without executing
daft hooks run worktree-post-create --verbose    # Show skipped jobs with reasons

Use cases: re-running after a failure, iterating during hook development, or bootstrapping existing worktrees that predate the hooks config.

Move Hooks

When a worktree is moved (rename via daft worktree-branch -m, layout transform via daft layout transform, or adopt via daft worktree-flow-adopt), daft replays identity-tracked hooks to tear down the old environment and set up the new one.

Flow: worktree-pre-remove (old identity) -> worktree-post-remove (old identity) -> move on disk -> worktree-pre-create (new identity) -> worktree-post-create (new identity). Only tracked jobs run.

tracks field: Declares which attributes a job depends on.

- name: link-output
  run: ln -sf {worktree_path}/dist /opt/builds/current
  tracks: [path] # Re-runs when worktree path changes

- name: set-branch-env
  run: echo "BRANCH={branch}" > .env.branch
  tracks: [branch] # Re-runs when branch name changes

- name: install-deps
  run: npm install
  # No tracks -- skipped during moves

Implicit tracking: If tracks is omitted, daft infers it from template usage -- {worktree_path} implies path, {branch}/{worktree_branch} implies branch. Explicit tracks overrides inference.

Dependency pull-in: Jobs listed in needs of a tracked job are included in the move even if not tracked themselves.

Failure handling: Hook failures during moves produce warnings, not errors. The move always completes.

Move-only template variables: {old_worktree_path}, {old_branch} -- available only when DAFT_IS_MOVE is true.

Move-only environment variables: DAFT_IS_MOVE (true during move hooks), DAFT_OLD_WORKTREE_PATH, DAFT_OLD_BRANCH_NAME.

Environment Variables in Hooks

All hooks receive: DAFT_HOOK, DAFT_COMMAND, DAFT_PROJECT_ROOT, DAFT_GIT_DIR, DAFT_REMOTE, DAFT_SOURCE_WORKTREE.

Worktree hooks add: DAFT_WORKTREE_PATH, DAFT_BRANCH_NAME.

Creation hooks add: DAFT_IS_NEW_BRANCH, DAFT_BASE_BRANCH.

Clone hooks add: DAFT_REPOSITORY_URL, DAFT_DEFAULT_BRANCH.

Removal hooks add: DAFT_REMOVAL_REASON (remote-deleted, manual, or ejecting).

Move hooks add: DAFT_IS_MOVE, DAFT_OLD_WORKTREE_PATH, DAFT_OLD_BRANCH_NAME.

Environment Tool Detection and Setup

When working in a daft repo, detect environment tools by their marker files and suggest daft.yml hooks to automate setup for new worktrees.

Tool Detection Table

ToolMarker FilesPurpose
mise.mise.toml, .tool-versionsPolyglot runtime manager (Node, Python, Ruby, Go, etc.)
direnv.envrcPer-directory environment variables
nvm / fnm.nvmrc, .node-versionNode.js version management
pyenv.python-versionPython version management
rbenv.ruby-versionRuby version management
DockerDockerfile, docker-compose.yml, compose.ymlContainerized development
npmpackage.json, package-lock.jsonNode.js dependencies
yarnyarn.lockNode.js dependencies (Yarn)
pnpmpnpm-lock.yamlNode.js dependencies (pnpm)
piprequirements.txt, pyproject.toml, setup.pyPython dependencies
CargoCargo.toml, Cargo.lockRust dependencies
Go modulesgo.mod, go.sumGo dependencies
BundlerGemfile, Gemfile.lockRuby dependencies
Composercomposer.json, composer.lockPHP dependencies

Hook Jobs for Detected Tools

mise (if .mise.toml or .tool-versions exists):

- name: mise-install
  run: mise install

direnv (if .envrc exists):

- name: direnv-allow
  run: direnv allow .

nvm (if .nvmrc or .node-version exists):

- name: nvm-use
  run: |
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
    nvm install

npm (if package.json exists):

- name: npm-install
  run: npm install

pip with venv (if requirements.txt exists):

- name: pip-install
  run: |
    python -m venv .venv
    . .venv/bin/activate
    pip install -r requirements.txt

Cargo (if Cargo.toml exists):

- name: cargo-build
  run: cargo build

Comprehensive Example

For a project using mise, direnv, and npm:

hooks:
  post-clone:
    piped: true
    jobs:
      - name: mise-install
        run: mise install
      - name: direnv-allow
        run: direnv allow .
      - name: npm-install
        run: npm install
        needs: [mise-install]
      - name: setup-env
        run: cp .env.example .env

  worktree-post-create:
    jobs:
      - name: mise-install
        run: mise install
      - name: direnv-allow
        run: direnv allow .
      - name: npm-install
        run: npm install
        needs: [mise-install]

Suggesting Tooling for Repos That Lack It

When a daft-managed repo has no daft.yml, check for dependency files and suggest creating one. A worktree-post-create hook that installs dependencies is the most impactful automation to add.

Starter Configurations

Node.js project (detected via package.json):

hooks:
  worktree-post-create:
    jobs:
      - name: install-deps
        run: npm install

Python project (detected via requirements.txt or pyproject.toml):

hooks:
  worktree-post-create:
    jobs:
      - name: install-deps
        run: |
          python -m venv .venv
          . .venv/bin/activate
          pip install -r requirements.txt

Rust project (detected via Cargo.toml):

hooks:
  worktree-post-create:
    jobs:
      - name: build
        run: cargo build

Go project (detected via go.mod):

hooks:
  worktree-post-create:
    jobs:
      - name: download-deps
        run: go mod download

When suggesting daft.yml, also remind the user to trust the repo: daft hooks trust.

Workflow Guidance for Agents

When working in a daft-managed repository, apply these translations:

User intentCorrect daft approach
"Create a branch"daft worktree-checkout -b <name> -- creates branch + worktree + pushes
"Branch from main"daft worktree-checkout -b <name> main -- branches from the specified base
"Switch to branch X"Navigate to the worktree directory: cd../X/
"Go back"daft worktree-checkout -- - -- toggles to the previous worktree
"Check out a PR"daft worktree-checkout <branch> -- creates worktree for existing branch
"Delete a branch"daft worktree-branch -d <branch> -- removes worktree, local branch, and remote tracking branch
"Clean up branches"daft worktree-prune -- removes worktrees for deleted remote branches
"Wrong branch"daft worktree-carry <correct-branch> -- moves uncommitted changes
"Update from remote"daft worktree-fetch -- updates current or specified worktrees (use source:dest for cross-branch)
"Adopt existing repo"daft worktree-flow-adopt -- converts traditional repo to daft layout

Per-worktree Isolation

Each worktree has its own node_modules/, .venv/, target/, etc. When a new worktree is created without daft.yml hooks, dependencies are not installed automatically. If the user creates a new worktree and encounters missing-dependency errors, the fix is to run the appropriate install command in that worktree (e.g., npm install, pip install -r requirements.txt).

Navigating Worktrees

From any worktree, sibling worktrees are at ../<branch-name>/. The project root (containing .git/) is at .. relative to any top-level worktree. Use git rev-parse --git-common-dir to programmatically find the root.

Modifying Shared Files

Files like daft.yml, .gitignore, and CI configuration live in each worktree independently (they are part of the Git-tracked content). Changes to these files in one worktree must be committed and merged to propagate to other worktrees.

Shortcuts

daft supports three shortcut styles as symlink aliases for faster terminal use:

StyleShortcutsExample
Git (default)gwtclone, gwtinit, gwtco, gwtcb, gwtbd, gwtprune, gwtcarry, gwtfetch, gwtls, gwtsyncgwtco feature/auth
Shellgwco, gwcobgwco feature/auth
Legacygclone, gcw, gcbw, gprunegcw feature/auth

The gwtcb, gwcob, and gcbw shortcuts map to git-worktree-checkout -b (branch creation mode).

Default-branch shortcuts (gwtcm, gwtcbm, gwcobd, gcbdw) are available via shell integration only (daft shell-init). They resolve the remote's default branch dynamically and use git-worktree-checkout -b.

Shell integration also provides gwtrn (maps to daft rename) and gwtsync (maps to git-worktree-sync) as shell functions with cd behavior.

Manage with daft setup shortcuts list, enable <style>, disable <style>, only <style>.

When a user asks how to use daft more efficiently, mention shortcuts as a convenience option. Agents should never execute shortcuts directly -- always use the daft binary form (see Invocation Forms).

Configuration Reference

Key git config settings:

Local-first defaults: daft does not contact the remote by default. Remote operations are opt-in via daft config remote-sync or the individual settings below. Use daft config remote-sync --on to re-enable all remote operations at once, or --local on any command to suppress remote operations for a single invocation.

KeyDefaultDescription
daft.autocdtrueCD into new worktrees via shell wrappers
daft.remote"origin"Default remote name
daft.checkout.fetchfalseFetch from remote before checking out an existing branch
daft.checkout.pushfalsePush new branches to remote after creation
daft.branchDelete.remotefalseDelete the remote branch when removing a local branch
daft.checkout.upstreamtrueSet upstream tracking
daft.checkout.carryfalseCarry uncommitted changes on checkout
daft.checkoutBranch.carrytrueCarry uncommitted changes on branch creation
daft.update.args"--ff-only"Default pull arguments for update (same-branch mode)
daft.prune.cdTarget"root"Where to cd after pruning (root or default-branch)
daft.list.stat"summary"Statistics mode for list (summary or lines)
daft.sync.stat"summary"Statistics mode for sync (summary or lines)
daft.prune.stat"summary"Statistics mode for prune (summary or lines)
daft.list.columns(all columns)Default columns for daft list (same syntax as --columns)
daft.sync.columns(all columns)Default columns for daft sync summary table
daft.prune.columns(all columns)Default columns for daft prune summary table
daft.list.sort"+branch"Default sort order for daft list (same syntax as --sort)
daft.sync.sort"+branch"Default sort order for daft sync
daft.prune.sort"+branch"Default sort order for daft prune
daft.go.autoStartfalseAuto-create worktree when branch not found in go
daft.hooks.enabledtrueMaster switch for hooks
daft.hooks.defaultTrust"deny"Default trust for unknown repos
daft.hooks.timeout300Hook timeout in seconds

Column Selection (--columns)

The list, sync, and prune commands support a --columns flag to control which columns appear in the output table and in what order.

Valid column names

Default columns (shown unless removed): annotation, branch, path, base, changes, remote, age, owner, last-commit

Optional columns (must be explicitly added): size, hash

The size column shows the disk size of each worktree folder in human-readable format (e.g. 42K, 1.3M, 2.5G). When visible, a summary footer row displays the total size across all worktrees.

The hash column shows the abbreviated (7-char) commit hash of each worktree's HEAD commit.

Two modes

Replace mode — provide an exact comma-separated list; only those columns appear, in that order:

daft list --columns branch,path,age
daft sync --columns branch,path,status,age   # status is always pinned on sync/prune

Modifier mode — prefix columns with + (add) or - (remove) to adjust the defaults:

daft list --columns -annotation,-last-commit   # remove two columns
daft list --columns +base,-age                 # add base, remove age
daft list --columns +size                      # add optional size column

Modifier mode is detected automatically when every entry starts with + or -.

Pinned columns on sync and prune

The status column (showing pruned/updated/skipped) is always displayed on sync and prune and cannot be controlled via --columns.

Persistent defaults via git config

Set a default so you never need to pass the flag manually:

git config daft.list.columns "branch,path,age"
git config daft.sync.columns "-annotation,-last-commit"
git config daft.prune.columns "branch,path,age"

The --columns flag overrides the git config value for that invocation.

Sorting (--sort)

The list, sync, and prune commands support a --sort flag to control the sort order of the output.

Sortable columns

branch, path, size, age, owner, hash, activity, commit

activity considers both committed and uncommitted file changes (working tree mtime). commit (alias: last-commit) sorts by last commit time only.

Syntax

Prefix with + (ascending, the default) or - (descending). Multiple columns can be comma-separated for multi-level sort:

daft list --sort branch            # ascending by branch name (default)
daft list --sort -activity         # most recent activity first (commits + uncommitted)
daft list --sort -commit           # most recent commit first (ignores uncommitted)
daft list --sort +owner,-size      # by owner ascending, then size descending

You can sort by columns not shown in the output (e.g., --sort -size without --columns +size). The sort data is collected automatically.

Persistent defaults via git config

git config daft.list.sort "-activity"
git config daft.sync.sort "+owner,-size"
git config daft.prune.sort "+branch"

The --sort flag overrides the git config value for that invocation.

平台分布

Codex

34.91%
按下载量换算127

Claude

28.29%
按下载量换算103

Cursor

19.27%
按下载量换算70

Gemini CLI

8.94%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/avihut/daft --skill daft-worktree-workflow 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills