MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / readRegistryEntryAtPath

Function readRegistryEntryAtPath

src/daemon/daemon-registry.ts:117–143  ·  view source on GitHub ↗
(
  registryPath: string,
  expectedWorkspaceKey?: string,
)

Source from the content-addressed store, hash-verified

115 | { status: 'valid'; entry: DaemonRegistryEntry };
116
117function readRegistryEntryAtPath(
118 registryPath: string,
119 expectedWorkspaceKey?: string,
120): RegistryReadResult {
121 let content: string;
122 try {
123 content = readFileSync(registryPath, 'utf8');
124 } catch (error) {
125 if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
126 return { status: 'missing' };
127 }
128 return { status: 'invalid' };
129 }
130
131 try {
132 const parsed = JSON.parse(content) as unknown;
133 if (!isDaemonRegistryEntry(parsed)) {
134 return { status: 'invalid' };
135 }
136 if (expectedWorkspaceKey !== undefined && parsed.workspaceKey !== expectedWorkspaceKey) {
137 return { status: 'invalid' };
138 }
139 return { status: 'valid', entry: parsed };
140 } catch {
141 return { status: 'invalid' };
142 }
143}
144
145function readValidRegistryEntryAtPath(
146 registryPath: string,

Callers 3

readDaemonRegistryEntryFunction · 0.85

Calls 1

isDaemonRegistryEntryFunction · 0.85

Tested by

no test coverage detected