MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / appendJsonlLine

Function appendJsonlLine

apps/kimi-code/src/utils/persistence.ts:96–105  ·  view source on GitHub ↗
(
  filePath: string,
  lineSchema: z.ZodType<T>,
  value: T,
)

Source from the content-addressed store, hash-verified

94}
95
96export async function appendJsonlLine<T>(
97 filePath: string,
98 lineSchema: z.ZodType<T>,
99 value: T,
100): Promise<void> {
101 assertNonConfigWrite(filePath);
102 const parsed = lineSchema.parse(value);
103 await mkdir(dirname(filePath), { recursive: true });
104 await appendFile(filePath, `${JSON.stringify(parsed)}\n`, 'utf-8');
105}

Callers 2

appendInputHistoryFunction · 0.90

Calls 3

assertNonConfigWriteFunction · 0.85
mkdirFunction · 0.50
appendFileFunction · 0.50

Tested by

no test coverage detected