Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
27 lines
1.0 KiB
Bash
Executable File
27 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Feeds the chunker of the earlier code-review-bot module a diff whose added line starts with "++". Writes output/21.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
OUT=target/earlier-bot
|
|
mkdir -p $OUT
|
|
cat > $OUT/Probe.java <<'JAVA'
|
|
import com.ankurm.reviewbot.DiffChunker;
|
|
|
|
public class Probe {
|
|
public static void main(String[] args) {
|
|
String diff = "diff --git a/x.sql b/x.sql\n--- a/x.sql\n+++ b/x.sql\n@@ -1,2 +1,4 @@\n select 1;\n+++i;\n+select 2;\n select 3;\n";
|
|
for (var chunk : new DiffChunker(2000).chunk(diff).chunks()) {
|
|
System.out.print(chunk.text());
|
|
System.out.println("added lines: " + chunk.addedLines());
|
|
}
|
|
}
|
|
}
|
|
JAVA
|
|
javac -d $OUT ../code-review-bot/src/main/java/com/ankurm/reviewbot/DiffChunker.java $OUT/Probe.java
|
|
{
|
|
echo "new file content is: select 1; / ++i; / select 2; / select 3; (added: lines 2 and 3)"
|
|
echo "code-review-bot DiffChunker says:"
|
|
java -cp $OUT Probe
|
|
} > output/21-earlier-bot-chunker.txt
|
|
cat output/21-earlier-bot-chunker.txt
|