Skip to content

Commit 13c9adf

Browse files
sgwannabeclaude
andcommitted
feat(commands): /pf:preview slash command (Phase 2)
User-facing manual entry point for re-opening or stopping the local preview server post-H2 (e.g. after a reboot or explicit /pf:preview stop). Wraps scripts/start-preview-server.sh; defaults to most-recent run when run_id omitted. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 421891f commit 13c9adf

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
description: Launch the local preview server for a frozen run (post-H2 or manual re-open)
3+
---
4+
5+
# /pf:preview — Launch the local preview server for a frozen run
6+
7+
**Layer-0 정책**: Pro/Max 기본 포함. 별도 API 키 불필요.
8+
9+
## Usage
10+
11+
```
12+
/pf:preview [run_id]
13+
/pf:preview stop [run_id]
14+
/pf:preview status [run_id]
15+
```
16+
17+
## 인자
18+
19+
- `run_id` (optional): 특정 run. 생략 시 가장 최근 run (`ls -t runs/r-* | head -1`).
20+
21+
## 동작
22+
23+
`bash scripts/start-preview-server.sh runs/<id>/` 호출. `runs/<id>/` 의 내용으로 profile 자동 감지:
24+
25+
1. `docker-compose.yml` 존재 (pro/max) → `docker compose up -d` + 첫 published port → 브라우저 자동 오픈.
26+
2. `apps/api/package.json` + `apps/web/package.json` 존재 (standard) → 의존성 설치 → 18080부터 free port 자동 탐색 → `pnpm dev` 백그라운드 spawn → web TCP accept 대기 (≤60s) → 브라우저 자동 오픈.
27+
3. 둘 다 없음 → exit 2 (TestDD freeze 미완료).
28+
29+
본 명령은 H2 승인 직후 M3가 자동으로 한 번 호출하므로 수동 실행은 보통 **재오픈** 또는 **재기동** 용도다 (서버를 stop 했거나 머신을 재부팅한 경우).
30+
31+
## Idempotency
32+
33+
이미 살아있는 PID 가 `<run_dir>/.preview-server.pid` 에 있으면 재기동 없이 URL 만 다시 연다. 두 번 spawn 되지 않는다.
34+
35+
## 종료
36+
37+
- `/pf:preview stop <run_id>` — SIGTERM → 5s 대기 → SIGKILL fallback. docker 프로필은 `docker compose down`.
38+
- `/pf:preview status <run_id>` — 살아있으면 stdout 에 URL + exit 0, 아니면 exit 1.
39+
40+
## 관련
41+
42+
- 본 명령은 plugin `preview-forge`의 일부입니다.
43+
- 스크립트: `scripts/start-preview-server.sh` (CI 테스트용 `PF_PREVIEW_DRY_RUN=1` 지원).
44+
- Gap B 배경: DEMO-STORYBOARD.md L1:50–2:00 의 자동 localhost:18080 약속.
45+
- 상세 스펙: [preview-forge-proposal.html](../../../preview-forge-proposal.html)

0 commit comments

Comments
 (0)