Compare commits
2 Commits
efcec4e122
...
v0.2.25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4464e5d91f | ||
|
|
66c8624d66 |
@@ -1,18 +0,0 @@
|
|||||||
repos:
|
|
||||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
||||||
rev: v0.9.0.6
|
|
||||||
hooks:
|
|
||||||
- id: shellcheck
|
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
||||||
rev: v0.1.8
|
|
||||||
hooks:
|
|
||||||
- id: ruff
|
|
||||||
args: [--fix]
|
|
||||||
- id: ruff-format
|
|
||||||
|
|
||||||
- repo: https://github.com/commitizen-tools/commitizen
|
|
||||||
rev: v3.2.0
|
|
||||||
hooks:
|
|
||||||
- id: commitizen
|
|
||||||
stages: [commit-msg]
|
|
||||||
@@ -16,38 +16,6 @@
|
|||||||
- Test changes before submitting
|
- Test changes before submitting
|
||||||
- See [VERSIONING.md](VERSIONING.md) for backport compatibility rules
|
- See [VERSIONING.md](VERSIONING.md) for backport compatibility rules
|
||||||
|
|
||||||
## Pre-commit Hooks
|
|
||||||
|
|
||||||
This repository uses [pre-commit](https://pre-commit.com/) for linting and commit message enforcement.
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install pre-commit
|
|
||||||
pre-commit install
|
|
||||||
```
|
|
||||||
|
|
||||||
### Hooks
|
|
||||||
|
|
||||||
- **shellcheck** — Lints bash scripts
|
|
||||||
- **ruff** — Lints and formats Python
|
|
||||||
- **commitizen** — Enforces [Conventional Commits](https://www.conventionalcommits.org/) format
|
|
||||||
|
|
||||||
### Commit Message Format
|
|
||||||
|
|
||||||
Use Conventional Commits format:
|
|
||||||
|
|
||||||
```
|
|
||||||
type(scope): message
|
|
||||||
|
|
||||||
# Examples
|
|
||||||
fix(session): handle missing session gracefully
|
|
||||||
feat(pm): add queue daemon for task delegation
|
|
||||||
docs: update contributing guide
|
|
||||||
```
|
|
||||||
|
|
||||||
Types: `fix`, `feat`, `docs`, `refactor`, `chore`, `test`
|
|
||||||
|
|
||||||
## Branches
|
## Branches
|
||||||
|
|
||||||
### Primary Branches
|
### Primary Branches
|
||||||
|
|||||||
@@ -64,3 +64,26 @@ load_agent_env() {
|
|||||||
set +a
|
set +a
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_debug_mode() {
|
||||||
|
local filtered_args=()
|
||||||
|
local debug_mode=false
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--debug)
|
||||||
|
debug_mode=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
filtered_args+=("$arg")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$debug_mode" = true ]; then
|
||||||
|
export KUGETSU_VERBOSITY="debug"
|
||||||
|
echo "[DEBUG] Debug mode enabled" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${filtered_args[@]}"
|
||||||
|
}
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ cmd_delegate() {
|
|||||||
local msg_file="$LOGS_DIR/msg-$new_session.txt"
|
local msg_file="$LOGS_DIR/msg-$new_session.txt"
|
||||||
printf '%s' "$message" > "$msg_file"
|
printf '%s' "$message" > "$msg_file"
|
||||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$new_session'" >> "$log_file" 2>&1 &
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$new_session'" >> "$log_file" 2>&1 &
|
||||||
rm -f "$msg_file"
|
|
||||||
echo "Delegated to new session (logged to $(basename "$log_file"))"
|
echo "Delegated to new session (logged to $(basename "$log_file"))"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,28 +270,7 @@ build_dev_agent_message() {
|
|||||||
local number=$(echo "$issue_ref" | grep -oE '#[0-9]+$' | tr -d '#')
|
local number=$(echo "$issue_ref" | grep -oE '#[0-9]+$' | tr -d '#')
|
||||||
local worktree_path=$(issue_ref_to_worktree_path "$issue_ref")
|
local worktree_path=$(issue_ref_to_worktree_path "$issue_ref")
|
||||||
|
|
||||||
if [ -n "$user_message" ]; then
|
local base_message="You are assigned to work on $issue_ref.
|
||||||
cat <<EOF
|
|
||||||
You are continuing work on $issue_ref. A PR likely already exists.
|
|
||||||
|
|
||||||
IMPORTANT - Review workflow:
|
|
||||||
1. First, check if PR exists: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls?state=open" -H "Authorization: Bearer \$GITEA_TOKEN" | grep -i "$number"
|
|
||||||
2. Get PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
|
||||||
3. Get PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
|
||||||
|
|
||||||
You may need to:
|
|
||||||
- Make code changes and push to the same branch
|
|
||||||
- Reply to PR comments using: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your reply here"}'
|
|
||||||
- Or do both
|
|
||||||
|
|
||||||
Delegator's message:
|
|
||||||
$user_message
|
|
||||||
|
|
||||||
Work directory: $worktree_path (already on the fix branch)
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
cat <<EOF
|
|
||||||
You are assigned to work on $issue_ref.
|
|
||||||
|
|
||||||
Workflow:
|
Workflow:
|
||||||
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
||||||
@@ -307,17 +285,17 @@ Workflow:
|
|||||||
6. If anything is unclear, post a comment on the issue asking for clarification before implementing
|
6. If anything is unclear, post a comment on the issue asking for clarification before implementing
|
||||||
7. Implement the solution
|
7. Implement the solution
|
||||||
8. Create a branch named fix/issue-$number and implement the fix
|
8. Create a branch named fix/issue-$number and implement the fix
|
||||||
9. Create a PR when the implementation is complete using: tea pr create --repo $owner/$repo --title "Your PR title" --body "PR description"
|
9. Create a PR when the implementation is complete
|
||||||
- Make sure you are logged in with: tea login add --name gitea --token \$GITEA_TOKEN --url https://$instance
|
|
||||||
- If tea is not available, use: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/pulls" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"title":"PR Title","head":"branch-name","base":"main","body":"PR description"}'
|
|
||||||
|
|
||||||
Tools for PR interaction:
|
Work directory: $worktree_path"
|
||||||
- Post issue/PR comment: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your comment"}'
|
|
||||||
- List PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
if [ -n "$user_message" ]; then
|
||||||
- List PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
echo "$base_message
|
||||||
|
|
||||||
Work directory: $worktree_path
|
Additional instructions from delegator:
|
||||||
EOF
|
$user_message"
|
||||||
|
else
|
||||||
|
echo "$base_message"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,11 +378,7 @@ cmd_start() {
|
|||||||
|
|
||||||
cd "$worktree_path"
|
cd "$worktree_path"
|
||||||
local sanitized_id=$(echo "$new_session_id" | sed 's/[^a-zA-Z0-9_-]/_/g')
|
local sanitized_id=$(echo "$new_session_id" | sed 's/[^a-zA-Z0-9_-]/_/g')
|
||||||
mkdir -p "$worktree_path/.kugetsu"
|
local msg_file="$worktree_path/.kugetsu-msg.txt"
|
||||||
if [ ! -f "$worktree_path/.gitignore" ] || ! grep -q "^.kugetsu/" "$worktree_path/.gitignore"; then
|
|
||||||
echo ".kugetsu/" >> "$worktree_path/.gitignore" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
local msg_file="$worktree_path/.kugetsu/msg.txt"
|
|
||||||
printf '%s' "$dev_message" > "$msg_file"
|
printf '%s' "$dev_message" > "$msg_file"
|
||||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$new_session_id'" >> "$LOGS_DIR/dev-$sanitized_id.log" 2>&1 &
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$new_session_id'" >> "$LOGS_DIR/dev-$sanitized_id.log" 2>&1 &
|
||||||
|
|
||||||
@@ -470,11 +444,7 @@ cmd_continue() {
|
|||||||
|
|
||||||
cd "$worktree_path"
|
cd "$worktree_path"
|
||||||
local sanitized_id=$(echo "$opencode_session_id" | sed 's/[^a-zA-Z0-9_-]/_/g')
|
local sanitized_id=$(echo "$opencode_session_id" | sed 's/[^a-zA-Z0-9_-]/_/g')
|
||||||
mkdir -p "$worktree_path/.kugetsu"
|
local msg_file="$worktree_path/.kugetsu-msg.txt"
|
||||||
if [ ! -f "$worktree_path/.gitignore" ] || ! grep -q "^.kugetsu/" "$worktree_path/.gitignore"; then
|
|
||||||
echo ".kugetsu/" >> "$worktree_path/.gitignore" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
local msg_file="$worktree_path/.kugetsu/msg.txt"
|
|
||||||
printf '%s' "$message" > "$msg_file"
|
printf '%s' "$message" > "$msg_file"
|
||||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$sanitized_id.log" 2>&1 &
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$sanitized_id.log" 2>&1 &
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user