Skip to content

feat: add pattern support to bit fork command#10094

Merged
davidfirst merged 7 commits intomasterfrom
fork-pattern-support
Nov 26, 2025
Merged

feat: add pattern support to bit fork command#10094
davidfirst merged 7 commits intomasterfrom
fork-pattern-support

Conversation

@davidfirst
Copy link
Member

@davidfirst davidfirst commented Nov 25, 2025

Support patterns in bit fork command.

Changes

  • Added pattern detection to bit fork command using hasWildcard()
  • Pattern mode forks all matching components with same names to target scope
  • Validation prevents target-component-name when using patterns
  • Target scope required via --scope flag or workspace defaultScope
  • Supports both workspace and remote component patterns
  • Added forkByPattern() method in ForkingMain
  • Added e2e tests for pattern forking functionality

Usage Examples

# Fork all components from a scope
bit fork "org.scope/**" --scope my-org.my-scope

# Fork specific components matching pattern
bit fork "org.scope/utils/*" --scope my-scope

# Fork to defaultScope (when configured in workspace)
bit fork "org.scope/**"

Benefits

  • Intuitive UX - users naturally try patterns with bit fork
  • Consistent with other Bit commands that support patterns
  • Enables cross-scope pattern forking
  • No breaking changes - existing usage continues to work
  • bit scope fork remains useful as convenience command

- Updated fork command to accept patterns for forking multiple components
- Pattern mode forks all matching components with same names to target scope
- Added validation to prevent target-component-name when using patterns
- Target scope required via --scope flag or workspace defaultScope
- Supports both workspace and remote component patterns
- Added e2e tests for pattern forking functionality
targetScope will be handled naturally by downstream code
- Extract scope names from pattern to query remote scopes
- Support comma-separated patterns across multiple scopes
- Works with empty workspace forking remote components
- Uses filterIdsFromPoolIdsByPattern for consistent pattern matching
- Filter out components that already exist with target scope
- Fork remaining components without error
- Only error if ALL components already exist
- More user-friendly when re-running fork command
- Detect patterns using wildcards or commas
- Add forkByPattern method to handle multiple component forking
- Support cross-scope pattern matching for remote components
- Filter out already-forked components to avoid conflicts
- Add e2e tests for pattern-based forking scenarios
@davidfirst davidfirst enabled auto-merge (squash) November 26, 2025 00:51
@davidfirst davidfirst merged commit 1da379f into master Nov 26, 2025
12 checks passed
@davidfirst davidfirst deleted the fork-pattern-support branch November 26, 2025 01:31
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