fix: show mission context when no active session in coord status
Previously `mosaic coord status` only said "No active session" with no indication of whether a mission existed. Now shows mission name, status, milestones/tasks progress, and actionable next steps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,10 +38,91 @@ _require_jq
|
||||
|
||||
lock_data=""
|
||||
if ! lock_data="$(session_lock_read "$PROJECT")"; then
|
||||
if [[ "$FORMAT" == "json" ]]; then
|
||||
echo '{"status":"no-session"}'
|
||||
# No active session — but check if a mission exists
|
||||
mp="$(mission_path "$PROJECT")"
|
||||
if [[ -f "$mp" ]]; then
|
||||
m_status="$(jq -r '.status // "inactive"' "$mp")"
|
||||
m_name="$(jq -r '.name // "unnamed"' "$mp")"
|
||||
m_id="$(jq -r '.mission_id // ""' "$mp")"
|
||||
m_total="$(jq '.milestones | length' "$mp")"
|
||||
m_done="$(jq '[.milestones[] | select(.status == "completed")] | length' "$mp")"
|
||||
m_current="$(jq -r '[.milestones[] | select(.status == "active" or .status == "pending")][0].name // "none"' "$mp")"
|
||||
|
||||
# Task counts if TASKS.md exists
|
||||
task_json="$(count_tasks_md "$PROJECT")"
|
||||
t_total="$(echo "$task_json" | jq '.total')"
|
||||
t_done="$(echo "$task_json" | jq '.done')"
|
||||
t_pending="$(echo "$task_json" | jq '.pending')"
|
||||
t_inprog="$(echo "$task_json" | jq '.in_progress')"
|
||||
|
||||
if [[ "$FORMAT" == "json" ]]; then
|
||||
jq -n \
|
||||
--arg status "no-session" \
|
||||
--arg mission_status "$m_status" \
|
||||
--arg mission_name "$m_name" \
|
||||
--arg mission_id "$m_id" \
|
||||
--argjson milestones_total "$m_total" \
|
||||
--argjson milestones_done "$m_done" \
|
||||
--argjson tasks_total "$t_total" \
|
||||
--argjson tasks_done "$t_done" \
|
||||
'{
|
||||
status: $status,
|
||||
mission: {
|
||||
status: $mission_status,
|
||||
name: $mission_name,
|
||||
id: $mission_id,
|
||||
milestones_total: $milestones_total,
|
||||
milestones_done: $milestones_done,
|
||||
tasks_total: $tasks_total,
|
||||
tasks_done: $tasks_done
|
||||
}
|
||||
}'
|
||||
else
|
||||
echo ""
|
||||
echo -e " ${C_DIM}No active agent session.${C_RESET}"
|
||||
echo ""
|
||||
|
||||
# Mission info
|
||||
case "$m_status" in
|
||||
active) ms_color="${C_GREEN}ACTIVE${C_RESET}" ;;
|
||||
paused) ms_color="${C_YELLOW}PAUSED${C_RESET}" ;;
|
||||
completed) ms_color="${C_CYAN}COMPLETED${C_RESET}" ;;
|
||||
*) ms_color="${C_DIM}${m_status}${C_RESET}" ;;
|
||||
esac
|
||||
|
||||
echo -e " ${C_BOLD}Mission:${C_RESET} $m_name"
|
||||
echo -e " ${C_CYAN}Status:${C_RESET} $ms_color"
|
||||
echo -e " ${C_CYAN}ID:${C_RESET} $m_id"
|
||||
echo -e " ${C_CYAN}Milestones:${C_RESET} $m_done / $m_total completed"
|
||||
[[ "$m_current" != "none" ]] && echo -e " ${C_CYAN}Current:${C_RESET} $m_current"
|
||||
|
||||
if (( t_total > 0 )); then
|
||||
echo -e " ${C_CYAN}Tasks:${C_RESET} $t_done / $t_total done ($t_pending pending, $t_inprog in-progress)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
if [[ "$m_status" == "active" || "$m_status" == "paused" ]]; then
|
||||
echo -e " ${C_BOLD}Next steps:${C_RESET}"
|
||||
echo " mosaic coord continue Generate continuation prompt"
|
||||
echo " mosaic yolo claude Launch agent session"
|
||||
elif [[ "$m_status" == "completed" ]]; then
|
||||
echo -e " ${C_DIM}Mission completed. Start a new one with: mosaic coord init${C_RESET}"
|
||||
else
|
||||
echo -e " ${C_DIM}Initialize with: mosaic coord init --name \"Mission Name\"${C_RESET}"
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo -e "${C_DIM}No active session.${C_RESET}"
|
||||
if [[ "$FORMAT" == "json" ]]; then
|
||||
echo '{"status":"no-session","mission":null}'
|
||||
else
|
||||
echo ""
|
||||
echo -e " ${C_DIM}No active session.${C_RESET}"
|
||||
echo -e " ${C_DIM}No mission found.${C_RESET}"
|
||||
echo ""
|
||||
echo " Initialize with: mosaic coord init --name \"Mission Name\""
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
exit 4
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user