Coverage for little_loops / cli / auto.py: 27%
33 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-04-11 23:20 -0500
« prev ^ index » next coverage.py v7.12.0, created at 2026-04-11 23:20 -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 parse_priorities,
16)
17from little_loops.config import BRConfig
18from little_loops.issue_manager import AutoManager
21def main_auto() -> int:
22 """Entry point for ll-auto command.
24 Process all backlog issues sequentially in priority order.
26 Returns:
27 Exit code (0 = success)
28 """
29 parser = argparse.ArgumentParser(
30 description="Process all backlog issues sequentially in priority order",
31 formatter_class=argparse.RawDescriptionHelpFormatter,
32 epilog="""
33Examples:
34 %(prog)s # Process all issues in priority order
35 %(prog)s --max-issues 5 # Process at most 5 issues
36 %(prog)s --resume # Resume from previous state
37 %(prog)s --dry-run # Preview what would be processed
38 %(prog)s --category bugs # Only process bugs
39 %(prog)s --only BUG-001,BUG-002 # Process only specific issues
40 %(prog)s --skip BUG-003 # Skip specific issues
41 %(prog)s --type BUG # Process only bugs
42 %(prog)s --type BUG,ENH # Process bugs and enhancements
43 %(prog)s --priority P1,P2 # Only process P1 and P2 issues
44""",
45 )
47 # Add common arguments from shared module
48 add_common_auto_args(parser)
50 # Add tool-specific arguments
51 parser.add_argument(
52 "--category",
53 "-c",
54 type=str,
55 default=None,
56 help="Filter to specific category (bugs, features, enhancements)",
57 )
58 parser.add_argument(
59 "--verbose",
60 "-v",
61 action="store_true",
62 help="Enable verbose output (default when --quiet is not set)",
63 )
65 args = parser.parse_args()
67 project_root = args.config or Path.cwd()
68 config = BRConfig(project_root)
69 configure_output(config.cli)
71 if args.idle_timeout is not None:
72 config.automation.idle_timeout_seconds = args.idle_timeout
74 if args.handoff_threshold is not None:
75 if not (1 <= args.handoff_threshold <= 100):
76 parser.error("--handoff-threshold must be between 1 and 100")
77 os.environ["LL_HANDOFF_THRESHOLD"] = str(args.handoff_threshold)
79 if args.context_limit is not None:
80 if args.context_limit < 50000:
81 parser.error("--context-limit must be at least 50000")
82 os.environ["LL_CONTEXT_LIMIT"] = str(args.context_limit)
84 # Parse issue ID filters
85 only_ids = parse_issue_ids_ordered(args.only)
86 skip_ids = parse_issue_ids(args.skip)
87 type_prefixes = parse_issue_types(args.type)
88 priority_filter = parse_priorities(args.priority)
90 manager = AutoManager(
91 config=config,
92 dry_run=args.dry_run,
93 max_issues=args.max_issues,
94 resume=args.resume,
95 category=args.category,
96 only_ids=only_ids,
97 skip_ids=skip_ids,
98 type_prefixes=type_prefixes,
99 priority_filter=priority_filter,
100 verbose=args.verbose or not args.quiet,
101 preview_full=args.verbose,
102 )
104 return manager.run()