Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/docgen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,19 @@ def playwright(
help="Path to *.docgen.yaml sidecar OR <path>.py::<test_name> for @pytest.mark.docgen.",
)
@click.option(
"--output-dir",
"--output",
"output_dir_arg",
required=True,
default=None,
type=click.Path(file_okay=False),
help="Directory to write rendered.mp4, poster.png, fragment.txt, manifest.json, cache-status.txt.",
help="Output directory for rendered.mp4, poster.png, fragment.txt, manifest.json.",
)
@click.option(
"--output-dir",
"output_dir_legacy",
default=None,
type=click.Path(file_okay=False),
hidden=True,
help="Deprecated alias for --output.",
)
@click.option(
"--cache-dir",
Expand All @@ -201,16 +209,21 @@ def playwright(
def demo_function(
ctx: click.Context,
manifest_arg: str,
output_dir_arg: str,
output_dir_arg: str | None,
output_dir_legacy: str | None,
cache_dir_arg: str | None,
no_narration: bool,
) -> None:
"""Render a single per-function demo video from a declarative manifest."""
from docgen.demo_function import run_cli

out = output_dir_arg or output_dir_legacy
if not out:
raise click.UsageError("Missing required option '--output' (directory for rendered artifacts).")

code = run_cli(
manifest_arg=manifest_arg,
output_dir_arg=output_dir_arg,
output_dir_arg=out,
cache_dir_arg=cache_dir_arg,
no_narration=no_narration,
)
Expand Down
10 changes: 10 additions & 0 deletions src/docgen/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,13 @@ def discover(cls, start: str | Path | None = None) -> "Config":
raise FileNotFoundError(
f"Could not find {_YAML_FILENAME} in any parent of {start or os.getcwd()}"
)

@classmethod
def minimal(cls, base_dir: str | Path | None = None) -> "Config":
"""Minimal config when no ``docgen.yaml`` exists (standalone tools).

Relative tape paths and Playwright discovery resolve under ``base_dir``
(defaults to the current working directory).
"""
base = Path(base_dir or os.getcwd()).resolve()
return cls(yaml_path=base / _YAML_FILENAME, base_dir=base, raw={})
Loading