()
| 315 | |
| 316 | |
| 317 | def main() -> None: |
| 318 | parser = argparse.ArgumentParser( |
| 319 | prog="coderlm", |
| 320 | description="Generate CodeRLM instruction files for AI coding platforms", |
| 321 | ) |
| 322 | parser.add_argument( |
| 323 | "--platform", |
| 324 | help="Platform to generate for (or 'all')", |
| 325 | ) |
| 326 | parser.add_argument( |
| 327 | "--list", |
| 328 | action="store_true", |
| 329 | help="List available platforms", |
| 330 | ) |
| 331 | parser.add_argument( |
| 332 | "--dry-run", |
| 333 | action="store_true", |
| 334 | help="Show what would be done without writing files", |
| 335 | ) |
| 336 | parser.add_argument( |
| 337 | "--clean", |
| 338 | action="store_true", |
| 339 | help="Remove generated files for the specified platform", |
| 340 | ) |
| 341 | parser.add_argument( |
| 342 | "--project-root", |
| 343 | type=Path, |
| 344 | default=Path.cwd(), |
| 345 | help="Project root directory (default: current directory)", |
| 346 | ) |
| 347 | |
| 348 | args = parser.parse_args() |
| 349 | |
| 350 | if args.list: |
| 351 | list_platforms() |
| 352 | return |
| 353 | |
| 354 | if not args.platform: |
| 355 | parser.print_help() |
| 356 | sys.exit(1) |
| 357 | |
| 358 | # Resolve platforms |
| 359 | if args.platform == "all": |
| 360 | targets = list(PLATFORMS.values()) |
| 361 | elif args.platform in PLATFORMS: |
| 362 | targets = [PLATFORMS[args.platform]] |
| 363 | else: |
| 364 | print(f"ERROR: Unknown platform '{args.platform}'", file=sys.stderr) |
| 365 | print(f"Available: {', '.join(PLATFORMS.keys())}, all", file=sys.stderr) |
| 366 | sys.exit(1) |
| 367 | |
| 368 | project_root = args.project_root.resolve() |
| 369 | action = "clean" if args.clean else "generate" |
| 370 | |
| 371 | if args.dry_run: |
| 372 | print(f"[DRY RUN] {action} for: {', '.join(t.name for t in targets)}") |
| 373 | else: |
| 374 | print(f"{action.title()} for: {', '.join(t.name for t in targets)}") |
no test coverage detected