machineconfig 1.97__py3-none-any.whl → 2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/cloud_manager.py +22 -29
- machineconfig/cluster/data_transfer.py +2 -3
- machineconfig/cluster/distribute.py +0 -2
- machineconfig/cluster/file_manager.py +4 -5
- machineconfig/cluster/job_params.py +1 -4
- machineconfig/cluster/loader_runner.py +8 -11
- machineconfig/cluster/remote_machine.py +4 -5
- machineconfig/cluster/script_execution.py +2 -2
- machineconfig/cluster/script_notify_upon_completion.py +0 -1
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +4 -6
- machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +35 -75
- machineconfig/cluster/sessions_managers/wt_local.py +113 -185
- machineconfig/cluster/sessions_managers/wt_local_manager.py +127 -197
- machineconfig/cluster/sessions_managers/wt_remote.py +60 -67
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +110 -149
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +61 -64
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +72 -172
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +27 -60
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +58 -137
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +46 -74
- machineconfig/cluster/sessions_managers/zellij_local.py +91 -147
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +165 -190
- machineconfig/cluster/sessions_managers/zellij_remote.py +51 -58
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +40 -46
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +19 -17
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +30 -31
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +64 -134
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +7 -11
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +27 -55
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +14 -13
- machineconfig/cluster/templates/cli_click.py +0 -1
- machineconfig/cluster/templates/cli_gooey.py +0 -2
- machineconfig/cluster/templates/cli_trogon.py +0 -1
- machineconfig/cluster/templates/run_cloud.py +0 -1
- machineconfig/cluster/templates/run_cluster.py +0 -1
- machineconfig/cluster/templates/run_remote.py +0 -1
- machineconfig/cluster/templates/utils.py +27 -11
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
- machineconfig/jobs/python/check_installations.py +9 -9
- machineconfig/jobs/python/create_bootable_media.py +0 -2
- machineconfig/jobs/python/python_cargo_build_share.py +2 -2
- machineconfig/jobs/python/python_ve_symlink.py +9 -11
- machineconfig/jobs/python/tasks.py +0 -1
- machineconfig/jobs/python/vscode/api.py +5 -5
- machineconfig/jobs/python/vscode/link_ve.py +20 -21
- machineconfig/jobs/python/vscode/select_interpreter.py +28 -29
- machineconfig/jobs/python/vscode/sync_code.py +14 -18
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +15 -15
- machineconfig/jobs/python_custom_installers/dev/aider.py +10 -18
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +12 -21
- machineconfig/jobs/python_custom_installers/dev/brave.py +13 -22
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +13 -20
- machineconfig/jobs/python_custom_installers/dev/code.py +17 -24
- machineconfig/jobs/python_custom_installers/dev/cursor.py +10 -21
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +12 -11
- machineconfig/jobs/python_custom_installers/dev/espanso.py +19 -23
- machineconfig/jobs/python_custom_installers/dev/goes.py +9 -16
- machineconfig/jobs/python_custom_installers/dev/lvim.py +13 -21
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +15 -22
- machineconfig/jobs/python_custom_installers/dev/redis.py +15 -23
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +15 -22
- machineconfig/jobs/python_custom_installers/dev/winget.py +32 -50
- machineconfig/jobs/python_custom_installers/docker.py +15 -24
- machineconfig/jobs/python_custom_installers/gh.py +18 -26
- machineconfig/jobs/python_custom_installers/hx.py +33 -17
- machineconfig/jobs/python_custom_installers/warp-cli.py +15 -23
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_generic_installers/config.json +412 -389
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_windows_installers/dev/config.json +1 -1
- machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
- machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
- machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
- machineconfig/jobs/windows/start_terminal.ps1 +1 -1
- machineconfig/logger.py +50 -0
- machineconfig/profile/create.py +50 -36
- machineconfig/profile/create_hardlinks.py +33 -26
- machineconfig/profile/shell.py +87 -60
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/cloud/init.sh +2 -2
- machineconfig/scripts/linux/checkout_versions +1 -1
- machineconfig/scripts/linux/choose_wezterm_theme +1 -1
- machineconfig/scripts/linux/cloud_copy +1 -1
- machineconfig/scripts/linux/cloud_manager +1 -1
- machineconfig/scripts/linux/cloud_mount +1 -1
- machineconfig/scripts/linux/cloud_repo_sync +1 -1
- machineconfig/scripts/linux/cloud_sync +1 -1
- machineconfig/scripts/linux/croshell +1 -1
- machineconfig/scripts/linux/devops +3 -5
- machineconfig/scripts/linux/fire +2 -1
- machineconfig/scripts/linux/fire_agents +3 -3
- machineconfig/scripts/linux/ftpx +1 -1
- machineconfig/scripts/linux/gh_models +1 -1
- machineconfig/scripts/linux/kill_process +1 -1
- machineconfig/scripts/linux/mcinit +2 -2
- machineconfig/scripts/linux/repos +1 -1
- machineconfig/scripts/linux/scheduler +1 -1
- machineconfig/scripts/linux/start_slidev +1 -1
- machineconfig/scripts/linux/start_terminals +1 -1
- machineconfig/scripts/linux/url2md +1 -1
- machineconfig/scripts/linux/warp-cli.sh +122 -0
- machineconfig/scripts/linux/wifi_conn +1 -1
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__init__.py +0 -0
- machineconfig/scripts/python/ai/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/generate_files.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
- machineconfig/scripts/python/ai/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
- machineconfig/scripts/python/ai/chatmodes/deepResearch.chatmode.md +81 -0
- machineconfig/scripts/python/ai/configs/.gemini/settings.json +81 -0
- machineconfig/scripts/python/ai/generate_files.py +84 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +45 -0
- machineconfig/scripts/python/ai/mcinit.py +107 -0
- machineconfig/scripts/python/ai/prompts/allLintersAndTypeCheckers.prompt.md +5 -0
- machineconfig/scripts/python/ai/prompts/research-report-skeleton.prompt.md +38 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +52 -0
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +3 -3
- machineconfig/scripts/python/choose_wezterm_theme.py +2 -2
- machineconfig/scripts/python/cloud_copy.py +20 -19
- machineconfig/scripts/python/cloud_mount.py +10 -8
- machineconfig/scripts/python/cloud_repo_sync.py +15 -15
- machineconfig/scripts/python/cloud_sync.py +1 -1
- machineconfig/scripts/python/croshell.py +18 -16
- machineconfig/scripts/python/devops.py +6 -6
- machineconfig/scripts/python/devops_add_identity.py +9 -7
- machineconfig/scripts/python/devops_add_ssh_key.py +19 -19
- machineconfig/scripts/python/devops_backup_retrieve.py +14 -14
- machineconfig/scripts/python/devops_devapps_install.py +3 -3
- machineconfig/scripts/python/devops_update_repos.py +141 -53
- machineconfig/scripts/python/dotfile.py +3 -3
- machineconfig/scripts/python/fire_agents.py +202 -41
- machineconfig/scripts/python/fire_jobs.py +20 -21
- machineconfig/scripts/python/ftpx.py +4 -3
- machineconfig/scripts/python/gh_models.py +94 -94
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/cloud_helpers.py +3 -3
- machineconfig/scripts/python/helpers/helpers2.py +3 -3
- machineconfig/scripts/python/helpers/helpers4.py +8 -7
- machineconfig/scripts/python/helpers/helpers5.py +7 -7
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +2 -2
- machineconfig/scripts/python/mount_nfs.py +4 -3
- machineconfig/scripts/python/mount_nw_drive.py +4 -4
- machineconfig/scripts/python/mount_ssh.py +4 -3
- machineconfig/scripts/python/repos.py +9 -9
- machineconfig/scripts/python/scheduler.py +1 -1
- machineconfig/scripts/python/start_slidev.py +9 -8
- machineconfig/scripts/python/start_terminals.py +1 -1
- machineconfig/scripts/python/viewer.py +40 -40
- machineconfig/scripts/python/wifi_conn.py +65 -66
- machineconfig/scripts/python/wsl_windows_transfer.py +2 -2
- machineconfig/scripts/windows/checkout_version.ps1 +1 -3
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
- machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
- machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
- machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
- machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
- machineconfig/scripts/windows/croshell.ps1 +2 -2
- machineconfig/scripts/windows/devops.ps1 +1 -4
- machineconfig/scripts/windows/dotfile.ps1 +1 -3
- machineconfig/scripts/windows/fire.ps1 +1 -1
- machineconfig/scripts/windows/ftpx.ps1 +2 -2
- machineconfig/scripts/windows/gpt.ps1 +1 -1
- machineconfig/scripts/windows/kill_process.ps1 +1 -2
- machineconfig/scripts/windows/mcinit.ps1 +2 -2
- machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
- machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/pomodoro.ps1 +1 -1
- machineconfig/scripts/windows/py2exe.ps1 +1 -3
- machineconfig/scripts/windows/repos.ps1 +1 -1
- machineconfig/scripts/windows/scheduler.ps1 +1 -1
- machineconfig/scripts/windows/snapshot.ps1 +2 -2
- machineconfig/scripts/windows/start_slidev.ps1 +1 -1
- machineconfig/scripts/windows/start_terminals.ps1 +1 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
- machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
- machineconfig/settings/lf/linux/lfrc +1 -1
- machineconfig/settings/linters/.ruff.toml +2 -2
- machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
- machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
- machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
- machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +71 -71
- machineconfig/settings/shells/wt/settings.json +8 -8
- machineconfig/settings/svim/linux/init.toml +1 -1
- machineconfig/settings/svim/windows/init.toml +1 -1
- machineconfig/setup_linux/web_shortcuts/croshell.sh +0 -54
- machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
- machineconfig/setup_linux/web_shortcuts/tmp.sh +2 -0
- machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
- machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
- machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +75 -18
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +52 -42
- machineconfig/utils/ai/browser_user_wrapper.py +5 -5
- machineconfig/utils/ai/generate_file_checklist.py +19 -22
- machineconfig/utils/ai/url2md.py +5 -3
- machineconfig/utils/cloud/onedrive/setup_oauth.py +5 -4
- machineconfig/utils/cloud/onedrive/transaction.py +192 -227
- machineconfig/utils/code.py +71 -43
- machineconfig/utils/installer.py +77 -85
- machineconfig/utils/installer_utils/installer_abc.py +29 -17
- machineconfig/utils/installer_utils/installer_class.py +188 -83
- machineconfig/utils/io_save.py +3 -15
- machineconfig/utils/links.py +22 -11
- machineconfig/utils/notifications.py +197 -0
- machineconfig/utils/options.py +38 -25
- machineconfig/utils/path.py +18 -6
- machineconfig/utils/path_reduced.py +637 -316
- machineconfig/utils/procs.py +69 -63
- machineconfig/utils/scheduling.py +11 -13
- machineconfig/utils/ssh.py +351 -0
- machineconfig/utils/terminal.py +225 -0
- machineconfig/utils/utils.py +13 -12
- machineconfig/utils/utils2.py +43 -10
- machineconfig/utils/utils5.py +242 -46
- machineconfig/utils/ve.py +11 -6
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/METADATA +15 -9
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/RECORD +232 -235
- machineconfig/cluster/self_ssh.py +0 -57
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/archive/python_tools.txt +0 -12
- machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/update.py +0 -3
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/linux/activate_ve +0 -87
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/init.py +0 -56
- machineconfig/scripts/python/ai/rules/python/dev.md +0 -31
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/windows/activate_ve.ps1 +0 -54
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/WHEEL +0 -0
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Windows Terminal layout generation utilities for creating wt command strings.
|
|
4
4
|
Based on Windows Terminal documentation: https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments
|
|
5
5
|
"""
|
|
6
|
+
|
|
6
7
|
import shlex
|
|
7
8
|
import random
|
|
8
9
|
import string
|
|
@@ -15,107 +16,104 @@ logger = logging.getLogger(__name__)
|
|
|
15
16
|
|
|
16
17
|
class WTLayoutGenerator:
|
|
17
18
|
"""Handles generation of Windows Terminal command strings for multi-tab layouts."""
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
@staticmethod
|
|
20
21
|
def generate_random_suffix(length: int = 8) -> str:
|
|
21
22
|
"""Generate a random string suffix for unique window names."""
|
|
22
|
-
return
|
|
23
|
-
|
|
23
|
+
return "".join(random.choices(string.ascii_lowercase + string.digits, k=length))
|
|
24
|
+
|
|
24
25
|
@staticmethod
|
|
25
26
|
def parse_command(command: str) -> Tuple[str, List[str]]:
|
|
26
27
|
"""Parse a command string into command and arguments."""
|
|
27
28
|
try:
|
|
28
29
|
parts = shlex.split(command)
|
|
29
|
-
if not parts:
|
|
30
|
+
if not parts:
|
|
30
31
|
raise ValueError("Empty command provided")
|
|
31
32
|
return parts[0], parts[1:] if len(parts) > 1 else []
|
|
32
33
|
except ValueError as e:
|
|
33
34
|
logger.error(f"Error parsing command '{command}': {e}")
|
|
34
35
|
parts = command.split()
|
|
35
36
|
return parts[0] if parts else "", parts[1:] if len(parts) > 1 else []
|
|
36
|
-
|
|
37
|
+
|
|
37
38
|
@staticmethod
|
|
38
39
|
def escape_for_wt(text: str) -> str:
|
|
39
40
|
"""Escape text for use in Windows Terminal commands."""
|
|
40
41
|
# Windows Terminal uses PowerShell-style escaping
|
|
41
42
|
# Escape special characters that might cause issues
|
|
42
43
|
text = text.replace('"', '""') # Escape quotes for PowerShell
|
|
43
|
-
if
|
|
44
|
+
if " " in text or ";" in text or "&" in text or "|" in text:
|
|
44
45
|
return f'"{text}"'
|
|
45
46
|
return text
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
@staticmethod
|
|
48
49
|
def create_tab_command(tab_name: str, cwd: str, command: str, is_first_tab: bool = False) -> str:
|
|
49
50
|
"""Create a Windows Terminal tab command string."""
|
|
50
51
|
cmd, args = WTLayoutGenerator.parse_command(command)
|
|
51
|
-
|
|
52
|
+
|
|
52
53
|
# Convert paths to Windows format if needed
|
|
53
|
-
if cwd.startswith(
|
|
54
|
-
cwd = cwd.replace(
|
|
55
|
-
elif cwd ==
|
|
54
|
+
if cwd.startswith("~/"):
|
|
55
|
+
cwd = cwd.replace("~/", f"{Path.home()}/")
|
|
56
|
+
elif cwd == "~":
|
|
56
57
|
cwd = str(Path.home())
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
# Build the wt command parts
|
|
59
60
|
tab_parts = []
|
|
60
|
-
|
|
61
|
+
|
|
61
62
|
if not is_first_tab:
|
|
62
63
|
tab_parts.append("new-tab")
|
|
63
|
-
|
|
64
|
+
|
|
64
65
|
# Add profile if specified (could be extended to support different shells)
|
|
65
66
|
# tab_parts.extend(["-p", "\"Command Prompt\""]) # or "PowerShell", "WSL", etc.
|
|
66
|
-
|
|
67
|
+
|
|
67
68
|
# Add starting directory
|
|
68
69
|
tab_parts.extend(["-d", WTLayoutGenerator.escape_for_wt(cwd)])
|
|
69
|
-
|
|
70
|
+
|
|
70
71
|
# Add tab title
|
|
71
72
|
tab_parts.extend(["--title", WTLayoutGenerator.escape_for_wt(tab_name)])
|
|
72
|
-
|
|
73
|
+
|
|
73
74
|
# Add the command to execute
|
|
74
75
|
full_command = command if not args else f"{cmd} {' '.join(args)}"
|
|
75
76
|
tab_parts.append(WTLayoutGenerator.escape_for_wt(full_command))
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
return " ".join(tab_parts)
|
|
78
|
-
|
|
79
|
+
|
|
79
80
|
@staticmethod
|
|
80
81
|
def validate_tab_config(tab_config: Dict[str, Tuple[str, str]]) -> None:
|
|
81
82
|
"""Validate tab configuration format and content."""
|
|
82
|
-
if not tab_config:
|
|
83
|
+
if not tab_config:
|
|
83
84
|
raise ValueError("Tab configuration cannot be empty")
|
|
84
85
|
for tab_name, (cwd, command) in tab_config.items():
|
|
85
|
-
if not tab_name.strip():
|
|
86
|
+
if not tab_name.strip():
|
|
86
87
|
raise ValueError(f"Invalid tab name: {tab_name}")
|
|
87
|
-
if not command.strip():
|
|
88
|
+
if not command.strip():
|
|
88
89
|
raise ValueError(f"Invalid command for tab '{tab_name}': {command}")
|
|
89
|
-
if not cwd.strip():
|
|
90
|
+
if not cwd.strip():
|
|
90
91
|
raise ValueError(f"Invalid cwd for tab '{tab_name}': {cwd}")
|
|
91
|
-
|
|
92
|
-
def generate_wt_command(self, tab_config: Dict[str, Tuple[str, str]],
|
|
93
|
-
window_name: str | None = None,
|
|
94
|
-
maximized: bool = False,
|
|
95
|
-
focus: bool = True) -> str:
|
|
92
|
+
|
|
93
|
+
def generate_wt_command(self, tab_config: Dict[str, Tuple[str, str]], window_name: str | None = None, maximized: bool = False, focus: bool = True) -> str:
|
|
96
94
|
"""Generate complete Windows Terminal command string."""
|
|
97
95
|
self.validate_tab_config(tab_config)
|
|
98
|
-
|
|
96
|
+
|
|
99
97
|
# Start building the wt command
|
|
100
98
|
wt_parts = ["wt"]
|
|
101
|
-
|
|
99
|
+
|
|
102
100
|
# Add window options
|
|
103
101
|
if maximized:
|
|
104
102
|
wt_parts.append("--maximized")
|
|
105
|
-
|
|
103
|
+
|
|
106
104
|
if focus:
|
|
107
105
|
wt_parts.append("--focus")
|
|
108
|
-
|
|
106
|
+
|
|
109
107
|
if window_name:
|
|
110
108
|
wt_parts.extend(["-w", WTLayoutGenerator.escape_for_wt(window_name)])
|
|
111
|
-
|
|
109
|
+
|
|
112
110
|
# Add tabs
|
|
113
111
|
tab_commands = []
|
|
114
112
|
for i, (tab_name, (cwd, command)) in enumerate(tab_config.items()):
|
|
115
113
|
is_first = i == 0
|
|
116
114
|
tab_cmd = self.create_tab_command(tab_name, cwd, command, is_first)
|
|
117
115
|
tab_commands.append(tab_cmd)
|
|
118
|
-
|
|
116
|
+
|
|
119
117
|
# Join all parts with semicolons (Windows Terminal command separator)
|
|
120
118
|
if tab_commands:
|
|
121
119
|
if len(tab_commands) == 1:
|
|
@@ -126,65 +124,64 @@ class WTLayoutGenerator:
|
|
|
126
124
|
wt_parts.append(tab_commands[0]) # First tab
|
|
127
125
|
for tab_cmd in tab_commands[1:]:
|
|
128
126
|
wt_parts.extend([";", tab_cmd])
|
|
129
|
-
|
|
127
|
+
|
|
130
128
|
return " ".join(wt_parts)
|
|
131
|
-
|
|
132
|
-
def create_wt_script(self, tab_config: Dict[str, Tuple[str, str]],
|
|
133
|
-
output_dir: Path, session_name: str,
|
|
134
|
-
window_name: str | None = None) -> str:
|
|
129
|
+
|
|
130
|
+
def create_wt_script(self, tab_config: Dict[str, Tuple[str, str]], output_dir: Path, session_name: str, window_name: str | None = None) -> str:
|
|
135
131
|
"""Create a Windows Terminal script file and return its absolute path."""
|
|
136
132
|
self.validate_tab_config(tab_config)
|
|
137
|
-
|
|
133
|
+
|
|
138
134
|
# Generate unique suffix for this script
|
|
139
135
|
random_suffix = self.generate_random_suffix()
|
|
140
136
|
wt_command = self.generate_wt_command(tab_config, window_name or session_name)
|
|
141
|
-
|
|
137
|
+
|
|
142
138
|
try:
|
|
143
139
|
# Create output directory if it doesn't exist
|
|
144
140
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
145
|
-
|
|
141
|
+
|
|
146
142
|
# Create both .bat and .ps1 versions for flexibility
|
|
147
143
|
bat_file = output_dir / f"wt_layout_{session_name}_{random_suffix}.bat"
|
|
148
144
|
ps1_file = output_dir / f"wt_layout_{session_name}_{random_suffix}.ps1"
|
|
149
|
-
|
|
145
|
+
|
|
150
146
|
# Create batch file
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
text = f"""@echo off
|
|
148
|
+
REM Windows Terminal layout for {session_name}
|
|
149
|
+
{wt_command}
|
|
150
|
+
"""
|
|
151
|
+
bat_file.write_text(text, encoding="utf-8")
|
|
152
|
+
|
|
156
153
|
# Create PowerShell file (better for complex commands)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
text = f"""# Windows Terminal layout for {session_name}
|
|
155
|
+
# Generated on {random_suffix}
|
|
156
|
+
{wt_command}
|
|
157
|
+
"""
|
|
158
|
+
ps1_file.write_text(text, encoding="utf-8")
|
|
159
|
+
|
|
162
160
|
logger.info(f"Windows Terminal script files created: {bat_file.absolute()}")
|
|
163
161
|
return str(bat_file.absolute())
|
|
164
|
-
|
|
162
|
+
|
|
165
163
|
except OSError as e:
|
|
166
164
|
logger.error(f"Failed to create script file: {e}")
|
|
167
165
|
raise
|
|
168
|
-
|
|
169
|
-
def generate_split_pane_command(self, tab_config: Dict[str, Tuple[str, str]],
|
|
170
|
-
window_name: str | None = None) -> str:
|
|
166
|
+
|
|
167
|
+
def generate_split_pane_command(self, tab_config: Dict[str, Tuple[str, str]], window_name: str | None = None) -> str:
|
|
171
168
|
"""Generate Windows Terminal command with split panes instead of separate tabs."""
|
|
172
169
|
self.validate_tab_config(tab_config)
|
|
173
|
-
|
|
170
|
+
|
|
174
171
|
wt_parts = ["wt"]
|
|
175
|
-
|
|
172
|
+
|
|
176
173
|
if window_name:
|
|
177
174
|
wt_parts.extend(["-w", WTLayoutGenerator.escape_for_wt(window_name)])
|
|
178
|
-
|
|
175
|
+
|
|
179
176
|
# First pane (main tab)
|
|
180
177
|
first_tab = list(tab_config.items())[0]
|
|
181
178
|
tab_name, (cwd, command) = first_tab
|
|
182
|
-
|
|
179
|
+
|
|
183
180
|
# Start with first tab
|
|
184
181
|
wt_parts.extend(["-d", WTLayoutGenerator.escape_for_wt(cwd)])
|
|
185
182
|
wt_parts.extend(["--title", WTLayoutGenerator.escape_for_wt(tab_name)])
|
|
186
183
|
wt_parts.append(WTLayoutGenerator.escape_for_wt(command))
|
|
187
|
-
|
|
184
|
+
|
|
188
185
|
# Add split panes for remaining tabs
|
|
189
186
|
for tab_name, (cwd, command) in list(tab_config.items())[1:]:
|
|
190
187
|
wt_parts.append(";")
|
|
@@ -192,5 +189,5 @@ class WTLayoutGenerator:
|
|
|
192
189
|
wt_parts.extend(["-d", WTLayoutGenerator.escape_for_wt(cwd)])
|
|
193
190
|
wt_parts.extend(["--title", WTLayoutGenerator.escape_for_wt(tab_name)])
|
|
194
191
|
wt_parts.append(WTLayoutGenerator.escape_for_wt(command))
|
|
195
|
-
|
|
196
|
-
return " ".join(wt_parts)
|
|
192
|
+
|
|
193
|
+
return " ".join(wt_parts)
|