| … | … | @@ -600,18 +600,20 @@ async function cmdProfile(pubkey) { |
| 600 | 600 | /** |
| 601 | 601 | * Migrate storage from local directory to production path |
| 602 | 602 | */ |
| 603 | | async function cmdMigrateStorage(sourcePath) { |
| 603 | async function cmdMigrateStorage(sourcePath, destPath) { |
| 604 | 604 | if (!sourcePath) { |
| 605 | | console.error('❌ Usage: cli migrate-storage <source-path>') |
| 606 | | console.log('\nExample:') |
| 605 | console.error('❌ Usage: cli migrate-storage <source-path> [dest-path]') |
| 606 | console.log('\nExamples:') |
| 607 | 607 | console.log(' cli migrate-storage ./wirecore-storage') |
| 608 | | console.log('\nThis will copy data from source to current storage path:', STORAGE_PATH) |
| 608 | console.log(' cli migrate-storage ./wirecore-storage ~/.config/pear/app-storage/by-dkey/...') |
| 609 | console.log('') |
| 610 | console.log('If dest-path is not specified, uses current storage path:', STORAGE_PATH) |
| 609 | 611 | return |
| 610 | 612 | } |
| 611 | 613 | |
| 612 | 614 | // Resolve paths |
| 613 | 615 | const source = path.resolve(sourcePath) |
| 614 | | const dest = path.resolve(STORAGE_PATH) |
| 616 | const dest = destPath ? path.resolve(destPath) : path.resolve(STORAGE_PATH) |
| 615 | 617 | |
| 616 | 618 | console.log('📦 Storage Migration') |
| 617 | 619 | console.log(' Source:', source) |
| … | … | @@ -1329,7 +1331,7 @@ function showUsage() { |
| 1329 | 1331 | console.log(' pear run . cli directory [query] Search user directory') |
| 1330 | 1332 | console.log(' pear run . cli profile <pubkey> View user profile') |
| 1331 | 1333 | console.log(' pear run . cli storage-path Show current storage location') |
| 1332 | | console.log(' pear run . cli migrate-storage <path> Migrate data from another storage') |
| 1334 | console.log(' pear run . cli migrate-storage <source> [dest] Migrate storage data') |
| 1333 | 1335 | console.log('') |
| 1334 | 1336 | console.log('Examples:') |
| 1335 | 1337 | console.log(' pear run . web 3003') |
| … | … | @@ -1343,8 +1345,8 @@ function showUsage() { |
| 1343 | 1345 | console.log(' # Check current storage location') |
| 1344 | 1346 | console.log(' pear run . cli storage-path') |
| 1345 | 1347 | console.log('') |
| 1346 | | console.log(' # Migrate from local dev storage to production') |
| 1347 | | console.log(' pear run . cli migrate-storage ./wirecore-storage') |
| 1348 | console.log(' # Migrate from local storage to specific destination') |
| 1349 | console.log(' pear run . cli migrate-storage ./wirecore-storage ~/.config/pear/app-storage/by-dkey/...') |
| 1348 | 1350 | } |
| 1349 | 1351 | |
| 1350 | 1352 | /** |
| … | … | @@ -1431,7 +1433,7 @@ async function main() { |
| 1431 | 1433 | break |
| 1432 | 1434 | |
| 1433 | 1435 | case 'migrate-storage': |
| 1434 | | await cmdMigrateStorage(cmdParams[0]) |
| 1436 | await cmdMigrateStorage(cmdParams[0], cmdParams[1]) |
| 1435 | 1437 | break |
| 1436 | 1438 | |
| 1437 | 1439 | default: |