Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ For other install methods (Go, manual download, PATH troubleshooting), see the [

## Usage

> **Shortcut:** The installer adds `ocwt` as a shell alias for `opencode-worktree` — use either interchangeably.

### Start an agent task

```bash
Expand Down
3 changes: 3 additions & 0 deletions cmd/opencode-worktree/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ Merge Options:

General:
-h, --help Show this help message

Alias:
The installer adds 'ocwt' as a shell alias for opencode-worktree.
`)
}

Expand Down
7 changes: 6 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ This should display the available subcommands: `task`, `merge`, `list`, `cleanup

### Step 5: Confirm with user

Tell the user installation is complete. Show them a quick usage example:
Tell the user installation is complete. Mention the `ocwt` shortcut alias that was installed automatically:

```bash
# Start an isolated agent session
Expand All @@ -179,3 +179,8 @@ opencode-worktree task my-task-name
# Start with an initial prompt
opencode-worktree task my-task-name "Description of what to work on"
```

> **Tip:** The installer adds `ocwt` as a shell alias for `opencode-worktree` — use either interchangeably. If you installed manually or via `go install`, add it yourself:
> ```bash
> echo "alias ocwt='opencode-worktree'" >> ~/.zshrc # or ~/.bashrc
> ```
41 changes: 41 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,45 @@ complete -F _opencode_worktree opencode-worktree'
printf 'Restart your shell or run: source %s\n' "$rc_file"
}

install_alias() {
alias_marker="# opencode-worktree alias"
alias_line="alias ocwt='opencode-worktree'"
snippet="$alias_marker
$alias_line"

shell="$(basename "${SHELL:-}")"
rc_file=""

case "$shell" in
zsh)
if [ -f "$HOME/.zshrc" ]; then
rc_file="$HOME/.zshrc"
fi
;;
bash)
if [ -f "$HOME/.bashrc" ]; then
rc_file="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
rc_file="$HOME/.bash_profile"
fi
;;
esac

if [ -z "$rc_file" ]; then
printf '\nShortcut: you can add this alias to your shell profile:\n'
printf ' %s\n' "$alias_line"
return
fi

if grep -qF "$alias_marker" "$rc_file" 2>/dev/null; then
printf '\nShell alias (ocwt) already installed in %s\n' "$rc_file"
return
fi

printf '\n%s\n' "$snippet" >> "$rc_file"
printf '\nShell alias installed: ocwt → opencode-worktree\n'
printf 'Restart your shell or run: source %s\n' "$rc_file"
}

install_completions
install_alias