-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance AI-driven development scripts and update documentation #7
Changes from 7 commits
72ffcbd
febd678
8cad47c
64f34cc
64f21c1
7a174e2
3b2873c
cc06de5
42f5c50
040a9f2
6db1452
6c02470
e25d4ce
b0917b5
4f16d69
7e5a408
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -12,20 +12,44 @@ notice "[aidd-commit-msg]: Preparing commit message" | |||||||
PREV_COMMIT_MSG=$(git log -10 --pretty=format:%s) | ||||||||
|
||||||||
# Current staged git changes. | ||||||||
CHANGES=$(git diff --staged) | ||||||||
CHANGES=$(git diff) | ||||||||
CURRENT_DIR=$(pwd) | ||||||||
|
||||||||
# If there is no changes, exit. | ||||||||
if [ -z "$CHANGES" ]; then | ||||||||
error "No changes to commit" | ||||||||
echo "Please stage your changes before generating a commit message." | ||||||||
echo "Please UNSTAGE changes before generating a commit message." | ||||||||
exit 1 | ||||||||
fi | ||||||||
|
||||||||
# FUNCTION | ||||||||
# -------------------- | ||||||||
created_files_prompt() { | ||||||||
|
||||||||
local UNTRACKED=$(git ls-files --others --exclude-standard) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use In POSIX sh, - local UNTRACKED=$(git ls-files --others --exclude-standard)
+ UNTRACKED="$(git ls-files --others --exclude-standard)"
ToolsShellcheck
|
||||||||
|
||||||||
if [ -z "$UNTRACKED" ]; then | ||||||||
return "No created files." | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Return values in shell functions must be numeric. The - return "No created files."
+ echo "No created files."
+ return 0 Committable suggestion
Suggested change
ToolsShellcheck
|
||||||||
fi | ||||||||
|
||||||||
echo "Created files:" | ||||||||
|
||||||||
for file in $UNTRACKED; do | ||||||||
echo "---" | ||||||||
echo "$file" | ||||||||
cat "$file" | ||||||||
echo "---" | ||||||||
echo "" | ||||||||
done | ||||||||
} | ||||||||
|
||||||||
# PROMPT | ||||||||
# -------------------- | ||||||||
PROMPT=$(cat <<EOF | ||||||||
Goal: | ||||||||
Generate git add + git commit message for every changes in the code. | ||||||||
1. Summarize functionnal changes in comments, with numbered list. | ||||||||
2. Identify hunks (but do not display them). | ||||||||
3. Generate git add + git commit message for every changes in the code, following rules. | ||||||||
|
||||||||
Rules: | ||||||||
- Should be formatted in Conventional Commit. | ||||||||
|
@@ -34,12 +58,18 @@ Rules: | |||||||
- Commits should be small and focused on a single change. | ||||||||
- 1 commit message can have multiple files changes. | ||||||||
- Answer with shell script ONLY. | ||||||||
- Use relative git add path based on $CURRENT_DIR. | ||||||||
- Use "git add --patch" with hunks when little changes are made. | ||||||||
- When using path option, be sure to "y" in EOF multiple if needed. | ||||||||
- Do not use "git add --patch" one 1 line changes. | ||||||||
|
||||||||
Previous commit messages: | ||||||||
$PREV_COMMIT_MSG | ||||||||
|
||||||||
Current git changes: | ||||||||
$CHANGES | ||||||||
|
||||||||
$(created_files_prompt) | ||||||||
EOF | ||||||||
) | ||||||||
|
||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
|
||
. "$(dirname "$0")/_.sh" | ||
|
||
# REQUIREMENTS | ||
# -------------------- | ||
check_binary "git" | ||
|
||
# NOTICE | ||
# -------------------- | ||
notice "[aiddc-commits-diff-main]: Get the commits diff between the current branch and main branch." | ||
|
||
# PROMPT PARAMS | ||
# -------------------- | ||
DIFF=$(git log --oneline --no-merges main..HEAD) | ||
|
||
# | ||
# PROMPT | ||
# | ||
PROMPT=$DIFF | ||
# | ||
# COPY OUTPUT | ||
# | ||
copy "$PROMPT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote the variable to prevent word splitting.
The
CHANGES
variable should be quoted to prevent word splitting and potential issues with filenames containing spaces.Committable suggestion