@@ -130,12 +130,42 @@ publish-test: build ## Publish to TestPyPI
130130 @echo " $( GREEN) Published to TestPyPI!$( NC) "
131131 @echo " Install with: pip install -i https://test.pypi.org/simple/ code2logic"
132132
133- publish : build # # Publish to PyPI (production)
133+
134+ git-clean : # # Ensure git working tree is clean
135+ @if [ " $( FORCE) " = " 1" ]; then \
136+ echo " FORCE=1 set: skipping git clean check." ; \
137+ exit 0; \
138+ fi
139+ @git diff --quiet || (echo " Working tree has unstaged changes. Commit or stash before publishing." ; exit 1)
140+ @git diff --cached --quiet || (echo " Index has staged but uncommitted changes. Commit before publishing." ; exit 1)
141+
142+ check-bumpver : # # Ensure bumpver is installed
143+ @$(PYTHON ) -c " import bumpver" > /dev/null 2>&1 || (echo " Missing bumpver. Install dev deps: pip install -e '.[dev]'" ; exit 1)
144+
145+
146+ bump-patch : check-bumpver # # Bump patch version (updates pyproject.toml and code2logic/__init__.py)
147+ $(PYTHON ) -m bumpver update --patch
148+
149+
150+ bump-minor : check-bumpver # # Bump minor version
151+ $(PYTHON ) -m bumpver update --minor
152+
153+
154+ bump-major : check-bumpver # # Bump major version
155+ $(PYTHON ) -m bumpver update --major
156+
157+ publish : bump-patch build # # Publish to PyPI (production)
134158 @echo " $( YELLOW) Publishing to PyPI...$( NC) "
135159 $(PYTHON ) -m twine upload dist/*
136160 @echo " $( GREEN) Published to PyPI!$( NC) "
137161 @echo " Install with: pip install code2logic"
138162
163+ publish-dirty : bump-patch build # # Publish to PyPI without git-clean (dangerous)
164+ @echo " $( YELLOW) Publishing to PyPI (skipping git clean check)...$( NC) "
165+ $(PYTHON ) -m twine upload dist/*
166+ @echo " $( GREEN) Published to PyPI!$( NC) "
167+ @echo " Install with: pip install code2logic"
168+
139169# ============================================================================
140170# Docker
141171# ============================================================================
0 commit comments