Skip to content

feat(config): support worktreeConfig in dev-proxy.config.mjs#65

Merged
reopt-eric merged 1 commit into
mainfrom
feat/worktree-config-mjs
May 22, 2026
Merged

feat(config): support worktreeConfig in dev-proxy.config.mjs#65
reopt-eric merged 1 commit into
mainfrom
feat/worktree-config-mjs

Conversation

@reopt-eric

@reopt-eric reopt-eric commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

`worktreeConfig`를 `dev-proxy.config.mjs`에서도 작성·읽을 수 있도록 통합. `.dev-proxy.json`은 read-only legacy fallback으로 격하. `dev-proxy migrate`가 legacy `worktreeConfig`를 mjs로 옮긴 뒤 옛 JSON 파일을 삭제합니다.

Why

CLAUDE.md는 mjs가 `routes + worktreeConfig`를 모두 담는다고 기술돼 있었으나, 실제 코드는 mjs에서 `worktreeConfig`를 매핑하지 않아 worktree 사용자에게만 `.dev-proxy.json`이 필수인 어색한 상태였습니다. 이제 신규 사용자는 `dev-proxy.config.mjs` + `.dev-proxy.worktrees.json` 두 파일만 인식하면 됩니다.

Changes

  • `src/proxy/config.ts`: `ProjectConfig.worktreeConfig`, `RawProjectConfig.worktreeConfig` 추가. `loadProjectConfig` JS 분기에서 mjs preferred + legacy `.dev-proxy.json` fallback. legacy 헬퍼 `loadLegacyWorktreeConfig` 추출.
  • `src/cli/config-io.ts`: `generateJsConfig` / `writeJsConfig` 시그니처에 optional `worktreeConfig` 인자 추가. mjs 출력에 `worktreeConfig` 블록 emit.
  • `src/commands/migrate.tsx`: routes + worktreeConfig 모두 mjs로 이전. worktrees는 `.dev-proxy.worktrees.json`으로. legacy `.dev-proxy.json`은 항상 삭제. status `split-worktrees` → `cleaned-legacy`로 의미 명확화.
  • `src/commands/worktree.tsx`: `cfg.worktreeConfig` 대신 proxy config singleton 경유 `getWorktreeConfig` 헬퍼 추가. 에러 메시지를 `dev-proxy.config.mjs` 기준으로 갱신.

Backward compatibility

사용자 상태 동작
mjs만 (`worktreeConfig` 포함) 정상 (신규 흐름)
mjs + legacy `.dev-proxy.json` (worktreeConfig 잔류) legacy fallback으로 동작. `migrate`가 정리
legacy `.dev-proxy.json`만 (routes + worktreeConfig + worktrees) `migrate` 후 mjs + .worktrees.json + .json 삭제

Test plan

  • `pnpm check` 통과 (typecheck + lint + format + 446 tests)
  • migrate fall-through 시나리오 신규 테스트 (mjs+legacy worktreeConfig, mjs+legacy worktrees, legacy-only)
  • config.ts 신규 테스트 (mjs worktreeConfig + fallback + mjs win)
  • generateJsConfig 신규 테스트 (worktreeConfig with/without, services/hooks)
  • getWorktreeConfig 신규 테스트 (singleton lookup, missing, no-config)
  • 수동: legacy `.dev-proxy.json` 사용자로 `worktree create` 정상 동작
  • 수동: mjs only 사용자로 `worktree create` 정상 동작
  • 수동: `migrate`로 legacy 파일 정리

Follow-up

PR B (Issue 별도)에서 SKILL.md, README, installation.md, CLAUDE.md를 이 변경에 맞춰 동기화 + DNS/worktree onboarding 갭 보강 예정.

Closes #64

🤖 Generated with Claude Code

Move worktreeConfig from .dev-proxy.json into the active JS config,
keeping the legacy file as a read-only fallback. The dev-proxy.config.mjs
default export now accepts a `worktreeConfig` field alongside `routes`,
and `dev-proxy migrate` relocates legacy entries before deleting the
old JSON file.

CLI commands look up worktreeConfig via the proxy config singleton,
which already merges mjs + legacy at load time.

Closes #64

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@reopt-eric
reopt-eric merged commit 1f9474b into main May 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate worktreeConfig to dev-proxy.config.mjs (deprecate .dev-proxy.json)

2 participants