Coverage for little_loops / cli / issues / next_issue.py: 0%
19 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-04-02 13:03 -0500
« prev ^ index » next coverage.py v7.12.0, created at 2026-04-02 13:03 -0500
1"""ll-issues next-issue: Print the highest-confidence active issue."""
3from __future__ import annotations
5import argparse
6from typing import TYPE_CHECKING
8if TYPE_CHECKING:
9 from little_loops.config import BRConfig
12def cmd_next_issue(config: BRConfig, args: argparse.Namespace) -> int:
13 """Print the highest-confidence active issue.
15 Sort key: (-(outcome_confidence or -1), -(confidence_score or -1), priority_int)
17 Args:
18 config: Project configuration
19 args: Parsed arguments with optional .json and .path flags
21 Returns:
22 Exit code (0 = found, 1 = no issues)
23 """
24 from little_loops.cli.output import print_json
25 from little_loops.issue_parser import find_issues
27 issues = find_issues(config)
28 if not issues:
29 return 1
31 issues.sort(
32 key=lambda i: (
33 -(i.outcome_confidence if i.outcome_confidence is not None else -1),
34 -(i.confidence_score if i.confidence_score is not None else -1),
35 i.priority_int,
36 )
37 )
39 top = issues[0]
41 if getattr(args, "json", False):
42 print_json(
43 {
44 "id": top.issue_id,
45 "path": str(top.path),
46 "outcome_confidence": top.outcome_confidence,
47 "confidence_score": top.confidence_score,
48 "priority": top.priority,
49 }
50 )
51 return 0
53 if getattr(args, "path", False):
54 print(str(top.path))
55 return 0
57 print(top.issue_id)
58 return 0