Coverage for little_loops / cli / auto.py: 33%
27 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-03-18 16:18 -0500
« prev ^ index » next coverage.py v7.12.0, created at 2026-03-18 16:18 -0500
1"""ll-auto: Process all backlog issues sequentially in priority order."""
3from __future__ import annotations
5import argparse
6import os
7from pathlib import Path
9from little_loops.cli.output import configure_output
10from little_loops.cli_args import (
11 add_common_auto_args,
12 parse_issue_ids,
13 parse_issue_ids_ordered,
14 parse_issue_types,
15)
16from little_loops.config import BRConfig
17from little_loops.issue_manager import AutoManager
20def main_auto() -> int:
21 """Entry point for ll-auto command.
23 Process all backlog issues sequentially in priority order.
25 Returns:
26 Exit code (0 = success)
27 """
28 parser = argparse.ArgumentParser(
29 description="Process all backlog issues sequentially in priority order",
30 formatter_class=argparse.RawDescriptionHelpFormatter,
31 epilog="""
32Examples:
33 %(prog)s # Process all issues in priority order
34 %(prog)s --max-issues 5 # Process at most 5 issues
35 %(prog)s --resume # Resume from previous state
36 %(prog)s --dry-run # Preview what would be processed
37 %(prog)s --category bugs # Only process bugs
38 %(prog)s --only BUG-001,BUG-002 # Process only specific issues
39 %(prog)s --skip BUG-003 # Skip specific issues
40 %(prog)s --type BUG # Process only bugs
41 %(prog)s --type BUG,ENH # Process bugs and enhancements
42""",
43 )
45 # Add common arguments from shared module
46 add_common_auto_args(parser)
48 # Add tool-specific arguments
49 parser.add_argument(
50 "--category",
51 "-c",
52 type=str,
53 default=None,
54 help="Filter to specific category (bugs, features, enhancements)",
55 )
57 args = parser.parse_args()
59 project_root = args.config or Path.cwd()
60 config = BRConfig(project_root)
61 configure_output(config.cli)
63 if args.idle_timeout is not None:
64 config.automation.idle_timeout_seconds = args.idle_timeout
66 if args.handoff_threshold is not None:
67 if not (1 <= args.handoff_threshold <= 100):
68 parser.error("--handoff-threshold must be between 1 and 100")
69 os.environ["LL_HANDOFF_THRESHOLD"] = str(args.handoff_threshold)
71 # Parse issue ID filters
72 only_ids = parse_issue_ids_ordered(args.only)
73 skip_ids = parse_issue_ids(args.skip)
74 type_prefixes = parse_issue_types(args.type)
76 manager = AutoManager(
77 config=config,
78 dry_run=args.dry_run,
79 max_issues=args.max_issues,
80 resume=args.resume,
81 category=args.category,
82 only_ids=only_ids,
83 skip_ids=skip_ids,
84 type_prefixes=type_prefixes,
85 verbose=not args.quiet,
86 )
88 return manager.run()