Overview
Time Capsule includes an automatic version management system that handles cache clearing and displays an authentic Unix-style package update sequence when the application version changes.The system mimics real Unix package management, providing a seamless and authentic update experience without interrupting the user flow.
How It Works
Version Detection
When the application loads, theVersionManager checks if the stored version matches the current version:
- version-manager.ts
- Location
Update Trigger
When a version mismatch is detected, the system performs these steps:1
Clear localStorage
Remove all localStorage items except preserved keys:
2
Clear IndexedDB
Clear the settings store:
3
Clear Service Worker Caches
Remove all cached resources:
4
Set Pending Update Flag
Mark that an update sequence should be shown:
5
Reload Page
Force a page reload to show the update sequence:
Update Sequence Display
On the next boot, the system displays an authentic Unix package update sequence:- Normal Boot
- Update Mode
Shows
boot-messages.json with:- Kernel initialization messages
- Service startup logs
- Desktop environment loading
Boot Sequence Generalization
TheDebianRealBoot class accepts a mode parameter:
- Boot screen component
- CSS classes and animations
- Progress bar
- Completion logic
This design allows code reuse while providing different content for each mode.
File Structure
Boot Messages
Defines the normal boot sequence:Each phase has min/max timing values to simulate realistic boot delays.
Update Messages
Defines the package update sequence:Message Types and Colors
Boot Mode
kernel
Color: Gray (#cccccc)Kernel initialization messages
cpu
Color: Light blue (#88aaff)CPU detection and info
memory
Color: Orange (#ffaa88)Memory detection and allocation
fs
Color: Yellow (#ffff88)Filesystem mounting
systemd
Color: Cyan (#88ffff)Init system messages
service
Color: Green (#00ff00)Service startup
drm
Color: Red (#ff8888)Graphics subsystem
desktop
Color: Bright cyan (#00ffaa)Desktop ready
Update Mode
package
Color: Light blue (#88aaff)Package operations (reading lists, building dependencies)
download
Color: Orange (#ffaa88)Package downloads from repository
install
Color: Green (#00ff00)Package installation and unpacking
service
Color: Green (#00ff00)Service restarts and reloads
CSS Implementation
Colors are defined in/public/css/desktop/boot-screen.css:
Testing Updates
You can manually test the update sequence for development:1
Open Browser Console
Press F12 or right-click → Inspect → Console
2
Change Version
Run this command in the console:
3
Reload Page
Press F5 or refresh the page
4
Observe Update Sequence
You’ll see the package update sequence instead of the normal boot
After the update sequence completes, the version will be updated to the current version automatically.
Triggering Updates in Production
To trigger updates for users in production:1
Update package.json
Increment the version number:Current version: 1.0.31
2
Commit and Deploy
Commit the change and deploy to production:
3
Users See Update
When users visit the site, they’ll automatically see the update sequence
The version from
package.json is injected at build time via Vite as import.meta.env.PUBLIC_APP_VERSION.Customization
Adding New Message Types
1
Update Messages File
Add to
update-messages.json or boot-messages.json:2
Add CSS Class
In
public/css/desktop/boot-screen.css:3
Update Type Map
In
src/scripts/boot/init.ts:Preserving User Data During Updates
By default, the update system clears all localStorage. To preserve specific keys:Custom Update Logic
For version-specific migrations, add logic in the update method:Architecture Benefits
No Modal Interruption
Updates feel like a natural system operation rather than an intrusive popup
Authentic Experience
Mimics real Unix package management for period-accurate feel
Code Reuse
Same boot screen component handles both normal boot and update modes
Flexible
Easy to add new message types, phases, or customize timing
Testable
Can trigger updates manually in console for testing
Automatic
No user intervention required - just bump version and deploy
Related Files
Core System
Core System
version-manager.ts -
/src/scripts/core/version-manager.tsVersion detection, cache clearing, and update orchestrationinit.ts - /src/scripts/boot/init.tsBoot sequence orchestration and message displayData Files
Data Files
boot-messages.json -
/src/data/boot-messages.jsonNormal boot sequence messages with kernel, services, and desktop startupupdate-messages.json - /src/data/update-messages.jsonPackage update sequence with downloads and installationUI Components
UI Components
BootSequence.astro -
/src/components/desktop/BootSequence.astroBoot screen component used for both modesboot-screen.css - /public/css/desktop/boot-screen.cssStyling for boot messages, colors, and animationsVersion History
Current Version: 1.0.31
The project uses semantic versioning:- Major: Breaking changes requiring user action
- Minor: New features, backward compatible
- Patch: Bug fixes and minor improvements
Version bumps that require cache clearing should increment at least the minor version.
Version Update Best Practices
- Breaking Changes
- New Features
- Bug Fixes
When to use: Major architectural changes, data structure changes
- Clear all caches
- Show update sequence
- Consider data migration
Future Enhancements
Migration Scripts
Migration Scripts
Add version-specific migration scripts:
Changelog Display
Changelog Display
Show changelog after update completes:
Rollback Capability
Rollback Capability
Add ability to rollback failed updates:
Update History
Update History
Track update history in IndexedDB:

