@kekonic/diagrams-cli 1.0.0-rc.4
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/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1273 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/lsp-bin.d.mts +1 -0
- package/dist/lsp-bin.mjs +8 -0
- package/dist/lsp-bin.mjs.map +1 -0
- package/dist/lsp-server-uxE48S7X.mjs +325 -0
- package/dist/lsp-server-uxE48S7X.mjs.map +1 -0
- package/dist/lsp-server.d.mts +7 -0
- package/dist/lsp-server.mjs +2 -0
- package/package.json +62 -0
- package/schema/kekonic-diagrams.config.schema.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kekonic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# @kekonic/diagrams-cli
|
|
2
|
+
|
|
3
|
+
Command-line tools for KDiagram diagrams.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add --save-dev @kekonic/diagrams-cli
|
|
9
|
+
pnpm kdiagrams --help
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Keep the CLI local to the project so developers and CI use the same version. For a one-off
|
|
13
|
+
evaluation, run `pnpm dlx @kekonic/diagrams-cli --help`.
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Render one portable diagram to SVG (stdout or file)
|
|
19
|
+
kdiagrams render diagram.kdiagram -o out.svg --theme light
|
|
20
|
+
|
|
21
|
+
# Discover and render a directory while preserving its structure
|
|
22
|
+
kdiagrams render diagrams/ --out-dir public/diagrams
|
|
23
|
+
|
|
24
|
+
# Validate files, directories, or quoted globs
|
|
25
|
+
kdiagrams check docs/ "examples/**/*.kdiagram"
|
|
26
|
+
kdiagrams check - --json # diagram source on stdin
|
|
27
|
+
git ls-files "*.kdiagram" | kdiagrams check --files-from -
|
|
28
|
+
|
|
29
|
+
# Dump AST or GraphModel as JSON
|
|
30
|
+
kdiagrams ast diagram.kdiagrams --pretty
|
|
31
|
+
kdiagrams graph diagram.kdiagrams --pretty
|
|
32
|
+
|
|
33
|
+
# Discover the supported surface and inspect rendered quality
|
|
34
|
+
kdiagrams capabilities --pretty
|
|
35
|
+
kdiagrams analyze diagrams/ --pretty
|
|
36
|
+
|
|
37
|
+
# Format source
|
|
38
|
+
kdiagrams format diagram.kdiagram -o formatted.kdiagram
|
|
39
|
+
kdiagrams format diagrams/ --check
|
|
40
|
+
kdiagrams format diagrams/ --write
|
|
41
|
+
kdiagrams doctor
|
|
42
|
+
kdiagrams completions zsh > ~/.zfunc/_kdiagrams
|
|
43
|
+
kdiagrams studio architecture.kdiagram
|
|
44
|
+
kdiagrams lsp --stdio
|
|
45
|
+
kdiagrams --version
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Diagnostics print to stderr; rendered SVG or versioned JSON goes to stdout unless `-o` is set.
|
|
49
|
+
Unknown options are rejected with suggestions. Exit `0` means success, `1` means source diagnostics
|
|
50
|
+
or a format check failure, `2` means invalid CLI usage, and `3` means an operational failure.
|
|
51
|
+
|
|
52
|
+
## Input discovery
|
|
53
|
+
|
|
54
|
+
Every command accepts files, directories, and quoted glob patterns. Directory discovery is
|
|
55
|
+
recursive, stably ordered, limited to `.kdiagram` files, and deduplicated. Options may appear before
|
|
56
|
+
or after inputs.
|
|
57
|
+
|
|
58
|
+
Place Git-ignore-style patterns in `.kdiagramignore`, select another rules file with
|
|
59
|
+
`--ignore-file`, or repeat `--exclude` for command-specific exclusions. `-` means diagram source on
|
|
60
|
+
stdin; when a command has no input, piped stdin is read automatically. Use `--stdin-filename` to
|
|
61
|
+
give that source a meaningful path. `--files-from <file|->` instead reads one input path per line.
|
|
62
|
+
|
|
63
|
+
For batch rendering, use `--out-dir` and optionally `--output-template`. Templates support
|
|
64
|
+
`{path}`, `{dir}`, `{name}`, and `{ext}`. The default `{path}.svg` preserves source directories and
|
|
65
|
+
the command rejects output collisions before writing files.
|
|
66
|
+
|
|
67
|
+
## Agent and automation contracts
|
|
68
|
+
|
|
69
|
+
`kdiagrams capabilities` emits a deterministic, versioned description of the built-in language,
|
|
70
|
+
node kinds, shapes, icons, layout policies, presentation modes, and quality checks. Its
|
|
71
|
+
`registryScope` is `built-in`; runtime registrations belong to the embedding application and are
|
|
72
|
+
not inferred by the standalone CLI.
|
|
73
|
+
|
|
74
|
+
`kdiagrams analyze <inputs...>` runs the complete parse, compile, measure, layout, and route pipeline
|
|
75
|
+
without returning SVG. Its JSON envelope reports diagnostics and artifact dimensions for every
|
|
76
|
+
input. Source errors exit 1; quality warnings remain inspectable warnings so callers can apply a
|
|
77
|
+
project-specific delivery policy.
|
|
78
|
+
|
|
79
|
+
## Portable exports and project config
|
|
80
|
+
|
|
81
|
+
CLI SVG is a self-contained theme snapshot by default. Use `--live-theme` only when the SVG will be
|
|
82
|
+
inlined into a host that provides KDiagram CSS variables. `--background theme`, `--embed-fonts`, and
|
|
83
|
+
`--print-safe` make destination requirements explicit.
|
|
84
|
+
|
|
85
|
+
The CLI discovers `kekonic-diagrams.config.json` upward from the current directory. It can define named
|
|
86
|
+
themes and reusable profiles; command flags take precedence:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"$schema": "./node_modules/@kekonic/diagrams-cli/schema/kekonic-diagrams.config.schema.json",
|
|
91
|
+
"version": 1,
|
|
92
|
+
"defaultProfile": "paper",
|
|
93
|
+
"profiles": {
|
|
94
|
+
"paper": {
|
|
95
|
+
"theme": "light",
|
|
96
|
+
"background": "theme",
|
|
97
|
+
"embedFonts": true,
|
|
98
|
+
"printSafe": true
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Select a profile with `--profile paper`, a config with `--config`, or a deterministic JSON token map
|
|
105
|
+
with `--theme-file`. PNG and PDF are reserved in the profile model but are not emitted by this CLI
|
|
106
|
+
version.
|
|
107
|
+
|
|
108
|
+
After stable releases begin, macOS users can install the same published CLI through
|
|
109
|
+
`brew install kekonic/tap/diagrams`.
|
|
110
|
+
|
|
111
|
+
## Local authoring studio
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
kdiagrams studio architecture.kdiagram
|
|
115
|
+
kdiagrams studio diagrams/ --no-open
|
|
116
|
+
kdiagrams studio architecture.kdiagrams --allow-write
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Studio starts an offline browser authoring host with Monaco editing, live preview and diagnostics,
|
|
120
|
+
layout/theme controls, graph inspection, source/graph selection, and SVG export. It binds only to
|
|
121
|
+
`127.0.0.1`, generates an unguessable token for each session, and limits file access to resolved
|
|
122
|
+
inputs. Browser saves are disabled unless `--allow-write` is explicit. `--no-open` starts the server
|
|
123
|
+
without launching a browser; use `--port` only when another local tool needs a predictable port.
|
|
124
|
+
|
|
125
|
+
## Language server
|
|
126
|
+
|
|
127
|
+
`kdiagrams lsp --stdio` runs the Language Server Protocol for editor clients. It supports incremental
|
|
128
|
+
document synchronization, diagnostics, completion, hover, definition, references, rename, document
|
|
129
|
+
symbols, folding, semantic tokens, formatting, and code actions. Protocol messages are the only
|
|
130
|
+
stdout output. The server and Studio both use `@kekonic/diagrams-language-service`, so editor
|
|
131
|
+
semantics do not diverge from CLI validation and formatting.
|
|
132
|
+
|
|
133
|
+
## Example
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
kdiagrams render diagram.kdiagram -o out.svg
|
|
137
|
+
kdiagrams check diagram.kdiagram
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
See `@kekonic/diagrams` for programmatic API usage.
|
|
141
|
+
|
|
142
|
+
Publishing guides (CI, README SVGs, wiki exports): [diagrams.kekonic.com/publish](https://diagrams.kekonic.com/publish/).
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|