MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / handleCreateFile

Function handleCreateFile

ai-code-studio/src/components/SoulEditor.tsx:70–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 }
69
70 async function handleCreateFile() {
71 let name = newFileName.trim();
72 if (!name) return;
73 if (!name.endsWith('.md')) name += '.md';
74 try {
75 await api(`/api/bootstrap/${encodeURIComponent(name)}`, {
76 method: 'POST',
77 body: JSON.stringify({ content: `# ${name.replace('.md', '')}\n\n` }),
78 });
79 setNewFileName('');
80 setShowNewFile(false);
81 await loadFiles();
82 setActiveFile(name);
83 } catch { /* ignore */ }
84 }
85
86 const currentFile = files.find(f => f.name === activeFile);
87 const isDirty = currentFile ? editContent !== currentFile.content : false;

Callers 1

SoulEditorFunction · 0.85

Calls 1

apiFunction · 0.90

Tested by

no test coverage detected