Skip to content
predraw.cli
Edit
On this page

CLI entry point for predraw — strictcli-based with build/pack/unpack subcommands.

#predraw.cli

#predraw.cli

CLI entry point for predraw — strictcli-based with build/pack/unpack subcommands.

#main

python
def main()

Entry point for the predraw CLI.

#_cmd_build

python
def _cmd_build(ctx, path: str | None=None) -> None

Build all outputs for a scene, grouped by mode to avoid redundant work.

#_build

python
def _build(path: str, *, dry_run: bool) -> int

The build itself, callable without a strictcli Context.

Split out of the handler because watch rebuilds by calling it directly and because --dry-run is now framework-owned: the flag arrives on the Context (ctx.dry_run), never as a handler kwarg, so the one parameter that actually varies has to be passed explicitly here.

#_cmd_pack

python
def _cmd_pack(ctx, path: str | None=None, *, output: str | None=None) -> None

Pack a scene directory into a single self-contained JSON file.

#_cmd_unpack

python
def _cmd_unpack(ctx, file: str, *, output: str | None=None) -> None

Unpack a packed JSON file into a project directory.

#_cmd_init

python
def _cmd_init(ctx, path: str | None=None) -> None

Create a starter predraw project in the given directory.

#_collect_json_files

python
def _collect_json_files(project_dir: Path) -> list[Path]

Collect all .json files in the project directory, excluding *.local-only dirs.

#_get_mtimes

python
def _get_mtimes(files: list[Path]) -> dict[Path, float]

Get mtime for each file, skipping files that disappeared.

#_detect_changes

python
def _detect_changes(prev_mtimes: dict[Path, float], curr_mtimes: dict[Path, float]) -> bool

Return True if any files were added, removed, or modified.

#_cmd_watch

python
def _cmd_watch(ctx, path: str | None=None) -> None

Watch project files and rebuild on change.

#_cmd_validate

python
def _cmd_validate(ctx, file: str, *, schema: str | None=None) -> None

Validate a JSON file against its scene or config schema.

#pack_scene

python
def pack_scene(scene: Scene) -> dict

Convert a Scene to a packed JSON-serializable dict.

Removes imports (already resolved into defs) and assigns IDs to elements that lack them for referenceability.

#_assign_ids

python
def _assign_ids(elements: list[dict], counter: list[int] | None=None) -> None

Recursively assign auto-generated IDs to elements missing one.

#unpack_scene

python
def unpack_scene(scene: Scene, output_dir: str) -> None

Unpack a scene into a directory structure with components/ and main.json.

#_scene_to_dict

python
def _scene_to_dict(scene: Scene) -> dict

Convert a Scene back to a JSON-serializable dict.

#_element_to_dict

python
def _element_to_dict(el: Element) -> dict

Convert an Element back to a JSON-serializable dict.

Omits default/None values to keep output clean.

#_gradient_to_dict

python
def _gradient_to_dict(grad: Gradient) -> dict

Convert a Gradient to a JSON-serializable dict, omitting defaults.

#_char_style_to_dict

python
def _char_style_to_dict(cs) -> dict

Convert a CharStyle to a dict, omitting defaults.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search