[TUI]: Prompt to attach a branch when graduating a detached worktree

オープン
#10 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
65/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
git, rust
領域
cli, tooling

調査の方向性

Ctrl-G の graduation フローから開始し、提案されている try graduate --attach エントリーポイントをたどってから、Git worktree の状態と TUI プロンプトがどのように処理されているかを調べます。detached worktree が編集可能なブランチのアタッチ、確認、拒否、キャンセル、そして対処可能な失敗処理をサポートし、既存の動作を維持したまま、列挙されたすべての状態をカバーできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement
Existing issues
  • I searched the existing issues for this interaction.
Current workflow

try worktree <name> intentionally creates a detached worktree. Ctrl-G later moves that worktree to a permanent location, but it does not attach HEAD to a branch.

As a result, the TUI can report a successful graduation while leaving the promoted project detached. Users must know to run this manually before or after graduation:

git switch -c <branch>

The distinction between moving a worktree and attaching its Git HEAD is not visible in the current interaction.

Proposed interaction

When Ctrl-G is used on a detached Git worktree, the TUI should detect the detached state and prompt the user to attach it to a branch.

The prompt should:

  1. Explain that the selected worktree has a detached HEAD.
  2. Offer an inferred branch name derived from the graduation/worktree name.
  3. Allow the branch name to be edited.
  4. Run the equivalent of git switch -c <branch> before moving the worktree when confirmed.
  5. Allow the user to decline and graduate while detached.

No attachment prompt is needed for a worktree already associated with a branch or for a non-Git directory.

Why this improves the TUI

Branch attachment is part of promoting an ephemeral detached worktree into maintained work. Prompting at the transition point makes the Git state explicit, avoids orphaned commits, and removes a prerequisite that users otherwise have to discover outside try.

Acceptance criteria
  • Ctrl-G detects whether a selected Git worktree is detached.
  • Detached worktrees receive an attach-branch prompt before the move.
  • The prompt includes an editable inferred branch name.
  • Confirming performs branch attachment before git worktree move.
  • Declining preserves the existing detached graduation behavior.
  • Escape cancels without attaching or moving.
  • Attachment failure prevents the move and displays an actionable error.
  • Already-attached worktrees and normal directories are not prompted.
  • Tests cover confirm, edit, decline, cancel, failure, and already-attached states.
try version

try v0.1.0

Shell

zsh

Additional context

The same behavior should be available non-interactively through the proposed try graduate --attach CLI.

主要言語
Rust
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

indexzero/try.rs のほかの issue

indexzero/try.rs の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。