AX Commander 비교본 런처 기능 대량 이식
변경 목적: Agent Compare 아래 비교본의 개발 문서와 런처 소스를 기준으로 현재 AX Commander에 빠져 있던 신규 런처 기능을 동일한 흐름으로 옮겨, 비교본 수준의 기능 폭을 현재 제품에 반영했습니다. 핵심 수정사항: 비교본의 신규 런처 핸들러 다수를 src/AxCopilot/Handlers로 이식하고 App.xaml.cs 등록 흐름에 연결했습니다. 빠른 링크, 파일 태그, 알림 센터, 포모도로, 파일 브라우저, 핫키 관리, OCR, 세션/스케줄/매크로, Git/정규식/네트워크/압축/해시/UUID/JWT/QR 등 AX Commander 기능을 추가했습니다. 핵심 수정사항: 신규 기능이 실제 동작하도록 AppSettings 확장, SchedulerService/FileTagService/NotificationCenterService/IconCacheService/UrlTemplateEngine/PomodoroService 추가, 배치 이름변경/세션/스케줄/매크로 편집 창 추가, NotificationService와 Symbols 보강, QR/OCR용 csproj 의존성과 Windows 타겟 프레임워크를 반영했습니다. 문서 반영: README.md와 docs/DEVELOPMENT.md에 비교본 기반 런처 기능 이식 이력과 검증 결과를 업데이트했습니다. 검증 결과: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ 실행 기준 경고 0개, 오류 0개를 확인했습니다.
This commit is contained in:
56
src/AxCopilot/Services/UrlTemplateEngine.cs
Normal file
56
src/AxCopilot/Services/UrlTemplateEngine.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AxCopilot.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Phase L3-4: URL 템플릿 엔진.
|
||||
/// {0}, {1}, {query}, {param} 등의 플레이스홀더를 인자로 치환합니다.
|
||||
/// </summary>
|
||||
public static class UrlTemplateEngine
|
||||
{
|
||||
private static readonly Regex NamedPlaceholder = new(@"\{(\w+)\}", RegexOptions.Compiled);
|
||||
private static readonly Regex IndexedPlaceholder = new(@"\{(\d+)\}", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// URL 템플릿의 플레이스홀더를 args 배열로 치환합니다.
|
||||
/// {0}, {1} — 순서 기반 | {query}, {param} 등 — 첫 번째 인자로 치환
|
||||
/// </summary>
|
||||
public static string Expand(string urlTemplate, params string[] args)
|
||||
{
|
||||
if (string.IsNullOrEmpty(urlTemplate)) return urlTemplate;
|
||||
|
||||
var encoded = args.Select(Uri.EscapeDataString).ToArray();
|
||||
|
||||
// 인덱스 기반: {0}, {1}…
|
||||
var result = IndexedPlaceholder.Replace(urlTemplate, m =>
|
||||
{
|
||||
if (int.TryParse(m.Groups[1].Value, out var idx) && idx < encoded.Length)
|
||||
return encoded[idx];
|
||||
return m.Value;
|
||||
});
|
||||
|
||||
// 이름 기반: {query}, {param}… → 첫 번째 인자로 치환
|
||||
result = NamedPlaceholder.Replace(result, m =>
|
||||
{
|
||||
return encoded.Length > 0 ? encoded[0] : m.Value;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>공백으로 구분된 쿼리 문자열을 파싱하여 템플릿에 적용합니다.</summary>
|
||||
public static string ExpandFromQuery(string urlTemplate, string query)
|
||||
{
|
||||
var parts = query.Trim().Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
return Expand(urlTemplate, parts);
|
||||
}
|
||||
|
||||
/// <summary>템플릿에 포함된 플레이스홀더 목록을 반환합니다.</summary>
|
||||
public static IReadOnlyList<string> GetPlaceholders(string urlTemplate)
|
||||
{
|
||||
var result = new List<string>();
|
||||
foreach (Match m in NamedPlaceholder.Matches(urlTemplate))
|
||||
result.Add(m.Groups[1].Value);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user