machineconfig 2.0__py3-none-any.whl → 2.1__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.
- machineconfig/cluster/cloud_manager.py +0 -3
- machineconfig/cluster/data_transfer.py +0 -1
- machineconfig/cluster/file_manager.py +0 -1
- machineconfig/cluster/job_params.py +0 -3
- machineconfig/cluster/loader_runner.py +0 -3
- machineconfig/cluster/remote_machine.py +0 -1
- machineconfig/cluster/script_notify_upon_completion.py +0 -1
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +3 -5
- machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +17 -57
- machineconfig/cluster/sessions_managers/wt_local.py +36 -110
- machineconfig/cluster/sessions_managers/wt_local_manager.py +42 -112
- machineconfig/cluster/sessions_managers/wt_remote.py +23 -30
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +20 -62
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +10 -15
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +27 -127
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +10 -43
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +22 -101
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +11 -39
- machineconfig/cluster/sessions_managers/zellij_local.py +49 -102
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +34 -78
- machineconfig/cluster/sessions_managers/zellij_remote.py +17 -24
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +7 -13
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +4 -2
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +6 -6
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +18 -88
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +2 -6
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +12 -40
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -2
- machineconfig/cluster/templates/cli_click.py +0 -1
- machineconfig/cluster/templates/cli_gooey.py +0 -2
- machineconfig/cluster/templates/cli_trogon.py +0 -1
- machineconfig/cluster/templates/run_cloud.py +0 -1
- machineconfig/cluster/templates/run_cluster.py +0 -1
- machineconfig/cluster/templates/run_remote.py +0 -1
- machineconfig/cluster/templates/utils.py +26 -10
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
- machineconfig/jobs/python/check_installations.py +1 -0
- machineconfig/jobs/python/create_bootable_media.py +0 -2
- machineconfig/jobs/python/python_ve_symlink.py +9 -11
- machineconfig/jobs/python/tasks.py +0 -1
- machineconfig/jobs/python/vscode/api.py +5 -5
- machineconfig/jobs/python/vscode/link_ve.py +13 -14
- machineconfig/jobs/python/vscode/select_interpreter.py +21 -22
- machineconfig/jobs/python/vscode/sync_code.py +9 -13
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +13 -13
- machineconfig/jobs/python_custom_installers/dev/aider.py +7 -15
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +9 -18
- machineconfig/jobs/python_custom_installers/dev/brave.py +10 -19
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +8 -15
- machineconfig/jobs/python_custom_installers/dev/code.py +14 -21
- machineconfig/jobs/python_custom_installers/dev/cursor.py +3 -14
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +8 -7
- machineconfig/jobs/python_custom_installers/dev/espanso.py +15 -19
- machineconfig/jobs/python_custom_installers/dev/goes.py +5 -12
- machineconfig/jobs/python_custom_installers/dev/lvim.py +9 -17
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/redis.py +12 -20
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +12 -19
- machineconfig/jobs/python_custom_installers/dev/winget.py +5 -23
- machineconfig/jobs/python_custom_installers/docker.py +12 -21
- machineconfig/jobs/python_custom_installers/gh.py +11 -19
- machineconfig/jobs/python_custom_installers/hx.py +32 -16
- machineconfig/jobs/python_custom_installers/warp-cli.py +12 -20
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
- machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
- machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
- machineconfig/jobs/windows/start_terminal.ps1 +1 -1
- machineconfig/profile/create.py +29 -22
- machineconfig/profile/create_hardlinks.py +26 -19
- machineconfig/profile/shell.py +51 -28
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/cloud/init.sh +2 -2
- machineconfig/scripts/linux/checkout_versions +1 -1
- machineconfig/scripts/linux/choose_wezterm_theme +1 -1
- machineconfig/scripts/linux/cloud_copy +1 -1
- machineconfig/scripts/linux/cloud_manager +1 -1
- machineconfig/scripts/linux/cloud_mount +1 -1
- machineconfig/scripts/linux/cloud_repo_sync +1 -1
- machineconfig/scripts/linux/cloud_sync +1 -1
- machineconfig/scripts/linux/croshell +1 -1
- machineconfig/scripts/linux/devops +4 -6
- machineconfig/scripts/linux/fire +1 -1
- machineconfig/scripts/linux/fire_agents +3 -2
- machineconfig/scripts/linux/ftpx +1 -1
- machineconfig/scripts/linux/gh_models +1 -1
- machineconfig/scripts/linux/kill_process +1 -1
- machineconfig/scripts/linux/mcinit +1 -1
- machineconfig/scripts/linux/repos +1 -1
- machineconfig/scripts/linux/scheduler +1 -1
- machineconfig/scripts/linux/start_slidev +1 -1
- machineconfig/scripts/linux/start_terminals +1 -1
- machineconfig/scripts/linux/url2md +1 -1
- machineconfig/scripts/linux/warp-cli.sh +122 -0
- machineconfig/scripts/linux/wifi_conn +1 -1
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__init__.py +0 -0
- machineconfig/scripts/python/ai/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/generate_files.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/generate_files.py +84 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +2 -2
- machineconfig/scripts/python/ai/mcinit.py +7 -3
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +10 -5
- machineconfig/scripts/python/cloud_copy.py +1 -1
- machineconfig/scripts/python/cloud_mount.py +1 -1
- machineconfig/scripts/python/cloud_repo_sync.py +4 -4
- machineconfig/scripts/python/croshell.py +5 -3
- machineconfig/scripts/python/devops_add_identity.py +1 -1
- machineconfig/scripts/python/devops_add_ssh_key.py +1 -1
- machineconfig/scripts/python/devops_backup_retrieve.py +1 -1
- machineconfig/scripts/python/devops_update_repos.py +140 -52
- machineconfig/scripts/python/dotfile.py +1 -1
- machineconfig/scripts/python/fire_agents.py +28 -9
- machineconfig/scripts/python/fire_jobs.py +3 -4
- machineconfig/scripts/python/ftpx.py +2 -1
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/helpers2.py +2 -2
- machineconfig/scripts/python/helpers/helpers4.py +1 -2
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +1 -1
- machineconfig/scripts/python/mount_nfs.py +1 -1
- machineconfig/scripts/python/mount_ssh.py +1 -1
- machineconfig/scripts/python/repos.py +1 -1
- machineconfig/scripts/python/start_slidev.py +1 -1
- machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
- machineconfig/scripts/windows/checkout_version.ps1 +1 -3
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
- machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
- machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
- machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
- machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
- machineconfig/scripts/windows/croshell.ps1 +2 -2
- machineconfig/scripts/windows/devops.ps1 +1 -4
- machineconfig/scripts/windows/dotfile.ps1 +1 -3
- machineconfig/scripts/windows/fire.ps1 +1 -1
- machineconfig/scripts/windows/ftpx.ps1 +2 -2
- machineconfig/scripts/windows/gpt.ps1 +1 -1
- machineconfig/scripts/windows/kill_process.ps1 +1 -2
- machineconfig/scripts/windows/mcinit.ps1 +1 -1
- machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
- machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/pomodoro.ps1 +1 -1
- machineconfig/scripts/windows/py2exe.ps1 +1 -3
- machineconfig/scripts/windows/repos.ps1 +1 -1
- machineconfig/scripts/windows/scheduler.ps1 +1 -1
- machineconfig/scripts/windows/snapshot.ps1 +2 -2
- machineconfig/scripts/windows/start_slidev.ps1 +1 -1
- machineconfig/scripts/windows/start_terminals.ps1 +1 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
- machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
- machineconfig/settings/lf/linux/lfrc +1 -1
- machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
- machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
- machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
- machineconfig/settings/svim/linux/init.toml +1 -1
- machineconfig/settings/svim/windows/init.toml +1 -1
- machineconfig/setup_linux/web_shortcuts/croshell.sh +0 -54
- machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
- machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
- machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
- machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +66 -12
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +44 -36
- machineconfig/utils/ai/generate_file_checklist.py +8 -10
- machineconfig/utils/ai/url2md.py +4 -2
- machineconfig/utils/cloud/onedrive/setup_oauth.py +1 -0
- machineconfig/utils/cloud/onedrive/transaction.py +63 -98
- machineconfig/utils/code.py +60 -39
- machineconfig/utils/installer.py +27 -33
- machineconfig/utils/installer_utils/installer_abc.py +8 -7
- machineconfig/utils/installer_utils/installer_class.py +149 -70
- machineconfig/utils/links.py +22 -11
- machineconfig/utils/notifications.py +197 -0
- machineconfig/utils/options.py +29 -23
- machineconfig/utils/path.py +13 -6
- machineconfig/utils/path_reduced.py +485 -216
- machineconfig/utils/procs.py +47 -41
- machineconfig/utils/scheduling.py +0 -1
- machineconfig/utils/ssh.py +157 -76
- machineconfig/utils/terminal.py +82 -37
- machineconfig/utils/utils.py +12 -10
- machineconfig/utils/utils2.py +38 -48
- machineconfig/utils/utils5.py +183 -116
- machineconfig/utils/ve.py +9 -4
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/METADATA +3 -2
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/RECORD +200 -217
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
- machineconfig/jobs/python/archive/python_tools.txt +0 -12
- machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/update.py +0 -3
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/linux/activate_ve +0 -87
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/windows/activate_ve.ps1 +0 -54
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/WHEEL +0 -0
- {machineconfig-2.0.dist-info → machineconfig-2.1.dist-info}/top_level.txt +0 -0
machineconfig/profile/shell.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
"""shell
|
|
2
|
-
"""
|
|
1
|
+
"""shell"""
|
|
3
2
|
|
|
4
3
|
from machineconfig.utils.utils2 import randstr
|
|
5
|
-
from machineconfig.utils.path_reduced import
|
|
4
|
+
from machineconfig.utils.path_reduced import PathExtended as PathExtended, modify_text
|
|
6
5
|
from machineconfig.utils.terminal import Terminal
|
|
7
6
|
from machineconfig.utils.utils import LIBRARY_ROOT, REPO_ROOT, display_options
|
|
8
7
|
import platform
|
|
@@ -27,8 +26,10 @@ BOX_WIDTH = 100 # Define BOX_WIDTH or get it from a config
|
|
|
27
26
|
def create_default_shell_profile() -> None:
|
|
28
27
|
profile_path = get_shell_profile_path()
|
|
29
28
|
profile = profile_path.read_text(encoding="utf-8")
|
|
30
|
-
if system == "Windows":
|
|
31
|
-
|
|
29
|
+
if system == "Windows":
|
|
30
|
+
source = f""". {str(LIBRARY_ROOT.joinpath("settings/shells/pwsh/init.ps1").collapseuser()).replace("~", "$HOME")}"""
|
|
31
|
+
else:
|
|
32
|
+
source = f"""source {str(LIBRARY_ROOT.joinpath("settings/shells/bash/init.sh").collapseuser()).replace("~", "$HOME")}"""
|
|
32
33
|
|
|
33
34
|
if source in profile:
|
|
34
35
|
console.print(Panel("🔄 PROFILE | Skipping init script sourcing - already present in profile", title="[bold blue]Profile[/bold blue]", border_style="blue"))
|
|
@@ -49,17 +50,20 @@ def get_shell_profile_path() -> PathExtended:
|
|
|
49
50
|
if system == "Windows":
|
|
50
51
|
obj = Terminal().run("$PROFILE", shell="pwsh")
|
|
51
52
|
res = obj.op2path()
|
|
52
|
-
if isinstance(res, PathExtended):
|
|
53
|
+
if isinstance(res, PathExtended):
|
|
54
|
+
profile_path = res
|
|
53
55
|
else:
|
|
54
56
|
obj.print(capture=False)
|
|
55
57
|
raise ValueError(f"""Could not get profile path for Windows. Got {res}""")
|
|
56
|
-
elif system == "Linux":
|
|
57
|
-
|
|
58
|
+
elif system == "Linux":
|
|
59
|
+
profile_path = PathExtended("~/.bashrc").expanduser()
|
|
60
|
+
else:
|
|
61
|
+
raise ValueError(f"""Not implemented for this system {system}""")
|
|
58
62
|
console.print(Panel(f"""🐚 SHELL PROFILE | Working with path: `{profile_path}`""", title="[bold blue]Shell Profile[/bold blue]", border_style="blue"))
|
|
59
63
|
return profile_path
|
|
60
64
|
|
|
61
65
|
|
|
62
|
-
def append_temporarily(dirs: list[str], kind: Literal[
|
|
66
|
+
def append_temporarily(dirs: list[str], kind: Literal["append", "prefix", "replace"]) -> str:
|
|
63
67
|
dirs_ = []
|
|
64
68
|
for path in dirs:
|
|
65
69
|
path_rel = PathExtended(path).collapseuser(strict=False)
|
|
@@ -68,24 +72,33 @@ def append_temporarily(dirs: list[str], kind: Literal['append', 'prefix', 'repla
|
|
|
68
72
|
else:
|
|
69
73
|
dirs_.append(path_rel.as_posix() if system == "Linux" else str(path_rel))
|
|
70
74
|
dirs = dirs_
|
|
71
|
-
if len(dirs) == 0:
|
|
75
|
+
if len(dirs) == 0:
|
|
76
|
+
return ""
|
|
72
77
|
|
|
73
78
|
if system == "Windows":
|
|
74
79
|
"""Source: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2"""
|
|
75
|
-
if kind == "append":
|
|
76
|
-
|
|
77
|
-
elif kind == "
|
|
78
|
-
|
|
80
|
+
if kind == "append":
|
|
81
|
+
command = rf'$env:Path += ";{sep.join(dirs)}"' # Append to the Path variable in the current window:
|
|
82
|
+
elif kind == "prefix":
|
|
83
|
+
command = rf'$env:Path = "{sep.join(dirs)};" + $env:Path' # Prefix the Path variable in the current window:
|
|
84
|
+
elif kind == "replace":
|
|
85
|
+
command = rf'$env:Path = "{sep.join(dirs)}"' # Replace the Path variable in the current window (use with caution!):
|
|
86
|
+
else:
|
|
87
|
+
raise KeyError
|
|
79
88
|
return command # if run is False else tm.run(command, shell="powershell")
|
|
80
|
-
elif system in ["Linux", "Darwin"]:
|
|
81
|
-
|
|
89
|
+
elif system in ["Linux", "Darwin"]:
|
|
90
|
+
result = f'export PATH="{sep.join(dirs)}:$PATH"'
|
|
91
|
+
else:
|
|
92
|
+
raise ValueError
|
|
82
93
|
return result
|
|
83
94
|
|
|
95
|
+
|
|
84
96
|
def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
85
97
|
from machineconfig.utils.utils2 import read_toml
|
|
98
|
+
|
|
86
99
|
env_path = read_toml(LIBRARY_ROOT.joinpath("profile/env_path.toml"))
|
|
87
100
|
# env_path = LIBRARY_ROOT.joinpath("profile/env_path.toml").readit()
|
|
88
|
-
dirs = env_path[f
|
|
101
|
+
dirs = env_path[f"path_{system.lower()}"]["extension"]
|
|
89
102
|
|
|
90
103
|
console.print(Panel("🔍 ENVIRONMENT | Current PATH variables:", title="[bold blue]Environment[/bold blue]", border_style="blue"))
|
|
91
104
|
|
|
@@ -93,8 +106,10 @@ def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
|
93
106
|
tmp = display_options(msg="Which directory to add?", options=dirs + ["all", "none(EXIT)"], default="none(EXIT)")
|
|
94
107
|
assert isinstance(tmp, str), f"Choice must be a string or a list of strings, not {type(choice)}"
|
|
95
108
|
choice = tmp
|
|
96
|
-
if str(choice) != "all":
|
|
97
|
-
|
|
109
|
+
if str(choice) != "all":
|
|
110
|
+
dirs = [choice]
|
|
111
|
+
if choice == "none(EXIT)":
|
|
112
|
+
return
|
|
98
113
|
|
|
99
114
|
console.print(f"\n📌 Adding directories to PATH: {dirs}")
|
|
100
115
|
addition = append_temporarily(dirs=dirs, kind="append")
|
|
@@ -111,23 +126,29 @@ def main_env_path(choice: Optional[str], profile_path: Optional[str]) -> None:
|
|
|
111
126
|
def main_add_sources_to_shell_profile(profile_path: Optional[str], choice: Optional[str]) -> None:
|
|
112
127
|
# sources: list[str] = LIBRARY_ROOT.joinpath("profile/sources.toml").readit()[system.lower()]['files']
|
|
113
128
|
from machineconfig.utils.utils2 import read_toml
|
|
114
|
-
|
|
129
|
+
|
|
130
|
+
sources: list[str] = read_toml(LIBRARY_ROOT.joinpath("profile/sources.toml"))[system.lower()]["files"]
|
|
115
131
|
|
|
116
132
|
console.print(Panel("🔄 Adding sources to shell profile", title="[bold blue]Sources[/bold blue]", border_style="blue"))
|
|
117
133
|
|
|
118
134
|
if choice is None:
|
|
119
135
|
choice_obj = display_options(msg="Which patch to add?", options=sources + ["all", "none(EXIT)"], default="none(EXIT)", multi=True)
|
|
120
136
|
if isinstance(choice_obj, str):
|
|
121
|
-
if choice_obj == "all":
|
|
122
|
-
|
|
123
|
-
|
|
137
|
+
if choice_obj == "all":
|
|
138
|
+
choice = choice_obj
|
|
139
|
+
elif choice_obj == "none(EXIT)":
|
|
140
|
+
return
|
|
141
|
+
else:
|
|
142
|
+
sources = [choice_obj]
|
|
124
143
|
else: # isinstance(choice_obj, list):
|
|
125
144
|
sources = choice_obj
|
|
126
|
-
elif choice == "none(EXIT)":
|
|
145
|
+
elif choice == "none(EXIT)":
|
|
146
|
+
return
|
|
127
147
|
|
|
128
148
|
if isinstance(profile_path, str):
|
|
129
149
|
profile_path_obj = PathExtended(profile_path)
|
|
130
|
-
else:
|
|
150
|
+
else:
|
|
151
|
+
profile_path_obj = get_shell_profile_path()
|
|
131
152
|
profile = profile_path_obj.read_text(encoding="utf-8")
|
|
132
153
|
|
|
133
154
|
for a_file in sources:
|
|
@@ -141,7 +162,8 @@ def main_add_sources_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
141
162
|
elif system == "Linux":
|
|
142
163
|
profile += f"\nsource {file}"
|
|
143
164
|
console.print(f"➕ Added Bash source: {file}")
|
|
144
|
-
else:
|
|
165
|
+
else:
|
|
166
|
+
raise ValueError(f"Not implemented for this system {system}")
|
|
145
167
|
else:
|
|
146
168
|
console.print(f"⏭️ Source already present: {file}")
|
|
147
169
|
|
|
@@ -158,7 +180,8 @@ def main_add_patches_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
158
180
|
choice_chosen = display_options(msg="Which patch to add?", options=list(patches) + ["all", "none(EXIT)"], default="none(EXIT)", multi=False)
|
|
159
181
|
assert isinstance(choice_chosen, str), f"Choice must be a string or a list of strings, not {type(choice)}"
|
|
160
182
|
choice = choice_chosen
|
|
161
|
-
if choice == "none(EXIT)":
|
|
183
|
+
if choice == "none(EXIT)":
|
|
184
|
+
return None
|
|
162
185
|
elif str(choice) == "all":
|
|
163
186
|
console.print("📌 Adding all patches to profile")
|
|
164
187
|
else:
|
|
@@ -187,5 +210,5 @@ def main_add_patches_to_shell_profile(profile_path: Optional[str], choice: Optio
|
|
|
187
210
|
console.print(Panel("✅ Shell profile updated with patches", title="[bold blue]Patches[/bold blue]", border_style="blue"))
|
|
188
211
|
|
|
189
212
|
|
|
190
|
-
if __name__ ==
|
|
213
|
+
if __name__ == "__main__":
|
|
191
214
|
pass
|
|
Binary file
|
|
@@ -59,7 +59,7 @@ curl bit.ly/cfgvelinux -L | bash
|
|
|
59
59
|
|
|
60
60
|
# Activate virtual environment
|
|
61
61
|
echo "🚀 Activating Python virtual environment..."
|
|
62
|
-
. $HOME/
|
|
62
|
+
. $HOME/code/machineconfig/.venv/bin/activate
|
|
63
63
|
|
|
64
64
|
# Clone repositories
|
|
65
65
|
echo "📋 Setting up code repositories..."
|
|
@@ -94,7 +94,7 @@ echo """#=======================================================================
|
|
|
94
94
|
|
|
95
95
|
# Activate virtual environment
|
|
96
96
|
echo "🚀 Activating Python virtual environment..."
|
|
97
|
-
. $HOME/scripts/activate_ve '
|
|
97
|
+
. $HOME/scripts/activate_ve '.venv'
|
|
98
98
|
|
|
99
99
|
# Install all essential development applications
|
|
100
100
|
echo "📥 Installing essential development applications..."
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
# if [ -z "$VIRTUAL_ENV" ]; then
|
|
5
|
-
# source ~/scripts/activate_ve ''
|
|
6
|
-
# fi
|
|
7
|
-
# source ~/scripts/activate_ve ve # this script only works under ve default ve.
|
|
3
|
+
source ~/code/machineconfig/.venv/bin/activate
|
|
8
4
|
|
|
9
5
|
op_script=$HOME/tmp_results/shells/python_return_command.sh
|
|
10
6
|
if [ -f "$op_script" ]; then
|
|
11
7
|
rm $op_script
|
|
12
8
|
fi
|
|
13
9
|
|
|
14
|
-
uv run --no-dev --project ~/code/machineconfig python -m machineconfig.scripts.python.devops "$@"
|
|
10
|
+
# uv run --no-dev --project ~/code/machineconfig python -m machineconfig.scripts.python.devops "$@"
|
|
11
|
+
python -m machineconfig.scripts.python.devops "$@"
|
|
12
|
+
|
|
15
13
|
if [ -f "$op_script" ]; then
|
|
16
14
|
chmod +x $op_script
|
|
17
15
|
source $op_script
|
machineconfig/scripts/linux/fire
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
source ~/code/machineconfig/.venv/bin/activate
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
# Generate random string of length 5
|
|
6
7
|
random_str=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
|
|
@@ -17,7 +18,7 @@ if [ -f "$op_script" ]; then
|
|
|
17
18
|
echo "Running $op_script"
|
|
18
19
|
chmod +x $op_script
|
|
19
20
|
set -- # clear all positional parameters
|
|
20
|
-
source $op_script # sourcing the script means the args passed to the this script are passed to the sourced script which cofuses the sources script as it
|
|
21
|
+
source $op_script # sourcing the script means the args passed to the this script are passed to the sourced script which cofuses the sources script as it and it doesn't understand first.sh arguments.
|
|
21
22
|
fi
|
|
22
23
|
|
|
23
24
|
|
machineconfig/scripts/linux/ftpx
CHANGED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs Cloudflare WARP (warp-cli) on supported Ubuntu / Debian systems.
|
|
3
|
+
# Usage: sudo ./warp-cli.sh [--allow-unsupported] [--force-reinstall]
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
ALLOW_UNSUPPORTED=0
|
|
8
|
+
FORCE_REINSTALL=0
|
|
9
|
+
|
|
10
|
+
for arg in "$@"; do
|
|
11
|
+
case "$arg" in
|
|
12
|
+
--allow-unsupported) ALLOW_UNSUPPORTED=1 ;;
|
|
13
|
+
--force-reinstall) FORCE_REINSTALL=1 ;;
|
|
14
|
+
-h|--help)
|
|
15
|
+
printf "Usage: %s [--allow-unsupported] [--force-reinstall]\n" "$0"
|
|
16
|
+
exit 0
|
|
17
|
+
;;
|
|
18
|
+
*)
|
|
19
|
+
printf "Unknown argument: %s\n" "$arg" >&2
|
|
20
|
+
exit 2
|
|
21
|
+
;;
|
|
22
|
+
esac
|
|
23
|
+
done
|
|
24
|
+
|
|
25
|
+
require_root() {
|
|
26
|
+
if [ "${EUID}" -ne 0 ]; then
|
|
27
|
+
printf "Please run as root (use sudo).\n" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
have_cmd() { command -v "$1" >/dev/null 2>&1; }
|
|
33
|
+
|
|
34
|
+
detect_os() {
|
|
35
|
+
if have_cmd lsb_release; then
|
|
36
|
+
DIST_ID=$(lsb_release -si 2>/dev/null | tr '[:upper:]' '[:lower:]')
|
|
37
|
+
CODENAME=$(lsb_release -sc 2>/dev/null | tr '[:upper:]' '[:lower:]')
|
|
38
|
+
elif [ -f /etc/os-release ]; then
|
|
39
|
+
# shellcheck disable=SC1091
|
|
40
|
+
. /etc/os-release
|
|
41
|
+
DIST_ID=$(printf "%s" "${ID:-}" | tr '[:upper:]' '[:lower:]')
|
|
42
|
+
CODENAME=$(printf "%s" "${VERSION_CODENAME:-}" | tr '[:upper:]' '[:lower:]')
|
|
43
|
+
else
|
|
44
|
+
printf "Cannot detect distribution. Install lsb_release or provide /etc/os-release.\n" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
is_supported() {
|
|
50
|
+
case "$DIST_ID" in
|
|
51
|
+
ubuntu)
|
|
52
|
+
# Supported: noble jammy focal (older: bionic xenial)
|
|
53
|
+
case "$CODENAME" in
|
|
54
|
+
noble|jammy|focal|bionic|xenial) return 0 ;; esac ;;
|
|
55
|
+
debian)
|
|
56
|
+
# Supported: bookworm bullseye buster (older: stretch)
|
|
57
|
+
case "$CODENAME" in
|
|
58
|
+
bookworm|bullseye|buster|stretch) return 0 ;; esac ;;
|
|
59
|
+
esac
|
|
60
|
+
return 1
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
add_key() {
|
|
64
|
+
local key_path="/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg"
|
|
65
|
+
if [ -s "$key_path" ]; then
|
|
66
|
+
return 0
|
|
67
|
+
fi
|
|
68
|
+
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output "$key_path"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
add_repo() {
|
|
72
|
+
local list_file="/etc/apt/sources.list.d/cloudflare-client.list"
|
|
73
|
+
if grep -q "pkg.cloudflareclient.com" "$list_file" 2>/dev/null; then
|
|
74
|
+
return 0
|
|
75
|
+
fi
|
|
76
|
+
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ ${CODENAME} main" > "$list_file"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
need_update=0
|
|
80
|
+
install_package() {
|
|
81
|
+
if dpkg -s cloudflare-warp >/dev/null 2>&1; then
|
|
82
|
+
if [ "$FORCE_REINSTALL" -eq 1 ]; then
|
|
83
|
+
apt-get install --reinstall -y cloudflare-warp
|
|
84
|
+
else
|
|
85
|
+
printf "cloudflare-warp already installed. Use --force-reinstall to reinstall.\n"
|
|
86
|
+
fi
|
|
87
|
+
else
|
|
88
|
+
apt-get install -y cloudflare-warp
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main() {
|
|
93
|
+
require_root
|
|
94
|
+
if ! have_cmd apt-get; then
|
|
95
|
+
printf "apt-get not found. This script supports only Debian/Ubuntu.\n" >&2
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
detect_os
|
|
99
|
+
if ! is_supported; then
|
|
100
|
+
if [ "$ALLOW_UNSUPPORTED" -ne 1 ]; then
|
|
101
|
+
printf "Distribution %s (%s) not in supported list. Use --allow-unsupported to proceed.\n" "$DIST_ID" "$CODENAME" >&2
|
|
102
|
+
exit 3
|
|
103
|
+
else
|
|
104
|
+
printf "Proceeding on unsupported distribution %s (%s).\n" "$DIST_ID" "$CODENAME"
|
|
105
|
+
fi
|
|
106
|
+
fi
|
|
107
|
+
pre_key_checksum=$( [ -f /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg ] && sha256sum /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg | cut -d' ' -f1 || true )
|
|
108
|
+
add_key
|
|
109
|
+
post_key_checksum=$(sha256sum /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg | cut -d' ' -f1)
|
|
110
|
+
if [ "$pre_key_checksum" != "$post_key_checksum" ]; then need_update=1; fi
|
|
111
|
+
repo_before=$(grep -R "pkg.cloudflareclient.com" /etc/apt/sources.list.d 2>/dev/null || true)
|
|
112
|
+
add_repo
|
|
113
|
+
repo_after=$(grep -R "pkg.cloudflareclient.com" /etc/apt/sources.list.d 2>/dev/null || true)
|
|
114
|
+
if [ "$repo_before" != "$repo_after" ]; then need_update=1; fi
|
|
115
|
+
if [ "$need_update" -eq 1 ]; then
|
|
116
|
+
apt-get update
|
|
117
|
+
fi
|
|
118
|
+
install_package
|
|
119
|
+
printf "Done. Basic usage: 'warp-cli register' then 'warp-cli connect'. For account: 'warp-cli set-mode warp'.\n"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
main "$@"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
#!/usr/bin/env python3
|
|
3
|
+
"""Script to generate a markdown table with checkboxes for all Python files in the repo."""
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_python_files(repo_root: Path) -> list[str]:
|
|
9
|
+
"""Get all Python files relative to repo root."""
|
|
10
|
+
# Get all .py files recursively
|
|
11
|
+
py_files = list(repo_root.glob("**/*.py"))
|
|
12
|
+
|
|
13
|
+
# Filter out files in .venv and __pycache__ directories
|
|
14
|
+
filtered_files = []
|
|
15
|
+
for file_path in py_files:
|
|
16
|
+
relative_path = file_path.relative_to(repo_root)
|
|
17
|
+
path_parts = relative_path.parts
|
|
18
|
+
|
|
19
|
+
# Skip files in .venv or __pycache__ directories
|
|
20
|
+
if any(part in {".venv", "__pycache__"} for part in path_parts):
|
|
21
|
+
continue
|
|
22
|
+
|
|
23
|
+
filtered_files.append(str(relative_path))
|
|
24
|
+
|
|
25
|
+
return sorted(filtered_files)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def generate_markdown_table(files: list[str]) -> str:
|
|
29
|
+
"""Generate markdown table with checkboxes."""
|
|
30
|
+
header = "# Python Files Checklist\n\n"
|
|
31
|
+
table = "| Index | File Path | Status |\n|-------|-----------|--------|\n"
|
|
32
|
+
|
|
33
|
+
for index, file_path in enumerate(files, start=1):
|
|
34
|
+
# Remove leading ./ if present
|
|
35
|
+
clean_path = file_path.lstrip('./')
|
|
36
|
+
table += f"| {index} | {clean_path} | - [ ] |\n"
|
|
37
|
+
|
|
38
|
+
return header + table
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def main() -> None:
|
|
42
|
+
"""Main function."""
|
|
43
|
+
repo_root = Path.cwd()
|
|
44
|
+
if not repo_root.joinpath("pyproject.toml").exists():
|
|
45
|
+
raise RuntimeError(f" {repo_root} Not a repo root")
|
|
46
|
+
output_file = repo_root / ".ai" / "all_files_with_index.md"
|
|
47
|
+
|
|
48
|
+
print(f"Repo root: {repo_root}")
|
|
49
|
+
print(f"Output file: {output_file}")
|
|
50
|
+
|
|
51
|
+
# Ensure output directory exists
|
|
52
|
+
output_file.parent.mkdir(parents=True, exist_ok=True)
|
|
53
|
+
|
|
54
|
+
# Get Python files
|
|
55
|
+
python_files = get_python_files(repo_root)
|
|
56
|
+
print(f"Found {len(python_files)} Python files")
|
|
57
|
+
|
|
58
|
+
# Generate markdown
|
|
59
|
+
markdown_content = generate_markdown_table(python_files)
|
|
60
|
+
print(f"Generated markdown content length: {len(markdown_content)}")
|
|
61
|
+
|
|
62
|
+
# Write to file
|
|
63
|
+
output_file.write_text(markdown_content)
|
|
64
|
+
print(f"Generated {output_file} with {len(python_files)} Python files")
|
|
65
|
+
|
|
66
|
+
# Create 5 symlinks to repo_root at ~/code_copies/${repo_name}_copy_{i}
|
|
67
|
+
import pathlib
|
|
68
|
+
# import os
|
|
69
|
+
repo_root = pathlib.Path.cwd().resolve()
|
|
70
|
+
repo_name: str = pathlib.Path(repo_root).name
|
|
71
|
+
symlink_dir: pathlib.Path = pathlib.Path.home() / "code_copies"
|
|
72
|
+
symlink_dir.mkdir(exist_ok=True)
|
|
73
|
+
for i in range(1, 6):
|
|
74
|
+
symlink_path: pathlib.Path = symlink_dir / f"{repo_name}_copy_{i}"
|
|
75
|
+
if symlink_path.exists() or symlink_path.is_symlink():
|
|
76
|
+
symlink_path.unlink()
|
|
77
|
+
symlink_path.symlink_to(repo_root, target_is_directory=True)
|
|
78
|
+
# Windows equivalent (comment):
|
|
79
|
+
# for /l %i in (1,1,5) do mklink /D "%USERPROFILE%\code_copies\{repo_name}_copy_%i" "C:\path\to\repo_root"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
main()
|
|
84
|
+
|