@fredlackey/devutils 0.0.17 → 0.0.19

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 (331) hide show
  1. package/README.md +32 -150
  2. package/package.json +5 -82
  3. package/bin/dev.js +0 -16
  4. package/files/README.md +0 -0
  5. package/files/claude/.claude/commands/setup-context.md +0 -3
  6. package/files/monorepos/_archive/README.md +0 -36
  7. package/files/monorepos/_legacy/README.md +0 -36
  8. package/files/monorepos/ai-docs/README.md +0 -33
  9. package/files/monorepos/apps/README.md +0 -24
  10. package/files/monorepos/docs/README.md +0 -40
  11. package/files/monorepos/packages/README.md +0 -25
  12. package/files/monorepos/research/README.md +0 -29
  13. package/files/monorepos/scripts/README.md +0 -24
  14. package/src/cli.js +0 -72
  15. package/src/commands/README.md +0 -41
  16. package/src/commands/configure.js +0 -199
  17. package/src/commands/identity.js +0 -1630
  18. package/src/commands/ignore.js +0 -247
  19. package/src/commands/install.js +0 -526
  20. package/src/commands/setup.js +0 -246
  21. package/src/commands/status.js +0 -223
  22. package/src/commands/update.js +0 -142
  23. package/src/commands/version.js +0 -100
  24. package/src/completion.js +0 -284
  25. package/src/constants.js +0 -45
  26. package/src/ignore/claude-code.txt +0 -10
  27. package/src/ignore/docker.txt +0 -18
  28. package/src/ignore/linux.txt +0 -23
  29. package/src/ignore/macos.txt +0 -36
  30. package/src/ignore/node.txt +0 -55
  31. package/src/ignore/terraform.txt +0 -37
  32. package/src/ignore/vscode.txt +0 -18
  33. package/src/ignore/windows.txt +0 -35
  34. package/src/index.js +0 -0
  35. package/src/installs/README.md +0 -399
  36. package/src/installs/adobe-creative-cloud.js +0 -546
  37. package/src/installs/adobe-creative-cloud.md +0 -605
  38. package/src/installs/appcleaner.js +0 -321
  39. package/src/installs/appcleaner.md +0 -699
  40. package/src/installs/apt-transport-https.js +0 -390
  41. package/src/installs/apt-transport-https.md +0 -678
  42. package/src/installs/atomicparsley.js +0 -642
  43. package/src/installs/atomicparsley.md +0 -795
  44. package/src/installs/aws-cli.js +0 -797
  45. package/src/installs/aws-cli.md +0 -727
  46. package/src/installs/balena-etcher.js +0 -710
  47. package/src/installs/balena-etcher.md +0 -761
  48. package/src/installs/bambu-studio.js +0 -1143
  49. package/src/installs/bambu-studio.md +0 -780
  50. package/src/installs/bash-completion.js +0 -575
  51. package/src/installs/bash-completion.md +0 -833
  52. package/src/installs/bash.js +0 -417
  53. package/src/installs/bash.md +0 -993
  54. package/src/installs/beyond-compare.js +0 -603
  55. package/src/installs/beyond-compare.md +0 -813
  56. package/src/installs/brave-browser.js +0 -968
  57. package/src/installs/brave-browser.md +0 -650
  58. package/src/installs/build-essential.js +0 -529
  59. package/src/installs/build-essential.md +0 -977
  60. package/src/installs/ca-certificates.js +0 -618
  61. package/src/installs/ca-certificates.md +0 -937
  62. package/src/installs/caffeine.js +0 -508
  63. package/src/installs/caffeine.md +0 -839
  64. package/src/installs/camtasia.js +0 -596
  65. package/src/installs/camtasia.md +0 -762
  66. package/src/installs/chatgpt.js +0 -476
  67. package/src/installs/chatgpt.md +0 -814
  68. package/src/installs/chocolatey.js +0 -456
  69. package/src/installs/chocolatey.md +0 -661
  70. package/src/installs/chrome-canary.js +0 -419
  71. package/src/installs/chrome-canary.md +0 -641
  72. package/src/installs/chromium.js +0 -667
  73. package/src/installs/chromium.md +0 -838
  74. package/src/installs/claude-code.js +0 -576
  75. package/src/installs/claude-code.md +0 -1173
  76. package/src/installs/cloudflare-warp.js +0 -900
  77. package/src/installs/cloudflare-warp.md +0 -1047
  78. package/src/installs/comet-browser.js +0 -588
  79. package/src/installs/comet-browser.md +0 -731
  80. package/src/installs/curl.js +0 -379
  81. package/src/installs/curl.md +0 -714
  82. package/src/installs/cursor.js +0 -579
  83. package/src/installs/cursor.md +0 -970
  84. package/src/installs/dbeaver.js +0 -924
  85. package/src/installs/dbeaver.md +0 -939
  86. package/src/installs/dbschema.js +0 -692
  87. package/src/installs/dbschema.md +0 -925
  88. package/src/installs/dependencies.md +0 -453
  89. package/src/installs/development-tools.js +0 -600
  90. package/src/installs/development-tools.md +0 -977
  91. package/src/installs/docker.js +0 -1029
  92. package/src/installs/docker.md +0 -1109
  93. package/src/installs/drawio.js +0 -1019
  94. package/src/installs/drawio.md +0 -795
  95. package/src/installs/elmedia-player.js +0 -347
  96. package/src/installs/elmedia-player.md +0 -556
  97. package/src/installs/ffmpeg.js +0 -889
  98. package/src/installs/ffmpeg.md +0 -852
  99. package/src/installs/file.js +0 -464
  100. package/src/installs/file.md +0 -987
  101. package/src/installs/gemini-cli.js +0 -811
  102. package/src/installs/gemini-cli.md +0 -1153
  103. package/src/installs/git.js +0 -400
  104. package/src/installs/git.md +0 -907
  105. package/src/installs/gitego.js +0 -949
  106. package/src/installs/gitego.md +0 -1172
  107. package/src/installs/go.js +0 -931
  108. package/src/installs/go.md +0 -958
  109. package/src/installs/google-antigravity.js +0 -913
  110. package/src/installs/google-antigravity.md +0 -1075
  111. package/src/installs/google-chrome.js +0 -833
  112. package/src/installs/google-chrome.md +0 -862
  113. package/src/installs/gpg.js +0 -480
  114. package/src/installs/gpg.md +0 -1056
  115. package/src/installs/homebrew.js +0 -1033
  116. package/src/installs/homebrew.md +0 -988
  117. package/src/installs/imageoptim.js +0 -968
  118. package/src/installs/imageoptim.md +0 -1119
  119. package/src/installs/installers.json +0 -4032
  120. package/src/installs/installers.json.tmp +0 -3953
  121. package/src/installs/jq.js +0 -400
  122. package/src/installs/jq.md +0 -809
  123. package/src/installs/keyboard-maestro.js +0 -719
  124. package/src/installs/keyboard-maestro.md +0 -825
  125. package/src/installs/kiro.js +0 -864
  126. package/src/installs/kiro.md +0 -1015
  127. package/src/installs/latex.js +0 -789
  128. package/src/installs/latex.md +0 -1095
  129. package/src/installs/lftp.js +0 -356
  130. package/src/installs/lftp.md +0 -907
  131. package/src/installs/lsb-release.js +0 -346
  132. package/src/installs/lsb-release.md +0 -814
  133. package/src/installs/messenger.js +0 -847
  134. package/src/installs/messenger.md +0 -900
  135. package/src/installs/microsoft-office.js +0 -568
  136. package/src/installs/microsoft-office.md +0 -760
  137. package/src/installs/microsoft-teams.js +0 -801
  138. package/src/installs/microsoft-teams.md +0 -886
  139. package/src/installs/moom.js +0 -326
  140. package/src/installs/moom.md +0 -570
  141. package/src/installs/node.js +0 -904
  142. package/src/installs/node.md +0 -1153
  143. package/src/installs/nordpass.js +0 -716
  144. package/src/installs/nordpass.md +0 -921
  145. package/src/installs/nordvpn.js +0 -892
  146. package/src/installs/nordvpn.md +0 -1052
  147. package/src/installs/nvm.js +0 -995
  148. package/src/installs/nvm.md +0 -1057
  149. package/src/installs/ohmyzsh.js +0 -529
  150. package/src/installs/ohmyzsh.md +0 -1094
  151. package/src/installs/openssh.js +0 -804
  152. package/src/installs/openssh.md +0 -1056
  153. package/src/installs/pandoc.js +0 -662
  154. package/src/installs/pandoc.md +0 -1036
  155. package/src/installs/parallels-desktop.js +0 -431
  156. package/src/installs/parallels-desktop.md +0 -446
  157. package/src/installs/pinentry.js +0 -510
  158. package/src/installs/pinentry.md +0 -1142
  159. package/src/installs/pngyu.js +0 -869
  160. package/src/installs/pngyu.md +0 -896
  161. package/src/installs/postman.js +0 -799
  162. package/src/installs/postman.md +0 -940
  163. package/src/installs/procps.js +0 -425
  164. package/src/installs/procps.md +0 -851
  165. package/src/installs/safari-tech-preview.js +0 -374
  166. package/src/installs/safari-tech-preview.md +0 -533
  167. package/src/installs/sfnt2woff.js +0 -658
  168. package/src/installs/sfnt2woff.md +0 -795
  169. package/src/installs/shellcheck.js +0 -481
  170. package/src/installs/shellcheck.md +0 -1005
  171. package/src/installs/slack.js +0 -741
  172. package/src/installs/slack.md +0 -865
  173. package/src/installs/snagit.js +0 -585
  174. package/src/installs/snagit.md +0 -844
  175. package/src/installs/software-properties-common.js +0 -372
  176. package/src/installs/software-properties-common.md +0 -805
  177. package/src/installs/spotify.js +0 -877
  178. package/src/installs/spotify.md +0 -901
  179. package/src/installs/studio-3t.js +0 -823
  180. package/src/installs/studio-3t.md +0 -918
  181. package/src/installs/sublime-text.js +0 -804
  182. package/src/installs/sublime-text.md +0 -914
  183. package/src/installs/superwhisper.js +0 -706
  184. package/src/installs/superwhisper.md +0 -630
  185. package/src/installs/tailscale.js +0 -745
  186. package/src/installs/tailscale.md +0 -1100
  187. package/src/installs/tar.js +0 -389
  188. package/src/installs/tar.md +0 -946
  189. package/src/installs/termius.js +0 -798
  190. package/src/installs/termius.md +0 -844
  191. package/src/installs/terraform.js +0 -779
  192. package/src/installs/terraform.md +0 -899
  193. package/src/installs/tfenv.js +0 -778
  194. package/src/installs/tfenv.md +0 -1091
  195. package/src/installs/tidal.js +0 -771
  196. package/src/installs/tidal.md +0 -864
  197. package/src/installs/tmux.js +0 -346
  198. package/src/installs/tmux.md +0 -1030
  199. package/src/installs/tree.js +0 -411
  200. package/src/installs/tree.md +0 -833
  201. package/src/installs/unzip.js +0 -460
  202. package/src/installs/unzip.md +0 -879
  203. package/src/installs/vim.js +0 -421
  204. package/src/installs/vim.md +0 -1040
  205. package/src/installs/vlc.js +0 -821
  206. package/src/installs/vlc.md +0 -927
  207. package/src/installs/vscode.js +0 -843
  208. package/src/installs/vscode.md +0 -1002
  209. package/src/installs/wget.js +0 -420
  210. package/src/installs/wget.md +0 -791
  211. package/src/installs/whatsapp.js +0 -729
  212. package/src/installs/whatsapp.md +0 -854
  213. package/src/installs/winpty.js +0 -352
  214. package/src/installs/winpty.md +0 -620
  215. package/src/installs/woff2.js +0 -553
  216. package/src/installs/woff2.md +0 -977
  217. package/src/installs/wsl.js +0 -572
  218. package/src/installs/wsl.md +0 -699
  219. package/src/installs/xcode-clt.js +0 -520
  220. package/src/installs/xcode-clt.md +0 -351
  221. package/src/installs/xcode.js +0 -560
  222. package/src/installs/xcode.md +0 -573
  223. package/src/installs/yarn.js +0 -824
  224. package/src/installs/yarn.md +0 -1074
  225. package/src/installs/yq.js +0 -654
  226. package/src/installs/yq.md +0 -944
  227. package/src/installs/yt-dlp.js +0 -701
  228. package/src/installs/yt-dlp.md +0 -946
  229. package/src/installs/yum-utils.js +0 -297
  230. package/src/installs/yum-utils.md +0 -648
  231. package/src/installs/zoom.js +0 -759
  232. package/src/installs/zoom.md +0 -884
  233. package/src/installs/zsh.js +0 -455
  234. package/src/installs/zsh.md +0 -1008
  235. package/src/scripts/README.md +0 -617
  236. package/src/scripts/STATUS.md +0 -208
  237. package/src/scripts/afk.js +0 -411
  238. package/src/scripts/backup-all.js +0 -746
  239. package/src/scripts/backup-source.js +0 -727
  240. package/src/scripts/brewd.js +0 -389
  241. package/src/scripts/brewi.js +0 -520
  242. package/src/scripts/brewr.js +0 -527
  243. package/src/scripts/brews.js +0 -477
  244. package/src/scripts/brewu.js +0 -504
  245. package/src/scripts/c.js +0 -201
  246. package/src/scripts/ccurl.js +0 -341
  247. package/src/scripts/certbot-crontab-init.js +0 -504
  248. package/src/scripts/certbot-init.js +0 -657
  249. package/src/scripts/ch.js +0 -355
  250. package/src/scripts/claude-danger.js +0 -268
  251. package/src/scripts/clean-dev.js +0 -435
  252. package/src/scripts/clear-dns-cache.js +0 -541
  253. package/src/scripts/clone.js +0 -435
  254. package/src/scripts/code-all.js +0 -437
  255. package/src/scripts/count-files.js +0 -211
  256. package/src/scripts/count-folders.js +0 -211
  257. package/src/scripts/count.js +0 -264
  258. package/src/scripts/d.js +0 -219
  259. package/src/scripts/datauri.js +0 -389
  260. package/src/scripts/delete-files.js +0 -380
  261. package/src/scripts/docker-clean.js +0 -426
  262. package/src/scripts/dp.js +0 -442
  263. package/src/scripts/e.js +0 -390
  264. package/src/scripts/empty-trash.js +0 -513
  265. package/src/scripts/evm.js +0 -444
  266. package/src/scripts/fetch-github-repos.js +0 -456
  267. package/src/scripts/get-channel.js +0 -345
  268. package/src/scripts/get-course.js +0 -399
  269. package/src/scripts/get-dependencies.js +0 -306
  270. package/src/scripts/get-folder.js +0 -799
  271. package/src/scripts/get-tunes.js +0 -426
  272. package/src/scripts/get-video.js +0 -367
  273. package/src/scripts/git-backup.js +0 -577
  274. package/src/scripts/git-clone.js +0 -493
  275. package/src/scripts/git-pup.js +0 -319
  276. package/src/scripts/git-push.js +0 -396
  277. package/src/scripts/h.js +0 -622
  278. package/src/scripts/hide-desktop-icons.js +0 -499
  279. package/src/scripts/hide-hidden-files.js +0 -538
  280. package/src/scripts/install-dependencies-from.js +0 -456
  281. package/src/scripts/ips.js +0 -663
  282. package/src/scripts/iso.js +0 -370
  283. package/src/scripts/killni.js +0 -577
  284. package/src/scripts/ll.js +0 -467
  285. package/src/scripts/local-ip.js +0 -325
  286. package/src/scripts/m.js +0 -524
  287. package/src/scripts/map.js +0 -309
  288. package/src/scripts/mkd.js +0 -351
  289. package/src/scripts/ncu-update-all.js +0 -457
  290. package/src/scripts/nginx-init.js +0 -718
  291. package/src/scripts/npmi.js +0 -382
  292. package/src/scripts/o.js +0 -511
  293. package/src/scripts/org-by-date.js +0 -338
  294. package/src/scripts/p.js +0 -224
  295. package/src/scripts/packages.js +0 -330
  296. package/src/scripts/path.js +0 -225
  297. package/src/scripts/ports.js +0 -597
  298. package/src/scripts/q.js +0 -305
  299. package/src/scripts/refresh-files.js +0 -394
  300. package/src/scripts/remove-smaller-files.js +0 -516
  301. package/src/scripts/rename-files-with-date.js +0 -533
  302. package/src/scripts/resize-image.js +0 -539
  303. package/src/scripts/rm-safe.js +0 -669
  304. package/src/scripts/s.js +0 -540
  305. package/src/scripts/set-git-public.js +0 -365
  306. package/src/scripts/show-desktop-icons.js +0 -475
  307. package/src/scripts/show-hidden-files.js +0 -472
  308. package/src/scripts/tpa.js +0 -280
  309. package/src/scripts/tpo.js +0 -280
  310. package/src/scripts/u.js +0 -505
  311. package/src/scripts/vpush.js +0 -437
  312. package/src/scripts/y.js +0 -283
  313. package/src/utils/README.md +0 -95
  314. package/src/utils/common/apps.js +0 -143
  315. package/src/utils/common/display.js +0 -157
  316. package/src/utils/common/network.js +0 -185
  317. package/src/utils/common/os.js +0 -294
  318. package/src/utils/common/package-manager.js +0 -301
  319. package/src/utils/common/privileges.js +0 -138
  320. package/src/utils/common/shell.js +0 -216
  321. package/src/utils/macos/apps.js +0 -228
  322. package/src/utils/macos/brew.js +0 -315
  323. package/src/utils/ubuntu/apt.js +0 -307
  324. package/src/utils/ubuntu/desktop.js +0 -292
  325. package/src/utils/ubuntu/snap.js +0 -344
  326. package/src/utils/ubuntu/systemd.js +0 -286
  327. package/src/utils/windows/choco.js +0 -465
  328. package/src/utils/windows/env.js +0 -246
  329. package/src/utils/windows/registry.js +0 -269
  330. package/src/utils/windows/shell.js +0 -240
  331. package/src/utils/windows/winget.js +0 -489
@@ -1,900 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * @fileoverview Install Cloudflare WARP VPN client across supported platforms.
5
- * @module installs/cloudflare-warp
6
- *
7
- * Cloudflare WARP is a VPN client that encrypts all traffic leaving your device
8
- * and routes it through Cloudflare's global network. Built on the WireGuard protocol,
9
- * WARP provides fast, secure connections while protecting your privacy from ISP
10
- * snooping and network-level tracking.
11
- *
12
- * WARP operates in several modes:
13
- * - WARP mode (default): Encrypts all traffic (including DNS) and routes it through Cloudflare
14
- * - 1.1.1.1 mode: Only encrypts DNS traffic to Cloudflare's 1.1.1.1 resolver
15
- * - WARP+ mode: Premium tier with optimized routing through Cloudflare's Argo network
16
- *
17
- * This installer provides:
18
- * - Cloudflare WARP GUI application via Homebrew cask for macOS
19
- * - Cloudflare WARP daemon via official APT repository for Ubuntu/Debian
20
- * - Cloudflare WARP via DNF/YUM for Amazon Linux/RHEL
21
- * - Cloudflare WARP GUI via Chocolatey for Windows
22
- * - Windows WARP installation from Git Bash via PowerShell
23
- *
24
- * IMPORTANT PLATFORM NOTES:
25
- * - Raspberry Pi OS: WARP is NOT officially supported on ARM Linux architecture
26
- * - WSL: Recommended to install WARP on Windows host; WSL traffic is automatically protected
27
- * - After installation, WARP must be manually connected using the GUI or warp-cli
28
- */
29
-
30
- const os = require('../utils/common/os');
31
- const shell = require('../utils/common/shell');
32
- const brew = require('../utils/macos/brew');
33
- const choco = require('../utils/windows/choco');
34
-
35
- /**
36
- * The Homebrew cask name for Cloudflare WARP on macOS.
37
- * @constant {string}
38
- */
39
- const HOMEBREW_CASK_NAME = 'cloudflare-warp';
40
-
41
- /**
42
- * The Chocolatey package name for Cloudflare WARP on Windows.
43
- * Note: The package is named 'warp' not 'cloudflare-warp' on Chocolatey.
44
- * @constant {string}
45
- */
46
- const CHOCO_PACKAGE_NAME = 'warp';
47
-
48
- /**
49
- * The command used to verify WARP CLI installation on Linux systems.
50
- * @constant {string}
51
- */
52
- const WARP_CLI_COMMAND = 'warp-cli';
53
-
54
- /**
55
- * The macOS application path where WARP is installed.
56
- * Used for verification and to locate the bundled warp-cli.
57
- * @constant {string}
58
- */
59
- const MACOS_APP_PATH = '/Applications/Cloudflare WARP.app';
60
-
61
- /**
62
- * The path to warp-cli bundled inside the macOS application.
63
- * @constant {string}
64
- */
65
- const MACOS_WARP_CLI_PATH = '/Applications/Cloudflare WARP.app/Contents/Resources/warp-cli';
66
-
67
- /**
68
- * Check if the WARP CLI command is available in the system PATH.
69
- * This performs a quick check that works across Linux platforms.
70
- *
71
- * Note: On macOS, warp-cli is bundled inside the application and not in PATH.
72
- * Use isWarpAppInstalledMacOS() for macOS verification instead.
73
- *
74
- * @returns {boolean} True if the warp-cli command is available, false otherwise
75
- */
76
- function isWarpCliCommandAvailable() {
77
- return shell.commandExists(WARP_CLI_COMMAND);
78
- }
79
-
80
- /**
81
- * Check if Cloudflare WARP application is installed on macOS.
82
- * Checks for the application bundle in /Applications.
83
- *
84
- * @returns {boolean} True if WARP app is installed on macOS, false otherwise
85
- */
86
- function isWarpAppInstalledMacOS() {
87
- const fs = require('fs');
88
- try {
89
- return fs.existsSync(MACOS_APP_PATH);
90
- } catch {
91
- return false;
92
- }
93
- }
94
-
95
- /**
96
- * Get the installed version of WARP CLI on Linux systems.
97
- *
98
- * Executes 'warp-cli --version' to verify WARP is properly installed
99
- * and retrieve the version number.
100
- *
101
- * @returns {Promise<string|null>} WARP version string, or null if not installed
102
- */
103
- async function getWarpCliVersion() {
104
- if (!isWarpCliCommandAvailable()) {
105
- return null;
106
- }
107
-
108
- const result = await shell.exec('warp-cli --version');
109
- if (result.code === 0 && result.stdout) {
110
- // Output format: "warp-cli 2024.6.555.0 (a1b2c3d4)"
111
- // Extract just the version number
112
- const versionMatch = result.stdout.match(/warp-cli\s+([\d.]+)/);
113
- return versionMatch ? versionMatch[1] : result.stdout.trim();
114
- }
115
- return null;
116
- }
117
-
118
- /**
119
- * Get the installed version of WARP on macOS using the bundled warp-cli.
120
- *
121
- * @returns {Promise<string|null>} WARP version string, or null if not installed
122
- */
123
- async function getWarpVersionMacOS() {
124
- if (!isWarpAppInstalledMacOS()) {
125
- return null;
126
- }
127
-
128
- // Use the bundled warp-cli inside the application
129
- const result = await shell.exec(`"${MACOS_WARP_CLI_PATH}" --version 2>/dev/null`);
130
- if (result.code === 0 && result.stdout) {
131
- const versionMatch = result.stdout.match(/warp-cli\s+([\d.]+)/);
132
- return versionMatch ? versionMatch[1] : result.stdout.trim();
133
- }
134
- return null;
135
- }
136
-
137
- /**
138
- * Install Cloudflare WARP GUI application on macOS using Homebrew.
139
- *
140
- * This installs the full Cloudflare WARP desktop application, which includes
141
- * the GUI (menu bar icon), background daemon, and bundled warp-cli.
142
- *
143
- * Prerequisites:
144
- * - macOS 10.15 (Catalina) or later
145
- * - Homebrew package manager installed
146
- * - Apple Silicon (M1/M2/M3/M4) or Intel processor
147
- *
148
- * After installation:
149
- * 1. Launch Cloudflare WARP from Applications or menu bar
150
- * 2. Grant VPN configuration permission when prompted
151
- * 3. Enable WARP by clicking the toggle in the menu bar app
152
- *
153
- * NOTE: On first launch, WARP will request permission to add VPN configurations.
154
- * The warp-cli is bundled inside the application at:
155
- * /Applications/Cloudflare WARP.app/Contents/Resources/warp-cli
156
- *
157
- * @returns {Promise<void>}
158
- */
159
- async function install_macos() {
160
- console.log('Checking if Cloudflare WARP is already installed...');
161
-
162
- // Check if WARP application is already installed
163
- if (isWarpAppInstalledMacOS()) {
164
- const version = await getWarpVersionMacOS();
165
- if (version) {
166
- console.log(`Cloudflare WARP ${version} is already installed, skipping installation.`);
167
- } else {
168
- console.log('Cloudflare WARP is already installed, skipping installation.');
169
- }
170
- console.log('');
171
- console.log('To launch Cloudflare WARP:');
172
- console.log(' open -a "Cloudflare WARP"');
173
- return;
174
- }
175
-
176
- // Also check if the cask is installed (WARP may be installed but app not in expected location)
177
- const caskInstalled = await brew.isCaskInstalled(HOMEBREW_CASK_NAME);
178
- if (caskInstalled) {
179
- console.log('Cloudflare WARP is already installed via Homebrew, skipping installation.');
180
- console.log('');
181
- console.log('To launch Cloudflare WARP:');
182
- console.log(' open -a "Cloudflare WARP"');
183
- return;
184
- }
185
-
186
- // Verify Homebrew is available
187
- if (!brew.isInstalled()) {
188
- console.log('Homebrew is not installed. Please install Homebrew first.');
189
- console.log('Run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
190
- return;
191
- }
192
-
193
- console.log('Installing Cloudflare WARP via Homebrew...');
194
-
195
- // Install WARP cask with --quiet to suppress non-essential output
196
- const result = await shell.exec('brew install --quiet --cask cloudflare-warp');
197
-
198
- if (result.code !== 0) {
199
- console.log('Failed to install Cloudflare WARP via Homebrew.');
200
- console.log(result.stderr || result.stdout);
201
- console.log('');
202
- console.log('Troubleshooting:');
203
- console.log(' 1. Run "brew update" and retry');
204
- console.log(' 2. Try manual installation: brew install --cask cloudflare-warp');
205
- console.log(' 3. Or download directly from: https://one.one.one.one/');
206
- return;
207
- }
208
-
209
- // Verify installation succeeded
210
- if (isWarpAppInstalledMacOS()) {
211
- const version = await getWarpVersionMacOS();
212
- if (version) {
213
- console.log(`Cloudflare WARP ${version} installed successfully.`);
214
- } else {
215
- console.log('Cloudflare WARP installed successfully.');
216
- }
217
- } else {
218
- console.log('Cloudflare WARP installed successfully.');
219
- }
220
-
221
- console.log('');
222
- console.log('To complete setup:');
223
- console.log(' 1. Launch Cloudflare WARP:');
224
- console.log(' open -a "Cloudflare WARP"');
225
- console.log('');
226
- console.log(' 2. Click "Allow" when prompted to add VPN configurations.');
227
- console.log('');
228
- console.log(' 3. Look for the WARP icon in the menu bar and click to enable.');
229
- console.log('');
230
- console.log('To verify WARP is working:');
231
- console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
232
- console.log(' Expected output: warp=on');
233
- console.log('');
234
- console.log('NOTE: The warp-cli is bundled inside the application:');
235
- console.log(' /Applications/Cloudflare\\ WARP.app/Contents/Resources/warp-cli --help');
236
- }
237
-
238
- /**
239
- * Install Cloudflare WARP on Ubuntu/Debian using the official APT repository.
240
- *
241
- * This function:
242
- * 1. Installs prerequisites (curl, gpg, lsb-release)
243
- * 2. Downloads and installs Cloudflare's GPG key
244
- * 3. Adds the Cloudflare APT repository
245
- * 4. Installs the cloudflare-warp package
246
- *
247
- * Prerequisites:
248
- * - Ubuntu 20.04 (Focal), 22.04 (Jammy), or 24.04 (Noble)
249
- * - Debian 10 (Buster) through 13 (Trixie)
250
- * - 64-bit (x86_64/amd64) architecture only (ARM is NOT supported)
251
- * - sudo privileges
252
- *
253
- * After installation:
254
- * 1. Register with Cloudflare: warp-cli registration new
255
- * 2. Connect to WARP: warp-cli connect
256
- *
257
- * @returns {Promise<void>}
258
- */
259
- async function install_ubuntu() {
260
- console.log('Checking if Cloudflare WARP is already installed...');
261
-
262
- // Check if WARP is already installed
263
- const existingVersion = await getWarpCliVersion();
264
- if (existingVersion) {
265
- console.log(`Cloudflare WARP ${existingVersion} is already installed, skipping installation.`);
266
- return;
267
- }
268
-
269
- // Verify architecture - WARP only supports x86_64 on Linux
270
- const archResult = await shell.exec('uname -m');
271
- const arch = archResult.stdout.trim();
272
- if (arch !== 'x86_64') {
273
- console.log(`Cloudflare WARP is not available for ${arch} architecture.`);
274
- console.log('WARP only supports 64-bit (x86_64/amd64) on Linux.');
275
- return;
276
- }
277
-
278
- // Ensure prerequisites are installed
279
- console.log('Installing prerequisites (curl, gpg, lsb-release)...');
280
- const prereqResult = await shell.exec(
281
- 'sudo DEBIAN_FRONTEND=noninteractive apt-get update -y && ' +
282
- 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gpg lsb-release'
283
- );
284
- if (prereqResult.code !== 0) {
285
- console.log('Failed to install prerequisites.');
286
- console.log(prereqResult.stderr);
287
- return;
288
- }
289
-
290
- // Step 1: Add the Cloudflare GPG key
291
- console.log('Adding Cloudflare GPG key...');
292
- const gpgResult = await shell.exec(
293
- 'curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | ' +
294
- 'sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg'
295
- );
296
- if (gpgResult.code !== 0) {
297
- console.log('Failed to add Cloudflare GPG key.');
298
- console.log(gpgResult.stderr);
299
- console.log('');
300
- console.log('Troubleshooting:');
301
- console.log(' 1. Ensure you have internet connectivity');
302
- console.log(' 2. Try running manually:');
303
- console.log(' curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg');
304
- return;
305
- }
306
-
307
- // Step 2: Add the Cloudflare repository
308
- console.log('Adding Cloudflare APT repository...');
309
- const repoResult = await shell.exec(
310
- 'echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] ' +
311
- 'https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | ' +
312
- 'sudo tee /etc/apt/sources.list.d/cloudflare-client.list'
313
- );
314
- if (repoResult.code !== 0) {
315
- console.log('Failed to add Cloudflare repository.');
316
- console.log(repoResult.stderr);
317
- return;
318
- }
319
-
320
- // Step 3: Update package lists and install WARP
321
- console.log('Updating package lists...');
322
- const updateResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y');
323
- if (updateResult.code !== 0) {
324
- console.log('Failed to update package lists.');
325
- console.log(updateResult.stderr);
326
- return;
327
- }
328
-
329
- console.log('Installing cloudflare-warp package...');
330
- const installResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cloudflare-warp');
331
- if (installResult.code !== 0) {
332
- console.log('Failed to install Cloudflare WARP.');
333
- console.log(installResult.stderr);
334
- console.log('');
335
- console.log('Troubleshooting:');
336
- console.log(' 1. Verify the repository was added correctly:');
337
- console.log(' cat /etc/apt/sources.list.d/cloudflare-client.list');
338
- console.log(' 2. Check if your distribution is supported');
339
- console.log(' 3. Try running: sudo apt-get update && sudo apt-get install cloudflare-warp');
340
- return;
341
- }
342
-
343
- // Verify installation succeeded
344
- const version = await getWarpCliVersion();
345
- if (version) {
346
- console.log(`Cloudflare WARP ${version} installed successfully.`);
347
- } else {
348
- console.log('Cloudflare WARP installed successfully.');
349
- }
350
-
351
- console.log('');
352
- console.log('To complete setup:');
353
- console.log(' 1. Register with Cloudflare:');
354
- console.log(' warp-cli registration new');
355
- console.log('');
356
- console.log(' 2. Connect to WARP:');
357
- console.log(' warp-cli connect');
358
- console.log('');
359
- console.log('To verify WARP is working:');
360
- console.log(' warp-cli status');
361
- console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
362
- console.log(' Expected output: warp=on');
363
- console.log('');
364
- console.log('If warp-cli is not found, start the service:');
365
- console.log(' sudo systemctl enable --now warp-svc');
366
- }
367
-
368
- /**
369
- * Handle Raspberry Pi OS installation attempt.
370
- *
371
- * Cloudflare WARP client is NOT officially supported on ARM Linux architectures.
372
- * This includes all Raspberry Pi devices running Raspberry Pi OS (both 32-bit
373
- * and 64-bit).
374
- *
375
- * The documentation mentions an unofficial workaround using wgcf with WireGuard,
376
- * but per project guidelines, we do not suggest alternatives.
377
- *
378
- * @returns {Promise<void>}
379
- */
380
- async function install_raspbian() {
381
- console.log('Cloudflare WARP is not available for Raspberry Pi OS.');
382
- return;
383
- }
384
-
385
- /**
386
- * Install Cloudflare WARP on Amazon Linux/RHEL using DNF or YUM.
387
- *
388
- * This function:
389
- * 1. Detects the package manager (DNF for AL2023/RHEL8+, YUM for AL2/RHEL7)
390
- * 2. Adds the Cloudflare repository
391
- * 3. Installs the cloudflare-warp package
392
- * 4. Enables and starts the warp-svc service
393
- *
394
- * Prerequisites:
395
- * - Amazon Linux 2023 (AL2023), RHEL 8, CentOS 8, or compatible distributions
396
- * - 64-bit (x86_64) architecture only
397
- * - sudo privileges
398
- *
399
- * After installation:
400
- * 1. Register with Cloudflare: warp-cli registration new
401
- * 2. Connect to WARP: warp-cli connect
402
- *
403
- * @returns {Promise<void>}
404
- */
405
- async function install_amazon_linux() {
406
- console.log('Checking if Cloudflare WARP is already installed...');
407
-
408
- // Check if WARP is already installed
409
- const existingVersion = await getWarpCliVersion();
410
- if (existingVersion) {
411
- console.log(`Cloudflare WARP ${existingVersion} is already installed, skipping installation.`);
412
- return;
413
- }
414
-
415
- // Detect package manager (dnf for AL2023/RHEL8+, yum for AL2/RHEL7)
416
- const hasDnf = shell.commandExists('dnf');
417
- const hasYum = shell.commandExists('yum');
418
- const packageManager = hasDnf ? 'dnf' : (hasYum ? 'yum' : null);
419
-
420
- if (!packageManager) {
421
- console.log('Neither dnf nor yum package manager found.');
422
- console.log('This installer supports Amazon Linux 2023 (dnf) and Amazon Linux 2 (yum),');
423
- console.log('as well as RHEL/CentOS 7, 8, and 9.');
424
- return;
425
- }
426
-
427
- console.log(`Detected package manager: ${packageManager}`);
428
-
429
- // Ensure curl is installed
430
- if (!shell.commandExists('curl')) {
431
- console.log('Installing curl...');
432
- const curlResult = await shell.exec(`sudo ${packageManager} install -y curl`);
433
- if (curlResult.code !== 0) {
434
- console.log('Failed to install curl. Please install curl manually and retry.');
435
- return;
436
- }
437
- }
438
-
439
- // Step 1: Add the Cloudflare repository
440
- console.log('Adding Cloudflare repository...');
441
- const repoResult = await shell.exec(
442
- 'curl -fsSl https://pkg.cloudflareclient.com/cloudflare-warp-ascii.repo | ' +
443
- 'sudo tee /etc/yum.repos.d/cloudflare-warp.repo'
444
- );
445
- if (repoResult.code !== 0) {
446
- console.log('Failed to add Cloudflare repository.');
447
- console.log(repoResult.stderr);
448
- return;
449
- }
450
-
451
- // Step 2: Update package cache and install WARP
452
- console.log('Updating package cache...');
453
- const updateResult = await shell.exec(`sudo ${packageManager} update -y`);
454
- if (updateResult.code !== 0) {
455
- console.log('Warning: Package cache update had issues, continuing with installation...');
456
- }
457
-
458
- console.log('Installing cloudflare-warp package...');
459
- const installResult = await shell.exec(`sudo ${packageManager} install -y cloudflare-warp`);
460
- if (installResult.code !== 0) {
461
- console.log('Failed to install Cloudflare WARP.');
462
- console.log(installResult.stderr);
463
- console.log('');
464
- console.log('Troubleshooting:');
465
- console.log(' 1. Verify the repository was added:');
466
- console.log(' cat /etc/yum.repos.d/cloudflare-warp.repo');
467
- console.log(' 2. Try importing the GPG key manually:');
468
- console.log(' sudo rpm --import https://pkg.cloudflareclient.com/pubkey.gpg');
469
- console.log(` 3. Retry: sudo ${packageManager} install cloudflare-warp`);
470
- return;
471
- }
472
-
473
- // Step 3: Enable and start the WARP service
474
- console.log('Enabling and starting warp-svc service...');
475
- const serviceResult = await shell.exec('sudo systemctl enable --now warp-svc');
476
- if (serviceResult.code !== 0) {
477
- console.log('Warning: Could not enable warp-svc service. You may need to start it manually.');
478
- }
479
-
480
- // Verify installation succeeded
481
- const version = await getWarpCliVersion();
482
- if (version) {
483
- console.log(`Cloudflare WARP ${version} installed successfully.`);
484
- } else {
485
- console.log('Cloudflare WARP installed successfully.');
486
- }
487
-
488
- console.log('');
489
- console.log('To complete setup:');
490
- console.log(' 1. Register with Cloudflare:');
491
- console.log(' warp-cli registration new');
492
- console.log('');
493
- console.log(' 2. Connect to WARP:');
494
- console.log(' warp-cli connect');
495
- console.log('');
496
- console.log('To verify WARP is working:');
497
- console.log(' warp-cli status');
498
- console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
499
- console.log(' Expected output: warp=on');
500
- }
501
-
502
- /**
503
- * Install Cloudflare WARP on Windows using Chocolatey.
504
- *
505
- * This installs the Cloudflare WARP GUI application for Windows, which includes
506
- * the graphical interface (system tray icon), background service, and CLI tools.
507
- *
508
- * Prerequisites:
509
- * - Windows 10 version 1909 or later (64-bit)
510
- * - Administrator PowerShell or Command Prompt
511
- * - Chocolatey package manager installed
512
- *
513
- * After installation, Cloudflare WARP will be available in the Start Menu
514
- * and system tray. Launch it to complete the initial setup.
515
- *
516
- * @returns {Promise<void>}
517
- */
518
- async function install_windows() {
519
- console.log('Checking if Cloudflare WARP is already installed...');
520
-
521
- // Check if WARP package is installed via Chocolatey
522
- const packageInstalled = await choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
523
- if (packageInstalled) {
524
- console.log('Cloudflare WARP is already installed via Chocolatey, skipping installation.');
525
- console.log('');
526
- console.log('If WARP is not running, launch it from the Start Menu:');
527
- console.log(' Search for "Cloudflare WARP" and click to launch.');
528
- return;
529
- }
530
-
531
- // Verify Chocolatey is available
532
- if (!choco.isInstalled()) {
533
- console.log('Chocolatey is not installed. Please install Chocolatey first.');
534
- console.log('');
535
- console.log('Run the following in an Administrator PowerShell:');
536
- console.log(" Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))");
537
- return;
538
- }
539
-
540
- console.log('Installing Cloudflare WARP via Chocolatey...');
541
-
542
- // Install WARP (package name is 'warp' on Chocolatey)
543
- const result = await choco.install(CHOCO_PACKAGE_NAME);
544
-
545
- if (!result.success) {
546
- console.log('Failed to install Cloudflare WARP via Chocolatey.');
547
- console.log(result.output);
548
- console.log('');
549
- console.log('Troubleshooting:');
550
- console.log(' 1. Ensure you are running as Administrator');
551
- console.log(' 2. Try manual installation: choco install warp -y');
552
- console.log(' 3. Or download from: https://one.one.one.one/');
553
- return;
554
- }
555
-
556
- console.log('Cloudflare WARP installed successfully.');
557
- console.log('');
558
- console.log('To complete setup:');
559
- console.log(' 1. Launch Cloudflare WARP from the Start Menu');
560
- console.log(' 2. Click the WARP icon in the system tray');
561
- console.log(' 3. Toggle the switch to enable WARP');
562
- console.log('');
563
- console.log('To verify WARP is working:');
564
- console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | findstr warp');
565
- console.log(' Expected output: warp=on');
566
- }
567
-
568
- /**
569
- * Install Cloudflare WARP on Ubuntu running in WSL (Windows Subsystem for Linux).
570
- *
571
- * IMPORTANT: The recommended approach is to install WARP on the Windows host,
572
- * NOT inside WSL. When WARP runs on Windows, WSL 2 traffic is automatically
573
- * protected. Installing WARP inside WSL has known issues because Windows WARP
574
- * uses WinDivert which operates in Windows user-land, and WSL 2's networking
575
- * bypasses it.
576
- *
577
- * This function installs WARP directly within WSL for users who specifically
578
- * need it running inside the WSL environment.
579
- *
580
- * Prerequisites:
581
- * - Windows 10 version 2004 or later, or Windows 11
582
- * - WSL 2 installed with Ubuntu distribution
583
- * - WARP installed on the Windows host (recommended) OR
584
- * - Following this installation for WARP inside WSL (not recommended)
585
- *
586
- * NOTE: WSL does not use systemd by default, so the warp-svc daemon must be
587
- * started manually with 'sudo warp-svc &' before running 'warp-cli' commands.
588
- *
589
- * @returns {Promise<void>}
590
- */
591
- async function install_ubuntu_wsl() {
592
- console.log('Detected Ubuntu running in WSL (Windows Subsystem for Linux).');
593
- console.log('');
594
- console.log('RECOMMENDATION: Install Cloudflare WARP on the Windows host instead.');
595
- console.log('The Windows WARP client provides network protection that is visible');
596
- console.log('to WSL 2 automatically. See: choco install warp -y (in Windows)');
597
- console.log('');
598
-
599
- // Check if WARP is already installed
600
- const existingVersion = await getWarpCliVersion();
601
- if (existingVersion) {
602
- console.log(`Cloudflare WARP ${existingVersion} is already installed, skipping installation.`);
603
- return;
604
- }
605
-
606
- // Verify architecture - WARP only supports x86_64 on Linux
607
- const archResult = await shell.exec('uname -m');
608
- const arch = archResult.stdout.trim();
609
- if (arch !== 'x86_64') {
610
- console.log(`Cloudflare WARP is not available for ${arch} architecture.`);
611
- console.log('WARP only supports 64-bit (x86_64/amd64) on Linux.');
612
- return;
613
- }
614
-
615
- // Install WARP using same process as Ubuntu
616
- console.log('Proceeding with Cloudflare WARP installation inside WSL...');
617
- console.log('');
618
-
619
- // Ensure prerequisites are installed
620
- console.log('Installing prerequisites (curl, gpg, lsb-release)...');
621
- const prereqResult = await shell.exec(
622
- 'sudo DEBIAN_FRONTEND=noninteractive apt-get update -y && ' +
623
- 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gpg lsb-release'
624
- );
625
- if (prereqResult.code !== 0) {
626
- console.log('Failed to install prerequisites.');
627
- console.log(prereqResult.stderr);
628
- return;
629
- }
630
-
631
- // Add the Cloudflare GPG key
632
- console.log('Adding Cloudflare GPG key...');
633
- const gpgResult = await shell.exec(
634
- 'curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | ' +
635
- 'sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg'
636
- );
637
- if (gpgResult.code !== 0) {
638
- console.log('Failed to add Cloudflare GPG key.');
639
- console.log(gpgResult.stderr);
640
- return;
641
- }
642
-
643
- // Add the Cloudflare repository
644
- console.log('Adding Cloudflare APT repository...');
645
- const repoResult = await shell.exec(
646
- 'echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] ' +
647
- 'https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | ' +
648
- 'sudo tee /etc/apt/sources.list.d/cloudflare-client.list'
649
- );
650
- if (repoResult.code !== 0) {
651
- console.log('Failed to add Cloudflare repository.');
652
- console.log(repoResult.stderr);
653
- return;
654
- }
655
-
656
- // Update package lists and install WARP
657
- console.log('Updating package lists...');
658
- const updateResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y');
659
- if (updateResult.code !== 0) {
660
- console.log('Failed to update package lists.');
661
- console.log(updateResult.stderr);
662
- return;
663
- }
664
-
665
- console.log('Installing cloudflare-warp package...');
666
- const installResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cloudflare-warp');
667
- if (installResult.code !== 0) {
668
- console.log('Failed to install Cloudflare WARP.');
669
- console.log(installResult.stderr);
670
- return;
671
- }
672
-
673
- // Verify installation succeeded
674
- const version = await getWarpCliVersion();
675
- if (version) {
676
- console.log(`Cloudflare WARP ${version} installed successfully.`);
677
- } else {
678
- console.log('Cloudflare WARP installed successfully.');
679
- }
680
-
681
- console.log('');
682
- console.log('IMPORTANT for WSL users:');
683
- console.log('');
684
- console.log('1. WSL does not use systemd by default. Start the daemon manually:');
685
- console.log(' sudo warp-svc &');
686
- console.log(' sleep 3');
687
- console.log('');
688
- console.log('2. Register with Cloudflare:');
689
- console.log(' warp-cli registration new');
690
- console.log('');
691
- console.log('3. Connect to WARP:');
692
- console.log(' warp-cli connect');
693
- console.log('');
694
- console.log('4. To auto-start warp-svc when WSL launches, add to ~/.bashrc:');
695
- console.log(' if ! pgrep -x warp-svc > /dev/null; then');
696
- console.log(' sudo warp-svc > /dev/null 2>&1 &');
697
- console.log(' sleep 2');
698
- console.log(' fi');
699
- console.log('');
700
- const currentUser = process.env.USER || process.env.USERNAME || 'youruser';
701
- console.log('5. For passwordless sudo (optional):');
702
- console.log(` echo "${currentUser} ALL=(ALL) NOPASSWD: /usr/bin/warp-svc" | sudo tee /etc/sudoers.d/warp-svc`);
703
- console.log(' sudo chmod 0440 /etc/sudoers.d/warp-svc');
704
- }
705
-
706
- /**
707
- * Install Cloudflare WARP from Git Bash on Windows.
708
- *
709
- * Git Bash runs within Windows, so this function installs Cloudflare WARP
710
- * on the Windows host using Chocolatey via PowerShell interop.
711
- * Once installed, WARP protects all network traffic from the machine,
712
- * including Git Bash, because it runs as a system-wide VPN.
713
- *
714
- * Prerequisites:
715
- * - Windows 10 or Windows 11 (64-bit)
716
- * - Git Bash installed (comes with Git for Windows)
717
- * - Chocolatey package manager installed on Windows
718
- *
719
- * @returns {Promise<void>}
720
- */
721
- async function install_gitbash() {
722
- console.log('Detected Git Bash on Windows.');
723
- console.log('Installing Cloudflare WARP on the Windows host...');
724
- console.log('');
725
-
726
- // Check if Chocolatey is available via Windows path
727
- const chocoPath = '/c/ProgramData/chocolatey/bin/choco.exe';
728
- const chocoResult = await shell.exec(`"${chocoPath}" --version 2>/dev/null`);
729
-
730
- if (chocoResult.code !== 0) {
731
- console.log('Chocolatey is not installed on Windows.');
732
- console.log('Please install Chocolatey first, then run this installer again.');
733
- console.log('');
734
- console.log('Or download Cloudflare WARP directly from:');
735
- console.log(' https://one.one.one.one/');
736
- return;
737
- }
738
-
739
- // Check if WARP is already installed
740
- const listResult = await shell.exec(`"${chocoPath}" list --local-only --exact warp 2>/dev/null`);
741
- if (listResult.code === 0 && listResult.stdout.toLowerCase().includes('warp')) {
742
- console.log('Cloudflare WARP is already installed, skipping installation.');
743
- console.log('');
744
- console.log('If WARP is not running, launch it from the Windows Start Menu.');
745
- return;
746
- }
747
-
748
- console.log('Installing Cloudflare WARP via Windows Chocolatey...');
749
-
750
- const installResult = await shell.exec(`"${chocoPath}" install warp -y`);
751
-
752
- if (installResult.code !== 0) {
753
- console.log('Failed to install Cloudflare WARP.');
754
- console.log(installResult.stdout || installResult.stderr);
755
- console.log('');
756
- console.log('Troubleshooting:');
757
- console.log(' 1. Run Git Bash as Administrator and retry');
758
- console.log(' 2. Try installing directly from PowerShell:');
759
- console.log(' choco install warp -y');
760
- console.log(' 3. Or download from: https://one.one.one.one/');
761
- return;
762
- }
763
-
764
- console.log('Cloudflare WARP installed successfully.');
765
- console.log('');
766
- console.log('To complete setup:');
767
- console.log(' 1. Launch Cloudflare WARP from the Windows Start Menu');
768
- console.log(' 2. Click the WARP icon in the system tray');
769
- console.log(' 3. Toggle the switch to enable WARP');
770
- console.log('');
771
- console.log('Git Bash notes:');
772
- console.log(' - WARP is a system-wide VPN; all traffic (including Git Bash) is protected');
773
- console.log(' - Look for the WARP icon in the Windows system tray to verify it is running');
774
- console.log('');
775
- console.log('To verify WARP is working:');
776
- console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
777
- console.log(' Expected output: warp=on');
778
- }
779
-
780
- /**
781
- * Check if Cloudflare WARP is installed on the current system.
782
- *
783
- * This function checks for WARP installation across all supported platforms:
784
- * - macOS: Checks for WARP.app via Homebrew cask or application bundle
785
- * - Windows: Checks for WARP via Chocolatey package
786
- * - Linux: Checks if warp-cli command exists in PATH
787
- *
788
- * @returns {Promise<boolean>} True if WARP is installed, false otherwise
789
- */
790
- async function isInstalled() {
791
- const platform = os.detect();
792
-
793
- if (platform.type === 'macos') {
794
- // Check if WARP app is installed or cask is installed
795
- if (isWarpAppInstalledMacOS()) {
796
- return true;
797
- }
798
- return brew.isCaskInstalled(HOMEBREW_CASK_NAME);
799
- }
800
-
801
- if (platform.type === 'windows' || platform.type === 'gitbash') {
802
- // Check if WARP package is installed via Chocolatey
803
- return choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
804
- }
805
-
806
- // Linux and WSL: Check if warp-cli command exists
807
- return isWarpCliCommandAvailable();
808
- }
809
-
810
- /**
811
- * Check if this installer is supported on the current platform.
812
- *
813
- * Cloudflare WARP is NOT available on:
814
- * - Raspberry Pi OS (ARM architecture not supported)
815
- *
816
- * Note: WSL support is limited; recommended to install on Windows host instead.
817
- *
818
- * @returns {boolean} True if installation is supported on this platform
819
- */
820
- function isEligible() {
821
- const platform = os.detect();
822
- // Exclude raspbian since WARP is not available for ARM Linux
823
- return ['macos', 'ubuntu', 'debian', 'wsl', 'amazon_linux', 'rhel', 'fedora', 'windows', 'gitbash'].includes(platform.type);
824
- }
825
-
826
- /**
827
- * Main installation entry point - detects platform and runs appropriate installer.
828
- *
829
- * Detects the current platform and executes the corresponding installer function.
830
- * Handles platform-specific mappings to ensure all supported platforms have
831
- * appropriate installation logic.
832
- *
833
- * Supported platforms:
834
- * - macOS: WARP GUI via Homebrew cask
835
- * - Ubuntu/Debian: WARP daemon via official APT repository
836
- * - Amazon Linux/RHEL: WARP via DNF/YUM
837
- * - Windows: WARP GUI via Chocolatey
838
- * - WSL (Ubuntu): WARP within WSL (not recommended)
839
- * - Git Bash: WARP on Windows host via PowerShell
840
- *
841
- * Unsupported platforms:
842
- * - Raspberry Pi OS: ARM architecture not supported
843
- *
844
- * @returns {Promise<void>}
845
- */
846
- async function install() {
847
- const platform = os.detect();
848
-
849
- // Map platform types to their installer functions
850
- // This mapping handles aliases (e.g., debian maps to ubuntu)
851
- const installers = {
852
- 'macos': install_macos,
853
- 'ubuntu': install_ubuntu,
854
- 'debian': install_ubuntu,
855
- 'wsl': install_ubuntu_wsl,
856
- 'raspbian': install_raspbian,
857
- 'amazon_linux': install_amazon_linux,
858
- 'rhel': install_amazon_linux,
859
- 'fedora': install_amazon_linux,
860
- 'windows': install_windows,
861
- 'gitbash': install_gitbash
862
- };
863
-
864
- const installer = installers[platform.type];
865
-
866
- if (!installer) {
867
- // Gracefully handle unsupported platforms without throwing an error
868
- console.log(`Cloudflare WARP is not available for ${platform.type}.`);
869
- return;
870
- }
871
-
872
- await installer();
873
- }
874
-
875
- // Export all functions for use as a module and for testing
876
- module.exports = {
877
- install,
878
- isInstalled,
879
- isEligible,
880
- install_macos,
881
- install_ubuntu,
882
- install_ubuntu_wsl,
883
- install_raspbian,
884
- install_amazon_linux,
885
- install_windows,
886
- install_gitbash,
887
- // Export helper functions for potential reuse or testing
888
- isWarpCliCommandAvailable,
889
- isWarpAppInstalledMacOS,
890
- getWarpCliVersion,
891
- getWarpVersionMacOS
892
- };
893
-
894
- // Allow direct execution: node cloudflare-warp.js
895
- if (require.main === module) {
896
- install().catch(err => {
897
- console.error(err.message);
898
- process.exit(1);
899
- });
900
- }