#!/usr/bin/env python3 import os BASE_DIR = "/Users/jakeshore/.clawdbot/workspace/mcpengine-repo/servers/xero/src/apps" MAIN_TSX = '''import React, { Suspense, Component, ErrorInfo, ReactNode } from 'react'; import { createRoot } from 'react-dom/client'; const App = React.lazy(() => import('./App')); interface ErrorBoundaryProps { children: ReactNode; } interface ErrorBoundaryState { hasError: boolean; error?: Error; } class ErrorBoundary extends Component { constructor(props: ErrorBoundaryProps) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error: Error): ErrorBoundaryState { return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error('Error caught by boundary:', error, errorInfo); } render() { if (this.state.hasError) { return (

Something went wrong

{this.state.error?.message}

); } return this.props.children; } } const LoadingSkeleton = () => (
); const container = document.getElementById('root'); if (container) { const root = createRoot(container); root.render( }> ); } ''' # Remaining 9 apps apps = [ { "name": "profit-loss", "title": "Profit & Loss", "subtitle": "P&L report viewer", "icon": "šŸ“ˆ", }, { "name": "balance-sheet", "title": "Balance Sheet", "subtitle": "Balance sheet viewer", "icon": "āš–ļø", }, { "name": "trial-balance", "title": "Trial Balance", "subtitle": "Trial balance viewer", "icon": "🧮", }, { "name": "aged-receivables", "title": "Aged Receivables", "subtitle": "AR aging report", "icon": "šŸ“Š", }, { "name": "aged-payables", "title": "Aged Payables", "subtitle": "AP aging report", "icon": "šŸ“‰", }, { "name": "employee-directory", "title": "Employee Directory", "subtitle": "Employee records", "icon": "šŸ‘„", }, { "name": "payroll-dashboard", "title": "Payroll Dashboard", "subtitle": "Pay runs, slips, and leave", "icon": "šŸ’°", }, { "name": "tax-center", "title": "Tax Center", "subtitle": "Tax rates and returns", "icon": "šŸ›ļø", }, { "name": "org-overview", "title": "Organisation Overview", "subtitle": "Organisation info, settings, and metrics", "icon": "šŸ¢", }, ] for app in apps: app_dir = os.path.join(BASE_DIR, app["name"]) # Create index.html html_content = f''' {app["title"]} - Xero MCP
''' with open(os.path.join(app_dir, "index.html"), "w") as f: f.write(html_content) # Create main.tsx with open(os.path.join(app_dir, "main.tsx"), "w") as f: f.write(MAIN_TSX) # Copy styles.css from template os.system(f"cp {BASE_DIR}/invoice-dashboard/styles.css {app_dir}/styles.css") print(f"āœ… Created {app['name']}") print("\n✨ All files created!")