Merge remote-tracking branch 'origin/master' into feat/zsetup-command

This commit is contained in:
KellyMichels 2026-07-24 17:59:35 -05:00
commit dc171e02f7
4 changed files with 39 additions and 5 deletions

View File

@ -22,6 +22,11 @@ Notable changes to the Evomedia.net Token Savers.
credentials and RSA signing keys.
### Added
- **`zkill all`** — `zkill` now accepts `all`, stopping the dev server of
every project that has a `ports.dev` (edge/docker stacks with no local dev
server are skipped). Brings it in line with `zdeploy all` / `zbackup all`;
the one-shot "stop everything I've got running locally". Ported to both the
PowerShell and bash versions.
- **`zdeploy` server-side health verification (`verify` block)** — projects
not published through the edge proxy can declare
`"verify": { "port": ..., "path": "/health", "expect": "..." }` and the

View File

@ -118,7 +118,7 @@ The `.cmd` wrappers are the everyday interface. Every command takes one or more
| `zsetup <key> ...` | Create the project's Python venv + install deps (or `npm install` for node) |
| `zstart <key> ...` | Start local dev server(s) |
| `zstartd <key> ...` | Same, detached (new window, returns immediately) |
| `zkill <key> ...` | Kill local dev server(s) by port |
| `zkill <key> ... \| all` | Kill local dev server(s) by port |
| `zrestart <key> ...` | Kill + start in one step |
| `zrestartd <key> ...` | Kill + start detached |
| `zdeploy <key> ... \| all` | Zip → upload → rebuild → verify a project on the server |
@ -150,14 +150,15 @@ zstartd nextapp # detached: window opens, prompt returns
#### `zkill` — stop dev servers
```
zkill <project> [<project> ...] [-Port N] [-KillAll]
zkill <project> [<project> ...] | all [-Port N] [-KillAll]
```
Finds whatever is LISTENING on each project's dev port and kills it — along with its whole process tree, children first. That matters for auto-reloading servers (uvicorn/watchfiles, nodemon): their worker processes inherit the listening socket and would otherwise survive as orphans, serving stale code. `-KillAll` also hunts down stray `node`/`python`/`next-server` processes whose command line references the project folder.
Finds whatever is LISTENING on each project's dev port and kills it — along with its whole process tree, children first. That matters for auto-reloading servers (uvicorn/watchfiles, nodemon): their worker processes inherit the listening socket and would otherwise survive as orphans, serving stale code. `-KillAll` also hunts down stray `node`/`python`/`next-server` processes whose command line references the project folder. `all` targets every project that has a dev port — the one-shot "stop everything I've got running locally".
```powershell
zkill viteapp # free the port
zkill pyapp viteapp nextapp # nuke everything
zkill all # stop every project's dev server
zkill nextapp -KillAll # also kill orphaned runtime processes
```

View File

@ -26,11 +26,26 @@ Start-ZTracking
if ($Projects.Count -eq 0) {
$keys = (Get-ZProjectKeys) -join ', '
Write-Host ""
Write-Host "Usage: zkill <project> [<project> ...] [-Port N] [-KillAll]" -ForegroundColor Yellow
Write-Host "Usage: zkill <project> [<project> ...] | all [-Port N] [-KillAll]" -ForegroundColor Yellow
Write-Host " Projects in zconfig.json: $keys" -ForegroundColor Gray
Write-Host " 'all' stops the dev server of every project that has one." -ForegroundColor Gray
Stop-ZTracking; exit 1
}
# Tolerate switch-style args (zkill -myproject) from muscle memory.
$Projects = @($Projects | ForEach-Object { $_.TrimStart('-') })
# 'all' -> every project that actually has a local dev server (a ports.dev).
if ($Projects -contains 'all') {
$cfg = Get-ZConfig
$Projects = @(Get-ZProjectKeys | Where-Object { $cfg.projects.$_.ports -and $cfg.projects.$_.ports.dev })
if ($Projects.Count -eq 0) {
Write-Host "No projects have a dev port to kill." -ForegroundColor Yellow
Stop-ZTracking; exit 0
}
Write-Host "Killing dev servers for: $($Projects -join ', ')" -ForegroundColor Cyan
}
foreach ($key in $Projects) {
$proj = Get-ZProject -Key $key
$devPort = if ($Port -gt 0) { $Port } elseif ($proj.ports -and $proj.ports.dev) { [int]$proj.ports.dev } else { 0 }

View File

@ -26,11 +26,24 @@ while [ $# -gt 0 ]; do
done
if [ "${#projects[@]}" -eq 0 ]; then
warn "Usage: zkill <project> [<project> ...] [--port N] [--kill-all]"
warn "Usage: zkill <project> [<project> ...] | all [--port N] [--kill-all]"
dim " Projects in zconfig.json: $(zproj_csv)"
dim " 'all' stops the dev server of every project that has one."
exit 1
fi
# 'all' -> every project that actually has a local dev server (a ports.dev).
if printf '%s\n' "${projects[@]}" | grep -qx 'all'; then
dev_keys=(); while IFS= read -r _zl || [ -n "$_zl" ]; do dev_keys+=("$_zl"); done \
< <(jq -r '.projects | to_entries[] | select((.key | startswith("_") | not) and .value.ports.dev != null) | .key' "$ZCONFIG")
if [ "${#dev_keys[@]}" -eq 0 ]; then
warn "No projects have a dev port to kill."
exit 0
fi
projects=("${dev_keys[@]}")
info "Killing dev servers for: $(printf '%s ' "${projects[@]}")"
fi
# --kill-all (kill stray project processes beyond the dev-port listener) isn't
# ported yet; announce it rather than silently accepting the flag and doing nothing.
[ "$kill_all" -eq 1 ] && warn "Note: --kill-all isn't implemented in the bash port yet - killing dev-port listeners only."