MCPcopy
hub / github.com/callstack/agent-device / resolveConnectionProfile

Function resolveConnectionProfile

src/remote/remote-connection-state.ts:225–246  ·  view source on GitHub ↗
(
  state: RemoteConnectionState,
  options: {
    cwd: string;
    env: Record<string, string | undefined>;
    validateRemoteConfigHash?: boolean;
  },
)

Source from the content-addressed store, hash-verified

223}
224
225function resolveConnectionProfile(
226 state: RemoteConnectionState,
227 options: {
228 cwd: string;
229 env: Record<string, string | undefined>;
230 validateRemoteConfigHash?: boolean;
231 },
232): Partial<CliFlags> {
233 try {
234 return resolveRemoteConfigProfile({
235 configPath: state.remoteConfigPath,
236 cwd: options.cwd,
237 env: options.env,
238 }).profile;
239 } catch (error) {
240 // Disconnect tolerates a missing/unparseable profile; other paths already failed hash checks.
241 if (options.validateRemoteConfigHash === false) {
242 return {};
243 }
244 throw error;
245 }
246}
247
248function writeJsonFile(filePath: string, value: unknown): void {
249 fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, {

Callers 1

Calls 1

Tested by

no test coverage detected