Commit Graph

331 Commits

Author SHA1 Message Date
Mika Kuns
df132e8be1 style(ui): redesign TaskDetailView with editable fields, tag chips, and accent styling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:30:17 +02:00
Mika Kuns
eb7c1ebf69 style(ui): redesign task rows with checkboxes, inline add field, remove toolbar
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:29:44 +02:00
Mika Kuns
2d6b5bbaff style(ui): redesign MainWindow with reactive layout, sidebar polish, and list header
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:27:49 +02:00
Mika Kuns
5b6c095a89 fix(di): register TagRepository in TaskDetailViewModel constructor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:25:22 +02:00
Mika Kuns
f51278e1aa feat(ui): wire TaskDetail changes back to task list refresh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:25:16 +02:00
Mika Kuns
28a0d9b11f feat(ui): make TaskDetailViewModel editable with auto-save and tag CRUD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:24:10 +02:00
Mika Kuns
a4da2e23a1 feat(ui): add inline task creation, toggle-done, and list name to TaskListViewModel
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:23:58 +02:00
Mika Kuns
0796b3c2d5 feat(ui): add ToggleDone command and checkbox state to TaskItemViewModel 2026-04-14 10:21:47 +02:00
Mika Kuns
3c52e9c67f feat(ui): add colored dot brush to ListItemViewModel
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 10:20:59 +02:00
Mika Kuns
d8c628c15a style: add Forest Teal accent resources and force dark theme
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 10:20:58 +02:00
Mika Kuns
a548d41d18 feat(ui): add CheckboxBorderConverter for task status circles
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 10:20:22 +02:00
Mika Kuns
9f61cd1449 docs: add UX redesign implementation plan (16 tasks)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 10:07:13 +02:00
Mika Kuns
0e41c37d37 docs: add UX redesign spec (Microsoft To Do style)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 09:54:45 +02:00
Mika Kuns
473e0f71d5 fix(ui): re-evaluate RunNow CanExecute when worker connection changes
Subscribe to WorkerClient.PropertyChanged in TaskListViewModel and call
NotifyCanExecuteChanged on every TaskItemViewModel.RunNowCommand when
IsConnected flips, so the button enables immediately on reconnect without
waiting for the next task DB refresh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:46:10 +02:00
Mika Kuns
981b8e4a3d fix(ui): make list and task rows fully hit-testable for clicks
Add Background="Transparent" and HorizontalAlignment="Stretch" to the
DataTemplate roots in MainWindow.axaml and TaskListView.axaml so that
DoubleTapped, PointerPressed and ContextFlyout fire reliably across the
entire row surface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:41:23 +02:00
Mika Kuns
7838f081dd refactor(ui): harden context menu event handling and simplify bindings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:16:09 +02:00
Mika Kuns
5d5a583af0 fix(ui): context menu operates on right-clicked item and gates new-task on list selection
- Add PointerPressed handlers on list/task item templates that set SelectedList/SelectedTask on right-click before the ContextFlyout opens
- Add CanAddTask guard and NotifyCanExecuteChangedFor on CurrentListId so Add Task menu item is disabled when no list is selected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:11:34 +02:00
Mika Kuns
3653dcad01 feat(ui): add context menus for lists and tasks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:07:14 +02:00
Mika Kuns
6727cc4e9d refactor(ui): harden double-click edit handlers
Remove redundant SelectedList/SelectedTask assignments (single-tap already
updated selection via binding) and CanExecute guards (always true for
unconditional [RelayCommand]). Set e.Handled = true to stop DoubleTapped
from bubbling to the ListBox.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:04:19 +02:00
Mika Kuns
db5a447b12 feat(ui): open editor on double-click for lists and tasks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 14:57:20 +02:00
Mika Kuns
fdf357be8a fix(ui): harden worker auto-reconnect lifecycle
- Fix _startCts lifecycle leak: old CTS is cancelled and disposed before replacement
- Guard StartAsync re-entrancy: early-return if retry loop is still running (lock + IsCompleted check)
- Await _retryLoopTask in both StopAsync and DisposeAsync before stopping/disposing the hub

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 14:50:34 +02:00
Mika Kuns
36ef624c51 fix(ui): cancel retry loop before disposing worker connection
Add _startCts?.Cancel() at the top of DisposeAsync to prevent
ConnectWithRetryAsync from calling _hub.StartAsync on an already-disposed
HubConnection when the caller disposes without first calling StopAsync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 14:46:46 +02:00
Mika Kuns
c6522cf8c1 fix(ui): auto-reconnect worker connection with retry backoff
Add IndefiniteRetryPolicy for WithAutomaticReconnect, wrap initial
StartAsync in a retry loop so the UI keeps retrying when Worker is
offline at startup, and expose IsReconnecting to StatusBar
("Connecting..." / "Online" / "Offline").
2026-04-13 14:40:36 +02:00
Mika Kuns
48e4aabeb1 feat(ui): wire avalonia desktop ui to data and worker
App: build a ServiceProvider in Program.cs (AppSettings, SqliteConnectionFactory,
all repositories, GitService, WorkerClient, all view-models), apply schema, then
hand control to Avalonia. App.OnFrameworkInitializationCompleted resolves
MainWindowViewModel from the container.

Ui:
- AppSettings POCO loaded from ~/.todo-app/ui.config.json (db path, hub url).
- WorkerClient wraps HubConnection with auto-reconnect, exposes IsConnected and
  ActiveTasks plus C# events for TaskStarted/Finished/Message/Updated and
  WorktreeUpdated; all inbound events are marshalled to the UI thread.
- ViewModels: MainWindow (lists CRUD via ListEditor dialog), TaskList (load by
  list, add/edit/delete, auto WakeQueue on agent+queued create), TaskItem
  (RunNow gated on connection + status), TaskDetail (description, result, live
  ndjson rolling buffer of 500 lines, worktree branch/diff with merge/keep/
  discard via GitService), StatusBar, ListEditor, TaskEditor.
- Views: 3-pane MainWindow (lists | tasks | detail) with GridSplitters, status
  bar, dialog windows for the editors. Status badges via StatusColorConverter.
- Markdown rendering, folder picker, delete-confirmation, settings dialog and
  scroll-to-bottom on the live log are intentionally TODO -- functional
  scaffold only.

Tests: also debounce the FIFO queue test (poll instead of Task.Delay(200)) so
the assertion isn't racy when the suite runs alongside the slower git tests.
38 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:01:03 +02:00
Mika Kuns
01235d986f feat(worker,data): add git worktree support and conventional commits
GitService (in ClaudeDo.Data so the UI can reuse it) wraps the git CLI:
IsGitRepo, RevParseHead, WorktreeAdd/Remove, HasChanges, AddAll, Commit
(multi-line via -F -), DiffStat, BranchDelete, MergeFfOnly. Throws with
stderr on failure.

WorktreeManager owns the per-task lifecycle: validate working_dir is a
git repo (throws if not, no DB row written), create the worktree at
<repo>/../.claudedo-worktrees/<slug>/<id>/ (or central root per config),
insert the worktrees row. CommitIfChangedAsync skips when there are no
changes, otherwise commits and updates head_commit + diff_stat.

CommitMessageBuilder produces "{type}({list-slug}): {title<=60}" with a
blank-line-separated description (truncated to 400) and a permanent
"ClaudeDo-Task: <id>" trailer. Slug normalises whitespace + strips
non-alphanumerics. Newlines hard-coded to \n so git on Windows doesn't
choke on \r\n.

TaskRunner branches on list.WorkingDir: worktree path runs Claude in the
worktree, commits on success, broadcasts WorktreeUpdated; failure leaves
the worktree row active for inspection. Sandbox path unchanged.

Tests: 38 pass (12 new). GitRepoFixture spins up a real temp repo with a
seed commit; tests skip gracefully if `git` isn't on PATH.
CommitMessageBuilder fully unit-tested. WorktreeManager covers create,
no-change skip, real-commit, and non-repo failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:29:26 +02:00
Mika Kuns
e5038d7e16 feat(worker): add claude-cli runner, queue service, and hub api
Runner stack (non-worktree path): IClaudeProcess + ClaudeProcess spawning the
CLI with --output-format stream-json, prompt via stdin, parses the final
type:"result" line into RunResult. LogWriter appends ndjson to
~/.todo-app/logs/<taskId>.ndjson. TaskRunner orchestrates DB transitions
(MarkRunning -> MarkDone/Failed) and pushes TaskStarted/Message/Finished/
Updated via HubBroadcaster. Worktree-backed lists short-circuit with a
"Slice E" failure message until git support lands.

QueueService (BackgroundService) holds two in-memory slots (_queueSlot +
_overrideSlot) guarded by a lock. Uses PeriodicTimer + SemaphoreSlim wake
signal so WakeQueue() triggers an instant pickup. RunNow throws
InvalidOperationException when override busy; CancelTask cancels the linked
CTS which kills the child process tree.

WorkerHub extended with GetActive, RunNow (translated to HubException
variants), CancelTask, WakeQueue. HubBroadcaster exposes typed push methods.

Tests: 26 pass (12 new). QueueServiceTests cover override-busy,
schedule-filter, FIFO sequentiality, cancellation, plus a FakeClaudeProcess
that blocks on a TCS for deterministic slot-state assertions.
MessageParserTests cover result extraction + malformed/non-result lines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:14:00 +02:00
Mika Kuns
9f51ff0b17 feat(data,worker): add repositories, stale-task recovery, and test foundation
Data: TagRepository, ListRepository, TaskRepository (incl. queue selection via
effective agent tag + scheduled_for filter), WorktreeRepository. All CRUD via
parameterized SqliteCommand; enums roundtrip as lowercase strings matching the
schema CHECK constraints.

Worker: StaleTaskRecovery IHostedService flips running -> failed on startup and
marks the result column with a [stale] reason. All four repositories registered
as singletons.

Tests: DbFixture with temp-file SQLite + schema bootstrap, covering
TaskRepository (queue pick via list-tag and task-tag, schedule filter,
transitions, stale flip), ListRepository CRUD + junctions, and
StaleTaskRecovery. 14 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:08:06 +02:00
Mika Kuns
f81ef02273 feat(data,worker): add db schema init and signalr hub skeleton
Data layer: Paths helper with ~/%USERPROFILE% expansion, SqliteConnectionFactory
(WAL + foreign keys), SchemaInitializer that applies the embedded schema.sql, and
POCO entities for lists/tasks/tags/worktrees.

Worker: WorkerConfig loader (~/.todo-app/worker.config.json with defaults),
WorkerHub exposing Ping(), and Program.cs wiring Kestrel to 127.0.0.1:<port>,
SignalR at /hub, schema applied on startup.

Pins Microsoft.Data.Sqlite and Microsoft.Extensions.Hosting to 8.x for net8.0
compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:00:47 +02:00
Mika Kuns
71cfa64427 chore(scaffold): add solution skeleton for App, Ui, Data, Worker and tests
Create .slnx with five projects, wire references (App->Ui->Data,
Worker->Data, Tests->Worker+Data), install Avalonia/MVVM/SignalR.Client/
Sqlite/Hosting packages, and add schema.sql per docs/plan.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:48:06 +02:00
Mika Kuns
b6897df86e chore: add gitignore and finalize initial plan
- .gitignore for .NET output, IDE files, runtime artifacts (todo.db, worktrees, sandbox, logs)
- docs/plan.md: .NET worker spawning Claude CLI, per-list working_dir + git worktrees, 3NF schema, SignalR IPC, Windows-Service deployment path
2026-04-13 11:14:46 +02:00
Mika Kuns
9435559468 initial 2026-04-13 09:22:58 +02:00