Skip to content

Commit 401830f

Browse files
committed
deduplicate with filelist
1 parent 27d3177 commit 401830f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/suggest-optimize.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ if [ -f "$SEEN_MARKER" ] && grep -qF "$COMMIT_HASH" "$SEEN_MARKER" 2>/dev/null;
111111
fi
112112
echo "$COMMIT_HASH" >> "$SEEN_MARKER"
113113

114+
# Dedup: skip if all changed files were already sent to codeflash in this session.
115+
# This prevents re-triggering when codeflash's own optimized changes are committed.
116+
OPTIMIZED_FILES_MARKER="$TRANSCRIPT_DIR/codeflash-optimized-files"
117+
if [ -f "$OPTIMIZED_FILES_MARKER" ]; then
118+
UNSEEN_FILES=$(comm -23 <(echo "$CHANGED_FILES" | sort) <(sort "$OPTIMIZED_FILES_MARKER"))
119+
if [ -z "$UNSEEN_FILES" ]; then
120+
exit 0
121+
fi
122+
fi
123+
# Record the files we're about to send to codeflash
124+
echo "$CHANGED_FILES" >> "$OPTIMIZED_FILES_MARKER"
125+
114126
# --- JS/TS project path ---------------------------------------------------
115127
if [ "$HAS_JS_CHANGES" = "true" ]; then
116128
MESSAGE="JS/TS files were changed in a recent commit. Use the codeflash:optimize skill WITHOUT ANY ARGUMENTS to to optimize the JavaScript/TypeScript code for performance. Use npx to execute codeflash"

0 commit comments

Comments
 (0)