MCPcopy Index your code
hub / github.com/github/spec-kit / try_read_integration_json

Function try_read_integration_json

src/specify_cli/integration_state.py:73–87  ·  view source on GitHub ↗

Parse ``.specify/integration.json`` without raising. Returns ``(normalized_state, None)`` on success, ``(None, None)`` when the file does not exist, or ``(None, error)`` for any parse / validation failure. This helper delegates file I/O and raw JSON validation to ``_read_integration

(
    project_root: Path,
)

Source from the content-addressed store, hash-verified

71
72
73def try_read_integration_json(
74 project_root: Path,
75) -> tuple[dict[str, Any] | None, IntegrationReadError | None]:
76 """Parse ``.specify/integration.json`` without raising.
77
78 Returns ``(normalized_state, None)`` on success, ``(None, None)`` when the
79 file does not exist, or ``(None, error)`` for any parse / validation
80 failure. This helper delegates file I/O and raw JSON validation to
81 ``_read_integration_json_data`` so callers that need raw state can share
82 the same low-level reader instead of duplicating parse logic.
83 """
84 data, error = _read_integration_json_data(project_root)
85 if data is None:
86 return None, error
87 return normalize_integration_state(data), None
88
89
90def try_read_integration_json_with_raw(

Callers 1

Calls 2

Tested by

no test coverage detected