MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / from_cli

Method from_cli

codewiki/src/config.py:158–223  ·  view source on GitHub ↗

Create configuration for CLI context. Args: repo_path: Repository path output_dir: Output directory for generated docs llm_base_url: LLM API base URL llm_api_key: LLM API key main_model: Primary model cluster_m

(
        cls,
        repo_path: str,
        output_dir: str,
        llm_base_url: str,
        llm_api_key: str,
        main_model: str,
        cluster_model: str,
        fallback_model: str = FALLBACK_MODEL_1,
        provider: str = "openai-compatible",
        aws_region: str = "us-east-1",
        api_version: str = "2024-12-01-preview",
        azure_deployment: str = "",
        max_tokens: int = DEFAULT_MAX_TOKENS,
        max_token_per_module: int = DEFAULT_MAX_TOKEN_PER_MODULE,
        max_token_per_leaf_module: int = DEFAULT_MAX_TOKEN_PER_LEAF_MODULE,
        max_depth: int = MAX_DEPTH,
        agent_instructions: Optional[Dict[str, Any]] = None
    )

Source from the content-addressed store, hash-verified

156 if self.agent_instructions:
157 return self.agent_instructions.get("include_patterns")
158 return None
159
160 @property
161 def exclude_patterns(self) -> list[str] | None:
162 """Get file exclude patterns from agent instructions."""
163 if self.agent_instructions:
164 return self.agent_instructions.get("exclude_patterns")
165 return None
166
167 @property
168 def focus_modules(self) -> list[str] | None:
169 """Get focus modules from agent instructions."""
170 if self.agent_instructions:
171 return self.agent_instructions.get("focus_modules")
172 return None
173
174 @property
175 def doc_type(self) -> str | None:
176 """Get documentation type from agent instructions."""
177 if self.agent_instructions:
178 return self.agent_instructions.get("doc_type")
179 return None
180
181 @property
182 def custom_instructions(self) -> str | None:
183 """Get custom instructions from agent instructions."""
184 if self.agent_instructions:
185 return self.agent_instructions.get("custom_instructions")
186 return None
187
188 @property
189 def language(self) -> str | None:
190 """Output language of the generated docs (None means English)."""
191 if self.agent_instructions:
192 return normalize_language(self.agent_instructions.get("language"))
193 return None
194
195 def get_prompt_addition(self) -> str:
196 """Generate prompt additions based on agent instructions."""
197 if not self.agent_instructions:
198 return ""
199
200 additions = []
201
202 # First, so it is not outweighed by the English prompts around it
203 if self.language:
204 additions.append(format_language_directive(self.language))
205
206 if self.doc_type:
207 doc_type_instructions = {
208 "api": "Focus on API documentation: endpoints, parameters, return types, and usage examples.",
209 "architecture": "Focus on architecture documentation: system design, component relationships, and data flow.",
210 "user-guide": "Focus on user guide documentation: how to use features, step-by-step tutorials.",
211 "developer": "Focus on developer documentation: code structure, contribution guidelines, and implementation details.",
212 }
213 if self.doc_type.lower() in doc_type_instructions:
214 additions.append(doc_type_instructions[self.doc_type.lower()])
215 else:

Callers 3

generateMethod · 0.80
to_backend_configMethod · 0.80
_legacy_generate_docsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected