| from agent.file_ops import write | |
| def coder(plan, ws): | |
| write(f"{ws}/index.html", | |
| """<!doctype html> | |
| <div id="root"></div> | |
| <script type="module" src="/src/main.jsx"></script> | |
| """) | |
| write(f"{ws}/src/main.jsx", | |
| """import React from "react"; | |
| import { createRoot } from "react-dom/client"; | |
| import App from "./App"; | |
| createRoot(document.getElementById("root")).render(<App />); | |
| """) | |
| write(f"{ws}/src/App.jsx", | |
| f"""export default function App() {{ | |
| return <h1>{plan['goal']}</h1> | |
| }} | |
| """) |