mirror of
https://github.com/github/spec-kit.git
synced 2026-04-01 10:13:08 +00:00
fix: normalize manifest keys to POSIX, type manifest parameter
- Store manifest file keys using as_posix() after resolving relative to project root, ensuring cross-platform portable manifests - Type the manifest parameter as IntegrationManifest (via TYPE_CHECKING import) instead of Any in IntegrationBase methods
This commit is contained in:
@@ -13,7 +13,10 @@ import shutil
|
||||
from abc import ABC
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .manifest import IntegrationManifest
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -95,7 +98,7 @@ class IntegrationBase(ABC):
|
||||
def setup(
|
||||
self,
|
||||
project_root: Path,
|
||||
manifest: Any,
|
||||
manifest: IntegrationManifest,
|
||||
parsed_options: dict[str, Any] | None = None,
|
||||
**opts: Any,
|
||||
) -> list[Path]:
|
||||
@@ -143,7 +146,7 @@ class IntegrationBase(ABC):
|
||||
def teardown(
|
||||
self,
|
||||
project_root: Path,
|
||||
manifest: Any,
|
||||
manifest: IntegrationManifest,
|
||||
*,
|
||||
force: bool = False,
|
||||
) -> tuple[list[Path], list[Path]]:
|
||||
@@ -161,7 +164,7 @@ class IntegrationBase(ABC):
|
||||
def install(
|
||||
self,
|
||||
project_root: Path,
|
||||
manifest: Any,
|
||||
manifest: IntegrationManifest,
|
||||
parsed_options: dict[str, Any] | None = None,
|
||||
**opts: Any,
|
||||
) -> list[Path]:
|
||||
@@ -173,7 +176,7 @@ class IntegrationBase(ABC):
|
||||
def uninstall(
|
||||
self,
|
||||
project_root: Path,
|
||||
manifest: Any,
|
||||
manifest: IntegrationManifest,
|
||||
*,
|
||||
force: bool = False,
|
||||
) -> tuple[list[Path], list[Path]]:
|
||||
|
||||
@@ -87,7 +87,8 @@ class IntegrationManifest:
|
||||
content = content.encode("utf-8")
|
||||
abs_path.write_bytes(content)
|
||||
|
||||
self._files[str(rel)] = hashlib.sha256(content).hexdigest()
|
||||
normalized = abs_path.relative_to(self.project_root).as_posix()
|
||||
self._files[normalized] = hashlib.sha256(content).hexdigest()
|
||||
return abs_path
|
||||
|
||||
def record_existing(self, rel_path: str | Path) -> None:
|
||||
@@ -97,7 +98,8 @@ class IntegrationManifest:
|
||||
"""
|
||||
rel = Path(rel_path)
|
||||
abs_path = _validate_rel_path(rel, self.project_root)
|
||||
self._files[str(rel)] = _sha256(abs_path)
|
||||
normalized = abs_path.relative_to(self.project_root).as_posix()
|
||||
self._files[normalized] = _sha256(abs_path)
|
||||
|
||||
# -- Querying ---------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user