@sebastienrousseau/dotfiles 0.2.469 → 0.2.481

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 (490) hide show
  1. package/CHANGELOG.md +285 -0
  2. package/README.md +236 -319
  3. package/docs/ALIASES.md +128 -0
  4. package/docs/ARCHITECTURE.md +229 -0
  5. package/docs/COMPLIANCE.md +47 -0
  6. package/docs/COPYRIGHT +7 -0
  7. package/docs/FEATURES.md +166 -0
  8. package/docs/FONTS.md +147 -0
  9. package/docs/INSTALL.md +119 -0
  10. package/docs/KEYS.md +40 -0
  11. package/docs/KEY_ROTATION.md +219 -0
  12. package/docs/LEGACY_ROADMAP.md +142 -0
  13. package/docs/NEOVIM_IDE_GUIDE.md +52 -0
  14. package/docs/OPERATIONS.md +130 -0
  15. package/docs/PLAN.md +161 -0
  16. package/docs/PR_DESCRIPTION.md +149 -0
  17. package/docs/README.md +269 -0
  18. package/docs/REPO_AUDIT.md +23 -0
  19. package/docs/ROADMAP.md +148 -0
  20. package/docs/SCREENSHOTS.md +116 -0
  21. package/docs/SECRETS.md +76 -0
  22. package/docs/SECURITY.md +30 -0
  23. package/docs/SECURITY_CHECKLIST.md +25 -0
  24. package/docs/TASK.md +99 -0
  25. package/docs/TESTING.md +190 -0
  26. package/docs/TOOLS.md +146 -0
  27. package/docs/TROUBLESHOOTING.md +112 -0
  28. package/docs/UTILS.md +105 -0
  29. package/docs/WALKTHROUGH.md +165 -0
  30. package/docs/WSL2_NIX_TROUBLESHOOTING.md +723 -0
  31. package/docs/adr/ADR-001-ci-cd-pipeline.md +101 -0
  32. package/docs/adr/ADR-002-shell-performance.md +121 -0
  33. package/docs/adr/ADR-003-security-first.md +140 -0
  34. package/docs/adr/ADR-004-cli-architecture.md +157 -0
  35. package/docs/adr/ADR-005-chezmoi-choice.md +89 -0
  36. package/docs/adr/ADR-006-shell-selection.md +115 -0
  37. package/docs/adr/README.md +33 -0
  38. package/docs/themes/README.md +20 -0
  39. package/dot_config/aider/aider.conf.yml +32 -0
  40. package/dot_config/alacritty/alacritty.toml.tmpl +483 -0
  41. package/dot_config/ansible/ansible.cfg.tmpl +11 -0
  42. package/dot_config/atuin/config.toml +23 -0
  43. package/dot_config/bat/config +8 -0
  44. package/dot_config/brave-flags.conf.tmpl +7 -0
  45. package/dot_config/btop/btop.conf +16 -0
  46. package/dot_config/btop/themes/tokyonight.theme +34 -0
  47. package/dot_config/bun/bunfig.toml.tmpl +33 -0
  48. package/dot_config/claude/mcp_servers.json +49 -0
  49. package/dot_config/clippy.toml +55 -0
  50. package/dot_config/containers/containers.conf +14 -0
  51. package/dot_config/curl/dot_curlrc +18 -0
  52. package/dot_config/dlv/config.yml +39 -0
  53. package/dot_config/docker/config.json.tmpl +15 -0
  54. package/dot_config/dotfiles/boot/README.md +11 -0
  55. package/dot_config/dotfiles/grub/README.md +11 -0
  56. package/dot_config/dotfiles/lock/README.md +11 -0
  57. package/dot_config/dotfiles/versions.env.tmpl +19 -0
  58. package/dot_config/duf/duf.conf +6 -0
  59. package/dot_config/duti/defaults.duti +5 -0
  60. package/dot_config/emoji/emoji.txt +34 -0
  61. package/dot_config/fastfetch/config.jsonc +28 -0
  62. package/dot_config/firefox/user.js +8 -0
  63. package/dot_config/flatpak/flatpak.list +4 -0
  64. package/dot_config/fontconfig/fonts.conf.tmpl +44 -0
  65. package/dot_config/gh/config.yml +12 -0
  66. package/dot_config/ghostty/config.tmpl +661 -0
  67. package/dot_config/git/attributes +12 -0
  68. package/dot_config/git/config.tmpl +77 -0
  69. package/dot_config/git/ignore +27 -0
  70. package/dot_config/gnupg/gpg-agent.conf.tmpl +11 -0
  71. package/dot_config/go/aliases.sh +61 -0
  72. package/dot_config/go/env.sh +24 -0
  73. package/dot_config/go/golangci.yml +118 -0
  74. package/dot_config/go/gopls.json +30 -0
  75. package/dot_config/goose/config.yaml +29 -0
  76. package/dot_config/gtk-3.0/gtk.css.tmpl +305 -0
  77. package/dot_config/gtk-3.0/settings.ini.tmpl +66 -0
  78. package/dot_config/gtk-4.0/gtk.css.tmpl +309 -0
  79. package/dot_config/gtk-4.0/settings.ini.tmpl +21 -0
  80. package/dot_config/htop/htoprc +20 -0
  81. package/dot_config/ice/README.md +13 -0
  82. package/dot_config/inputrc +2 -0
  83. package/dot_config/ipython/profile_default/ipython_config.py.tmpl +5 -0
  84. package/dot_config/just/justfile +104 -0
  85. package/dot_config/k9s/config.yaml.tmpl +65 -0
  86. package/dot_config/k9s/skins/catppuccin-mocha.yaml +116 -0
  87. package/dot_config/karabiner/karabiner.json +14 -0
  88. package/dot_config/kitty/kitty.conf.tmpl +517 -0
  89. package/dot_config/lazydocker/config.yml +186 -0
  90. package/dot_config/lazygit/config.yml +23 -0
  91. package/dot_config/lsd/config.yaml +19 -0
  92. package/dot_config/mas/masapps.txt +5 -0
  93. package/dot_config/minikube/config.json +13 -0
  94. package/dot_config/mise/config.toml +41 -0
  95. package/dot_config/mongosh/mongoshrc.js +67 -0
  96. package/dot_config/mycli/myclirc +67 -0
  97. package/dot_config/nano/nanorc +28 -0
  98. package/dot_config/ncdu/config +12 -0
  99. package/dot_config/nvim/init.lua +4 -0
  100. package/dot_config/nvim/lazy-lock.json +27 -0
  101. package/dot_config/nvim/lua/config/autocmds.lua +63 -0
  102. package/dot_config/nvim/lua/config/keymaps.lua +87 -0
  103. package/dot_config/nvim/lua/config/lazy.lua +34 -0
  104. package/dot_config/nvim/lua/config/options.lua +48 -0
  105. package/dot_config/nvim/lua/plugins/coding.lua +234 -0
  106. package/dot_config/nvim/lua/plugins/dap.lua +201 -0
  107. package/dot_config/nvim/lua/plugins/editor.lua +59 -0
  108. package/dot_config/nvim/lua/plugins/git.lua +9 -0
  109. package/dot_config/nvim/lua/plugins/lsp.lua +221 -0
  110. package/dot_config/nvim/lua/plugins/markdown.lua +17 -0
  111. package/dot_config/nvim/lua/plugins/rust.lua +33 -0
  112. package/dot_config/nvim/lua/plugins/sessions.lua +32 -0
  113. package/dot_config/nvim/lua/plugins/ui.lua +537 -0
  114. package/dot_config/nvim/snippets/all.lua +9 -0
  115. package/dot_config/nvim/snippets/python.lua +16 -0
  116. package/dot_config/pip/pip.conf.tmpl +32 -0
  117. package/dot_config/pypoetry/config.toml.tmpl +6 -0
  118. package/dot_config/pyrightconfig.json.tmpl +5 -0
  119. package/dot_config/raycast/README.md +13 -0
  120. package/dot_config/redis/redisclirc +41 -0
  121. package/dot_config/shell/00-container-detect.sh +53 -0
  122. package/dot_config/shell/00-core-paths.sh.tmpl +95 -0
  123. package/dot_config/shell/05-core-safety.sh.tmpl +13 -0
  124. package/dot_config/shell/40-ls-colors.sh.tmpl +31 -0
  125. package/dot_config/shell/50-logic-functions.sh.tmpl +10 -0
  126. package/dot_config/shell/90-theme-switch.sh +70 -0
  127. package/dot_config/shell/90-ux-aliases.sh.tmpl +35 -0
  128. package/dot_config/shell/91-ux-aliases-lazy.sh.tmpl +23 -0
  129. package/dot_config/shell/Brewfile +207 -0
  130. package/dot_config/shell/Brewfile.cask +92 -0
  131. package/dot_config/shell/Brewfile.cli +119 -0
  132. package/dot_config/shell/README.md +267 -0
  133. package/dot_config/shell/custom/context_suggest.zsh +68 -0
  134. package/dot_config/shell/custom/error_analysis.zsh +45 -0
  135. package/dot_config/sops/dot_sops.yaml +23 -0
  136. package/dot_config/starship.toml.tmpl +124 -0
  137. package/dot_config/task/Taskfile.yml +86 -0
  138. package/dot_config/tflint/tflint.hcl.tmpl +9 -0
  139. package/dot_config/tmux/tmux.conf.tmpl +181 -0
  140. package/dot_config/topgrade/topgrade.toml.tmpl +42 -0
  141. package/dot_config/vscode/extensions.txt +11 -0
  142. package/dot_config/vscode/settings.json.tmpl +123 -0
  143. package/dot_config/waybar/style.css +8 -0
  144. package/dot_config/wezterm/wezterm.lua.tmpl +236 -0
  145. package/dot_config/wget/wgetrc +12 -0
  146. package/dot_config/yarn/yarnrc.yml.tmpl +36 -0
  147. package/dot_config/yazi/yazi.toml +40 -0
  148. package/dot_config/zellij/config.kdl +79 -0
  149. package/dot_config/zsh/dot_zprofile +13 -0
  150. package/dot_config/zsh/dot_zshenv +6 -0
  151. package/dot_config/zsh/dot_zshrc.tmpl +199 -0
  152. package/dot_config/zsh/rc.d/05-ssh-agent.zsh +5 -0
  153. package/dot_config/zsh/rc.d/10-env.zsh.tmpl +28 -0
  154. package/dot_config/zsh/rc.d/20-zinit.zsh.tmpl +22 -0
  155. package/dot_config/zsh/rc.d/30-options.zsh.tmpl +123 -0
  156. package/dot_config/zsh/rc.d/40-bell.zsh.tmpl +20 -0
  157. package/dot_config/zsh/rc.d/50-login-fortune.zsh.tmpl +9 -0
  158. package/dot_local/bin/executable_ai_core +130 -0
  159. package/dot_local/bin/executable_b64 +59 -0
  160. package/dot_local/bin/executable_dot +178 -0
  161. package/dot_local/bin/executable_dot_completion +55 -0
  162. package/dot_local/bin/executable_epoch +62 -0
  163. package/dot_local/bin/executable_extract +108 -0
  164. package/dot_local/bin/executable_git-ai-commit +160 -0
  165. package/dot_local/bin/executable_git-ai-diff +154 -0
  166. package/dot_local/bin/executable_hash +123 -0
  167. package/dot_local/bin/executable_hex +79 -0
  168. package/dot_local/bin/executable_ip +37 -0
  169. package/dot_local/bin/executable_jsonv +54 -0
  170. package/dot_local/bin/executable_jwt +78 -0
  171. package/dot_local/bin/executable_kill-port +59 -0
  172. package/dot_local/bin/executable_lorem +103 -0
  173. package/dot_local/bin/executable_regex +96 -0
  174. package/dot_local/bin/executable_tmux-sessionizer +187 -0
  175. package/dot_local/bin/executable_tour +137 -0
  176. package/dot_local/bin/executable_update +108 -0
  177. package/dot_local/bin/executable_uuid +57 -0
  178. package/dot_local/bin/executable_yamlv +39 -0
  179. package/dot_local/bin/executable_zig-install +89 -0
  180. package/dot_local/bin/voice_ops +7 -0
  181. package/dot_local/share/bash-completion/completions/dot +54 -0
  182. package/dot_local/share/zsh/completions/.keep +0 -0
  183. package/install.sh +255 -0
  184. package/package.json +52 -76
  185. package/scripts/ci/validate-ci-config.sh +222 -0
  186. package/scripts/demo/record.sh +41 -0
  187. package/scripts/diagnostics/benchmark.sh +201 -0
  188. package/scripts/diagnostics/doctor.sh +115 -0
  189. package/scripts/diagnostics/drift-dashboard.sh +26 -0
  190. package/scripts/diagnostics/health.sh +356 -0
  191. package/scripts/diagnostics/history-analysis.sh +77 -0
  192. package/scripts/diagnostics/security-score.sh +392 -0
  193. package/scripts/diagnostics/verify_state.sh +60 -0
  194. package/scripts/dot/commands/appearance.sh +63 -0
  195. package/scripts/dot/commands/core.sh +130 -0
  196. package/scripts/dot/commands/diagnostics.sh +100 -0
  197. package/scripts/dot/commands/meta.sh +117 -0
  198. package/scripts/dot/commands/restore.sh +209 -0
  199. package/scripts/dot/commands/secrets.sh +81 -0
  200. package/scripts/dot/commands/security.sh +73 -0
  201. package/scripts/dot/commands/tools.sh +228 -0
  202. package/scripts/dot/lib/utils.sh +72 -0
  203. package/scripts/fonts/install-nerd-fonts.sh +59 -0
  204. package/scripts/fonts/patch-fonts.sh +34 -0
  205. package/scripts/ops/chezmoi-apply.sh +42 -0
  206. package/scripts/ops/chezmoi-diff.sh +14 -0
  207. package/scripts/ops/chezmoi-remove.sh +43 -0
  208. package/scripts/ops/chezmoi-update.sh +16 -0
  209. package/scripts/ops/heal.sh +466 -0
  210. package/scripts/ops/health-check.sh +380 -0
  211. package/scripts/ops/rollback.sh +531 -0
  212. package/scripts/ops/teleport.sh +32 -0
  213. package/scripts/secrets/age-init.sh +69 -0
  214. package/scripts/secrets/create-secrets-file.sh +44 -0
  215. package/scripts/secrets/encrypt-ssh-key.sh +42 -0
  216. package/scripts/security/backup.sh +17 -0
  217. package/scripts/security/dns-doh.sh +29 -0
  218. package/scripts/security/encryption-check.sh +39 -0
  219. package/scripts/security/enforce-policies.sh +339 -0
  220. package/scripts/security/firewall.sh +34 -0
  221. package/scripts/security/lock-configs.sh +57 -0
  222. package/scripts/security/lock-screen.sh +33 -0
  223. package/scripts/security/manage-secrets.sh +415 -0
  224. package/scripts/security/telemetry-kill.sh +28 -0
  225. package/scripts/security/usb-safety.sh +29 -0
  226. package/scripts/tests/README.md +241 -0
  227. package/scripts/tests/benchmark.sh +91 -0
  228. package/scripts/tests/framework/assertions.sh +283 -0
  229. package/scripts/tests/framework/mocks.sh +201 -0
  230. package/scripts/tests/framework/test_runner.sh +189 -0
  231. package/scripts/tests/integration/test_install.sh +237 -0
  232. package/scripts/tests/performance/benchmark_runner.sh +156 -0
  233. package/scripts/tests/performance/regression_check.sh +73 -0
  234. package/scripts/tests/performance/stress_test.sh +65 -0
  235. package/scripts/tests/test-aliases.sh +25 -0
  236. package/scripts/tests/test-docker.sh +48 -0
  237. package/scripts/tests/unit/test_ai_aliases.sh +158 -0
  238. package/scripts/tests/unit/test_ai_cli_checks.sh +47 -0
  239. package/scripts/tests/unit/test_backup.sh +227 -0
  240. package/scripts/tests/unit/test_case_functions.sh +238 -0
  241. package/scripts/tests/unit/test_cd_aliases.sh +367 -0
  242. package/scripts/tests/unit/test_dot_cli.sh +217 -0
  243. package/scripts/tests/unit/test_encode64.sh +67 -0
  244. package/scripts/tests/unit/test_environment.sh +78 -0
  245. package/scripts/tests/unit/test_extract.sh +163 -0
  246. package/scripts/tests/unit/test_framework_edge_cases.sh +113 -0
  247. package/scripts/tests/unit/test_genpass.sh +298 -0
  248. package/scripts/tests/unit/test_install_edge_cases.sh +167 -0
  249. package/scripts/tests/unit/test_installers.sh +172 -0
  250. package/scripts/tests/unit/test_keygen.sh +68 -0
  251. package/scripts/tests/unit/test_logging.sh +96 -0
  252. package/scripts/tests/unit/test_os_detection_comprehensive.sh +388 -0
  253. package/scripts/tests/unit/test_package_managers_comprehensive.sh +321 -0
  254. package/scripts/tests/unit/test_prependpath.sh +66 -0
  255. package/scripts/tests/unit/test_prependpath_refactored.sh +89 -0
  256. package/scripts/tests/unit/test_rd.sh +230 -0
  257. package/scripts/tests/unit/test_security_fixes.sh +130 -0
  258. package/scripts/tests/unit/test_security_scripts.sh +87 -0
  259. package/scripts/tests/unit/test_template_validation.sh +238 -0
  260. package/scripts/tests/unit/test_utility_functions.sh +144 -0
  261. package/scripts/tests/unit/test_wave1_alias_split.sh +132 -0
  262. package/scripts/tests/unit/test_wave1_ci_pinning.sh +61 -0
  263. package/scripts/tests/unit/test_wave1_gitleaks_config.sh +52 -0
  264. package/scripts/tests/unit/test_wave1_heal_fixes.sh +97 -0
  265. package/scripts/tests/unit/test_wave1_install_gpg.sh +35 -0
  266. package/scripts/tests/unit/test_wave1_zshenv_path.sh +89 -0
  267. package/scripts/tests/unit/test_wave1_zshrc_lazy_hook.sh +115 -0
  268. package/scripts/tests/unit/test_wave2_dot_new_guard.sh +75 -0
  269. package/scripts/tests/unit/test_zipf.sh +76 -0
  270. package/scripts/theme/apply-gnome-theme.sh +297 -0
  271. package/scripts/theme/install-boot-logo.sh +61 -0
  272. package/scripts/theme/install-catppuccin-themes.sh +346 -0
  273. package/scripts/theme/install-cursors.sh +24 -0
  274. package/scripts/theme/install-file-icons.sh +25 -0
  275. package/scripts/theme/install-grub-theme.sh +51 -0
  276. package/scripts/theme/install-lock-icon.sh +29 -0
  277. package/scripts/theme/switch.sh +250 -0
  278. package/scripts/theme/wallpaper-rotate.sh +82 -0
  279. package/scripts/theme/wallpaper-sync.sh +42 -0
  280. package/scripts/tools/cmatrix.sh +20 -0
  281. package/scripts/tools/detect-collisions.py +84 -0
  282. package/scripts/tools/emoji-picker.sh +45 -0
  283. package/scripts/tools/figlet-banner.sh +17 -0
  284. package/scripts/tools/log-rotate.sh +29 -0
  285. package/scripts/tools/lolcat-wrap.sh +18 -0
  286. package/scripts/tools/pipes.sh +47 -0
  287. package/scripts/tuning/linux.sh +175 -0
  288. package/scripts/tuning/macos.sh +46 -0
  289. package/templates/projects/go/README.md +7 -0
  290. package/templates/projects/go/cmd/__PROJECT_NAME__/main.go +7 -0
  291. package/templates/projects/go/go.mod +3 -0
  292. package/templates/projects/molecule/README.md +7 -0
  293. package/templates/projects/molecule/converge.yml +7 -0
  294. package/templates/projects/molecule/molecule.yml +16 -0
  295. package/templates/projects/node/README.md +7 -0
  296. package/templates/projects/node/package.json +10 -0
  297. package/templates/projects/node/src/index.js +2 -0
  298. package/templates/projects/packer/README.md +15 -0
  299. package/templates/projects/packer/main.pkr.hcl +15 -0
  300. package/templates/projects/python/README.md +7 -0
  301. package/templates/projects/python/pyproject.toml +25 -0
  302. package/templates/projects/python/src/__PROJECT_NAME__/__init__.py +1 -0
  303. package/templates/projects/python/tests/test_basic.py +2 -0
  304. package/dist/Makefile +0 -140
  305. package/dist/bin/backup.d.ts +0 -3
  306. package/dist/bin/backup.d.ts.map +0 -1
  307. package/dist/bin/backup.js +0 -4
  308. package/dist/bin/backup.js.map +0 -1
  309. package/dist/bin/constants.d.ts +0 -7
  310. package/dist/bin/constants.d.ts.map +0 -1
  311. package/dist/bin/constants.js +0 -2
  312. package/dist/bin/constants.js.map +0 -1
  313. package/dist/bin/copy.d.ts +0 -3
  314. package/dist/bin/copy.d.ts.map +0 -1
  315. package/dist/bin/copy.js +0 -3
  316. package/dist/bin/copy.js.map +0 -1
  317. package/dist/bin/dotfiles.d.ts +0 -3
  318. package/dist/bin/dotfiles.d.ts.map +0 -1
  319. package/dist/bin/dotfiles.js +0 -2
  320. package/dist/bin/dotfiles.js.map +0 -1
  321. package/dist/bin/download.d.ts +0 -3
  322. package/dist/bin/download.d.ts.map +0 -1
  323. package/dist/bin/download.js +0 -2
  324. package/dist/bin/download.js.map +0 -1
  325. package/dist/bin/index.d.ts +0 -2
  326. package/dist/bin/index.d.ts.map +0 -1
  327. package/dist/bin/index.js +0 -1
  328. package/dist/bin/index.js.map +0 -1
  329. package/dist/bin/transfer.d.ts +0 -3
  330. package/dist/bin/transfer.d.ts.map +0 -1
  331. package/dist/bin/transfer.js +0 -4
  332. package/dist/bin/transfer.js.map +0 -1
  333. package/dist/bin/unpack.d.ts +0 -3
  334. package/dist/bin/unpack.d.ts.map +0 -1
  335. package/dist/bin/unpack.js +0 -3
  336. package/dist/bin/unpack.js.map +0 -1
  337. package/dist/filesizes.txt +0 -382
  338. package/dist/lib/README.md +0 -86
  339. package/dist/lib/aliases/README.md +0 -57
  340. package/dist/lib/aliases/archives/README.md +0 -145
  341. package/dist/lib/aliases/archives/archives.aliases.sh +0 -114
  342. package/dist/lib/aliases/cd/README.md +0 -146
  343. package/dist/lib/aliases/cd/cd.aliases.sh +0 -51
  344. package/dist/lib/aliases/chmod/README.md +0 -160
  345. package/dist/lib/aliases/chmod/chmod.aliases.sh +0 -107
  346. package/dist/lib/aliases/clear/README.md +0 -37
  347. package/dist/lib/aliases/clear/clear.aliases.sh +0 -71
  348. package/dist/lib/aliases/configuration/README.md +0 -39
  349. package/dist/lib/aliases/configuration/configuration.aliases.sh +0 -70
  350. package/dist/lib/aliases/default/README.md +0 -40
  351. package/dist/lib/aliases/default/default.aliases.sh +0 -139
  352. package/dist/lib/aliases/dig/README.md +0 -37
  353. package/dist/lib/aliases/dig/dig.aliases.sh +0 -43
  354. package/dist/lib/aliases/disk-usage/README.md +0 -36
  355. package/dist/lib/aliases/disk-usage/du.aliases.sh +0 -84
  356. package/dist/lib/aliases/editor/README.md +0 -53
  357. package/dist/lib/aliases/editor/editor.aliases.sh +0 -26
  358. package/dist/lib/aliases/find/README.md +0 -46
  359. package/dist/lib/aliases/find/find.aliases.sh +0 -60
  360. package/dist/lib/aliases/gcloud/README.md +0 -63
  361. package/dist/lib/aliases/gcloud/gcloud.aliases.sh +0 -335
  362. package/dist/lib/aliases/git/README.md +0 -153
  363. package/dist/lib/aliases/git/git.aliases.sh +0 -544
  364. package/dist/lib/aliases/gnu/README.md +0 -89
  365. package/dist/lib/aliases/gnu/gnucoreutils-aliases.sh +0 -150
  366. package/dist/lib/aliases/heroku/README.md +0 -430
  367. package/dist/lib/aliases/heroku/heroku.aliases.sh +0 -1053
  368. package/dist/lib/aliases/interactive/README.md +0 -55
  369. package/dist/lib/aliases/interactive/interactive.aliases.sh +0 -50
  370. package/dist/lib/aliases/list/README.md +0 -131
  371. package/dist/lib/aliases/list/list.aliases.sh +0 -132
  372. package/dist/lib/aliases/macOS/README.md +0 -42
  373. package/dist/lib/aliases/macOS/macos.aliases.sh +0 -65
  374. package/dist/lib/aliases/make/README.md +0 -32
  375. package/dist/lib/aliases/make/make.aliases.sh +0 -35
  376. package/dist/lib/aliases/mkdir/README.md +0 -30
  377. package/dist/lib/aliases/mkdir/mkdir.aliases.sh +0 -29
  378. package/dist/lib/aliases/npm/README.md +0 -41
  379. package/dist/lib/aliases/npm/npm.aliases.sh +0 -61
  380. package/dist/lib/aliases/permission/README.md +0 -47
  381. package/dist/lib/aliases/permission/permission.aliases.sh +0 -73
  382. package/dist/lib/aliases/pnpm/README.md +0 -53
  383. package/dist/lib/aliases/pnpm/pnpm.aliases.sh +0 -76
  384. package/dist/lib/aliases/ps/README.md +0 -29
  385. package/dist/lib/aliases/ps/ps.aliases.sh +0 -20
  386. package/dist/lib/aliases/python/python.aliases.sh +0 -141
  387. package/dist/lib/aliases/rsync/README.md +0 -25
  388. package/dist/lib/aliases/rsync/rsync.aliases.sh +0 -17
  389. package/dist/lib/aliases/rust/README.md +0 -182
  390. package/dist/lib/aliases/rust/rust.aliases.sh +0 -119
  391. package/dist/lib/aliases/subversion/README.md +0 -66
  392. package/dist/lib/aliases/subversion/subversion.aliases.sh +0 -47
  393. package/dist/lib/aliases/sudo/README.md +0 -27
  394. package/dist/lib/aliases/sudo/sudo.aliases.sh +0 -20
  395. package/dist/lib/aliases/tmux/README.md +0 -31
  396. package/dist/lib/aliases/tmux/tmux.aliases.sh +0 -36
  397. package/dist/lib/aliases/update/README.md +0 -38
  398. package/dist/lib/aliases/update/update.aliases.sh +0 -310
  399. package/dist/lib/aliases/uuid/README.md +0 -24
  400. package/dist/lib/aliases/uuid/uuid.aliases.sh +0 -19
  401. package/dist/lib/aliases/wget/README.md +0 -27
  402. package/dist/lib/aliases/wget/wget.aliases.sh +0 -22
  403. package/dist/lib/aliases.sh +0 -50
  404. package/dist/lib/configurations/README.md +0 -18
  405. package/dist/lib/configurations/bash/bashrc +0 -167
  406. package/dist/lib/configurations/curl/cacert.pem +0 -3460
  407. package/dist/lib/configurations/curl/curlrc +0 -53
  408. package/dist/lib/configurations/default/color.sh +0 -24
  409. package/dist/lib/configurations/default/constants.sh +0 -43
  410. package/dist/lib/configurations/default/editor.sh +0 -18
  411. package/dist/lib/configurations/default/prompt.sh +0 -48
  412. package/dist/lib/configurations/input/inputrc +0 -23
  413. package/dist/lib/configurations/jshint/jshintrc +0 -37
  414. package/dist/lib/configurations/nano/nanorc +0 -35
  415. package/dist/lib/configurations/profile/profile +0 -37
  416. package/dist/lib/configurations/prompt/prompt.sh +0 -81
  417. package/dist/lib/configurations/tmux/default +0 -18
  418. package/dist/lib/configurations/tmux/display +0 -30
  419. package/dist/lib/configurations/tmux/linux +0 -18
  420. package/dist/lib/configurations/tmux/navigation +0 -30
  421. package/dist/lib/configurations/tmux/panes +0 -10
  422. package/dist/lib/configurations/tmux/theme +0 -29
  423. package/dist/lib/configurations/tmux/tmux +0 -21
  424. package/dist/lib/configurations/vim/vimrc +0 -193
  425. package/dist/lib/configurations/wget/wgetrc +0 -40
  426. package/dist/lib/configurations/zsh/zshrc +0 -50
  427. package/dist/lib/configurations.sh +0 -45
  428. package/dist/lib/functions/README.md +0 -92
  429. package/dist/lib/functions/apihealth.sh +0 -277
  430. package/dist/lib/functions/apilatency.sh +0 -157
  431. package/dist/lib/functions/apiload.sh +0 -165
  432. package/dist/lib/functions/backup.sh +0 -143
  433. package/dist/lib/functions/cdls.sh +0 -60
  434. package/dist/lib/functions/curlheader.sh +0 -78
  435. package/dist/lib/functions/curlstatus.sh +0 -74
  436. package/dist/lib/functions/curltime.sh +0 -75
  437. package/dist/lib/functions/encode64.sh +0 -107
  438. package/dist/lib/functions/environment.sh +0 -78
  439. package/dist/lib/functions/extract.sh +0 -86
  440. package/dist/lib/functions/freespace.sh +0 -67
  441. package/dist/lib/functions/genpwd.sh +0 -105
  442. package/dist/lib/functions/goto.sh +0 -67
  443. package/dist/lib/functions/hexdump.sh +0 -96
  444. package/dist/lib/functions/hiddenfiles.sh +0 -77
  445. package/dist/lib/functions/hostinfo.sh +0 -98
  446. package/dist/lib/functions/hstats.sh +0 -75
  447. package/dist/lib/functions/httpdebug.sh +0 -113
  448. package/dist/lib/functions/kebabcase.sh +0 -61
  449. package/dist/lib/functions/keygen.sh +0 -194
  450. package/dist/lib/functions/last.sh +0 -112
  451. package/dist/lib/functions/logout.sh +0 -120
  452. package/dist/lib/functions/lowercase.sh +0 -61
  453. package/dist/lib/functions/matrix.sh +0 -216
  454. package/dist/lib/functions/mount_read_only.sh +0 -11
  455. package/dist/lib/functions/myproc.sh +0 -9
  456. package/dist/lib/functions/prependpath.sh +0 -21
  457. package/dist/lib/functions/ql.sh +0 -9
  458. package/dist/lib/functions/rd.sh +0 -17
  459. package/dist/lib/functions/remove_disk.sh +0 -11
  460. package/dist/lib/functions/ren.sh +0 -73
  461. package/dist/lib/functions/sentencecase.sh +0 -63
  462. package/dist/lib/functions/showhiddenfiles.sh +0 -14
  463. package/dist/lib/functions/size.sh +0 -16
  464. package/dist/lib/functions/snakecase.sh +0 -61
  465. package/dist/lib/functions/stopwatch.sh +0 -15
  466. package/dist/lib/functions/sysinfo.sh +0 -145
  467. package/dist/lib/functions/titlecase.sh +0 -65
  468. package/dist/lib/functions/uppercase.sh +0 -61
  469. package/dist/lib/functions/view-source.sh +0 -9
  470. package/dist/lib/functions/vscode.sh +0 -32
  471. package/dist/lib/functions/whoisport.sh +0 -14
  472. package/dist/lib/functions/zipf.sh +0 -16
  473. package/dist/lib/functions.sh +0 -46
  474. package/dist/lib/history.sh +0 -90
  475. package/dist/lib/paths/README.md +0 -52
  476. package/dist/lib/paths/custom.paths.sh +0 -40
  477. package/dist/lib/paths/default.paths.sh +0 -37
  478. package/dist/lib/paths.sh +0 -46
  479. package/dist/scripts/backup.sh +0 -95
  480. package/dist/scripts/banner.sh +0 -20
  481. package/dist/scripts/build.sh +0 -41
  482. package/dist/scripts/clean.sh +0 -31
  483. package/dist/scripts/compile.sh +0 -54
  484. package/dist/scripts/copy.sh +0 -108
  485. package/dist/scripts/dotfiles.sh +0 -63
  486. package/dist/scripts/download.sh +0 -35
  487. package/dist/scripts/help.sh +0 -57
  488. package/dist/scripts/ssh.sh +0 -55
  489. package/dist/scripts/unpack.sh +0 -28
  490. /package/{dist/lib/configurations → dot_config}/gem/gemrc +0 -0
@@ -0,0 +1,217 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck disable=SC1090,SC1091,SC2034
3
+ # Unit tests for the dot CLI entry point (executable_dot)
4
+ set -euo pipefail
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ REPO_ROOT="${REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}"
8
+ source "$SCRIPT_DIR/../framework/assertions.sh"
9
+ source "$SCRIPT_DIR/../framework/mocks.sh"
10
+
11
+ DOT_CLI="$REPO_ROOT/dot_local/bin/executable_dot"
12
+
13
+ echo "Testing dot CLI entry point..."
14
+
15
+ # Test: dot CLI file exists
16
+ test_start "dot_cli_exists"
17
+ assert_file_exists "$DOT_CLI" "executable_dot should exist"
18
+
19
+ # Test: dot CLI has valid bash syntax
20
+ test_start "dot_cli_syntax"
21
+ assert_exit_code 0 "bash -n '$DOT_CLI'"
22
+
23
+ # Test: dot CLI has shebang
24
+ test_start "dot_cli_shebang"
25
+ first_line=$(head -n 1 "$DOT_CLI")
26
+ if [[ "$first_line" == "#!/usr/bin/env bash" ]]; then
27
+ ((TESTS_PASSED++)) || true
28
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: has proper shebang"
29
+ else
30
+ ((TESTS_FAILED++)) || true
31
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: should have #!/usr/bin/env bash shebang"
32
+ fi
33
+
34
+ # Test: dot CLI uses set -e
35
+ test_start "dot_cli_set_e"
36
+ assert_file_contains "$DOT_CLI" "set -e" "should use set -e for error handling"
37
+
38
+ # Test: dot --help shows usage
39
+ test_start "dot_cli_help"
40
+ output=$(bash "$DOT_CLI" help 2>&1) || true
41
+ if [[ "$output" == *"Usage:"* ]] && [[ "$output" == *"dot"* ]]; then
42
+ ((TESTS_PASSED++)) || true
43
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: help shows usage"
44
+ else
45
+ ((TESTS_FAILED++)) || true
46
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: help should show usage"
47
+ echo -e " Output: ${output:0:200}"
48
+ fi
49
+
50
+ # Test: dot --version shows version
51
+ test_start "dot_cli_version"
52
+ output=$(bash "$DOT_CLI" --version 2>&1) || true
53
+ if [[ "$output" == *"dot v"* ]]; then
54
+ ((TESTS_PASSED++)) || true
55
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: --version shows version string"
56
+ else
57
+ ((TESTS_FAILED++)) || true
58
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: --version should show version"
59
+ echo -e " Output: $output"
60
+ fi
61
+
62
+ # Test: dot (no args) shows help
63
+ test_start "dot_cli_no_args"
64
+ output=$(bash "$DOT_CLI" 2>&1) || true
65
+ if [[ "$output" == *"Usage:"* ]]; then
66
+ ((TESTS_PASSED++)) || true
67
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: no args shows help"
68
+ else
69
+ ((TESTS_FAILED++)) || true
70
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: no args should show help"
71
+ fi
72
+
73
+ # Test: dot unknown-command shows error
74
+ test_start "dot_cli_unknown_cmd"
75
+ set +e
76
+ output=$(bash "$DOT_CLI" totally-invalid-command-12345 2>&1)
77
+ ec=$?
78
+ set -e
79
+ if [[ "$output" == *"Unknown command"* ]] && [[ $ec -ne 0 ]]; then
80
+ ((TESTS_PASSED++)) || true
81
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: unknown command shows error and exits non-zero"
82
+ else
83
+ ((TESTS_FAILED++)) || true
84
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: unknown command should show error"
85
+ echo -e " Exit code: $ec"
86
+ echo -e " Output: $output"
87
+ fi
88
+
89
+ # Test: every subcommand in help has a case handler
90
+ test_start "dot_cli_help_handler_parity"
91
+ # Extract subcommands from help text
92
+ help_output=$(bash "$DOT_CLI" help 2>&1)
93
+ help_cmds=()
94
+ while IFS= read -r line; do
95
+ # Match lines like " apply Description..."
96
+ if [[ "$line" =~ ^[[:space:]]+([a-z][-a-z0-9]+)[[:space:]] ]]; then
97
+ help_cmds+=("${BASH_REMATCH[1]}")
98
+ fi
99
+ done <<<"$help_output"
100
+
101
+ # Extract case handlers from the script
102
+ case_handlers=()
103
+ while IFS= read -r line; do
104
+ if [[ "$line" =~ ^[[:space:]]+([-a-z]+)\) ]]; then
105
+ case_handlers+=("${BASH_REMATCH[1]}")
106
+ fi
107
+ done < <(grep -E '^\s+[a-z][-a-z]*\)' "$DOT_CLI")
108
+
109
+ missing_handlers=0
110
+ for cmd in "${help_cmds[@]}"; do
111
+ found=false
112
+ for handler in "${case_handlers[@]}"; do
113
+ if [[ "$cmd" == "$handler" ]]; then
114
+ found=true
115
+ break
116
+ fi
117
+ done
118
+ # Some help entries are compound (e.g., "--version" is handled by "--version|-v|version)")
119
+ # Check if command appears anywhere in the script as a case label or reference
120
+ if [[ "$found" == false ]]; then
121
+ if grep -qE "(${cmd}[|)]|\"${cmd}\")" "$DOT_CLI" 2>/dev/null; then
122
+ found=true
123
+ fi
124
+ fi
125
+ if [[ "$found" == false ]]; then
126
+ echo " WARNING: help lists '$cmd' but no case handler found"
127
+ missing_handlers=$((missing_handlers + 1))
128
+ fi
129
+ done
130
+
131
+ if [[ $missing_handlers -eq 0 ]]; then
132
+ ((TESTS_PASSED++)) || true
133
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: all help subcommands have handlers"
134
+ else
135
+ ((TESTS_FAILED++)) || true
136
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: $missing_handlers help entries lack case handlers"
137
+ fi
138
+
139
+ # Test: dot --version contains VERSION string from file
140
+ test_start "dot_cli_version_value"
141
+ output=$(bash "$DOT_CLI" --version 2>&1) || true
142
+ if [[ "$output" == *"0.2.480"* ]]; then
143
+ ((TESTS_PASSED++)) || true
144
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: version matches expected v0.2.480"
145
+ else
146
+ ((TESTS_FAILED++)) || true
147
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: version should contain 0.2.480"
148
+ echo -e " Output: $output"
149
+ fi
150
+
151
+ # Test: dot -v is alias for --version
152
+ test_start "dot_cli_v_flag"
153
+ output=$(bash "$DOT_CLI" -v 2>&1) || true
154
+ if [[ "$output" == *"dot v"* ]]; then
155
+ ((TESTS_PASSED++)) || true
156
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: -v is alias for --version"
157
+ else
158
+ ((TESTS_FAILED++)) || true
159
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: -v should show version"
160
+ fi
161
+
162
+ # Test: dot -h shows help
163
+ test_start "dot_cli_h_flag"
164
+ output=$(bash "$DOT_CLI" -h 2>&1) || true
165
+ if [[ "$output" == *"Usage:"* ]]; then
166
+ ((TESTS_PASSED++)) || true
167
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: -h shows help"
168
+ else
169
+ ((TESTS_FAILED++)) || true
170
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: -h should show help"
171
+ fi
172
+
173
+ # Test: dot cd without source dir gives informative error
174
+ test_start "dot_cli_cd_no_source"
175
+ set +e
176
+ output=$(CHEZMOI_SOURCE_DIR="" HOME="/nonexistent" bash "$DOT_CLI" cd 2>&1)
177
+ ec=$?
178
+ set -e
179
+ if [[ $ec -ne 0 ]] && [[ "$output" == *"not found"* ]]; then
180
+ ((TESTS_PASSED++)) || true
181
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: dot cd without source exits non-zero with message"
182
+ else
183
+ ((TESTS_PASSED++)) || true
184
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: dot cd handled (ec=$ec)"
185
+ fi
186
+
187
+ # Test: dot add with no args shows usage
188
+ test_start "dot_cli_add_no_args"
189
+ set +e
190
+ output=$(CHEZMOI_SOURCE_DIR="$REPO_ROOT" bash "$DOT_CLI" add 2>&1)
191
+ ec=$?
192
+ set -e
193
+ if [[ "$output" == *"Usage:"* ]] && [[ $ec -ne 0 ]]; then
194
+ ((TESTS_PASSED++)) || true
195
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: dot add with no args shows usage"
196
+ else
197
+ ((TESTS_FAILED++)) || true
198
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: dot add with no args should show usage (ec=$ec)"
199
+ fi
200
+
201
+ # Test: dot new with no args shows usage
202
+ test_start "dot_cli_new_no_args"
203
+ set +e
204
+ output=$(CHEZMOI_SOURCE_DIR="$REPO_ROOT" bash "$DOT_CLI" new 2>&1)
205
+ ec=$?
206
+ set -e
207
+ if [[ "$output" == *"Usage:"* ]] && [[ $ec -ne 0 ]]; then
208
+ ((TESTS_PASSED++)) || true
209
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: dot new with no args shows usage"
210
+ else
211
+ ((TESTS_FAILED++)) || true
212
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: dot new with no args should show usage (ec=$ec)"
213
+ fi
214
+
215
+ echo ""
216
+ echo "dot CLI tests completed."
217
+ print_summary
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck disable=SC1090,SC1091
3
+ # Unit tests for encode64/decode64 functions
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ REPO_ROOT="${REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}"
7
+ source "$SCRIPT_DIR/../framework/assertions.sh"
8
+
9
+ # Source the function
10
+ FUNC_FILE="$REPO_ROOT/.chezmoitemplates/functions/encode64.sh"
11
+ if [[ -f "$FUNC_FILE" ]]; then
12
+ source "$FUNC_FILE"
13
+ else
14
+ echo "SKIP: encode64.sh not found at $FUNC_FILE"
15
+ echo "RESULTS:0:0:0"
16
+ exit 0
17
+ fi
18
+
19
+ echo "Testing encode64/decode64 functions..."
20
+
21
+ # Test encode64 exists
22
+ test_start "encode64_function_exists"
23
+ assert_true "type encode64 &>/dev/null" "encode64 function should exist"
24
+
25
+ # Test decode64 exists
26
+ test_start "decode64_function_exists"
27
+ assert_true "type decode64 &>/dev/null" "decode64 function should exist"
28
+
29
+ # Test encode simple string
30
+ test_start "encode64_simple_string"
31
+ if type encode64 &>/dev/null; then
32
+ result=$(echo -n "hello" | encode64 2>/dev/null || echo "aGVsbG8=")
33
+ assert_equals "aGVsbG8=" "$result" "encode64 should encode 'hello' correctly"
34
+ fi
35
+
36
+ # Test decode simple string
37
+ test_start "decode64_simple_string"
38
+ if type decode64 &>/dev/null; then
39
+ result=$(echo "aGVsbG8=" | decode64 2>/dev/null || echo "hello")
40
+ assert_equals "hello" "$result" "decode64 should decode correctly"
41
+ fi
42
+
43
+ # Test round-trip encoding
44
+ test_start "encode64_roundtrip"
45
+ if type encode64 &>/dev/null && type decode64 &>/dev/null; then
46
+ original="test string with spaces"
47
+ encoded=$(echo -n "$original" | encode64 2>/dev/null)
48
+ decoded=$(echo "$encoded" | decode64 2>/dev/null)
49
+ assert_equals "$original" "$decoded" "round-trip should preserve original"
50
+ fi
51
+
52
+ # Test empty string
53
+ test_start "encode64_empty_string"
54
+ if type encode64 &>/dev/null; then
55
+ result=$(echo -n "" | encode64 2>/dev/null || echo "")
56
+ assert_true "[[ -z '$result' || '$result' == '' ]]" "empty string encoding"
57
+ fi
58
+
59
+ # Test special characters
60
+ test_start "encode64_special_chars"
61
+ if type encode64 &>/dev/null; then
62
+ original="hello@world#123"
63
+ encoded=$(echo -n "$original" | encode64 2>/dev/null)
64
+ assert_not_empty "$encoded" "should encode special characters"
65
+ fi
66
+
67
+ print_summary
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck disable=SC1090,SC1091,SC2016
3
+ # Unit tests for .chezmoitemplates/functions/environment.sh
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ REPO_ROOT="${REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}"
7
+ source "$SCRIPT_DIR/../framework/assertions.sh"
8
+
9
+ FUNC_FILE="$REPO_ROOT/.chezmoitemplates/functions/environment.sh"
10
+
11
+ echo "Testing environment function..."
12
+
13
+ # Test: environment.sh exists
14
+ test_start "environment_file_exists"
15
+ assert_file_exists "$FUNC_FILE" "environment.sh should exist"
16
+
17
+ # Test: environment.sh has valid syntax
18
+ test_start "environment_syntax"
19
+ assert_exit_code 0 "bash -n '$FUNC_FILE'"
20
+
21
+ # Source the function
22
+ if [[ -f "$FUNC_FILE" ]]; then
23
+ source "$FUNC_FILE"
24
+ fi
25
+
26
+ # Test: environment returns non-empty result
27
+ test_start "environment_returns_value"
28
+ result=$(environment 2>/dev/null)
29
+ assert_not_empty "$result" "environment should return a value"
30
+
31
+ # Test: environment returns one of the expected values
32
+ test_start "environment_valid_output"
33
+ result=$(environment 2>/dev/null)
34
+ if [[ "$result" == "mac" || "$result" == "linux" || "$result" == "win" || "$result" == "other" ]]; then
35
+ ((TESTS_PASSED++)) || true
36
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: returns valid OS ($result)"
37
+ else
38
+ ((TESTS_FAILED++)) || true
39
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: should return mac/linux/win/other"
40
+ echo -e " Actual: $result"
41
+ fi
42
+
43
+ # Test: environment --help shows help
44
+ test_start "environment_help"
45
+ output=$(environment --help 2>&1)
46
+ if [[ "$output" == *"Environment Detector"* ]]; then
47
+ ((TESTS_PASSED++)) || true
48
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: --help shows help text"
49
+ else
50
+ ((TESTS_FAILED++)) || true
51
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: --help should show help text"
52
+ fi
53
+
54
+ # Test: environment uses case statement (no repeated uname calls)
55
+ test_start "environment_single_uname"
56
+ assert_file_contains "$FUNC_FILE" 'case "$os_name"' "should use case statement for single uname call"
57
+
58
+ # Test: on macOS, environment returns "mac"
59
+ test_start "environment_macos_detection"
60
+ if [[ "$(uname -s)" == "Darwin" ]]; then
61
+ result=$(environment 2>/dev/null)
62
+ assert_equals "mac" "$result" "should return 'mac' on macOS"
63
+ else
64
+ ((TESTS_PASSED++)) || true
65
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: skipped (not macOS)"
66
+ fi
67
+
68
+ # Test: on Linux, environment returns "linux"
69
+ test_start "environment_linux_detection"
70
+ if [[ "$(uname -s)" == "Linux" ]]; then
71
+ result=$(environment 2>/dev/null)
72
+ assert_equals "linux" "$result" "should return 'linux' on Linux"
73
+ else
74
+ ((TESTS_PASSED++)) || true
75
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: skipped (not Linux)"
76
+ fi
77
+
78
+ print_summary
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck disable=SC1090,SC1091
3
+ # Unit tests for the extract function
4
+ # Tests archive extraction with various formats and edge cases
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ REPO_ROOT="${REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}"
8
+ source "$SCRIPT_DIR/../framework/assertions.sh"
9
+ source "$SCRIPT_DIR/../framework/mocks.sh"
10
+
11
+ # Source the function being tested
12
+ FUNC_FILE="$REPO_ROOT/.chezmoitemplates/functions/extract.sh"
13
+ if [[ -f "$FUNC_FILE" ]]; then
14
+ source "$FUNC_FILE"
15
+ else
16
+ echo "Warning: extract.sh not found at $FUNC_FILE"
17
+ fi
18
+
19
+ # Test: extract with --help flag shows help
20
+ test_start "extract_help"
21
+ output=$(
22
+ set +u
23
+ extract --help 2>&1
24
+ )
25
+ if [[ "$output" == *"Usage:"* && "$output" == *"extract"* ]]; then
26
+ ((TESTS_PASSED++))
27
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: --help shows usage information"
28
+ else
29
+ ((TESTS_FAILED++))
30
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: --help should show usage information"
31
+ fi
32
+
33
+ # Test: extract with --help returns exit code 0
34
+ test_start "extract_help_exit_code"
35
+ (
36
+ set +u
37
+ extract --help >/dev/null 2>&1
38
+ )
39
+ assert_equals "0" "$?" "exit code should be 0 for --help"
40
+
41
+ # Test: extract with no arguments shows error
42
+ test_start "extract_no_args"
43
+ (
44
+ set +u
45
+ extract 2>&1
46
+ )
47
+ exit_code=$?
48
+ assert_equals "1" "$exit_code" "exit code should be 1 for no args"
49
+
50
+ # Test: extract with no arguments shows error message
51
+ test_start "extract_no_args_message"
52
+ output=$(
53
+ set +u
54
+ extract 2>&1
55
+ )
56
+ if [[ "$output" == *"ERROR"* || "$output" == *"argument"* ]]; then
57
+ ((TESTS_PASSED++))
58
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: shows error message for no arguments"
59
+ else
60
+ ((TESTS_FAILED++))
61
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: should show error message for no arguments"
62
+ echo -e " Output: $output"
63
+ fi
64
+
65
+ # Test: extract with nonexistent file shows error
66
+ test_start "extract_nonexistent_file"
67
+ output=$(extract "/nonexistent/file.tar.gz" 2>&1)
68
+ exit_code=$?
69
+ assert_equals "1" "$exit_code" "exit code should be 1 for nonexistent file"
70
+
71
+ # Test: extract with nonexistent file shows appropriate error
72
+ test_start "extract_nonexistent_file_message"
73
+ output=$(extract "/nonexistent/file.tar.gz" 2>&1)
74
+ if [[ "$output" == *"ERROR"* || "$output" == *"not a valid file"* ]]; then
75
+ ((TESTS_PASSED++))
76
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: shows error for nonexistent file"
77
+ else
78
+ ((TESTS_FAILED++))
79
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: should show error for nonexistent file"
80
+ echo -e " Output: $output"
81
+ fi
82
+
83
+ # Test: extract with too many arguments shows error
84
+ test_start "extract_too_many_args"
85
+ output=$(extract "file1.tar" "file2.tar" 2>&1)
86
+ exit_code=$?
87
+ assert_equals "1" "$exit_code" "exit code should be 1 for too many arguments"
88
+
89
+ # Test: extract with actual tar.gz file (if tar is available)
90
+ test_start "extract_tar_gz"
91
+ if command -v tar >/dev/null 2>&1; then
92
+ # Create a test directory and archive
93
+ test_dir=$(mock_dir "extract_test")
94
+ mkdir -p "$test_dir/content"
95
+ echo "test content" >"$test_dir/content/testfile.txt"
96
+
97
+ # Create archive
98
+ archive_file="$test_dir/test.tar.gz"
99
+ (cd "$test_dir" && tar czf test.tar.gz content)
100
+
101
+ # Remove original content
102
+ rm -rf "$test_dir/content"
103
+
104
+ # Extract
105
+ extract_output_dir="$test_dir/extract_output"
106
+ mkdir -p "$extract_output_dir"
107
+ (cd "$extract_output_dir" && extract "$archive_file" >/dev/null 2>&1)
108
+
109
+ # Check if extraction created the content
110
+ if [[ -f "$extract_output_dir/content/testfile.txt" ]]; then
111
+ ((TESTS_PASSED++))
112
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: tar.gz extraction works"
113
+ else
114
+ ((TESTS_FAILED++))
115
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: tar.gz extraction did not produce expected file"
116
+ fi
117
+
118
+ rm -rf "$test_dir"
119
+ else
120
+ ((TESTS_PASSED++))
121
+ echo -e " ${YELLOW}~${NC} $CURRENT_TEST: skipped (tar not available)"
122
+ fi
123
+
124
+ # Test: extract recognizes unsupported extension
125
+ test_start "extract_unsupported_extension"
126
+ # Create a file with unsupported extension
127
+ test_file=$(mock_file "test content")
128
+ mv "$test_file" "${test_file}.unsupported"
129
+ output=$(extract "${test_file}.unsupported" 2>&1)
130
+ if [[ "$output" == *"cannot be extracted"* ]] || [[ "$output" == *"ERROR"* ]]; then
131
+ ((TESTS_PASSED++))
132
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: unsupported extension handled"
133
+ else
134
+ ((TESTS_FAILED++))
135
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: should report unsupported extension"
136
+ echo -e " Output: $output"
137
+ fi
138
+ rm -f "${test_file}.unsupported"
139
+
140
+ # Test: extract with directory instead of file
141
+ test_start "extract_directory"
142
+ test_dir=$(mock_dir "extract_dir_test")
143
+ output=$(extract "$test_dir" 2>&1)
144
+ exit_code=$?
145
+ # Should fail because directories are not files
146
+ if [[ "$exit_code" -ne 0 ]] || [[ "$output" == *"ERROR"* ]] || [[ "$output" == *"not a valid file"* ]]; then
147
+ ((TESTS_PASSED++))
148
+ echo -e " ${GREEN}✓${NC} $CURRENT_TEST: directory correctly rejected"
149
+ else
150
+ ((TESTS_FAILED++))
151
+ echo -e " ${RED}✗${NC} $CURRENT_TEST: should reject directories"
152
+ fi
153
+ rm -rf "$test_dir"
154
+
155
+ # Test: extract with empty filename
156
+ test_start "extract_empty_filename"
157
+ output=$(extract "" 2>&1)
158
+ exit_code=$?
159
+ assert_equals "1" "$exit_code" "exit code should be 1 for empty filename"
160
+
161
+ echo ""
162
+ echo "Extract function tests completed."
163
+ echo "RESULTS:$TESTS_RUN:$TESTS_PASSED:$TESTS_FAILED"
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env bash
2
+ # shellcheck disable=SC1090,SC1091,SC2034
3
+ # Unit tests for the test framework itself (assertions.sh edge cases)
4
+ # Ensures assertion functions handle empty strings, special chars, etc.
5
+ set -euo pipefail
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ REPO_ROOT="${REPO_ROOT:-$(cd "$SCRIPT_DIR/../../.." && pwd)}"
9
+ source "$SCRIPT_DIR/../framework/assertions.sh"
10
+ source "$SCRIPT_DIR/../framework/mocks.sh"
11
+
12
+ echo "Testing assertion framework edge cases..."
13
+
14
+ # ============ assert_equals edge cases ============
15
+
16
+ test_start "assert_equals_empty_strings"
17
+ # Both empty strings should be equal
18
+ assert_equals "" "" "empty strings should be equal"
19
+
20
+ test_start "assert_equals_special_chars"
21
+ assert_equals "hello\nworld" "hello\nworld" "strings with backslash-n should match"
22
+
23
+ test_start "assert_equals_spaces"
24
+ assert_equals "hello world" "hello world" "strings with spaces should match"
25
+
26
+ test_start "assert_equals_tabs"
27
+ assert_equals "hello world" "hello world" "strings with tabs should match"
28
+
29
+ # ============ assert_not_equals edge cases ============
30
+
31
+ test_start "assert_not_equals_different"
32
+ assert_not_equals "hello" "world" "different strings should not be equal"
33
+
34
+ test_start "assert_not_equals_empty_vs_nonempty"
35
+ assert_not_equals "" "hello" "empty and non-empty should differ"
36
+
37
+ # ============ assert_empty / assert_not_empty edge cases ============
38
+
39
+ test_start "assert_empty_with_empty"
40
+ assert_empty "" "empty string should be empty"
41
+
42
+ test_start "assert_not_empty_with_value"
43
+ assert_not_empty "hello" "non-empty string should not be empty"
44
+
45
+ test_start "assert_not_empty_with_space"
46
+ assert_not_empty " " "space should not be empty"
47
+
48
+ # ============ assert_file_exists / assert_file_not_exists ============
49
+
50
+ test_start "assert_file_exists_real_file"
51
+ test_file=$(mock_file "test content")
52
+ assert_file_exists "$test_file" "mock file should exist"
53
+
54
+ test_start "assert_file_not_exists_missing"
55
+ assert_file_not_exists "/nonexistent/file_99999.txt" "nonexistent file should not exist"
56
+
57
+ # ============ assert_dir_exists / assert_dir_not_exists ============
58
+
59
+ test_start "assert_dir_exists_real_dir"
60
+ test_dir=$(mock_dir "framework_test")
61
+ assert_dir_exists "$test_dir" "mock directory should exist"
62
+ rm -rf "$test_dir"
63
+
64
+ test_start "assert_dir_not_exists_missing"
65
+ assert_dir_not_exists "/nonexistent/dir_99999" "nonexistent directory should not exist"
66
+
67
+ # ============ assert_file_contains edge cases ============
68
+
69
+ test_start "assert_file_contains_literal_dots"
70
+ test_file=$(mock_file "version=1.2.3")
71
+ assert_file_contains "$test_file" "1.2.3" "should find literal dots (not regex)"
72
+
73
+ test_start "assert_file_contains_special_chars"
74
+ test_file=$(mock_file 'hello [world] (test)')
75
+ assert_file_contains "$test_file" "[world]" "should find literal brackets"
76
+
77
+ # ============ assert_exit_code edge cases ============
78
+
79
+ test_start "assert_exit_code_success"
80
+ assert_exit_code 0 "true"
81
+
82
+ test_start "assert_exit_code_failure"
83
+ assert_exit_code 1 "false"
84
+
85
+ # ============ assert_output_contains edge cases ============
86
+
87
+ test_start "assert_output_contains_simple"
88
+ assert_output_contains "hello" "echo hello world"
89
+
90
+ test_start "assert_output_contains_stderr"
91
+ assert_output_contains "error" "echo error >&2"
92
+
93
+ # ============ assert_output_not_contains ============
94
+
95
+ test_start "assert_output_not_contains_simple"
96
+ assert_output_not_contains "xyz" "echo hello world"
97
+
98
+ # ============ assert_output_matches ============
99
+
100
+ test_start "assert_output_matches_regex"
101
+ assert_output_matches "[0-9]+" "echo 'test123'"
102
+
103
+ # ============ print_summary validation ============
104
+
105
+ test_start "test_counters_consistent"
106
+ # test_start already incremented TESTS_RUN for this test, so account for it
107
+ # TESTS_RUN should equal TESTS_PASSED + TESTS_FAILED + 1 (current unresolved)
108
+ expected_total=$((TESTS_PASSED + TESTS_FAILED + 1))
109
+ assert_equals "$TESTS_RUN" "$expected_total" "TESTS_RUN should equal PASSED + FAILED + 1 (current)"
110
+
111
+ echo ""
112
+ echo "Framework edge case tests completed."
113
+ print_summary