File size: 4,491 Bytes
edae06c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{
  "name": "LOGOS Codebase Analysis (Local Swarm)",
  "nodes": [
    {
      "parameters": {},
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "id": "trigger-node"
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "projectPath",
              "value": "C:/Users/Nauti/Desktop/LOGOS CURSOR/"
            },
            {
              "name": "localLLM",
              "value": "http://localhost:1234/v1"
            }
          ]
        }
      },
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "id": "config-node"
    },
    {
      "parameters": {
        "command": "dir /s /b *.py",
        "cwd": "={{$node[\"Config\"].json[\"projectPath\"]}}"
      },
      "name": "Find Python Files",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        650,
        200
      ],
      "id": "find-files"
    },
    {
      "parameters": {
        "functionCode": "const output = [];\nconst files = items[0].json.stdout.split('\\r\\n');\nfor (const file of files) {\n  if (file && file.trim() !== '') {\n    output.push({json: { filePath: file.trim() }});\n  }\n}\nreturn output;"
      },
      "name": "Split Files",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        850,
        200
      ],
      "id": "split-files"
    },
    {
      "parameters": {
        "fileSelector": "={{$json[\"filePath\"]}}",
        "dataPropertyName": "codeContent"
      },
      "name": "Read Code",
      "type": "n8n-nodes-base.readBinaryFile",
      "typeVersion": 1,
      "position": [
        1050,
        200
      ],
      "id": "read-code"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{$node[\"Config\"].json[\"localLLM\"]}}/chat/completions",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "local-model"
            },
            {
              "name": "messages",
              "value": "=[{\"role\": \"system\", \"content\": \"You are a Senior Python Logic Analyzer. Analyze this code for bugs and logic structure.\"}, {\"role\": \"user\", \"content\": \"{{$binary.codeContent.data}}\"}]"
            },
            {
              "name": "stream",
              "value": false
            }
          ]
        },
        "options": {}
      },
      "name": "Nano Swarm (Code)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1250,
        200
      ],
      "id": "local-llm-req"
    },
    {
      "parameters": {
        "command": "python hf_space/analyze_uploads.py --recursive",
        "cwd": "={{$node[\"Config\"].json[\"projectPath\"]}}"
      },
      "name": "Analyze Diagrams (Images)",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        650,
        450
      ],
      "id": "analyze-images"
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Find Python Files",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze Diagrams (Images)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Python Files": {
      "main": [
        [
          {
            "node": "Split Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Files": {
      "main": [
        [
          {
            "node": "Read Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Code": {
      "main": [
        [
          {
            "node": "Nano Swarm (Code)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}