indexzero / indexzero/try.rs

[CLI]: Add try graduate with detached-worktree attachment

Open
#9 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Existing issues
  • I searched the existing issues for this CLI request.
Problem

Graduation is currently available only as Ctrl-G inside the interactive selector. It cannot be invoked directly from scripts or from a shell already located inside the try.

Attaching a detached worktree to a branch is also a separate manual step:

git switch -c <branch>

This makes the complete promotion workflow difficult to discover and impossible to automate through a first-class try command.

Proposed command-line interface
# Perform the same graduation operation as Ctrl-G.
try graduate

# Graduate and attach a detached Git worktree to a branch first.
try graduate --attach

try graduate should expose the same destination derivation, validation, move, symlink, output, and final cd behavior as Ctrl-G.

--attach should perform the equivalent of git switch -c <inferred-branch> before moving the worktree. Branch inference should use the same normalized name presented by the graduation workflow.

Expected behavior
  • From a try, try graduate graduates that try without requiring the TUI.
  • try graduate --attach detects detached Git worktrees and creates/checks out the inferred branch before the move.
  • An attachment failure stops the operation before the worktree is moved.
  • Already-attached worktrees are handled safely and do not receive a second branch.
  • Regular, non-worktree directories continue through the normal move path.
  • The command emits/evaluates shell operations consistently with the existing wrapper architecture.
Compatibility and scripting considerations

The CLI and TUI must share one graduation implementation so their behavior cannot drift. The command should preserve the shell-emission model used by try exec, existing TRY_PATH/TRY_PROJECTS behavior, quoting guarantees, and upstream-conformance boundaries.

This complements the proposed Worktrunk-aware default destination; the command should consume the same inferred destination and branch name rather than reimplementing them.

Acceptance criteria
  • try graduate performs the same operation as Ctrl-G.
  • try graduate --attach attaches a detached worktree with git switch -c before moving it.
  • Attachment and move failures return non-zero without leaving a partially graduated worktree.
  • Existing branches and already-attached worktrees have explicit, tested behavior.
  • The CLI and TUI use shared graduation logic.
  • try --help, completions, the usage spec, and documentation include graduate and --attach.
  • Contract tests cover normal directories, detached worktrees, attached worktrees, cancellation/failure, and shell quoting.
try version

try v0.1.0

Additional context

The desired workflow is “promote this existing try,” not “create another worktree with try worktree.”

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the existing Ctrl-G graduation path and the shell-emission architecture used by try exec; trace the shared destination and branch-name derivation before reviewing CLI parsing. Then inspect the help, completions, usage spec, documentation, and contract-test entry points mentioned in the issue. Done means shared CLI/TUI behavior, safe attachment and failure handling, and coverage for the listed directory, worktree, cancellation, and quoting cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.