MCPcopy Create free account
hub / github.com/cortexkit/magic-context / readJsonc

Function readJsonc

packages/cli/src/commands/setup-pi.ts:74–82  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

72}
73
74function readJsonc(path: string): Record<string, unknown> | null {
75 try {
76 return parseJsonc(readFileSync(path, "utf-8")) as Record<string, unknown>;
77 } catch (error) {
78 const message = error instanceof Error ? error.message : String(error);
79 console.warn(`Could not parse ${path}: ${message}`);
80 return null;
81 }
82}
83
84function compactObject<T extends Record<string, unknown>>(obj: T): T {
85 for (const key of Object.keys(obj)) {

Callers 2

writePiSettingsPackageFunction · 0.70
writeMagicContextConfigFunction · 0.70

Calls 2

warnMethod · 0.65
parseJsoncFunction · 0.50

Tested by

no test coverage detected