Unified the two repository import flows into one component (RepositorySelectionModal) and added the ability to create a new repository + universe in one step with auto-naming.
Both flows already used the same RepositorySelectionModal component:
- Load → From Repository (import mode) - Creates a new universe from a repo
- Add Repository (attach mode) - Links a repo to an existing universe
The modal already had a "+ New Repo" button that could create repositories on GitHub.
File: src/components/modals/RepositorySelectionModal.jsx
When in import mode and user clicks "+ New Repo & Universe":
- Creates the GitHub repository
- Auto-generates a universe name from the repo name (e.g., "my-cool-project" → "My Cool Project")
- Creates a local universe with that name
- Links the universe to the new repository
- Switches to the new universe
- Closes the modal
Key Features:
- Universe name is auto-generated by capitalizing and replacing hyphens with spaces
- Repository slug becomes the universe slug
- The universe is immediately linked to Git as source of truth
- User is switched to the newly created universe
File: src/components/modals/RepositorySelectionModal.jsx
"+ New Repo" Button:
- Now red-themed (
#7A0000background) to match app style - Better padding and styling (
4px 8px) - Dynamic label based on intent:
- Import mode: "New Repo & Universe"
- Attach mode: "New Repo"
"Create" Button:
- Red-themed (
#7A0000background) - Better padding (
6px 12px) - Disabled when repo name is empty
- Dynamic label based on intent:
- Import mode: "Create Repo & Universe"
- Attach mode: "Create Repository"
File: src/services/universeBackend.js
Updated linkToDiscoveredUniverse() to handle the isNew flag:
- When
discoveredUniverse.isNewis true:- Creates a new local universe
- Configures it with Git settings
- Sets Git as source of truth
- Sets up Git sync engine
- Switches to the new universe
- Shows success notification
- Click "Load" in Universes header
- Select "From Repository"
- Click "+ New Repo & Universe" button
- Enter repository name (e.g., "my-project")
- Choose public/private
- Click "Create Repo & Universe"
- ✨ Magic happens:
- GitHub repo "my-project" is created
- Local universe "My Project" is created
- Universe is linked to the repo
- You're switched to the new universe
- Ready to start working!
- Click "Load" in Universes header
- Select "From Repository"
- Browse your repositories
- Click a repo to expand it
- Select a universe file to import
- Universe is created and linked
- Open an existing universe
- In Storage section, click "Add Repository"
- Browse and select a repository
- Link it to the current universe
const universeName = trimmedName.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
// "my-cool-project" → "My Cool Project"
// "data-analysis" → "Data Analysis"{
name: "My Project", // Auto-generated display name
slug: "my-project", // Repo name as slug
repo: {
user: "username",
repo: "my-project"
},
isNew: true // Flag to trigger universe creation
}- Source of Truth: Git (repository)
- Local File: Disabled (using Git)
- Git Repo: Enabled and linked
- Metadata: Includes
createdWithRepotimestamp
- Streamlined Workflow: Create repo + universe in one step
- Consistent Naming: Auto-naming ensures universe name matches repo
- One Interface: Both import and attach flows use the same well-styled modal
- Clear Intent: Button labels change based on context
- Git-First: New universes are immediately set up with Git as source of truth
- Auto-Switch: User is automatically switched to the new universe
- Visual Consistency: Red-themed buttons match the app's design language
- Create new repo in import mode creates universe
- Universe name is properly formatted from repo name
- Universe is linked to repository
- Git is set as source of truth
- User is switched to new universe
- Modal closes after creation
- Button labels change based on intent
- Buttons are red-themed (#7A0000)
- Create button is disabled when name is empty
- Existing repo import still works
- Attach mode still works for existing universes
- No linting errors
-
src/components/modals/RepositorySelectionModal.jsx- Enhanced
handleCreateRepository()to create universe in import mode - Updated button styling to red theme
- Added dynamic button labels based on intent
- Enhanced
-
src/services/universeBackend.js- Updated
linkToDiscoveredUniverse()to handleisNewflag - Added logic to create universe locally before linking
- Added auto-switching to new universe
- Updated
- Add template selection when creating universe
- Allow customizing universe name before creation
- Support importing from other sources (GitLab, Bitbucket)
- Add universe visibility settings (public/private)
- Batch create multiple universes from multiple repos