-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrepomix.sh
More file actions
executable file
·80 lines (66 loc) · 2.63 KB
/
repomix.sh
File metadata and controls
executable file
·80 lines (66 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/zsh
INCLUDE_PATHS=(
"**/*"
"src"
"package.json"
)
IGNORE_PATHS=(
"content/on-deck"
"content/youtube"
"content/questions-and-answers"
"content/archive"
".gitignore"
"chapters.md"
"embeddings.json"
"new-*.md"
"repomix.sh"
"TODO.md"
)
INCLUDE_STRING=$(IFS=,; echo "${INCLUDE_PATHS[*]}")
IGNORE_STRING=$(IFS=,; echo "${IGNORE_PATHS[*]}")
INSTRUCTION_FILE="repomix-instruction.md"
TEMP_DIR=""
if [ ! -f "$INSTRUCTION_FILE" ]; then
TEMP_DIR=$(mktemp -d)
INSTRUCTION_FILE="$TEMP_DIR/repomix-instruction-temp.md"
cat > "$INSTRUCTION_FILE" << 'EOF'
I'm going to ask you to refactor my code, write a new feature, or fix a bug.
- Any time you are refactoring, building a new feature, or fixing a bug, add a few logging functions to track what is happening and help debug when the application fails.
- In your responses when you respond with code, you will respond with the entire code files with no comments.
- Include one or two sentences before the code file explaining what has been changed, do not write the explanation as comments in the code file.
- Do not include any comments in the code at all.
- Aside from the instructions above and given below, you will not make any changes to the code files. You will only add or remove code specific to the requested refactor, feature, or bug fix.
- Only respond with code files if there are changes (either additions or subtractions), do not respond with code files that are identical to the code files I gave you.
- Always use ESM, async/await, try catch, and the latest version of Node.js (22 as of now). Avoid for and while loops in favor of map functions. Avoid if-else statements unless very minimal and when no other appropriate solutions exist.
- Do not use semi-colons.
- Always write `.ts` files with TypeScript. Infer types whenever possible, when types must be declared keep them minimal and inlined instead of named. Always include return types.
EOF
echo "Created temporary instruction file: $INSTRUCTION_FILE"
fi
OUTPUT_FILE="new-llm-1.md"
COUNTER=2
while [ -f "$OUTPUT_FILE" ]; do
OUTPUT_FILE="new-llm-$COUNTER.md"
COUNTER=$((COUNTER + 1))
done
repomix \
--instruction-file-path "$INSTRUCTION_FILE" \
--include "$INCLUDE_STRING" \
--ignore "$IGNORE_STRING" \
--style markdown \
--output "$OUTPUT_FILE" \
--token-count-encoding "o200k_base" \
--top-files-len 30 \
--no-git-sort-by-changes \
--no-file-summary
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo "Successfully created $OUTPUT_FILE"
else
echo "Error running repomix command"
fi
if [ -n "$TEMP_DIR" ]; then
rm -rf "$TEMP_DIR"
echo "Removed temporary directory and instruction file"
fi
exit $EXIT_CODE