pace-dotnet 0.1.0__tar.gz
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.
- pace_dotnet-0.1.0/LICENSE +21 -0
- pace_dotnet-0.1.0/PKG-INFO +183 -0
- pace_dotnet-0.1.0/README.md +150 -0
- pace_dotnet-0.1.0/pace/__init__.py +6 -0
- pace_dotnet-0.1.0/pace/cli.py +339 -0
- pace_dotnet-0.1.0/pace/commands/__init__.py +11 -0
- pace_dotnet-0.1.0/pace/commands/clean.py +365 -0
- pace_dotnet-0.1.0/pace/commands/dotnet.py +314 -0
- pace_dotnet-0.1.0/pace/commands/format.py +12 -0
- pace_dotnet-0.1.0/pace/commands/git.py +265 -0
- pace_dotnet-0.1.0/pace/commands/init.py +12 -0
- pace_dotnet-0.1.0/pace/commands/test.py +12 -0
- pace_dotnet-0.1.0/pace/commands/upload.py +165 -0
- pace_dotnet-0.1.0/pace/config.py +270 -0
- pace_dotnet-0.1.0/pace/console_helpers.py +14 -0
- pace_dotnet-0.1.0/pace/data/__init__.py +1 -0
- pace_dotnet-0.1.0/pace/data/pace.toml +8 -0
- pace_dotnet-0.1.0/pace/rich_demos/__init__.py +1 -0
- pace_dotnet-0.1.0/pace/rich_demos/columns.py +35 -0
- pace_dotnet-0.1.0/pace/rich_demos/progress_bar.py +37 -0
- pace_dotnet-0.1.0/pace_dotnet.egg-info/PKG-INFO +183 -0
- pace_dotnet-0.1.0/pace_dotnet.egg-info/SOURCES.txt +27 -0
- pace_dotnet-0.1.0/pace_dotnet.egg-info/dependency_links.txt +1 -0
- pace_dotnet-0.1.0/pace_dotnet.egg-info/entry_points.txt +2 -0
- pace_dotnet-0.1.0/pace_dotnet.egg-info/requires.txt +11 -0
- pace_dotnet-0.1.0/pace_dotnet.egg-info/top_level.txt +1 -0
- pace_dotnet-0.1.0/pyproject.toml +63 -0
- pace_dotnet-0.1.0/setup.cfg +4 -0
- pace_dotnet-0.1.0/tests/test_cli.py +12 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pace-dotnet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Project Automation and Configuration Engine - A Python CLI tool for bulk management of C# .NET project ecosystems
|
|
5
|
+
Author: Noremac11800
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Noremac11800/PACE
|
|
8
|
+
Project-URL: Repository, https://github.com/Noremac11800/PACE
|
|
9
|
+
Project-URL: Issues, https://github.com/Noremac11800/PACE/issues
|
|
10
|
+
Keywords: dotnet,.net,cli,project-management,automation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: tomli>=2.4.1
|
|
23
|
+
Requires-Dist: tomli-w>=1.2.0
|
|
24
|
+
Requires-Dist: rich>=13.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.3.4
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pyright>=1.1.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
# **P**roject **A**utomation and **C**onfiguration **E**ngine
|
|
37
|
+
|
|
38
|
+
> A Python CLI tool for bulk management of C# .NET project ecosystems — from single class libraries to complex multi-project hierarchies with MAUI applications.
|
|
39
|
+
|
|
40
|
+
[](https://python.org)
|
|
41
|
+
[](https://dotnet.microsoft.com)
|
|
42
|
+
[](https://dotnet.microsoft.com/apps/maui)
|
|
43
|
+
[](./LICENSE)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Overview
|
|
48
|
+
|
|
49
|
+
PACE eliminates the repetitive, error-prone manual work of managing .NET project ecosystems at scale. Rather than shelling into each project directory to run `dotnet` commands, manage git state, or manually update build configurations, PACE provides a unified interface to interact with all of them at once.
|
|
50
|
+
|
|
51
|
+
It understands your project topology — respecting dependency order, project hierarchy, and configuration context — so you can express intent once and apply it across your entire repository graph.
|
|
52
|
+
|
|
53
|
+
PACE is built for .NET library authors, platform teams, and SDK maintainers who manage production-grade codebases consisting of multiple interconnected components and need reliable, scriptable tooling to keep them in sync.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Target project types
|
|
58
|
+
|
|
59
|
+
| Type | Description |
|
|
60
|
+
|------|-------------|
|
|
61
|
+
| **Class libraries** | Standalone or NuGet-published reusable packages |
|
|
62
|
+
| **MAUI applications** | Cross-platform apps with platform image and build assets |
|
|
63
|
+
| **Dependency trees** | Multi-library hierarchies with topological dependency ordering |
|
|
64
|
+
| **Sample applications** | Reference and demo apps accompanying library suites |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Capabilities
|
|
69
|
+
|
|
70
|
+

|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Design principles
|
|
75
|
+
|
|
76
|
+
**Composability** — individual commands can be piped, scripted, and combined into workflows. PACE is a good Unix citizen.
|
|
77
|
+
|
|
78
|
+
**Topology-awareness** — multi-project operations always respect inter-project dependencies. `CoreLib` is built before `ExtensionLib` before `SampleApp`, automatically.
|
|
79
|
+
|
|
80
|
+
**Transparency** — every operation emits clear, structured output suitable for both human review and CI log parsing. Nothing happens silently.
|
|
81
|
+
|
|
82
|
+
**Reproducibility** — configuration is declared in a manifest file that describes the project graph, repository layout, and per-project overrides. Behaviour is version-controllable alongside the code it manages.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Installation
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
TBD
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Or install from source:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/Noremac11800/PACE.git
|
|
96
|
+
cd PACE
|
|
97
|
+
pip install -e .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Quick start
|
|
103
|
+
|
|
104
|
+
Initialize a manifest in your workspace root:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pace init
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This generates a `pace.toml` describing your project graph. Edit it to reflect your repository layout, then run any command across the full graph:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Build all projects in dependency order
|
|
114
|
+
pace dotnet build
|
|
115
|
+
|
|
116
|
+
# Build projects starting from a specific project
|
|
117
|
+
pace --from ProjectName dotnet build
|
|
118
|
+
|
|
119
|
+
# Check git status across every repo
|
|
120
|
+
pace git status
|
|
121
|
+
|
|
122
|
+
# Run all unit tests and show a summary
|
|
123
|
+
pace test
|
|
124
|
+
|
|
125
|
+
# Format and verify code style
|
|
126
|
+
pace format --check
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
PACE is driven by a `pace.toml` manifest at your workspace root:
|
|
134
|
+
|
|
135
|
+
```toml
|
|
136
|
+
[workspace]
|
|
137
|
+
path = "C:\Applications\Melbourne"
|
|
138
|
+
|
|
139
|
+
[[project]]
|
|
140
|
+
name = "common-lib"
|
|
141
|
+
path = "./common-lib/src/CommonLib/CommonLib.csproj"
|
|
142
|
+
type = "classlib"
|
|
143
|
+
|
|
144
|
+
[[project]]
|
|
145
|
+
name = "feature-module"
|
|
146
|
+
path = "./feature-module/src/FeatureModule/FeatureModule.csproj"
|
|
147
|
+
type = "classlib"
|
|
148
|
+
depends_on = ["common-lib"]
|
|
149
|
+
|
|
150
|
+
[[project]]
|
|
151
|
+
name = "mobile-app"
|
|
152
|
+
path = "./mobile-app/src/MobileApp/MobileApp.csproj"
|
|
153
|
+
type = "maui"
|
|
154
|
+
depends_on = ["feature-module"]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Install in development mode
|
|
163
|
+
pip install -e ".[dev]"
|
|
164
|
+
|
|
165
|
+
# Run tests
|
|
166
|
+
pytest
|
|
167
|
+
|
|
168
|
+
# Format code
|
|
169
|
+
ruff format .
|
|
170
|
+
|
|
171
|
+
# Check code style
|
|
172
|
+
ruff check .
|
|
173
|
+
|
|
174
|
+
# or for safe fixes
|
|
175
|
+
ruff check --fix .
|
|
176
|
+
|
|
177
|
+
# Type check
|
|
178
|
+
pyright
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# **P**roject **A**utomation and **C**onfiguration **E**ngine
|
|
4
|
+
|
|
5
|
+
> A Python CLI tool for bulk management of C# .NET project ecosystems — from single class libraries to complex multi-project hierarchies with MAUI applications.
|
|
6
|
+
|
|
7
|
+
[](https://python.org)
|
|
8
|
+
[](https://dotnet.microsoft.com)
|
|
9
|
+
[](https://dotnet.microsoft.com/apps/maui)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
PACE eliminates the repetitive, error-prone manual work of managing .NET project ecosystems at scale. Rather than shelling into each project directory to run `dotnet` commands, manage git state, or manually update build configurations, PACE provides a unified interface to interact with all of them at once.
|
|
17
|
+
|
|
18
|
+
It understands your project topology — respecting dependency order, project hierarchy, and configuration context — so you can express intent once and apply it across your entire repository graph.
|
|
19
|
+
|
|
20
|
+
PACE is built for .NET library authors, platform teams, and SDK maintainers who manage production-grade codebases consisting of multiple interconnected components and need reliable, scriptable tooling to keep them in sync.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Target project types
|
|
25
|
+
|
|
26
|
+
| Type | Description |
|
|
27
|
+
|------|-------------|
|
|
28
|
+
| **Class libraries** | Standalone or NuGet-published reusable packages |
|
|
29
|
+
| **MAUI applications** | Cross-platform apps with platform image and build assets |
|
|
30
|
+
| **Dependency trees** | Multi-library hierarchies with topological dependency ordering |
|
|
31
|
+
| **Sample applications** | Reference and demo apps accompanying library suites |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Capabilities
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Design principles
|
|
42
|
+
|
|
43
|
+
**Composability** — individual commands can be piped, scripted, and combined into workflows. PACE is a good Unix citizen.
|
|
44
|
+
|
|
45
|
+
**Topology-awareness** — multi-project operations always respect inter-project dependencies. `CoreLib` is built before `ExtensionLib` before `SampleApp`, automatically.
|
|
46
|
+
|
|
47
|
+
**Transparency** — every operation emits clear, structured output suitable for both human review and CI log parsing. Nothing happens silently.
|
|
48
|
+
|
|
49
|
+
**Reproducibility** — configuration is declared in a manifest file that describes the project graph, repository layout, and per-project overrides. Behaviour is version-controllable alongside the code it manages.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
TBD
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or install from source:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/Noremac11800/PACE.git
|
|
63
|
+
cd PACE
|
|
64
|
+
pip install -e .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
Initialize a manifest in your workspace root:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pace init
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This generates a `pace.toml` describing your project graph. Edit it to reflect your repository layout, then run any command across the full graph:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Build all projects in dependency order
|
|
81
|
+
pace dotnet build
|
|
82
|
+
|
|
83
|
+
# Build projects starting from a specific project
|
|
84
|
+
pace --from ProjectName dotnet build
|
|
85
|
+
|
|
86
|
+
# Check git status across every repo
|
|
87
|
+
pace git status
|
|
88
|
+
|
|
89
|
+
# Run all unit tests and show a summary
|
|
90
|
+
pace test
|
|
91
|
+
|
|
92
|
+
# Format and verify code style
|
|
93
|
+
pace format --check
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Configuration
|
|
99
|
+
|
|
100
|
+
PACE is driven by a `pace.toml` manifest at your workspace root:
|
|
101
|
+
|
|
102
|
+
```toml
|
|
103
|
+
[workspace]
|
|
104
|
+
path = "C:\Applications\Melbourne"
|
|
105
|
+
|
|
106
|
+
[[project]]
|
|
107
|
+
name = "common-lib"
|
|
108
|
+
path = "./common-lib/src/CommonLib/CommonLib.csproj"
|
|
109
|
+
type = "classlib"
|
|
110
|
+
|
|
111
|
+
[[project]]
|
|
112
|
+
name = "feature-module"
|
|
113
|
+
path = "./feature-module/src/FeatureModule/FeatureModule.csproj"
|
|
114
|
+
type = "classlib"
|
|
115
|
+
depends_on = ["common-lib"]
|
|
116
|
+
|
|
117
|
+
[[project]]
|
|
118
|
+
name = "mobile-app"
|
|
119
|
+
path = "./mobile-app/src/MobileApp/MobileApp.csproj"
|
|
120
|
+
type = "maui"
|
|
121
|
+
depends_on = ["feature-module"]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Install in development mode
|
|
130
|
+
pip install -e ".[dev]"
|
|
131
|
+
|
|
132
|
+
# Run tests
|
|
133
|
+
pytest
|
|
134
|
+
|
|
135
|
+
# Format code
|
|
136
|
+
ruff format .
|
|
137
|
+
|
|
138
|
+
# Check code style
|
|
139
|
+
ruff check .
|
|
140
|
+
|
|
141
|
+
# or for safe fixes
|
|
142
|
+
ruff check --fix .
|
|
143
|
+
|
|
144
|
+
# Type check
|
|
145
|
+
pyright
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"""CLI entry point for PACE."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
from argparse import Namespace
|
|
7
|
+
from importlib.resources import files
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
# Force UTF-8 encoding for stdout/stderr to avoid encoding issues on Windows
|
|
12
|
+
os.environ["PYTHONIOENCODING"] = "utf-8:replace"
|
|
13
|
+
if sys.platform == "win32":
|
|
14
|
+
# Reconfigure stdout/stderr to use UTF-8 with replace error handling
|
|
15
|
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace") # type: ignore[attr-defined]
|
|
16
|
+
sys.stderr.reconfigure(encoding="utf-8", errors="replace") # type: ignore[attr-defined]
|
|
17
|
+
|
|
18
|
+
import rich
|
|
19
|
+
from rich.console import Console
|
|
20
|
+
from rich.traceback import install
|
|
21
|
+
|
|
22
|
+
from pace.commands import clean, dotnet, git, upload
|
|
23
|
+
from pace.config import Config, load_config
|
|
24
|
+
from pace.rich_demos import columns, progress_bar
|
|
25
|
+
|
|
26
|
+
_DEMOS = {
|
|
27
|
+
"columns": columns.run,
|
|
28
|
+
"progress_bar": progress_bar.run,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class _Option:
|
|
33
|
+
def __init__(self, short: str, long: str, description: str, metavar: str | None = None) -> None:
|
|
34
|
+
self.short = short
|
|
35
|
+
self.long = long
|
|
36
|
+
self.metavar = metavar
|
|
37
|
+
self.description = description
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class _Options:
|
|
41
|
+
DEBUG = _Option("", "--debug", "Enable debug mode with full tracebacks")
|
|
42
|
+
CONFIG = _Option(
|
|
43
|
+
"-C",
|
|
44
|
+
"--config",
|
|
45
|
+
"Path to configuration file. Defaults to an internal pace.toml file.",
|
|
46
|
+
metavar="<path>",
|
|
47
|
+
)
|
|
48
|
+
PRINT_CONFIG = _Option("", "--print-config", "Print the configuration and exit")
|
|
49
|
+
PRINT_CONFIG_PATH = _Option(
|
|
50
|
+
"", "--print-config-path", "Print the path to the configuration file and exit"
|
|
51
|
+
)
|
|
52
|
+
VERSION = _Option("-v", "--version", "Print the version and exit")
|
|
53
|
+
FROM_REPO = _Option(
|
|
54
|
+
"",
|
|
55
|
+
"--from",
|
|
56
|
+
"Starting repository name. Only projects in the dependency chain from this repo will be included.",
|
|
57
|
+
metavar="<reponame>",
|
|
58
|
+
)
|
|
59
|
+
TO_REPO = _Option(
|
|
60
|
+
"",
|
|
61
|
+
"--to",
|
|
62
|
+
"Ending repository name. Only projects in the dependency chain up to this repo will be included.",
|
|
63
|
+
metavar="<reponame>",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class PaceFormatter(argparse.HelpFormatter):
|
|
68
|
+
"""Custom help formatter for PACE CLI."""
|
|
69
|
+
|
|
70
|
+
def _format_usage(self, usage: Any, actions: Any, groups: Any, prefix: Any) -> str: # noqa: ARG002
|
|
71
|
+
"""Override usage formatting to match the desired style."""
|
|
72
|
+
return f"usage: [-h] [{_Options.CONFIG.short} {_Options.CONFIG.metavar}] [OPTIONS] command...\n\n"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def main() -> int:
|
|
76
|
+
"""Main entry point for the PACE CLI.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
Exit code (0 for success, non-zero for failure)
|
|
80
|
+
"""
|
|
81
|
+
console = Console()
|
|
82
|
+
|
|
83
|
+
parser = argparse.ArgumentParser(
|
|
84
|
+
description="PACE - Project Automation and Configuration Engine",
|
|
85
|
+
formatter_class=PaceFormatter,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
parser.add_argument(
|
|
89
|
+
_Options.DEBUG.long,
|
|
90
|
+
action="store_true",
|
|
91
|
+
default=False,
|
|
92
|
+
help="Enable debug mode with full tracebacks",
|
|
93
|
+
)
|
|
94
|
+
parser.add_argument(
|
|
95
|
+
_Options.CONFIG.short,
|
|
96
|
+
_Options.CONFIG.long,
|
|
97
|
+
metavar=_Options.CONFIG.metavar,
|
|
98
|
+
help="Path to configuration file. Defaults to an internal pace.toml file.",
|
|
99
|
+
type=Path,
|
|
100
|
+
)
|
|
101
|
+
parser.add_argument(
|
|
102
|
+
_Options.PRINT_CONFIG.long,
|
|
103
|
+
action="store_true",
|
|
104
|
+
help="Print the loaded configuration",
|
|
105
|
+
default=False,
|
|
106
|
+
)
|
|
107
|
+
parser.add_argument(
|
|
108
|
+
_Options.PRINT_CONFIG_PATH.long,
|
|
109
|
+
action="store_true",
|
|
110
|
+
help="Print the path to the configuration file and exit",
|
|
111
|
+
default=False,
|
|
112
|
+
)
|
|
113
|
+
parser.add_argument(_Options.VERSION.long, action="version", version="pace 0.1.0")
|
|
114
|
+
parser.add_argument(
|
|
115
|
+
_Options.FROM_REPO.long,
|
|
116
|
+
dest="from_repo",
|
|
117
|
+
metavar=_Options.FROM_REPO.metavar,
|
|
118
|
+
help=_Options.FROM_REPO.description,
|
|
119
|
+
default=None,
|
|
120
|
+
)
|
|
121
|
+
parser.add_argument(
|
|
122
|
+
_Options.TO_REPO.long,
|
|
123
|
+
dest="to_repo",
|
|
124
|
+
metavar=_Options.TO_REPO.metavar,
|
|
125
|
+
help=_Options.TO_REPO.description,
|
|
126
|
+
default=None,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
subparsers = parser.add_subparsers(dest="command", metavar="command")
|
|
130
|
+
|
|
131
|
+
clean_parser = subparsers.add_parser(
|
|
132
|
+
"clean", help="Delete build artifacts and NuGet cache for all projects"
|
|
133
|
+
)
|
|
134
|
+
clean_parser.add_argument(
|
|
135
|
+
"--cache",
|
|
136
|
+
action="store_true",
|
|
137
|
+
help="Clean NuGet packages from ~/.nuget/packages",
|
|
138
|
+
default=False,
|
|
139
|
+
)
|
|
140
|
+
clean_parser.add_argument(
|
|
141
|
+
"--custom-cache",
|
|
142
|
+
action="store_true",
|
|
143
|
+
help="Clean NuGet packages from the custom cache path configured in nuget_cache_path",
|
|
144
|
+
default=False,
|
|
145
|
+
)
|
|
146
|
+
clean_parser.add_argument(
|
|
147
|
+
"--project",
|
|
148
|
+
action="store_true",
|
|
149
|
+
help="Clean project bin/ and obj/ directories",
|
|
150
|
+
default=False,
|
|
151
|
+
)
|
|
152
|
+
clean_parser.add_argument(
|
|
153
|
+
"-n",
|
|
154
|
+
"--dry-run",
|
|
155
|
+
action="store_true",
|
|
156
|
+
help="Show what would be deleted without actually deleting",
|
|
157
|
+
default=False,
|
|
158
|
+
)
|
|
159
|
+
dotnet_parser = subparsers.add_parser(
|
|
160
|
+
"dotnet", help="Execute dotnet commands across the project graph"
|
|
161
|
+
)
|
|
162
|
+
dotnet_parser.add_argument(
|
|
163
|
+
"dotnet_args",
|
|
164
|
+
metavar="... <dotnet-args>",
|
|
165
|
+
nargs=argparse.REMAINDER,
|
|
166
|
+
help="Arguments to pass to dotnet (e.g., 'build -c Release')",
|
|
167
|
+
)
|
|
168
|
+
_git_parser = subparsers.add_parser("git", help="Execute git commands across all repositories")
|
|
169
|
+
|
|
170
|
+
# Upload command with arguments
|
|
171
|
+
upload_parser = subparsers.add_parser(
|
|
172
|
+
"upload", help="Upload app packages to the deployment server"
|
|
173
|
+
)
|
|
174
|
+
upload_parser.add_argument(
|
|
175
|
+
"package_path",
|
|
176
|
+
metavar="<path-to-app-package>",
|
|
177
|
+
help="Path to the app package file (.ipa, .msix, .aab, .apk)",
|
|
178
|
+
type=Path,
|
|
179
|
+
)
|
|
180
|
+
upload_parser.add_argument(
|
|
181
|
+
"--username",
|
|
182
|
+
required=True,
|
|
183
|
+
help="Name of the uploader",
|
|
184
|
+
metavar="<username>",
|
|
185
|
+
)
|
|
186
|
+
upload_parser.add_argument(
|
|
187
|
+
"--app-name",
|
|
188
|
+
required=True,
|
|
189
|
+
help="Name of the application",
|
|
190
|
+
metavar="<appname>",
|
|
191
|
+
)
|
|
192
|
+
upload_parser.add_argument(
|
|
193
|
+
"--platform",
|
|
194
|
+
required=True,
|
|
195
|
+
choices=["iOS", "Android", "Windows"],
|
|
196
|
+
help="Target platform",
|
|
197
|
+
metavar="<platform>",
|
|
198
|
+
)
|
|
199
|
+
upload_parser.add_argument(
|
|
200
|
+
"--release-type",
|
|
201
|
+
required=True,
|
|
202
|
+
choices=["Debug", "Release"],
|
|
203
|
+
help="Build configuration",
|
|
204
|
+
metavar="<type>",
|
|
205
|
+
)
|
|
206
|
+
upload_parser.add_argument(
|
|
207
|
+
"--version",
|
|
208
|
+
required=True,
|
|
209
|
+
help="Version number or identifier",
|
|
210
|
+
metavar="<version>",
|
|
211
|
+
)
|
|
212
|
+
upload_parser.add_argument(
|
|
213
|
+
"--endpoint",
|
|
214
|
+
required=True,
|
|
215
|
+
help="Base URL of the deployment server",
|
|
216
|
+
metavar="<url>",
|
|
217
|
+
)
|
|
218
|
+
upload_parser.add_argument(
|
|
219
|
+
"-n",
|
|
220
|
+
"--build-description",
|
|
221
|
+
help="Build notes/description",
|
|
222
|
+
metavar="<description>",
|
|
223
|
+
default=None,
|
|
224
|
+
)
|
|
225
|
+
upload_parser.add_argument(
|
|
226
|
+
"-N",
|
|
227
|
+
"--build-description-from-file",
|
|
228
|
+
help="Read build description from file",
|
|
229
|
+
metavar="<filepath>",
|
|
230
|
+
type=Path,
|
|
231
|
+
default=None,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
demo_parser = subparsers.add_parser("demo", help="Run a built-in demo")
|
|
235
|
+
demo_parser.add_argument(
|
|
236
|
+
"name",
|
|
237
|
+
choices=list(_DEMOS),
|
|
238
|
+
metavar="name",
|
|
239
|
+
help=f"Demo to run. Choices: {', '.join(_DEMOS)}",
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
args: Namespace
|
|
243
|
+
unknownargs: list[str]
|
|
244
|
+
args, unknownargs = parser.parse_known_args()
|
|
245
|
+
|
|
246
|
+
if args.debug:
|
|
247
|
+
install(show_locals=True, suppress=[rich])
|
|
248
|
+
|
|
249
|
+
try:
|
|
250
|
+
return _run(console, args, unknownargs, parser)
|
|
251
|
+
except Exception as e:
|
|
252
|
+
if args.debug:
|
|
253
|
+
raise
|
|
254
|
+
console.print(f"[red]error:[/red] {e}")
|
|
255
|
+
return 1
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def process_options(console: Console, config: Config, args: Namespace) -> bool:
|
|
259
|
+
"""Process configuration options and return True if any were given.
|
|
260
|
+
|
|
261
|
+
Args:
|
|
262
|
+
console: Rich console for output
|
|
263
|
+
config: Loaded configuration
|
|
264
|
+
args: Parsed command line arguments
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
True if any configuration option was given, False otherwise
|
|
268
|
+
"""
|
|
269
|
+
config_path = args.config or files("pace.data").joinpath("pace.toml")
|
|
270
|
+
|
|
271
|
+
was_option_given = False
|
|
272
|
+
if args.print_config_path:
|
|
273
|
+
console.print(config_path)
|
|
274
|
+
was_option_given = True
|
|
275
|
+
|
|
276
|
+
if args.print_config:
|
|
277
|
+
console.print(config)
|
|
278
|
+
was_option_given = True
|
|
279
|
+
|
|
280
|
+
return was_option_given
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def _run(
|
|
284
|
+
console: Console, args: Namespace, unknownargs: list[str], parser: argparse.ArgumentParser
|
|
285
|
+
) -> int:
|
|
286
|
+
if args.config is not None:
|
|
287
|
+
if args.config.exists():
|
|
288
|
+
config = load_config(args.config, from_repo=args.from_repo, to_repo=args.to_repo)
|
|
289
|
+
else:
|
|
290
|
+
return 1
|
|
291
|
+
else:
|
|
292
|
+
config = load_config(from_repo=args.from_repo, to_repo=args.to_repo)
|
|
293
|
+
|
|
294
|
+
was_option_given = process_options(console, config, args)
|
|
295
|
+
|
|
296
|
+
match args.command:
|
|
297
|
+
case "clean":
|
|
298
|
+
clean.run(
|
|
299
|
+
console,
|
|
300
|
+
config,
|
|
301
|
+
cache=args.cache,
|
|
302
|
+
custom_cache=args.custom_cache,
|
|
303
|
+
project=args.project,
|
|
304
|
+
dry_run=args.dry_run,
|
|
305
|
+
)
|
|
306
|
+
case "dotnet":
|
|
307
|
+
return dotnet.run(console, config, args.dotnet_args)
|
|
308
|
+
case "git":
|
|
309
|
+
return git.run(console, config, unknownargs)
|
|
310
|
+
case "upload":
|
|
311
|
+
# Handle build description from file if provided
|
|
312
|
+
build_description = args.build_description
|
|
313
|
+
if args.build_description_from_file:
|
|
314
|
+
try:
|
|
315
|
+
build_description = args.build_description_from_file.read_text()
|
|
316
|
+
except Exception as e:
|
|
317
|
+
console.print(f"[red]Error reading build description file: {e}[/red]")
|
|
318
|
+
return 1
|
|
319
|
+
upload.run(
|
|
320
|
+
console,
|
|
321
|
+
args.package_path,
|
|
322
|
+
args.username,
|
|
323
|
+
args.app_name,
|
|
324
|
+
args.platform,
|
|
325
|
+
args.release_type,
|
|
326
|
+
args.version,
|
|
327
|
+
args.endpoint,
|
|
328
|
+
build_description,
|
|
329
|
+
)
|
|
330
|
+
case "demo":
|
|
331
|
+
_DEMOS[args.name](console, unknownargs)
|
|
332
|
+
case _:
|
|
333
|
+
if not was_option_given:
|
|
334
|
+
parser.print_help()
|
|
335
|
+
return 0
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
if __name__ == "__main__":
|
|
339
|
+
sys.exit(main())
|