Harden .gitignore and drop hardcoded home paths before publishing

The repo is about to be pushed to a remote, so this covers what should never
travel with it and what should not be baked into the source.

.gitignore now covers credentials (.env, keys, tokens, .netrc), host-local
config (*.local.json), the SQLite telemetry store and its WAL sidecars, logs,
benchmark and sweep output, and the timestamped .bak files this project has
accumulated before. Verified that no currently tracked file is caught by the
new patterns.

Also removed /home/drjones from tracked source, which an ignore file cannot
help with. BASE_DIR now derives from the module's own location, the ComfyUI
model directory falls back to ~/ComfyUI/models, and start_manager.sh resolves
its interpreter through $HOME with a python3 fallback. All three still resolve
to exactly the same paths on this machine; they just no longer hardcode one
user's home directory into a published repository.

Note for the record: the git history was scanned across all refs and contains
no credentials. The password visible in `git remote -v` lives only in
.git/config, which is never pushed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
drjones
2026-08-29 10:30:37 -07:00
parent c593e7aece
commit 172d812820
4 changed files with 122 additions and 11 deletions

122
.gitignore vendored
View File

@@ -1,12 +1,118 @@
__pycache__/
*.py[cod]
*$py.class
*.log
.venv/
venv/
.DS_Store
# ---------------------------------------------------------------------------
# Credentials and secrets — never commit these.
#
# Note: the remote URL in .git/config may embed a username and password. That
# file is local-only and is never pushed, but it does mean `git remote -v`
# prints your password to the terminal. Prefer a credential helper or a token.
# ---------------------------------------------------------------------------
.env
.env.*
*.env
!.env.example
secrets.json
credentials.json
*.credentials
.netrc
.htpasswd
*.pem
*.key
!*.pub
id_rsa*
id_ed25519*
*.p12
*.pfx
*_token
*.token
token.txt
auth.json
# persistent telemetry store
# ---------------------------------------------------------------------------
# Local machine state — paths, tuning and service config specific to one host.
# Commit the .example variants instead.
# ---------------------------------------------------------------------------
*.local.json
*.local.sh
settings.local.*
config.local.*
overclock_profiles.local.json
hyperswap.conf
.hyperswap_env
# ---------------------------------------------------------------------------
# Persistent telemetry store (SQLite + WAL sidecars).
# Grows ~0.4 MB/hour; contains this machine's hardware history, not source.
# ---------------------------------------------------------------------------
hyperswap.db
hyperswap.db-wal
hyperswap.db-shm
*.sqlite
*.sqlite3
*.db-journal
# ---------------------------------------------------------------------------
# Logs and captured run output
# ---------------------------------------------------------------------------
*.log
logs/
manager.log
nohup.out
# ---------------------------------------------------------------------------
# Benchmark, sweep and profiling artefacts
# ---------------------------------------------------------------------------
sweep_*.json
autotune_*.json
pl_*.json
benchmark_*.json
*.prof
*.pstats
perf.data*
# ---------------------------------------------------------------------------
# Backups and scratch files (timestamped .bak files have appeared here before)
# ---------------------------------------------------------------------------
*.bak
*.bak-*
*.backup
*.pre-tuning
*.orig
*.rej
*.tmp
*.swp
*.swo
*~
.#*
scratch/
tmp/
# ---------------------------------------------------------------------------
# Python
# ---------------------------------------------------------------------------
__pycache__/
*.py[cod]
*$py.class
*.so
.venv/
venv/
env/
.Python
build/
dist/
*.egg-info/
.eggs/
.pytest_cache/
.mypy_cache/
.ruff_cache/
.coverage
htmlcov/
.tox/
# ---------------------------------------------------------------------------
# Editors and OS
# ---------------------------------------------------------------------------
.vscode/
.idea/
*.iml
.DS_Store
Thumbs.db
desktop.ini

View File

@@ -27,7 +27,8 @@ logger = logging.getLogger("ram_optimizer")
OLLAMA_API_BASE = "http://localhost:11434"
COMFY_API_BASE = "http://127.0.0.1:8188"
COMFY_MODELS_DIR = os.environ.get("HYPERSWAP_COMFY_MODELS", "/home/drjones/ComfyUI/models")
COMFY_MODELS_DIR = os.environ.get(
"HYPERSWAP_COMFY_MODELS", os.path.expanduser("~/ComfyUI/models"))
OLLAMA_MODEL_DIRS = [
"/usr/share/ollama/.ollama/models",
os.path.expanduser("~/.ollama/models"),

View File

@@ -3,6 +3,7 @@ import asyncio
import contextlib
import json
import logging
import os
import signal
import time
from contextlib import asynccontextmanager
@@ -28,7 +29,7 @@ logger = logging.getLogger("model_manager_server")
logging.getLogger("httpx").setLevel(logging.WARNING)
logging.getLogger("httpcore").setLevel(logging.WARNING)
BASE_DIR = "/home/drjones/unified-model-manager"
BASE_DIR = os.environ.get("HYPERSWAP_BASE_DIR", os.path.dirname(os.path.abspath(__file__)))
# ==========================================

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash
# Launch the HyperSwap server. Override HYPERSWAP_PYTHON to use a different interpreter.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
exec /home/drjones/comfy-mcp-venv/bin/python server.py
PYTHON="${HYPERSWAP_PYTHON:-$HOME/comfy-mcp-venv/bin/python}"
[ -x "$PYTHON" ] || PYTHON="$(command -v python3)"
exec "$PYTHON" server.py