machineconfig 8.14__py3-none-any.whl → 8.45__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/remote/run_cluster.py +1 -1
- machineconfig/cluster/remote/run_remote.py +1 -1
- machineconfig/cluster/sessions_managers/utils/maker.py +10 -8
- machineconfig/cluster/sessions_managers/wt_local.py +1 -1
- machineconfig/cluster/sessions_managers/wt_local_manager.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
- machineconfig/jobs/installer/checks/check_installations.py +133 -0
- machineconfig/jobs/installer/checks/install_utils.py +132 -0
- machineconfig/jobs/installer/checks/report_utils.py +39 -0
- machineconfig/jobs/installer/checks/vt_utils.py +89 -0
- machineconfig/jobs/installer/installer_data.json +225 -140
- machineconfig/jobs/installer/linux_scripts/docker.sh +6 -9
- machineconfig/jobs/installer/package_groups.py +10 -9
- machineconfig/jobs/installer/python_scripts/boxes.py +1 -2
- machineconfig/jobs/installer/python_scripts/code.py +10 -8
- machineconfig/jobs/installer/python_scripts/hx.py +30 -13
- machineconfig/jobs/installer/python_scripts/nerfont_windows_helper.py +6 -5
- machineconfig/jobs/installer/python_scripts/sysabc.py +25 -19
- machineconfig/jobs/installer/python_scripts/yazi.py +33 -17
- machineconfig/jobs/scripts/powershell_scripts/cmatrix.ps1 +52 -0
- machineconfig/jobs/scripts/powershell_scripts/mount_ssh.ps1 +1 -1
- machineconfig/jobs/scripts_dynamic/a.py +413 -10
- machineconfig/profile/create_links.py +77 -20
- machineconfig/profile/create_links_export.py +40 -51
- machineconfig/profile/mapper_data.toml +30 -0
- machineconfig/profile/mapper_dotfiles.toml +253 -0
- machineconfig/scripts/python/agents.py +70 -172
- machineconfig/scripts/python/ai/initai.py +3 -1
- machineconfig/scripts/python/ai/scripts/__init__.py +1 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.ps1 +2 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +7 -5
- machineconfig/scripts/python/ai/solutions/claude/claude.py +1 -1
- machineconfig/scripts/python/ai/solutions/cline/cline.py +1 -1
- machineconfig/scripts/python/ai/solutions/copilot/github_copilot.py +1 -1
- machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +29 -0
- machineconfig/scripts/python/ai/solutions/crush/crush.py +1 -1
- machineconfig/scripts/python/ai/solutions/cursor/cursors.py +1 -1
- machineconfig/scripts/python/ai/solutions/gemini/gemini.py +1 -1
- machineconfig/scripts/python/ai/solutions/gemini/settings.json +3 -0
- machineconfig/scripts/python/ai/{solutions → utils}/generic.py +2 -15
- machineconfig/scripts/python/ai/utils/vscode_tasks.py +6 -3
- machineconfig/scripts/python/cloud.py +58 -11
- machineconfig/scripts/python/croshell.py +4 -156
- machineconfig/scripts/python/devops.py +57 -40
- machineconfig/scripts/python/devops_navigator.py +17 -3
- machineconfig/scripts/python/fire_jobs.py +8 -207
- machineconfig/scripts/python/ftpx.py +5 -225
- machineconfig/scripts/python/graph/cli_graph.json +8743 -0
- machineconfig/scripts/python/{env_manager → helper_env}/path_manager_tui.py +2 -2
- machineconfig/scripts/python/{env_manager → helpers/helper_env}/env_manager_tui.py +1 -1
- machineconfig/scripts/python/helpers/helper_env/path_manager_tui.py +228 -0
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_cursor_agents.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_gemini.py +1 -1
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_qwen.py +1 -1
- machineconfig/scripts/python/helpers/helpers_agents/agents_impl.py +168 -0
- machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_launch.py +5 -5
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_copy.py +6 -6
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_mount.py +10 -5
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_sync.py +3 -3
- machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers2.py +1 -1
- machineconfig/scripts/python/helpers/helpers_croshell/croshell_impl.py +225 -0
- machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/scheduler.py +4 -4
- machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/start_slidev.py +7 -6
- machineconfig/scripts/python/helpers/helpers_devops/backup_config.py +149 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_backup_retrieve.py +267 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_config.py +98 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_config_dotfile.py +274 -0
- machineconfig/scripts/python/helpers/helpers_devops/cli_data.py +76 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_nw.py +52 -72
- machineconfig/scripts/python/helpers/helpers_devops/cli_repos.py +265 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_self.py +39 -23
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_file.py +44 -30
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_server.py +26 -43
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/cli_share_terminal.py +12 -6
- machineconfig/scripts/python/helpers/helpers_devops/cli_ssh.py +167 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_status.py +12 -6
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/devops_update_repos.py +1 -1
- machineconfig/scripts/python/{interactive.py → helpers/helpers_devops/interactive.py} +68 -52
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/run_script.py +75 -58
- machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.ps1 +41 -0
- machineconfig/scripts/python/helpers/helpers_devops/themes/choose_starship_theme.sh +48 -0
- machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_wezterm_theme.py +3 -3
- machineconfig/scripts/python/helpers/helpers_fire_command/fire_jobs_impl.py +233 -0
- machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_route_helper.py +3 -3
- machineconfig/scripts/python/helpers/helpers_msearch/msearch_impl.py +248 -0
- machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_linux/fzfg +4 -3
- machineconfig/scripts/python/helpers/helpers_msearch/scripts_linux/search_with_context.sh +48 -0
- machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_windows/fzfg.ps1 +1 -1
- machineconfig/scripts/python/helpers/helpers_navigator/__init__.py +20 -0
- machineconfig/scripts/python/helpers/helpers_navigator/cli_graph_loader.py +234 -0
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/command_builder.py +61 -13
- machineconfig/scripts/python/helpers/helpers_navigator/command_detail.py +153 -0
- machineconfig/scripts/python/helpers/helpers_navigator/command_tree.py +45 -0
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/data_models.py +18 -11
- machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/main_app.py +5 -5
- machineconfig/scripts/python/helpers/helpers_network/__init__.py +0 -0
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address.py +15 -17
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/address_switch.py +1 -1
- machineconfig/scripts/python/helpers/helpers_network/ftpx_impl.py +276 -0
- machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_ssh.py +2 -2
- machineconfig/scripts/python/helpers/helpers_network/ssh_add_identity.py +73 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_add_ssh_key.py +175 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_debug_linux.py +319 -0
- machineconfig/scripts/python/helpers/helpers_network/ssh_debug_windows.py +275 -0
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action.py +3 -3
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/action_helper.py +3 -3
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/cloud_repo_sync.py +116 -33
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/grource.py +3 -2
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/record.py +33 -13
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_2.py +63 -19
- machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/update.py +0 -6
- machineconfig/scripts/python/helpers/helpers_search/script_help.py +81 -0
- machineconfig/scripts/python/helpers/helpers_sessions/__init__.py +0 -0
- machineconfig/scripts/python/helpers/helpers_sessions/sessions_impl.py +177 -0
- machineconfig/scripts/python/{helpers_sessions → helpers/helpers_sessions}/sessions_multiprocess.py +1 -1
- machineconfig/scripts/python/helpers/helpers_terminal/__init__.py +0 -0
- machineconfig/scripts/python/helpers/helpers_terminal/terminal_impl.py +96 -0
- machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/download.py +1 -1
- machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/python.py +46 -26
- machineconfig/scripts/python/helpers/helpers_utils/specs.py +246 -0
- machineconfig/scripts/python/mcfg_entry.py +133 -48
- machineconfig/scripts/python/msearch.py +15 -61
- machineconfig/scripts/python/sessions.py +59 -194
- machineconfig/scripts/python/terminal.py +18 -96
- machineconfig/scripts/python/utils.py +101 -20
- machineconfig/settings/atuin/config.toml +294 -0
- machineconfig/settings/atuin/themes/catppuccin-mocha-mauve.toml +12 -0
- machineconfig/settings/linters/.ruff.toml +1 -0
- machineconfig/settings/mprocs/windows/mprocs.yaml +2 -2
- machineconfig/settings/shells/bash/init.sh +6 -3
- machineconfig/settings/shells/pwsh/init.ps1 +69 -1
- machineconfig/settings/shells/pwsh/search_pwsh_history.ps1 +99 -0
- machineconfig/settings/shells/wezterm/wezterm.lua +4 -1
- machineconfig/settings/shells/wt/settings.json +20 -7
- machineconfig/settings/shells/zsh/init.sh +34 -4
- machineconfig/settings/television/cable_unix/bash-history.toml +1 -1
- machineconfig/settings/television/cable_windows/pwsh-history.toml +1 -1
- machineconfig/settings/tv/config.toml +234 -0
- machineconfig/settings/tv/themes/catppuccin-mocha-sky.toml +22 -0
- machineconfig/settings/wsl/.wslconfig +5 -30
- machineconfig/settings/yazi/yazi_linux.toml +18 -8
- machineconfig/settings/zellij/layouts/st.kdl +2 -2
- machineconfig/settings/zellij/layouts/st2.kdl +1 -1
- machineconfig/setup_linux/web_shortcuts/interactive.sh +10 -10
- machineconfig/setup_linux/web_shortcuts/live_from_github.sh +3 -0
- machineconfig/setup_mac/__init__.py +0 -2
- machineconfig/setup_windows/__init__.py +0 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +14 -13
- machineconfig/setup_windows/web_shortcuts/live_from_github.ps1 +4 -3
- machineconfig/setup_windows/web_shortcuts/quick_init.ps1 +3 -3
- machineconfig/type_hinting/sql/__init__.py +1 -0
- machineconfig/type_hinting/sql/base.py +216 -0
- machineconfig/type_hinting/sql/core_schema.py +64 -0
- machineconfig/type_hinting/sql/core_schema_typeddict.py +41 -0
- machineconfig/type_hinting/sql/typeddict_codegen.py +222 -0
- machineconfig/type_hinting/typedict/__init__.py +1 -0
- machineconfig/type_hinting/typedict/ast_utils.py +130 -0
- machineconfig/type_hinting/typedict/generator_helpers.py +319 -0
- machineconfig/type_hinting/typedict/generators.py +231 -0
- machineconfig/type_hinting/typedict/polars_schema.py +24 -0
- machineconfig/type_hinting/typedict/polars_schema_typeddict.py +63 -0
- machineconfig/utils/accessories.py +24 -0
- machineconfig/utils/code.py +41 -13
- machineconfig/utils/files/ascii_art.py +10 -14
- machineconfig/utils/files/headers.py +3 -5
- machineconfig/utils/files/read.py +8 -1
- machineconfig/utils/installer_utils/github_release_bulk.py +1 -0
- machineconfig/utils/installer_utils/install_from_url.py +1 -1
- machineconfig/utils/installer_utils/installer_class.py +12 -4
- machineconfig/utils/installer_utils/installer_cli.py +1 -15
- machineconfig/utils/installer_utils/installer_helper.py +2 -2
- machineconfig/utils/installer_utils/installer_locator_utils.py +13 -13
- machineconfig/utils/installer_utils/installer_runner.py +4 -4
- machineconfig/utils/meta.py +6 -4
- machineconfig/utils/options.py +49 -19
- machineconfig/utils/options_utils/__init__.py +0 -0
- machineconfig/utils/options_utils/options_tv_linux.py +211 -0
- machineconfig/utils/options_utils/options_tv_windows.py +88 -0
- machineconfig/utils/options_utils/tv_options.py +37 -0
- machineconfig/utils/path_extended.py +6 -6
- machineconfig/utils/scheduler.py +8 -2
- machineconfig/utils/schemas/fire_agents/fire_agents_input.py +1 -1
- machineconfig/utils/source_of_truth.py +6 -1
- machineconfig/utils/ssh.py +69 -18
- machineconfig/utils/ssh_utils/abc.py +1 -1
- machineconfig/utils/ssh_utils/wsl.py +107 -170
- machineconfig/utils/ssh_utils/wsl_helper.py +217 -0
- machineconfig/utils/upgrade_packages.py +4 -8
- {machineconfig-8.14.dist-info → machineconfig-8.45.dist-info}/METADATA +29 -22
- {machineconfig-8.14.dist-info → machineconfig-8.45.dist-info}/RECORD +247 -208
- machineconfig/jobs/installer/check_installations.py +0 -248
- machineconfig/profile/backup.toml +0 -49
- machineconfig/profile/mapper.toml +0 -263
- machineconfig/scripts/python/helpers_devops/cli_config.py +0 -105
- machineconfig/scripts/python/helpers_devops/cli_config_dotfile.py +0 -89
- machineconfig/scripts/python/helpers_devops/cli_data.py +0 -25
- machineconfig/scripts/python/helpers_devops/cli_repos.py +0 -208
- machineconfig/scripts/python/helpers_devops/devops_backup_retrieve.py +0 -80
- machineconfig/scripts/python/helpers_devops/themes/choose_starship_theme.bash +0 -3
- machineconfig/scripts/python/helpers_navigator/__init__.py +0 -20
- machineconfig/scripts/python/helpers_navigator/command_detail.py +0 -44
- machineconfig/scripts/python/helpers_navigator/command_tree.py +0 -620
- machineconfig/scripts/python/helpers_network/ssh_add_identity.py +0 -116
- machineconfig/scripts/python/helpers_network/ssh_add_ssh_key.py +0 -153
- machineconfig/scripts/python/helpers_network/ssh_debug_linux.py +0 -391
- machineconfig/scripts/python/helpers_network/ssh_debug_windows.py +0 -338
- machineconfig/scripts/python/helpers_repos/entrypoint.py +0 -77
- machineconfig/setup_mac/ssh/openssh_setup.sh +0 -114
- machineconfig/setup_windows/ssh/add-sshkey.ps1 +0 -29
- machineconfig/setup_windows/ssh/openssh-server.ps1 +0 -37
- machineconfig/utils/options_tv.py +0 -119
- machineconfig/utils/tst.py +0 -20
- /machineconfig/{scripts/python/helpers_agents → jobs/installer/checks}/__init__.py +0 -0
- /machineconfig/scripts/python/ai/{solutions/_shared.py → utils/shared.py} +0 -0
- /machineconfig/scripts/python/{helpers_agents/agentic_frameworks → graph}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers}/__init__.py +0 -0
- /machineconfig/scripts/python/{env_manager → helpers/helper_env}/__init__.py +0 -0
- /machineconfig/scripts/python/{env_manager → helpers/helper_env}/path_manager_backend.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_agents}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_devops → helpers/helpers_agents/agentic_frameworks}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/agentic_frameworks/fire_crush.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_help_search.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_helper_types.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/fire_agents_load_balancer.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aichat/config.yaml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/aider/.aider.conf.yml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/copilot/config.yml +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/crush/crush.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/configs/gemini/settings.json +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/privacy/privacy.py +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/prompt.txt +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.ps1 +0 -0
- /machineconfig/scripts/python/{helpers_agents → helpers/helpers_agents}/templates/template.sh +0 -0
- /machineconfig/scripts/python/{helpers_devops/themes → helpers/helpers_cloud}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/cloud_helpers.py +0 -0
- /machineconfig/scripts/python/{helpers_cloud → helpers/helpers_cloud}/helpers5.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_croshell}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/crosh.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/pomodoro.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer.py +0 -0
- /machineconfig/scripts/python/{helpers_croshell → helpers/helpers_croshell}/viewer_template.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_devops}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_sessions → helpers/helpers_devops/themes}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_devops → helpers/helpers_devops}/themes/choose_pwsh_theme.ps1 +0 -0
- /machineconfig/scripts/python/{helpers_devops/themes/choose_starship_theme.ps1 → helpers/helpers_fire_command/__init__.py} +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/cloud_manager.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/f.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/file_wrangler.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_args_helper.py +0 -0
- /machineconfig/scripts/python/{helpers_fire_command → helpers/helpers_fire_command}/fire_jobs_streamlit_helper.py +0 -0
- /machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers_navigator → helpers/helpers_navigator}/search_bar.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nfs.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/mount_nw_drive.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/onetimeshare.py +0 -0
- /machineconfig/scripts/python/{helpers_network → helpers/helpers_network}/wifi_conn.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/clone.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/repo_analyzer_1.py +0 -0
- /machineconfig/scripts/python/{helpers_repos → helpers/helpers_repos}/sync.py +0 -0
- /machineconfig/scripts/python/helpers/{ast_search.py → helpers_search/ast_search.py} +0 -0
- /machineconfig/scripts/python/helpers/{qr_code.py → helpers_search/qr_code.py} +0 -0
- /machineconfig/scripts/python/helpers/{repo_rag.py → helpers_search/repo_rag.py} +0 -0
- /machineconfig/scripts/python/helpers/{symantic_search.py → helpers_search/symantic_search.py} +0 -0
- /machineconfig/scripts/python/{helpers_utils → helpers/helpers_utils}/pdf.py +0 -0
- {machineconfig-8.14.dist-info → machineconfig-8.45.dist-info}/WHEEL +0 -0
- {machineconfig-8.14.dist-info → machineconfig-8.45.dist-info}/entry_points.txt +0 -0
- {machineconfig-8.14.dist-info → machineconfig-8.45.dist-info}/top_level.txt +0 -0
|
@@ -1,55 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
"""Fast-loading CLI entry point using lazy imports.
|
|
2
|
+
|
|
3
|
+
Submodules are only imported when their commands are actually invoked, not at startup.
|
|
4
|
+
This makes `mcfg --help` much faster by avoiding loading heavy dependencies.
|
|
5
|
+
"""
|
|
6
|
+
from typing import Optional, Annotated
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def fire(
|
|
11
|
+
ctx: typer.Context,
|
|
12
|
+
path: Annotated[str, typer.Argument(help="Path to the Python file to run")] = ".",
|
|
13
|
+
function: Annotated[Optional[str], typer.Argument(help="Function to run")] = None,
|
|
14
|
+
ve: Annotated[str, typer.Option("--ve", "-v", help="Virtual environment name")] = "",
|
|
15
|
+
cmd: Annotated[bool, typer.Option("--cmd", "-B", help="Create a cmd fire command to launch the job asynchronously")] = False,
|
|
16
|
+
interactive: Annotated[bool, typer.Option("--interactive", "-i", help="Whether to run the job interactively using IPython")] = False,
|
|
17
|
+
debug: Annotated[bool, typer.Option("--debug", "-d", help="Enable debug mode")] = False,
|
|
18
|
+
choose_function: Annotated[bool, typer.Option("--choose-function", "-c", help="Choose function interactively")] = False,
|
|
19
|
+
loop: Annotated[bool, typer.Option("--loop", "-l", help="Infinite recursion (runs again after completion/interruption)")] = False,
|
|
20
|
+
jupyter: Annotated[bool, typer.Option("--jupyter", "-j", help="Open in a jupyter notebook")] = False,
|
|
21
|
+
marimo: Annotated[bool, typer.Option("--marimo", "-M", help="Open in a marimo notebook")] = False,
|
|
22
|
+
module: Annotated[bool, typer.Option("--module", "-m", help="Launch the main file")] = False,
|
|
23
|
+
script: Annotated[bool, typer.Option("--script", "-s", help="Launch as a script without fire")] = False,
|
|
24
|
+
optimized: Annotated[bool, typer.Option("--optimized", "-O", help="Run the optimized version of the function")] = False,
|
|
25
|
+
zellij_tab: Annotated[Optional[str], typer.Option("--zellij-tab", "-z", help="Open in a new zellij tab")] = None,
|
|
26
|
+
submit_to_cloud: Annotated[bool, typer.Option("--submit-to-cloud", "-C", help="Submit to cloud compute")] = False,
|
|
27
|
+
remote: Annotated[bool, typer.Option("--remote", "-r", help="Launch on a remote machine")] = False,
|
|
28
|
+
streamlit: Annotated[bool, typer.Option("--streamlit", "-S", help="Run as streamlit app")] = False,
|
|
29
|
+
environment: Annotated[str, typer.Option("--environment", "-E", help="Choose ip, localhost, hostname or arbitrary url")] = "",
|
|
30
|
+
holdDirectory: Annotated[bool, typer.Option("--holdDirectory", "-D", help="Hold current directory and avoid cd'ing to the script directory")] = False,
|
|
31
|
+
PathExport: Annotated[bool, typer.Option("--PathExport", "-P", help="Augment the PYTHONPATH with repo root")] = False,
|
|
32
|
+
git_pull: Annotated[bool, typer.Option("--git-pull", "-g", help="Start by pulling the git repo")] = False,
|
|
33
|
+
watch: Annotated[bool, typer.Option("--watch", "-w", help="Watch the file for changes")] = False,
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Fire and manage jobs."""
|
|
36
|
+
from machineconfig.scripts.python.fire_jobs import fire as fire_impl
|
|
37
|
+
fire_impl(ctx=ctx, path=path, function=function, ve=ve, cmd=cmd, interactive=interactive, debug=debug,
|
|
38
|
+
choose_function=choose_function, loop=loop, jupyter=jupyter, marimo=marimo, module=module,
|
|
39
|
+
script=script, optimized=optimized, zellij_tab=zellij_tab, submit_to_cloud=submit_to_cloud,
|
|
40
|
+
remote=remote, streamlit=streamlit, environment=environment, holdDirectory=holdDirectory,
|
|
41
|
+
PathExport=PathExport, git_pull=git_pull, watch=watch)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def ftpx(
|
|
45
|
+
source: Annotated[str, typer.Argument(help="Source path (machine:path)")],
|
|
46
|
+
target: Annotated[str, typer.Argument(help="Target path (machine:path)")],
|
|
47
|
+
recursive: Annotated[bool, typer.Option("--recursive", "-r", help="Send recursively.")] = False,
|
|
48
|
+
zipFirst: Annotated[bool, typer.Option("--zipFirst", "-z", help="Zip before sending.")] = False,
|
|
49
|
+
cloud: Annotated[bool, typer.Option("--cloud", "-c", help="Transfer through the cloud.")] = False,
|
|
50
|
+
overwrite_existing: Annotated[bool, typer.Option("--overwrite-existing", "-o", help="Overwrite existing files on remote when sending from local to remote.")] = False,
|
|
51
|
+
) -> None:
|
|
52
|
+
"""File transfer utility though SSH."""
|
|
53
|
+
from machineconfig.scripts.python.ftpx import ftpx as ftpx_impl
|
|
54
|
+
ftpx_impl(source=source, target=target, recursive=recursive, zipFirst=zipFirst, cloud=cloud, overwrite_existing=overwrite_existing)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def croshell(
|
|
58
|
+
path: Annotated[Optional[str], typer.Argument(help="path of file to read.")] = None,
|
|
59
|
+
project_path: Annotated[Optional[str], typer.Option("--project", "-p", help="specify uv project to use")] = None,
|
|
60
|
+
uv_with: Annotated[Optional[str], typer.Option("--uv-with", "-w", help="specify uv with packages to use")] = None,
|
|
61
|
+
marimo: Annotated[bool, typer.Option("--marimo", "-m", help="open the notebook using marimo if available")] = False,
|
|
62
|
+
jupyter: Annotated[bool, typer.Option("--jupyter", "-j", help="run in jupyter interactive console")] = False,
|
|
63
|
+
vscode: Annotated[bool, typer.Option("--vscode", "-c", help="open the script in vscode")] = False,
|
|
64
|
+
visidata: Annotated[bool, typer.Option("--visidata", "-v", help="open data file in visidata")] = False,
|
|
65
|
+
python: Annotated[bool, typer.Option("--python", "-P", help="flag to use python over IPython.")] = False,
|
|
66
|
+
profile: Annotated[Optional[str], typer.Option("--profile", "-r", help="ipython profile to use, defaults to default profile.")] = None,
|
|
67
|
+
) -> None:
|
|
68
|
+
"""Cross-shell command execution."""
|
|
69
|
+
from machineconfig.scripts.python.croshell import croshell as croshell_impl
|
|
70
|
+
croshell_impl(path=path, project_path=project_path, uv_with=uv_with, marimo=marimo, jupyter=jupyter, vscode=vscode, visidata=visidata, python=python, profile=profile)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def devops(ctx: typer.Context) -> None:
|
|
74
|
+
"""[d] DevOps related commands."""
|
|
75
|
+
from machineconfig.scripts.python.devops import get_app
|
|
76
|
+
get_app()(ctx.args, standalone_mode=not ctx.args)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def cloud(ctx: typer.Context) -> None:
|
|
80
|
+
"""[c] Cloud management commands."""
|
|
81
|
+
from machineconfig.scripts.python.cloud import get_app
|
|
82
|
+
get_app()(ctx.args, standalone_mode=not ctx.args)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def sessions(ctx: typer.Context) -> None:
|
|
86
|
+
"""[s] Session and layout management."""
|
|
87
|
+
from machineconfig.scripts.python.sessions import get_app
|
|
88
|
+
get_app()(ctx.args, standalone_mode=not ctx.args)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def agents(ctx: typer.Context) -> None:
|
|
92
|
+
"""[a] 🤖 AI Agents management commands."""
|
|
93
|
+
from machineconfig.scripts.python.agents import get_app
|
|
94
|
+
get_app()(ctx.args, standalone_mode=not ctx.args)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def utils(ctx: typer.Context) -> None:
|
|
98
|
+
"""[u] Utility commands."""
|
|
99
|
+
from machineconfig.scripts.python.utils import get_app
|
|
100
|
+
get_app()(ctx.args, standalone_mode=not ctx.args)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def terminal(ctx: typer.Context) -> None:
|
|
104
|
+
"""[t] Terminal management commands."""
|
|
105
|
+
from machineconfig.scripts.python.terminal import get_app
|
|
106
|
+
get_app()(ctx.args, standalone_mode=not ctx.args)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def get_app() -> typer.Typer:
|
|
110
|
+
app = typer.Typer(help="MachineConfig CLI - Manage your machine configurations and workflows", no_args_is_help=True, add_help_option=True, add_completion=False)
|
|
111
|
+
|
|
112
|
+
ctx_settings: dict[str, object] = {"allow_extra_args": True, "allow_interspersed_args": True, "ignore_unknown_options": True, "help_option_names": []}
|
|
113
|
+
|
|
114
|
+
app.command(name="devops", help="[d] DevOps related commands", context_settings=ctx_settings)(devops)
|
|
115
|
+
app.command(name="d", hidden=True, context_settings=ctx_settings)(devops)
|
|
116
|
+
app.command(name="cloud", help="[c] Cloud management commands", context_settings=ctx_settings)(cloud)
|
|
117
|
+
app.command(name="c", hidden=True, context_settings=ctx_settings)(cloud)
|
|
118
|
+
app.command(name="sessions", help="[s] Session and layout management", context_settings=ctx_settings)(sessions)
|
|
119
|
+
app.command(name="s", hidden=True, context_settings=ctx_settings)(sessions)
|
|
120
|
+
app.command(name="agents", help="[a] 🤖 AI Agents management commands", context_settings=ctx_settings)(agents)
|
|
121
|
+
app.command(name="a", hidden=True, context_settings=ctx_settings)(agents)
|
|
122
|
+
app.command(name="utils", help="[u] Utility commands", context_settings=ctx_settings)(utils)
|
|
123
|
+
app.command(name="u", hidden=True, context_settings=ctx_settings)(utils)
|
|
124
|
+
app.command(name="terminal", help="[t] Terminal management commands", context_settings=ctx_settings)(terminal)
|
|
125
|
+
app.command(name="t", hidden=True, context_settings=ctx_settings)(terminal)
|
|
126
|
+
|
|
127
|
+
app.command(name="fire", help="[f] Fire and manage jobs", no_args_is_help=False, context_settings={"allow_extra_args": True, "allow_interspersed_args": False})(fire)
|
|
128
|
+
app.command(name="f", hidden=True, no_args_is_help=False, context_settings={"allow_extra_args": True, "allow_interspersed_args": False})(fire)
|
|
129
|
+
app.command("ftpx", no_args_is_help=True, help="[ff] File transfer utility though SSH")(ftpx)
|
|
130
|
+
app.command("ff", no_args_is_help=True, hidden=True)(ftpx)
|
|
131
|
+
app.command("croshell", no_args_is_help=False, help="[r] Cross-shell command execution")(croshell)
|
|
132
|
+
app.command("r", no_args_is_help=False, hidden=True)(croshell)
|
|
48
133
|
|
|
49
134
|
return app
|
|
50
135
|
|
|
51
136
|
|
|
52
|
-
def main():
|
|
137
|
+
def main() -> None:
|
|
53
138
|
app = get_app()
|
|
54
139
|
app()
|
|
55
140
|
|
|
@@ -1,72 +1,26 @@
|
|
|
1
|
+
"""msearch - Machineconfig search helper."""
|
|
1
2
|
|
|
2
3
|
import typer
|
|
3
4
|
from typing import Annotated
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
def machineconfig_search(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
install_if_missing("tv")
|
|
21
|
-
install_if_missing("bat")
|
|
22
|
-
install_if_missing("fd")
|
|
23
|
-
install_if_missing("rg") # ripgrep
|
|
24
|
-
install_if_missing("rga") # ripgrep-all
|
|
25
|
-
# install_if_missing("tree-sitter-cli")
|
|
26
|
-
return
|
|
27
|
-
if symantic:
|
|
28
|
-
script = ""
|
|
29
|
-
for an_ex in extension.split(","):
|
|
30
|
-
script = script + f"""\nparse *.{an_ex} """
|
|
31
|
-
from machineconfig.utils.code import run_shell_script
|
|
32
|
-
run_shell_script(script=script)
|
|
33
|
-
return
|
|
34
|
-
if ast:
|
|
35
|
-
from machineconfig.scripts.python.helpers.ast_search import get_repo_symbols
|
|
36
|
-
symbols = get_repo_symbols(directory)
|
|
37
|
-
from machineconfig.utils.options import choose_from_options
|
|
38
|
-
try:
|
|
39
|
-
res = choose_from_options(options=symbols, msg="Select a symbol to search for:", tv=True, multi=False)
|
|
40
|
-
from rich import print_json
|
|
41
|
-
import json
|
|
42
|
-
res_json = json.dumps(res, indent=4)
|
|
43
|
-
print_json(res_json)
|
|
44
|
-
return None
|
|
45
|
-
except Exception as e:
|
|
46
|
-
print(f"❌ Error during selection: {e}")
|
|
47
|
-
return None
|
|
48
|
-
if file:
|
|
49
|
-
script = """fzf --ansi --preview-window 'right:60%' --preview 'bat --color=always --style=numbers,grid,header --line-range :300 {}' """
|
|
50
|
-
if no_dotfiles:
|
|
51
|
-
script = "fd | " + script
|
|
52
|
-
from machineconfig.utils.code import run_shell_script
|
|
53
|
-
run_shell_script(script=script)
|
|
54
|
-
return
|
|
55
|
-
from machineconfig.scripts.python.helpers_msearch import FZFG_LINUX_PATH, FZFG_WINDOWS_PATH
|
|
56
|
-
import platform
|
|
57
|
-
if platform.system() == "Linux" or platform.system() == "Darwin":
|
|
58
|
-
script = FZFG_LINUX_PATH.read_text(encoding="utf-8")
|
|
59
|
-
elif platform.system() == "Windows":
|
|
60
|
-
script = FZFG_WINDOWS_PATH.read_text(encoding="utf-8")
|
|
61
|
-
else:
|
|
62
|
-
raise RuntimeError("Unsupported platform")
|
|
63
|
-
if rga:
|
|
64
|
-
script = script.replace("rg ", "rga ").replace("ripgrep", "ripgrep-all")
|
|
65
|
-
from machineconfig.utils.code import exit_then_run_shell_script
|
|
66
|
-
exit_then_run_shell_script(script=script, strict=False)
|
|
8
|
+
path: Annotated[str, typer.Argument(help="The directory/file to search")] = ".",
|
|
9
|
+
ast: Annotated[bool, typer.Option(..., "--ast", "-a", help="The abstract syntax tree search/ tree sitter search of symbols")] = False,
|
|
10
|
+
symantic: Annotated[bool, typer.Option(..., "--symantic", "-s", help="The symantic search of symbols")] = False,
|
|
11
|
+
extension: Annotated[str, typer.Option(..., "--extension", "-E", help="File extension to filter by (e.g., .py, .js)")] = "",
|
|
12
|
+
file: Annotated[bool, typer.Option(..., "--file", "-f", help="File search using fzf")] = False,
|
|
13
|
+
no_dotfiles: Annotated[bool, typer.Option(..., "--no-dotfiles", "-D", help="Exclude dotfiles from search")] = False,
|
|
14
|
+
rga: Annotated[bool, typer.Option(..., "--rga", "-A", help="Use ripgrep-all for searching all (non text files) instead of ripgrep")] = False,
|
|
15
|
+
edit: Annotated[bool, typer.Option(..., "--edit", "-e", help="Open selection in editor (helix)")] = False,
|
|
16
|
+
install_dependencies: Annotated[bool, typer.Option(..., "--install-req", "-i", help="Install required dependencies if missing")] = False,
|
|
17
|
+
) -> None:
|
|
18
|
+
"""Machineconfig search helper."""
|
|
19
|
+
from machineconfig.scripts.python.helpers.helpers_msearch.msearch_impl import machineconfig_search as impl
|
|
20
|
+
impl(path=path, ast=ast, symantic=symantic, extension=extension, file=file, no_dotfiles=no_dotfiles, rga=rga, edit=edit, install_dependencies=install_dependencies)
|
|
67
21
|
|
|
68
22
|
|
|
69
|
-
def main():
|
|
23
|
+
def main() -> None:
|
|
70
24
|
app = typer.Typer(add_completion=False, no_args_is_help=True)
|
|
71
25
|
app.command(name="msearch", help=machineconfig_search.__doc__, short_help="machineconfig search helper", no_args_is_help=False)(machineconfig_search)
|
|
72
26
|
app()
|
|
@@ -1,205 +1,70 @@
|
|
|
1
|
+
"""Sessions management commands - lazy loading subcommands."""
|
|
1
2
|
|
|
2
3
|
from typing import Optional, Literal, Annotated
|
|
3
4
|
import typer
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
def balance_load(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
def balance_load(
|
|
8
|
+
layout_path: Annotated[str, typer.Argument(..., help="Path to the layout.json file")],
|
|
9
|
+
max_thresh: Annotated[int, typer.Option(..., "--max-threshold", "-m", help="Maximum tabs per layout")],
|
|
10
|
+
thresh_type: Annotated[Literal["number", "n", "weight", "w"], typer.Option(..., "--threshold-type", "-t", help="Threshold type")],
|
|
11
|
+
breaking_method: Annotated[Literal["moreLayouts", "ml", "combineTabs", "ct"], typer.Option(..., "--breaking-method", "-b", help="Breaking method")],
|
|
12
|
+
output_path: Annotated[Optional[str], typer.Option(..., "--output-path", "-o", help="Path to write the adjusted layout.json file")] = None,
|
|
13
|
+
) -> None:
|
|
11
14
|
"""Adjust layout file to limit max tabs per layout, etc."""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
layout_configs = layoutfile["layouts"]
|
|
31
|
-
from machineconfig.cluster.sessions_managers.utils.load_balancer import limit_tab_num
|
|
32
|
-
new_layouts = limit_tab_num(layout_configs=layout_configs, max_thresh=max_thresh, threshold_type=thresh_type_resolved[thresh_type], breaking_method=breaking_method_resolved[breaking_method])
|
|
33
|
-
layoutfile["layouts"] = new_layouts
|
|
34
|
-
target_file = Path(output_path) if output_path is not None else layout_path_obj.parent / f'{layout_path_obj.stem}_adjusted_{max_thresh}_{thresh_type}_{breaking_method}.json'
|
|
35
|
-
target_file.parent.mkdir(parents=True, exist_ok=True)
|
|
36
|
-
target_file.write_text(data=json.dumps(layoutfile, indent=4), encoding="utf-8")
|
|
37
|
-
typer.echo(f"Adjusted layout saved to {target_file}")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def select_layout(layouts_json_file: str, selected_layouts_names: Optional[list[str]], select_interactively: bool,
|
|
41
|
-
subsitute_home: bool
|
|
42
|
-
) -> list["LayoutConfig"]:
|
|
43
|
-
import json
|
|
44
|
-
from machineconfig.utils.options import choose_from_options
|
|
45
|
-
from machineconfig.utils.schemas.layouts.layout_types import LayoutsFile
|
|
46
|
-
from pathlib import Path
|
|
47
|
-
json_str = Path(layouts_json_file).read_text(encoding="utf-8")
|
|
48
|
-
if subsitute_home:
|
|
49
|
-
json_str = json_str.replace("~", str(Path.home())).replace("$HOME", str(Path.home()))
|
|
50
|
-
json_str = json_str.replace("""Command": "f """, """Command": "~/.config/machineconfig/scripts/wrap_mcfg fire """)
|
|
51
|
-
json_str = json_str.replace("""Command": "s """, """Command": "~/.config/machineconfig/scripts/wrap_mcfg sessions """)
|
|
52
|
-
|
|
53
|
-
layout_file: LayoutsFile = json.loads(json_str)
|
|
54
|
-
if len(layout_file["layouts"]) == 0:
|
|
55
|
-
raise ValueError(f"No layouts found in {layouts_json_file}")
|
|
56
|
-
if selected_layouts_names is None: # choose all, or interactively
|
|
57
|
-
if not select_interactively:
|
|
58
|
-
return layout_file["layouts"]
|
|
59
|
-
options = [layout["layoutName"] for layout in layout_file["layouts"]]
|
|
60
|
-
from machineconfig.utils.options import choose_from_options
|
|
61
|
-
selected_layouts_names = choose_from_options(multi=True, options=options, prompt="Choose a layout configuration:", tv=True, msg="Choose one option")
|
|
62
|
-
print(f"Selected layout(s): {selected_layouts_names}")
|
|
63
|
-
# Extract the configs from the names:
|
|
64
|
-
layouts_chosen: list[LayoutConfig] = []
|
|
65
|
-
for name in selected_layouts_names:
|
|
66
|
-
layout_chosen = next((layout for layout in layout_file["layouts"] if layout["layoutName"] == name), None)
|
|
67
|
-
if layout_chosen is None:
|
|
68
|
-
layout_chosen = next((layout for layout in layout_file["layouts"] if layout["layoutName"].lower() == name.lower()), None)
|
|
69
|
-
if layout_chosen is None:
|
|
70
|
-
available_layouts = [layout["layoutName"] for layout in layout_file["layouts"]]
|
|
71
|
-
raise ValueError(f"Layout '{name}' not found. Available layouts: {available_layouts}")
|
|
72
|
-
layouts_chosen.append(layout_chosen)
|
|
73
|
-
return layouts_chosen
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def find_layout_file(layout_path: str, ) -> str:
|
|
77
|
-
from machineconfig.utils.path_helper import search_for_files_of_interest
|
|
78
|
-
from machineconfig.utils.options import choose_from_options
|
|
79
|
-
from machineconfig.utils.path_helper import match_file_name, sanitize_path
|
|
80
|
-
from pathlib import Path
|
|
81
|
-
path_obj = sanitize_path(layout_path)
|
|
82
|
-
if not path_obj.exists():
|
|
83
|
-
choice_file = match_file_name(sub_string=layout_path, search_root=Path.cwd(), suffixes={".json"})
|
|
84
|
-
elif path_obj.is_dir():
|
|
85
|
-
print(f"🔍 Searching recursively for Python, PowerShell and Shell scripts in directory `{path_obj}`")
|
|
86
|
-
files = search_for_files_of_interest(path_obj, suffixes={".py", ".sh", ".ps1"})
|
|
87
|
-
print(f"🔍 Got #{len(files)} results.")
|
|
88
|
-
choice_file = choose_from_options(multi=False, options=files, tv=True, msg="Choose one option")
|
|
89
|
-
choice_file = Path(choice_file).expanduser().absolute()
|
|
90
|
-
else:
|
|
91
|
-
choice_file = path_obj
|
|
92
|
-
return str(choice_file)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def run(ctx: typer.Context,
|
|
96
|
-
layout_path: Annotated[Optional[str], typer.Argument(..., help="Path to the layout.json file")] = None,
|
|
97
|
-
max_tabs: Annotated[int, typer.Option(..., "--max-tabs", "-mt", help="A Sanity checker that throws an error if any layout exceeds the maximum number of tabs to launch.")] = 10,
|
|
98
|
-
max_layouts: Annotated[int, typer.Option(..., "--max-layouts", "-ml", help="A Sanity checker that throws an error if the total number of *parallel layouts exceeds this number.")] = 10,
|
|
99
|
-
sleep_inbetween: Annotated[float, typer.Option(..., "--sleep-inbetween", "-si", help="Sleep time in seconds between launching layouts")] = 1.0,
|
|
100
|
-
monitor: Annotated[bool, typer.Option(..., "--monitor", "-m", help="Monitor the layout sessions for completion")] = False,
|
|
101
|
-
parallel: Annotated[bool, typer.Option(..., "--parallel", "-p", help="Launch multiple layouts in parallel")] = False,
|
|
102
|
-
kill_upon_completion: Annotated[bool, typer.Option(..., "--kill-upon-completion", "-k", help="Kill session(s) upon completion (only relevant if monitor flag is set)")] = False,
|
|
103
|
-
choose: Annotated[Optional[str], typer.Option(..., "--choose", "-c", help="Comma separated names of layouts to be selected from the layout file passed")] = None,
|
|
104
|
-
choose_interactively: Annotated[bool, typer.Option(..., "--choose-interactively", "-i", help="Select layouts interactively")] = False,
|
|
105
|
-
subsitute_home: Annotated[bool, typer.Option(..., "--substitute-home", "-sh", help="Substitute ~ and $HOME in layout file with actual home directory path")] = False,
|
|
106
|
-
):
|
|
107
|
-
"""
|
|
108
|
-
Launch terminal sessions based on a layout configuration file.
|
|
109
|
-
"""
|
|
15
|
+
from machineconfig.scripts.python.helpers.helpers_sessions.sessions_impl import balance_load as impl
|
|
16
|
+
impl(layout_path=layout_path, max_thresh=max_thresh, thresh_type=thresh_type, breaking_method=breaking_method, output_path=output_path)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def run(
|
|
20
|
+
ctx: typer.Context,
|
|
21
|
+
layout_path: Annotated[Optional[str], typer.Argument(..., help="Path to the layout.json file")] = None,
|
|
22
|
+
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,
|
|
23
|
+
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,
|
|
24
|
+
sleep_inbetween: Annotated[float, typer.Option(..., "--sleep-inbetween", "-si", help="Sleep time in seconds between launching layouts")] = 1.0,
|
|
25
|
+
monitor: Annotated[bool, typer.Option(..., "--monitor", "-m", help="Monitor the layout sessions for completion")] = False,
|
|
26
|
+
parallel: Annotated[bool, typer.Option(..., "--parallel", "-p", help="Launch multiple layouts in parallel")] = False,
|
|
27
|
+
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,
|
|
28
|
+
choose: Annotated[Optional[str], typer.Option(..., "--choose", "-c", help="Comma separated names of layouts to be selected from the layout file passed")] = None,
|
|
29
|
+
choose_interactively: Annotated[bool, typer.Option(..., "--choose-interactively", "-i", help="Select layouts interactively")] = False,
|
|
30
|
+
subsitute_home: Annotated[bool, typer.Option(..., "--substitute-home", "-sh", help="Substitute ~ and $HOME in layout file with actual home directory path")] = False,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""Launch terminal sessions based on a layout configuration file."""
|
|
110
33
|
if layout_path is None:
|
|
111
34
|
typer.echo(ctx.get_help())
|
|
112
35
|
raise typer.Exit()
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
raise
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
raise typer.Exit(0)
|
|
126
|
-
import time
|
|
127
|
-
import platform
|
|
128
|
-
if platform.system() == "Linux" or platform.system() == "Darwin":
|
|
129
|
-
from machineconfig.cluster.sessions_managers.zellij_local_manager import ZellijLocalManager
|
|
130
|
-
if not parallel: iterable = [[item] for item in layouts_selected]
|
|
131
|
-
else: iterable = [layouts_selected]
|
|
132
|
-
for i, a_layouts in enumerate(iterable):
|
|
133
|
-
manager = ZellijLocalManager(session_layouts=a_layouts)
|
|
134
|
-
manager.start_all_sessions(poll_interval=2, poll_seconds=2)
|
|
135
|
-
if monitor:
|
|
136
|
-
manager.run_monitoring_routine(wait_ms=2000)
|
|
137
|
-
if kill_upon_completion:
|
|
138
|
-
manager.kill_all_sessions()
|
|
139
|
-
if i < len(layouts_selected) - 1: # Don't sleep after the last layout
|
|
140
|
-
time.sleep(sleep_inbetween)
|
|
141
|
-
elif platform.system() == "Windows":
|
|
142
|
-
from machineconfig.cluster.sessions_managers.wt_local_manager import WTLocalManager
|
|
143
|
-
if not parallel: iterable = [[item] for item in layouts_selected]
|
|
144
|
-
else: iterable = [layouts_selected]
|
|
145
|
-
for i, a_layouts in enumerate(iterable):
|
|
146
|
-
manager = WTLocalManager(session_layouts=a_layouts)
|
|
147
|
-
manager.start_all_sessions()
|
|
148
|
-
if monitor:
|
|
149
|
-
manager.run_monitoring_routine(wait_ms=2000)
|
|
150
|
-
if kill_upon_completion:
|
|
151
|
-
manager.kill_all_sessions()
|
|
152
|
-
if i < len(layouts_selected) - 1: # Don't sleep after the last layout
|
|
153
|
-
time.sleep(sleep_inbetween)
|
|
154
|
-
else:
|
|
155
|
-
print(f"❌ Unsupported platform: {platform.system()}")
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def create_template(name: Annotated[Optional[str], typer.Argument(..., help="Name of the layout template to create")] = None,
|
|
159
|
-
num_tabs: Annotated[int, typer.Option(..., "--num-tabs", "-t", help="Number of tabs to include in the template")] = 3,
|
|
160
|
-
):
|
|
36
|
+
from machineconfig.scripts.python.helpers.helpers_sessions.sessions_impl import run_layouts
|
|
37
|
+
try:
|
|
38
|
+
run_layouts(layout_path=layout_path, max_tabs=max_tabs, max_layouts=max_layouts, sleep_inbetween=sleep_inbetween, monitor=monitor, parallel=parallel, kill_upon_completion=kill_upon_completion, choose=choose, choose_interactively=choose_interactively, subsitute_home=subsitute_home)
|
|
39
|
+
except ValueError as e:
|
|
40
|
+
typer.echo(str(e))
|
|
41
|
+
raise typer.Exit(1) from e
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def create_template(
|
|
45
|
+
name: Annotated[Optional[str], typer.Argument(..., help="Name of the layout template to create")] = None,
|
|
46
|
+
num_tabs: Annotated[int, typer.Option(..., "--num-tabs", "-t", help="Number of tabs to include in the template")] = 3,
|
|
47
|
+
) -> None:
|
|
161
48
|
"""Create a layout template file."""
|
|
162
|
-
from machineconfig.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
"layouts": layouts
|
|
182
|
-
}
|
|
183
|
-
import json
|
|
184
|
-
json_string = json.dumps(file, indent=4)
|
|
185
|
-
if name is None:
|
|
186
|
-
layout_path = Path.cwd() / "layout.json"
|
|
187
|
-
else:
|
|
188
|
-
layout_path = Path.cwd() / (name.replace(".json", "") + ".json")
|
|
189
|
-
layout_path.parent.mkdir(parents=True, exist_ok=True)
|
|
190
|
-
if layout_path.exists():
|
|
191
|
-
print(f"❌ File {layout_path} already exists. Aborting to avoid overwriting.")
|
|
192
|
-
return
|
|
193
|
-
layout_path.write_text(json_string, encoding="utf-8")
|
|
194
|
-
print(f"✅ Created layout template at {layout_path}")
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
def get_app():
|
|
198
|
-
layouts_app = typer.Typer(help="Layouts management subcommands", no_args_is_help=True, add_help_option=False, add_completion=False)
|
|
199
|
-
from machineconfig.scripts.python.helpers_sessions.sessions_multiprocess import create_from_function
|
|
200
|
-
|
|
201
|
-
layouts_app.command("create-from-function", no_args_is_help=True, help=create_from_function.__doc__, short_help="[c] Create a layout from a function")(create_from_function)
|
|
202
|
-
layouts_app.command("c", no_args_is_help=True, help=create_from_function.__doc__, hidden=True)(create_from_function)
|
|
49
|
+
from machineconfig.scripts.python.helpers.helpers_sessions.sessions_impl import create_template as impl
|
|
50
|
+
impl(name=name, num_tabs=num_tabs)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def create_from_function(
|
|
54
|
+
num_process: Annotated[int, typer.Option(..., "--num-process", "-n", help="Number of parallel processes to run")],
|
|
55
|
+
path: Annotated[str, typer.Option(..., "--path", "-p", help="Path to a Python or Shell script file or a directory containing such files")] = ".",
|
|
56
|
+
function: Annotated[Optional[str], typer.Option(..., "--function", "-f", help="Function to run from the Python file. If not provided, you will be prompted to choose.")] = None,
|
|
57
|
+
) -> None:
|
|
58
|
+
"""Create a layout from a function to run in multiple processes."""
|
|
59
|
+
from machineconfig.scripts.python.helpers.helpers_sessions.sessions_multiprocess import create_from_function as impl
|
|
60
|
+
impl(num_process=num_process, path=path, function=function)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def get_app() -> typer.Typer:
|
|
64
|
+
layouts_app = typer.Typer(help="Layouts management subcommands", no_args_is_help=True, add_help_option=True, add_completion=False)
|
|
65
|
+
|
|
66
|
+
layouts_app.command("create-from-function", no_args_is_help=True, short_help="[c] Create a layout from a function")(create_from_function)
|
|
67
|
+
layouts_app.command("c", no_args_is_help=True, hidden=True)(create_from_function)
|
|
203
68
|
|
|
204
69
|
layouts_app.command("run", no_args_is_help=True, help=run.__doc__, short_help="[r] Run the selected layout(s)")(run)
|
|
205
70
|
layouts_app.command("r", no_args_is_help=True, help=run.__doc__, hidden=True)(run)
|
|
@@ -212,10 +77,10 @@ def get_app():
|
|
|
212
77
|
return layouts_app
|
|
213
78
|
|
|
214
79
|
|
|
215
|
-
def main():
|
|
80
|
+
def main() -> None:
|
|
216
81
|
layouts_app = get_app()
|
|
217
82
|
layouts_app()
|
|
218
83
|
|
|
219
84
|
|
|
220
85
|
if __name__ == "__main__":
|
|
221
|
-
|
|
86
|
+
pass
|