Skip to content

feat: convert convention and validation with llm#8

Merged
sehwan505 merged 26 commits intomainfrom
feature/convert-convention
Nov 12, 2025
Merged

feat: convert convention and validation with llm#8
sehwan505 merged 26 commits intomainfrom
feature/convert-convention

Conversation

@sehwan505
Copy link
Copy Markdown
Contributor

1. Convert: 자연어 → Linter 설정 자동 변환

  • LLM(GPT-4o-mini)으로 자연어 규칙을 ESLint/Checkstyle/PMD 설정으로 변환
  • Goroutine worker pool(5개)로 병렬 처리 → 3-4배 성능 향상
  • 간단한 규칙은 Linter로, 복잡한 규칙은 LLM Validator로 자동 할당

2. Validate: LLM 기반 코드 검증

  • Git diff 기반 변경 코드만 검증
  • Linter + LLM Validator 다층 검증
  • 위반사항, severity, 개선 제안 리포트

3. MCP 서버 자동 설정

  • user-policy.json 없음 → Dashboard 안내
  • code-policy.json 없음 → 자동 변환 실행
  • 둘 다 존재 → MCP 서버 시작
  • query_conventions, validate_code 도구 제공

sehwan505 and others added 19 commits November 3, 2025 19:24
- Remove fallback inference logic (fail fast on LLM errors)
- Remove conversion report generation
- Remove verbose logging from converter
- Add validation scripts for eslint and checkstyle
- Add linter validation documentation
- Simplify converter interface (remove verbose parameter)
- Reduce inference.go from 311 to 160 lines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sehwan505 sehwan505 requested a review from Copilot November 5, 2025 03:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive E2E testing infrastructure and multi-target linter conversion capabilities to Symphony CLI. It introduces LLM-powered validation for complex coding conventions, automated conversion of natural language policies to multiple linter configurations (ESLint, Checkstyle, PMD), and extensive test coverage for the validation workflow.

  • LLM-powered validator for code changes using OpenAI API
  • Multi-target converter supporting ESLint, Checkstyle, and PMD with intelligent rule inference
  • Comprehensive E2E and unit tests covering validation, conversion, and MCP integration workflows

Reviewed Changes

Copilot reviewed 37 out of 39 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
tests/e2e/validator_test.go E2E tests for LLM validator with policy loading and code validation
tests/e2e/unit_workflow_test.go Unit tests for policy parsing, diff extraction, and workflow steps
tests/e2e/mcp_integration_test.go MCP integration tests for convention queries and AI code validation
tests/e2e/full_workflow_test.go Full workflow tests from policy creation to validation
tests/e2e/examples/*.js Good and bad code examples for validation testing
internal/validator/*.go LLM validator implementation with git diff extraction
internal/llm/*.go LLM client and inference engine for rule analysis
internal/converter/linters/*.go Multi-linter converters (ESLint, Checkstyle, PMD)
internal/cmd/*.go Enhanced CLI commands for convert, validate, and MCP
docs/*.md Comprehensive documentation for features and usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,202 @@
package e2e_test

Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 109 contains a malformed diff header. The line number '0' is invalid - it should start at 1. This will cause the diff extraction to fail.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,60 @@
package validator

Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 17 contains a malformed diff header with line number '0' instead of a valid line number. This will break diff parsing and should be corrected to match the actual diff format.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,146 @@
package validator

Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 12 has an invalid diff header with line number '0'. Diff headers should have valid line numbers starting from 1, otherwise the ExtractAddedLines function may not work correctly.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,60 @@
package validator

Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another occurrence of invalid line number '0' in diff header at line 29. This pattern appears multiple times and should be fixed to ensure proper diff parsing.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,60 @@
package validator

Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid line number '0' in diff header at line 48. This should use a valid line number to represent the proper git diff format.

Copilot uses AI. Check for mistakes.

// GOOD: STYLE-002 - Consistent single quotes
const message = 'Hello, World!';
const greeting = 'Welcome';
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable greeting.

Copilot uses AI. Check for mistakes.
const greeting = 'Welcome';

// GOOD: STYLE-003 - Using const for non-reassigned variables
function processItems(items) {
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function processItems.

Copilot uses AI. Check for mistakes.
}

// GOOD: PERF-001 - Using async/await instead of nested promises
async function getUserProfile(userId) {
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function getUserProfile.

Copilot uses AI. Check for mistakes.
// GOOD: SEC-003 - Sanitizing HTML before rendering
import DOMPurify from 'dompurify';

function SafeComponent({ htmlContent }) {
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function SafeComponent.

Copilot uses AI. Check for mistakes.
}

// UI component with minimal logic
function UserDashboard({ userId }) {
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function UserDashboard.

Copilot uses AI. Check for mistakes.
@sehwan505 sehwan505 force-pushed the feature/convert-convention branch from 8cf56f4 to a0d85ff Compare November 10, 2025 06:39
@sehwan505 sehwan505 merged commit 28882f3 into main Nov 12, 2025
2 checks passed
@sehwan505 sehwan505 deleted the feature/convert-convention branch December 10, 2025 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants