feat(cmd/t): prompt for archival on completion

Amolith and Crush created

Co-authored-by: Crush <crush@charm.land>

Change summary

cmd/t/u.go | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Detailed changes

cmd/t/u.go 🔗

@@ -180,7 +180,20 @@ func runUpdateTask(cmd *cobra.Command, _ []string) error {
 	out := cmd.OutOrStdout()
 	_, _ = fmt.Fprintln(out, "")
 	if statusOnlyChanged && newStatus == task.StatusCompleted {
-		_, _ = fmt.Fprintln(out, "Task marked completed. Continue working through remaining tasks with `np t u`.")
+		pending, err := env.TaskStore.ListByStatus(cmd.Context(), sessionDoc.SID, task.StatusPending)
+		if err != nil {
+			return err
+		}
+		inProgress, err := env.TaskStore.ListByStatus(cmd.Context(), sessionDoc.SID, task.StatusInProgress)
+		if err != nil {
+			return err
+		}
+		
+		if len(pending) == 0 && len(inProgress) == 0 {
+			_, _ = fmt.Fprintln(out, "No pending tasks remaining. If you've completed the goal, escalate to the operator and obtain confirmation before archiving the session with `np a`.")
+		} else {
+			_, _ = fmt.Fprintln(out, "Task marked completed. Continue working through remaining tasks with `np t u`.")
+		}
 	} else {
 		_, _ = fmt.Fprintln(out, "Task updated. Use `np p` to review the full plan.")
 	}