mirror of
https://github.com/github/spec-kit.git
synced 2026-04-01 18:23:09 +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 abc import ABC
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
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(
|
def setup(
|
||||||
self,
|
self,
|
||||||
project_root: Path,
|
project_root: Path,
|
||||||
manifest: Any,
|
manifest: IntegrationManifest,
|
||||||
parsed_options: dict[str, Any] | None = None,
|
parsed_options: dict[str, Any] | None = None,
|
||||||
**opts: Any,
|
**opts: Any,
|
||||||
) -> list[Path]:
|
) -> list[Path]:
|
||||||
@@ -143,7 +146,7 @@ class IntegrationBase(ABC):
|
|||||||
def teardown(
|
def teardown(
|
||||||
self,
|
self,
|
||||||
project_root: Path,
|
project_root: Path,
|
||||||
manifest: Any,
|
manifest: IntegrationManifest,
|
||||||
*,
|
*,
|
||||||
force: bool = False,
|
force: bool = False,
|
||||||
) -> tuple[list[Path], list[Path]]:
|
) -> tuple[list[Path], list[Path]]:
|
||||||
@@ -161,7 +164,7 @@ class IntegrationBase(ABC):
|
|||||||
def install(
|
def install(
|
||||||
self,
|
self,
|
||||||
project_root: Path,
|
project_root: Path,
|
||||||
manifest: Any,
|
manifest: IntegrationManifest,
|
||||||
parsed_options: dict[str, Any] | None = None,
|
parsed_options: dict[str, Any] | None = None,
|
||||||
**opts: Any,
|
**opts: Any,
|
||||||
) -> list[Path]:
|
) -> list[Path]:
|
||||||
@@ -173,7 +176,7 @@ class IntegrationBase(ABC):
|
|||||||
def uninstall(
|
def uninstall(
|
||||||
self,
|
self,
|
||||||
project_root: Path,
|
project_root: Path,
|
||||||
manifest: Any,
|
manifest: IntegrationManifest,
|
||||||
*,
|
*,
|
||||||
force: bool = False,
|
force: bool = False,
|
||||||
) -> tuple[list[Path], list[Path]]:
|
) -> tuple[list[Path], list[Path]]:
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ class IntegrationManifest:
|
|||||||
content = content.encode("utf-8")
|
content = content.encode("utf-8")
|
||||||
abs_path.write_bytes(content)
|
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
|
return abs_path
|
||||||
|
|
||||||
def record_existing(self, rel_path: str | Path) -> None:
|
def record_existing(self, rel_path: str | Path) -> None:
|
||||||
@@ -97,7 +98,8 @@ class IntegrationManifest:
|
|||||||
"""
|
"""
|
||||||
rel = Path(rel_path)
|
rel = Path(rel_path)
|
||||||
abs_path = _validate_rel_path(rel, self.project_root)
|
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 ---------------------------------------------------------
|
# -- Querying ---------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user