Skip to content

feat: add repository filtering options to nut import#21

Merged
stefreak merged 3 commits intomainfrom
copilot/add-skip-options-for-import
Nov 30, 2025
Merged

feat: add repository filtering options to nut import#21
stefreak merged 3 commits intomainfrom
copilot/add-skip-options-for-import

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 30, 2025

Adds --skip-forks, --skip-private, --skip-internal, --skip-public, and --include-archived flags to nut import for selective repository import.

Changes

  • CLI flags: Five boolean filters on the Import command for fork, private, internal, public, and archived repository types
  • Default behavior: Archived repositories are now skipped by default (use --include-archived to override)
  • Filtering logic: should_skip_repo() checks repository metadata (archived, fork, private, visibility fields from octocrab's Repository model)
  • Code deduplication: Extracted duplicated clone logic from three match branches into process_repo() helper function (~75 lines consolidated)
  • Refactoring: Created RepoFilters struct to group filter parameters and improve code maintainability

Usage

# Import only non-fork repositories from a user
nut import --user octocat --skip-forks

# Import only public repositories from an organization (excluding archived by default)
nut import --org github --skip-private --skip-internal

# Include archived repositories
nut import --user octocat --include-archived

# Combine multiple filters
nut import --user octocat --skip-forks --skip-private

CLI help showing all filter options

Filters are applied during streaming enumeration, so skipped repositories are never cloned.

Custom agent used: Señora Nut Engineer
Software Engineering Agent

Original prompt

Implement --skip-forks, --skip-private, --skip-internal, and --skip-public options for nut import.
Maybe use the chance to deduplicate some of the github client code.
But keep it simple.
Don't write tests unless they can succeed without access to the github api, but also don't write tests that don't do much.

Custom agent used: Señora Nut Engineer
Software Engineering Agent


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: stefreak <139624+stefreak@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement skip options for nut import command feat: add repository filtering options to nut import Nov 30, 2025
Copilot AI requested a review from stefreak November 30, 2025 12:47
@stefreak
Copy link
Copy Markdown
Owner

@copilot skip archived repos by default, but implement an option --include-archived

Co-authored-by: stefreak <139624+stefreak@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 30, 2025

@copilot skip archived repos by default, but implement an option --include-archived

Done in adc2839. Archived repositories are now skipped by default. Added --include-archived flag to override this behavior when needed.

CLI help showing --include-archived flag

@stefreak stefreak marked this pull request as ready for review November 30, 2025 13:25
@stefreak stefreak merged commit 403f2d9 into main Nov 30, 2025
9 checks passed
@stefreak stefreak deleted the copilot/add-skip-options-for-import branch November 30, 2025 13:27
@github-actions github-actions Bot mentioned this pull request Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants