#!/usr/bin/env bash # Stub for git — supports clone and pull, returns success. # For clone: creates a minimal fake repo tree at the target with the install scripts. # Log the full command before any shifts. echo "$@" >> "${GIT_STUB_LOG:-/dev/null}" case "$1" in clone) # Args after `clone`: optional flags, then [url] [target]. Find the last two non-flag args. target="" url="" shift # past 'clone' while [[ $# -gt 0 ]]; do if [[ "$1" == --* ]] || [[ "$1" == -* ]]; then shift # skip flag and its possible value if [[ $# -gt 0 ]] && [[ "$1" != --* ]] && [[ "$1" != -* ]] && [[ "$1" =~ ^[0-9]+$ ]]; then shift # depth=N etc. fi continue fi if [[ -z "$url" ]]; then url="$1" else target="$1" fi shift done if [[ -z "$target" ]]; then target="${url##*/}" target="${target%.git}" fi mkdir -p "$target/scripts/install" # Provide minimal expected files so install.sh can copy them. for s in install-rust.sh build-extension.sh pull-model.sh bg-orchestrator.sh \ jarvis-wrapper.sh jarvis-uninstall.sh; do cat > "$target/scripts/install/$s" < "$target/pyproject.toml" <