machineconfig 6.82__py3-none-any.whl → 7.98__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.
Files changed (294) hide show
  1. machineconfig/cluster/remote/cloud_manager.py +1 -1
  2. machineconfig/cluster/sessions_managers/utils/maker.py +25 -13
  3. machineconfig/cluster/sessions_managers/wt_local.py +16 -221
  4. machineconfig/cluster/sessions_managers/wt_local_manager.py +55 -193
  5. machineconfig/cluster/sessions_managers/wt_remote_manager.py +42 -198
  6. machineconfig/cluster/sessions_managers/wt_utils/manager_persistence.py +52 -0
  7. machineconfig/cluster/sessions_managers/wt_utils/monitoring_helpers.py +50 -0
  8. machineconfig/cluster/sessions_managers/wt_utils/status_reporting.py +76 -0
  9. machineconfig/cluster/sessions_managers/wt_utils/wt_helpers.py +199 -0
  10. machineconfig/cluster/sessions_managers/zellij_local_manager.py +3 -1
  11. machineconfig/cluster/sessions_managers/zellij_remote_manager.py +3 -2
  12. machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +2 -2
  13. machineconfig/jobs/installer/custom/boxes.py +2 -2
  14. machineconfig/jobs/installer/custom/hx.py +75 -18
  15. machineconfig/jobs/installer/custom/yazi.py +119 -0
  16. machineconfig/jobs/installer/custom_dev/brave.py +5 -3
  17. machineconfig/jobs/installer/custom_dev/cloudflare_warp_cli.py +23 -0
  18. machineconfig/jobs/installer/custom_dev/code.py +4 -1
  19. machineconfig/jobs/installer/custom_dev/dubdb_adbc.py +1 -1
  20. machineconfig/jobs/installer/custom_dev/nerdfont.py +1 -1
  21. machineconfig/jobs/installer/custom_dev/nerfont_windows_helper.py +27 -22
  22. machineconfig/jobs/installer/custom_dev/sysabc.py +139 -0
  23. machineconfig/jobs/installer/custom_dev/wezterm.py +2 -19
  24. machineconfig/jobs/installer/custom_dev/winget.py +10 -14
  25. machineconfig/jobs/installer/installer_data.json +1287 -216
  26. machineconfig/jobs/installer/linux_scripts/q.sh +10 -7
  27. machineconfig/jobs/installer/linux_scripts/redis.sh +1 -0
  28. machineconfig/jobs/installer/package_groups.py +58 -89
  29. machineconfig/jobs/installer/powershell_scripts/install_fonts.ps1 +129 -34
  30. machineconfig/logger.py +0 -1
  31. machineconfig/profile/create_helper.py +43 -16
  32. machineconfig/profile/create_links.py +2 -1
  33. machineconfig/profile/create_links_export.py +64 -18
  34. machineconfig/profile/create_shell_profile.py +78 -127
  35. machineconfig/profile/mapper.toml +15 -8
  36. machineconfig/scripts/__init__.py +0 -4
  37. machineconfig/scripts/linux/wrap_mcfg +46 -0
  38. machineconfig/scripts/nu/wrap_mcfg.nu +69 -0
  39. machineconfig/scripts/python/agents.py +52 -37
  40. machineconfig/scripts/python/ai/initai.py +1 -1
  41. machineconfig/scripts/python/ai/scripts/command_runner.ps1 +33 -0
  42. machineconfig/scripts/python/ai/{command_runner → scripts}/command_runner.sh +1 -1
  43. machineconfig/scripts/python/ai/solutions/copilot/{chatmodes/Thinking-Beast-Mode.chatmode.md → agents/Thinking-Beast-Mode.agent.md} +0 -1
  44. machineconfig/scripts/python/ai/solutions/copilot/{chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md → agents/Ultimate-Transparent-Thinking-Beast-Mode.agent.md} +0 -1
  45. machineconfig/scripts/python/ai/solutions/copilot/{chatmodes/deepResearch.chatmode.md → agents/deepResearch.agent.md} +2 -2
  46. machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +5 -5
  47. machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +4 -0
  48. machineconfig/scripts/python/ai/solutions/copilot/instructions/python/watch_exec.prompt.md +20 -0
  49. machineconfig/scripts/python/ai/solutions/generic.py +1 -1
  50. machineconfig/scripts/python/ai/{generate_files.py → utils/generate_files.py} +2 -2
  51. machineconfig/scripts/python/ai/{vscode_tasks.py → utils/vscode_tasks.py} +7 -2
  52. machineconfig/scripts/python/croshell.py +77 -78
  53. machineconfig/scripts/python/devops.py +39 -21
  54. machineconfig/scripts/python/devops_navigator.py +0 -4
  55. machineconfig/scripts/python/env_manager/env_manager_tui.py +204 -0
  56. machineconfig/scripts/python/env_manager/path_manager_tui.py +1 -1
  57. machineconfig/scripts/python/fire_jobs.py +84 -115
  58. machineconfig/scripts/python/ftpx.py +42 -16
  59. machineconfig/scripts/python/helpers/ast_search.py +74 -0
  60. machineconfig/scripts/python/helpers/qr_code.py +166 -0
  61. machineconfig/scripts/python/helpers/repo_rag.py +325 -0
  62. machineconfig/scripts/python/helpers/run_py_script.py +79 -0
  63. machineconfig/scripts/python/helpers/symantic_search.py +25 -0
  64. machineconfig/scripts/python/helpers/tmp_py_scripts/a.py +26 -0
  65. machineconfig/scripts/python/{helpers_fire → helpers_agents}/agentic_frameworks/fire_crush.json +1 -1
  66. machineconfig/scripts/python/helpers_agents/agentic_frameworks/fire_crush.py +39 -0
  67. machineconfig/scripts/python/{helpers_fire → helpers_agents}/agentic_frameworks/fire_cursor_agents.py +3 -4
  68. machineconfig/scripts/python/helpers_agents/agentic_frameworks/fire_gemini.py +55 -0
  69. machineconfig/scripts/python/helpers_agents/agentic_frameworks/fire_qwen.py +30 -0
  70. machineconfig/scripts/python/{helpers_fire → helpers_agents}/fire_agents_help_launch.py +32 -13
  71. machineconfig/scripts/python/{helpers_fire → helpers_agents}/fire_agents_helper_types.py +11 -14
  72. machineconfig/scripts/python/helpers_agents/templates/prompt.txt +10 -0
  73. machineconfig/scripts/python/helpers_agents/templates/template.sh +32 -0
  74. machineconfig/scripts/python/helpers_cloud/cloud_copy.py +28 -21
  75. machineconfig/scripts/python/helpers_cloud/cloud_helpers.py +1 -1
  76. machineconfig/scripts/python/helpers_cloud/cloud_mount.py +19 -17
  77. machineconfig/scripts/python/helpers_cloud/cloud_sync.py +8 -7
  78. machineconfig/scripts/python/helpers_croshell/crosh.py +3 -3
  79. machineconfig/scripts/python/helpers_croshell/start_slidev.py +6 -7
  80. machineconfig/scripts/python/helpers_devops/cli_config.py +46 -61
  81. machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +67 -55
  82. machineconfig/scripts/python/helpers_devops/cli_nw.py +157 -16
  83. machineconfig/scripts/python/helpers_devops/cli_repos.py +55 -21
  84. machineconfig/scripts/python/helpers_devops/cli_self.py +98 -48
  85. machineconfig/scripts/python/helpers_devops/cli_share_file.py +137 -0
  86. machineconfig/scripts/python/helpers_devops/cli_share_server.py +80 -42
  87. machineconfig/scripts/python/helpers_devops/{cli_terminal.py → cli_share_terminal.py} +15 -17
  88. machineconfig/scripts/python/helpers_devops/cli_utils.py +3 -128
  89. machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +4 -4
  90. machineconfig/scripts/python/helpers_devops/devops_status.py +7 -19
  91. machineconfig/scripts/python/helpers_devops/themes/choose_wezterm_theme.py +1 -1
  92. machineconfig/scripts/python/{helpers_fire/helpers4.py → helpers_fire_command/file_wrangler.py} +56 -20
  93. machineconfig/scripts/python/helpers_fire_command/fire_jobs_route_helper.py +26 -16
  94. machineconfig/scripts/python/helpers_msearch/__init__.py +5 -0
  95. machineconfig/scripts/{linux → python/helpers_msearch/scripts_linux}/fzfg +3 -3
  96. machineconfig/scripts/python/helpers_msearch/scripts_windows/fzfg.ps1 +59 -0
  97. machineconfig/scripts/python/helpers_navigator/command_tree.py +50 -18
  98. machineconfig/scripts/python/helpers_network/address.py +132 -0
  99. machineconfig/scripts/python/{nw → helpers_network}/devops_add_ssh_key.py +24 -5
  100. machineconfig/scripts/python/{nw → helpers_network}/mount_nfs +0 -1
  101. machineconfig/scripts/python/{nw → helpers_network}/mount_nfs.py +2 -2
  102. machineconfig/scripts/python/{nw → helpers_network}/mount_ssh.py +1 -1
  103. machineconfig/scripts/python/{nw → helpers_network}/ssh_debug_linux.py +7 -7
  104. machineconfig/scripts/python/{nw → helpers_network}/ssh_debug_windows.py +4 -4
  105. machineconfig/scripts/python/{nw → helpers_network}/wifi_conn.py +1 -53
  106. machineconfig/scripts/python/{nw → helpers_network}/wsl_windows_transfer.py +3 -2
  107. machineconfig/scripts/python/helpers_repos/clone.py +0 -1
  108. machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py +46 -19
  109. machineconfig/scripts/python/helpers_repos/entrypoint.py +2 -1
  110. machineconfig/scripts/python/helpers_repos/grource.py +1 -1
  111. machineconfig/scripts/python/helpers_repos/record.py +2 -1
  112. machineconfig/scripts/python/helpers_repos/repo_analyzer_1.py +160 -0
  113. machineconfig/scripts/python/helpers_repos/{count_lines.py → repo_analyzer_2.py} +113 -192
  114. machineconfig/scripts/python/helpers_sessions/sessions_multiprocess.py +20 -13
  115. machineconfig/scripts/python/helpers_utils/download.py +150 -0
  116. machineconfig/scripts/python/helpers_utils/path.py +185 -0
  117. machineconfig/scripts/python/interactive.py +19 -26
  118. machineconfig/scripts/python/{mcfg.py → mcfg_entry.py} +10 -0
  119. machineconfig/scripts/python/msearch.py +71 -0
  120. machineconfig/scripts/python/sessions.py +94 -25
  121. machineconfig/scripts/python/terminal.py +133 -0
  122. machineconfig/scripts/python/utils.py +28 -30
  123. machineconfig/scripts/windows/mounts/mount_ssh.ps1 +1 -1
  124. machineconfig/scripts/windows/wrap_mcfg.ps1 +63 -0
  125. machineconfig/settings/broot/conf.toml +1 -1
  126. machineconfig/settings/helix/config.toml +16 -0
  127. machineconfig/settings/helix/languages.toml +13 -4
  128. machineconfig/settings/helix/yazi-picker.sh +12 -0
  129. machineconfig/settings/lf/linux/exe/lfcd.sh +1 -0
  130. machineconfig/settings/lf/linux/exe/previewer.sh +3 -2
  131. machineconfig/settings/lf/windows/lfcd.ps1 +1 -1
  132. machineconfig/settings/lf/windows/lfrc +14 -16
  133. machineconfig/settings/marimo/marimo.toml +1 -1
  134. machineconfig/settings/marimo/snippets/globalize.py +34 -0
  135. machineconfig/settings/shells/bash/init.sh +43 -11
  136. machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +1 -1
  137. machineconfig/settings/shells/nushell/config.nu +2 -32
  138. machineconfig/settings/shells/nushell/env.nu +45 -6
  139. machineconfig/settings/shells/nushell/init.nu +314 -0
  140. machineconfig/settings/shells/pwsh/init.ps1 +40 -14
  141. machineconfig/settings/shells/starship/starship.toml +16 -0
  142. machineconfig/settings/shells/wezterm/wezterm.lua +2 -0
  143. machineconfig/settings/shells/wt/settings.json +14 -5
  144. machineconfig/settings/shells/zsh/init.sh +17 -19
  145. machineconfig/settings/television/cable_unix/alias.toml +8 -0
  146. machineconfig/settings/television/cable_unix/aws-buckets.toml +14 -0
  147. machineconfig/settings/television/cable_unix/aws-instances.toml +13 -0
  148. machineconfig/settings/television/cable_unix/bash-history.toml +8 -0
  149. machineconfig/settings/television/cable_unix/channels.toml +19 -0
  150. machineconfig/settings/television/cable_unix/dirs.toml +13 -0
  151. machineconfig/settings/television/cable_unix/distrobox-list.toml +42 -0
  152. machineconfig/settings/television/cable_unix/docker-images.toml +13 -0
  153. machineconfig/settings/television/cable_unix/dotfiles.toml +11 -0
  154. machineconfig/settings/television/cable_unix/env.toml +17 -0
  155. machineconfig/settings/television/cable_unix/files.toml +11 -0
  156. machineconfig/settings/television/cable_unix/fish-history.toml +8 -0
  157. machineconfig/settings/television/cable_unix/git-branch.toml +11 -0
  158. machineconfig/settings/television/cable_unix/git-diff.toml +10 -0
  159. machineconfig/settings/television/cable_unix/git-log.toml +12 -0
  160. machineconfig/settings/television/cable_unix/git-reflog.toml +12 -0
  161. machineconfig/settings/television/cable_unix/git-repos.toml +16 -0
  162. machineconfig/settings/television/cable_unix/guix.toml +20 -0
  163. machineconfig/settings/television/cable_unix/just-recipes.toml +18 -0
  164. machineconfig/settings/television/cable_unix/k8s-deployments.toml +36 -0
  165. machineconfig/settings/television/cable_unix/k8s-pods.toml +50 -0
  166. machineconfig/settings/television/cable_unix/k8s-services.toml +36 -0
  167. machineconfig/settings/television/cable_unix/man-pages.toml +24 -0
  168. machineconfig/settings/television/cable_unix/nu-history.toml +7 -0
  169. machineconfig/settings/television/cable_unix/procs.toml +20 -0
  170. machineconfig/settings/television/cable_unix/text.toml +17 -0
  171. machineconfig/settings/television/cable_unix/tldr.toml +18 -0
  172. machineconfig/settings/television/cable_unix/zsh-history.toml +9 -0
  173. machineconfig/settings/television/cable_windows/alias.toml +7 -0
  174. machineconfig/settings/television/cable_windows/dirs.toml +13 -0
  175. machineconfig/settings/television/cable_windows/docker-images.toml +13 -0
  176. machineconfig/settings/television/cable_windows/dotfiles.toml +11 -0
  177. machineconfig/settings/television/cable_windows/env.toml +17 -0
  178. machineconfig/settings/television/cable_windows/files.toml +14 -0
  179. machineconfig/settings/television/cable_windows/git-branch.toml +11 -0
  180. machineconfig/settings/television/cable_windows/git-diff.toml +10 -0
  181. machineconfig/settings/television/cable_windows/git-log.toml +11 -0
  182. machineconfig/settings/television/cable_windows/git-reflog.toml +11 -0
  183. machineconfig/settings/television/cable_windows/git-repos.toml +15 -0
  184. machineconfig/settings/television/cable_windows/nu-history.toml +7 -0
  185. machineconfig/settings/television/cable_windows/pwsh-history.toml +6 -0
  186. machineconfig/settings/television/cable_windows/text.toml +17 -0
  187. machineconfig/settings/yazi/init.lua +61 -0
  188. machineconfig/settings/yazi/keymap_linux.toml +94 -0
  189. machineconfig/settings/yazi/keymap_windows.toml +78 -0
  190. machineconfig/settings/yazi/shell/yazi_cd.ps1 +33 -0
  191. machineconfig/settings/yazi/shell/yazi_cd.sh +8 -0
  192. machineconfig/settings/yazi/theme.toml +4 -0
  193. machineconfig/settings/yazi/yazi_linux.toml +84 -0
  194. machineconfig/settings/yazi/yazi_windows.toml +58 -0
  195. machineconfig/setup_linux/__init__.py +2 -1
  196. machineconfig/setup_linux/web_shortcuts/interactive.sh +27 -12
  197. machineconfig/setup_linux/web_shortcuts/live_from_github.sh +31 -0
  198. machineconfig/setup_mac/__init__.py +2 -3
  199. machineconfig/setup_mac/apps_gui.sh +248 -0
  200. machineconfig/setup_windows/__init__.py +3 -3
  201. machineconfig/setup_windows/uv.ps1 +8 -1
  202. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +26 -11
  203. machineconfig/setup_windows/web_shortcuts/live_from_github.ps1 +30 -0
  204. machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +17 -0
  205. machineconfig/utils/accessories.py +7 -4
  206. machineconfig/utils/code.py +99 -32
  207. machineconfig/utils/files/ascii_art.py +1 -1
  208. machineconfig/utils/files/headers.py +3 -2
  209. machineconfig/utils/installer_utils/github_release_bulk.py +156 -119
  210. machineconfig/utils/installer_utils/install_from_url.py +183 -0
  211. machineconfig/utils/installer_utils/installer_class.py +42 -99
  212. machineconfig/utils/installer_utils/installer_cli.py +175 -0
  213. machineconfig/utils/installer_utils/installer_helper.py +129 -0
  214. machineconfig/utils/installer_utils/{installer_abc.py → installer_locator_utils.py} +36 -85
  215. machineconfig/utils/{installer.py → installer_utils/installer_runner.py} +16 -61
  216. machineconfig/utils/io.py +69 -1
  217. machineconfig/utils/links.py +56 -38
  218. machineconfig/utils/meta.py +33 -18
  219. machineconfig/utils/options.py +46 -18
  220. machineconfig/utils/options_tv.py +119 -0
  221. machineconfig/utils/path_extended.py +44 -95
  222. machineconfig/utils/path_helper.py +76 -23
  223. machineconfig/utils/procs.py +1 -1
  224. machineconfig/utils/scheduler.py +20 -53
  225. machineconfig/utils/scheduling.py +0 -2
  226. machineconfig/utils/schemas/fire_agents/fire_agents_input.py +1 -1
  227. machineconfig/utils/schemas/layouts/layout_types.py +1 -1
  228. machineconfig/utils/ssh.py +159 -412
  229. machineconfig/utils/ssh_utils/abc.py +5 -0
  230. machineconfig/utils/ssh_utils/copy_from_here.py +111 -0
  231. machineconfig/utils/ssh_utils/copy_to_here.py +302 -0
  232. machineconfig/utils/ssh_utils/utils.py +142 -0
  233. machineconfig/utils/ssh_utils/wsl.py +210 -0
  234. machineconfig/utils/terminal.py +1 -0
  235. machineconfig/utils/upgrade_packages.py +104 -28
  236. machineconfig/utils/ve.py +12 -4
  237. machineconfig-7.98.dist-info/METADATA +132 -0
  238. {machineconfig-6.82.dist-info → machineconfig-7.98.dist-info}/RECORD +259 -196
  239. {machineconfig-6.82.dist-info → machineconfig-7.98.dist-info}/entry_points.txt +4 -1
  240. machineconfig/jobs/installer/linux_scripts/pgsql.sh +0 -41
  241. machineconfig/jobs/installer/linux_scripts/timescaledb.sh +0 -71
  242. machineconfig/jobs/installer/powershell_scripts/archive_pygraphviz.ps1 +0 -12
  243. machineconfig/scripts/linux/fzf2g +0 -21
  244. machineconfig/scripts/linux/fzfag +0 -17
  245. machineconfig/scripts/linux/fzffg +0 -25
  246. machineconfig/scripts/linux/fzfrga +0 -21
  247. machineconfig/scripts/linux/mcfgs +0 -38
  248. machineconfig/scripts/linux/other/share_smb +0 -1
  249. machineconfig/scripts/linux/skrg +0 -4
  250. machineconfig/scripts/linux/warp-cli.sh +0 -122
  251. machineconfig/scripts/linux/z_ls +0 -104
  252. machineconfig/scripts/python/ai/command_runner/prompt.txt +0 -9
  253. machineconfig/scripts/python/helpers_fire/agentic_frameworks/fire_crush.py +0 -37
  254. machineconfig/scripts/python/helpers_fire/agentic_frameworks/fire_gemini.py +0 -44
  255. machineconfig/scripts/python/helpers_fire/agentic_frameworks/fire_qwen.py +0 -43
  256. machineconfig/scripts/python/helpers_fire/prompt.txt +0 -2
  257. machineconfig/scripts/python/helpers_fire/template.sh +0 -15
  258. machineconfig/scripts/python/helpers_repos/count_lines_frontend.py +0 -17
  259. machineconfig/scripts/python/helpers_repos/secure_repo.py +0 -15
  260. machineconfig/scripts/python/nw/add_ssh_key.py +0 -148
  261. machineconfig/scripts/windows/fzfb.ps1 +0 -3
  262. machineconfig/scripts/windows/fzfg.ps1 +0 -2
  263. machineconfig/scripts/windows/fzfrga.bat +0 -20
  264. machineconfig/scripts/windows/mcfgs.ps1 +0 -17
  265. machineconfig/settings/lf/linux/exe/fzf_nano.sh +0 -16
  266. machineconfig/settings/lf/windows/fzf_edit.ps1 +0 -6
  267. machineconfig/settings/lf/windows/tst.ps1 +0 -1
  268. machineconfig/settings/yazi/yazi.toml +0 -4
  269. machineconfig/setup_linux/apps.sh +0 -66
  270. machineconfig/setup_linux/others/cli_installation.sh +0 -137
  271. machineconfig/setup_mac/apps.sh +0 -73
  272. machineconfig/setup_windows/apps.ps1 +0 -62
  273. machineconfig/utils/installer_utils/installer.py +0 -225
  274. machineconfig-6.82.dist-info/METADATA +0 -82
  275. /machineconfig/jobs/installer/linux_scripts/{warp-cli.sh → cloudflare_warp_cli.sh} +0 -0
  276. /machineconfig/scripts/python/{helpers_fire → ai/utils}/__init__.py +0 -0
  277. /machineconfig/scripts/python/{helpers_fire/agentic_frameworks → helpers_agents}/__init__.py +0 -0
  278. /machineconfig/scripts/python/{nw → helpers_agents/agentic_frameworks}/__init__.py +0 -0
  279. /machineconfig/scripts/python/{helpers_fire → helpers_agents}/fire_agents_help_search.py +0 -0
  280. /machineconfig/scripts/python/{helpers_fire → helpers_agents}/fire_agents_load_balancer.py +0 -0
  281. /machineconfig/scripts/python/{helpers_fire → helpers_agents/templates}/template.ps1 +0 -0
  282. /machineconfig/{settings/shells/pwsh/profile.ps1 → scripts/python/helpers_fire_command/f.py} +0 -0
  283. /machineconfig/{settings/yazi/keymap.toml → scripts/python/helpers_network/__init__.py} +0 -0
  284. /machineconfig/scripts/python/{nw → helpers_network}/devops_add_identity.py +0 -0
  285. /machineconfig/scripts/python/{nw → helpers_network}/mount_drive +0 -0
  286. /machineconfig/scripts/python/{nw → helpers_network}/mount_nw_drive +0 -0
  287. /machineconfig/scripts/python/{nw → helpers_network}/mount_nw_drive.py +0 -0
  288. /machineconfig/scripts/python/{nw → helpers_network}/mount_smb +0 -0
  289. /machineconfig/scripts/python/{nw → helpers_network}/onetimeshare.py +0 -0
  290. /machineconfig/scripts/{Restore-ThunderbirdProfile.ps1 → windows/mounts/Restore-ThunderbirdProfile.ps1} +0 -0
  291. /machineconfig/{jobs/installer/powershell_scripts → setup_windows/ssh}/openssh-server_add_key.ps1 +0 -0
  292. /machineconfig/{jobs/installer/powershell_scripts → setup_windows/ssh}/openssh-server_copy-ssh-id.ps1 +0 -0
  293. {machineconfig-6.82.dist-info → machineconfig-7.98.dist-info}/WHEEL +0 -0
  294. {machineconfig-6.82.dist-info → machineconfig-7.98.dist-info}/top_level.txt +0 -0
@@ -1,49 +1,109 @@
1
1
 
2
2
  import typer
3
- from typing import Optional, Annotated
3
+ from typing import Annotated, Literal
4
4
 
5
5
 
6
- def update(no_copy_assets: Annotated[bool, typer.Option("--no-assets-copy", "-na", help="Copy (overwrite) assets to the machine after the update")] = False):
6
+ def copy_both_assets():
7
+ import machineconfig.profile.create_helper as create_helper
8
+ create_helper.copy_assets_to_machine(which="scripts")
9
+ create_helper.copy_assets_to_machine(which="settings")
10
+
11
+
12
+ def init(which: Annotated[Literal["init", "ia", "live", "wrap"], typer.Argument(..., help="Comma-separated list of script names to run all initialization scripts.")] = "init",
13
+ run: Annotated[bool, typer.Option("--run/--no-run", "-r/-nr", help="Run the script after displaying it.")] = False,
14
+ ) -> None:
15
+ import platform
16
+ if platform.system() == "Linux" or platform.system() == "Darwin":
17
+ match which:
18
+ case "init":
19
+ import machineconfig.settings as module
20
+ from pathlib import Path
21
+ if platform.system() == "Darwin":
22
+ init_path = Path(module.__file__).parent.joinpath("shells", "zsh", "init.sh")
23
+ else: init_path = Path(module.__file__).parent.joinpath("shells", "bash", "init.sh")
24
+ script = init_path.read_text(encoding="utf-8")
25
+ case "ia":
26
+ from machineconfig.setup_linux import INTERACTIVE as script_path
27
+ script = script_path.read_text(encoding="utf-8")
28
+ case "live":
29
+ from machineconfig.setup_linux import LIVE as script_path
30
+ script = script_path.read_text(encoding="utf-8")
31
+ case _:
32
+ typer.echo("Unsupported shell script for Linux.")
33
+ raise typer.Exit(code=1)
34
+
35
+ elif platform.system() == "Windows":
36
+ match which:
37
+ case "init":
38
+ import machineconfig.settings as module
39
+ from pathlib import Path
40
+ init_path = Path(module.__file__).parent.joinpath("shells", "powershell", "init.ps1")
41
+ script = init_path.read_text(encoding="utf-8")
42
+ case "ia":
43
+ from machineconfig.setup_windows import INTERACTIVE as script_path
44
+ script = script_path.read_text(encoding="utf-8")
45
+ case "live":
46
+ from machineconfig.setup_windows import LIVE as script_path
47
+ script = script_path.read_text(encoding="utf-8")
48
+ case _:
49
+ typer.echo("Unsupported shell script for Windows.")
50
+ raise typer.Exit(code=1)
51
+ else:
52
+ # raise NotImplementedError("Unsupported platform")
53
+ typer.echo("Unsupported platform for init scripts.")
54
+ raise typer.Exit(code=1)
55
+ if run:
56
+ from machineconfig.utils.code import exit_then_run_shell_script
57
+ exit_then_run_shell_script(script, strict=True)
58
+ else:
59
+ print(script)
60
+
61
+
62
+ def update(copy_assets: Annotated[bool, typer.Option("--assets-copy/--no-assets-copy", "-a/-na", help="Copy (overwrite) assets to the machine after the update")] = True,
63
+ link_public_configs: Annotated[bool, typer.Option("--link-public-configs/--no-link-public-configs", "-b/-nb", help="Link public configs after update (overwrites your configs!)")] = False,
64
+ ):
7
65
  """🔄 UPDATE uv and machineconfig"""
8
- # from machineconfig.utils.source_of_truth import LIBRARY_ROOT
9
- # repo_root = LIBRARY_ROOT.parent.parent
10
66
  from pathlib import Path
11
67
  if Path.home().joinpath("code", "machineconfig").exists():
12
- code = """
68
+ shell_script = """
13
69
  uv self update
14
70
  cd ~/code/machineconfig
15
71
  git pull
16
72
  uv tool install --upgrade --editable $HOME/code/machineconfig
17
73
  """
18
74
  else:
19
- code = """
75
+ shell_script = """
20
76
  uv self update
21
77
  uv tool install --upgrade machineconfig
22
78
  """
23
79
  import platform
24
80
  if platform.system() == "Windows":
25
- # from machineconfig.utils.code import run_shell_script_after_exit
26
- # run_shell_script_after_exit(code)
27
- print(f'please run {code} in powershell to update machineconfig')
81
+ from machineconfig.utils.code import exit_then_run_shell_script, get_uv_command_executing_python_script
82
+ from machineconfig.utils.meta import lambda_to_python_script
83
+ python_script = lambda_to_python_script(lambda: copy_both_assets(),
84
+ in_global=True, import_module=False)
85
+ uv_command, _py_file = get_uv_command_executing_python_script(python_script=python_script, uv_with=["machineconfig"], uv_project_dir=None)
86
+ exit_then_run_shell_script(shell_script + "\n" + uv_command, strict=True)
28
87
  else:
29
88
  from machineconfig.utils.code import run_shell_script
30
- run_shell_script(code)
31
- if not no_copy_assets:
32
- import machineconfig.profile.create_helper as create_helper
33
- create_helper.copy_assets_to_machine(which="scripts")
34
- create_helper.copy_assets_to_machine(which="settings")
89
+ run_shell_script(shell_script)
90
+ if copy_assets:
91
+ copy_both_assets()
92
+ if link_public_configs:
93
+ 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
+
96
+
35
97
  def install(no_copy_assets: Annotated[bool, typer.Option("--no-assets-copy", "-na", help="Copy (overwrite) assets to the machine after the update")] = False):
36
98
  """📋 CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates."""
37
- from machineconfig.utils.code import run_shell_script
99
+ from machineconfig.utils.code import run_shell_script, get_uv_run_command
38
100
  from pathlib import Path
101
+ import platform
102
+ uv_run_command = get_uv_run_command(platform=platform.system()) # type: ignore
39
103
  if Path.home().joinpath("code/machineconfig").exists():
40
- run_shell_script(f"""$HOME/.local/bin/uv tool install --upgrade --editable "{str(Path.home().joinpath("code/machineconfig"))}" """)
104
+ run_shell_script(f""" {uv_run_command} tool install --upgrade --editable "{str(Path.home().joinpath("code/machineconfig"))}" """)
41
105
  else:
42
- import platform
43
- if platform.system() == "Windows":
44
- run_shell_script(r"""& "$HOME\.local\bin\uv.exe" tool install --upgrade "machineconfig>=6.81" """)
45
- else:
46
- run_shell_script("""$HOME/.local/bin/uv tool install --upgrade "machineconfig>=6.81" """)
106
+ run_shell_script(rf""" {uv_run_command} tool install --upgrade "machineconfig>=7.98" """)
47
107
  from machineconfig.profile.create_shell_profile import create_default_shell_profile
48
108
  if not no_copy_assets:
49
109
  create_default_shell_profile() # involves copying assets too
@@ -66,22 +126,11 @@ def navigate():
66
126
  import machineconfig.scripts.python as navigator
67
127
  from pathlib import Path
68
128
  path = Path(navigator.__file__).resolve().parent.joinpath("devops_navigator.py")
69
- from machineconfig.utils.code import run_shell_script
129
+ from machineconfig.utils.code import exit_then_run_shell_script
70
130
  if Path.home().joinpath("code/machineconfig").exists(): executable = f"""--project "{str(Path.home().joinpath("code/machineconfig"))}" --with textual"""
71
- else: executable = """--with "machineconfig>=6.81,textual" """
72
- run_shell_script(f"""uv run {executable} {path}""")
73
-
74
-
75
- def run_python(ip: Annotated[str, typer.Argument(..., help="Python command to run in the machineconfig environment")],
76
- command: Annotated[Optional[bool], typer.Option(..., "--command", "-c", help="Run as command")] = False):
77
- """🐍 RUN python command/file in the machineconfig environment"""
78
- if command:
79
- exec(ip)
80
- return
81
- import machineconfig
82
- import subprocess
83
- import sys
84
- subprocess.run([sys.executable, ip], cwd=machineconfig.__path__[0])
131
+ else: executable = """--with "machineconfig>=7.98,textual" """
132
+ exit_then_run_shell_script(f"""uv run {executable} {path}""")
133
+
85
134
  def readme():
86
135
  from rich.console import Console
87
136
  from rich.markdown import Markdown
@@ -104,19 +153,20 @@ def readme():
104
153
 
105
154
  def get_app():
106
155
  cli_app = typer.Typer(help="🔄 [s] self operations subcommands", no_args_is_help=True, add_help_option=False, add_completion=False)
107
- cli_app.command("update", no_args_is_help=False, help="🔄 [u] UPDATE machineconfig")(update)
108
- cli_app.command("u", no_args_is_help=False, hidden=True)(update)
109
- cli_app.command("interactive", no_args_is_help=False, help="🤖 [i] INTERACTIVE configuration of machine.")(interactive)
110
- cli_app.command("i", no_args_is_help=False, help="INTERACTIVE configuration of machine.", hidden=True)(interactive)
111
- cli_app.command("status", no_args_is_help=False, help="📊 [s] STATUS of machine, shell profile, apps, symlinks, dotfiles, etc.")(status)
112
- cli_app.command("s", no_args_is_help=False, help="STATUS of machine, shell profile, apps, symlinks, dotfiles, etc.", hidden=True)(status)
113
- 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)
114
- 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)
115
- cli_app.command("navigate", no_args_is_help=False, help="📚 [n] NAVIGATE command structure with TUI")(navigate)
156
+ cli_app.command("update", no_args_is_help=False, help="🔄 [u] UPDATE machineconfig")(update)
157
+ cli_app.command("u", no_args_is_help=False, hidden=True)(update)
158
+ cli_app.command("interactive", no_args_is_help=False, help="🤖 [i] INTERACTIVE configuration of machine.")(interactive)
159
+ cli_app.command("i", no_args_is_help=False, help="INTERACTIVE configuration of machine.", hidden=True)(interactive)
160
+ cli_app.command(name="init", no_args_is_help=False, help="🦐 [t] Define and manage configurations")(init)
161
+ cli_app.command(name="t", no_args_is_help=False, hidden=True)(init)
162
+ cli_app.command("status", no_args_is_help=False, help="📊 [s] STATUS of machine, shell profile, apps, symlinks, dotfiles, etc.")(status)
163
+ cli_app.command("s", no_args_is_help=False, help="STATUS of machine, shell profile, apps, symlinks, dotfiles, etc.", hidden=True)(status)
164
+ 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)
165
+ 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)
166
+ cli_app.command("navigate", no_args_is_help=False, help="📚 [n] NAVIGATE command structure with TUI")(navigate)
116
167
  cli_app.command("n", no_args_is_help=False, help="NAVIGATE command structure with TUI", hidden=True)(navigate)
117
- cli_app.command("python", no_args_is_help=False, help="🐍 [c] python command/file in the machineconfig environment", context_settings={"show_help_on_error": True})(run_python)
118
- cli_app.command("c", no_args_is_help=False, help="RUN python command/file in the machineconfig environment", hidden=True)(run_python)
119
- cli_app.command("readme", no_args_is_help=False, help="📚 [r] render readme markdown in terminal.")(readme)
168
+
169
+ cli_app.command("readme", no_args_is_help=False, help="📚 [r] render readme markdown in terminal.")(readme)
120
170
  cli_app.command("r", no_args_is_help=False, hidden=True)(readme)
121
171
  return cli_app
122
172
 
@@ -0,0 +1,137 @@
1
+
2
+ import typer
3
+ from typing import Annotated
4
+
5
+
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'")],
7
+ ) -> None:
8
+ """Receive a file using croc with relay server.
9
+ Usage examples:
10
+ devops network receive 7121-donor-olympic-bicycle
11
+ devops network receive -- --relay 10.17.62.206:443 7121-donor-olympic-bicycle
12
+ devops network receive -- croc --relay 10.17.62.206:443 7121-donor-olympic-bicycle
13
+ """
14
+ from machineconfig.utils.installer_utils.installer_cli import install_if_missing
15
+ install_if_missing(which="croc")
16
+ import platform
17
+ import sys
18
+
19
+ is_windows = platform.system() == "Windows"
20
+
21
+ # If no args passed via typer, try to get them from sys.argv directly
22
+ # This handles the case where -- was used and arguments weren't parsed by typer
23
+ if not code_args or (len(code_args) == 1 and code_args[0] in ['--relay', 'croc']):
24
+ # Find the index of 'rx' or 'receive' in sys.argv and get everything after it
25
+ try:
26
+ for i, arg in enumerate(sys.argv):
27
+ if arg in ['rx', 'receive', 'r'] and i + 1 < len(sys.argv):
28
+ code_args = sys.argv[i + 1:]
29
+ break
30
+ except Exception:
31
+ pass
32
+
33
+ # Join all arguments
34
+ input_str = " ".join(code_args)
35
+ tokens = input_str.split()
36
+
37
+ # Parse input to extract relay server and secret code
38
+ relay_server: str | None = None
39
+ secret_code: str | None = None
40
+
41
+ # Remove 'croc' and 'export' from tokens if present
42
+ tokens = [t for t in tokens if t not in ['croc', 'export']]
43
+
44
+ # Look for --relay flag and capture next token
45
+ relay_idx = -1
46
+ for i, token in enumerate(tokens):
47
+ if token == '--relay' and i + 1 < len(tokens):
48
+ relay_server = tokens[i + 1]
49
+ relay_idx = i
50
+ break
51
+
52
+ # Look for CROC_SECRET= prefix in any token
53
+ for token in tokens:
54
+ if token.startswith('CROC_SECRET='):
55
+ secret_code = token.split('=', 1)[1].strip('"').strip("'")
56
+ break
57
+
58
+ # If no secret code found yet, look for tokens with dashes (typical pattern: number-word-word-word)
59
+ # Skip relay server and relay flag
60
+ if not secret_code:
61
+ for i, token in enumerate(tokens):
62
+ if '-' in token and not token.startswith('-') and token != relay_server:
63
+ if relay_idx >= 0 and (i == relay_idx or i == relay_idx + 1):
64
+ continue # Skip relay server parts
65
+ secret_code = token
66
+ break
67
+
68
+ if not secret_code and not relay_server:
69
+ typer.echo(f"❌ Error: Could not parse croc receive code from input: {input_str}", err=True)
70
+ typer.echo("Usage:", err=True)
71
+ typer.echo(" devops network receive 7121-donor-olympic-bicycle", err=True)
72
+ typer.echo(" devops network receive -- --relay 10.17.62.206:443 7121-donor-olympic-bicycle", err=True)
73
+ raise typer.Exit(code=1)
74
+
75
+ # Build the appropriate script for current OS
76
+ if is_windows:
77
+ # Windows PowerShell format: croc --relay server:port secret-code --yes
78
+ relay_arg = f"--relay {relay_server}" if relay_server else ""
79
+ code_arg = f"{secret_code}" if secret_code else ""
80
+ script = f"""croc {relay_arg} {code_arg} --yes""".strip()
81
+ else:
82
+ # Linux/macOS Bash format: CROC_SECRET="secret-code" croc --relay server:port --yes
83
+ relay_arg = f"--relay {relay_server}" if relay_server else ""
84
+ if secret_code:
85
+ script = f"""export CROC_SECRET="{secret_code}"
86
+ croc {relay_arg} --yes""".strip()
87
+ else:
88
+ script = f"""croc {relay_arg} --yes""".strip()
89
+
90
+ from machineconfig.utils.code import exit_then_run_shell_script, print_code
91
+ print_code(code=script, desc="🚀 Receiving file with croc", lexer="bash" if platform.system() != "Windows" else "powershell")
92
+ exit_then_run_shell_script(script=script, strict=False)
93
+
94
+
95
+ def share_file_send(path: Annotated[str, typer.Argument(help="Path to the file or directory to send")],
96
+ zip_folder: Annotated[bool, typer.Option("--zip", help="Zip folder before sending")] = False,
97
+ code: Annotated[str | None, typer.Option("--code", "-c", help="Codephrase used to connect to relay")] = None,
98
+ text: Annotated[str | None, typer.Option("--text", "-t", help="Send some text")] = None,
99
+ qrcode: Annotated[bool, typer.Option("--qrcode", "--qr", help="Show receive code as a qrcode")] = False,
100
+ ) -> None:
101
+ """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
+ 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
+
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}"
130
+ 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}"""
133
+
134
+ typer.echo(f"🚀 Sending file: {path}. Use: devops network receive")
135
+ from machineconfig.utils.code import exit_then_run_shell_script, print_code
136
+ 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)
@@ -1,5 +1,6 @@
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
4
  import typer
4
5
 
5
6
 
@@ -31,73 +32,110 @@ def display_share_url(local_ip_v4: str, port: int, protocol: str = "http") -> No
31
32
  console.print(panel)
32
33
 
33
34
 
34
- def main(
35
+ def web_file_explorer(
35
36
  path: Annotated[str, typer.Argument(help="Path to the file or directory to share")],
36
37
  port: Annotated[Optional[int], typer.Option("--port", "-p", help="Port to run the share server on (default: 8080)")] = None,
37
38
  username: Annotated[Optional[str], typer.Option("--username", "-u", help="Username for share access (default: current user)")] = None,
38
39
  password: Annotated[Optional[str], typer.Option("--password", "-w", help="Password for share access (default: from ~/dotfiles/creds/passwords/quick_password)")] = None,
39
- over_internet: Annotated[bool, typer.Option("--over-internet", "-i", help="Expose the share server over the internet using ngrok")] = False
40
+ over_internet: Annotated[bool, typer.Option("--over-internet", "-i", help="Expose the share server over the internet using ngrok")] = False,
41
+ backend: Annotated[str, typer.Option("--backend", "-b", help="Backend to use: filebrowser (default), miniserve, qrcp, or easy-sharing")] = "miniserve",
40
42
  ) -> None:
41
- from machineconfig.utils.installer_utils.installer import install_if_missing
42
- install_if_missing(which="easy-sharing")
43
- if over_internet: install_if_missing(which="ngrok", )
43
+ from machineconfig.utils.installer_utils.installer_cli import install_if_missing
44
+
45
+ if backend not in ["filebrowser", "miniserve", "qrcp", "easy-sharing"]:
46
+ typer.echo(f"❌ ERROR: Invalid backend '{backend}'. Must be one of: filebrowser, miniserve, qrcp, easy-sharing", err=True)
47
+ raise typer.Exit(code=1)
48
+ install_if_missing(which=backend)
49
+ if over_internet:
50
+ install_if_missing(which="ngrok")
44
51
  if username is None:
45
52
  import getpass
46
53
  username = getpass.getuser()
54
+
47
55
  if password is None:
48
56
  pwd_path = Path.home().joinpath("dotfiles/creds/passwords/quick_password")
49
57
  if pwd_path.exists():
50
58
  password = pwd_path.read_text(encoding="utf-8").strip()
51
59
  else:
52
- # raise ValueError("Password not provided and default password file does not exist.")
53
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)
54
- typer.Exit(code=1)
61
+ raise typer.Exit(code=1)
55
62
 
56
63
  if port is None:
57
- port = 8080 # Default port for ezshare
64
+ port = 8080
58
65
 
59
- import socket
60
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
61
- s.connect(('8.8.8.8',80))
62
- local_ip_v4 = s.getsockname()[0]
63
- s.close()
66
+ import machineconfig.scripts.python.helpers_network.address as helper
67
+ res = helper.select_lan_ipv4(prefer_vpn=False)
68
+ if res is None:
69
+ typer.echo("❌ ERROR: Could not determine local LAN IPv4 address for share server.", err=True)
70
+ raise typer.Exit(code=1)
71
+ local_ip_v4 = res
64
72
 
65
- # Display the flashy share announcement
66
73
  protocol = "http"
67
74
  display_share_url(local_ip_v4, port, protocol)
68
- import subprocess
69
- import time
70
- # Build ezshare command
71
- ezshare_cmd = f"""easy-sharing --port {port} --username {username} --password "{password}" {path}"""
72
- ezshare_process = subprocess.Popen(ezshare_cmd, shell=True)
73
- processes = [ezshare_process]
74
75
 
75
- if over_internet:
76
- ngrok_process = subprocess.Popen(f"ngrok http {port}", shell=True)
77
- processes.append(ngrok_process)
78
- time.sleep(3)
79
- try:
80
- import requests
81
- response = requests.get("http://localhost:4040/api/tunnels")
82
- data = response.json()
83
- public_url = data['tunnels'][0]['public_url']
84
- print(f"🌐 Ngrok tunnel ready: {public_url}")
85
- except Exception as e:
86
- print(f"Could not retrieve ngrok URL: {e}")
76
+ path_obj = Path(path).resolve()
77
+ if not path_obj.exists():
78
+ typer.echo(f"❌ ERROR: Path does not exist: {path}", err=True)
79
+ raise typer.Exit(code=1)
87
80
 
88
- try:
89
- while True:
90
- print("Share server is running. Press Ctrl+C to stop.")
91
- time.sleep(2)
92
- except KeyboardInterrupt:
93
- print("\nTerminating processes...")
94
- for p in processes:
95
- p.terminate()
96
- p.wait()
81
+ if backend == "filebrowser":
82
+ db_path = Path.home().joinpath(".config/filebrowser/filebrowser.db")
83
+ db_path.parent.mkdir(parents=True, exist_ok=True)
84
+ command = f"""
85
+ filebrowser users add {username} "{password}" --database {db_path}
86
+ filebrowser --address 0.0.0.0 --port {port} --root "{path_obj}" --database {db_path}
87
+ """
88
+ 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}" """
90
+ elif backend == "easy-sharing":
91
+ command = f"""easy-sharing --port {port} --username {username} --password "{password}" "{path_obj}" """
92
+ elif backend == "qrcp":
93
+ command = f"""qrcp "{path_obj}" """
94
+ else:
95
+ typer.echo(f"❌ ERROR: Unknown backend '{backend}'", err=True)
96
+ raise typer.Exit(code=1)
97
+
98
+ from machineconfig.utils.code import exit_then_run_shell_script
99
+ exit_then_run_shell_script(script=command, strict=False)
100
+ # import subprocess
101
+ # import time
102
+ # server_process: subprocess.Popen[bytes]
103
+ # server_process = subprocess.Popen(command, shell=True)
104
+ # processes = [server_process]
105
+ # if over_internet:
106
+ # ngrok_process = subprocess.Popen(f"ngrok http {port}", shell=True)
107
+ # processes.append(ngrok_process)
108
+ # time.sleep(3)
109
+ # try:
110
+ # import requests
111
+ # response = requests.get("http://localhost:4040/api/tunnels")
112
+ # data = response.json()
113
+ # public_url = data['tunnels'][0]['public_url']
114
+ # print(f"🌐 Ngrok tunnel ready: {public_url}")
115
+ # except Exception as e:
116
+ # print(f"Could not retrieve ngrok URL: {e}")
117
+
118
+ # try:
119
+ # while True:
120
+ # print(f"Share server ({backend}) is running. Press Ctrl+C to stop.")
121
+ # time.sleep(2)
122
+ # except KeyboardInterrupt:
123
+ # print("\nTerminating processes...")
124
+ # for p in processes:
125
+ # p.terminate()
126
+ # p.wait()
127
+
97
128
 
129
+ def get_share_file_app():
130
+ app = typer.Typer(name="share-file", help="Send or receive files using croc with relay server.")
131
+ app.command(name="send", no_args_is_help=True, hidden=False, help="[s] send files from here.")(share_file_send)
132
+ app.command(name="s", no_args_is_help=True, hidden=True, help="[s] send files from here.")(share_file_send)
133
+ app.command(name="receive", no_args_is_help=True, hidden=False, help="[r] receive files to here.")(share_file_receive)
134
+ app.command(name="r", no_args_is_help=True, hidden=True, help="[r] receive files to here.")(share_file_receive)
135
+ return app
98
136
 
99
137
  def main_with_parser():
100
- typer.run(main)
138
+ typer.run(web_file_explorer)
101
139
 
102
140
 
103
141
  if __name__ == "__main__":
@@ -1,10 +1,6 @@
1
- from pathlib import Path
1
+
2
2
  from typing import Optional, Annotated
3
3
  import typer
4
- import subprocess
5
- import time
6
-
7
-
8
4
 
9
5
  """
10
6
  reference:
@@ -17,13 +13,11 @@ reference:
17
13
 
18
14
  def display_terminal_url(local_ip_v4: str, port: int, protocol: str = "http") -> None:
19
15
  """Display a flashy, unmissable terminal URL announcement."""
20
-
21
16
  from rich.console import Console
22
17
  from rich.panel import Panel
23
18
  from rich.text import Text
24
19
  from rich.align import Align
25
20
  console = Console()
26
-
27
21
  # Create the main message with styling
28
22
  url_text = Text(f"{protocol}://{local_ip_v4}:{port}", style="bold bright_cyan underline")
29
23
  message = Text.assemble(
@@ -42,14 +36,13 @@ def display_terminal_url(local_ip_v4: str, port: int, protocol: str = "http") ->
42
36
  padding=(1, 2),
43
37
  expand=False
44
38
  )
45
-
46
39
  # Print with extra spacing and attention-grabbing elements
47
40
  # console.print("\n" + "🔥" * 60 + "\n", style="bright_red bold")
48
41
  console.print(panel)
49
42
  # console.print("🔥" * 60 + "\n", style="bright_red bold")
50
43
 
51
44
 
52
- def main(
45
+ def share_terminal(
53
46
  port: Annotated[Optional[int], typer.Option("--port", "-p", help="Port to run the terminal server on (default: 7681)")] = None,
54
47
  username: Annotated[Optional[str], typer.Option("--username", "-u", help="Username for terminal access (default: current user)")] = None,
55
48
  password: Annotated[Optional[str], typer.Option("--password", "-w", help="Password for terminal access (default: from ~/dotfiles/creds/passwords/quick_password)")] = None,
@@ -60,10 +53,11 @@ def main(
60
53
  ssl_ca: Annotated[Optional[str], typer.Option("--ssl-ca", "-A", help="SSL CA file path for client certificate verification")] = None,
61
54
  over_internet: Annotated[bool, typer.Option("--over-internet", "-i", help="Expose the terminal over the internet using ngrok")] = False
62
55
  ) -> None:
63
- from machineconfig.utils.installer_utils.installer import install_if_missing
56
+ from machineconfig.utils.installer_utils.installer_cli import install_if_missing
64
57
  install_if_missing("ttyd")
65
58
  if over_internet: install_if_missing("ngrok")
66
59
 
60
+ from pathlib import Path
67
61
  if username is None:
68
62
  import getpass
69
63
  username = getpass.getuser()
@@ -96,11 +90,12 @@ def main(
96
90
  if ssl_ca and not Path(ssl_ca).exists():
97
91
  raise FileNotFoundError(f"SSL CA file not found: {ssl_ca}")
98
92
 
99
- import socket
100
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
101
- s.connect(('8.8.8.8',80))
102
- local_ip_v4 = s.getsockname()[0]
103
- s.close()
93
+ import machineconfig.scripts.python.helpers_network.address as helper
94
+ res = helper.select_lan_ipv4(prefer_vpn=False)
95
+ if res is None:
96
+ print("❌ Error: Could not determine local LAN IPv4 address for terminal.")
97
+ raise typer.Exit(code=1)
98
+ local_ip_v4 = res
104
99
 
105
100
  # Display the flashy terminal announcement
106
101
  protocol = "https" if ssl else "http"
@@ -119,7 +114,10 @@ def main(
119
114
  start_command = "powershell"
120
115
  else:
121
116
  start_command = "bash"
122
-
117
+
118
+ import subprocess
119
+ import time
120
+
123
121
  ttyd_cmd = f"ttyd --writable -t enableSixel=true {ssl_args} --port {port} --credential \"{username}:{password}\" -t 'theme={{\"background\": \"black\"}}' {start_command}"
124
122
  ttyd_process = subprocess.Popen(ttyd_cmd, shell=True)
125
123
  processes = [ttyd_process]
@@ -149,7 +147,7 @@ def main(
149
147
 
150
148
 
151
149
  def main_with_parser():
152
- typer.run(main)
150
+ typer.run(share_terminal)
153
151
 
154
152
 
155
153
  if __name__ == "__main__":