@fredlackey/devutils 0.0.1 → 0.0.3

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 (259) hide show
  1. package/README.md +5 -5
  2. package/package.json +1 -1
  3. package/src/commands/install.js +374 -36
  4. package/src/installs/adobe-creative-cloud.js +527 -25
  5. package/src/installs/adobe-creative-cloud.md +605 -0
  6. package/src/installs/appcleaner.js +303 -26
  7. package/src/installs/appcleaner.md +699 -0
  8. package/src/installs/apt-transport-https.js +390 -0
  9. package/src/installs/apt-transport-https.md +678 -0
  10. package/src/installs/atomicparsley.js +624 -26
  11. package/src/installs/atomicparsley.md +795 -0
  12. package/src/installs/aws-cli.js +779 -26
  13. package/src/installs/aws-cli.md +727 -0
  14. package/src/installs/balena-etcher.js +688 -26
  15. package/src/installs/balena-etcher.md +761 -0
  16. package/src/installs/bambu-studio.js +912 -26
  17. package/src/installs/bambu-studio.md +780 -0
  18. package/src/installs/bash-completion.js +554 -23
  19. package/src/installs/bash-completion.md +833 -0
  20. package/src/installs/bash.js +399 -26
  21. package/src/installs/bash.md +993 -0
  22. package/src/installs/beyond-compare.js +585 -26
  23. package/src/installs/beyond-compare.md +813 -0
  24. package/src/installs/build-essential.js +511 -26
  25. package/src/installs/build-essential.md +977 -0
  26. package/src/installs/ca-certificates.js +618 -0
  27. package/src/installs/ca-certificates.md +937 -0
  28. package/src/installs/caffeine.js +490 -26
  29. package/src/installs/caffeine.md +839 -0
  30. package/src/installs/camtasia.js +577 -25
  31. package/src/installs/camtasia.md +762 -0
  32. package/src/installs/chatgpt.js +458 -26
  33. package/src/installs/chatgpt.md +814 -0
  34. package/src/installs/chocolatey.js +447 -0
  35. package/src/installs/chocolatey.md +661 -0
  36. package/src/installs/chrome-canary.js +472 -26
  37. package/src/installs/chrome-canary.md +641 -0
  38. package/src/installs/chromium.js +645 -26
  39. package/src/installs/chromium.md +838 -0
  40. package/src/installs/claude-code.js +558 -26
  41. package/src/installs/claude-code.md +1173 -0
  42. package/src/installs/curl.js +361 -26
  43. package/src/installs/curl.md +714 -0
  44. package/src/installs/cursor.js +561 -26
  45. package/src/installs/cursor.md +970 -0
  46. package/src/installs/dbschema.js +674 -26
  47. package/src/installs/dbschema.md +925 -0
  48. package/src/installs/dependencies.md +435 -0
  49. package/src/installs/development-tools.js +600 -0
  50. package/src/installs/development-tools.md +977 -0
  51. package/src/installs/docker.js +1010 -25
  52. package/src/installs/docker.md +1109 -0
  53. package/src/installs/drawio.js +1001 -26
  54. package/src/installs/drawio.md +795 -0
  55. package/src/installs/elmedia-player.js +328 -25
  56. package/src/installs/elmedia-player.md +556 -0
  57. package/src/installs/ffmpeg.js +870 -25
  58. package/src/installs/ffmpeg.md +852 -0
  59. package/src/installs/file.js +464 -0
  60. package/src/installs/file.md +987 -0
  61. package/src/installs/gemini-cli.js +793 -26
  62. package/src/installs/gemini-cli.md +1153 -0
  63. package/src/installs/git.js +382 -26
  64. package/src/installs/git.md +907 -0
  65. package/src/installs/gitego.js +931 -26
  66. package/src/installs/gitego.md +1172 -0
  67. package/src/installs/go.js +913 -26
  68. package/src/installs/go.md +958 -0
  69. package/src/installs/google-chrome.js +801 -25
  70. package/src/installs/google-chrome.md +862 -0
  71. package/src/installs/gpg.js +412 -73
  72. package/src/installs/gpg.md +1056 -0
  73. package/src/installs/homebrew.js +1015 -26
  74. package/src/installs/homebrew.md +988 -0
  75. package/src/installs/imageoptim.js +950 -26
  76. package/src/installs/imageoptim.md +1119 -0
  77. package/src/installs/installers.json +2297 -0
  78. package/src/installs/jq.js +382 -26
  79. package/src/installs/jq.md +809 -0
  80. package/src/installs/keyboard-maestro.js +701 -26
  81. package/src/installs/keyboard-maestro.md +825 -0
  82. package/src/installs/latex.js +771 -26
  83. package/src/installs/latex.md +1095 -0
  84. package/src/installs/lftp.js +338 -26
  85. package/src/installs/lftp.md +907 -0
  86. package/src/installs/lsb-release.js +346 -0
  87. package/src/installs/lsb-release.md +814 -0
  88. package/src/installs/messenger.js +829 -26
  89. package/src/installs/messenger.md +900 -0
  90. package/src/installs/microsoft-office.js +550 -26
  91. package/src/installs/microsoft-office.md +760 -0
  92. package/src/installs/microsoft-teams.js +782 -25
  93. package/src/installs/microsoft-teams.md +886 -0
  94. package/src/installs/node.js +886 -26
  95. package/src/installs/node.md +1153 -0
  96. package/src/installs/nordpass.js +698 -26
  97. package/src/installs/nordpass.md +921 -0
  98. package/src/installs/nvm.js +977 -26
  99. package/src/installs/nvm.md +1057 -0
  100. package/src/installs/openssh.js +734 -64
  101. package/src/installs/openssh.md +1056 -0
  102. package/src/installs/pandoc.js +644 -26
  103. package/src/installs/pandoc.md +1036 -0
  104. package/src/installs/pinentry.js +492 -26
  105. package/src/installs/pinentry.md +1142 -0
  106. package/src/installs/pngyu.js +851 -26
  107. package/src/installs/pngyu.md +896 -0
  108. package/src/installs/postman.js +781 -26
  109. package/src/installs/postman.md +940 -0
  110. package/src/installs/procps.js +425 -0
  111. package/src/installs/procps.md +851 -0
  112. package/src/installs/safari-tech-preview.js +355 -25
  113. package/src/installs/safari-tech-preview.md +533 -0
  114. package/src/installs/sfnt2woff.js +640 -26
  115. package/src/installs/sfnt2woff.md +795 -0
  116. package/src/installs/shellcheck.js +463 -26
  117. package/src/installs/shellcheck.md +1005 -0
  118. package/src/installs/slack.js +722 -25
  119. package/src/installs/slack.md +865 -0
  120. package/src/installs/snagit.js +566 -25
  121. package/src/installs/snagit.md +844 -0
  122. package/src/installs/software-properties-common.js +372 -0
  123. package/src/installs/software-properties-common.md +805 -0
  124. package/src/installs/spotify.js +858 -25
  125. package/src/installs/spotify.md +901 -0
  126. package/src/installs/studio-3t.js +803 -26
  127. package/src/installs/studio-3t.md +918 -0
  128. package/src/installs/sublime-text.js +780 -25
  129. package/src/installs/sublime-text.md +914 -0
  130. package/src/installs/superwhisper.js +687 -25
  131. package/src/installs/superwhisper.md +630 -0
  132. package/src/installs/tailscale.js +727 -26
  133. package/src/installs/tailscale.md +1100 -0
  134. package/src/installs/tar.js +389 -0
  135. package/src/installs/tar.md +946 -0
  136. package/src/installs/termius.js +780 -26
  137. package/src/installs/termius.md +844 -0
  138. package/src/installs/terraform.js +761 -26
  139. package/src/installs/terraform.md +899 -0
  140. package/src/installs/tidal.js +752 -25
  141. package/src/installs/tidal.md +864 -0
  142. package/src/installs/tmux.js +328 -26
  143. package/src/installs/tmux.md +1030 -0
  144. package/src/installs/tree.js +393 -26
  145. package/src/installs/tree.md +833 -0
  146. package/src/installs/unzip.js +460 -0
  147. package/src/installs/unzip.md +879 -0
  148. package/src/installs/vim.js +403 -26
  149. package/src/installs/vim.md +1040 -0
  150. package/src/installs/vlc.js +803 -26
  151. package/src/installs/vlc.md +927 -0
  152. package/src/installs/vscode.js +825 -26
  153. package/src/installs/vscode.md +1002 -0
  154. package/src/installs/wget.js +415 -0
  155. package/src/installs/wget.md +791 -0
  156. package/src/installs/whatsapp.js +710 -25
  157. package/src/installs/whatsapp.md +854 -0
  158. package/src/installs/winpty.js +352 -0
  159. package/src/installs/winpty.md +620 -0
  160. package/src/installs/woff2.js +535 -26
  161. package/src/installs/woff2.md +977 -0
  162. package/src/installs/wsl.js +572 -0
  163. package/src/installs/wsl.md +699 -0
  164. package/src/installs/xcode-clt.js +520 -0
  165. package/src/installs/xcode-clt.md +351 -0
  166. package/src/installs/xcode.js +542 -26
  167. package/src/installs/xcode.md +573 -0
  168. package/src/installs/yarn.js +806 -26
  169. package/src/installs/yarn.md +1074 -0
  170. package/src/installs/yq.js +636 -26
  171. package/src/installs/yq.md +944 -0
  172. package/src/installs/yt-dlp.js +683 -26
  173. package/src/installs/yt-dlp.md +946 -0
  174. package/src/installs/yum-utils.js +297 -0
  175. package/src/installs/yum-utils.md +648 -0
  176. package/src/installs/zoom.js +740 -25
  177. package/src/installs/zoom.md +884 -0
  178. package/src/scripts/README.md +567 -45
  179. package/src/scripts/STATUS.md +208 -0
  180. package/src/scripts/afk.js +395 -7
  181. package/src/scripts/backup-all.js +731 -9
  182. package/src/scripts/backup-source.js +711 -8
  183. package/src/scripts/brewd.js +373 -7
  184. package/src/scripts/brewi.js +505 -9
  185. package/src/scripts/brewr.js +512 -9
  186. package/src/scripts/brews.js +462 -9
  187. package/src/scripts/brewu.js +488 -7
  188. package/src/scripts/c.js +185 -7
  189. package/src/scripts/ccurl.js +325 -8
  190. package/src/scripts/certbot-crontab-init.js +488 -8
  191. package/src/scripts/certbot-init.js +641 -9
  192. package/src/scripts/ch.js +339 -7
  193. package/src/scripts/claude-danger.js +253 -8
  194. package/src/scripts/clean-dev.js +419 -8
  195. package/src/scripts/clear-dns-cache.js +525 -7
  196. package/src/scripts/clone.js +417 -7
  197. package/src/scripts/code-all.js +420 -7
  198. package/src/scripts/count-files.js +195 -8
  199. package/src/scripts/count-folders.js +195 -8
  200. package/src/scripts/count.js +248 -8
  201. package/src/scripts/d.js +203 -7
  202. package/src/scripts/datauri.js +373 -8
  203. package/src/scripts/delete-files.js +363 -7
  204. package/src/scripts/docker-clean.js +410 -8
  205. package/src/scripts/dp.js +426 -7
  206. package/src/scripts/e.js +375 -9
  207. package/src/scripts/empty-trash.js +497 -7
  208. package/src/scripts/evm.js +428 -9
  209. package/src/scripts/fetch-github-repos.js +441 -10
  210. package/src/scripts/get-channel.js +329 -8
  211. package/src/scripts/get-course.js +384 -11
  212. package/src/scripts/get-dependencies.js +290 -9
  213. package/src/scripts/get-folder.js +783 -10
  214. package/src/scripts/get-tunes.js +411 -10
  215. package/src/scripts/get-video.js +352 -9
  216. package/src/scripts/git-backup.js +561 -9
  217. package/src/scripts/git-clone.js +477 -9
  218. package/src/scripts/git-pup.js +303 -7
  219. package/src/scripts/git-push.js +380 -8
  220. package/src/scripts/h.js +607 -9
  221. package/src/scripts/hide-desktop-icons.js +483 -7
  222. package/src/scripts/hide-hidden-files.js +522 -7
  223. package/src/scripts/install-dependencies-from.js +440 -9
  224. package/src/scripts/ips.js +647 -10
  225. package/src/scripts/iso.js +354 -8
  226. package/src/scripts/killni.js +561 -7
  227. package/src/scripts/ll.js +451 -8
  228. package/src/scripts/local-ip.js +310 -8
  229. package/src/scripts/m.js +508 -8
  230. package/src/scripts/map.js +293 -8
  231. package/src/scripts/mkd.js +287 -7
  232. package/src/scripts/ncu-update-all.js +441 -8
  233. package/src/scripts/nginx-init.js +702 -12
  234. package/src/scripts/npmi.js +366 -7
  235. package/src/scripts/o.js +495 -8
  236. package/src/scripts/org-by-date.js +321 -7
  237. package/src/scripts/p.js +208 -7
  238. package/src/scripts/packages.js +313 -8
  239. package/src/scripts/path.js +209 -7
  240. package/src/scripts/ports.js +582 -8
  241. package/src/scripts/q.js +290 -8
  242. package/src/scripts/refresh-files.js +378 -10
  243. package/src/scripts/remove-smaller-files.js +500 -8
  244. package/src/scripts/rename-files-with-date.js +517 -9
  245. package/src/scripts/resize-image.js +523 -9
  246. package/src/scripts/rm-safe.js +653 -8
  247. package/src/scripts/s.js +525 -9
  248. package/src/scripts/set-git-public.js +349 -7
  249. package/src/scripts/show-desktop-icons.js +459 -7
  250. package/src/scripts/show-hidden-files.js +456 -7
  251. package/src/scripts/tpa.js +265 -8
  252. package/src/scripts/tpo.js +264 -7
  253. package/src/scripts/u.js +489 -7
  254. package/src/scripts/vpush.js +422 -8
  255. package/src/scripts/y.js +267 -7
  256. package/src/utils/common/os.js +94 -2
  257. package/src/utils/ubuntu/apt.js +13 -7
  258. package/src/utils/windows/choco.js +82 -26
  259. package/src/utils/windows/winget.js +89 -27
@@ -1,44 +1,476 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * @fileoverview Install ChatGPT.
4
+ * @fileoverview Install ChatGPT desktop application.
5
+ *
6
+ * ChatGPT is OpenAI's AI assistant available as a desktop application.
7
+ *
8
+ * Platform Support:
9
+ * - macOS: Official OpenAI app via Homebrew (Apple Silicon only)
10
+ * - Windows: Official OpenAI app via winget from Microsoft Store
11
+ * - Ubuntu/Debian: Third-party Snap wrapper (chatgpt-desktop)
12
+ * - WSL: Uses Windows host app or wslu web browser integration
13
+ * - Raspberry Pi OS: Not supported (ARM64 Snap packages not available)
14
+ * - Amazon Linux: Not supported (typically server environment without GUI)
15
+ * - Git Bash: Delegates to Windows installation via winget
16
+ *
5
17
  * @module installs/chatgpt
6
18
  */
7
19
 
8
20
  const os = require('../utils/common/os');
21
+ const shell = require('../utils/common/shell');
22
+ const brew = require('../utils/macos/brew');
23
+ const macosApps = require('../utils/macos/apps');
24
+ const snap = require('../utils/ubuntu/snap');
25
+ const winget = require('../utils/windows/winget');
26
+
27
+ /**
28
+ * Whether this installer requires a desktop environment to function.
29
+ * ChatGPT desktop app is a GUI application.
30
+ */
31
+ const REQUIRES_DESKTOP = true;
32
+
33
+ /**
34
+ * The Microsoft Store ID for the official ChatGPT Windows app.
35
+ * This ID is used to install and verify the app via winget.
36
+ */
37
+ const WINDOWS_STORE_ID = '9NT1R1C2HH7J';
38
+
39
+ /**
40
+ * The Homebrew cask name for the official ChatGPT macOS app.
41
+ */
42
+ const HOMEBREW_CASK_NAME = 'chatgpt';
43
+
44
+ /**
45
+ * The Snap package name for the third-party ChatGPT desktop wrapper on Linux.
46
+ * Note: This is NOT an official OpenAI product.
47
+ */
48
+ const SNAP_PACKAGE_NAME = 'chatgpt-desktop';
49
+
50
+ /**
51
+ * Install ChatGPT on macOS using Homebrew.
52
+ *
53
+ * The official ChatGPT desktop app from OpenAI requires:
54
+ * - macOS 14 (Sonoma) or later
55
+ * - Apple Silicon processor (M1, M2, M3, or later)
56
+ *
57
+ * Intel Macs are not supported by the official app.
58
+ *
59
+ * @returns {Promise<void>}
60
+ */
61
+ async function install_macos() {
62
+ // Step 1: Check if ChatGPT is already installed in /Applications
63
+ const isAlreadyInstalled = macosApps.isAppInstalled('ChatGPT');
64
+ if (isAlreadyInstalled) {
65
+ console.log('ChatGPT is already installed, skipping...');
66
+ return;
67
+ }
68
+
69
+ // Step 2: Check if Homebrew is available
70
+ if (!brew.isInstalled()) {
71
+ console.error('Homebrew is not installed. Please install Homebrew first.');
72
+ console.error('Run: dev install homebrew');
73
+ return;
74
+ }
75
+
76
+ // Step 3: Check processor architecture (Apple Silicon required)
77
+ const architecture = os.getArch();
78
+ if (architecture !== 'arm64') {
79
+ console.log('ChatGPT desktop app requires Apple Silicon (M1/M2/M3).');
80
+ console.log('Intel Macs are not supported by the official OpenAI app.');
81
+ return;
82
+ }
83
+
84
+ // Step 4: Install ChatGPT via Homebrew cask
85
+ console.log('Installing ChatGPT via Homebrew...');
86
+ const installResult = await brew.installCask(HOMEBREW_CASK_NAME);
87
+
88
+ if (!installResult.success) {
89
+ console.error('Failed to install ChatGPT.');
90
+ console.error(installResult.output);
91
+ return;
92
+ }
93
+
94
+ // Step 5: Verify the installation succeeded
95
+ const isNowInstalled = macosApps.isAppInstalled('ChatGPT');
96
+ if (!isNowInstalled) {
97
+ console.error('Installation completed but ChatGPT.app was not found in /Applications.');
98
+ return;
99
+ }
100
+
101
+ console.log('ChatGPT installed successfully.');
102
+ console.log('Launch it from Applications or press Option+Space after first launch.');
103
+ }
104
+
105
+ /**
106
+ * Install ChatGPT on Ubuntu/Debian using Snap.
107
+ *
108
+ * Note: OpenAI does not provide an official ChatGPT desktop app for Linux.
109
+ * This installs a third-party Electron wrapper (chatgpt-desktop) that provides
110
+ * a native window for the ChatGPT web interface.
111
+ *
112
+ * @returns {Promise<void>}
113
+ */
114
+ async function install_ubuntu() {
115
+ // Step 1: Check if chatgpt-desktop is already installed via Snap
116
+ const isAlreadyInstalled = await snap.isSnapInstalled(SNAP_PACKAGE_NAME);
117
+ if (isAlreadyInstalled) {
118
+ console.log('ChatGPT Desktop is already installed, skipping...');
119
+ return;
120
+ }
121
+
122
+ // Step 2: Check if snapd is available
123
+ if (!snap.isInstalled()) {
124
+ console.error('Snap is not installed. Please install snapd first.');
125
+ console.error('Run: sudo apt-get update && sudo apt-get install -y snapd');
126
+ return;
127
+ }
128
+
129
+ // Step 3: Inform user this is a third-party wrapper
130
+ console.log('Note: This installs a third-party ChatGPT desktop wrapper, not an official OpenAI app.');
131
+ console.log('Installing ChatGPT Desktop via Snap...');
132
+
133
+ // Step 4: Install the Snap package
134
+ const installResult = await snap.install(SNAP_PACKAGE_NAME);
135
+
136
+ if (!installResult.success) {
137
+ console.error('Failed to install ChatGPT Desktop.');
138
+ console.error(installResult.output);
139
+ return;
140
+ }
141
+
142
+ // Step 5: Verify the installation succeeded
143
+ const isNowInstalled = await snap.isSnapInstalled(SNAP_PACKAGE_NAME);
144
+ if (!isNowInstalled) {
145
+ console.error('Installation completed but chatgpt-desktop was not found.');
146
+ return;
147
+ }
148
+
149
+ console.log('ChatGPT Desktop installed successfully.');
150
+ console.log('You may need to log out and log back in for the app to appear in your menu.');
151
+ console.log('Or launch directly with: chatgpt-desktop');
152
+ }
153
+
154
+ /**
155
+ * Install ChatGPT on Ubuntu running in WSL.
156
+ *
157
+ * For WSL environments, the recommended approach is to:
158
+ * 1. Install the Windows ChatGPT app (if not already installed)
159
+ * 2. Use wslu (wslview) to open the ChatGPT web interface
160
+ *
161
+ * Running Linux GUI apps in WSL requires WSL 2 with WSLg (Windows 11+).
162
+ *
163
+ * @returns {Promise<void>}
164
+ */
165
+ async function install_ubuntu_wsl() {
166
+ // Step 1: Check if wslu is installed for web browser integration
167
+ const hasWslview = shell.commandExists('wslview');
168
+
169
+ if (!hasWslview) {
170
+ // Install wslu utilities which provide wslview for opening Windows browser
171
+ console.log('Installing wslu utilities for Windows integration...');
172
+ const aptResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y wslu');
173
+
174
+ if (aptResult.code !== 0) {
175
+ console.error('Failed to install wslu utilities.');
176
+ console.error(aptResult.stderr);
177
+ return;
178
+ }
179
+ }
180
+
181
+ // Step 2: Try to install the Windows ChatGPT app via winget (if accessible)
182
+ // Check if winget.exe is accessible from WSL
183
+ const hasWinget = shell.commandExists('winget.exe');
184
+
185
+ if (hasWinget) {
186
+ // Check if ChatGPT is already installed on Windows
187
+ const listResult = await shell.exec(`winget.exe list --id ${WINDOWS_STORE_ID}`);
188
+ const isWindowsAppInstalled = listResult.code === 0 && listResult.stdout.includes(WINDOWS_STORE_ID);
189
+
190
+ if (!isWindowsAppInstalled) {
191
+ console.log('Installing ChatGPT Windows app via winget...');
192
+ const installResult = await shell.exec(
193
+ `winget.exe install --id ${WINDOWS_STORE_ID} --source msstore --silent --accept-package-agreements --accept-source-agreements`
194
+ );
195
+
196
+ if (installResult.code === 0) {
197
+ console.log('ChatGPT Windows app installed successfully.');
198
+ } else {
199
+ console.log('Could not install Windows app. You can use the web interface instead.');
200
+ }
201
+ } else {
202
+ console.log('ChatGPT Windows app is already installed.');
203
+ }
204
+ }
205
+
206
+ console.log('');
207
+ console.log('WSL ChatGPT setup complete.');
208
+ console.log('Access ChatGPT using: wslview https://chat.openai.com');
209
+ console.log('Or launch the Windows app from the Start Menu.');
210
+ }
211
+
212
+ /**
213
+ * Install ChatGPT on Raspberry Pi OS.
214
+ *
215
+ * OpenAI does not provide an official ChatGPT desktop app for Raspberry Pi.
216
+ * Third-party Snap packages typically only support x86_64 (amd64) architecture,
217
+ * not ARM64 (aarch64) used by Raspberry Pi.
218
+ *
219
+ * @returns {Promise<void>}
220
+ */
221
+ async function install_raspbian() {
222
+ console.log('ChatGPT desktop app is not available for Raspberry Pi OS.');
223
+ console.log('The Raspberry Pi uses ARM64 architecture which is not supported by available packages.');
224
+ return;
225
+ }
226
+
227
+ /**
228
+ * Install ChatGPT on Amazon Linux/RHEL.
229
+ *
230
+ * OpenAI does not provide an official ChatGPT desktop app for Amazon Linux.
231
+ * Amazon Linux is typically used as a server operating system without a
232
+ * desktop environment, making GUI applications impractical.
233
+ *
234
+ * @returns {Promise<void>}
235
+ */
236
+ async function install_amazon_linux() {
237
+ console.log('ChatGPT desktop app is not available for Amazon Linux.');
238
+ return;
239
+ }
9
240
 
10
241
  /**
11
- * Install ChatGPT across supported platforms.
242
+ * Install ChatGPT on Windows using winget.
243
+ *
244
+ * Installs the official OpenAI ChatGPT app from the Microsoft Store.
245
+ * Requires Windows 10 version 17763.0 or later, or Windows 11.
246
+ *
247
+ * @returns {Promise<void>}
248
+ */
249
+ async function install_windows() {
250
+ // Step 1: Check if winget is available
251
+ if (!winget.isInstalled()) {
252
+ console.error('winget is not available. Please install App Installer from the Microsoft Store.');
253
+ return;
254
+ }
255
+
256
+ // Step 2: Check if ChatGPT is already installed
257
+ // For Microsoft Store apps, we check by the store ID
258
+ const listResult = await shell.exec(`winget list --id ${WINDOWS_STORE_ID}`);
259
+ const isAlreadyInstalled = listResult.code === 0 && listResult.stdout.includes(WINDOWS_STORE_ID);
260
+
261
+ if (isAlreadyInstalled) {
262
+ console.log('ChatGPT is already installed, skipping...');
263
+ return;
264
+ }
265
+
266
+ // Step 3: Install from Microsoft Store
267
+ console.log('Installing ChatGPT from Microsoft Store...');
268
+ const installResult = await shell.exec(
269
+ `winget install --id ${WINDOWS_STORE_ID} --source msstore --silent --accept-package-agreements --accept-source-agreements`
270
+ );
271
+
272
+ if (installResult.code !== 0) {
273
+ console.error('Failed to install ChatGPT.');
274
+ console.error(installResult.stderr || installResult.stdout);
275
+ return;
276
+ }
277
+
278
+ // Step 4: Verify installation
279
+ const verifyResult = await shell.exec(`winget list --id ${WINDOWS_STORE_ID}`);
280
+ const isNowInstalled = verifyResult.code === 0 && verifyResult.stdout.includes(WINDOWS_STORE_ID);
281
+
282
+ if (!isNowInstalled) {
283
+ console.error('Installation completed but ChatGPT was not found.');
284
+ return;
285
+ }
286
+
287
+ console.log('ChatGPT installed successfully.');
288
+ console.log('Launch it from the Start Menu or press Alt+Space after first launch.');
289
+ }
290
+
291
+ /**
292
+ * Install ChatGPT on Git Bash (Windows).
293
+ *
294
+ * Git Bash runs within the Windows environment and can use winget.exe
295
+ * to install Windows applications. This function delegates to the
296
+ * Windows installation process.
297
+ *
298
+ * @returns {Promise<void>}
299
+ */
300
+ async function install_gitbash() {
301
+ // Git Bash can run Windows commands, so we use winget.exe directly
302
+
303
+ // Step 1: Check if winget.exe is accessible
304
+ const hasWinget = shell.commandExists('winget.exe');
305
+ if (!hasWinget) {
306
+ console.error('winget.exe is not available in PATH.');
307
+ console.error('Please install App Installer from the Microsoft Store.');
308
+ return;
309
+ }
310
+
311
+ // Step 2: Check if ChatGPT is already installed
312
+ const listResult = await shell.exec(`winget.exe list --id ${WINDOWS_STORE_ID}`);
313
+ const isAlreadyInstalled = listResult.code === 0 && listResult.stdout.includes(WINDOWS_STORE_ID);
314
+
315
+ if (isAlreadyInstalled) {
316
+ console.log('ChatGPT is already installed, skipping...');
317
+ return;
318
+ }
319
+
320
+ // Step 3: Install from Microsoft Store
321
+ console.log('Installing ChatGPT from Microsoft Store...');
322
+ const installResult = await shell.exec(
323
+ `winget.exe install --id ${WINDOWS_STORE_ID} --source msstore --silent --accept-package-agreements --accept-source-agreements`
324
+ );
325
+
326
+ if (installResult.code !== 0) {
327
+ console.error('Failed to install ChatGPT.');
328
+ console.error(installResult.stderr || installResult.stdout);
329
+ return;
330
+ }
331
+
332
+ // Step 4: Verify installation
333
+ const verifyResult = await shell.exec(`winget.exe list --id ${WINDOWS_STORE_ID}`);
334
+ const isNowInstalled = verifyResult.code === 0 && verifyResult.stdout.includes(WINDOWS_STORE_ID);
335
+
336
+ if (!isNowInstalled) {
337
+ console.error('Installation completed but ChatGPT was not found.');
338
+ return;
339
+ }
340
+
341
+ console.log('ChatGPT installed successfully.');
342
+ console.log('Launch it from the Start Menu or press Alt+Space after first launch.');
343
+ }
344
+
345
+ /**
346
+ * Check if ChatGPT is installed on the current platform.
347
+ *
348
+ * This function performs platform-specific checks to determine if ChatGPT
349
+ * is already installed:
350
+ * - macOS: Checks for ChatGPT.app in /Applications
351
+ * - Windows/Git Bash: Checks for Microsoft Store app via winget
352
+ * - Ubuntu/Debian: Checks for Snap package
353
+ *
354
+ * @returns {Promise<boolean>} True if ChatGPT is installed
355
+ */
356
+ async function isInstalled() {
357
+ const platform = os.detect();
358
+
359
+ // macOS: Check for ChatGPT.app
360
+ if (platform.type === 'macos') {
361
+ return macosApps.isAppInstalled('ChatGPT');
362
+ }
363
+
364
+ // Windows: Check via winget
365
+ if (platform.type === 'windows') {
366
+ const listResult = await shell.exec(`winget list --id ${WINDOWS_STORE_ID}`);
367
+ return listResult.code === 0 && listResult.stdout.includes(WINDOWS_STORE_ID);
368
+ }
369
+
370
+ // Git Bash: Check via winget.exe
371
+ if (platform.type === 'gitbash') {
372
+ const listResult = await shell.exec(`winget.exe list --id ${WINDOWS_STORE_ID}`);
373
+ return listResult.code === 0 && listResult.stdout.includes(WINDOWS_STORE_ID);
374
+ }
375
+
376
+ // Ubuntu/Debian: Check for Snap package
377
+ if (['ubuntu', 'debian'].includes(platform.type)) {
378
+ return await snap.isSnapInstalled(SNAP_PACKAGE_NAME);
379
+ }
380
+
381
+ // WSL: Check Windows host via winget.exe
382
+ if (platform.type === 'wsl') {
383
+ const hasWinget = shell.commandExists('winget.exe');
384
+ if (hasWinget) {
385
+ const listResult = await shell.exec(`winget.exe list --id ${WINDOWS_STORE_ID}`);
386
+ return listResult.code === 0 && listResult.stdout.includes(WINDOWS_STORE_ID);
387
+ }
388
+ return false;
389
+ }
390
+
391
+ // Other platforms: Not supported
392
+ return false;
393
+ }
394
+
395
+ /**
396
+ * Check if this installer is supported on the current platform.
397
+ *
398
+ * ChatGPT desktop app can be installed on:
399
+ * - macOS (official OpenAI app via Homebrew, Apple Silicon only)
400
+ * - Windows (official OpenAI app via winget from Microsoft Store)
401
+ * - Ubuntu/Debian (third-party Snap wrapper)
402
+ * - WSL (Windows host app or wslu web browser integration)
403
+ * - Git Bash (Windows app via winget)
404
+ *
405
+ * Note: Raspberry Pi and Amazon Linux are NOT supported.
406
+ *
407
+ * @returns {boolean} True if installation is supported on this platform
408
+ */
409
+ function isEligible() {
410
+ const platform = os.detect();
411
+ const supportedPlatforms = ['macos', 'ubuntu', 'debian', 'wsl', 'windows', 'gitbash'];
412
+ if (!supportedPlatforms.includes(platform.type)) {
413
+ return false;
414
+ }
415
+ if (REQUIRES_DESKTOP && !os.isDesktopAvailable()) {
416
+ return false;
417
+ }
418
+ return true;
419
+ }
420
+
421
+ /**
422
+ * Main installation entry point - detects platform and runs appropriate installer.
423
+ *
424
+ * This function automatically detects the current operating system and
425
+ * delegates to the appropriate platform-specific installation function.
12
426
  *
13
427
  * @returns {Promise<void>}
14
428
  */
15
429
  async function install() {
16
430
  const platform = os.detect();
17
431
 
18
- switch (platform.type) {
19
- case 'macos':
20
- // TODO: Implement macOS installation
21
- break;
22
- case 'debian':
23
- // TODO: Implement Debian/Ubuntu installation
24
- break;
25
- case 'rhel':
26
- // TODO: Implement RHEL/Amazon Linux installation
27
- break;
28
- case 'windows-wsl':
29
- // TODO: Implement WSL installation
30
- break;
31
- case 'windows':
32
- // TODO: Implement Windows installation
33
- break;
34
- default:
35
- console.error(`Unsupported platform: ${platform.type}`);
36
- process.exit(1);
37
- }
38
- }
39
-
40
- module.exports = { install };
432
+ // Map platform types to their installer functions
433
+ const installers = {
434
+ 'macos': install_macos,
435
+ 'ubuntu': install_ubuntu,
436
+ 'debian': install_ubuntu,
437
+ 'wsl': install_ubuntu_wsl,
438
+ 'raspbian': install_raspbian,
439
+ 'amazon_linux': install_amazon_linux,
440
+ 'rhel': install_amazon_linux,
441
+ 'fedora': install_amazon_linux,
442
+ 'windows': install_windows,
443
+ 'gitbash': install_gitbash,
444
+ };
445
+
446
+ const installer = installers[platform.type];
447
+
448
+ if (!installer) {
449
+ // Gracefully handle unsupported platforms without throwing an error
450
+ console.log(`ChatGPT desktop app is not available for ${platform.type}.`);
451
+ return;
452
+ }
453
+
454
+ await installer();
455
+ }
456
+
457
+ module.exports = {
458
+ REQUIRES_DESKTOP,
459
+ install,
460
+ isInstalled,
461
+ isEligible,
462
+ install_macos,
463
+ install_ubuntu,
464
+ install_ubuntu_wsl,
465
+ install_raspbian,
466
+ install_amazon_linux,
467
+ install_windows,
468
+ install_gitbash,
469
+ };
41
470
 
42
471
  if (require.main === module) {
43
- install();
472
+ install().catch(err => {
473
+ console.error(err.message);
474
+ process.exit(1);
475
+ });
44
476
  }