diff --git a/app/Http/Controllers/DevTools/FlowTesterController.php b/app/Http/Controllers/DevTools/FlowTesterController.php index 459d9b24..7cc336d9 100644 --- a/app/Http/Controllers/DevTools/FlowTesterController.php +++ b/app/Http/Controllers/DevTools/FlowTesterController.php @@ -124,7 +124,7 @@ public function clone(int $id) } /** - * JSON 유효성 검사 (HTMX) + * JSON 유효성 검사 및 메타 정보 추출 */ public function validateJson(Request $request) { @@ -159,9 +159,38 @@ public function validateJson(Request $request) ]); } + // meta 정보 추출 + $meta = $data['meta'] ?? []; + $tags = $meta['tags'] ?? []; + + // 카테고리 추론: tags[0] 또는 첫 번째 endpoint에서 추출 + $category = $tags[0] ?? null; + if (! $category && ! empty($data['steps'])) { + $firstEndpoint = $data['steps'][0]['endpoint'] ?? ''; + // /item-master/pages → item-master + if (preg_match('#^/([^/]+)#', $firstEndpoint, $matches)) { + $category = $matches[1]; + } + } + + // 이름 추론: meta.name 또는 description 첫 부분 + $name = $meta['name'] ?? null; + if (! $name && ! empty($meta['description'])) { + // 설명의 첫 번째 줄 또는 50자까지 + $name = mb_substr(strtok($meta['description'], "\n"), 0, 50); + } + return response()->json([ 'valid' => true, 'stepCount' => count($data['steps'] ?? []), + 'extracted' => [ + 'name' => $name, + 'description' => $meta['description'] ?? null, + 'category' => $category, + 'author' => $meta['author'] ?? null, + 'tags' => $tags, + 'version' => $data['version'] ?? '1.0', + ], ]); } catch (\JsonException $e) { return response()->json([ diff --git a/resources/views/components/context-menu.blade.php b/resources/views/components/context-menu.blade.php index 2d4d3567..a1af194a 100644 --- a/resources/views/components/context-menu.blade.php +++ b/resources/views/components/context-menu.blade.php @@ -59,17 +59,4 @@ class="w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex i 사용자 수정 - - {{-- 구분선 --}} -
- - \ No newline at end of file diff --git a/resources/views/dev-tools/flow-tester/create.blade.php b/resources/views/dev-tools/flow-tester/create.blade.php index 2adb287b..e43d0633 100644 --- a/resources/views/dev-tools/flow-tester/create.blade.php +++ b/resources/views/dev-tools/flow-tester/create.blade.php @@ -14,22 +14,100 @@ class="p-2 text-gray-600 hover:bg-gray-100 rounded-lg transition">