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,205 +1,70 @@
1
+ """Sessions management commands - lazy loading subcommands."""
1
2
 
2
3
  from typing import Optional, Literal, Annotated
3
4
  import typer
4
5
 
5
6
 
6
- def balance_load(layout_path: Annotated[str, typer.Argument(..., help="Path to the layout.json file")],
7
- max_thresh: Annotated[int, typer.Option(..., "--max-threshold", "-m", help="Maximum tabs per layout")],
8
- thresh_type: Annotated[Literal['number', 'n', 'weight', 'w'], typer.Option(..., "--threshold-type", "-t", help="Threshold type")],
9
- breaking_method: Annotated[Literal['moreLayouts', 'ml', 'combineTabs', 'ct'], typer.Option(..., "--breaking-method", "-b", help="Breaking method")],
10
- output_path: Annotated[Optional[str], typer.Option(..., "--output-path", "-o", help="Path to write the adjusted layout.json file")] = None):
7
+ def balance_load(
8
+ layout_path: Annotated[str, typer.Argument(..., help="Path to the layout.json file")],
9
+ max_thresh: Annotated[int, typer.Option(..., "--max-threshold", "-m", help="Maximum tabs per layout")],
10
+ thresh_type: Annotated[Literal["number", "n", "weight", "w"], typer.Option(..., "--threshold-type", "-t", help="Threshold type")],
11
+ breaking_method: Annotated[Literal["moreLayouts", "ml", "combineTabs", "ct"], typer.Option(..., "--breaking-method", "-b", help="Breaking method")],
12
+ output_path: Annotated[Optional[str], typer.Option(..., "--output-path", "-o", help="Path to write the adjusted layout.json file")] = None,
13
+ ) -> None:
11
14
  """Adjust layout file to limit max tabs per layout, etc."""
12
- thresh_type_resolved: dict[str, Literal['number', 'weight']] = {
13
- 'number': 'number',
14
- 'n': 'number',
15
- 'weight': 'weight',
16
- 'w': 'weight'
17
- }
18
- breaking_method_resolved: dict[str, Literal['moreLayouts', 'combineTabs']] = {
19
- 'moreLayouts': 'moreLayouts',
20
- 'ml': 'moreLayouts',
21
- 'combineTabs': 'combineTabs',
22
- 'ct': 'combineTabs'
23
- }
24
- from pathlib import Path
25
- layout_path_obj = Path(layout_path).expanduser().absolute()
26
-
27
- from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
28
- import json
29
- layoutfile: LayoutsFile = json.loads(layout_path_obj.read_text())
30
- layout_configs = layoutfile["layouts"]
31
- from machineconfig.cluster.sessions_managers.utils.load_balancer import limit_tab_num
32
- new_layouts = limit_tab_num(layout_configs=layout_configs, max_thresh=max_thresh, threshold_type=thresh_type_resolved[thresh_type], breaking_method=breaking_method_resolved[breaking_method])
33
- layoutfile["layouts"] = new_layouts
34
- target_file = Path(output_path) if output_path is not None else layout_path_obj.parent / f'{layout_path_obj.stem}_adjusted_{max_thresh}_{thresh_type}_{breaking_method}.json'
35
- target_file.parent.mkdir(parents=True, exist_ok=True)
36
- target_file.write_text(data=json.dumps(layoutfile, indent=4), encoding="utf-8")
37
- typer.echo(f"Adjusted layout saved to {target_file}")
38
-
39
-
40
- def select_layout(layouts_json_file: str, selected_layouts_names: Optional[list[str]], select_interactively: bool,
41
- subsitute_home: bool
42
- ) -> list["LayoutConfig"]:
43
- import json
44
- from machineconfig.utils.options import choose_from_options
45
- from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
46
- from pathlib import Path
47
- json_str = Path(layouts_json_file).read_text(encoding="utf-8")
48
- if subsitute_home:
49
- json_str = json_str.replace("~", str(Path.home())).replace("$HOME", str(Path.home()))
50
- json_str = json_str.replace("""Command": "f """, """Command": "~/.config/machineconfig/scripts/wrap_mcfg fire """)
51
- json_str = json_str.replace("""Command": "s """, """Command": "~/.config/machineconfig/scripts/wrap_mcfg sessions """)
52
-
53
- layout_file: LayoutsFile = json.loads(json_str)
54
- if len(layout_file["layouts"]) == 0:
55
- raise ValueError(f"No layouts found in {layouts_json_file}")
56
- if selected_layouts_names is None: # choose all, or interactively
57
- if not select_interactively:
58
- return layout_file["layouts"]
59
- options = [layout["layoutName"] for layout in layout_file["layouts"]]
60
- from machineconfig.utils.options import choose_from_options
61
- selected_layouts_names = choose_from_options(multi=True, options=options, prompt="Choose a layout configuration:", tv=True, msg="Choose one option")
62
- print(f"Selected layout(s): {selected_layouts_names}")
63
- # Extract the configs from the names:
64
- layouts_chosen: list[LayoutConfig] = []
65
- for name in selected_layouts_names:
66
- layout_chosen = next((layout for layout in layout_file["layouts"] if layout["layoutName"] == name), None)
67
- if layout_chosen is None:
68
- layout_chosen = next((layout for layout in layout_file["layouts"] if layout["layoutName"].lower() == name.lower()), None)
69
- if layout_chosen is None:
70
- available_layouts = [layout["layoutName"] for layout in layout_file["layouts"]]
71
- raise ValueError(f"Layout '{name}' not found. Available layouts: {available_layouts}")
72
- layouts_chosen.append(layout_chosen)
73
- return layouts_chosen
74
-
75
-
76
- def find_layout_file(layout_path: str, ) -> str:
77
- from machineconfig.utils.path_helper import search_for_files_of_interest
78
- from machineconfig.utils.options import choose_from_options
79
- from machineconfig.utils.path_helper import match_file_name, sanitize_path
80
- from pathlib import Path
81
- path_obj = sanitize_path(layout_path)
82
- if not path_obj.exists():
83
- choice_file = match_file_name(sub_string=layout_path, search_root=Path.cwd(), suffixes={".json"})
84
- elif path_obj.is_dir():
85
- print(f"🔍 Searching recursively for Python, PowerShell and Shell scripts in directory `{path_obj}`")
86
- files = search_for_files_of_interest(path_obj, suffixes={".py", ".sh", ".ps1"})
87
- print(f"🔍 Got #{len(files)} results.")
88
- choice_file = choose_from_options(multi=False, options=files, tv=True, msg="Choose one option")
89
- choice_file = Path(choice_file).expanduser().absolute()
90
- else:
91
- choice_file = path_obj
92
- return str(choice_file)
93
-
94
-
95
- def run(ctx: typer.Context,
96
- layout_path: Annotated[Optional[str], typer.Argument(..., help="Path to the layout.json file")] = None,
97
- max_tabs: Annotated[int, typer.Option(..., "--max-tabs", "-mt", help="A Sanity checker that throws an error if any layout exceeds the maximum number of tabs to launch.")] = 10,
98
- max_layouts: Annotated[int, typer.Option(..., "--max-layouts", "-ml", help="A Sanity checker that throws an error if the total number of *parallel layouts exceeds this number.")] = 10,
99
- sleep_inbetween: Annotated[float, typer.Option(..., "--sleep-inbetween", "-si", help="Sleep time in seconds between launching layouts")] = 1.0,
100
- monitor: Annotated[bool, typer.Option(..., "--monitor", "-m", help="Monitor the layout sessions for completion")] = False,
101
- parallel: Annotated[bool, typer.Option(..., "--parallel", "-p", help="Launch multiple layouts in parallel")] = False,
102
- kill_upon_completion: Annotated[bool, typer.Option(..., "--kill-upon-completion", "-k", help="Kill session(s) upon completion (only relevant if monitor flag is set)")] = False,
103
- choose: Annotated[Optional[str], typer.Option(..., "--choose", "-c", help="Comma separated names of layouts to be selected from the layout file passed")] = None,
104
- choose_interactively: Annotated[bool, typer.Option(..., "--choose-interactively", "-i", help="Select layouts interactively")] = False,
105
- subsitute_home: Annotated[bool, typer.Option(..., "--substitute-home", "-sh", help="Substitute ~ and $HOME in layout file with actual home directory path")] = False,
106
- ):
107
- """
108
- Launch terminal sessions based on a layout configuration file.
109
- """
15
+ from machineconfig.scripts.python.helpers.helpers_sessions.sessions_impl import balance_load as impl
16
+ impl(layout_path=layout_path, max_thresh=max_thresh, thresh_type=thresh_type, breaking_method=breaking_method, output_path=output_path)
17
+
18
+
19
+ def run(
20
+ ctx: typer.Context,
21
+ layout_path: Annotated[Optional[str], typer.Argument(..., help="Path to the layout.json file")] = None,
22
+ sleep_inbetween: Annotated[float, typer.Option(..., "--sleep-inbetween", "-si", help="Sleep time in seconds between launching layouts")] = 1.0,
23
+ monitor: Annotated[bool, typer.Option(..., "--monitor", "-m", help="Monitor the layout sessions for completion")] = False,
24
+ parallel: Annotated[bool, typer.Option(..., "--parallel", "-p", help="Launch multiple layouts in parallel")] = False,
25
+ kill_upon_completion: Annotated[bool, typer.Option(..., "--kill-upon-completion", "-k", help="Kill session(s) upon completion (only relevant if monitor flag is set)")] = False,
26
+ choose: Annotated[Optional[str], typer.Option(..., "--choose", "-c", help="Comma separated names of layouts to be selected from the layout file passed")] = None,
27
+ choose_interactively: Annotated[bool, typer.Option(..., "--choose-interactively", "-i", help="Select layouts interactively")] = False,
28
+ subsitute_home: Annotated[bool, typer.Option(..., "--substitute-home", "-sh", help="Substitute ~ and $HOME in layout file with actual home directory path")] = False,
29
+ max_tabs: Annotated[int, typer.Option(..., "--max-tabs", "-mt", help="A Sanity checker that throws an error if any layout exceeds the maximum number of tabs to launch.")] = 25,
30
+ max_layouts: Annotated[int, typer.Option(..., "--max-layouts", "-ml", help="A Sanity checker that throws an error if the total number of *parallel layouts exceeds this number.")] = 25,
31
+ ) -> None:
32
+ """Launch terminal sessions based on a layout configuration file."""
110
33
  if layout_path is None:
111
34
  typer.echo(ctx.get_help())
112
35
  raise typer.Exit()
113
- layout_path_resolved = find_layout_file(layout_path=layout_path)
114
- layouts_selected = select_layout(layouts_json_file=layout_path_resolved, selected_layouts_names=choose.split(",") if choose else None, select_interactively=choose_interactively, subsitute_home=subsitute_home)
115
-
116
- # ============= Basic sanity checks =============
117
- if parallel and len(layouts_selected) > max_layouts:
118
- raise ValueError(f"Number of layouts {len(layouts_selected)} exceeds the maximum allowed {max_layouts}. Please adjust your layout file.")
119
- for a_layout in layouts_selected:
120
- if len(a_layout["layoutTabs"]) > max_tabs:
121
- typer.echo(f"Layout '{a_layout.get('layoutName', 'Unnamed')}' has {len(a_layout['layoutTabs'])} tabs which exceeds the max of {max_tabs}.")
122
- confirm = typer.confirm("Do you want to proceed with launching this layout?", default=False)
123
- if not confirm:
124
- typer.echo("Aborting launch.")
125
- raise typer.Exit(0)
126
- import time
127
- import platform
128
- if platform.system() == "Linux" or platform.system() == "Darwin":
129
- from machineconfig.cluster.sessions_managers.zellij_local_manager import ZellijLocalManager
130
- if not parallel: iterable = [[item] for item in layouts_selected]
131
- else: iterable = [layouts_selected]
132
- for i, a_layouts in enumerate(iterable):
133
- manager = ZellijLocalManager(session_layouts=a_layouts)
134
- manager.start_all_sessions(poll_interval=2, poll_seconds=2)
135
- if monitor:
136
- manager.run_monitoring_routine(wait_ms=2000)
137
- if kill_upon_completion:
138
- manager.kill_all_sessions()
139
- if i < len(layouts_selected) - 1: # Don't sleep after the last layout
140
- time.sleep(sleep_inbetween)
141
- elif platform.system() == "Windows":
142
- from machineconfig.cluster.sessions_managers.wt_local_manager import WTLocalManager
143
- if not parallel: iterable = [[item] for item in layouts_selected]
144
- else: iterable = [layouts_selected]
145
- for i, a_layouts in enumerate(iterable):
146
- manager = WTLocalManager(session_layouts=a_layouts)
147
- manager.start_all_sessions()
148
- if monitor:
149
- manager.run_monitoring_routine(wait_ms=2000)
150
- if kill_upon_completion:
151
- manager.kill_all_sessions()
152
- if i < len(layouts_selected) - 1: # Don't sleep after the last layout
153
- time.sleep(sleep_inbetween)
154
- else:
155
- print(f"❌ Unsupported platform: {platform.system()}")
156
-
157
-
158
- def create_template(name: Annotated[Optional[str], typer.Argument(..., help="Name of the layout template to create")] = None,
159
- num_tabs: Annotated[int, typer.Option(..., "--num-tabs", "-t", help="Number of tabs to include in the template")] = 3,
160
- ):
36
+ from machineconfig.scripts.python.helpers.helpers_sessions.sessions_impl import run_layouts
37
+ try:
38
+ run_layouts(layout_path=layout_path, max_tabs=max_tabs, max_layouts=max_layouts, sleep_inbetween=sleep_inbetween, monitor=monitor, parallel=parallel, kill_upon_completion=kill_upon_completion, choose=choose, choose_interactively=choose_interactively, subsitute_home=subsitute_home)
39
+ except ValueError as e:
40
+ typer.echo(str(e))
41
+ raise typer.Exit(1) from e
42
+
43
+
44
+ def create_template(
45
+ name: Annotated[Optional[str], typer.Argument(..., help="Name of the layout template to create")] = None,
46
+ num_tabs: Annotated[int, typer.Option(..., "--num-tabs", "-t", help="Number of tabs to include in the template")] = 3,
47
+ ) -> None:
161
48
  """Create a layout template file."""
162
- from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile, TabConfig
163
- from pathlib import Path
164
- tabs: list[TabConfig] = []
165
- for i in range(1, num_tabs + 1):
166
- tab: TabConfig = {
167
- "tabName": f"Tab{i}",
168
- "startDir": "~/" + str(Path.cwd().relative_to(Path.home())),
169
- "command": "bash",
170
- }
171
- tabs.append(tab)
172
- layouts: list[LayoutConfig] = [
173
- {
174
- "layoutName": f"{Path.cwd().name}Layout",
175
- "layoutTabs": tabs,
176
- }
177
- ]
178
- file: LayoutsFile = {
179
- "$schema": "https://bit.ly/cfglayout", # type: ignore
180
- "version": "0.1",
181
- "layouts": layouts
182
- }
183
- import json
184
- json_string = json.dumps(file, indent=4)
185
- if name is None:
186
- layout_path = Path.cwd() / "layout.json"
187
- else:
188
- layout_path = Path.cwd() / (name.replace(".json", "") + ".json")
189
- layout_path.parent.mkdir(parents=True, exist_ok=True)
190
- if layout_path.exists():
191
- print(f"❌ File {layout_path} already exists. Aborting to avoid overwriting.")
192
- return
193
- layout_path.write_text(json_string, encoding="utf-8")
194
- print(f"✅ Created layout template at {layout_path}")
195
-
196
-
197
- def get_app():
198
- layouts_app = typer.Typer(help="Layouts management subcommands", no_args_is_help=True, add_help_option=False, add_completion=False)
199
- from machineconfig.scripts.python.helpers_sessions.sessions_multiprocess import create_from_function
200
-
201
- layouts_app.command("create-from-function", no_args_is_help=True, help=create_from_function.__doc__, short_help="[c] Create a layout from a function")(create_from_function)
202
- layouts_app.command("c", no_args_is_help=True, help=create_from_function.__doc__, hidden=True)(create_from_function)
49
+ from machineconfig.scripts.python.helpers.helpers_sessions.sessions_impl import create_template as impl
50
+ impl(name=name, num_tabs=num_tabs)
51
+
52
+
53
+ def create_from_function(
54
+ num_process: Annotated[int, typer.Option(..., "--num-process", "-n", help="Number of parallel processes to run")],
55
+ path: Annotated[str, typer.Option(..., "--path", "-p", help="Path to a Python or Shell script file or a directory containing such files")] = ".",
56
+ function: Annotated[Optional[str], typer.Option(..., "--function", "-f", help="Function to run from the Python file. If not provided, you will be prompted to choose.")] = None,
57
+ ) -> None:
58
+ """Create a layout from a function to run in multiple processes."""
59
+ from machineconfig.scripts.python.helpers.helpers_sessions.sessions_multiprocess import create_from_function as impl
60
+ impl(num_process=num_process, path=path, function=function)
61
+
62
+
63
+ def get_app() -> typer.Typer:
64
+ layouts_app = typer.Typer(help="Layouts management subcommands", no_args_is_help=True, add_help_option=True, add_completion=False)
65
+
66
+ layouts_app.command("create-from-function", no_args_is_help=True, short_help="[c] Create a layout from a function")(create_from_function)
67
+ layouts_app.command("c", no_args_is_help=True, hidden=True)(create_from_function)
203
68
 
204
69
  layouts_app.command("run", no_args_is_help=True, help=run.__doc__, short_help="[r] Run the selected layout(s)")(run)
205
70
  layouts_app.command("r", no_args_is_help=True, help=run.__doc__, hidden=True)(run)
@@ -212,10 +77,10 @@ def get_app():
212
77
  return layouts_app
213
78
 
214
79
 
215
- def main():
80
+ def main() -> None:
216
81
  layouts_app = get_app()
217
82
  layouts_app()
218
83
 
219
84
 
220
85
  if __name__ == "__main__":
221
- from machineconfig.utils.schemas.layouts.layout_types import LayoutConfig
86
+ pass
@@ -1,122 +1,44 @@
1
-
2
1
  import typer
3
- from typing import Annotated, Optional
4
-
5
-
6
- def strip_ansi_codes(text: str) -> str:
7
- """Remove ANSI color codes from text."""
8
- import re
9
- return re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', text)
2
+ from typing import Annotated
10
3
 
11
4
 
12
5
  def choose_zellij_session(
13
- name: Annotated[Optional[str], typer.Argument(help="Name of the Zellij session to attach to. If not provided, a list will be shown to choose from.")] = None,
6
+ name: Annotated[str | None, typer.Argument(help="Name of the Zellij session to attach to. If not provided, a list will be shown to choose from.")] = None,
14
7
  new_session: Annotated[bool, typer.Option("--new-session", "-n", help="Create a new Zellij session instead of attaching to an existing one.", show_default=True)] = False,
15
- kill_all: Annotated[bool, typer.Option("--kill-all", "-k", help="Kill all existing Zellij sessions before creating a new one.", show_default=True)] = False):
8
+ kill_all: Annotated[bool, typer.Option("--kill-all", "-k", help="Kill all existing Zellij sessions before creating a new one.", show_default=True)] = False) -> None:
16
9
  """Choose a Zellij session to attach to."""
17
- if name is not None:
18
- result = f"zellij attach {name}"
19
- from machineconfig.utils.code import exit_then_run_shell_script
20
- exit_then_run_shell_script(result, strict=True)
21
-
22
- if new_session:
23
- cmd = """
24
- zellij --layout st2
25
- """
26
- if kill_all:
27
- cmd = f"""zellij kill-sessions
28
- {cmd}"""
29
- from machineconfig.utils.code import exit_then_run_shell_script
30
- exit_then_run_shell_script(script=cmd, strict=True)
31
- typer.Exit()
32
- return
33
- cmd = "zellij list-sessions"
34
- import subprocess
35
- sessions: list[str] = subprocess.check_output(cmd, shell=True).decode().strip().split("\n")
36
- # filter out empty lines and keep raw lines (they contain creation info)
37
- sessions = [s for s in sessions if s.strip()]
38
- sessions.sort(key=lambda s: "EXITED" in s)
39
-
40
- if "current" in sessions:
41
- print("Already in a Zellij session, avoiding nesting and exiting.")
10
+ from machineconfig.scripts.python.helpers.helpers_terminal.terminal_impl import choose_zellij_session as impl
11
+ action, payload = impl(name=name, new_session=new_session, kill_all=kill_all)
12
+ if action == "error":
13
+ typer.echo(payload, err=True, color=True)
42
14
  raise typer.Exit()
43
- if len(sessions) == 0:
44
- print("No Zellij sessions found, creating a new one.")
45
- result = """zellij --layout st2"""
46
- elif len(sessions) == 1:
47
- session_name = sessions[0].split(" [Created")[0]
48
- print(f"Only one Zellij session found: {session_name}, attaching to it.")
49
- result = f"zellij attach {session_name}"
50
- else:
51
- from machineconfig.utils.options import choose_from_options
52
- # Artificially inject a "NEW SESSION" option so the user can create one from the list
53
- NEW_SESSION_LABEL = "NEW SESSION"
54
- options = [NEW_SESSION_LABEL] + sessions
55
- session_name = choose_from_options(msg="Choose a Zellij session to attach to:", multi=False, options=options, tv=True)
56
- if session_name == NEW_SESSION_LABEL:
57
- cmd = "zellij --layout st2"
58
- if kill_all:
59
- cmd = f"zellij kill-sessions\n{cmd}"
60
- from machineconfig.utils.code import exit_then_run_shell_script
61
- exit_then_run_shell_script(cmd, strict=True)
62
- raise typer.Exit()
63
- session_name = session_name.split(" [Created")[0]
64
- result = f"zellij attach {session_name}"
65
- from machineconfig.utils.code import exit_then_run_shell_script
66
- exit_then_run_shell_script(result, strict=True)
67
-
15
+ if action == "run_script" and payload:
16
+ from machineconfig.utils.code import exit_then_run_shell_script
17
+ exit_then_run_shell_script(payload, strict=True)
68
18
 
69
19
 
70
20
  def get_session_tabs() -> list[tuple[str, str]]:
71
21
  """Get all Zellij session tabs."""
72
- cmd = "zellij list-sessions"
73
- import subprocess
74
- sessions: list[str] = subprocess.check_output(cmd, shell=True).decode().strip().split("\n")
75
- sessions = [strip_ansi_codes(s) for s in sessions]
76
- active_sessions = [s for s in sessions if "EXITED" not in s]
77
- result: list[tuple[str, str]] = []
78
- for session_line in active_sessions:
79
- session_name = session_line.split(" [Created")[0].strip()
80
- # Query tab names for the session
81
- tab_cmd = f"zellij --session {session_name} action query-tab-names"
82
- try:
83
- tabs: list[str] = subprocess.check_output(tab_cmd, shell=True).decode().strip().split("\n")
84
- for tab in tabs:
85
- if tab.strip():
86
- result.append((session_name, tab.strip()))
87
- except subprocess.CalledProcessError:
88
- # Skip if query fails
89
- continue
22
+ from machineconfig.scripts.python.helpers.helpers_terminal.terminal_impl import get_session_tabs as impl
23
+ result = impl()
90
24
  print(result)
91
25
  return result
92
26
 
93
27
 
94
- def start_wt(layout_name: Annotated[str, typer.Argument(help="Layout name to start.")]):
28
+ def start_wt(layout_name: Annotated[str, typer.Argument(help="Layout name to start.")]) -> None:
95
29
  """Start a Windows Terminal layout by name."""
96
- from pathlib import Path
97
- layouts_file = Path.home().joinpath("dotfiles/machineconfig/layouts.json")
98
- if not layouts_file.exists():
99
- typer.echo(f"❌ Layouts file not found: {layouts_file}")
100
- # available
101
- raise typer.Exit(code=1)
102
- import json
103
- from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
104
- layouts_data: LayoutsFile = json.loads(layouts_file.read_text(encoding="utf-8"))
105
- chosen_layout = next((a_layout for a_layout in layouts_data["layouts"] if a_layout["layoutName"] == layout_name), None)
106
- if not chosen_layout:
107
- typer.echo(f"❌ Layout '{layout_name}' not found in layouts file.")
108
- available_layouts = [a_layout["layoutName"] for a_layout in layouts_data["layouts"]]
109
- typer.echo(f"Available layouts: {', '.join(available_layouts)}")
30
+ from machineconfig.scripts.python.helpers.helpers_terminal.terminal_impl import start_wt as impl
31
+ status, message = impl(layout_name=layout_name)
32
+ if status == "error":
33
+ typer.echo(message)
110
34
  raise typer.Exit(code=1)
111
- from machineconfig.cluster.sessions_managers.wt_local import run_wt_layout
112
- run_wt_layout(layout_config=chosen_layout)
113
35
  # cmd = f'powershell -ExecutionPolicy Bypass -File "./{layout_name}_layout.ps1"'
114
36
  # from machineconfig.utils.code import exit_then_run_shell_script
115
37
  # exit_then_run_shell_script(cmd, strict=True)
116
38
 
117
39
 
118
40
  def get_app():
119
- app = typer.Typer(help="🖥️ Terminal utilities", no_args_is_help=True, add_help_option=False)
41
+ app = typer.Typer(help="🖥️ Terminal utilities", no_args_is_help=True, add_help_option=True, add_completion=False)
120
42
  app.command(name="attach-to-zellij", no_args_is_help=False, help=choose_zellij_session.__doc__, short_help="[z] Choose a Zellij session to attach to")(choose_zellij_session)
121
43
  app.command(name="z", hidden=True, no_args_is_help=False, help=choose_zellij_session.__doc__)(choose_zellij_session)
122
44
 
@@ -1,38 +1,119 @@
1
- from machineconfig.scripts.python.helpers_utils.pdf import merge_pdfs, compress_pdf
2
- from machineconfig.scripts.python.helpers_utils.python import edit_file_with_hx, get_machine_specs, init_project, tui_env
3
- from machineconfig.scripts.python.helpers_utils.download import download
1
+ """Utility commands - lazy loading subcommands."""
2
+
4
3
  import typer
5
- from typing import Annotated
4
+ from typing import Annotated, Optional, Literal
6
5
 
7
6
 
8
- def kill_process(
9
- # name: Annotated[Optional[str], typer.Option(..., "--name", "-n", help="Name of the process to kill")],
10
- # command: Annotated[str, typer.Option(..., "--command", "-c", help="Match by command line instead of process name")] = "",
11
- interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Interactively choose the process to kill")] = True):
7
+ def kill_process(interactive: Annotated[bool, typer.Option(..., "--interactive", "-i", help="Interactively choose the process to kill")] = True) -> None:
8
+ """⚔️ Choose a process to kill."""
12
9
  from machineconfig.utils.procs import main, ProcessManager
13
10
  if interactive:
14
11
  main()
15
12
  return
16
13
  _ = ProcessManager
17
- # pm = ProcessManager()
18
- # if command:
19
- # pm.filter_and_kill(name=command
20
- # )
21
14
 
22
15
 
23
- def upgrade_packages():
16
+ def upgrade_packages(root: Annotated[str, typer.Argument(help="Root directory of the project")] = ".") -> None:
17
+ """⬆️ Upgrade project dependencies."""
24
18
  from machineconfig.utils.upgrade_packages import generate_uv_add_commands
25
19
  from pathlib import Path
26
- generate_uv_add_commands(pyproject_path=Path.cwd() / "pyproject.toml", output_path=Path.cwd() / "pyproject_init.sh")
20
+ root_resolved = Path(root).expanduser().absolute().resolve()
21
+ generate_uv_add_commands(pyproject_path=root_resolved / "pyproject.toml", output_path=root_resolved / "pyproject_init.sh")
22
+ def tui_env(which: Annotated[Literal["PATH", "p", "ENV", "e"], typer.Argument(help="Which environment variable to display.")] = "ENV") -> None:
23
+ """📚 NAVIGATE ENV/PATH variable with TUI."""
24
+ from machineconfig.scripts.python.helpers.helpers_utils.python import tui_env as impl
25
+ impl(which=which)
26
+
27
+
28
+ def download(
29
+ url: Annotated[Optional[str], typer.Argument(..., help="The URL to download the file from.")] = None,
30
+ decompress: Annotated[bool, typer.Option(..., "--decompress", "-d", help="Decompress the file if it's an archive.")] = False,
31
+ output: Annotated[Optional[str], typer.Option("--output", "-o", help="The output file path.")] = None,
32
+ output_dir: Annotated[Optional[str], typer.Option("--output-dir", help="Directory to place the downloaded file in.")] = None,
33
+ ) -> None:
34
+ """⬇️ Download a file from a URL and optionally decompress it."""
35
+ from machineconfig.scripts.python.helpers.helpers_utils.download import download as impl
36
+ impl(url=url, decompress=decompress, output=output, output_dir=output_dir)
37
+
38
+
39
+ def get_machine_specs(hardware: Annotated[bool, typer.Option(..., "--hardware", "-h", help="Show compute capability")] = False) -> None:
40
+ """💻 Get machine specifications."""
41
+ from machineconfig.scripts.python.helpers.helpers_utils.python import get_machine_specs as impl
42
+ impl(hardware=hardware)
43
+
44
+
45
+ def type_hint(path: Annotated[str, typer.Argument(..., help="Path to file/project dir to type hint.")] = ".",
46
+ dependency: Annotated[Literal["self-contained", "import"], typer.Option(..., "--dependency", "-d", help="Generated file is self contained or performs imports")] = "self-contained"
47
+ ) -> None:
48
+ from machineconfig.type_hinting.typedict.generators import generate_names_file
49
+ from pathlib import Path
50
+ path_resolved = Path(path).resolve()
51
+ if not path_resolved.exists():
52
+ typer.echo(f"Error: The provided path '{path}' does not exist.", err=True)
53
+ raise typer.Exit(code=1)
54
+ if path_resolved.is_file():
55
+ modules = [path_resolved]
56
+ else:
57
+ if not (path_resolved / "pyproject.toml").exists():
58
+ typer.echo("Error: Provided directory path is not a project root (missing pyproject.toml).", err=True)
59
+ raise typer.Exit(code=1)
60
+ else:
61
+ modules = [file for file in path_resolved.rglob("dtypes.py") if ".venv" not in str(file)]
62
+ for input_file in modules:
63
+ print(f"Worked on: {input_file}")
64
+ output_file = input_file.parent.joinpath(f"{input_file.stem}_names.py")
65
+ generated_file = generate_names_file(input_file, output_file, search_paths=None, dependency=dependency)
66
+ print(f"Generated: {generated_file}")
67
+
68
+
69
+ def init_project(
70
+ name: Annotated[Optional[str], typer.Option("--name", "-n", help="Name of the project.")] = None,
71
+ tmp_dir: Annotated[bool, typer.Option("--tmp-dir", "-t", help="Use a temporary directory for the project initialization.")] = False,
72
+ python: Annotated[Literal["3.11", "3.12", "3.13", "3.14"], typer.Option("--python", "-p", help="Python sub version for the uv virtual environment.")] = "3.13",
73
+ libraries: Annotated[Optional[str], typer.Option("--libraries", "-l", help="Additional packages to include in the uv virtual environment (space separated).")] = None,
74
+ group: Annotated[Optional[str], typer.Option("--group", "-g", help="group of packages names (no separation) p:plot, t:types, l:linting, i:interactive, d:data")] = "p,t,l,i,d",
75
+ ) -> None:
76
+ """🚀 Initialize a project with a uv virtual environment and install dev packages."""
77
+ from machineconfig.scripts.python.helpers.helpers_utils.python import init_project as impl
78
+ impl(name=name, tmp_dir=tmp_dir, python=python, libraries=libraries, group=group)
79
+
80
+
81
+ def edit_file_with_hx(path: Annotated[Optional[str], typer.Argument(..., help="The root directory of the project to edit, or a file path.")] = None) -> None:
82
+ """✏️ Open a file in the default editor."""
83
+ from machineconfig.scripts.python.helpers.helpers_utils.python import edit_file_with_hx as impl
84
+ impl(path=path)
85
+
86
+
87
+ def merge_pdfs(
88
+ pdfs: Annotated[list[str], typer.Argument(..., help="Paths to the PDF files to merge.")],
89
+ output: Annotated[Optional[str], typer.Option("--output", "-o", help="Output merged PDF file path.")] = None,
90
+ compress: Annotated[bool, typer.Option("--compress", "-c", help="Compress the output PDF.")] = False,
91
+ ) -> None:
92
+ """📄 Merge two PDF files into one."""
93
+ from machineconfig.scripts.python.helpers.helpers_utils.pdf import merge_pdfs as impl
94
+ impl(pdfs=pdfs, output=output, compress=compress)
95
+
96
+
97
+ def compress_pdf(
98
+ pdf_input: Annotated[str, typer.Argument(..., help="Path to the input PDF file to compress.")],
99
+ output: Annotated[Optional[str], typer.Option("--output", "-o", help="Output compressed PDF file path.")] = None,
100
+ quality: Annotated[int, typer.Option("--quality", "-q", help="JPEG quality for image compression (0-100, 0=no change, 100=best).")] = 85,
101
+ image_dpi: Annotated[int, typer.Option("--image-dpi", "-d", help="Target DPI for image resampling.")] = 0,
102
+ compress_streams: Annotated[bool, typer.Option("--compress-streams", "-c", help="Compress uncompressed streams.")] = True,
103
+ use_objstms: Annotated[bool, typer.Option("--object-streams", "-s", help="Use object streams for additional compression.")] = True,
104
+ ) -> None:
105
+ """📦 Compress a PDF file."""
106
+ from machineconfig.scripts.python.helpers.helpers_utils.pdf import compress_pdf as impl
107
+ impl(pdf_input=pdf_input, output=output, quality=quality, image_dpi=image_dpi, compress_streams=compress_streams, use_objstms=use_objstms)
27
108
 
28
109
 
29
110
  def get_app() -> typer.Typer:
30
- app = typer.Typer(help="🛠️ utilities operations", no_args_is_help=True, add_help_option=False, add_completion=False)
111
+ app = typer.Typer(help="🛠️ utilities operations", no_args_is_help=True, add_help_option=True, add_completion=False)
31
112
  app.command(name="kill-process", no_args_is_help=False, help="⚔️ [k] Choose a process to kill")(kill_process)
32
- app.command(name="k", no_args_is_help=False, help="Choose a process to kill", hidden=True)(kill_process)
113
+ app.command(name="k", no_args_is_help=False, hidden=True)(kill_process)
33
114
 
34
115
  app.command("environment", no_args_is_help=False, help="📚 [v] NAVIGATE ENV/PATH variable with TUI")(tui_env)
35
- app.command("v", no_args_is_help=False, help="NAVIGATE ENV/PATH variable with TUI", hidden=True)(tui_env)
116
+ app.command("v", no_args_is_help=False, hidden=True)(tui_env)
36
117
 
37
118
  app.command(name="upgrade-packages", no_args_is_help=False, help="⬆️ [up] Upgrade project dependencies.")(upgrade_packages)
38
119
  app.command(name="up", no_args_is_help=False, hidden=True)(upgrade_packages)
@@ -51,12 +132,12 @@ def get_app() -> typer.Typer:
51
132
  app.command(name="pdf-compress", no_args_is_help=True, help="📦 [pc] Compress a PDF file.")(compress_pdf)
52
133
  app.command(name="pc", no_args_is_help=True, hidden=True)(compress_pdf)
53
134
 
54
- # app.command(name="copy", no_args_is_help=True, help="[c] Copy files or directories.")(copy)
55
- # app.command(name="c", no_args_is_help=True, hidden=True)(copy)
135
+ app.command(name="type-hint", no_args_is_help=True, help="📝 [t] Type hint a file or project directory.")(type_hint)
136
+ app.command(name="t", no_args_is_help=True, hidden=True)(type_hint)
56
137
 
57
138
  return app
58
139
 
59
140
 
60
141
  def main():
61
142
  app = get_app()
62
- app()
143
+ app()