Skip to content

fix: bin/ 스크립트 경로를 __file__ 기준으로 해석하여 cwd 무관하게 동작#708

Merged
jk-kim0 merged 4 commits intomainfrom
fix/resolve-script-paths
Feb 13, 2026
Merged

fix: bin/ 스크립트 경로를 __file__ 기준으로 해석하여 cwd 무관하게 동작#708
jk-kim0 merged 4 commits intomainfrom
fix/resolve-script-paths

Conversation

@jk-kim0
Copy link
Copy Markdown
Contributor

@jk-kim0 jk-kim0 commented Feb 13, 2026

Summary

  • confluence-mdx/bin/ 하위 모든 CLI 스크립트의 기본 상대 경로가 CWD 기준으로 해석되어, 스크립트 위치와 다른 디렉터리에서 실행 시 FileNotFoundError 발생
  • __file__ 기반으로 _SCRIPT_DIR / _PROJECT_DIR / _REPO_ROOT를 계산하고, 기본 경로를 절대경로로 변환하도록 수정
  • 모든 스크립트의 경로 변수를 Path + UPPERCASE 패턴으로 통일

Changes

  • convert_all.py: _SCRIPT_DIR / _PROJECT_DIR + _resolve() 헬퍼로 5개 경로 인자 resolve
  • fetch/config.py: _PROJECT_DIRdefault_output_dir, cache_dir, translations_file resolve
  • converter/cli.py: _SCRIPT_DIR / _PROJECT_DIR 추가, --public-dir 기본값을 절대경로로 설정
  • restore_alt_from_diff.py: _REPO_ROOT 기준 git 명령 실행 및 diff 파일경로 해석
  • sync_confluence_url.py: -r 기본 디렉터리를 _REPO_ROOT / src/content/{en,ja}로 해석
  • skeleton/cli.py, diff.py, compare.py: target/ 기본 디렉터리를 _PROJECT_DIR 기준으로 해석
  • skeleton/common.py: extract_language_code() 등에서 절대경로 지원 (re.matchre.search)

Test plan

  • CI 테스트 전체 통과 (convert, skeleton, image-copy, lint, build)
  • 레포 루트에서 python3 confluence-mdx/bin/convert_all.py --help 실행 확인
  • confluence-mdx/ 디렉터리 내에서 실행해도 동일하게 동작 확인

🤖 Generated with Claude Code

convert_all.py and fetch_cli.py (via Config) used relative paths like
"var/pages.yaml" which broke when invoked from outside confluence-mdx/.
Now all default paths resolve against the script's project root
(confluence-mdx/) regardless of the working directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
querypie-docs Ready Ready Preview, Comment Feb 13, 2026 11:45am

Request Review

convert_all.py, fetch/config.py 외 나머지 bin/ 스크립트들도
__file__ 기반으로 프로젝트 루트를 결정하여 cwd에 무관하게 동작하도록 개선.

- restore_alt_from_diff.py: _REPO_ROOT 기준 git 명령 실행 및 파일경로 해석
- sync_confluence_url.py: 기본 디렉터리를 _REPO_ROOT 기준으로 해석
- skeleton/cli.py, diff.py, compare.py: target/ 기본 디렉터리를 _PROJECT_DIR 기준으로 해석
- skeleton/common.py: 절대경로에서도 target/{lang}/ 패턴 인식 (re.match → re.search)
- converter/cli.py: --public-dir 기본값을 _project_dir 기준으로 해석

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
모든 bin/ 스크립트의 경로 변수를 일관된 패턴으로 통일:
- _SCRIPT_DIR (Path): confluence-mdx/bin/
- _PROJECT_DIR (Path): confluence-mdx/
- _REPO_ROOT (Path): repo root (필요한 스크립트만)

변경 파일: convert_all.py, converter/cli.py, fetch/config.py,
skeleton/cli.py, skeleton/diff.py, skeleton/compare.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
사용자가 CLI로 명시한 --public-dir 경로는 cwd 기준 유지,
기본값(./public)만 _PROJECT_DIR 기준 절대경로로 설정.
테스트에서 상대경로로 --public-dir를 전달할 때 오작동하는 문제 수정.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jk-kim0 jk-kim0 changed the title fix: resolve CLI script paths relative to project root fix: bin/ 스크립트 경로를 __file__ 기준으로 해석하여 cwd 무관하게 동작 Feb 13, 2026
@jk-kim0 jk-kim0 merged commit 58ef261 into main Feb 13, 2026
7 checks passed
@jk-kim0 jk-kim0 deleted the fix/resolve-script-paths branch February 13, 2026 12:02
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.

1 participant