You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MESSAGE="Java files were changed in a recent commit. Use the codeflash:optimize skill WITHOUT ANY ARGUMENTS to optimize the Java code for performance."
Copy file name to clipboardExpand all lines: skills/optimize/SKILL.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,12 @@ Disambiguate the file and function from `$ARGUMENTS` if --file and/or --function
14
14
15
15
## Correct cwd
16
16
17
-
Based on the language of the file/s of concern, Find the `pyproject.toml` (Python) /`package.json` (JS/TS) file closest to the file/files of concern (the file passed to codeflash --file or the files which changed in the diff).
17
+
Based on the language of the file/s of concern, find the config file closest to the file/files of concern (the file passed to codeflash --file or the files which changed in the diff):
18
+
-**Python**: `pyproject.toml`
19
+
-**JS/TS**: `package.json`
20
+
-**Java**: `pom.xml` or `build.gradle`/`build.gradle.kts`
18
21
19
-
`cd` into the directory where you found the `pyproject.toml`/`package.json`.
22
+
`cd` into the directory where you found the config file.
Copy file name to clipboardExpand all lines: skills/setup/SKILL.md
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,8 +90,54 @@ Merge this into the existing `package.json` object — do not overwrite other fi
90
90
91
91
### Check 1c: Project Configuration (Java)
92
92
93
-
Find the `pom.xml` (if it's a maven project) or `build.gradle.kts` (if it's a gradle project) file closest to the file/files of concern (the file passed to codeflash --file or the files which changed in the diff).
93
+
Find the `pom.xml` (Maven) or `build.gradle`/`build.gradle.kts` (Gradle) file closest to the file/files of concern (the file passed to codeflash --file or the files which changed in the diff).
94
94
95
+
For Maven projects, check if `codeflash.*` properties exist in the `<properties>` section of `pom.xml`. For Gradle projects, check if `codeflash.*` properties exist in `gradle.properties`.
96
+
97
+
- If the build file exists but lacks codeflash properties, run **Configuration Discovery (Java)** below and add them.
98
+
- If no build file exists, exit early — Java projects require Maven or Gradle.
99
+
100
+
#### Configuration Discovery (Java)
101
+
102
+
Perform the following discovery steps relative to the directory containing the target `pom.xml` or `build.gradle`:
103
+
104
+
**Discover source root:**
105
+
Find the relative path to the Java source directory. Look for:
106
+
1. Standard Maven/Gradle layout: `src/main/java`
107
+
2. Custom `sourceDirectory` in `pom.xml`
108
+
3. Fallback to `src` if it exists
109
+
Default to `src/main/java`.
110
+
111
+
**Discover test root:**
112
+
Find the relative path to the Java test directory. Look for:
113
+
1. Standard layout: `src/test/java`
114
+
2. Custom `testSourceDirectory` in `pom.xml`
115
+
3. Directories named `test` or `tests`
116
+
Default to `src/test/java`.
117
+
118
+
**Write the configuration:**
119
+
120
+
For Maven projects, add `codeflash.*` properties to the `<properties>` section of `pom.xml`. Only write properties that differ from defaults:
121
+
122
+
```xml
123
+
<properties>
124
+
<!-- Only add if source root is NOT src/main/java -->
0 commit comments