{ "name": "GitHub Structure Creator - Complete & Working", "nodes": [ { "parameters": { "path": "create-github-structure", "httpMethod": "POST", "options": {} }, "id": "1e5b3e3e-4f2a-4b1c-8c5d-6e7f8a9b0c1d", "name": "GitHub Deploy Trigger", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [200, 300], "webhookId": "github-structure-creator" }, { "parameters": { "values": { "string": [ { "name": "company_name", "value": "={{ $json.body.company_name }}" }, { "name": "repository_name", "value": "={{ $json.body.repository_name }}" }, { "name": "github_owner", "value": "={{ $json.body.github_owner }}" }, { "name": "domains", "value": "={{ $json.body.domains }}" } ] }, "options": {} }, "id": "2f6c4d4f-5e3b-4c2d-9d6e-7f8a9b0c1e2f", "name": "Deploy Status", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [400, 300] }, { "parameters": { "jsCode": "const data = $input.all();\nconst company = data[0].json.company_name;\nconst domains = data[0].json.domains;\n\n// Generate main README content\nlet readme = `# ${company} - Business Operating System\\n\\n`;\nreadme += `## 🏗️ Systematic Business Organization\\n\\n`;\nreadme += `This repository contains the complete Business Operating System (B-OS) for ${company}, organized using the systematic 0-9 framework for maximum clarity and zero entropy.\\n\\n`;\n\n// Add domain overview\nreadme += `## 📊 Business Domains\\n\\n`;\ndomains.forEach(domain => {\n readme += `### ${domain.number} - ${domain.name}\\n`;\n readme += `${domain.content ? domain.content.join(', ') : 'Core business area'}\\n\\n`;\n \n if (domain.subdomains && domain.subdomains.length > 0) {\n readme += `**Subdomains:**\\n`;\n domain.subdomains.forEach(sub => {\n readme += `- ${sub.number}: ${sub.name}\\n`;\n });\n readme += `\\n`;\n }\n});\n\nreadme += `## 🎯 Quick Navigation\\n\\n`;\ndomains.forEach(domain => {\n const folderName = `${domain.number}-${domain.name.replace(/\\s+/g, '-')}`;\n readme += `- [${domain.number} - ${domain.name}](./${folderName}/)\\n`;\n});\n\nreadme += `\\n## 🚀 Usage\\n\\nThis systematic organization eliminates the \"entropy tax\" by providing:\\n- Clear structure for all business information\\n- Consistent navigation across domains\\n- Systematic templates for each area\\n- AI-powered insights and automation\\n\\n**Generated by:** AI-Powered Entropy Management System\\n**Framework:** 0-9 Business Operating System\\n**Date:** ${new Date().toISOString().split('T')[0]}`;\n\n// Generate file list for batch creation\nconst files = [];\n\ndomains.forEach(domain => {\n const folderName = `${domain.number}-${domain.name.replace(/\\s+/g, '-')}`;\n \n // Domain README\n let domainReadme = `# ${domain.number} - ${domain.name}\\n\\n`;\n domainReadme += `## Overview\\n\\n${domain.content ? domain.content.join(', ') : 'Core business domain for systematic organization.'}\\n\\n`;\n \n if (domain.subdomains && domain.subdomains.length > 0) {\n domainReadme += `## Subdomains\\n\\n`;\n domain.subdomains.forEach(sub => {\n domainReadme += `### ${sub.number} - ${sub.name}\\n`;\n domainReadme += `[View Details](./${sub.number.replace('.', '-')}-${sub.name.replace(/\\s+/g, '-')}/README.md)\\n\\n`;\n });\n }\n \n domainReadme += `## Templates\\n\\n- [ ] Strategy Document\\n- [ ] Process Documentation\\n- [ ] Resource Inventory\\n- [ ] Action Items\\n\\n**Last Updated:** ${new Date().toISOString().split('T')[0]}`;\n \n files.push({\n path: `${folderName}/README.md`,\n content: domainReadme,\n type: 'domain'\n });\n \n // Subdomain files\n if (domain.subdomains && domain.subdomains.length > 0) {\n domain.subdomains.forEach(sub => {\n const subFolderName = `${sub.number.replace('.', '-')}-${sub.name.replace(/\\s+/g, '-')}`;\n let subReadme = `# ${sub.number} - ${sub.name}\\n\\n`;\n subReadme += `## Purpose\\n\\nSystematic organization for ${sub.name} within the ${domain.name} domain.\\n\\n`;\n subReadme += `## Structure\\n\\n- [ ] Documentation/\\n- [ ] Templates/\\n- [ ] Resources/\\n- [ ] Processes/\\n\\n`;\n subReadme += `## Quick Actions\\n\\n- [ ] Review current state\\n- [ ] Update documentation\\n- [ ] Process improvements\\n- [ ] Resource optimization\\n\\n`;\n subReadme += `**Domain:** ${domain.number} - ${domain.name}\\n**Subdomain:** ${sub.number} - ${sub.name}\\n**Updated:** ${new Date().toISOString().split('T')[0]}`;\n \n files.push({\n path: `${folderName}/${subFolderName}/README.md`,\n content: subReadme,\n type: 'subdomain'\n });\n });\n }\n});\n\nreturn [{\n json: {\n company_name: company,\n repository_name: data[0].json.repository_name,\n github_owner: data[0].json.github_owner,\n main_readme: readme,\n files: files,\n total_files: files.length + 1\n }\n}];" }, "id": "3a7d5e5a-6f4c-5d3e-ae7f-8a9b0c1d2e3f", "name": "Prepare File Deployment", "type": "n8n-nodes-base.code", "typeVersion": 1, "position": [600, 300] }, { "parameters": { "url": "http://host.docker.internal:3001/tools/create_or_update_file", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "bodyContentType": "raw", "body": "{\n \"owner\": \"{{ $json.github_owner }}\",\n \"repo\": \"{{ $json.repository_name }}\",\n \"path\": \"BUSINESS-OS.md\",\n \"content\": \"{{ $json.main_readme }}\",\n \"message\": \"Create Business Operating System for {{ $json.company_name }}\",\n \"branch\": \"main\"\n}", "options": {} }, "id": "4b8e6f6b-7a5d-6e4f-bf8a-9b0c1d2e3f4a", "name": "Update Main README", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, "position": [800, 300] }, { "parameters": { "batchSize": 1, "options": {}, "fieldName": "files" }, "id": "5c9f7a7c-8b6e-7f5a-ca9b-0c1d2e3f4a5b", "name": "Batch Domain Files", "type": "n8n-nodes-base.splitInBatches", "typeVersion": 1, "position": [1000, 300] }, { "parameters": { "url": "http://host.docker.internal:3001/tools/create_or_update_file", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "bodyContentType": "raw", "body": "{\n \"owner\": \"{{ $json.github_owner }}\",\n \"repo\": \"{{ $json.repository_name }}\",\n \"path\": \"{{ $json.path }}\",\n \"content\": \"{{ $json.content }}\",\n \"message\": \"Create {{ $json.type }} structure for {{ $json.company_name }}\",\n \"branch\": \"main\"\n}", "options": {} }, "id": "6daeb8ad-9c7f-8a6b-db0c-1d2e3f4a5b6c", "name": "Create Domain Files", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, "position": [1200, 300] }, { "parameters": { "values": { "string": [ { "name": "status", "value": "completed" }, { "name": "company_name", "value": "={{ $json.company_name }}" }, { "name": "repository_name", "value": "={{ $json.repository_name }}" }, { "name": "files_created", "value": "={{ $json.total_files }}" }, { "name": "completion_time", "value": "={{ new Date().toISOString() }}" } ] }, "options": {} }, "id": "7ebfc9be-ad8a-9b7c-ec1d-2e3f4a5b6c7d", "name": "Finalize Structure", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [1400, 300] }, { "parameters": { "values": { "string": [ { "name": "deployment_status", "value": "success" }, { "name": "message", "value": "GitHub repository structure successfully created for {{ $json.company_name }}" }, { "name": "repository_url", "value": "https://github.com/{{ $json.github_owner }}/{{ $json.repository_name }}" }, { "name": "next_steps", "value": "Review the created structure and begin populating with business content" } ] }, "options": {} }, "id": "8fcad0cf-be9b-ac8d-fd2e-3f4a5b6c7d8e", "name": "Deployment Complete", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [1600, 300] } ], "connections": { "GitHub Deploy Trigger": { "main": [ [ { "node": "Deploy Status", "type": "main", "index": 0 } ] ] }, "Deploy Status": { "main": [ [ { "node": "Prepare File Deployment", "type": "main", "index": 0 } ] ] }, "Prepare File Deployment": { "main": [ [ { "node": "Update Main README", "type": "main", "index": 0 } ] ] }, "Update Main README": { "main": [ [ { "node": "Batch Domain Files", "type": "main", "index": 0 } ] ] }, "Batch Domain Files": { "main": [ [ { "node": "Create Domain Files", "type": "main", "index": 0 } ] ] }, "Create Domain Files": { "main": [ [ { "node": "Finalize Structure", "type": "main", "index": 0 } ] ] }, "Finalize Structure": { "main": [ [ { "node": "Deployment Complete", "type": "main", "index": 0 } ] ] } }, "active": true, "settings": {}, "versionId": "github-creator-final-working-v1" }