Reference
This section provides a comprehensive reference for all functions and classes in our project.
lampe
cli
commands
check_reviewed
check_reviewed(repo: Path = typer.Option(..., exists=True, file_okay=False, dir_okay=True, readable=True), repo_full_name: str | None = typer.Option(None, help='Repository full name (e.g. owner/repo)'), output: str = typer.Option('auto', help='Output provider (auto|console|github|gitlab|bitbucket)'), pr_number: int | None = typer.Option(None, '--pr', help='Pull request number (required for non-console providers)'))
Check if the token user has already reviewed this PR.
Returns exit code 0 if reviewed, 1 if not reviewed.
Source code in packages/lampe-cli/src/lampe/cli/commands/check_reviewed.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
describe
describe(repo: Path = typer.Option(..., exists=True, file_okay=False, dir_okay=True, readable=True), repo_full_name: str | None = typer.Option(None, help='Repository full name (e.g. owner/repo)'), base: str = typer.Option(..., help='Base commit SHA'), head: str = typer.Option(..., help='Head commit SHA'), title: str = typer.Option('Pull Request', help='PR title (local runs)'), output: str = typer.Option('auto', help='Output provider (auto|console|github|gitlab|bitbucket)'), variant: str = typer.Option('default', help='default|agentic'), files_exclude: list[str] | None = typer.Option(None, '--exclude'), files_reinclude: list[str] | None = typer.Option(None, '--reinclude'), truncation_tokens: int = typer.Option(DEFAULT_MAX_TOKENS, '--max-tokens'), timeout: int | None = typer.Option(None, '--timeout-seconds'), verbose: bool = typer.Option(False, '--verbose/--no-verbose'))
Generate a PR description and deliver it to the specified output provider.
Source code in packages/lampe-cli/src/lampe/cli/commands/describe.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
healthcheck
healthcheck() -> None
Check if the CLI is healthy and can connect to the configured provider.
Source code in packages/lampe-cli/src/lampe/cli/commands/healthcheck.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
review
review(repo: Path = typer.Option(..., exists=True, file_okay=False, dir_okay=True, readable=True), repo_full_name: str | None = typer.Option(None, help='Repository full name (e.g. owner/repo)'), base: str = typer.Option(..., help='Base commit SHA'), head: str = typer.Option(..., help='Head commit SHA'), title: str = typer.Option('Pull Request', help='PR title (local runs)'), output: str = typer.Option('auto', help='Output provider (auto|console|github|gitlab|bitbucket)'), review_depth: ReviewDepth = typer.Option(ReviewDepth.STANDARD, help='Review depth (basic|standard|comprehensive)'), variant: str = typer.Option('agentic', help='Review variant: agentic (full) or quick (only critical and high issues)'), guidelines: list[str] | None = typer.Option(None, '--guideline', help='Custom review guidelines (can be repeated)'), files_exclude: list[str] | None = typer.Option(None, '--exclude'), timeout: int | None = typer.Option(None, '--timeout-seconds'), verbose: bool = typer.Option(False, '--verbose/--no-verbose'))
Generate a PR code review and deliver it to the specified output provider.
Model selection is automatic based on review_depth: - basic: gpt-5-nano - standard: gpt-5 - comprehensive: gpt-5.1
Source code in packages/lampe-cli/src/lampe/cli/commands/review.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
entrypoint
version() -> None
Show version information.
Source code in packages/lampe-cli/src/lampe/cli/entrypoint.py
18 19 20 21 22 23 24 25 | |
orchestrators
pr_review
AgenticOrchestratorAdapter
Uses the agentic orchestrator workflow (intent, skills, validation agents).
QuickOrchestratorAdapter
Uses the quick review workflow (single agent, grep-first, Claude 4.5 with thinking).
providers
base
PRReviewPayload(reviews: list[AgentReviewOutput])
dataclass
json_payload() -> str
Return the payload as a JSON string.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
65 66 67 | |
Provider(repository: Repository, pull_request: PullRequest)
Bases: ABC
Abstract provider for delivering workflow outputs.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
83 84 85 | |
create_provider(provider_name: ProviderType | str, repository: Repository, pull_request: PullRequest) -> 'Provider'
staticmethod
Create a provider instance based on the specified type.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
deliver_pr_description(payload: PRDescriptionPayload) -> None
abstractmethod
Deliver a PR description to the configured destination.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
87 88 89 90 | |
deliver_pr_review(payload: PRReviewPayload) -> None
abstractmethod
Deliver a PR review to the configured destination.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
92 93 94 95 | |
detect_provider_type() -> ProviderType
staticmethod
Detect the appropriate provider type based on available environment variables.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
has_reviewed() -> bool
abstractmethod
Check if the token user has already reviewed this PR.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
102 103 104 105 | |
healthcheck() -> None
abstractmethod
Check if the provider is healthy and can connect to the service.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
97 98 99 100 | |
ProviderType
Bases: StrEnum
Available provider types.
update_or_add_text_between_tags(text: str, new_text: str, feature: str) -> str
Update the text between the tags and with new_text. If the tags don't exist, add them at the bottom of the text. The tags and new_text are preserved in the output.
Source code in packages/lampe-cli/src/lampe/cli/providers/base.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
bitbucket
BitbucketProvider(repository: Repository, pull_request: PullRequest)
Bases: Provider
Bitbucket provider for delivering PR descriptions to Bitbucket Cloud API.
Source code in packages/lampe-cli/src/lampe/cli/providers/bitbucket.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
deliver_pr_description(payload: PRDescriptionPayload) -> None
Update the PR description on Bitbucket.
Source code in packages/lampe-cli/src/lampe/cli/providers/bitbucket.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
deliver_pr_review(payload: PRReviewPayload) -> None
Post PR review comments on Bitbucket.
Source code in packages/lampe-cli/src/lampe/cli/providers/bitbucket.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
has_reviewed() -> bool
Check if the token user has already reviewed this PR.
Source code in packages/lampe-cli/src/lampe/cli/providers/bitbucket.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
healthcheck() -> None
Check if the Bitbucket provider is healthy and can connect to Bitbucket.
Source code in packages/lampe-cli/src/lampe/cli/providers/bitbucket.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
console
ConsoleProvider(repository: Repository, pull_request: PullRequest)
Bases: Provider
Console provider for delivering PR descriptions to stdout.
Source code in packages/lampe-cli/src/lampe/cli/providers/console.py
16 17 | |
deliver_pr_description(payload: PRDescriptionPayload) -> None
Print the PR description to console.
Source code in packages/lampe-cli/src/lampe/cli/providers/console.py
19 20 21 | |
deliver_pr_review(payload: PRReviewPayload) -> None
Print the PR review to console.
Source code in packages/lampe-cli/src/lampe/cli/providers/console.py
23 24 25 | |
has_reviewed() -> bool
Check if the token user has already reviewed this PR.
Source code in packages/lampe-cli/src/lampe/cli/providers/console.py
31 32 33 34 | |
healthcheck() -> None
Check if the console provider is healthy and can connect to the service.
Source code in packages/lampe-cli/src/lampe/cli/providers/console.py
27 28 29 | |
github
GitHubProvider(repository: Repository, pull_request: PullRequest)
Bases: Provider
GitHub provider for delivering PR descriptions to GitHub API.
Source code in packages/lampe-cli/src/lampe/cli/providers/github.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
deliver_pr_description(payload: PRDescriptionPayload) -> None
Update the PR description on GitHub.
Source code in packages/lampe-cli/src/lampe/cli/providers/github.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
deliver_pr_review(payload: PRReviewPayload) -> None
Post PR review comments on GitHub.
Source code in packages/lampe-cli/src/lampe/cli/providers/github.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
has_reviewed() -> bool
Check if the token user has already reviewed this PR.
Source code in packages/lampe-cli/src/lampe/cli/providers/github.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
healthcheck() -> None
Check if the GitHub provider is healthy and can connect to GitHub.
Source code in packages/lampe-cli/src/lampe/cli/providers/github.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
core
data_models
Issue
Bases: BaseModel
Individual issue to be resolved.
PullRequest
Bases: BaseModel
Pull request information.
Repository
Bases: BaseModel
Repository information.
issue
Issue
Bases: BaseModel
Individual issue to be resolved.
pull_request
PullRequest
Bases: BaseModel
Pull request information.
repository
Repository
Bases: BaseModel
Repository information.
gitconfig
init_git()
Initialize Git configuration and check version requirements.
Source code in src/lampe/core/gitconfig.py
58 59 60 61 | |
valid_git_version_available() -> bool
Check if the installed Git version meets the minimum requirement.
Returns:
| Type | Description |
|---|---|
bool
|
True if Git version meets requirement, False otherwise |
Source code in src/lampe/core/gitconfig.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
langfuseconfig
trace_span(func: Callable) -> Callable
Decorator that add any non auto-instrumented function to the langfuse trace.
Source code in src/lampe/core/langfuseconfig.py
67 68 69 70 71 72 73 74 75 76 77 | |
trace_with_function_name(func: Callable) -> Callable
Decorator that automatically updates the current trace with function name and metadata.
The decorated function should have a 'metadata' parameter to pass additional metadata to the trace.
Source code in src/lampe/core/langfuseconfig.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
llmconfig
get_model(env_var: str, default: str) -> str
Return model from env var or default. For use with LAMPE_MODEL_* variables.
Source code in src/lampe/core/llmconfig.py
18 19 20 | |
provider_from_model(model: str) -> str | None
Extract provider from LiteLLM model string (e.g. anthropic/claude-..., openai/gpt-...).
Source code in src/lampe/core/llmconfig.py
23 24 25 26 27 28 29 30 | |
parsers
MarkdownCodeBlockRemoverOutputParser
Bases: BaseOutputParser
Output parser that extracts and returns the content of markdown code blocks marked with 'md' or 'markdown'.
This parser is designed to process LLM outputs or other text that may contain markdown code blocks.
It specifically targets code blocks with the language tag 'md' or 'markdown', removing the code block
markers and returning only the inner content. If no such block is found, it falls back to extracting
a generic code block (```). If the result still contains any other code block (with a language tag),
it is preserved as-is. If no code block is found, the original text (stripped of leading/trailing whitespace)
is returned.
Edge Cases:
- If the input is an empty string, returns an empty string.
- If the input contains a code block with a language other than 'md' or 'markdown', it is preserved.
- If the input contains text before or after a markdown code block, only the content inside the block is returned.
- If the input contains an incomplete code block, returns the input with the trailing backticks removed if present.
Examples
Examples
>>> parser = MarkdownCodeBlockRemoverOutputParser()
>>> text = '''```md
... This is inside md block.
... ```'''
>>> parser.parse(text)
'This is inside md block.'
>>> text = '''```python
... Multiple lines
... are here.
... ```'''
>>> parser.parse(text)
'```python
Multiple lines are here. ```'
>>> text = 'No code block here.'
>>> parser.parse(text)
'No code block here.'
parse(output: str) -> str
Extracts and returns the content of a markdown code block marked with md ormarkdown from the input text.
If the input contains a markdown code block with language tag 'md' or 'markdown', the content inside that block is returned, with the code block markers removed. If no such block is found, but a generic code block (```) is present, its content is returned. If the result still contains any other code block (with a language tag), it is preserved as-is. If no code block is found, the original text (stripped of leading/trailing whitespace) is returned.
Source code in src/lampe/core/parsers/markdown_code_block_remover_output.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
YAMLPydanticOutputParser
Bases: PydanticOutputParser[Model], Generic[Model]
A parser that extracts and validates YAML content using Pydantic models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_cls
|
Pydantic output class used for validation |
required | |
excluded_schema_keys_from_format
|
Schema keys to exclude from format string, by default None |
required | |
pydantic_format_tmpl
|
Template for format string, by default PYDANTIC_FORMAT_TMPL |
required |
Notes
This parser extracts YAML content from markdown code blocks, validates the structure using a Pydantic model, and returns the validated data. It first looks for YAML-specific code blocks, then falls back to any code block if needed.
format_string: str
property
Get the format string that instructs the LLM how to output YAML.
This method will provide a format string that includes the Pydantic model's JSON schema converted to a YAML example, helping the LLM understand the expected output structure.
Returns:
| Type | Description |
|---|---|
str
|
Format string with YAML schema example |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
The method is not yet implemented |
parse(text: str) -> Model
Extract, parse and validate YAML content using the configured Pydantic model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw text containing YAML content in markdown code blocks |
required |
Returns:
| Type | Description |
|---|---|
Model
|
Validated data matching the Pydantic model structure |
Raises:
| Type | Description |
|---|---|
YAMLParsingError
|
If no valid YAML content is found in the text or if the YAML parsing fails due to syntax errors |
ValidationError
|
If the data does not match the Pydantic model schema |
Source code in src/lampe/core/parsers/yaml_pydantic_output.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
markdown_code_block_remover_output
MarkdownCodeBlockRemoverOutputParser
Bases: BaseOutputParser
Output parser that extracts and returns the content of markdown code blocks marked with 'md' or 'markdown'.
This parser is designed to process LLM outputs or other text that may contain markdown code blocks.
It specifically targets code blocks with the language tag 'md' or 'markdown', removing the code block
markers and returning only the inner content. If no such block is found, it falls back to extracting
a generic code block (```). If the result still contains any other code block (with a language tag),
it is preserved as-is. If no code block is found, the original text (stripped of leading/trailing whitespace)
is returned.
Edge Cases:
- If the input is an empty string, returns an empty string.
- If the input contains a code block with a language other than 'md' or 'markdown', it is preserved.
- If the input contains text before or after a markdown code block, only the content inside the block is returned.
- If the input contains an incomplete code block, returns the input with the trailing backticks removed if present.
Examples
Examples
>>> parser = MarkdownCodeBlockRemoverOutputParser()
>>> text = '''```md
... This is inside md block.
... ```'''
>>> parser.parse(text)
'This is inside md block.'
>>> text = '''```python
... Multiple lines
... are here.
... ```'''
>>> parser.parse(text)
'```python
Multiple lines are here. ```'
>>> text = 'No code block here.'
>>> parser.parse(text)
'No code block here.'
parse(output: str) -> str
Extracts and returns the content of a markdown code block marked with md ormarkdown from the input text.
If the input contains a markdown code block with language tag 'md' or 'markdown', the content inside that block is returned, with the code block markers removed. If no such block is found, but a generic code block (```) is present, its content is returned. If the result still contains any other code block (with a language tag), it is preserved as-is. If no code block is found, the original text (stripped of leading/trailing whitespace) is returned.
Source code in src/lampe/core/parsers/markdown_code_block_remover_output.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
utils
extract_md_code_block(output: str, language: str = '', match_any_language: bool = False) -> str | None
Extract markdown code block content from a string, handling nested code blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
str
|
The string to extract code block content from. |
required |
language
|
str
|
The language identifier for the code block (e.g., 'yaml', 'python', 'json'). |
''
|
match_any_language
|
bool
|
If True, the language of the code block is optional and the function will return the first code block found. |
False
|
Returns:
| Type | Description |
|---|---|
str | None
|
The extracted code block content, or the entire input if no language is specified or no matching code block is found. |
Notes
This function extracts content between {language} tags, preserving any nested
code blocks within the content. The regex pattern handles:
- Optional text before the code block
- Nested code blocks (e.g.json, python, inside the main block)
- Proper indentation of nested content
- Case-insensitive language tag matching
Examples:
>>> text = '''
... Some text
... ```yaml
... key: value
... nested: |
... ```python
... print("Hello")
... ```
... ```
... '''
>>> result = extract_md_code_block(text, 'yaml')
>>> print(result)
key: value
nested: |
```python
print("Hello")
```
Source code in src/lampe/core/parsers/utils.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
yaml_pydantic_output
YAMLParsingError
Bases: Exception
Raised when YAML parsing or validation fails.
YAMLPydanticOutputParser
Bases: PydanticOutputParser[Model], Generic[Model]
A parser that extracts and validates YAML content using Pydantic models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_cls
|
Pydantic output class used for validation |
required | |
excluded_schema_keys_from_format
|
Schema keys to exclude from format string, by default None |
required | |
pydantic_format_tmpl
|
Template for format string, by default PYDANTIC_FORMAT_TMPL |
required |
Notes
This parser extracts YAML content from markdown code blocks, validates the structure using a Pydantic model, and returns the validated data. It first looks for YAML-specific code blocks, then falls back to any code block if needed.
format_string: str
property
Get the format string that instructs the LLM how to output YAML.
This method will provide a format string that includes the Pydantic model's JSON schema converted to a YAML example, helping the LLM understand the expected output structure.
Returns:
| Type | Description |
|---|---|
str
|
Format string with YAML schema example |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
The method is not yet implemented |
parse(text: str) -> Model
Extract, parse and validate YAML content using the configured Pydantic model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw text containing YAML content in markdown code blocks |
required |
Returns:
| Type | Description |
|---|---|
Model
|
Validated data matching the Pydantic model structure |
Raises:
| Type | Description |
|---|---|
YAMLParsingError
|
If no valid YAML content is found in the text or if the YAML parsing fails due to syntax errors |
ValidationError
|
If the data does not match the Pydantic model schema |
Source code in src/lampe/core/parsers/yaml_pydantic_output.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
tools
TempGitRepository(repo_url: str, head_ref: str | None = None, base_ref: str | None = None, folder_name: str | None = None, sparse: bool = True, shallow: bool = True, blob_filter: bool = True, remove_existing: bool = True)
Context Manager for cloning and cleaning up a local clone of a repository
Uses partial clone optimizations including shallow clone, sparse checkout, and blob filtering to efficiently fetch only required content. Upon exit, will attempt to delete the cloned repository.
Attributes:
| Name | Type | Description |
|---|---|---|
repo_url |
Repository URL to clone |
|
head_ref |
Optional head ref to check out. |
|
folder_name |
Optional name prefix for temp directory |
|
sparse |
Enable sparse checkout mode to avoid populating all files initially. |
|
shallow |
Enable shallow clone (depth=1) to fetch only the target commit. |
|
blob_filter |
Enable blob filtering (--filter=blob:none) to fetch file contents on-demand |
|
remove_existing |
Remove existing directory if it exists |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Git version check fails |
GitCommandError
|
If clone operation fails |
UnableToDeleteError
|
If unable to delete the cloned repository |
Source code in src/lampe/core/tools/repository/management.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
clone_repo(repo_url: str, head_ref: str | None = None, base_ref: str | None = None, folder_name: str | None = None, sparse: bool = True, shallow: bool = True, blob_filter: bool = True, remove_existing: bool = True) -> str
Clone a repository optimized for PR review.
Uses partial clone optimizations including shallow clone, sparse checkout, and blob filtering to efficiently fetch only required content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_url
|
str
|
Repository URL to clone |
required |
head_ref
|
str | None
|
Head ref to checkout |
None
|
base_ref
|
str | None
|
Base ref to fetch for diff computation |
None
|
folder_name
|
str | None
|
Optional name prefix for temp directory |
None
|
sparse
|
bool
|
Enable sparse checkout mode to avoid populating all files initially |
True
|
shallow
|
bool
|
Enable shallow clone (depth=1) to fetch only the target commit |
True
|
blob_filter
|
bool
|
Enable blob filtering (--filter=blob:none) to fetch file contents on-demand |
True
|
remove_existing
|
bool
|
Remove existing directory if it exists |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the cloned repository |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Git version check fails |
GitCommandError
|
If clone operation fails |
Source code in src/lampe/core/tools/repository/management.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
get_diff_between_commits(base_hash: str, head_hash: str = 'HEAD', files_exclude_patterns: list[str] | None = None, files_include_patterns: list[str] | None = None, files_reinclude_patterns: list[str] | None = None, batch_size: int = 50, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Get the diff between two commits, optionally filtering files by glob patterns.
The filtering is done in a specific order to ensure correct pattern application: 1. First, if include patterns are provided, only files matching those patterns are kept 2. Then, exclude patterns are applied to filter out matching files 3. Finally, reinclude patterns can override the exclude patterns to bring back specific files
This order ensures that reinclude patterns only affect files that were actually excluded, preventing the reinclude of files that weren't matched by include patterns in the first place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_hash
|
str
|
Base commit hash to compare from |
required |
head_hash
|
str
|
Head commit hash to compare to. If not provided, uses HEAD |
'HEAD'
|
files_exclude_patterns
|
list[str] | None
|
List of glob patterns to exclude from the diff (relative to repo root). These patterns take precedence over include patterns. |
None
|
files_include_patterns
|
list[str] | None
|
List of glob patterns to include in the diff (relative to repo root). Note that exclude patterns will override these if there are conflicts. |
None
|
files_reinclude_patterns
|
list[str] | None
|
List of glob patterns to re-include files that were excluded by the exclude patterns. These patterns will only affect files that were previously excluded. |
None
|
repo_path
|
str
|
Path to the git repository |
'/tmp/'
|
batch_size
|
int
|
Number of files to process in each batch. |
50
|
include_line_numbers
|
bool
|
Whether to include line numbers in diff output (default: False) |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Diff as a string |
Raises:
| Type | Description |
|---|---|
DiffNotFoundError
|
If there is an unexpected git error |
Source code in src/lampe/core/tools/repository/diff.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
view_file(commit_hash: str, file_path: str, line_start: int | None = None, line_end: int | None = None, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Get file content from a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit_hash
|
str
|
Commit reference (e.g., "main", commit hash) |
required |
file_path
|
str
|
Path to the file within the repository |
required |
line_start
|
int | None
|
Line range start index (0-based) of head_content to extract content from |
None
|
line_end
|
int | None
|
Line range end index (0-based) of head_content to extract content to |
None
|
include_line_numbers
|
bool
|
Whether to prefix each line with its line number (default: False) |
False
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
File content as a string, empty string if file doesn't exist or line range is invalid |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If the file doesn't exist or any other git error occurs |
Source code in src/lampe/core/tools/repository/content.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
repository
FileDiffInfo
Bases: BaseModel
Information about a single file diff.
LocalCommitsAvailability(repo_path: str, commits: list[str])
Context manager to check if commits are available locally before git operations.
Checks if specified commits exist locally using git fsck --root and fetches
them if they're not present. This is useful for ensuring all required commits
are available before performing git operations that depend on them.
Attributes:
| Name | Type | Description |
|---|---|---|
repo_path |
Path to the git repository |
|
commits |
List of commit references to check and fetch if needed |
Source code in src/lampe/core/tools/repository/management.py
219 220 221 222 223 | |
TempGitRepository(repo_url: str, head_ref: str | None = None, base_ref: str | None = None, folder_name: str | None = None, sparse: bool = True, shallow: bool = True, blob_filter: bool = True, remove_existing: bool = True)
Context Manager for cloning and cleaning up a local clone of a repository
Uses partial clone optimizations including shallow clone, sparse checkout, and blob filtering to efficiently fetch only required content. Upon exit, will attempt to delete the cloned repository.
Attributes:
| Name | Type | Description |
|---|---|---|
repo_url |
Repository URL to clone |
|
head_ref |
Optional head ref to check out. |
|
folder_name |
Optional name prefix for temp directory |
|
sparse |
Enable sparse checkout mode to avoid populating all files initially. |
|
shallow |
Enable shallow clone (depth=1) to fetch only the target commit. |
|
blob_filter |
Enable blob filtering (--filter=blob:none) to fetch file contents on-demand |
|
remove_existing |
Remove existing directory if it exists |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Git version check fails |
GitCommandError
|
If clone operation fails |
UnableToDeleteError
|
If unable to delete the cloned repository |
Source code in src/lampe/core/tools/repository/management.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
clone_repo(repo_url: str, head_ref: str | None = None, base_ref: str | None = None, folder_name: str | None = None, sparse: bool = True, shallow: bool = True, blob_filter: bool = True, remove_existing: bool = True) -> str
Clone a repository optimized for PR review.
Uses partial clone optimizations including shallow clone, sparse checkout, and blob filtering to efficiently fetch only required content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_url
|
str
|
Repository URL to clone |
required |
head_ref
|
str | None
|
Head ref to checkout |
None
|
base_ref
|
str | None
|
Base ref to fetch for diff computation |
None
|
folder_name
|
str | None
|
Optional name prefix for temp directory |
None
|
sparse
|
bool
|
Enable sparse checkout mode to avoid populating all files initially |
True
|
shallow
|
bool
|
Enable shallow clone (depth=1) to fetch only the target commit |
True
|
blob_filter
|
bool
|
Enable blob filtering (--filter=blob:none) to fetch file contents on-demand |
True
|
remove_existing
|
bool
|
Remove existing directory if it exists |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the cloned repository |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Git version check fails |
GitCommandError
|
If clone operation fails |
Source code in src/lampe/core/tools/repository/management.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
fetch_commit_ref(repo_path: str, commit_ref: str) -> None
Fetch a base reference from the remote repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path
|
str
|
Path to the git repository |
required |
commit_ref
|
str
|
Commit reference to fetch (e.g., branch name, commit hash) |
required |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If the fetch operation fails |
Source code in src/lampe/core/tools/repository/management.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
find_files_by_pattern(pattern: str, repo_path: str = '/tmp/') -> str
Search for files using git ls-files and pattern matching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Pattern to search for (e.g. ".py", "src//.md") |
required |
repo_path
|
str
|
Path to git repository |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing matching file paths |
Source code in src/lampe/core/tools/repository/search.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
get_diff_between_commits(base_hash: str, head_hash: str = 'HEAD', files_exclude_patterns: list[str] | None = None, files_include_patterns: list[str] | None = None, files_reinclude_patterns: list[str] | None = None, batch_size: int = 50, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Get the diff between two commits, optionally filtering files by glob patterns.
The filtering is done in a specific order to ensure correct pattern application: 1. First, if include patterns are provided, only files matching those patterns are kept 2. Then, exclude patterns are applied to filter out matching files 3. Finally, reinclude patterns can override the exclude patterns to bring back specific files
This order ensures that reinclude patterns only affect files that were actually excluded, preventing the reinclude of files that weren't matched by include patterns in the first place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_hash
|
str
|
Base commit hash to compare from |
required |
head_hash
|
str
|
Head commit hash to compare to. If not provided, uses HEAD |
'HEAD'
|
files_exclude_patterns
|
list[str] | None
|
List of glob patterns to exclude from the diff (relative to repo root). These patterns take precedence over include patterns. |
None
|
files_include_patterns
|
list[str] | None
|
List of glob patterns to include in the diff (relative to repo root). Note that exclude patterns will override these if there are conflicts. |
None
|
files_reinclude_patterns
|
list[str] | None
|
List of glob patterns to re-include files that were excluded by the exclude patterns. These patterns will only affect files that were previously excluded. |
None
|
repo_path
|
str
|
Path to the git repository |
'/tmp/'
|
batch_size
|
int
|
Number of files to process in each batch. |
50
|
include_line_numbers
|
bool
|
Whether to include line numbers in diff output (default: False) |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Diff as a string |
Raises:
| Type | Description |
|---|---|
DiffNotFoundError
|
If there is an unexpected git error |
Source code in src/lampe/core/tools/repository/diff.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
get_diff_for_files(base_reference: str, file_paths: list[str] | None = None, head_reference: str = 'HEAD', repo_path: str = '/tmp/', batch_size: int = 50) -> str
Get the diff between two commits, optionally for specific files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_reference
|
str
|
Base commit reference (e.g., "main", commit hash) |
required |
file_paths
|
list[str] | None
|
List of file paths to get diff for |
None
|
head_reference
|
str
|
Head commit reference (e.g., "feature", commit hash). Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
batch_size
|
int
|
Number of files to process in each batch. |
50
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing diffs for specified files or all changed files |
Source code in src/lampe/core/tools/repository/diff.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
get_file_content_at_commit(commit_hash: str, file_path: str, line_start: int | None = None, line_end: int | None = None, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Get file content from a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit_hash
|
str
|
Commit reference (e.g., "main", commit hash) |
required |
file_path
|
str
|
Path to the file within the repository |
required |
line_start
|
int | None
|
Line range start index (0-based) of head_content to extract content from |
None
|
line_end
|
int | None
|
Line range end index (0-based) of head_content to extract content to |
None
|
include_line_numbers
|
bool
|
Whether to prefix each line with its line number (default: False) |
False
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
File content as a string, empty string if file doesn't exist or line range is invalid |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If the file doesn't exist or any other git error occurs |
Source code in src/lampe/core/tools/repository/content.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
is_sparse_clone(repo_path: str) -> bool
Check if a repository is a sparse clone.
A sparse clone is detected by checking multiple indicators: 1. If core.sparseCheckout is enabled 2. If .git/info/sparse-checkout file exists and has content
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path
|
str
|
Path to the git repository |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the repository appears to be a sparse clone, False otherwise |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If git commands fail |
Source code in src/lampe/core/tools/repository/management.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
list_changed_files(base_reference: str, head_reference: str = 'HEAD', repo_path: str = '/tmp/') -> str
List files changed between base reference and HEAD, with change stats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against HEAD |
required |
head_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against base reference. Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string listing changed files with status, additions/deletions and size Format: "[STATUS] filepath | +additions -deletions | sizeKB" STATUS is one of: A (added), D (deleted), M (modified) |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If there is an error executing git commands |
Source code in src/lampe/core/tools/repository/diff.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
list_changed_files_as_objects(base_reference: str, head_reference: str = 'HEAD', repo_path: str = '/tmp/') -> list[FileDiffInfo]
List files changed between base reference and HEAD as structured objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against HEAD |
required |
head_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against base reference. Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
list[FileDiffInfo]
|
List of FileDiffInfo objects for each changed file |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If there is an error executing git commands |
Source code in src/lampe/core/tools/repository/diff.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
list_directory_at_commit(relative_dir_path: str, commit_hash: str = 'HEAD', repo_path: str = '/tmp/') -> str
List directory contents at a specific commit (like ls).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relative_dir_path
|
str
|
Directory path relative to repository root (e.g. "src/", "." for repo root) |
required |
commit_hash
|
str
|
Commit reference to list at (e.g., "main", commit hash). Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted listing of entries: type (blob/tree), name, path. One per line. |
Source code in src/lampe/core/tools/repository/content.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
search_in_files(pattern: str, relative_dir_path: str, commit_reference: str, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Search for a pattern in files within a directory at a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Pattern to search for |
required |
relative_dir_path
|
str
|
Directory path to search in |
required |
commit_reference
|
str
|
Commit reference to search at |
required |
include_line_numbers
|
bool
|
Whether to include line numbers in search results (default: False) |
False
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Search results as a string |
Source code in src/lampe/core/tools/repository/search.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
show_commit(commit_reference: str, repo_path: str = '/tmp/') -> str
Show the contents of a commit.
This function shows the contents of a commit, including the commit details and diffs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit_reference
|
str
|
Commit reference (e.g., "main", commit hash) |
required |
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing commit details and diffs |
Source code in src/lampe/core/tools/repository/history.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
content
file_exists(file_path: str, commit_hash: str = 'HEAD', repo_path: str = '/tmp/') -> bool
Check if a file exists in a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the file within the repository |
required |
commit_hash
|
str
|
Commit reference to check (e.g., commit hash, branch name, tag). Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
bool
|
True if file exists in the commit, False otherwise |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If there is an unexpected git error |
Source code in src/lampe/core/tools/repository/content.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
get_file_content_at_commit(commit_hash: str, file_path: str, line_start: int | None = None, line_end: int | None = None, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Get file content from a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit_hash
|
str
|
Commit reference (e.g., "main", commit hash) |
required |
file_path
|
str
|
Path to the file within the repository |
required |
line_start
|
int | None
|
Line range start index (0-based) of head_content to extract content from |
None
|
line_end
|
int | None
|
Line range end index (0-based) of head_content to extract content to |
None
|
include_line_numbers
|
bool
|
Whether to prefix each line with its line number (default: False) |
False
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
File content as a string, empty string if file doesn't exist or line range is invalid |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If the file doesn't exist or any other git error occurs |
Source code in src/lampe/core/tools/repository/content.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
get_file_size_at_commit(file_path: str, commit_hash: str = 'HEAD', repo_path: str = '/tmp/') -> int
Get the size of a file at a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the file within the repository |
required |
commit_hash
|
str
|
Commit reference (e.g., "main", commit hash). Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
int
|
Size of the file in bytes |
Source code in src/lampe/core/tools/repository/content.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
list_directory_at_commit(relative_dir_path: str, commit_hash: str = 'HEAD', repo_path: str = '/tmp/') -> str
List directory contents at a specific commit (like ls).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relative_dir_path
|
str
|
Directory path relative to repository root (e.g. "src/", "." for repo root) |
required |
commit_hash
|
str
|
Commit reference to list at (e.g., "main", commit hash). Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted listing of entries: type (blob/tree), name, path. One per line. |
Source code in src/lampe/core/tools/repository/content.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
diff
FileDiffInfo
Bases: BaseModel
Information about a single file diff.
get_diff_between_commits(base_hash: str, head_hash: str = 'HEAD', files_exclude_patterns: list[str] | None = None, files_include_patterns: list[str] | None = None, files_reinclude_patterns: list[str] | None = None, batch_size: int = 50, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Get the diff between two commits, optionally filtering files by glob patterns.
The filtering is done in a specific order to ensure correct pattern application: 1. First, if include patterns are provided, only files matching those patterns are kept 2. Then, exclude patterns are applied to filter out matching files 3. Finally, reinclude patterns can override the exclude patterns to bring back specific files
This order ensures that reinclude patterns only affect files that were actually excluded, preventing the reinclude of files that weren't matched by include patterns in the first place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_hash
|
str
|
Base commit hash to compare from |
required |
head_hash
|
str
|
Head commit hash to compare to. If not provided, uses HEAD |
'HEAD'
|
files_exclude_patterns
|
list[str] | None
|
List of glob patterns to exclude from the diff (relative to repo root). These patterns take precedence over include patterns. |
None
|
files_include_patterns
|
list[str] | None
|
List of glob patterns to include in the diff (relative to repo root). Note that exclude patterns will override these if there are conflicts. |
None
|
files_reinclude_patterns
|
list[str] | None
|
List of glob patterns to re-include files that were excluded by the exclude patterns. These patterns will only affect files that were previously excluded. |
None
|
repo_path
|
str
|
Path to the git repository |
'/tmp/'
|
batch_size
|
int
|
Number of files to process in each batch. |
50
|
include_line_numbers
|
bool
|
Whether to include line numbers in diff output (default: False) |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Diff as a string |
Raises:
| Type | Description |
|---|---|
DiffNotFoundError
|
If there is an unexpected git error |
Source code in src/lampe/core/tools/repository/diff.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
get_diff_for_files(base_reference: str, file_paths: list[str] | None = None, head_reference: str = 'HEAD', repo_path: str = '/tmp/', batch_size: int = 50) -> str
Get the diff between two commits, optionally for specific files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_reference
|
str
|
Base commit reference (e.g., "main", commit hash) |
required |
file_paths
|
list[str] | None
|
List of file paths to get diff for |
None
|
head_reference
|
str
|
Head commit reference (e.g., "feature", commit hash). Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
batch_size
|
int
|
Number of files to process in each batch. |
50
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing diffs for specified files or all changed files |
Source code in src/lampe/core/tools/repository/diff.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
list_changed_files(base_reference: str, head_reference: str = 'HEAD', repo_path: str = '/tmp/') -> str
List files changed between base reference and HEAD, with change stats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against HEAD |
required |
head_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against base reference. Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string listing changed files with status, additions/deletions and size Format: "[STATUS] filepath | +additions -deletions | sizeKB" STATUS is one of: A (added), D (deleted), M (modified) |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If there is an error executing git commands |
Source code in src/lampe/core/tools/repository/diff.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
list_changed_files_as_objects(base_reference: str, head_reference: str = 'HEAD', repo_path: str = '/tmp/') -> list[FileDiffInfo]
List files changed between base reference and HEAD as structured objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against HEAD |
required |
head_reference
|
str
|
Git reference (commit hash, branch name, etc.) to compare against base reference. Defaults to "HEAD" |
'HEAD'
|
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
list[FileDiffInfo]
|
List of FileDiffInfo objects for each changed file |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If there is an error executing git commands |
Source code in src/lampe/core/tools/repository/diff.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
encoding
Encoding utilities for git command outputs.
sanitize_utf8(text: str) -> str
Sanitize a string to ensure it contains only valid UTF-8 characters.
This function handles surrogate pairs and other invalid UTF-8 sequences that can occur when processing file content from git commands. Surrogate pairs are common in binary files or files with incorrect encoding.
The function uses 'replace' error handling which replaces invalid sequences with the Unicode replacement character (U+FFFD).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to sanitize (may contain surrogate pairs or invalid UTF-8) |
required |
Returns:
| Type | Description |
|---|---|
str
|
Sanitized text containing only valid UTF-8 characters |
Examples:
>>> sanitize_utf8("Valid text")
'Valid text'
>>> sanitize_utf8("Text with surrogates: \udcff\udcfe")
'Text with surrogates:'
Source code in src/lampe/core/tools/repository/encoding.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
history
get_commit_log(max_count: int, repo_path: str = '/tmp/') -> str
Get the log of commits for a repository.
This function gets the log of commits for a repository, including the commit details and the list of files path that were changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_count
|
int
|
Maximum number of commits to return |
required |
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing commit details and list of files that were changed |
Source code in src/lampe/core/tools/repository/history.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
show_commit(commit_reference: str, repo_path: str = '/tmp/') -> str
Show the contents of a commit.
This function shows the contents of a commit, including the commit details and diffs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit_reference
|
str
|
Commit reference (e.g., "main", commit hash) |
required |
repo_path
|
str
|
Path to git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing commit details and diffs |
Source code in src/lampe/core/tools/repository/history.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
management
LocalCommitsAvailability(repo_path: str, commits: list[str])
Context manager to check if commits are available locally before git operations.
Checks if specified commits exist locally using git fsck --root and fetches
them if they're not present. This is useful for ensuring all required commits
are available before performing git operations that depend on them.
Attributes:
| Name | Type | Description |
|---|---|---|
repo_path |
Path to the git repository |
|
commits |
List of commit references to check and fetch if needed |
Source code in src/lampe/core/tools/repository/management.py
219 220 221 222 223 | |
TempGitRepository(repo_url: str, head_ref: str | None = None, base_ref: str | None = None, folder_name: str | None = None, sparse: bool = True, shallow: bool = True, blob_filter: bool = True, remove_existing: bool = True)
Context Manager for cloning and cleaning up a local clone of a repository
Uses partial clone optimizations including shallow clone, sparse checkout, and blob filtering to efficiently fetch only required content. Upon exit, will attempt to delete the cloned repository.
Attributes:
| Name | Type | Description |
|---|---|---|
repo_url |
Repository URL to clone |
|
head_ref |
Optional head ref to check out. |
|
folder_name |
Optional name prefix for temp directory |
|
sparse |
Enable sparse checkout mode to avoid populating all files initially. |
|
shallow |
Enable shallow clone (depth=1) to fetch only the target commit. |
|
blob_filter |
Enable blob filtering (--filter=blob:none) to fetch file contents on-demand |
|
remove_existing |
Remove existing directory if it exists |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Git version check fails |
GitCommandError
|
If clone operation fails |
UnableToDeleteError
|
If unable to delete the cloned repository |
Source code in src/lampe/core/tools/repository/management.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
clone_repo(repo_url: str, head_ref: str | None = None, base_ref: str | None = None, folder_name: str | None = None, sparse: bool = True, shallow: bool = True, blob_filter: bool = True, remove_existing: bool = True) -> str
Clone a repository optimized for PR review.
Uses partial clone optimizations including shallow clone, sparse checkout, and blob filtering to efficiently fetch only required content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_url
|
str
|
Repository URL to clone |
required |
head_ref
|
str | None
|
Head ref to checkout |
None
|
base_ref
|
str | None
|
Base ref to fetch for diff computation |
None
|
folder_name
|
str | None
|
Optional name prefix for temp directory |
None
|
sparse
|
bool
|
Enable sparse checkout mode to avoid populating all files initially |
True
|
shallow
|
bool
|
Enable shallow clone (depth=1) to fetch only the target commit |
True
|
blob_filter
|
bool
|
Enable blob filtering (--filter=blob:none) to fetch file contents on-demand |
True
|
remove_existing
|
bool
|
Remove existing directory if it exists |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the cloned repository |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Git version check fails |
GitCommandError
|
If clone operation fails |
Source code in src/lampe/core/tools/repository/management.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
fetch_commit_ref(repo_path: str, commit_ref: str) -> None
Fetch a base reference from the remote repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path
|
str
|
Path to the git repository |
required |
commit_ref
|
str
|
Commit reference to fetch (e.g., branch name, commit hash) |
required |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If the fetch operation fails |
Source code in src/lampe/core/tools/repository/management.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
is_sparse_clone(repo_path: str) -> bool
Check if a repository is a sparse clone.
A sparse clone is detected by checking multiple indicators: 1. If core.sparseCheckout is enabled 2. If .git/info/sparse-checkout file exists and has content
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_path
|
str
|
Path to the git repository |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the repository appears to be a sparse clone, False otherwise |
Raises:
| Type | Description |
|---|---|
GitCommandError
|
If git commands fail |
Source code in src/lampe/core/tools/repository/management.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
search
find_files_by_pattern(pattern: str, repo_path: str = '/tmp/') -> str
Search for files using git ls-files and pattern matching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Pattern to search for (e.g. ".py", "src//.md") |
required |
repo_path
|
str
|
Path to git repository |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string containing matching file paths |
Source code in src/lampe/core/tools/repository/search.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
search_in_files(pattern: str, relative_dir_path: str, commit_reference: str, include_line_numbers: bool = False, repo_path: str = '/tmp/') -> str
Search for a pattern in files within a directory at a specific commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
Pattern to search for |
required |
relative_dir_path
|
str
|
Directory path to search in |
required |
commit_reference
|
str
|
Commit reference to search at |
required |
include_line_numbers
|
bool
|
Whether to include line numbers in search results (default: False) |
False
|
repo_path
|
str
|
Path to the git repository, by default "/tmp/" |
'/tmp/'
|
Returns:
| Type | Description |
|---|---|
str
|
Search results as a string |
Source code in src/lampe/core/tools/repository/search.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
utils
truncate_to_token_limit(content: str, max_tokens: int) -> str
Truncate the content to the maximum number of tokens.
If the content is too long, truncate it to 200000 characters (3-4 characters per token)
before encoding for performance reasons.
We allow endoftext token to be encoded, since in the past we encountered issues with the tokenizer.
Args: content (str): The content to truncate. max_tokens (int): The maximum number of tokens to keep.
Returns: str: The truncated content.
Source code in src/lampe/core/utils/token.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
token
truncate_to_token_limit(content: str, max_tokens: int) -> str
Truncate the content to the maximum number of tokens.
If the content is too long, truncate it to 200000 characters (3-4 characters per token)
before encoding for performance reasons.
We allow endoftext token to be encoded, since in the past we encountered issues with the tokenizer.
Args: content (str): The content to truncate. max_tokens (int): The maximum number of tokens to keep.
Returns: str: The truncated content.
Source code in src/lampe/core/utils/token.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
describe
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
generate_pr_description(repository: Repository, pull_request: PullRequest, files_exclude_patterns: list[str] | None = None, files_reinclude_patterns: list[str] | None = None, truncation_tokens: int = MAX_TOKENS, timeout: int | None = None, verbose: bool = False, metadata: dict | None = None) -> PRDescriptionOutput
async
Generate a PR description.
This function generates a PR description for a given pull request. It uses the PRDescriptionWorkflow to generate the description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repository
|
Repository
|
The repository to generate the PR description for. |
required |
pull_request
|
PullRequest
|
The pull request to generate the PR description for. |
required |
files_exclude_patterns
|
list[str] | None
|
The glob matching patterns to exclude from the diff, by default None |
None
|
files_reinclude_patterns
|
list[str] | None
|
The glob matching patterns to re-include in the diff, by default None |
None
|
truncation_tokens
|
int
|
The maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
timeout
|
int | None
|
The timeout for the workflow, by default None |
None
|
verbose
|
bool
|
Whether to print verbose output, by default False |
False
|
metadata
|
dict | None
|
The metadata to use for the workflow, by default None |
None
|
Returns:
| Type | Description |
|---|---|
PRDescriptionOutput
|
The output containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
workflows
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
pr_description
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
data_models
PRDescriptionInput
Bases: BaseModel
Input for PR description generation workflow.
generation
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
generate_pr_description(repository: Repository, pull_request: PullRequest, files_exclude_patterns: list[str] | None = None, files_reinclude_patterns: list[str] | None = None, truncation_tokens: int = MAX_TOKENS, timeout: int | None = None, verbose: bool = False, metadata: dict | None = None) -> PRDescriptionOutput
async
Generate a PR description.
This function generates a PR description for a given pull request. It uses the PRDescriptionWorkflow to generate the description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repository
|
Repository
|
The repository to generate the PR description for. |
required |
pull_request
|
PullRequest
|
The pull request to generate the PR description for. |
required |
files_exclude_patterns
|
list[str] | None
|
The glob matching patterns to exclude from the diff, by default None |
None
|
files_reinclude_patterns
|
list[str] | None
|
The glob matching patterns to re-include in the diff, by default None |
None
|
truncation_tokens
|
int
|
The maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
timeout
|
int | None
|
The timeout for the workflow, by default None |
None
|
verbose
|
bool
|
Whether to print verbose output, by default False |
False
|
metadata
|
dict | None
|
The metadata to use for the workflow, by default None |
None
|
Returns:
| Type | Description |
|---|---|
PRDescriptionOutput
|
The output containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
review
AgenticReviewComplete
Bases: StopEvent
Complete event for agentic review workflow.
AgenticReviewStart
Bases: StartEvent
Start event for agentic review workflow.
generate_agentic_pr_review(repository: Repository, pull_request: PullRequest, review_depth: ReviewDepth = ReviewDepth.STANDARD, custom_guidelines: list[str] | None = None, files_exclude_patterns: list[str] | None = None, timeout: int | None = None, verbose: bool = False) -> AgenticReviewComplete
async
Generate a PR review using the agentic orchestrator workflow.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
workflows
AgenticReviewComplete
Bases: StopEvent
Complete event for agentic review workflow.
AgenticReviewStart
Bases: StartEvent
Start event for agentic review workflow.
generate_agentic_pr_review(repository: Repository, pull_request: PullRequest, review_depth: ReviewDepth = ReviewDepth.STANDARD, custom_guidelines: list[str] | None = None, files_exclude_patterns: list[str] | None = None, timeout: int | None = None, verbose: bool = False) -> AgenticReviewComplete
async
Generate a PR review using the agentic orchestrator workflow.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
agentic_review
Agentic review workflow with orchestrator, validation agents, and skill selection.
AgenticReviewComplete
Bases: StopEvent
Complete event for agentic review workflow.
AgenticReviewStart
Bases: StartEvent
Start event for agentic review workflow.
generate_agentic_pr_review(repository: Repository, pull_request: PullRequest, review_depth: ReviewDepth = ReviewDepth.STANDARD, custom_guidelines: list[str] | None = None, files_exclude_patterns: list[str] | None = None, timeout: int | None = None, verbose: bool = False) -> AgenticReviewComplete
async
Generate a PR review using the agentic orchestrator workflow.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
agentic_review_prompt
Prompts for the agentic review orchestrator.
agentic_review_workflow
Main agentic review orchestrator workflow.
AgenticReviewComplete
Bases: StopEvent
Complete event for agentic review workflow.
AgenticReviewStart
Bases: StartEvent
Start event for agentic review workflow.
AgenticReviewWorkflow(timeout: int | None = None, verbose: bool = False, *args: Any, **kwargs: Any)
Bases: Workflow
Orchestrator workflow for agentic review.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
149 150 151 152 153 154 155 156 157 158 159 160 | |
aggregate_and_deliver(ctx: Context, ev: ValidationsCompleteEvent) -> AgenticReviewComplete
async
Convert to AgentReviewOutput, run QA, deliver.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
extract_intent_and_select_skills(ctx: Context, ev: AgenticReviewStart) -> TasksPlannedEvent
async
Extract PR intent, discover/select skills, plan tasks.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
run_validations(ctx: Context, ev: TasksPlannedEvent) -> ValidationsCompleteEvent
async
Run all validation agents (parallel).
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
IntentExtractedEvent
Bases: Event
Event after intent extraction.
TasksPlannedEvent
Bases: Event
Event after task planning.
ValidationsCompleteEvent
Bases: Event
Event after all validations complete.
generate_agentic_pr_review(repository: Repository, pull_request: PullRequest, review_depth: ReviewDepth = ReviewDepth.STANDARD, custom_guidelines: list[str] | None = None, files_exclude_patterns: list[str] | None = None, timeout: int | None = None, verbose: bool = False) -> AgenticReviewComplete
async
Generate a PR review using the agentic orchestrator workflow.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/agentic_review_workflow.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
data_models
Data models for the agentic review workflow.
PRIntent
Bases: BaseModel
Extracted intent from the PR.
TaskPlanningOutput
Bases: BaseModel
Structured output from task planning.
ValidationAgentInput
Bases: BaseModel
Input for the validation agent.
ValidationAgentResponseModel
Bases: BaseModel
Pydantic model for validation agent JSON response parsing.
ValidationFinding
Bases: BaseModel
Structured finding from a validation agent.
ValidationResult
Bases: BaseModel
Output from a Validation Agent.
ValidationTask
Bases: BaseModel
Single task to send to a Validation Agent.
response_parse
Utilities for parsing LLM JSON responses with graceful handling of malformed output.
extract_json_from_llm_content(content: str) -> str
Extract JSON from LLM response, supporting markdown code blocks.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/response_parse.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
parse_validation_response(content: str) -> tuple[ValidationAgentResponseModel | None, bool]
Parse LLM content into ValidationAgentResponseModel.
Returns (parsed_model, success). On failure returns (None, False).
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/response_parse.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
run
CLI entry point for running the agentic PR review from JSON input.
main() -> None
Run agentic PR review from a JSON input file. Usage: generate_pr_review
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/run.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
skill_selector
Skill selector and discovery for agentic review.
SkillInfo
Bases: BaseModel
Metadata and content of a discovered skill.
discover_skills(repo_path: str) -> list[SkillInfo]
Find all SKILL.md files in the repository.
Scans for any SKILL.md file under the repo root. Skips directories: .git, node_modules, pycache, .venv, venv, .tox, dist, build.
Returns: List of SkillInfo with path, name, description, and full content.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/skill_selector/skill_discovery.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
select_applicable_skills(pr_intent: PRIntent, files_changed: str, skills: list[SkillInfo], llm: LiteLLM | None = None) -> list[SkillInfo]
async
Select which skills from the repo apply to this PR.
Do not call this when skills is empty - the workflow should skip skill selection.
Args: pr_intent: Extracted PR intent files_changed: List of changed files skills: List of discovered skills (must be non-empty) llm: Optional LLM instance
Returns: List of SkillInfo that apply to this PR
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/skill_selector/skill_selector_agent.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
skill_discovery
Discover SKILL.md files within the reviewed repository.
SkillInfo
Bases: BaseModel
Metadata and content of a discovered skill.
discover_skills(repo_path: str) -> list[SkillInfo]
Find all SKILL.md files in the repository.
Scans for any SKILL.md file under the repo root. Skips directories: .git, node_modules, pycache, .venv, venv, .tox, dist, build.
Returns: List of SkillInfo with path, name, description, and full content.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/skill_selector/skill_discovery.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
skill_selector_agent
Skill Selector Agent - selects which skills apply to a given PR.
SkillSelectionOutput
Bases: BaseModel
Structured output from the Skill Selector Agent.
select_applicable_skills(pr_intent: PRIntent, files_changed: str, skills: list[SkillInfo], llm: LiteLLM | None = None) -> list[SkillInfo]
async
Select which skills from the repo apply to this PR.
Do not call this when skills is empty - the workflow should skip skill selection.
Args: pr_intent: Extracted PR intent files_changed: List of changed files skills: List of discovered skills (must be non-empty) llm: Optional LLM instance
Returns: List of SkillInfo that apply to this PR
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/skill_selector/skill_selector_agent.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
skill_selector_prompt
Prompt for the Skill Selector Agent.
validation
Validation agents for task-based code verification.
BasicValidationAgent(*args, **kwargs)
Bases: ValidationAgent
Validation agent without skill content. Executes orchestrator-formulated tasks.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/basic_validation_agent.py
15 16 | |
SkillAugmentedValidationAgent(skill_content: str, *args, **kwargs)
Bases: ValidationAgent
Validation agent with skill content. The skill defines what to validate.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/skill_augmented_validation_agent.py
19 20 | |
basic_validation_agent
Basic validation agent - no skill augmentation.
BasicValidationAgent(*args, **kwargs)
Bases: ValidationAgent
Validation agent without skill content. Executes orchestrator-formulated tasks.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/basic_validation_agent.py
15 16 | |
ValidationAgentComplete
Bases: StopEvent
Stop event for validation agent.
ValidationAgentStart
Bases: StartEvent
Start event for validation agent.
skill_augmented_validation_agent
Skill-augmented validation agent - with domain-specific skill content.
SkillAugmentedValidationAgent(skill_content: str, *args, **kwargs)
Bases: ValidationAgent
Validation agent with skill content. The skill defines what to validate.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/skill_augmented_validation_agent.py
19 20 | |
ValidationAgentComplete
Bases: StopEvent
Stop event for validation agent.
ValidationAgentStart
Bases: StartEvent
Start event for validation agent.
validation_agent
Base validation agent - task-based verification.
ValidationAgent(skill_content: str = '', llm: LiteLLM | None = None, *args: Any, **kwargs: Any)
Bases: FunctionCallingAgent
Base validation agent that executes a single verification task.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/validation_agent.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
handle_agent_completion(ctx: Context, ev: AgentCompleteEvent) -> ValidationAgentComplete
async
Parse agent output into ValidationResult.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/validation_agent.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
setup_query_and_tools(ctx: Context, ev: ValidationAgentStart) -> UserInputEvent
async
Setup the validation task and tools.
Source code in packages/lampe-review/src/lampe/review/workflows/agentic_review/validation/validation_agent.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
ValidationAgentComplete
Bases: StopEvent
Stop event for validation agent.
ValidationAgentStart
Bases: StartEvent
Start event for validation agent.
validation_agent_prompt
Prompt for validation agents (task-based verification).
pr_review
Shared data models and LLM aggregation for PR review (used by agentic workflow).
agents
Mute-issue aggregation agent used by the agentic review LLM aggregation step.
MuteIssueAggregationAgent(*args: Any, **kwargs: Any)
Bases: FunctionCallingAgent
Agent that runs mute_issue tool calls and stores results in context.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/agents/mute_issue_aggregation_agent.py
50 51 52 53 54 55 56 57 | |
setup(ctx: WorkflowContext, ev: MuteIssueStart) -> UserInputEvent
async
Convert input to user prompt for the agent.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/agents/mute_issue_aggregation_agent.py
59 60 61 62 | |
MuteIssueStart
Bases: StartEvent
Start event for mute-issue aggregation.
mute_issue_aggregation_agent
Agent that runs mute_issue tool calls for cleaning and deduplicating review comments.
MuteIssueAggregationAgent(*args: Any, **kwargs: Any)
Bases: FunctionCallingAgent
Agent that runs mute_issue tool calls and stores results in context.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/agents/mute_issue_aggregation_agent.py
50 51 52 53 54 55 56 57 | |
setup(ctx: WorkflowContext, ev: MuteIssueStart) -> UserInputEvent
async
Convert input to user prompt for the agent.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/agents/mute_issue_aggregation_agent.py
59 60 61 62 | |
MuteIssueStart
Bases: StartEvent
Start event for mute-issue aggregation.
mute_issue_aggregation_agent_prompt
Prompt for mute-issue aggregation agent that cleans and deduplicates review comments.
data_models
AgentReviewOutput
Bases: BaseModel
Output from individual specialized agents.
to_lightweight_dict() -> dict[str, Any]
Convert to dictionary with lightweight sources for aggregation.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/data_models.py
143 144 145 146 147 148 149 150 151 152 153 154 155 | |
FileReview
Bases: BaseModel
Review for a specific file with inline comments.
IssueWithId
Bases: BaseModel
Single issue with its mute ID, for use in aggregator/hallucination prompts.
build_from_agent_reviews(reviews: list[AgentReviewOutput]) -> list[IssueWithId]
classmethod
Build IssueWithId list from agent reviews. Reusable for aggregator and hallucination filter.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/data_models.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
format_list_for_prompt(issues: list[IssueWithId]) -> str
staticmethod
Format a list of issues as markdown for the LLM prompt.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/data_models.py
126 127 128 129 130 131 | |
to_markdown_block() -> str
Format this issue as a markdown block for LLM prompts.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/data_models.py
82 83 84 85 86 87 88 89 90 91 92 | |
LightweightToolSource
Bases: BaseModel
Lightweight version of ToolSource without tool_output for aggregation.
PRReivewAggregatorOutput
Bases: BaseModel
Output model for PR review aggregation.
PRReviewInput
Bases: BaseModel
Input for PR review generation workflow.
ReviewComment
Bases: BaseModel
Structured comment with metadata.
ReviewDepth
Bases: str, Enum
Review depth levels for PR reviews.
llm_aggregation_step
LLM-based aggregation workflow for cleaning and deduplicating review comments.
Uses a tool-based approach: the LLM calls mute_issue(issue_id) for each issue to mute. Original reviews are kept with muted flags applied.
LLMAggregationCompleteEvent
Bases: StopEvent
Complete event for LLM aggregation workflow.
LLMAggregationStartEvent
Bases: StartEvent
Start event for LLM aggregation workflow.
LLMAggregationWorkflow(timeout: int | None = None, verbose: bool = False, max_tool_iterations: int = 5, llm: Any | None = None, *args: Any, **kwargs: Any)
Bases: Workflow
Workflow for aggregating and cleaning review comments using LLM tool calls.
The LLM calls mute_issue(issue_id) for each issue to mute. Original reviews are preserved with muted flags applied based on tool calls.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/llm_aggregation_step.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
aggregate_reviews(ctx: WorkflowContext, ev: LLMAggregationStartEvent) -> LLMAggregationCompleteEvent
async
Aggregate and clean reviews using LLM with mute_issue tool calls.
Source code in packages/lampe-review/src/lampe/review/workflows/pr_review/llm_aggregation_step.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
quick_review
Quick review workflow — context-window-aware, grep-first, Claude 4.5 with extended thinking.
QuickReviewComplete
Bases: StopEvent
Complete event for quick review workflow.
QuickReviewStart
Bases: StartEvent
Start event for quick review workflow.
generate_quick_pr_review(repository: Repository, pull_request: PullRequest, timeout: int | None = None, verbose: bool = False) -> QuickReviewComplete
async
Generate a quick PR review using the single-agent quick review workflow.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_workflow.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
hallucination_filter_prompt
Prompt for hallucination filter — mutes comments that ask the user to investigate instead of stating verified bugs.
hallucination_filter_step
Hallucination filter step — uses cheap LLM with mute_issue tool to remove investigation-request comments.
HallucinationFilterCompleteEvent
Bases: StopEvent
Complete event for hallucination filter.
HallucinationFilterStartEvent
Bases: StartEvent
Start event for hallucination filter.
HallucinationFilterWorkflow(timeout: int | None = None, verbose: bool = False, max_tool_iterations: int = 5, llm: Any | None = None, *args: Any, **kwargs: Any)
Bases: Workflow
Workflow to mute investigation-request comments using a cheap LLM and mute_issue tool.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/hallucination_filter_step.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
filter_hallucinations(ctx: WorkflowContext, ev: HallucinationFilterStartEvent) -> HallucinationFilterCompleteEvent
async
Run hallucination filter: mute comments that ask reader to investigate.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/hallucination_filter_step.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
quick_review_agent
Quick review agent — context-window-aware, grep-first with env-configurable model.
QuickReviewAgent(llm: LiteLLM | None = None, *args: Any, **kwargs: Any)
Bases: FunctionCallingAgent
Lightweight review agent: grep-first, small reads. Model via LAMPE_MODEL_QUICK_REVIEW.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_agent.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
handle_agent_completion(ctx: Context, ev: AgentCompleteEvent) -> ValidationAgentComplete
async
Parse agent output into ValidationResult.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_agent.py
98 99 100 101 102 103 104 105 106 107 108 | |
setup_query_and_tools(ctx: Context, ev: QuickReviewAgentStart) -> UserInputEvent
async
Setup the quick review query and pre-fill tool params.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_agent.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
QuickReviewAgentStart
Bases: StartEvent
Start event for quick review agent.
QuickReviewInput(repo_path: str, base_commit: str, head_commit: str, files_changed: str)
Input for quick review (no task — agent thinks about what to verify).
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_agent.py
34 35 36 37 38 39 40 41 42 43 44 | |
quick_review_agent_prompt
Prompt for quick review agent — context-window-aware, single-file diff + targeted investigation.
quick_review_workflow
Quick review workflow — single agent, grep-first, minimal context.
QuickReviewComplete
Bases: StopEvent
Complete event for quick review workflow.
QuickReviewStart
Bases: StartEvent
Start event for quick review workflow.
QuickReviewWorkflow(timeout: int | None = None, verbose: bool = False, *args, **kwargs)
Bases: Workflow
Simple workflow: list files → run quick review agent → convert to AgentReviewOutput.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_workflow.py
46 47 48 49 50 51 52 53 54 55 | |
run_quick_review(ctx: Context, ev: QuickReviewStart) -> QuickReviewComplete
async
Run the quick review agent on changed files.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_workflow.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
generate_quick_pr_review(repository: Repository, pull_request: PullRequest, timeout: int | None = None, verbose: bool = False) -> QuickReviewComplete
async
Generate a quick PR review using the single-agent quick review workflow.
Source code in packages/lampe-review/src/lampe/review/workflows/quick_review/quick_review_workflow.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
template
TemplateWorkflow
Bases: Workflow
A template workflow that demonstrates basic workflow structure.
This workflow is responsible for: - Demonstrating the basic workflow pattern - Showing how to handle events - Providing a template for new workflows
template_workflow
TemplateWorkflow
Bases: Workflow
A template workflow that demonstrates basic workflow structure.
This workflow is responsible for: - Demonstrating the basic workflow pattern - Showing how to handle events - Providing a template for new workflows