(projectContent string)
| 1282 | func parseProjectInputsDirect(projectContent string) ([]map[string]string, error) { |
| 1283 | var cfg struct { |
| 1284 | Content string `yaml:"content"` |
| 1285 | } |
| 1286 | |
| 1287 | // Parse YAML to extract content |
| 1288 | if err := yaml.Unmarshal([]byte(projectContent), &cfg); err != nil { |
| 1289 | return nil, fmt.Errorf("failed to parse project configuration: %w", err) |
| 1290 | } |
| 1291 | |
| 1292 | if strings.TrimSpace(cfg.Content) == "" { |
| 1293 | return nil, fmt.Errorf("project content cannot be empty") |
| 1294 | } |
| 1295 | |
| 1296 | // Parse content to extract input information |
| 1297 | lines := strings.Split(cfg.Content, "\n") |
| 1298 | inputNames := make(map[string]bool) |
| 1299 | actualLineNum := 0 |
| 1300 | |
| 1301 | for i, line := range lines { |
| 1302 | actualLineNum = i + 1 |
| 1303 | line = strings.TrimSpace(line) |
| 1304 | if line == "" { |
| 1305 | continue |
| 1306 | } |
| 1307 | |
| 1308 | // Skip comment lines |
| 1309 | if strings.HasPrefix(line, "#") { |
| 1310 | continue |
| 1311 | } |
| 1312 | |
| 1313 | // Parse arrow format: -> |
| 1314 | parts := strings.Split(line, "->") |
| 1315 | if len(parts) != 2 { |
| 1316 | return nil, fmt.Errorf("invalid line format at line %d: %s", actualLineNum, line) |
| 1317 | } |
| 1318 | |
| 1319 | from := strings.TrimSpace(parts[0]) |
| 1320 | |
| 1321 | // Parse from node type |
| 1322 | fromType, fromID := parseNodeDirect(from) |
| 1323 | |
| 1324 | if fromType == "" { |
| 1325 | return nil, fmt.Errorf("invalid node format at line %d: %s", actualLineNum, from) |
| 1326 | } |
| 1327 | |
| 1328 | // Collect input names |
| 1329 | if fromType == "INPUT" { |
| 1330 | inputNames[fromID] = true |
| 1331 | } |
| 1332 | } |
| 1333 | |
| 1334 | // Convert to result format |
| 1335 | inputs := []map[string]string{} |
| 1336 | for name := range inputNames { |
| 1337 | inputs = append(inputs, map[string]string{ |
| 1338 | "id": "input." + name, |
| 1339 | "name": name, |
| 1340 | "type": "virtual", // Virtual input node for testing |
| 1341 | }) |
no test coverage detected