setup-bash-cli-alias

A command for adding or updating Claude Code, Codex, and Grok terminal shortcuts in the user's Z shell startup file. The shortcuts use tmux, a terminal session manager, and can support resuming work or using separate worktrees.

In plain words
What is it for?
Use it to check required command-line tools, add or replace the managed alias blocks in ~/.zshrc, detect conflicting functions, and report missing prerequisites.
Why use it?
It avoids repeatedly typing long commands while keeping unrelated shell settings intact. It also limits changes to the intended zsh configuration instead of modifying project files or other shell profiles.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/mineru98/skills-store/setup-bash-cli-alias
Clone the repo
git clone --depth 1 https://github.com/Mineru98/skills-store

Made for: Claude Code.

Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,516 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.05516
Opus 5 $0.00015 $0.02758
Sonnet 5 $0.00006 $0.01103
Haiku 4.5 $0.00003 $0.00552

Measured 2d ago against content hash d0cbc2f4a89b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

setup-bash-cli-alias scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

transcript_file="$(find "$HOME/.claude/projects" -type f \
.claude/commands/setup-bash-cli-alias.md · 479 lines

How it starts

The opening of the file, as written. The whole thing — 479 lines — stays where its author put it; the contents beside it link to each section on GitHub.

목적

Gist cli-alias-등록.md 의 「프롬프트 for bash」 내용만 사용해 ~/.zshrc 에 Claude Code / Codex / Grok CLI alias 를 넣는다.

PowerShell 프로필 설정은 절대 하지 않는다.

하드 제약

  • 현재 프로젝트(저장소) 파일은 수정하지 않는다.
  • 대상은 사용자 홈의 ~/.zshrc 뿐이다. (zsh 전용 문법)
  • 기존 .zshrc 의 무관한 설정은 유지한다. 관련 블록만 추가하거나 교체한다.
  • ~/.bashrc / ~/.bash_profile / PowerShell 프로필에 쓰지 않는다.
  • claude, codex, grok, tmux, jq, zsh 가 이미 설치되어 있다고 가정한다. 없으면 설치를 강제하지 말고 누락만 보고한다.

사용자 힌트: $ARGUMENTS

실행 순서

질문하지 말고 바로 수행한다. dry-run 힌트가 있으면 실제 쓰기 전에 변경 요약만 보여 준다.

1. 전제 확인

echo "SHELL=$SHELL"
command -v zsh; command -v claude; command -v codex; command -v grok; command -v tmux; command -v jq
test -f "$HOME/.zshrc" && echo "zshrc=exists" || echo "zshrc=missing"

2. 기존 블록 탐지

~/.zshrc 에 아래 마커가 있으면 그 구간만 교체한다. 없으면 파일 끝에 추가한다.

# >>> skills-store bash cli alias (cc/cx) >>>
# <<< skills-store bash cli alias (cc/cx) <<<

# >>> skills-store bash cli alias (grok) >>>
# <<< skills-store bash cli alias (grok) <<<

cc/cx 와 grok 은 서로 분리된 독립 블록으로 탐지·교체한다. 한쪽을 갱신할 때 다른 블록의 커스터마이즈를 덮지 않는다.

동등한 기존 cc() / cx() / grok() 함수 정의가 마커 없이 있으면, 충돌 여부를 보고한 뒤 해당 마커 블록으로 통합한다. 사용자 다른 함수는 건드리지 않는다. gk 는 oh-my-zsh git 플러그인이 쓰는 alias 일 수 있으므로 grok 래퍼로 만들거나 수정하지 않는다.

3. 넣을 내용

아래 블록 전체를 마커 사이에 넣는다. 함수 본문은 Gist bash 절과 동일하다.

# >>> skills-store bash cli alias (cc/cx) >>>
cc() {
  local -a claude_default_args=(--effort medium --dangerously-skip-permissions)

  if [[ "$1" == "--tmux" ]]; then
    shift
    local claude_bin="${commands[claude]}"

    if [[ "$1" == "--resume" ]]; then
      local resume_id="$2"
      local resume_session_name="cc-resume-${resume_id[1,8]:-picker}-$(date +%H%M%S)-$RANDOM"

      if [[ -n "$TMUX" ]]; then
        tmux new-session -d -s "$resume_session_name" -c "$PWD" -- \
          "$claude_bin" "${claude_default_args[@]}" "$@" || return
        tmux set-option -t "$resume_session_name" detach-on-destroy off
        tmux switch-client -t "$resume_session_name"
        while tmux has-session -t "$resume_session_name" 2>/dev/null; do
          sleep 0.1
        done
      else
        tmux new-session -s "$resume_session_name" -c "$PWD" -- \
          "$claude_bin" "${claude_default_args[@]}" "$@"
      fi

      if [[ -n "$resume_id" ]]; then
        printf '\nClaude session ID: %s\n' "$resume_id"
        printf 'Resume: cc --resume %s\n' "$resume_id"
        printf 'Resume with claude: claude --resume %s\n' "$resume_id"
        printf 'Resume in tmux: cc --tmux --resume %s\n' "$resume_id"
        printf 'Resume in tmux with claude: claude --tmux --resume %s\n' "$resume_id"
      fi
      return
    fi

    local use_worktree=false
    if [[ "$1" == "--worktree" ]]; then
      use_worktree=true
      shift
    fi

    local session_name="cc-$(date +%Y%m%d-%H%M%S)-$RANDOM"
    local start_dir="$PWD"
    local repo_root="$(git rev-parse --show-toplevel 2>/dev/null)"
    local session_project="$start_dir"
    local -a claude_args=("$@")

    if [[ "$use_worktree" == true ]]; then
      session_project="$repo_root/.claude/worktrees/$session_name"
      claude_args=(--worktree "$session_name" "$@")
    fi

    local history_file="$HOME/.claude/history.jsonl"
    local history_start_size=0
    if [[ -f "$history_file" ]]; then
      history_start_size="$(wc -c < "$history_file" | tr -d ' ')"
    fi

    if [[ -n "$TMUX" ]]; then
      tmux new-session -d -s "$session_name" -c "$start_dir" -- \
        "$claude_bin" "${claude_default_args[@]}" "${claude_args[@]}" || return
      tmux set-option -t "$session_name" detach-on-destroy off
      tmux switch-client -t "$session_name"
      while tmux has-session -t "$session_name" 2>/dev/null; do
        sleep 0.1
      done
    else
      tmux new-session -s "$session_name" -c "$start_dir" -- \
        "$claude_bin" "${claude_default_args[@]}" "${claude_args[@]}"
    fi

    local session_id=""
    local transcript_file=""
    local attempt

    if [[ -f "$history_file" ]]; then
      for attempt in {1..20}; do
        session_id="$(tail -c +$((history_start_size + 1)) "$history_file" | \
          jq -r --arg project "$session_project" \
          'select(.project == $project and .sessionId) | .sessionId' \
          2>/dev/null | tail -n 1)"
        [[ -n "$session_id" && "$session_id" != "null" ]] && break
        sleep 0.1
      done
    fi

    if [[ -n "$session_id" && "$session_id" != "null" ]]; then
      transcript_file="$(find "$HOME/.claude/projects" -type f \
        -name "$session_id.jsonl" -print -quit 2>/dev/null)"
    fi

    if [[ -n "$transcript_file" ]]; then
      local session_log="$HOME/.claude/cc-tmux-sessions.log"
      printf '%s\t%s\t%s\t%s\n' \
        "$(date '+%Y-%m-%dT%H:%M:%S%z')" \
        "$session_id" "$session_name" "$session_project" >> "$session_log"

      printf '\nClaude session ID: %s\n' "$session_id"
      printf 'Resume: cc --resume %s\n' "$session_id"
      printf 'Resume with claude: claude --resume %s\n' "$session_id"
      printf 'Resume in tmux: cc --tmux --resume %s\n' "$session_id"
      printf 'Resume in tmux with claude: claude --tmux --resume %s\n' "$session_id"
      printf 'Log: %s\n' "$session_log"
    elif [[ -n "$session_id" && "$session_id" != "null" ]]; then
      printf '\nNo resumable conversation was created.\n'
    fi
    return
  fi

  VISUAL=code EDITOR=code command claude "${claude_default_args[@]}" "$@"
}
claude() { cc "$@"; }

cx() {
  local -a codex_default_args=(--disable apps)
  local arg
  local has_bypass=false

  for arg in "$@"; do
    if [[ "$arg" == "--dangerously-bypass-approvals-and-sandbox" ]]; then
      has_bypass=true
      break
    fi
  done

  if [[ "$has_bypass" == false ]]; then
    codex_default_args=(--dangerously-bypass-approvals-and-sandbox "${codex_default_args[@]}")
  fi

  if [[ "$1" == "--resume" ]]; then
    shift
    VISUAL=vi EDITOR=vi command codex resume "${codex_default_args[@]}" "$@"
    return
  fi

  if [[ "$1" == "--tmux" ]]; then
    shift
    local codex_bin="${commands[codex]}"
    local start_dir="$PWD"
    local zsh_bin="${commands[zsh]:-zsh}"
    local -a tmux_settle_wrapper=(
      "$zsh_bin" -fc '
        VISUAL=vi EDITOR=vi "$@"
        exit_status=$?
        sleep 3
        exit "$exit_status"
      ' cx-tmux-settle
    )

    if [[ "$1" == "--resume" ]]; then
      shift
      local resume_id="$1"
      local resume_session_name="cx-resume-${resume_id[1,8]:-picker}-$(date +%H%M%S)-$RANDOM"

      if [[ -n "$TMUX" ]]; then
        tmux new-session -d -s "$resume_session_name" -c "$start_dir" -- \
          "${tmux_settle_wrapper[@]}" \
          "$codex_bin" resume \
          "${codex_default_args[@]}" "$@" || return
        tmux set-option -t "$resume_session_name" detach-on-destroy off
        tmux switch-client -t "$resume_session_name"
        while tmux has-session -t "$resume_session_name" 2>/dev/null; do
          sleep 0.1
        done
      else
        tmux new-session -s "$resume_session_name" -c "$start_dir" -- \
          "${tmux_settle_wrapper[@]}" \
          "$codex_bin" resume \
          "${codex_default_args[@]}" "$@"
      fi

      if [[ -n "$resume_id" ]]; then
        printf '\nCodex session ID: %s\n' "$resume_id"
        printf 'Resume: cx --resume %s\n' "$resume_id"
        printf 'Resume in tmux: cx --tmux --resume %s\n' "$resume_id"
        printf 'Resume with codex: codex resume %s\n' "$resume_id"
        printf 'Resume in tmux with codex: codex --tmux --resume %s\n' "$resume_id"
      fi
      return
    fi

    local session_name="cx-$(date +%Y%m%d-%H%M%S)-$RANDOM"
    local -A known_rollouts
    local rollout_file

    for rollout_file in "$HOME"/.codex/sessions/**/*.jsonl(N); do
      known_rollouts[$rollout_file]=1
    done

    if [[ -n "$TMUX" ]]; then
      tmux new-session -d -s "$session_name" -c "$start_dir" -- \
        "${tmux_settle_wrapper[@]}" \
        "$codex_bin" \
        "${codex_default_args[@]}" "$@" || return
      tmux set-option -t "$session_name" detach-on-destroy off
      tmux switch-client -t "$session_name"
      while tmux has-session -t "$session_name" 2>/dev/null; do
        sleep 0.1
      done
    else
      tmux new-session -s "$session_name" -c "$start_dir" -- \
        "${tmux_settle_wrapper[@]}" \
        "$codex_bin" \
        "${codex_default_args[@]}" "$@"
    fi

    local session_id=""
    local rollout_cwd=""

    for rollout_file in "$HOME"/.codex/sessions/**/*.jsonl(N); do
      [[ -n "${known_rollouts[$rollout_file]}" ]] && continue
      rollout_cwd="$(head -n 1 "$rollout_file" | jq -r \
        'select(.type == "session_meta") | .payload.cwd // empty' 2>/dev/null)"
      [[ "$rollout_cwd" != "$start_dir" ]] && continue
      session_id="$(head -n 1 "$rollout_file" | jq -r \
        'select(.type == "session_meta") | .payload.id // empty' 2>/dev/null)"
    done

    if [[ -n "$session_id" ]]; then
      local session_log="$HOME/.codex/cx-tmux-sessions.log"
      printf '%s\t%s\t%s\t%s\n' \
        "$(date '+%Y-%m-%dT%H:%M:%S%z')" \
        "$session_id" "$session_name" "$start_dir" >> "$session_log"

      printf '\nCodex session ID: %s\n' "$session_id"
      printf 'Resume: cx --resume %s\n' "$session_id"
      printf 'Resume in tmux: cx --tmux --resume %s\n' "$session_id"
      printf 'Resume with codex: codex resume %s\n' "$session_id"
      printf 'Resume in tmux with codex: codex --tmux --resume %s\n' "$session_id"
      printf 'Log: %s\n' "$session_log"
    fi
    return
  fi

  VISUAL=vi EDITOR=vi command codex "${codex_default_args[@]}" "$@"
}
codex() { cx "$@"; }
# <<< skills-store bash cli alias (cc/cx) <<<

Read the full file on GitHub · 479 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 479 lines · 29 tokens per session scan B d0cbc2f4a89b

Subscribe to this mod's changes

setup-bash-cli-alias is a command published in the GitHub repository Mineru98/skills-store (13 stars, last pushed 4d ago), licensed MIT. It adds 29 tokens to every session and 5,516 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.