PwrAgent Dev Restart
Use this skill when the running Electron app must be stopped and restarted from a freshly updated checkout, especially after merging a PR.
Run the commands below from the checkout you want to restart. The script derives
its default root from its own location, so it targets the checkout it ships in,
including a git worktree.
Workflow
- Confirm the target checkout is updated and clean enough to run:
```bash
git status --short --branch
```
```bash
git log -1 --oneline --decorate
```
- Dry-run the restart to see which processes would be stopped:
```bash
.agents/skills/pwragent-dev-restart/scripts/restart-pwragent-dev.zsh schedule --delay 30 --dry-run
```
- Schedule the restart and answer the user before the delay expires:
```bash
.agents/skills/pwragent-dev-restart/scripts/restart-pwragent-dev.zsh schedule --delay 30
```
- After the delay, verify the app came back:
```bash
tail -120 .local/pwragent-dev-restart.log
```
```bash
pgrep -fl "$PWD|PwrAgent|pnpm.*dev|electron-vite"
```
Script Notes
- The script stops processes matching the target checkout path and their bounded parent dev-server chain, then starts
pnpm dev:devfrom the checkout. - The script discovers running processes by checkout path. It does not require a pidfile or a previous skill-started instance.
- It excludes helper and coding-agent CLI processes whose serialized command
payloads mention the checkout path but are not part of the PwrAgent dev
process tree.
- It also never signals its own ancestors. The shell or agent session that
starts the restart is usually a grandparent or higher, and its command line
can contain the checkout path. schedule passes that protected pid set to the
detached restart-now child, which is reparented and cannot discover it.
- With
--detach-start, the script starts the dev command in a detachedtmuxsession whentmuxis available. This survives parent command cleanup while keeping the dev logs in the configured restart log. - It uses a
nohupsleep wrapper for the delayed timer. Do not uselaunchctl submithere: launchd can keep descendantpnpm devprocesses in the submitted job context and relaunch them after they exit. - Default root is derived from the script location: the checkout that contains
.agents/skills/pwragent-dev-restart/scripts/restart-pwragent-dev.zsh. Pass
--root PATH to target a different checkout.
- The root must be a pnpm workspace root (
package.jsonand
pnpm-workspace.yaml). The script stops processes whose command line matches
the root path, so it refuses a broad root that would match unrelated
processes.
- Default log is
<root>/.local/pwragent-dev-restart.log. - Use
--dry-runbefore scheduling unless the user explicitly asks to restart immediately.