# PLAN: Windows PowerShell bootstrap 추가 ## 이 파일을 읽는 구현 에이전트에게 이 계획은 `[windows-bootstrap]` 완료만 목표로 하며 `01_core_command` 완료 후 실행해야 한다. predecessor `01_core_command`의 `complete.log`가 없으면 구현을 시작하지 말고 대기한다. ## 배경 마일스톤은 Windows PowerShell bootstrap을 요구하지만 현재 repository에는 shell bootstrap만 있다. Core가 Windows script URL과 command를 반환할 수 있어야 하고, PowerShell script는 zip asset 다운로드, 압축 해제, config 생성, 실행 안내 또는 시작 흐름을 제공해야 한다. ## Roadmap Targets - Milestone: `agent-roadmap/phase/control-plane-product-surface/milestones/cross-os-runner-bootstrap.md` - Epic: `[bootstrap-platforms] Cross-OS bootstrap contract` - Task id: `[windows-bootstrap]` - Completion mode: check-on-pass ## 분석 결과 ### 읽은 파일 - `services/core/internal/httpserver/routes.go` - `services/core/internal/httpserver/bootstrap_provider.go` - `services/core/internal/httpserver/runner_handlers.go` - `services/core/internal/httpserver/server_test.go` - `apps/runner/assets/script/shell/oto_agent_bootstrap.sh` - `apps/runner/test/oto_agent_bootstrap_script_test.dart` - `README.md` - `agent-test/local/rules.md` - `agent-test/local/agent-smoke.md` ### 테스트 환경 규칙 기본 환경은 local이다. Windows 실제 실행 환경은 보장되지 않으므로 parser/text fixture와 Core handler 테스트를 우선 검증으로 둔다. ### 테스트 커버리지 공백 PowerShell script는 아직 파일도 route도 없다. 실제 Windows에서 실행하는 integration smoke는 후속 환경 준비가 필요할 수 있으므로 이 작업은 quoting, zip asset, config key, command generation을 deterministic test로 고정한다. ### 심볼 참조 `/bootstrap/oto-agent.sh`와 embedded shell provider가 현재 유일한 bootstrap asset serving 경로다. Windows에는 별도 `.ps1` route와 provider entry가 필요하다. ### 분할 판단 이 작업은 `03+01_windows_bootstrap`이며 `01_core_command`의 대상 script 계약에 의존한다. Unix script 확장과는 병렬 가능하지만 `04+02,03_binary_contract`, `05+01,02,03_node_connect`의 전제다. ### 범위 결정 근거 PowerShell bootstrap과 Core serving/command 연결만 구현한다. release packaging, checksum/signature, Windows service manager 등록은 범위 제외다. ### 빌드 등급 `cloud-G07`: PowerShell quoting, process invocation, Windows path semantics가 중심이라 높은 주의가 필요하다. ## 의존 관계 및 구현 순서 - 선행: `agent-task/m-cross-os-runner-bootstrap/01_core_command/complete.log` - 병렬 가능: `02_unix_bootstrap` - 후속: `04+02,03_binary_contract`, `05+01,02,03_node_connect` ## 구현 체크리스트 - [ ] PowerShell bootstrap asset을 추가하고 Windows x64/arm64 zip asset 선택을 고정한다. - [ ] Core가 `.ps1` bootstrap asset을 serve하고 Windows command에서 해당 URL을 사용한다. - [ ] script/config 생성 시 기존 agent 설정 의미를 유지하고 enrollment token 출력 노출을 피한다. - [ ] Windows route, content, command, quoting, zip asset 이름을 테스트한다. - [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다. ### [BOOTSTRAP_WINDOWS-1] PowerShell asset 추가 문제: Windows bootstrap script가 없다. 해결 방법: `apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1` 같은 명시적 asset을 추가한다. 새 파일은 기존 파일로 대체할 수 없으므로 생성이 정당하다. 수정 파일 및 체크리스트: - `apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1` - `apps/runner/test/oto_agent_bootstrap_script_test.dart` 또는 별도 runner bootstrap test 테스트 작성: x64/arm64 zip asset, HTTPS release URL, config key, token 비노출, quoting을 fixture로 검증한다. 중간 검증: `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart` ### [BOOTSTRAP_WINDOWS-2] Core route와 command 연결 문제: Core는 shell script만 embed/serve한다. 해결 방법: PowerShell embedded asset과 route를 추가하고 `01_core_command`의 Windows target이 해당 URL을 사용하도록 한다. 수정 파일 및 체크리스트: - `services/core/internal/httpserver/bootstrap_provider.go` - `services/core/internal/httpserver/routes.go` - `services/core/internal/httpserver/runner_handlers.go` - `services/core/internal/httpserver/server_test.go` - `services/core/internal/httpserver/oto_agent_bootstrap.ps1` 테스트 작성: `.ps1` route 응답, Windows command, invalid target regression을 검증한다. 중간 검증: `cd services/core && go test ./...` ## 수정 파일 요약 | 경로 | 목적 | |------|------| | `apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1` | Windows bootstrap 구현 | | `services/core/internal/httpserver/oto_agent_bootstrap.ps1` | Core embedded Windows asset | | `services/core/internal/httpserver/bootstrap_provider.go` | bootstrap provider 확장 | | `services/core/internal/httpserver/routes.go` | `.ps1` route 추가 | | `services/core/internal/httpserver/runner_handlers.go` | Windows command 반환 | | tests | PowerShell/route/command fixture 검증 | ## 최종 검증 - `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart` - `cd services/core && go test ./...` - `cd apps/runner && dart analyze` 모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.