API reference

This reference is generated from the public Documentledger modules, including the CLI, storage and scan layers, section/source indexing, impact resolution, context rendering, and link management.

documentledger.source_index.file_unit_id(path: str) str[source]
documentledger.source_index.module_unit_id(path: str) str[source]
documentledger.source_index.qualified_unit_id(path: str, kind: str, qualname: str) str[source]
documentledger.source_index.hash_text(value: str) str[source]
documentledger.source_index.semantic_dump(node: AST | Sequence[AST]) str[source]
documentledger.source_index.line_span(node: AST, total_lines: int) tuple[int, int][source]
documentledger.source_index.slice_source(lines: list[str], span: tuple[int, int]) str[source]
documentledger.source_index.function_signature(node: FunctionDef | AsyncFunctionDef) str[source]
documentledger.source_index.class_signature(node: ClassDef) str[source]
documentledger.source_index.docstring_value(node: Module | ClassDef | FunctionDef | AsyncFunctionDef) str[source]
documentledger.source_index.without_docstring(body: list[stmt]) list[stmt][source]
documentledger.source_index.public_literal_values(node: AST) list[str][source]
documentledger.source_index.exported_assignments(nodes: list[stmt]) list[str][source]
documentledger.source_index.decorator_hash(node: FunctionDef | AsyncFunctionDef | ClassDef) str[source]
documentledger.source_index.function_unit(path: str, lines: list[str], node: FunctionDef | AsyncFunctionDef, qualname: str) SourceUnit[source]
documentledger.source_index.class_unit(path: str, lines: list[str], node: ClassDef) SourceUnit[source]
documentledger.source_index.module_unit(path: str, lines: list[str], tree: Module) SourceUnit[source]
documentledger.source_index.file_unit(path: str, text: str, line_count: int) SourceUnit[source]
documentledger.source_index.index_python_source(path: str, text: str) list[SourceUnit][source]
documentledger.source_index.source_units_for_file(path: Path, repo_path: str) list[SourceUnit][source]
documentledger.source_index.source_inventory(root: Path, source_paths: list[str]) dict[str, dict[str, Any]][source]
documentledger.source_index.source_inventory_for_paths(root: Path, source_paths: Sequence[str]) dict[str, dict[str, Any]][source]
class documentledger.models.Config(root: 'Path', path: 'Path', project_name: 'str', project_uuid: 'str', storage_dir: 'Path', source_roots: 'list[str]', doc_roots: 'list[str]', source_extensions: 'list[str]', doc_extensions: 'list[str]', validation_commands: 'list[str]', require_doc_frontmatter: 'bool' = False)[source]
root: Path
path: Path
project_name: str
project_uuid: str
storage_dir: Path
source_roots: list[str]
doc_roots: list[str]
source_extensions: list[str]
doc_extensions: list[str]
validation_commands: list[str]
require_doc_frontmatter: bool = False
__init__(root: Path, path: Path, project_name: str, project_uuid: str, storage_dir: Path, source_roots: list[str], doc_roots: list[str], source_extensions: list[str], doc_extensions: list[str], validation_commands: list[str], require_doc_frontmatter: bool = False) None
class documentledger.models.ToolConfig(config_version: int, ledger_code: str, source_roots: tuple[str, ...], doc_roots: tuple[str, ...], source_extensions: tuple[str, ...], doc_extensions: tuple[str, ...], validation_commands: tuple[str, ...], require_doc_frontmatter: bool = False)[source]

Documentledger’s tool-owned schema-2 configuration.

Project identity and storage routing deliberately do not live here. They are supplied by the shared ledgercore manifest and resolved layout.

config_version: int
ledger_code: str
source_roots: tuple[str, ...]
doc_roots: tuple[str, ...]
source_extensions: tuple[str, ...]
doc_extensions: tuple[str, ...]
validation_commands: tuple[str, ...]
require_doc_frontmatter: bool
__init__(config_version: int, ledger_code: str, source_roots: tuple[str, ...], doc_roots: tuple[str, ...], source_extensions: tuple[str, ...], doc_extensions: tuple[str, ...], validation_commands: tuple[str, ...], require_doc_frontmatter: bool = False) None
class documentledger.models.WorkspacePaths(project_root: Path, manifest_path: Path | None, local_config_path: Path | None, config_path: Path, data_dir: Path, artifacts_dir: Path | None, config_binding_path: Path | None, data_binding_path: Path | None, artifacts_binding_path: Path | None, layout_source: Literal['canonical', 'legacy'])[source]

Resolved canonical or legacy paths, kept separate from tool config.

project_root: Path
manifest_path: Path | None
local_config_path: Path | None
config_path: Path
data_dir: Path
artifacts_dir: Path | None
config_binding_path: Path | None
data_binding_path: Path | None
artifacts_binding_path: Path | None
layout_source: Literal['canonical', 'legacy']
property storage_dir: Path

Compatibility alias for storage call sites during the migration.

__init__(project_root: Path, manifest_path: Path | None, local_config_path: Path | None, config_path: Path, data_dir: Path, artifacts_dir: Path | None, config_binding_path: Path | None, data_binding_path: Path | None, artifacts_binding_path: Path | None, layout_source: Literal['canonical', 'legacy']) None
class documentledger.models.Workspace(config: 'Config', metadata: 'dict[str, object]', paths: 'WorkspacePaths | None' = None, project_name: 'str | None' = None, project_uuid: 'str | None' = None)[source]
config: Config
metadata: dict[str, object]
paths: WorkspacePaths | None = None
project_name: str | None = None
project_uuid: str | None = None
__init__(config: Config, metadata: dict[str, object], paths: WorkspacePaths | None = None, project_name: str | None = None, project_uuid: str | None = None) None
class documentledger.models.SourceUnit(source_id: 'str', path: 'str', kind: 'str', qualname: 'str', line_span: 'tuple[int, int]', signature: 'str', hashes: 'dict[str, str]')[source]
source_id: str
path: str
kind: str
qualname: str
line_span: tuple[int, int]
signature: str
hashes: dict[str, str]
to_record() dict[str, Any][source]
__init__(source_id: str, path: str, kind: str, qualname: str, line_span: tuple[int, int], signature: str, hashes: dict[str, str]) None
class documentledger.models.DocSection(section_id: 'str', doc_path: 'str', heading_path: 'list[str]', heading_slug: 'str', line_span: 'tuple[int, int]', section_hash: 'str', summary: 'str', text: 'str')[source]
section_id: str
doc_path: str
heading_path: list[str]
heading_slug: str
line_span: tuple[int, int]
section_hash: str
summary: str
text: str
to_record() dict[str, Any][source]
__init__(section_id: str, doc_path: str, heading_path: list[str], heading_slug: str, line_span: tuple[int, int], section_hash: str, summary: str, text: str) None
class documentledger.models.ScanResult(version: 'int', changed_sources: 'list[str]' = <factory>, deleted_sources: 'list[str]' = <factory>, stale_docs: 'list[str]' = <factory>, unlinked_changed_sources: 'list[str]' = <factory>, changed_units: 'list[dict[str, Any]]'=<factory>, added_units: 'list[dict[str, Any]]'=<factory>, deleted_units: 'list[dict[str, Any]]'=<factory>, affected_sections: 'list[dict[str, Any]]'=<factory>, unmapped_changed_units: 'list[dict[str, Any]]'=<factory>, source_units: 'dict[str, dict[str, Any]]'=<factory>, source_hashes: 'dict[str, str]'=<factory>, doc_hashes: 'dict[str, str]'=<factory>, unchanged: 'bool' = False)[source]
version: int
changed_sources: list[str]
deleted_sources: list[str]
stale_docs: list[str]
unlinked_changed_sources: list[str]
changed_units: list[dict[str, Any]]
added_units: list[dict[str, Any]]
deleted_units: list[dict[str, Any]]
affected_sections: list[dict[str, Any]]
unmapped_changed_units: list[dict[str, Any]]
source_units: dict[str, dict[str, Any]]
source_hashes: dict[str, str]
doc_hashes: dict[str, str]
unchanged: bool = False
__init__(version: int, changed_sources: list[str] = <factory>, deleted_sources: list[str] = <factory>, stale_docs: list[str] = <factory>, unlinked_changed_sources: list[str] = <factory>, changed_units: list[dict[str, ~typing.Any]]=<factory>, added_units: list[dict[str, ~typing.Any]]=<factory>, deleted_units: list[dict[str, ~typing.Any]]=<factory>, affected_sections: list[dict[str, ~typing.Any]]=<factory>, unmapped_changed_units: list[dict[str, ~typing.Any]]=<factory>, source_units: dict[str, dict[str, ~typing.Any]]=<factory>, source_hashes: dict[str, str]=<factory>, doc_hashes: dict[str, str]=<factory>, unchanged: bool = False) None