Learn how to use Factory’s Local File Sync feature to integrate your local workspace with your Factory context
Local File Sync is a powerful feature that allows you to synchronize your Factory context files with your local filesystem. This guide will walk you through setting up and using Local File Sync to streamline your development workflow.
Local File Sync creates a direct connection between your local workspace and Factory, offering several benefits:
Automatic synchronization of context files with your local Git repository
Real-time updates of context as you edit files locally
Ability to save generated fragments directly to your local filesystem
Diff viewing capabilities for comparing changes
Access Context Panel
In your Factory session, navigate to the context panel.
Initiate Local Sync
Look for the “Add Local Repository” or similar option to begin the setup process.
Select Local Directory
Choose the directory on your local machine that contains your Git repository. Ensure this directory has a .git
file.
Confirm Mapping
Factory will automatically detect and map your context files to the corresponding files in your local repository.
Local File Sync uses the File Systems Access API to enable continuous synchronization. Ensure your browser supports this API for the best experience.
Once set up, Local File Sync will automatically keep your context files up-to-date with your local changes:
Edit a file locally, and the changes will be reflected in your Factory context
Factory will use the most recent version of your files, even as you chat and work on your project
Generate a Fragment
Use Factory to generate or modify code within a fragment.
Save to Local
Look for the “Save to Local” option at the footer of the fragment interface.
Review Changes
Use the diff viewer to compare the changes between the fragment and your local file.
Confirm Save
If satisfied with the changes, confirm to save the fragment directly to your local filesystem.
The diff viewer allows you to compare changes before saving:
View differences between the current fragment and the local file
Compare changes across multiple fragments
Make informed decisions about which changes to apply
Regular Commits: Commit your local changes regularly to maintain a clear history and avoid conflicts.
Use Branches: When working on significant changes, consider using feature branches to keep your main branch stable.
Review Diffs Carefully: Always review the diff viewer before saving fragments to ensure you’re not overwriting important local changes.
Sync Not Working
Ensure your selected directory contains a .git
file
Check your internet connection
Try refreshing the Factory session
Changes Not Reflecting
Verify that you’ve saved your local changes
Check if the file is correctly mapped in Factory
Try manually refreshing the context in Factory