Coverage for little_loops / cli / auto.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2026-03-04 01:17 -0600

1"""ll-auto: Process all backlog issues sequentially in priority order.""" 

2 

3from __future__ import annotations 

4 

5import argparse 

6from pathlib import Path 

7 

8from little_loops.cli_args import add_common_auto_args, parse_issue_ids, parse_issue_types 

9from little_loops.config import BRConfig 

10from little_loops.issue_manager import AutoManager 

11 

12 

13def main_auto() -> int: 

14 """Entry point for ll-auto command. 

15 

16 Process all backlog issues sequentially in priority order. 

17 

18 Returns: 

19 Exit code (0 = success) 

20 """ 

21 parser = argparse.ArgumentParser( 

22 description="Process all backlog issues sequentially in priority order", 

23 formatter_class=argparse.RawDescriptionHelpFormatter, 

24 epilog=""" 

25Examples: 

26 %(prog)s # Process all issues in priority order 

27 %(prog)s --max-issues 5 # Process at most 5 issues 

28 %(prog)s --resume # Resume from previous state 

29 %(prog)s --dry-run # Preview what would be processed 

30 %(prog)s --category bugs # Only process bugs 

31 %(prog)s --only BUG-001,BUG-002 # Process only specific issues 

32 %(prog)s --skip BUG-003 # Skip specific issues 

33 %(prog)s --type BUG # Process only bugs 

34 %(prog)s --type BUG,ENH # Process bugs and enhancements 

35""", 

36 ) 

37 

38 # Add common arguments from shared module 

39 add_common_auto_args(parser) 

40 

41 # Add tool-specific arguments 

42 parser.add_argument( 

43 "--category", 

44 "-c", 

45 type=str, 

46 default=None, 

47 help="Filter to specific category (bugs, features, enhancements)", 

48 ) 

49 

50 args = parser.parse_args() 

51 

52 project_root = args.config or Path.cwd() 

53 config = BRConfig(project_root) 

54 

55 # Parse issue ID filters 

56 only_ids = parse_issue_ids(args.only) 

57 skip_ids = parse_issue_ids(args.skip) 

58 type_prefixes = parse_issue_types(args.type) 

59 

60 manager = AutoManager( 

61 config=config, 

62 dry_run=args.dry_run, 

63 max_issues=args.max_issues, 

64 resume=args.resume, 

65 category=args.category, 

66 only_ids=only_ids, 

67 skip_ids=skip_ids, 

68 type_prefixes=type_prefixes, 

69 verbose=not args.quiet, 

70 ) 

71 

72 return manager.run()