This guide helps you migrate from the original CommonJS codebase to the modern ESM version.
For New Users: Just use v0.2. Skip this document.
For Existing Users: Your data is compatible. Update your scripts to use ESM imports and new CLI.
Before (v0.1):
const { UrbanKnowledgeMapper } = require('./mapper.js');After (v0.2):
import { UrbanKnowledgeMapper } from './mapper.js';Action Required: If you have custom scripts using UbiCity modules, update them to use ESM imports.
Before (v0.1):
const mapper = new UrbanKnowledgeMapper();
mapper.loadAll(); // Synchronous
const report = mapper.generateReport(); // SynchronousAfter (v0.2):
const mapper = new UrbanKnowledgeMapper();
await mapper.initialize();
await mapper.loadAll(); // Now async
const report = await mapper.generateReport(); // Now asyncAction Required: Add async/await to your code. Wrap in async
functions or use .then().
Before (v0.1):
node mapper.js report
node capture.js
node visualize.jsAfter (v0.2):
node src/cli.js report # Or: npx ubicity report
node src/capture.js
node src/visualize.js # (still works, enhanced version coming)Action Required: Update shell scripts and documentation to use new paths.
Before (v0.1):
ubicity/ ├── mapper.js ├── capture.js ├── visualize.js └── ubicity-data/
After (v0.2):
ubicity/ ├── src/ │ ├── mapper.js │ ├── capture.js │ ├── cli.js │ ├── schemas.js │ ├── storage.js │ ├── export.js │ └── privacy.js ├── tests/ └── ubicity-data/
Action Required: Update import paths in custom code.
Good news: Your existing data is 100% compatible!
The v0.2 JSON schema is a superset of v0.1. All existing experience files work without modification.
Verification:
# Load old data with new code
node src/cli.js stats
# Should show: Total Experiences: [your count]If you see errors, the new validation caught data quality issues. Use the migration helper (see below).
We provide a script to validate and optionally fix your existing data:
node scripts/migrate-data.js --check # Check only (dry run)
node scripts/migrate-data.js --fix # Fix issues
node scripts/migrate-data.js --backup # Backup first, then fixCommon fixes: - Add missing timestamps - Normalize coordinate formats - Add version field - Validate against Zod schema
| v0.1 Feature | v0.2 Equivalent | Notes |
|---|---|---|
|
|
Enhanced output |
|
|
Same functionality |
|
|
Same functionality |
|
|
Enhanced journey view |
N/A |
|
New: Storage statistics |
|
|
Same UX, better validation |
N/A |
|
New: CSV, GeoJSON, DOT, Markdown |
N/A |
|
New: Anonymization tools |
# Export to CSV
node -e "import('./src/export.js').then(m => m.exportData('csv', 'data.csv'))"
# Export to GeoJSON (for mapping tools)
node -e "import('./src/export.js').then(m => m.exportData('geojson', 'map.json'))"
# Export to Markdown (readable journeys)
node -e "import('./src/export.js').then(m => m.exportData('markdown', 'journeys.md'))"import { fullyAnonymize, exportAnonymousData } from './src/privacy.js';
// Anonymize single experience
const anonymized = fullyAnonymize(experience);
// Export shareable dataset
await exportAnonymousData('./ubicity-data', 'public-dataset.json', {
includePrivate: false,
anonymizationLevel: 'full'
});import { validateExperience, safeValidateExperience } from './src/schemas.js';
// Throws on invalid data
validateExperience(data);
// Returns { success, errors } for graceful handling
const result = safeValidateExperience(data);
if (!result.success) {
console.error('Validation errors:', result.errors);
}If v0.2 doesn’t work for you:
The old code still exists in this repo:
# Use original files in project root
node mapper.js report
node capture.js
node visualize.jsgit checkout claude/ubicity-learning-setup-01H8249ctY6CW1u58MdFWLbB
# Or: git clone the zotero-voyant-export repo-
❏ Read this guide
-
❏ Backup your
ubicity-data/directory -
❏ Install dependencies:
npm install -
❏ Run tests:
npm test -
❏ Verify data loads:
node src/cli.js stats -
❏ Test old workflows with new CLI
-
❏ Update custom scripts to use ESM
-
❏ Update documentation/README references
-
❏ Try new export features
-
❏ (Optional) Run linter:
npm run lint -
❏ (Optional) Format code:
npm run format
You don’t have to migrate everything at once:
Week 1: Install v0.2, verify data compatibility Week 2: Start using new CLI for analysis Week 3: Update capture workflow (if you have custom scripts) Week 4: Migrate custom analysis code to ESM Week 5: Delete old CommonJS files (if confident)
Issues: Open a GitHub issue with “migration” tag Questions: Check
GETTING_STARTED.md for v0.2 usage Rollback: See “Rollback Plan”
section above
Despite the technical changes, UbiCity v0.2 still respects:
-
✅ Minimal Viable Protocol (WHO/WHERE/WHAT)
-
✅ Tools not platforms
-
✅ Data first, infrastructure later
-
✅ File-based storage (no database)
-
✅ CLI-first (no mandatory web interface)
-
✅ Zero bloat (only Zod dependency)
-
✅ Constraint mechanisms (pause points, 4-week experiment)
The modernization improves quality without compromising philosophy.
See CHANGELOG.md for upcoming features in v0.3:
-
Enhanced interactive visualization
-
Performance monitoring
-
Batch import tools
-
Plugin system for custom analyzers
But remember: You don’t need any of this to start capturing learning experiences.
The core remains simple. Everything else is optional.
Questions? Something broken? File an issue: https://github.com/Hyperpolymath/ubicity/issues