machineconfig 5.0__py3-none-any.whl → 5.12__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.

@@ -9,6 +9,7 @@ from pathlib import Path
9
9
  from rich.progress import track
10
10
  import polars as pl
11
11
  import plotly.graph_objects as go
12
+
12
13
  import plotly.express as px
13
14
  import typer
14
15
 
@@ -3,7 +3,11 @@ import typer
3
3
 
4
4
 
5
5
  def analyze_repo_development(repo_path: str = typer.Argument(..., help="Path to the git repository")):
6
- cmd = f"""uv run --python 3.13 --with machineconfig machineconfig.scripts.python.count_lines analyze-over-time {repo_path}"""
6
+ from machineconfig.scripts.python import count_lines
7
+ from pathlib import Path
8
+ count_lines_path = Path(count_lines.__file__).resolve().parent.joinpath("count_lines.py")
9
+ # --project $HOME/code/machineconfig
10
+ cmd = f"""uv run --python 3.13 --with machineconfig--group plot {count_lines_path} analyze-over-time {repo_path}"""
7
11
  from machineconfig.utils.code import run_script
8
12
  run_script(cmd)
9
13
 
@@ -9,10 +9,9 @@ import typer
9
9
 
10
10
 
11
11
  app = typer.Typer(help=f"🛠️ DevOps operations @ machineconfig {__version__}", no_args_is_help=True)
12
-
13
12
  app.command(name="install", help="📦 Install essential packages")(installer_entry_point.main)
14
13
  app.command(name="share-terminal", help="📡 Share terminal via web browser")(share_terminal.main)
15
- app.command(name="repos", help="📁 Manage git repositories")(repos.main)
14
+ app.add_typer(repos.app, name="repos", help="📁 Manage git repositories")
16
15
 
17
16
  ssh_app = typer.Typer(help="🔐 SSH operations subcommands", no_args_is_help=True)
18
17
  app.add_typer(ssh_app, name="ssh")
@@ -187,7 +187,7 @@ Set-Service -Name sshd -StartupType 'Automatic'"""
187
187
  if "retrieve_repositories" in selected_options:
188
188
  console.print(Panel("📚 [bold bright_magenta]REPOSITORIES[/bold bright_magenta]\n[italic]Project code retrieval[/italic]", border_style="bright_magenta"))
189
189
  from machineconfig.scripts.python import repos as module
190
- module.main(directory=str(Path.home() / "code"), clone=True, cloud="odg1")
190
+ module.main(directory=str(Path.home() / "code"), capture=True, cloud="odg1")
191
191
 
192
192
  if "retrieve_data" in selected_options:
193
193
  console.print(Panel("💾 [bold bright_cyan]DATA RETRIEVAL[/bold bright_cyan]\n[italic]Backup restoration[/italic]", border_style="bright_cyan"))
@@ -1,4 +1,4 @@
1
- """Repos
1
+ """Repos CLI powered by Typer.
2
2
 
3
3
  # TODO use gh api user --jq '.login' to get the username and use it to clone the repos.
4
4
  in the event that username@github.com is not mentioned in the remote url.
@@ -6,95 +6,127 @@ in the event that username@github.com is not mentioned in the remote url.
6
6
  """
7
7
 
8
8
 
9
- import typer
10
9
  from typing import Annotated, Optional
11
- from pathlib import Path
12
-
13
-
14
- def analyze_repo_development(repo_path: str = typer.Argument(..., help="Path to the git repository")):
15
- cmd = f"""uv run --python 3.13 --with machineconfig machineconfig.scripts.python.count_lines analyze-over-time {repo_path}"""
16
- from machineconfig.utils.code import run_script
17
- run_script(cmd)
18
-
19
-
20
- def main(
21
- directory: Annotated[Optional[str], typer.Argument(help="📁 Folder containing repos to record or a specs JSON file to follow.")] = None,
22
- push: Annotated[bool, typer.Option("--push", help="🚀 Push changes.")] = False,
23
- pull: Annotated[bool, typer.Option("--pull", help="⬇️ Pull changes.")] = False,
24
- commit: Annotated[bool, typer.Option("--commit", help="💾 Commit changes.")] = False,
25
- all: Annotated[bool, typer.Option("--all", help="🔄 Pull, commit, and push changes.")] = False,
26
- record: Annotated[bool, typer.Option("--record", help="📝 Record repositories.")] = False,
27
- clone: Annotated[bool, typer.Option("--clone", help="📥 Clone repositories from record.")] = False,
28
- checkout: Annotated[bool, typer.Option("--checkout", help="🔀 Check out to versions provided in a JSON file.")] = False,
29
- checkout_to_branch: Annotated[bool, typer.Option("--checkout-to-branch", help="🔀 Check out to the main branch.")] = False,
30
- recursive: Annotated[bool, typer.Option("--recursive", "-r", help="🔍 Recursive flag.")] = False,
31
- no_sync: Annotated[bool, typer.Option("--no-sync", help="🚫 Disable automatic uv sync after pulls.")] = False,
32
- cloud: Annotated[Optional[str], typer.Option("--cloud", "-c", help="☁️ Cloud storage option.")] = None,
33
- analyze: Annotated[bool, typer.Option("--analyze", help="📊 Analyze repository development over time.")] = False,
10
+ import typer
11
+
12
+
13
+
14
+ app = typer.Typer(help=" Manage development repositories", no_args_is_help=True)
15
+ sync_app = typer.Typer(help="� Manage repository specifications and syncing", no_args_is_help=True)
16
+ app.add_typer(sync_app, name="sync", help="� Sync repositories using saved specs")
17
+
18
+
19
+ DirectoryArgument = Annotated[
20
+ Optional[str],
21
+ typer.Argument(help="📁 Folder containing repos or the specs JSON file to use."),
22
+ ]
23
+ RecursiveOption = Annotated[
24
+ bool,
25
+ typer.Option("--recursive", "-r", help="🔍 Recurse into nested repositories."),
26
+ ]
27
+ NoSyncOption = Annotated[
28
+ bool,
29
+ typer.Option("--no-sync", help="🚫 Disable automatic uv sync after pulls."),
30
+ ]
31
+ CloudOption = Annotated[
32
+ Optional[str],
33
+ typer.Option("--cloud", "-c", help="☁️ Upload to or download from this cloud remote."),
34
+ ]
35
+
36
+
37
+
38
+ @app.command()
39
+ def push(directory: DirectoryArgument = None,
40
+ recursive: RecursiveOption = False,
41
+ no_sync: NoSyncOption = False,
34
42
  ) -> None:
35
- print("\n" + "=" * 50)
36
- print("📂 Welcome to the Repository Manager")
37
- print("=" * 50 + "\n")
38
-
39
- if analyze:
40
- from machineconfig.scripts.python.count_lines_frontend import analyze_repo_development
41
- analyze_repo_development(repo_path=directory if directory is not None else ".")
42
- return
43
- # app.command(name="analyze-repo", help="📊 Analyze code repository over time")(analyze_repo_development)
44
-
45
- from machineconfig.utils.io import read_ini
46
- from machineconfig.utils.source_of_truth import CONFIG_PATH, DEFAULTS_PATH
47
- from machineconfig.utils.path_extended import PathExtended
43
+ """🚀 Push changes across repositories."""
44
+ from machineconfig.scripts.python.repos_helper import git_operations
45
+ git_operations(directory, pull=False, commit=False, push=True, recursive=recursive, no_sync=no_sync)
46
+ @app.command()
47
+ def pull(
48
+ directory: DirectoryArgument = None,
49
+ recursive: RecursiveOption = False,
50
+ no_sync: NoSyncOption = False,
51
+ ) -> None:
52
+ """⬇️ Pull changes across repositories."""
53
+ from machineconfig.scripts.python.repos_helper import git_operations
54
+ git_operations(directory, pull=True, commit=False, push=False, recursive=recursive, no_sync=no_sync)
55
+ @app.command()
56
+ def commit(
57
+ directory: DirectoryArgument = None,
58
+ recursive: RecursiveOption = False,
59
+ no_sync: NoSyncOption = False,
60
+ ) -> None:
61
+ """💾 Commit changes across repositories."""
62
+ from machineconfig.scripts.python.repos_helper import git_operations
63
+ git_operations(directory, pull=False, commit=True, push=False, recursive=recursive, no_sync=no_sync)
64
+ @app.command()
65
+ def all(
66
+ directory: DirectoryArgument = None,
67
+ recursive: RecursiveOption = False,
68
+ no_sync: NoSyncOption = False,
69
+ ) -> None:
70
+ """🔄 Pull, commit, and push changes across repositories."""
71
+ from machineconfig.scripts.python.repos_helper import git_operations
72
+ git_operations(directory, pull=True, commit=True, push=True, recursive=recursive, no_sync=no_sync)
73
+
74
+
75
+ @sync_app.command()
76
+ def record(
77
+ directory: DirectoryArgument = None,
78
+ cloud: CloudOption = None,
79
+ ) -> None:
80
+ """📝 Record repositories into a repos.json specification."""
81
+ from machineconfig.scripts.python.repos_helper import print_banner, resolve_directory
82
+ print_banner()
83
+ repos_root = resolve_directory(directory)
48
84
  from machineconfig.scripts.python.repos_helper_record import main as record_repos
49
- from machineconfig.scripts.python.repos_helper_clone import clone_repos
50
- from machineconfig.scripts.python.repos_helper_action import perform_git_operations
51
-
52
- if directory is None:
53
- directory = Path.cwd().as_posix()
54
- print(f"📁 Using directory: {directory}")
55
- repos_root = PathExtended(directory).expanduser().absolute()
56
- auto_sync = not no_sync # Enable auto sync by default, disable with --no-sync
57
- if record:
58
- save_path = record_repos(repos_root=repos_root)
59
- if cloud is not None:
60
- PathExtended(save_path).to_cloud(rel2home=True, cloud=cloud)
61
-
62
- elif clone or checkout or checkout_to_branch:
63
- print("\n📥 Cloning or checking out repositories...")
64
- if not repos_root.exists() or repos_root.name != "repos.json":
65
- repos_root = PathExtended(CONFIG_PATH).joinpath("repos").joinpath(repos_root.rel2home()).joinpath("repos.json")
66
- if not repos_root.exists():
67
- if cloud is None:
68
- cloud_name: str = read_ini(DEFAULTS_PATH)["general"]["rclone_config_name"]
69
- print(f"⚠️ Using default cloud: {cloud_name}")
70
- else:
71
- cloud_name = cloud
72
- assert cloud_name is not None, f"Path {repos_root} does not exist and cloud was not passed. You can't clone without one of them."
73
- repos_root.from_cloud(cloud=cloud_name, rel2home=True)
74
- assert (repos_root.exists() and repos_root.name == "repos.json") or cloud is not None, f"Path {repos_root} does not exist and cloud was not passed. You can't clone without one of them."
75
- clone_repos(spec_path=repos_root, preferred_remote=None, checkout_branch_flag=checkout_to_branch, checkout_commit_flag=checkout)
76
-
77
- elif all or commit or pull or push:
78
- perform_git_operations(
79
- repos_root=repos_root,
80
- pull=pull or all,
81
- commit=commit or all,
82
- push=push or all,
83
- recursive=recursive,
84
- auto_sync=auto_sync
85
- )
86
- else:
87
- # print("❌ No action specified. Try passing --push, --pull, --commit, or --all.")
88
- typer.echo("❌ No action specified. Try passing --push, --pull, --commit, or --all.")
89
- import click
90
- ctx = click.get_current_context()
91
- typer.echo(ctx.get_help())
92
- raise typer.Exit(1)
93
-
94
-
95
- def main_from_parser() -> None:
96
- typer.run(main)
97
-
98
-
99
- if __name__ == "__main__":
100
- main_from_parser()
85
+ save_path = record_repos(repos_root=repos_root)
86
+ from machineconfig.utils.path_extended import PathExtended
87
+ if cloud is not None:
88
+ PathExtended(save_path).to_cloud(rel2home=True, cloud=cloud)
89
+ @sync_app.command()
90
+ def capture(
91
+ directory: DirectoryArgument = None,
92
+ cloud: CloudOption = None,
93
+ ) -> None:
94
+ """📥 Clone repositories described by a repos.json specification."""
95
+ from machineconfig.scripts.python.repos_helper import print_banner, clone_from_specs
96
+ print_banner()
97
+ clone_from_specs(directory, cloud, checkout_branch_flag=False, checkout_commit_flag=False)
98
+
99
+
100
+ @sync_app.command(name="checkout-to-commit")
101
+ def checkout_command(
102
+ directory: DirectoryArgument = None,
103
+ cloud: CloudOption = None,
104
+ ) -> None:
105
+ """🔀 Check out specific commits listed in the specification."""
106
+ from machineconfig.scripts.python.repos_helper import print_banner, clone_from_specs
107
+ print_banner()
108
+ clone_from_specs(directory, cloud, checkout_branch_flag=False, checkout_commit_flag=True)
109
+
110
+
111
+ @sync_app.command(name="checkout-to-branch")
112
+ def checkout_to_branch_command(
113
+ directory: DirectoryArgument = None,
114
+ cloud: CloudOption = None,
115
+ ) -> None:
116
+ """🔀 Check out to the main branch defined in the specification."""
117
+ from machineconfig.scripts.python.repos_helper import print_banner, clone_from_specs
118
+ print_banner()
119
+ clone_from_specs(directory, cloud, checkout_branch_flag=True, checkout_commit_flag=False)
120
+
121
+
122
+ @app.command()
123
+ def analyze(
124
+ directory: DirectoryArgument = None,
125
+ ) -> None:
126
+ """📊 Analyze repository development over time."""
127
+ from machineconfig.scripts.python.repos_helper import print_banner
128
+ print_banner()
129
+ repo_path = directory if directory is not None else "."
130
+ from machineconfig.scripts.python.count_lines_frontend import analyze_repo_development
131
+ analyze_repo_development(repo_path=repo_path)
132
+
@@ -0,0 +1,85 @@
1
+
2
+
3
+
4
+ from typing import Optional
5
+ from pathlib import Path
6
+ from machineconfig.utils.source_of_truth import CONFIG_PATH, DEFAULTS_PATH
7
+
8
+ import typer
9
+
10
+
11
+
12
+ def print_banner() -> None:
13
+ typer.echo("\n" + "=" * 50)
14
+ typer.echo("📂 Welcome to the Repository Manager")
15
+ typer.echo("=" * 50 + "\n")
16
+
17
+
18
+
19
+ def resolve_directory(directory: Optional[str]) -> Path:
20
+ if directory is None:
21
+ directory = Path.cwd().as_posix()
22
+ typer.echo(f"📁 Using directory: {directory}")
23
+ return Path(directory).expanduser().absolute()
24
+ def git_operations(
25
+ directory: Optional[str],
26
+ *,
27
+ pull: bool,
28
+ commit: bool,
29
+ push: bool,
30
+ recursive: bool,
31
+ no_sync: bool,
32
+ ) -> None:
33
+ print_banner()
34
+ repos_root = resolve_directory(directory)
35
+ auto_sync = not no_sync
36
+ from machineconfig.scripts.python.repos_helper_action import perform_git_operations
37
+ from machineconfig.utils.path_extended import PathExtended
38
+ perform_git_operations(
39
+ repos_root=PathExtended(repos_root),
40
+ pull=pull,
41
+ commit=commit,
42
+ push=push,
43
+ recursive=recursive,
44
+ auto_sync=auto_sync,
45
+ )
46
+ def resolve_spec_path(directory: Optional[str], cloud: Optional[str]) -> Path:
47
+ repos_root = resolve_directory(directory)
48
+ from machineconfig.utils.path_extended import PathExtended
49
+ if not repos_root.exists() or repos_root.name != "repos.json":
50
+ candidate = Path(CONFIG_PATH).joinpath("repos").joinpath(PathExtended(repos_root).rel2home()).joinpath("repos.json")
51
+ repos_root = candidate
52
+ if not repos_root.exists():
53
+ cloud_name: Optional[str]
54
+ if cloud is None:
55
+ from machineconfig.utils.io import read_ini
56
+ cloud_name = read_ini(DEFAULTS_PATH)["general"]["rclone_config_name"]
57
+ typer.echo(f"⚠️ Using default cloud: {cloud_name}")
58
+ else:
59
+ cloud_name = cloud
60
+ assert cloud_name is not None, (
61
+ f"Path {repos_root} does not exist and cloud was not passed. You can't clone without one of them."
62
+ )
63
+ from machineconfig.utils.path_extended import PathExtended
64
+ PathExtended(repos_root).from_cloud(cloud=cloud_name, rel2home=True)
65
+ assert repos_root.exists() and repos_root.name == "repos.json", (
66
+ f"Path {repos_root} does not exist and cloud was not passed. You can't clone without one of them."
67
+ )
68
+ return repos_root
69
+ def clone_from_specs(
70
+ directory: Optional[str],
71
+ cloud: Optional[str],
72
+ *,
73
+ checkout_branch_flag: bool,
74
+ checkout_commit_flag: bool,
75
+ ) -> None:
76
+ print_banner()
77
+ typer.echo("\n📥 Cloning or checking out repositories...")
78
+ spec_path = resolve_spec_path(directory, cloud)
79
+ from machineconfig.scripts.python.repos_helper_clone import clone_repos
80
+ clone_repos(
81
+ spec_path=spec_path,
82
+ preferred_remote=None,
83
+ checkout_branch_flag=checkout_branch_flag,
84
+ checkout_commit_flag=checkout_commit_flag,
85
+ )
@@ -7,6 +7,9 @@ from dataclasses import dataclass
7
7
  from enum import Enum
8
8
 
9
9
  from rich import print as pprint
10
+ from rich.table import Table
11
+ from rich.panel import Panel
12
+ from rich.columns import Columns
10
13
 
11
14
 
12
15
  class GitAction(Enum):
@@ -191,87 +194,127 @@ def git_action(path: PathExtended, action: GitAction, mess: Optional[str] = None
191
194
 
192
195
 
193
196
  def print_git_operations_summary(summary: GitOperationSummary, operations_performed: list[str]) -> None:
194
- """Print a detailed summary of git operations similar to repos_helper_record.py."""
195
- print("\n📊 Git Operations Summary:")
196
- print(f" Total paths processed: {summary.total_paths_processed}")
197
- print(f" Git repositories found: {summary.git_repos_found}")
198
- print(f" Non-git paths skipped: {summary.non_git_paths}")
199
-
200
- # Show per-operation statistics
197
+ """Print a detailed summary of git operations with rich formatting and tables."""
198
+ from rich.console import Console
199
+ console = Console()
200
+
201
+ # Main summary panel
202
+ summary_stats = [
203
+ f"Total paths processed: {summary.total_paths_processed}",
204
+ f"Git repositories found: {summary.git_repos_found}",
205
+ f"Non-git paths skipped: {summary.non_git_paths}"
206
+ ]
207
+
208
+ console.print(Panel.fit(
209
+ "\n".join(summary_stats),
210
+ title="[bold blue]📊 Git Operations Summary[/bold blue]",
211
+ border_style="blue"
212
+ ))
213
+
214
+ # Statistics panels in columns
215
+ stat_panels = []
216
+
201
217
  if "commit" in operations_performed:
202
- print("\n💾 Commit Operations:")
203
- print(f" Attempted: {summary.commits_attempted}")
204
- print(f" Successful: {summary.commits_successful}")
205
- print(f" No changes: {summary.commits_no_changes}")
206
- print(f" Failed: {summary.commits_failed}")
207
-
218
+ commit_stats = [
219
+ f"Attempted: {summary.commits_attempted}",
220
+ f"Successful: {summary.commits_successful}",
221
+ f"No changes: {summary.commits_no_changes}",
222
+ f"Failed: {summary.commits_failed}"
223
+ ]
224
+ stat_panels.append(Panel.fit(
225
+ "\n".join(commit_stats),
226
+ title="[bold green]💾 Commit Operations[/bold green]",
227
+ border_style="green"
228
+ ))
229
+
208
230
  if "pull" in operations_performed:
209
- print("\n⬇️ Pull Operations:")
210
- print(f" Attempted: {summary.pulls_attempted}")
211
- print(f" Successful: {summary.pulls_successful}")
212
- print(f" Failed: {summary.pulls_failed}")
213
-
231
+ pull_stats = [
232
+ f"Attempted: {summary.pulls_attempted}",
233
+ f"Successful: {summary.pulls_successful}",
234
+ f"Failed: {summary.pulls_failed}"
235
+ ]
236
+ stat_panels.append(Panel.fit(
237
+ "\n".join(pull_stats),
238
+ title="[bold cyan]⬇️ Pull Operations[/bold cyan]",
239
+ border_style="cyan"
240
+ ))
241
+
214
242
  if "push" in operations_performed:
215
- print("\n🚀 Push Operations:")
216
- print(f" Attempted: {summary.pushes_attempted}")
217
- print(f" Successful: {summary.pushes_successful}")
218
- print(f" Failed: {summary.pushes_failed}")
243
+ push_stats = [
244
+ f"Attempted: {summary.pushes_attempted}",
245
+ f"Successful: {summary.pushes_successful}",
246
+ f"Failed: {summary.pushes_failed}"
247
+ ]
248
+ stat_panels.append(Panel.fit(
249
+ "\n".join(push_stats),
250
+ title="[bold magenta]🚀 Push Operations[/bold magenta]",
251
+ border_style="magenta"
252
+ ))
219
253
 
220
- # Show repositories without remotes (important for push operations)
254
+ if stat_panels:
255
+ console.print(Columns(stat_panels, equal=True, expand=True))
256
+
257
+ # Repositories without remotes warning
221
258
  if summary.repos_without_remotes:
222
- print(f"\n⚠️ WARNING: {len(summary.repos_without_remotes)} repositories have no remote configurations:")
259
+ repos_table = Table(title="[bold yellow]⚠️ Repositories Without Remotes[/bold yellow]")
260
+ repos_table.add_column("Repository Name", style="cyan", no_wrap=True)
261
+ repos_table.add_column("Full Path", style="dim")
262
+
223
263
  for repo_path in summary.repos_without_remotes:
224
- print(f" • {repo_path.name} ({repo_path})")
225
- print(" These repositories cannot be pushed to remote servers.")
226
- else:
227
- if "push" in operations_performed:
228
- print("\n✅ All repositories have remote configurations.")
264
+ repos_table.add_row(repo_path.name, str(repo_path))
229
265
 
230
- # Show failed operations
266
+ console.print(repos_table)
267
+ console.print("[yellow]These repositories cannot be pushed to remote servers.[/yellow]")
268
+ elif "push" in operations_performed:
269
+ console.print("[green]✅ All repositories have remote configurations.[/green]")
270
+
271
+ # Failed operations table
231
272
  if summary.failed_operations:
232
- print(f"\nFAILED OPERATIONS ({len(summary.failed_operations)} total):")
233
-
234
- # Group failed operations by type
273
+ failed_table = Table(title=f"[bold red]Failed Operations ({len(summary.failed_operations)} total)[/bold red]")
274
+ failed_table.add_column("Action", style="bold red", no_wrap=True)
275
+ failed_table.add_column("Repository", style="cyan", no_wrap=True)
276
+ failed_table.add_column("Problem", style="red")
277
+
278
+ # Group failed operations by type for better organization
235
279
  failed_by_action = {}
236
280
  for failed_op in summary.failed_operations:
237
281
  if failed_op.action not in failed_by_action:
238
282
  failed_by_action[failed_op.action] = []
239
283
  failed_by_action[failed_op.action].append(failed_op)
240
-
284
+
241
285
  for action, failures in failed_by_action.items():
242
- print(f"\n {action.upper()} failures ({len(failures)}):")
243
286
  for failure in failures:
244
- if not failure.is_git_repo:
245
- print(f" • {failure.repo_path.name} ({failure.repo_path}) - Not a git repository")
246
- else:
247
- print(f" • {failure.repo_path.name} ({failure.repo_path}) - {failure.message}")
287
+ repo_name = failure.repo_path.name if failure.is_git_repo else f"{failure.repo_path.name} (not git repo)"
288
+ problem = failure.message if failure.is_git_repo else "Not a git repository"
289
+ failed_table.add_row(action.upper(), repo_name, problem)
290
+
291
+ console.print(failed_table)
248
292
  else:
249
- print("\n✅ All git operations completed successfully!")
293
+ console.print("[green]✅ All git operations completed successfully![/green]")
250
294
 
251
295
  # Overall success assessment
252
296
  total_failed = len(summary.failed_operations)
253
- total_operations = (summary.commits_attempted + summary.pulls_attempted +
297
+ total_operations = (summary.commits_attempted + summary.pulls_attempted +
254
298
  summary.pushes_attempted)
255
-
299
+
256
300
  if total_failed == 0 and total_operations > 0:
257
- print(f"\n🎉 SUCCESS: All {total_operations} operations completed successfully!")
301
+ console.print(f"\n[bold green]🎉 SUCCESS: All {total_operations} operations completed successfully![/bold green]")
258
302
  elif total_operations == 0:
259
- print("\n📝 No git operations were performed.")
303
+ console.print("\n[blue]📝 No git operations were performed.[/blue]")
260
304
  else:
261
305
  success_rate = ((total_operations - total_failed) / total_operations * 100) if total_operations > 0 else 0
262
- print(f"\n⚖️ SUMMARY: {total_operations - total_failed}/{total_operations} operations succeeded ({success_rate:.1f}% success rate)")
263
306
  if total_failed > 0:
264
- print(" Review the failed operations above for details on what needs attention.")
307
+ console.print(f"\n[bold yellow]⚖️ SUMMARY: {total_operations - total_failed}/{total_operations} operations succeeded ({success_rate:.1f}% success rate)[/bold yellow]")
308
+ console.print("[yellow]Review the failed operations table above for details on what needs attention.[/yellow]")
309
+ else:
310
+ console.print(f"\n[bold green]⚖️ SUMMARY: {total_operations}/{total_operations} operations succeeded (100% success rate)[/bold green]")
265
311
 
266
312
 
267
313
  def perform_git_operations(repos_root: PathExtended, pull: bool, commit: bool, push: bool, recursive: bool, auto_sync: bool) -> None:
268
314
  """Perform git operations on all repositories and provide detailed summary."""
269
315
  print(f"\n🔄 Performing Git actions on repositories @ `{repos_root}`...")
270
-
271
- # Initialize summary tracking
272
316
  summary = GitOperationSummary()
273
- operations_performed = []
274
-
317
+ operations_performed = []
275
318
  # Determine which operations to perform
276
319
  if pull:
277
320
  operations_performed.append("pull")
@@ -1,4 +1,5 @@
1
1
  from machineconfig.utils.path_extended import PathExtended
2
+ from pathlib import Path
2
3
  from machineconfig.utils.schemas.repos.repos_types import GitVersionInfo, RepoRecordDict, RepoRemote
3
4
 
4
5
  from machineconfig.utils.schemas.repos.repos_types import RepoRecordFile
@@ -185,8 +186,9 @@ def record_repos_recursively(repos_root: str, r: bool, progress: Progress | None
185
186
  return res
186
187
 
187
188
 
188
- def main(repos_root: PathExtended):
189
+ def main(repos_root: Path):
189
190
  print("\n📝 Recording repositories...")
191
+ repos_root = PathExtended(repos_root).expanduser().absolute()
190
192
 
191
193
  # Count total directories and repositories for accurate progress tracking
192
194
  print("🔍 Analyzing directory structure...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 5.0
3
+ Version: 5.12
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -161,6 +161,26 @@ curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/ma
161
161
  short `curl bit.ly/cfgcroshelllinux -L | bash`
162
162
 
163
163
 
164
+ ## Repository management CLI
165
+
166
+ The DevOps CLI now exposes rich subcommands for working with git repositories. Run `python -m machineconfig.scripts.python.devops repos --help` to explore the hierarchy:
167
+
168
+ * Top-level actions: `push`, `pull`, `commit`, `all`, and `analyze`.
169
+ * These commands accept `--recursive/-r` and `--no-sync` to control nested repos and automatic `uv sync`.
170
+ * Sync workflows live under `sync`:
171
+ * `record` captures the current machine state into a `repos.json`.
172
+ * `capture` clones repos from a specification without changing commits.
173
+ * `checkout` aligns repositories to commits stored in the spec.
174
+ * `checkout-to-branch` switches repositories to the tracked branch.
175
+ * Each sync subcommand accepts `--cloud/-c` for fetching/saving specs from remote storage.
176
+
177
+ Example:
178
+
179
+ ```bash
180
+ python -m machineconfig.scripts.python.devops repos sync record ~/code --cloud my_remote
181
+ python -m machineconfig.scripts.python.devops repos pull ~/code --recursive
182
+ ```
183
+
164
184
  # Author
165
185
  Alex Al-Saffar. [email](mailto:programmer@usa.com)
166
186
 
@@ -124,7 +124,6 @@ machineconfig/scripts/linux/mount_drive,sha256=zemKofv7hOmRN_V3qK0q580GkfWw3Vdik
124
124
  machineconfig/scripts/linux/mount_nfs,sha256=kpIbAse3igReEGgnXngez2ytWucLwmb_xo6e6KeO_rs,1870
125
125
  machineconfig/scripts/linux/mount_nw_drive,sha256=pNzHc7yZn5YIzn2BkpKvd5530PqbestkzrdoXaChyqY,2338
126
126
  machineconfig/scripts/linux/mount_smb,sha256=7UN5EP1kuxYL_-CnyaH4f9Wuu2CgALDZpJ0mPcdvCiY,94
127
- machineconfig/scripts/linux/repos,sha256=1qbmIemZjkjcPmiL1Bp8pD46E83OXsR5EJ0XQt29Bhc,96
128
127
  machineconfig/scripts/linux/scheduler,sha256=Z9Wu0N9vWRbi4FoRbpcc4ydq4bVaDjZOXESR35ZN0rI,100
129
128
  machineconfig/scripts/linux/sessions,sha256=A4vxUDHnDhyph833iy-tBprgQ7av_DZ5t031PRrbqVQ,98
130
129
  machineconfig/scripts/linux/share_cloud.sh,sha256=75IzCm7Nob1wO-zlfaNyPPod1IjAsVCG5lcMFdXmiI4,3010
@@ -146,10 +145,10 @@ machineconfig/scripts/python/cloud_manager.py,sha256=YN0DYLzPKtMBaks-EAVwFmkCu3X
146
145
  machineconfig/scripts/python/cloud_mount.py,sha256=GwcXbd5ohoHGESfX5edtCEl2-umDDxH_AZapmFSzc9E,6740
147
146
  machineconfig/scripts/python/cloud_repo_sync.py,sha256=8dnlHbQqRymPRU0v01pNIuaIvFeY4fReP7ewNSSCt34,9765
148
147
  machineconfig/scripts/python/cloud_sync.py,sha256=RWGpAfJ9fnN18yNBSgN44dzA38Hmd4879JL5r2pcyrM,3514
149
- machineconfig/scripts/python/count_lines.py,sha256=aVg91ArHg73swKNGMQzi_WlPnTLEbc8rkNZkCv_qpvI,15894
150
- machineconfig/scripts/python/count_lines_frontend.py,sha256=1DQn9YUbl5IYjjJ1fS5qEe60X-5ez6zZiXMQXVTA4-8,359
148
+ machineconfig/scripts/python/count_lines.py,sha256=BoIR9B5l-Yb1UtCkR1iBp7zCD8jxXw8BAgOnmiFG9es,15895
149
+ machineconfig/scripts/python/count_lines_frontend.py,sha256=Kl2sLS8Cwy_7vx5DuTbb0V45_Z-j43g2dP-lRi9c5uI,571
151
150
  machineconfig/scripts/python/croshell.py,sha256=parFHSL859H00ExDpDBPHBFe_E_DrfVq6P8CpCGVK9A,8571
152
- machineconfig/scripts/python/devops.py,sha256=dPCdg55WdcOXy6NIjIUnkBEpgmy-ooGGYA0x_G30ZKA,3486
151
+ machineconfig/scripts/python/devops.py,sha256=JB4_M6S-nO3yqas8wtAlU2r6jsmHu_nlq7aoEOH-54Y,3486
153
152
  machineconfig/scripts/python/devops_add_identity.py,sha256=wvjNgqsLmqD2SxbNCW_usqfp0LI-TDvcJJKGOWt2oFw,3775
154
153
  machineconfig/scripts/python/devops_add_ssh_key.py,sha256=BXB-9RvuSZO0YTbnM2azeABW2ngLW4SKhhAGAieMzfw,6873
155
154
  machineconfig/scripts/python/devops_backup_retrieve.py,sha256=JLJHmi8JmZ_qVTeMW-qBEAYGt1fmfWXzZ7Gm-Q-GDcU,5585
@@ -166,16 +165,17 @@ machineconfig/scripts/python/fire_jobs_streamlit_helper.py,sha256=47DEQpj8HBSa-_
166
165
  machineconfig/scripts/python/ftpx.py,sha256=QfQTp-6jQP6yxfbLc5sKxiMtTgAgc8sjN7d17_uLiZc,9400
167
166
  machineconfig/scripts/python/get_zellij_cmd.py,sha256=e35-18hoXM9N3PFbvbizfkNY_-63iMicieWE3TbGcCQ,576
168
167
  machineconfig/scripts/python/gh_models.py,sha256=3BLfW25mBRiPO5VKtVm-nMlKLv-PaZDw7mObajq6F6M,5538
169
- machineconfig/scripts/python/interactive.py,sha256=NHAniZPgEfhgA3higTRD3U76nHIDpZLygWebhKc6ld0,11791
168
+ machineconfig/scripts/python/interactive.py,sha256=Tmqes57K0Z1svEcxM6uOd6nSivwwQCthrupToeubDAo,11793
170
169
  machineconfig/scripts/python/mount_nfs.py,sha256=aECrL64j9g-9rF49sVJAjGmzaoGgcMnl3g9v17kQF4c,3239
171
170
  machineconfig/scripts/python/mount_nw_drive.py,sha256=iru6AtnTyvyuk6WxlK5R4lDkuliVpPV5_uBTVVhXtjQ,1550
172
171
  machineconfig/scripts/python/mount_ssh.py,sha256=k2fKq3f5dKq_7anrFOlqvJoI_3U4EWNHLRZ1o3Lsy6M,2268
173
172
  machineconfig/scripts/python/onetimeshare.py,sha256=bmGsNnskym5OWfIhpOfZG5jq3m89FS0a6dF5Sb8LaZM,2539
174
173
  machineconfig/scripts/python/pomodoro.py,sha256=SPkfeoZGv8rylGiOyzQ7UK3aXZ3G2FIOuGkSuBUggOI,2019
175
- machineconfig/scripts/python/repos.py,sha256=F6RuAldifnk_t_KUt1d69JT8EqV06Ip27JYljp6-1RY,5196
176
- machineconfig/scripts/python/repos_helper_action.py,sha256=6bQln9x2L_lOnvWwnTM_nJjkugl5LDDGHedVsz2zuI4,13320
174
+ machineconfig/scripts/python/repos.py,sha256=n7LUG_SPZ_i-moYjz3QHPhsBM_cFpm3cZ-tjztplDfc,4918
175
+ machineconfig/scripts/python/repos_helper.py,sha256=3jLdnNf1canpzi3JXiz5VA6UTUmLeNHuhjOWVl_thP0,3006
176
+ machineconfig/scripts/python/repos_helper_action.py,sha256=sXeOw5uHaK2GJixYW8qU_PD24mruGcQ59uf68ELC76A,14846
177
177
  machineconfig/scripts/python/repos_helper_clone.py,sha256=9vGb9NCXT0lkerPzOJjmFfhU8LSzE-_1LDvjkhgnal0,5461
178
- machineconfig/scripts/python/repos_helper_record.py,sha256=I4CsIPMZR-JcUuKyyinynws0ul0xb2Lb5F1QCnS9HBY,10911
178
+ machineconfig/scripts/python/repos_helper_record.py,sha256=dtnnInQPn00u1cyr0oOgJ_jB12O3bSiNctwzC3W7_3w,10994
179
179
  machineconfig/scripts/python/repos_helper_update.py,sha256=AYyKIB7eQ48yoYmFjydIhRI1lV39TBv_S4_LCa-oKuQ,11042
180
180
  machineconfig/scripts/python/scheduler.py,sha256=rKhssuxkD697EY6qaV6CSdNhxpAQLDWO4fE8GMCQ9FA,3061
181
181
  machineconfig/scripts/python/sessions.py,sha256=e8gL0fVWOZ5WcJsA3ZWfqJBc5c7g-rMlVf0SF63rIaU,8547
@@ -246,7 +246,6 @@ machineconfig/scripts/windows/mount_ssh.ps1,sha256=zvU1737vR0f0S7Si1tXMb3ys_I9KV
246
246
  machineconfig/scripts/windows/nano.ps1,sha256=H1PNN1x3UnOCGwijgMij-K2ZM2E20sfsLTEEap-W5dQ,50
247
247
  machineconfig/scripts/windows/pomodoro.ps1,sha256=9r61cwRy4M2_1A-NFb0fxUuUONxXBLJmLYtY3apkyQA,80
248
248
  machineconfig/scripts/windows/reload_path.ps1,sha256=81hQY18LFApVZWFiUfgMzzPH2pJ1WD1fHInfmicBZFA,217
249
- machineconfig/scripts/windows/repos.ps1,sha256=sjUcrURmYuxdcrdhwLHeWxwByyLgY4k13i8VYSFDKuo,76
250
249
  machineconfig/scripts/windows/scheduler.ps1,sha256=YfOlBxCkPfeQPeyCiNw0g3kIpdbjjf6daLEWuyHSaXY,81
251
250
  machineconfig/scripts/windows/sessions.ps1,sha256=cQdgSS3rVWvhthsUi5lyFI05_GKiRGI-j4FB1SZNKpM,80
252
251
  machineconfig/scripts/windows/share_cloud.cmd,sha256=exD7JCdxw2LqVjw2MKCYHbVZlEqmelXtwnATng-dhJ4,1028
@@ -409,8 +408,8 @@ machineconfig/utils/schemas/fire_agents/fire_agents_input.py,sha256=pTxvLzIpD5RF
409
408
  machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoSpdmTIdgS9LS-RvE-QZ-D260tD3o,1214
410
409
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
411
410
  machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
412
- machineconfig-5.0.dist-info/METADATA,sha256=iR23svhxBwVuCPPYQw123XN8KR3K_JufOAnMeJ0tIHk,7060
413
- machineconfig-5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
414
- machineconfig-5.0.dist-info/entry_points.txt,sha256=LcwklRJPY_uKBvStgtOJn5G_pmFCEdpgRNzUUc6twAQ,1134
415
- machineconfig-5.0.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
416
- machineconfig-5.0.dist-info/RECORD,,
411
+ machineconfig-5.12.dist-info/METADATA,sha256=bcbdbTMVjgLU4e-XinDcInPPj0ELaL4i1jJYkM2_5BA,8030
412
+ machineconfig-5.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
413
+ machineconfig-5.12.dist-info/entry_points.txt,sha256=2afE1mw-o4MUlfxyX73SV02XaQI4SV_LdL2r6_CzhPU,1074
414
+ machineconfig-5.12.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
415
+ machineconfig-5.12.dist-info/RECORD,,
@@ -13,7 +13,6 @@ initai = machineconfig.scripts.python.ai.initai:main
13
13
  kill_process = machineconfig.utils.procs:main
14
14
  mount_nfs = machineconfig.scripts.python.mount_nfs:main
15
15
  mount_nw_drive = machineconfig.scripts.python.mount_nw_drive:main
16
- repos = machineconfig.scripts.python.repos:main_from_parser
17
16
  sessions = machineconfig.scripts.python.sessions:main_from_parser
18
17
  start_slidev = machineconfig.scripts.python.start_slidev:arg_parser
19
18
  wifi_conn = machineconfig.scripts.python.wifi_conn:arg_parser
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bash
2
- uv run --python 3.13 --no-dev --project $HOME/code/machineconfig repos "$@"
@@ -1 +0,0 @@
1
- uv run --python 3.13 --no-dev --project $HOME/code/machineconfig repos $args