- Use correct anchoring logic: only patterns starting with '/' are anchored
- Fix test expectation for negation patterns to match Git behavior
- Apply code formatting
- Move escaped character handling after negation pattern detection
- Fix is_anchored logic to only check for leading "/" instead of any "/"
- Properly remove directory markers with removesuffix("/")
Addresses gitignore parsing issues mentioned in #348
Tokens: 1691910
Prompt (after initial instructions):
When the serena mcp server is started in ide-assistant mode and a project is passed, we should: │
│ │
│ 1. check the excluded tools from the project.yml. If no project.yml exists, there are no excluded tools there. You can use the Project or ProjectConfig classes for that. │
│ 2. exclude the tools there a-priori for the entire session, like the tools that are excluded from the context │
│ 3. exclude the activate_project tool │
│ │
│ The code modification should happen in SerenaAgent, the problematic block is here: │
│ │
│ # determine the base toolset defining the set of exposed tools (which e.g. the MCP shall see), │
│ # limited by the Serena config, the context (which is fixed for the session) and JetBrains mode │
│ tool_inclusion_definitions = [self.serena_config, self._context] │
│ if self.serena_config.jetbrains: │
│ tool_inclusion_definitions.append(SerenaAgentMode.from_name_internal("jetbrains")) │
│ self._base_tool_set = ToolSet.default().apply(*tool_inclusion_definitions) │
│ self._exposed_tools = {tc: t for tc, t in self._all_tools.items() if self._base_tool_set.includes_name(t.get_name())} │
│ log.info(f"Number of exposed tools: {len(self._exposed_tools)}") │
│ │
│ The exposed tools should be adjusted to reflect the logic I mentioned above
This command creates a SerenaAgent instance for a project and uses the InitialInstructionsTool
to output the system prompt/initial instructions. It follows the same pattern as the existing
index-project command and can be run with: uv run print-system-prompt [project_path]
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>