계층형 메모리 frontmatter에 description 메타를 추가해 rule 파일의 의도와 적용 범위를 /memory 결과에서 함께 읽을 수 있도록 정리했습니다. MemoryTool에 show_scope 액션을 추가해 managed, user, project, local 메모리 파일의 실제 내용을 슬래시 명령으로 직접 확인할 수 있게 했습니다. README와 DEVELOPMENT 문서에 2026-04-07 00:31 (KST) 기준 변경 이력을 반영했고 Release 빌드 경고 0 오류 0을 확인했습니다.
This commit is contained in:
@@ -415,7 +415,8 @@ public class AgentMemoryService
|
||||
Label = label,
|
||||
Path = fullPath,
|
||||
Content = frontMatter.Content.Trim(),
|
||||
Paths = frontMatter.Paths
|
||||
Paths = frontMatter.Paths,
|
||||
Description = frontMatter.Description
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -618,11 +619,31 @@ public class AgentMemoryService
|
||||
}
|
||||
}
|
||||
|
||||
private static (string Content, List<string> Paths) ParseFrontMatter(string content)
|
||||
public string? ReadInstructionFile(string scope, string? workFolder)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
var path = GetWritableInstructionPath(scope, workFolder);
|
||||
if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
return File.ReadAllText(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogService.Warn($"메모리 파일 읽기 실패 ({path}): {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static (string Content, List<string> Paths, string Description) ParseFrontMatter(string content)
|
||||
{
|
||||
var lines = content.Replace("\r\n", "\n").Split('\n').ToList();
|
||||
if (lines.Count < 3 || !string.Equals(lines[0].Trim(), "---", StringComparison.Ordinal))
|
||||
return (content, new List<string>());
|
||||
return (content, new List<string>(), "");
|
||||
|
||||
var endIndex = -1;
|
||||
for (var i = 1; i < lines.Count; i++)
|
||||
@@ -635,13 +656,20 @@ public class AgentMemoryService
|
||||
}
|
||||
|
||||
if (endIndex < 1)
|
||||
return (content, new List<string>());
|
||||
return (content, new List<string>(), "");
|
||||
|
||||
var paths = new List<string>();
|
||||
var description = "";
|
||||
var inPaths = false;
|
||||
for (var i = 1; i < endIndex; i++)
|
||||
{
|
||||
var line = lines[i].Trim();
|
||||
if (line.StartsWith("description:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
description = line["description:".Length..].Trim().Trim('"');
|
||||
inPaths = false;
|
||||
continue;
|
||||
}
|
||||
if (line.StartsWith("paths:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
inPaths = true;
|
||||
@@ -664,7 +692,7 @@ public class AgentMemoryService
|
||||
}
|
||||
|
||||
var stripped = string.Join("\n", lines.Skip(endIndex + 1)).Trim();
|
||||
return (stripped, paths);
|
||||
return (stripped, paths, description);
|
||||
}
|
||||
|
||||
private static bool ShouldApplyToCurrentWorkFolder(IReadOnlyList<string> patterns, string? projectRoot, string? currentWorkFolder)
|
||||
@@ -773,4 +801,7 @@ public class MemoryInstructionDocument
|
||||
|
||||
[JsonPropertyName("paths")]
|
||||
public List<string> Paths { get; set; } = new();
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string Description { get; set; } = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user