개요
LikeC4는 C4 모델에서 영감을 받은 모델링 언어이자 도구 모음으로, 코드에서 항상 최신 상태의 아키텍처 다이어그램을 직접 생성할 수 있으며 협업과 아키텍처 진화를 지원합니다. CLI, VS Code 확장 및 실시간 미리보기 서버를 제공합니다.
README 미리보기
# Architecture as a code\n\nVisualize, collaborate on, and evolve your software architecture with always up-to-date, live diagrams generated from your code.\n\n[docs](https://likec4.dev/) - [playground](https://playground.likec4.dev/) - [demo](https://template.likec4.dev/view/index)\n\n \n\n\n\n\n\n\n## What is LikeC4? Why "like"?\n\nLikeC4 is a modeling language for describing software architecture and tools to generate diagrams from the model.\n\nLikeC4 is inspired by [C4 Model](https://c4model.com/) and [Structurizr DSL](https://github.com/structurizr/dsl), but provides some flexibility.\nYou customize or define your own notation, element types, and any number of nested levels in architecture model.\\nPerfectly tailored to your needs.\n\n## What does LikeC4 look like?\n\nLikeC4 source:\n\n\n \n\n\nRun [CLI](./packages/likec4/README.md) to preview:\n\n```sh\nnpx likec4 start\n```\n\nAnd result:\n\n\n \n\n\nTemplate repository - [likec4/template](https://github.com/likec4/template)\\nDeployed - [https://template.likec4.dev](https://template.likec4.dev/view/index)\n\n[](https://stackblitz.com/~/github.com/likec4/template)\n\nCheck [Tutorial](https://likec4.dev/tutorial/) - for a quick overview of LikeC4.\n\n## Getting help\n\nWe are always happy to help you get started:\n\n- [Join Discord community](https://discord.gg/86ZSpjKAdA) – it is the easiest way to get help\n- [GitHub Discussions](https://github.com/likec4/likec4/discussions) – ask anything about the project or give feedback\n\n## Contributors\n\n\n \n\n\n[Become a contributor](./CONTRIBUTING.md)\n\n## Support development\n\nLikeC4 is a MIT-licensed open source project with its ongoing development made possible entirely by your support.\\nIf you like the project, please consider contributing financially to help grow and improve it.\\nYou can support us via [OpenCollective](https://opencollective.com/likec4) or [GitHub Sponsors](https://github.com/sponsors/likec4).\n\n## License\n\nThis project is release
FAQ (5)
문제 해결임포트된 두 형제 요소 간의 관계에서 발생하는 LikeC4 오류 "Layout validation failed: Element @owner not found"는 어떻게 해결하나요?
이 문제는 LikeC4 CLI 1.59.3 및 1.59.4에 영향을 미칩니다. @owner.a 및 @owner.b와 같이 임포트된 요소들이 연결될 때, commonAncestor()가 프로젝트 네임스페이스 @owner를 모델 요소로 잘못 처리합니다.
즉시 적용 가능한 해결 방법: 두 요소를 실제 부모 요소 아래에 배치하고 해당 부모를 임포트하세요.
owner/model.c4에서:
model {
system platform {
system a
system b
}
}
consumer/model.c4에서:
import { platform } from 'owner'
model {
platform.a -> platform.b "Example relationship"
}
views {
view example {
include platform.a, platform.b
}
}
영구적인 수정: packages/core/src/utils/fqn.ts에서 commonAncestor()를 업데이트하여 단일 @namespace 세그먼트가 조상으로 반환되지 않도록 합니다:
if (
ancestor.length === 0 ||
(ancestor.length === 1 && ancestor[0]!.startsWith('@'))
) {
return null
}패치된 빌드를 사용하거나 PR "fix(core): ignore project namespace in commonAncestor of imported elements"이 포함된 릴리스로 업그레이드하세요. 다음 명령으로 확인하세요:
npx likec4 validate --project consumer . --json문제 해결LikeC4 visual editor가 dynamic view 외부에 중복된 style 규칙을 삽입하는 문제를 어떻게 해결하나요?
LikeC4 v1.59.4 이상으로 업그레이드하세요. 해당 버그는 뷰의 닫는 중괄호 앞에 스타일 변경 사항이 삽입되도록 language-server에서 수정되었습니다. 업그레이드 후에는 이를 둘러싼 views 블록에서 중복된 style 블록을 삭제하고 편집된 dynamic view 내부의 규칙만 남겨 두세요. 예시는 다음과 같습니다:
dynamic view example {
user -> app
style app {
shape mobile
}
}
v1.59.3에서 임시 해결 방법으로, 비주얼 에디터를 사용하기 전에 style user {}와 같은 로컬 스타일 규칙을 dynamic view 내부에 추가하면 이후 스타일 삽입이 뷰 내부에 유지됩니다.
문제 해결LikeC4 요소 세부 정보 대화 상자에서 긴 메타데이터 값이 잘리지 않고 전체 값 툴팁이 표시되지 않는 이유는 무엇인가요?
값 그리드 열은 1fr을 사용하며, 이는 minmax(auto, 1fr)로 해석됩니다. white-space: nowrap가 적용되면 최소 너비가 전체 텍스트 너비가 되므로 값이 잘리는 대신 열이 확장됩니다. packages/diagram/src/overlays/element-details/ElementDetailsCard.tsx에서 값 열을 minmax(0, 1fr)로 변경하여 그리드를 수정하세요:
gridTemplateColumns: 'min-content minmax(0, 1fr)'
또한 packages/diagram/src/overlays/element-details/MetadataValue.tsx의 메타데이터 값 래퍼에 말줄임 스타일은 유지하면서 minWidth: 0을 추가하세요:
{
minWidth: 0,
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap'
}
이렇게 하면 열이 콘텐츠 너비보다 작게 축소될 수 있고, 긴 값의 경우 scrollWidth > clientWidth가 true가 되어 호버 툴팁이 활성화됩니다. 짧은 값은 변경되지 않습니다. 이 수정 후 툴팁이 다이얼로그 백드롭 뒤에 표시되면 포털 툴팁의 z-index를 <dialog>와 백드롭보다 높게 설정하세요(#3256 관련).
문제 해결LikeC4 dynamic view 단계에서 relationship kind 기본 제목이 누락되는 이유는 무엇인가요?
이는 LikeC4 1.59.3의 버그입니다: relationship kind의 기본 technology는 dynamic view step에 적용되지만, 기본 title은 적용되지 않습니다. fix(core): apply relationship kind default title to dynamic view steps 수정이 포함된 릴리스로 업그레이드하세요. 임시 해결 방법으로, step에 title을 명시적으로 반복하세요:
gatewayService2 -[discover]-> discoveryServer ':8761'
명시적인 ':8761'이 없으면 수정된 버전을 사용하기 전까지 title이 렌더링되지 않습니다.
문제 해결LikeC4 HTML export에서 동적 뷰의 "variant: sequence" 속성이 무시되고 다이어그램 뷰가 표시되는 문제를 해결하는 방법?
내보낸 SPA가 초기 렌더링 시 URL dynamic 매개변수를 기본값 diagram으로 설정하여 뷰에 구성된 variant: sequence를 덮어쓰기 때문에 이 문제가 발생합니다.
임시 해결 방법: 명시적인 쿼리 매개변수를 사용하여 내보낸 HTML을 여세요:
index.html?dynamic=sequence
URL에 이미 쿼리 문자열이 있는 경우 다음을 사용하세요:
index.html?...&dynamic=sequence
로컬 단일 파일 내보내기의 경우, 예를 들어 다음과 같이 여세요:
file:///absolute/path/to/index.html?dynamic=sequence
영구 수정: "respect dynamic view variant on initial render" 수정이 포함된 LikeC4 릴리스로 업그레이드한 후 다시 빌드하세요:
npx -y likec4@latest build -o "./html" --output-single-file