machineconfig 5.94__py3-none-any.whl → 5.96__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.

@@ -48,7 +48,7 @@ def adjust_gitignore(repo_root: Path) -> None:
48
48
  "CLAUDE.md",
49
49
  "CRUSH.md",
50
50
  ".cursor",
51
- ".clinerules"
51
+ ".clinerules",
52
52
  ".github/instructions",
53
53
  ".github/chatmodes",
54
54
  ".github/prompts",
@@ -20,8 +20,13 @@ def update():
20
20
  uv self update
21
21
  uv tool install --upgrade machineconfig
22
22
  """
23
- from machineconfig.utils.code import run_shell_script
24
- run_shell_script(code)
23
+ import platform
24
+ if platform.system() == "Windows":
25
+ from machineconfig.utils.code import run_shell_script_after_exit
26
+ run_shell_script_after_exit(code)
27
+ else:
28
+ from machineconfig.utils.code import run_shell_script
29
+ run_shell_script(code)
25
30
 
26
31
  def interactive():
27
32
  """🤖 INTERACTIVE configuration of machine."""
@@ -101,3 +106,4 @@ def get_app():
101
106
  cli_app.command("readme", no_args_is_help=False, help="📚 [r] render readme markdown in terminal.")(readme)
102
107
  cli_app.command("r", no_args_is_help=False, hidden=True)(readme)
103
108
  return cli_app
109
+
@@ -12,10 +12,10 @@ CONFIG_ROOT="$HOME/.config/machineconfig"
12
12
 
13
13
  # 📂 Add directories to PATH
14
14
  add_to_path_if_not_already \
15
- "$HOME/.local/bin" \
16
- "$HOME/.cargo/bin" \
17
15
  "$CONFIG_ROOT/scripts/linux" \
18
16
  "$HOME/dotfiles/scripts/linux" \
17
+ "$HOME/.local/bin" \
18
+ "$HOME/.cargo/bin" \
19
19
  "/usr/games"
20
20
  # this way, if the script was run multiple times, e.g. due to nested shells in zellij, there will be no duplicates in the path
21
21
  # export DISPLAY=localhost:0.0 # xming server
@@ -26,10 +26,14 @@ add_to_path_if_not_already \
26
26
  . $CONFIG_ROOT/settings/broot/br.sh
27
27
  . $CONFIG_ROOT/settings/lf/linux/exe/lfcd.sh
28
28
  . $CONFIG_ROOT/settings/tere/terecd.sh
29
+ # check if file in ~/dotfiles/machineconfig/init_linux.sh exists and source it
30
+ if [ -f "$HOME/dotfiles/machineconfig/init_linux.sh" ]; then
31
+ # echo "Sourcing $HOME/dotfiles/machineconfig/init_linux.sh"
32
+ source "$HOME/dotfiles/machineconfig/init_linux.sh"
33
+ fi
29
34
 
30
35
  # set alias l to lsd -la
31
36
  alias l='lsd -la'
32
-
33
37
  alias d=devops
34
38
  alias c=cloud
35
39
  alias a=agents
@@ -57,20 +61,16 @@ alias cs=croshell
57
61
  # [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
58
62
 
59
63
 
64
+ # https://github.com/atuinsh/atuin
65
+ # eval "$(atuin init bash)"
66
+
60
67
  # source /home/alex/.config/broot/launcher/bash/br
61
68
  # eval "$(thefuck --alias)"
62
69
  # from https://github.com/ajeetdsouza/zoxide
63
70
  eval "$(zoxide init bash)"
64
71
  # from https://github.com/starship/starship
65
72
  eval "$(starship init bash)"
66
- # https://github.com/atuinsh/atuin
67
- # eval "$(atuin init bash)"
68
73
  # LEVE THIS IN THE END TO AVOID EXECUTION FAILURE OF THE REST OF THE SCRIPT
69
74
  # from https://github.com/cantino/mcfly
70
75
  eval "$(mcfly init bash)"
71
76
 
72
- # check if file in ~/dotfiles/machineconfig/init_linux.sh exists and source it
73
- if [ -f "$HOME/dotfiles/machineconfig/init_linux.sh" ]; then
74
- # echo "Sourcing $HOME/dotfiles/machineconfig/init_linux.sh"
75
- source "$HOME/dotfiles/machineconfig/init_linux.sh"
76
- fi
@@ -7,7 +7,6 @@ function Add-ToPathIfNotAlready {
7
7
  [Parameter(Mandatory=$true)]
8
8
  [string[]]$Directories
9
9
  )
10
-
11
10
  foreach ($dir in $Directories) {
12
11
  if ($env:Path -notlike "*$dir*") {
13
12
  $env:Path += ";$dir"
@@ -16,7 +15,7 @@ function Add-ToPathIfNotAlready {
16
15
  }
17
16
 
18
17
  Add-ToPathIfNotAlready -Directories @(
19
- "$CONFIG_ROOT\src\machineconfig\scripts\windows",
18
+ "$CONFIG_ROOT\scripts\windows",
20
19
  "$HOME\dotfiles\scripts\windows",
21
20
  "C:\Program Files (x86)\GnuWin32\bin",
22
21
  "C:\Program Files\CodeBlocks\MinGW\bin",
@@ -24,10 +23,6 @@ Add-ToPathIfNotAlready -Directories @(
24
23
  "C:\Program Files\Graphviz\bin"
25
24
  )
26
25
 
27
- # $machineconfig_path = (python -c "print(__import__('machineconfig').__file__[:-12])")
28
- #C:\Program Files\Git\bin
29
-
30
-
31
26
  # sources ================================================================
32
27
  . $CONFIG_ROOT\settings\broot\brootcd.ps1
33
28
  . $CONFIG_ROOT\settings\lf\windows\lfcd.ps1
@@ -36,7 +31,6 @@ Add-ToPathIfNotAlready -Directories @(
36
31
 
37
32
  function lsdla { lsd -la }
38
33
  Set-Alias -Name l -Value lsdla -Option AllScope
39
-
40
34
  function d { mcfg devops @args }
41
35
  function c { mcfg cloud @args }
42
36
  function a { mcfg agents @args }
@@ -44,8 +38,6 @@ function s { mcfg sessions @args }
44
38
  function ff { mcfg ftpx @args }
45
39
  function f { mcfg fire @args }
46
40
  function cs { mcfg croshell @args }
47
-
48
-
49
41
  try {
50
42
  Set-Alias -Name gcs -Value {gh copilot suggest -t shell}
51
43
  Set-Alias -Name gcg -Value {gh copilot suggest -t git}
@@ -72,25 +64,3 @@ try {
72
64
  catch {
73
65
  # Do nothing
74
66
  }
75
-
76
- # try {
77
- # Invoke-Expression -Command $(mcfly init powershell | out-string)
78
- # }
79
- # catch {
80
- # # Do nothing
81
- # }
82
-
83
-
84
- # oh-my-posh --init --shell pwsh --config $env:USERPROFILE/AppData/Local/Programs/oh-my-posh/themes/atomicBit.omp.json | Invoke-Expression
85
-
86
- # try {
87
- # Invoke-Expression (&starship init powershell)
88
- # }
89
- # catch {
90
- # # Do nothing
91
- # # oh-my-posh --init --shell pwsh --config $env:USERPROFILE/AppData/Local/Programs/oh-my-posh/themes/atomicBit.omp.json | Invoke-Expression
92
- # }
93
-
94
- # Set-Alias lvim '~/.local/bin/lvim.ps1'
95
- # function fuck { $history = (Get-History -Count 1).CommandLine; if (-not [string]::IsNullOrWhiteSpace($history)) { $f>
96
-
@@ -1,6 +1,8 @@
1
1
  import platform
2
2
  from typing import Optional
3
3
  import subprocess
4
+ import os
5
+ # import time
4
6
  from rich.console import Console
5
7
  from rich.panel import Panel
6
8
  from rich.syntax import Syntax
@@ -134,3 +136,74 @@ def run_shell_script(script: str, display_script: bool = True, clean_env: bool =
134
136
  temp_script_path.unlink(missing_ok=True)
135
137
  console.print(f"🗑️ [blue]Temporary script deleted:[/blue] [green]{temp_script_path}[/green]")
136
138
  return proc
139
+
140
+
141
+ def run_shell_script_after_exit(script: str, check_interval: float = 0.1, display_script: bool = True) -> subprocess.Popen[bytes]:
142
+ current_pid = os.getpid()
143
+ console = Console()
144
+
145
+ if platform.system() == "Windows":
146
+ monitor_script = f"""$ErrorActionPreference = "Stop"
147
+ $targetPid = {current_pid}
148
+ $checkInterval = {check_interval}
149
+
150
+ Write-Host "🔍 Monitoring process PID: $targetPid"
151
+
152
+ while ($true) {{
153
+ $process = Get-Process -Id $targetPid -ErrorAction SilentlyContinue
154
+ if (-not $process) {{
155
+ Write-Host "✅ Process $targetPid has exited. Running script..."
156
+ break
157
+ }}
158
+ Start-Sleep -Seconds $checkInterval
159
+ }}
160
+
161
+ # Execute the provided script
162
+ {script}
163
+ """
164
+ suffix = ".ps1"
165
+ cmd = ["powershell", "-ExecutionPolicy", "Bypass", "-NoProfile", "-WindowStyle", "Hidden", "-File"]
166
+ else:
167
+ monitor_script = f"""#!/bin/bash
168
+ target_pid={current_pid}
169
+ check_interval={check_interval}
170
+
171
+ echo "🔍 Monitoring process PID: $target_pid"
172
+
173
+ while kill -0 $target_pid 2>/dev/null; do
174
+ sleep $check_interval
175
+ done
176
+
177
+ echo "✅ Process $target_pid has exited. Running script..."
178
+
179
+ # Execute the provided script
180
+ {script}
181
+ """
182
+ suffix = ".sh"
183
+ cmd = ["bash"]
184
+
185
+ monitor_script_path = PathExtended.tmp().joinpath("tmp_scripts", "monitor", randstr() + suffix)
186
+ monitor_script_path.parent.mkdir(parents=True, exist_ok=True)
187
+ monitor_script_path.write_text(monitor_script, encoding="utf-8")
188
+
189
+ if display_script:
190
+ lexer = "powershell" if platform.system() == "Windows" else "bash"
191
+ console.print(Panel(Syntax(code=monitor_script, lexer=lexer), title=f"📄 Monitor script @ {monitor_script_path}", subtitle="Will run after current process exits"), style="bold yellow")
192
+
193
+ if platform.system() != "Windows":
194
+ monitor_script_path.chmod(0o755)
195
+
196
+ cmd.append(str(monitor_script_path))
197
+
198
+ if platform.system() == "Windows":
199
+ creation_flags = subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS
200
+ process = subprocess.Popen(cmd, creationflags=creation_flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
201
+ else:
202
+ process = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL, start_new_session=True)
203
+
204
+ if display_script:
205
+ console.print(f"🚀 [green]Monitor process started with PID:[/green] [blue]{process.pid}[/blue]")
206
+ console.print(f"📍 [yellow]Watching PID:[/yellow] [blue]{current_pid}[/blue]")
207
+
208
+ return process
209
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 5.94
3
+ Version: 5.96
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -139,7 +139,7 @@ machineconfig/scripts/python/ai/scripts/lint_and_type_check.ps1,sha256=m_z4vzLrv
139
139
  machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh,sha256=Mt9D0LSEwbvVaq_wxTAch4NLyFUuDGHjn6rtEt_9alU,4615
140
140
  machineconfig/scripts/python/ai/solutions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
141
  machineconfig/scripts/python/ai/solutions/_shared.py,sha256=rBniovmKZuY48T50cCyG_oeFZgSap365EXEadv9UtM4,603
142
- machineconfig/scripts/python/ai/solutions/generic.py,sha256=MRaEjyJC7VWi0klq_JEoeOmD6ZoFZIMoJXuHkTiuXSI,2363
142
+ machineconfig/scripts/python/ai/solutions/generic.py,sha256=wXmajwy99GNCr1lPGPwavKHRgLtR8JrTalovYNn0kCg,2364
143
143
  machineconfig/scripts/python/ai/solutions/claude/claude.py,sha256=tVMdaOL_9jC1nvfPsJs9WRkPPNa2tQVyq4vxdpOPK6k,343
144
144
  machineconfig/scripts/python/ai/solutions/cline/cline.py,sha256=3nYdEmdk76sYerEvImEDi3Qi-n94ExFkg20HttI7iCc,446
145
145
  machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py,sha256=spuPpENX_lZIBiANQq9eTxefoPBE2Ao_LEY16ZCaUQY,1890
@@ -178,7 +178,7 @@ machineconfig/scripts/python/devops_helpers/cli_config_dotfile.py,sha256=rjTys4F
178
178
  machineconfig/scripts/python/devops_helpers/cli_data.py,sha256=kvJ7g2CccjjXIhCwdu_Vlif8JHC0qUoLjuGcTSqT-IU,514
179
179
  machineconfig/scripts/python/devops_helpers/cli_nw.py,sha256=nI_zmcmUvijVeXIWT2dN5onoy3ou-lub1cL-SJImmDA,4125
180
180
  machineconfig/scripts/python/devops_helpers/cli_repos.py,sha256=GEsW0ykgu8mtoiXurOSjOlbY_Xrngy_aeBq4eRZY8ts,12335
181
- machineconfig/scripts/python/devops_helpers/cli_self.py,sha256=6tNrchY6-QStf4LfpCRvy36gBM3_GJIGC2OVCiz-iNo,4986
181
+ machineconfig/scripts/python/devops_helpers/cli_self.py,sha256=WHrx980iGBMO_A-QiA4NyJ_2bvHBIe1nmhzwbczEOi0,5179
182
182
  machineconfig/scripts/python/devops_helpers/cli_share_server.py,sha256=q9pFJ6AxPuygMr3onMNOKEuuQHbVE_6Qoyo7xRT5FX0,4196
183
183
  machineconfig/scripts/python/devops_helpers/cli_terminal.py,sha256=k_PzXaiGyE0vXr0Ii1XcJz2A7UvyPJrR31TRWt4RKRI,6019
184
184
  machineconfig/scripts/python/devops_helpers/devops_backup_retrieve.py,sha256=nK47Rc7gQuDCnkk6_sW1y82gBnDJ9TdHU8XwMPFBK9c,5591
@@ -323,7 +323,7 @@ machineconfig/settings/rofi/config.rasi,sha256=nDX5B8wdXQYF1fwiOTBRJUI4l_gQbYaLa
323
323
  machineconfig/settings/rofi/config_default.rasi,sha256=rTfKnC-bZuWX1l-lWQACCUOE1ShhkfykAxtXX9PlQHE,4694
324
324
  machineconfig/settings/shells/alacritty/alacritty.toml,sha256=EbL-2Y4QunW1pvRWB2yuLCw8MMPONheJr5LFoWRieUQ,871
325
325
  machineconfig/settings/shells/alacritty/alacritty.yml,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
326
- machineconfig/settings/shells/bash/init.sh,sha256=vQCV0bnIh8nBiFq1d2YoToDqPdPTrCPDEeRFY0Om6sE,2266
326
+ machineconfig/settings/shells/bash/init.sh,sha256=wVG9lTNy0C8CVSnt-6TSSM3EHRwPc7uU7jz3WVSrI3c,2266
327
327
  machineconfig/settings/shells/hyper/.hyper.js,sha256=h-HqeYlvPvPD4Ee7828Cxo87uVkzbMGJFqXTZIWoegw,8884
328
328
  machineconfig/settings/shells/ipy/profiles/default/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
329
329
  machineconfig/settings/shells/ipy/profiles/default/startup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -331,7 +331,7 @@ machineconfig/settings/shells/ipy/profiles/default/startup/playext.py,sha256=OJ3
331
331
  machineconfig/settings/shells/kitty/kitty.conf,sha256=lDdx-dUX3jbKGb3BkS2f2TOpmgGiS-CI-_-lFvhD5A4,52870
332
332
  machineconfig/settings/shells/nushell/config.nu,sha256=ug0E0NXNlCzgStScFN6VTsAkUaOTPJZB69P-LS5L2VE,1047
333
333
  machineconfig/settings/shells/nushell/env.nu,sha256=4VmaXb-qP6qnMD5TPzkXMLFNlB5QC4l9HEzCvXZE2GQ,315
334
- machineconfig/settings/shells/pwsh/init.ps1,sha256=o98tqfAOZT89rclbhRmDBQ7zU9Rtdm_FvY8alXYGCN0,2647
334
+ machineconfig/settings/shells/pwsh/init.ps1,sha256=NKTMy-8jhlnSi5kZQ9EkGAQqGmjQ1c8vQyb2YBah0NE,1833
335
335
  machineconfig/settings/shells/pwsh/profile.ps1,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
336
336
  machineconfig/settings/shells/starship/starship.toml,sha256=5rQTY7ZpKnrnhgu2Y9OJKUYMz5lPLIftO1p1VRuVZwQ,1150
337
337
  machineconfig/settings/shells/vtm/settings.xml,sha256=5TNXd-i0eUGo2w3tuhY9aOkwoJdqih8_HO_U6uL2Dts,18262
@@ -383,7 +383,7 @@ machineconfig/setup_windows/wt_and_pwsh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
383
383
  machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py,sha256=ogxJnwpdcpH7N6dFJu95UCNoGYirZKQho_3X0F_hmXs,6791
384
384
  machineconfig/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
385
385
  machineconfig/utils/accessories.py,sha256=W_9dLzjwNTW5JQk_pe3B2ijQ1nA2-8Kdg2r7VBtzgQs,4340
386
- machineconfig/utils/code.py,sha256=yUoRzw7jTL-f3I0liyxguyzpki8d1h1ieJmG6dHzkDQ,6300
386
+ machineconfig/utils/code.py,sha256=CAjArgaT2ENhnsgwtGUYBRyAbs_tiMlX3PKy-Uz47c4,8901
387
387
  machineconfig/utils/installer.py,sha256=ZnhW_gRmGlq5uXwzNvIn-x1vXuOJxkzVqjNu188f37s,10465
388
388
  machineconfig/utils/io.py,sha256=rzEwAnq-gyT29Y4CDHHGxAA6ddIIFOCxrqZ6dn0ALa4,2255
389
389
  machineconfig/utils/links.py,sha256=KM6vIn3hag9FYEzLSHP5MAM9tU_RStw2mCq2_OvmmZA,23672
@@ -421,8 +421,8 @@ machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoS
421
421
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
422
422
  machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
423
423
  machineconfig/utils/ssh_utils/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
424
- machineconfig-5.94.dist-info/METADATA,sha256=RkrR24IGdAjvpYIIwt594YIkWuLUq_IYtBRqrDU0YDs,3012
425
- machineconfig-5.94.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
426
- machineconfig-5.94.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
427
- machineconfig-5.94.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
428
- machineconfig-5.94.dist-info/RECORD,,
424
+ machineconfig-5.96.dist-info/METADATA,sha256=pkyWaEW2JW25EIBCw6tu92LmMsnOv7dh_Y89Qa0QYSI,3012
425
+ machineconfig-5.96.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
426
+ machineconfig-5.96.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
427
+ machineconfig-5.96.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
428
+ machineconfig-5.96.dist-info/RECORD,,