MCPcopy Create free account
hub / github.com/freecodexyz/free-code / onInit

Function onInit

src/screens/REPL.tsx:3795–3823  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3793 handlers: messageActionHandlers
3794 } = useMessageActions(cursor, setCursor, cursorNavRef, messageActionCaps);
3795 async function onInit() {
3796 // Always verify API key on startup, so we can show the user an error in the
3797 // bottom right corner of the screen if the API key is invalid.
3798 void reverify();
3799
3800 // Populate readFileState with CLAUDE.md files at startup
3801 const memoryFiles = await getMemoryFiles();
3802 if (memoryFiles.length > 0) {
3803 const fileList = memoryFiles.map(f => ` [${f.type}] ${f.path} (${f.content.length} chars)${f.parent ? ` (included by ${f.parent})` : ''}`).join('\n');
3804 logForDebugging(`Loaded ${memoryFiles.length} CLAUDE.md/rules files:\n${fileList}`);
3805 } else {
3806 logForDebugging('No CLAUDE.md/rules files found');
3807 }
3808 for (const file of memoryFiles) {
3809 // When the injected content doesn't match disk (stripped HTML comments,
3810 // stripped frontmatter, MEMORY.md truncation), cache the RAW disk bytes
3811 // with isPartialView so Edit/Write require a real Read first while
3812 // getChangedFiles + nested_memory dedup still work.
3813 readFileState.current.set(file.path, {
3814 content: file.contentDiffersFromDisk ? file.rawContent ?? file.content : file.content,
3815 timestamp: Date.now(),
3816 offset: undefined,
3817 limit: undefined,
3818 isPartialView: file.contentDiffersFromDisk
3819 });
3820 }
3821
3822 // Initial message handling is done via the initialMessage effect
3823 }
3824
3825 // Register cost summary tracker
3826 useCostSummary(useFpsMetrics());

Callers 2

REPLFunction · 0.85
useRemoteSessionFunction · 0.85

Calls 2

logForDebuggingFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected