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