@sebastienrousseau/dotfiles 0.2.481 → 0.2.499

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 (317) hide show
  1. package/docs/ARCHITECTURE.md +29 -196
  2. package/docs/COMPLIANCE.md +10 -10
  3. package/docs/COPYRIGHT +3 -4
  4. package/docs/OPERATIONS.md +38 -65
  5. package/docs/PLAN.md +3 -3
  6. package/docs/PR_DESCRIPTION.md +85 -84
  7. package/docs/ROADMAP.md +11 -11
  8. package/docs/ROADMAP_legacy.md +556 -0
  9. package/docs/SECURITY_CHECKLIST.md +1 -1
  10. package/docs/TASK.md +4 -4
  11. package/docs/WALKTHROUGH.md +33 -152
  12. package/package.json +17 -5
  13. package/scripts/backup.sh +142 -0
  14. package/scripts/banner.sh +20 -0
  15. package/scripts/benchmark.sh +20 -0
  16. package/scripts/build.sh +41 -0
  17. package/scripts/clean.sh +31 -0
  18. package/scripts/compile.sh +54 -0
  19. package/scripts/copy.sh +108 -0
  20. package/scripts/{tools/detect-collisions.py → detect-collisions.py} +1 -1
  21. package/scripts/doctor.sh +79 -0
  22. package/scripts/dotfiles.sh +63 -0
  23. package/scripts/download.sh +35 -0
  24. package/scripts/help.sh +57 -0
  25. package/scripts/lock-configs.sh +57 -0
  26. package/scripts/package.sh +46 -0
  27. package/scripts/ssh.sh +55 -0
  28. package/scripts/teleport.sh +23 -0
  29. package/scripts/{tests/test-aliases.sh → test-aliases.sh} +3 -3
  30. package/scripts/test_smoke.sh +88 -0
  31. package/scripts/unpack.sh +28 -0
  32. package/scripts/{diagnostics/verify_state.sh → verify_state.sh} +21 -21
  33. package/templates/projects/go/README.md +0 -4
  34. package/templates/projects/node/README.md +0 -4
  35. package/templates/projects/python/README.md +0 -4
  36. package/templates/projects/python/pyproject.toml +0 -15
  37. package/CHANGELOG.md +0 -285
  38. package/LICENSE +0 -1283
  39. package/README.md +0 -315
  40. package/docs/ALIASES.md +0 -128
  41. package/docs/FEATURES.md +0 -166
  42. package/docs/FONTS.md +0 -147
  43. package/docs/INSTALL.md +0 -119
  44. package/docs/KEYS.md +0 -40
  45. package/docs/KEY_ROTATION.md +0 -219
  46. package/docs/LEGACY_ROADMAP.md +0 -142
  47. package/docs/NEOVIM_IDE_GUIDE.md +0 -52
  48. package/docs/README.md +0 -269
  49. package/docs/REPO_AUDIT.md +0 -23
  50. package/docs/SCREENSHOTS.md +0 -116
  51. package/docs/SECRETS.md +0 -76
  52. package/docs/SECURITY.md +0 -30
  53. package/docs/TESTING.md +0 -190
  54. package/docs/TOOLS.md +0 -146
  55. package/docs/TROUBLESHOOTING.md +0 -112
  56. package/docs/UTILS.md +0 -105
  57. package/docs/WSL2_NIX_TROUBLESHOOTING.md +0 -723
  58. package/docs/adr/ADR-001-ci-cd-pipeline.md +0 -101
  59. package/docs/adr/ADR-002-shell-performance.md +0 -121
  60. package/docs/adr/ADR-003-security-first.md +0 -140
  61. package/docs/adr/ADR-004-cli-architecture.md +0 -157
  62. package/docs/adr/ADR-005-chezmoi-choice.md +0 -89
  63. package/docs/adr/ADR-006-shell-selection.md +0 -115
  64. package/docs/adr/README.md +0 -33
  65. package/docs/themes/README.md +0 -20
  66. package/dot_config/aider/aider.conf.yml +0 -32
  67. package/dot_config/alacritty/alacritty.toml.tmpl +0 -483
  68. package/dot_config/ansible/ansible.cfg.tmpl +0 -11
  69. package/dot_config/atuin/config.toml +0 -23
  70. package/dot_config/bat/config +0 -8
  71. package/dot_config/brave-flags.conf.tmpl +0 -7
  72. package/dot_config/btop/btop.conf +0 -16
  73. package/dot_config/btop/themes/tokyonight.theme +0 -34
  74. package/dot_config/bun/bunfig.toml.tmpl +0 -33
  75. package/dot_config/claude/mcp_servers.json +0 -49
  76. package/dot_config/clippy.toml +0 -55
  77. package/dot_config/containers/containers.conf +0 -14
  78. package/dot_config/curl/dot_curlrc +0 -18
  79. package/dot_config/dlv/config.yml +0 -39
  80. package/dot_config/docker/config.json.tmpl +0 -15
  81. package/dot_config/dotfiles/boot/README.md +0 -11
  82. package/dot_config/dotfiles/grub/README.md +0 -11
  83. package/dot_config/dotfiles/lock/README.md +0 -11
  84. package/dot_config/dotfiles/versions.env.tmpl +0 -19
  85. package/dot_config/duf/duf.conf +0 -6
  86. package/dot_config/duti/defaults.duti +0 -5
  87. package/dot_config/emoji/emoji.txt +0 -34
  88. package/dot_config/fastfetch/config.jsonc +0 -28
  89. package/dot_config/firefox/user.js +0 -8
  90. package/dot_config/flatpak/flatpak.list +0 -4
  91. package/dot_config/fontconfig/fonts.conf.tmpl +0 -44
  92. package/dot_config/gem/gemrc +0 -9
  93. package/dot_config/gh/config.yml +0 -12
  94. package/dot_config/ghostty/config.tmpl +0 -661
  95. package/dot_config/git/attributes +0 -12
  96. package/dot_config/git/config.tmpl +0 -77
  97. package/dot_config/git/ignore +0 -27
  98. package/dot_config/gnupg/gpg-agent.conf.tmpl +0 -11
  99. package/dot_config/go/aliases.sh +0 -61
  100. package/dot_config/go/env.sh +0 -24
  101. package/dot_config/go/golangci.yml +0 -118
  102. package/dot_config/go/gopls.json +0 -30
  103. package/dot_config/goose/config.yaml +0 -29
  104. package/dot_config/gtk-3.0/gtk.css.tmpl +0 -305
  105. package/dot_config/gtk-3.0/settings.ini.tmpl +0 -66
  106. package/dot_config/gtk-4.0/gtk.css.tmpl +0 -309
  107. package/dot_config/gtk-4.0/settings.ini.tmpl +0 -21
  108. package/dot_config/htop/htoprc +0 -20
  109. package/dot_config/ice/README.md +0 -13
  110. package/dot_config/inputrc +0 -2
  111. package/dot_config/ipython/profile_default/ipython_config.py.tmpl +0 -5
  112. package/dot_config/just/justfile +0 -104
  113. package/dot_config/k9s/config.yaml.tmpl +0 -65
  114. package/dot_config/k9s/skins/catppuccin-mocha.yaml +0 -116
  115. package/dot_config/karabiner/karabiner.json +0 -14
  116. package/dot_config/kitty/kitty.conf.tmpl +0 -517
  117. package/dot_config/lazydocker/config.yml +0 -186
  118. package/dot_config/lazygit/config.yml +0 -23
  119. package/dot_config/lsd/config.yaml +0 -19
  120. package/dot_config/mas/masapps.txt +0 -5
  121. package/dot_config/minikube/config.json +0 -13
  122. package/dot_config/mise/config.toml +0 -41
  123. package/dot_config/mongosh/mongoshrc.js +0 -67
  124. package/dot_config/mycli/myclirc +0 -67
  125. package/dot_config/nano/nanorc +0 -28
  126. package/dot_config/ncdu/config +0 -12
  127. package/dot_config/nvim/init.lua +0 -4
  128. package/dot_config/nvim/lazy-lock.json +0 -27
  129. package/dot_config/nvim/lua/config/autocmds.lua +0 -63
  130. package/dot_config/nvim/lua/config/keymaps.lua +0 -87
  131. package/dot_config/nvim/lua/config/lazy.lua +0 -34
  132. package/dot_config/nvim/lua/config/options.lua +0 -48
  133. package/dot_config/nvim/lua/plugins/coding.lua +0 -234
  134. package/dot_config/nvim/lua/plugins/dap.lua +0 -201
  135. package/dot_config/nvim/lua/plugins/editor.lua +0 -59
  136. package/dot_config/nvim/lua/plugins/git.lua +0 -9
  137. package/dot_config/nvim/lua/plugins/lsp.lua +0 -221
  138. package/dot_config/nvim/lua/plugins/markdown.lua +0 -17
  139. package/dot_config/nvim/lua/plugins/rust.lua +0 -33
  140. package/dot_config/nvim/lua/plugins/sessions.lua +0 -32
  141. package/dot_config/nvim/lua/plugins/ui.lua +0 -537
  142. package/dot_config/nvim/snippets/all.lua +0 -9
  143. package/dot_config/nvim/snippets/python.lua +0 -16
  144. package/dot_config/pip/pip.conf.tmpl +0 -32
  145. package/dot_config/pypoetry/config.toml.tmpl +0 -6
  146. package/dot_config/pyrightconfig.json.tmpl +0 -5
  147. package/dot_config/raycast/README.md +0 -13
  148. package/dot_config/redis/redisclirc +0 -41
  149. package/dot_config/shell/00-container-detect.sh +0 -53
  150. package/dot_config/shell/00-core-paths.sh.tmpl +0 -95
  151. package/dot_config/shell/05-core-safety.sh.tmpl +0 -13
  152. package/dot_config/shell/40-ls-colors.sh.tmpl +0 -31
  153. package/dot_config/shell/50-logic-functions.sh.tmpl +0 -10
  154. package/dot_config/shell/90-theme-switch.sh +0 -70
  155. package/dot_config/shell/90-ux-aliases.sh.tmpl +0 -35
  156. package/dot_config/shell/91-ux-aliases-lazy.sh.tmpl +0 -23
  157. package/dot_config/shell/Brewfile +0 -207
  158. package/dot_config/shell/Brewfile.cask +0 -92
  159. package/dot_config/shell/Brewfile.cli +0 -119
  160. package/dot_config/shell/README.md +0 -267
  161. package/dot_config/shell/custom/context_suggest.zsh +0 -68
  162. package/dot_config/shell/custom/error_analysis.zsh +0 -45
  163. package/dot_config/sops/dot_sops.yaml +0 -23
  164. package/dot_config/starship.toml.tmpl +0 -124
  165. package/dot_config/task/Taskfile.yml +0 -86
  166. package/dot_config/tflint/tflint.hcl.tmpl +0 -9
  167. package/dot_config/tmux/tmux.conf.tmpl +0 -181
  168. package/dot_config/topgrade/topgrade.toml.tmpl +0 -42
  169. package/dot_config/vscode/extensions.txt +0 -11
  170. package/dot_config/vscode/settings.json.tmpl +0 -123
  171. package/dot_config/waybar/style.css +0 -8
  172. package/dot_config/wezterm/wezterm.lua.tmpl +0 -236
  173. package/dot_config/wget/wgetrc +0 -12
  174. package/dot_config/yarn/yarnrc.yml.tmpl +0 -36
  175. package/dot_config/yazi/yazi.toml +0 -40
  176. package/dot_config/zellij/config.kdl +0 -79
  177. package/dot_config/zsh/dot_zprofile +0 -13
  178. package/dot_config/zsh/dot_zshenv +0 -6
  179. package/dot_config/zsh/dot_zshrc.tmpl +0 -199
  180. package/dot_config/zsh/rc.d/05-ssh-agent.zsh +0 -5
  181. package/dot_config/zsh/rc.d/10-env.zsh.tmpl +0 -28
  182. package/dot_config/zsh/rc.d/20-zinit.zsh.tmpl +0 -22
  183. package/dot_config/zsh/rc.d/30-options.zsh.tmpl +0 -123
  184. package/dot_config/zsh/rc.d/40-bell.zsh.tmpl +0 -20
  185. package/dot_config/zsh/rc.d/50-login-fortune.zsh.tmpl +0 -9
  186. package/dot_local/bin/executable_ai_core +0 -130
  187. package/dot_local/bin/executable_b64 +0 -59
  188. package/dot_local/bin/executable_dot +0 -178
  189. package/dot_local/bin/executable_dot_completion +0 -55
  190. package/dot_local/bin/executable_epoch +0 -62
  191. package/dot_local/bin/executable_extract +0 -108
  192. package/dot_local/bin/executable_git-ai-commit +0 -160
  193. package/dot_local/bin/executable_git-ai-diff +0 -154
  194. package/dot_local/bin/executable_hash +0 -123
  195. package/dot_local/bin/executable_hex +0 -79
  196. package/dot_local/bin/executable_ip +0 -37
  197. package/dot_local/bin/executable_jsonv +0 -54
  198. package/dot_local/bin/executable_jwt +0 -78
  199. package/dot_local/bin/executable_kill-port +0 -59
  200. package/dot_local/bin/executable_lorem +0 -103
  201. package/dot_local/bin/executable_regex +0 -96
  202. package/dot_local/bin/executable_tmux-sessionizer +0 -187
  203. package/dot_local/bin/executable_tour +0 -137
  204. package/dot_local/bin/executable_update +0 -108
  205. package/dot_local/bin/executable_uuid +0 -57
  206. package/dot_local/bin/executable_yamlv +0 -39
  207. package/dot_local/bin/executable_zig-install +0 -89
  208. package/dot_local/bin/voice_ops +0 -7
  209. package/dot_local/share/bash-completion/completions/dot +0 -54
  210. package/dot_local/share/zsh/completions/.keep +0 -0
  211. package/install.sh +0 -255
  212. package/scripts/ci/validate-ci-config.sh +0 -222
  213. package/scripts/demo/record.sh +0 -41
  214. package/scripts/diagnostics/benchmark.sh +0 -201
  215. package/scripts/diagnostics/doctor.sh +0 -115
  216. package/scripts/diagnostics/drift-dashboard.sh +0 -26
  217. package/scripts/diagnostics/health.sh +0 -356
  218. package/scripts/diagnostics/history-analysis.sh +0 -77
  219. package/scripts/diagnostics/security-score.sh +0 -392
  220. package/scripts/dot/commands/appearance.sh +0 -63
  221. package/scripts/dot/commands/core.sh +0 -130
  222. package/scripts/dot/commands/diagnostics.sh +0 -100
  223. package/scripts/dot/commands/meta.sh +0 -117
  224. package/scripts/dot/commands/restore.sh +0 -209
  225. package/scripts/dot/commands/secrets.sh +0 -81
  226. package/scripts/dot/commands/security.sh +0 -73
  227. package/scripts/dot/commands/tools.sh +0 -228
  228. package/scripts/dot/lib/utils.sh +0 -72
  229. package/scripts/fonts/install-nerd-fonts.sh +0 -59
  230. package/scripts/fonts/patch-fonts.sh +0 -34
  231. package/scripts/ops/chezmoi-apply.sh +0 -42
  232. package/scripts/ops/chezmoi-diff.sh +0 -14
  233. package/scripts/ops/chezmoi-remove.sh +0 -43
  234. package/scripts/ops/chezmoi-update.sh +0 -16
  235. package/scripts/ops/heal.sh +0 -466
  236. package/scripts/ops/health-check.sh +0 -380
  237. package/scripts/ops/rollback.sh +0 -531
  238. package/scripts/ops/teleport.sh +0 -32
  239. package/scripts/secrets/age-init.sh +0 -69
  240. package/scripts/secrets/create-secrets-file.sh +0 -44
  241. package/scripts/secrets/encrypt-ssh-key.sh +0 -42
  242. package/scripts/security/backup.sh +0 -17
  243. package/scripts/security/dns-doh.sh +0 -29
  244. package/scripts/security/encryption-check.sh +0 -39
  245. package/scripts/security/enforce-policies.sh +0 -339
  246. package/scripts/security/firewall.sh +0 -34
  247. package/scripts/security/lock-configs.sh +0 -57
  248. package/scripts/security/lock-screen.sh +0 -33
  249. package/scripts/security/manage-secrets.sh +0 -415
  250. package/scripts/security/telemetry-kill.sh +0 -28
  251. package/scripts/security/usb-safety.sh +0 -29
  252. package/scripts/tests/README.md +0 -241
  253. package/scripts/tests/benchmark.sh +0 -91
  254. package/scripts/tests/framework/assertions.sh +0 -283
  255. package/scripts/tests/framework/mocks.sh +0 -201
  256. package/scripts/tests/framework/test_runner.sh +0 -189
  257. package/scripts/tests/integration/test_install.sh +0 -237
  258. package/scripts/tests/performance/benchmark_runner.sh +0 -156
  259. package/scripts/tests/performance/regression_check.sh +0 -73
  260. package/scripts/tests/performance/stress_test.sh +0 -65
  261. package/scripts/tests/test-docker.sh +0 -48
  262. package/scripts/tests/unit/test_ai_aliases.sh +0 -158
  263. package/scripts/tests/unit/test_ai_cli_checks.sh +0 -47
  264. package/scripts/tests/unit/test_backup.sh +0 -227
  265. package/scripts/tests/unit/test_case_functions.sh +0 -238
  266. package/scripts/tests/unit/test_cd_aliases.sh +0 -367
  267. package/scripts/tests/unit/test_dot_cli.sh +0 -217
  268. package/scripts/tests/unit/test_encode64.sh +0 -67
  269. package/scripts/tests/unit/test_environment.sh +0 -78
  270. package/scripts/tests/unit/test_extract.sh +0 -163
  271. package/scripts/tests/unit/test_framework_edge_cases.sh +0 -113
  272. package/scripts/tests/unit/test_genpass.sh +0 -298
  273. package/scripts/tests/unit/test_install_edge_cases.sh +0 -167
  274. package/scripts/tests/unit/test_installers.sh +0 -172
  275. package/scripts/tests/unit/test_keygen.sh +0 -68
  276. package/scripts/tests/unit/test_logging.sh +0 -96
  277. package/scripts/tests/unit/test_os_detection_comprehensive.sh +0 -388
  278. package/scripts/tests/unit/test_package_managers_comprehensive.sh +0 -321
  279. package/scripts/tests/unit/test_prependpath.sh +0 -66
  280. package/scripts/tests/unit/test_prependpath_refactored.sh +0 -89
  281. package/scripts/tests/unit/test_rd.sh +0 -230
  282. package/scripts/tests/unit/test_security_fixes.sh +0 -130
  283. package/scripts/tests/unit/test_security_scripts.sh +0 -87
  284. package/scripts/tests/unit/test_template_validation.sh +0 -238
  285. package/scripts/tests/unit/test_utility_functions.sh +0 -144
  286. package/scripts/tests/unit/test_wave1_alias_split.sh +0 -132
  287. package/scripts/tests/unit/test_wave1_ci_pinning.sh +0 -61
  288. package/scripts/tests/unit/test_wave1_gitleaks_config.sh +0 -52
  289. package/scripts/tests/unit/test_wave1_heal_fixes.sh +0 -97
  290. package/scripts/tests/unit/test_wave1_install_gpg.sh +0 -35
  291. package/scripts/tests/unit/test_wave1_zshenv_path.sh +0 -89
  292. package/scripts/tests/unit/test_wave1_zshrc_lazy_hook.sh +0 -115
  293. package/scripts/tests/unit/test_wave2_dot_new_guard.sh +0 -75
  294. package/scripts/tests/unit/test_zipf.sh +0 -76
  295. package/scripts/theme/apply-gnome-theme.sh +0 -297
  296. package/scripts/theme/install-boot-logo.sh +0 -61
  297. package/scripts/theme/install-catppuccin-themes.sh +0 -346
  298. package/scripts/theme/install-cursors.sh +0 -24
  299. package/scripts/theme/install-file-icons.sh +0 -25
  300. package/scripts/theme/install-grub-theme.sh +0 -51
  301. package/scripts/theme/install-lock-icon.sh +0 -29
  302. package/scripts/theme/switch.sh +0 -250
  303. package/scripts/theme/wallpaper-rotate.sh +0 -82
  304. package/scripts/theme/wallpaper-sync.sh +0 -42
  305. package/scripts/tools/cmatrix.sh +0 -20
  306. package/scripts/tools/emoji-picker.sh +0 -45
  307. package/scripts/tools/figlet-banner.sh +0 -17
  308. package/scripts/tools/log-rotate.sh +0 -29
  309. package/scripts/tools/lolcat-wrap.sh +0 -18
  310. package/scripts/tools/pipes.sh +0 -47
  311. package/scripts/tuning/linux.sh +0 -175
  312. package/scripts/tuning/macos.sh +0 -46
  313. package/templates/projects/molecule/README.md +0 -7
  314. package/templates/projects/molecule/converge.yml +0 -7
  315. package/templates/projects/molecule/molecule.yml +0 -16
  316. package/templates/projects/packer/README.md +0 -15
  317. package/templates/projects/packer/main.pkr.hcl +0 -15
@@ -1,189 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck disable=SC1090,SC1091,SC2034
3
- # Main test runner for dotfiles test suite
4
- # Discovers and runs all test files, reports results
5
-
6
- set -euo pipefail
7
-
8
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
- TESTS_DIR="$(dirname "$SCRIPT_DIR")"
10
- REPO_ROOT="$(dirname "$(dirname "$TESTS_DIR")")"
11
-
12
- if [[ ! -d "$REPO_ROOT" ]]; then
13
- echo "Error: REPO_ROOT is not a valid directory: $REPO_ROOT" >&2
14
- exit 1
15
- fi
16
-
17
- # Export paths for test files
18
- export TESTS_DIR
19
- export REPO_ROOT
20
- export FRAMEWORK_DIR="$SCRIPT_DIR"
21
-
22
- # Run a single test file and capture results
23
- run_test_file() {
24
- local test_file="$1"
25
- local temp_results
26
- temp_results=$(mktemp)
27
-
28
- echo ""
29
- echo "Running: $(basename "$test_file")"
30
- echo "─────────────────────────────────────"
31
-
32
- # Run test as a separate process (not subshell with source)
33
- # This avoids trap interference from double-sourcing framework files
34
- local exit_status=0
35
- bash "$test_file" 2>&1 | tee "$temp_results" || exit_status=$?
36
-
37
- # Parse results from output
38
- local results_line
39
- results_line=$(grep "^RESULTS:" "$temp_results" | tail -1) || true
40
- if [[ -n "$results_line" ]]; then
41
- local run passed failed
42
- IFS=':' read -r _ run passed failed <<<"$results_line"
43
- TOTAL_TESTS_RUN=$((TOTAL_TESTS_RUN + run))
44
- TOTAL_TESTS_PASSED=$((TOTAL_TESTS_PASSED + passed))
45
- TOTAL_TESTS_FAILED=$((TOTAL_TESTS_FAILED + failed))
46
- elif [[ $exit_status -ne 0 ]]; then
47
- # Test file crashed without producing RESULTS -- count as failure
48
- echo -e "\033[0;31mERROR: $(basename "$test_file") crashed (exit $exit_status) without producing results\033[0m"
49
- TOTAL_TESTS_RUN=$((TOTAL_TESTS_RUN + 1))
50
- TOTAL_TESTS_FAILED=$((TOTAL_TESTS_FAILED + 1))
51
- fi
52
-
53
- rm -f "$temp_results"
54
- }
55
-
56
- # Show usage
57
- usage() {
58
- cat <<EOF
59
- Dotfiles Test Runner
60
-
61
- Usage:
62
- $(basename "$0") [options] [pattern]
63
-
64
- Options:
65
- -h, --help Show this help message
66
- -v, --verbose Verbose output
67
- -i, --integration Include integration tests
68
- -u, --unit-only Run only unit tests
69
-
70
- Arguments:
71
- pattern Run only tests matching pattern (e.g., 'extract', 'backup')
72
-
73
- Examples:
74
- $(basename "$0") # Run all unit tests
75
- $(basename "$0") extract # Run only extract tests
76
- $(basename "$0") -i # Run unit and integration tests
77
- RUN_INTEGRATION=1 $(basename "$0") # Alternative way to run integration tests
78
-
79
- Environment Variables:
80
- RUN_INTEGRATION=1 Enable integration tests
81
- VERBOSE=1 Enable verbose output
82
- EOF
83
- }
84
-
85
- main() {
86
- local test_pattern="*"
87
- local run_integration="${RUN_INTEGRATION:-0}"
88
- local verbose="${VERBOSE:-0}"
89
- local unit_only=0
90
-
91
- # Initialize global counters
92
- TOTAL_TESTS_RUN=0
93
- TOTAL_TESTS_PASSED=0
94
- TOTAL_TESTS_FAILED=0
95
-
96
- # Parse arguments
97
- while [[ $# -gt 0 ]]; do
98
- case "$1" in
99
- -h | --help)
100
- usage
101
- exit 0
102
- ;;
103
- -v | --verbose)
104
- verbose=1
105
- shift
106
- ;;
107
- -i | --integration)
108
- run_integration=1
109
- shift
110
- ;;
111
- -u | --unit-only)
112
- unit_only=1
113
- shift
114
- ;;
115
- -*)
116
- echo "Unknown option: $1" >&2
117
- usage
118
- exit 1
119
- ;;
120
- *)
121
- test_pattern="$1"
122
- shift
123
- ;;
124
- esac
125
- done
126
-
127
- echo "╔═══════════════════════════════════════╗"
128
- echo "║ Dotfiles Test Suite ║"
129
- echo "╚═══════════════════════════════════════╝"
130
- echo ""
131
- echo "Repository: $REPO_ROOT"
132
- echo "Tests Dir: $TESTS_DIR"
133
- echo ""
134
-
135
- local test_count=0
136
-
137
- # Run unit tests
138
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
139
- echo "UNIT TESTS"
140
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
141
-
142
- for test_file in "$TESTS_DIR"/unit/test_${test_pattern}.sh; do
143
- if [[ -f "$test_file" ]]; then
144
- run_test_file "$test_file"
145
- ((test_count++)) || true
146
- fi
147
- done
148
-
149
- if [[ $test_count -eq 0 ]]; then
150
- echo "No unit tests found matching pattern: $test_pattern"
151
- fi
152
-
153
- # Run integration tests if requested
154
- if [[ "$run_integration" == "1" && "$unit_only" != "1" ]]; then
155
- echo ""
156
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
157
- echo "INTEGRATION TESTS"
158
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
159
-
160
- local integration_count=0
161
- for test_file in "$TESTS_DIR"/integration/test_*.sh; do
162
- if [[ -f "$test_file" ]]; then
163
- run_test_file "$test_file"
164
- ((integration_count++)) || true
165
- fi
166
- done
167
-
168
- if [[ $integration_count -eq 0 ]]; then
169
- echo "No integration tests found."
170
- fi
171
- fi
172
-
173
- # Print final summary
174
- echo ""
175
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
176
- echo "FINAL SUMMARY"
177
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
178
- echo -e "Total tests run: $TOTAL_TESTS_RUN"
179
- echo -e "\033[0;32mTotal passed: $TOTAL_TESTS_PASSED\033[0m"
180
- echo -e "\033[0;31mTotal failed: $TOTAL_TESTS_FAILED\033[0m"
181
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
182
-
183
- if [[ $TOTAL_TESTS_FAILED -gt 0 ]]; then
184
- exit 1
185
- fi
186
- exit 0
187
- }
188
-
189
- main "$@"
@@ -1,237 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck disable=SC1090,SC1091
3
- # Integration tests for install.sh
4
- # Tests the dotfiles installation process in isolation
5
-
6
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
- source "$SCRIPT_DIR/../framework/assertions.sh"
8
- source "$SCRIPT_DIR/../framework/mocks.sh"
9
-
10
- INSTALL_SCRIPT="$REPO_ROOT/install.sh"
11
-
12
- # Test: install.sh exists
13
- test_start "install_script_exists"
14
- assert_file_exists "$INSTALL_SCRIPT" "install.sh should exist"
15
-
16
- # Test: install.sh is executable
17
- test_start "install_script_executable"
18
- if [[ -x "$INSTALL_SCRIPT" ]]; then
19
- ((TESTS_PASSED++))
20
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: install.sh is executable"
21
- else
22
- ((TESTS_FAILED++))
23
- echo -e " ${RED}✗${NC} $CURRENT_TEST: install.sh should be executable"
24
- fi
25
-
26
- # Test: install.sh has shebang
27
- test_start "install_script_shebang"
28
- first_line=$(head -n 1 "$INSTALL_SCRIPT")
29
- if [[ "$first_line" == "#!/"* ]]; then
30
- ((TESTS_PASSED++))
31
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: has proper shebang"
32
- else
33
- ((TESTS_FAILED++))
34
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should have shebang"
35
- fi
36
-
37
- # Test: install.sh uses set -e
38
- test_start "install_script_set_e"
39
- if grep -q "set -e" "$INSTALL_SCRIPT"; then
40
- ((TESTS_PASSED++))
41
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: uses set -e for error handling"
42
- else
43
- ((TESTS_FAILED++))
44
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should use set -e"
45
- fi
46
-
47
- # Test: install.sh defines step function
48
- test_start "install_script_step_function"
49
- if grep -q "step()" "$INSTALL_SCRIPT"; then
50
- ((TESTS_PASSED++))
51
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: defines step function"
52
- else
53
- ((TESTS_FAILED++))
54
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should define step function"
55
- fi
56
-
57
- # Test: install.sh defines error function
58
- test_start "install_script_error_function"
59
- if grep -q "error()" "$INSTALL_SCRIPT"; then
60
- ((TESTS_PASSED++))
61
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: defines error function"
62
- else
63
- ((TESTS_FAILED++))
64
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should define error function"
65
- fi
66
-
67
- # Test: install.sh checks for curl
68
- test_start "install_script_curl_check"
69
- if grep -q "curl" "$INSTALL_SCRIPT" && grep -q "command -v curl" "$INSTALL_SCRIPT"; then
70
- ((TESTS_PASSED++))
71
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: checks for curl dependency"
72
- else
73
- ((TESTS_FAILED++))
74
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should check for curl"
75
- fi
76
-
77
- # Test: install.sh checks for git
78
- test_start "install_script_git_check"
79
- if grep -q "git" "$INSTALL_SCRIPT" && grep -q "command -v git" "$INSTALL_SCRIPT"; then
80
- ((TESTS_PASSED++))
81
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: checks for git dependency"
82
- else
83
- ((TESTS_FAILED++))
84
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should check for git"
85
- fi
86
-
87
- # Test: install.sh detects OS
88
- test_start "install_script_os_detection"
89
- if grep -q "uname" "$INSTALL_SCRIPT"; then
90
- ((TESTS_PASSED++))
91
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: detects OS using uname"
92
- else
93
- ((TESTS_FAILED++))
94
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should detect OS"
95
- fi
96
-
97
- # Test: install.sh has version pinning
98
- test_start "install_script_version_pin"
99
- if grep -q "CHEZMOI_VERSION" "$INSTALL_SCRIPT" || grep -q "VERSION=" "$INSTALL_SCRIPT"; then
100
- ((TESTS_PASSED++))
101
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: has version pinning for security"
102
- else
103
- ((TESTS_FAILED++))
104
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should have version pinning"
105
- fi
106
-
107
- # Test: install.sh installs chezmoi via brew or get.chezmoi.io
108
- test_start "install_script_chezmoi_install"
109
- if grep -q "brew install chezmoi" "$INSTALL_SCRIPT" && grep -q "get.chezmoi.io" "$INSTALL_SCRIPT"; then
110
- ((TESTS_PASSED++))
111
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: installs chezmoi via brew or get.chezmoi.io"
112
- else
113
- ((TESTS_FAILED++))
114
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should install chezmoi via brew or get.chezmoi.io"
115
- fi
116
-
117
- # Test: install.sh creates backup
118
- test_start "install_script_backup"
119
- if grep -q "backup" "$INSTALL_SCRIPT" || grep -q "\.bak" "$INSTALL_SCRIPT"; then
120
- ((TESTS_PASSED++))
121
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: creates backup of existing files"
122
- else
123
- ((TESTS_FAILED++))
124
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should backup existing files"
125
- fi
126
-
127
- # Test: install.sh uses chezmoi
128
- test_start "install_script_chezmoi"
129
- if grep -q "chezmoi" "$INSTALL_SCRIPT"; then
130
- ((TESTS_PASSED++))
131
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: uses chezmoi for dotfile management"
132
- else
133
- ((TESTS_FAILED++))
134
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should use chezmoi"
135
- fi
136
-
137
- # Test: install.sh handles non-interactive mode
138
- test_start "install_script_noninteractive"
139
- if grep -q "NONINTERACTIVE" "$INSTALL_SCRIPT" || grep -q "force" "$INSTALL_SCRIPT"; then
140
- ((TESTS_PASSED++))
141
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: supports non-interactive mode"
142
- else
143
- ((TESTS_FAILED++))
144
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should support non-interactive mode"
145
- fi
146
-
147
- # Test: install.sh backs up managed dotfiles
148
- test_start "install_script_cleanup"
149
- if grep -q "chezmoi managed" "$INSTALL_SCRIPT" && grep -q "cp -a" "$INSTALL_SCRIPT"; then
150
- ((TESTS_PASSED++))
151
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: backs up managed dotfiles before overwriting"
152
- else
153
- ((TESTS_FAILED++))
154
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should back up managed dotfiles"
155
- fi
156
-
157
- # Test: install.sh uses HTTPS
158
- test_start "install_script_https"
159
- if grep -q "https://" "$INSTALL_SCRIPT"; then
160
- ((TESTS_PASSED++))
161
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: uses HTTPS for downloads"
162
- else
163
- ((TESTS_FAILED++))
164
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should use HTTPS"
165
- fi
166
-
167
- # Test: install.sh detects multiple OS types
168
- test_start "install_script_multi_os"
169
- os_count=0
170
- for os_type in "debian" "fedora" "arch" "macos" "wsl2"; do
171
- if grep -q "$os_type" "$INSTALL_SCRIPT"; then
172
- os_count=$((os_count + 1))
173
- fi
174
- done
175
- if [[ $os_count -ge 3 ]]; then
176
- ((TESTS_PASSED++))
177
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: detects $os_count OS types"
178
- else
179
- ((TESTS_FAILED++))
180
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should detect multiple OS types"
181
- fi
182
-
183
- # Test: install.sh supports Linux
184
- test_start "install_script_linux"
185
- if grep -q "linux" "$INSTALL_SCRIPT" || grep -q "Linux" "$INSTALL_SCRIPT"; then
186
- ((TESTS_PASSED++))
187
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: supports Linux"
188
- else
189
- ((TESTS_FAILED++))
190
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should support Linux"
191
- fi
192
-
193
- # Test: install.sh supports macOS
194
- test_start "install_script_macos"
195
- if grep -q "darwin" "$INSTALL_SCRIPT" || grep -q "Darwin" "$INSTALL_SCRIPT"; then
196
- ((TESTS_PASSED++))
197
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: supports macOS"
198
- else
199
- ((TESTS_FAILED++))
200
- echo -e " ${RED}✗${NC} $CURRENT_TEST: should support macOS"
201
- fi
202
-
203
- # Test: Dry run syntax check
204
- test_start "install_script_syntax"
205
- if bash -n "$INSTALL_SCRIPT" 2>/dev/null; then
206
- ((TESTS_PASSED++))
207
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: script has valid bash syntax"
208
- else
209
- ((TESTS_FAILED++))
210
- echo -e " ${RED}✗${NC} $CURRENT_TEST: script has syntax errors"
211
- fi
212
-
213
- # Test: No hardcoded sensitive paths in install
214
- test_start "install_script_no_sensitive_paths"
215
- sensitive_patterns=("password" "secret" "token" "apikey" "api_key")
216
- found_sensitive=false
217
- for pattern in "${sensitive_patterns[@]}"; do
218
- if grep -qi "$pattern" "$INSTALL_SCRIPT" 2>/dev/null | grep -v "^#"; then
219
- found_sensitive=true
220
- break
221
- fi
222
- done
223
-
224
- if [[ "$found_sensitive" == false ]]; then
225
- ((TESTS_PASSED++))
226
- echo -e " ${GREEN}✓${NC} $CURRENT_TEST: no hardcoded sensitive data"
227
- else
228
- ((TESTS_PASSED++)) # Might be false positive
229
- echo -e " ${YELLOW}~${NC} $CURRENT_TEST: review for sensitive data"
230
- fi
231
-
232
- echo ""
233
- echo "Integration tests for install.sh completed."
234
- echo ""
235
- echo "NOTE: These tests verify the install script structure."
236
- echo "Full integration testing should be done in a container/VM."
237
- echo "RESULTS:$TESTS_RUN:$TESTS_PASSED:$TESTS_FAILED"
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck disable=SC1090,SC2015,SC2034,SC2155
3
- set -euo pipefail
4
-
5
- # Performance benchmark runner for shell functions
6
- # Measures execution time and memory usage
7
-
8
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
- REPO_ROOT="$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")")"
10
-
11
- # Results storage for regression tracking
12
- RESULTS_DIR="${RESULTS_DIR:-$HOME/.local/share/dotfiles/benchmarks}"
13
- RESULTS_FILE="$RESULTS_DIR/benchmark_$(date +%Y%m%d_%H%M%S).json"
14
-
15
- # Thresholds (in milliseconds)
16
- # Note: CI environments may be slower, so thresholds are set conservatively
17
- SHELL_STARTUP_THRESHOLD_MS=500
18
- FUNCTION_LOAD_THRESHOLD_MS=200 # Increased for CI compatibility
19
- CD_OPERATION_THRESHOLD_MS=50
20
-
21
- RED='\033[0;31m'
22
- GREEN='\033[0;32m'
23
- YELLOW='\033[0;33m'
24
- NC='\033[0m'
25
-
26
- # Store benchmark result in JSON format for regression tracking
27
- store_result() {
28
- local metric="$1" value="$2" threshold="$3" status="$4"
29
- mkdir -p "$RESULTS_DIR"
30
-
31
- # Append to JSON results
32
- cat >>"$RESULTS_FILE" <<EOF
33
- {"timestamp": "$(date -Iseconds)", "metric": "$metric", "value": $value, "threshold": $threshold, "status": "$status"}
34
- EOF
35
- }
36
-
37
- measure_time_ms() {
38
- local start end
39
- # Use perl for portable millisecond timing (works on macOS and Linux)
40
- if command -v perl >/dev/null 2>&1; then
41
- start=$(perl -MTime::HiRes=time -e 'printf "%.0f\n", time * 1000')
42
- "$@" >/dev/null 2>&1 || true
43
- end=$(perl -MTime::HiRes=time -e 'printf "%.0f\n", time * 1000')
44
- echo $((end - start))
45
- else
46
- # Fallback: use seconds only (less precise but portable)
47
- start=$(date +%s)
48
- "$@" >/dev/null 2>&1 || true
49
- end=$(date +%s)
50
- echo $(((end - start) * 1000))
51
- fi
52
- }
53
-
54
- benchmark_shell_startup() {
55
- echo "Benchmarking shell startup time..."
56
- local total=0
57
- local iterations=5
58
-
59
- for ((i = 1; i <= iterations; i++)); do
60
- local time_ms
61
- time_ms=$(measure_time_ms "zsh -i -c 'exit' 2>/dev/null || bash -i -c 'exit'")
62
- total=$((total + time_ms))
63
- done
64
-
65
- local avg=$((total / iterations))
66
- local status
67
-
68
- if [[ $avg -gt $SHELL_STARTUP_THRESHOLD_MS ]]; then
69
- status="FAIL"
70
- echo -e "${RED}✗ FAIL${NC}: Shell startup ${avg}ms exceeds threshold ${SHELL_STARTUP_THRESHOLD_MS}ms"
71
- store_result "shell_startup" "$avg" "$SHELL_STARTUP_THRESHOLD_MS" "$status"
72
- return 1
73
- else
74
- status="PASS"
75
- echo -e "${GREEN}✓ PASS${NC}: Shell startup ${avg}ms (threshold: ${SHELL_STARTUP_THRESHOLD_MS}ms)"
76
- store_result "shell_startup" "$avg" "$SHELL_STARTUP_THRESHOLD_MS" "$status"
77
- return 0
78
- fi
79
- }
80
-
81
- benchmark_function_sourcing() {
82
- echo "Benchmarking function file sourcing..."
83
- local failures=0
84
-
85
- for func_file in "$REPO_ROOT"/.chezmoitemplates/functions/*.sh; do
86
- [[ -f "$func_file" ]] || continue
87
- local name=$(basename "$func_file")
88
- local time_ms
89
- time_ms=$(measure_time_ms "source '$func_file'")
90
-
91
- if [[ $time_ms -gt $FUNCTION_LOAD_THRESHOLD_MS ]]; then
92
- echo -e "${YELLOW}⚠ WARN${NC}: $name took ${time_ms}ms to source"
93
- ((failures++))
94
- fi
95
- done
96
-
97
- if [[ $failures -eq 0 ]]; then
98
- echo -e "${GREEN}✓ PASS${NC}: All functions load within threshold"
99
- fi
100
- }
101
-
102
- benchmark_memory_usage() {
103
- echo "Benchmarking memory usage..."
104
-
105
- # Get baseline memory
106
- local baseline
107
- baseline=$(ps -o rss= -p $$ | tr -d ' ')
108
-
109
- # Source all functions
110
- for func_file in "$REPO_ROOT"/.chezmoitemplates/functions/*.sh; do
111
- [[ -f "$func_file" ]] && source "$func_file" 2>/dev/null || true
112
- done
113
-
114
- # Get memory after loading
115
- local after
116
- after=$(ps -o rss= -p $$ | tr -d ' ')
117
-
118
- local diff_kb=$((after - baseline))
119
- local diff_mb=$((diff_kb / 1024))
120
- local status
121
-
122
- echo "Memory increase after loading functions: ${diff_mb}MB (${diff_kb}KB)"
123
-
124
- # Fail if memory usage exceeds 50MB
125
- if [[ $diff_mb -gt 50 ]]; then
126
- status="FAIL"
127
- echo -e "${RED}✗ FAIL${NC}: Memory usage ${diff_mb}MB exceeds 50MB threshold"
128
- store_result "memory_usage_kb" "$diff_kb" "51200" "$status"
129
- return 1
130
- else
131
- status="PASS"
132
- echo -e "${GREEN}✓ PASS${NC}: Memory usage within acceptable limits"
133
- store_result "memory_usage_kb" "$diff_kb" "51200" "$status"
134
- return 0
135
- fi
136
- }
137
-
138
- generate_report() {
139
- echo ""
140
- echo "╔═══════════════════════════════════════╗"
141
- echo "║ Performance Benchmark Report ║"
142
- echo "╚═══════════════════════════════════════╝"
143
- echo ""
144
-
145
- benchmark_shell_startup
146
- echo ""
147
- benchmark_function_sourcing
148
- echo ""
149
- benchmark_memory_usage
150
- }
151
-
152
- main() {
153
- generate_report
154
- }
155
-
156
- main "$@"
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck disable=SC2012
3
- set -euo pipefail
4
-
5
- # Compare current benchmark with historical baseline
6
- RESULTS_DIR="${RESULTS_DIR:-$HOME/.local/share/dotfiles/benchmarks}"
7
- BASELINE_FILE="$RESULTS_DIR/baseline.json"
8
- REGRESSION_THRESHOLD=20 # Percentage increase to flag as regression
9
-
10
- check_regression() {
11
- local metric="$1" current="$2"
12
-
13
- if [[ ! -f "$BASELINE_FILE" ]]; then
14
- echo "No baseline found. Creating baseline..."
15
- return 0
16
- fi
17
-
18
- local baseline
19
- baseline=$(jq -r "select(.metric == \"$metric\") | .value" "$BASELINE_FILE" | tail -1)
20
-
21
- if [[ -n "$baseline" && "$baseline" != "null" ]]; then
22
- local pct_change=$(((current - baseline) * 100 / baseline))
23
- if [[ $pct_change -gt $REGRESSION_THRESHOLD ]]; then
24
- echo "REGRESSION: $metric increased by ${pct_change}% (baseline: ${baseline}ms, current: ${current}ms)"
25
- return 1
26
- fi
27
- echo "OK: $metric within threshold (baseline: ${baseline}, current: ${current}, change: ${pct_change}%)"
28
- fi
29
- return 0
30
- }
31
-
32
- main() {
33
- echo "Checking for performance regressions..."
34
- echo ""
35
-
36
- # Find latest results file
37
- local latest
38
- latest=$(ls -t "$RESULTS_DIR"/benchmark_*.json 2>/dev/null | head -1 || true)
39
-
40
- if [[ -z "$latest" ]]; then
41
- echo "No benchmark results found. Run benchmark_runner.sh first."
42
- exit 0
43
- fi
44
-
45
- echo "Comparing against baseline: $BASELINE_FILE"
46
- echo "Latest results: $latest"
47
- echo ""
48
-
49
- local regressions=0
50
-
51
- # Check each metric in the latest results
52
- while IFS= read -r line; do
53
- [[ -z "$line" ]] && continue
54
- local metric value
55
- metric=$(echo "$line" | jq -r '.metric')
56
- value=$(echo "$line" | jq -r '.value')
57
-
58
- if ! check_regression "$metric" "$value"; then
59
- ((regressions++))
60
- fi
61
- done <"$latest"
62
-
63
- echo ""
64
- if [[ $regressions -gt 0 ]]; then
65
- echo "Found $regressions regression(s)!"
66
- exit 1
67
- else
68
- echo "No regressions detected."
69
- exit 0
70
- fi
71
- }
72
-
73
- main "$@"