Option C Tools
Loading...
Searching...
No Matches
skeleton_exporter Namespace Reference

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"

Detailed Description

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.

Function Documentation

◆ _format_class()

str skeleton_exporter._format_class ( ast.ClassDef node,
str indent = "",
* ,
bool no_diagnostics = False )
protected
Reconstruct a class definition with methods and nested classes.

Definition at line 140 of file skeleton_exporter.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _format_decorators()

str skeleton_exporter._format_decorators ( ast.AST node,
str indent = "" )
protected
Reconstruct decorator lines from an AST node's decorator_list.

Definition at line 105 of file skeleton_exporter.py.

Here is the caller graph for this function:

◆ _format_function()

str skeleton_exporter._format_function ( ast.FunctionDef | ast.AsyncFunctionDef node,
str indent = "" )
protected
Reconstruct a function/method signature with decorators and docstring.

Definition at line 113 of file skeleton_exporter.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _skeleton_for_non_python()

str skeleton_exporter._skeleton_for_non_python ( Path filepath)
protected
Return a one-line placeholder for a non-Python file.

Definition at line 258 of file skeleton_exporter.py.

Here is the caller graph for this function:

◆ _strip_docstring_section()

str skeleton_exporter._strip_docstring_section ( str docstring,
str section_name )
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.

Here is the caller graph for this function:

◆ clean_skeleton_dirs()

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.

Here is the caller graph for this function:

◆ extract_skeleton()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_skeleton_exporter()

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.

Here is the call graph for this function:

◆ write_skeleton_file_for_dir()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _HEADER_TEXT

tuple skeleton_exporter._HEADER_TEXT
protected
Initial value:
1= (
2 "This file contains structural skeletons (headers, docstrings, signatures) "
3 "of all source files in the directory {directory}.\n"
4 "Implementation bodies are omitted — only the public API surface is shown.\n\n"
5)

Definition at line 61 of file skeleton_exporter.py.

◆ _ROOT_HEADER

str skeleton_exporter._ROOT_HEADER = "####### Root directory: .\n\n"
protected

Definition at line 69 of file skeleton_exporter.py.

◆ _SEPARATOR_FILE

str skeleton_exporter._SEPARATOR_FILE = "##### File name {num:02d}: {path}\n"
protected

Definition at line 67 of file skeleton_exporter.py.

◆ _SEPARATOR_SUBDIR

str skeleton_exporter._SEPARATOR_SUBDIR = "####### Subdirectory name {num:02d}: {dirname}\n"
protected

Definition at line 68 of file skeleton_exporter.py.