|
Option C Tools
|
Functions | |
| str | _strip_docstring_section (str docstring, str section_name) |
| str | _format_decorators (ast.AST node, str indent="") |
| str | _format_function (ast.FunctionDef|ast.AsyncFunctionDef node, str indent="") |
| str | _format_class (ast.ClassDef node, str indent="", *, bool no_diagnostics=False) |
| str | extract_skeleton (str text, str filepath, *, bool no_diagnostics=False) |
| str | _skeleton_for_non_python (Path filepath) |
| tuple | write_skeleton_file_for_dir (Path folder, Path output_path, Path root, dict cfg, *, bool no_diagnostics=False) |
| None | clean_skeleton_dirs (Path root, bool dry_run=False) |
| None | run_skeleton_exporter (Path root, list[str] args, bool json_mode=False) |
Variables | |
| tuple | _HEADER_TEXT |
| str | _SEPARATOR_FILE = "##### File name {num:02d}: {path}\n" |
| str | _SEPARATOR_SUBDIR = "####### Subdirectory name {num:02d}: {dirname}\n" |
| str | _ROOT_HEADER = "####### Root directory: .\n\n" |
Purpose
-------
Export structural skeletons of source files for AI inspection, code review,
or project overview. Emits headers, module docstrings, and function/class
signatures without implementation bodies.
Responsibilities
----------------
- Extract Python file skeletons via AST: headers, docstrings, signatures.
- Produce one-line placeholders for non-Python files.
- Reuse the source exporter's config, exclusion, and output infrastructure.
- Support ``--no-diagnostics`` to omit Diagnostics docstring sections.
Diagnostics
-----------
Domain: OCT-SKELETON
Levels:
L2 — lifecycle
L3 — semantic details
L4 — deep tracing
Contracts
---------
- All public helpers from ``source_exporter`` are reused, not duplicated.
- Skeleton output never contains implementation bodies.
- Non-Python files produce a single-line size summary.
|
protected |
Reconstruct a class definition with methods and nested classes.
Definition at line 140 of file skeleton_exporter.py.
|
protected |
Reconstruct decorator lines from an AST node's decorator_list.
Definition at line 105 of file skeleton_exporter.py.
|
protected |
Reconstruct a function/method signature with decorators and docstring.
Definition at line 113 of file skeleton_exporter.py.
|
protected |
Return a one-line placeholder for a non-Python file.
Definition at line 258 of file skeleton_exporter.py.
|
protected |
Remove a named RST-style section from a docstring.
Sections are identified by the pattern::
SectionName
-----------
(content until next section header or end of docstring)
Definition at line 76 of file skeleton_exporter.py.
| None skeleton_exporter.clean_skeleton_dirs | ( | Path | root, |
| bool | dry_run = False ) |
Remove all _skeleton_code-* directories under root.
Definition at line 325 of file skeleton_exporter.py.
| str skeleton_exporter.extract_skeleton | ( | str | text, |
| str | filepath, | ||
| * | , | ||
| bool | no_diagnostics = False ) |
Extract structural skeleton from a Python file's source text. Returns a string containing headers, module docstring, and class/function signatures — no implementation bodies.
Definition at line 201 of file skeleton_exporter.py.
| None skeleton_exporter.run_skeleton_exporter | ( | Path | root, |
| list[str] | args, | ||
| bool | json_mode = False ) |
Execute the skeleton exporter with the given root directory and arguments.
When *json_mode* is True, emits a machine-readable JSON summary to stdout
instead of the plain-text summary:
``{"tool": "export-skeleton", "directories_processed": N,
"files_exported": N, "output_dirs": [...], "exit_code": 0}``
Definition at line 348 of file skeleton_exporter.py.
| tuple skeleton_exporter.write_skeleton_file_for_dir | ( | Path | folder, |
| Path | output_path, | ||
| Path | root, | ||
| dict | cfg, | ||
| * | , | ||
| bool | no_diagnostics = False ) |
Write a skeleton export file for all source files in a directory.
Definition at line 269 of file skeleton_exporter.py.
|
protected |
Definition at line 61 of file skeleton_exporter.py.
|
protected |
Definition at line 69 of file skeleton_exporter.py.
|
protected |
Definition at line 67 of file skeleton_exporter.py.
|
protected |
Definition at line 68 of file skeleton_exporter.py.