echo "๐Ÿงน Starting code cleanup and publishing process..."

echo "โšซ Running Black formatter..."
black . && echo "โœ… Code formatting complete!" || echo "โŒ Black formatting failed!"

echo "๐Ÿ” Running Ruff linter..."
ruff check . --fix && echo "โœ… Linting complete!" || echo "โŒ Linting failed!"


echo "Creating llm.txt file..."
python3 llm_txt.py && echo "โœ… llm.txt file created!" || echo "โŒ llm.txt file creation failed!"

echo "๐Ÿ—๏ธ  Building package..."
poetry build && echo "โœ… Build successful!" || echo "โŒ Build failed!"

echo "๐Ÿ“ฆ Publishing to PyPI..."
poetry publish && echo "โœ… Package published!" || echo "โŒ Publishing failed!"

echo "๐Ÿ“ Enter your commit message:"
read commit_message
git add . && echo "โœ… Changes staged!"
git commit -m "$commit_message" && echo "โœ… Changes committed!"

echo "๐Ÿš€ Pushing to remote repository..."
git push && echo "โœ… Changes pushed to remote!"

echo "โœจ All done! Package cleaned, built, and published successfully! โœจ"