From 1dde4ddb576f1de0127e65492e74db88cb701faa Mon Sep 17 00:00:00 2001 From: Leopere Date: Wed, 23 Apr 2025 10:08:07 -0400 Subject: [PATCH] Add Git workflow Cursor rule and enhance build-test-run.sh with Git guidance --- .cursor/rules.json | 8 ++++++++ .cursor/rules/git-workflow.mdc | 5 +++++ build-test-run.sh | 21 ++++++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .cursor/rules/git-workflow.mdc diff --git a/.cursor/rules.json b/.cursor/rules.json index 92d638f..0315357 100644 --- a/.cursor/rules.json +++ b/.cursor/rules.json @@ -56,6 +56,14 @@ { "pattern": "**/.woodpecker.yml", "rule": "ci-pipeline.mdc" + }, + { + "pattern": "**/build-test-run.sh", + "rule": "git-workflow.mdc" + }, + { + "pattern": "**/.git/**/*", + "rule": "git-workflow.mdc" } ] } \ No newline at end of file diff --git a/.cursor/rules/git-workflow.mdc b/.cursor/rules/git-workflow.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/git-workflow.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/build-test-run.sh b/build-test-run.sh index bdaf947..39881f4 100755 --- a/build-test-run.sh +++ b/build-test-run.sh @@ -5,6 +5,7 @@ set -e GREEN='\033[0;32m' YELLOW='\033[1;33m' RED='\033[0;31m' +BLUE='\033[0;34m' NC='\033[0m' # No Color echo -e "${YELLOW}Starting build-test-run script for local development${NC}" @@ -27,6 +28,7 @@ fi echo -e "${GREEN}Build completed successfully${NC}" # Step 2: Run tests if they exist +TESTS_PASSED=false if [ -f "./tests/run_tests.sh" ]; then echo -e "${GREEN}Step 2: Running tests${NC}" echo "Running tests..." >> $LOG_FILE @@ -34,9 +36,11 @@ if [ -f "./tests/run_tests.sh" ]; then ./tests/run_tests.sh >> $LOG_FILE 2>&1 if [ $? -ne 0 ]; then echo -e "${RED}Tests failed. Check $LOG_FILE for details.${NC}" + echo -e "${YELLOW}Please fix the issues before committing your changes.${NC}" exit 1 fi echo -e "${GREEN}Tests completed successfully${NC}" + TESTS_PASSED=true else echo -e "${YELLOW}No test script found. Skipping tests.${NC}" fi @@ -61,4 +65,19 @@ fi echo -e "${GREEN}All services are up and running!${NC}" echo -e "To view logs: ${YELLOW}docker compose -f docker-compose.dev.yml logs -f${NC}" echo -e "To stop: ${YELLOW}docker compose -f docker-compose.dev.yml down${NC}" -echo "Build and run completed at $(date)" >> $LOG_FILE \ No newline at end of file +echo "Build and run completed at $(date)" >> $LOG_FILE + +# Show Git workflow guidance if tests passed +if [ "$TESTS_PASSED" = true ]; then + echo -e "\n${BLUE}=== Ready to Commit and Push ===${NC}" + echo -e "${GREEN}All tests have passed! You can now commit and push your changes:${NC}" + echo -e "${YELLOW}git add .${NC}" + echo -e "${YELLOW}git commit -m \"Your descriptive commit message\"${NC}" + echo -e "${YELLOW}git push${NC}" + echo -e "\n${GREEN}Or use the convenient one-liner:${NC}" + echo -e "${YELLOW}git add . && git commit -m \"Your descriptive commit message\" && git push${NC}" + echo -e "\n${BLUE}Remember:${NC}" + echo -e "- Use descriptive commit messages" + echo -e "- Add 'HOTFIX:' prefix for emergency fixes" + echo -e "- Document significant changes in your commit message" +fi \ No newline at end of file