Diagnostic Spec
1. Goal
Every CLI failure should answer four questions:
- What failed?
- Where or in which resource did it fail?
- Why did it fail?
- What should the user do next?
2. Text Shape
[ERROR] DOMAIN-001
message: unknown domain 'payment'
domain: payment
available: billing, order
suggestion: run 'boundra create-domain payment' or choose an existing domain
Fields:
- stable diagnostic code
- concise message
- zero or more context fields
- actionable suggestion
Boundary violations keep their existing BR-* text shape and additionally
follow the same message/context/suggestion principle.
3. JSON Shape
When JSON output is requested, failures must remain machine-readable:
{
"status": "error",
"errors": [
{
"code": "DOMAIN-001",
"message": "unknown domain 'payment'",
"context": {
"domain": "payment",
"available": "billing, order"
},
"suggestion": "run 'boundra create-domain payment' or choose an existing domain"
}
],
"meta": {
"command": "generate"
}
}
Successful check-boundaries JSON and violation fields remain backward
compatible. Its meta object also reports scanned_file_count and
analyzed_domain_count so CI can distinguish a clean scan from an empty scan.
The domain count includes only unique domains with at least one scanned source
file under paths.domains; ignored or absent domain sources do not count.
Text output emits a warning when either count is zero; zero counts do not change
the command exit code by themselves.
4. Code Families
CLI-*: command syntax and option errorsPROJECT-*: config, manifest, and project loading errorsDOMAIN-*: domain creation and lookup errorsDEPENDENCY-*: domain dependency workflow errorsGEN-*: generated artifact and public API update errorsRUNTIME-*: TypeScript contract execution errorsCOVERAGE-001: the configured--min-domainsthreshold was not met; context includesminimum_domain_count,analyzed_domain_count, andscanned_file_count
5. Runtime Validation Issues
BoundraRuntimeError는 framework adapter와 개발 오버레이가 특정 schema
provider에 의존하지 않도록 정규화된 issues를 제공한다.
{
"name": "BoundraRuntimeError",
"code": "RUNTIME-001",
"contract": "create-task",
"phase": "input",
"message": "contract 'create-task' rejected input at 'title': 제목은 두 글자 이상 입력해 주세요.",
"suggestion": "fix input field 'title': 제목은 두 글자 이상 입력해 주세요.",
"issues": [
{
"code": "too_small",
"path": ["title"],
"message": "제목은 두 글자 이상 입력해 주세요."
}
]
}
규칙:
issues는 항상 배열이며 validation issue가 없으면 빈 배열이다.- issue는
code,path,message만 안정적으로 노출한다. - 입력 원문이나 schema provider의 전체 오류 객체는 직렬화하지 않는다.
toJSON()은 위 구조를 반환하고 내부cause는 제외한다.- runtime package는 Zod에 직접 의존하지 않고 구조적으로 호환되는 issue를 정규화한다.
5. Exit Codes
0: success1: boundary violations2: usage, config, manifest, or resource validation error3: unexpected I/O or internal execution error