Custom instructions for the documentation agent. Allows users to customize: - File filtering (include/exclude patterns) - Module focus (prioritize certain modules) - Documentation type (API docs, architecture docs, etc.) - Custom instructions for the LLM Attrib
| 19 | |
| 20 | @dataclass |
| 21 | class AgentInstructions: |
| 22 | """ |
| 23 | Custom instructions for the documentation agent. |
| 24 | |
| 25 | Allows users to customize: |
| 26 | - File filtering (include/exclude patterns) |
| 27 | - Module focus (prioritize certain modules) |
| 28 | - Documentation type (API docs, architecture docs, etc.) |
| 29 | - Custom instructions for the LLM |
| 30 | |
| 31 | Attributes: |
| 32 | include_patterns: File patterns to include (e.g., ["*.cs", "*.py"]) |
| 33 | exclude_patterns: File/directory patterns to exclude (e.g., ["*Tests*", "*test*"]) |
| 34 | focus_modules: Modules to document in more detail |
| 35 | doc_type: Type of documentation to generate |
| 36 | custom_instructions: Additional instructions for the documentation agent |
| 37 | """ |
| 38 | include_patterns: Optional[List[str]] = None # e.g., ["*.cs"] for C# projects |
| 39 | exclude_patterns: Optional[List[str]] = None # e.g., ["*Tests*", "*Specs*"] |
| 40 | focus_modules: Optional[List[str]] = None # e.g., ["src/core", "src/api"] |
| 41 | doc_type: Optional[str] = None # e.g., "api", "architecture", "user-guide" |
| 42 | custom_instructions: Optional[str] = None # Free-form instructions |
| 43 | |
| 44 | def to_dict(self) -> dict: |
| 45 | """Convert to dictionary, excluding None values.""" |
| 46 | result = {} |
| 47 | if self.include_patterns: |
| 48 | result['include_patterns'] = self.include_patterns |
| 49 | if self.exclude_patterns: |
| 50 | result['exclude_patterns'] = self.exclude_patterns |
| 51 | if self.focus_modules: |
| 52 | result['focus_modules'] = self.focus_modules |
| 53 | if self.doc_type: |
| 54 | result['doc_type'] = self.doc_type |
| 55 | if self.custom_instructions: |
| 56 | result['custom_instructions'] = self.custom_instructions |
| 57 | return result |
| 58 | |
| 59 | @classmethod |
| 60 | def from_dict(cls, data: dict) -> 'AgentInstructions': |
| 61 | """Create AgentInstructions from dictionary.""" |
| 62 | return cls( |
| 63 | include_patterns=data.get('include_patterns'), |
| 64 | exclude_patterns=data.get('exclude_patterns'), |
| 65 | focus_modules=data.get('focus_modules'), |
| 66 | doc_type=data.get('doc_type'), |
| 67 | custom_instructions=data.get('custom_instructions'), |
| 68 | ) |
| 69 | |
| 70 | def is_empty(self) -> bool: |
| 71 | """Check if all fields are empty/None.""" |
| 72 | return not any([ |
| 73 | self.include_patterns, |
| 74 | self.exclude_patterns, |
| 75 | self.focus_modules, |
| 76 | self.doc_type, |
| 77 | self.custom_instructions, |
| 78 | ]) |
no outgoing calls
no test coverage detected