Files
trex-core/docs/batches/bat-026_20260609_config-dir-env-and-config-path/planning.md
T
genichinandClaude Opus 4.8 8b2c26c04c feat(config): config 디렉터리 기반 설정 관리 (--config-path/--env-file, trex-orb-v1 정합, BAT-026)
REQ-048/010 change-req. `--config` 를 이름으로 해석 + `--config-path <dir>`
(기본 ./config) + resolve_config_toml(슬래시 포함 값은 하위호환 명시 경로).
`.env` 를 config-dir 결정적 해석(--env-file 우선, 없으면 <config_dir>/.env,
CWD 무관) + config/.env.example + .gitignore config/* 허용목록. 운영자 CLI 도
--config-path/--env-file 동일 적용. from_env() legacy 루트 .env 폴백 유지로
완전 하위호환.

단위 23 + 전체 375 passed, ruff clean, 라이브 스모크(name·path 동일).
REQ-048/010 → Implemented.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 23:45:08 +09:00

2.0 KiB

BAT-026 Planning

  • Status: confirmed
  • Batch: BAT-026
  • Profile: batch-lite

Included REQ

  • REQ-048 (CHG-20260609-01) — --config 이름 해석 + --config-path + resolve_config_toml
  • REQ-010 (CHG-20260609-01) — config-dir .env 결정적 해석 + --env-file + config/.env.example + .gitignore

Delivery Plan

  1. config.py: DEFAULT_CONFIG_DIR + resolve_config_toml(name, config_path)(슬래시 포함=명시 경로 하위호환). _load_dotenv(config_path=None, env_file=None) — --env-file 우선 → <config_dir>/.env → (config 컨텍스트 없으면) legacy find_dotenv(usecwd=True) 폴백. from_config(toml_path, env_file=None) 가 config-dir .env 선로드 후 from_env().
  2. daemon.py main: --config-path/--env-file argparse + resolve_config_toml + from_config(path, env_file).
  3. cli.py: _add_common 에 --config-path/--env-file; _resolve_instance 가 resolve_config_toml 경유; main 이 from_env 전 config-dir .env 선로드.
  4. .gitignore config/* 허용목록(*.example.toml/.env.example), config/.env.example 신규.
  5. 테스트: resolve_config_toml(이름/.toml/config-path/경로형), _load_dotenv(env-file/config-dir/override/부재/CWD무관), daemon·cli 인자.

Dependencies

  • Internal: from_env() 의 legacy .env 로드 유지가 하위호환의 핵심.
  • External: 없음.

Design Gate

  • Design Required Before Implementation: no
  • Reason: 국소 변경(3개 런타임 파일 + .gitignore + config 예제). 신규 계약 필드/런타임 흐름 없음. --config 의미 확장은 change-req(CHG-20260609-01)로 이미 정합.

Milestones

  1. config.py/daemon.py/cli.py + .gitignore + config/.env.example 구현.
  2. 단위(resolve/dotenv/인자) green + 전체 회귀 + ruff.

Risks

  • R-1: config/.env 부재 시 키 미로드로 기동 실패. 대응: from_env() legacy 루트 .env 폴백 유지 → 무중단(완전 하위호환).
  • R-2: --config 경로형 사용처 회귀. 대응: 슬래시 포함 값 명시 경로 폴백 + 회귀 테스트.