machineconfig 7.49__py3-none-any.whl → 7.64__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 (93) hide show
  1. machineconfig/cluster/sessions_managers/utils/maker.py +21 -11
  2. machineconfig/jobs/installer/custom/boxes.py +2 -2
  3. machineconfig/jobs/installer/custom/hx.py +16 -12
  4. machineconfig/jobs/installer/custom_dev/brave.py +1 -1
  5. machineconfig/jobs/installer/custom_dev/cloudflare_warp_cli.py +23 -0
  6. machineconfig/jobs/installer/custom_dev/code.py +4 -1
  7. machineconfig/jobs/installer/custom_dev/dubdb_adbc.py +1 -1
  8. machineconfig/jobs/installer/custom_dev/nerfont_windows_helper.py +1 -10
  9. machineconfig/jobs/installer/custom_dev/sysabc.py +119 -0
  10. machineconfig/jobs/installer/custom_dev/wezterm.py +2 -19
  11. machineconfig/jobs/installer/installer_data.json +739 -25
  12. machineconfig/jobs/installer/linux_scripts/redis.sh +1 -0
  13. machineconfig/jobs/installer/package_groups.py +49 -83
  14. machineconfig/logger.py +0 -1
  15. machineconfig/profile/create_links_export.py +21 -7
  16. machineconfig/profile/mapper.toml +1 -4
  17. machineconfig/scripts/linux/wrap_mcfg +1 -1
  18. machineconfig/scripts/python/croshell.py +20 -43
  19. machineconfig/scripts/python/devops.py +3 -4
  20. machineconfig/scripts/python/env_manager/path_manager_tui.py +1 -1
  21. machineconfig/scripts/python/fire_jobs.py +53 -39
  22. machineconfig/scripts/python/ftpx.py +4 -2
  23. machineconfig/scripts/python/helpers_agents/agentic_frameworks/fire_qwen.py +0 -12
  24. machineconfig/scripts/python/helpers_croshell/crosh.py +3 -3
  25. machineconfig/scripts/python/helpers_devops/cli_config.py +3 -19
  26. machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +22 -13
  27. machineconfig/scripts/python/helpers_devops/cli_self.py +12 -6
  28. machineconfig/scripts/python/helpers_devops/cli_share_file.py +2 -2
  29. machineconfig/scripts/python/helpers_devops/cli_share_server.py +1 -1
  30. machineconfig/scripts/python/helpers_devops/cli_terminal.py +1 -1
  31. machineconfig/scripts/python/helpers_devops/cli_utils.py +1 -152
  32. machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +4 -4
  33. machineconfig/scripts/python/helpers_fire_command/file_wrangler.py +2 -20
  34. machineconfig/scripts/python/helpers_fire_command/fire_jobs_route_helper.py +3 -4
  35. machineconfig/scripts/python/helpers_msearch/scripts_linux/fzfg +1 -1
  36. machineconfig/scripts/python/helpers_repos/clone.py +0 -1
  37. machineconfig/scripts/python/helpers_repos/cloud_repo_sync.py +9 -3
  38. machineconfig/scripts/python/helpers_repos/count_lines_frontend.py +1 -1
  39. machineconfig/scripts/python/helpers_repos/entrypoint.py +2 -1
  40. machineconfig/scripts/python/helpers_repos/record.py +2 -1
  41. machineconfig/scripts/python/helpers_sessions/sessions_multiprocess.py +7 -7
  42. machineconfig/scripts/python/helpers_utils/download.py +151 -0
  43. machineconfig/scripts/python/helpers_utils/path.py +106 -0
  44. machineconfig/scripts/python/interactive.py +17 -26
  45. machineconfig/scripts/python/nw/devops_add_ssh_key.py +21 -5
  46. machineconfig/scripts/python/nw/ssh_debug_linux.py +7 -7
  47. machineconfig/scripts/python/nw/ssh_debug_windows.py +4 -4
  48. machineconfig/scripts/python/nw/wsl_windows_transfer.py +3 -2
  49. machineconfig/scripts/python/sessions.py +37 -22
  50. machineconfig/scripts/python/utils.py +8 -3
  51. machineconfig/scripts/windows/mounts/mount_ssh.ps1 +1 -1
  52. machineconfig/settings/shells/nushell/init.nu +2 -2
  53. machineconfig/settings/shells/wezterm/wezterm.lua +2 -0
  54. machineconfig/settings/shells/zsh/init.sh +1 -8
  55. machineconfig/settings/yazi/init.lua +45 -24
  56. machineconfig/settings/yazi/keymap_windows.toml +1 -2
  57. machineconfig/settings/yazi/shell/yazi_cd.ps1 +29 -5
  58. machineconfig/setup_linux/__init__.py +0 -1
  59. machineconfig/setup_linux/web_shortcuts/interactive.sh +12 -10
  60. machineconfig/setup_mac/__init__.py +2 -3
  61. machineconfig/setup_windows/__init__.py +0 -3
  62. machineconfig/setup_windows/web_shortcuts/interactive.ps1 +12 -10
  63. machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +16 -0
  64. machineconfig/utils/code.py +2 -2
  65. machineconfig/utils/files/headers.py +2 -2
  66. machineconfig/utils/installer_utils/installer_class.py +42 -40
  67. machineconfig/utils/installer_utils/{installer.py → installer_cli.py} +61 -101
  68. machineconfig/utils/installer_utils/{installer_abc.py → installer_locator_utils.py} +0 -68
  69. machineconfig/utils/{installer.py → installer_utils/installer_runner.py} +11 -51
  70. machineconfig/utils/io.py +0 -1
  71. machineconfig/utils/meta.py +29 -15
  72. machineconfig/utils/options.py +1 -1
  73. machineconfig/utils/path_extended.py +40 -19
  74. machineconfig/utils/path_helper.py +75 -21
  75. machineconfig/utils/schemas/layouts/layout_types.py +1 -1
  76. machineconfig/utils/ssh.py +3 -3
  77. machineconfig-7.64.dist-info/METADATA +124 -0
  78. {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/RECORD +84 -87
  79. machineconfig/jobs/installer/linux_scripts/pgsql.sh +0 -41
  80. machineconfig/jobs/installer/linux_scripts/timescaledb.sh +0 -71
  81. machineconfig/jobs/installer/powershell_scripts/archive_pygraphviz.ps1 +0 -12
  82. machineconfig/scripts/python/nw/add_ssh_key.py +0 -148
  83. machineconfig/settings/lf/linux/exe/fzf_nano.sh +0 -16
  84. machineconfig/setup_linux/apps.sh +0 -66
  85. machineconfig/setup_mac/apps.sh +0 -73
  86. machineconfig/setup_windows/apps.ps1 +0 -62
  87. machineconfig-7.49.dist-info/METADATA +0 -92
  88. /machineconfig/jobs/installer/linux_scripts/{warp-cli.sh → cloudflare_warp_cli.sh} +0 -0
  89. /machineconfig/{jobs/installer/powershell_scripts → setup_windows/ssh}/openssh-server_add_key.ps1 +0 -0
  90. /machineconfig/{jobs/installer/powershell_scripts → setup_windows/ssh}/openssh-server_copy-ssh-id.ps1 +0 -0
  91. {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/WHEEL +0 -0
  92. {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/entry_points.txt +0 -0
  93. {machineconfig-7.49.dist-info → machineconfig-7.64.dist-info}/top_level.txt +0 -0
@@ -13,9 +13,9 @@ import typer
13
13
  console = Console()
14
14
 
15
15
 
16
- def get_add_ssh_key_script(path_to_key: PathExtended):
16
+ def get_add_ssh_key_script(path_to_key: PathExtended) -> str:
17
17
  console.print(Panel("🔑 SSH KEY CONFIGURATION", title="[bold blue]SSH Setup[/bold blue]"))
18
- if system() == "Linux":
18
+ if system() == "Linux" or system() == "Darwin":
19
19
  authorized_keys = PathExtended.home().joinpath(".ssh/authorized_keys")
20
20
  console.print(Panel(f"🐧 Linux SSH configuration\n📄 Authorized keys file: {authorized_keys}", title="[bold blue]System Info[/bold blue]"))
21
21
  elif system() == "Windows":
@@ -35,7 +35,7 @@ def get_add_ssh_key_script(path_to_key: PathExtended):
35
35
  program = ""
36
36
  else:
37
37
  console.print(Panel(f"➕ Adding new SSH key to authorized keys\n🔑 Key file: {path_to_key.name}", title="[bold blue]Action[/bold blue]"))
38
- if system() == "Linux":
38
+ if system() == "Linux" or system() == "Darwin":
39
39
  program = f"cat {path_to_key} >> ~/.ssh/authorized_keys"
40
40
  elif system() == "Windows":
41
41
  program_path = LIBRARY_ROOT.joinpath("setup_windows/add-sshkey.ps1")
@@ -48,14 +48,14 @@ def get_add_ssh_key_script(path_to_key: PathExtended):
48
48
  raise NotImplementedError
49
49
  else:
50
50
  console.print(Panel(f"📝 Creating new authorized_keys file\n🔑 Using key: {path_to_key.name}", title="[bold blue]Action[/bold blue]"))
51
- if system() == "Linux":
51
+ if system() == "Linux" or system() == "Darwin":
52
52
  program = f"cat {path_to_key} > ~/.ssh/authorized_keys"
53
53
  else:
54
54
  program_path = LIBRARY_ROOT.joinpath("setup_windows/openssh-server_add-sshkey.ps1")
55
55
  program = PathExtended(program_path).expanduser().read_text(encoding="utf-8").replace('$sshfile=""', f'$sshfile="{path_to_key}"')
56
56
  console.print(Panel("🔧 Configured PowerShell script for Windows\n📝 Set key path in script", title="[bold blue]Configuration[/bold blue]"))
57
57
 
58
- if system() == "Linux":
58
+ if system() == "Linux" or system() == "Darwin":
59
59
  program += """
60
60
  sudo chmod 700 ~/.ssh
61
61
  sudo chmod 644 ~/.ssh/authorized_keys
@@ -66,6 +66,16 @@ sudo service ssh --full-restart
66
66
  return program
67
67
 
68
68
 
69
+ """
70
+ Common pitfalls:
71
+ 🚫 Wrong line endings (LF/CRLF) in config files
72
+ 🌐 Network port conflicts (try 2222 -> 2223) between WSL and Windows
73
+ sudo service ssh restart
74
+ sudo service ssh status
75
+ sudo nano /etc/ssh/sshd_config
76
+ """
77
+
78
+
69
79
  def main(pub_path: Annotated[Optional[str], typer.Argument(..., help="Path to the public key file")] = None,
70
80
  pub_choose: Annotated[bool, typer.Option(..., "--choose", "-c", help="Choose from available public keys in ~/.ssh")] = False,
71
81
  pub_val: Annotated[bool, typer.Option(..., "--paste", "-p", help="Paste the public key content manually")] = False,
@@ -127,6 +137,12 @@ def main(pub_path: Annotated[Optional[str], typer.Argument(..., help="Path to th
127
137
  console.print(Panel("🚀 SSH KEY AUTHORIZATION READY\nRun the generated script to apply changes", box=box.DOUBLE_EDGE, title_align="left"))
128
138
  from machineconfig.utils.code import run_shell_script
129
139
  run_shell_script(script=program)
140
+ import socket
141
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
142
+ s.connect(('8.8.8.8', 80))
143
+ local_ip_v4 = s.getsockname()[0]
144
+ s.close()
145
+ console.print(Panel(f"🌐 This computer is accessible at: {local_ip_v4}", title="[bold green]Network Info[/bold green]", border_style="green"))
130
146
  console.print(Panel("✅ SSH KEY AUTHORIZATION COMPLETED", box=box.DOUBLE_EDGE, title_align="left"))
131
147
 
132
148
 
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  from platform import system
4
- from machineconfig.utils.path_extended import PathExtended
4
+ from pathlib import Path
5
5
  from rich.console import Console
6
6
  from rich.panel import Panel
7
7
  from rich import box
@@ -26,7 +26,7 @@ def ssh_debug_linux() -> dict[str, dict[str, str | bool]]:
26
26
  results: dict[str, dict[str, str | bool]] = {}
27
27
  issues_found: list[str] = []
28
28
 
29
- ssh_dir = PathExtended.home().joinpath(".ssh")
29
+ ssh_dir = Path.home().joinpath(".ssh")
30
30
  authorized_keys = ssh_dir.joinpath("authorized_keys")
31
31
 
32
32
  console.print(Panel("🔐 Checking SSH directory and authorized_keys...", title="[bold blue]File Permissions[/bold blue]", border_style="blue"))
@@ -106,7 +106,7 @@ def ssh_debug_linux() -> dict[str, dict[str, str | bool]]:
106
106
 
107
107
  console.print(Panel("🔌 Checking SSH port and listening status...", title="[bold blue]Network Status[/bold blue]", border_style="blue"))
108
108
 
109
- sshd_config_paths = [PathExtended("/etc/ssh/sshd_config"), PathExtended("/etc/sshd_config")]
109
+ sshd_config_paths = [Path("/etc/ssh/sshd_config"), Path("/etc/sshd_config")]
110
110
  sshd_config = None
111
111
  for config_path in sshd_config_paths:
112
112
  if config_path.exists():
@@ -236,7 +236,7 @@ def ssh_debug_linux() -> dict[str, dict[str, str | bool]]:
236
236
 
237
237
  console.print(Panel("🗂️ Checking for problematic files in /etc/...", title="[bold blue]System Files[/bold blue]", border_style="blue"))
238
238
 
239
- hosts_deny = PathExtended("/etc/hosts.deny")
239
+ hosts_deny = Path("/etc/hosts.deny")
240
240
  if hosts_deny.exists():
241
241
  hosts_deny_content = hosts_deny.read_text(encoding="utf-8")
242
242
  active_lines = [line.strip() for line in hosts_deny_content.splitlines() if line.strip() and not line.strip().startswith("#")]
@@ -252,14 +252,14 @@ def ssh_debug_linux() -> dict[str, dict[str, str | bool]]:
252
252
  results["hosts_deny"] = {"status": "ok", "message": "/etc/hosts.deny does not exist", "action": ""}
253
253
  console.print(Panel("✅ /etc/hosts.deny not present", title="[bold green]OK[/bold green]", border_style="green"))
254
254
 
255
- hosts_allow = PathExtended("/etc/hosts.allow")
255
+ hosts_allow = Path("/etc/hosts.allow")
256
256
  if hosts_allow.exists():
257
257
  results["hosts_allow"] = {"status": "ok", "message": "/etc/hosts.allow exists (check if needed)", "action": ""}
258
258
  console.print(Panel("ℹ️ /etc/hosts.allow exists\n💡 Ensure it allows SSH if using TCP wrappers", title="[bold blue]Info[/bold blue]", border_style="blue"))
259
259
 
260
260
  console.print(Panel("👤 Checking home directory permissions...", title="[bold blue]User Permissions[/bold blue]", border_style="blue"))
261
261
 
262
- home_dir = PathExtended.home()
262
+ home_dir = Path.home()
263
263
  home_stat = os.stat(home_dir)
264
264
  home_perms = oct(home_stat.st_mode)[-3:]
265
265
 
@@ -294,7 +294,7 @@ def ssh_debug_linux() -> dict[str, dict[str, str | bool]]:
294
294
 
295
295
  console.print(Panel("📋 Checking SSH logs for errors...", title="[bold blue]Logs[/bold blue]", border_style="blue"))
296
296
 
297
- log_files = [PathExtended("/var/log/auth.log"), PathExtended("/var/log/secure")]
297
+ log_files = [Path("/var/log/auth.log"), Path("/var/log/secure")]
298
298
  log_found = False
299
299
  for log_file in log_files:
300
300
  if log_file.exists():
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  from platform import system
4
- from machineconfig.utils.path_extended import PathExtended
4
+ from pathlib import Path
5
5
  from rich.console import Console
6
6
  from rich.panel import Panel
7
7
  from rich import box
@@ -26,7 +26,7 @@ def ssh_debug_windows() -> dict[str, dict[str, str | bool]]:
26
26
  results: dict[str, dict[str, str | bool]] = {}
27
27
  issues_found: list[str] = []
28
28
 
29
- ssh_dir = PathExtended.home().joinpath(".ssh")
29
+ ssh_dir = Path.home().joinpath(".ssh")
30
30
  authorized_keys = ssh_dir.joinpath("authorized_keys")
31
31
 
32
32
  console.print(Panel("🔐 Checking SSH directory and authorized_keys...", title="[bold blue]File Permissions[/bold blue]", border_style="blue"))
@@ -124,7 +124,7 @@ def ssh_debug_windows() -> dict[str, dict[str, str | bool]]:
124
124
 
125
125
  console.print(Panel("🔌 Checking SSH port and listening status...", title="[bold blue]Network Status[/bold blue]", border_style="blue"))
126
126
 
127
- sshd_config_paths = [PathExtended("C:\\ProgramData\\ssh\\sshd_config"), PathExtended(os.environ.get("PROGRAMDATA", "C:\\ProgramData")).joinpath("ssh", "sshd_config")]
127
+ sshd_config_paths = [Path("C:\\ProgramData\\ssh\\sshd_config"), Path(os.environ.get("PROGRAMDATA", "C:\\ProgramData")).joinpath("ssh", "sshd_config")]
128
128
  sshd_config = None
129
129
  for config_path in sshd_config_paths:
130
130
  if config_path.exists():
@@ -168,7 +168,7 @@ def ssh_debug_windows() -> dict[str, dict[str, str | bool]]:
168
168
  if admin_authorized_keys_lines:
169
169
  console.print(Panel("⚠️ IMPORTANT: Administrators group uses different authorized_keys location\n💡 For admin users, keys should be in: C:\\ProgramData\\ssh\\administrators_authorized_keys\n💡 Not in user's .ssh/authorized_keys!", title="[bold yellow]Admin Users[/bold yellow]", border_style="yellow"))
170
170
 
171
- programdata_auth_keys = PathExtended(os.environ.get("PROGRAMDATA", "C:\\ProgramData")).joinpath("ssh", "administrators_authorized_keys")
171
+ programdata_auth_keys = Path(os.environ.get("PROGRAMDATA", "C:\\ProgramData")).joinpath("ssh", "administrators_authorized_keys")
172
172
  if programdata_auth_keys.exists():
173
173
  console.print(Panel("✅ administrators_authorized_keys file exists", title="[bold green]OK[/bold green]", border_style="green"))
174
174
  else:
@@ -35,15 +35,16 @@ def main(
35
35
  print("=" * 50 + "\n")
36
36
 
37
37
  path_obj = PathExtended(path).expanduser().absolute()
38
+ relative_home = PathExtended(path_obj.expanduser().absolute().relative_to(Path.home()))
38
39
 
39
40
  if same_file_system:
40
41
  print("⚠️ Using a not recommended transfer method! Copying files across the same file system.")
41
42
  if system == "Windows": # move files over to WSL
42
43
  print("📤 Transferring files from Windows to WSL...")
43
- path_obj.copy(folder=WSL_FROM_WIN.joinpath(UserName).joinpath(path_obj.rel2home().parent), overwrite=True) # the following works for files and folders alike.
44
+ path_obj.copy(folder=WSL_FROM_WIN.joinpath(UserName).joinpath(relative_home.parent), overwrite=True) # the following works for files and folders alike.
44
45
  else: # move files from WSL to win
45
46
  print("📤 Transferring files from WSL to Windows...")
46
- path_obj.copy(folder=WIN_FROM_WSL.joinpath(UserName).joinpath(path_obj.rel2home().parent), overwrite=True)
47
+ path_obj.copy(folder=WIN_FROM_WSL.joinpath(UserName).joinpath(relative_home.parent), overwrite=True)
47
48
  print("✅ Transfer completed successfully!\n")
48
49
  else:
49
50
  from machineconfig.utils.ssh import SSH
@@ -1,32 +1,47 @@
1
1
 
2
- from pathlib import Path
3
2
  from typing import Optional, Literal, Annotated
4
3
  import typer
5
4
 
6
- def balance_load(layout_path: Annotated[Path, typer.Argument(..., help="Path to the layout.json file")],
7
- max_thresh: Annotated[int, typer.Option(..., help="Maximum tabs per layout")],
8
- thresh_type: Annotated[Literal['number', 'weight'], typer.Option(..., help="Threshold type")],
9
- breaking_method: Annotated[Literal['moreLayouts', 'combineTabs'], typer.Option(..., help="Breaking method")],
10
- output_path: Annotated[Optional[Path], typer.Option(..., help="Path to write the adjusted layout.json file")] = None):
5
+ def balance_load(layout_path: Annotated[str, typer.Argument(..., help="Path to the layout.json file")],
6
+ max_thresh: Annotated[int, typer.Option(..., "--max-threshold", "-m", help="Maximum tabs per layout")],
7
+ thresh_type: Annotated[Literal['number', 'n', 'weight', 'w'], typer.Option(..., "--threshold-type", "-t", help="Threshold type")],
8
+ breaking_method: Annotated[Literal['moreLayouts', 'ml', 'combineTabs', 'ct'], typer.Option(..., "--breaking-method", "-b", help="Breaking method")],
9
+ output_path: Annotated[Optional[str], typer.Option(..., "--output-path", "-o", help="Path to write the adjusted layout.json file")] = None):
11
10
  """Adjust layout file to limit max tabs per layout, etc."""
11
+ thresh_type_resolved: dict[str, Literal['number', 'weight']] = {
12
+ 'number': 'number',
13
+ 'n': 'number',
14
+ 'weight': 'weight',
15
+ 'w': 'weight'
16
+ }
17
+ breaking_method_resolved: dict[str, Literal['moreLayouts', 'combineTabs']] = {
18
+ 'moreLayouts': 'moreLayouts',
19
+ 'ml': 'moreLayouts',
20
+ 'combineTabs': 'combineTabs',
21
+ 'ct': 'combineTabs'
22
+ }
23
+ from pathlib import Path
24
+ layout_path_obj = Path(layout_path).expanduser().absolute()
25
+
12
26
  from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
13
27
  import json
14
- layoutfile: LayoutsFile = json.loads(layout_path.read_text())
28
+ layoutfile: LayoutsFile = json.loads(layout_path_obj.read_text())
15
29
  layout_configs = layoutfile["layouts"]
16
30
  from machineconfig.cluster.sessions_managers.utils.load_balancer import limit_tab_num
17
- new_layouts = limit_tab_num(layout_configs=layout_configs, max_thresh=max_thresh, threshold_type=thresh_type, breaking_method=breaking_method)
31
+ 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])
18
32
  layoutfile["layouts"] = new_layouts
19
- target_file = output_path if output_path is not None else layout_path.parent / f'{layout_path.stem}_adjusted_{max_thresh}_{thresh_type}_{breaking_method}.json'
33
+ 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'
20
34
  target_file.parent.mkdir(parents=True, exist_ok=True)
21
35
  target_file.write_text(data=json.dumps(layoutfile, indent=4), encoding="utf-8")
22
36
  typer.echo(f"Adjusted layout saved to {target_file}")
23
37
 
24
38
 
25
- def select_layout(layouts_json_file: Path, selected_layouts_names: Optional[list[str]], select_interactively: bool) -> list["LayoutConfig"]:
39
+ def select_layout(layouts_json_file: str, selected_layouts_names: Optional[list[str]], select_interactively: bool) -> list["LayoutConfig"]:
26
40
  import json
27
41
  from machineconfig.utils.options import choose_from_options
28
42
  from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
29
- layout_file: LayoutsFile = json.loads(layouts_json_file.read_text(encoding="utf-8"))
43
+ from pathlib import Path
44
+ layout_file: LayoutsFile = json.loads(Path(layouts_json_file).read_text(encoding="utf-8"))
30
45
  if len(layout_file["layouts"]) == 0:
31
46
  raise ValueError(f"No layouts found in {layouts_json_file}")
32
47
  if selected_layouts_names is None: # choose all, or interactively
@@ -49,35 +64,35 @@ def select_layout(layouts_json_file: Path, selected_layouts_names: Optional[list
49
64
  return layouts_chosen
50
65
 
51
66
 
52
- def find_layout_file(layout_path: str, ) -> Path:
53
- from machineconfig.utils.path_extended import PathExtended
54
- from machineconfig.scripts.python.helpers_fire_command.file_wrangler import search_for_files_of_interest
67
+ def find_layout_file(layout_path: str, ) -> str:
68
+ from machineconfig.utils.path_helper import search_for_files_of_interest
55
69
  from machineconfig.utils.options import choose_from_options
56
70
  from machineconfig.utils.path_helper import match_file_name, sanitize_path
71
+ from pathlib import Path
57
72
  path_obj = sanitize_path(layout_path)
58
73
  if not path_obj.exists():
59
- choice_file = match_file_name(sub_string=layout_path, search_root=PathExtended.cwd(), suffixes={".json"})
74
+ choice_file = match_file_name(sub_string=layout_path, search_root=Path.cwd(), suffixes={".json"})
60
75
  elif path_obj.is_dir():
61
76
  print(f"🔍 Searching recursively for Python, PowerShell and Shell scripts in directory `{path_obj}`")
62
- files = search_for_files_of_interest(path_obj)
77
+ files = search_for_files_of_interest(path_obj, suffixes={".py", ".sh", ".ps1"})
63
78
  print(f"🔍 Got #{len(files)} results.")
64
79
  choice_file = choose_from_options(multi=False, options=files, fzf=True, msg="Choose one option")
65
- choice_file = PathExtended(choice_file)
80
+ choice_file = Path(choice_file).expanduser().absolute()
66
81
  else:
67
82
  choice_file = path_obj
68
- return choice_file
83
+ return str(choice_file)
69
84
 
70
85
 
71
86
  def run(ctx: typer.Context,
72
87
  layout_path: Annotated[Optional[str], typer.Argument(..., help="Path to the layout.json file")] = None,
73
- max_tabs: Annotated[int, typer.Option(..., help="A Sanity checker that throws an error if any layout exceeds the maximum number of tabs to launch.")] = 10,
74
- max_layouts: Annotated[int, typer.Option(..., help="A Sanity checker that throws an error if the total number of *parallel layouts exceeds this number.")] = 10,
75
- sleep_inbetween: Annotated[float, typer.Option(..., help="Sleep time in seconds between launching layouts")] = 1.0,
88
+ 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,
89
+ 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,
90
+ sleep_inbetween: Annotated[float, typer.Option(..., "--sleep-inbetween", "-si", help="Sleep time in seconds between launching layouts")] = 1.0,
76
91
  monitor: Annotated[bool, typer.Option(..., "--monitor", "-m", help="Monitor the layout sessions for completion")] = False,
77
92
  parallel: Annotated[bool, typer.Option(..., "--parallel", "-p", help="Launch multiple layouts in parallel")] = False,
78
93
  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,
79
94
  choose: Annotated[Optional[str], typer.Option(..., "--choose", "-c", help="Comma separated names of layouts to be selected from the layout file passed")] = None,
80
- choose_interactively: Annotated[bool, typer.Option(..., "--choose-interactively", "-ia", help="Select layouts interactively")] = False
95
+ choose_interactively: Annotated[bool, typer.Option(..., "--choose-interactively", "-i", help="Select layouts interactively")] = False
81
96
  ):
82
97
  """
83
98
  Launch terminal sessions based on a layout configuration file.
@@ -1,6 +1,8 @@
1
1
 
2
2
 
3
- from machineconfig.scripts.python.helpers_devops.cli_utils import download, merge_pdfs, get_machine_specs, init_project, compress_pdf, edit
3
+ from machineconfig.scripts.python.helpers_devops.cli_utils import merge_pdfs, compress_pdf
4
+ from machineconfig.scripts.python.helpers_utils.path import edit_file_with_hx, get_machine_specs, init_project, path
5
+ from machineconfig.scripts.python.helpers_utils.download import download
4
6
  import typer
5
7
  from typing import Annotated
6
8
 
@@ -30,6 +32,9 @@ def get_app() -> typer.Typer:
30
32
  app.command(name="kill-process", no_args_is_help=False, help="[k] Choose a process to kill")(kill_process)
31
33
  app.command(name="k", no_args_is_help=False, help="Choose a process to kill", hidden=True)(kill_process)
32
34
 
35
+ app.command("path", no_args_is_help=False, help="📚 [p] NAVIGATE PATH variable with TUI")(path)
36
+ app.command("p", no_args_is_help=False, help="NAVIGATE PATH variable with TUI", hidden=True)(path)
37
+
33
38
  app.command(name="upgrade-packages", no_args_is_help=False, help="[up] Upgrade project dependencies.")(upgrade_packages)
34
39
  app.command(name="up", no_args_is_help=False, hidden=True)(upgrade_packages)
35
40
 
@@ -39,8 +44,8 @@ def get_app() -> typer.Typer:
39
44
  app.command(name="g", no_args_is_help=False, hidden=True)(get_machine_specs)
40
45
  app.command(name="init-project", no_args_is_help=False, help="[i] Initialize a project with a uv virtual environment and install dev packages.")(init_project)
41
46
  app.command(name="i", no_args_is_help=False, hidden=True)(init_project)
42
- app.command(name="edit", no_args_is_help=False, help="[e] Open a file in the default editor.")(edit)
43
- app.command(name="e", no_args_is_help=False, hidden=True)(edit)
47
+ app.command(name="edit", no_args_is_help=False, help="[e] Open a file in the default editor.")(edit_file_with_hx)
48
+ app.command(name="e", no_args_is_help=False, hidden=True)(edit_file_with_hx)
44
49
 
45
50
  app.command(name="pdf-merge", no_args_is_help=True, help="[pm] Merge two PDF files into one.")(merge_pdfs)
46
51
  app.command(name="pm", no_args_is_help=True, hidden=True)(merge_pdfs)
@@ -7,7 +7,7 @@ $user = ''
7
7
  $sharePath = ''
8
8
  $driveLetter = ''
9
9
 
10
- uv run --python 3.14 --with "machineconfig>=7.49" python -m machineconfig.scripts.python.mount_ssh
10
+ uv run --python 3.14 --with "machineconfig>=7.64" python -m machineconfig.scripts.python.mount_ssh
11
11
 
12
12
  net use T: \\sshfs.kr\$user@$host.local
13
13
  # this worked: net use T: \\sshfs\alex@alex-p51s-5.local
@@ -31,11 +31,11 @@ export-env {
31
31
  let config_root = $"($env.HOME)/.config/machineconfig"
32
32
  load-env { CONFIG_ROOT: $config_root }
33
33
 
34
- let new_path = (add_to_path_if_not_already $"($config_root)/scripts/linux" $"($env.HOME)/dotfiles/scripts/linux" "/usr/local/bin")
34
+ let new_path = (add_to_path_if_not_already $"($config_root)/scripts" $"($env.HOME)/dotfiles/scripts/linux" "/usr/local/bin")
35
35
  load-env { PATH: $new_path }
36
36
 
37
37
  # Source external scripts and define aliases
38
- if ($"($config_root)/scripts/linux" | path exists) {
38
+ if ($"($config_root)/scripts" | path exists) {
39
39
  # Source helper scripts
40
40
  # let broot_script = ($config_root | path join "settings" "broot" "brootcd.nu")
41
41
  # let lf_script = ($config_root | path join "settings" "lf" "linux" "lfcd.nu")
@@ -190,4 +190,6 @@ end
190
190
 
191
191
 
192
192
  -- and finally, return the configuration to wezterm
193
+ -- config.enable_osc133 = false -- to silence: P>|WezTerm 20240203-110809-5046fc22\
194
+
193
195
  return config
@@ -57,7 +57,7 @@ alias r='wrap_in_shell_script croshell'
57
57
  alias u='wrap_in_shell_script utils'
58
58
  alias t='wrap_in_shell_script terminal'
59
59
  alias ms='wrap_in_shell_script msearch'
60
- alias x='. $CONFIG_ROOT/scripts/linux/wrap_mcfg explore'
60
+ alias x='. $CONFIG_ROOT/scripts/wrap_mcfg explore'
61
61
 
62
62
  # alias gcs='gh copilot suggest -t shell'
63
63
  # alias gcg='gh copilot suggest -t git'
@@ -72,15 +72,9 @@ alias x='. $CONFIG_ROOT/scripts/linux/wrap_mcfg explore'
72
72
  # gh copilot explain "Input command is: $x The output is this: $y"
73
73
  # }
74
74
 
75
- # 📦 Node Version Manager
76
- # export NVM_DIR="$HOME/.nvm"
77
- # [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
78
- # [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
79
-
80
75
 
81
76
  # https://github.com/atuinsh/atuin
82
77
  # eval "$(atuin init bash)"
83
-
84
78
  # source /home/alex/.config/broot/launcher/bash/br
85
79
  # eval "$(thefuck --alias)"
86
80
  # from https://github.com/ajeetdsouza/zoxide
@@ -90,7 +84,6 @@ eval "$(starship init zsh)"
90
84
  # LEVE THIS IN THE END TO AVOID EXECUTION FAILURE OF THE REST OF THE SCRIPT
91
85
  # from https://github.com/cantino/mcfly
92
86
  eval "$(mcfly init zsh)"
93
-
94
87
  # Show elapsed runtime
95
88
  # _show_elapsed
96
89
 
@@ -1,36 +1,57 @@
1
+ -- https://yazi-rs.github.io/docs/tips#symlink-in-status
2
+ -- https://yazi-rs.github.io/docs/tips#user-group-in-status
3
+ -- https://yazi-rs.github.io/docs/tips#username-hostname-in-header
1
4
 
5
+ -- Load Status component
6
+ function Status:render(area)
7
+ self.area = area
2
8
 
3
- -- https://yazi-rs.github.io/docs/tips#symlink-in-status
4
- Status:children_add(function(self)
9
+ local left = ui.Line(self:mode())
10
+ local right = ui.Line {}
11
+ local center = ui.Line {}
12
+
13
+ -- Add symlink target
5
14
  local h = self._current.hovered
6
15
  if h and h.link_to then
7
- return " -> " .. tostring(h.link_to)
8
- else
9
- return ""
16
+ center = center .. ui.Span(" -> " .. tostring(h.link_to)):fg("cyan")
10
17
  end
11
- end, 3300, Status.LEFT)
12
-
13
18
 
14
- -- https://yazi-rs.github.io/docs/tips#user-group-in-status
15
- Status:children_add(function()
16
- local h = cx.active.current.hovered
17
- if not h or ya.target_family() ~= "unix" then
18
- return ""
19
+ -- Add user:group on Unix
20
+ if h and ya.target_family() == "unix" then
21
+ right = right .. ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta")
22
+ right = right .. ui.Span(":"):fg("magenta")
23
+ right = right .. ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta")
24
+ right = right .. ui.Span(" ")
19
25
  end
20
26
 
21
- return ui.Line {
22
- ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
23
- ":",
24
- ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
25
- " ",
27
+ -- Add default status elements
28
+ left = left .. self:size()
29
+ right = self:name() .. right .. self:percentage()
30
+
31
+ return {
32
+ ui.Paragraph(area, { left, center }),
33
+ ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT),
26
34
  }
27
- end, 500, Status.RIGHT)
35
+ end
28
36
 
37
+ -- Load Header component
38
+ function Header:render(area)
39
+ self.area = area
40
+
41
+ local left = ui.Line {}
42
+ local right = ui.Line {}
29
43
 
30
- -- https://yazi-rs.github.io/docs/tips#username-hostname-in-header
31
- Header:children_add(function()
32
- if ya.target_family() ~= "unix" then
33
- return ""
44
+ -- Add username@hostname on Unix
45
+ if ya.target_family() == "unix" then
46
+ left = left .. ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
34
47
  end
35
- return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
36
- end, 500, Header.LEFT)
48
+
49
+ -- Add default header elements
50
+ left = left .. self:cwd()
51
+ right = self:tabs()
52
+
53
+ return {
54
+ ui.Paragraph(area, { left }),
55
+ ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT),
56
+ }
57
+ end
@@ -12,7 +12,6 @@ for = "windows"
12
12
  run = 'shell "powershell.exe" --block'
13
13
  desc = "Open PowerShell here"
14
14
 
15
-
16
15
  # FROM https://github.com/yazi-rs/plugins/tree/main/toggle-pane.yazi
17
16
  # keymap.toml
18
17
  # parent, current, preview
@@ -55,7 +54,7 @@ desc = "Read with vscode"
55
54
 
56
55
  [[mgr.prepend_keymap]]
57
56
  on = ["R", "h"]
58
- # run = 'shell --block -- powershell "~\.config\machineconfig\scripts\wrap_mcfg"utils edit "$0"'
57
+ run = 'shell --block -- powershell "~\.config\machineconfig\scripts\wrap_mcfg" utils edit "$0"'
59
58
  desc = "Read with helix"
60
59
 
61
60
  [[mgr.prepend_keymap]]
@@ -1,9 +1,33 @@
1
+ # function y {
2
+ # $tmp = (New-TemporaryFile).FullName
3
+ # yazi $args --cwd-file="$tmp"
4
+ # $cwd = Get-Content -Path $tmp -Encoding UTF8
5
+ # if (-not [String]::IsNullOrEmpty($cwd) -and $cwd -ne $PWD.Path) {
6
+ # Set-Location -LiteralPath (Resolve-Path -LiteralPath $cwd).Path
7
+ # }
8
+ # Remove-Item -Path $tmp
9
+ # }
1
10
  function y {
11
+ # Save + temporarily disable WezTerm/Starship prompt marking
12
+ $oldWez = $env:WEZTERM_SHELL_SKIP_ALL
13
+ $env:WEZTERM_SHELL_SKIP_ALL = "1" # tells WezTerm integration to skip markers (supported knob)
14
+ $oldTransient = $env:STARSHIP_DISABLE_TRANSIENT_PROMPT
15
+ $env:STARSHIP_DISABLE_TRANSIENT_PROMPT = "true"
16
+
2
17
  $tmp = (New-TemporaryFile).FullName
3
- yazi $args --cwd-file="$tmp"
4
- $cwd = Get-Content -Path $tmp -Encoding UTF8
5
- if (-not [String]::IsNullOrEmpty($cwd) -and $cwd -ne $PWD.Path) {
6
- Set-Location -LiteralPath (Resolve-Path -LiteralPath $cwd).Path
18
+ try {
19
+ yazi $args --cwd-file="$tmp"
20
+ $cwd = Get-Content -Path $tmp -Encoding UTF8
21
+ if (-not [string]::IsNullOrEmpty($cwd) -and $cwd -ne $PWD.Path) {
22
+ Set-Location -LiteralPath (Resolve-Path -LiteralPath $cwd).Path
23
+ }
24
+ } finally {
25
+ # Clean up temp file
26
+ Remove-Item -Path $tmp -ErrorAction SilentlyContinue
27
+ # Restore env
28
+ if ($null -ne $oldWez) { $env:WEZTERM_SHELL_SKIP_ALL = $oldWez } else { Remove-Item Env:\WEZTERM_SHELL_SKIP_ALL -ErrorAction SilentlyContinue }
29
+ if ($null -ne $oldTransient) { $env:STARSHIP_DISABLE_TRANSIENT_PROMPT = $oldTransient } else { Remove-Item Env:\STARSHIP_DISABLE_TRANSIENT_PROMPT -ErrorAction SilentlyContinue }
30
+ # Nudge terminal back to sane modes (cursor on, no mouse, no bracketed paste)
31
+ Write-Host -NoNewline "`e[0m`e[?25h`e[?1000l`e[?1002l`e[?1006l`e[?2004l"
7
32
  }
8
- Remove-Item -Path $tmp
9
33
  }
@@ -2,7 +2,6 @@
2
2
  from pathlib import Path
3
3
 
4
4
  INTERACTIVE = Path(__file__).parent.joinpath("web_shortcuts/interactive.sh")
5
- APPS = Path(__file__).parent.joinpath("apps.sh")
6
5
  UV = Path(__file__).parent.joinpath("uv.sh")
7
6
 
8
7
  APPS_DESKTOP = Path(__file__).parent.joinpath("apps_desktop.sh")
@@ -2,16 +2,16 @@
2
2
  . <( curl -sSL "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/uv.sh")
3
3
  . <( curl -sSL "https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/scripts/linux/wrap_mcfg")
4
4
 
5
- alias devops='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" devops'
6
- alias cloud='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" cloud'
7
- alias agents='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" agents'
8
- alias sessions='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" sessions'
9
- alias ftpx='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" ftpx'
10
- alias fire='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" fire'
11
- alias croshell='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" croshell'
12
- alias utils='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" utils'
13
- alias terminal='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" terminal'
14
- alias msearch='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.49" msearch'
5
+ alias devops='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" devops'
6
+ alias cloud='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" cloud'
7
+ alias agents='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" agents'
8
+ alias sessions='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" sessions'
9
+ alias ftpx='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" ftpx'
10
+ alias fire='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" fire'
11
+ alias croshell='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" croshell'
12
+ alias utils='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" utils'
13
+ alias terminal='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" terminal'
14
+ alias msearch='$HOME/.local/bin/uvx --python 3.14 --from "machineconfig>=7.64" msearch'
15
15
 
16
16
  alias d='wrap_in_shell_script devops'
17
17
  alias c='wrap_in_shell_script cloud'
@@ -25,3 +25,5 @@ alias t='wrap_in_shell_script terminal'
25
25
  alias ms='wrap_in_shell_script msearch'
26
26
 
27
27
  echo "mcfg command aliases are now defined in this shell session."
28
+
29
+ devops self interactive
@@ -7,11 +7,10 @@ pointing at common scripts (so other code can import these paths).
7
7
 
8
8
  from pathlib import Path
9
9
 
10
- # Path to main installer script for macOS
11
- APPS = Path(__file__).parent.joinpath("apps.sh")
10
+
12
11
  # Optional helper scripts (may or may not exist)
13
12
  UV = Path(__file__).parent.joinpath("uv.sh")
14
13
  # Path to macOS SSH helper
15
14
  SSH_SETUP = Path(__file__).parent.joinpath("ssh/openssh_setup.sh")
16
15
 
17
- __all__ = ["APPS", "UV", "SSH_SETUP"]
16
+ __all__ = ["UV", "SSH_SETUP"]
@@ -1,11 +1,8 @@
1
1
 
2
2
  from pathlib import Path
3
3
 
4
- APPS = Path(__file__).parent.joinpath("apps.ps1")
5
4
  UV = Path(__file__).parent.joinpath("uv.ps1")
6
-
7
5
  DOCKER = Path(__file__).parent.joinpath("others/docker.ps1")
8
6
  OBS = Path(__file__).parent.joinpath("others/obs.ps1")
9
7
  POWER_OPTIONS = Path(__file__).parent.joinpath("others/power_options.ps1")
10
-
11
8
  SSH_SERVER = Path(__file__).parent.joinpath("ssh/openssh_server.ps1")