|
30 | 30 | FUZZFORGE_DEFAULT_HUB_NAME = "mcp-security-hub" |
31 | 31 |
|
32 | 32 |
|
| 33 | +def get_fuzzforge_user_dir() -> Path: |
| 34 | + """Return the user-global ``~/.fuzzforge/`` directory. |
| 35 | +
|
| 36 | + Stores data that is shared across all workspaces: cloned hub |
| 37 | + repositories, the hub registry, container storage (graphroot/runroot), |
| 38 | + and the hub workspace volume. |
| 39 | +
|
| 40 | + :return: ``Path.home() / ".fuzzforge"`` |
| 41 | +
|
| 42 | + """ |
| 43 | + return Path.home() / ".fuzzforge" |
| 44 | + |
| 45 | + |
33 | 46 | def get_fuzzforge_dir() -> Path: |
34 | 47 | """Return the project-local ``.fuzzforge/`` directory. |
35 | 48 |
|
36 | | - Uses the current working directory so that each project gets its |
37 | | - own isolated FuzzForge configuration, hubs, and storage — similar |
38 | | - to how ``.git/`` or ``.venv/`` work. |
| 49 | + Stores data that is specific to the current workspace: fuzzing |
| 50 | + results and project artifacts. Similar to how ``.git/`` scopes |
| 51 | + version-control data to a single project. |
39 | 52 |
|
40 | 53 | :return: ``Path.cwd() / ".fuzzforge"`` |
41 | 54 |
|
@@ -238,21 +251,27 @@ def uninstall_agent_config(agent: AIAgent) -> str: |
238 | 251 |
|
239 | 252 |
|
240 | 253 | def get_hubs_registry_path() -> Path: |
241 | | - """Return path to the hubs registry file (``.fuzzforge/hubs.json``). |
| 254 | + """Return path to the hubs registry file (``~/.fuzzforge/hubs.json``). |
| 255 | +
|
| 256 | + Stored in the user-global directory so the registry is shared across |
| 257 | + all workspaces. |
242 | 258 |
|
243 | 259 | :return: Path to the registry JSON file. |
244 | 260 |
|
245 | 261 | """ |
246 | | - return get_fuzzforge_dir() / "hubs.json" |
| 262 | + return get_fuzzforge_user_dir() / "hubs.json" |
247 | 263 |
|
248 | 264 |
|
249 | 265 | def get_default_hubs_dir() -> Path: |
250 | | - """Return default directory for cloned hubs (``.fuzzforge/hubs/``). |
| 266 | + """Return default directory for cloned hubs (``~/.fuzzforge/hubs/``). |
| 267 | +
|
| 268 | + Stored in the user-global directory so hubs are cloned once and |
| 269 | + reused in every workspace. |
251 | 270 |
|
252 | 271 | :return: Path to the default hubs directory. |
253 | 272 |
|
254 | 273 | """ |
255 | | - return get_fuzzforge_dir() / "hubs" |
| 274 | + return get_fuzzforge_user_dir() / "hubs" |
256 | 275 |
|
257 | 276 |
|
258 | 277 | def load_hubs_registry() -> dict[str, Any]: |
@@ -322,7 +341,7 @@ def scan_hub_for_servers(hub_path: Path) -> list[dict[str, Any]]: |
322 | 341 | "image": f"{tool_name}:latest", |
323 | 342 | "category": category, |
324 | 343 | "capabilities": capabilities, |
325 | | - "volumes": [f"{get_fuzzforge_dir()}/hub/workspace:/data"], |
| 344 | + "volumes": [f"{get_fuzzforge_user_dir()}/hub/workspace:/data"], |
326 | 345 | "enabled": True, |
327 | 346 | } |
328 | 347 | ) |
|
0 commit comments