licos-dev-cli 0.1.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.
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
/target/
|
|
3
|
+
**/*.rs.bk
|
|
4
|
+
Cargo.lock
|
|
5
|
+
|
|
6
|
+
# Node
|
|
7
|
+
node_modules/
|
|
8
|
+
packages/*/dist/
|
|
9
|
+
|
|
10
|
+
# IDE
|
|
11
|
+
.idea/
|
|
12
|
+
.vscode/
|
|
13
|
+
*.swp
|
|
14
|
+
*.swo
|
|
15
|
+
|
|
16
|
+
# OS
|
|
17
|
+
.DS_Store
|
|
18
|
+
Thumbs.db
|
|
19
|
+
|
|
20
|
+
# Environment
|
|
21
|
+
.env
|
|
22
|
+
.env.local
|
|
23
|
+
|
|
24
|
+
# Workspace
|
|
25
|
+
/workspace/
|
|
26
|
+
|
|
27
|
+
# Test runtime data
|
|
28
|
+
/test/licos-data/
|
|
29
|
+
/test/screenshots/
|
|
30
|
+
/test/vue-app/
|
|
31
|
+
|
|
32
|
+
# Build
|
|
33
|
+
*.log
|
|
34
|
+
.licos
|
|
35
|
+
|
|
36
|
+
/tmp
|
|
37
|
+
|
|
38
|
+
/Docs/hermes-agent
|
|
39
|
+
/Docs/OpenCode
|
|
40
|
+
/Docs/平台API
|
|
41
|
+
|
|
42
|
+
*.codex-*
|
|
43
|
+
|
|
44
|
+
project-20260423_130440
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "licos-dev-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "LICOS Dev CLI — generate files from the command line"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"licos-dev-sdk>=0.1.0",
|
|
12
|
+
"click>=8.1",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
licos-dev = "licos_dev_cli.main:cli"
|
|
17
|
+
|
|
18
|
+
[tool.hatch.build.targets.wheel]
|
|
19
|
+
packages = ["src/licos_dev_cli"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""LICOS Dev CLI."""
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"""CLI entry point — wraps licos-dev-sdk functions as click commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import json
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
# ── Helpers ──────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
def _read_input(input_path: str | None, content: str | None) -> str:
|
|
12
|
+
"""Read content from --input file, --content arg, or stdin."""
|
|
13
|
+
if input_path:
|
|
14
|
+
with open(input_path, "r", encoding="utf-8") as f:
|
|
15
|
+
return f.read()
|
|
16
|
+
if content:
|
|
17
|
+
return content
|
|
18
|
+
if not sys.stdin.isatty():
|
|
19
|
+
return sys.stdin.read()
|
|
20
|
+
raise click.UsageError("Provide --input, --content, or pipe via stdin.")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _read_json(input_path: str | None, content: str | None) -> object:
|
|
24
|
+
"""Read and parse JSON from input."""
|
|
25
|
+
raw = _read_input(input_path, content)
|
|
26
|
+
return json.loads(raw)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# ── CLI Group ────────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
@click.group()
|
|
32
|
+
def cli():
|
|
33
|
+
"""LICOS Dev — file generation CLI for AI agents."""
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ── PDF ──────────────────────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
@cli.command()
|
|
40
|
+
@click.option("-i", "--input", "input_path", help="Input file (Markdown or HTML)")
|
|
41
|
+
@click.option("-c", "--content", help="Direct content")
|
|
42
|
+
@click.option("-f", "--filename", required=True, help="Output filename (no extension)")
|
|
43
|
+
@click.option("-o", "--output-dir", default=None, help="Output directory")
|
|
44
|
+
@click.option("--format", "content_type", default="markdown", help="Content type: markdown|html")
|
|
45
|
+
@click.option("--page-size", default="A4", help="Page size: A4|LETTER")
|
|
46
|
+
def pdf(input_path, content, filename, output_dir, content_type, page_size):
|
|
47
|
+
"""Generate PDF from Markdown or HTML."""
|
|
48
|
+
from licos_dev_sdk import create_pdf
|
|
49
|
+
text = _read_input(input_path, content)
|
|
50
|
+
path = create_pdf(text, filename, content_type=content_type, output_dir=output_dir, page_size=page_size)
|
|
51
|
+
click.echo(path)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# ── DOCX ─────────────────────────────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
@cli.command()
|
|
57
|
+
@click.option("-i", "--input", "input_path")
|
|
58
|
+
@click.option("-c", "--content")
|
|
59
|
+
@click.option("-f", "--filename", required=True)
|
|
60
|
+
@click.option("-o", "--output-dir", default=None)
|
|
61
|
+
@click.option("--format", "content_type", default="markdown")
|
|
62
|
+
@click.option("--font", default="Arial")
|
|
63
|
+
@click.option("--font-size", default=11, type=int)
|
|
64
|
+
def docx(input_path, content, filename, output_dir, content_type, font, font_size):
|
|
65
|
+
"""Generate DOCX from Markdown or HTML."""
|
|
66
|
+
from licos_dev_sdk import create_docx
|
|
67
|
+
text = _read_input(input_path, content)
|
|
68
|
+
path = create_docx(text, filename, content_type=content_type, output_dir=output_dir, font_name=font, font_size=font_size)
|
|
69
|
+
click.echo(path)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# ── XLSX ─────────────────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
@cli.command()
|
|
75
|
+
@click.option("-i", "--input", "input_path")
|
|
76
|
+
@click.option("-c", "--content", help="JSON data")
|
|
77
|
+
@click.option("-f", "--filename", required=True)
|
|
78
|
+
@click.option("-o", "--output-dir", default=None)
|
|
79
|
+
@click.option("--sheet-name", default="Sheet1")
|
|
80
|
+
@click.option("--header-color", default="4472C4")
|
|
81
|
+
def xlsx(input_path, content, filename, output_dir, sheet_name, header_color):
|
|
82
|
+
"""Generate XLSX from JSON data."""
|
|
83
|
+
from licos_dev_sdk import create_xlsx
|
|
84
|
+
data = _read_json(input_path, content)
|
|
85
|
+
path = create_xlsx(data, filename, output_dir=output_dir, sheet_name=sheet_name, header_color=header_color)
|
|
86
|
+
click.echo(path)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# ── CSV ──────────────────────────────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
@cli.command()
|
|
92
|
+
@click.option("-i", "--input", "input_path")
|
|
93
|
+
@click.option("-c", "--content", help="JSON data")
|
|
94
|
+
@click.option("-f", "--filename", required=True)
|
|
95
|
+
@click.option("-o", "--output-dir", default=None)
|
|
96
|
+
def csv(input_path, content, filename, output_dir):
|
|
97
|
+
"""Generate CSV from JSON data."""
|
|
98
|
+
from licos_dev_sdk import create_csv
|
|
99
|
+
data = _read_json(input_path, content)
|
|
100
|
+
path = create_csv(data, filename, output_dir=output_dir)
|
|
101
|
+
click.echo(path)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# ── PPTX ─────────────────────────────────────────────────────────────────────
|
|
105
|
+
|
|
106
|
+
@cli.command()
|
|
107
|
+
@click.option("-i", "--input", "input_path")
|
|
108
|
+
@click.option("-c", "--content")
|
|
109
|
+
@click.option("-f", "--filename", required=True)
|
|
110
|
+
@click.option("-o", "--output-dir", default=None)
|
|
111
|
+
@click.option("--format", "content_type", default="markdown")
|
|
112
|
+
def pptx(input_path, content, filename, output_dir, content_type):
|
|
113
|
+
"""Generate PPTX from Markdown."""
|
|
114
|
+
from licos_dev_sdk import create_pptx
|
|
115
|
+
text = _read_input(input_path, content)
|
|
116
|
+
path = create_pptx(text, filename, content_type=content_type, output_dir=output_dir)
|
|
117
|
+
click.echo(path)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# ── Chart ────────────────────────────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
@cli.command()
|
|
123
|
+
@click.option("-i", "--input", "input_path")
|
|
124
|
+
@click.option("-c", "--content", help="JSON chart data")
|
|
125
|
+
@click.option("-f", "--filename", required=True)
|
|
126
|
+
@click.option("-o", "--output-dir", default=None)
|
|
127
|
+
@click.option("--type", "chart_type", required=True, help="bar|line|pie|scatter|heatmap")
|
|
128
|
+
@click.option("--format", "fmt", default="png", help="png|svg")
|
|
129
|
+
@click.option("--title", default="")
|
|
130
|
+
@click.option("--width", default=800, type=int)
|
|
131
|
+
@click.option("--height", default=600, type=int)
|
|
132
|
+
def chart(input_path, content, filename, output_dir, chart_type, fmt, title, width, height):
|
|
133
|
+
"""Generate chart image from JSON data."""
|
|
134
|
+
from licos_dev_sdk import create_chart
|
|
135
|
+
data = _read_json(input_path, content)
|
|
136
|
+
path = create_chart(chart_type, data, filename, output_dir=output_dir, format=fmt, title=title, width=width, height=height)
|
|
137
|
+
click.echo(path)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# ── Diagram ──────────────────────────────────────────────────────────────────
|
|
141
|
+
|
|
142
|
+
@cli.command()
|
|
143
|
+
@click.option("-i", "--input", "input_path")
|
|
144
|
+
@click.option("-c", "--content", help="DOT source")
|
|
145
|
+
@click.option("-f", "--filename", required=True)
|
|
146
|
+
@click.option("-o", "--output-dir", default=None)
|
|
147
|
+
@click.option("--format", "fmt", default="png", help="png|svg|pdf")
|
|
148
|
+
def diagram(input_path, content, filename, output_dir, fmt):
|
|
149
|
+
"""Generate diagram from Graphviz DOT source."""
|
|
150
|
+
from licos_dev_sdk import create_diagram
|
|
151
|
+
text = _read_input(input_path, content)
|
|
152
|
+
path = create_diagram(text, filename, output_dir=output_dir, format=fmt)
|
|
153
|
+
click.echo(path)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# ── QR Code ──────────────────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
@cli.command()
|
|
159
|
+
@click.option("-d", "--data", required=True, help="Data to encode")
|
|
160
|
+
@click.option("-f", "--filename", required=True)
|
|
161
|
+
@click.option("-o", "--output-dir", default=None)
|
|
162
|
+
@click.option("--size", default=300, type=int)
|
|
163
|
+
def qrcode(data, filename, output_dir, size):
|
|
164
|
+
"""Generate QR code PNG image."""
|
|
165
|
+
from licos_dev_sdk import create_qrcode
|
|
166
|
+
path = create_qrcode(data, filename, output_dir=output_dir, size=size)
|
|
167
|
+
click.echo(path)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
# ── Barcode ──────────────────────────────────────────────────────────────────
|
|
171
|
+
|
|
172
|
+
@cli.command()
|
|
173
|
+
@click.option("-d", "--data", required=True, help="Data to encode")
|
|
174
|
+
@click.option("-f", "--filename", required=True)
|
|
175
|
+
@click.option("-o", "--output-dir", default=None)
|
|
176
|
+
@click.option("--type", "barcode_type", default="code128", help="code128|ean13|ean8|isbn13|upc")
|
|
177
|
+
def barcode(data, filename, output_dir, barcode_type):
|
|
178
|
+
"""Generate barcode PNG image."""
|
|
179
|
+
from licos_dev_sdk import create_barcode
|
|
180
|
+
path = create_barcode(data, filename, output_dir=output_dir, barcode_type=barcode_type)
|
|
181
|
+
click.echo(path)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# ── ZIP ──────────────────────────────────────────────────────────────────────
|
|
185
|
+
|
|
186
|
+
@cli.command("zip")
|
|
187
|
+
@click.option("-p", "--paths", required=True, help="Comma-separated file/dir paths")
|
|
188
|
+
@click.option("-f", "--filename", required=True)
|
|
189
|
+
@click.option("-o", "--output-dir", default=None)
|
|
190
|
+
def zip_cmd(paths, filename, output_dir):
|
|
191
|
+
"""Create ZIP archive."""
|
|
192
|
+
from licos_dev_sdk import create_zip
|
|
193
|
+
source_paths = [p.strip() for p in paths.split(",")]
|
|
194
|
+
path = create_zip(source_paths, filename, output_dir=output_dir)
|
|
195
|
+
click.echo(path)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# ── TAR.GZ ───────────────────────────────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
@cli.command("tar")
|
|
201
|
+
@click.option("-p", "--paths", required=True, help="Comma-separated file/dir paths")
|
|
202
|
+
@click.option("-f", "--filename", required=True)
|
|
203
|
+
@click.option("-o", "--output-dir", default=None)
|
|
204
|
+
def tar_cmd(paths, filename, output_dir):
|
|
205
|
+
"""Create TAR.GZ archive."""
|
|
206
|
+
from licos_dev_sdk import create_tar_gz
|
|
207
|
+
source_paths = [p.strip() for p in paths.split(",")]
|
|
208
|
+
path = create_tar_gz(source_paths, filename, output_dir=output_dir)
|
|
209
|
+
click.echo(path)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# ── JSON ─────────────────────────────────────────────────────────────────────
|
|
213
|
+
|
|
214
|
+
@cli.command("json")
|
|
215
|
+
@click.option("-i", "--input", "input_path")
|
|
216
|
+
@click.option("-c", "--content", help="JSON or YAML content")
|
|
217
|
+
@click.option("-f", "--filename", required=True)
|
|
218
|
+
@click.option("-o", "--output-dir", default=None)
|
|
219
|
+
def json_cmd(input_path, content, filename, output_dir):
|
|
220
|
+
"""Generate JSON file (accepts JSON or YAML input)."""
|
|
221
|
+
from licos_dev_sdk import create_json
|
|
222
|
+
raw = _read_input(input_path, content)
|
|
223
|
+
try:
|
|
224
|
+
data = json.loads(raw)
|
|
225
|
+
except json.JSONDecodeError:
|
|
226
|
+
import yaml
|
|
227
|
+
data = yaml.safe_load(raw)
|
|
228
|
+
path = create_json(data, filename, output_dir=output_dir)
|
|
229
|
+
click.echo(path)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# ── YAML ─────────────────────────────────────────────────────────────────────
|
|
233
|
+
|
|
234
|
+
@cli.command("yaml")
|
|
235
|
+
@click.option("-i", "--input", "input_path")
|
|
236
|
+
@click.option("-c", "--content", help="JSON or YAML content")
|
|
237
|
+
@click.option("-f", "--filename", required=True)
|
|
238
|
+
@click.option("-o", "--output-dir", default=None)
|
|
239
|
+
def yaml_cmd(input_path, content, filename, output_dir):
|
|
240
|
+
"""Generate YAML file (accepts JSON or YAML input)."""
|
|
241
|
+
from licos_dev_sdk import create_yaml
|
|
242
|
+
import yaml as yaml_lib
|
|
243
|
+
raw = _read_input(input_path, content)
|
|
244
|
+
try:
|
|
245
|
+
data = json.loads(raw)
|
|
246
|
+
except json.JSONDecodeError:
|
|
247
|
+
data = yaml_lib.safe_load(raw)
|
|
248
|
+
path = create_yaml(data, filename, output_dir=output_dir)
|
|
249
|
+
click.echo(path)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
# ── XML ──────────────────────────────────────────────────────────────────────
|
|
253
|
+
|
|
254
|
+
@cli.command("xml")
|
|
255
|
+
@click.option("-i", "--input", "input_path")
|
|
256
|
+
@click.option("-c", "--content", help="JSON content")
|
|
257
|
+
@click.option("-f", "--filename", required=True)
|
|
258
|
+
@click.option("-o", "--output-dir", default=None)
|
|
259
|
+
@click.option("--root-tag", default="root")
|
|
260
|
+
def xml_cmd(input_path, content, filename, output_dir, root_tag):
|
|
261
|
+
"""Generate XML file from JSON data."""
|
|
262
|
+
from licos_dev_sdk import create_xml
|
|
263
|
+
data = _read_json(input_path, content)
|
|
264
|
+
path = create_xml(data, filename, output_dir=output_dir, root_tag=root_tag)
|
|
265
|
+
click.echo(path)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
# ── HTML ─────────────────────────────────────────────────────────────────────
|
|
269
|
+
|
|
270
|
+
@cli.command("html")
|
|
271
|
+
@click.option("-i", "--input", "input_path")
|
|
272
|
+
@click.option("-c", "--content")
|
|
273
|
+
@click.option("-f", "--filename", required=True)
|
|
274
|
+
@click.option("-o", "--output-dir", default=None)
|
|
275
|
+
@click.option("--format", "content_type", default="markdown", help="markdown|html")
|
|
276
|
+
def html_cmd(input_path, content, filename, output_dir, content_type):
|
|
277
|
+
"""Generate HTML file from Markdown or raw HTML."""
|
|
278
|
+
from licos_dev_sdk import create_html
|
|
279
|
+
text = _read_input(input_path, content)
|
|
280
|
+
path = create_html(text, filename, output_dir=output_dir, content_type=content_type)
|
|
281
|
+
click.echo(path)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
if __name__ == "__main__":
|
|
285
|
+
cli()
|