Compare commits

...

8 Commits

Author SHA1 Message Date
shokollm
62ea2564b8 Revert "Merge pull request 'feat(kugetsu): add lock mechanism for worktree coordination' (#96) from feat/issue-71-lock-mechanism-v2 into main"
This reverts commit 8a72509452, reversing
changes made to e1050cb70a.
2026-04-02 03:12:40 +00:00
shokollm
7ee4e66407 Revert "Merge pull request 'feat(kugetsu): add queue infrastructure for autonomous PM' (#97) from feat/issue-49-queue-v2 into main"
This reverts commit e1050cb70a, reversing
changes made to caf1e9cdcd.
2026-04-02 03:11:52 +00:00
b5e2dfbb4e Merge pull request 'feat(kugetsu): add KUGETSU_VERBOSITY for PM agent output control' (#98) from feat/issue-46-verbosity-v3 into main 2026-04-02 04:54:11 +02:00
8a72509452 Merge pull request 'feat(kugetsu): add lock mechanism for worktree coordination' (#96) from feat/issue-71-lock-mechanism-v2 into main 2026-04-02 04:52:45 +02:00
shokollm
990bc46477 feat(kugetsu): add lock mechanism for worktree coordination
Add lock mechanism to prevent concurrent access to worktrees:
- Add LOCKS_DIR constant (~/.kugetsu/locks)
- Add acquire_lock() - acquires lock file with PID, session_id, timestamp
- Add release_lock() - releases lock if held by current process
- Add release_all_locks() - releases all locks for a session
- Add check_lock() - check if issue is locked
- Modify cmd_start to acquire lock before creating worktree
- Modify cmd_destroy to release lock when destroying session
- Add trap for cleanup on EXIT/INT/TERM

Lock files named after issue ref. Stale lock detection: if PID
no longer exists, lock is considered stale.

Fixes #71
2026-04-02 02:52:16 +00:00
shokollm
10cca9d67e feat(kugetsu): add KUGETSU_VERBOSITY for PM agent output control
Add KUGETSU_VERBOSITY environment variable with three modes:
- default (default): Normal balanced output
- verbose: High verbosity with all context
- quiet: Minimal output, essential info only

Export KUGETSU_VERBOSITY in cmd_delegate when running opencode.

Fixes #46
2026-04-02 02:47:38 +00:00
e1050cb70a Merge pull request 'feat(kugetsu): add queue infrastructure for autonomous PM' (#97) from feat/issue-49-queue-v2 into main 2026-04-02 04:37:41 +02:00
shokollm
0f66de2929 feat(kugetsu): add queue infrastructure for autonomous PM
Add queue management system for task queue architecture (Phase 1):

- Add QUEUE_FILE and POLL_INTERVAL constants
- Add init_queue() to initialize queue.json if missing
- Add cmd_queue with subcommands:
  - list: Show queue status with counts per tier
  - enqueue <tier> <msg>: Add task to queue
  - dequeue [tier]: Remove and return next task (priority order)
  - clear: Clear all queued tasks

Queue tiers:
- dev_followups (highest priority)
- user_interrupts (medium)
- background (lowest)

This enables the autonomous queue-based architecture where PM agent
continuously polls the queue and assigns work to dev agents.

Part of #49
2026-04-02 01:04:10 +00:00

View File

@@ -9,7 +9,9 @@ INDEX_FILE="$KUGETSU_DIR/index.json"
NOTIFICATIONS_FILE="$KUGETSU_DIR/notifications.json" NOTIFICATIONS_FILE="$KUGETSU_DIR/notifications.json"
LOGS_DIR="$KUGETSU_DIR/logs" LOGS_DIR="$KUGETSU_DIR/logs"
ENV_DIR="${ENV_DIR:-$KUGETSU_DIR/env}" ENV_DIR="${ENV_DIR:-$KUGETSU_DIR/env}"
MAX_CONCURRENT_AGENTS="${MAX_CONCURRENT_AGENTS:-3}" MAX_CONCURRENT_AGENTS="${MAX_CONCURRENT_AGENTS:-3}"
KUGETSU_VERBOSITY="${KUGETSU_VERBOSITY:-default}"
# Load user config overrides (~/.kugetsu/config) # Load user config overrides (~/.kugetsu/config)
if [ -f "$KUGETSU_DIR/config" ]; then if [ -f "$KUGETSU_DIR/config" ]; then
@@ -547,6 +549,7 @@ cmd_status() {
cmd_delegate() { cmd_delegate() {
local message="${1:-}" local message="${1:-}"
local verbosity="${KUGETSU_VERBOSITY:-default}"
if [ -z "$message" ]; then if [ -z "$message" ]; then
echo "Error: message is required" >&2 echo "Error: message is required" >&2
@@ -566,7 +569,7 @@ cmd_delegate() {
local temp_dir="${KUGETSU_TEMP_DIR:-$HOME/.local/share/opencode/tool-output}" local temp_dir="${KUGETSU_TEMP_DIR:-$HOME/.local/share/opencode/tool-output}"
mkdir -p "$ENV_DIR" mkdir -p "$ENV_DIR"
local env_sh="set -a; export KUGETSU_TEMP_DIR='$temp_dir'; " local env_sh="set -a; export KUGETSU_TEMP_DIR='$temp_dir'; export KUGETSU_VERBOSITY='$verbosity'; "
if [ -f "$ENV_DIR/pm-agent.env" ]; then if [ -f "$ENV_DIR/pm-agent.env" ]; then
env_sh="${env_sh}source '$ENV_DIR/pm-agent.env'; " env_sh="${env_sh}source '$ENV_DIR/pm-agent.env'; "
elif [ -f "$ENV_DIR/default.env" ]; then elif [ -f "$ENV_DIR/default.env" ]; then
@@ -577,6 +580,7 @@ cmd_delegate() {
nohup sh -c "${env_sh}opencode run '$message' --continue --session '$pm_session' >> '$log_file' 2>&1" > /dev/null 2>&1 & nohup sh -c "${env_sh}opencode run '$message' --continue --session '$pm_session' >> '$log_file' 2>&1" > /dev/null 2>&1 &
disown disown
echo "Delegated to PM agent (logged to $(basename "$log_file"))" echo "Delegated to PM agent (logged to $(basename "$log_file"))"
echo "Verbosity: $verbosity"
} }
cmd_logs() { cmd_logs() {