<!-- task=01_command_catalog_contract plan=0 tag=CATALOG_CONTRACT -->

# Code Review Reference - CATALOG_CONTRACT

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `구현 체크리스트`; the final checklist item is mandatory before saving.
> Do not modify or check the `코드리뷰 전용 체크리스트`; it is owned by the review agent only.
> Follow the ownership table at the bottom of this file for which sections you own.

## 개요

date=2026-05-21
task=01_command_catalog_contract, plan=0, tag=CATALOG_CONTRACT

## 이 파일을 읽는 리뷰 에이전트에게

각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다.

1. 판정을 append한다.
2. `CODE_REVIEW-cloud-G06.md` → `code_review_cloud_G06_N.log`, `PLAN-cloud-G06.md` → `plan_cloud_G06_M.log`로 아카이브한다.
3. PASS이면 `complete.log` 작성 후 task 디렉터리를 `agent-task/archive/YYYY/MM/01_command_catalog_contract/`로 이동한다. WARN/FAIL이면 다음 active plan/review 파일을 즉시 작성한다.
4. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다.

---

## 구현 항목별 완료 여부

| 항목 | 완료 여부 |
|------|---------|
| [CATALOG_CONTRACT-1] command catalog contract를 추가한다. | [x] |
| [CATALOG_CONTRACT-2] contract 테스트를 추가한다. | [x] |

## 구현 체크리스트

- [x] [CATALOG_CONTRACT-1] command catalog contract를 추가한다.
- [x] [CATALOG_CONTRACT-2] contract 테스트를 추가한다.
- [x] 중간 검증과 최종 검증을 모두 실행한다.
- [x] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.

## 코드리뷰 전용 체크리스트

> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.

- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
- [x] active `CODE_REVIEW-*-G??.md`를 `code_review_cloud_G06_N.log`로 아카이브한다.
- [x] active `PLAN-*-G??.md`를 `plan_cloud_G06_M.log`로 아카이브한다.
- [x] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
- [x] PASS이면 `agent-task/01_command_catalog_contract/`를 `agent-task/archive/YYYY/MM/01_command_catalog_contract/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
- [ ] WARN/FAIL이면 다음 active `PLAN-cloud-G06.md`와 `CODE_REVIEW-cloud-G06.md`를 작성하고 `complete.log`를 작성하지 않는다.

## 계획 대비 변경 사항

계획 대비 변경 사항이나 특이 사항이 없습니다. 제공된 계획을 바탕으로 충실히 구현하였습니다.

## 주요 설계 결정

- `CommandCatalog`와 `CommandCatalogEntry` 구조 정의: YAML 스펙을 노출하는 안정된 JSON 규격을 제공하기 위해 `CommandCatalogEntry` 클래스를 설계하여, `command`, `category`, `dataModel`, `samplePath`, `hasSample`, `sampleExists` 등의 타입이 안정된 필드들로 표현되도록 보장했습니다.
- 대소문자 무시 필터링 적용: category와 command 조회 조건(대소문자 무시 exact match)을 완벽히 소화하기 위해, 입력받은 category 및 command를 toLowerCase()로 정규화한 후 spec 필드와 비교하도록 하였습니다.

## 리뷰어를 위한 체크포인트

- `CommandSpec`과 `Command.catalogRows` 기존 동작이 바뀌지 않았는지 확인한다.
- `CommandCatalogEntry.toJson()` 필드와 타입이 계획과 일치하는지 확인한다.
- category/command 필터가 대소문자 무시 exact match인지 확인한다.
- samplePath가 없는 command의 `hasSample`/`sampleExists`가 false인지 확인한다.

## 검증 결과

필수 규칙:
- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다.
- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다.
- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다.

### CATALOG_CONTRACT-1 중간 검증
```
$ dart test test/oto_command_catalog_test.dart
Building package executable...
Built test:test.
00:00 +0: loading test/oto_command_catalog_test.dart
00:00 +0: (setUpAll)
00:00 +0: all command types are registered
00:00 +1: all command types are registered
00:00 +1: all registered commands expose specs
00:00 +2: all registered commands expose specs
00:00 +2: spec sample paths exist when provided
00:00 +3: spec sample paths exist when provided
00:00 +3: spec sample paths contain the registered command
00:00 +4: spec sample paths contain the registered command
00:00 +4: spec category and dataModel are non-empty
00:00 +5: spec category and dataModel are non-empty
00:00 +5: iOS sample must not contain stale field: workspacePath
00:00 +6: iOS sample must not contain stale field: workspacePath
00:00 +6: iOS sample must not contain stale field: exportOptionsPlist
00:00 +7: iOS sample must not contain stale field: exportOptionsPlist
00:00 +7: iOS ... samples must not contain stale field: username/password
00:00 +8: iOS ... samples must not contain stale field: username/password
00:00 +8: sample fields must include expected iOS model fields
00:00 +9: sample fields must include expected iOS model fields
00:00 +9: all registered commands have samplePath (with allowlist)
00:00 +10: all registered commands have samplePath (with allowlist)
00:00 +10: all ... commands have sample files containing the registered command
00:00 +11: all ... commands have sample files containing the registered command
00:00 +11: GitHub ... write tags (<@>) not read tags (<!>) for result storage
00:00 +12: GitHub ... write tags (<@>) not read tags (<!>) for result storage
00:00 +12: all samplePath YAML files parse as maps with a commands list
00:00 +13: all samplePath YAML files parse as maps with a commands list
00:00 +13: AwsCli sample uses sub-command key (not subCommand)
00:00 +14: AwsCli sample uses sub-command key (not subCommand)
00:00 +14: Jira sample includes both id and token fields
00:00 +15: Jira sample includes both id and token fields
00:00 +15: Protobuf sample commands list contains valid string entries
00:00 +16: Protobuf sample commands list contains valid string entries
00:00 +16: BuildFlutter sample uses supported fields and flutter targets
00:00 +17: BuildFlutter sample uses supported fields and flutter targets
00:00 +17: command catalog contract exposes stable fields
00:01 +17: command catalog contract exposes stable fields
00:01 +18: command catalog contract exposes stable fields
00:01 +18: command catalog filters category and command case-insensitively
00:01 +19: command catalog filters category and command case-insensitively
00:01 +19: (tearDownAll)
00:01 +19: All tests passed!
```

### CATALOG_CONTRACT-2 중간 검증
```
$ dart test test/oto_command_catalog_test.dart
Building package executable...
Built test:test.
00:00 +0: loading test/oto_command_catalog_test.dart
00:00 +0: (setUpAll)
00:00 +0: all command types are registered
00:00 +1: all command types are registered
00:00 +1: all registered commands expose specs
00:00 +2: all registered commands expose specs
00:00 +2: spec sample paths exist when provided
00:00 +3: spec sample paths exist when provided
00:00 +3: spec sample paths contain the registered command
00:00 +4: spec sample paths contain the registered command
00:00 +4: spec category and dataModel are non-empty
00:00 +5: spec category and dataModel are non-empty
00:00 +5: iOS sample must not contain stale field: workspacePath
00:00 +6: iOS sample must not contain stale field: workspacePath
00:00 +6: iOS sample must not contain stale field: exportOptionsPlist
00:00 +7: iOS sample must not contain stale field: exportOptionsPlist
00:00 +7: iOS ... samples must not contain stale field: username/password
00:00 +8: iOS ... samples must not contain stale field: username/password
00:00 +8: sample fields must include expected iOS model fields
00:00 +9: sample fields must include expected iOS model fields
00:00 +9: all registered commands have samplePath (with allowlist)
00:00 +10: all registered commands have samplePath (with allowlist)
00:00 +10: all ... commands have sample files containing the registered command
00:00 +11: all ... commands have sample files containing the registered command
00:00 +11: GitHub ... write tags (<@>) not read tags (<!>) for result storage
00:00 +12: GitHub ... write tags (<@>) not read tags (<!>) for result storage
00:00 +12: all samplePath YAML files parse as maps with a commands list
00:00 +13: all samplePath YAML files parse as maps with a commands list
00:00 +13: AwsCli sample uses sub-command key (not subCommand)
00:00 +14: AwsCli sample uses sub-command key (not subCommand)
00:00 +14: Jira sample includes both id and token fields
00:00 +15: Jira sample includes both id and token fields
00:00 +15: Protobuf sample commands list contains valid string entries
00:00 +16: Protobuf sample commands list contains valid string entries
00:00 +16: BuildFlutter sample uses supported fields and flutter targets
00:00 +17: BuildFlutter sample uses supported fields and flutter targets
00:00 +17: command catalog contract exposes stable fields
00:01 +17: command catalog contract exposes stable fields
00:01 +18: command catalog contract exposes stable fields
00:01 +18: command catalog filters category and command case-insensitively
00:01 +19: command catalog filters category and command case-insensitively
00:01 +19: (tearDownAll)
00:01 +19: All tests passed!
```

### 최종 검증
```
$ dart test test/oto_command_catalog_test.dart
Building package executable...
Built test:test.
00:00 +0: loading test/oto_command_catalog_test.dart
00:00 +0: (setUpAll)
00:00 +0: all command types are registered
00:00 +1: all command types are registered
00:00 +1: all registered commands expose specs
00:00 +2: all registered commands expose specs
00:00 +2: spec sample paths exist when provided
00:00 +3: spec sample paths exist when provided
00:00 +3: spec sample paths contain the registered command
00:00 +4: spec sample paths contain the registered command
00:00 +4: spec category and dataModel are non-empty
00:00 +5: spec category and dataModel are non-empty
00:00 +5: iOS sample must not contain stale field: workspacePath
00:00 +6: iOS sample must not contain stale field: workspacePath
00:00 +6: iOS sample must not contain stale field: exportOptionsPlist
00:00 +7: iOS sample must not contain stale field: exportOptionsPlist
00:00 +7: iOS ... samples must not contain stale field: username/password
00:00 +8: iOS ... samples must not contain stale field: username/password
00:00 +8: sample fields must include expected iOS model fields
00:00 +9: sample fields must include expected iOS model fields
00:00 +9: all registered commands have samplePath (with allowlist)
00:00 +10: all registered commands have samplePath (with allowlist)
00:00 +10: all ... commands have sample files containing the registered command
00:00 +11: all ... commands have sample files containing the registered command
00:00 +11: GitHub ... write tags (<@>) not read tags (<!>) for result storage
00:00 +12: GitHub ... write tags (<@>) not read tags (<!>) for result storage
00:00 +12: all samplePath YAML files parse as maps with a commands list
00:00 +13: all samplePath YAML files parse as maps with a commands list
00:00 +13: AwsCli sample uses sub-command key (not subCommand)
00:00 +14: AwsCli sample uses sub-command key (not subCommand)
00:00 +14: Jira sample includes both id and token fields
00:00 +15: Jira sample includes both id and token fields
00:00 +15: Protobuf sample commands list contains valid string entries
00:00 +16: Protobuf sample commands list contains valid string entries
00:00 +16: BuildFlutter sample uses supported fields and flutter targets
00:00 +17: BuildFlutter sample uses supported fields and flutter targets
00:00 +17: command catalog contract exposes stable fields
00:01 +17: command catalog contract exposes stable fields
00:01 +18: command catalog contract exposes stable fields
00:01 +18: command catalog filters category and command case-insensitively
00:01 +19: command catalog filters category and command case-insensitively
00:01 +19: (tearDownAll)
00:01 +19: All tests passed!

$ dart analyze
Analyzing oto...
No issues found!
```

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section: completion table, implementation checklist, changes from plan, design decisions, and verification output?**
> If anything is blank, go back and fill it in before saving this file.
> Leave the review-agent-only checklist unchanged.

## 코드리뷰 결과

- 종합 판정: PASS
- 차원별 평가:
  - correctness: Pass
  - completeness: Pass
  - test coverage: Pass
  - API contract: Pass
  - code quality: Pass
  - plan deviation: Pass
  - verification trust: Pass
- 발견된 문제: 없음
- 다음 단계: PASS - `complete.log`를 작성하고 task 디렉터리를 `agent-task/archive/2026/05/01_command_catalog_contract/`로 이동한다.
