# shellcheck shell=dash

___x_cmd_claude___util_get_agentfile_(){
    local dir="${1:-"${CLAUDE_PROJECT_DIR:-$PWD}"}"
    local filename="CLAUDE.md"
    x_=""; ___x_cmd skill --util_find_up_ "$dir" "$filename" AGENTS.md || {
        claude:error "Failed to retrieve existing context files — Not found CLAUDE.md"
        return 1
    }
}

___x_cmd_claude_rootfolder_(){
    local x_
    if ___x_cmd locatefolder_ "$PWD" ".claude"; then
        x_="$x_/.claude"
    else
        return 1
    fi
}

___x_cmd_claude_rootfolder(){
    local x_
    ___x_cmd_claude_rootfolder_ || return $?
    printf "%s\n" "$x_"
}
