MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readPolicySource

Function readPolicySource

graph-ui/src/llm/policy.ts:82–111  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

80 * Steuerungsdatei wird nicht als Erlaubnis gelesen.
81 */
82export function readPolicySource(source: string): PolicyReading {
83 let parsed: unknown;
84 try {
85 parsed = JSON.parse(source);
86 } catch (error) {
87 return {
88 verdict: 'unreadable',
89 path: POLICY_PATH,
90 detail: `die Datei ist kein lesbares JSON: ${error instanceof Error ? error.message : String(error)}`,
91 };
92 }
93 if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
94 return { verdict: 'unreadable', path: POLICY_PATH, detail: 'die Datei enthaelt kein JSON-Objekt' };
95 }
96 const value = (parsed as Record<string, unknown>)['llm'];
97 if (value === undefined) {
98 return { verdict: 'absent', path: POLICY_PATH, detail: '' };
99 }
100 if (value === 'deny') {
101 return { verdict: 'deny', path: POLICY_PATH, detail: '' };
102 }
103 if (value === 'allow') {
104 return { verdict: 'allow', path: POLICY_PATH, detail: '' };
105 }
106 return {
107 verdict: 'unreadable',
108 path: POLICY_PATH,
109 detail: `"llm" traegt den Wert ${JSON.stringify(value)}, und dieses Programm kennt nur "allow" und "deny"`,
110 };
111}
112
113/**
114 * Die Policy des indizierten Projekts holen und deuten.

Callers 2

policy.test.tsFile · 0.90
readLlmPolicyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected