-
Notifications
You must be signed in to change notification settings - Fork 5
Filter by DEFAULT_BRANCH tag on the remediation to avoid git checkout for the fix #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
timothedelion
merged 15 commits into
main
from
tdelion/APPAI-46/remediate-without-checkout
Oct 24, 2025
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f1b05be
feat(remediation): Filter by DEFAULT_BRANCH tag on the remediation to…
timothedelion 9226b4e
chore(agents): Update the rules and rely on AGENTS.md
timothedelion a363cd7
chore(typing): Add Pydantic model for APITokenInfo
timothedelion ba986df
chore(Enum): Use Enum instead of plain strings
timothedelion 92c52b1
feat(tools): Make the applied filters explicit as a return to the model
timothedelion 7e64584
This is a combination of 2 commits.
timothedelion b9c91a9
chore(typing): Add Pydantic models for tools return : remediate and list
timothedelion c8c5ac1
chore(typing): Add Pydantic models for all tools
timothedelion d4d072d
fix(tests): Fix tests
timothedelion 557d221
chore(agents): Update python version in AGENTS.md
timothedelion c0b12dd
fix(typing): Let the IDs being robust to both int and str case
timothedelion c56f342
feat(scripts): Make the run_tool script more exhaustive
timothedelion eb447ea
fix
timothedelion d6a3be5
fix
timothedelion 2d47351
fix
timothedelion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| @../cursor_rules.md | ||
| Rules for Claude are in @AGENTS.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # Project structure, technologies and architecture conventions | ||
|
|
||
| ## Technologies used | ||
|
|
||
|
|
||
| - **uv** - Fast Python package installer and resolver | ||
| - **Python 3.11** - Modern Python with type hints and performance improvements | ||
| - **FastMCP** - MCP server implementation | ||
| - **Pytest** - Testing framework with fixtures and plugins | ||
| - **Pydantic** - Data validation using Python type annotations | ||
| - **Structlog** - Structured logging for better observability | ||
|
|
||
| ## Dependencies Management | ||
|
|
||
| 1. **Use pyproject.toml with uv** | ||
| - Use `pyproject.toml` for dependency management, not requirements.txt | ||
| - Works well with `uv` for fast, reliable package management | ||
| - Properly specify dependencies with version constraints | ||
| - Use `uv sync` to install dependencies | ||
|
|
||
| 2. **Example pyproject.toml** | ||
| ```toml | ||
| [build-system] | ||
| requires = ["setuptools>=42", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "my-mcp-server" | ||
| version = "0.1.0" | ||
| description = "My MCP server" | ||
| requires-python = ">=3.9" | ||
| dependencies = [ | ||
| "mcp>=0.2.0", | ||
| "requests>=2.28.0", | ||
| ] | ||
| ``` | ||
|
|
||
| ## Server Implementation Guidelines | ||
|
|
||
| 1. **Do NOT use uvicorn or fastapi with MCP/FastMCP** | ||
| - MCP has its own server implementation | ||
| - FastMCP/MCP can run directly using `mcp.run()` with no need for external web servers | ||
| - Avoid adding uvicorn or fastapi to dependencies | ||
| - Do not use `uvicorn.run(...)` in code | ||
|
|
||
| 2. **Use the correct server method** | ||
| - Use `mcp.run()` to start the server (no additional parameters needed for stdio transport) | ||
| - Example: `mcp.run()` instead of `uvicorn.run(mcp.app, ...)` | ||
|
|
||
| 3. **Dependencies** | ||
| - Only include required dependencies | ||
| - For basic MCP implementation, only `mcp` or `fastmcp` and possibly `requests` are needed | ||
| - Do not include web server packages unnecessarily | ||
|
|
||
|
|
||
|
|
||
| ## Code Organization and Imports | ||
|
|
||
| 1. **Use `src` as the root code directory** | ||
| - Ensure all code is placed within the `src` directory | ||
| - Handle imports accordingly by using the appropriate package path | ||
| - Example: `from src.gitguardian.your_module import YourClass` | ||
|
|
||
| 2. **FastMCP imports must use the correct package path** | ||
| - All imports concerning FastMCP must be done under `mcp.server.fastmcp` | ||
| - Example: `from mcp.server.fastmcp import FastMCP` instead of direct imports | ||
|
|
||
| This guide ensures all MCP implementations follow the project's standards of using native capabilities rather than external web servers. | ||
|
|
||
|
|
||
| # Lower level Python rules | ||
|
|
||
| ## General Guidelines | ||
|
|
||
| - Follow PEP 8 style guidelines | ||
| - Add docstrings to all public functions and classes | ||
| - Keep imports organized and sorted | ||
| - Don't use lazy/deferred imports, except inside Celery tasks definitions | ||
|
|
||
| ## Running tests | ||
|
|
||
| To run the tests, `uv run pytest` | ||
|
|
||
| ## Creating tests : | ||
|
|
||
| - We use pytest, and plain classes. Don't use unittest classes | ||
| - Use project fixtures (`test_account`, `owner_client`, `api_client`) instead of creating new instances | ||
| - file naming convention : `test_<whatever>.py` | ||
| - don't use self.assertEqual (and so on) helpers but only assert | ||
| - The docstring of every test function must follow this format : | ||
|
|
||
| ``` | ||
| """ | ||
| GIVEN ... | ||
| WHEN ... | ||
| THEN ... | ||
| """ | ||
| ``` | ||
|
|
||
| ## Variable names | ||
|
|
||
| Use clear variable and function names that indicate their purpose without being overly verbose. | ||
| Follow established conventions where appropriate (e.g., `i` for loop indices, `df` for dataframes), | ||
| but ensure non-standard names are self-explanatory. | ||
| For example, prefer `calculate_user_discount(price, user_tier)` over `calc(p, t)`, but `i` is perfectly fine for a simple loop counter. | ||
|
|
||
|
|
||
| ## **all** Lists | ||
|
|
||
| - Add an `__all__` list when using `import *` imports | ||
| - When provided, the `__all__ = []` list must be ordered alphabetically | ||
| - When adding new items to `__all__`, maintain alphabetical order | ||
| - Example: | ||
| ```python | ||
| __all__ = [ | ||
| "ClassA", | ||
| "ClassB", | ||
| "function_a", | ||
| "function_b", | ||
| ] | ||
| ``` | ||
|
|
||
| ## Typing | ||
|
|
||
| - Use typing for function signatures and return values | ||
| - Don't use `from typing import List` but rather `list` | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.