MCPcopy Create free account
hub / github.com/afar1/fieldtheory-cli / addUserFrameFromFile

Function addUserFrameFromFile

src/frames-registry.ts:167–178  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

165 * The file must contain a single frame object (not wrapped in `{ frames: [...] }`).
166 */
167export function addUserFrameFromFile(filePath: string): AddUserFrameResult {
168 const resolved = path.resolve(filePath);
169 let raw: unknown;
170 try {
171 const text = fs.readFileSync(resolved, 'utf-8');
172 raw = JSON.parse(text);
173 } catch (err) {
174 throw new Error(`Could not read frame file ${resolved}: ${(err as Error).message}`);
175 }
176 const frame = parseFrame(raw);
177 return addUserFrame(frame);
178}
179
180/**
181 * Validate an optional frame id from user input (CLI flag, API field, etc).

Callers 1

buildCliFunction · 0.85

Calls 2

parseFrameFunction · 0.85
addUserFrameFunction · 0.85

Tested by

no test coverage detected