feat: wire --local-repo-path into create command and add validation

- Add --local-repo-path to UNIVERSAL_ARGUMENTS in create.py so it is
  registered in the actual parser (not just help display)
- Add --local-repo-path to GITHUB_ARGUMENTS in arguments/github.py for
  the standalone github subcommand
- Forward --local-repo-path through create_command._route_github() to
  github_scraper
- Add local_repo_path to the config dict built from CLI args in
  github_scraper.main()
- Add early validation in GitHubScraper.__init__(): warn and reset to
  None if path does not exist, triggering a real GitHub API fallback
  instead of silently operating with an empty file tree (fixes #281)
- Update test_create_arguments.py count/names assertions (17 -> 18)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-20 07:28:49 +03:00
parent 23e620070d
commit c996e88dac
5 changed files with 31 additions and 4 deletions

View File

@@ -212,7 +212,14 @@ class GitHubScraper:
self.local_repo_path = local_repo_path or config.get("local_repo_path")
if self.local_repo_path:
self.local_repo_path = os.path.expanduser(self.local_repo_path)
logger.info(f"Local repository mode enabled: {self.local_repo_path}")
if not os.path.isdir(self.local_repo_path):
logger.warning(
f"local_repo_path does not exist or is not a directory: {self.local_repo_path}"
)
logger.warning("Falling back to GitHub API mode (local_repo_path ignored)")
self.local_repo_path = None
else:
logger.info(f"Local repository mode enabled: {self.local_repo_path}")
# Configure directory exclusions (smart defaults + optional customization)
self.excluded_dirs = set(EXCLUDED_DIRS) # Start with smart defaults
@@ -1405,6 +1412,7 @@ def main():
"max_issues": args.max_issues,
"interactive": not args.non_interactive,
"github_profile": args.profile,
"local_repo_path": getattr(args, "local_repo_path", None),
}
else:
parser.error("Either --repo or --config is required")