machineconfig 8.12__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 +45 -21
- 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} +69 -45
- machineconfig/scripts/python/helpers/helpers_devops/run_script.py +197 -0
- 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 +49 -29
- 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 +79 -37
- 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 +73 -22
- machineconfig/utils/ssh_utils/abc.py +1 -1
- machineconfig/utils/ssh_utils/copy_from_here.py +2 -2
- machineconfig/utils/ssh_utils/utils.py +2 -2
- 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.12.dist-info → machineconfig-8.45.dist-info}/METADATA +29 -22
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/RECORD +249 -211
- machineconfig/jobs/installer/check_installations.py +0 -248
- machineconfig/jobs/scripts/bash_scripts/mint_keyboard_shortcuts.sh +0 -30
- 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/run_script.py +0 -168
- 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.12.dist-info → machineconfig-8.45.dist-info}/WHEEL +0 -0
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/entry_points.txt +0 -0
- {machineconfig-8.12.dist-info → machineconfig-8.45.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"""Pure Python implementation for fire_jobs route command - no typer dependencies."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional, Callable
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_args_helper import FireJobArgs
|
|
6
|
+
|
|
7
|
+
RandStrFunc = Callable[[int], str]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def route(args: FireJobArgs, fire_args: str) -> None:
|
|
11
|
+
"""Route execution based on args configuration."""
|
|
12
|
+
from machineconfig.utils.path_helper import get_choice_file
|
|
13
|
+
from machineconfig.utils.accessories import get_repo_root, randstr
|
|
14
|
+
|
|
15
|
+
choice_file = get_choice_file(args.path, suffixes=None)
|
|
16
|
+
repo_root = get_repo_root(choice_file)
|
|
17
|
+
print(f"💾 Selected file: {choice_file}.\nRepo root: {repo_root}")
|
|
18
|
+
|
|
19
|
+
if args.marimo:
|
|
20
|
+
_handle_marimo(choice_file=choice_file, repo_root=repo_root, randstr_func=randstr)
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
kwargs_dict = _prepare_kwargs(args=args, choice_file=choice_file)
|
|
24
|
+
choice_function = _choose_function(args=args, choice_file=choice_file, kwargs_dict=kwargs_dict)
|
|
25
|
+
if isinstance(choice_function, tuple):
|
|
26
|
+
choice_function, choice_file, kwargs_dict = choice_function
|
|
27
|
+
|
|
28
|
+
command = _build_command(args=args, choice_file=choice_file, choice_function=choice_function, kwargs_dict=kwargs_dict, repo_root=repo_root, fire_args=fire_args, randstr_func=randstr)
|
|
29
|
+
command = _apply_command_modifiers(args=args, command=command, choice_file=choice_file, repo_root=repo_root, randstr_func=randstr)
|
|
30
|
+
|
|
31
|
+
from machineconfig.utils.code import exit_then_run_shell_script
|
|
32
|
+
exit_then_run_shell_script(script=command, strict=False)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _handle_marimo(choice_file: Path, repo_root: Optional[Path], randstr_func: RandStrFunc) -> None:
|
|
36
|
+
"""Handle marimo notebook launch."""
|
|
37
|
+
print(f"🧽 Preparing to launch Marimo notebook for `{choice_file}`...")
|
|
38
|
+
tmp_dir = Path.home().joinpath(f"tmp_results/tmp_scripts/marimo/{choice_file.stem}_{randstr_func(10)}")
|
|
39
|
+
tmp_dir.mkdir(parents=True, exist_ok=True)
|
|
40
|
+
script = f"""
|
|
41
|
+
cd {tmp_dir}
|
|
42
|
+
uv run --python 3.14 --with marimo marimo convert {choice_file} -o marimo_nb.py
|
|
43
|
+
uv run --project {repo_root} --with marimo marimo edit --host 0.0.0.0 marimo_nb.py
|
|
44
|
+
"""
|
|
45
|
+
from machineconfig.utils.code import exit_then_run_shell_script
|
|
46
|
+
print(f"🚀 Launching Marimo notebook for `{choice_file}`...")
|
|
47
|
+
exit_then_run_shell_script(script)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _prepare_kwargs(args: FireJobArgs, choice_file: Path) -> dict[str, object]:
|
|
51
|
+
"""Prepare kwargs dict from args."""
|
|
52
|
+
if choice_file.suffix == ".py":
|
|
53
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_args_helper import extract_kwargs
|
|
54
|
+
return extract_kwargs(args)
|
|
55
|
+
return {}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _choose_function(args: FireJobArgs, choice_file: Path, kwargs_dict: dict[str, object]) -> Optional[str] | tuple[Optional[str], Path, dict[str, object]]:
|
|
59
|
+
"""Choose function to run, possibly interactively."""
|
|
60
|
+
if args.choose_function:
|
|
61
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_route_helper import choose_function_or_lines
|
|
62
|
+
choice_function, choice_file, kwargs_dict = choose_function_or_lines(choice_file, kwargs_dict)
|
|
63
|
+
return (choice_function, choice_file, kwargs_dict)
|
|
64
|
+
return args.function
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _build_command(args: FireJobArgs, choice_file: Path, choice_function: Optional[str], kwargs_dict: dict[str, object], repo_root: Optional[Path], fire_args: str, randstr_func: RandStrFunc) -> str:
|
|
68
|
+
"""Build the execution command."""
|
|
69
|
+
if choice_file.suffix == ".py":
|
|
70
|
+
exe_line = _build_python_exe_line(args=args, choice_file=choice_file, repo_root=repo_root)
|
|
71
|
+
choice_file_adjusted = _adjust_choice_file(args=args, choice_file=choice_file, repo_root=repo_root)
|
|
72
|
+
|
|
73
|
+
if args.script or (args.debug and args.choose_function):
|
|
74
|
+
choice_file = _create_import_script(choice_file=choice_file, choice_function=choice_function, kwargs_dict=kwargs_dict, repo_root=repo_root, randstr_func=randstr_func)
|
|
75
|
+
choice_file_adjusted = str(choice_file)
|
|
76
|
+
|
|
77
|
+
return _build_final_command(args=args, exe_line=exe_line, choice_file=choice_file, choice_file_adjusted=choice_file_adjusted, choice_function=choice_function, fire_args=fire_args)
|
|
78
|
+
elif choice_file.suffix in (".ps1", ".sh"):
|
|
79
|
+
return f". {choice_file}"
|
|
80
|
+
elif choice_file.suffix == "":
|
|
81
|
+
return str(choice_file)
|
|
82
|
+
else:
|
|
83
|
+
raise NotImplementedError(f"File type {choice_file.suffix} not supported, in the sense that I don't know how to fire it.")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _build_python_exe_line(args: FireJobArgs, choice_file: Path, repo_root: Optional[Path]) -> str:
|
|
87
|
+
"""Build Python execution line."""
|
|
88
|
+
module_line = "-m" if args.module else ""
|
|
89
|
+
with_project = f"--project {repo_root} " if repo_root is not None else ""
|
|
90
|
+
interactive_line = "-i" if args.interactive else ""
|
|
91
|
+
|
|
92
|
+
if args.interactive:
|
|
93
|
+
from machineconfig.utils.ve import get_ve_path_and_ipython_profile
|
|
94
|
+
_ve_root_from_file, ipy_profile = get_ve_path_and_ipython_profile(init_path=choice_file)
|
|
95
|
+
if ipy_profile is None:
|
|
96
|
+
ipy_profile = "default"
|
|
97
|
+
ipython_line = f"--no-banner --profile {ipy_profile} "
|
|
98
|
+
else:
|
|
99
|
+
ipython_line = ""
|
|
100
|
+
|
|
101
|
+
if args.streamlit:
|
|
102
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.fire_jobs_route_helper import get_command_streamlit
|
|
103
|
+
interpreter_line = get_command_streamlit(choice_file=choice_file, environment=args.environment, repo_root=repo_root)
|
|
104
|
+
elif args.jupyter:
|
|
105
|
+
interpreter_line = "jupyter-lab"
|
|
106
|
+
else:
|
|
107
|
+
interpreter_line = "python" if not args.interactive else "ipython"
|
|
108
|
+
|
|
109
|
+
return f"uv run {with_project} {interpreter_line} {interactive_line} {module_line} {ipython_line}"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _adjust_choice_file(args: FireJobArgs, choice_file: Path, repo_root: Optional[Path]) -> str:
|
|
113
|
+
"""Adjust choice file path for module mode."""
|
|
114
|
+
if args.module and choice_file.suffix == ".py":
|
|
115
|
+
if repo_root is not None:
|
|
116
|
+
return ".".join(Path(choice_file).relative_to(repo_root).parts).replace(".py", "")
|
|
117
|
+
else:
|
|
118
|
+
return ".".join(Path(choice_file).relative_to(Path.cwd()).parts).replace(".py", "")
|
|
119
|
+
return str(choice_file)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _create_import_script(choice_file: Path, choice_function: Optional[str], kwargs_dict: dict[str, object], repo_root: Optional[Path], randstr_func: RandStrFunc) -> Path:
|
|
123
|
+
"""Create a script that imports the module and calls the function."""
|
|
124
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.file_wrangler import get_import_module_code, wrap_import_in_try_except
|
|
125
|
+
from machineconfig.utils.meta import lambda_to_python_script
|
|
126
|
+
from machineconfig.utils.code import print_code
|
|
127
|
+
|
|
128
|
+
import_code = get_import_module_code(str(choice_file))
|
|
129
|
+
import_code_robust = lambda_to_python_script(
|
|
130
|
+
lambda: wrap_import_in_try_except(
|
|
131
|
+
import_line=import_code, pyfile=str(choice_file), repo_root=str(repo_root) if repo_root is not None else None
|
|
132
|
+
),
|
|
133
|
+
in_global=True,
|
|
134
|
+
import_module=False,
|
|
135
|
+
)
|
|
136
|
+
code_printing = lambda_to_python_script(
|
|
137
|
+
lambda: print_code(code=import_code_robust, lexer="python", desc="import as module code"),
|
|
138
|
+
in_global=True, import_module=False
|
|
139
|
+
)
|
|
140
|
+
print(f"🧩 Preparing import code for module import:\n{import_code}")
|
|
141
|
+
if choice_function is not None:
|
|
142
|
+
calling = f"""res = {choice_function}({("**" + str(kwargs_dict)) if kwargs_dict else ""})"""
|
|
143
|
+
else:
|
|
144
|
+
calling = """# No function selected to call. You can add your code here."""
|
|
145
|
+
new_choice_file = Path.home().joinpath(f"tmp_results/tmp_scripts/python/{Path(choice_file).parent.name}_{Path(choice_file).stem}_{randstr_func(10)}.py")
|
|
146
|
+
new_choice_file.parent.mkdir(parents=True, exist_ok=True)
|
|
147
|
+
new_choice_file.write_text(import_code_robust + "\n" + code_printing + "\n" + calling, encoding="utf-8")
|
|
148
|
+
return new_choice_file
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _build_final_command(args: FireJobArgs, exe_line: str, choice_file: Path, choice_file_adjusted: str, choice_function: Optional[str], fire_args: str) -> str:
|
|
152
|
+
"""Build the final command string."""
|
|
153
|
+
if args.debug:
|
|
154
|
+
import platform
|
|
155
|
+
if platform.system() == "Windows":
|
|
156
|
+
return f"{exe_line} -m ipdb {choice_file_adjusted} "
|
|
157
|
+
elif platform.system() in ["Linux", "Darwin"]:
|
|
158
|
+
return f"{exe_line} -m pudb {choice_file_adjusted} "
|
|
159
|
+
else:
|
|
160
|
+
raise NotImplementedError(f"Platform {platform.system()} not supported.")
|
|
161
|
+
elif args.module:
|
|
162
|
+
return f"{exe_line} {choice_file_adjusted} "
|
|
163
|
+
elif choice_function is not None and choice_file.suffix == ".py":
|
|
164
|
+
return f"{exe_line} -m fire {choice_file_adjusted} {choice_function} {fire_args}"
|
|
165
|
+
elif args.streamlit:
|
|
166
|
+
if args.holdDirectory:
|
|
167
|
+
return f"{exe_line} {choice_file}"
|
|
168
|
+
else:
|
|
169
|
+
return f"cd {choice_file.parent}\n{exe_line} {choice_file.name}\ncd {Path.cwd()}"
|
|
170
|
+
elif args.cmd:
|
|
171
|
+
return rf""" cd /d {choice_file.parent} & {exe_line} {choice_file.name} """
|
|
172
|
+
elif choice_file.suffix == "":
|
|
173
|
+
return f"{exe_line} {choice_file} {fire_args}"
|
|
174
|
+
else:
|
|
175
|
+
return f"{exe_line} {choice_file} "
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _apply_command_modifiers(args: FireJobArgs, command: str, choice_file: Path, repo_root: Optional[Path], randstr_func: RandStrFunc) -> str:
|
|
179
|
+
"""Apply various command modifiers based on args."""
|
|
180
|
+
from rich.panel import Panel
|
|
181
|
+
from rich.console import Console
|
|
182
|
+
from rich.syntax import Syntax
|
|
183
|
+
|
|
184
|
+
console = Console()
|
|
185
|
+
|
|
186
|
+
if args.cmd:
|
|
187
|
+
new_line = "\n"
|
|
188
|
+
command = rf"""start cmd -Argument "/k {command.replace(new_line, " & ")} " """
|
|
189
|
+
|
|
190
|
+
if args.submit_to_cloud:
|
|
191
|
+
command = f"""uv run python -m machineconfig.cluster.templates.cli_click --file {choice_file} """
|
|
192
|
+
if args.function is not None:
|
|
193
|
+
command += f"--function {args.function} "
|
|
194
|
+
|
|
195
|
+
if args.optimized:
|
|
196
|
+
command = command.replace("python ", "python -OO ")
|
|
197
|
+
|
|
198
|
+
if args.zellij_tab is not None:
|
|
199
|
+
comman_path__ = Path.home().joinpath(f"tmp_results/tmp_scripts/zellij_commands/{choice_file.stem}_{randstr_func(10)}.sh")
|
|
200
|
+
comman_path__.parent.mkdir(parents=True, exist_ok=True)
|
|
201
|
+
comman_path__.write_text(command, encoding="utf-8")
|
|
202
|
+
console.print(Panel(Syntax(command, lexer="shell"), title=f"🔥 fire command @ {comman_path__}: "), style="bold red")
|
|
203
|
+
import subprocess
|
|
204
|
+
|
|
205
|
+
existing_tab_names = subprocess.run(["zellij", "action", "query-tab-names"], capture_output=True, text=True, check=True).stdout.splitlines()
|
|
206
|
+
if args.zellij_tab in existing_tab_names:
|
|
207
|
+
print(f"⚠️ Tab name `{args.zellij_tab}` already exists. Please choose a different name.")
|
|
208
|
+
args.zellij_tab += f"_{randstr_func(3)}"
|
|
209
|
+
from machineconfig.cluster.sessions_managers.zellij_local import run_command_in_zellij_tab
|
|
210
|
+
|
|
211
|
+
command = run_command_in_zellij_tab(command=str(comman_path__), tab_name=args.zellij_tab, cwd=None)
|
|
212
|
+
|
|
213
|
+
if args.watch:
|
|
214
|
+
command = "watchexec --restart --exts py,sh,ps1 " + command
|
|
215
|
+
|
|
216
|
+
if args.git_pull:
|
|
217
|
+
command = f"\ngit -C {choice_file.parent} pull\n" + command
|
|
218
|
+
|
|
219
|
+
if args.PathExport:
|
|
220
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.file_wrangler import add_to_path
|
|
221
|
+
export_line = add_to_path(path_variable="PYTHONPATH", directory=str(repo_root))
|
|
222
|
+
command = export_line + "\n" + command
|
|
223
|
+
|
|
224
|
+
if args.loop:
|
|
225
|
+
import platform
|
|
226
|
+
if platform.system() in ["Linux", "Darwin"]:
|
|
227
|
+
command = command + "\nsleep 0.5"
|
|
228
|
+
elif platform.system() == "Windows":
|
|
229
|
+
command = "$ErrorActionPreference = 'SilentlyContinue';\n" + command + "\nStart-Sleep -Seconds 0.5"
|
|
230
|
+
else:
|
|
231
|
+
raise NotImplementedError(f"Platform {platform.system()} not supported.")
|
|
232
|
+
|
|
233
|
+
return command
|
|
@@ -21,7 +21,7 @@ def choose_function_or_lines(choice_file: Path, kwargs_dict: dict[str, object])
|
|
|
21
21
|
choice_function: Optional[str] = None
|
|
22
22
|
|
|
23
23
|
if choice_file.suffix == ".py":
|
|
24
|
-
from machineconfig.scripts.python.helpers_fire_command.file_wrangler import parse_pyfile
|
|
24
|
+
from machineconfig.scripts.python.helpers.helpers_fire_command.file_wrangler import parse_pyfile
|
|
25
25
|
options, func_args = parse_pyfile(file_path=str(choice_file))
|
|
26
26
|
choice_function_tmp = choose_from_options(msg="Choose a function to run", options=options, tv=True, multi=False)
|
|
27
27
|
assert isinstance(choice_function_tmp, str), f"choice_function must be a string. Got {type(choice_function_tmp)}"
|
|
@@ -54,8 +54,8 @@ def choose_function_or_lines(choice_file: Path, kwargs_dict: dict[str, object])
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def get_command_streamlit(choice_file: Path, environment: str, repo_root: Optional[Path]) -> str:
|
|
57
|
-
# from machineconfig.scripts.python.helpers_utils.path import get_machine_specs
|
|
58
|
-
from machineconfig.scripts.python.helpers_network.address import select_lan_ipv4
|
|
57
|
+
# from machineconfig.scripts.python.helpers.helpers_utils.path import get_machine_specs
|
|
58
|
+
from machineconfig.scripts.python.helpers.helpers_network.address import select_lan_ipv4
|
|
59
59
|
res = select_lan_ipv4(prefer_vpn=False)
|
|
60
60
|
if res is None:
|
|
61
61
|
raise RuntimeError("Could not determine local LAN IPv4 address for streamlit app.")
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"""Pure Python implementation for msearch command - no typer dependencies."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def machineconfig_search(
|
|
8
|
+
path: str, ast: bool, symantic: bool, extension: str, file: bool, no_dotfiles: bool, rga: bool, edit: bool, install_dependencies: bool
|
|
9
|
+
) -> None:
|
|
10
|
+
"""Machineconfig search helper."""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
if install_dependencies:
|
|
14
|
+
_install_dependencies()
|
|
15
|
+
return
|
|
16
|
+
if symantic:
|
|
17
|
+
_run_symantic_search(extension=extension)
|
|
18
|
+
return
|
|
19
|
+
if ast:
|
|
20
|
+
_run_ast_search(directory=path)
|
|
21
|
+
return
|
|
22
|
+
if file:
|
|
23
|
+
_run_file_search(no_dotfiles=no_dotfiles, edit=edit)
|
|
24
|
+
return
|
|
25
|
+
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
import sys
|
|
28
|
+
import tempfile
|
|
29
|
+
import io
|
|
30
|
+
is_temp_file = False
|
|
31
|
+
if not sys.stdin.isatty() and Path(path).is_dir():
|
|
32
|
+
# Use UTF-8 encoding to handle emoji and Unicode characters on Windows
|
|
33
|
+
if sys.stdin.encoding != 'utf-8':
|
|
34
|
+
stdin_wrapper = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace')
|
|
35
|
+
content = stdin_wrapper.read()
|
|
36
|
+
else:
|
|
37
|
+
content = sys.stdin.read()
|
|
38
|
+
if content:
|
|
39
|
+
tf = tempfile.NamedTemporaryFile(mode='w', encoding='utf-8', delete=False, prefix="msearch_stdin_")
|
|
40
|
+
tf.write(content)
|
|
41
|
+
tf.close()
|
|
42
|
+
path = tf.name
|
|
43
|
+
is_temp_file = True
|
|
44
|
+
|
|
45
|
+
if Path(path).absolute().resolve().is_file():
|
|
46
|
+
from machineconfig.utils.code import exit_then_run_shell_script
|
|
47
|
+
code = search_file_with_context(path=path, is_temp_file=is_temp_file, edit=edit)
|
|
48
|
+
exit_then_run_shell_script(script=code, strict=False)
|
|
49
|
+
return
|
|
50
|
+
|
|
51
|
+
_run_text_search(rga=rga, directory=path)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _install_dependencies() -> None:
|
|
55
|
+
"""Install required dependencies."""
|
|
56
|
+
from machineconfig.utils.installer_utils.installer_cli import install_if_missing
|
|
57
|
+
|
|
58
|
+
install_if_missing("fzf")
|
|
59
|
+
install_if_missing("tv")
|
|
60
|
+
install_if_missing("bat")
|
|
61
|
+
install_if_missing("fd")
|
|
62
|
+
install_if_missing("rg")
|
|
63
|
+
install_if_missing("rga")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def search_file_with_context(path: str, is_temp_file: bool, edit: bool) -> str:
|
|
68
|
+
import platform
|
|
69
|
+
import base64
|
|
70
|
+
from pathlib import Path
|
|
71
|
+
abs_path = str(Path(path).absolute())
|
|
72
|
+
if platform.system() == "Linux" or platform.system() == "Darwin":
|
|
73
|
+
if edit:
|
|
74
|
+
code = """
|
|
75
|
+
res=$(nl -ba -w1 -s' ' "$TEMP_FILE" | tv \
|
|
76
|
+
--preview-command "bat --color=always --style=numbers --highlight-line {split: :0} $TEMP_FILE" \
|
|
77
|
+
--preview-size 80 \
|
|
78
|
+
--preview-offset "{split: :0}" \
|
|
79
|
+
--source-output "{}")
|
|
80
|
+
if [ -n "$res" ]; then
|
|
81
|
+
line=$(echo "$res" | cut -d' ' -f1)
|
|
82
|
+
hx "$TEMP_FILE:$line"
|
|
83
|
+
fi
|
|
84
|
+
"""
|
|
85
|
+
else:
|
|
86
|
+
code = """
|
|
87
|
+
nl -ba -w1 -s' ' "$TEMP_FILE" | tv \
|
|
88
|
+
--preview-command "bat --color=always --style=numbers --highlight-line {split: :0} $TEMP_FILE" \
|
|
89
|
+
--preview-size 80 \
|
|
90
|
+
--preview-offset "{split: :0}" \
|
|
91
|
+
--source-output "{}" \
|
|
92
|
+
| cut -d' ' -f2-
|
|
93
|
+
"""
|
|
94
|
+
code = code.replace("$TEMP_FILE", abs_path)
|
|
95
|
+
if is_temp_file:
|
|
96
|
+
code += f"\nrm {path}"
|
|
97
|
+
elif platform.system() == "Windows":
|
|
98
|
+
# Windows: avoid piping INTO `tv` (it breaks TUI interactivity on Windows terminals).
|
|
99
|
+
# Use `tv --source-command` so stdin remains attached to the console.
|
|
100
|
+
# Note: using `cmd /C type` here has proven brittle due to quoting/command-line parsing
|
|
101
|
+
# differences; generate the numbered lines via a self-contained PowerShell command.
|
|
102
|
+
abs_path_escaped = abs_path.replace("'", "''")
|
|
103
|
+
# Use `-EncodedCommand` to avoid nested quoting issues across PowerShell/tv/cmd.
|
|
104
|
+
ps_script = (
|
|
105
|
+
"$OutputEncoding = [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new(); "
|
|
106
|
+
"$i = 0; "
|
|
107
|
+
f"Get-Content -LiteralPath '{abs_path_escaped}' | ForEach-Object {{ $i = $i + 1; \"{{0}} {{1}}\" -f $i, $_ }}"
|
|
108
|
+
)
|
|
109
|
+
encoded = base64.b64encode(ps_script.encode("utf-16le")).decode("ascii")
|
|
110
|
+
source_cmd = f"powershell -NoProfile -ExecutionPolicy Bypass -EncodedCommand {encoded}"
|
|
111
|
+
source_cmd_ps_literal = source_cmd.replace("'", "''")
|
|
112
|
+
if edit:
|
|
113
|
+
code = f"""
|
|
114
|
+
$sourceCmd = '{source_cmd_ps_literal}'
|
|
115
|
+
$res = tv `
|
|
116
|
+
--source-command $sourceCmd `
|
|
117
|
+
--preview-command 'bat --color=always --style=numbers --highlight-line {{split: :0}} {abs_path}' `
|
|
118
|
+
--preview-size 80 `
|
|
119
|
+
--preview-offset "{{split: :0}}" `
|
|
120
|
+
--source-output "{{}}"
|
|
121
|
+
if ($res) {{
|
|
122
|
+
$line = $res.Split(' ')[0]
|
|
123
|
+
hx "{abs_path_escaped}:$line"
|
|
124
|
+
}}
|
|
125
|
+
"""
|
|
126
|
+
else:
|
|
127
|
+
code = f"""
|
|
128
|
+
$sourceCmd = '{source_cmd_ps_literal}'
|
|
129
|
+
tv `
|
|
130
|
+
--source-command $sourceCmd `
|
|
131
|
+
--preview-command 'bat --color=always --style=numbers --highlight-line {{split: :0}} {abs_path}' `
|
|
132
|
+
--preview-size 80 `
|
|
133
|
+
--preview-offset "{{split: :0}}" `
|
|
134
|
+
--source-output "{{}}" | ForEach-Object {{ $_ -replace '^\\d+\\s+', '' }}
|
|
135
|
+
"""
|
|
136
|
+
if is_temp_file:
|
|
137
|
+
code += f"\nRemove-Item '{abs_path_escaped}' -Force"
|
|
138
|
+
else:
|
|
139
|
+
raise RuntimeError(f"Unsupported platform, {platform.system()}")
|
|
140
|
+
return code
|
|
141
|
+
|
|
142
|
+
def _run_symantic_search(extension: str) -> None:
|
|
143
|
+
"""Run symantic search."""
|
|
144
|
+
script = ""
|
|
145
|
+
for an_ex in extension.split(","):
|
|
146
|
+
script = script + f"""\nparse *.{an_ex} """
|
|
147
|
+
from machineconfig.utils.code import run_shell_script
|
|
148
|
+
|
|
149
|
+
run_shell_script(script=script)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _run_ast_search(directory: str) -> None:
|
|
153
|
+
"""Run AST search."""
|
|
154
|
+
from machineconfig.scripts.python.helpers.helpers_search.ast_search import get_repo_symbols
|
|
155
|
+
|
|
156
|
+
symbols = get_repo_symbols(directory)
|
|
157
|
+
from machineconfig.utils.options import choose_from_options
|
|
158
|
+
|
|
159
|
+
try:
|
|
160
|
+
res = choose_from_options(options=symbols, msg="Select a symbol to search for:", tv=True, multi=False)
|
|
161
|
+
from rich import print_json
|
|
162
|
+
import json
|
|
163
|
+
|
|
164
|
+
res_json = json.dumps(res, indent=4)
|
|
165
|
+
print_json(res_json)
|
|
166
|
+
except Exception as e:
|
|
167
|
+
print(f"❌ Error during selection: {e}")
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _run_file_search(no_dotfiles: bool, edit: bool) -> None:
|
|
171
|
+
"""Run file search."""
|
|
172
|
+
import platform
|
|
173
|
+
|
|
174
|
+
if not edit:
|
|
175
|
+
script = """fzf --ansi --preview-window 'right:60%' --preview 'bat --color=always --style=numbers,grid,header --line-range :300 {}' """
|
|
176
|
+
if no_dotfiles:
|
|
177
|
+
script = "fd | " + script
|
|
178
|
+
from machineconfig.utils.code import run_shell_script
|
|
179
|
+
|
|
180
|
+
run_shell_script(script=script)
|
|
181
|
+
return
|
|
182
|
+
|
|
183
|
+
if platform.system() == "Linux" or platform.system() == "Darwin":
|
|
184
|
+
script = """
|
|
185
|
+
selected=$({SOURCE_CMD} fzf --ansi --preview-window 'right:60%' --preview 'bat --color=always --style=numbers,grid,header --line-range :300 {}')
|
|
186
|
+
if [ -n "$selected" ]; then
|
|
187
|
+
res=$(nl -ba -w1 -s' ' "$selected" | tv \
|
|
188
|
+
--preview-command "bat --color=always --style=numbers --highlight-line {split: :0} $selected" \
|
|
189
|
+
--preview-size 80 \
|
|
190
|
+
--preview-offset "{split: :0}" \
|
|
191
|
+
--source-output "{}")
|
|
192
|
+
if [ -n "$res" ]; then
|
|
193
|
+
line=$(echo "$res" | cut -d' ' -f1)
|
|
194
|
+
hx "$selected:$line"
|
|
195
|
+
fi
|
|
196
|
+
fi
|
|
197
|
+
"""
|
|
198
|
+
source_cmd = "" if not no_dotfiles else "fd | "
|
|
199
|
+
script = script.replace("{SOURCE_CMD}", source_cmd)
|
|
200
|
+
elif platform.system() == "Windows":
|
|
201
|
+
script = r"""
|
|
202
|
+
$selected = {SOURCE_CMD} fzf --ansi --preview-window 'right:60%' --preview 'bat --color=always --style=numbers,grid,header --line-range :300 {}'
|
|
203
|
+
if ($selected) {
|
|
204
|
+
$choicesPath = Join-Path $env:TEMP ("msearch_choices_" + [guid]::NewGuid().ToString() + ".txt")
|
|
205
|
+
$i = 0
|
|
206
|
+
Get-Content -LiteralPath "$selected" | ForEach-Object { $i = $i + 1; "{0} {1}" -f $i, $_ } | Set-Content -LiteralPath $choicesPath -Encoding utf8
|
|
207
|
+
$sourceCmd = 'cmd /C type "' + $choicesPath + '"'
|
|
208
|
+
$previewCmd = 'bat --color=always --style=numbers --highlight-line {split: :0} "' + $selected + '"'
|
|
209
|
+
$res = tv `
|
|
210
|
+
--source-command $sourceCmd `
|
|
211
|
+
--preview-command $previewCmd `
|
|
212
|
+
--preview-size 80 `
|
|
213
|
+
--preview-offset "{split: :0}" `
|
|
214
|
+
--source-output "{}"
|
|
215
|
+
Remove-Item -LiteralPath $choicesPath -Force -ErrorAction SilentlyContinue
|
|
216
|
+
if ($res) {
|
|
217
|
+
$line = $res.Split(' ')[0]
|
|
218
|
+
hx "$($selected):$line"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
"""
|
|
222
|
+
source_cmd = "" if not no_dotfiles else "fd | "
|
|
223
|
+
script = script.replace("{SOURCE_CMD}", source_cmd)
|
|
224
|
+
else:
|
|
225
|
+
raise RuntimeError("Unsupported platform")
|
|
226
|
+
|
|
227
|
+
from machineconfig.utils.code import run_shell_script
|
|
228
|
+
|
|
229
|
+
run_shell_script(script=script)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def _run_text_search(rga: bool, directory: Optional[str]) -> None:
|
|
233
|
+
"""Run text search using fzf with ripgrep."""
|
|
234
|
+
from machineconfig.scripts.python.helpers.helpers_msearch import FZFG_LINUX_PATH, FZFG_WINDOWS_PATH
|
|
235
|
+
import platform
|
|
236
|
+
|
|
237
|
+
if platform.system() == "Linux" or platform.system() == "Darwin":
|
|
238
|
+
script = FZFG_LINUX_PATH.read_text(encoding="utf-8")
|
|
239
|
+
elif platform.system() == "Windows":
|
|
240
|
+
script = FZFG_WINDOWS_PATH.read_text(encoding="utf-8")
|
|
241
|
+
else:
|
|
242
|
+
raise RuntimeError("Unsupported platform")
|
|
243
|
+
if rga:
|
|
244
|
+
script = script.replace("rg ", "rga ").replace("ripgrep", "ripgrep-all")
|
|
245
|
+
from machineconfig.utils.code import exit_then_run_shell_script
|
|
246
|
+
if directory:
|
|
247
|
+
script = "cd " + directory + "\n" + script
|
|
248
|
+
exit_then_run_shell_script(script=script, strict=False)
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
# fzf and ggrep with switch keys for modes
|
|
3
3
|
# https://github.com/junegunn/fzf/blob/master/ADVANCED.md#switching-between-ripgrep-mode-and-fzf-mode
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
|
|
5
7
|
# Switch between Ripgrep launcher mode (CTRL-R) and fzf filtering mode (CTRL-F)
|
|
6
8
|
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
|
|
7
|
-
INITIAL_QUERY="
|
|
9
|
+
INITIAL_QUERY=""
|
|
8
10
|
IFS=: read -ra selected < <(
|
|
9
11
|
FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \
|
|
10
12
|
fzf --ansi \
|
|
@@ -19,5 +21,4 @@ IFS=: read -ra selected < <(
|
|
|
19
21
|
--preview 'bat --color=always {1} --highlight-line {2}' \
|
|
20
22
|
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
|
|
21
23
|
)
|
|
22
|
-
[ -n "${selected[0]}" ] && hx "${selected[0]}:${selected[1]}:${selected[2]}"
|
|
23
|
-
"
|
|
24
|
+
[ -n "${selected[0]}" ] && hx "${selected[0]}:${selected[1]}:${selected[2]}"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# This script allows searching through input (stdin) using 'tv' (television)
|
|
4
|
+
# while showing the context around the matching line in the preview window.
|
|
5
|
+
#
|
|
6
|
+
# Usage: command | ./search_with_context.sh
|
|
7
|
+
# Example: hyperfine --help | ./search_with_context.sh
|
|
8
|
+
|
|
9
|
+
# set -o pipefail
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Create a temporary file to store the stdin input
|
|
13
|
+
TEMP_FILE=$(mktemp)
|
|
14
|
+
# Capture stdin to the temp file
|
|
15
|
+
cat > "$TEMP_FILE"
|
|
16
|
+
# Ensure cleanup of the temp file on exit
|
|
17
|
+
trap "rm -f $TEMP_FILE" EXIT
|
|
18
|
+
|
|
19
|
+
# Run tv with the following configuration:
|
|
20
|
+
# 1. `nl -ba -w1 -s' '`: Add line numbers to the input (e.g., "1 line content").
|
|
21
|
+
# -ba: number all lines
|
|
22
|
+
# -w1: width of line numbers (minimal)
|
|
23
|
+
# -s' ': separator is a single space
|
|
24
|
+
#
|
|
25
|
+
# 2. `tv`: The television fuzzy finder.
|
|
26
|
+
#
|
|
27
|
+
# 3. `--preview-command`: Use `bat` to show the file content.
|
|
28
|
+
# - `--color=always`: Force color output for the preview.
|
|
29
|
+
# - `--highlight-line {split: :0}`: Highlight the line number extracted from the entry.
|
|
30
|
+
# `{split: :0}` splits the entry by space (default) and takes the first field (index 0), which is the line number.
|
|
31
|
+
# - `$TEMP_FILE`: The file to preview.
|
|
32
|
+
#
|
|
33
|
+
# 4. `--preview-offset`: Scroll the preview to the matching line.
|
|
34
|
+
# - `{split: :0}`: Use the extracted line number as the offset.
|
|
35
|
+
#
|
|
36
|
+
# 5. `--source-output`: Define what `tv` outputs when an entry is selected.
|
|
37
|
+
# - `{}`: Output the full entry (including the line number).
|
|
38
|
+
#
|
|
39
|
+
# 6. `cut -d' ' -f2-`: Post-process the output to remove the line number.
|
|
40
|
+
# - `-d' '`: Delimiter is space.
|
|
41
|
+
# - `-f2-`: Keep fields from 2 onwards (dropping the line number).
|
|
42
|
+
|
|
43
|
+
nl -ba -w1 -s' ' "$TEMP_FILE" | tv \
|
|
44
|
+
--preview-command "bat --color=always --highlight-line {split: :0} $TEMP_FILE" \
|
|
45
|
+
--preview-size 80 \
|
|
46
|
+
--preview-offset "{split: :0}" \
|
|
47
|
+
--source-output "{}" \
|
|
48
|
+
| cut -d' ' -f2-
|
machineconfig/scripts/python/{helpers_msearch → helpers/helpers_msearch}/scripts_windows/fzfg.ps1
RENAMED
|
@@ -9,7 +9,7 @@ if ($null -eq $QueryTokens) {
|
|
|
9
9
|
$QueryTokens = @()
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
$initialQuery =
|
|
12
|
+
$initialQuery = ''
|
|
13
13
|
$rgPrefix = 'rg --column --line-number --no-heading --color=always --smart-case '
|
|
14
14
|
|
|
15
15
|
$escapedDefault = if ($initialQuery.Length -gt 0) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Helper modules for the devops navigator TUI application.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.data_models import CommandInfo, ArgumentInfo
|
|
6
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.command_builder import CommandBuilderScreen
|
|
7
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.command_tree import CommandTree
|
|
8
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.command_detail import CommandDetail
|
|
9
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.search_bar import SearchBar
|
|
10
|
+
from machineconfig.scripts.python.helpers.helpers_navigator.main_app import CommandNavigatorApp
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"CommandInfo",
|
|
14
|
+
"ArgumentInfo",
|
|
15
|
+
"CommandBuilderScreen",
|
|
16
|
+
"CommandTree",
|
|
17
|
+
"CommandDetail",
|
|
18
|
+
"SearchBar",
|
|
19
|
+
"CommandNavigatorApp",
|
|
20
|
+
]
|