stackforge-cli 0.1.2__py3-none-any.whl → 0.1.4__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.
- stackforge/engines/dotnet/__init__.py +7 -7
- stackforge/engines/dotnet/api_generator.py +313 -312
- stackforge/engines/dotnet/config_generator.py +76 -76
- stackforge/engines/dotnet/csproj_generator.py +82 -82
- stackforge/engines/dotnet/docker_generator.py +63 -63
- stackforge/engines/dotnet/git_generator.py +126 -111
- stackforge/engines/dotnet/layers_generator.py +543 -543
- stackforge/engines/dotnet/program_generator.py +245 -195
- stackforge/engines/dotnet/scaffolder.py +74 -74
- stackforge/project_name.py +34 -34
- stackforge/scaffold.py +90 -80
- stackforge/ui.py +72 -72
- stackforge/version.py +48 -48
- {stackforge_cli-0.1.2.dist-info → stackforge_cli-0.1.4.dist-info}/METADATA +107 -107
- stackforge_cli-0.1.4.dist-info/RECORD +19 -0
- {stackforge_cli-0.1.2.dist-info → stackforge_cli-0.1.4.dist-info}/WHEEL +1 -1
- stackforge_cli-0.1.2.dist-info/RECORD +0 -19
- {stackforge_cli-0.1.2.dist-info → stackforge_cli-0.1.4.dist-info}/entry_points.txt +0 -0
- {stackforge_cli-0.1.2.dist-info → stackforge_cli-0.1.4.dist-info}/top_level.txt +0 -0
|
@@ -1,111 +1,126 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
subprocess.run(["git", "
|
|
105
|
-
ui.file_created("
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
ui.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
import uuid
|
|
2
|
+
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from stackforge import ui
|
|
5
|
+
|
|
6
|
+
def generate_sln(base: Path, project: str):
|
|
7
|
+
layers = ["API", "Application", "Domain", "Infrastructure", "Persistence"]
|
|
8
|
+
configurations = ["Debug|Any CPU", "Release|Any CPU"]
|
|
9
|
+
|
|
10
|
+
project_entries = ""
|
|
11
|
+
project_configs = ""
|
|
12
|
+
for layer in layers:
|
|
13
|
+
guid = "{" + str(uuid.uuid4()).upper() + "}"
|
|
14
|
+
project_entries += f"""Project("{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}") = "{layer}", "{layer}\\{layer}.csproj", "{guid}"
|
|
15
|
+
EndProject
|
|
16
|
+
"""
|
|
17
|
+
for config in configurations:
|
|
18
|
+
project_configs += f"\t\t{guid}.{config}.ActiveCfg = {config}\n"
|
|
19
|
+
project_configs += f"\t\t{guid}.{config}.Build.0 = {config}\n"
|
|
20
|
+
|
|
21
|
+
solution_configs = "".join(f"\t\t{config} = {config}\n" for config in configurations)
|
|
22
|
+
|
|
23
|
+
# Without the Global section, dotnet build/restore on the .sln finds no projects to build.
|
|
24
|
+
content = f"""
|
|
25
|
+
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
26
|
+
# Visual Studio Version 17
|
|
27
|
+
{project_entries}Global
|
|
28
|
+
\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
29
|
+
{solution_configs}\tEndGlobalSection
|
|
30
|
+
\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
31
|
+
{project_configs}\tEndGlobalSection
|
|
32
|
+
EndGlobal
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
file_path = base / f"{project}.sln"
|
|
36
|
+
file_path.write_text(content)
|
|
37
|
+
ui.file_created(f"{project}.sln")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def generate_gitignore(base: Path):
|
|
41
|
+
content = """# Build results
|
|
42
|
+
bin/
|
|
43
|
+
obj/
|
|
44
|
+
out/
|
|
45
|
+
|
|
46
|
+
# Environment
|
|
47
|
+
.env
|
|
48
|
+
|
|
49
|
+
# VS / Rider
|
|
50
|
+
.vs/
|
|
51
|
+
.idea/
|
|
52
|
+
*.user
|
|
53
|
+
|
|
54
|
+
# Logs
|
|
55
|
+
*.log
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
file_path = base / ".gitignore"
|
|
59
|
+
file_path.write_text(content)
|
|
60
|
+
ui.file_created(".gitignore")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def generate_github_workflow(base: Path):
|
|
64
|
+
workflow_dir = base / ".github" / "workflows"
|
|
65
|
+
workflow_dir.mkdir(parents=True, exist_ok=True)
|
|
66
|
+
|
|
67
|
+
content = """name: Sync Environment Branches
|
|
68
|
+
|
|
69
|
+
on:
|
|
70
|
+
push:
|
|
71
|
+
branches:
|
|
72
|
+
- main
|
|
73
|
+
|
|
74
|
+
permissions:
|
|
75
|
+
contents: write
|
|
76
|
+
|
|
77
|
+
jobs:
|
|
78
|
+
sync-branches:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
with:
|
|
83
|
+
fetch-depth: 0
|
|
84
|
+
|
|
85
|
+
- name: Create staging branch if missing
|
|
86
|
+
run: |
|
|
87
|
+
if ! git ls-remote --exit-code origin refs/heads/staging; then
|
|
88
|
+
git push origin HEAD:refs/heads/staging
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
- name: Create development branch if missing
|
|
92
|
+
run: |
|
|
93
|
+
if ! git ls-remote --exit-code origin refs/heads/development; then
|
|
94
|
+
git push origin HEAD:refs/heads/development
|
|
95
|
+
fi
|
|
96
|
+
"""
|
|
97
|
+
file_path = workflow_dir / "sync-branches.yml"
|
|
98
|
+
file_path.write_text(content.lstrip())
|
|
99
|
+
ui.file_created(".github/workflows/sync-branches.yml")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def git_init(base: Path, project: str):
|
|
103
|
+
try:
|
|
104
|
+
subprocess.run(["git", "init", "-b", "main"], cwd=base, check=True, capture_output=True)
|
|
105
|
+
ui.file_created("git init (main)")
|
|
106
|
+
|
|
107
|
+
subprocess.run(["git", "add", "."], cwd=base, check=True, capture_output=True)
|
|
108
|
+
ui.file_created("git add .")
|
|
109
|
+
|
|
110
|
+
subprocess.run(
|
|
111
|
+
["git", "commit", "-m", f"initial: scaffold {project} with stackforge"],
|
|
112
|
+
cwd=base,
|
|
113
|
+
check=True,
|
|
114
|
+
capture_output=True
|
|
115
|
+
)
|
|
116
|
+
ui.file_created("initial commit")
|
|
117
|
+
|
|
118
|
+
subprocess.run(["git", "branch", "staging"], cwd=base, check=True, capture_output=True)
|
|
119
|
+
subprocess.run(["git", "branch", "development"], cwd=base, check=True, capture_output=True)
|
|
120
|
+
ui.file_created("branches: main, staging, development")
|
|
121
|
+
|
|
122
|
+
except subprocess.CalledProcessError as e:
|
|
123
|
+
ui.error(f"Git error: {e}")
|
|
124
|
+
except FileNotFoundError:
|
|
125
|
+
ui.error("Git not found. Make sure Git is installed and in your PATH.")
|
|
126
|
+
|