Skip to content

refactor: centralize cleanup and risk threshold#227

Open
Hiten0305l wants to merge 1 commit into
NVIDIA:mainfrom
Hiten0305l:refactor-risk-threshold
Open

refactor: centralize cleanup and risk threshold#227
Hiten0305l wants to merge 1 commit into
NVIDIA:mainfrom
Hiten0305l:refactor-risk-threshold

Conversation

@Hiten0305l

Copy link
Copy Markdown

Summary

This refactor removes duplicated logic by centralizing shared functionality used by both the CLI and the MCP server. It ensures that the risk-score threshold and temporary directory cleanup logic are defined in a single place, making future maintenance easier and preventing the implementations from drifting.

Changes

  • Moved the shared RISK_THRESHOLD constant to skillspector.constants.
  • Updated both cli.py and mcp_server.py to import and use the shared RISK_THRESHOLD instead of maintaining duplicate values.
  • Added a shared cleanup_result() helper in skillspector.cleanup to centralize temporary directory cleanup.
  • Replaced the duplicated cleanup logic in both cli.py and mcp_server.py with the shared helper.
  • Removed duplicated implementations while preserving the existing CLI and MCP server behavior.

This change is purely a refactor and does not modify existing functionality.

Validation

  • Verified that RISK_THRESHOLD is defined only once and imported where needed.
  • Verified that temporary directory cleanup is centralized and used by both the CLI and MCP server.
  • Verified that the optional MCP dependency installs successfully using uv sync --extra mcp.
  • Existing functionality remains unchanged.

Fixes #192

Signed-off-by: Hiten <erhiten6@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] mcp: centralize RISK_THRESHOLD constant and deduplicate cleanup helper

1 participant