mirror of
https://github.com/cloudstack-llc/mlx-knife.git
synced 2026-07-15 12:55:42 -04:00
eedb91b75c
- Push (upload-only): quiet JSON by default; capture hub logs in data.hf_logs - No-op detection aligned to hub signal; clear commit fields; uploaded_files_count=0 - Add --dry-run (plan vs remote) and --check-only (offline preflight); merge .hfignore; extend default ignores - Human output: concise; --verbose shows commit URL; JSON shape unchanged - Tests: add offline dry-run cases; live push remains opt-in (wet/live_push) - Docs: README push section updated; TESTING.md reference + mini-matrix; - Changelog: add 2.0.0-alpha.2; note Issue #31 under 1.1.1 pending - Spec: keep schema stable (0.1.3); CLI/version docs consistent
51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Simple helper to push a local test workspace to Hugging Face.
|
|
# Usage: scripts/push-test-workspace.sh <org/model> [branch] [commit_message]
|
|
|
|
REPO_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
WS_DIR="${REPO_ROOT_DIR}/mymodel_test_workspace"
|
|
|
|
REPO_ID=${1:-}
|
|
BRANCH=${2:-main}
|
|
COMMIT_MSG=${3:-"mlx-knife push (test workspace)"}
|
|
|
|
if [[ -z "${REPO_ID}" ]]; then
|
|
echo "Usage: $0 <org/model> [branch] [commit_message]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
if [[ -z "${HF_TOKEN:-}" ]]; then
|
|
echo "HF_TOKEN is not set; export a write-enabled token" >&2
|
|
exit 2
|
|
fi
|
|
|
|
# Prepare workspace (ignored by Git via .gitignore)
|
|
mkdir -p "${WS_DIR}"
|
|
if [[ ! -f "${WS_DIR}/README.md" ]]; then
|
|
cat >"${WS_DIR}/README.md" <<'EOF'
|
|
# Test Workspace for mlxk2 push
|
|
|
|
This folder is intentionally lightweight and git-ignored.
|
|
It is safe to push to a personal HF test repo for validation.
|
|
EOF
|
|
fi
|
|
|
|
# Reasonable default exclude rules (merged with hard excludes in code)
|
|
cat >"${WS_DIR}/.hfignore" <<'EOF'
|
|
.DS_Store
|
|
__pycache__/
|
|
*.tmp
|
|
*.log
|
|
*.zip
|
|
*.tar
|
|
*.tar.gz
|
|
.venv/
|
|
venv/
|
|
EOF
|
|
|
|
echo "Pushing ${WS_DIR} -> ${REPO_ID}@${BRANCH}"
|
|
mlxk2 push "${WS_DIR}" "${REPO_ID}" --create --branch "${BRANCH}" --commit "${COMMIT_MSG}"
|
|
|