Compare commits
8 Commits
fix/issue-
...
v0.2.7
| Author | SHA1 | Date | |
|---|---|---|---|
| 80a3228be9 | |||
|
|
d68a63af41 | ||
| 56310755b8 | |||
|
|
fb33be3a64 | ||
| 1b19c9a92c | |||
|
|
85a4239383 | ||
|
|
91b51f62c0 | ||
| 7234837284 |
@@ -6,6 +6,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v0.2.4] - 2026-04-06
|
||||
|
||||
### Fixed
|
||||
- Queue daemon: Locking to prevent daemon vs manual conflicts
|
||||
- Queue daemon: Proper error handling for failed tasks
|
||||
- Queue daemon: Fix GITEA_TOKEN loading from pm-agent.env
|
||||
- cmd_delegate: Enqueue tasks instead of bypassing queue
|
||||
- Notifications: Call kugetsu_add_notification from bash instead of os.system()
|
||||
- kugetsu: Remove duplicate update_queue_item_state that overwrote fixed version
|
||||
|
||||
### Added
|
||||
- Queue functions moved to kugetsu-index.sh for daemon access
|
||||
- kugetsu-session.sh sources required modules for daemon use
|
||||
|
||||
## [v0.2.3] - 2026-04-06
|
||||
|
||||
### Fixed
|
||||
- get_pending_tasks() returns proper JSON array instead of concatenated JSON objects
|
||||
|
||||
## [v0.2.1] - 2026-04-03
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -93,6 +93,10 @@ EOF
|
||||
|
||||
ensure_dirs() {
|
||||
mkdir -p "$SESSIONS_DIR"
|
||||
mkdir -p "$LOGS_DIR"
|
||||
mkdir -p "$WORKTREES_DIR"
|
||||
mkdir -p "$QUEUE_DIR"
|
||||
mkdir -p "$QUEUE_ITEMS_DIR"
|
||||
}
|
||||
|
||||
ensure_worktree_dir() {
|
||||
@@ -257,7 +261,9 @@ PYEOF
|
||||
}
|
||||
|
||||
ensure_queue_dirs() {
|
||||
mkdir -p "$QUEUE_DIR"
|
||||
mkdir -p "$QUEUE_ITEMS_DIR"
|
||||
mkdir -p "$LOGS_DIR"
|
||||
}
|
||||
|
||||
generate_queue_id() {
|
||||
@@ -848,6 +854,11 @@ EOF
|
||||
}
|
||||
|
||||
parse_issue_ref_from_message() {
|
||||
# DEPRECATED: This function is not called anywhere.
|
||||
# The active implementation is extract_issue_ref_from_message()
|
||||
# in kugetsu-session.sh which is used by cmd_delegate.
|
||||
# This function is kept for backwards compatibility and will
|
||||
# be removed in a future release.
|
||||
local message="$1"
|
||||
|
||||
local gitserver=""
|
||||
@@ -855,21 +866,20 @@ parse_issue_ref_from_message() {
|
||||
local repo=""
|
||||
local issue_number=""
|
||||
|
||||
if echo "$message" | grep -qE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/(issues|pull)/[0-9]+'; then
|
||||
gitserver=$(echo "$message" | grep -oE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+' | head -1 | sed 's/\/[^/]*\/[^/]*$//')
|
||||
local full_path=$(echo "$message" | grep -oE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+/(issues|pull)/[0-9]+' | head -1)
|
||||
owner=$(echo "$full_path" | cut -d'/' -f2)
|
||||
repo=$(echo "$full_path" | cut -d'/' -f3)
|
||||
issue_number=$(echo "$full_path" | grep -oE '[0-9]+$' | head -1)
|
||||
elif echo "$message" | grep -qE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#[0-9]+'; then
|
||||
gitserver=$(echo "$message" | grep -oE '[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+' | head -1)
|
||||
owner=$(echo "$gitserver" | cut -d'/' -f2)
|
||||
repo=$(echo "$gitserver" | cut -d'/' -f3)
|
||||
issue_number=$(echo "$message" | grep -oE '#[0-9]+' | grep -oE '[0-9]+' | head -1)
|
||||
elif echo "$message" | grep -qE '[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#([0-9]+)'; then
|
||||
owner=$(echo "$message" | grep -oE '[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#' | sed 's/#$//' | cut -d'/' -f1)
|
||||
repo=$(echo "$message" | grep -oE '[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+#' | sed 's/#$//' | cut -d'/' -f2)
|
||||
issue_number=$(echo "$message" | grep -oE '#[0-9]+' | grep -oE '[0-9]+' | head -1)
|
||||
if [[ "$message" =~ (https?://)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)/(issues|pull)/([0-9]+) ]]; then
|
||||
gitserver="${BASH_REMATCH[2]}"
|
||||
owner="${BASH_REMATCH[3]}"
|
||||
repo="${BASH_REMATCH[4]}"
|
||||
issue_number="${BASH_REMATCH[6]}"
|
||||
elif [[ "$message" =~ (https?://)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)#([0-9]+) ]]; then
|
||||
gitserver="${BASH_REMATCH[2]}"
|
||||
owner="${BASH_REMATCH[3]}"
|
||||
repo="${BASH_REMATCH[4]}"
|
||||
issue_number="${BASH_REMATCH[5]}"
|
||||
elif [[ "$message" =~ ([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)#([0-9]+) ]]; then
|
||||
owner="${BASH_REMATCH[1]}"
|
||||
repo="${BASH_REMATCH[2]}"
|
||||
issue_number="${BASH_REMATCH[3]}"
|
||||
fi
|
||||
|
||||
echo "${gitserver}|${owner}|${repo}|${issue_number}"
|
||||
|
||||
@@ -43,15 +43,24 @@ kugetsu_add_notification() {
|
||||
notifications=$(cat "$NOTIFICATIONS_FILE")
|
||||
fi
|
||||
|
||||
local new_notification=$(python3 -c "import json; print(json.dumps({
|
||||
notifications=$(echo "$notifications" | python3 -c "
|
||||
import json
|
||||
import sys
|
||||
|
||||
notifications = json.load(sys.stdin)
|
||||
new_notification = {
|
||||
'type': '$notification_type',
|
||||
'message': '$message',
|
||||
'issue_ref': '$issue_ref',
|
||||
'message': '''$message'''.replace('\"', '\"'),
|
||||
'issue_ref': '$issue_ref' if '$issue_ref' else None,
|
||||
'timestamp': '$timestamp',
|
||||
'read': False
|
||||
}))")
|
||||
}
|
||||
|
||||
notifications=$(python3 -c "import json; n=json.loads('$notifications'); n.append(json.loads('$new_notification')); print(json.dumps(n[-50:] if len(n)>50 else n, indent=2))")
|
||||
notifications.append(new_notification)
|
||||
notifications = notifications[-50:] if len(notifications) > 50 else notifications
|
||||
|
||||
print(json.dumps(notifications, indent=2))
|
||||
")
|
||||
|
||||
echo "$notifications" > "$NOTIFICATIONS_FILE"
|
||||
}
|
||||
|
||||
@@ -81,9 +81,20 @@ EOF
|
||||
echo "Press Ctrl+C to cancel or wait for session to be created"
|
||||
sleep 2
|
||||
|
||||
local before_sessions=$(opencode session list 2>/dev/null | grep -E '^ses_' | awk '{print $1}' || true)
|
||||
|
||||
opencode
|
||||
|
||||
local session_ids=$(opencode session list 2>/dev/null | grep -E '^ses_' | awk '{print $1}' | tail -1)
|
||||
local after_sessions=$(opencode session list 2>/dev/null | grep -E '^ses_' | awk '{print $1}' || true)
|
||||
local session_ids=""
|
||||
while IFS= read -r line; do
|
||||
local sid=$(echo "$line" | awk '{print $1}')
|
||||
if [ -n "$sid" ] && ! echo "$before_sessions" | grep -q "^${sid}$"; then
|
||||
session_ids="$sid"
|
||||
break
|
||||
fi
|
||||
done <<< "$after_sessions"
|
||||
|
||||
if [ -z "$session_ids" ]; then
|
||||
echo "Error: Could not find newly created session" >&2
|
||||
exit 1
|
||||
@@ -95,9 +106,20 @@ EOF
|
||||
echo "Base session created: $session_ids"
|
||||
echo "Starting PM agent..."
|
||||
|
||||
before_sessions="$after_sessions"
|
||||
|
||||
opencode
|
||||
|
||||
local pm_session_ids=$(opencode session list 2>/dev/null | grep -E '^ses_' | grep -v "$session_ids" | tail -1)
|
||||
after_sessions=$(opencode session list 2>/dev/null | grep -E '^ses_' | awk '{print $1}' || true)
|
||||
local pm_session_ids=""
|
||||
while IFS= read -r line; do
|
||||
local sid=$(echo "$line" | awk '{print $1}')
|
||||
if [ -n "$sid" ] && ! echo "$before_sessions" | grep -q "^${sid}$"; then
|
||||
pm_session_ids="$sid"
|
||||
break
|
||||
fi
|
||||
done <<< "$after_sessions"
|
||||
|
||||
if [ -z "$pm_session_ids" ]; then
|
||||
echo "Warning: Could not find separate PM agent session" >&2
|
||||
pm_session_ids="$session_ids"
|
||||
@@ -134,13 +156,11 @@ extract_issue_ref_from_message() {
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$message" =~ (https?://[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+/(issues|pull)/[0-9]+) ]]; then
|
||||
local url="${BASH_REMATCH[1]}"
|
||||
local path=$(echo "$url" | sed 's|https\?://||' | cut -d'/' -f2-)
|
||||
local instance=$(echo "$path" | cut -d'/' -f1)
|
||||
local owner=$(echo "$path" | cut -d'/' -f2)
|
||||
local repo=$(echo "$path" | cut -d'/' -f3)
|
||||
local num=$(echo "$path" | grep -oE '[0-9]+$')
|
||||
if [[ "$message" =~ (https?://)?([a-zA-Z0-9.-]+)/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+)/(issues|pull)/([0-9]+) ]]; then
|
||||
local instance="${BASH_REMATCH[2]}"
|
||||
local owner="${BASH_REMATCH[3]}"
|
||||
local repo="${BASH_REMATCH[4]}"
|
||||
local num="${BASH_REMATCH[6]}"
|
||||
echo "${instance}/${owner}/${repo}#${num}"
|
||||
return
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user