machineconfig 8.14__py3-none-any.whl → 8.50__py3-none-any.whl

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.

Potentially problematic release.


This version of machineconfig might be problematic. Click here for more details.

Files changed (273) hide show
  1. machineconfig/cluster/remote/run_cluster.py +1 -1
  2. machineconfig/cluster/remote/run_remote.py +1 -1
  3. machineconfig/cluster/sessions_managers/utils/maker.py +10 -8
  4. machineconfig/cluster/sessions_managers/wt_local.py +1 -1
  5. machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
  6. machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
  7. machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
  8. machineconfig/jobs/installer/checks/check_installations.py +133 -0
  9. machineconfig/jobs/installer/checks/install_utils.py +132 -0
  10. machineconfig/jobs/installer/checks/report_utils.py +39 -0
  11. machineconfig/jobs/installer/checks/vt_utils.py +89 -0
  12. machineconfig/jobs/installer/installer_data.json +225 -140
  13. machineconfig/jobs/installer/linux_scripts/docker.sh +6 -9
  14. machineconfig/jobs/installer/package_groups.py +10 -9
  15. machineconfig/jobs/installer/python_scripts/boxes.py +1 -2
  16. machineconfig/jobs/installer/python_scripts/code.py +10 -8
  17. machineconfig/jobs/installer/python_scripts/hx.py +30 -13
  18. machineconfig/jobs/installer/python_scripts/nerfont_windows_helper.py +6 -5
  19. machineconfig/jobs/installer/python_scripts/sysabc.py +25 -19
  20. machineconfig/jobs/installer/python_scripts/yazi.py +33 -17
  21. machineconfig/jobs/scripts/powershell_scripts/cmatrix.ps1 +52 -0
  22. machineconfig/jobs/scripts/powershell_scripts/mount_ssh.ps1 +1 -1
  23. machineconfig/jobs/scripts_dynamic/a.py +413 -10
  24. machineconfig/profile/create_links.py +77 -20
  25. machineconfig/profile/create_links_export.py +63 -58
  26. machineconfig/profile/mapper_data.toml +30 -0
  27. machineconfig/profile/mapper_dotfiles.toml +253 -0
  28. machineconfig/scripts/python/agents.py +70 -172
  29. machineconfig/scripts/python/ai/initai.py +3 -1
  30. machineconfig/scripts/python/ai/scripts/__init__.py +1 -0
  31. machineconfig/scripts/python/ai/scripts/lint_and_type_check.ps1 +2 -0
  32. machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +7 -5
  33. machineconfig/scripts/python/ai/solutions/claude/claude.py +1 -1
  34. machineconfig/scripts/python/ai/solutions/cline/cline.py +1 -1
  35. machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +1 -1
  36. machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +29 -0
  37. machineconfig/scripts/python/ai/solutions/crush/crush.py +1 -1
  38. machineconfig/scripts/python/ai/solutions/cursor/cursors.py +1 -1
  39. machineconfig/scripts/python/ai/solutions/gemini/gemini.py +1 -1
  40. machineconfig/scripts/python/ai/solutions/gemini/settings.json +3 -0
  41. machineconfig/scripts/python/ai/{solutions → utils}/generic.py +2 -15
  42. machineconfig/scripts/python/ai/utils/vscode_tasks.py +6 -3
  43. machineconfig/scripts/python/cloud.py +58 -11
  44. machineconfig/scripts/python/croshell.py +4 -156
  45. machineconfig/scripts/python/devops.py +57 -40
  46. machineconfig/scripts/python/devops_navigator.py +17 -3
  47. machineconfig/scripts/python/fire_jobs.py +8 -207
  48. machineconfig/scripts/python/ftpx.py +5 -225
  49. machineconfig/scripts/python/graph/cli_graph.json +8743 -0
  50. machineconfig/scripts/python/{env_manager → helper_env}/path_manager_tui.py +2 -2
  51. machineconfig/scripts/python/{env_manager → helpers/helper_env}/env_manager_tui.py +1 -1
  52. machineconfig/scripts/python/helpers/helper_env/path_manager_tui.py +228 -0
  53. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.py +1 -1
  54. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_cursor_agents.py +1 -1
  55. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_gemini.py +1 -1
  56. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_qwen.py +1 -1
  57. machineconfig/scripts/python/helpers/helpers_agents/agents_impl.py +168 -0
  58. machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_launch.py +5 -5
  59. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_copy.py +6 -6
  60. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_mount.py +10 -5
  61. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_sync.py +3 -3
  62. machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers2.py +1 -1
  63. machineconfig/scripts/python/helpers/helpers_croshell/croshell_impl.py +225 -0
  64. machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/scheduler.py +4 -4
  65. machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/start_slidev.py +7 -6
  66. machineconfig/scripts/python/helpers/helpers_devops/backup_config.py +149 -0
  67. machineconfig/scripts/python/helpers/helpers_devops/cli_backup_retrieve.py +267 -0
  68. machineconfig/scripts/python/helpers/helpers_devops/cli_config.py +98 -0
  69. machineconfig/scripts/python/helpers/helpers_devops/cli_config_dotfile.py +274 -0
  70. machineconfig/scripts/python/helpers/helpers_devops/cli_data.py +76 -0
  71. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_nw.py +52 -72
  72. machineconfig/scripts/python/helpers/helpers_devops/cli_repos.py +274 -0
  73. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_self.py +40 -23
  74. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_file.py +44 -30
  75. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_server.py +26 -43
  76. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_terminal.py +12 -6
  77. machineconfig/scripts/python/helpers/helpers_devops/cli_ssh.py +167 -0
  78. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_status.py +12 -6
  79. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_update_repos.py +1 -1
  80. machineconfig/scripts/python/{interactive.py → helpers/helpers_devops/interactive.py} +68 -52
  81. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/run_script.py +75 -58
  82. machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.ps1 +41 -0
  83. machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.sh +48 -0
  84. machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_wezterm_theme.py +3 -3
  85. machineconfig/scripts/python/helpers/helpers_fire_command/fire_jobs_impl.py +233 -0
  86. machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_route_helper.py +3 -3
  87. machineconfig/scripts/python/helpers/helpers_msearch/msearch_impl.py +248 -0
  88. machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_linux/fzfg +4 -3
  89. machineconfig/scripts/python/helpers/helpers_msearch/scripts_linux/search_with_context.sh +48 -0
  90. machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_windows/fzfg.ps1 +1 -1
  91. machineconfig/scripts/python/helpers/helpers_navigator/__init__.py +20 -0
  92. machineconfig/scripts/python/helpers/helpers_navigator/cli_graph_loader.py +234 -0
  93. machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/command_builder.py +61 -13
  94. machineconfig/scripts/python/helpers/helpers_navigator/command_detail.py +153 -0
  95. machineconfig/scripts/python/helpers/helpers_navigator/command_tree.py +45 -0
  96. machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/data_models.py +18 -11
  97. machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/main_app.py +5 -5
  98. machineconfig/scripts/python/helpers/helpers_network/__init__.py +0 -0
  99. machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address.py +15 -17
  100. machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address_switch.py +1 -1
  101. machineconfig/scripts/python/helpers/helpers_network/ftpx_impl.py +276 -0
  102. machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_ssh.py +2 -2
  103. machineconfig/scripts/python/helpers/helpers_network/ssh_add_identity.py +73 -0
  104. machineconfig/scripts/python/helpers/helpers_network/ssh_add_ssh_key.py +175 -0
  105. machineconfig/scripts/python/helpers/helpers_network/ssh_debug_linux.py +319 -0
  106. machineconfig/scripts/python/helpers/helpers_network/ssh_debug_windows.py +275 -0
  107. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action.py +3 -3
  108. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action_helper.py +3 -3
  109. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/cloud_repo_sync.py +117 -33
  110. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/grource.py +3 -2
  111. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/record.py +33 -13
  112. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_2.py +63 -19
  113. machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/update.py +0 -6
  114. machineconfig/scripts/python/helpers/helpers_search/script_help.py +81 -0
  115. machineconfig/scripts/python/helpers/helpers_sessions/__init__.py +0 -0
  116. machineconfig/scripts/python/helpers/helpers_sessions/sessions_impl.py +186 -0
  117. machineconfig/scripts/python/{helpers_sessions → helpers/helpers_sessions}/sessions_multiprocess.py +1 -1
  118. machineconfig/scripts/python/helpers/helpers_terminal/__init__.py +0 -0
  119. machineconfig/scripts/python/helpers/helpers_terminal/terminal_impl.py +96 -0
  120. machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/download.py +1 -1
  121. machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/python.py +47 -26
  122. machineconfig/scripts/python/helpers/helpers_utils/specs.py +246 -0
  123. machineconfig/scripts/python/mcfg_entry.py +133 -48
  124. machineconfig/scripts/python/msearch.py +15 -61
  125. machineconfig/scripts/python/sessions.py +59 -194
  126. machineconfig/scripts/python/terminal.py +18 -96
  127. machineconfig/scripts/python/utils.py +101 -20
  128. machineconfig/settings/atuin/config.toml +294 -0
  129. machineconfig/settings/atuin/themes/catppuccin-mocha-mauve.toml +12 -0
  130. machineconfig/settings/linters/.ruff.toml +1 -0
  131. machineconfig/settings/mprocs/windows/mprocs.yaml +2 -2
  132. machineconfig/settings/shells/bash/init.sh +6 -3
  133. machineconfig/settings/shells/pwsh/init.ps1 +69 -1
  134. machineconfig/settings/shells/pwsh/search_pwsh_history.ps1 +99 -0
  135. machineconfig/settings/shells/wezterm/wezterm.lua +4 -1
  136. machineconfig/settings/shells/wt/settings.json +20 -7
  137. machineconfig/settings/shells/zsh/init.sh +25 -4
  138. machineconfig/settings/television/cable_unix/bash-history.toml +1 -1
  139. machineconfig/settings/television/cable_windows/pwsh-history.toml +1 -1
  140. machineconfig/settings/tv/config.toml +234 -0
  141. machineconfig/settings/tv/themes/catppuccin-mocha-sky.toml +22 -0
  142. machineconfig/settings/wsl/.wslconfig +5 -30
  143. machineconfig/settings/yazi/yazi_linux.toml +18 -8
  144. machineconfig/settings/zellij/layouts/st.kdl +2 -2
  145. machineconfig/settings/zellij/layouts/st2.kdl +1 -1
  146. machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
  147. machineconfig/setup_linux/web_shortcuts/live_from_github.sh +3 -0
  148. machineconfig/setup_mac/__init__.py +0 -2
  149. machineconfig/setup_windows/__init__.py +0 -1
  150. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +14 -13
  151. machineconfig/setup_windows/web_shortcuts/live_from_github.ps1 +4 -3
  152. machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +3 -3
  153. machineconfig/type_hinting/sql/__init__.py +1 -0
  154. machineconfig/type_hinting/sql/base.py +216 -0
  155. machineconfig/type_hinting/sql/core_schema.py +64 -0
  156. machineconfig/type_hinting/sql/core_schema_typeddict.py +41 -0
  157. machineconfig/type_hinting/sql/typeddict_codegen.py +222 -0
  158. machineconfig/type_hinting/typedict/__init__.py +1 -0
  159. machineconfig/type_hinting/typedict/ast_utils.py +130 -0
  160. machineconfig/type_hinting/typedict/generator_helpers.py +319 -0
  161. machineconfig/type_hinting/typedict/generators.py +231 -0
  162. machineconfig/type_hinting/typedict/polars_schema.py +24 -0
  163. machineconfig/type_hinting/typedict/polars_schema_typeddict.py +63 -0
  164. machineconfig/utils/accessories.py +24 -0
  165. machineconfig/utils/code.py +41 -13
  166. machineconfig/utils/files/ascii_art.py +10 -14
  167. machineconfig/utils/files/headers.py +3 -5
  168. machineconfig/utils/files/read.py +8 -1
  169. machineconfig/utils/installer_utils/github_release_bulk.py +11 -91
  170. machineconfig/utils/installer_utils/github_release_scraper.py +99 -0
  171. machineconfig/utils/installer_utils/install_from_url.py +1 -1
  172. machineconfig/utils/installer_utils/installer_class.py +12 -4
  173. machineconfig/utils/installer_utils/installer_cli.py +1 -15
  174. machineconfig/utils/installer_utils/installer_helper.py +2 -2
  175. machineconfig/utils/installer_utils/installer_locator_utils.py +13 -13
  176. machineconfig/utils/installer_utils/installer_runner.py +4 -4
  177. machineconfig/utils/io.py +25 -8
  178. machineconfig/utils/meta.py +6 -4
  179. machineconfig/utils/options.py +49 -19
  180. machineconfig/utils/options_utils/__init__.py +0 -0
  181. machineconfig/utils/options_utils/options_tv_linux.py +211 -0
  182. machineconfig/utils/options_utils/options_tv_windows.py +88 -0
  183. machineconfig/utils/options_utils/tv_options.py +37 -0
  184. machineconfig/utils/path_extended.py +6 -6
  185. machineconfig/utils/scheduler.py +8 -2
  186. machineconfig/utils/schemas/fire_agents/fire_agents_input.py +1 -1
  187. machineconfig/utils/source_of_truth.py +6 -1
  188. machineconfig/utils/ssh.py +69 -18
  189. machineconfig/utils/ssh_utils/abc.py +1 -1
  190. machineconfig/utils/ssh_utils/copy_from_here.py +17 -12
  191. machineconfig/utils/ssh_utils/utils.py +21 -5
  192. machineconfig/utils/ssh_utils/wsl.py +107 -170
  193. machineconfig/utils/ssh_utils/wsl_helper.py +217 -0
  194. machineconfig/utils/upgrade_packages.py +4 -8
  195. {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/METADATA +29 -22
  196. {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/RECORD +251 -211
  197. machineconfig/jobs/installer/check_installations.py +0 -248
  198. machineconfig/profile/backup.toml +0 -49
  199. machineconfig/profile/mapper.toml +0 -263
  200. machineconfig/scripts/python/helpers_devops/cli_config.py +0 -105
  201. machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +0 -89
  202. machineconfig/scripts/python/helpers_devops/cli_data.py +0 -25
  203. machineconfig/scripts/python/helpers_devops/cli_repos.py +0 -208
  204. machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +0 -80
  205. machineconfig/scripts/python/helpers_devops/themes/choose_starship_theme.bash +0 -3
  206. machineconfig/scripts/python/helpers_navigator/__init__.py +0 -20
  207. machineconfig/scripts/python/helpers_navigator/command_detail.py +0 -44
  208. machineconfig/scripts/python/helpers_navigator/command_tree.py +0 -620
  209. machineconfig/scripts/python/helpers_network/ssh_add_identity.py +0 -116
  210. machineconfig/scripts/python/helpers_network/ssh_add_ssh_key.py +0 -153
  211. machineconfig/scripts/python/helpers_network/ssh_debug_linux.py +0 -391
  212. machineconfig/scripts/python/helpers_network/ssh_debug_windows.py +0 -338
  213. machineconfig/scripts/python/helpers_repos/entrypoint.py +0 -77
  214. machineconfig/setup_mac/ssh/openssh_setup.sh +0 -114
  215. machineconfig/setup_windows/ssh/add-sshkey.ps1 +0 -29
  216. machineconfig/setup_windows/ssh/openssh-server.ps1 +0 -37
  217. machineconfig/utils/options_tv.py +0 -119
  218. machineconfig/utils/tst.py +0 -20
  219. /machineconfig/{scripts/python/helpers_agents → jobs/installer/checks}/__init__.py +0 -0
  220. /machineconfig/scripts/python/ai/{solutions/_shared.py → utils/shared.py} +0 -0
  221. /machineconfig/scripts/python/{helpers_agents/agentic_frameworks → graph}/__init__.py +0 -0
  222. /machineconfig/scripts/python/{helpers_cloud → helpers}/__init__.py +0 -0
  223. /machineconfig/scripts/python/{env_manager → helpers/helper_env}/__init__.py +0 -0
  224. /machineconfig/scripts/python/{env_manager → helpers/helper_env}/path_manager_backend.py +0 -0
  225. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_agents}/__init__.py +0 -0
  226. /machineconfig/scripts/python/{helpers_devops → helpers/helpers_agents/agentic_frameworks}/__init__.py +0 -0
  227. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.json +0 -0
  228. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_search.py +0 -0
  229. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_helper_types.py +0 -0
  230. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_load_balancer.py +0 -0
  231. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aichat/config.yaml +0 -0
  232. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aider/.aider.conf.yml +0 -0
  233. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/copilot/config.yml +0 -0
  234. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/crush/crush.json +0 -0
  235. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/gemini/settings.json +0 -0
  236. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/privacy.py +0 -0
  237. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/prompt.txt +0 -0
  238. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.ps1 +0 -0
  239. /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.sh +0 -0
  240. /machineconfig/scripts/python/{helpers_devops/themes → helpers/helpers_cloud}/__init__.py +0 -0
  241. /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_helpers.py +0 -0
  242. /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers5.py +0 -0
  243. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_croshell}/__init__.py +0 -0
  244. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/crosh.py +0 -0
  245. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/pomodoro.py +0 -0
  246. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer.py +0 -0
  247. /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer_template.py +0 -0
  248. /machineconfig/scripts/python/{helpers_network → helpers/helpers_devops}/__init__.py +0 -0
  249. /machineconfig/scripts/python/{helpers_sessions → helpers/helpers_devops/themes}/__init__.py +0 -0
  250. /machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_pwsh_theme.ps1 +0 -0
  251. /machineconfig/scripts/python/{helpers_devops/themes/choose_starship_theme.ps1 → helpers/helpers_fire_command/__init__.py} +0 -0
  252. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/cloud_manager.py +0 -0
  253. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/f.py +0 -0
  254. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/file_wrangler.py +0 -0
  255. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_args_helper.py +0 -0
  256. /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_streamlit_helper.py +0 -0
  257. /machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/__init__.py +0 -0
  258. /machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/search_bar.py +0 -0
  259. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nfs.py +0 -0
  260. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nw_drive.py +0 -0
  261. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/onetimeshare.py +0 -0
  262. /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/wifi_conn.py +0 -0
  263. /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/clone.py +0 -0
  264. /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_1.py +0 -0
  265. /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/sync.py +0 -0
  266. /machineconfig/scripts/python/helpers/{ast_search.py → helpers_search/ast_search.py} +0 -0
  267. /machineconfig/scripts/python/helpers/{qr_code.py → helpers_search/qr_code.py} +0 -0
  268. /machineconfig/scripts/python/helpers/{repo_rag.py → helpers_search/repo_rag.py} +0 -0
  269. /machineconfig/scripts/python/helpers/{symantic_search.py → helpers_search/symantic_search.py} +0 -0
  270. /machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/pdf.py +0 -0
  271. {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/WHEEL +0 -0
  272. {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/entry_points.txt +0 -0
  273. {machineconfig-8.14.dist-info → machineconfig-8.50.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,7 @@
1
1
 
2
2
  import typer
3
3
  from typing import Annotated, Literal
4
+ from machineconfig.utils.ssh_utils.abc import MACHINECONFIG_VERSION
4
5
 
5
6
 
6
7
  def copy_both_assets():
@@ -69,12 +70,12 @@ def update(copy_assets: Annotated[bool, typer.Option("--assets-copy/--no-assets-
69
70
  uv self update
70
71
  cd ~/code/machineconfig
71
72
  git pull
72
- uv tool install --upgrade --editable $HOME/code/machineconfig
73
+ uv tool install --no-cache --upgrade --editable $HOME/code/machineconfig
73
74
  """
74
75
  else:
75
76
  shell_script = """
76
77
  uv self update
77
- uv tool install --upgrade machineconfig
78
+ uv tool install --no-cache --upgrade machineconfig
78
79
  """
79
80
  import platform
80
81
  if platform.system() == "Windows":
@@ -91,41 +92,58 @@ uv tool install --upgrade machineconfig
91
92
  copy_both_assets()
92
93
  if link_public_configs:
93
94
  import machineconfig.profile.create_links_export as create_links_export
94
- create_links_export.main_public_from_parser(method="copy", on_conflict="overwrite-default-path", which="all", interactive=False)
95
+ create_links_export.main_from_parser(sensitivity="public", method="copy", on_conflict="overwrite-default-path", which="all")
95
96
 
96
97
 
97
98
  def install(copy_assets: Annotated[bool, typer.Option("--copy-assets/--no-assets-copy", "-a/-na", help="Copy (overwrite) assets to the machine after the update")] = True,
98
99
  dev: Annotated[bool, typer.Option("--dev", "-d", help="Install from local development code instead of PyPI")] = False,
100
+
99
101
  ):
100
102
  """📋 CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates."""
101
- from machineconfig.utils.code import run_shell_script, get_uv_command
103
+ from machineconfig.utils.code import run_shell_script, get_uv_command, get_shell_script_running_lambda_function, exit_then_run_shell_script
102
104
  from pathlib import Path
103
105
  import platform
104
- if dev and not Path.home().joinpath("code/machineconfig").exists():
106
+ mcfg_path = Path.home().joinpath("code/machineconfig")
107
+ _ = run_shell_script
108
+ if dev and not mcfg_path.exists():
105
109
  # clone: https://github.com/thisismygitrepo/machineconfig.git
106
110
  import git
107
- repo_parent = Path.home().joinpath("code")
108
- repo_parent.mkdir(parents=True, exist_ok=True)
109
- git.Repo.clone_from("https://github.com/thisismygitrepo/machineconfig.git", str(repo_parent.joinpath("machineconfig")))
111
+ mcfg_path.parent.mkdir(parents=True, exist_ok=True)
112
+ git.Repo.clone_from("https://github.com/thisismygitrepo/machineconfig.git", str(mcfg_path))
113
+ # now we need to run `uv sync` to install dependencies
114
+
110
115
  uv_command = get_uv_command(platform=platform.system())
111
- if Path.home().joinpath("code/machineconfig").exists():
112
- run_shell_script(f""" {uv_command} tool install --upgrade --editable "{str(Path.home().joinpath("code/machineconfig"))}" """)
113
- else:
114
- run_shell_script(rf""" {uv_command} tool install --upgrade "machineconfig>=8.14" """)
115
116
  if copy_assets:
116
- from machineconfig.profile.create_shell_profile import create_default_shell_profile
117
- create_default_shell_profile() # involves copying assets too
117
+ def func():
118
+ from machineconfig.profile.create_shell_profile import create_default_shell_profile
119
+ create_default_shell_profile() # involves copying assets too
120
+ uv_command2, _script_path = get_shell_script_running_lambda_function(lambda: func(),
121
+ uv_with=["machineconfig"], uv_project_dir=None)
122
+ else:
123
+ uv_command2 = ""
124
+ if mcfg_path.exists():
125
+ exit_then_run_shell_script(f"""
126
+ cd {str(mcfg_path)}
127
+ {uv_command} sync
128
+ {uv_command} tool install --upgrade --editable "{str(mcfg_path)}"
129
+ {uv_command2}
130
+ """)
131
+ else:
132
+ exit_then_run_shell_script(rf"""
133
+ {uv_command} tool install --upgrade "{MACHINECONFIG_VERSION}"
134
+ {uv_command2}
135
+ """)
118
136
 
119
137
 
120
138
 
121
139
  def interactive():
122
140
  """🤖 INTERACTIVE configuration of machine."""
123
- from machineconfig.scripts.python.interactive import main
141
+ from machineconfig.scripts.python.helpers.helpers_devops.interactive import main
124
142
  main()
125
143
 
126
144
  def status():
127
145
  """📊 STATUS of machine, shell profile, apps, symlinks, dotfiles, etc."""
128
- import machineconfig.scripts.python.helpers_devops.devops_status as helper
146
+ import machineconfig.scripts.python.helpers.helpers_devops.devops_status as helper
129
147
  helper.main()
130
148
 
131
149
 
@@ -136,7 +154,7 @@ def navigate():
136
154
  path = Path(navigator.__file__).resolve().parent.joinpath("devops_navigator.py")
137
155
  from machineconfig.utils.code import exit_then_run_shell_script
138
156
  if Path.home().joinpath("code/machineconfig").exists(): executable = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" --with textual"""
139
- else: executable = """--with "machineconfig>=8.14,textual" """
157
+ else: executable = f"""--with "{MACHINECONFIG_VERSION},textual" """
140
158
  exit_then_run_shell_script(f"""uv run {executable} {path}""")
141
159
 
142
160
  def readme():
@@ -160,21 +178,20 @@ def readme():
160
178
 
161
179
 
162
180
  def get_app():
163
- cli_app = typer.Typer(help="🔄 [s] self operations subcommands", no_args_is_help=True, add_help_option=False, add_completion=False)
181
+ cli_app = typer.Typer(help="🔄 [s] self operations subcommands", no_args_is_help=True, add_help_option=True, add_completion=False)
164
182
  cli_app.command("update", no_args_is_help=False, help="🔄 [u] UPDATE machineconfig")(update)
165
183
  cli_app.command("u", no_args_is_help=False, hidden=True)(update)
166
- cli_app.command("interactive", no_args_is_help=False, help="🤖 [i] INTERACTIVE configuration of machine.")(interactive)
167
- cli_app.command("i", no_args_is_help=False, help="INTERACTIVE configuration of machine.", hidden=True)(interactive)
184
+ cli_app.command("interactive", no_args_is_help=False, help="🤖 [ia] INTERACTIVE configuration of machine.")(interactive)
185
+ cli_app.command("ia", no_args_is_help=False, help="INTERACTIVE configuration of machine.", hidden=True)(interactive)
168
186
  cli_app.command(name="init", no_args_is_help=False, help="🦐 [t] Define and manage configurations")(init)
169
187
  cli_app.command(name="t", no_args_is_help=False, hidden=True)(init)
170
188
  cli_app.command("status", no_args_is_help=False, help="📊 [s] STATUS of machine, shell profile, apps, symlinks, dotfiles, etc.")(status)
171
189
  cli_app.command("s", no_args_is_help=False, help="STATUS of machine, shell profile, apps, symlinks, dotfiles, etc.", hidden=True)(status)
172
- cli_app.command("install", no_args_is_help=False, help="📋 [I] CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates.")(install)
173
- cli_app.command("I", no_args_is_help=False, help="CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates.", hidden=True)(install)
190
+ cli_app.command("install", no_args_is_help=False, help="📋 [i] CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates.")(install)
191
+ cli_app.command("i", no_args_is_help=False, help="CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates.", hidden=True)(install)
174
192
  cli_app.command("navigate", no_args_is_help=False, help="📚 [n] NAVIGATE command structure with TUI")(navigate)
175
193
  cli_app.command("n", no_args_is_help=False, help="NAVIGATE command structure with TUI", hidden=True)(navigate)
176
194
 
177
195
  cli_app.command("readme", no_args_is_help=False, help="📚 [r] render readme markdown in terminal.")(readme)
178
196
  cli_app.command("r", no_args_is_help=False, hidden=True)(readme)
179
197
  return cli_app
180
-
@@ -1,6 +1,6 @@
1
1
 
2
2
  import typer
3
- from typing import Annotated
3
+ from typing import Annotated, Literal
4
4
 
5
5
 
6
6
  def share_file_receive(code_args: Annotated[list[str], typer.Argument(help="Receive code or relay command. Examples: '7121-donor-olympic-bicycle' or '--relay 10.17.62.206:443 7121-donor-olympic-bicycle'")],
@@ -97,41 +97,55 @@ def share_file_send(path: Annotated[str, typer.Argument(help="Path to the file o
97
97
  code: Annotated[str | None, typer.Option("--code", "-c", help="Codephrase used to connect to relay")] = None,
98
98
  text: Annotated[str | None, typer.Option("--text", "-t", help="Send some text")] = None,
99
99
  qrcode: Annotated[bool, typer.Option("--qrcode", "--qr", help="Show receive code as a qrcode")] = False,
100
+ backend: Annotated[Literal["wormhole", "w", "croc", "c"], typer.Option("--backend", "-b", help="Backend to use")] = "croc",
100
101
  ) -> None:
101
102
  """Send a file using croc with relay server."""
102
- from machineconfig.utils.installer_utils.installer_cli import install_if_missing
103
- install_if_missing(which="croc")
104
- # Get relay server IP from environment or use default
105
- import machineconfig.scripts.python.helpers_network.address as helper
106
- res = helper.select_lan_ipv4(prefer_vpn=False)
107
- if res is None:
108
- typer.echo("❌ Error: Could not determine local LAN IPv4 address for relay.", err=True)
109
- raise typer.Exit(code=1)
110
- local_ip_v4 = res
111
103
  import platform
112
- relay_port = "443"
113
- is_windows = platform.system() == "Windows"
114
-
115
- # Build command parts
116
- relay_arg = f"--relay {local_ip_v4}:{relay_port} --ip {local_ip_v4}:{relay_port}"
117
- zip_arg = "--zip" if zip_folder else ""
118
- text_arg = f"--text '{text}'" if text else ""
119
- qrcode_arg = "--qrcode" if qrcode else ""
120
- path_arg = f"{path}" if not text else ""
121
104
 
122
- if is_windows:
123
- # Windows PowerShell format
124
- code_arg = f"--code {code}" if code else ""
125
- script = f"""croc {relay_arg} send {zip_arg} {code_arg} {qrcode_arg} {text_arg} {path_arg}"""
126
- else:
127
- # Linux/macOS Bash format
128
- if code:
129
- script = f"""export CROC_SECRET="{code}"
105
+ match backend:
106
+ case "wormhole" | "w":
107
+ if code is None: code_line = ""
108
+ else: code_line = f"--code {code}"
109
+ if text is not None: text_line = f"--text '{text}'"
110
+ else: text_line = f"'{path}'"
111
+ script = f"""
112
+ uvx magic-wormhole send {code_line} {text_line}
113
+ """
114
+ print(f"🚀 Sending file: {path}. Use: uvx magic-wormhole receive ")
115
+ case "croc" | "c":
116
+ from machineconfig.utils.installer_utils.installer_cli import install_if_missing
117
+ install_if_missing(which="croc")
118
+
119
+ # Get relay server IP from environment or use default
120
+ import machineconfig.scripts.python.helpers.helpers_network.address as helper
121
+ res = helper.select_lan_ipv4(prefer_vpn=False)
122
+ if res is None:
123
+ typer.echo("❌ Error: Could not determine local LAN IPv4 address for relay.", err=True)
124
+ raise typer.Exit(code=1)
125
+ local_ip_v4 = res
126
+ relay_port = "443"
127
+ is_windows = platform.system() == "Windows"
128
+ # Build command parts
129
+ relay_arg = f"--relay {local_ip_v4}:{relay_port} --ip {local_ip_v4}:{relay_port}"
130
+ zip_arg = "--zip" if zip_folder else ""
131
+ text_arg = f"--text '{text}'" if text else ""
132
+ qrcode_arg = "--qrcode" if qrcode else ""
133
+ path_arg = f"{path}" if not text else ""
134
+
135
+ if is_windows:
136
+ # Windows PowerShell format
137
+ code_arg = f"--code {code}" if code else ""
138
+ script = f"""croc {relay_arg} send {zip_arg} {code_arg} {qrcode_arg} {text_arg} {path_arg}"""
139
+ else:
140
+ # Linux/macOS Bash format
141
+ if code:
142
+ script = f"""
143
+ export CROC_SECRET="{code}"
130
144
  croc {relay_arg} send {zip_arg} {qrcode_arg} {text_arg} {path_arg}"""
131
- else:
132
- script = f"""croc {relay_arg} send {zip_arg} {qrcode_arg} {text_arg} {path_arg}"""
145
+ else:
146
+ script = f"""croc {relay_arg} send {zip_arg} {qrcode_arg} {text_arg} {path_arg}"""
133
147
 
134
148
  typer.echo(f"🚀 Sending file: {path}. Use: devops network receive")
135
149
  from machineconfig.utils.code import exit_then_run_shell_script, print_code
136
150
  print_code(code=script, desc="🚀 sending file with croc", lexer="bash" if platform.system() != "Windows" else "powershell")
137
- exit_then_run_shell_script(script=script, strict=False)
151
+ exit_then_run_shell_script(script=script, strict=False)
@@ -1,42 +1,17 @@
1
1
  from pathlib import Path
2
2
  from typing import Optional, Annotated
3
- from machineconfig.scripts.python.helpers_devops.cli_share_file import share_file_receive, share_file_send
3
+ from machineconfig.scripts.python.helpers.helpers_devops.cli_share_file import share_file_receive, share_file_send
4
+ from machineconfig.utils.accessories import display_with_flashy_style
4
5
  import typer
5
6
 
6
7
 
7
- def display_share_url(local_ip_v4: str, port: int, protocol: str = "http") -> None:
8
- """Display a flashy, unmissable share URL announcement."""
9
- from rich.console import Console
10
- from rich.panel import Panel
11
- from rich.text import Text
12
- from rich.align import Align
13
- console = Console()
14
- # Create the main message with styling
15
- url_text = Text(f"{protocol}://{local_ip_v4}:{port}", style="bold bright_cyan underline")
16
- message = Text.assemble(
17
- ("🚀 ", "bright_red"),
18
- ("Share server is now accessible at: ", "bright_white bold"),
19
- url_text,
20
- (" 🚀", "bright_red")
21
- )
22
- # Create a fancy panel with borders and styling
23
- panel = Panel(
24
- Align.center(message),
25
- title="[bold bright_green]🌐 SHARE SERVER READY 🌐[/bold bright_green]",
26
- subtitle="[italic bright_yellow]⚡ Click the link above to access your shared files! ⚡[/italic bright_yellow]",
27
- border_style="bright_magenta",
28
- padding=(1, 2),
29
- expand=False
30
- )
31
- # Print with extra spacing and attention-grabbing elements
32
- console.print(panel)
33
-
34
-
35
8
  def web_file_explorer(
36
9
  path: Annotated[str, typer.Argument(help="Path to the file or directory to share")],
37
10
  port: Annotated[Optional[int], typer.Option("--port", "-p", help="Port to run the share server on (default: 8080)")] = None,
38
11
  username: Annotated[Optional[str], typer.Option("--username", "-u", help="Username for share access (default: current user)")] = None,
12
+ no_auth: Annotated[bool, typer.Option("--no-auth", "-na", help="Disable authentication for share access")] = False,
39
13
  password: Annotated[Optional[str], typer.Option("--password", "-w", help="Password for share access (default: from ~/dotfiles/creds/passwords/quick_password)")] = None,
14
+ bind_address: Annotated[str, typer.Option("--bind", "-a", help="Address to bind the server to")] = "0.0.0.0",
40
15
  over_internet: Annotated[bool, typer.Option("--over-internet", "-i", help="Expose the share server over the internet using ngrok")] = False,
41
16
  backend: Annotated[str, typer.Option("--backend", "-b", help="Backend to use: filebrowser (default), miniserve, qrcp, or easy-sharing")] = "miniserve",
42
17
  ) -> None:
@@ -48,22 +23,22 @@ def web_file_explorer(
48
23
  install_if_missing(which=backend)
49
24
  if over_internet:
50
25
  install_if_missing(which="ngrok")
51
- if username is None:
52
- import getpass
53
- username = getpass.getuser()
54
-
55
- if password is None:
26
+ if password is None and not no_auth:
56
27
  pwd_path = Path.home().joinpath("dotfiles/creds/passwords/quick_password")
57
28
  if pwd_path.exists():
58
29
  password = pwd_path.read_text(encoding="utf-8").strip()
59
- else:
60
- typer.echo(f"⚠️ WARNING: Password not provided and default password file does not exist.\nPath: {pwd_path}\nUsing default password: 'quick_password' (insecure!)", err=True)
61
- raise typer.Exit(code=1)
30
+ if username is None:
31
+ import getpass
32
+ username = getpass.getuser()
33
+ # else:
34
+ # typer.echo(f"⚠️ WARNING: Password not provided and default password file does not exist.\nPath: {pwd_path}\nUsing default password: 'quick_password' (insecure!)", err=True)
35
+ # raise typer.Exit(code=1)
36
+
62
37
 
63
38
  if port is None:
64
39
  port = 8080
65
40
 
66
- import machineconfig.scripts.python.helpers_network.address as helper
41
+ import machineconfig.scripts.python.helpers.helpers_network.address as helper
67
42
  res = helper.select_lan_ipv4(prefer_vpn=False)
68
43
  if res is None:
69
44
  typer.echo("❌ ERROR: Could not determine local LAN IPv4 address for share server.", err=True)
@@ -71,7 +46,7 @@ def web_file_explorer(
71
46
  local_ip_v4 = res
72
47
 
73
48
  protocol = "http"
74
- display_share_url(local_ip_v4, port, protocol)
49
+ display_with_flashy_style(msg=f"{protocol}://{local_ip_v4}:{port}/", title="Local Network Share URL")
75
50
 
76
51
  path_obj = Path(path).resolve()
77
52
  if not path_obj.exists():
@@ -83,14 +58,22 @@ def web_file_explorer(
83
58
  db_path.parent.mkdir(parents=True, exist_ok=True)
84
59
  command = f"""
85
60
  filebrowser users add {username} "{password}" --database {db_path}
86
- filebrowser --address 0.0.0.0 --port {port} --root "{path_obj}" --database {db_path}
61
+ filebrowser --address {bind_address} --port {port} --root "{path_obj}" --database {db_path}
87
62
  """
88
63
  elif backend == "miniserve":
89
- command = f"""miniserve --port {port} --interfaces 0.0.0.0 --auth {username}:{password} --upload-files --mkdir --enable-tar --enable-tar-gz --enable-zip --qrcode "{path_obj}" """
64
+ if username and password:
65
+ auth_line = f"""--auth "{username}:{password}" """
66
+ else:
67
+ auth_line = ""
68
+ command = f"""miniserve --port {port} --interfaces {bind_address} {auth_line} --upload-files --mkdir --enable-tar --enable-tar-gz --enable-zip --qrcode "{path_obj}" """
90
69
  elif backend == "easy-sharing":
91
- command = f"""easy-sharing --port {port} --username {username} --password "{password}" "{path_obj}" """
70
+ if username is None and password is None:
71
+ auth_line = ""
72
+ else:
73
+ auth_line = f'--username "{username}" --password "{password}"'
74
+ command = f"""easy-sharing --port {port} {auth_line} "{path_obj}" """
92
75
  elif backend == "qrcp":
93
- command = f"""qrcp "{path_obj}" """
76
+ command = f"""qrcp --port {port} --bind {bind_address} "{path_obj}" """
94
77
  else:
95
78
  typer.echo(f"❌ ERROR: Unknown backend '{backend}'", err=True)
96
79
  raise typer.Exit(code=1)
@@ -46,6 +46,7 @@ def share_terminal(
46
46
  port: Annotated[Optional[int], typer.Option("--port", "-p", help="Port to run the terminal server on (default: 7681)")] = None,
47
47
  username: Annotated[Optional[str], typer.Option("--username", "-u", help="Username for terminal access (default: current user)")] = None,
48
48
  password: Annotated[Optional[str], typer.Option("--password", "-w", help="Password for terminal access (default: from ~/dotfiles/creds/passwords/quick_password)")] = None,
49
+ no_auth: Annotated[bool, typer.Option("--no-auth", "-n", help="Disable authentication (not recommended)")] = False,
49
50
  start_command: Annotated[Optional[str], typer.Option("--start-command", "-s", help="Command to run on terminal start (default: bash/powershell)")] = None,
50
51
  ssl: Annotated[bool, typer.Option("--ssl", "-S", help="Enable SSL")] = False,
51
52
  ssl_cert: Annotated[Optional[str], typer.Option("--ssl-cert", "-C", help="SSL certificate file path")] = None,
@@ -61,12 +62,14 @@ def share_terminal(
61
62
  if username is None:
62
63
  import getpass
63
64
  username = getpass.getuser()
64
- if password is None:
65
+ if password is None and not no_auth:
65
66
  pwd_path = Path.home().joinpath("dotfiles/creds/passwords/quick_password")
66
67
  if pwd_path.exists():
67
68
  password = pwd_path.read_text(encoding="utf-8").strip()
68
69
  else:
69
- raise ValueError("Password not provided and default password file does not exist.")
70
+ # raise ValueError("Password not provided and default password file does not exist.")
71
+ print("❌ Error: Password not provided and default password file does not exist.")
72
+ raise typer.Exit(code=1)
70
73
 
71
74
  if port is None:
72
75
  port = 7681 # Default port for ttyd
@@ -83,14 +86,17 @@ def share_terminal(
83
86
  key_path = Path(ssl_key)
84
87
 
85
88
  if not cert_path.exists():
86
- raise FileNotFoundError(f"SSL certificate file not found: {ssl_cert}")
89
+ print(f"❌ Error: SSL certificate file not found: {ssl_cert}")
90
+ raise typer.Exit(code=1)
87
91
  if not key_path.exists():
88
- raise FileNotFoundError(f"SSL key file not found: {ssl_key}")
92
+ print(f"❌ Error: SSL key file not found: {ssl_key}")
93
+ raise typer.Exit(code=1)
89
94
 
90
95
  if ssl_ca and not Path(ssl_ca).exists():
91
- raise FileNotFoundError(f"SSL CA file not found: {ssl_ca}")
96
+ print(f"❌ Error: SSL CA file not found: {ssl_ca}")
97
+ raise typer.Exit(code=1)
92
98
 
93
- import machineconfig.scripts.python.helpers_network.address as helper
99
+ import machineconfig.scripts.python.helpers.helpers_network.address as helper
94
100
  res = helper.select_lan_ipv4(prefer_vpn=False)
95
101
  if res is None:
96
102
  print("❌ Error: Could not determine local LAN IPv4 address for terminal.")
@@ -0,0 +1,167 @@
1
+ import typer
2
+ from typing import Optional, Annotated
3
+
4
+
5
+ def install_ssh_server() -> None:
6
+ """📡 Install SSH server"""
7
+ import platform
8
+ if platform.system() == "Windows":
9
+ script = _get_windows_ssh_server_install_script()
10
+ elif platform.system() == "Linux" or platform.system() == "Darwin":
11
+ script = """
12
+ sudo nala install openssh-server -y || true # try to install first
13
+ # sudo nala purge openssh-server -y
14
+ # sudo nala install openssh-server -y
15
+ echo "✅ FINISHED installing openssh-server."
16
+ """
17
+ else:
18
+ print(f"❌ Error: Platform {platform.system()} is not supported.")
19
+ raise typer.Exit(code=1)
20
+ from machineconfig.utils.code import run_shell_script
21
+ run_shell_script(script=script)
22
+
23
+
24
+ def change_ssh_port(port: Annotated[int, typer.Option(..., "--port", "-p", help="SSH port to use")] = 2222) -> None:
25
+ """🔌 Change SSH port (Linux/WSL only, default: 2222)"""
26
+ import platform
27
+ if platform.system() != "Linux":
28
+ print("❌ Error: change_ssh_port requires Linux environment")
29
+ raise typer.Exit(code=1)
30
+ from machineconfig.utils.ssh_utils.wsl import change_ssh_port as _change_ssh_port
31
+ _change_ssh_port(port=port)
32
+
33
+
34
+ def _get_windows_ssh_server_install_script(use_winget: bool = True) -> str:
35
+ install_winget = r'''
36
+ Write-Host "Installing OpenSSH via winget..." -ForegroundColor Cyan
37
+ winget install --no-upgrade --Id Microsoft.OpenSSH.Preview --source winget --accept-package-agreements --accept-source-agreements
38
+ $wingetSshPath = "C:\Program Files\OpenSSH"
39
+ $currentMachinePath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
40
+ if ($currentMachinePath -notlike "*$wingetSshPath*") {
41
+ Write-Host "Adding OpenSSH to system PATH..." -ForegroundColor Yellow
42
+ [System.Environment]::SetEnvironmentVariable("Path", "$currentMachinePath;$wingetSshPath", "Machine")
43
+ }
44
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
45
+ '''
46
+ install_capability = r'''
47
+ Write-Host "Installing OpenSSH via Windows Capability..." -ForegroundColor Cyan
48
+ Add-WindowsCapability -Online -Name OpenSSH.Server
49
+ Add-WindowsCapability -Online -Name OpenSSH.Client
50
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
51
+ '''
52
+ configure_sshd_service = r'''
53
+ $serviceExists = Get-Service -Name sshd -ErrorAction SilentlyContinue
54
+ if (-not $serviceExists) {
55
+ Write-Host "sshd service not found, registering manually..." -ForegroundColor Yellow
56
+ sc.exe create sshd binPath= "$sshdExePath" start= auto
57
+ if ($LASTEXITCODE -ne 0) { throw "Failed to create sshd service" }
58
+ }
59
+ Set-Service -Name sshd -StartupType Automatic
60
+ Start-Service sshd
61
+ Write-Host "sshd service started successfully." -ForegroundColor Green
62
+ '''
63
+ configure_firewall = r'''
64
+ $existingRule = Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue
65
+ if (-not $existingRule) {
66
+ Write-Host "Creating firewall rule for SSH..." -ForegroundColor Yellow
67
+ New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH SSH Server" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Program $sshdExePath
68
+ } else {
69
+ Write-Host "Firewall rule already exists." -ForegroundColor Green
70
+ }
71
+ '''
72
+ configure_default_shell = r'''
73
+ Write-Host "Configuring default shell for SSH..." -ForegroundColor Cyan
74
+ $shell = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
75
+ if (-not (Test-Path "HKLM:\SOFTWARE\OpenSSH")) { New-Item -Path "HKLM:\SOFTWARE\OpenSSH" -Force | Out-Null }
76
+ New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value $shell -PropertyType String -Force | Out-Null
77
+ New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "/c" -PropertyType String -Force | Out-Null
78
+ Write-Host "Default shell set to: $shell" -ForegroundColor Green
79
+ '''
80
+ configure_ssh_agent = r'''
81
+ Write-Host "Configuring ssh-agent service..." -ForegroundColor Cyan
82
+ $agentService = Get-Service -Name ssh-agent -ErrorAction SilentlyContinue
83
+ if ($agentService) {
84
+ Set-Service -Name ssh-agent -StartupType Automatic
85
+ Start-Service ssh-agent -ErrorAction SilentlyContinue
86
+ Write-Host "ssh-agent service configured and started." -ForegroundColor Green
87
+ } else {
88
+ Write-Host "ssh-agent service not available." -ForegroundColor Yellow
89
+ }
90
+ '''
91
+ ensure_ssh_directory = r'''
92
+ $sshDir = Join-Path $env:USERPROFILE ".ssh"
93
+ if (-not (Test-Path $sshDir)) {
94
+ New-Item -ItemType Directory -Path $sshDir -Force | Out-Null
95
+ Write-Host "Created .ssh directory at: $sshDir" -ForegroundColor Green
96
+ }
97
+ '''
98
+ if use_winget:
99
+ install_method = install_winget
100
+ sshd_exe_path = r'C:\Program Files\OpenSSH\sshd.exe'
101
+ else:
102
+ install_method = install_capability
103
+ sshd_exe_path = r'$env:WINDIR\System32\OpenSSH\sshd.exe'
104
+ return fr'''
105
+ $ErrorActionPreference = "Stop"
106
+ try {{ Set-ExecutionPolicy -Scope CurrentUser Bypass -ErrorAction SilentlyContinue }} catch {{ }}
107
+ Write-Host "========================================" -ForegroundColor Magenta
108
+ Write-Host "OpenSSH Server Installation for Windows" -ForegroundColor Magenta
109
+ Write-Host "========================================" -ForegroundColor Magenta
110
+ {install_method}
111
+ $sshdExePath = "{sshd_exe_path}"
112
+ {configure_sshd_service}
113
+ {configure_firewall}
114
+ {configure_default_shell}
115
+ {configure_ssh_agent}
116
+ {ensure_ssh_directory}
117
+ Write-Host "========================================" -ForegroundColor Magenta
118
+ Write-Host "OpenSSH Server installation complete!" -ForegroundColor Green
119
+ Write-Host "SSH config directory: $env:ProgramData\ssh" -ForegroundColor Cyan
120
+ Write-Host "========================================" -ForegroundColor Magenta
121
+ '''
122
+
123
+
124
+ def add_ssh_key(
125
+ path: Annotated[Optional[str], typer.Option(..., help="Path to the public key file")] = None,
126
+ choose: Annotated[bool, typer.Option(..., "--choose", "-c", help="Choose from available public keys in ~/.ssh/*.pub")] = False,
127
+ value: Annotated[bool, typer.Option(..., "--value", "-v", help="Paste the public key content manually")] = False,
128
+ github: Annotated[Optional[str], typer.Option(..., "--github", "-g", help="Fetch public keys from a GitHub username")] = None,
129
+ ) -> None:
130
+ """🔑 Add SSH public key to this machine so its accessible by owner of corresponding private key."""
131
+ import machineconfig.scripts.python.helpers.helpers_network.ssh_add_ssh_key as helper
132
+ helper.main(pub_path=path, pub_choose=choose, pub_val=value, from_github=github)
133
+
134
+
135
+ def add_ssh_identity() -> None:
136
+ """🗝️ Add SSH identity (private key) to this machine"""
137
+ import machineconfig.scripts.python.helpers.helpers_network.ssh_add_identity as helper
138
+ helper.main()
139
+
140
+
141
+ def debug_ssh() -> None:
142
+ """🐛 Debug SSH connection"""
143
+ from platform import system
144
+ if system() == "Linux" or system() == "Darwin":
145
+ import machineconfig.scripts.python.helpers.helpers_network.ssh_debug_linux as helper
146
+ helper.ssh_debug_linux()
147
+ elif system() == "Windows":
148
+ import machineconfig.scripts.python.helpers.helpers_network.ssh_debug_windows as helper
149
+ helper.ssh_debug_windows()
150
+ else:
151
+ print(f"❌ Error: Platform {system()} is not supported.")
152
+ raise typer.Exit(code=1)
153
+
154
+
155
+ def get_app() -> typer.Typer:
156
+ ssh_app = typer.Typer(help="🔐 SSH subcommands", no_args_is_help=True, add_help_option=True, add_completion=False)
157
+ ssh_app.command(name="install-server", help="📡 [i] Install SSH server")(install_ssh_server)
158
+ ssh_app.command(name="i", help="Install SSH server", hidden=True)(install_ssh_server)
159
+ ssh_app.command(name="change-port", help="🔌 [p] Change SSH port (Linux/WSL only)")(change_ssh_port)
160
+ ssh_app.command(name="p", help="Change SSH port", hidden=True)(change_ssh_port)
161
+ ssh_app.command(name="add-key", help="🔑 [k] Add SSH public key to this machine", no_args_is_help=True)(add_ssh_key)
162
+ ssh_app.command(name="k", help="Add SSH public key to this machine", hidden=True, no_args_is_help=True)(add_ssh_key)
163
+ ssh_app.command(name="add-identity", help="🗝️ [A] Add SSH identity (private key) to this machine")(add_ssh_identity)
164
+ ssh_app.command(name="A", help="Add SSH identity (private key) to this machine", hidden=True)(add_ssh_identity)
165
+ ssh_app.command(name="debug", help="🐛 [d] Debug SSH connection")(debug_ssh)
166
+ ssh_app.command(name="d", help="Debug SSH connection", hidden=True)(debug_ssh)
167
+ return ssh_app
@@ -11,7 +11,7 @@ from rich.table import Table
11
11
  from rich.text import Text
12
12
 
13
13
  from machineconfig.utils.path_extended import PathExtended
14
- from machineconfig.utils.source_of_truth import CONFIG_ROOT, DEFAULTS_PATH, LIBRARY_ROOT
14
+ from machineconfig.utils.source_of_truth import CONFIG_ROOT, DEFAULTS_PATH
15
15
 
16
16
 
17
17
  console = Console()
@@ -137,7 +137,7 @@ def _check_config_files_status() -> dict[str, Any]:
137
137
  from machineconfig.profile.create_links import read_mapper
138
138
 
139
139
  try:
140
- mapper = read_mapper()
140
+ mapper = read_mapper(repo="library")
141
141
  public_configs = list(mapper.get("public", {}).keys())
142
142
  private_configs = list(mapper.get("private", {}).keys())
143
143
 
@@ -205,10 +205,16 @@ def _check_backup_config() -> dict[str, Any]:
205
205
  cloud_config = "Not configured"
206
206
 
207
207
  try:
208
- backup_file = LIBRARY_ROOT.joinpath("profile/backup.toml")
208
+ from machineconfig.scripts.python.helpers.helpers_devops.backup_config import LIBRARY_BACKUP_PATH
209
+ backup_file = LIBRARY_BACKUP_PATH
209
210
  if backup_file.exists():
210
211
  backup_data = tomllib.loads(backup_file.read_text(encoding="utf-8"))
211
- backup_items = list(backup_data.keys())
212
+ backup_items: list[str] = []
213
+ for group_name, entries in backup_data.items():
214
+ if isinstance(entries, dict):
215
+ backup_items.extend([f"{group_name}.{entry_name}" for entry_name in entries.keys()])
216
+ else:
217
+ backup_items.append(str(group_name))
212
218
  backup_items_count = len(backup_items)
213
219
  else:
214
220
  backup_items = []
@@ -466,8 +472,8 @@ def main() -> None:
466
472
  console.print("\n")
467
473
 
468
474
  # system_info = _check_system_info()
469
- # from machineconfig.scripts.python.helpers_devops.devops_system_info import _check_system_info
470
- from machineconfig.scripts.python.helpers_utils.python import get_machine_specs
475
+ # from machineconfig.scripts.python.helpers.helpers_devops.devops_system_info import _check_system_info
476
+ from machineconfig.scripts.python.helpers.helpers_utils.python import get_machine_specs
471
477
  system_info = get_machine_specs()
472
478
  from typing import cast
473
479
  system_info = cast(dict[str, str], system_info)
@@ -9,7 +9,7 @@ from rich.panel import Panel
9
9
  from rich.table import Table
10
10
  from rich.text import Text
11
11
 
12
- from machineconfig.scripts.python.helpers_repos.update import RepositoryUpdateResult, run_uv_sync, update_repository
12
+ from machineconfig.scripts.python.helpers.helpers_repos.update import RepositoryUpdateResult, run_uv_sync, update_repository
13
13
  from machineconfig.utils.io import read_ini
14
14
  from machineconfig.utils.source_of_truth import DEFAULTS_PATH
15
15