heyvm 1.0.0
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/LICENSE +21 -0
- package/README.md +621 -0
- package/bin/file-browser +0 -0
- package/bin/heyvm +0 -0
- package/bin/heyvm-core +0 -0
- package/bin/heyvm.js +61 -0
- package/core/README.md +51 -0
- package/core/cmd/heyvm-core/main.go +73 -0
- package/core/go.mod +25 -0
- package/core/go.sum +47 -0
- package/core/internal/auth/errors.go +29 -0
- package/core/internal/auth/password.go +187 -0
- package/core/internal/auth/provider.go +33 -0
- package/core/internal/auth/ssh_key.go +142 -0
- package/core/internal/config/config.go +111 -0
- package/core/internal/ipc/actions.go +738 -0
- package/core/internal/ipc/handler.go +281 -0
- package/core/internal/ipc/protocol.go +126 -0
- package/core/internal/sftp/errors.go +29 -0
- package/core/internal/sftp/manager.go +303 -0
- package/core/internal/sftp/types.go +30 -0
- package/core/internal/ssh/errors.go +23 -0
- package/core/internal/ssh/manager.go +226 -0
- package/core/internal/ssh/session.go +105 -0
- package/core/internal/vm/errors.go +35 -0
- package/core/internal/vm/models.go +84 -0
- package/core/internal/vm/registry.go +240 -0
- package/package.json +59 -0
- package/scripts/install.js +100 -0
- package/ui/README.md +43 -0
- package/ui/dist/App.d.ts +3 -0
- package/ui/dist/App.d.ts.map +1 -0
- package/ui/dist/App.js +142 -0
- package/ui/dist/App.js.map +1 -0
- package/ui/dist/components/ConfirmDialog.d.ts +9 -0
- package/ui/dist/components/ConfirmDialog.d.ts.map +1 -0
- package/ui/dist/components/ConfirmDialog.js +22 -0
- package/ui/dist/components/ConfirmDialog.js.map +1 -0
- package/ui/dist/components/ErrorMessage.d.ts +8 -0
- package/ui/dist/components/ErrorMessage.d.ts.map +1 -0
- package/ui/dist/components/ErrorMessage.js +10 -0
- package/ui/dist/components/ErrorMessage.js.map +1 -0
- package/ui/dist/components/Header.d.ts +8 -0
- package/ui/dist/components/Header.d.ts.map +1 -0
- package/ui/dist/components/Header.js +10 -0
- package/ui/dist/components/Header.js.map +1 -0
- package/ui/dist/components/LoadingSpinner.d.ts +7 -0
- package/ui/dist/components/LoadingSpinner.d.ts.map +1 -0
- package/ui/dist/components/LoadingSpinner.js +7 -0
- package/ui/dist/components/LoadingSpinner.js.map +1 -0
- package/ui/dist/components/StatusBar.d.ts +11 -0
- package/ui/dist/components/StatusBar.d.ts.map +1 -0
- package/ui/dist/components/StatusBar.js +11 -0
- package/ui/dist/components/StatusBar.js.map +1 -0
- package/ui/dist/core/ipc.d.ts +96 -0
- package/ui/dist/core/ipc.d.ts.map +1 -0
- package/ui/dist/core/ipc.js +310 -0
- package/ui/dist/core/ipc.js.map +1 -0
- package/ui/dist/core/types.d.ts +45 -0
- package/ui/dist/core/types.d.ts.map +1 -0
- package/ui/dist/core/types.js +3 -0
- package/ui/dist/core/types.js.map +1 -0
- package/ui/dist/hooks/useFiles.d.ts +14 -0
- package/ui/dist/hooks/useFiles.d.ts.map +1 -0
- package/ui/dist/hooks/useFiles.js +102 -0
- package/ui/dist/hooks/useFiles.js.map +1 -0
- package/ui/dist/hooks/useVM.d.ts +10 -0
- package/ui/dist/hooks/useVM.d.ts.map +1 -0
- package/ui/dist/hooks/useVM.js +54 -0
- package/ui/dist/hooks/useVM.js.map +1 -0
- package/ui/dist/hooks/useVMList.d.ts +10 -0
- package/ui/dist/hooks/useVMList.d.ts.map +1 -0
- package/ui/dist/hooks/useVMList.js +56 -0
- package/ui/dist/hooks/useVMList.js.map +1 -0
- package/ui/dist/index.d.ts +3 -0
- package/ui/dist/index.d.ts.map +1 -0
- package/ui/dist/index.js +7488 -0
- package/ui/dist/index.js.map +1 -0
- package/ui/dist/keybindings.d.ts +146 -0
- package/ui/dist/keybindings.d.ts.map +1 -0
- package/ui/dist/keybindings.js +96 -0
- package/ui/dist/keybindings.js.map +1 -0
- package/ui/dist/screens/AddVMScreen.d.ts +9 -0
- package/ui/dist/screens/AddVMScreen.d.ts.map +1 -0
- package/ui/dist/screens/AddVMScreen.js +163 -0
- package/ui/dist/screens/AddVMScreen.js.map +1 -0
- package/ui/dist/screens/VMDetailScreen.d.ts +12 -0
- package/ui/dist/screens/VMDetailScreen.d.ts.map +1 -0
- package/ui/dist/screens/VMDetailScreen.js +96 -0
- package/ui/dist/screens/VMDetailScreen.js.map +1 -0
- package/ui/dist/screens/VMListScreen.d.ts +12 -0
- package/ui/dist/screens/VMListScreen.d.ts.map +1 -0
- package/ui/dist/screens/VMListScreen.js +158 -0
- package/ui/dist/screens/VMListScreen.js.map +1 -0
- package/ui/dist/screens/tabs/FilesTab.d.ts +9 -0
- package/ui/dist/screens/tabs/FilesTab.d.ts.map +1 -0
- package/ui/dist/screens/tabs/FilesTab.js +374 -0
- package/ui/dist/screens/tabs/FilesTab.js.map +1 -0
- package/ui/dist/screens/tabs/OverviewTab.d.ts +10 -0
- package/ui/dist/screens/tabs/OverviewTab.d.ts.map +1 -0
- package/ui/dist/screens/tabs/OverviewTab.js +110 -0
- package/ui/dist/screens/tabs/OverviewTab.js.map +1 -0
- package/ui/dist/screens/tabs/TerminalTab.d.ts +9 -0
- package/ui/dist/screens/tabs/TerminalTab.d.ts.map +1 -0
- package/ui/dist/screens/tabs/TerminalTab.js +270 -0
- package/ui/dist/screens/tabs/TerminalTab.js.map +1 -0
- package/ui/dist/utils/terminalEmulator.d.ts +49 -0
- package/ui/dist/utils/terminalEmulator.d.ts.map +1 -0
- package/ui/dist/utils/terminalEmulator.js +88 -0
- package/ui/dist/utils/terminalEmulator.js.map +1 -0
- package/ui/package.json +34 -0
- package/ui/scripts/start-with-core.js +81 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
package config
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"os"
|
|
5
|
+
"path/filepath"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
const (
|
|
9
|
+
// ConfigDirName is the name of the config directory
|
|
10
|
+
ConfigDirName = ".heyvm"
|
|
11
|
+
|
|
12
|
+
// ConfigFileName is the name of the main config file
|
|
13
|
+
ConfigFileName = "config.yaml"
|
|
14
|
+
|
|
15
|
+
// StateFileName is the name of the state file
|
|
16
|
+
StateFileName = "state.json"
|
|
17
|
+
|
|
18
|
+
// LogsDirName is the name of the logs directory
|
|
19
|
+
LogsDirName = "logs"
|
|
20
|
+
|
|
21
|
+
// LogFileName is the name of the log file
|
|
22
|
+
LogFileName = "heyvm-core.log"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
// GetConfigDir returns the path to the config directory
|
|
26
|
+
func GetConfigDir() (string, error) {
|
|
27
|
+
homeDir, err := os.UserHomeDir()
|
|
28
|
+
if err != nil {
|
|
29
|
+
return "", err
|
|
30
|
+
}
|
|
31
|
+
return filepath.Join(homeDir, ConfigDirName), nil
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// GetConfigPath returns the path to the config file
|
|
35
|
+
func GetConfigPath() (string, error) {
|
|
36
|
+
configDir, err := GetConfigDir()
|
|
37
|
+
if err != nil {
|
|
38
|
+
return "", err
|
|
39
|
+
}
|
|
40
|
+
return filepath.Join(configDir, ConfigFileName), nil
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// GetStatePath returns the path to the state file
|
|
44
|
+
func GetStatePath() (string, error) {
|
|
45
|
+
configDir, err := GetConfigDir()
|
|
46
|
+
if err != nil {
|
|
47
|
+
return "", err
|
|
48
|
+
}
|
|
49
|
+
return filepath.Join(configDir, StateFileName), nil
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// GetLogsDir returns the path to the logs directory
|
|
53
|
+
func GetLogsDir() (string, error) {
|
|
54
|
+
configDir, err := GetConfigDir()
|
|
55
|
+
if err != nil {
|
|
56
|
+
return "", err
|
|
57
|
+
}
|
|
58
|
+
return filepath.Join(configDir, LogsDirName), nil
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// GetLogPath returns the path to the log file
|
|
62
|
+
func GetLogPath() (string, error) {
|
|
63
|
+
logsDir, err := GetLogsDir()
|
|
64
|
+
if err != nil {
|
|
65
|
+
return "", err
|
|
66
|
+
}
|
|
67
|
+
return filepath.Join(logsDir, LogFileName), nil
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// EnsureConfigDir creates the config directory if it doesn't exist
|
|
71
|
+
func EnsureConfigDir() error {
|
|
72
|
+
configDir, err := GetConfigDir()
|
|
73
|
+
if err != nil {
|
|
74
|
+
return err
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Create config directory with secure permissions (0700)
|
|
78
|
+
if err := os.MkdirAll(configDir, 0700); err != nil {
|
|
79
|
+
return err
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Create logs directory
|
|
83
|
+
logsDir, err := GetLogsDir()
|
|
84
|
+
if err != nil {
|
|
85
|
+
return err
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if err := os.MkdirAll(logsDir, 0700); err != nil {
|
|
89
|
+
return err
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return nil
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ConfigExists checks if the config file exists
|
|
96
|
+
func ConfigExists() (bool, error) {
|
|
97
|
+
configPath, err := GetConfigPath()
|
|
98
|
+
if err != nil {
|
|
99
|
+
return false, err
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_, err = os.Stat(configPath)
|
|
103
|
+
if os.IsNotExist(err) {
|
|
104
|
+
return false, nil
|
|
105
|
+
}
|
|
106
|
+
if err != nil {
|
|
107
|
+
return false, err
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return true, nil
|
|
111
|
+
}
|