
___x_cmd_claude_box(){
    [ $# -gt 0 ]    ||  set -- status

    local op="$1" ;     shift
    case "$op" in
        -h|--help)      ___x_cmd_help -m claude box         "$@"    ;;

        start|stop|restart|status|run|exec|image|pull|update)
                        ___x_cmd_claude_box_"${op}"         "$@"    ;;

        --)             ___x_cmd_claude_box_run             "$@"    ;;
        *)              ___x_cmd_claude_box_run  "$op"      "$@"    ;;
    esac

}

# mapping the minimax, glm, kimi, openrouter, siliconflow, gemini keys into the folder.
# how to handle ssh -- copy the ssh key automatically ?
# copy the github tokens ?
# Or just sync all of the config in x-cmd to the

___x_cmd_claude_box___setupenv(){
    :

    # copy the keys
    # backup or fork a another workspace ...
}

___x_cmd_claude_box_start(){
    local ___X_CMD_CLAUDE_OPTS

    local ws=""
    while [ $# -gt 0 ]; do
        case "$1" in
            --dind)     ___x_cmd cmdstr ___X_CMD_CLAUDE_OPTS $1 ;    shift ;;
            --ws)       ws="$2" ;   arg:2:shift ;;
            -v)         ___x_cmd cmdstr ___X_CMD_CLAUDE_OPTS -v "$2";   arg:2:shift ;;
            *)          break ;;
        esac
    done

    ___x_cmd_claude_container_image_prepare

    # mapping folders ?
    case "$ws" in
        -)      ;;
        "")     ws="$PWD" ;;
    esac

    eval set -- "$___X_CMD_CLAUDE_OPTS"

    local sharefolder="$___X_CMD_ROOT/share"
    ___x_cmd mkdirp "$sharefolder"

    ___x_cmd docker run             \
        -it                         \
        -v "$ws":/ws                \
        -w "$ws"                    \
        -v "$sharefolder":/share    \
        -d --name x-claude-box-0 x-claude-box "$@" sh -c 'while sleep 100; do :; done' || return $?
        # foreversleep

    # ___x_cmd docker cp "$HOME/.claude.json" x-claude-box-0:"/root/"
    # ___x_cmd docker cp "$HOME/.claude/settings.json" x-claude-box-0:"/root/.claude"
    ___x_cmd docker cp "$HOME/.x-cmd.root/local/cfg" x-claude-box-0:"/root/.x-cmd.root/local"

}

___x_cmd_claude_box_stop(){
    ___x_cmd docker stop x-claude-box-0
}

___x_cmd_claude_box_restart(){
    ___x_cmd docker restart x-claude-box-0
}

___x_cmd_claude_box_run(){
    if [ $# -eq 0 ]; then
        ___x_cmd docker exec -it x-claude-box-0 rootbin.sh claude
    else
        ___x_cmd docker exec -it x-claude-box-0 rootbin.sh "$@"
    fi
}

___x_cmd_claude_box_exec(){
    ___x_cmd docker exec x-claude-box-0 rootbin.sh "$@"
}

___x_cmd_claude_box_status(){
    ___X_CMD_DOCKER_PS_PREFIX="x-claude-box" ___x_cmd docker ps
}

___x_cmd_claude_box_pull(){
    ___x_cmd_claude_container_image_update

    # Using ubuntu image.
    # Using x-cmd refit.
    # Prepare basic
}

___x_cmd_claude_box_update(){
    ___x_cmd_claude_container_image_update

    # Using ubuntu image.
    # Using x-cmd refit.
    # Prepare basic
}

