Skip to content

Convert unleashed aliases to shell functions for argument passthrough #6

@martymcenroe

Description

@martymcenroe

Problem

Bash aliases don't accept extra arguments. When you type:

unleashed-c-18-triplet --continue

Bash interprets --continue as a shell token, not as an argument to the Python script inside the alias. This causes:

bash: syntax error near unexpected token `--continue'

This blocks the v18 passthrough feature where unknown args (like --resume, --continue, --name) are forwarded to claude.cmd.

Root Cause

Current aliases are defined as:

alias unleashed-c-18-triplet='(PROJECT_PATH="$(cygpath -w "$(pwd)")" && cd /c/Users/mcwiz/Projects/unleashed && poetry run python src/unleashed-c-18.py --mirror --friction --cwd "$PROJECT_PATH")'

Aliases are simple text substitution — there's no $@ or $1 to capture extra arguments.

Proposed Fix

Convert aliases to shell functions, which DO accept arguments via $@:

unleashed-c-18-triplet() {
  (PROJECT_PATH="$(cygpath -w "$(pwd)")" && cd /c/Users/mcwiz/Projects/unleashed && poetry run python src/unleashed-c-18.py --mirror --friction --cwd "$PROJECT_PATH" "$@")
}

The "$@" at the end passes all extra arguments through to the Python script.

Scope

This affects ALL unleashed aliases in .bash_profile (v07 through v18, both Claude and Gemini variants). However, since changing all of them at once is risky, the suggested approach is:

  1. Phase 1: Convert only the v18 aliases to functions (4 entries)
  2. Test thoroughly — ensure basic launch, flag passthrough, and subshell isolation all work
  3. Phase 2: If stable, convert remaining aliases to functions

Risk

  • Functions and aliases have subtly different behavior in bash (quoting, subshell scope, precedence)
  • The subshell () wrapping is critical — it prevents cd from changing the user's working directory
  • Need to verify that "$@" inside () inside {} correctly passes arguments
  • A broken .bash_profile can lock out the entire shell environment

Testing

# Basic launch (no extra args) — should work identically to alias version
unleashed-c-18-triplet

# Passthrough args — should launch claude with --continue
unleashed-c-18-triplet --continue

# Passthrough with value — should resume specific session
unleashed-c-18-joint --resume 65fc85a1-d85e-443f-acbc-d48c48bff1e4

# Named session
unleashed-c-18 --name "test-session"

Related

  • v18 parse_known_args() in unleashed-c-18.py already handles the Python side — it consumes unleashed flags and passes the rest to claude.cmd
  • This issue is the bash side of that same feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions