machineconfig 5.30__py3-none-any.whl → 5.32__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/scripts/linux/{wifi_conn → cloud} +1 -1
- machineconfig/scripts/python/agents.py +6 -0
- machineconfig/scripts/python/ai/initai.py +0 -9
- machineconfig/scripts/python/cloud.py +12 -0
- machineconfig/scripts/python/{cloud_copy.py → cloud_helpers/cloud_copy.py} +3 -3
- machineconfig/scripts/python/{cloud_sync.py → cloud_helpers/cloud_sync.py} +3 -10
- machineconfig/scripts/python/{helpers → cloud_helpers}/helpers2.py +1 -1
- machineconfig/scripts/python/croshell_helpers/__init__.py +0 -0
- machineconfig/scripts/python/devops.py +13 -122
- machineconfig/scripts/python/devops_helpers/cli_config.py +43 -0
- machineconfig/scripts/python/devops_helpers/cli_data.py +18 -0
- machineconfig/scripts/python/devops_helpers/cli_nw.py +39 -0
- machineconfig/scripts/python/{repos.py → devops_helpers/cli_repos.py} +52 -16
- machineconfig/scripts/python/devops_helpers/cli_self.py +41 -0
- machineconfig/scripts/python/devops_helpers/devops_backup_retrieve.py +1 -1
- machineconfig/scripts/python/devops_helpers/devops_update_repos.py +1 -1
- machineconfig/scripts/python/devops_navigator.py +806 -0
- machineconfig/scripts/python/fire_jobs.py +2 -2
- machineconfig/scripts/python/ftpx.py +1 -1
- machineconfig/scripts/python/helpers_fire_command/fire_jobs_route_helper.py +1 -1
- machineconfig/scripts/python/helpers_repos/__init__.py +0 -0
- machineconfig/scripts/python/{secure_repo.py → helpers_repos/secure_repo.py} +1 -1
- machineconfig/scripts/python/interactive.py +2 -2
- machineconfig/scripts/python/nw/__init__.py +0 -0
- machineconfig/scripts/python/repos_helpers/{repos_helper_action.py → action.py} +1 -1
- machineconfig/scripts/python/repos_helpers/{repos_helper.py → entrypoint.py} +2 -2
- machineconfig/scripts/python/{helpers/repo_sync_helpers.py → repos_helpers/sync.py} +0 -20
- machineconfig/scripts/python/sessions.py +2 -2
- machineconfig/scripts/python/sessions_helpers/__init__.py +0 -0
- machineconfig/scripts/python/{sessions_multiprocess.py → sessions_helpers/sessions_multiprocess.py} +1 -1
- machineconfig/scripts/windows/{initai.ps1 → cloud.ps1} +1 -1
- machineconfig/utils/code.py +13 -3
- {machineconfig-5.30.dist-info → machineconfig-5.32.dist-info}/METADATA +1 -1
- {machineconfig-5.30.dist-info → machineconfig-5.32.dist-info}/RECORD +65 -72
- machineconfig-5.32.dist-info/entry_points.txt +9 -0
- machineconfig/scripts/linux/choose_wezterm_theme +0 -3
- machineconfig/scripts/linux/cloud_copy +0 -2
- machineconfig/scripts/linux/cloud_mount +0 -2
- machineconfig/scripts/linux/cloud_sync +0 -2
- machineconfig/scripts/linux/gh_models +0 -2
- machineconfig/scripts/linux/initai +0 -2
- machineconfig/scripts/linux/scheduler +0 -2
- machineconfig/scripts/linux/start_slidev +0 -2
- machineconfig/scripts/python/gh_models.py +0 -104
- machineconfig/scripts/python/helpers_fire/fire_q.py +0 -19
- machineconfig/scripts/python/snapshot.py +0 -25
- machineconfig/scripts/python/start_terminals.py +0 -121
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +0 -1
- machineconfig/scripts/windows/cloud_copy.ps1 +0 -1
- machineconfig/scripts/windows/cloud_mount.ps1 +0 -1
- machineconfig/scripts/windows/cloud_sync.ps1 +0 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +0 -2
- machineconfig-5.30.dist-info/entry_points.txt +0 -17
- /machineconfig/scripts/python/{helpers → cloud_helpers}/__init__.py +0 -0
- /machineconfig/scripts/python/{helpers → cloud_helpers}/cloud_helpers.py +0 -0
- /machineconfig/scripts/python/{cloud_mount.py → cloud_helpers/cloud_mount.py} +0 -0
- /machineconfig/scripts/python/{helpers → cloud_helpers}/helpers5.py +0 -0
- /machineconfig/scripts/python/{pomodoro.py → croshell_helpers/pomodoro.py} +0 -0
- /machineconfig/scripts/python/{scheduler.py → croshell_helpers/scheduler.py} +0 -0
- /machineconfig/scripts/python/{start_slidev.py → croshell_helpers/start_slidev.py} +0 -0
- /machineconfig/scripts/python/{viewer.py → croshell_helpers/viewer.py} +0 -0
- /machineconfig/scripts/python/{viewer_template.py → croshell_helpers/viewer_template.py} +0 -0
- /machineconfig/scripts/{windows/select_pwsh_theme.ps1 → python/devops_helpers/choose_pwsh_theme.ps1} +0 -0
- /machineconfig/scripts/python/{choose_wezterm_theme.py → devops_helpers/choose_wezterm_theme.py} +0 -0
- /machineconfig/scripts/python/{dotfile.py → devops_helpers/cli_config_dotfile.py} +0 -0
- /machineconfig/scripts/python/{share_terminal.py → devops_helpers/cli_terminal.py} +0 -0
- /machineconfig/scripts/python/{helpers → helpers_fire}/helpers4.py +0 -0
- /machineconfig/scripts/python/{cloud_repo_sync.py → helpers_repos/cloud_repo_sync.py} +0 -0
- /machineconfig/scripts/{linux → python/nw}/mount_drive +0 -0
- /machineconfig/scripts/{linux → python/nw}/mount_nfs +0 -0
- /machineconfig/scripts/python/{mount_nfs.py → nw/mount_nfs.py} +0 -0
- /machineconfig/scripts/{linux → python/nw}/mount_nw_drive +0 -0
- /machineconfig/scripts/python/{mount_nw_drive.py → nw/mount_nw_drive.py} +0 -0
- /machineconfig/scripts/{linux → python/nw}/mount_smb +0 -0
- /machineconfig/scripts/python/{mount_ssh.py → nw/mount_ssh.py} +0 -0
- /machineconfig/scripts/python/{onetimeshare.py → nw/onetimeshare.py} +0 -0
- /machineconfig/scripts/python/{wifi_conn.py → nw/wifi_conn.py} +0 -0
- /machineconfig/scripts/python/{wsl_windows_transfer.py → nw/wsl_windows_transfer.py} +0 -0
- /machineconfig/scripts/python/repos_helpers/{repos_helper_clone.py → clone.py} +0 -0
- /machineconfig/scripts/python/repos_helpers/{repos_helper_record.py → record.py} +0 -0
- /machineconfig/scripts/python/repos_helpers/{repos_helper_update.py → update.py} +0 -0
- {machineconfig-5.30.dist-info → machineconfig-5.32.dist-info}/WHEEL +0 -0
- {machineconfig-5.30.dist-info → machineconfig-5.32.dist-info}/top_level.txt +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
uv run --python 3.13 --no-dev --project $HOME/code/machineconfig
|
|
2
|
+
uv run --python 3.13 --no-dev --project $HOME/code/machineconfig cloud $@
|
|
@@ -184,12 +184,18 @@ def template():
|
|
|
184
184
|
typer.echo(f"Template bash script written to {save_path}")
|
|
185
185
|
|
|
186
186
|
|
|
187
|
+
def init_config():
|
|
188
|
+
from machineconfig.scripts.python.ai.initai import add_ai_configs
|
|
189
|
+
add_ai_configs(repo_root=Path.cwd())
|
|
190
|
+
|
|
191
|
+
|
|
187
192
|
def main_from_parser():
|
|
188
193
|
import sys
|
|
189
194
|
agents_app = typer.Typer(help="🤖 AI Agents management subcommands")
|
|
190
195
|
agents_app.command("create", no_args_is_help=True)(create)
|
|
191
196
|
agents_app.command("collect", no_args_is_help=True)(collect)
|
|
192
197
|
agents_app.command("create-template", no_args_is_help=False, help="Create a template for fire agents")(template)
|
|
198
|
+
agents_app.command("init-config", no_args_is_help=False, help="Initialize AI configurations in the current repository")(init_config)
|
|
193
199
|
if len(sys.argv) == 1:
|
|
194
200
|
agents_app(["--help"])
|
|
195
201
|
else:
|
|
@@ -47,12 +47,3 @@ uv add --upgrade-package pytest --dev
|
|
|
47
47
|
crush.build_configuration(repo_root=repo_root)
|
|
48
48
|
cline.build_configuration(repo_root=repo_root)
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def main() -> None:
|
|
53
|
-
repo_root = Path.cwd()
|
|
54
|
-
add_ai_configs(repo_root=repo_root)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if __name__ == "__main__":
|
|
58
|
-
add_ai_configs(repo_root=Path.cwd())
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import typer
|
|
3
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_sync import main
|
|
4
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_copy import main as copy_main
|
|
5
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_mount import main as mount_main
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
app = typer.Typer(add_completion=False, no_args_is_help=True)
|
|
9
|
+
app.command(name="sync", no_args_is_help=True, help="""🔄 Synchronize files/folders between local and cloud storage.""")(main)
|
|
10
|
+
app.command(name="copy", no_args_is_help=True, short_help="""📤 Upload or 📥 Download files/folders to/from cloud storage services like Google Drive, Dropbox, OneDrive, etc.""")(copy_main)
|
|
11
|
+
app.command(name="mount", no_args_is_help=True, short_help="""🔗 Mount cloud storage services like Google Drive, Dropbox, OneDrive, etc. as local drives.""")(mount_main)
|
|
12
|
+
|
|
@@ -10,8 +10,8 @@ from typing import Optional, Annotated
|
|
|
10
10
|
|
|
11
11
|
import typer
|
|
12
12
|
|
|
13
|
-
from machineconfig.scripts.python.
|
|
14
|
-
from machineconfig.scripts.python.
|
|
13
|
+
from machineconfig.scripts.python.cloud_helpers.helpers2 import parse_cloud_source_target
|
|
14
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_helpers import ArgsDefaults, Args
|
|
15
15
|
from rich.console import Console
|
|
16
16
|
from rich.panel import Panel
|
|
17
17
|
from rich.progress import Progress
|
|
@@ -76,8 +76,8 @@ def main(
|
|
|
76
76
|
os_specific: Annotated[bool, typer.Option(help="💻 choose path specific for this OS.")] = ArgsDefaults.os_specific,
|
|
77
77
|
config: Annotated[Optional[str], typer.Option(help="⚙️ path to cloud.json file.")] = None,
|
|
78
78
|
) -> None:
|
|
79
|
+
"""📤 Upload or 📥 Download files/folders to/from cloud storage services like Google Drive, Dropbox, OneDrive, etc."""
|
|
79
80
|
console.print(Panel("☁️ Cloud Copy Utility", title="[bold blue]Cloud Copy[/bold blue]", border_style="blue", width=152))
|
|
80
|
-
|
|
81
81
|
args_obj = Args(
|
|
82
82
|
overwrite=overwrite,
|
|
83
83
|
share=share,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
TODO: use typer or typed-argument-parser to parse args
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from machineconfig.scripts.python.
|
|
6
|
-
from machineconfig.scripts.python.
|
|
7
|
-
from machineconfig.scripts.python.cloud_mount import get_mprocs_mount_txt
|
|
5
|
+
from machineconfig.scripts.python.cloud_helpers.helpers2 import parse_cloud_source_target
|
|
6
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_helpers import Args
|
|
7
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_mount import get_mprocs_mount_txt
|
|
8
8
|
|
|
9
9
|
from typing import Annotated, Optional
|
|
10
10
|
import typer
|
|
@@ -78,10 +78,3 @@ def main(
|
|
|
78
78
|
|
|
79
79
|
subprocess.run(txt, shell=True, check=True)
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
def arg_parser() -> None:
|
|
83
|
-
typer.run(main)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if __name__ == "__main__":
|
|
87
|
-
arg_parser()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from machineconfig.scripts.python.
|
|
1
|
+
from machineconfig.scripts.python.cloud_helpers.cloud_helpers import Args, ArgsDefaults, absolute, find_cloud_config, get_secure_share_cloud_config
|
|
2
2
|
from machineconfig.utils.io import read_ini
|
|
3
3
|
from machineconfig.utils.source_of_truth import DEFAULTS_PATH
|
|
4
4
|
from machineconfig.utils.accessories import pprint
|
|
File without changes
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"""devops with emojis"""
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Optional
|
|
5
5
|
|
|
6
|
-
import machineconfig.scripts.python.
|
|
7
|
-
import machineconfig.scripts.python.
|
|
6
|
+
import machineconfig.scripts.python.devops_helpers.cli_repos as cli_repos
|
|
7
|
+
import machineconfig.scripts.python.devops_helpers.cli_config as cli_config
|
|
8
|
+
from machineconfig.scripts.python.devops_helpers.cli_self import self_app
|
|
9
|
+
import machineconfig.scripts.python.devops_helpers.cli_data as cli_data
|
|
10
|
+
import machineconfig.scripts.python.devops_helpers.cli_nw as cli_network
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
|
|
13
|
+
app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True, add_completion=True)
|
|
10
14
|
@app.command(no_args_is_help=True)
|
|
11
|
-
def install(
|
|
15
|
+
def install( which: Optional[str] = typer.Option(None, "--which", "-w", help="Comma-separated list of program names to install."),
|
|
12
16
|
group: Optional[str] = typer.Option(None, "--group", "-g", help="Groups names. A group is bundle of apps. See available groups when running interactively."),
|
|
13
17
|
interactive: bool = typer.Option(False, "--interactive", "-ia", help="Interactive selection of programs to install."),
|
|
14
18
|
) -> None:
|
|
@@ -17,126 +21,13 @@ def install( which: Optional[str] = typer.Option(None, "--which", "-w", help=
|
|
|
17
21
|
installer_entry_point.main(which=which, group=group, interactive=interactive)
|
|
18
22
|
|
|
19
23
|
|
|
20
|
-
app.add_typer(
|
|
21
|
-
config_apps =
|
|
22
|
-
app.add_typer(
|
|
23
|
-
app_data = typer.Typer(help="💾 Data subcommands", no_args_is_help=True)
|
|
24
|
-
app.add_typer(app_data, name="data")
|
|
25
|
-
nw_apps = typer.Typer(help="🔐 Network subcommands", no_args_is_help=True)
|
|
26
|
-
nw_apps.command(name="share-terminal", help="📡 Share terminal via web browser")(share_terminal.main)
|
|
27
|
-
app.add_typer(nw_apps, name="network")
|
|
28
|
-
self_app = typer.Typer(help="🔄 SELF operations subcommands", no_args_is_help=True)
|
|
24
|
+
app.add_typer(cli_repos.app, name="repos", help="📁 Manage git repositories")
|
|
25
|
+
app.add_typer(cli_config.config_apps, name="config")
|
|
26
|
+
app.add_typer(cli_data.app_data, name="data")
|
|
29
27
|
app.add_typer(self_app, name="self")
|
|
30
|
-
|
|
31
|
-
@self_app.command()
|
|
32
|
-
def update():
|
|
33
|
-
"""🔄 UPDATE essential repos"""
|
|
34
|
-
import machineconfig.scripts.python.devops_helpers.devops_update_repos as helper
|
|
35
|
-
helper.main()
|
|
36
|
-
@self_app.command()
|
|
37
|
-
def interactive():
|
|
38
|
-
"""🤖 INTERACTIVE configuration of machine."""
|
|
39
|
-
from machineconfig.scripts.python.interactive import main
|
|
40
|
-
main()
|
|
41
|
-
@self_app.command()
|
|
42
|
-
def status():
|
|
43
|
-
"""📊 STATUS of machine, shell profile, apps, symlinks, dotfiles, etc."""
|
|
44
|
-
import machineconfig.scripts.python.devops_helpers.devops_status as helper
|
|
45
|
-
helper.main()
|
|
46
|
-
@self_app.command()
|
|
47
|
-
def clone():
|
|
48
|
-
"""📋 CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates."""
|
|
49
|
-
import platform
|
|
50
|
-
from machineconfig.utils.code import run_shell_script
|
|
51
|
-
from machineconfig.profile.shell import create_default_shell_profile
|
|
52
|
-
if platform.system() == "Windows":
|
|
53
|
-
from machineconfig.setup_windows import MACHINECONFIG
|
|
54
|
-
create_default_shell_profile(method="copy")
|
|
55
|
-
else:
|
|
56
|
-
from machineconfig.setup_linux import MACHINECONFIG
|
|
57
|
-
create_default_shell_profile(method="reference")
|
|
58
|
-
run_shell_script(MACHINECONFIG.read_text(encoding="utf-8"))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@config_apps.command(no_args_is_help=True)
|
|
63
|
-
def private(method: Literal["symlink", "copy"] = typer.Option(..., "--method", "-m", help="Method to use for linking files"),
|
|
64
|
-
on_conflict: Literal["throwError", "overwriteSelfManaged", "backupSelfManaged", "overwriteDefaultPath", "backupDefaultPath"] = typer.Option("throwError", "--on-conflict", "-o", help="Action to take on conflict"),
|
|
65
|
-
which: Optional[str] = typer.Option(None, "--which", "-w", help="Specific items to process"),
|
|
66
|
-
interactive: bool = typer.Option(False, "--interactive", "-ia", help="Run in interactive mode")):
|
|
67
|
-
"""🔗 Manage private configuration files."""
|
|
68
|
-
import machineconfig.profile.create_frontend as create_frontend
|
|
69
|
-
create_frontend.main_private_from_parser(method=method, on_conflict=on_conflict, which=which, interactive=interactive)
|
|
70
|
-
|
|
71
|
-
@config_apps.command(no_args_is_help=True)
|
|
72
|
-
def public(method: Literal["symlink", "copy"] = typer.Option(..., "--method", "-m", help="Method to use for setting up the config file."),
|
|
73
|
-
on_conflict: Literal["throwError", "overwriteDefaultPath", "backupDefaultPath"] = typer.Option("throwError", "--on-conflict", "-o", help="Action to take on conflict"),
|
|
74
|
-
which: Optional[str] = typer.Option(None, "--which", "-w", help="Specific items to process"),
|
|
75
|
-
interactive: bool = typer.Option(False, "--interactive", "-ia", help="Run in interactive mode")):
|
|
76
|
-
"""🔗 Manage public configuration files."""
|
|
77
|
-
import machineconfig.profile.create_frontend as create_frontend
|
|
78
|
-
create_frontend.main_public_from_parser(method=method, on_conflict=on_conflict, which=which, interactive=interactive)
|
|
79
|
-
|
|
80
|
-
@config_apps.command(no_args_is_help=True)
|
|
81
|
-
def dotfile(file: Annotated[str, typer.Argument(help="file/folder path.")],
|
|
82
|
-
overwrite: Annotated[bool, typer.Option("--overwrite", "-o", help="Overwrite.")] = False,
|
|
83
|
-
dest: Annotated[str, typer.Option("--dest", "-d", help="destination folder")] = "",
|
|
84
|
-
):
|
|
85
|
-
"""🔗 Manage dotfiles."""
|
|
86
|
-
import machineconfig.scripts.python.dotfile as dotfile_module
|
|
87
|
-
dotfile_module.main(file=file, overwrite=overwrite, dest=dest)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@config_apps.command(no_args_is_help=True)
|
|
91
|
-
def shell(method: Annotated[Literal["copy", "reference"], typer.Argument(help="Choose the method to configure the shell profile: 'copy' copies the init script directly, 'reference' references machineconfig for dynamic updates.")]):
|
|
92
|
-
"""🔗 Configure your shell profile."""
|
|
93
|
-
from machineconfig.profile.shell import create_default_shell_profile
|
|
94
|
-
create_default_shell_profile(method=method)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
@nw_apps.command()
|
|
98
|
-
def add_key():
|
|
99
|
-
"""🔑 SSH add pub key to this machine"""
|
|
100
|
-
import machineconfig.scripts.python.devops_helpers.devops_add_ssh_key as helper
|
|
101
|
-
helper.main()
|
|
102
|
-
@nw_apps.command()
|
|
103
|
-
def add_identity():
|
|
104
|
-
"""🗝️ SSH add identity (private key) to this machine"""
|
|
105
|
-
import machineconfig.scripts.python.devops_helpers.devops_add_identity as helper
|
|
106
|
-
helper.main()
|
|
107
|
-
@nw_apps.command()
|
|
108
|
-
def connect():
|
|
109
|
-
"""🔐 SSH use key pair to connect two machines"""
|
|
110
|
-
raise NotImplementedError
|
|
111
|
-
|
|
112
|
-
@nw_apps.command()
|
|
113
|
-
def setup():
|
|
114
|
-
"""📡 SSH setup"""
|
|
115
|
-
import platform
|
|
116
|
-
if platform.system() == "Windows":
|
|
117
|
-
from machineconfig.setup_windows import SSH_SERVER
|
|
118
|
-
program = SSH_SERVER.read_text(encoding="utf-8")
|
|
119
|
-
elif platform.system() == "Linux" or platform.system() == "Darwin":
|
|
120
|
-
from machineconfig.setup_linux import SSH_SERVER
|
|
121
|
-
program = SSH_SERVER.read_text(encoding="utf-8")
|
|
122
|
-
else:
|
|
123
|
-
raise NotImplementedError(f"Platform {platform.system()} is not supported.")
|
|
124
|
-
from machineconfig.utils.code import run_shell_script
|
|
125
|
-
run_shell_script(script=program)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
@app_data.command()
|
|
129
|
-
def backup():
|
|
130
|
-
"""💾 BACKUP"""
|
|
131
|
-
from machineconfig.scripts.python.devops_helpers.devops_backup_retrieve import main_backup_retrieve
|
|
132
|
-
main_backup_retrieve(direction="BACKUP")
|
|
28
|
+
app.add_typer(cli_network.nw_apps, name="network")
|
|
133
29
|
|
|
134
30
|
|
|
135
|
-
@app_data.command()
|
|
136
|
-
def retrieve():
|
|
137
|
-
"""📥 RETRIEVE"""
|
|
138
|
-
from machineconfig.scripts.python.devops_helpers.devops_backup_retrieve import main_backup_retrieve
|
|
139
|
-
main_backup_retrieve(direction="RETRIEVE")
|
|
140
31
|
|
|
141
32
|
|
|
142
33
|
# @app.command()
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from typing import Literal, Annotated, Optional
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
config_apps = typer.Typer(help="⚙️ Configuration subcommands", no_args_is_help=True)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@config_apps.command(no_args_is_help=True)
|
|
11
|
+
def private(method: Literal["symlink", "copy"] = typer.Option(..., "--method", "-m", help="Method to use for linking files"),
|
|
12
|
+
on_conflict: Literal["throwError", "overwriteSelfManaged", "backupSelfManaged", "overwriteDefaultPath", "backupDefaultPath"] = typer.Option("throwError", "--on-conflict", "-o", help="Action to take on conflict"),
|
|
13
|
+
which: Optional[str] = typer.Option(None, "--which", "-w", help="Specific items to process"),
|
|
14
|
+
interactive: bool = typer.Option(False, "--interactive", "-ia", help="Run in interactive mode")):
|
|
15
|
+
"""🔗 Manage private configuration files."""
|
|
16
|
+
import machineconfig.profile.create_frontend as create_frontend
|
|
17
|
+
create_frontend.main_private_from_parser(method=method, on_conflict=on_conflict, which=which, interactive=interactive)
|
|
18
|
+
|
|
19
|
+
@config_apps.command(no_args_is_help=True)
|
|
20
|
+
def public(method: Literal["symlink", "copy"] = typer.Option(..., "--method", "-m", help="Method to use for setting up the config file."),
|
|
21
|
+
on_conflict: Literal["throwError", "overwriteDefaultPath", "backupDefaultPath"] = typer.Option("throwError", "--on-conflict", "-o", help="Action to take on conflict"),
|
|
22
|
+
which: Optional[str] = typer.Option(None, "--which", "-w", help="Specific items to process"),
|
|
23
|
+
interactive: bool = typer.Option(False, "--interactive", "-ia", help="Run in interactive mode")):
|
|
24
|
+
"""🔗 Manage public configuration files."""
|
|
25
|
+
import machineconfig.profile.create_frontend as create_frontend
|
|
26
|
+
create_frontend.main_public_from_parser(method=method, on_conflict=on_conflict, which=which, interactive=interactive)
|
|
27
|
+
|
|
28
|
+
@config_apps.command(no_args_is_help=True)
|
|
29
|
+
def dotfile(file: Annotated[str, typer.Argument(help="file/folder path.")],
|
|
30
|
+
overwrite: Annotated[bool, typer.Option("--overwrite", "-o", help="Overwrite.")] = False,
|
|
31
|
+
dest: Annotated[str, typer.Option("--dest", "-d", help="destination folder")] = "",
|
|
32
|
+
):
|
|
33
|
+
"""🔗 Manage dotfiles."""
|
|
34
|
+
import machineconfig.scripts.python.devops_helpers.cli_config_dotfile as dotfile_module
|
|
35
|
+
dotfile_module.main(file=file, overwrite=overwrite, dest=dest)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@config_apps.command(no_args_is_help=True)
|
|
39
|
+
def shell(method: Annotated[Literal["copy", "reference"], typer.Argument(help="Choose the method to configure the shell profile: 'copy' copies the init script directly, 'reference' references machineconfig for dynamic updates.")]):
|
|
40
|
+
"""🔗 Configure your shell profile."""
|
|
41
|
+
from machineconfig.profile.shell import create_default_shell_profile
|
|
42
|
+
create_default_shell_profile(method=method)
|
|
43
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import typer
|
|
3
|
+
|
|
4
|
+
app_data = typer.Typer(help="💾 Data subcommands", no_args_is_help=True)
|
|
5
|
+
|
|
6
|
+
@app_data.command()
|
|
7
|
+
def backup():
|
|
8
|
+
"""💾 BACKUP"""
|
|
9
|
+
from machineconfig.scripts.python.devops_helpers.devops_backup_retrieve import main_backup_retrieve
|
|
10
|
+
main_backup_retrieve(direction="BACKUP")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@app_data.command()
|
|
14
|
+
def retrieve():
|
|
15
|
+
"""📥 RETRIEVE"""
|
|
16
|
+
from machineconfig.scripts.python.devops_helpers.devops_backup_retrieve import main_backup_retrieve
|
|
17
|
+
main_backup_retrieve(direction="RETRIEVE")
|
|
18
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
import machineconfig.scripts.python.devops_helpers.cli_terminal as cli_terminal
|
|
3
|
+
import typer
|
|
4
|
+
nw_apps = typer.Typer(help="🔐 Network subcommands", no_args_is_help=True)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
nw_apps.command(name="share-terminal", help="📡 Share terminal via web browser")(cli_terminal.main)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@nw_apps.command()
|
|
11
|
+
def add_key():
|
|
12
|
+
"""🔑 SSH add pub key to this machine"""
|
|
13
|
+
import machineconfig.scripts.python.devops_helpers.devops_add_ssh_key as helper
|
|
14
|
+
helper.main()
|
|
15
|
+
@nw_apps.command()
|
|
16
|
+
def add_identity():
|
|
17
|
+
"""🗝️ SSH add identity (private key) to this machine"""
|
|
18
|
+
import machineconfig.scripts.python.devops_helpers.devops_add_identity as helper
|
|
19
|
+
helper.main()
|
|
20
|
+
@nw_apps.command()
|
|
21
|
+
def connect():
|
|
22
|
+
"""🔐 SSH use key pair to connect two machines"""
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
|
|
25
|
+
@nw_apps.command()
|
|
26
|
+
def setup():
|
|
27
|
+
"""📡 SSH setup"""
|
|
28
|
+
import platform
|
|
29
|
+
if platform.system() == "Windows":
|
|
30
|
+
from machineconfig.setup_windows import SSH_SERVER
|
|
31
|
+
program = SSH_SERVER.read_text(encoding="utf-8")
|
|
32
|
+
elif platform.system() == "Linux" or platform.system() == "Darwin":
|
|
33
|
+
from machineconfig.setup_linux import SSH_SERVER
|
|
34
|
+
program = SSH_SERVER.read_text(encoding="utf-8")
|
|
35
|
+
else:
|
|
36
|
+
raise NotImplementedError(f"Platform {platform.system()} is not supported.")
|
|
37
|
+
from machineconfig.utils.code import run_shell_script
|
|
38
|
+
run_shell_script(script=program)
|
|
39
|
+
|
|
@@ -8,14 +8,15 @@ in the event that username@github.com is not mentioned in the remote url.
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import Annotated, Optional
|
|
10
10
|
import typer
|
|
11
|
-
from
|
|
11
|
+
from git import Repo, InvalidGitRepositoryError
|
|
12
|
+
from machineconfig.scripts.python.helpers_repos.secure_repo import main as secure_repo_main
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
app = typer.Typer(help="
|
|
15
|
-
sync_app = typer.Typer(help="
|
|
16
|
-
app.add_typer(sync_app, name="
|
|
15
|
+
app = typer.Typer(help="📁 Manage development repositories", no_args_is_help=True)
|
|
16
|
+
sync_app = typer.Typer(help="🔄 Manage repository specifications and syncing", no_args_is_help=True)
|
|
17
|
+
app.add_typer(sync_app, name="mirror", help="🔄 mirror repositories using saved specs")
|
|
17
18
|
|
|
18
|
-
DirectoryArgument = Annotated[Optional[str], typer.Argument(help="📁
|
|
19
|
+
DirectoryArgument = Annotated[Optional[str], typer.Argument(help="📁 Directory containing repo(s).")]
|
|
19
20
|
RecursiveOption = Annotated[bool, typer.Option("--recursive", "-r", help="🔍 Recurse into nested repositories.")]
|
|
20
21
|
NoSyncOption = Annotated[bool, typer.Option("--no-sync", help="🚫 Disable automatic uv sync after pulls.")]
|
|
21
22
|
CloudOption = Annotated[Optional[str], typer.Option("--cloud", "-c", help="☁️ Upload to or download from this cloud remote.")]
|
|
@@ -24,7 +25,7 @@ CloudOption = Annotated[Optional[str], typer.Option("--cloud", "-c", help="☁
|
|
|
24
25
|
@app.command(no_args_is_help=True)
|
|
25
26
|
def push(directory: DirectoryArgument = None, recursive: RecursiveOption = False, no_sync: NoSyncOption = False) -> None:
|
|
26
27
|
"""🚀 Push changes across repositories."""
|
|
27
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
28
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import git_operations
|
|
28
29
|
|
|
29
30
|
git_operations(directory, pull=False, commit=False, push=True, recursive=recursive, no_sync=no_sync)
|
|
30
31
|
|
|
@@ -32,7 +33,7 @@ def push(directory: DirectoryArgument = None, recursive: RecursiveOption = False
|
|
|
32
33
|
@app.command(no_args_is_help=True)
|
|
33
34
|
def pull(directory: DirectoryArgument = None, recursive: RecursiveOption = False, no_sync: NoSyncOption = False) -> None:
|
|
34
35
|
"""⬇️ Pull changes across repositories."""
|
|
35
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
36
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import git_operations
|
|
36
37
|
|
|
37
38
|
git_operations(directory, pull=True, commit=False, push=False, recursive=recursive, no_sync=no_sync)
|
|
38
39
|
|
|
@@ -40,25 +41,24 @@ def pull(directory: DirectoryArgument = None, recursive: RecursiveOption = False
|
|
|
40
41
|
@app.command(no_args_is_help=True)
|
|
41
42
|
def commit(directory: DirectoryArgument = None, recursive: RecursiveOption = False, no_sync: NoSyncOption = False) -> None:
|
|
42
43
|
"""💾 Commit changes across repositories."""
|
|
43
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
44
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import git_operations
|
|
44
45
|
|
|
45
46
|
git_operations(directory, pull=False, commit=True, push=False, recursive=recursive, no_sync=no_sync)
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
@app.command(no_args_is_help=True)
|
|
49
|
-
def
|
|
50
|
+
def sync(directory: DirectoryArgument = None, recursive: RecursiveOption = False, no_sync: NoSyncOption = False) -> None:
|
|
50
51
|
"""🔄 Pull, commit, and push changes across repositories."""
|
|
51
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
52
|
-
|
|
52
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import git_operations
|
|
53
53
|
git_operations(directory, pull=True, commit=True, push=True, recursive=recursive, no_sync=no_sync)
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
@sync_app.command(no_args_is_help=True)
|
|
57
57
|
def capture(directory: DirectoryArgument = None, cloud: CloudOption = None) -> None:
|
|
58
58
|
"""📝 Record repositories into a repos.json specification."""
|
|
59
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
59
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import resolve_directory
|
|
60
60
|
repos_root = resolve_directory(directory)
|
|
61
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
61
|
+
from machineconfig.scripts.python.repos_helpers.record import main as record_repos
|
|
62
62
|
|
|
63
63
|
save_path = record_repos(repos_root=repos_root)
|
|
64
64
|
from machineconfig.utils.path_extended import PathExtended
|
|
@@ -70,7 +70,7 @@ def capture(directory: DirectoryArgument = None, cloud: CloudOption = None) -> N
|
|
|
70
70
|
@sync_app.command(no_args_is_help=True)
|
|
71
71
|
def clone(directory: DirectoryArgument = None, cloud: CloudOption = None) -> None:
|
|
72
72
|
"""📥 Clone repositories described by a repos.json specification."""
|
|
73
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
73
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import clone_from_specs
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
clone_from_specs(directory, cloud, checkout_branch_flag=False, checkout_commit_flag=False)
|
|
@@ -79,7 +79,7 @@ def clone(directory: DirectoryArgument = None, cloud: CloudOption = None) -> Non
|
|
|
79
79
|
@sync_app.command(name="checkout-to-commit", no_args_is_help=True)
|
|
80
80
|
def checkout_command(directory: DirectoryArgument = None, cloud: CloudOption = None) -> None:
|
|
81
81
|
"""🔀 Check out specific commits listed in the specification."""
|
|
82
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
82
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import clone_from_specs
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
clone_from_specs(directory, cloud, checkout_branch_flag=False, checkout_commit_flag=True)
|
|
@@ -88,7 +88,7 @@ def checkout_command(directory: DirectoryArgument = None, cloud: CloudOption = N
|
|
|
88
88
|
@sync_app.command(name="checkout-to-branch", no_args_is_help=True)
|
|
89
89
|
def checkout_to_branch_command(directory: DirectoryArgument = None, cloud: CloudOption = None) -> None:
|
|
90
90
|
"""🔀 Check out to the main branch defined in the specification."""
|
|
91
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
91
|
+
from machineconfig.scripts.python.repos_helpers.entrypoint import clone_from_specs
|
|
92
92
|
clone_from_specs(directory, cloud, checkout_branch_flag=True, checkout_commit_flag=False)
|
|
93
93
|
|
|
94
94
|
|
|
@@ -135,3 +135,39 @@ def viz(
|
|
|
135
135
|
user_image_dir=user_image_dir, max_files=max_files, max_file_lag=max_file_lag,
|
|
136
136
|
file_idle_time=file_idle_time, framerate=framerate, background_color=background_color,
|
|
137
137
|
font_size=font_size, camera_mode=camera_mode)
|
|
138
|
+
|
|
139
|
+
@app.command(no_args_is_help=True)
|
|
140
|
+
def cleanup(repo: DirectoryArgument = None, recursive: RecursiveOption = False) -> None:
|
|
141
|
+
"""🧹 Clean repository directories from cache files."""
|
|
142
|
+
if repo is None:
|
|
143
|
+
repo = Path.cwd().as_posix()
|
|
144
|
+
|
|
145
|
+
arg_path = Path(repo).expanduser().absolute()
|
|
146
|
+
|
|
147
|
+
if not recursive:
|
|
148
|
+
# Check if the directory is a git repo
|
|
149
|
+
try:
|
|
150
|
+
Repo(str(arg_path), search_parent_directories=False)
|
|
151
|
+
except InvalidGitRepositoryError:
|
|
152
|
+
typer.echo(f"❌ {arg_path} is not a git repository. Use -r flag for recursive cleanup.")
|
|
153
|
+
return
|
|
154
|
+
# Run cleanup on this repo
|
|
155
|
+
repos_to_clean = [arg_path]
|
|
156
|
+
else:
|
|
157
|
+
# Find all git repos recursively under the directory
|
|
158
|
+
git_dirs = list(arg_path.rglob('.git'))
|
|
159
|
+
repos_to_clean = [git_dir.parent for git_dir in git_dirs if git_dir.is_dir()]
|
|
160
|
+
if not repos_to_clean:
|
|
161
|
+
typer.echo(f"❌ No git repositories found under {arg_path}")
|
|
162
|
+
return
|
|
163
|
+
|
|
164
|
+
for repo_path in repos_to_clean:
|
|
165
|
+
typer.echo(f"🧹 Cleaning {repo_path}")
|
|
166
|
+
script = fr"""
|
|
167
|
+
cd "{repo_path}"
|
|
168
|
+
uv run --with cleanpy cleanpy .
|
|
169
|
+
# mcinit .
|
|
170
|
+
# find "." -type f \( -name "*.py" -o -name "*.md" -o -name "*.json" \) -not -path "*/\.*" -not -path "*/__pycache__/*" -print0 | xargs -0 sed -i 's/[[:space:]]*$//'
|
|
171
|
+
"""
|
|
172
|
+
from machineconfig.utils.code import run_shell_script
|
|
173
|
+
run_shell_script(script)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import typer
|
|
3
|
+
|
|
4
|
+
self_app = typer.Typer(help="🔄 SELF operations subcommands", no_args_is_help=True)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@self_app.command()
|
|
8
|
+
def update():
|
|
9
|
+
"""🔄 UPDATE essential repos"""
|
|
10
|
+
import machineconfig.scripts.python.devops_helpers.devops_update_repos as helper
|
|
11
|
+
helper.main()
|
|
12
|
+
@self_app.command()
|
|
13
|
+
def interactive():
|
|
14
|
+
"""🤖 INTERACTIVE configuration of machine."""
|
|
15
|
+
from machineconfig.scripts.python.interactive import main
|
|
16
|
+
main()
|
|
17
|
+
@self_app.command()
|
|
18
|
+
def status():
|
|
19
|
+
"""📊 STATUS of machine, shell profile, apps, symlinks, dotfiles, etc."""
|
|
20
|
+
import machineconfig.scripts.python.devops_helpers.devops_status as helper
|
|
21
|
+
helper.main()
|
|
22
|
+
@self_app.command()
|
|
23
|
+
def clone():
|
|
24
|
+
"""📋 CLONE machienconfig locally and incorporate to shell profile for faster execution and nightly updates."""
|
|
25
|
+
import platform
|
|
26
|
+
from machineconfig.utils.code import run_shell_script
|
|
27
|
+
from machineconfig.profile.shell import create_default_shell_profile
|
|
28
|
+
if platform.system() == "Windows":
|
|
29
|
+
from machineconfig.setup_windows import MACHINECONFIG
|
|
30
|
+
create_default_shell_profile(method="copy")
|
|
31
|
+
else:
|
|
32
|
+
from machineconfig.setup_linux import MACHINECONFIG
|
|
33
|
+
create_default_shell_profile(method="reference")
|
|
34
|
+
run_shell_script(MACHINECONFIG.read_text(encoding="utf-8"))
|
|
35
|
+
|
|
36
|
+
@self_app.command()
|
|
37
|
+
def navigate():
|
|
38
|
+
"""📚 NAVIGATE command structure with TUI"""
|
|
39
|
+
from machineconfig.scripts.python.devops_navigator import main
|
|
40
|
+
main()
|
|
41
|
+
|
|
@@ -6,7 +6,7 @@ from machineconfig.utils.path_extended import PathExtended
|
|
|
6
6
|
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, DEFAULTS_PATH
|
|
7
7
|
from machineconfig.utils.code import print_code
|
|
8
8
|
from machineconfig.utils.options import choose_cloud_interactively, choose_from_options
|
|
9
|
-
from machineconfig.scripts.python.
|
|
9
|
+
from machineconfig.scripts.python.cloud_helpers.helpers2 import ES
|
|
10
10
|
from platform import system
|
|
11
11
|
from typing import Any, Literal, Optional
|
|
12
12
|
from rich.console import Console
|
|
@@ -8,7 +8,7 @@ from rich.panel import Panel
|
|
|
8
8
|
from rich.table import Table
|
|
9
9
|
from rich.text import Text
|
|
10
10
|
|
|
11
|
-
from machineconfig.scripts.python.repos_helpers.
|
|
11
|
+
from machineconfig.scripts.python.repos_helpers.update import RepositoryUpdateResult, run_uv_sync, update_repository
|
|
12
12
|
from machineconfig.utils.io import read_ini
|
|
13
13
|
from machineconfig.utils.source_of_truth import DEFAULTS_PATH
|
|
14
14
|
|