feat: add gitea-deploy skill, tools, and sdlc foreground service rule
- skills/gitea-deploy/: new skill for Gitea deployment automation - tools/: shared utility scripts - skills/sdlc/SKILL.md: add Foreground Service Rule for long-running processes (background start + readiness polling pattern)
This commit is contained in:
@@ -220,6 +220,48 @@ Output format — `impl-plan.md`:
|
||||
- Update `specs/STATUS.md` to reflect current progress.
|
||||
- Do not proceed to Phase 6 until all tasks in impl-plan are implemented.
|
||||
|
||||
### Foreground Service Rule
|
||||
|
||||
Some tasks require starting a long-running foreground service (e.g. `uvicorn`, `npm run dev`, `docker run`, `flask run`). These commands block the terminal and will stall the implementation plan if run synchronously.
|
||||
|
||||
**Rule: Always start foreground services in the background and verify readiness before continuing.**
|
||||
|
||||
Pattern:
|
||||
```bash
|
||||
# Start in background, redirect logs
|
||||
<command> > /tmp/<service>.log 2>&1 &
|
||||
SERVICE_PID=$!
|
||||
|
||||
# Wait for readiness (poll the health endpoint or log output)
|
||||
for i in $(seq 1 30); do
|
||||
if <readiness-check>; then
|
||||
echo "<service> is ready"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
```
|
||||
|
||||
Readiness check by service type:
|
||||
|
||||
| Service | Readiness Check |
|
||||
|---|---|
|
||||
| HTTP server (uvicorn, flask, fastapi, express, vite) | `curl -sf http://localhost:<port>` |
|
||||
| Vite dev server | `curl -sf http://localhost:5173` (or configured port) |
|
||||
| Docker container | `docker inspect --format='{{.State.Health.Status}}' <name>` == `healthy`; or `curl` the exposed port |
|
||||
| PostgreSQL | `pg_isready -h localhost -p 5432` |
|
||||
| Redis | `redis-cli ping` |
|
||||
| Generic TCP port | `nc -z localhost <port>` |
|
||||
|
||||
After the readiness check passes, continue with the next implementation step. If the service fails to become ready within 30 seconds, print the last 20 lines of the log file and stop:
|
||||
```bash
|
||||
echo "Service failed to start. Last logs:"
|
||||
tail -20 /tmp/<service>.log
|
||||
exit 1
|
||||
```
|
||||
|
||||
**Never use `&& sleep N` as a substitute for a real readiness check.** Fixed sleeps are fragile — use polling loops instead.
|
||||
|
||||
---
|
||||
|
||||
## Phase 6 — Verification
|
||||
|
||||
Reference in New Issue
Block a user