kb-dashboard-cli 0.2.0__tar.gz
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.
- kb_dashboard_cli-0.2.0/PKG-INFO +198 -0
- kb_dashboard_cli-0.2.0/README.md +177 -0
- kb_dashboard_cli-0.2.0/pyproject.toml +229 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/__init__.py +23 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/cli.py +104 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/cli_context.py +21 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/cli_local.py +520 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/cli_options.py +276 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/cli_output.py +189 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/cli_remote.py +710 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/lsp/__init__.py +10 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/lsp/grid_extractor.py +103 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/lsp/grid_updater.py +220 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/lsp/models.py +292 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/lsp/server.py +466 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/lsp/utils.py +25 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/sample_data/__init__.py +1 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/sample_data/loader.py +163 -0
- kb_dashboard_cli-0.2.0/src/dashboard_compiler/tools/__init__.py +1 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: kb-dashboard-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: CLI, LSP, and future MCP server for kb-yaml-to-lens dashboard compiler
|
|
5
|
+
License: MIT
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
12
|
+
Requires-Dist: kb-dashboard-core
|
|
13
|
+
Requires-Dist: kb-dashboard-tools
|
|
14
|
+
Requires-Dist: click>=8.3
|
|
15
|
+
Requires-Dist: rich-click>=1.9.0
|
|
16
|
+
Requires-Dist: elasticsearch>=8.16.2
|
|
17
|
+
Requires-Dist: pygls>=2.0.0
|
|
18
|
+
Requires-Dist: lsprotocol>=2024.0.0
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
<!-- markdownlint-disable MD041 -->
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
# kb-dashboard-cli
|
|
26
|
+
|
|
27
|
+
CLI, LSP, and future MCP server for the kb-yaml-to-lens dashboard compiler.
|
|
28
|
+
|
|
29
|
+
This package provides command-line tools and language server capabilities for building Kibana dashboards from YAML definitions.
|
|
30
|
+
It converts human-friendly YAML dashboard definitions into Kibana NDJSON format:
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- **YAML-based Dashboard Definition** – Define dashboards, panels, filters, and queries in simple YAML
|
|
35
|
+
- **Rich Panel Support** – Lens visualizations (metric, pie, XY charts), Markdown, Links, Image panels, and more
|
|
36
|
+
- **Advanced Controls** – Control groups with options lists, range sliders, and time sliders with chaining
|
|
37
|
+
- **Filter Support** – Exists, phrase, range, and custom DSL with AND/OR/NOT operators
|
|
38
|
+
- **Direct Upload** – Optional direct upload to Kibana with authentication support
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
**For ⭐ VS Code Extension (Recommended):**
|
|
43
|
+
- VS Code 1.85.0+ or compatible editor (Cursor, VSCodium, etc.)
|
|
44
|
+
- No Python installation required - bundled binary included!
|
|
45
|
+
|
|
46
|
+
**For CLI (Automation/CI):**
|
|
47
|
+
- Python 3.12+
|
|
48
|
+
- [uv](https://github.com/astral-sh/uv) (recommended for dependency management)
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### Option 1: ⭐ VS Code Extension (Recommended for Getting Started)
|
|
53
|
+
|
|
54
|
+
**Best for:** Interactive dashboard development, visual editing, live preview
|
|
55
|
+
|
|
56
|
+
The VS Code extension is the fastest way to start building Kibana dashboards. It includes:
|
|
57
|
+
- Pre-built snippets for quick dashboard scaffolding
|
|
58
|
+
- Live preview as you type
|
|
59
|
+
- Visual drag-and-drop grid editor
|
|
60
|
+
- One-click upload to Kibana
|
|
61
|
+
- **No Python installation required** - LSP server binary is bundled
|
|
62
|
+
|
|
63
|
+
#### Installation
|
|
64
|
+
|
|
65
|
+
**From OpenVSX Registry (Cursor, VS Code forks):**
|
|
66
|
+
1. Open Extensions view (Ctrl+Shift+X)
|
|
67
|
+
2. Search for "Kibana Dashboard Compiler"
|
|
68
|
+
3. Click Install
|
|
69
|
+
|
|
70
|
+
**Manual VSIX Install:**
|
|
71
|
+
Download platform-specific `.vsix` from [releases page](https://github.com/strawgate/kb-yaml-to-lens/releases)
|
|
72
|
+
|
|
73
|
+
#### Verify Installation
|
|
74
|
+
|
|
75
|
+
After installation, verify the extension is working:
|
|
76
|
+
|
|
77
|
+
1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
|
|
78
|
+
2. Type "YAML Dashboard" - you should see all extension commands
|
|
79
|
+
3. Create a test file: `test-dashboard.yaml`
|
|
80
|
+
4. Type `dashboard` and press Tab - a snippet should insert
|
|
81
|
+
|
|
82
|
+
If commands don't appear, restart VS Code and check the Output panel (View → Output → "Kibana Dashboard Compiler").
|
|
83
|
+
|
|
84
|
+
#### Your First Dashboard in VS Code
|
|
85
|
+
|
|
86
|
+
1. Create a new file: `my-dashboard.yaml`
|
|
87
|
+
2. Start typing `dashboard` and press Tab to insert snippet
|
|
88
|
+
3. Save (Ctrl+S) - auto-compiles in background
|
|
89
|
+
4. Run command (Ctrl+Shift+P): **"YAML Dashboard: Preview Dashboard"**
|
|
90
|
+
5. Configure Kibana URL in settings, then run: **"YAML Dashboard: Open in Kibana"**
|
|
91
|
+
|
|
92
|
+
**Learn more:** [VS Code Extension Documentation](https://strawgate.github.io/kb-yaml-to-lens/vscode-extension)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Option 2: CLI (Best for Automation & CI/CD)
|
|
97
|
+
|
|
98
|
+
**Best for:** Scripting, CI/CD pipelines, batch processing, programmatic usage
|
|
99
|
+
|
|
100
|
+
The CLI provides three installation methods:
|
|
101
|
+
|
|
102
|
+
<details>
|
|
103
|
+
<summary><b>Click to expand CLI installation options</b></summary>
|
|
104
|
+
|
|
105
|
+
#### Using uv (Recommended for Development)
|
|
106
|
+
|
|
107
|
+
This project uses [uv](https://github.com/astral-sh/uv) for fast, reliable Python package management.
|
|
108
|
+
|
|
109
|
+
**For basic usage (compiling dashboards):**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
uv sync
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Using Docker
|
|
116
|
+
|
|
117
|
+
Run the compiler in a container without installing Python or dependencies:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Pull the pre-built image
|
|
121
|
+
docker pull ghcr.io/strawgate/kb-yaml-to-lens/kb-dashboard-compiler:latest
|
|
122
|
+
|
|
123
|
+
# Or build locally (from repo root)
|
|
124
|
+
make cli docker-build
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Standalone Binary
|
|
128
|
+
|
|
129
|
+
Download a platform-specific binary from the [releases page](https://github.com/strawgate/kb-yaml-to-lens/releases):
|
|
130
|
+
|
|
131
|
+
- Linux (x64): `kb-dashboard-linux-x64`
|
|
132
|
+
- macOS (Intel): `kb-dashboard-darwin-x64`
|
|
133
|
+
- macOS (Apple Silicon): `kb-dashboard-darwin-arm64`
|
|
134
|
+
- Windows (x64): `kb-dashboard-windows-x64.exe`
|
|
135
|
+
|
|
136
|
+
No Python installation required!
|
|
137
|
+
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
#### Compile Your First Dashboard (CLI)
|
|
141
|
+
|
|
142
|
+
1. Create a YAML dashboard file in `inputs/` directory:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
dashboards:
|
|
146
|
+
- name: My First Dashboard
|
|
147
|
+
description: A simple dashboard with markdown
|
|
148
|
+
panels:
|
|
149
|
+
- title: Welcome
|
|
150
|
+
grid: { x: 0, y: 0, w: 24, h: 15 } # Position and size on 48-column grid
|
|
151
|
+
markdown:
|
|
152
|
+
content: |
|
|
153
|
+
# Welcome to Kibana!
|
|
154
|
+
|
|
155
|
+
This is my first dashboard compiled from YAML.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
2. Compile to NDJSON:
|
|
159
|
+
|
|
160
|
+
If using uv: `uv run kb-dashboard compile --input-dir inputs --output-dir output`
|
|
161
|
+
|
|
162
|
+
If using Docker:
|
|
163
|
+
```bash
|
|
164
|
+
docker run --rm -v $(pwd)/inputs:/inputs -v $(pwd)/output:/output \
|
|
165
|
+
ghcr.io/strawgate/kb-yaml-to-lens/kb-dashboard-compiler:latest \
|
|
166
|
+
compile --input-dir inputs --output-dir output
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
If using standalone binary: `./kb-dashboard-<platform> compile --input-dir inputs --output-dir output`
|
|
170
|
+
|
|
171
|
+
3. (Optional) Upload directly to Kibana:
|
|
172
|
+
|
|
173
|
+
Add `--upload --kibana-url http://localhost:5601 --kibana-username elastic --kibana-password changeme` to the compile command above.
|
|
174
|
+
|
|
175
|
+
The `--upload` flag will automatically open your dashboard in the browser upon successful upload.
|
|
176
|
+
|
|
177
|
+
**Learn more:** [CLI Documentation](https://strawgate.github.io/kb-yaml-to-lens/CLI)
|
|
178
|
+
|
|
179
|
+
## Documentation
|
|
180
|
+
|
|
181
|
+
### Getting Started
|
|
182
|
+
- **[VS Code Extension Guide](https://strawgate.github.io/kb-yaml-to-lens/vscode-extension)** - Visual dashboard development (recommended for beginners)
|
|
183
|
+
- **[CLI Reference](https://strawgate.github.io/kb-yaml-to-lens/CLI)** - Command-line compilation and automation
|
|
184
|
+
- **[Complete Examples](https://strawgate.github.io/kb-yaml-to-lens/examples/)** - Real-world dashboard examples you can copy
|
|
185
|
+
|
|
186
|
+
### Deep Dive
|
|
187
|
+
- **[Full Documentation Site](https://strawgate.github.io/kb-yaml-to-lens/)** - Complete user guide and API reference
|
|
188
|
+
- **[Programmatic Usage Guide](https://strawgate.github.io/kb-yaml-to-lens/programmatic-usage)** - Create dashboards entirely in Python code
|
|
189
|
+
- **[Architecture](https://strawgate.github.io/kb-yaml-to-lens/architecture)** - Technical design and data flow overview
|
|
190
|
+
- **[Contributing Guide](../CONTRIBUTING.md)** - How to contribute and add new capabilities
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
MIT
|
|
195
|
+
|
|
196
|
+
## Support
|
|
197
|
+
|
|
198
|
+
For issues and feature requests, please refer to the repository's issue tracker.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD041 -->
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
# kb-dashboard-cli
|
|
5
|
+
|
|
6
|
+
CLI, LSP, and future MCP server for the kb-yaml-to-lens dashboard compiler.
|
|
7
|
+
|
|
8
|
+
This package provides command-line tools and language server capabilities for building Kibana dashboards from YAML definitions.
|
|
9
|
+
It converts human-friendly YAML dashboard definitions into Kibana NDJSON format:
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **YAML-based Dashboard Definition** – Define dashboards, panels, filters, and queries in simple YAML
|
|
14
|
+
- **Rich Panel Support** – Lens visualizations (metric, pie, XY charts), Markdown, Links, Image panels, and more
|
|
15
|
+
- **Advanced Controls** – Control groups with options lists, range sliders, and time sliders with chaining
|
|
16
|
+
- **Filter Support** – Exists, phrase, range, and custom DSL with AND/OR/NOT operators
|
|
17
|
+
- **Direct Upload** – Optional direct upload to Kibana with authentication support
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
**For ⭐ VS Code Extension (Recommended):**
|
|
22
|
+
- VS Code 1.85.0+ or compatible editor (Cursor, VSCodium, etc.)
|
|
23
|
+
- No Python installation required - bundled binary included!
|
|
24
|
+
|
|
25
|
+
**For CLI (Automation/CI):**
|
|
26
|
+
- Python 3.12+
|
|
27
|
+
- [uv](https://github.com/astral-sh/uv) (recommended for dependency management)
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### Option 1: ⭐ VS Code Extension (Recommended for Getting Started)
|
|
32
|
+
|
|
33
|
+
**Best for:** Interactive dashboard development, visual editing, live preview
|
|
34
|
+
|
|
35
|
+
The VS Code extension is the fastest way to start building Kibana dashboards. It includes:
|
|
36
|
+
- Pre-built snippets for quick dashboard scaffolding
|
|
37
|
+
- Live preview as you type
|
|
38
|
+
- Visual drag-and-drop grid editor
|
|
39
|
+
- One-click upload to Kibana
|
|
40
|
+
- **No Python installation required** - LSP server binary is bundled
|
|
41
|
+
|
|
42
|
+
#### Installation
|
|
43
|
+
|
|
44
|
+
**From OpenVSX Registry (Cursor, VS Code forks):**
|
|
45
|
+
1. Open Extensions view (Ctrl+Shift+X)
|
|
46
|
+
2. Search for "Kibana Dashboard Compiler"
|
|
47
|
+
3. Click Install
|
|
48
|
+
|
|
49
|
+
**Manual VSIX Install:**
|
|
50
|
+
Download platform-specific `.vsix` from [releases page](https://github.com/strawgate/kb-yaml-to-lens/releases)
|
|
51
|
+
|
|
52
|
+
#### Verify Installation
|
|
53
|
+
|
|
54
|
+
After installation, verify the extension is working:
|
|
55
|
+
|
|
56
|
+
1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
|
|
57
|
+
2. Type "YAML Dashboard" - you should see all extension commands
|
|
58
|
+
3. Create a test file: `test-dashboard.yaml`
|
|
59
|
+
4. Type `dashboard` and press Tab - a snippet should insert
|
|
60
|
+
|
|
61
|
+
If commands don't appear, restart VS Code and check the Output panel (View → Output → "Kibana Dashboard Compiler").
|
|
62
|
+
|
|
63
|
+
#### Your First Dashboard in VS Code
|
|
64
|
+
|
|
65
|
+
1. Create a new file: `my-dashboard.yaml`
|
|
66
|
+
2. Start typing `dashboard` and press Tab to insert snippet
|
|
67
|
+
3. Save (Ctrl+S) - auto-compiles in background
|
|
68
|
+
4. Run command (Ctrl+Shift+P): **"YAML Dashboard: Preview Dashboard"**
|
|
69
|
+
5. Configure Kibana URL in settings, then run: **"YAML Dashboard: Open in Kibana"**
|
|
70
|
+
|
|
71
|
+
**Learn more:** [VS Code Extension Documentation](https://strawgate.github.io/kb-yaml-to-lens/vscode-extension)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### Option 2: CLI (Best for Automation & CI/CD)
|
|
76
|
+
|
|
77
|
+
**Best for:** Scripting, CI/CD pipelines, batch processing, programmatic usage
|
|
78
|
+
|
|
79
|
+
The CLI provides three installation methods:
|
|
80
|
+
|
|
81
|
+
<details>
|
|
82
|
+
<summary><b>Click to expand CLI installation options</b></summary>
|
|
83
|
+
|
|
84
|
+
#### Using uv (Recommended for Development)
|
|
85
|
+
|
|
86
|
+
This project uses [uv](https://github.com/astral-sh/uv) for fast, reliable Python package management.
|
|
87
|
+
|
|
88
|
+
**For basic usage (compiling dashboards):**
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv sync
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Using Docker
|
|
95
|
+
|
|
96
|
+
Run the compiler in a container without installing Python or dependencies:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Pull the pre-built image
|
|
100
|
+
docker pull ghcr.io/strawgate/kb-yaml-to-lens/kb-dashboard-compiler:latest
|
|
101
|
+
|
|
102
|
+
# Or build locally (from repo root)
|
|
103
|
+
make cli docker-build
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Standalone Binary
|
|
107
|
+
|
|
108
|
+
Download a platform-specific binary from the [releases page](https://github.com/strawgate/kb-yaml-to-lens/releases):
|
|
109
|
+
|
|
110
|
+
- Linux (x64): `kb-dashboard-linux-x64`
|
|
111
|
+
- macOS (Intel): `kb-dashboard-darwin-x64`
|
|
112
|
+
- macOS (Apple Silicon): `kb-dashboard-darwin-arm64`
|
|
113
|
+
- Windows (x64): `kb-dashboard-windows-x64.exe`
|
|
114
|
+
|
|
115
|
+
No Python installation required!
|
|
116
|
+
|
|
117
|
+
</details>
|
|
118
|
+
|
|
119
|
+
#### Compile Your First Dashboard (CLI)
|
|
120
|
+
|
|
121
|
+
1. Create a YAML dashboard file in `inputs/` directory:
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
dashboards:
|
|
125
|
+
- name: My First Dashboard
|
|
126
|
+
description: A simple dashboard with markdown
|
|
127
|
+
panels:
|
|
128
|
+
- title: Welcome
|
|
129
|
+
grid: { x: 0, y: 0, w: 24, h: 15 } # Position and size on 48-column grid
|
|
130
|
+
markdown:
|
|
131
|
+
content: |
|
|
132
|
+
# Welcome to Kibana!
|
|
133
|
+
|
|
134
|
+
This is my first dashboard compiled from YAML.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
2. Compile to NDJSON:
|
|
138
|
+
|
|
139
|
+
If using uv: `uv run kb-dashboard compile --input-dir inputs --output-dir output`
|
|
140
|
+
|
|
141
|
+
If using Docker:
|
|
142
|
+
```bash
|
|
143
|
+
docker run --rm -v $(pwd)/inputs:/inputs -v $(pwd)/output:/output \
|
|
144
|
+
ghcr.io/strawgate/kb-yaml-to-lens/kb-dashboard-compiler:latest \
|
|
145
|
+
compile --input-dir inputs --output-dir output
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
If using standalone binary: `./kb-dashboard-<platform> compile --input-dir inputs --output-dir output`
|
|
149
|
+
|
|
150
|
+
3. (Optional) Upload directly to Kibana:
|
|
151
|
+
|
|
152
|
+
Add `--upload --kibana-url http://localhost:5601 --kibana-username elastic --kibana-password changeme` to the compile command above.
|
|
153
|
+
|
|
154
|
+
The `--upload` flag will automatically open your dashboard in the browser upon successful upload.
|
|
155
|
+
|
|
156
|
+
**Learn more:** [CLI Documentation](https://strawgate.github.io/kb-yaml-to-lens/CLI)
|
|
157
|
+
|
|
158
|
+
## Documentation
|
|
159
|
+
|
|
160
|
+
### Getting Started
|
|
161
|
+
- **[VS Code Extension Guide](https://strawgate.github.io/kb-yaml-to-lens/vscode-extension)** - Visual dashboard development (recommended for beginners)
|
|
162
|
+
- **[CLI Reference](https://strawgate.github.io/kb-yaml-to-lens/CLI)** - Command-line compilation and automation
|
|
163
|
+
- **[Complete Examples](https://strawgate.github.io/kb-yaml-to-lens/examples/)** - Real-world dashboard examples you can copy
|
|
164
|
+
|
|
165
|
+
### Deep Dive
|
|
166
|
+
- **[Full Documentation Site](https://strawgate.github.io/kb-yaml-to-lens/)** - Complete user guide and API reference
|
|
167
|
+
- **[Programmatic Usage Guide](https://strawgate.github.io/kb-yaml-to-lens/programmatic-usage)** - Create dashboards entirely in Python code
|
|
168
|
+
- **[Architecture](https://strawgate.github.io/kb-yaml-to-lens/architecture)** - Technical design and data flow overview
|
|
169
|
+
- **[Contributing Guide](../CONTRIBUTING.md)** - How to contribute and add new capabilities
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT
|
|
174
|
+
|
|
175
|
+
## Support
|
|
176
|
+
|
|
177
|
+
For issues and feature requests, please refer to the repository's issue tracker.
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "kb-dashboard-cli"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "CLI, LSP, and future MCP server for kb-yaml-to-lens dashboard compiler"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = {text = "MIT"}
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 3 - Alpha",
|
|
10
|
+
"Intended Audience :: Developers",
|
|
11
|
+
"License :: OSI Approved :: MIT License",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Topic :: Software Development :: Code Generators",
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"kb-dashboard-core",
|
|
18
|
+
"kb-dashboard-tools",
|
|
19
|
+
"click>=8.3",
|
|
20
|
+
"rich-click>=1.9.0",
|
|
21
|
+
"elasticsearch>=8.16.2",
|
|
22
|
+
"pygls>=2.0.0",
|
|
23
|
+
"lsprotocol>=2024.0.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[dependency-groups]
|
|
27
|
+
dev = [
|
|
28
|
+
"pytest>=9.0",
|
|
29
|
+
"pytest-cov>=6.0",
|
|
30
|
+
"deepdiff>=8.4.2",
|
|
31
|
+
"pytest-asyncio>=1.3",
|
|
32
|
+
"inline-snapshot>=0.31.1",
|
|
33
|
+
"dirty-equals>=0.8.0",
|
|
34
|
+
"pytest-examples>=0.0.18",
|
|
35
|
+
"pydantic2zod @ git+https://github.com/argyle-engineering/pydantic2zod@0.1.1",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
kb-dashboard = "dashboard_compiler.cli:cli"
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
43
|
+
asyncio_mode = "auto"
|
|
44
|
+
addopts = "-vv"
|
|
45
|
+
|
|
46
|
+
[tool.inline-snapshot]
|
|
47
|
+
format-command = "ruff format"
|
|
48
|
+
|
|
49
|
+
[build-system]
|
|
50
|
+
requires = ["uv_build>=0.8.2,<0.9.0"]
|
|
51
|
+
build-backend = "uv_build"
|
|
52
|
+
|
|
53
|
+
[tool.uv.build-backend]
|
|
54
|
+
module-name = "dashboard_compiler"
|
|
55
|
+
|
|
56
|
+
[tool.uv.sources]
|
|
57
|
+
kb-dashboard-core = { workspace = true }
|
|
58
|
+
kb-dashboard-tools = { workspace = true }
|
|
59
|
+
|
|
60
|
+
[tool.ruff]
|
|
61
|
+
line-length = 140
|
|
62
|
+
# Assume Python 3.12
|
|
63
|
+
target-version = "py312"
|
|
64
|
+
# Add commonly ignored directories
|
|
65
|
+
extend-exclude = [
|
|
66
|
+
".git",
|
|
67
|
+
".mypy_cache",
|
|
68
|
+
".pytest_cache",
|
|
69
|
+
".ruff_cache",
|
|
70
|
+
".venv",
|
|
71
|
+
"venv",
|
|
72
|
+
"__pycache__",
|
|
73
|
+
"build",
|
|
74
|
+
"dist",
|
|
75
|
+
"reference",
|
|
76
|
+
"**/*.old.py",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint]
|
|
80
|
+
|
|
81
|
+
# When using extend-select, a rule like PLR will enable PLR* rules like PLR0###.
|
|
82
|
+
extend-select = [
|
|
83
|
+
"A", "ARG", "B", "C4", "COM", "DTZ", "E", "EM", "F", "FURB", "I",
|
|
84
|
+
"LOG", "N", "PERF", "PIE", "PLR", "PLW", "PT", "PTH", "Q", "RET",
|
|
85
|
+
"RSE", "RUF", "S", "SIM", "TC", "TID", "TRY", "UP", "W",
|
|
86
|
+
"D", # Add docstring checks since kb-yaml-to-lens uses them
|
|
87
|
+
# Additional quality and safety rules:
|
|
88
|
+
"ANN", # flake8-annotations - Type annotations
|
|
89
|
+
"PLE", # Pylint errors - Serious bug detection
|
|
90
|
+
"T10", # flake8-debugger - Prevent debugger statements
|
|
91
|
+
"ISC", # flake8-implicit-str-concat - Prevent string concat bugs
|
|
92
|
+
"FA", # flake8-future-annotations - Modern type hints (PEP 563)
|
|
93
|
+
"PGH", # pygrep-hooks - Additional code quality checks
|
|
94
|
+
"INP", # flake8-no-pep420 - Explicit namespace packages
|
|
95
|
+
]
|
|
96
|
+
ignore = [
|
|
97
|
+
"COM812", # Conflicts with formatter
|
|
98
|
+
"D203", # incorrect-blank-line-before-class
|
|
99
|
+
"D213", # multi-line-summary-second-line
|
|
100
|
+
"D413", # multi-line-summary-second-line
|
|
101
|
+
"D100", # Ignore missing docstrings for modules
|
|
102
|
+
"A002", # Allow shadowing builtin names (e.g., 'filter')
|
|
103
|
+
"ANN401", # We use Pyright for Any checking
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
# Per-file rule ignores
|
|
107
|
+
[tool.ruff.lint.per-file-ignores]
|
|
108
|
+
"__init__.py" = ["F401"] # Ignore unused imports in __init__.py files
|
|
109
|
+
"tests/**/*.py" = [
|
|
110
|
+
"S101", # Allow assert usage in tests
|
|
111
|
+
"PLR2004", # Allow magic values in test assertions
|
|
112
|
+
"INP001", # Tests are not meant to be imported as packages
|
|
113
|
+
]
|
|
114
|
+
"src/dashboard_compiler/**/view.py" = [
|
|
115
|
+
"N815", # Ignore casing requirements for view models
|
|
116
|
+
"N803", # Ignore lowercase arguments in view models
|
|
117
|
+
"D101", # Ignore missing docstrings in view models
|
|
118
|
+
"ANN202", # Ignore missing return type for private serializer methods
|
|
119
|
+
"ERA001", # Allow commented JSON structure documentation
|
|
120
|
+
]
|
|
121
|
+
"src/dashboard_compiler/lsp/grid_*.py" = [
|
|
122
|
+
"PLR2004", # Allow magic numbers (CLI arg counts)
|
|
123
|
+
"PLR0911", # Allow many return statements in grid_updater
|
|
124
|
+
"PLR0912", # Allow many branches in grid_updater
|
|
125
|
+
"PLR0915", # Allow many statements in grid_updater
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[tool.ruff.format]
|
|
129
|
+
quote-style = "single"
|
|
130
|
+
|
|
131
|
+
[tool.ruff.lint.mccabe]
|
|
132
|
+
max-complexity = 10
|
|
133
|
+
|
|
134
|
+
[tool.ruff.lint.isort]
|
|
135
|
+
known-first-party = ["dashboard_compiler"]
|
|
136
|
+
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
|
|
137
|
+
|
|
138
|
+
[tool.ruff.lint.flake8-quotes]
|
|
139
|
+
docstring-quotes = "double"
|
|
140
|
+
inline-quotes = "single"
|
|
141
|
+
|
|
142
|
+
[tool.ruff.lint.pep8-naming]
|
|
143
|
+
classmethod-decorators = ["classmethod", "pydantic.validator"]
|
|
144
|
+
|
|
145
|
+
[tool.coverage.run]
|
|
146
|
+
source = ["src/dashboard_compiler"]
|
|
147
|
+
branch = true
|
|
148
|
+
relative_files = true
|
|
149
|
+
omit = [
|
|
150
|
+
"*/tests/*",
|
|
151
|
+
"*/test_*.py",
|
|
152
|
+
"*/__pycache__/*",
|
|
153
|
+
"*/packages/vscode-extension/*",
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
[tool.coverage.report]
|
|
157
|
+
precision = 2
|
|
158
|
+
show_missing = true
|
|
159
|
+
skip_covered = false
|
|
160
|
+
skip_empty = true
|
|
161
|
+
# Enforce minimum coverage threshold (fails if below this percentage)
|
|
162
|
+
fail_under = 80
|
|
163
|
+
exclude_lines = [
|
|
164
|
+
"pragma: no cover",
|
|
165
|
+
"def __repr__",
|
|
166
|
+
"raise AssertionError",
|
|
167
|
+
"raise NotImplementedError",
|
|
168
|
+
"if __name__ == .__main__.:",
|
|
169
|
+
"if TYPE_CHECKING:",
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
[tool.coverage.html]
|
|
173
|
+
directory = "htmlcov"
|
|
174
|
+
|
|
175
|
+
[tool.coverage.json]
|
|
176
|
+
# Do not fail JSON export based on coverage threshold
|
|
177
|
+
# (threshold enforcement happens in [tool.coverage.report] for make test-coverage)
|
|
178
|
+
output = "coverage.json"
|
|
179
|
+
show_contexts = false
|
|
180
|
+
|
|
181
|
+
[tool.basedpyright]
|
|
182
|
+
pythonVersion = "3.12"
|
|
183
|
+
typeCheckingMode = "recommended"
|
|
184
|
+
reportImportCycles = "error"
|
|
185
|
+
reportExplicitAny = false
|
|
186
|
+
reportIncompatibleVariableOverride = false
|
|
187
|
+
include = ["src/dashboard_compiler", "tests"]
|
|
188
|
+
exclude = [
|
|
189
|
+
"**/.venv/**",
|
|
190
|
+
"**/output/**",
|
|
191
|
+
"**/*.old.py",
|
|
192
|
+
]
|
|
193
|
+
[[tool.basedpyright.executionEnvironments]]
|
|
194
|
+
root = "tests"
|
|
195
|
+
# Tests use many libraries and test patterns that trigger type warnings.
|
|
196
|
+
# The volume of warnings makes inline ignores impractical for test code.
|
|
197
|
+
reportMissingTypeStubs = false
|
|
198
|
+
reportUnknownParameterType = false
|
|
199
|
+
reportUnknownArgumentType = false
|
|
200
|
+
reportUnknownVariableType = false
|
|
201
|
+
reportAny = false
|
|
202
|
+
reportArgumentType = false
|
|
203
|
+
reportCallIssue = false
|
|
204
|
+
reportMissingImports = false
|
|
205
|
+
reportUninitializedInstanceVariable = false
|
|
206
|
+
reportUnusedCallResult = false
|
|
207
|
+
reportImplicitOverride = false
|
|
208
|
+
reportPrivateUsage = false
|
|
209
|
+
reportUnannotatedClassAttribute = false
|
|
210
|
+
reportUntypedNamedTuple = false
|
|
211
|
+
|
|
212
|
+
[[tool.basedpyright.executionEnvironments]]
|
|
213
|
+
root = "src/dashboard_compiler/panels/charts/lens/metrics/formula_parser.py"
|
|
214
|
+
# Formula parser uses TatSu which lacks type stubs and returns untyped AST structures.
|
|
215
|
+
# With 100+ type unknowns, per-line ignores would severely harm readability.
|
|
216
|
+
reportMissingTypeStubs = false
|
|
217
|
+
reportAny = false
|
|
218
|
+
reportUnknownMemberType = false
|
|
219
|
+
reportUnknownVariableType = false
|
|
220
|
+
reportUnknownArgumentType = false
|
|
221
|
+
|
|
222
|
+
[[tool.basedpyright.executionEnvironments]]
|
|
223
|
+
root = "src/dashboard_compiler/yaml_roundtrip.py"
|
|
224
|
+
# ruamel.yaml lacks type stubs and returns dynamic types from load/dump operations.
|
|
225
|
+
reportAny = false
|
|
226
|
+
reportUnknownMemberType = false
|
|
227
|
+
|
|
228
|
+
[[tool.basedpyright.executionEnvironments]]
|
|
229
|
+
root = "src/dashboard_compiler"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Dashboard CLI Package - CLI, LSP, and future MCP server for kb-yaml-to-lens."""
|
|
2
|
+
|
|
3
|
+
from beartype import BeartypeConf
|
|
4
|
+
from beartype.claw import beartype_this_package
|
|
5
|
+
from kb_dashboard_core.dashboard_compiler import dump, load, render
|
|
6
|
+
from kb_dashboard_tools import KibanaClient
|
|
7
|
+
|
|
8
|
+
# Enable strict BearType checking:
|
|
9
|
+
# - warning_cls_on_decorator_exception=None: Raises fatal exceptions instead of warnings
|
|
10
|
+
# - claw_is_pep526=True: Type-check annotated variable assignments (default, explicit for clarity)
|
|
11
|
+
beartype_this_package(
|
|
12
|
+
conf=BeartypeConf(
|
|
13
|
+
warning_cls_on_decorator_exception=None,
|
|
14
|
+
claw_is_pep526=True,
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
'KibanaClient',
|
|
20
|
+
'dump',
|
|
21
|
+
'load',
|
|
22
|
+
'render',
|
|
23
|
+
]
|