likec4 1.59.3 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/codegen/react.mjs +6 -6
- package/__app__/codegen/webcomponent.mjs +147 -69
- package/__app__/src/aichat/index.mjs +10 -5
- package/__app__/src/chunks/AIChat.mjs +1134 -693
- package/__app__/src/chunks/LikeC4Styles.mjs +4101 -1737
- package/__app__/src/chunks/ProjectsOverview.mjs +624 -334
- package/__app__/src/chunks/es.mjs +515 -335
- package/__app__/src/chunks/hooks.mjs +578 -366
- package/__app__/src/chunks/libs/@floating-ui.mjs +2720 -1966
- package/__app__/src/chunks/libs/@mantine.mjs +14067 -9487
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +2266 -1146
- package/__app__/src/chunks/libs/@tanstack.mjs +3152 -1932
- package/__app__/src/chunks/libs/@xstate/react.mjs +2924 -1468
- package/__app__/src/chunks/libs/@xyflow/react.mjs +6627 -4067
- package/__app__/src/chunks/libs/bezier-js.mjs +1312 -726
- package/__app__/src/chunks/libs/d3.mjs +3218 -1509
- package/__app__/src/chunks/libs/fast-equals.mjs +437 -201
- package/__app__/src/chunks/libs/framer.mjs +9251 -3846
- package/__app__/src/chunks/libs/nanostores.mjs +174 -0
- package/__app__/src/chunks/libs/zod.mjs +4591 -2363
- package/__app__/src/chunks/rolldown-runtime.mjs +39 -23
- package/__app__/src/chunks/styled-system.mjs +3538 -756
- package/__app__/src/fonts.css +112 -1
- package/__app__/src/main.mjs +44398 -24039
- package/__app__/src/style.css +18488 -1
- package/config/schema.json +136 -97
- package/dist/app/render-view-client.css +1 -1
- package/dist/app/render-view-client.js +506 -338
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +16 -14
- package/dist/chunks/generate-likec4.mjs +5 -0
- package/dist/chunks/index.d.mts +246 -180
- package/dist/chunks/index2.d.mts +2882 -1977
- package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
- package/dist/chunks/libs/@chevrotain/types.d.mts +111 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/birpc.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +87 -35
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/json5.mjs +4 -4
- package/dist/chunks/libs/langium.d.mts +9903 -5297
- package/dist/chunks/libs/langium.mjs +16 -24
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/package-manager-detector.mjs +1 -1
- package/dist/chunks/libs/pako.mjs +2 -2
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/node.mjs +60 -60
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/sequence-view.mjs +1 -1
- package/dist/chunks/vite-plugin.mjs +55 -52
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +208 -1300
- package/dist/config/index.d.mts +2 -2
- package/dist/generators/likec4.d.mts +6578 -0
- package/dist/generators/likec4.mjs +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/model/index.d.mts +8 -5
- package/dist/vite-plugin/index.d.mts +6 -3
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +9 -0
- package/dist/vite-plugin/internal/index.d.mts +16 -15
- package/dist/vite-plugin/internal/index.mjs +144 -46
- package/generators/likec4/package.json +4 -0
- package/package.json +117 -110
- package/react/index.d.mts +8500 -5399
- package/react/index.mjs +534 -58617
- package/react/rolldown-runtime-DnkiqaRY.js +1 -0
- package/skills/likec4-dsl/SKILL.md +428 -0
- package/skills/likec4-dsl/evals/evals-public.json +202 -0
- package/skills/likec4-dsl/evals/grading-spec.json +589 -0
- package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
- package/skills/likec4-dsl/references/cli.md +139 -0
- package/skills/likec4-dsl/references/configuration.md +266 -0
- package/skills/likec4-dsl/references/deployment.md +160 -0
- package/skills/likec4-dsl/references/dynamic-views.md +455 -0
- package/skills/likec4-dsl/references/examples.md +370 -0
- package/skills/likec4-dsl/references/identifier-validity.md +90 -0
- package/skills/likec4-dsl/references/include-predicates-wildcards.md +179 -0
- package/skills/likec4-dsl/references/model.md +151 -0
- package/skills/likec4-dsl/references/predicates.md +123 -0
- package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
- package/skills/likec4-dsl/references/specification.md +75 -0
- package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
- package/skills/likec4-dsl/references/troubleshooting.md +96 -0
- package/skills/likec4-dsl/references/views.md +329 -0
- package/vite-plugin-modules.d.ts +4 -2
- package/dist/chunks/libs/picomatch.mjs +0 -1
- package/dist/chunks/libs/zod.d.mts +0 -2140
- package/dist/chunks/libs/zod.mjs +0 -65
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# LeanIX bridge, Draw.io profile, and agent boundaries
|
|
2
|
+
|
|
3
|
+
This reference is for tasks that touch **LeanIX**, **Draw.io export**, or **bridge artifacts**. It complements `cli.md` and the main skill rules.
|
|
4
|
+
|
|
5
|
+
## Canonical source of truth
|
|
6
|
+
|
|
7
|
+
- **LikeC4 DSL** (`.c4` / `.likec4`) is canonical. The bridge derives LeanIX-shaped inventory and Draw.io annotations from the resolved model.
|
|
8
|
+
- **Agent Skills** teach DSL syntax and CLI contracts; they **do not** replace running `likec4 gen leanix …`, `likec4 sync leanix …`, or `likec4 export drawio --profile leanix`.
|
|
9
|
+
|
|
10
|
+
## CLI commands (first-class)
|
|
11
|
+
|
|
12
|
+
From the project root (see `@likec4/leanix-bridge` README for details):
|
|
13
|
+
|
|
14
|
+
| Goal | Command |
|
|
15
|
+
| --------------------------------- | ------------------------------------------------------------------------ |
|
|
16
|
+
| Manifest + dry-run + report | `likec4 gen leanix dry-run -o out/bridge` |
|
|
17
|
+
| Sync workflow (dry-run / plan) | `likec4 sync leanix --dry-run -o out/bridge` |
|
|
18
|
+
| Apply sync to LeanIX API | `likec4 sync leanix --apply -o out/bridge` (requires `LEANIX_API_TOKEN`) |
|
|
19
|
+
| Draw.io with bridge-managed cells | `likec4 export drawio --profile leanix -o ./diagrams` |
|
|
20
|
+
|
|
21
|
+
**Draw.io default profile** (`default`): no `bridgeManaged` / `likec4Id` in styles.
|
|
22
|
+
|
|
23
|
+
**Draw.io LeanIX profile** (`leanix`): adds `bridgeManaged=true`, `likec4Id`, `likec4Kind`, `likec4ViewId`, optional `likec4ProjectId` on vertices; `likec4RelationId` on edges — for round-trip and LeanIX alignment.
|
|
24
|
+
|
|
25
|
+
Other useful flags: `likec4 export drawio --roundtrip` (embed layout in DSL comments), `--all-in-one`, `--uncompressed`.
|
|
26
|
+
|
|
27
|
+
## Round-trip mental model
|
|
28
|
+
|
|
29
|
+
1. **Export** Draw.io with `--profile leanix` so cells carry stable LikeC4 identities.
|
|
30
|
+
2. **Parse** Draw.io back to DSL (`likec4` / generators): `likec4Id` on vertices and `likec4RelationId` on edges preserve FQN and relationship identity where the parser supports them (see `packages/generators` Draw.io tests).
|
|
31
|
+
3. **After LeanIX sync**, `manifestToDrawioLeanixMapping(manifest)` maps `likec4Id` ↔ LeanIX fact sheet / relation ids for re-export or tooling.
|
|
32
|
+
|
|
33
|
+
Do not invent bridge JSON shapes; generate them via the CLI or `@likec4/leanix-bridge` APIs documented in the package README.
|
|
34
|
+
|
|
35
|
+
## Mapping config (YAML / JSON)
|
|
36
|
+
|
|
37
|
+
Custom **LeanIX mapping** merges over defaults (`factSheetTypes`, `relationTypes`, `metadataToFields`). Invalid shapes (arrays instead of objects, non-string values, unknown top-level keys) are rejected with explicit errors when the config is normalized via `mergeWithDefault` / validation in `@likec4/leanix-bridge`.
|
|
38
|
+
|
|
39
|
+
## MCP vs bridge
|
|
40
|
+
|
|
41
|
+
- **MCP** (`likec4 mcp`, `@likec4/mcp`) exposes **read/query** tools over the LikeC4 workspace model (elements, views, relationships). It does **not** replace `likec4 gen leanix` or `likec4 sync leanix`.
|
|
42
|
+
- For LeanIX artifacts, Draw.io leanix profile, or manifest dry-run, use the **CLI** (or programmatic `@likec4/leanix-bridge`) as documented above.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# CLI Reference
|
|
2
|
+
|
|
3
|
+
`likec4` is npm package that provides a CLI tool for working with LikeC4 models.
|
|
4
|
+
Only essential commands/parameters are listed here, for full documentation use `likec4 help`, `likec4 <command> --help`.
|
|
5
|
+
Examples use `bunx` to run the CLI, but you should use workspace's package manager (e.g. `bun`, `pnpm`, `npm`).
|
|
6
|
+
If workspace is not a npm project, use `bunx` (if available) -> `pnpx` (if available) -> `npx` as a fallback.
|
|
7
|
+
|
|
8
|
+
If workspace already has `likec4` as a dependency, check its version from package.json, make sure it is at least 1.53.0. Pin the version `bunx likec4@1.53.0 ...` otherwise.
|
|
9
|
+
|
|
10
|
+
## Common Commands and Frequent Mistakes
|
|
11
|
+
|
|
12
|
+
### ✅ Correct commands (use these)
|
|
13
|
+
|
|
14
|
+
| Task | Correct Command |
|
|
15
|
+
| ----------------- | --------------------------------------------------------------------- |
|
|
16
|
+
| Validate files | `bunx likec4 validate --json --no-layout --file <file> [project-dir]` |
|
|
17
|
+
| Start dev server | `bunx likec4 serve [project-dir]` |
|
|
18
|
+
| Export PNG | `bunx likec4 export png -o ./images [project-dir]` |
|
|
19
|
+
| Build static site | `bunx likec4 build -o ./dist [project-dir]` |
|
|
20
|
+
| List icons | `bunx likec4 list-icons` or `bunx likec4 list-icons --group tech` |
|
|
21
|
+
|
|
22
|
+
### ❌ Common mistakes (avoid these)
|
|
23
|
+
|
|
24
|
+
| Incorrect | Why it fails | Correct |
|
|
25
|
+
| ------------------------------------------ | ----------------------------------------- | ---------------------------------------- |
|
|
26
|
+
| `bunx likec4 check ...` | Command doesn't exist | Use `bunx likec4 validate ...` |
|
|
27
|
+
| `bunx likec4 lint ...` | Command doesn't exist | Use `bunx likec4 validate ...` |
|
|
28
|
+
| `bunx likec4 verify ...` | Command doesn't exist | Use `bunx likec4 validate ...` |
|
|
29
|
+
| `bunx likec4 export png --out-dir ./images` | Unknown flag (`--out-dir`) | Use `-o ./images` or `--outdir ./images` |
|
|
30
|
+
|
|
31
|
+
## `serve` (aliases: `start`, `dev`)
|
|
32
|
+
|
|
33
|
+
Starts local server with live reload to preview diagrams (default port is 5173).
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bunx likec4 serve [project-dir]
|
|
37
|
+
bunx likec4 serve --port 3000 [project-dir]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When started, you can show the diagram to user in the browser by following the URL displayed in the console.
|
|
41
|
+
To navigate to specific view, use the URL path `/view/<view-id>`.
|
|
42
|
+
|
|
43
|
+
## `build` (alias: `bundle`)
|
|
44
|
+
|
|
45
|
+
Build a static website for deployment.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bunx likec4 build -o ./dist [project-dir]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## `export`
|
|
52
|
+
|
|
53
|
+
Export diagrams to various formats.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# PNG (requires Playwright)
|
|
57
|
+
bunx likec4 export png -o ./images [project-dir]
|
|
58
|
+
bunx likec4 export png --theme dark --flat -f "overview*" -o ./images [project-dir]
|
|
59
|
+
|
|
60
|
+
# JSON model
|
|
61
|
+
bunx likec4 export json -o model.json --pretty --skip-layout [project-dir]
|
|
62
|
+
|
|
63
|
+
# DrawIO
|
|
64
|
+
bunx likec4 export drawio --all-in-one -o ./diagrams [project-dir]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**export png** options: `--outdir` (`-o`), `--theme` [light|dark], `--flat`, `--filter` (`-f`, glob patterns), `--seq` (sequence layout for dynamic views), `--timeout` (default 15s)
|
|
68
|
+
**export json** options: `--outfile` (`-o`, default "likec4.json"), `--pretty`, `--skip-layout`
|
|
69
|
+
**export drawio** options: `--outdir` (`-o`), `--all-in-one`, `--roundtrip`, `--uncompressed`, `--profile` [default|leanix]
|
|
70
|
+
|
|
71
|
+
### LeanIX bridge and Draw.io (LeanIX profile)
|
|
72
|
+
|
|
73
|
+
Use these when the task is **LeanIX inventory**, **bridge artifacts**, or **Draw.io with stable bridge-managed ids** — not for generic DSL editing alone.
|
|
74
|
+
|
|
75
|
+
| Task | Command |
|
|
76
|
+
| ---------------------------------------------- | ------------------------------------------------------------------------ |
|
|
77
|
+
| Manifest + LeanIX dry-run + report | `bunx likec4 gen leanix dry-run -o out/bridge [project-dir]` |
|
|
78
|
+
| Sync workflow (review / apply) | `bunx likec4 sync leanix --dry-run -o out/bridge [project-dir]` / `bunx likec4 sync leanix --apply -o out/bridge [project-dir]` |
|
|
79
|
+
| Draw.io with `likec4Id`, `bridgeManaged`, etc. | `bunx likec4 export drawio --profile leanix -o ./diagrams [project-dir]` |
|
|
80
|
+
|
|
81
|
+
Full boundaries, round-trip notes, and MCP vs bridge: **`references/bridge-leanix-drawio.md`**.
|
|
82
|
+
|
|
83
|
+
## `codegen` (aliases: `gen`, `generate`)
|
|
84
|
+
|
|
85
|
+
Generate code artifacts from the model.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# TypeScript model (typed, with all views and elements)
|
|
89
|
+
bunx likec4 gen model -o likec4-model.ts [project-dir]
|
|
90
|
+
|
|
91
|
+
# React component
|
|
92
|
+
bunx likec4 gen react -o dist/likec4-views.mjs [project-dir]
|
|
93
|
+
|
|
94
|
+
# Web component JS bundle
|
|
95
|
+
bunx likec4 gen webcomponent -o likec4.js -w c4 [project-dir]
|
|
96
|
+
|
|
97
|
+
# Diagram formats
|
|
98
|
+
bunx likec4 gen mermaid -o ./out # .mmd files
|
|
99
|
+
bunx likec4 gen plantuml -o ./out # .puml files
|
|
100
|
+
bunx likec4 gen d2 -o ./out # .d2 files
|
|
101
|
+
bunx likec4 gen dot -o ./out # .dot files (Graphviz)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Shared options: `--outfile`/`--outdir` (`-o`), `--project` (`-p`), `--use-dot`
|
|
105
|
+
|
|
106
|
+
## `mcp`
|
|
107
|
+
|
|
108
|
+
Start MCP (Model Context Protocol) server for AI tool integration.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bunx likec4 mcp [workspace] # stdio transport (default)
|
|
112
|
+
bunx likec4 mcp --http [workspace] # HTTP transport on port 33335
|
|
113
|
+
bunx likec4 mcp -p 1234 [workspace] # HTTP transport on custom port
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Options: `--stdio` (default), `--http`, `--port` (`-p`, default 33335), `--use-dot`
|
|
117
|
+
|
|
118
|
+
## `list-icons`
|
|
119
|
+
|
|
120
|
+
List all available built-in icons. Fast, no workspace initialization needed.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bunx likec4 list-icons # all icons, one group:name per line
|
|
124
|
+
bunx likec4 list-icons --format json # grouped JSON object
|
|
125
|
+
bunx likec4 list-icons --group aws # only AWS icons
|
|
126
|
+
bunx likec4 list-icons --group tech -f json # tech icons as JSON
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Options: `--format` (`-f`, `text` default or `json`), `--group` (`-g`, one of: `aws`, `azure`, `gcp`, `tech`, `bootstrap`)
|
|
130
|
+
|
|
131
|
+
Icon groups: `aws` (~307 icons), `azure` (~614), `gcp` (~216), `tech` (~2000), `bootstrap` (~2051).
|
|
132
|
+
|
|
133
|
+
## `format`
|
|
134
|
+
|
|
135
|
+
Format LikeC4 source files in-place.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
bunx likec4 format [workspace]
|
|
139
|
+
```
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Project Configuration Reference
|
|
2
|
+
|
|
3
|
+
LikeC4 projects are defined by a config file. The file's location determines project scope — all `.c4` files in the directory (and subdirectories) belong to that project.
|
|
4
|
+
|
|
5
|
+
## Config File Names
|
|
6
|
+
|
|
7
|
+
LikeC4 recognizes (in any order):
|
|
8
|
+
|
|
9
|
+
| Format | File names |
|
|
10
|
+
| ---------- | -------------------------------------------------------- |
|
|
11
|
+
| JSON/JSON5 | `.likec4rc`, `.likec4.config.json`, `likec4.config.json` |
|
|
12
|
+
| JavaScript | `likec4.config.js`, `likec4.config.mjs` |
|
|
13
|
+
| TypeScript | `likec4.config.ts`, `likec4.config.mts` |
|
|
14
|
+
|
|
15
|
+
## JSON Config Schema
|
|
16
|
+
|
|
17
|
+
Always include `$schema` for validation and autocomplete:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"$schema": "https://likec4.dev/schemas/config.json",
|
|
22
|
+
"name": "my-project"
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## All Options
|
|
27
|
+
|
|
28
|
+
### `name` (required)
|
|
29
|
+
|
|
30
|
+
Unique project identifier. Must not be `"default"`. Cannot contain `.`, `@`, or `#`.
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{ "name": "cloud-platform" }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `title`
|
|
37
|
+
|
|
38
|
+
Human-readable project title.
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{ "name": "cloud-platform", "title": "Cloud Platform Architecture" }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### `metadata`
|
|
45
|
+
|
|
46
|
+
Arbitrary key-value pairs for custom project information.
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"metadata": {
|
|
51
|
+
"owner": "platform-team",
|
|
52
|
+
"domain": "payments",
|
|
53
|
+
"version": "2.0"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### `contactPerson`
|
|
59
|
+
|
|
60
|
+
Person involved in creating or maintaining the project.
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{ "contactPerson": "Jane Doe" }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `include`
|
|
67
|
+
|
|
68
|
+
Reference external directories containing `.c4` files.
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"include": {
|
|
73
|
+
"paths": ["../shared", "../common/specs"],
|
|
74
|
+
"maxDepth": 5,
|
|
75
|
+
"fileThreshold": 50
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Property | Type | Default | Description |
|
|
81
|
+
| --------------- | ---------- | ---------- | -------------------------------------- |
|
|
82
|
+
| `paths` | `string[]` | (required) | Relative directory paths to scan |
|
|
83
|
+
| `maxDepth` | `number` | `3` | Directory scan depth (1–20) |
|
|
84
|
+
| `fileThreshold` | `number` | `30` | Warn if loaded file count exceeds this |
|
|
85
|
+
|
|
86
|
+
### `exclude`
|
|
87
|
+
|
|
88
|
+
Glob patterns (picomatch) to exclude files. Default: `["**/node_modules/**"]`.
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{ "exclude": ["**/node_modules/**", "**/generated/**"] }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### `inferTechnologyFromIcon`
|
|
95
|
+
|
|
96
|
+
Auto-derive `technology` from icon name when not set explicitly. Applies to `aws:`, `azure:`, `gcp:`, `tech:` icons. Default: `true`.
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{ "inferTechnologyFromIcon": false }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `implicitViews`
|
|
103
|
+
|
|
104
|
+
Auto-generate scoped views for elements without explicit views, enabling drill-down navigation. Default: `false`.
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{ "implicitViews": true }
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `imageAliases`
|
|
111
|
+
|
|
112
|
+
Shortcuts for image directory paths. Default alias `@` points to `./images`.
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"imageAliases": {
|
|
117
|
+
"@": "./images",
|
|
118
|
+
"@shared": "../../shared-images"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `manualLayouts`
|
|
124
|
+
|
|
125
|
+
Configure where manual layout data is stored.
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"manualLayouts": {
|
|
130
|
+
"outDir": ".likec4"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`outDir` is relative to the config file location. Default: `".likec4"`.
|
|
136
|
+
|
|
137
|
+
### `styles`
|
|
138
|
+
|
|
139
|
+
Theme customization and default styling.
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"styles": {
|
|
144
|
+
"theme": {
|
|
145
|
+
"colors": {
|
|
146
|
+
"primary": "#FF6B6B",
|
|
147
|
+
"secondary": "rgba(37,99,235,1)"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"defaults": {
|
|
151
|
+
"border": "dashed",
|
|
152
|
+
"opacity": 100,
|
|
153
|
+
"size": "md",
|
|
154
|
+
"relationship": {
|
|
155
|
+
"color": "gray",
|
|
156
|
+
"line": "dashed"
|
|
157
|
+
},
|
|
158
|
+
"view": {
|
|
159
|
+
"routing": "ortho"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Set `styles.defaults.view.routing` to `spline` for curved relationships or `ortho` for right-angle bends. The default is `spline`. A view's `routing` property or `autoLayout` routing parameter overrides this project default. See [Edge routing](./views.md#edge-routing) for precedence and limitations.
|
|
167
|
+
|
|
168
|
+
### `extends`
|
|
169
|
+
|
|
170
|
+
Inherit styles from other config files (JSON only). Single path or array.
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{ "extends": "../shared/likec4.config.json" }
|
|
174
|
+
{ "extends": ["../shared/base.json", "../shared/theme.json"] }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### `landingPage`
|
|
178
|
+
|
|
179
|
+
Configure the landing page of the generated site.
|
|
180
|
+
|
|
181
|
+
Redirect to index view:
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{ "landingPage": { "redirect": true } }
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Show only specific views:
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{ "landingPage": { "include": ["overview", "cloud-detail"] } }
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Hide specific views:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{ "landingPage": { "exclude": ["internal-debug"] } }
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `generators` (TypeScript/JS config only)
|
|
200
|
+
|
|
201
|
+
Custom generators that produce output from the model.
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { defineConfig } from 'likec4'
|
|
205
|
+
|
|
206
|
+
export default defineConfig({
|
|
207
|
+
name: 'my-project',
|
|
208
|
+
generators: {
|
|
209
|
+
'my-gen': async ({ likec4model, ctx }) => {
|
|
210
|
+
const elements = likec4model.elements()
|
|
211
|
+
await ctx.write({
|
|
212
|
+
path: 'output.json',
|
|
213
|
+
content: JSON.stringify(elements, null, 2),
|
|
214
|
+
})
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Run with: `likec4 gen my-gen`
|
|
221
|
+
|
|
222
|
+
## Multi-Project Setup
|
|
223
|
+
|
|
224
|
+
Each config file in the workspace defines a separate project. Files belong to the project of the nearest config file in the directory hierarchy.
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
workspace/
|
|
228
|
+
├─ project-a/
|
|
229
|
+
│ ├─ likec4.config.json ← project "a"
|
|
230
|
+
│ ├─ model.c4
|
|
231
|
+
│ └─ views.c4
|
|
232
|
+
├─ project-b/
|
|
233
|
+
│ ├─ likec4.config.json ← project "b"
|
|
234
|
+
│ └─ model.c4
|
|
235
|
+
└─ shared/
|
|
236
|
+
└─ common.c4 ← included via "include.paths"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Use `include.paths` to share `.c4` files across projects.
|
|
240
|
+
|
|
241
|
+
## Minimal Starter Config
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"$schema": "https://likec4.dev/schemas/config.json",
|
|
246
|
+
"name": "my-project",
|
|
247
|
+
"title": "My Architecture"
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Important:** Always include `"$schema"` (recommended) — it enables IDE autocomplete and validation for your config file.
|
|
252
|
+
|
|
253
|
+
### Common Mistake: Missing $schema
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
// ❌ Missing $schema — no IDE validation/autocomplete
|
|
257
|
+
{
|
|
258
|
+
"name": "my-project"
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ✅ Correct — with schema for IDE support
|
|
262
|
+
{
|
|
263
|
+
"$schema": "https://likec4.dev/schemas/config.json",
|
|
264
|
+
"name": "my-project"
|
|
265
|
+
}
|
|
266
|
+
```
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Deployment (LikeC4 DSL)
|
|
2
|
+
|
|
3
|
+
The `deployment` block maps logical model elements to physical infrastructure nodes using `instanceOf`. It uses `deploymentNode` kinds from the specification.
|
|
4
|
+
|
|
5
|
+
**Key rules:**
|
|
6
|
+
|
|
7
|
+
- Deployment inherits ALL relationships from the logical model automatically.
|
|
8
|
+
- Additional deployment-level relationships can be defined inline (same syntax as in model).
|
|
9
|
+
- Use named instances (`id = instanceOf ELEMENT`) when multiple instances of the same element exist within the same deployment node.
|
|
10
|
+
- Anonymous `instanceOf ELEMENT` (no name) is fine when there is only one instance per node.
|
|
11
|
+
- In deployment-view filters, instance tags are cumulative with logical element tags.
|
|
12
|
+
- In deployment-view filters, instance metadata replaces logical element metadata when present; otherwise logical metadata is the fallback.
|
|
13
|
+
|
|
14
|
+
## Syntax
|
|
15
|
+
|
|
16
|
+
```likec4
|
|
17
|
+
deployment {
|
|
18
|
+
IDENTIFIER = DEPLOYMENT_KIND {
|
|
19
|
+
TAGS
|
|
20
|
+
PROPERTIES
|
|
21
|
+
|
|
22
|
+
// Anonymous instance — fine when there is only one instance per node
|
|
23
|
+
instanceOf ELEMENT_ID
|
|
24
|
+
|
|
25
|
+
// Named instance — required when same element appears multiple times in the same node
|
|
26
|
+
IDENTIFIER = instanceOf ELEMENT_ID {
|
|
27
|
+
TAGS
|
|
28
|
+
PROPERTIES
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Basic Example
|
|
35
|
+
|
|
36
|
+
```likec4
|
|
37
|
+
specification {
|
|
38
|
+
element webapp
|
|
39
|
+
deploymentNode vm
|
|
40
|
+
}
|
|
41
|
+
model {
|
|
42
|
+
webapp myapp
|
|
43
|
+
}
|
|
44
|
+
deployment {
|
|
45
|
+
vm vm1 {
|
|
46
|
+
instanceOf myapp // anonymous: single instance
|
|
47
|
+
}
|
|
48
|
+
vm vm2 {
|
|
49
|
+
// Named: two replicas of the same logical element in one node
|
|
50
|
+
instance1 = instanceOf myapp
|
|
51
|
+
instance2 = instanceOf myapp
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Multi-Environment Pattern
|
|
57
|
+
|
|
58
|
+
```likec4
|
|
59
|
+
specification {
|
|
60
|
+
deploymentNode environment { notation "Environment"; style { color gray } }
|
|
61
|
+
deploymentNode zone { notation "Network Zone" }
|
|
62
|
+
deploymentNode vm
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
deployment {
|
|
66
|
+
environment prod {
|
|
67
|
+
zone AppTier {
|
|
68
|
+
vm appVm {
|
|
69
|
+
primary = instanceOf cloud.api
|
|
70
|
+
secondary = instanceOf cloud.api // named: two replicas
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
zone DataTier {
|
|
74
|
+
vm dbVm { instanceOf cloud.db }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
environment staging {
|
|
78
|
+
vm stagingApp { instanceOf cloud.api }
|
|
79
|
+
vm stagingDb { instanceOf cloud.db }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Deployment Relationships
|
|
85
|
+
|
|
86
|
+
Additional relationships can be defined between deployment nodes or named instances:
|
|
87
|
+
|
|
88
|
+
```likec4
|
|
89
|
+
deployment {
|
|
90
|
+
environment prod {
|
|
91
|
+
zone AppTier {
|
|
92
|
+
vm appVm {
|
|
93
|
+
primary = instanceOf cloud.api
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
zone DataTier {
|
|
97
|
+
vm dbVm { instanceOf cloud.db }
|
|
98
|
+
}
|
|
99
|
+
// Deployment-level relationship not in the logical model
|
|
100
|
+
AppTier -> DataTier "internal traffic" { technology "TCP/5432" }
|
|
101
|
+
// Bidirectional, `-[kind]<->` is also supported
|
|
102
|
+
AppTier <-> DataTier "replicates"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Deployment View Filtering
|
|
108
|
+
|
|
109
|
+
Deployment views use normal `where` filters, with deployment-aware endpoint values:
|
|
110
|
+
|
|
111
|
+
- Deployment instance tags = logical element tags + instance tags.
|
|
112
|
+
- Deployment instance kind = logical element kind.
|
|
113
|
+
- Deployment instance metadata replaces logical metadata as a whole when present, otherwise logical metadata is the fallback.
|
|
114
|
+
- Nested children of a deployed instance use the logical child tags, kind, and metadata.
|
|
115
|
+
- Deployment node tags, kind, and metadata come from the deployment model.
|
|
116
|
+
- Tags are not inherited from parent deployment nodes.
|
|
117
|
+
|
|
118
|
+
Relationship endpoint filters use those same rules:
|
|
119
|
+
|
|
120
|
+
```likec4
|
|
121
|
+
views {
|
|
122
|
+
deployment view prod {
|
|
123
|
+
include * -> *
|
|
124
|
+
exclude * -> *
|
|
125
|
+
where target.metadata.zone is "restricted"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Use unqualified `metadata.*` for the relationship's own metadata; use `source.metadata.*` or `target.metadata.*` for endpoint metadata.
|
|
131
|
+
|
|
132
|
+
## Deployment View Navigation
|
|
133
|
+
|
|
134
|
+
Element `with { navigateTo VIEW_ID }` overrides are supported for deployment nodes and instances:
|
|
135
|
+
|
|
136
|
+
```likec4
|
|
137
|
+
views {
|
|
138
|
+
deployment view prod {
|
|
139
|
+
include server with {
|
|
140
|
+
navigateTo server_deployment
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
deployment view server_deployment {
|
|
144
|
+
include server.*
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The target must be an existing view. Overrides are view-local, support selectors and `where` filters,
|
|
150
|
+
and the last matching navigation override wins. Other element `with` properties remain unsupported;
|
|
151
|
+
use local `style` rules for deployment-view styling.
|
|
152
|
+
|
|
153
|
+
## Named vs. Anonymous: When It Matters
|
|
154
|
+
|
|
155
|
+
| Scenario | Use |
|
|
156
|
+
| ----------------------------------------------- | --------------------------------------------- |
|
|
157
|
+
| Single instance of element in node | Anonymous: `instanceOf cloud.api` |
|
|
158
|
+
| Multiple instances of same element in same node | Named: `primary = instanceOf cloud.api` |
|
|
159
|
+
| Strict eval requires named instance identifier | Named: `IDENTIFIER = instanceOf ELEMENT` |
|
|
160
|
+
| Deployment view needs to distinguish replicas | Named: each gets a unique node in the diagram |
|