codeflash-agent/Makefile
HeshamHM28 45badaf3f0 feat: add Java stop hook to enforce optimization effort (30-attempt cap)
Blocks session exit when the LLM hasn't proven its optimization with
real JMH benchmarks, hasn't tried enough techniques, or has strategies
remaining. Caps at 30 blocks to prevent infinite loops.
2026-04-30 16:59:06 +03:00

111 lines
3.5 KiB
Makefile

LANGS := $(notdir $(wildcard plugin/languages/*))
.PHONY: build clean bootstrap \
install lock sync \
lint format typecheck docs-check test check tidy \
check-version version-dev version-release
##############
# Plugin #
##############
build: clean
@for lang in $(LANGS); do \
echo "Assembling plugin ($$lang) → dist-$$lang/"; \
rsync -a --exclude='languages/' --exclude='README.md' --exclude='ARCHITECTURE.md' --exclude='ROADMAP.md' plugin/ dist-$$lang/; \
rsync -a plugin/languages/$$lang/agents/ dist-$$lang/agents/; \
rsync -a plugin/languages/$$lang/references/ dist-$$lang/references/; \
rsync -a plugin/languages/$$lang/skills/ dist-$$lang/skills/; \
if [ -d "plugin/languages/$$lang/hooks" ]; then \
rsync -a plugin/languages/$$lang/hooks/ dist-$$lang/hooks/; \
fi; \
find dist-$$lang -type f -name '*.md' -exec \
sed -i.bak "s|languages/$$lang/references/|references/|g" {} +; \
find dist-$$lang -type f -name '*.md' -exec \
sed -i.bak "s|languages/$$lang/agents/|agents/|g" {} +; \
find dist-$$lang -type f -name '*.md' -exec \
sed -i.bak "s|languages/$$lang/skills/|skills/|g" {} +; \
find dist-$$lang -name '*.bak' -delete; \
find dist-$$lang -name '.DS_Store' -delete; \
echo "Done. dist-$$lang/"; \
echo ""; \
done
@echo "Built: $(foreach l,$(LANGS),dist-$l/)"
clean:
rm -rf $(foreach l,$(LANGS),dist-$l/)
##############
# Scaffold #
##############
# Scaffold optimization projects: make bootstrap ORG=roboflow PROJECTS="supervision inference"
bootstrap:
ifndef ORG
$(error ORG is required. Usage: make bootstrap ORG=roboflow PROJECTS="supervision inference")
endif
ifndef PROJECTS
$(error PROJECTS is required. Usage: make bootstrap ORG=roboflow PROJECTS="supervision inference")
endif
@echo "Scaffolding projects under: .codeflash/$(ORG)/"
@for proj in $(PROJECTS); do \
bash scripts/scaffold.sh $(ORG) $$proj .codeflash/$(ORG)/$$proj; \
done
@echo ""
@echo "Next steps:"
@echo " 1. Fill in infra/cloud-init.yaml with project-specific setup"
@echo " 2. Add benchmark scripts to bench/"
@echo " 3. Edit README.md with project description and methodology"
@echo " 4. Update status.md with current project state"
##############
# Install #
##############
install: ## Install all workspace packages
uv sync --locked --all-packages
lock: ## Re-lock the workspace
uv lock
sync: ## Sync a specific package: make sync PKG=codeflash-core
uv sync --locked --package $(PKG)
##############
# Quality #
##############
lint: ## Run ruff linter on packages
uv run ruff check packages/
format: ## Check formatting on packages
uv run ruff format --check packages/
typecheck: ## Run mypy on package sources
uv run mypy packages/codeflash-core/src/ packages/codeflash-python/src/
docs-check: ## Check docstring coverage
uv run interrogate packages/codeflash-core/src/ packages/codeflash-python/src/
test: ## Run all package tests
uv run pytest packages/ -v
check: lint format typecheck docs-check ## Run all checks (no tests)
tidy: ## Auto-fix formatting and lint issues
uv run ruff format packages/
uv run ruff check --fix-only --show-fixes packages/
##############
# Versioning #
##############
check-version: ## Verify version was bumped (CI)
uv run python scripts/versioning.py check-version $(ARGS)
version-dev: ## Bump to pre-release version with changelog entry
uv run python scripts/versioning.py version-dev $(ARGS)
version-release: ## Release version, aggregate changelogs
uv run python scripts/versioning.py version-release $(ARGS)
uv run python scripts/combine-changelogs.py $(ARGS)