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.
Files changed (2) hide show
  1. package/ghost.js +36 -18
  2. 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
- async initialize() {
107
- try {
108
- // VIOLATION: Direct file system operations
109
- // Should delegate to a system extension or Gateway method
110
- const ghostDir = path.dirname(USER_EXTENSIONS_DIR);
111
- if (!fs.existsSync(ghostDir)) {
112
- fs.mkdirSync(ghostDir, { recursive: true });
113
- }
114
-
115
- if (fs.existsSync(USER_EXTENSIONS_DIR) && !fs.lstatSync(USER_EXTENSIONS_DIR).isDirectory()) {
116
- fs.unlinkSync(USER_EXTENSIONS_DIR);
117
- }
118
-
119
- if (!fs.existsSync(USER_EXTENSIONS_DIR)) {
120
- fs.mkdirSync(USER_EXTENSIONS_DIR, { recursive: true });
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlasia-ghost",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Extensible gateway-based Git CLI with AI-powered operations",
5
5
  "main": "ghost.js",
6
6
  "files": [