imcp 0.0.13 → 0.0.15

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 (157) hide show
  1. package/dist/core/ConfigurationProvider.d.ts +1 -0
  2. package/dist/core/ConfigurationProvider.js +15 -0
  3. package/dist/core/InstallationService.js +2 -7
  4. package/dist/core/MCPManager.d.ts +11 -2
  5. package/dist/core/MCPManager.js +24 -1
  6. package/dist/core/RequirementService.js +2 -8
  7. package/dist/core/installers/clients/BaseClientInstaller.d.ts +51 -0
  8. package/dist/core/installers/clients/BaseClientInstaller.js +160 -0
  9. package/dist/core/installers/clients/ClientInstaller.d.ts +16 -8
  10. package/dist/core/installers/clients/ClientInstaller.js +77 -504
  11. package/dist/core/installers/clients/ClientInstallerFactory.d.ts +19 -0
  12. package/dist/core/installers/clients/ClientInstallerFactory.js +41 -0
  13. package/dist/core/installers/clients/ClineInstaller.d.ts +18 -0
  14. package/dist/core/installers/clients/ClineInstaller.js +124 -0
  15. package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +34 -0
  16. package/dist/core/installers/clients/GithubCopilotInstaller.js +162 -0
  17. package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +15 -0
  18. package/dist/core/installers/clients/MSRooCodeInstaller.js +122 -0
  19. package/dist/core/installers/requirements/BaseInstaller.d.ts +11 -34
  20. package/dist/core/installers/requirements/BaseInstaller.js +5 -116
  21. package/dist/core/installers/requirements/CommandInstaller.d.ts +6 -1
  22. package/dist/core/installers/requirements/CommandInstaller.js +7 -0
  23. package/dist/core/installers/requirements/GeneralInstaller.d.ts +6 -1
  24. package/dist/core/installers/requirements/GeneralInstaller.js +9 -4
  25. package/dist/core/installers/requirements/NpmInstaller.d.ts +46 -7
  26. package/dist/core/installers/requirements/NpmInstaller.js +150 -58
  27. package/dist/core/installers/requirements/PipInstaller.d.ts +9 -0
  28. package/dist/core/installers/requirements/PipInstaller.js +66 -28
  29. package/dist/core/onboard/FeedOnboardService.d.ts +72 -0
  30. package/dist/core/onboard/FeedOnboardService.js +312 -0
  31. package/dist/core/onboard/OnboardProcessor.d.ts +79 -0
  32. package/dist/core/onboard/OnboardProcessor.js +290 -0
  33. package/dist/core/onboard/OnboardStatus.d.ts +49 -0
  34. package/dist/core/onboard/OnboardStatus.js +10 -0
  35. package/dist/core/onboard/OnboardStatusManager.d.ts +57 -0
  36. package/dist/core/onboard/OnboardStatusManager.js +176 -0
  37. package/dist/core/types.d.ts +6 -6
  38. package/dist/core/validators/FeedValidator.d.ts +20 -0
  39. package/dist/core/validators/FeedValidator.js +80 -0
  40. package/dist/core/validators/IServerValidator.d.ts +19 -0
  41. package/dist/core/validators/IServerValidator.js +2 -0
  42. package/dist/core/validators/SSEServerValidator.d.ts +15 -0
  43. package/dist/core/validators/SSEServerValidator.js +39 -0
  44. package/dist/core/validators/ServerValidatorFactory.d.ts +24 -0
  45. package/dist/core/validators/ServerValidatorFactory.js +45 -0
  46. package/dist/core/validators/StdioServerValidator.d.ts +46 -0
  47. package/dist/core/validators/StdioServerValidator.js +229 -0
  48. package/dist/services/InstallRequestValidator.d.ts +1 -1
  49. package/dist/services/ServerService.d.ts +9 -6
  50. package/dist/services/ServerService.js +18 -7
  51. package/dist/utils/adoUtils.d.ts +29 -0
  52. package/dist/utils/adoUtils.js +252 -0
  53. package/dist/utils/clientUtils.d.ts +0 -7
  54. package/dist/utils/clientUtils.js +0 -42
  55. package/dist/utils/githubUtils.d.ts +10 -0
  56. package/dist/utils/githubUtils.js +22 -0
  57. package/dist/utils/macroExpressionUtils.d.ts +38 -0
  58. package/dist/utils/macroExpressionUtils.js +116 -0
  59. package/dist/utils/osUtils.d.ts +4 -20
  60. package/dist/utils/osUtils.js +78 -23
  61. package/dist/web/contract/serverContract.d.ts +66 -0
  62. package/dist/web/contract/serverContract.js +2 -0
  63. package/dist/web/public/css/notifications.css +48 -17
  64. package/dist/web/public/css/onboard.css +107 -0
  65. package/dist/web/public/index.html +90 -18
  66. package/dist/web/public/js/api.js +3 -6
  67. package/dist/web/public/js/flights/flights.js +127 -0
  68. package/dist/web/public/js/modal/index.js +58 -0
  69. package/dist/web/public/js/modal/installHandler.js +227 -0
  70. package/dist/web/public/js/modal/installModal.js +163 -0
  71. package/dist/web/public/js/modal/installation.js +281 -0
  72. package/dist/web/public/js/modal/loadingModal.js +52 -0
  73. package/dist/web/public/js/modal/loadingUI.js +74 -0
  74. package/dist/web/public/js/modal/messageQueue.js +112 -0
  75. package/dist/web/public/js/modal/modalSetup.js +513 -0
  76. package/dist/web/public/js/modal/modalUI.js +214 -0
  77. package/dist/web/public/js/modal/modalUtils.js +49 -0
  78. package/dist/web/public/js/modal/version.js +20 -0
  79. package/dist/web/public/js/modal/versionUtils.js +20 -0
  80. package/dist/web/public/js/modal.js +25 -1041
  81. package/dist/web/public/js/notifications.js +66 -27
  82. package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +338 -0
  83. package/dist/web/public/js/onboard/formProcessor.js +864 -0
  84. package/dist/web/public/js/onboard/index.js +374 -0
  85. package/dist/web/public/js/onboard/publishHandler.js +132 -0
  86. package/dist/web/public/js/onboard/state.js +76 -0
  87. package/dist/web/public/js/onboard/templates.js +343 -0
  88. package/dist/web/public/js/onboard/uiHandlers.js +758 -0
  89. package/dist/web/public/js/onboard/validationHandlers.js +378 -0
  90. package/dist/web/public/js/serverCategoryDetails.js +43 -17
  91. package/dist/web/public/js/serverCategoryList.js +15 -2
  92. package/dist/web/public/onboard.html +296 -0
  93. package/dist/web/public/styles.css +91 -1
  94. package/dist/web/server.d.ts +0 -10
  95. package/dist/web/server.js +131 -22
  96. package/package.json +2 -2
  97. package/src/core/ConfigurationProvider.ts +15 -0
  98. package/src/core/InstallationService.ts +2 -7
  99. package/src/core/MCPManager.ts +26 -1
  100. package/src/core/RequirementService.ts +2 -9
  101. package/src/core/installers/clients/BaseClientInstaller.ts +196 -0
  102. package/src/core/installers/clients/ClientInstaller.ts +97 -589
  103. package/src/core/installers/clients/ClientInstallerFactory.ts +46 -0
  104. package/src/core/installers/clients/ClineInstaller.ts +135 -0
  105. package/src/core/installers/clients/GithubCopilotInstaller.ts +179 -0
  106. package/src/core/installers/clients/MSRooCodeInstaller.ts +133 -0
  107. package/src/core/installers/requirements/BaseInstaller.ts +13 -136
  108. package/src/core/installers/requirements/CommandInstaller.ts +9 -1
  109. package/src/core/installers/requirements/GeneralInstaller.ts +11 -4
  110. package/src/core/installers/requirements/NpmInstaller.ts +178 -61
  111. package/src/core/installers/requirements/PipInstaller.ts +68 -29
  112. package/src/core/onboard/FeedOnboardService.ts +346 -0
  113. package/src/core/onboard/OnboardProcessor.ts +305 -0
  114. package/src/core/onboard/OnboardStatus.ts +55 -0
  115. package/src/core/onboard/OnboardStatusManager.ts +188 -0
  116. package/src/core/types.ts +6 -6
  117. package/src/core/validators/FeedValidator.ts +79 -0
  118. package/src/core/validators/IServerValidator.ts +21 -0
  119. package/src/core/validators/SSEServerValidator.ts +43 -0
  120. package/src/core/validators/ServerValidatorFactory.ts +51 -0
  121. package/src/core/validators/StdioServerValidator.ts +259 -0
  122. package/src/services/InstallRequestValidator.ts +1 -1
  123. package/src/services/ServerService.ts +22 -7
  124. package/src/utils/adoUtils.ts +291 -0
  125. package/src/utils/clientUtils.ts +0 -44
  126. package/src/utils/githubUtils.ts +24 -0
  127. package/src/utils/macroExpressionUtils.ts +121 -0
  128. package/src/utils/osUtils.ts +89 -24
  129. package/src/web/contract/serverContract.ts +74 -0
  130. package/src/web/public/css/notifications.css +48 -17
  131. package/src/web/public/css/onboard.css +107 -0
  132. package/src/web/public/index.html +90 -18
  133. package/src/web/public/js/api.js +3 -6
  134. package/src/web/public/js/flights/flights.js +127 -0
  135. package/src/web/public/js/modal/index.js +58 -0
  136. package/src/web/public/js/modal/installModal.js +163 -0
  137. package/src/web/public/js/modal/installation.js +281 -0
  138. package/src/web/public/js/modal/loadingModal.js +52 -0
  139. package/src/web/public/js/modal/messageQueue.js +112 -0
  140. package/src/web/public/js/modal/modalSetup.js +513 -0
  141. package/src/web/public/js/modal/modalUtils.js +49 -0
  142. package/src/web/public/js/modal/versionUtils.js +20 -0
  143. package/src/web/public/js/modal.js +25 -1041
  144. package/src/web/public/js/notifications.js +66 -27
  145. package/src/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +338 -0
  146. package/src/web/public/js/onboard/formProcessor.js +864 -0
  147. package/src/web/public/js/onboard/index.js +374 -0
  148. package/src/web/public/js/onboard/publishHandler.js +132 -0
  149. package/src/web/public/js/onboard/state.js +76 -0
  150. package/src/web/public/js/onboard/templates.js +343 -0
  151. package/src/web/public/js/onboard/uiHandlers.js +758 -0
  152. package/src/web/public/js/onboard/validationHandlers.js +378 -0
  153. package/src/web/public/js/serverCategoryDetails.js +43 -17
  154. package/src/web/public/js/serverCategoryList.js +15 -2
  155. package/src/web/public/onboard.html +296 -0
  156. package/src/web/public/styles.css +91 -1
  157. package/src/web/server.ts +167 -58
@@ -88,8 +88,6 @@ export async function installCLI(tool) {
88
88
  }
89
89
  /**
90
90
  * Refreshes the PATH environment variable for the current Node.js process
91
- * This is necessary because when tools are installed using package managers,
92
- * they update the system PATH but the current Node process doesn't see those changes.
93
91
  */
94
92
  export async function refreshPathEnv() {
95
93
  const osType = getOSType();
@@ -139,6 +137,61 @@ export async function refreshPathEnv() {
139
137
  // Continue execution even if PATH refresh fails
140
138
  }
141
139
  }
140
+ /**
141
+ * Check if a command is available on the system
142
+ * Handles special cases for VS Code on different platforms
143
+ */
144
+ export async function isCommandAvailable(command) {
145
+ try {
146
+ // For VS Code on macOS, check both command-line tool and app bundle
147
+ if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
148
+ try {
149
+ // Try which command first
150
+ await execAsync(`which ${command}`);
151
+ return true;
152
+ }
153
+ catch (error) {
154
+ // If which fails, check application bundles
155
+ const systemVSCodePath = command === 'code' ?
156
+ '/Applications/Visual Studio Code.app' :
157
+ '/Applications/Visual Studio Code - Insiders.app';
158
+ try {
159
+ // Check system Applications first
160
+ await execAsync(`test -d "${systemVSCodePath}"`);
161
+ return true;
162
+ }
163
+ catch (error) {
164
+ // If system Applications check fails, try user Applications
165
+ const homedir = process.env.HOME;
166
+ if (homedir) {
167
+ const userVSCodePath = command === 'code' ?
168
+ `${homedir}/Applications/Visual Studio Code.app` :
169
+ `${homedir}/Applications/Visual Studio Code - Insiders.app`;
170
+ try {
171
+ await execAsync(`test -d "${userVSCodePath}"`);
172
+ return true;
173
+ }
174
+ catch (error) {
175
+ return false;
176
+ }
177
+ }
178
+ return false;
179
+ }
180
+ }
181
+ }
182
+ // For Windows, use where command
183
+ if (process.platform === 'win32') {
184
+ await execAsync(`where ${command}`);
185
+ return true;
186
+ }
187
+ // For all other cases (Unix-like systems), use which command
188
+ await execAsync(`which ${command}`);
189
+ return true;
190
+ }
191
+ catch (error) {
192
+ return false;
193
+ }
194
+ }
142
195
  export async function isToolInstalled(tool, retries = 3) {
143
196
  try {
144
197
  Logger.debug({
@@ -181,11 +234,6 @@ export async function isToolInstalled(tool, retries = 3) {
181
234
  return false;
182
235
  }
183
236
  }
184
- /**
185
- * Opens a URL in the default browser
186
- * @param url The URL to open
187
- * @returns A promise that resolves when the browser is launched
188
- */
189
237
  export async function openBrowser(url) {
190
238
  const osType = getOSType();
191
239
  Logger.debug({
@@ -234,12 +282,6 @@ export async function openBrowser(url) {
234
282
  // Don't throw the error - just log it and continue
235
283
  }
236
284
  }
237
- /**
238
- * Gets the directory containing Python packages (site-packages) based on Python executable path.
239
- * Handles different Python installations (system, venv, conda) across different OS platforms.
240
- * @param pythonExecutablePath The full path to the Python executable
241
- * @returns The site-packages directory path
242
- */
243
285
  export function getPythonPackagePath(pythonExecutablePath) {
244
286
  Logger.debug({
245
287
  action: 'get_python_package_path',
@@ -250,8 +292,29 @@ export function getPythonPackagePath(pythonExecutablePath) {
250
292
  const isWindows = process.platform === 'win32';
251
293
  // Handle common Python installation patterns
252
294
  if (isWindows) {
253
- // Windows: Check for Scripts directory (venv) or python.exe location
254
- if (dir.endsWith('Scripts')) {
295
+ // Windows: Handle different Python installations
296
+ if (dir.endsWith('WindowsApps')) {
297
+ // For Windows Store Python, find the actual Python installation directory
298
+ const entries = fs.readdirSync(dir);
299
+ const pythonDir = entries.find(e => e.startsWith('PythonSoftwareFoundation.Python'));
300
+ if (pythonDir && pythonDir.includes('.')) {
301
+ // Extract version from format like "PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0"
302
+ const parts = pythonDir.split('.');
303
+ const majorVer = parts[2];
304
+ const minorVer = parts[3].split('_')[0];
305
+ const version = majorVer + minorVer; // Combines "3" and "13" to "313"
306
+ const localAppData = process.env.LOCALAPPDATA;
307
+ if (localAppData) {
308
+ const sitePkgsPath = path.join(localAppData, 'Packages', pythonDir, 'LocalCache', 'local-packages', 'Python' + version, 'site-packages');
309
+ Logger.debug(`Resolved Windows Store Python site-packages path: ${sitePkgsPath}`);
310
+ return sitePkgsPath;
311
+ }
312
+ }
313
+ Logger.debug('Could not resolve Windows Store Python site-packages path');
314
+ // Fallback to user's site-packages
315
+ return path.join(process.env.APPDATA || '', 'Python', 'Python3', 'site-packages');
316
+ }
317
+ else if (dir.endsWith('Scripts')) {
255
318
  // Virtual environment structure on Windows: <venv>/Scripts/python.exe
256
319
  const venvRoot = path.dirname(dir);
257
320
  return path.join(venvRoot, 'Lib', 'site-packages');
@@ -304,10 +367,6 @@ export function getPythonPackagePath(pythonExecutablePath) {
304
367
  return path.dirname(pythonExecutablePath);
305
368
  }
306
369
  }
307
- /**
308
- * Finds the directory of the system's default Python installation.
309
- * @returns The directory path or null if not found.
310
- */
311
370
  export async function getSystemPythonPackageDirectory() {
312
371
  const command = process.platform === 'win32' ? 'where python' : 'which python';
313
372
  Logger.debug({
@@ -335,10 +394,6 @@ export async function getSystemPythonPackageDirectory() {
335
394
  return null;
336
395
  }
337
396
  }
338
- /**
339
- * Gets the path of the system's default browser.
340
- * @returns The path to the default browser executable.
341
- */
342
397
  export async function GetBrowserPath() {
343
398
  const osType = getOSType();
344
399
  Logger.debug({
@@ -0,0 +1,66 @@
1
+ import { DependencyConfig, RegistryConfig, ServerInstallOptions } from '../../core/types.js';
2
+ export interface OnboardServerConfig {
3
+ name: string;
4
+ description: string;
5
+ mode: 'stdio' | 'sse';
6
+ schemas?: string;
7
+ dependencies?: DependencyConfig;
8
+ repository?: string;
9
+ installation: {
10
+ command: string;
11
+ args?: string[];
12
+ env?: Record<string, {
13
+ name: string;
14
+ default?: string;
15
+ required: boolean;
16
+ description?: string;
17
+ }>;
18
+ };
19
+ }
20
+ export type RequirementType = 'npm' | 'pip' | 'command' | 'extension' | 'other';
21
+ export interface OnboardRequirementConfig {
22
+ type: RequirementType;
23
+ name: string;
24
+ version: string;
25
+ alias?: string;
26
+ registry?: RegistryConfig;
27
+ }
28
+ export interface OnboardRequestBody {
29
+ categoryData: {
30
+ name: string;
31
+ displayName: string;
32
+ description?: string;
33
+ repository?: string;
34
+ requirements?: OnboardRequirementConfig[];
35
+ mcpServers?: OnboardServerConfig[];
36
+ };
37
+ isUpdate: boolean;
38
+ forExistingCategory?: boolean;
39
+ serverName?: string;
40
+ }
41
+ export interface ListQueryParams {
42
+ local?: string;
43
+ }
44
+ export interface UpdateRequirementsRequestBody {
45
+ requirements: {
46
+ name: string;
47
+ updateVersion: string;
48
+ }[];
49
+ }
50
+ export interface InstallServersRequestBody {
51
+ serverList: Record<string, ServerInstallOptions>;
52
+ }
53
+ export interface UninstallServersRequestBody {
54
+ serverList: Record<string, {
55
+ removeData?: boolean;
56
+ }>;
57
+ options: {
58
+ targets: string[];
59
+ removeData?: boolean;
60
+ };
61
+ }
62
+ export interface ApiResponse<T> {
63
+ success: boolean;
64
+ data?: T;
65
+ error?: string;
66
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=serverContract.js.map
@@ -2,53 +2,84 @@
2
2
  .alert-container {
3
3
  z-index: 999999; /* Extremely high to appear above modals */
4
4
  position: fixed;
5
- top: 0 !important;
6
- left: 0 !important;
7
- right: 0 !important;
5
+ top: 20px; /* Adjusted for top-right positioning */
6
+ right: 20px; /* Adjusted for top-right positioning */
8
7
  display: flex;
9
8
  flex-direction: column;
10
- align-items: center;
9
+ align-items: flex-end; /* Align items to the right */
11
10
  gap: 10px;
12
11
  pointer-events: none; /* Allow clicking through the container */
12
+ max-width: 350px; /* Max width for the container */
13
13
  }
14
14
 
15
15
  .alert {
16
- min-width: 350px;
17
- max-width: 500px;
18
- box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
16
+ min-width: 300px; /* Adjusted min-width */
17
+ max-width: 100%; /* Alert can take full width of container */
18
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Softer shadow */
19
19
  backdrop-filter: blur(8px);
20
- border-width: 2px;
20
+ border-width: 1px; /* Thinner border */
21
+ border-radius: 8px; /* Rounded corners */
21
22
  pointer-events: auto; /* Re-enable pointer events for alerts */
22
- padding: 0.75rem 1.5rem;
23
- font-size: 1.1rem;
23
+ padding: 12px 20px; /* Adjusted padding */
24
+ font-size: 0.95rem; /* Slightly smaller font size */
24
25
  font-weight: 500;
25
- margin-top: 10px;
26
+ display: flex; /* For icon and text alignment */
27
+ align-items: center; /* Vertically center icon and text */
28
+ opacity: 0; /* Start hidden for animation */
29
+ transform: translateX(100%); /* Start off-screen for slide-in */
30
+ transition: opacity 0.3s ease-out, transform 0.3s ease-out; /* Smooth animation */
31
+ }
32
+
33
+ .alert.show {
34
+ opacity: 1;
35
+ transform: translateX(0);
26
36
  }
27
37
 
28
38
  .alert:first-child {
29
39
  margin-top: 0;
30
40
  }
31
41
 
42
+ .alert-icon {
43
+ margin-right: 10px; /* Space between icon and text */
44
+ font-size: 1.2rem; /* Icon size */
45
+ }
46
+
32
47
  .alert.alert-success {
33
- background-color: rgba(25, 135, 84, 0.98);
34
- border-color: #146c43;
48
+ background-color: rgba(30, 136, 229, 0.9); /* Blue for success */
49
+ border-color: #1e88e5;
35
50
  color: white;
36
- font-weight: 500;
37
51
  }
38
52
 
39
53
  .alert.alert-error {
40
- background-color: rgba(220, 53, 69, 0.98);
41
- border-color: #b02a37;
54
+ background-color: rgba(229, 57, 53, 0.9); /* Red for error */
55
+ border-color: #e53935;
42
56
  color: white;
43
- font-weight: 500;
57
+ }
58
+
59
+ .alert.alert-info {
60
+ background-color: rgba(2, 136, 209, 0.9); /* Light blue for info */
61
+ border-color: #0288d1;
62
+ color: white;
63
+ }
64
+
65
+ .alert.alert-warning {
66
+ background-color: rgba(251, 192, 45, 0.9); /* Yellow for warning */
67
+ border-color: #fbc02d;
68
+ color: #333; /* Darker text for better contrast on yellow */
44
69
  }
45
70
 
46
71
  .alert .btn-close {
47
72
  filter: brightness(0) invert(1);
48
73
  opacity: 0.8;
49
74
  padding: 0.75rem;
75
+ margin-left: auto; /* Push close button to the right */
50
76
  }
51
77
 
78
+ .alert.alert-warning .btn-close {
79
+ filter: none; /* No filter for warning close button for better visibility */
80
+ }
81
+
82
+
52
83
  /* When modal is open, add backdrop to alerts */
53
84
  .modal.show ~ .alert-container .alert {
54
85
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
@@ -0,0 +1,107 @@
1
+ /* Onboarding form styles */
2
+ .requirement-item,
3
+ .server-item {
4
+ background-color: #ffffff;
5
+ transition: all 0.2s ease;
6
+ }
7
+
8
+ .requirement-item:hover,
9
+ .server-item:hover {
10
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
11
+ }
12
+
13
+ .registry-config,
14
+ .installation-config,
15
+ .env-variables {
16
+ background-color: #f9fafb;
17
+ border-radius: 0.5rem;
18
+ padding: 0.75rem; /* Reduced padding */
19
+ margin-top: 0.75rem; /* Reduced margin-top */
20
+ }
21
+
22
+ .registry-github,
23
+ .registry-artifacts {
24
+ background-color: #ffffff;
25
+ border-radius: 0.5rem;
26
+ padding: 0.75rem; /* Reduced padding */
27
+ }
28
+
29
+ /* Order field styling */
30
+ input[type="number"][name$=".order"] {
31
+ -moz-appearance: textfield;
32
+ }
33
+
34
+ input[type="number"][name$=".order"]::-webkit-outer-spin-button,
35
+ input[type="number"][name$=".order"]::-webkit-inner-spin-button {
36
+ -webkit-appearance: none;
37
+ margin: 0;
38
+ }
39
+
40
+ input[type="number"][name$=".order"]:focus {
41
+ border-color: #3b82f6;
42
+ outline: none;
43
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
44
+ }
45
+
46
+ /* Collapsible sections */
47
+ .collapsible-content {
48
+ overflow: hidden;
49
+ transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out, margin 0.3s ease-out;
50
+ opacity: 1;
51
+ max-height: 1000px; /* Adjust as needed, should be larger than the content */
52
+ }
53
+
54
+ .collapsible-content.hidden {
55
+ max-height: 0;
56
+ opacity: 0;
57
+ padding-top: 0 !important; /* Use important to override potential inline styles or more specific selectors */
58
+ padding-bottom: 0 !important;
59
+ margin-top: 0 !important;
60
+ margin-bottom: 0 !important; /* Ensure bottom margin also collapses */
61
+ border-top-width: 0;
62
+ border-bottom-width: 0;
63
+ overflow: hidden; /* Ensure content is clipped during transition */
64
+ }
65
+
66
+ /* Styling for the clickable header of collapsible sections */
67
+ .collapsible-header {
68
+ cursor: pointer;
69
+ display: flex;
70
+ justify-content: space-between;
71
+ align-items: center;
72
+ }
73
+
74
+ .collapsible-header i {
75
+ transition: transform 0.3s ease;
76
+ }
77
+
78
+ .collapsible-content.hidden + .collapsible-header i {
79
+ transform: rotate(-90deg);
80
+ }
81
+
82
+ /* Specific styling for scrollable server content */
83
+ .server-content-scrollable {
84
+ /* This max-height is for when the section is *expanded*.
85
+ The .collapsible-content.hidden will still set max-height to 0 for collapse.
86
+ The general .collapsible-content max-height is a fallback for other sections.
87
+ */
88
+ max-height: 60vh; /* Reduced max-height for compactness */
89
+ overflow-y: auto; /* Add vertical scrollbar when content exceeds max-height */
90
+ padding-right: 0.5rem; /* Add a little padding so scrollbar doesn't overlap content too much */
91
+ /* Ensure it inherits or has its own transitions for smooth animation */
92
+ transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out, margin 0.3s ease-out;
93
+ opacity: 1; /* Explicitly set opacity for visible state */
94
+ }
95
+
96
+ /* Ensure that when server-content-scrollable is hidden, its specific max-height is overridden */
97
+ .server-content-scrollable.hidden {
98
+ max-height: 0 !important; /* Override the 60vh for hidden state */
99
+ opacity: 0 !important; /* Ensure opacity transition for hidden state */
100
+ overflow-y: hidden; /* Hide scrollbar when collapsed */
101
+ padding-top: 0 !important;
102
+ padding-bottom: 0 !important;
103
+ padding-left: 0 !important; /* Ensure all paddings are zeroed */
104
+ padding-right: 0 !important;
105
+ margin-top: 0 !important;
106
+ margin-bottom: 0 !important;
107
+ }
@@ -23,18 +23,42 @@
23
23
 
24
24
  <body class="bg-gray-50 min-h-screen">
25
25
  <div class="container mx-auto px-4 py-6">
26
- <header class="mb-8">
27
- <h1 class="text-3xl font-bold text-gray-900 flex items-center justify-center">
26
+ <div class="flex items-center justify-between mb-8">
27
+ <h1 class="text-3xl font-bold text-gray-900 flex items-center">
28
28
  <i class='bx bx-server mr-3 text-blue-600'></i>
29
29
  IMCP Server Manager
30
30
  </h1>
31
- </header>
32
-
33
- <div class="search-controls mb-6">
34
- <div class="relative max-w-2xl mx-auto">
35
- <input type="text" id="searchBox" placeholder="Search servers or tools..." class="search-input">
36
- <i class='bx bx-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400'></i>
31
+ <div class="lg:w-2/3 flex justify-end items-center gap-4">
32
+ <div class="relative w-48 focus-within:w-96 transition-all duration-300 ease-in-out">
33
+ <input type="text" id="searchBox"
34
+ placeholder="Search..."
35
+ data-expanded-placeholder="Search servers or tools..."
36
+ class="w-full px-10 py-2.5 bg-gray-50 border border-gray-200 rounded-lg
37
+ text-gray-700 placeholder-gray-400
38
+ focus:border-blue-400 focus:ring-2 focus:ring-blue-100
39
+ transition-all duration-300 ease-in-out">
40
+ <i class='bx bx-search absolute left-3.5 top-1/2 transform -translate-y-1/2 text-gray-400'></i>
41
+ </div>
42
+ <button id="onboardButton" style="display: none;"
43
+ class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center">
44
+ <i class='bx bx-plus-circle mr-2'></i>
45
+ Onboard
46
+ </button>
37
47
  </div>
48
+ <script>
49
+ document.addEventListener('DOMContentLoaded', () => {
50
+ const searchBox = document.getElementById('searchBox');
51
+ const expandedPlaceholder = searchBox.dataset.expandedPlaceholder;
52
+ searchBox.addEventListener('focus', () => {
53
+ setTimeout(() => searchBox.placeholder = expandedPlaceholder, 150);
54
+ });
55
+ searchBox.addEventListener('blur', () => {
56
+ if (!searchBox.value) {
57
+ searchBox.placeholder = 'Search...';
58
+ }
59
+ });
60
+ });
61
+ </script>
38
62
  </div>
39
63
 
40
64
  <div class="flex flex-col lg:flex-row gap-6">
@@ -147,10 +171,15 @@
147
171
  import { setupSearch } from './js/serverCategoryList.js';
148
172
  import { showServerDetails } from './js/serverCategoryDetails.js';
149
173
  import { showInstallModal, closeModal, setupModalOutsideClick } from './js/modal.js';
174
+ // import { showOnboardModal as navigateToOnboard } from './js/onboard/index.js'; // We are directly navigating
175
+ import flights, { getFlightQueryParameters, buildUrlWithFlights } from './js/flights/flights.js';
150
176
 
151
177
  // Make necessary functions available globally
152
178
  window.showServerDetails = showServerDetails;
153
179
  window.showInstallModal = showInstallModal;
180
+ // window.showOnboardModal = showOnboardModal; // This might conflict if showOnboardModal is also in onboard/index.js
181
+ // We'll rely on the event listener above for the main page's onboard button.
182
+ // If other parts of the app call window.showOnboardModal, they'll need updating too.
154
183
  window.closeModal = closeModal;
155
184
  window.handleInstallServer = handleInstallServer;
156
185
  window.installRequirement = installRequirement;
@@ -162,19 +191,62 @@
162
191
  setupSearch();
163
192
  setupModalOutsideClick();
164
193
 
165
- // Check URL parameters for category
166
- const urlParams = new URLSearchParams(window.location.search);
167
- const categoryParam = urlParams.get('category');
194
+ const onboardButton = document.getElementById('onboardButton');
195
+ if (flights.enableOnboard) {
196
+ onboardButton.style.display = 'flex'; // Make it visible
197
+ onboardButton.addEventListener('click', () => {
198
+ // The original showOnboardModal in onboard/index.js likely does window.location.href = 'onboard.html';
199
+ // We need to preserve existing flight parameters.
200
+ const flightQueryString = getFlightQueryParameters();
201
+ // Assuming navigateToOnboard from onboard/index.js handles the actual navigation
202
+ // If it directly sets window.location.href, we might need to adjust how it's called or modify it.
203
+ // For now, let's assume we can adapt its usage or it's a simple navigation.
204
+ // The simplest way if showOnboardModal in onboard/index.js is just `window.location.href = 'onboard.html'`
205
+ // would be to directly navigate here.
206
+ window.location.href = buildUrlWithFlights('onboard.html');
207
+ });
208
+ }
209
+ // No 'else' block needed as it's hidden by default via inline style
210
+
211
+ try {
212
+ // First fetch categories and wait for completion
213
+ // fetchServerCategories will call renderServerCategoryList, which might call loadLastSelectedCategory.
214
+ // loadLastSelectedCategory calls showServerDetails.
215
+ // The logic for setting initial category URL is now more centralized.
216
+
217
+ await fetchServerCategories(); // This populates allServerCategoriesData
168
218
 
169
- // If we have a category parameter or last selected category
170
- const lastSelected = categoryParam || localStorage.getItem('lastSelectedCategory');
219
+ const urlParams = new URLSearchParams(window.location.search);
220
+ const categoryParam = urlParams.get('category');
221
+ const lastSelectedCategoryFromStorage = localStorage.getItem('lastSelectedCategory');
171
222
 
172
- // First fetch categories
173
- await fetchServerCategories();
223
+ if (categoryParam) {
224
+ // Category is in URL, load it
225
+ await window.showServerDetails(categoryParam);
226
+ } else if (lastSelectedCategoryFromStorage) {
227
+ // Category not in URL, but in localStorage. Redirect to URL with this category and flights.
228
+ window.location.href = buildUrlWithFlights('index.html', { category: lastSelectedCategoryFromStorage });
229
+ return; // Stop further execution, page will reload
230
+ } else if (allServerCategoriesData && allServerCategoriesData.length > 0) {
231
+ // No category in URL or localStorage, pick first from list and redirect.
232
+ window.location.href = buildUrlWithFlights('index.html', { category: allServerCategoriesData[0].name });
233
+ return; // Stop further execution, page will reload
234
+ } else {
235
+ // No categories at all, or data still loading. Default placeholder will be shown.
236
+ // Or, if allServerCategoriesData is empty after fetch, the placeholder from HTML remains.
237
+ }
174
238
 
175
- // Then show the selected category if it exists
176
- if (lastSelected) {
177
- showServerDetails(lastSelected);
239
+ } catch (error) {
240
+ console.error('Error during initialization:', error);
241
+ // Potentially show a user-friendly error message in the UI
242
+ const serverCategoryDetailsDiv = document.getElementById('serverCategoryDetails');
243
+ if (serverCategoryDetailsDiv) {
244
+ serverCategoryDetailsDiv.innerHTML = `<p class="text-red-500">Error initializing page: ${error.message}</p>`;
245
+ }
246
+ const serverCategoryListDiv = document.getElementById('serverCategoryList');
247
+ if (serverCategoryListDiv) {
248
+ serverCategoryListDiv.innerHTML = `<p class="text-red-500">Could not load categories.</p>`;
249
+ }
178
250
  }
179
251
  });
180
252
  </script>
@@ -3,6 +3,8 @@ import { showToast } from './notifications.js';
3
3
 
4
4
  // Global store for server data
5
5
  let allServerCategoriesData = [];
6
+ // Make it available globally for legacy code
7
+ window.allServerCategoriesData = allServerCategoriesData;
6
8
 
7
9
  // Fetch and display servers
8
10
  async function fetchServerCategories() {
@@ -14,16 +16,11 @@ async function fetchServerCategories() {
14
16
  if (!responseData.success || !responseData.data) {
15
17
  throw new Error(`API Error fetching servers: ${responseData.error || 'Invalid data format'}`);
16
18
  }
17
- allServerCategoriesData = responseData.data; // Store globally
19
+ allServerCategoriesData = window.allServerCategoriesData = responseData.data; // Update both local and global references
18
20
 
19
21
  // Use the renderServerCategoryList function to display servers
20
22
  renderServerCategoryList(allServerCategoriesData);
21
23
 
22
- // Show the first category by default if there are categories
23
- if (allServerCategoriesData.length > 0) {
24
- window.showServerDetails(allServerCategoriesData[0].name);
25
- }
26
-
27
24
  // Check if search is active
28
25
  const searchTerm = document.getElementById('searchBox').value.toLowerCase();
29
26
  if (searchTerm) {