marty-cli 0.1.0__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.
marty_cli/__init__.py ADDED
@@ -0,0 +1,93 @@
1
+ """marty-cli - CLI application."""
2
+
3
+ import os
4
+ from pathlib import Path
5
+
6
+ import typer
7
+
8
+ from marty_cli.workflow_manager import WorkflowManager
9
+
10
+ app = typer.Typer(help="marty-cli - A CLI application")
11
+
12
+ workflow_app = typer.Typer(help="Manage GitHub workflows")
13
+ app.add_typer(workflow_app, name="workflow")
14
+
15
+
16
+ @workflow_app.command("add")
17
+ def workflow_add(
18
+ name: str,
19
+ path: Path = typer.Option(None, "--path", help="Target directory"),
20
+ ) -> None:
21
+ """Add a workflow to your project."""
22
+ target_path = (path or Path(os.getcwd())) / ".github" / "workflows"
23
+ manager = WorkflowManager(target_path)
24
+
25
+ if manager.add_workflow(name):
26
+ typer.echo(f"Added workflow: {name}")
27
+ else:
28
+ typer.echo(f"Error: Workflow '{name}' not found in bundled workflows")
29
+ raise typer.Exit(code=1)
30
+
31
+
32
+ @workflow_app.command("update")
33
+ def workflow_update(
34
+ name: str,
35
+ path: Path = typer.Option(None, "--path", help="Target directory"),
36
+ ) -> None:
37
+ """Update an existing workflow."""
38
+ target_path = (path or Path(os.getcwd())) / ".github" / "workflows"
39
+ manager = WorkflowManager(target_path)
40
+
41
+ if manager.update_workflow(name):
42
+ typer.echo(f"Updated workflow: {name}")
43
+ else:
44
+ typer.echo(f"Error: Workflow '{name}' is not installed or not found in bundled workflows")
45
+ raise typer.Exit(code=1)
46
+
47
+
48
+ @workflow_app.command("delete")
49
+ def workflow_delete(
50
+ name: str,
51
+ path: Path = typer.Option(None, "--path", help="Target directory"),
52
+ ) -> None:
53
+ """Delete a workflow from your project."""
54
+ target_path = (path or Path(os.getcwd())) / ".github" / "workflows"
55
+ manager = WorkflowManager(target_path)
56
+
57
+ if manager.delete_workflow(name):
58
+ typer.echo(f"Deleted workflow: {name}")
59
+ else:
60
+ typer.echo(f"Error: Workflow '{name}' is not installed")
61
+ raise typer.Exit(code=1)
62
+
63
+
64
+ @workflow_app.command("list")
65
+ def workflow_list(
66
+ path: Path = typer.Option(None, "--path", help="Target directory"),
67
+ ) -> None:
68
+ """List available and installed workflows."""
69
+ target_path = (path or Path(os.getcwd())) / ".github" / "workflows"
70
+ manager = WorkflowManager(target_path)
71
+
72
+ bundled = manager.get_bundled_workflows()
73
+ installed = manager.get_installed_workflows()
74
+
75
+ typer.echo("Available (bundled):")
76
+ for wf in bundled:
77
+ status = "installed" if wf in installed else "not installed"
78
+ typer.echo(f" - {wf} ({status})")
79
+
80
+ typer.echo("\nInstalled:")
81
+ if installed:
82
+ for wf in installed:
83
+ typer.echo(f" - {wf}")
84
+ else:
85
+ typer.echo(" (none)")
86
+
87
+
88
+ def main() -> None:
89
+ app()
90
+
91
+
92
+ if __name__ == "__main__":
93
+ main()
marty_cli/__main__.py ADDED
@@ -0,0 +1,6 @@
1
+ """Entry point for marty-cli CLI."""
2
+
3
+ from . import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,96 @@
1
+ """Workflow manager for handling bundled and installed workflows."""
2
+
3
+ import shutil
4
+ from pathlib import Path
5
+
6
+
7
+ class WorkflowManager:
8
+ """Manages bundled and installed GitHub workflows."""
9
+
10
+ def __init__(self, target_path: Path | None = None) -> None:
11
+ """Initialize the workflow manager.
12
+
13
+ Args:
14
+ target_path: Path to the target .github/workflows directory.
15
+ Defaults to current directory.
16
+ """
17
+ self.target_path = target_path or Path.cwd() / ".github" / "workflows"
18
+ self.bundled_path = Path(__file__).parent / "workflows"
19
+
20
+ def get_bundled_workflows(self) -> list[str]:
21
+ """Get list of available bundled workflows.
22
+
23
+ Returns:
24
+ List of workflow names (without .yml extension).
25
+ """
26
+ if not self.bundled_path.exists():
27
+ return []
28
+ return [f.stem for f in self.bundled_path.glob("*.yml")]
29
+
30
+ def get_installed_workflows(self) -> list[str]:
31
+ """Get list of installed workflows.
32
+
33
+ Returns:
34
+ List of workflow names (without .yml extension).
35
+ """
36
+ if not self.target_path.exists():
37
+ return []
38
+ return [f.stem for f in self.target_path.glob("*.yml")]
39
+
40
+ def add_workflow(self, name: str) -> bool:
41
+ """Add a bundled workflow to the project.
42
+
43
+ Args:
44
+ name: Name of the workflow to add.
45
+
46
+ Returns:
47
+ True if successful, False otherwise.
48
+ """
49
+ bundled_workflows = self.get_bundled_workflows()
50
+ if name not in bundled_workflows:
51
+ return False
52
+
53
+ source = self.bundled_path / f"{name}.yml"
54
+ self.target_path.mkdir(parents=True, exist_ok=True)
55
+ dest = self.target_path / f"{name}.yml"
56
+ shutil.copy2(source, dest)
57
+ return True
58
+
59
+ def update_workflow(self, name: str) -> bool:
60
+ """Update an installed workflow from the bundled version.
61
+
62
+ Args:
63
+ name: Name of the workflow to update.
64
+
65
+ Returns:
66
+ True if successful, False otherwise.
67
+ """
68
+ installed_workflows = self.get_installed_workflows()
69
+ bundled_workflows = self.get_bundled_workflows()
70
+
71
+ if name not in installed_workflows:
72
+ return False
73
+ if name not in bundled_workflows:
74
+ return False
75
+
76
+ source = self.bundled_path / f"{name}.yml"
77
+ dest = self.target_path / f"{name}.yml"
78
+ shutil.copy2(source, dest)
79
+ return True
80
+
81
+ def delete_workflow(self, name: str) -> bool:
82
+ """Delete an installed workflow.
83
+
84
+ Args:
85
+ name: Name of the workflow to delete.
86
+
87
+ Returns:
88
+ True if successful, False otherwise.
89
+ """
90
+ installed_workflows = self.get_installed_workflows()
91
+ if name not in installed_workflows:
92
+ return False
93
+
94
+ workflow_file = self.target_path / f"{name}.yml"
95
+ workflow_file.unlink()
96
+ return True
@@ -0,0 +1,15 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Run tests
15
+ run: echo "Running tests..."
@@ -0,0 +1,12 @@
1
+ name: Pull Request Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+
7
+ jobs:
8
+ review:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Review changes
12
+ run: echo "Reviewing PR..."
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: marty-cli
3
+ Version: 0.1.0
4
+ Summary: My Python CLI
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: typer>=0.12.0
7
+ Provides-Extra: dev
8
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
9
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
10
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
11
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
12
+ Provides-Extra: rich
13
+ Requires-Dist: rich>=13.0.0; extra == 'rich'
14
+ Description-Content-Type: text/markdown
15
+
16
+ # marty-cli
17
+
18
+ A Python CLI application created with @nesalia/create.
19
+
20
+ ## Requirements
21
+
22
+ - Python 3.12+
23
+ - uv (recommended) or pip
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ # Using uv (recommended)
29
+ uv sync
30
+
31
+ # Or using pip
32
+ pip install -e .
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ # Run the CLI
39
+ marty-cli --help
40
+
41
+ # Say hello
42
+ marty-cli hello --name World
43
+
44
+ # Run tests
45
+ pytest
46
+ ```
47
+
48
+ ## Development
49
+
50
+ ```bash
51
+ # Install dev dependencies
52
+ uv sync --extra dev
53
+
54
+ # Run linter
55
+ ruff check .
56
+
57
+ # Run tests
58
+ pytest
59
+ ```
@@ -0,0 +1,9 @@
1
+ marty_cli/__init__.py,sha256=3vO_MD7_ajCmhXFCdiwAl6am1X_cG3ApYAglhJKxQio,2749
2
+ marty_cli/__main__.py,sha256=D-EwccC5bzmz97cj7PfaJUHJlBYUEc1utMC2pIZH5fY,96
3
+ marty_cli/workflow_manager.py,sha256=5T9obV-WLsvB1-vjqvq2_p3-9NPEAu9pA8IXbJMNLFc,2964
4
+ marty_cli/workflows/ci.yml,sha256=6bPqvNO_J8oLVj4ALBZkCH1YgPHZmHRF_2mE2P0HMEk,228
5
+ marty_cli/workflows/pr-review.yml,sha256=SE45JcL_Di8YdWkkyfyzAPYK0k_-0SJwA-vPGbuZpBE,210
6
+ marty_cli-0.1.0.dist-info/METADATA,sha256=oIsFtXPhCzwSmsWOVghY_XEw9Xc8r-dlfthstLUkZ58,896
7
+ marty_cli-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
8
+ marty_cli-0.1.0.dist-info/entry_points.txt,sha256=fdRte0tEZg3CGSAzTGYe5RnNRrp9LOBbzxhjcH_KoOM,54
9
+ marty_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ marty-cli = marty_cli.__main__:main