-
Notifications
You must be signed in to change notification settings - Fork 0
chore: improve commit context generation and error handling #129
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
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fac855d
chore: improve commit context generation and error handling
towry 8c1e3e4
docs: update agent configurations and documentation
towry df7499e
chore: remove --no-edit flag from jj describe command
towry 1888282
feat: add mcp configuration
towry 2c1d5ed
feat: add expertls installation script
towry 115950a
docs: add safety warning to coding rules
towry 50182b0
refactor: update jj log aliases
towry 7e4cf43
feat(jj): enhance git fetch command with remote support
towry 49d636f
feat(jj): enhance git push command with remote and bookmark support
towry 5563fa4
feat: update LLM models for git branch and commit roles
towry 949b187
fix: reduce LLM temperature for more consistent commit messages
towry 51c2441
fix: update LLM model to qwen3-next-80b-a3b-instruct
towry 2593a1b
chore: deps
towry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "kiroAgent.configureMCP": "Disabled" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # 命令行指南 | ||
|
|
||
| _命令 1_: `nix flake update` _描述_: 更新 Nix flake 的输入依赖,当需要拉取最新版 | ||
| 本的包或模块时使用。 | ||
|
|
||
| _命令 2_: `home-manager switch --flake .#towry` _描述_: 应用用户级别的配置更改, | ||
| 使用 home-manager 切换到指定的配置。 | ||
|
|
||
| _命令 3_: `darwin-rebuild switch --flake .` _描述_: 应用系统级别的配置更改,使用 | ||
| nix-darwin 切换到新的系统配置。 | ||
|
|
||
| _命令 4_: `jj ci -m "message"` _描述_: 提交当前更改到 JJ 仓库,使用描述性消息。 | ||
|
|
||
| _命令 5_: `jj df` _描述_: 显示当前工作目录与父提交之间的差异。 | ||
|
|
||
| _命令 6_: `jj log` _描述_: 显示提交历史日志。 | ||
|
|
||
| _命令 7_: `jj new branch-name` _描述_: 创建新的分支或书签。 | ||
|
|
||
| _命令 8_: `jj gp -b branch-name` _描述_: 推送指定的分支到远程仓库。 | ||
|
|
||
| _命令 9_: `make build` _描述_: 构建用户配置,使用 home-manager 构建激活包。 | ||
|
|
||
| _命令 10_: `make switch` _描述_: 切换系统配置,使用 darwin-rebuild 应用更改。 | ||
|
|
||
| _命令 11_: `just update-self-repo` _描述_: 更新私有仓库的输入,使用 nix flake | ||
| update 针对特定输入。 | ||
|
|
||
| _注意事项_: | ||
|
|
||
| - 在这个 dotfiles 项目中,`nix build` 命令通常用于构建特定的输出,如 | ||
| `.#homeConfigurations.towry.activationPackage`,而不是整个项目构建。 | ||
| - JJ 被用作版本控制系统而不是 Git,因此提交和推送命令使用 `jj ci` 和 `jj gp` 而 | ||
| 不是 `git commit` 和 `git push`。 | ||
| - `make` 目标如 `build` 和 `switch` 是对 nix 命令的包装,简化了常见操作。 | ||
| - 更新 flake 输入后,通常需要运行 `home-manager switch` 或 | ||
| `darwin-rebuild switch` 来应用更改。 | ||
| - 私有仓库的更新使用 `just update-self-repo` 来避免手动指定输入名称。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,19 +62,19 @@ get_revision_changes() { | |||||||||||||||||||
| echo | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Check if diff is too large | ||||||||||||||||||||
| local diff_lines=$(jj diff -r "$rev" --color=never --no-pager | wc -l | tr -d ' ') | ||||||||||||||||||||
| local diff_lines=$(jj diff --context 2 -r "$rev" --color=never --no-pager | wc -l | tr -d ' ') | ||||||||||||||||||||
| local exit_code=$? | ||||||||||||||||||||
| if [ $exit_code -ne 0 ]; then | ||||||||||||||||||||
| echo "Error: jj diff | wc -l failed with exit code: $exit_code" >&2 | ||||||||||||||||||||
| exit $exit_code | ||||||||||||||||||||
| fi | ||||||||||||||||||||
| local max_diff_lines=100 # Conservative limit for token usage | ||||||||||||||||||||
| local minimal_threshold=200 # If diff is huge, use minimal output | ||||||||||||||||||||
| local max_diff_lines=2000 # Conservative limit for token usage | ||||||||||||||||||||
| local minimal_threshold=10000 # If diff is huge, use minimal output | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if [ "$diff_lines" -gt "$minimal_threshold" ]; then | ||||||||||||||||||||
| echo "Very large diff detected ($diff_lines lines). Showing minimal summary:" | ||||||||||||||||||||
| # For huge diffs, just show summary stats | ||||||||||||||||||||
| jj diff -r "$rev" --stat --color=never --no-pager | ||||||||||||||||||||
| jj diff --context 2 -r "$rev" --stat --color=never --no-pager | ||||||||||||||||||||
| local exit_code=$? | ||||||||||||||||||||
| if [ $exit_code -ne 0 ]; then | ||||||||||||||||||||
| echo "Error: jj diff --stat (minimal) failed with exit code: $exit_code" >&2 | ||||||||||||||||||||
|
|
@@ -89,7 +89,7 @@ get_revision_changes() { | |||||||||||||||||||
| # NOTE: jj diff returns exit code 3 (not 141) when used in a pipeline with head | ||||||||||||||||||||
| # This is jj's way of handling SIGPIPE when the pipe is closed early by head | ||||||||||||||||||||
| set +o pipefail | ||||||||||||||||||||
| jj diff -r "$rev" --color=never --no-pager | head -n "$max_diff_lines" | ||||||||||||||||||||
| jj diff --context 2 -r "$rev" --color=never --no-pager | head -n "$max_diff_lines" | ||||||||||||||||||||
| local jj_exit_code=${PIPESTATUS[0]} # Get exit code of jj diff | ||||||||||||||||||||
| local head_exit_code=${PIPESTATUS[1]:-0} # Get exit code of head, default to 0 if not set | ||||||||||||||||||||
| set -o pipefail | ||||||||||||||||||||
|
|
@@ -103,7 +103,7 @@ get_revision_changes() { | |||||||||||||||||||
| echo "... (diff truncated - $((diff_lines - max_diff_lines)) lines omitted) ..." | ||||||||||||||||||||
| else | ||||||||||||||||||||
| echo "Full diff:" | ||||||||||||||||||||
| jj diff -r "$rev" --color=never --no-pager | ||||||||||||||||||||
| jj diff --context 2 -r "$rev" --color=never --no-pager | ||||||||||||||||||||
| local exit_code=$? | ||||||||||||||||||||
| if [ $exit_code -ne 0 ]; then | ||||||||||||||||||||
| echo "Error: jj diff (full) failed with exit code: $exit_code" >&2 | ||||||||||||||||||||
|
|
@@ -118,10 +118,10 @@ get_recent_commits() { | |||||||||||||||||||
| local rev="$1" | ||||||||||||||||||||
| echo "=== RECENT COMMIT HISTORY ===" | ||||||||||||||||||||
| echo | ||||||||||||||||||||
| echo "Last 2 commits:" | ||||||||||||||||||||
| echo "Last 3 commits:" | ||||||||||||||||||||
| # Use template to format output similar to git log --oneline | ||||||||||||||||||||
| jj log -n 2 -r "..$rev" --no-pager --no-graph --color=never \ | ||||||||||||||||||||
| -T 'change_id.short() ++ " " ++ description.first_line() ++ "\n"' | ||||||||||||||||||||
| jj log -n 3 -r "..$rev" --no-pager --no-graph --color=never \ | ||||||||||||||||||||
| -T 'commit_id.short() ++ ": " ++ description.first_line() ++ "\n"' | ||||||||||||||||||||
| local exit_code=$? | ||||||||||||||||||||
| if [ $exit_code -ne 0 ]; then | ||||||||||||||||||||
| echo "Error: jj log failed with exit code: $exit_code" >&2 | ||||||||||||||||||||
|
|
@@ -153,6 +153,14 @@ main() { | |||||||||||||||||||
| local rev | ||||||||||||||||||||
| rev=$(get_revision "${1:-}") | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # check rev is valid | ||||||||||||||||||||
| # jj log -r "$rev" --ignore-working-copy | ||||||||||||||||||||
| if ! jj log -r "$rev" --ignore-working-copy --no-pager >/dev/null 2>&1; then | ||||||||||||||||||||
| echo "Error: Invalid/ambiguous revision $rev" >&2 | ||||||||||||||||||||
| exit 1 | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+157
to
+163
|
||||||||||||||||||||
| # jj log -r "$rev" --ignore-working-copy | |
| if ! jj log -r "$rev" --ignore-working-copy --no-pager >/dev/null 2>&1; then | |
| echo "Error: Invalid/ambiguous revision $rev" >&2 | |
| exit 1 | |
| fi | |
| if ! jj log -r "$rev" --ignore-working-copy --no-pager >/dev/null 2>&1; then | |
| echo "Error: Invalid/ambiguous revision $rev" >&2 | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The comment on line 116 still says 'Function to get last 2 commit messages' but the code now retrieves 3 commits. Update the comment to match the implementation.