muban-cli 1.0.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.
- muban_cli-1.0.0/.gitignore +13 -0
- muban_cli-1.0.0/.gitlab-ci.yml +110 -0
- muban_cli-1.0.0/LICENSE +21 -0
- muban_cli-1.0.0/PKG-INFO +518 -0
- muban_cli-1.0.0/README.md +473 -0
- muban_cli-1.0.0/docs/MUBAN_CLI_CONCEPT.md +81 -0
- muban_cli-1.0.0/docs/muban-openapi-spec-v1.json +1 -0
- muban_cli-1.0.0/muban_cli/__init__.py +10 -0
- muban_cli-1.0.0/muban_cli/__main__.py +6 -0
- muban_cli-1.0.0/muban_cli/api.py +1085 -0
- muban_cli-1.0.0/muban_cli/auth.py +432 -0
- muban_cli-1.0.0/muban_cli/cli.py +125 -0
- muban_cli-1.0.0/muban_cli/commands/__init__.py +120 -0
- muban_cli-1.0.0/muban_cli/commands/admin.py +152 -0
- muban_cli-1.0.0/muban_cli/commands/audit.py +336 -0
- muban_cli-1.0.0/muban_cli/commands/auth.py +374 -0
- muban_cli-1.0.0/muban_cli/commands/generate.py +199 -0
- muban_cli-1.0.0/muban_cli/commands/resources.py +78 -0
- muban_cli-1.0.0/muban_cli/commands/settings.py +148 -0
- muban_cli-1.0.0/muban_cli/commands/templates.py +346 -0
- muban_cli-1.0.0/muban_cli/commands/users.py +544 -0
- muban_cli-1.0.0/muban_cli/config.py +331 -0
- muban_cli-1.0.0/muban_cli/exceptions.py +53 -0
- muban_cli-1.0.0/muban_cli/py.typed +1 -0
- muban_cli-1.0.0/muban_cli/utils.py +453 -0
- muban_cli-1.0.0/muban_cli.egg-info/PKG-INFO +518 -0
- muban_cli-1.0.0/muban_cli.egg-info/SOURCES.txt +37 -0
- muban_cli-1.0.0/muban_cli.egg-info/dependency_links.txt +1 -0
- muban_cli-1.0.0/muban_cli.egg-info/entry_points.txt +2 -0
- muban_cli-1.0.0/muban_cli.egg-info/requires.txt +18 -0
- muban_cli-1.0.0/muban_cli.egg-info/top_level.txt +1 -0
- muban_cli-1.0.0/pyproject.toml +143 -0
- muban_cli-1.0.0/setup.cfg +4 -0
- muban_cli-1.0.0/tests/__init__.py +3 -0
- muban_cli-1.0.0/tests/conftest.py +261 -0
- muban_cli-1.0.0/tests/test_api.py +245 -0
- muban_cli-1.0.0/tests/test_cli_simple.py +104 -0
- muban_cli-1.0.0/tests/test_config.py +176 -0
- muban_cli-1.0.0/tests/test_utils.py +149 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- test
|
|
3
|
+
- build
|
|
4
|
+
|
|
5
|
+
variables:
|
|
6
|
+
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
7
|
+
|
|
8
|
+
# Cache pip packages between jobs
|
|
9
|
+
cache:
|
|
10
|
+
key: ${CI_COMMIT_REF_SLUG}
|
|
11
|
+
paths:
|
|
12
|
+
- .cache/pip
|
|
13
|
+
- .venv/
|
|
14
|
+
|
|
15
|
+
# Test job - runs on all branches
|
|
16
|
+
test:
|
|
17
|
+
stage: test
|
|
18
|
+
image: python:3.11-slim
|
|
19
|
+
tags:
|
|
20
|
+
- docker
|
|
21
|
+
before_script:
|
|
22
|
+
- python -m venv .venv
|
|
23
|
+
- source .venv/bin/activate
|
|
24
|
+
- pip install --upgrade pip
|
|
25
|
+
- pip install -e ".[dev]"
|
|
26
|
+
script:
|
|
27
|
+
- pytest tests/ -v --tb=short --junitxml=report.xml
|
|
28
|
+
artifacts:
|
|
29
|
+
when: always
|
|
30
|
+
reports:
|
|
31
|
+
junit: report.xml
|
|
32
|
+
expire_in: 1 week
|
|
33
|
+
rules:
|
|
34
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
35
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
36
|
+
- if: $CI_COMMIT_BRANCH
|
|
37
|
+
|
|
38
|
+
# Test with coverage - runs on main/master and MRs
|
|
39
|
+
test:coverage:
|
|
40
|
+
stage: test
|
|
41
|
+
image: python:3.11-slim
|
|
42
|
+
tags:
|
|
43
|
+
- docker
|
|
44
|
+
before_script:
|
|
45
|
+
- python -m venv .venv
|
|
46
|
+
- source .venv/bin/activate
|
|
47
|
+
- pip install --upgrade pip
|
|
48
|
+
- pip install -e ".[dev]"
|
|
49
|
+
script:
|
|
50
|
+
- pytest tests/ -v --cov=muban_cli --cov-report=xml --cov-report=term-missing
|
|
51
|
+
coverage: '/TOTAL.*\s+(\d+%)/'
|
|
52
|
+
artifacts:
|
|
53
|
+
when: always
|
|
54
|
+
reports:
|
|
55
|
+
coverage_report:
|
|
56
|
+
coverage_format: cobertura
|
|
57
|
+
path: coverage.xml
|
|
58
|
+
expire_in: 1 week
|
|
59
|
+
rules:
|
|
60
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
61
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
62
|
+
|
|
63
|
+
# Test multiple Python versions
|
|
64
|
+
.test-matrix:
|
|
65
|
+
stage: test
|
|
66
|
+
tags:
|
|
67
|
+
- docker
|
|
68
|
+
before_script:
|
|
69
|
+
- python -m venv .venv
|
|
70
|
+
- source .venv/bin/activate
|
|
71
|
+
- pip install --upgrade pip
|
|
72
|
+
- pip install -e ".[dev]"
|
|
73
|
+
script:
|
|
74
|
+
- pytest tests/ -v --tb=short
|
|
75
|
+
|
|
76
|
+
test:py39:
|
|
77
|
+
extends: .test-matrix
|
|
78
|
+
image: python:3.9-slim
|
|
79
|
+
rules:
|
|
80
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
81
|
+
|
|
82
|
+
test:py310:
|
|
83
|
+
extends: .test-matrix
|
|
84
|
+
image: python:3.10-slim
|
|
85
|
+
rules:
|
|
86
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
87
|
+
|
|
88
|
+
test:py312:
|
|
89
|
+
extends: .test-matrix
|
|
90
|
+
image: python:3.12-slim
|
|
91
|
+
rules:
|
|
92
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
93
|
+
|
|
94
|
+
# Build package
|
|
95
|
+
build:
|
|
96
|
+
stage: build
|
|
97
|
+
image: python:3.11-slim
|
|
98
|
+
tags:
|
|
99
|
+
- docker
|
|
100
|
+
before_script:
|
|
101
|
+
- pip install build
|
|
102
|
+
script:
|
|
103
|
+
- python -m build
|
|
104
|
+
artifacts:
|
|
105
|
+
paths:
|
|
106
|
+
- dist/
|
|
107
|
+
expire_in: 1 week
|
|
108
|
+
rules:
|
|
109
|
+
- if: $CI_COMMIT_TAG
|
|
110
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
muban_cli-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 muban-cli contributors
|
|
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.
|
muban_cli-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: muban-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Command-line interface for Muban Document Generation Service
|
|
5
|
+
Author-email: Muban Team <contact@muban.me>
|
|
6
|
+
Maintainer-email: Muban Team <contact@muban.me>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://muban.me
|
|
9
|
+
Project-URL: Documentation, https://muban.me/features.html
|
|
10
|
+
Keywords: muban,jasperreports,document-generation,cli,pdf,reporting,templates
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: click>=8.0.0
|
|
29
|
+
Requires-Dist: requests>=2.25.0
|
|
30
|
+
Requires-Dist: urllib3>=1.26.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
|
35
|
+
Requires-Dist: responses>=0.23.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: types-requests>=2.28.0; extra == "dev"
|
|
40
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: mkdocs>=1.4.0; extra == "docs"
|
|
43
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# Muban CLI
|
|
47
|
+
|
|
48
|
+
A robust command-line interface for the **Muban Document Generation Service**. Manage JasperReports templates and generate documents directly from your terminal.
|
|
49
|
+
|
|
50
|
+
[](https://www.python.org/downloads/)
|
|
51
|
+
[](https://opensource.org/licenses/MIT)
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- **Secure Authentication** - JWT token-based auth with credential login
|
|
56
|
+
- **Template Management** - List, upload, download, and delete templates
|
|
57
|
+
- **Document Generation** - Generate PDF, XLSX, DOCX, RTF, and HTML documents
|
|
58
|
+
- **Search & Filter** - Search templates and filter audit logs
|
|
59
|
+
- **Audit & Monitoring** - Access audit logs and security dashboards (admin)
|
|
60
|
+
- **Automation Ready** - Perfect for CI/CD pipelines and scripting
|
|
61
|
+
- **Cross-Platform** - Works on Windows, macOS, and Linux
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
### From PyPI (Recommended)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install muban-cli
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### From Source
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/muban/muban-cli.git
|
|
75
|
+
cd muban-cli
|
|
76
|
+
pip install -e .
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Development Installation
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install -e ".[dev]"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
### 1. Configure the Server
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Interactive setup
|
|
91
|
+
muban configure
|
|
92
|
+
|
|
93
|
+
# Or with command-line options
|
|
94
|
+
muban configure --server https://api.muban.me
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2. Login with Your Credentials
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Interactive login (prompts for username/password)
|
|
101
|
+
muban login
|
|
102
|
+
|
|
103
|
+
# Or with command-line options
|
|
104
|
+
muban login --username your@email.com
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. List Available Templates
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
muban list
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 4. Generate a Document
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
muban generate TEMPLATE_ID -p title="Monthly Report" -p date="2025-01-08"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
121
|
+
### Configuration File
|
|
122
|
+
|
|
123
|
+
Configuration is stored in `~/.muban/config.json`. JWT tokens are stored separately in `~/.muban/credentials.json` with restricted permissions.
|
|
124
|
+
|
|
125
|
+
### Environment Variables
|
|
126
|
+
|
|
127
|
+
| Variable | Description |
|
|
128
|
+
| -------- | ----------- |
|
|
129
|
+
| `MUBAN_TOKEN` | JWT Bearer token (obtained via `muban login`) |
|
|
130
|
+
| `MUBAN_SERVER_URL` | API server URL (default: <https://api.muban.me>) |
|
|
131
|
+
| `MUBAN_AUTH_SERVER_URL` | Auth server URL (if different from API server) |
|
|
132
|
+
| `MUBAN_TIMEOUT` | Request timeout in seconds |
|
|
133
|
+
| `MUBAN_VERIFY_SSL` | Enable/disable SSL verification |
|
|
134
|
+
| `MUBAN_CONFIG_DIR` | Custom configuration directory |
|
|
135
|
+
|
|
136
|
+
Environment variables take precedence over configuration files.
|
|
137
|
+
|
|
138
|
+
## Commands Reference
|
|
139
|
+
|
|
140
|
+
### Authentication
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Login with credentials (interactive)
|
|
144
|
+
muban login
|
|
145
|
+
|
|
146
|
+
# Login with username provided
|
|
147
|
+
muban login --username admin@example.com
|
|
148
|
+
|
|
149
|
+
# Login with custom server
|
|
150
|
+
muban login --server https://api.muban.me
|
|
151
|
+
|
|
152
|
+
# Check authentication status (shows token expiry)
|
|
153
|
+
muban whoami
|
|
154
|
+
|
|
155
|
+
# Manually refresh access token
|
|
156
|
+
muban refresh
|
|
157
|
+
|
|
158
|
+
# Logout (clear all tokens)
|
|
159
|
+
muban logout
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Token Refresh:**
|
|
163
|
+
|
|
164
|
+
- If the server provides a refresh token, it's automatically stored
|
|
165
|
+
- The CLI automatically refreshes expired tokens when making API requests
|
|
166
|
+
- Use `muban refresh` to manually refresh before expiration
|
|
167
|
+
- Use `muban whoami` to see token expiration time
|
|
168
|
+
|
|
169
|
+
### Configuration Commands
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Interactive configuration
|
|
173
|
+
muban configure
|
|
174
|
+
|
|
175
|
+
# Set server URL
|
|
176
|
+
muban configure --server https://api.muban.me
|
|
177
|
+
|
|
178
|
+
# Set auth server (if different from API server)
|
|
179
|
+
muban configure --auth-server https://auth.muban.me
|
|
180
|
+
|
|
181
|
+
# Show current configuration
|
|
182
|
+
muban configure --show
|
|
183
|
+
|
|
184
|
+
# Clear all configuration
|
|
185
|
+
muban config-clear
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Template Management
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# List all templates
|
|
192
|
+
muban list
|
|
193
|
+
muban list --search "invoice" --format json
|
|
194
|
+
muban list --page 2 --size 50
|
|
195
|
+
|
|
196
|
+
# Search templates
|
|
197
|
+
muban search "quarterly report"
|
|
198
|
+
|
|
199
|
+
# Get template details
|
|
200
|
+
muban get TEMPLATE_ID
|
|
201
|
+
muban get TEMPLATE_ID --params # Show parameters
|
|
202
|
+
muban get TEMPLATE_ID --fields # Show fields
|
|
203
|
+
|
|
204
|
+
# Upload a template (ZIP format)
|
|
205
|
+
muban push report.zip --name "Monthly Report" --author "John Doe"
|
|
206
|
+
muban push invoice.zip -n "Invoice" -a "Finance Team" -m "Standard invoice template"
|
|
207
|
+
|
|
208
|
+
# Download a template
|
|
209
|
+
muban pull TEMPLATE_ID
|
|
210
|
+
muban pull TEMPLATE_ID -o ./templates/report.zip
|
|
211
|
+
|
|
212
|
+
# Delete a template
|
|
213
|
+
muban delete TEMPLATE_ID
|
|
214
|
+
muban delete TEMPLATE_ID --yes # Skip confirmation
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Document Generation
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Basic generation
|
|
221
|
+
muban generate TEMPLATE_ID -p title="Sales Report"
|
|
222
|
+
|
|
223
|
+
# Multiple parameters
|
|
224
|
+
muban generate TEMPLATE_ID -p title="Report" -p year=2025 -p amount=15750.25
|
|
225
|
+
|
|
226
|
+
# Different output formats
|
|
227
|
+
muban generate TEMPLATE_ID -F xlsx -o report.xlsx
|
|
228
|
+
muban generate TEMPLATE_ID -F docx -o report.docx
|
|
229
|
+
muban generate TEMPLATE_ID -F html -o report.html
|
|
230
|
+
|
|
231
|
+
# Using parameter file
|
|
232
|
+
muban generate TEMPLATE_ID --params-file params.json
|
|
233
|
+
|
|
234
|
+
# Using JSON data source
|
|
235
|
+
muban generate TEMPLATE_ID --data-file data.json
|
|
236
|
+
|
|
237
|
+
# PDF options
|
|
238
|
+
muban generate TEMPLATE_ID --pdf-pdfa PDF/A-1b --locale pl_PL
|
|
239
|
+
muban generate TEMPLATE_ID --pdf-password secret123
|
|
240
|
+
|
|
241
|
+
# Output options
|
|
242
|
+
muban generate TEMPLATE_ID -o ./output/report.pdf --filename "Sales_Report_Q4"
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Parameter File Format (params.json):**
|
|
246
|
+
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"title": "Monthly Sales Report",
|
|
250
|
+
"year": 2025,
|
|
251
|
+
"department": "Finance"
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Or as a list:
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
[
|
|
259
|
+
{"name": "title", "value": "Monthly Sales Report"},
|
|
260
|
+
{"name": "year", "value": 2025}
|
|
261
|
+
]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Data Source File Format (data.json):**
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"items": [
|
|
269
|
+
{"productName": "Widget A", "quantity": 100, "unitPrice": 25.50},
|
|
270
|
+
{"productName": "Widget B", "quantity": 50, "unitPrice": 45.00}
|
|
271
|
+
],
|
|
272
|
+
"summary": {
|
|
273
|
+
"totalItems": 150,
|
|
274
|
+
"totalValue": 4800.00
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Utility Commands
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# List available fonts
|
|
283
|
+
muban fonts
|
|
284
|
+
|
|
285
|
+
# List ICC color profiles (for PDF export)
|
|
286
|
+
muban icc-profiles
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Admin Commands
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
# Verify template integrity
|
|
293
|
+
muban admin verify-integrity TEMPLATE_ID
|
|
294
|
+
|
|
295
|
+
# Regenerate integrity digest
|
|
296
|
+
muban admin regenerate-digest TEMPLATE_ID
|
|
297
|
+
|
|
298
|
+
# Regenerate all digests
|
|
299
|
+
muban admin regenerate-all-digests --yes
|
|
300
|
+
|
|
301
|
+
# Get server configuration
|
|
302
|
+
muban admin server-config
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Audit Commands
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# View audit logs
|
|
309
|
+
muban audit logs
|
|
310
|
+
muban audit logs --severity HIGH --since 1d
|
|
311
|
+
muban audit logs --event-type LOGIN_FAILURE --format json
|
|
312
|
+
|
|
313
|
+
# Get audit statistics
|
|
314
|
+
muban audit statistics --since 7d
|
|
315
|
+
|
|
316
|
+
# View security events
|
|
317
|
+
muban audit security --since 24h
|
|
318
|
+
|
|
319
|
+
# Dashboard and monitoring
|
|
320
|
+
muban audit dashboard
|
|
321
|
+
muban audit threats
|
|
322
|
+
muban audit health
|
|
323
|
+
|
|
324
|
+
# List available event types
|
|
325
|
+
muban audit event-types
|
|
326
|
+
|
|
327
|
+
# Trigger cleanup
|
|
328
|
+
muban audit cleanup --yes
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Common Options
|
|
332
|
+
|
|
333
|
+
All commands support these options:
|
|
334
|
+
|
|
335
|
+
| Option | Short | Description |
|
|
336
|
+
|-------------|-------|-------------------------------|
|
|
337
|
+
| `--verbose` | `-v` | Enable verbose output |
|
|
338
|
+
| `--quiet` | `-q` | Suppress non-essential output |
|
|
339
|
+
| `--format` | `-f` | Output format (table, json) |
|
|
340
|
+
| `--help` | | Show help message |
|
|
341
|
+
|
|
342
|
+
## CI/CD Integration
|
|
343
|
+
|
|
344
|
+
### GitHub Actions Example
|
|
345
|
+
|
|
346
|
+
```yaml
|
|
347
|
+
name: Deploy Report Template
|
|
348
|
+
|
|
349
|
+
on:
|
|
350
|
+
push:
|
|
351
|
+
branches: [main]
|
|
352
|
+
paths:
|
|
353
|
+
- 'templates/**'
|
|
354
|
+
|
|
355
|
+
jobs:
|
|
356
|
+
deploy:
|
|
357
|
+
runs-on: ubuntu-latest
|
|
358
|
+
steps:
|
|
359
|
+
- uses: actions/checkout@v4
|
|
360
|
+
|
|
361
|
+
- name: Set up Python
|
|
362
|
+
uses: actions/setup-python@v5
|
|
363
|
+
with:
|
|
364
|
+
python-version: '3.9'
|
|
365
|
+
|
|
366
|
+
- name: Install Muban CLI
|
|
367
|
+
run: pip install muban-cli
|
|
368
|
+
|
|
369
|
+
- name: Deploy Template
|
|
370
|
+
env:
|
|
371
|
+
MUBAN_TOKEN: ${{ secrets.MUBAN_TOKEN }}
|
|
372
|
+
MUBAN_SERVER_URL: https://api.muban.me
|
|
373
|
+
run: |
|
|
374
|
+
cd templates
|
|
375
|
+
zip -r report.zip ./monthly_report/
|
|
376
|
+
muban push report.zip --name "Monthly Report" --author "CI/CD"
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### GitLab CI Example
|
|
380
|
+
|
|
381
|
+
```yaml
|
|
382
|
+
deploy_template:
|
|
383
|
+
image: python:3.9-slim
|
|
384
|
+
stage: deploy
|
|
385
|
+
only:
|
|
386
|
+
changes:
|
|
387
|
+
- templates/**
|
|
388
|
+
script:
|
|
389
|
+
- pip install muban-cli
|
|
390
|
+
- cd templates && zip -r report.zip ./monthly_report/
|
|
391
|
+
- muban push report.zip --name "Monthly Report" --author "GitLab CI"
|
|
392
|
+
variables:
|
|
393
|
+
MUBAN_TOKEN: $MUBAN_TOKEN
|
|
394
|
+
MUBAN_SERVER_URL: https://api.muban.me
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Shell Script Example
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
#!/bin/bash
|
|
401
|
+
# deploy-template.sh
|
|
402
|
+
|
|
403
|
+
set -e
|
|
404
|
+
|
|
405
|
+
TEMPLATE_DIR="./my_jasper_project"
|
|
406
|
+
TEMPLATE_NAME="Monthly Sales Report"
|
|
407
|
+
AUTHOR="Deploy Script"
|
|
408
|
+
|
|
409
|
+
# Create ZIP archive
|
|
410
|
+
zip -r template.zip "$TEMPLATE_DIR"
|
|
411
|
+
|
|
412
|
+
# Upload to Muban
|
|
413
|
+
muban push template.zip \
|
|
414
|
+
--name "$TEMPLATE_NAME" \
|
|
415
|
+
--author "$AUTHOR" \
|
|
416
|
+
--metadata "Deployed from commit ${GIT_COMMIT:-unknown}"
|
|
417
|
+
|
|
418
|
+
# Cleanup
|
|
419
|
+
rm template.zip
|
|
420
|
+
|
|
421
|
+
echo "Template deployed successfully!"
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Error Handling
|
|
425
|
+
|
|
426
|
+
The CLI provides detailed error messages and appropriate exit codes:
|
|
427
|
+
|
|
428
|
+
| Exit Code | Meaning |
|
|
429
|
+
| --------- | ------- |
|
|
430
|
+
| 0 | Success |
|
|
431
|
+
| 1 | General error |
|
|
432
|
+
| 130 | Interrupted (Ctrl+C) |
|
|
433
|
+
|
|
434
|
+
### Common Errors
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# Not configured
|
|
438
|
+
$ muban list
|
|
439
|
+
✗ Muban CLI is not configured.
|
|
440
|
+
Run 'muban configure' to set up your server, then 'muban login'.
|
|
441
|
+
|
|
442
|
+
# Not authenticated
|
|
443
|
+
$ muban list
|
|
444
|
+
✗ Not authenticated. Run 'muban login' to sign in.
|
|
445
|
+
|
|
446
|
+
# Template not found
|
|
447
|
+
$ muban get invalid-id
|
|
448
|
+
✗ Template not found: invalid-id
|
|
449
|
+
|
|
450
|
+
# Permission denied
|
|
451
|
+
$ muban delete some-template
|
|
452
|
+
✗ Permission denied. Manager role required.
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Development
|
|
456
|
+
|
|
457
|
+
### Running Tests
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
# Install dev dependencies
|
|
461
|
+
pip install -e ".[dev]"
|
|
462
|
+
|
|
463
|
+
# Run tests
|
|
464
|
+
pytest
|
|
465
|
+
|
|
466
|
+
# Run with coverage
|
|
467
|
+
pytest --cov=muban_cli --cov-report=html
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Code Quality
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# Format code
|
|
474
|
+
black muban_cli
|
|
475
|
+
isort muban_cli
|
|
476
|
+
|
|
477
|
+
# Type checking
|
|
478
|
+
mypy muban_cli
|
|
479
|
+
|
|
480
|
+
# Linting
|
|
481
|
+
flake8 muban_cli
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Project Structure
|
|
485
|
+
|
|
486
|
+
```text
|
|
487
|
+
muban-cli/
|
|
488
|
+
├── muban_cli/
|
|
489
|
+
│ ├── __init__.py # Package initialization
|
|
490
|
+
│ ├── cli.py # CLI commands (Click)
|
|
491
|
+
│ ├── api.py # REST API client
|
|
492
|
+
│ ├── config.py # Configuration management
|
|
493
|
+
│ ├── utils.py # Utility functions
|
|
494
|
+
│ ├── exceptions.py # Custom exceptions
|
|
495
|
+
│ └── py.typed # PEP 561 marker
|
|
496
|
+
├── tests/ # Test suite
|
|
497
|
+
├── pyproject.toml # Project configuration
|
|
498
|
+
└── README.md # Documentation
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
## License
|
|
502
|
+
|
|
503
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
504
|
+
|
|
505
|
+
## Support
|
|
506
|
+
|
|
507
|
+
- Email: <contact@muban.me>
|
|
508
|
+
- Documentation: <https://muban.me/features.html>
|
|
509
|
+
|
|
510
|
+
## Contributing
|
|
511
|
+
|
|
512
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
513
|
+
|
|
514
|
+
1. Fork the repository
|
|
515
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
516
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
517
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
518
|
+
5. Open a Pull Request
|