예제
KO

doctor

Hwaro 사이트의 설정, 템플릿, 구조 문제를 진단합니다.

콘텐츠 검증(프론트 매터, 대체 텍스트, 내부 링크)은 hwaro tool validate를 사용합니다.

hwaro doctor

# ./content가 아닌 콘텐츠 디렉터리 검사
hwaro doctor -c src/content

# 설정 값 정규화 (base_url 끝 슬래시, sitemap priority 등)
hwaro doctor --fix

# 권장 설정 섹션을 config.toml에 추가
hwaro doctor --approve

# 둘 다 수행 (--fix --approve와 동일)
hwaro doctor --full

# config.toml을 수정하지 않고 변경 사항 미리 보기
hwaro doctor --full --dry-run

# 결과를 JSON으로 출력
hwaro doctor --json

hwaro tool doctor도 하위 호환 별칭으로 동작합니다.

옵션

플래그 설명
-c, --content-dir DIR 검사할 콘텐츠 디렉터리 (기본값: content)
-e, --env ENV build --env ENV가 읽는 설정 그대로 검사 (config.ENV.toml을 병합, 기본값은 HWARO_ENV). --fix는 여전히 config.toml만 수정
--fix 실제 수정 수행 — 값 정규화 (base_url 끝 슬래시, sitemap priority 등)
--approve 권장 선택 설정 섹션을 승인하고 추가
--full --fix와 --approve를 모두 수행
--dry-run config.toml을 수정하지 않고 변경 사항 미리 보기
--strict 종료 코드 계산 시 경고를 오류로 취급
--max-warnings N 경고 수가 N을 초과하면 0이 아닌 코드로 종료
-j, --json 결과를 JSON으로 출력
-q, --quiet 정보 출력과 배너 숨김. 경고와 오류는 stderr에 [level] file: message 형식으로 한 줄씩 출력
-h, --help 도움말 표시

검사 항목

설정 진단:

템플릿 진단:

콘텐츠 진단:

구조 진단:

번역 보고 (언어가 둘 이상인 사이트):

페이지는 빌드가 page.translations를 만들 때와 똑같이 짝지어집니다 (언어 접미사를 뺀 기본 이름이 같으면 한 묶음이므로 about.md, about.en.md, about.ko.md는 서로 짝). 기본 빌드가 게시하는 페이지만 셈하므로, 초안이나 미래 날짜 페이지는 번역이 있다고도 없다고도 보지 않습니다. 헤드리스 (render = false, 섹션 [cascade]로 적용된 경우 포함)나 redirect_to 페이지는 빌드가 page.translations와 hreflang에서 빼므로 번역을 요구하지도, 번역으로 세지도 않습니다. 둘 다 info 수준이라 --strict가 부분 번역 때문에 실패하지 않습니다. 사람용 보고서는 언어별로 묶어 개수와 함께 보여 줍니다.

Translations:
  ko: 2 missing · 1 without original
  [info] content/about.md: No 'ko' translation
  [info] content/blog/_index.md: No 'ko' translation
  [info] content/notes.ko.md: 'ko' translation has no 'en' original

언어마다 처음 10개 항목만 보여 주고 나머지는 … and N more (use --json for all)로 줄입니다. --json에는 모든 항목이 language 필드와 함께 들어갑니다. 두 종류 모두 [doctor] ignore로 숨길 수 있습니다.

출력 예시

hwaro: doctor

  config.toml
    [ok]   file present & parseable
    [warn] base_url, title
    [ok]   sitemap (changefreq, priority)
    [ok]   taxonomies (duplicates)
    [ok]   search (format)
    [ok]   languages (default_language resolves)
    [ok]   versions (content paths exist)
    [ok]   markdown / pwa (valid enums)
    [ok]   image processing (widths set)
    [ok]   deployment / related (refs resolve)
    [ok]   menus (parent references)
    [ok]   referenced files & dirs
    [ok]   build output (route evidence)
    [ok]   sass (sources & enablement)

  templates/
    [ok]   required files (page.html, section.html)
    [ok]   template syntax

  content/
    [ok]   directory present
    [ok]   front matter (TOML/YAML parse)
    [ok]   front matter menus (declared in config)
    [ok]   front matter templates (exist)
    [ok]   front matter schema ([[content.schema]])
    [info] section index files (_index.md)
    [ok]   translations (pages in every language)

Config:
  [warn] config.toml: base_url is not set

Structure:
  [info] content/docs: Section directory missing _index.md: docs/

checked: 0 errors, 1 warning, 1 info

Tip: Use 'hwaro tool validate' for content checks

스캔 자체가 실행되지 않은 검사는 통과(✓)가 아니라 [--] … (skipped)로 표시됩니다. 예를 들어 templates/가 없으면 template syntax가 그렇습니다.

색상 터미널에서는 검사 줄이 hwaro doctor 헤딩 아래 ✓/⚠/✗/ℹ 기호로 표시되고, 요약은 심각도별 색이 입혀진 ✦ checked 결과 줄로 출력됩니다. 문제가 없으면 checked: no issues found — your site looks great로 끝납니다.

빌드 출력을 근거로 사용하기

[pwa] offline_page와 [pwa] precache_urls는 파일이 아니라 라우트입니다. doctor는 먼저 content/에서 찾고, 확장자가 있는 값(컴파일된 스타일시트, 리사이즈된 이미지 변형 등)은 마지막 빌드 결과인 [build] output_dir (기본값 public/)에서 찾습니다.

이 디렉터리는 hwaro build가 만든 것이어야 합니다. Hwaro 0.19부터 hwaro serve는 .hwaro/serve/에 빌드하고 output_dir은 건드리지 않으므로, serve만 쓰는 작업 흐름에서는 이 디렉터리가 없거나 예전 빌드에 멈춰 있습니다. 이제 doctor가 그 사실을 알려줍니다:

둘 다 info 수준이며, 실제로 그 트리가 필요했을 때만 나타납니다. 빌드가 생성하는 경로를 참조하지 않는 사이트는 public/ 이야기를 듣지 않습니다.

알려진 문제 무시

doctor가 보고하는 문제 중 이미 알고 있어 숨기고 싶은 것이 있으면, 해당 규칙 ID를 config.toml의 [doctor] 섹션에 추가합니다:

[doctor]
ignore = [
  "title-default",
  "structure-missing-index",
]

규칙 ID는 hwaro doctor --json 출력에서 확인하면 됩니다. 무시된 문제는 사람이 읽는 출력과 JSON 출력 모두에서 완전히 제외됩니다.

ignore는 warning과 info 수준의 문제만 숨깁니다. 아래 표에서 ✗로 표시된 error 수준 규칙은 어차피 hwaro build를 실패시키는 문제라서 목록에 넣어도 CI 게이트를 끌 수 없습니다. doctor는 계속 보고하고, 해당 항목이 효과가 없다는 경고를 출력합니다.

사용 가능한 규칙 ID

✗ 표시가 있는 항목은 error 수준이며 무시할 수 없습니다.

ID 분류 설명
config-not-found config 설정 파일을 찾을 수 없음 ✗
config-parse-error config 설정 파싱 실패 ✗
base-url-missing config base_url이 설정되지 않음
base-url-trailing-slash config base_url에 끝 슬래시가 있음
title-default config title이 아직 자리표시자임
sitemap-changefreq-invalid config 유효하지 않은 sitemap.changefreq
sitemap-priority-range config sitemap.priority가 범위를 벗어남
taxonomy-duplicate config 택소노미 이름 중복
language-duplicate config 언어 코드 중복
search-format-invalid config 지원하지 않는 search.format
default-language-undefined config default_language에 대응하는 [languages.<code>] 없음
markdown-math-engine-invalid config 지원하지 않는 markdown.math_engine
pwa-cache-strategy-invalid config 지원하지 않는 pwa.cache_strategy
pwa-display-invalid config 지원하지 않는 pwa.display
image-processing-widths-empty config image_processing이 켜져 있으나 widths가 비어 있음 (무음 no-op)
deployment-target-undefined config deployment.target에 대응하는 [[deployment.targets]] 없음
related-taxonomy-undefined config [related]가 정의되지 않은 택소노미를 참조
menu-parent-undefined config 메뉴 항목의 parent가 같은 메뉴의 identifier와 맞지 않음
version-path-missing config [[versions.list]] 경로가 content/ 아래에 없음
config-path-missing config 참조한 파일이 존재하지 않음
config-dir-missing config 참조한 디렉터리가 존재하지 않음
build-output-unusable config [build] output_dir로 라우트를 검증할 수 없음 (없거나 hwaro serve 출력)
build-output-stale config 소스보다 오래된 빌드 출력으로 라우트를 통과시킴
sass-dir-not-scanned config 빌드가 스캔하지 않는 루트 sass/ 디렉터리에 SCSS 파일이 있음
sass-disabled-with-sources config [sass]가 꺼진 상태에서 static/ 아래에 SCSS 엔트리 파일이 있음
missing-config-* config_missing 설정 섹션 누락 (예: missing-config-pwa)
template-dir-missing template 템플릿 디렉터리를 찾을 수 없음 ✗
template-required-missing template page.html(또는 default.html) 누락 ✗
template-section-missing template section.html 누락, 섹션은 page.html로 렌더링됨
template-syntax-error template 템플릿 파싱 실패 ✗
template-read-error template 템플릿 읽기 실패 ✗
content-dir-missing content 콘텐츠 디렉터리를 찾을 수 없음
content-frontmatter-invalid content 프론트 매터 파싱 실패 ✗
content-read-error content 콘텐츠 파일 읽기 실패 ✗
menu-undeclared content 프론트 매터의 메뉴 이름이 설정에 선언되지 않음
content-template-missing content 프론트 매터의 template / page_template / [cascade] template이 없는 템플릿을 가리킴
content-schema-violation content 프론트 매터가 [[content.schema]]를 위반 ✗
structure-missing-index structure _index.md가 없는 섹션
translation-missing i18n 설정된 언어에 대응 페이지가 없는 페이지나 섹션
translation-orphan i18n 기본 언어 원본이 없는 번역

어떤 규칙 ID와도 맞지 않는 항목은 "효과 없음" 경고로 알려주므로, 오타가 조용히 넘어가지 않습니다.

JSON 출력

{
  "schema_version": 1,
  "issues": [
    {
      "id": "base-url-missing",
      "level": "warning",
      "category": "config",
      "file": "config.toml",
      "message": "base_url is not set"
    }
  ],
  "summary": {
    "errors": 0,
    "warnings": 1,
    "infos": 0,
    "total": 1
  },
  "exit_code": 0
}