변경 목적: 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개를 확인했습니다.
131 lines
4.9 KiB
C#
131 lines
4.9 KiB
C#
using AxCopilot.SDK;
|
|
using AxCopilot.Services;
|
|
using AxCopilot.Themes;
|
|
|
|
namespace AxCopilot.Handlers;
|
|
|
|
/// <summary>
|
|
/// Phase L3-9: 뽀모도로 타이머 핸들러. "pomo" 프리픽스로 사용합니다.
|
|
///
|
|
/// 사용법:
|
|
/// pomo → 현재 타이머 상태 표시
|
|
/// pomo start → 집중 타이머 시작 (25분)
|
|
/// pomo break → 휴식 타이머 시작 (5분)
|
|
/// pomo stop → 타이머 중지
|
|
/// pomo reset → 타이머 초기화
|
|
///
|
|
/// Enter → 해당 명령 실행.
|
|
/// </summary>
|
|
public class PomoHandler : IActionHandler
|
|
{
|
|
public string? Prefix => "pomo";
|
|
|
|
public PluginMetadata Metadata => new(
|
|
"Pomodoro",
|
|
"뽀모도로 타이머 — pomo",
|
|
"1.0",
|
|
"AX",
|
|
"집중/휴식 타이머를 관리합니다.");
|
|
|
|
public Task<IEnumerable<LauncherItem>> GetItemsAsync(string query, CancellationToken ct)
|
|
{
|
|
var q = query.Trim().ToLowerInvariant();
|
|
var svc = PomodoroService.Instance;
|
|
var items = new List<LauncherItem>();
|
|
|
|
// ─── 명령 분기 ────────────────────────────────────────────────────────
|
|
|
|
if (q is "start" or "focus")
|
|
{
|
|
items.Add(new LauncherItem("집중 타이머 시작",
|
|
$"{svc.FocusMinutes}분 집중 모드 시작 · Enter로 실행",
|
|
null, "__START__", Symbol: Symbols.Timer));
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
if (q is "break" or "rest")
|
|
{
|
|
items.Add(new LauncherItem("휴식 타이머 시작",
|
|
$"{svc.BreakMinutes}분 휴식 모드 시작 · Enter로 실행",
|
|
null, "__BREAK__", Symbol: Symbols.Timer));
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
if (q is "stop" or "pause")
|
|
{
|
|
items.Add(new LauncherItem("타이머 중지",
|
|
"현재 타이머를 중지합니다 · Enter로 실행",
|
|
null, "__STOP__", Symbol: Symbols.MediaPlay));
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
if (q == "reset")
|
|
{
|
|
items.Add(new LauncherItem("타이머 초기화",
|
|
"타이머를 처음 상태로 초기화합니다 · Enter로 실행",
|
|
null, "__RESET__", Symbol: Symbols.Restart));
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
// ─── 기본: 현재 상태 + 명령 목록 ─────────────────────────────────────
|
|
|
|
var remaining = svc.Remaining;
|
|
var timeStr = $"{(int)remaining.TotalMinutes:D2}:{remaining.Seconds:D2}";
|
|
var stateStr = svc.Mode switch
|
|
{
|
|
PomodoroMode.Focus => svc.IsRunning ? $"집중 중 {timeStr} 남음" : $"집중 일시정지 {timeStr} 남음",
|
|
PomodoroMode.Break => svc.IsRunning ? $"휴식 중 {timeStr} 남음" : $"휴식 일시정지 {timeStr} 남음",
|
|
_ => "대기 중",
|
|
};
|
|
|
|
// 상태 카드
|
|
items.Add(new LauncherItem(
|
|
"🍅 뽀모도로 타이머",
|
|
stateStr,
|
|
null, null, Symbol: Symbols.Timer));
|
|
|
|
// 빠른 명령들
|
|
if (!svc.IsRunning)
|
|
{
|
|
items.Add(new LauncherItem("집중 시작",
|
|
$"{svc.FocusMinutes}분 집중 모드 시작 · Enter로 실행",
|
|
null, "__START__", Symbol: Symbols.Timer));
|
|
}
|
|
else
|
|
{
|
|
items.Add(new LauncherItem("타이머 중지",
|
|
"현재 타이머를 중지합니다 · Enter로 실행",
|
|
null, "__STOP__", Symbol: Symbols.MediaPlay));
|
|
}
|
|
|
|
if (svc.Mode == PomodoroMode.Focus && svc.IsRunning)
|
|
{
|
|
items.Add(new LauncherItem("휴식 시작",
|
|
$"{svc.BreakMinutes}분 휴식 모드로 전환 · Enter로 실행",
|
|
null, "__BREAK__", Symbol: Symbols.Timer));
|
|
}
|
|
|
|
items.Add(new LauncherItem("타이머 초기화",
|
|
"타이머를 처음 상태로 초기화합니다 · Enter로 실행",
|
|
null, "__RESET__", Symbol: Symbols.Restart));
|
|
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
public Task ExecuteAsync(LauncherItem item, CancellationToken ct)
|
|
{
|
|
if (item.Data is not string cmd) return Task.CompletedTask;
|
|
|
|
var svc = PomodoroService.Instance;
|
|
switch (cmd)
|
|
{
|
|
case "__START__": svc.StartFocus(); break;
|
|
case "__BREAK__": svc.StartBreak(); break;
|
|
case "__STOP__": svc.Stop(); break;
|
|
case "__RESET__": svc.Reset(); break;
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|