This commit is contained in:
MerwelLabs 2026-01-10 02:30:13 -05:00 committed by GitHub
commit 816a99a0ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 143 additions and 0 deletions

24
AUTORUN_README.md Normal file
View file

@ -0,0 +1,24 @@
Install and autorun for text-generation-webui (Windows)
This folder contains helper scripts to install the web UI as an autorun service on your Windows user account.
Files:
- `start_webui_minimized.ps1` — PowerShell script that launches the web UI server using the venv Python; starts minimized.
- `install_autostart.bat` — Creates a shortcut in your Windows Startup folder to run the PowerShell script at login.
How to install (one-time):
1. Double-click `install_autostart.bat` and allow it to run. This will create a shortcut named `TextGenWebUI.lnk` in your Startup folder.
2. The next time you log into Windows, the web UI will start automatically minimized using the project's venv.
Start now (manual):
- To start immediately without waiting for login, run the PowerShell script manually (right-click and select "Run with PowerShell") or run:
powershell -NoProfile -ExecutionPolicy Bypass -File "start_webui_minimized.ps1"
Stop/remove autorun:
- Delete `TextGenWebUI.lnk` from your Startup folder. You can open the Startup folder with:
explorer.exe shell:startup
Notes & troubleshooting:
- The scripts assume the project is at `D:\AI_ML_Development\text-generation-webui` and the venv exists at `venv` inside the project. If you move the project, edit `start_webui_minimized.ps1`.
- Ensure your PowerShell ExecutionPolicy allows running scripts. `install_autostart.bat` sets `-ExecutionPolicy Bypass` when launching the script.
- Logs: by default the script starts the server without redirecting output. To capture logs, edit `start_webui_minimized.ps1` and use the `-RedirectStandardOutput` / `-RedirectStandardError` options (commented in file).

40
clone_merwel_repos.ps1 Normal file
View file

@ -0,0 +1,40 @@
# Clone or update all repositories for MerwelLabs into the specified destination
$dest = 'D:\OneDrive_Merwel\OneDrive\Github'
$gh = 'C:\Program Files\GitHub CLI\gh.exe'
if (!(Test-Path $gh)) {
Write-Error "gh not found at $gh. Ensure GitHub CLI is installed and on PATH."
exit 1
}
New-Item -ItemType Directory -Path $dest -Force | Out-Null
Write-Output "Listing repositories for MerwelLabs..."
$reposJson = & $gh repo list MerwelLabs --limit 1000 --json name,sshUrl,visibility
if (-not $reposJson) {
Write-Output "No repos found or gh returned nothing."
exit 0
}
$repos = $reposJson | ConvertFrom-Json
foreach ($r in $repos) {
$dir = Join-Path $dest $r.name
if (Test-Path $dir) {
Write-Output "Updating $($r.name)..."
try {
git -C $dir pull --rebase
} catch {
Write-Warning "Failed to pull $($r.name): $_"
}
} else {
Write-Output "Cloning $($r.name)..."
try {
git clone $r.sshUrl $dir
} catch {
Write-Warning "Failed to clone $($r.name): $_"
}
}
}
Write-Output "Done. Repositories are in: $dest"

8
install_autostart.bat Normal file
View file

@ -0,0 +1,8 @@
@echo off
REM Creates a shortcut in the current user's Startup folder to run the web UI minimized at login.
set SCRIPT_PATH=%~dp0start_webui_minimized.ps1
necho Creating startup shortcut...
powershell -NoProfile -ExecutionPolicy Bypass -Command "$WshShell = New-Object -ComObject WScript.Shell; $startup = [Environment]::GetFolderPath('Startup'); $sc = $WshShell.CreateShortcut((Join-Path $startup 'TextGenWebUI.lnk')); $sc.TargetPath = 'powershell.exe'; $sc.Arguments = '-NoProfile -ExecutionPolicy Bypass -File "' + '%SCRIPT_PATH%' + '"'; $sc.IconLocation = '%~dp0venv\Scripts\python.exe'; $sc.WindowStyle = 7; $sc.Save()"
echo Shortcut created in your Startup folder.
echo To remove it, delete the file 'TextGenWebUI.lnk' from the Startup folder.
pause

14
start_webui_minimized.ps1 Normal file
View file

@ -0,0 +1,14 @@
# Start text-generation-webui in the project's venv, minimized.
# Created by automation. To edit, update this file in the project folder.
$ProjectPath = 'D:\AI_ML_Development\text-generation-webui'
$Python = Join-Path $ProjectPath 'venv\Scripts\python.exe'
# Launch the server in portable mode with API enabled.
# Use Minimized window style so the console doesn't pop up.
Start-Process -FilePath $Python -ArgumentList 'server.py','--portable','--api' -WorkingDirectory $ProjectPath -WindowStyle Minimized
# Optional: redirect output to a log file instead of showing console.
# To enable logging, uncomment the following lines and edit the log path.
# $log = Join-Path $ProjectPath 'autorun.log'
# Start-Process -FilePath $Python -ArgumentList 'server.py','--portable','--api' -WorkingDirectory $ProjectPath -WindowStyle Minimized -RedirectStandardOutput $log -RedirectStandardError $log

57
sync_merwel_repos.ps1 Normal file
View file

@ -0,0 +1,57 @@
<#
PowerShell script to sync MerwelLabs GitHub repositories into the OneDrive folder.
Writes logs to D:\OneDrive_Merwel\OneDrive\Github\sync_logs and keeps the last 30 logs.
#>
$dest = 'D:\OneDrive_Merwel\OneDrive\Github'
$gh = 'C:\Program Files\GitHub CLI\gh.exe'
$logDir = Join-Path $dest 'sync_logs'
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
$timestamp = (Get-Date).ToString('yyyy-MM-dd_HHmmss')
$logFile = Join-Path $logDir "sync_$timestamp.log"
Start-Transcript -Path $logFile -Force
Write-Output "=== MerwelLabs repo sync started: $(Get-Date -Format o) ==="
if (!(Test-Path $gh)) {
Write-Error "gh not found at $gh. Exiting."
Stop-Transcript
exit 1
}
Write-Output "Listing repositories for MerwelLabs..."
$reposJson = & $gh repo list MerwelLabs --limit 1000 --json name,sshUrl,visibility
if (-not $reposJson) {
Write-Output "No repos found or gh returned nothing."
Stop-Transcript
exit 0
}
$repos = $reposJson | ConvertFrom-Json
foreach ($r in $repos) {
$dir = Join-Path $dest $r.name
if (Test-Path $dir) {
Write-Output "Updating $($r.name)..."
try {
git -C $dir pull --rebase 2>&1 | ForEach-Object { Write-Output $_ }
} catch {
Write-Warning "Failed to pull $($r.name): $_"
}
} else {
Write-Output "Cloning $($r.name)..."
try {
git clone $r.sshUrl $dir 2>&1 | ForEach-Object { Write-Output $_ }
} catch {
Write-Warning "Failed to clone $($r.name): $_"
}
}
}
Write-Output "=== MerwelLabs repo sync finished: $(Get-Date -Format o) ==="
Stop-Transcript
# Rotate logs: keep last 30 log files
Get-ChildItem -Path $logDir -Filter 'sync_*.log' | Sort-Object LastWriteTime -Descending | Select-Object -Skip 30 | Remove-Item -Force -ErrorAction SilentlyContinue