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:
127
src/AxCopilot/Handlers/QuickLinkHandler.cs
Normal file
127
src/AxCopilot/Handlers/QuickLinkHandler.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
using AxCopilot.SDK;
|
||||
using AxCopilot.Services;
|
||||
using AxCopilot.Themes;
|
||||
|
||||
namespace AxCopilot.Handlers;
|
||||
|
||||
/// <summary>
|
||||
/// Phase L3-4: 파라미터 퀵링크 핸들러. "ql" 예약어로 사용합니다.
|
||||
/// 예: ql maps 강남역 → "maps" 키워드 URL에 "강남역" 치환 후 열기
|
||||
/// ql jira PROJ-1234 → "jira" 키워드 URL에 티켓 번호 치환
|
||||
/// ql (목록) → 등록된 퀵링크 목록 표시
|
||||
///
|
||||
/// 퀵링크는 설정 → 일반 → 퀵링크 탭에서 등록합니다.
|
||||
/// </summary>
|
||||
public class QuickLinkHandler : IActionHandler
|
||||
{
|
||||
private readonly SettingsService _settings;
|
||||
|
||||
public string? Prefix => "ql";
|
||||
|
||||
public PluginMetadata Metadata => new(
|
||||
"QuickLink",
|
||||
"파라미터 퀵링크 — ql [키워드] [인자]",
|
||||
"1.0",
|
||||
"AX");
|
||||
|
||||
public QuickLinkHandler(SettingsService settings) => _settings = settings;
|
||||
|
||||
public Task<IEnumerable<LauncherItem>> GetItemsAsync(string query, CancellationToken ct)
|
||||
{
|
||||
var links = _settings.Settings.QuickLinks;
|
||||
|
||||
// 등록된 퀵링크 없음
|
||||
if (links.Count == 0)
|
||||
{
|
||||
return Task.FromResult<IEnumerable<LauncherItem>>(
|
||||
[
|
||||
new LauncherItem(
|
||||
"등록된 퀵링크 없음",
|
||||
"설정 → 일반 → 퀵링크에서 추가하세요. 예: keyword=maps, url=https://map.naver.com/p/search/{0}",
|
||||
null, null, Symbol: Symbols.Globe)
|
||||
]);
|
||||
}
|
||||
|
||||
var items = new List<LauncherItem>();
|
||||
var parts = query.Trim().Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (parts.Length == 0)
|
||||
{
|
||||
// 쿼리 없음 — 전체 목록 표시
|
||||
foreach (var link in links)
|
||||
{
|
||||
items.Add(new LauncherItem(
|
||||
link.Name.Length > 0 ? link.Name : link.Keyword,
|
||||
$"ql {link.Keyword} [인자] · {link.Description} · {link.UrlTemplate}",
|
||||
null, null, Symbol: Symbols.Globe));
|
||||
}
|
||||
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
||||
}
|
||||
|
||||
var keyword = parts[0].ToLowerInvariant();
|
||||
var argQuery = parts.Length > 1 ? parts[1] : "";
|
||||
|
||||
// 키워드로 정확 일치 검색
|
||||
var matched = links.Where(l => l.Keyword.ToLowerInvariant() == keyword).ToList();
|
||||
|
||||
if (matched.Count > 0 && !string.IsNullOrWhiteSpace(argQuery))
|
||||
{
|
||||
// 인자가 있으면 URL 치환 후 실행 항목 생성
|
||||
foreach (var link in matched)
|
||||
{
|
||||
var url = UrlTemplateEngine.ExpandFromQuery(link.UrlTemplate, argQuery);
|
||||
items.Add(new LauncherItem(
|
||||
$"{(link.Name.Length > 0 ? link.Name : link.Keyword)}: {argQuery}",
|
||||
url,
|
||||
null, url, Symbol: Symbols.Globe));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 키워드 퍼지 검색 (부분 일치)
|
||||
var fuzzy = links
|
||||
.Where(l => l.Keyword.Contains(keyword, StringComparison.OrdinalIgnoreCase) ||
|
||||
l.Name.Contains(keyword, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
if (fuzzy.Count == 0)
|
||||
{
|
||||
items.Add(new LauncherItem(
|
||||
$"'{keyword}'에 해당하는 퀵링크 없음",
|
||||
"설정에서 새 퀵링크를 추가하세요",
|
||||
null, null, Symbol: Symbols.Globe));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var link in fuzzy)
|
||||
{
|
||||
var hint = UrlTemplateEngine.GetPlaceholders(link.UrlTemplate);
|
||||
var ph = hint.Count > 0 ? $" · 인자: {string.Join(", ", hint)}" : "";
|
||||
items.Add(new LauncherItem(
|
||||
$"ql {link.Keyword}{ph}",
|
||||
link.Description.Length > 0 ? link.Description : link.UrlTemplate,
|
||||
null, null, Symbol: Symbols.Globe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
||||
}
|
||||
|
||||
public Task ExecuteAsync(LauncherItem item, CancellationToken ct)
|
||||
{
|
||||
if (item.Data is string url && !string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(
|
||||
new System.Diagnostics.ProcessStartInfo(url) { UseShellExecute = true });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogService.Warn($"퀵링크 열기 실패: {ex.Message}");
|
||||
}
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user