feat(phase3a): initial Chat Agent infrastructure
Phase 3a implementation - Hermes Chat Agent configuration: - kugetsu-chat/SOUL.md - Chat Agent persona and routing logic - kugetsu-chat/SKILL.md - Chat Agent skill documentation - kugetsu-chat/scripts/setup - Configuration setup script - kugetsu-pm/SKILL.md - PM Agent skill documentation - kugetsu-helpers/SKILL.md - Helper tools for Hermes-kugetsu integration - kugetsu-helpers/scripts/kugetsu-helpers - Shell functions for delegation Provides: - Intent classification (small talk, task, status, mode change) - PM Agent delegation via terminal() - kugetsu status checking - Session management helpers
This commit is contained in:
148
skills/kugetsu-helpers/scripts/kugetsu-helpers
Executable file
148
skills/kugetsu-helpers/scripts/kugetsu-helpers
Executable file
@@ -0,0 +1,148 @@
|
||||
#!/bin/bash
|
||||
# kugetsu-helpers - Shell functions for Hermes to interact with kugetsu
|
||||
#
|
||||
# These functions provide tools for routing and delegation to PM Agent.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
KUGETSU_DIR="${KUGETSU_DIR:-$HOME/.kugetsu}"
|
||||
INDEX_FILE="$KUGETSU_DIR/index.json"
|
||||
|
||||
kugetsu_get_pm_session() {
|
||||
if [ ! -f "$INDEX_FILE" ]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
|
||||
python3 -c "import json; print(json.load(open('$INDEX_FILE')).get('pm_agent', ''))" 2>/dev/null || echo ""
|
||||
}
|
||||
|
||||
kugetsu_check_status() {
|
||||
if [ ! -f "$INDEX_FILE" ]; then
|
||||
echo "kugetsu_not_initialized"
|
||||
return
|
||||
fi
|
||||
|
||||
if ! grep -q '"pm_agent"' "$INDEX_FILE"; then
|
||||
echo "pm_agent_missing"
|
||||
return
|
||||
fi
|
||||
|
||||
PM_AGENT=$(kugetsu_get_pm_session)
|
||||
if [ -z "$PM_AGENT" ] || [ "$PM_AGENT" = "null" ]; then
|
||||
echo "pm_agent_missing"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "ok"
|
||||
}
|
||||
|
||||
kugetsu_delegate_to_pm() {
|
||||
local task="${1:-}"
|
||||
|
||||
if [ -z "$task" ]; then
|
||||
echo "Error: task is required"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local pm_session=$(kugetsu_get_pm_session)
|
||||
if [ -z "$pm_session" ] || [ "$pm_session" = "null" ]; then
|
||||
echo "Error: PM agent session not found. Run 'kugetsu init' first."
|
||||
return 1
|
||||
fi
|
||||
|
||||
opencode run --continue --session "$pm_session" "$task" 2>&1
|
||||
}
|
||||
|
||||
kugetsu_list_sessions() {
|
||||
if command -v kugetsu &> /dev/null; then
|
||||
kugetsu list 2>&1
|
||||
else
|
||||
echo "kugetsu command not found"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
kugetsu_create_dev_session() {
|
||||
local issue_ref="${1:-}"
|
||||
local task="${2:-}"
|
||||
|
||||
if [ -z "$issue_ref" ] || [ -z "$task" ]; then
|
||||
echo "Error: issue_ref and task are required"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! command -v kugetsu &> /dev/null; then
|
||||
echo "Error: kugetsu command not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
kugetsu start "$issue_ref" "$task" 2>&1
|
||||
}
|
||||
|
||||
kugetsu_continue_dev_session() {
|
||||
local issue_ref="${1:-}"
|
||||
local update="${2:-}"
|
||||
|
||||
if [ -z "$issue_ref" ] || [ -z "$update" ]; then
|
||||
echo "Error: issue_ref and update are required"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! command -v kugetsu &> /dev/null; then
|
||||
echo "Error: kugetsu command not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
kugetsu continue "$issue_ref" "$update" 2>&1
|
||||
}
|
||||
|
||||
# Main entry point for CLI usage
|
||||
main() {
|
||||
local command="${1:-}"
|
||||
shift || true
|
||||
|
||||
case "$command" in
|
||||
get-pm-session)
|
||||
kugetsu_get_pm_session
|
||||
;;
|
||||
check-status)
|
||||
kugetsu_check_status
|
||||
;;
|
||||
delegate-to-pm)
|
||||
kugetsu_delegate_to_pm "$@"
|
||||
;;
|
||||
list-sessions)
|
||||
kugetsu_list_sessions
|
||||
;;
|
||||
create-dev-session)
|
||||
kugetsu_create_dev_session "$@"
|
||||
;;
|
||||
continue-dev-session)
|
||||
kugetsu_continue_dev_session "$@"
|
||||
;;
|
||||
help|--help|-h)
|
||||
cat << 'EOF'
|
||||
kugetsu-helpers - Hermes tools for kugetsu
|
||||
|
||||
Commands:
|
||||
get-pm-session Get PM agent session ID
|
||||
check-status Check kugetsu initialization status
|
||||
delegate-to-pm <task> Delegate task to PM agent
|
||||
list-sessions List all kugetsu sessions
|
||||
create-dev-session <ref> <task> Create dev agent session
|
||||
continue-dev-session <ref> <update> Continue dev agent session
|
||||
|
||||
Usage in Hermes:
|
||||
terminal(command="kugetsu_delegate_to_pm 'fix issue #5'")
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown command '$command'"
|
||||
echo "Run 'kugetsu-helpers help' for usage"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user