개발언어 워크플로 힌트와 문서 품질 출력 경로를 고도화한다
- CodeLanguageCatalog에 manifest/build/test/lint 조회 API와 workflow summary 조합기를 추가해 no-LSP fallback과 컨텍스트 생성이 같은 힌트 소스를 재사용하도록 정리한다. - WorkspaceContextGenerator에 Language Workflow 섹션을 추가해 상위 언어의 실행 힌트를 .ax-context.md에 기록하고, HtmlSkill/ExcelSkill은 공통 ArtifactQualityOutputFormatter로 품질 요약과 repair guide를 일관되게 출력하도록 맞춘다. - README.md, docs/DEVELOPMENT.md, docs/NEXT_ROADMAP.md를 2026-04-15 09:49 (KST) 기준으로 갱신하고, CodeLanguageCatalogTests 및 WorkspaceContextGeneratorTests를 확장해 빌드 경고 0/오류 0과 관련 테스트 35건 통과를 확인한다.
This commit is contained in:
@@ -57,4 +57,24 @@ public class CodeLanguageCatalogTests
|
||||
summary.Should().Contain("go build ./...");
|
||||
summary.Should().Contain("go test ./...");
|
||||
}
|
||||
[Fact]
|
||||
public void BuildWorkflowSummary_ShouldExposeActionableWorkflowHints()
|
||||
{
|
||||
var summary = CodeLanguageCatalog.BuildWorkflowSummary("rust");
|
||||
|
||||
summary.Should().Contain("Rust");
|
||||
summary.Should().Contain("Cargo.toml");
|
||||
summary.Should().Contain("cargo build");
|
||||
summary.Should().Contain("cargo test");
|
||||
summary.Should().Contain("cargo clippy");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HintLookups_ShouldReturnLanguageSpecificEntries()
|
||||
{
|
||||
CodeLanguageCatalog.GetManifestHints("python").Should().Contain("pyproject.toml");
|
||||
CodeLanguageCatalog.GetBuildHints("go").Should().Contain("go build ./...");
|
||||
CodeLanguageCatalog.GetTestHints("kotlin").Should().Contain("./gradlew test");
|
||||
CodeLanguageCatalog.GetLintHints("javascript").Should().Contain("eslint .");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,4 +315,27 @@ public class WorkspaceContextGeneratorTests
|
||||
Directory.Delete(tempDir, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GenerateAsync_IncludesLanguageWorkflowHints()
|
||||
{
|
||||
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(tempDir);
|
||||
try
|
||||
{
|
||||
File.WriteAllText(Path.Combine(tempDir, "Cargo.toml"), "[package]\nname='sample'");
|
||||
File.WriteAllText(Path.Combine(tempDir, "main.rs"), "fn main() {}");
|
||||
|
||||
var result = await WorkspaceContextGenerator.GenerateAsync(tempDir);
|
||||
|
||||
result.Should().Contain("## Language Workflow");
|
||||
result.Should().Contain("Rust:");
|
||||
result.Should().Contain("Cargo.toml");
|
||||
result.Should().Contain("cargo build");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Directory.Delete(tempDir, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace AxCopilot.Services.Agent;
|
||||
|
||||
public static class ArtifactQualityOutputFormatter
|
||||
{
|
||||
public static IReadOnlyList<string> BuildLines(ArtifactQualityReport review)
|
||||
=> [review.ToToolSummary(), ArtifactRepairGuideService.BuildGuide(review)];
|
||||
|
||||
public static IReadOnlyList<string> BuildLines(DeckQualityReport review)
|
||||
=> [review.ToToolSummary(), DeckRepairGuideService.BuildGuide(review)];
|
||||
}
|
||||
@@ -222,8 +222,8 @@ public class ExcelSkill : IAgentTool
|
||||
false,
|
||||
false,
|
||||
false));
|
||||
features += $"\n{review.ToToolSummary()}";
|
||||
features += $"\n{ArtifactRepairGuideService.BuildGuide(review)}";
|
||||
foreach (var line in ArtifactQualityOutputFormatter.BuildLines(review))
|
||||
features += $"\n{line}";
|
||||
|
||||
return ToolResult.Ok(
|
||||
$"Excel 파일 생성 완료: {fullPath}\n시트: {sheetName}, 열: {colCount}, 행: {rowCount}{features}",
|
||||
@@ -333,8 +333,8 @@ public class ExcelSkill : IAgentTool
|
||||
HasSummaryItems(summarySheet, "scorecards") || HasSummaryItems(summarySheet, "cards") || HasSummaryItems(summarySheet, "kpis") || HasSummaryItems(summarySheet, "trend_series") || HasSummaryItems(summarySheet, "dashboard_tiles") || HasSummaryItems(summarySheet, "variance_series"),
|
||||
HasStructuredSummaryContent(summarySheet, "decision_summary"),
|
||||
HasSummaryItems(summarySheet, "sheet_summaries")));
|
||||
features += $"\n{review.ToToolSummary()}";
|
||||
features += $"\n{ArtifactRepairGuideService.BuildGuide(review)}";
|
||||
foreach (var line in ArtifactQualityOutputFormatter.BuildLines(review))
|
||||
features += $"\n{line}";
|
||||
|
||||
return ToolResult.Ok(
|
||||
$"Excel ?뚯씪 ?앹꽦 ?꾨즺: {fullPath}\n?쒗듃: {summaryName}, {sheetName}, ?? {colCount}, ?? {rowCount}{features} [?붿빟 ?쒗듃]",
|
||||
|
||||
@@ -308,8 +308,8 @@ public class HtmlSkill : IAgentTool
|
||||
useToc,
|
||||
usePrint,
|
||||
!string.IsNullOrWhiteSpace(printHeader) || !string.IsNullOrWhiteSpace(printFooter));
|
||||
featureStr += $"\n{review.ToToolSummary()}";
|
||||
featureStr += $"\n{ArtifactRepairGuideService.BuildGuide(review)}";
|
||||
foreach (var line in ArtifactQualityOutputFormatter.BuildLines(review))
|
||||
featureStr += $"\n{line}";
|
||||
|
||||
return ToolResult.Ok(
|
||||
$"HTML 문서 생성 완료: {fullPath} (디자인: {mood}{featureStr})",
|
||||
|
||||
@@ -94,6 +94,15 @@ internal static class WorkspaceContextGenerator
|
||||
}
|
||||
|
||||
// 4. 기존 컨텍스트 파일 감지
|
||||
var workflowGuidance = BuildLanguageWorkflow(extDist);
|
||||
if (workflowGuidance.Count > 0)
|
||||
{
|
||||
sb.AppendLine("## Language Workflow");
|
||||
foreach (var line in workflowGuidance)
|
||||
sb.AppendLine($"- {line}");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
var contextFiles = DetectContextFiles(workFolder);
|
||||
if (contextFiles.Count > 0)
|
||||
{
|
||||
@@ -440,6 +449,28 @@ internal static class WorkspaceContextGenerator
|
||||
.Select(x => $"{x.Language}: {x.Count} file(s)")
|
||||
.ToList();
|
||||
|
||||
private static List<string> BuildLanguageWorkflow(List<KeyValuePair<string, int>> extDist)
|
||||
{
|
||||
var workflow = new List<string>();
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var (extension, _) in extDist)
|
||||
{
|
||||
var capability = Services.CodeLanguageCatalog.FindByExtension(extension);
|
||||
if (capability == null || !seen.Add(capability.Key))
|
||||
continue;
|
||||
|
||||
var summary = Services.CodeLanguageCatalog.BuildWorkflowSummary(capability.Key);
|
||||
if (!string.IsNullOrWhiteSpace(summary))
|
||||
workflow.Add(summary);
|
||||
|
||||
if (workflow.Count >= 3)
|
||||
break;
|
||||
}
|
||||
|
||||
return workflow;
|
||||
}
|
||||
|
||||
private static async Task<(string? Branch, string? Remote)> GetGitInfoAsync(
|
||||
string folder, CancellationToken ct)
|
||||
{
|
||||
|
||||
@@ -380,6 +380,72 @@ public static class CodeLanguageCatalog
|
||||
sb.Append(BuildLspSupportDescription());
|
||||
return sb.ToString();
|
||||
}
|
||||
public static IReadOnlyList<string> GetManifestHints(string? key)
|
||||
{
|
||||
var normalizedKey = FindByKey(key)?.Key;
|
||||
if (string.IsNullOrWhiteSpace(normalizedKey))
|
||||
return [];
|
||||
|
||||
return s_manifestHints.TryGetValue(normalizedKey, out var hints)
|
||||
? hints
|
||||
: [];
|
||||
}
|
||||
|
||||
public static IReadOnlyList<string> GetBuildHints(string? key)
|
||||
{
|
||||
var normalizedKey = FindByKey(key)?.Key;
|
||||
if (string.IsNullOrWhiteSpace(normalizedKey))
|
||||
return [];
|
||||
|
||||
return s_buildHints.TryGetValue(normalizedKey, out var hints)
|
||||
? hints
|
||||
: [];
|
||||
}
|
||||
|
||||
public static IReadOnlyList<string> GetTestHints(string? key)
|
||||
{
|
||||
var normalizedKey = FindByKey(key)?.Key;
|
||||
if (string.IsNullOrWhiteSpace(normalizedKey))
|
||||
return [];
|
||||
|
||||
return s_testHints.TryGetValue(normalizedKey, out var hints)
|
||||
? hints
|
||||
: [];
|
||||
}
|
||||
|
||||
public static IReadOnlyList<string> GetLintHints(string? key)
|
||||
{
|
||||
var normalizedKey = FindByKey(key)?.Key;
|
||||
if (string.IsNullOrWhiteSpace(normalizedKey))
|
||||
return [];
|
||||
|
||||
return s_lintHints.TryGetValue(normalizedKey, out var hints)
|
||||
? hints
|
||||
: [];
|
||||
}
|
||||
|
||||
public static string BuildWorkflowSummary(string? key, int maxHintsPerKind = 2)
|
||||
{
|
||||
var capability = FindByKey(key);
|
||||
if (capability == null)
|
||||
return string.Empty;
|
||||
|
||||
var parts = new List<string>();
|
||||
AppendHintBlock(parts, "manifests", GetManifestHints(capability.Key), maxHintsPerKind);
|
||||
AppendHintBlock(parts, "build", GetBuildHints(capability.Key), maxHintsPerKind);
|
||||
AppendHintBlock(parts, "test", GetTestHints(capability.Key), maxHintsPerKind);
|
||||
AppendHintBlock(parts, "lint", GetLintHints(capability.Key), maxHintsPerKind);
|
||||
|
||||
var primaryGuidance = capability.Guidance.FirstOrDefault();
|
||||
if (!string.IsNullOrWhiteSpace(primaryGuidance))
|
||||
parts.Add("focus: " + primaryGuidance);
|
||||
|
||||
if (parts.Count == 0)
|
||||
return capability.DisplayName;
|
||||
|
||||
return $"{capability.DisplayName}: {string.Join(" | ", parts)}";
|
||||
}
|
||||
|
||||
public static string BuildFallbackSupportDescription()
|
||||
=> "LSP 서버가 없거나 연결되지 않아도 확장자, 매니페스트, build/test/lint 힌트 기반의 정적 분석을 계속 제공합니다.";
|
||||
|
||||
@@ -417,4 +483,19 @@ public static class CodeLanguageCatalog
|
||||
|
||||
return sb.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
private static void AppendHintBlock(List<string> parts, string label, IReadOnlyList<string> hints, int maxHintsPerKind)
|
||||
{
|
||||
if (hints.Count == 0)
|
||||
return;
|
||||
|
||||
var limited = hints
|
||||
.Where(hint => !string.IsNullOrWhiteSpace(hint))
|
||||
.Take(Math.Max(1, maxHintsPerKind))
|
||||
.ToList();
|
||||
if (limited.Count == 0)
|
||||
return;
|
||||
|
||||
parts.Add($"{label}: {string.Join(", ", limited)}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user