atlasia-ghost 1.0.1 → 1.0.2
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/ghost.js +36 -18
- package/package.json +1 -1
package/ghost.js
CHANGED
|
@@ -103,25 +103,43 @@ class GatewayLauncher {
|
|
|
103
103
|
* - Wire up event handlers between components
|
|
104
104
|
* - Delegate to _initializeExtensions() for extension loading
|
|
105
105
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
async initialize() {
|
|
107
|
+
try {
|
|
108
|
+
// Bootstrap environment directories
|
|
109
|
+
const ghostDir = path.dirname(USER_EXTENSIONS_DIR);
|
|
110
|
+
|
|
111
|
+
// Define required subdirectories
|
|
112
|
+
const dirs = {
|
|
113
|
+
home: ghostDir,
|
|
114
|
+
extensions: USER_EXTENSIONS_DIR,
|
|
115
|
+
telemetry: path.join(ghostDir, 'telemetry'),
|
|
116
|
+
config: path.join(ghostDir, 'config')
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Clean up any files that should be directories
|
|
120
|
+
for (const [key, dirPath] of Object.entries(dirs)) {
|
|
121
|
+
if (fs.existsSync(dirPath) && !fs.lstatSync(dirPath).isDirectory()) {
|
|
122
|
+
fs.unlinkSync(dirPath);
|
|
123
|
+
}
|
|
124
|
+
if (!fs.existsSync(dirPath)) {
|
|
125
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Bootstrap default config if missing
|
|
130
|
+
const configPath = path.join(dirs.config, 'config.json');
|
|
131
|
+
if (!fs.existsSync(configPath)) {
|
|
132
|
+
const defaultConfig = {
|
|
133
|
+
telemetry: { enabled: false, retention: '7d' },
|
|
134
|
+
extensions: { autoUpdate: false },
|
|
135
|
+
audit: { enabled: true, logPath: '~/.ghost/audit.log' }
|
|
136
|
+
};
|
|
137
|
+
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2), 'utf8');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.warn(`[GatewayLauncher] Failed to bootstrap environment: ${error.message}`);
|
|
121
142
|
}
|
|
122
|
-
} catch (error) {
|
|
123
|
-
}
|
|
124
|
-
|
|
125
143
|
// Pure orchestration: component initialization
|
|
126
144
|
this.gateway = new Gateway({
|
|
127
145
|
extensionsDir: USER_EXTENSIONS_DIR,
|