db-manager
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
DB Manager — PostgreSQL Direct Access
Session status
!SESSION_DIR="${HOME}/.cache/db-manager"; if command -v sha256sum >/dev/null 2>&1; then SESSION_KEY=$(printf %s "$PWD" | sha256sum | cut -c1-16); else SESSION_KEY=$(printf %s "$PWD" | shasum -a 256 | cut -c1-16); fi; SESSION_FILE="${SESSION_DIR}/session_${SESSION_KEY}"; if [ -f "$SESSION_FILE" ] && [ ! -L "$SESSION_FILE" ]; then DB_LABEL=$(grep '^DB_LABEL=' "$SESSION_FILE" | cut -d= -f2-); DB_SOURCE=$(grep '^DB_SOURCE=' "$SESSION_FILE" | cut -d= -f2-); echo "CONNECTED: ${DB_LABEL} (source: ${DB_SOURCE})"; else echo "NO_SESSION"; fi
Hash helper used throughout:
sha256sumon Linux,shasum -a 256on macOS — both produce the same hex digest, the snippets fall back automatically.
Core principle
Read DATABASE_URL from project .env files only when needed. The session file stores only metadata (path to the .env and a label) — never the URL itself. Never source the session file: it is data, not code.
Session setup (only if NO_SESSION)
- Find
.envfiles withDATABASE_URLin the project: