{
  "name": "PRAGMAS - Generate LaTeX PDF",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "pragmas/generate-latex-pdf",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "1",
      "name": "PDF Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const body = $json.body ?? {};\nconst query = $json.query ?? {};\nconst company = String(body.company ?? query.company ?? $json.company ?? '').trim();\nif (!company) {\n  throw new Error('company is required');\n}\nconst shellQuote = (value) => JSON.stringify(String(value)).replace(/[`$]/g, '\\\\$&');\nreturn [{\n  json: {\n    company,\n    command: ['python3 /workspace/scripts/dashboard/generate_latex_pdf.py', '--vault-path', '/workspace/obsidian-vault', '--company', company].map((part, index) => index === 0 ? part : shellQuote(part)).join(' ')\n  }\n}];"
      },
      "id": "2",
      "name": "Prepare Request",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "command": "={{$json.command}}"
      },
      "id": "3",
      "name": "Generate PDF",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        760,
        300
      ]
    }
  ],
  "connections": {
    "PDF Webhook": {
      "main": [
        [
          {
            "node": "Prepare Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Request": {
      "main": [
        [
          {
            "node": "Generate PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "pragmas-generate-latex-pdf-v2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "pragmas-generate-latex-pdf"
}