iop/agent-task/02+edge_opsconsole_package/plan_cloud_G07_0.log
toki 6e2a1fc2f2 feat: edge runtime, opsconsole, CLI target terminology, and e2e validation updates
- Add edge runtime config and opsconsole package
- Refactor edge console to use new runtime config
- Add service source metadata support
- Update CLI adapter with target terminology
- Add edge operation contract and event bus replay
- Update node label and command ops surface
- Add E2E smoke tests and full validation
- Update proto runtime definitions
- Update documentation and agent-ops rules
2026-05-17 14:57:49 +09:00

132 lines
4.2 KiB
Text

<!-- task=02_edge_opsconsole_package plan=0 tag=EOP -->
# 02 Edge Opsconsole Package Plan - EOP
## 이 파일을 읽는 구현 에이전트에게
**필수: 구현 마지막에는 반드시 `CODE_REVIEW-*-G??.md`의 모든 섹션을 실제 구현 내용과 명령 출력으로 채운다.**
이 task는 command loop/renderer 이동 작업이다. review 파일의 아카이브 지시는 구현 에이전트가 실행하지 않는다.
## 배경
Edge console은 삭제 대상이 아니라 edge-local ops console로 유지된다. 그러려면 `cmd/edge` 안의 두꺼운 콘솔 구현을 내부 패키지로 옮기고, cmd는 entrypoint로 얇게 유지해야 한다.
## 분석 결과
### 읽은 파일
- `agent-ops/skills/common/plan/SKILL.md`
- `agent-ops/rules/project/domain/edge/rules.md`
- `apps/edge/cmd/edge/main.go`
- `apps/edge/cmd/edge/console.go`
- `apps/edge/cmd/edge/console_events.go`
- `apps/edge/cmd/edge/console_test.go`
- `apps/edge/internal/service/service.go`
- `apps/edge/internal/events/bus.go`
- `apps/edge/internal/node/registry.go`
### 테스트 커버리지 공백
- slash command parser 전용 table test가 없다.
- event renderer는 테스트가 있지만 cmd package에 묶여 있다.
### 심볼 참조
- `consoleTarget`: `console.go:148`, tests `console_test.go:349`.
- `sendConsoleRun`: `console.go:171`.
- `sendConsoleStatus`: `console.go:286`.
- `consoleEventRouter`: `console_events.go:17`.
### 범위 결정 근거
- runtime 공통 조립은 `01_edge_runtime_common`에서 처리한다.
- service DTO 변경은 `04_edge_operation_contract`에서 처리한다.
- 출력 포맷 변경은 최소화한다.
### 빌드 등급
- Build `cloud-G07`: terminal-facing console behavior와 package boundary 변경.
- Review `cloud-G07`: 출력 호환성과 command behavior 확인 필요.
### [EOP-1] opsconsole 패키지 생성
#### 문제
`apps/edge/cmd/edge/console.go:80-145`에 command loop와 parser가 직접 들어 있다.
#### 해결 방법
- `apps/edge/internal/opsconsole` 패키지를 만든다.
- `TargetState`, `Console`, command parser, command execution methods를 이동한다.
- `cmd/edge`는 config/runtime 생성 후 `opsconsole.Run(...)`만 호출한다.
#### 수정 파일 및 체크리스트
- [ ] `apps/edge/internal/opsconsole/console.go`
- [ ] `apps/edge/internal/opsconsole/console_test.go`
- [ ] `apps/edge/cmd/edge/console.go`
- [ ] `apps/edge/cmd/edge/main.go`
#### 테스트 작성
- `TestParseCommand`
- `TestConsoleStateSessionBackgroundNode`
#### 중간 검증
```bash
go test -count=1 ./apps/edge/internal/opsconsole ./apps/edge/cmd/edge
```
### [EOP-2] event/status renderer 이동
#### 문제
`console_events.go`와 `formatUsageStatus`가 cmd package에 있어 ops surface logic이 entrypoint에 묶인다.
#### 해결 방법
- event router와 response stream을 `opsconsole`로 이동한다.
- status formatting helper도 `opsconsole`로 이동한다.
- 기존 출력 prefix는 유지한다.
#### 수정 파일 및 체크리스트
- [ ] `apps/edge/internal/opsconsole/events.go`
- [ ] `apps/edge/internal/opsconsole/status.go`
- [ ] `apps/edge/internal/opsconsole/events_test.go`
- [ ] `apps/edge/cmd/edge/console_events.go` 제거 또는 wrapper 축소
- [ ] `apps/edge/cmd/edge/console_test.go` 이동/갱신
#### 테스트 작성
- 기존 event router/status formatting 테스트를 새 패키지로 이동.
- 출력 문자열 호환 assertion 유지.
#### 중간 검증
```bash
go test -count=1 ./apps/edge/internal/opsconsole ./apps/edge/cmd/edge
```
## 수정 파일 요약
| 파일 | 항목 |
|---|---|
| `apps/edge/internal/opsconsole/console.go` | EOP-1 |
| `apps/edge/internal/opsconsole/console_test.go` | EOP-1 |
| `apps/edge/internal/opsconsole/events.go` | EOP-2 |
| `apps/edge/internal/opsconsole/status.go` | EOP-2 |
| `apps/edge/internal/opsconsole/events_test.go` | EOP-2 |
| `apps/edge/cmd/edge/console.go` | EOP-1, EOP-2 |
| `apps/edge/cmd/edge/console_events.go` | EOP-2 |
| `apps/edge/cmd/edge/console_test.go` | EOP-1, EOP-2 |
## 최종 검증
```bash
go test -count=1 ./apps/edge/internal/opsconsole ./apps/edge/cmd/edge
go test -count=1 ./...
```
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 전체 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.