-
Notifications
You must be signed in to change notification settings - Fork 0
Add CI workflow and comprehensive developer documentation #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Create AGENTS.md with comprehensive guidance for AI coding agents - Create CLAUDE.md with specific guidance for Claude Code - Document project overview, code style, testing, and common patterns - Provide reference documentation for development and maintenance Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
…re details - Add comprehensive BATS testing documentation to AGENTS.md - Document shared library architecture in AGENTS.md - Update code style guidelines for shared library pattern - Add development section to README.md with testing instructions - Document test structure and mock utilities - Add contributing guidelines Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
- Create new CI workflow file `.github/workflows/test.yml` - Trigger workflow on push and pull request events - Reuse existing BATS workflow from tenfyzhong/workflows repository - Configure test glob pattern to match `tests/*.bats` files Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
|
🤖 Hi @tenfyzhong, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
Summary of ChangesHello @tenfyzhong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers a substantial architectural improvement to the gitai project by introducing a shared Bash library. This refactoring centralizes previously duplicated code, enhancing the project's maintainability, scalability, and testability. Alongside this core change, the PR establishes a comprehensive testing framework and updates developer documentation, streamlining future development and onboarding processes. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
🤖 I'm sorry @tenfyzhong, but I was unable to process your request. Please see the logs for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant refactoring by extracting common functionality into a new shared library, lib/gitai-common.sh. This library centralizes ANSI color codes, spinner animations, temporary file management, Git utilities, command checking, configuration initialization, and LLM integration functions, all prefixed with gitai_. The existing scripts (ai-commit-msg, aipr, aitag) have been updated to source this new library and utilize its functions, with backward-compatible wrappers maintained for older function names. New documentation files (AGENTS.md, CLAUDE.md) have been added to guide AI agents and developers on the project's architecture, coding standards, and testing. The README.md has also been updated with a new 'Development' section detailing the shared library architecture and comprehensive BATS testing framework, which includes extensive mocking utilities. Review comments highlight the need to update outdated line counts in AGENTS.md and README.md, clarify the source of shared patterns in CLAUDE.md by explicitly mentioning the new library and gitai_ prefixed functions, and ensure the cleanup function in the shared library correctly calls the kill_spin wrapper for proper PID handling.
| # Usage: trap gitai_cleanup SIGINT | ||
| gitai_cleanup() { | ||
| echo -e "\n${GITAI_RED}Script interrupted. Cleaning up...${GITAI_NC}" | ||
| gitai_kill_spin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `aipr` (581 lines) - PR creation/update tool | ||
| - `aitag` (184 lines) - Tag generation tool | ||
| - `ai-commit-msg` (139 lines) - Git commit message hook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `spin_animation()` / `kill_spin()`: Terminal spinner during LLM processing | ||
| - `cleanup()`: SIGINT handler | ||
| - `init_config()`: Copy default prompts from Homebrew install to `~/.config/gitai/prompts/` | ||
| - ANSI color codes: `RED`, `GREEN`, `YELLOW`, `BLUE`, `NC` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good summary of shared patterns. To improve clarity, you could explicitly mention that these functions are provided by the new lib/gitai-common.sh shared library. It would also be helpful to use the new gitai_ prefixed function names (e.g., gitai_spin_animation) as the primary reference, while mentioning the old names as backward-compatibility wrappers, similar to how it's documented in AGENTS.md.
| ├── gitai-common.bats # Tests for shared library (~50 tests) | ||
| ├── aipr.bats # Tests for aipr script (~40 tests) | ||
| ├── aitag.bats # Tests for aitag script (~30 tests) | ||
| └── ai-commit-msg.bats # Tests for ai-commit-msg script (~25 tests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test counts mentioned here are inaccurate. For example, aipr.bats has 9 tests, not ~40. Please update these counts to match the actual number of tests in each file, as correctly stated in the pull request description (41, 9, 9, and 8 tests respectively).
| ├── gitai-common.bats # Tests for shared library (~50 tests) | |
| ├── aipr.bats # Tests for aipr script (~40 tests) | |
| ├── aitag.bats # Tests for aitag script (~30 tests) | |
| └── ai-commit-msg.bats # Tests for ai-commit-msg script (~25 tests) | |
| ├── gitai-common.bats # Tests for shared library (41 tests) | |
| ├── aipr.bats # Tests for aipr script (9 tests) | |
| ├── aitag.bats # Tests for aitag script (9 tests) | |
| └── ai-commit-msg.bats # Tests for ai-commit-msg script (8 tests) |
|
🤖 Hi @tenfyzhong, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @tenfyzhong, but I was unable to process your request. Please see the logs for more details. |
- aitag: Replace raw mktemp with gitai_create_temp_file(), remove conflicting trap and manual cleanup - ai-commit-msg: Replace raw mktemp with gitai_create_temp_file(), remove conflicting trap - aipr: Change exit 1 to return 1 in get_branch_remote() to allow proper error handling instead of terminating the script Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
GitAI Refactoring: Shared Library Implementation
Why This Change?
This refactoring addresses a critical maintenance issue in the GitAI project: code duplication across all three scripts. Each script (
aipr,aitag,ai-commit-msg) previously contained identical implementations of common functionality like spinner animations, color codes, temp file management, and git utilities. This made maintenance difficult and increased the risk of bugs when making changes.By implementing a shared library pattern, we've:
Changes Included
1. New Shared Library (
lib/gitai-common.sh)2. Script Refactoring
ai-commit-msg: Simplified from 139 to ~90 lines by using library functionsaipr: Reduced from 581 to ~500 lines with shared functionalityaitag: Streamlined from 184 to ~150 lines3. Backward Compatibility
spin_animation()callsgitai_spin_animation())REDandGITAI_RED)4. Comprehensive Test Suite
tests/gitai-common.bats: 41 tests for the shared librarytests/aipr.bats: 9 tests for PR functionalitytests/aitag.bats: 9 tests for tag generationtests/ai-commit-msg.bats: 8 tests for commit hookstests/test_helper.bash: 587-line test utility with mock implementations5. Documentation Updates
AGENTS.md: Complete guide for AI coding agents working on the projectCLAUDE.md: Claude-specific guidance for code generationREADME.md: Enhanced development section with testing instructions6. CI/CD Integration
.github/workflows/test.yml: GitHub Actions workflow for automated testingKey Features of the Shared Library
Color Management
Spinner Animations
Temp File Management
Git Utilities
Configuration Management
LLM Integration
Testing Strategy
The test suite provides comprehensive coverage:
Closed Issues
This refactoring resolves several maintenance concerns:
Future Benefits
This architecture enables: