oto/agent-ops/rules/project/rules.md
toki be1b139c25 sync: to agentic-framework v1.1.3 + add framework domain rule
- add update-domain-rule skill to common
- add framework domain rule (lib/framework/)
- update core domain to include lib/oto/application.dart
- update domain mapping table in rules.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 12:23:11 +09:00

88 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# oto_cli 프로젝트 규칙
## 응답 언어
한국어로 응답한다.
## 프로젝트 개요
OTO CLI는 YAML 파일로 정의된 빌드/배포 파이프라인을 실행하는 Dart CLI 도구다.
Jenkins, FTP, Git, Slack/Mattermost, iOS/Flutter/Android 빌드 등 다양한 CI/CD 작업을 커맨드로 추상화하고 파이프라인 엔진이 순차 실행한다.
## 실행 흐름
```
bin/main.dart
└── Application (singleton)
└── DataComposer ← YAML + Jenkins env 파싱
└── Pipeline
└── Command.byType(CommandType) → Command.execute(DataCommand)
```
## 주요 구조
```
lib/
├── cli/ # CLI 레이어 (명령 파싱, 스케줄러 관리)
└── oto/
├── application.dart # 싱글턴 오케스트레이터, BuildType enum
├── commands/ # 커맨드 구현체 (카테고리별)
├── core/ # 태그 시스템, 데이터 합성, 정의 데이터
├── data/ # JSON 직렬화 데이터 모델
└── pipeline/ # 파이프라인 실행 엔진
```
## 기술 스택
- 언어: Dart (SDK >=2.18.6 <4.0.0)
- 의존성: dart_framework (커스텀), http, json_annotation, cron, xml
- 코드 생성: json_serializable + build_runner (`dart run build_runner build`)
## BuildType
| Value | 설명 |
|-------|------|
| `jenkins` | CI 모드 Jenkins 환경 변수에서 워크스페이스·환경 읽기 |
| `test` | 로컬 테스트 모드 하드코딩된 테스트 데이터 사용 |
| `file` | 로컬 파일 경로에서 파이프라인 YAML 읽기 |
| `scheduler` | 스케줄러 데몬 모드 |
## 태그 시스템 (`lib/oto/core/tag_system.dart`)
- **읽기 태그** `<!namespace.key>` 런타임 저장소에서 치환
- **쓰기 태그** `<@namespace.key>` 커맨드 결과를 property에 저장
태그가 문자열 전체인 경우 원본 타입 유지 (List ), 부분 삽입이면 toString() 변환.
## 데이터 모델 컨벤션
- 모든 커맨드 파라미터는 `DataParam` (`lib/oto/data/base_data.dart`) 상속
- JSON 직렬화: `json_annotation` 사용, 생성 파일은 `*.g.dart`
- `DataCommon` Jenkins 환경 데이터 (workspace, job name, build number )
- `DataCommand` (`command_data.dart`) 모든 `Command.execute()` 전달되는 통합 컨테이너
## 새 커맨드 추가 절차
1. `lib/oto/data/*_data.dart` 데이터 모델 정의 (`DataParam` 상속)
2. `lib/oto/commands/command.dart` `CommandType` enum에 추가
3. `Command` 상속하여 커맨드 클래스 구현
4. `lib/oto/commands/command_registry.dart` 등록
5. `@JsonSerializable` 클래스 추가 `dart run build_runner build` 실행
## 에러 처리
- `Application.build()` `catch (e, stacktrace)` (Exception이 아닌 Error 포함 캐치)
- 에러 `exit(10)` 호출로 부모 프로세스에 실패 신호 전달
## 도메인 매핑
| 경로 패턴 | 도메인 | rules.md |
|----------|--------|----------|
| `lib/oto/pipeline/**` | pipeline | `agent-ops/rules/project/domain/pipeline/rules.md` |
| `lib/oto/commands/**` | command | `agent-ops/rules/project/domain/command/rules.md` |
| `lib/oto/data/**` | command | `agent-ops/rules/project/domain/command/rules.md` |
| `lib/cli/**` | cli | `agent-ops/rules/project/domain/cli/rules.md` |
| `lib/oto/application.dart` | core | `agent-ops/rules/project/domain/core/rules.md` |
| `lib/oto/core/**` | core | `agent-ops/rules/project/domain/core/rules.md` |
| `lib/oto/utils/**` | core | `agent-ops/rules/project/domain/core/rules.md` |
| `lib/framework/**` | framework | `agent-ops/rules/project/domain/framework/rules.md` |