feat: implement basic lesson system with metadata and auto-inclusion#687
feat: implement basic lesson system with metadata and auto-inclusion#687
Conversation
Implements Phase 1 of the enhanced lesson system (#686): Core Components: - Parser: Parse lessons with YAML frontmatter (match.keywords) - Index: Discover and index lessons from configured directories - Matcher: Match lessons based on context (message content, keywords) - Auto-include: Automatically include relevant lessons in context - Commands: CLI commands (/lesson list, /lesson search, /lesson show) Features: - YAML frontmatter with extensible match.keywords structure - Backward compatible with lessons without frontmatter - Inferred metadata (title, description, category) - Simple keyword matching for Phase 1 - Ready for future extensions (globs, semantic matching) Example lesson format: --- match: keywords: [patch, file, editing] --- # Lesson Title Lesson content... Tested with gptme-bob workspace lessons (21 lessons indexed). Related: #686
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 4843011 in 52 seconds. Click for details.
- Reviewed
728lines of code in6files - Skipped
0files when reviewing. - Skipped posting
6draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. gptme/lessons/auto_include.py:62
- Draft comment:
Consider explicitly annotating the type of 'matches' (e.g. list of MatchResult) to improve clarity. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2. gptme/lessons/auto_include.py:83
- Draft comment:
Consider narrowing the exception handling or logging the full traceback to improve debugging in case of errors. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. gptme/lessons/commands.py:140
- Draft comment:
For lesson search, consider paginating results or providing additional navigation if more than 10 lessons match. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
4. gptme/lessons/index.py:119
- Draft comment:
Consider using case-insensitive comparisons in get_by_category and find_by_keywords to ensure consistent matching behavior. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
5. gptme/lessons/matcher.py:56
- Draft comment:
Document and/or add tests for future matching criteria (e.g., tools, glob, semantic) to guide further development. - Reason this comment was not posted:
Confidence changes required:20%<= threshold50%None
6. gptme/lessons/parser.py:106
- Draft comment:
Validate that the 'keywords' extracted from YAML frontmatter is a list to prevent potential type issues if the data is not formatted as expected. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
Workflow ID: wflow_DuzD3o3Nz5ds5rGG
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Implements lesson system as a ToolSpec following gptme tool pattern - Uses MESSAGE_PRE_PROCESS hook for automatic lesson inclusion - Registers /lesson command through tool system - Imports from gptme.lessons module for core functionality - Auto-discovered by tool loading system - Configuration via environment variables: - GPTME_LESSONS_AUTO_INCLUDE (default: true) - GPTME_LESSONS_MAX_INCLUDED (default: 5) Completes the lesson system integration with gptme's tool architecture.
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed dc653f6 in 1 minute and 18 seconds. Click for details.
- Reviewed
178lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. gptme/tools/lessons.py:108
- Draft comment:
Ensure that 'match.matched_by' is always a list of strings; consider adding type-checking or a default to prevent join errors. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_3RQiWfVMy2x1sAZs
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
- Add test_lessons_commands.py with 31 tests covering all command functionality - Add test_lessons_tool.py with 20 tests covering tool integration - Coverage improvements: - gptme/lessons/commands.py: 13% → 98% - gptme/tools/lessons.py: 24% → 96% - Overall lesson system: 24% → 61% Tests cover: - Command parsing and dispatch (list, search, show, refresh) - Auto-include hooks with configuration - Lesson formatting and display - Error handling and edge cases - Tool specification and registration
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 8a28b6d in 50 seconds. Click for details.
- Reviewed
753lines of code in2files - Skipped
0files when reviewing. - Skipped posting
6draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/test_lessons_commands.py:22
- Draft comment:
Ensure the type hint 'list[str] | None' is supported on your targeted Python version (3.10+); otherwise, consider a compatible syntax. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
2. tests/test_lessons_commands.py:208
- Draft comment:
The test for search limits relies on exact formatting ('... and 5 more'). Consider using a regex or more flexible assertion to avoid brittleness if formatting changes. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
3. tests/test_lessons_commands.py:386
- Draft comment:
Verify that error messages for unknown subcommands remain consistent between tests and implementation. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
4. tests/test_lessons_tool.py:149
- Draft comment:
In test_hook_limits_max_lessons, the test relies on exact string matching for lesson titles. Consider abstracting the formatting to reduce brittleness in case the output format changes. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
5. tests/test_lessons_tool.py:197
- Draft comment:
Consider adding a test case where lessons exist and an invalid max lessons config value is provided, to verify that the default (e.g., 5) is used instead of returning no output. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
6. tests/test_lessons_tool.py:327
- Draft comment:
Using module reload in test_tool_availability_depends_on_module is effective but ensure it does not impact global state for other tests. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
Workflow ID: wflow_q5sJLVQ5tU9PgwyM
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
- Add test_lessons_parser.py with 28 tests covering parser functionality - Coverage improvement: gptme/lessons/parser.py: 36% → 96% - Overall lesson system: 61% → 69% (approaching 70% goal) Tests cover: - Title extraction from markdown - Description extraction with edge cases - Lesson parsing with/without YAML frontmatter - Error handling (file not found, invalid YAML) - Unicode content and complex structures - Dataclass validation
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 70819a6 in 58 seconds. Click for details.
- Reviewed
376lines of code in1files - Skipped
0files when reviewing. - Skipped posting
7draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/test_lessons_parser.py:16
- Draft comment:
TestExtractTitle covers various cases (whitespace, missing header) effectively. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. tests/test_lessons_parser.py:50
- Draft comment:
TestExtractDescription robustly verifies paragraph extraction and skipping empty lines. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. tests/test_lessons_parser.py:123
- Draft comment:
test_parse_lesson_with_frontmatter correctly parses and strips YAML frontmatter and extracts metadata. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
4. tests/test_lessons_parser.py:196
- Draft comment:
test_parse_lesson_invalid_yaml robustly checks error handling for malformed YAML frontmatter. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
5. tests/test_lessons_parser.py:215
- Draft comment:
Simulating the absence of PyYAML with patch is a clever approach to test dependency error handling. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
6. tests/test_lessons_parser.py:316
- Draft comment:
The malformed frontmatter test confirms fallback to regular content parsing; consider additional tests for varied malformed delimiter scenarios. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
7. tests/test_lessons_parser.py:339
- Draft comment:
Dataclass tests effectively ensure proper initialization of Lesson and LessonMetadata. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_xA4m4LTXICk8umdB
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
- Add test_lessons_matcher.py with 13 tests covering matching functionality - Coverage improvement: gptme/lessons/matcher.py: 42% → 100% - Overall lesson system: 69% → 75% (exceeded 70% goal!) Tests cover: - Keyword-based matching with scoring - Case-insensitive matching - Threshold-based filtering - Score-based sorting - Multiple lesson matching - Explicit keyword matching Final PR #687 status: - Created 92 comprehensive tests (31+20+28+13) - Improved coverage from 24% to 75% - Five modules at 96-100% coverage
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 3ec306b in 32 seconds. Click for details.
- Reviewed
237lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/test_lessons_matcher.py:136
- Draft comment:
Consider asserting the exact expected score (e.g. 3.0) instead of using a '> 2.0' check for clarity in the threshold test. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
2. tests/test_lessons_matcher.py:1
- Draft comment:
Overall, the tests provide comprehensive coverage. As an improvement suggestion, consider using parameterized tests to reduce duplication for similar matching scenarios. - Reason this comment was not posted:
Confidence changes required:30%<= threshold50%None
Workflow ID: wflow_K2af3np2vWbrcTlk
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
ErikBjare
left a comment
There was a problem hiding this comment.
Looks okay for merge, but should fix the review comments I left. I think some of the tests are excessive and unnecessary, you were really coverage-maxing to a fault I think.
- Extract and display code suggestions from review comment bodies - Rewrite tests to use real GitHub API calls instead of mocking - Test against actual PR #687 with review comments and suggestions - Remove mock dependencies from tests All tests pass with real API validation.
…ead_pr tool Comprehensive enhancement of GitHub PR reading capabilities: 1. Code Context Snippets (gh.py) - Extract diff_hunk from review comments - Display 3-10 lines of code context around commented lines - Remove diff markers for clean display 2. Code Suggestion Extraction (gh.py) - Detect and parse ```suggestion blocks from comment bodies - Format with syntax highlighting 3. New read_pr Tool Command (tools/gh.py) - Single command for agents to get full PR context - Syntax: gh read_pr <pr_url> - Returns all PR info: description, comments, review comments, suggestions - Proper error handling for invalid URLs 4. Comprehensive Testing - Real GitHub API tests (no mocking) - Tests against actual PR #687 - 7 tests covering all functionality - Proper type handling for ExecuteFunc Closes #688
- Use logger.exception instead of logger.warning for better debugging - Remove duplicated help text from lesson() docstring - Remove command usage from tool instructions (not needed by LLM)
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 99ec82e in 44 seconds. Click for details.
- Reviewed
52lines of code in2files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. gptme/lessons/commands.py:16
- Draft comment:
The docstring has been simplified. Ensure that detailed usage examples (now in _lesson_help) are sufficient for users. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. gptme/lessons/commands.py:148
- Draft comment:
Redundant manual command listing in the help text was removed. Confirm that _lesson_help now fully covers usage details. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. gptme/tools/lessons.py:90
- Draft comment:
Switching from logger.warning to logger.exception improves error diagnostics by logging the stack trace. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_GDcIEkVXjdCN7Cb6
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
The test was checking for /lesson command in instructions, but that was removed per review feedback (commands are for users, not LLM). Updated test to check for relevant content instead.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed dca167b in 53 seconds. Click for details.
- Reviewed
14lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/test_lessons_tool.py:322
- Draft comment:
Updated assertion to check for 'lesson system' in lower-case instructions; ensures instructions detail the lesson system. Verify this text remains consistent with future changes. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to verify that the text remains consistent with future changes, which is against the rules. It is not making a specific code suggestion or asking for a test to be written. Therefore, this comment should be removed.
2. tests/test_lessons_tool.py:324
- Draft comment:
Added assertion to verify 'keywords' appear in instructions; clearly indicates metadata support. This aligns with the enhanced lesson system requirements. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment seems to be purely informative, explaining what was done and why, without suggesting any changes or asking for confirmation. It doesn't align with the rules for useful comments.
Workflow ID: wflow_a094OdzHKqKtcgrt
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
* feat: add code context snippets to GitHub PR review comments Enhances get_github_pr_content() to include code context from diff_hunk in review comments, making it easier to understand what code is being commented on. - Extract diff_hunk from review comment API responses - Format and display code context with syntax highlighting - Remove diff markers (@@, +, -) for cleaner display - Add comprehensive tests with mocked gh CLI responses Closes #688 * feat: add code suggestion extraction and real API tests - Extract and display code suggestions from review comment bodies - Rewrite tests to use real GitHub API calls instead of mocking - Test against actual PR #687 with review comments and suggestions - Remove mock dependencies from tests All tests pass with real API validation. * feat: enhance GitHub PR reading with code context, suggestions, and read_pr tool Comprehensive enhancement of GitHub PR reading capabilities: 1. Code Context Snippets (gh.py) - Extract diff_hunk from review comments - Display 3-10 lines of code context around commented lines - Remove diff markers for clean display 2. Code Suggestion Extraction (gh.py) - Detect and parse ```suggestion blocks from comment bodies - Format with syntax highlighting 3. New read_pr Tool Command (tools/gh.py) - Single command for agents to get full PR context - Syntax: gh read_pr <pr_url> - Returns all PR info: description, comments, review comments, suggestions - Proper error handling for invalid URLs 4. Comprehensive Testing - Real GitHub API tests (no mocking) - Tests against actual PR #687 - 7 tests covering all functionality - Proper type handling for ExecuteFunc Closes #688 * refactor: rename read_pr to "gh pr view" to match gh CLI convention Makes the command more intuitive by following the standard gh CLI naming: - Old: gh read_pr <url> - New: gh pr view <url> This matches the native gh CLI command while providing enhanced output with code context, suggestions, and comprehensive review information. * feat: add "gh pr checks" to wait for CI completion Adds a new command to wait for all GitHub Actions checks to complete: - gh pr checks <pr_url> Features: - Polls check status every 10 seconds - Shows status updates only when status changes (less spammy) - Displays counts with emoji indicators (✅ passed, ❌ failed, 🔄 in progress) - Exits when all checks complete - Shows final summary of results Much cleaner than "gh run watch" and monitors all checks at once. * test: add comprehensive mocked tests for GitHub PR code context and suggestions - Created 8 mocked tests covering all new functionality - Tests code context extraction from diff_hunk - Tests code suggestion extraction from comment bodies - Tests edge cases (empty diff_hunk, multiple suggestions, malformed blocks) - Tests file extension extraction for syntax highlighting - Combined with existing tests achieves 73% coverage (up from 0% patch coverage) Addresses Codecov feedback on PR #689 * fix: address review comments from ellipsis-dev - Handle files without extensions (e.g., Makefile) by defaulting to "text" lang - Map unmapped check conclusions to "success" instead of undefined "completed" Addresses review comments from ellipsis-dev bot. * fix: show line ranges for multi-line review comments Display "path:start-end" for multi-line comments instead of just "path:end" to accurately reflect the lines being commented on, matching GitHub UI. Example: gptme/tools/lessons.py:138-155 instead of :155 * fix: use correct JSON schema type for gh tool parameter Change type from 'str' to 'string' to match JSON schema specification. Fixes OpenAI API schema validation error. * fix: handle gh CLI authentication errors in tests Skip test_gh_tool_read_pr when gh CLI is not authenticated, which is common in CI environments. This prevents false failures when gh is installed but not configured with credentials. * fix: use original_line as fallback for review comment line numbers GitHub API returns null for 'line' and 'start_line' when comments are on old commits. Use 'original_line' and 'original_start_line' as fallbacks to show the line numbers where the comment was originally made. --------- Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
- Created docs/lessons.rst with complete documentation - Added lessons to docs index - Enhanced docs/lessons/README.md with: - Autonomous mode configuration - CLI commands reference - Best practices for writing lessons - Migration guide for existing lessons - Added lessons feature to main README Post-merge documentation for PRs #687 and #722. Co-authored-by: Bob <bob@superuserlabs.org>
* docs: add comprehensive lesson system documentation - Created docs/lessons.rst with complete documentation - Added lessons to docs index - Enhanced docs/lessons/README.md with: - Autonomous mode configuration - CLI commands reference - Best practices for writing lessons - Migration guide for existing lessons - Added lessons feature to main README Post-merge documentation for PRs #687 and #722. Co-authored-by: Bob <bob@superuserlabs.org> * docs: fix lesson system documentation to match implementation Remove references to non-existent autonomous mode configuration variables (GPTME_LESSONS_AUTO_INCLUDE_AUTONOMOUS, GPTME_LESSONS_MAX_INCLUDED_AUTONOMOUS) that were removed during refactoring. The system now uses unified configuration for all modes: - GPTME_LESSONS_AUTO_INCLUDE (default: true) - GPTME_LESSONS_MAX_INCLUDED (default: 5) Keywords are extracted from both user and assistant messages in all contexts, with no mode detection. Fixes inconsistencies identified in Greptile review (PR #771). Co-authored-by: Bob <bob@superuserlabs.org> --------- Co-authored-by: Erik Bjäreholt <erik.bjareholt@gmail.com>
…ptme#687) * feat: implement basic lesson system with metadata and auto-inclusion Implements Phase 1 of the enhanced lesson system (gptme#686): Core Components: - Parser: Parse lessons with YAML frontmatter (match.keywords) - Index: Discover and index lessons from configured directories - Matcher: Match lessons based on context (message content, keywords) - Auto-include: Automatically include relevant lessons in context - Commands: CLI commands (/lesson list, /lesson search, /lesson show) Features: - YAML frontmatter with extensible match.keywords structure - Backward compatible with lessons without frontmatter - Inferred metadata (title, description, category) - Simple keyword matching for Phase 1 - Ready for future extensions (globs, semantic matching) Example lesson format: --- match: keywords: [patch, file, editing] --- # Lesson Title Lesson content... Tested with gptme-bob workspace lessons (21 lessons indexed). Related: gptme#686 * feat: add lessons as a proper tool with hooks and commands - Implements lesson system as a ToolSpec following gptme tool pattern - Uses MESSAGE_PRE_PROCESS hook for automatic lesson inclusion - Registers /lesson command through tool system - Imports from gptme.lessons module for core functionality - Auto-discovered by tool loading system - Configuration via environment variables: - GPTME_LESSONS_AUTO_INCLUDE (default: true) - GPTME_LESSONS_MAX_INCLUDED (default: 5) Completes the lesson system integration with gptme's tool architecture. * test: add comprehensive tests for lesson commands and tool - Add test_lessons_commands.py with 31 tests covering all command functionality - Add test_lessons_tool.py with 20 tests covering tool integration - Coverage improvements: - gptme/lessons/commands.py: 13% → 98% - gptme/tools/lessons.py: 24% → 96% - Overall lesson system: 24% → 61% Tests cover: - Command parsing and dispatch (list, search, show, refresh) - Auto-include hooks with configuration - Lesson formatting and display - Error handling and edge cases - Tool specification and registration * test: add comprehensive parser tests - Add test_lessons_parser.py with 28 tests covering parser functionality - Coverage improvement: gptme/lessons/parser.py: 36% → 96% - Overall lesson system: 61% → 69% (approaching 70% goal) Tests cover: - Title extraction from markdown - Description extraction with edge cases - Lesson parsing with/without YAML frontmatter - Error handling (file not found, invalid YAML) - Unicode content and complex structures - Dataclass validation * test: add comprehensive matcher tests, achieve 75% coverage - Add test_lessons_matcher.py with 13 tests covering matching functionality - Coverage improvement: gptme/lessons/matcher.py: 42% → 100% - Overall lesson system: 69% → 75% (exceeded 70% goal!) Tests cover: - Keyword-based matching with scoring - Case-insensitive matching - Threshold-based filtering - Score-based sorting - Multiple lesson matching - Explicit keyword matching Final PR gptme#687 status: - Created 92 comprehensive tests (31+20+28+13) - Improved coverage from 24% to 75% - Five modules at 96-100% coverage * fix: address review comments - Use logger.exception instead of logger.warning for better debugging - Remove duplicated help text from lesson() docstring - Remove command usage from tool instructions (not needed by LLM) * fix: update test to match new tool instructions The test was checking for /lesson command in instructions, but that was removed per review feedback (commands are for users, not LLM). Updated test to check for relevant content instead. --------- Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
…tme#689) * feat: add code context snippets to GitHub PR review comments Enhances get_github_pr_content() to include code context from diff_hunk in review comments, making it easier to understand what code is being commented on. - Extract diff_hunk from review comment API responses - Format and display code context with syntax highlighting - Remove diff markers (@@, +, -) for cleaner display - Add comprehensive tests with mocked gh CLI responses Closes gptme#688 * feat: add code suggestion extraction and real API tests - Extract and display code suggestions from review comment bodies - Rewrite tests to use real GitHub API calls instead of mocking - Test against actual PR gptme#687 with review comments and suggestions - Remove mock dependencies from tests All tests pass with real API validation. * feat: enhance GitHub PR reading with code context, suggestions, and read_pr tool Comprehensive enhancement of GitHub PR reading capabilities: 1. Code Context Snippets (gh.py) - Extract diff_hunk from review comments - Display 3-10 lines of code context around commented lines - Remove diff markers for clean display 2. Code Suggestion Extraction (gh.py) - Detect and parse ```suggestion blocks from comment bodies - Format with syntax highlighting 3. New read_pr Tool Command (tools/gh.py) - Single command for agents to get full PR context - Syntax: gh read_pr <pr_url> - Returns all PR info: description, comments, review comments, suggestions - Proper error handling for invalid URLs 4. Comprehensive Testing - Real GitHub API tests (no mocking) - Tests against actual PR gptme#687 - 7 tests covering all functionality - Proper type handling for ExecuteFunc Closes gptme#688 * refactor: rename read_pr to "gh pr view" to match gh CLI convention Makes the command more intuitive by following the standard gh CLI naming: - Old: gh read_pr <url> - New: gh pr view <url> This matches the native gh CLI command while providing enhanced output with code context, suggestions, and comprehensive review information. * feat: add "gh pr checks" to wait for CI completion Adds a new command to wait for all GitHub Actions checks to complete: - gh pr checks <pr_url> Features: - Polls check status every 10 seconds - Shows status updates only when status changes (less spammy) - Displays counts with emoji indicators (✅ passed, ❌ failed, 🔄 in progress) - Exits when all checks complete - Shows final summary of results Much cleaner than "gh run watch" and monitors all checks at once. * test: add comprehensive mocked tests for GitHub PR code context and suggestions - Created 8 mocked tests covering all new functionality - Tests code context extraction from diff_hunk - Tests code suggestion extraction from comment bodies - Tests edge cases (empty diff_hunk, multiple suggestions, malformed blocks) - Tests file extension extraction for syntax highlighting - Combined with existing tests achieves 73% coverage (up from 0% patch coverage) Addresses Codecov feedback on PR gptme#689 * fix: address review comments from ellipsis-dev - Handle files without extensions (e.g., Makefile) by defaulting to "text" lang - Map unmapped check conclusions to "success" instead of undefined "completed" Addresses review comments from ellipsis-dev bot. * fix: show line ranges for multi-line review comments Display "path:start-end" for multi-line comments instead of just "path:end" to accurately reflect the lines being commented on, matching GitHub UI. Example: gptme/tools/lessons.py:138-155 instead of :155 * fix: use correct JSON schema type for gh tool parameter Change type from 'str' to 'string' to match JSON schema specification. Fixes OpenAI API schema validation error. * fix: handle gh CLI authentication errors in tests Skip test_gh_tool_read_pr when gh CLI is not authenticated, which is common in CI environments. This prevents false failures when gh is installed but not configured with credentials. * fix: use original_line as fallback for review comment line numbers GitHub API returns null for 'line' and 'start_line' when comments are on old commits. Use 'original_line' and 'original_start_line' as fallbacks to show the line numbers where the comment was originally made. --------- Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
* docs: add comprehensive lesson system documentation - Created docs/lessons.rst with complete documentation - Added lessons to docs index - Enhanced docs/lessons/README.md with: - Autonomous mode configuration - CLI commands reference - Best practices for writing lessons - Migration guide for existing lessons - Added lessons feature to main README Post-merge documentation for PRs gptme#687 and gptme#722. Co-authored-by: Bob <bob@superuserlabs.org> * docs: fix lesson system documentation to match implementation Remove references to non-existent autonomous mode configuration variables (GPTME_LESSONS_AUTO_INCLUDE_AUTONOMOUS, GPTME_LESSONS_MAX_INCLUDED_AUTONOMOUS) that were removed during refactoring. The system now uses unified configuration for all modes: - GPTME_LESSONS_AUTO_INCLUDE (default: true) - GPTME_LESSONS_MAX_INCLUDED (default: 5) Keywords are extracted from both user and assistant messages in all contexts, with no mode detection. Fixes inconsistencies identified in Greptile review (PR gptme#771). Co-authored-by: Bob <bob@superuserlabs.org> --------- Co-authored-by: Erik Bjäreholt <erik.bjareholt@gmail.com>
- logmanager: count JSONL lines instead of loading entire file text - prompts: fix "seperately" typo - test_util_gh: fix flaky assertions for PR #687 (all comments now resolved)
PR #687's review threads are now all resolved (GraphQL isResolved=true, despite REST API showing resolved_at=null). Updated test to: - Assert "Unresolved" section is NOT present (was asserting it IS) - Add new test using PR #1489 which has actual unresolved threads - Document the REST/GraphQL API inconsistency
…#1496) * fix: cleanup test assertions, typo, and memory-efficient msg counting - logmanager: count JSONL lines instead of loading entire file text - prompts: fix "seperately" typo - test_util_gh: fix flaky assertions for PR #687 (all comments now resolved) * fix(test): update gh util test for resolved PR #687 review threads PR #687's review threads are now all resolved (GraphQL isResolved=true, despite REST API showing resolved_at=null). Updated test to: - Assert "Unresolved" section is NOT present (was asserting it IS) - Add new test using PR #1489 which has actual unresolved threads - Document the REST/GraphQL API inconsistency * fix(test): use PR #271 for unresolved review thread test Replace soft if-based assertion with hard assert using PR #271 (4 unresolved threads from Nov 2024, stable target). PR #1489 had all threads resolved, making the previous test a no-op. --------- Co-authored-by: TimeToBuildBob <TimeToBuildBob@users.noreply.github.com>
Implements Phase 1 of the enhanced lesson system.
Overview
Adds a basic lesson system to gptme that allows structured lessons with metadata to be automatically included in context based on keywords.
Core Components
/lesson list,/lesson search,/lesson show)Features
match.keywordsstructureExample Lesson Format
Testing
Tested with gptme-bob workspace:
Closes #686
Important
Implements a lesson system with metadata and auto-inclusion based on keywords, including a parser, index, matcher, and CLI commands, with comprehensive tests.
/lesson list,/lesson search,/lesson show,/lesson refresh.match.keywords.parser.py: Parses lessons with YAML frontmatter, extracting metadata.index.py: Discovers and indexes lessons from directories.matcher.py: Matches lessons based on context using keywords.auto_include.py: Automatically includes relevant lessons in context.tests/directory.This description was created by
for dca167b. You can customize this summary. It will automatically update as commits are pushed.