spindb 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -1
- package/cli/commands/connect.ts +336 -111
- package/cli/commands/engines.ts +1 -1
- package/cli/commands/info.ts +3 -3
- package/cli/commands/list.ts +1 -1
- package/cli/commands/menu.ts +257 -15
- package/cli/commands/restore.ts +1 -1
- package/cli/ui/prompts.ts +12 -6
- package/cli/ui/theme.ts +1 -1
- package/config/os-dependencies.ts +92 -0
- package/core/binary-manager.ts +12 -19
- package/core/dependency-manager.ts +135 -0
- package/engines/postgresql/index.ts +31 -1
- package/package.json +1 -1
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
packageManagers,
|
|
16
16
|
getEngineDependencies,
|
|
17
17
|
getUniqueDependencies,
|
|
18
|
+
usqlDependency,
|
|
19
|
+
pgcliDependency,
|
|
20
|
+
mycliDependency,
|
|
18
21
|
} from '../config/os-dependencies'
|
|
19
22
|
import { platformService } from './platform-service'
|
|
20
23
|
|
|
@@ -421,3 +424,135 @@ export async function getAllDependencyReports(): Promise<
|
|
|
421
424
|
)
|
|
422
425
|
return reports
|
|
423
426
|
}
|
|
427
|
+
|
|
428
|
+
// =============================================================================
|
|
429
|
+
// usql (Enhanced Shell) Support
|
|
430
|
+
// =============================================================================
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Check if usql is installed
|
|
434
|
+
*/
|
|
435
|
+
export async function isUsqlInstalled(): Promise<boolean> {
|
|
436
|
+
const status = await checkDependency(usqlDependency)
|
|
437
|
+
return status.installed
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Get usql dependency status
|
|
442
|
+
*/
|
|
443
|
+
export async function getUsqlStatus(): Promise<DependencyStatus> {
|
|
444
|
+
return checkDependency(usqlDependency)
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Install usql using the detected package manager
|
|
449
|
+
*/
|
|
450
|
+
export async function installUsql(
|
|
451
|
+
packageManager: DetectedPackageManager,
|
|
452
|
+
): Promise<InstallResult> {
|
|
453
|
+
return installDependency(usqlDependency, packageManager)
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Get usql manual installation instructions
|
|
458
|
+
*/
|
|
459
|
+
export function getUsqlManualInstructions(
|
|
460
|
+
platform: Platform = getCurrentPlatform(),
|
|
461
|
+
): string[] {
|
|
462
|
+
return getManualInstallInstructions(usqlDependency, platform)
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Get the usql dependency definition
|
|
467
|
+
*/
|
|
468
|
+
export function getUsqlDependency(): Dependency {
|
|
469
|
+
return usqlDependency
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// =============================================================================
|
|
473
|
+
// pgcli (PostgreSQL Enhanced Shell) Support
|
|
474
|
+
// =============================================================================
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Check if pgcli is installed
|
|
478
|
+
*/
|
|
479
|
+
export async function isPgcliInstalled(): Promise<boolean> {
|
|
480
|
+
const status = await checkDependency(pgcliDependency)
|
|
481
|
+
return status.installed
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Get pgcli dependency status
|
|
486
|
+
*/
|
|
487
|
+
export async function getPgcliStatus(): Promise<DependencyStatus> {
|
|
488
|
+
return checkDependency(pgcliDependency)
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Install pgcli using the detected package manager
|
|
493
|
+
*/
|
|
494
|
+
export async function installPgcli(
|
|
495
|
+
packageManager: DetectedPackageManager,
|
|
496
|
+
): Promise<InstallResult> {
|
|
497
|
+
return installDependency(pgcliDependency, packageManager)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Get pgcli manual installation instructions
|
|
502
|
+
*/
|
|
503
|
+
export function getPgcliManualInstructions(
|
|
504
|
+
platform: Platform = getCurrentPlatform(),
|
|
505
|
+
): string[] {
|
|
506
|
+
return getManualInstallInstructions(pgcliDependency, platform)
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Get the pgcli dependency definition
|
|
511
|
+
*/
|
|
512
|
+
export function getPgcliDependency(): Dependency {
|
|
513
|
+
return pgcliDependency
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// =============================================================================
|
|
517
|
+
// mycli (MySQL Enhanced Shell) Support
|
|
518
|
+
// =============================================================================
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Check if mycli is installed
|
|
522
|
+
*/
|
|
523
|
+
export async function isMycliInstalled(): Promise<boolean> {
|
|
524
|
+
const status = await checkDependency(mycliDependency)
|
|
525
|
+
return status.installed
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Get mycli dependency status
|
|
530
|
+
*/
|
|
531
|
+
export async function getMycliStatus(): Promise<DependencyStatus> {
|
|
532
|
+
return checkDependency(mycliDependency)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Install mycli using the detected package manager
|
|
537
|
+
*/
|
|
538
|
+
export async function installMycli(
|
|
539
|
+
packageManager: DetectedPackageManager,
|
|
540
|
+
): Promise<InstallResult> {
|
|
541
|
+
return installDependency(mycliDependency, packageManager)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Get mycli manual installation instructions
|
|
546
|
+
*/
|
|
547
|
+
export function getMycliManualInstructions(
|
|
548
|
+
platform: Platform = getCurrentPlatform(),
|
|
549
|
+
): string[] {
|
|
550
|
+
return getManualInstallInstructions(mycliDependency, platform)
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Get the mycli dependency definition
|
|
555
|
+
*/
|
|
556
|
+
export function getMycliDependency(): Dependency {
|
|
557
|
+
return mycliDependency
|
|
558
|
+
}
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
getBinaryUrl,
|
|
13
13
|
SUPPORTED_MAJOR_VERSIONS,
|
|
14
14
|
fetchAvailableVersions,
|
|
15
|
+
getLatestVersion,
|
|
16
|
+
FALLBACK_VERSION_MAP,
|
|
15
17
|
} from './binary-urls'
|
|
16
18
|
import { detectBackupFormat, restoreBackup } from './restore'
|
|
17
19
|
import type {
|
|
@@ -50,14 +52,42 @@ export class PostgreSQLEngine extends BaseEngine {
|
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Resolve a version string to a full version.
|
|
57
|
+
* If given a major version like '17', resolves to '17.7.0'.
|
|
58
|
+
* If already a full version like '17.7.0', returns as-is.
|
|
59
|
+
*/
|
|
60
|
+
resolveFullVersion(version: string): string {
|
|
61
|
+
// Check if already a full version (has at least one dot with numbers after)
|
|
62
|
+
if (/^\d+\.\d+/.test(version)) {
|
|
63
|
+
return version
|
|
64
|
+
}
|
|
65
|
+
// It's a major version, resolve using fallback map (sync, no network)
|
|
66
|
+
return FALLBACK_VERSION_MAP[version] || `${version}.0.0`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Resolve version asynchronously (tries network first for latest)
|
|
71
|
+
*/
|
|
72
|
+
async resolveFullVersionAsync(version: string): Promise<string> {
|
|
73
|
+
// Check if already a full version
|
|
74
|
+
if (/^\d+\.\d+/.test(version)) {
|
|
75
|
+
return version
|
|
76
|
+
}
|
|
77
|
+
// Resolve from network/cache
|
|
78
|
+
return getLatestVersion(version)
|
|
79
|
+
}
|
|
80
|
+
|
|
53
81
|
/**
|
|
54
82
|
* Get binary path for current platform
|
|
83
|
+
* Uses full version for directory naming (e.g., postgresql-17.7.0-darwin-arm64)
|
|
55
84
|
*/
|
|
56
85
|
getBinaryPath(version: string): string {
|
|
86
|
+
const fullVersion = this.resolveFullVersion(version)
|
|
57
87
|
const { platform: p, arch: a } = this.getPlatformInfo()
|
|
58
88
|
return paths.getBinaryPath({
|
|
59
89
|
engine: 'postgresql',
|
|
60
|
-
version,
|
|
90
|
+
version: fullVersion,
|
|
61
91
|
platform: p,
|
|
62
92
|
arch: a,
|
|
63
93
|
})
|