|
|
|
|
@@ -58,6 +58,25 @@ EOF
|
|
|
|
|
echo "Created config file: $KUGETSU_DIR/config"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
mkdir -p "$ENV_DIR"
|
|
|
|
|
if [ ! -f "$ENV_DIR/default.env" ]; then
|
|
|
|
|
cat > "$ENV_DIR/default.env" << 'EOF'
|
|
|
|
|
# Environment variables for agents
|
|
|
|
|
# Copy this file to <agent-type>.env (e.g., pm-agent.env, dev.env)
|
|
|
|
|
# and set your tokens and configuration
|
|
|
|
|
|
|
|
|
|
# Required: Gitea token for API access
|
|
|
|
|
# GITEA_TOKEN=your_gitea_token_here
|
|
|
|
|
|
|
|
|
|
# Optional: GitHub token (if using GitHub)
|
|
|
|
|
# GITHUB_TOKEN=your_github_token_here
|
|
|
|
|
|
|
|
|
|
# Optional: GitLab token (if using GitLab)
|
|
|
|
|
# GITLAB_TOKEN=your_gitlab_token_here
|
|
|
|
|
EOF
|
|
|
|
|
echo "Created env template: $ENV_DIR/default.env"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
local existing_base=$(get_base_session_id)
|
|
|
|
|
local existing_pm=$(get_pm_agent_session_id)
|
|
|
|
|
|
|
|
|
|
@@ -194,8 +213,8 @@ cmd_delegate() {
|
|
|
|
|
|
|
|
|
|
mkdir -p "$LOGS_DIR"
|
|
|
|
|
local log_file="$LOGS_DIR/delegate-$(date +%s).log"
|
|
|
|
|
nohup sh -c "GITEA_TOKEN='***' opencode run '$message' --continue --session '$pm_session' >> '$log_file' 2>&1" > /dev/null 2>&1 &
|
|
|
|
|
disown
|
|
|
|
|
load_agent_env "pm-agent"
|
|
|
|
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --continue --session '$pm_session'" >> "$log_file" 2>&1 &
|
|
|
|
|
echo "Delegated to PM agent (logged to $(basename "$log_file"))"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -313,7 +332,8 @@ cmd_start() {
|
|
|
|
|
|
|
|
|
|
load_agent_env "dev"
|
|
|
|
|
|
|
|
|
|
(cd "$worktree_path" && nohup sh -c "GITEA_TOKEN='$GITEA_TOKEN' opencode run '$dev_message' --continue --session '$new_session_id'" >> "$LOGS_DIR/dev-$new_session_id.log" 2>&1 &) && disown
|
|
|
|
|
cd "$worktree_path"
|
|
|
|
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$dev_message' --continue --session '$new_session_id'" >> "$LOGS_DIR/dev-$new_session_id.log" 2>&1 &
|
|
|
|
|
|
|
|
|
|
echo "Session started for '$issue_ref': $new_session_id"
|
|
|
|
|
echo "Worktree: $worktree_path"
|
|
|
|
|
@@ -367,9 +387,10 @@ cmd_continue() {
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -n "$worktree_path" ] && [ -d "$worktree_path" ]; then
|
|
|
|
|
(cd "$worktree_path" && nohup sh -c "GITEA_TOKEN='$GITEA_TOKEN' opencode run '$message' --continue --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 &) && disown
|
|
|
|
|
cd "$worktree_path"
|
|
|
|
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --continue --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 &
|
|
|
|
|
else
|
|
|
|
|
nohup sh -c "GITEA_TOKEN='$GITEA_TOKEN' opencode run '$message' --continue --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 & && disown
|
|
|
|
|
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --continue --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 &
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -521,7 +542,7 @@ cmd_destroy() {
|
|
|
|
|
local target="${1:-}"
|
|
|
|
|
local force=false
|
|
|
|
|
|
|
|
|
|
if [ "$2" = "-y" ]; then
|
|
|
|
|
if [ "${2:-}" = "-y" ]; then
|
|
|
|
|
force=true
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|