Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

Commit 976947c

Browse files
committed
feat: add FUZZFORGE_USER_DIR env var to override user-global data dir
1 parent 544569d commit 976947c

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

fuzzforge-cli/src/fuzzforge_cli/commands/mcp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ def _generate_mcp_config(
177177
# User-global storage paths for FuzzForge containers.
178178
# Kept under ~/.fuzzforge so images are built once and shared across
179179
# all workspaces — regardless of where `fuzzforge mcp install` is run.
180-
fuzzforge_home = Path.home() / ".fuzzforge"
180+
# Override with FUZZFORGE_USER_DIR for isolated testing.
181+
user_dir_env = os.environ.get("FUZZFORGE_USER_DIR")
182+
fuzzforge_home = Path(user_dir_env).resolve() if user_dir_env else Path.home() / ".fuzzforge"
181183
graphroot = fuzzforge_home / "containers" / "storage"
182184
runroot = fuzzforge_home / "containers" / "run"
183185

fuzzforge-cli/src/fuzzforge_cli/tui/helpers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from __future__ import annotations
1010

1111
import json
12+
import os
1213
import subprocess
1314
from pathlib import Path
1415
from typing import Any
@@ -37,9 +38,16 @@ def get_fuzzforge_user_dir() -> Path:
3738
repositories, the hub registry, container storage (graphroot/runroot),
3839
and the hub workspace volume.
3940
40-
:return: ``Path.home() / ".fuzzforge"``
41+
Override with the ``FUZZFORGE_USER_DIR`` environment variable to
42+
redirect all user-global data to a custom path — useful for testing
43+
a fresh install without touching the real ``~/.fuzzforge/``.
44+
45+
:return: ``Path.home() / ".fuzzforge"`` or ``$FUZZFORGE_USER_DIR``
4146
4247
"""
48+
env_dir = os.environ.get("FUZZFORGE_USER_DIR")
49+
if env_dir:
50+
return Path(env_dir).resolve()
4351
return Path.home() / ".fuzzforge"
4452

4553

0 commit comments

Comments
 (0)