feat(spaces): implement Phase 8 Git History Tracking

Implements optional git-based version control for information spaces:
- HistoryConfig model for configuring history tracking
- Commit, Branch, HistoryEntry, DiffResult models
- IHistoryBackend and IHistoryQuery interfaces
- GitHistoryBackend using git CLI for version control
- GitHistoryEventHandler for event-driven auto-commits
- HistoryEventCoordinator for managing space history
- HistoryQueryService for high-level history queries
- Automatic commits on DOCUMENT_ADDED/REMOVED/CONTENT_CHANGED events
- Support for:
  * Commit log with pagination and filtering
  * Diff between versions
  * File content at specific versions
  * Branch creation and switching
  * Version restoration
  * Uncommitted changes detection
- 43 comprehensive unit tests with git availability checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 18:03:35 +01:00
parent 727ce4d3c5
commit 4588cbeee8
8 changed files with 2587 additions and 9 deletions

View File

@@ -83,6 +83,27 @@ from .composability import (
)
from .composability.service import CircularReferenceError
# Phase 8: History Tracking (Optional)
from .history import (
# Models
Commit,
Branch,
HistoryEntry,
DiffResult,
DiffLine,
DiffType,
HistoryConfig,
# Interfaces
IHistoryBackend,
IHistoryQuery,
# Implementations
GitHistoryBackend,
GitError,
GitHistoryEventHandler,
HistoryEventCoordinator,
HistoryQueryService,
)
__all__ = [
# Models
"InformationSpace",
@@ -130,4 +151,21 @@ __all__ = [
"IAccessControlRepository",
"SqliteSpaceReferenceRepository",
"SqliteAccessControlRepository",
# History - Models
"Commit",
"Branch",
"HistoryEntry",
"DiffResult",
"DiffLine",
"DiffType",
"HistoryConfig",
# History - Interfaces
"IHistoryBackend",
"IHistoryQuery",
# History - Implementations
"GitHistoryBackend",
"GitError",
"GitHistoryEventHandler",
"HistoryEventCoordinator",
"HistoryQueryService",
]