scrolly 0.2.4__tar.gz → 0.2.5__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.
- {scrolly-0.2.4 → scrolly-0.2.5}/PKG-INFO +1 -1
- {scrolly-0.2.4 → scrolly-0.2.5}/pyproject.toml +1 -1
- scrolly-0.2.5/scrolly/_cli/_ai_help.py +124 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_cli.py +18 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_schema.py +24 -7
- {scrolly-0.2.4 → scrolly-0.2.5}/.gitignore +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/LICENSE +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/README.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_errors.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_assets.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_common.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_dom.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_elements.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_slides.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_snaps.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_snapshot.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/_cli/_introspect/_timeline.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/inference.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/introspect.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/model.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/parser.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/schema.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/deck/validator.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/_catalog.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/_codes.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/_report.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/_validation_error.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E001.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E002.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E003.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E004.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E005.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E006.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E007.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E008.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E009.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E010.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E011.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E012.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E101.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E102.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E103.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E201.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E202.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E203.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E204.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E205.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E206.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E207.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E299.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E301.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E302.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E303.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E304.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E305.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E306.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E307.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E308.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E401.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E402.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E403.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E501.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E502.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E503.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E504.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E505.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E601.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E602.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E603.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E701.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/E702.md +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/errors/catalog/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/_bundler.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/assets.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/introspect.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/lint.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/loader.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/orchestrator.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/pipeline/writer.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/assembler.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/assets/canvas.css +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/assets/canvas.js +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/assets/mermaid-LICENSE +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/assets/mermaid.min.js +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/bundled_assets.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/color.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/fan.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/nav_data.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/templates/index.html.j2 +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/render/zoom_control.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/ir.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/processor.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/registry.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/rendered.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/_shared.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/html.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/iframe.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/image.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/image_sequence.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/markdown.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/element_ir/renderers/mermaid.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/html.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/introspect.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/ir/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/ir/_framework/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/ir/_framework/animated_values.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/ir/_framework/element.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/ir/_framework/utils.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/ir/slide.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/processor.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/registry.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/renderers/__init__.py +0 -0
- {scrolly-0.2.4 → scrolly-0.2.5}/scrolly/slide/renderers/slide.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scrolly
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: CLI that compiles a JSON5 deck + slide files into a self-contained 2D-canvas HTML presentation.
|
|
5
5
|
Project-URL: Homepage, https://scrolly.readthedocs.io/en/stable/
|
|
6
6
|
Project-URL: Documentation, https://scrolly.readthedocs.io/en/stable/
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Builds the ``scrolly --help-for-ai-tools`` document.
|
|
2
|
+
|
|
3
|
+
One markdown document covering the entire CLI surface in a single read —
|
|
4
|
+
the command tree, every source-file and element schema, and every error
|
|
5
|
+
code — so an LLM agent gets the whole picture without round-tripping
|
|
6
|
+
through ``scrolly schema`` / ``scrolly errors`` per type and code. It is
|
|
7
|
+
a pure aggregator: every section is the output the individual commands
|
|
8
|
+
already produce, merged under markdown headers, never re-rendered.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from collections.abc import Iterator
|
|
14
|
+
|
|
15
|
+
import click
|
|
16
|
+
|
|
17
|
+
from scrolly._cli._schema import element_schema_json, file_schema_json, file_type_names
|
|
18
|
+
from scrolly.errors import registered_codes
|
|
19
|
+
from scrolly.errors._catalog import load_body
|
|
20
|
+
from scrolly.slide import element_source_types
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# ==================================================================================================
|
|
24
|
+
# Document assembly
|
|
25
|
+
# ==================================================================================================
|
|
26
|
+
def build_ai_help(root_command: click.Command, version: str) -> str:
|
|
27
|
+
"""Render the whole CLI reference as one self-contained markdown document.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
root_command: The top-level ``scrolly`` Click group, walked for the command tree.
|
|
31
|
+
version: The scrolly version string, shown in the document header.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
A single markdown document: header, command tree, file schemas,
|
|
35
|
+
element schemas, and error codes — heading levels nested so the
|
|
36
|
+
whole document forms one consistent hierarchy.
|
|
37
|
+
"""
|
|
38
|
+
sections = [
|
|
39
|
+
_header(version),
|
|
40
|
+
_commands_section(root_command),
|
|
41
|
+
_file_schemas_section(),
|
|
42
|
+
_element_schemas_section(),
|
|
43
|
+
_error_codes_section(),
|
|
44
|
+
]
|
|
45
|
+
return "\n\n".join(sections) + "\n"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _header(version: str) -> str:
|
|
49
|
+
"""Render the document title and one-paragraph orientation."""
|
|
50
|
+
return (
|
|
51
|
+
f"# scrolly {version} — CLI reference for AI tools\n\n"
|
|
52
|
+
"The complete scrolly command-line surface in one document: every command, "
|
|
53
|
+
"every source-file and element schema, and every error code. Generated from "
|
|
54
|
+
"the installed scrolly, so it matches this version exactly."
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# ==================================================================================================
|
|
59
|
+
# Sections
|
|
60
|
+
# ==================================================================================================
|
|
61
|
+
def _commands_section(root_command: click.Command) -> str:
|
|
62
|
+
"""Render every command's help text, walking the full command tree."""
|
|
63
|
+
blocks = ["## Commands"]
|
|
64
|
+
for path, help_text in _walk_commands(root_command, "scrolly", None):
|
|
65
|
+
blocks.append(f"### `{path}`\n\n```\n{help_text.rstrip()}\n```")
|
|
66
|
+
return "\n\n".join(blocks)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _file_schemas_section() -> str:
|
|
70
|
+
"""Render the JSON Schema for every source-file type (deck, slide)."""
|
|
71
|
+
blocks = ["## File schemas"]
|
|
72
|
+
for name in file_type_names():
|
|
73
|
+
blocks.append(f"### `{name}`\n\n```json\n{file_schema_json(name)}\n```")
|
|
74
|
+
return "\n\n".join(blocks)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _element_schemas_section() -> str:
|
|
78
|
+
"""Render the JSON Schema for every slide-element type."""
|
|
79
|
+
blocks = ["## Element schemas"]
|
|
80
|
+
for key in element_source_types():
|
|
81
|
+
blocks.append(f"### `{key}`\n\n```json\n{element_schema_json(key)}\n```")
|
|
82
|
+
return "\n\n".join(blocks)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _error_codes_section() -> str:
|
|
86
|
+
"""Render the catalog entry for every registered error code.
|
|
87
|
+
|
|
88
|
+
Each catalog body is verbatim markdown starting at its own ``# E…``
|
|
89
|
+
heading; demoting by two levels nests every entry under this section.
|
|
90
|
+
"""
|
|
91
|
+
blocks = ["## Error codes"]
|
|
92
|
+
for code in sorted(registered_codes()):
|
|
93
|
+
blocks.append(_demote_headings(load_body(code).rstrip(), 2))
|
|
94
|
+
return "\n\n".join(blocks)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# ==================================================================================================
|
|
98
|
+
# Helpers
|
|
99
|
+
# ==================================================================================================
|
|
100
|
+
def _walk_commands(
|
|
101
|
+
command: click.Command, info_name: str, parent_ctx: click.Context | None
|
|
102
|
+
) -> Iterator[tuple[str, str]]:
|
|
103
|
+
"""Yield ``(command_path, help_text)`` for a command and all its subcommands, depth-first."""
|
|
104
|
+
ctx = click.Context(command, info_name=info_name, parent=parent_ctx)
|
|
105
|
+
yield ctx.command_path, command.get_help(ctx)
|
|
106
|
+
if isinstance(command, click.Group):
|
|
107
|
+
for name in command.list_commands(ctx):
|
|
108
|
+
sub = command.get_command(ctx, name)
|
|
109
|
+
if sub is None or sub.hidden:
|
|
110
|
+
continue
|
|
111
|
+
yield from _walk_commands(sub, name, ctx)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _demote_headings(markdown: str, levels: int) -> str:
|
|
115
|
+
"""Deepen every ATX heading by ``levels`` ``#``, leaving fenced code blocks untouched."""
|
|
116
|
+
out = []
|
|
117
|
+
in_fence = False
|
|
118
|
+
for line in markdown.splitlines():
|
|
119
|
+
if line.lstrip().startswith("```"):
|
|
120
|
+
in_fence = not in_fence
|
|
121
|
+
if not in_fence and line.startswith("#"):
|
|
122
|
+
line = "#" * levels + line
|
|
123
|
+
out.append(line)
|
|
124
|
+
return "\n".join(out)
|
|
@@ -16,8 +16,26 @@ from scrolly.pipeline.lint import lint_deck
|
|
|
16
16
|
_err_console = Console(stderr=True, highlight=False)
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
def _emit_ai_help(ctx: click.Context, param: click.Parameter, value: bool) -> None:
|
|
20
|
+
"""Eager ``--help-for-ai-tools`` callback: print the full CLI reference and exit."""
|
|
21
|
+
if not value or ctx.resilient_parsing:
|
|
22
|
+
return
|
|
23
|
+
from scrolly._cli._ai_help import build_ai_help
|
|
24
|
+
|
|
25
|
+
click.echo(build_ai_help(ctx.find_root().command, __version__))
|
|
26
|
+
ctx.exit()
|
|
27
|
+
|
|
28
|
+
|
|
19
29
|
@click.group()
|
|
20
30
|
@click.version_option(__version__, prog_name="scrolly")
|
|
31
|
+
@click.option(
|
|
32
|
+
"--help-for-ai-tools",
|
|
33
|
+
is_flag=True,
|
|
34
|
+
is_eager=True,
|
|
35
|
+
expose_value=False,
|
|
36
|
+
callback=_emit_ai_help,
|
|
37
|
+
help="Print the entire CLI reference (commands, schemas, error codes) as one markdown document for AI agents.",
|
|
38
|
+
)
|
|
21
39
|
def cli() -> None:
|
|
22
40
|
"""scrolly — compile a JSON5 deck into a self-contained 2D-canvas HTML presentation."""
|
|
23
41
|
|
|
@@ -72,7 +72,7 @@ def schema_file(type_name: str | None, list_types: bool) -> None:
|
|
|
72
72
|
scrolly schema file <type> → JSON Schema for <type>
|
|
73
73
|
scrolly schema file --list-types → bare type names, one per line (agent / scripting)
|
|
74
74
|
"""
|
|
75
|
-
names =
|
|
75
|
+
names = file_type_names()
|
|
76
76
|
|
|
77
77
|
if list_types:
|
|
78
78
|
for name in names:
|
|
@@ -83,11 +83,11 @@ def schema_file(type_name: str | None, list_types: bool) -> None:
|
|
|
83
83
|
_print_file_index()
|
|
84
84
|
return
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
if
|
|
86
|
+
schema_text = file_schema_json(type_name)
|
|
87
|
+
if schema_text is None:
|
|
88
88
|
_err_console.print(f"[red]error:[/red] unknown file type '{type_name}' (known: {', '.join(names)})")
|
|
89
89
|
sys.exit(1)
|
|
90
|
-
click.echo(
|
|
90
|
+
click.echo(schema_text)
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
@schema.command(name="element")
|
|
@@ -119,16 +119,17 @@ def schema_element(type_name: str | None, list_types: bool) -> None:
|
|
|
119
119
|
_print_element_index()
|
|
120
120
|
return
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
schema_text = element_schema_json(type_name)
|
|
123
|
+
if schema_text is None:
|
|
123
124
|
_err_console.print(f"[red]error:[/red] unknown element type '{type_name}' (known: {', '.join(elements)})")
|
|
124
125
|
sys.exit(1)
|
|
125
|
-
click.echo(
|
|
126
|
+
click.echo(schema_text)
|
|
126
127
|
|
|
127
128
|
|
|
128
129
|
# --------------------------------------------------------------------------
|
|
129
130
|
# Schema lookup + index rendering
|
|
130
131
|
# --------------------------------------------------------------------------
|
|
131
|
-
def
|
|
132
|
+
def file_type_names() -> list[str]:
|
|
132
133
|
"""Return the sorted source-file type names (deck + registered slide types)."""
|
|
133
134
|
from scrolly.slide import registered_ir_types
|
|
134
135
|
|
|
@@ -148,6 +149,22 @@ def _file_schema(type_name: str) -> dict | None:
|
|
|
148
149
|
return None
|
|
149
150
|
|
|
150
151
|
|
|
152
|
+
def file_schema_json(type_name: str) -> str | None:
|
|
153
|
+
"""Render a source-file type's JSON Schema as indented JSON text, or ``None`` if unknown."""
|
|
154
|
+
schema_dict = _file_schema(type_name)
|
|
155
|
+
return None if schema_dict is None else json.dumps(schema_dict, indent=2)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def element_schema_json(type_name: str) -> str | None:
|
|
159
|
+
"""Render an element type's JSON Schema as indented JSON text, or ``None`` if unknown."""
|
|
160
|
+
from scrolly.slide import element_source_types
|
|
161
|
+
|
|
162
|
+
elements = element_source_types()
|
|
163
|
+
if type_name not in elements:
|
|
164
|
+
return None
|
|
165
|
+
return json.dumps(elements[type_name].source_schema(), indent=2)
|
|
166
|
+
|
|
167
|
+
|
|
151
168
|
def _print_file_index() -> None:
|
|
152
169
|
"""Print the human-readable index of source-file schemas."""
|
|
153
170
|
from scrolly.slide import registered_ir_types
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|