MCPcopy
hub / github.com/github/spec-kit / save

Method save

src/specify_cli/integrations/manifest.py:395–423  ·  view source on GitHub ↗

Write the manifest to disk. Returns the manifest path.

(self)

Source from the content-addressed store, hash-verified

393 # -- Persistence ------------------------------------------------------
394
395 def save(self) -> Path:
396 """Write the manifest to disk. Returns the manifest path."""
397 self._installed_at = self._installed_at or datetime.now(timezone.utc).isoformat()
398 data: dict[str, Any] = {
399 "integration": self.key,
400 "version": self.version,
401 "installed_at": self._installed_at,
402 "files": self._files,
403 **(
404 {"recovered_files": sorted(self._recovered_files)}
405 if self._recovered_files
406 else {}
407 ),
408 }
409 path = self.manifest_path
410 content = json.dumps(data, indent=2) + "\n"
411 _ensure_safe_manifest_destination(self.project_root, path)
412 fd, temp_name = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
413 temp_path = Path(temp_name)
414 try:
415 with os.fdopen(fd, "w", encoding="utf-8") as fh:
416 fh.write(content)
417 temp_path.chmod(0o644)
418 _ensure_safe_manifest_destination(self.project_root, path)
419 os.replace(temp_path, path)
420 finally:
421 if temp_path.exists():
422 temp_path.unlink()
423 return path
424
425 @classmethod
426 def load(

Calls 1