Compare commits
1 Commits
fix/issue-
...
4ec76b1248
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ec76b1248 |
@@ -32,7 +32,7 @@ if [ -f "$KUGETSU_DIR/config" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mask_sensitive_vars() {
|
mask_sensitive_vars() {
|
||||||
local line="${1:-}"
|
local line="$1"
|
||||||
for var in GITEA_TOKEN GITHUB_TOKEN GITLAB_TOKEN API_KEY PASSWORD TOKEN SECRET; do
|
for var in GITEA_TOKEN GITHUB_TOKEN GITLAB_TOKEN API_KEY PASSWORD TOKEN SECRET; do
|
||||||
if [[ "$line" =~ $var ]]; then
|
if [[ "$line" =~ $var ]]; then
|
||||||
line=$(echo "$line" | sed -E "s/=.*/=***MASKED***/")
|
line=$(echo "$line" | sed -E "s/=.*/=***MASKED***/")
|
||||||
|
|||||||
@@ -1,40 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
source "$SCRIPT_DIR/kugetsu-config.sh"
|
|
||||||
|
|
||||||
log() {
|
|
||||||
local level="${1:-}"
|
|
||||||
local component="${2:-}"
|
|
||||||
local message="${3:-}"
|
|
||||||
local timestamp
|
|
||||||
timestamp=$(date -Iseconds)
|
|
||||||
|
|
||||||
case "$level" in
|
|
||||||
info|warn|error|debug) ;;
|
|
||||||
*)
|
|
||||||
echo "Error: log level must be info|warn|error|debug" >&2
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$message" ]; then
|
|
||||||
message="$component"
|
|
||||||
component="${level}"
|
|
||||||
level="info"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local masked
|
|
||||||
masked=$(mask_sensitive_vars "$message")
|
|
||||||
echo "[$timestamp] $level $component $masked"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_debug() { log "debug" "$1" "${2:-}"; }
|
|
||||||
log_info() { log "info" "$1" "${2:-}"; }
|
|
||||||
log_warn() { log "warn" "$1" "${2:-}"; }
|
|
||||||
log_error() { log "error" "$1" "${2:-}"; }
|
|
||||||
|
|
||||||
cmd_logs() {
|
cmd_logs() {
|
||||||
local count="${1:-10}"
|
local count="${1:-10}"
|
||||||
|
|
||||||
|
|||||||
@@ -83,10 +83,6 @@ EOF
|
|||||||
if [ -n "$existing_base" ] && [ "$existing_base" != "null" ]; then
|
if [ -n "$existing_base" ] && [ "$existing_base" != "null" ]; then
|
||||||
if [ "$force" = true ]; then
|
if [ "$force" = true ]; then
|
||||||
echo "Warning: Reinitializing sessions (force mode)" >&2
|
echo "Warning: Reinitializing sessions (force mode)" >&2
|
||||||
echo "Destroying all sessions, worktrees, and logs..." >&2
|
|
||||||
cmd_destroy --base -y 2>/dev/null || true
|
|
||||||
cmd_destroy --pm-agent -y 2>/dev/null || true
|
|
||||||
rm -f "$LOGS_DIR"/*.log 2>/dev/null || true
|
|
||||||
else
|
else
|
||||||
echo "Error: Base session already exists: $existing_base" >&2
|
echo "Error: Base session already exists: $existing_base" >&2
|
||||||
echo "Use --force to reinitialize" >&2
|
echo "Use --force to reinitialize" >&2
|
||||||
@@ -423,12 +419,12 @@ cmd_continue() {
|
|||||||
local issue_ref=$(python3 -c "import json; print(json.load(open('$session_path')).get('issue_ref', ''))" 2>/dev/null || echo "")
|
local issue_ref=$(python3 -c "import json; print(json.load(open('$session_path')).get('issue_ref', ''))" 2>/dev/null || echo "")
|
||||||
|
|
||||||
if [ -z "$worktree_path" ] || [ ! -d "$worktree_path" ]; then
|
if [ -z "$worktree_path" ] || [ ! -d "$worktree_path" ]; then
|
||||||
echo "Warning: Worktree is missing for '$session_name'. Recovering..." >&2
|
echo "Error: Worktree is missing for '$session_name'" >&2
|
||||||
|
echo "Removing stale session file..." >&2
|
||||||
rm -f "$session_path"
|
rm -f "$session_path"
|
||||||
remove_issue_from_index "$session_name"
|
remove_issue_from_index "$session_name"
|
||||||
echo "Calling cmd_start to create new session and worktree..." >&2
|
echo "Use 'kugetsu start $session_name' to create a new session." >&2
|
||||||
cmd_start "$session_name" "$message"
|
exit 1
|
||||||
return $?
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$message" ]; then
|
if [ -z "$message" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user