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