Skip to content

Commit a2efa8e

Browse files
committed
Small improvements & bug fixes
1 parent 82d49f3 commit a2efa8e

File tree

19 files changed

+473
-87
lines changed

19 files changed

+473
-87
lines changed

.github/scripts/check_relevance.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import subprocess
2+
import sys
3+
4+
def get_last_tag():
5+
try:
6+
result = subprocess.run(
7+
["git", "tag", "--sort=-creatordate"],
8+
capture_output=True, text=True, check=True
9+
)
10+
tags = result.stdout.strip().split('\n')
11+
return tags[0] if tags and tags[0] else None
12+
except:
13+
return None
14+
15+
def has_relevant_changes(since_tag):
16+
if not since_tag:
17+
return True
18+
19+
range_spec = f"{since_tag}..HEAD"
20+
try:
21+
result = subprocess.run(
22+
["git", "diff", "--name-only", range_spec],
23+
capture_output=True, text=True, check=True
24+
)
25+
changed_files = result.stdout.strip().split('\n')
26+
27+
ignored_prefixes = [".github/", "docs/", "tests/", "README.md", ".gitignore", "LICENSE", "TODO.md"]
28+
29+
for f in changed_files:
30+
if not f: continue
31+
is_ignored = False
32+
for prefix in ignored_prefixes:
33+
if f.startswith(prefix) or f == prefix:
34+
is_ignored = True
35+
break
36+
if not is_ignored:
37+
print(f"Relevant change detected in: {f}")
38+
return True
39+
return False
40+
except:
41+
return True # Default to true if something fails
42+
43+
def main():
44+
last_tag = get_last_tag()
45+
if has_relevant_changes(last_tag):
46+
print("relevance=true")
47+
sys.exit(0)
48+
else:
49+
print("relevance=false")
50+
sys.exit(0)
51+
52+
if __name__ == "__main__":
53+
main()

.github/scripts/generate_changelog.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def parse_commits(commits):
4040

4141
categories = {
4242
"Features": [],
43-
"Fixes": [],
43+
"Bug Fixes": [],
44+
"Styling": [],
4445
"Documentation": [],
4546
"Maintenance": [],
4647
"Other": []
@@ -57,7 +58,9 @@ def parse_commits(commits):
5758
if lower_commit.startswith("feat"):
5859
categories["Features"].append(commit)
5960
elif lower_commit.startswith("fix"):
60-
categories["Fixes"].append(commit)
61+
categories["Bug Fixes"].append(commit)
62+
elif lower_commit.startswith("style"):
63+
categories["Styling"].append(commit)
6164
elif lower_commit.startswith("docs"):
6265
categories["Documentation"].append(commit)
6366
elif lower_commit.startswith(tuple(["chore", "refactor", "style", "test", "ci", "build"])):
@@ -73,8 +76,8 @@ def generate_markdown(categories):
7376
"""Generates markdown string from categories."""
7477
md = []
7578

76-
# Order: Feat, Fix, Docs, Maint, Other
77-
order = ["Features", "Fixes", "Documentation", "Maintenance", "Other"]
79+
# Order: Feat, Fix, Style, Docs, Maint, Other
80+
order = ["Features", "Bug Fixes", "Styling", "Documentation", "Maintenance", "Other"]
7881

7982
for cat in order:
8083
items = categories.get(cat, [])
@@ -102,15 +105,11 @@ def main():
102105
pr_count, categories = parse_commits(commits)
103106
print(f"Detected {pr_count} Pull Requests")
104107

105-
# Threshold: If less than 2 PRs, generate commit-based changelog
106-
if pr_count < 2:
107-
print("Generating commit-based changelog...")
108-
changelog_md = generate_markdown(categories)
109-
if not changelog_md:
110-
changelog_md = "No significant changes detected."
111-
else:
112-
print("Sufficient PRs detected. Skipping custom changelog generation.")
113-
changelog_md = ""
108+
# Always generate categorized output if we have commits
109+
print("Generating categorized changelog...")
110+
changelog_md = generate_markdown(categories)
111+
if not changelog_md:
112+
changelog_md = "No significant changes detected."
114113

115114
if args.output:
116115
with open(args.output, "w", encoding='utf-8') as f:

.github/scripts/release_summary.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import sys
2+
import os
3+
4+
def main():
5+
if len(sys.argv) < 3:
6+
print("Usage: python release_summary.py <version> <repo_url>")
7+
sys.exit(1)
8+
9+
version = sys.argv[1].lstrip('v')
10+
repo_url = sys.argv[2].rstrip('/')
11+
base_url = f"{repo_url}/releases/download/v{version}"
12+
13+
assets = [
14+
("SwitchCraft-windows.exe", "Modern GUI for Windows (64-bit)"),
15+
("SwitchCraft-linux", "Modern GUI for Linux"),
16+
("SwitchCraft-macos", "Modern GUI for macOS"),
17+
("SwitchCraft-Setup.exe", "Windows Installer (Modern)"),
18+
("SwitchCraft-Legacy.exe", "Legacy GUI for older Windows"),
19+
("SwitchCraft-Legacy-Setup.exe", "Legacy Windows Installer"),
20+
("SwitchCraft-CLI-windows.exe", "Command Line Interface (Windows)"),
21+
]
22+
23+
print("\n## Download Overview\n")
24+
print("| Asset | Description | Direct Download |")
25+
print("| :--- | :--- | :--- |")
26+
27+
for filename, desc in assets:
28+
download_url = f"{base_url}/{filename}"
29+
print(f"| `{filename}` | {desc} | [Download]({download_url}) |")
30+
31+
if __name__ == "__main__":
32+
main()

.github/workflows/nightly.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Nightly Release
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0' # Every Sunday at 00:00
6+
workflow_dispatch: # Allow manual trigger for testing
7+
8+
jobs:
9+
check_relevance:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
relevance: ${{ steps.check.outputs.relevance }}
13+
steps:
14+
- uses: actions/checkout@v6
15+
with:
16+
fetch-depth: 0
17+
- name: Set up Python
18+
uses: actions/setup-python@v6
19+
with:
20+
python-version: '3.14'
21+
- name: Check for relevant changes
22+
id: check
23+
run: |
24+
RELEVANCE=$(python .github/scripts/check_relevance.py | grep "relevance=" | cut -d= -f2)
25+
echo "relevance=$RELEVANCE" >> "$GITHUB_OUTPUT"
26+
27+
trigger_release:
28+
needs: check_relevance
29+
if: needs.check_relevance.outputs.relevance == 'true'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Trigger Release Workflow
33+
run: |
34+
gh workflow run release.yml -f release_type=development
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ jobs:
6666
echo 'EOF'
6767
} >> "$GITHUB_ENV"
6868
69+
- name: Generate Summary Table
70+
id: summary
71+
run: |
72+
VERSION="${{ steps.version.outputs.version }}"
73+
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
74+
python .github/scripts/release_summary.py "$VERSION" "$REPO_URL" > summary.md
75+
# Read summary content into a variable safely (multiline)
76+
{
77+
echo 'SUMMARY_BODY<<EOF'
78+
cat summary.md
79+
echo ""
80+
echo 'EOF'
81+
} >> "$GITHUB_ENV"
82+
6983
- name: Commit and Tag
7084
run: |
7185
VERSION="${{ steps.version.outputs.version }}"
@@ -94,10 +108,14 @@ jobs:
94108
tag_name: v${{ steps.version.outputs.version }}
95109
name: ${{ github.event.inputs.release_type == 'stable' && format('Release v{0}', steps.version.outputs.version) || github.event.inputs.release_type == 'prerelease' && format('Pre-release v{0}', steps.version.outputs.version) || format('Development Build v{0}', steps.version.outputs.version) }}
96110
body: |
97-
![Downloads](https://img.shields.io/github/downloads/FaserF/SwitchCraft/v${{ steps.version.outputs.version }}/total?color=blue&style=flat-square)
111+
![Downloads](https://img.shields.io/github/downloads/${{ github.repository }}/v${{ steps.version.outputs.version }}/total?color=blue&style=flat-square)
98112
99113
${{ env.CHANGELOG_BODY }}
100114
115+
---
116+
117+
${{ env.SUMMARY_BODY }}
118+
101119
draft: false
102120
prerelease: ${{ github.event.inputs.release_type != 'stable' }}
103121
generate_release_notes: true

src/generate_addons.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ def update_context(self, data):
3535
self.ctx = data
3636
def ask(self, query):
3737
q = query.lower()
38-
if "who are you" in q: return "I am SwitchCraft AI"
39-
if "wer bist du" in q: return "Ich bin SwitchCraft AI"
38+
if "hi" in q or "hallo" in q:
39+
return "Hallo! Ich bin der interner SwitchCraft AI Helper. Wie kann ich dir heute beim Paketieren helfen?"
40+
if "who are you" in q or "wer bist du" in q:
41+
return "I am the built-in SwitchCraft AI Assistant. I can help with silent switches, MSI properties, and Intune deployments."
4042
if "silent" in q or "switches" in q:
4143
sw = self.ctx.get("install_silent", "/S")
42-
if "what" in q:
43-
return f"detected these silent switches: {sw}"
44-
return f"folgende Switches gefunden: {sw}"
45-
return f"Simulated Response: You asked '{query}'. (This is a local placeholder AI)"
44+
return f"Für dieses Paket wurden folgende Silent-Switches erkannt: `{sw}`. Du kannst diese im Packaging Wizard noch anpassen."
45+
if "intune" in q:
46+
return "Um Apps nach Intune hochzuladen, stelle sicher, dass du die Graph API Credentials in den Einstellungen hinterlegt hast."
47+
return f"Ich habe deine Frage zu '{query}' verstanden, kann aber ohne aktive Gemini/OpenAI Verbindung keine tiefergehende Analyse durchführen. Nutze den Packaging Wizard für automatische Erkennungen!"
4648
"""
4749
create_addon("AI Assistant", "ai", {"service.py": ai_service_code})
4850

src/switchcraft/assets/lang/de.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
{
22
"app_title": "SwitchCraft Legacy 🧙‍♂️",
3+
"running_as_admin": "Status: Administrator ✅",
4+
"running_as_user": "Status: Standard-Benutzer 👤",
35
"nav_home": "Startseite",
6+
"cat_dashboard": "Dashboard",
7+
"cat_apps_devices": "Apps & Geräte",
8+
"cat_tools": "Werkzeuge",
9+
"cat_system": "System",
410
"nav_apps": "Apps (Winget)",
511
"nav_analyze": "Analyse",
6-
"nav_generate": "Generieren",
12+
"nav_helper": "KI Helfer",
713
"nav_intune": "Intune",
14+
"nav_intune_store": "Intune Store",
15+
"nav_scripts": "Skripte",
16+
"nav_macos": "macOS Utility",
817
"nav_history": "Verlauf",
918
"nav_settings": "Einstellungen",
19+
"nav_wizard": "Generieren (Wizard)",
20+
"nav_tester": "Detection Tester",
21+
"nav_stacks": "Stack Manager",
22+
"nav_dashboard": "Dashboard",
23+
"nav_library": "Library",
24+
"nav_groups": "Gruppen-Manager",
25+
"nav_winget_create": "Winget Creator",
1026
"tab_analyzer": "Analyse",
1127
"tab_helper": "KI Helfer",
1228
"tab_winget": "Winget Store",
@@ -75,7 +91,7 @@
7591
"brought_by": "Ein Projekt von Fabian Seitz (FaserF)",
7692
"msi_wrapper_tip": "💡 MSI Wrapper erkannt! Standard MSI-Switches funktionieren möglicherweise.",
7793
"found_params": "Gefundene Parameter",
78-
"known_params": "Bekannte Parameter",
94+
"known_params": "Parameter-Erklärungen",
7995
"unknown_params": "Unbekannte Parameter",
8096
"param_explanation": "Erklärung",
8197
"ai_smalltalk_hello": "Hallo! 👋 Wie kann ich helfen?",
@@ -180,7 +196,7 @@
180196
"create_intunewin_pkg": "📦 .intunewin Paket erstellen",
181197
"test_install_local": "▶ Test Installation (Lokal)",
182198
"extract_archive_btn": "📦 Archiv entpacken",
183-
"view_full_params": "🔍 Ganze Parameter-Details anzeigen",
199+
"view_full_params": "Detaillierte Analysedaten anzeigen",
184200
"confirm_automation": "Automatisierung bestätigen",
185201
"confirm_automation_msg": "Dies wird versuchen:\n1. Skript generieren & signieren\n2. Lokalen Install/Uninstall Test ausführen (Admin benötigt)\n3. IntuneWin Paket erstellen\n4. Nach Intune hochladen\n\nFortfahren?",
186202
"config_warning": "Konfigurations-Warnung",
@@ -461,10 +477,6 @@
461477
"cloud_backup_create": "Cloud Backup erstellen",
462478
"no_switches_intune_warn": "Warnung: Keine Silent Switches erkannt.",
463479
"click_to_open": "Klicken zum Öffnen",
464-
"cat_dashboard": "Dashboard",
465-
"cat_apps_devices": "Apps & Geräte",
466-
"cat_tools": "Werkzeuge",
467-
"cat_system": "System",
468480
"quick_actions": "Schnellzugriffe",
469481
"notif_open_logs": "Logs öffnen",
470482
"notif_open_changelog": "Changelog öffnen",

src/switchcraft/assets/lang/en.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
{
22
"app_title": "SwitchCraft Legacy 🧙‍♂️",
3+
"running_as_admin": "Status: Administrator ✅",
4+
"running_as_user": "Status: Standard User 👤",
35
"nav_home": "Home",
6+
"cat_dashboard": "Dashboard",
7+
"cat_apps_devices": "Apps & Devices",
8+
"cat_tools": "Tools",
9+
"cat_system": "System",
410
"nav_apps": "Winget Store",
511
"nav_analyze": "Analyzer",
6-
"nav_generate": "Generate",
12+
"nav_helper": "AI Helper",
713
"nav_intune": "Intune Utility",
14+
"nav_intune_store": "Intune Store",
15+
"nav_scripts": "Scripts",
16+
"nav_macos": "macOS Utility",
817
"nav_history": "History",
918
"nav_settings": "Settings",
19+
"nav_wizard": "Generate (Wizard)",
20+
"nav_tester": "Detection Tester",
21+
"nav_stacks": "Stack Manager",
22+
"nav_dashboard": "Dashboard",
23+
"nav_library": "Library",
24+
"nav_groups": "Group Manager",
25+
"nav_winget_create": "Winget Creator",
1026
"tab_analyzer": "Analyzer",
1127
"tab_helper": "AI Helper",
1228
"tab_winget": "Winget",
@@ -74,7 +90,7 @@
7490
"brought_by": "Brought to you by Fabian Seitz (FaserF)",
7591
"msi_wrapper_tip": "💡 Detected MSI Wrapper! Standard MSI switches may work.",
7692
"found_params": "Found Parameters",
77-
"known_params": "Known Parameters",
93+
"known_params": "Parameter Explanations",
7894
"unknown_params": "Unknown Parameters",
7995
"param_explanation": "Explanation",
8096
"ai_smalltalk_hello": "Hello! 👋 How can I help you regarding packaging?",
@@ -160,7 +176,7 @@
160176
"create_intunewin_pkg": "📦 Create .intunewin Package",
161177
"test_install_local": "▶ Test Install (Local)",
162178
"extract_archive_btn": "📦 Extract Archive",
163-
"view_full_params": "🔍 View Full Parameter Details",
179+
"view_full_params": "View Detailed Analysis Data",
164180
"confirm_automation": "Confirm Automation",
165181
"confirm_automation_msg": "This will attempt to:\n1. Generate & Sign Script\n2. Run Local Install/Uninstall Test (Requires Admin)\n3. Create IntuneWin Package\n4. Upload to Intune\n\nContinue?",
166182
"config_warning": "Config Warning",
@@ -461,10 +477,6 @@
461477
"cloud_backup_create": "Create Cloud Backup",
462478
"no_switches_intune_warn": "Warning: No silent switches detected.",
463479
"click_to_open": "Click to open",
464-
"cat_dashboard": "Dashboard",
465-
"cat_apps_devices": "Apps & Devices",
466-
"cat_tools": "Tools",
467-
"cat_system": "System",
468480
"quick_actions": "Quick Actions",
469481
"notif_open_logs": "Open Logs",
470482
"notif_open_changelog": "Open Changelog",

0 commit comments

Comments
 (0)