2026-05-04 11:06:11 +02:00
|
|
|
"""Built-in internal extension descriptors."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from markitect_tool.extension.registry import ExtensionDescriptor, ExtensionRegistry
|
|
|
|
|
from markitect_tool.extension.processing import ProcessingCapability
|
|
|
|
|
from markitect_tool.query import default_query_engine_registry
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def builtin_extension_registry() -> ExtensionRegistry:
|
|
|
|
|
"""Return descriptors for built-in Markitect extensions."""
|
|
|
|
|
|
|
|
|
|
registry = default_query_engine_registry().extension_registry()
|
2026-05-04 12:35:59 +02:00
|
|
|
for descriptor in _processor_descriptors() + [
|
|
|
|
|
_local_sqlite_backend_descriptor(),
|
|
|
|
|
_workflow_engine_descriptor(),
|
|
|
|
|
]:
|
2026-05-04 11:06:11 +02:00
|
|
|
registry.register(descriptor)
|
|
|
|
|
return registry
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _processor_descriptors() -> list[ExtensionDescriptor]:
|
|
|
|
|
return [
|
|
|
|
|
ExtensionDescriptor(
|
|
|
|
|
id="processor.identity",
|
|
|
|
|
kind="processor",
|
|
|
|
|
summary="Return fenced block content unchanged.",
|
|
|
|
|
capabilities=[
|
|
|
|
|
ProcessingCapability(id="processor", kind="execute"),
|
|
|
|
|
ProcessingCapability(id="deterministic", kind="execution"),
|
|
|
|
|
],
|
|
|
|
|
input_contract="ProcessorRequest",
|
|
|
|
|
output_contract="ProcessorResult",
|
|
|
|
|
diagnostics_namespace="processor",
|
|
|
|
|
provenance_prefix="processor.identity",
|
|
|
|
|
cli={"commands": ["mkt process"]},
|
|
|
|
|
docs=["docs/processors.md"],
|
|
|
|
|
),
|
|
|
|
|
ExtensionDescriptor(
|
|
|
|
|
id="processor.uppercase",
|
|
|
|
|
kind="processor",
|
|
|
|
|
summary="Uppercase fenced block content deterministically.",
|
|
|
|
|
capabilities=[
|
|
|
|
|
ProcessingCapability(id="processor", kind="execute"),
|
|
|
|
|
ProcessingCapability(id="deterministic", kind="execution"),
|
|
|
|
|
],
|
|
|
|
|
input_contract="ProcessorRequest",
|
|
|
|
|
output_contract="ProcessorResult",
|
|
|
|
|
diagnostics_namespace="processor",
|
|
|
|
|
provenance_prefix="processor.uppercase",
|
|
|
|
|
cli={"commands": ["mkt process"]},
|
|
|
|
|
docs=["docs/processors.md"],
|
|
|
|
|
),
|
|
|
|
|
ExtensionDescriptor(
|
|
|
|
|
id="processor.include",
|
|
|
|
|
kind="processor",
|
|
|
|
|
summary="Resolve a content reference into fenced block output.",
|
|
|
|
|
capabilities=[
|
|
|
|
|
ProcessingCapability(id="processor", kind="execute"),
|
|
|
|
|
ProcessingCapability(id="references", kind="read"),
|
|
|
|
|
ProcessingCapability(id="filesystem", kind="read"),
|
|
|
|
|
],
|
|
|
|
|
safety={"reads_files": True, "writes_files": False, "network": False},
|
|
|
|
|
input_contract="ProcessorRequest",
|
|
|
|
|
output_contract="ProcessorResult",
|
|
|
|
|
diagnostics_namespace="processor",
|
|
|
|
|
provenance_prefix="processor.include",
|
|
|
|
|
cli={"commands": ["mkt process"]},
|
|
|
|
|
docs=["docs/processors.md", "docs/content-references.md"],
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _local_sqlite_backend_descriptor() -> ExtensionDescriptor:
|
|
|
|
|
return ExtensionDescriptor(
|
|
|
|
|
id="backend.local-sqlite",
|
|
|
|
|
kind="backend",
|
|
|
|
|
summary="Local SQLite snapshot, metadata, JSON, and FTS5 index backend.",
|
|
|
|
|
capabilities=[
|
|
|
|
|
ProcessingCapability(id="snapshots", kind="backend"),
|
|
|
|
|
ProcessingCapability(id="ast", kind="backend"),
|
|
|
|
|
ProcessingCapability(id="json", kind="backend"),
|
|
|
|
|
ProcessingCapability(id="fts", kind="backend"),
|
|
|
|
|
ProcessingCapability(id="sql", kind="backend"),
|
|
|
|
|
ProcessingCapability(id="provenance", kind="backend"),
|
|
|
|
|
],
|
|
|
|
|
safety={"reads_files": True, "writes_local_cache": True, "network": False},
|
|
|
|
|
input_contract="Markdown files/directories",
|
|
|
|
|
output_contract="SQLite snapshot/index store",
|
|
|
|
|
diagnostics_namespace="backend.local_sqlite",
|
|
|
|
|
provenance_prefix="local_snapshot_store",
|
|
|
|
|
cli={"commands": ["mkt cache init", "mkt cache index", "mkt cache query", "mkt search"]},
|
|
|
|
|
docs=["docs/local-index-backend.md", "docs/backend-fabric.md"],
|
|
|
|
|
examples=["examples/backends/local-sqlite-backend.md"],
|
|
|
|
|
)
|
2026-05-04 12:35:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def _workflow_engine_descriptor() -> ExtensionDescriptor:
|
|
|
|
|
return ExtensionDescriptor(
|
|
|
|
|
id="workflow.markdown-dataflow",
|
|
|
|
|
kind="workflow-engine",
|
|
|
|
|
summary="Declarative Markdown dataflow workflow engine.",
|
|
|
|
|
capabilities=[
|
|
|
|
|
ProcessingCapability(id="workflow", kind="execute"),
|
|
|
|
|
ProcessingCapability(id="markdown", kind="read"),
|
|
|
|
|
ProcessingCapability(id="templates", kind="execute"),
|
|
|
|
|
ProcessingCapability(id="provenance", kind="emit"),
|
|
|
|
|
],
|
|
|
|
|
safety={
|
|
|
|
|
"reads_files": True,
|
|
|
|
|
"writes_output_files": True,
|
|
|
|
|
"network": False,
|
|
|
|
|
"assisted_generation": "adapter-only",
|
|
|
|
|
},
|
|
|
|
|
input_contract="Markdown/YAML workflow definition",
|
|
|
|
|
output_contract="WorkflowRunResult",
|
|
|
|
|
diagnostics_namespace="workflow",
|
|
|
|
|
provenance_prefix="workflow",
|
|
|
|
|
cli={"commands": ["mkt workflow inspect", "mkt workflow plan", "mkt workflow run"]},
|
|
|
|
|
docs=["docs/workflow-definition-standard.md"],
|
|
|
|
|
examples=["examples/workflows/adr-release-notes.workflow.md"],
|
|
|
|
|
)
|