File tree Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ while [[ "$#" -gt 0 ]]; do
15
15
--create-missing) CREATE_MISSING=true; shift ;;
16
16
--verbose) VERBOSE=true; shift ;;
17
17
--help|-h)
18
- echo " Usage: ./ apply-md [options]"
18
+ echo " Usage: apply-md [options]"
19
19
echo " "
20
20
echo " Options:"
21
21
echo " --dry-run Preview changes without applying them"
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- git commit -am " $( ./git-context | llm -m openrouter/anthropic/claude-3.5-haiku) " -e
2
+
3
+ # Get script directory (works even when called from other directories)
4
+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
5
+
6
+ # Use the full path to git-context
7
+ git commit -am " $( " $SCRIPT_DIR /git-context" | llm -m openrouter/anthropic/claude-3.5-haiku) " -e
Original file line number Diff line number Diff line change 3
3
# context - Simplified Code Context Generator
4
4
# Generates contextual information from a codebase to send to an LLM
5
5
6
+ # Get script directory (works even when called from other directories)
7
+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
8
+
6
9
# Default values
7
10
INCLUDE=()
8
11
EXCLUDE=()
@@ -21,7 +24,7 @@ while [[ "$#" -gt 0 ]]; do
21
24
--show-sizes) SHOW_FILE_SIZES=true; shift ;;
22
25
--no-ls-files) SHOW_LS_FILES=false; shift ;;
23
26
--help|-h)
24
- echo " Usage: ./ context [options] [include-pattern1 include-pattern2 ...]"
27
+ echo " Usage: context [options] [include-pattern1 include-pattern2 ...]"
25
28
echo " "
26
29
echo " Options:"
27
30
echo " --include=<pattern> File pattern to include (e.g., \" src/*.js\" )"
@@ -41,8 +44,8 @@ while [[ "$#" -gt 0 ]]; do
41
44
echo " \" !test/*\" - Exclude all files in test directory"
42
45
echo " "
43
46
echo " Examples:"
44
- echo " ./ context --include=\" src/*.js\" --exclude=\" *.test.js\" "
45
- echo " ./ context \" src/*.js\" \" *.md\" --max-size=1MB"
47
+ echo " context --include=\" src/*.js\" --exclude=\" *.test.js\" "
48
+ echo " context \" src/*.js\" \" *.md\" --max-size=1MB"
46
49
exit 0
47
50
;;
48
51
--* ) echo " Unknown parameter: $1 " ; exit 1 ;;
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- # simplified- git-context - Minimalist Git Context Generator for Commit Messages
3
+ # git-context - Minimalist Git Context Generator for Commit Messages
4
4
# Generates essential git-related context to help LLMs create meaningful commit messages
5
5
6
+ # Get script directory (works even when called from other directories)
7
+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
8
+
6
9
# Default values
7
10
RECENT_COMMITS=3
8
- PROMPT_FILE=" prompts/commit_prompt.txt"
11
+ PROMPT_FILE=" $SCRIPT_DIR / prompts/commit_prompt.txt"
9
12
INCLUDE_PROMPT=true
10
13
11
14
# Parse arguments
12
15
while [[ " $# " -gt 0 ]]; do
13
16
case $1 in
14
17
--recent-commits=* ) RECENT_COMMITS=" ${1#* =} " ; shift ;;
15
- --prompt=* ) PROMPT_FILE=" ${1#* =} " ; shift ;;
18
+ --prompt=* )
19
+ # If the path is relative and doesn't start with /, treat it as relative to script dir
20
+ if [[ " ${1#* =} " != /* ]]; then
21
+ PROMPT_FILE=" $SCRIPT_DIR /${1#* =} "
22
+ else
23
+ PROMPT_FILE=" ${1#* =} "
24
+ fi
25
+ shift
26
+ ;;
16
27
--no-prompt) INCLUDE_PROMPT=false; shift ;;
17
28
--help|-h)
18
- echo " Usage: ./ git-context [options]"
29
+ echo " Usage: git-context [options]"
19
30
echo " "
20
31
echo " Options:"
21
32
echo " --recent-commits=<num> Show most recent N commits for context (default: 3)"
22
33
echo " --prompt=<file> Use custom commit message prompt from file (default: prompts/commit_prompt.txt)"
34
+ echo " (Relative paths will be resolved from the script's directory)"
23
35
echo " --no-prompt Don't include commit message prompt"
24
36
echo " --help, -h Show this help message"
25
37
exit 0
You can’t perform that action at this time.
0 commit comments