Make project search paths configurable via ConfigManager and API#78
Make project search paths configurable via ConfigManager and API#78
Conversation
- Add methods to `ConfigManager` in `skillmeat/config.py` to get/set `project-search-paths`. - Add `ProjectSearchPathsRequest` and `ProjectSearchPathsResponse` schemas in `skillmeat/api/schemas/settings.py`. - Add endpoints `GET /settings/project-search-paths`, `POST /settings/project-search-paths`, `POST /settings/project-search-paths/add`, and `POST /settings/project-search-paths/remove` in `skillmeat/api/routers/settings.py`. - Update `discover_projects` in `skillmeat/api/routers/projects.py` to use configured paths. - Update `_get_search_paths` in `skillmeat/api/project_registry.py` to use configured paths. - Add `tests/test_config_settings.py` to verify the new functionality. Co-authored-by: miethe <6800980+miethe@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| paths = config.get_project_search_paths() | ||
| if paths: | ||
| return [Path(p) for p in paths] | ||
| except Exception: |
Check notice
Code scanning / CodeQL
Empty except Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 16 days ago
In general, empty except blocks over broad exception types should either be removed, narrowed to specific expected exceptions, or augmented to at least log or otherwise record the error, and ideally include a comment explaining why suppression is safe. Here we want to keep the behavior of falling back to default search paths when configuration lookup fails, but avoid completely silent failure.
The best fix without changing functionality is to replace the bare except Exception: pass with an except Exception as e: block that logs the failure (including exception details) and adds a short explanatory comment. The function will still proceed to the default paths that follow the try/except, so external behavior (using defaults on failure) remains the same, but operators and developers will now see why config-based paths were not used. No new imports are necessary because logging and logger already exist in the module.
Concretely, in skillmeat/api/project_registry.py, in the _get_search_paths method around lines 117–125, change:
try:
from skillmeat.config import ConfigManager
config = ConfigManager()
paths = config.get_project_search_paths()
if paths:
return [Path(p) for p in paths]
except Exception:
passto something like:
try:
from skillmeat.config import ConfigManager
config = ConfigManager()
paths = config.get_project_search_paths()
if paths:
return [Path(p) for p in paths]
except Exception as exc:
# Best-effort config loading; fall back to default search paths on any failure.
logger.debug("Failed to load project search paths from config: %s", exc)This keeps existing behavior but eliminates the empty except and adds traceability.
| @@ -122,8 +122,9 @@ | ||
| paths = config.get_project_search_paths() | ||
| if paths: | ||
| return [Path(p) for p in paths] | ||
| except Exception: | ||
| pass | ||
| except Exception as exc: | ||
| # Best-effort config loading; on failure, fall back to default search paths. | ||
| logger.debug("Failed to load project search paths from config: %s", exc) | ||
|
|
||
| home = Path.home() | ||
| return [ |
This change makes the project search paths configurable, allowing users to specify custom directories for project discovery via the configuration file or the settings API. It modifies
ConfigManagerto handle the new setting, adds corresponding API endpoints, and updates the project discovery logic in bothprojects.pyandproject_registry.pyto respect the configured paths. Default paths are used as a fallback.PR created automatically by Jules for task 17018136616428496921 started by @miethe