codeflash-agent/Makefile

109 lines
3.4 KiB
Makefile
Raw Permalink Normal View History

2026-04-09 08:36:01 +00:00
LANGS := $(notdir $(wildcard plugin/languages/*))
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
.PHONY: build clean bootstrap \
install lock sync \
lint format typecheck docs-check test check tidy \
check-version version-dev version-release
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
##############
# Plugin #
##############
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
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/; \
Feat/java language support (#12) * Add Java/Kotlin detection to top-level language router Adds pom.xml, build.gradle, build.gradle.kts, settings.gradle, and settings.gradle.kts as markers that route to the codeflash-java router. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java/Kotlin agent definitions for all optimization domains 10 agents covering the full optimization pipeline: - codeflash-java: router/team lead for domain detection - codeflash-java-setup: environment detection (build tool, JDK, profiling tools) - codeflash-java-deep: cross-domain optimizer (default) - codeflash-java-cpu: data structures, algorithms, JIT deopt, JMH benchmarks - codeflash-java-memory: heap/GC tuning, escape analysis, leak detection - codeflash-java-async: virtual threads, lock contention, CompletableFuture - codeflash-java-structure: class loading, JPMS, startup time, circular deps - codeflash-java-scan: quick cross-domain diagnosis via JFR/jdeps/GC logs - codeflash-java-ci: GitHub webhook handler for Java PRs - codeflash-java-pr-prep: JMH benchmarks and PR body templates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java domain reference guides for all optimization domains 6 guides covering deep domain knowledge for agent consumption: - data-structures: collection selection, autoboxing, JIT patterns, sorting - memory: JVM heap layout, GC algorithms and tuning, escape analysis, leaks - async: virtual threads, structured concurrency, lock hierarchy, contention - structure: class loading, JPMS, CDS/AppCDS, ServiceLoader, Spring startup - database: JPA N+1, HikariCP, pagination, batch operations, EXPLAIN plans - native: JNI, Panama FFM API, GraalVM native-image, Vector API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java optimization skills: session launcher and JFR profiling - codeflash-optimize: session launcher with start/resume/status/scan/review - jfr-profiling: quick-action JFR profiling in cpu/alloc/wall modes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Slim Java agents to match Go's concise ~175-line pattern Move inline code examples, antipattern encyclopedias, JMH templates, and deep-dive sections from agent prompts into reference guides. Agents now contain only: target tables, one-liner antipatterns, reasoning checklists, profiling commands, and keep/discard trees. Line counts (before → after): cpu: 636 → 181 memory: 878 → 193 async: 578 → 165 structure: 532 → 167 deep: 507 → 186 scan: 440 → 163 Average: 595 → 176 (vs Go's 175) Adds to data-structures/guide.md: - Collection contract traps table - Reflection → MethodHandle migration pattern - JMH benchmark template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Makefile build: use rsync merge and portable sed -i Two bugs in the build target: 1. cp -R created nested dirs (agents/agents/, references/references/) instead of merging language overlay into shared base. Fix: rsync -a. 2. sed -i '' is macOS-only; fails silently on Linux. Fix: sed -i.bak (works on both macOS and Linux), then delete .bak files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add HANDOFF.md session lifecycle to Java agents Java agents could read HANDOFF.md on resume but never wrote or updated it. A session that hit plateau would lose all context — what was tried, what worked, why it stopped, what to do next. Changes: - Deep agent: init HANDOFF.md on fresh start, record after each experiment, write Stop Reason + learnings.md on session end - Domain agents (CPU, memory, async, structure): record to HANDOFF.md after each keep/discard, write session-end state - Handoff template: make language-agnostic (was Python-specific), add Session status, Strategy & Decisions, and Stop Reason fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Close 11 gaps between Java and Python plugins Add missing sections to Java deep agent: experiment loop depth (12 steps), library boundary breaking, Phase 0 environment setup, CI mode, pre-submit review, adversarial review, team orchestration, cross-domain results schema, and structured progress reporting. Add polymorphic dispatch safety to CPU agent and data-structures guide. Add diff hygiene to CPU agent. Add native reference to router. Create two new reference files: library-replacement.md (Guava/Commons/ Jackson/Joda replacement tables) and team-orchestration.md (full dispatch and merge protocol). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 23:49:41 +00:00
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/; \
2026-04-09 08:36:01 +00:00
find dist-$$lang -type f -name '*.md' -exec \
Feat/java language support (#12) * Add Java/Kotlin detection to top-level language router Adds pom.xml, build.gradle, build.gradle.kts, settings.gradle, and settings.gradle.kts as markers that route to the codeflash-java router. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java/Kotlin agent definitions for all optimization domains 10 agents covering the full optimization pipeline: - codeflash-java: router/team lead for domain detection - codeflash-java-setup: environment detection (build tool, JDK, profiling tools) - codeflash-java-deep: cross-domain optimizer (default) - codeflash-java-cpu: data structures, algorithms, JIT deopt, JMH benchmarks - codeflash-java-memory: heap/GC tuning, escape analysis, leak detection - codeflash-java-async: virtual threads, lock contention, CompletableFuture - codeflash-java-structure: class loading, JPMS, startup time, circular deps - codeflash-java-scan: quick cross-domain diagnosis via JFR/jdeps/GC logs - codeflash-java-ci: GitHub webhook handler for Java PRs - codeflash-java-pr-prep: JMH benchmarks and PR body templates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java domain reference guides for all optimization domains 6 guides covering deep domain knowledge for agent consumption: - data-structures: collection selection, autoboxing, JIT patterns, sorting - memory: JVM heap layout, GC algorithms and tuning, escape analysis, leaks - async: virtual threads, structured concurrency, lock hierarchy, contention - structure: class loading, JPMS, CDS/AppCDS, ServiceLoader, Spring startup - database: JPA N+1, HikariCP, pagination, batch operations, EXPLAIN plans - native: JNI, Panama FFM API, GraalVM native-image, Vector API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java optimization skills: session launcher and JFR profiling - codeflash-optimize: session launcher with start/resume/status/scan/review - jfr-profiling: quick-action JFR profiling in cpu/alloc/wall modes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Slim Java agents to match Go's concise ~175-line pattern Move inline code examples, antipattern encyclopedias, JMH templates, and deep-dive sections from agent prompts into reference guides. Agents now contain only: target tables, one-liner antipatterns, reasoning checklists, profiling commands, and keep/discard trees. Line counts (before → after): cpu: 636 → 181 memory: 878 → 193 async: 578 → 165 structure: 532 → 167 deep: 507 → 186 scan: 440 → 163 Average: 595 → 176 (vs Go's 175) Adds to data-structures/guide.md: - Collection contract traps table - Reflection → MethodHandle migration pattern - JMH benchmark template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Makefile build: use rsync merge and portable sed -i Two bugs in the build target: 1. cp -R created nested dirs (agents/agents/, references/references/) instead of merging language overlay into shared base. Fix: rsync -a. 2. sed -i '' is macOS-only; fails silently on Linux. Fix: sed -i.bak (works on both macOS and Linux), then delete .bak files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add HANDOFF.md session lifecycle to Java agents Java agents could read HANDOFF.md on resume but never wrote or updated it. A session that hit plateau would lose all context — what was tried, what worked, why it stopped, what to do next. Changes: - Deep agent: init HANDOFF.md on fresh start, record after each experiment, write Stop Reason + learnings.md on session end - Domain agents (CPU, memory, async, structure): record to HANDOFF.md after each keep/discard, write session-end state - Handoff template: make language-agnostic (was Python-specific), add Session status, Strategy & Decisions, and Stop Reason fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Close 11 gaps between Java and Python plugins Add missing sections to Java deep agent: experiment loop depth (12 steps), library boundary breaking, Phase 0 environment setup, CI mode, pre-submit review, adversarial review, team orchestration, cross-domain results schema, and structured progress reporting. Add polymorphic dispatch safety to CPU agent and data-structures guide. Add diff hygiene to CPU agent. Add native reference to router. Create two new reference files: library-replacement.md (Guava/Commons/ Jackson/Joda replacement tables) and team-orchestration.md (full dispatch and merge protocol). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 23:49:41 +00:00
sed -i.bak "s|languages/$$lang/references/|references/|g" {} +; \
2026-04-09 08:36:01 +00:00
find dist-$$lang -type f -name '*.md' -exec \
Feat/java language support (#12) * Add Java/Kotlin detection to top-level language router Adds pom.xml, build.gradle, build.gradle.kts, settings.gradle, and settings.gradle.kts as markers that route to the codeflash-java router. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java/Kotlin agent definitions for all optimization domains 10 agents covering the full optimization pipeline: - codeflash-java: router/team lead for domain detection - codeflash-java-setup: environment detection (build tool, JDK, profiling tools) - codeflash-java-deep: cross-domain optimizer (default) - codeflash-java-cpu: data structures, algorithms, JIT deopt, JMH benchmarks - codeflash-java-memory: heap/GC tuning, escape analysis, leak detection - codeflash-java-async: virtual threads, lock contention, CompletableFuture - codeflash-java-structure: class loading, JPMS, startup time, circular deps - codeflash-java-scan: quick cross-domain diagnosis via JFR/jdeps/GC logs - codeflash-java-ci: GitHub webhook handler for Java PRs - codeflash-java-pr-prep: JMH benchmarks and PR body templates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java domain reference guides for all optimization domains 6 guides covering deep domain knowledge for agent consumption: - data-structures: collection selection, autoboxing, JIT patterns, sorting - memory: JVM heap layout, GC algorithms and tuning, escape analysis, leaks - async: virtual threads, structured concurrency, lock hierarchy, contention - structure: class loading, JPMS, CDS/AppCDS, ServiceLoader, Spring startup - database: JPA N+1, HikariCP, pagination, batch operations, EXPLAIN plans - native: JNI, Panama FFM API, GraalVM native-image, Vector API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java optimization skills: session launcher and JFR profiling - codeflash-optimize: session launcher with start/resume/status/scan/review - jfr-profiling: quick-action JFR profiling in cpu/alloc/wall modes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Slim Java agents to match Go's concise ~175-line pattern Move inline code examples, antipattern encyclopedias, JMH templates, and deep-dive sections from agent prompts into reference guides. Agents now contain only: target tables, one-liner antipatterns, reasoning checklists, profiling commands, and keep/discard trees. Line counts (before → after): cpu: 636 → 181 memory: 878 → 193 async: 578 → 165 structure: 532 → 167 deep: 507 → 186 scan: 440 → 163 Average: 595 → 176 (vs Go's 175) Adds to data-structures/guide.md: - Collection contract traps table - Reflection → MethodHandle migration pattern - JMH benchmark template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Makefile build: use rsync merge and portable sed -i Two bugs in the build target: 1. cp -R created nested dirs (agents/agents/, references/references/) instead of merging language overlay into shared base. Fix: rsync -a. 2. sed -i '' is macOS-only; fails silently on Linux. Fix: sed -i.bak (works on both macOS and Linux), then delete .bak files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add HANDOFF.md session lifecycle to Java agents Java agents could read HANDOFF.md on resume but never wrote or updated it. A session that hit plateau would lose all context — what was tried, what worked, why it stopped, what to do next. Changes: - Deep agent: init HANDOFF.md on fresh start, record after each experiment, write Stop Reason + learnings.md on session end - Domain agents (CPU, memory, async, structure): record to HANDOFF.md after each keep/discard, write session-end state - Handoff template: make language-agnostic (was Python-specific), add Session status, Strategy & Decisions, and Stop Reason fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Close 11 gaps between Java and Python plugins Add missing sections to Java deep agent: experiment loop depth (12 steps), library boundary breaking, Phase 0 environment setup, CI mode, pre-submit review, adversarial review, team orchestration, cross-domain results schema, and structured progress reporting. Add polymorphic dispatch safety to CPU agent and data-structures guide. Add diff hygiene to CPU agent. Add native reference to router. Create two new reference files: library-replacement.md (Guava/Commons/ Jackson/Joda replacement tables) and team-orchestration.md (full dispatch and merge protocol). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 23:49:41 +00:00
sed -i.bak "s|languages/$$lang/agents/|agents/|g" {} +; \
2026-04-09 08:36:01 +00:00
find dist-$$lang -type f -name '*.md' -exec \
Feat/java language support (#12) * Add Java/Kotlin detection to top-level language router Adds pom.xml, build.gradle, build.gradle.kts, settings.gradle, and settings.gradle.kts as markers that route to the codeflash-java router. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java/Kotlin agent definitions for all optimization domains 10 agents covering the full optimization pipeline: - codeflash-java: router/team lead for domain detection - codeflash-java-setup: environment detection (build tool, JDK, profiling tools) - codeflash-java-deep: cross-domain optimizer (default) - codeflash-java-cpu: data structures, algorithms, JIT deopt, JMH benchmarks - codeflash-java-memory: heap/GC tuning, escape analysis, leak detection - codeflash-java-async: virtual threads, lock contention, CompletableFuture - codeflash-java-structure: class loading, JPMS, startup time, circular deps - codeflash-java-scan: quick cross-domain diagnosis via JFR/jdeps/GC logs - codeflash-java-ci: GitHub webhook handler for Java PRs - codeflash-java-pr-prep: JMH benchmarks and PR body templates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java domain reference guides for all optimization domains 6 guides covering deep domain knowledge for agent consumption: - data-structures: collection selection, autoboxing, JIT patterns, sorting - memory: JVM heap layout, GC algorithms and tuning, escape analysis, leaks - async: virtual threads, structured concurrency, lock hierarchy, contention - structure: class loading, JPMS, CDS/AppCDS, ServiceLoader, Spring startup - database: JPA N+1, HikariCP, pagination, batch operations, EXPLAIN plans - native: JNI, Panama FFM API, GraalVM native-image, Vector API Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add Java optimization skills: session launcher and JFR profiling - codeflash-optimize: session launcher with start/resume/status/scan/review - jfr-profiling: quick-action JFR profiling in cpu/alloc/wall modes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Slim Java agents to match Go's concise ~175-line pattern Move inline code examples, antipattern encyclopedias, JMH templates, and deep-dive sections from agent prompts into reference guides. Agents now contain only: target tables, one-liner antipatterns, reasoning checklists, profiling commands, and keep/discard trees. Line counts (before → after): cpu: 636 → 181 memory: 878 → 193 async: 578 → 165 structure: 532 → 167 deep: 507 → 186 scan: 440 → 163 Average: 595 → 176 (vs Go's 175) Adds to data-structures/guide.md: - Collection contract traps table - Reflection → MethodHandle migration pattern - JMH benchmark template Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix Makefile build: use rsync merge and portable sed -i Two bugs in the build target: 1. cp -R created nested dirs (agents/agents/, references/references/) instead of merging language overlay into shared base. Fix: rsync -a. 2. sed -i '' is macOS-only; fails silently on Linux. Fix: sed -i.bak (works on both macOS and Linux), then delete .bak files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add HANDOFF.md session lifecycle to Java agents Java agents could read HANDOFF.md on resume but never wrote or updated it. A session that hit plateau would lose all context — what was tried, what worked, why it stopped, what to do next. Changes: - Deep agent: init HANDOFF.md on fresh start, record after each experiment, write Stop Reason + learnings.md on session end - Domain agents (CPU, memory, async, structure): record to HANDOFF.md after each keep/discard, write session-end state - Handoff template: make language-agnostic (was Python-specific), add Session status, Strategy & Decisions, and Stop Reason fields Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Close 11 gaps between Java and Python plugins Add missing sections to Java deep agent: experiment loop depth (12 steps), library boundary breaking, Phase 0 environment setup, CI mode, pre-submit review, adversarial review, team orchestration, cross-domain results schema, and structured progress reporting. Add polymorphic dispatch safety to CPU agent and data-structures guide. Add diff hygiene to CPU agent. Add native reference to router. Create two new reference files: library-replacement.md (Guava/Commons/ Jackson/Joda replacement tables) and team-orchestration.md (full dispatch and merge protocol). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 23:49:41 +00:00
sed -i.bak "s|languages/$$lang/skills/|skills/|g" {} +; \
find dist-$$lang -name '*.bak' -delete; \
2026-04-09 08:36:01 +00:00
find dist-$$lang -name '.DS_Store' -delete; \
echo "Done. dist-$$lang/"; \
echo ""; \
done
@echo "Built: $(foreach l,$(LANGS),dist-$l/)"
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
clean:
rm -rf $(foreach l,$(LANGS),dist-$l/)
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
##############
# Scaffold #
##############
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
# 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"
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
##############
# Install #
##############
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
install: ## Install all workspace packages
uv sync --locked --all-packages
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
lock: ## Re-lock the workspace
uv lock
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
sync: ## Sync a specific package: make sync PKG=codeflash-core
uv sync --locked --package $(PKG)
2026-04-03 22:36:50 +00:00
2026-04-09 08:36:01 +00:00
##############
# 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)