MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / withShape

Function withShape

src/ui-server/api/effects.ts:343–355  ·  view source on GitHub ↗

The category plus what the text says about the model and the access.

(category: EffectCategory, text: string, args: string | null, language: Language | null, receiverType: string | null)

Source from the content-addressed store, hash-verified

341
342/** The category plus what the text says about the model and the access. */
343function withShape(category: EffectCategory, text: string, args: string | null, language: Language | null, receiverType: string | null): Effect {
344 if (category !== 'database') return { category };
345 const out: Effect = { category };
346 const segments = text.replace(/\([^()]*\)/g, '').split(/[.:]+/).filter(Boolean);
347 const last = segments[segments.length - 1] ?? '';
348 const model = modelOf(segments, args, receiverType);
349 if (model) out.model = model;
350 const op = last.replace(/[!?]$/, '');
351 if (op === 'exec' && language === 'python') out.access = 'read';
352 else if (WRITE_OPS.test(op)) out.access = 'write';
353 else if (READ_OPS.test(op)) out.access = 'read';
354 return out;
355}
356
357const MODEL_SUFFIX = /(?:Repository|Repo|Dao|DAO|Model|Mapper|Store|Collection|Table|Service|Entity|Manager)$/;
358

Callers 1

classifyEffectFunction · 0.85

Calls 1

modelOfFunction · 0.85

Tested by

no test coverage detected