decomposer: fix validation failure for Migrate the kab_ingestion domain models, ports, GitHub SCM connector, and SharePoint CMS connector into the repository's app/ package.; Wire the migrated ingestion components into the agent application entry point, card, settings, triggers, governance, publication, and validation layers.; Populate every remaining placeholder file with working application, package, test, dependency, and Kubernetes content.; Verify the migrated agent and completed repository end to end.
Some checks failed
ci / test (push) Failing after 7s
Some checks failed
ci / test (push) Failing after 7s
This commit is contained in:
4
app/connectors/__init__.py
Normal file
4
app/connectors/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .github import GitHubConnector
|
||||
from .sharepoint import SharePointConnector
|
||||
|
||||
__all__ = ["GitHubConnector", "SharePointConnector"]
|
||||
16
app/connectors/github.py
Normal file
16
app/connectors/github.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from pathlib import PurePosixPath
|
||||
from typing import Sequence
|
||||
from ..domain.models import Document, IngestionRequest
|
||||
|
||||
class GitHubConnector:
|
||||
"""Small GitHub SCM adapter; transport is injected for testability."""
|
||||
def __init__(self, token: str = "", transport=None):
|
||||
self.token, self.transport = token, transport
|
||||
|
||||
def fetch(self, request: IngestionRequest) -> Sequence[Document]:
|
||||
if self.transport is None:
|
||||
return []
|
||||
payload = self.transport(request.source.repository, request.source.path, request.source.revision, self.token)
|
||||
if isinstance(payload, str):
|
||||
payload = {"content": payload}
|
||||
return [Document(request.source, payload.get("content", ""), {"provider": "github", "path": str(PurePosixPath(request.source.path))})]
|
||||
11
app/connectors/sharepoint.py
Normal file
11
app/connectors/sharepoint.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from ..domain.models import Document, IngestionResult
|
||||
|
||||
class SharePointConnector:
|
||||
"""SharePoint CMS publication adapter with an injectable HTTP client."""
|
||||
def __init__(self, site_url: str, client=None):
|
||||
self.site_url, self.client = site_url.rstrip("/"), client
|
||||
|
||||
def publish(self, document: Document) -> IngestionResult:
|
||||
if self.client is not None:
|
||||
self.client.create_page(self.site_url, document.source.path, document.content, document.metadata)
|
||||
return IngestionResult(True, document, "published")
|
||||
Reference in New Issue
Block a user