Compare commits

...
67 Commits
Author SHA1 Message Date
mika kunsandClaude Opus 5 31dfaffc8b docs(changelog): update for v2.16.0
Changelog / changelog (push) Successful in 2s
Release / release (push) Successful in 41s
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 15:43:58 +02:00
Mika Kuns 09bcd696dd feat(ui): dirty Ziel-Verzeichnis beim Oeffnen des Merge-Dialogs melden statt nach dem Fehlschlag
MergeTargetsDto/MergeTargets bekommen TargetDirty (via HasChangesAsync,
includeUntracked: false). Das Merge-Modal zeigt Warnung + Stash-Retry
sofort in InitializeAsync statt erst nach dem dirty_target-Fehlschlag;
der REVIEW-Block in der Detail-Pane zeigt denselben Hinweis neben
Approve. Der dirty_target-Rueckgabepfad bleibt als Absicherung bestehen.

Behebt Befund F6 aus docs/test-session-2026-09-16.md.
2026-09-16 15:43:39 +02:00
Mika Kuns 86cc309ba9 fix(ui): duplizierter Confirm-Dialog mit "Delete"-Knopf – zusammenfuehren und lokalisieren
F4: DetailsIslandView/TasksIslandView hatten je eine view-lokale Confirm/Error-Dialog-Kopie,
teils mit hartkodiertem "Delete"-Knopf fuer jede Aktion (inkl. der Stash+Merge-Bestaetigung,
die nichts loescht). Beide Kopien entfernt; DetailsIslandViewModel/TasksIslandViewModel routen
Confirm/Error jetzt durch den geteilten Dialogs-Seam (IDialogService, propagiert vom Shell wie
schon bei Lists/Tasks) statt ueber eine vom Code-behind gesetzte Func-Property.

IDialogService.ConfirmAsync bekommt einen optionalen confirmLabel-Parameter (Default: lokalisiertes
"Confirm"); nur die echten Delete-Aktionen (Task loeschen, abgeschlossene Tasks leeren) uebergeben
das lokalisierte "Delete"-Label.

F5: "Cancel"/"Confirm"/"Delete"/"OK" und die Titel "Confirm"/"Error" durch Loc.T mit neuen Keys
unter "dialog.*" ersetzt (en.json + de.json). Mission Controls eigene Dialog-Kopie bleibt bestehen
(eigenes Fenster, WindowDialogService ist an den Haupt-Owner gebunden) — nur ihre Labels wurden
lokalisiert.

Out of scope (siehe Task-Beschreibung): die Nachrichtentexte der Dialoge bleiben unlokalisiert.
2026-09-16 15:43:38 +02:00
Mika KunsandClaude Sonnet 5 684b0115e5 feat(worker): preview_merge_set flags removed symbols and locale-key overlaps
Overlap detection was file-name-only: 9/15 tasks touching en.json/de.json in
run #316 all got flagged even though only one pair actually collided on a
key, and a removed method with no textual file conflict (#297 vs #286) went
unflagged entirely.

- removedSymbols per task entry: a line-pattern scan of `-` diff lines for
  C# method/property/field/type/event declarations (skips .axaml/.json).
- symbolWarnings at the set level: cross-references those names against
  every other task's `+` lines, catching same-symbol collisions across
  files that overlaps/subsets (both purely file-based) can't see.
- overlaps narrows to key-path level for .json files (base commit vs. task
  branch head, both sides parsed and flattened) so two tasks adding
  different locale keys to the same file no longer collide; unparsable
  JSON on either side falls back to the old file-level check.
- GitService.ShowFileAsync: `git show ref:path`, used to read a task
  branch's json content at its base/head commit.

Out of scope per the task: no Roslyn/parser, no AXAML analysis, and the
merge-helper prompt in PromptFiles.cs doesn't mention the new fields yet.

Build: dotnet build src/ClaudeDo.App (pulls in Ui+Data) + src/ClaudeDo.Worker, both clean.
Tests: dotnet test tests/ClaudeDo.Worker.Tests --filter "FullyQualifiedName~MergeMcpTools|FullyQualifiedName~ExternalMcpToolSchema" -- 51 passed, 0 failed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 15:43:38 +02:00
Mika Kuns 1325ab9438 fix(ui): Worktrees-Uebersicht zeigt Task-Nummern, DIFF-Spalte trimmt statt abzuschneiden
Befund F7 aus der Sichtpruefung 2026-09-16. TaskNumber war bereits im
WorktreeMaintenanceService-Join und in WorktreeOverviewRow vorhanden, fehlte
aber im Wire-DTO und in der UI-Kette; jetzt bis zur Row-/Conflict-Anzeige
durchgereicht (#<number> dimmed vor dem Titel, ausgeblendet bei 0). DIFF-Spalte
bekommt CharacterEllipsis-Trimming + Tooltip statt hartem Cut, Spalte von 80
auf 110px verbreitert (Header und Row synchron).
2026-09-16 15:43:38 +02:00
Mika Kuns 56161e4e9b feat(ui): Bilder aus der Zwischenablage ins interaktive Terminal einfuegen
Ctrl+V mit einem Bild in der Zwischenablage schreibt es als temporaeres
PNG unter ~/.claudeDo/tmp/ und fuegt den Pfad in den Composer ein, genau
wie ein Datei-Drop -- Claude liest die Datei selbst. Text-Paste laeuft
unveraendert ueber den bestehenden bracketed-paste-Pfad.

Avalonia 12.0.4 liest Clipboard-Bitmaps bereits selbst (IClipboard.
TryGetDataAsync + AsyncDataTransferExtensions.TryGetBitmapAsync), kein
Win32-P/Invoke noetig. Alte Tmp-Dateien (>24h) werden beim App-Start
aufgeraeumt (ClaudeDo.App/Program.cs), keine eigene Aufraeum-Infrastruktur.
2026-09-16 15:43:38 +02:00
Mika Kuns 4ff5383b35 fix(ui): Diff-Viewer scrollt jetzt auch horizontal synchron
VerticalScrollSync mirrort nur noch Y, X blieb pro Pane unabhaengig. Beide
Panes nutzen dieselbe Schrift/Breite, also X 1:1 mitspiegeln statt wie bei
Y ueber TargetOffset umzurechnen. Die Echo-Abbruchbedingung prueft jetzt
beide Achsen (vorher nur Y), sonst wuerde der neue X-Schreibvorgang seine
eigene Echo-Bedingung nie erfuellen und endlos weiterlaufen.

Klasse in ScrollSync umbenannt (DiffTextView + ConflictResolverView
mitgezogen), da sie nicht mehr nur vertikal synchronisiert.

Kein Headless-Test hinzugefuegt: DiffDispatcherGuardTests.cs dokumentiert
bereits, dass ein bootstrapptes Avalonia Application/Dispatcher in
ClaudeDo.Ui.Tests nach drei eskalierenden Versuchen als Sackgasse verifiziert
wurde (Dispatcher-Thread-Affinitaet kollidiert mit xUnits Worker-Pool ohne
Thread-Garantie; Avalonia.Headless.XUnit kollidiert mit xunit 2.9.3). Als
Finding avaloniaedit-ui-test-dead-end festgehalten. Sichtpruefung bleibt
offen (Side-by-side + Merge-Editor mit ueberbreiten Zeilen).
2026-09-16 15:43:37 +02:00
Mika Kuns 5cdfb14ff1 fix(ui): Ordner-Toggle in der Sidebar schluckt schnelle Klicks
ToggleFolderAsync war ein async [RelayCommand]; AsyncRelayCommand sperrt
sich waehrend des DB-Writes selbst, schnelle Klicks gingen verloren
(Befund F1, docs/test-session-2026-09-16.md).

Variante A: Toggle ist jetzt synchron (reiner UI-State), Persistierung
fire-and-forget mit einem CancellationTokenSource pro Ordner, damit ein
zweiter Klick vor dem ersten Schreibvorgang diesen abbricht - die DB
landet immer beim zuletzt sichtbaren Zustand, nie bei einem veralteten.
Gleiches Muster wie SaveTitleAsync/SaveDescriptionAsync in
DetailsIslandViewModel.

Gegenprueft: RemoveFromFolderAsync/CreateListAsync haben denselben
async-RelayCommand-Schnitt, sind aber Einzelklick-Aktionen (Kontextmenue/
Button), kein Rapid-Click-Ziel wie der Ordner-Toggle - bewusst nicht
umgebaut. Die Modal-oeffnenden Commands sind unkritisch, ein Modal
blockiert ohnehin.
2026-09-16 15:43:37 +02:00
Mika KunsandClaude Sonnet 5 7452f6cfe4 fix(worker): preview_merge braucht einen runVerify-Parameter wie preview_merge_set
preview_merge baute bisher immer, sobald die Liste ein Verify-Kommando
konfiguriert hatte -- anders als das Geschwister-Tool preview_merge_set,
dessen runVerify-Parameter per Default false ist. Ein einzelnes preview_merge
im Merge-Helper-Recheck stiess dadurch einen ungewollten Scratch-Build an.

runVerify (Default false) jetzt symmetrisch bei preview_merge ergaenzt,
Description-Text und die Merge-Helper-Prompt-Doku angepasst.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 15:43:37 +02:00
Mika KunsandClaude Opus 5 c874bf7e52 fix(worker): depends_on-Nachfolger schon beim gelandeten Merge freigeben
Der Queue-Picker gatete eine task_dependencies-Kante auf status='done'.
review_task(skipVerify) laesst einen erfolgreich gemergten Task aber
bewusst auf WaitingForReview stehen, bis verify_merges einmal zentral
laeuft -- damit blockierte jeder Nachfolger ueber den gesamten Batch plus
Full-Suite-Verify hinweg, bei freien Slots.

Eine Kante gilt jetzt als erfuellt, wenn der Vorgaenger 'done' ist ODER
sein Merge gelandet ist (worktrees.state = 'merged'). TaskBlocking
(get_task/list_tasks/wait_for_task_change) und der UI-Wartehinweis folgen
derselben Regel, damit "blocked" nicht meldet, was der Picker claimt.

Abgeleitet: revert_merge/abort_merge setzen den Worktree auf Active und
blockieren wieder; reject_rerun/reject_park haben nie gemergt und bleiben
unerfuellt; ein Task ohne Worktree wird nur ueber 'done' erfuellt; ein
fehlgeschlagener verify_merges gibt Nachfolger frei, weil der Code so
oder so auf main liegt.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 15:43:37 +02:00
Mika KunsandClaude Sonnet 5 50b6b56f87 feat(usage): poll the OAuth usage endpoint as fast as its measured rate limit allows
Measured 2026-09-16 against the live endpoint: a clean burst allows exactly 5
requests before a 429, with Retry-After: 300 (a flat 5-req/5-min quota, no
ratelimit-* headers on either the 200s or the 429s). Lowered
UsagePollIntervalActiveSeconds/UsagePollIntervalIdleSeconds default from
300/900 to 120 each (clamp floor 90, up from 60) — leaves ~2.5 requests of
headroom per window for manual refreshes and any other consumer of the same
OAuth token, unlike 60s which consumes the whole quota by itself. The quota
is a flat per-account limit, not tied to ClaudeDo's own running/idle state,
so both keys share the same default now (kept separate for config
compatibility).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 15:43:37 +02:00
Mika Kuns 9a41bed0f5 fix(ui): Worker-Neustart trifft nun den tatsaechlich laufenden Prozess
RestartWorkerService verliess sich auf WorkerLocator.Find(), das bei einem
Debug-Build ohne install.json in der Verzeichniskette auf die Registry
zurueckfaellt und den Pfad der *installierten* Worker.exe liefert. Der
passt nicht zum laufenden Debug-Prozess, also ueberspringt
KillMatchingWorkerProcesses ihn stillschweigend (Pfadvergleich) - der neu
gestartete Worker startet vom falschen Pfad und stirbt sofort am bereits
belegten Port, waehrend der echte Worker unberuehrt weiterlaeuft. Der
Neustart nimmt jetzt den Pfad des tatsaechlich laufenden
ClaudeDo.Worker-Prozesses als Quelle, mit dem Locator nur noch als
Fallback, wenn keiner laeuft.
2026-09-16 15:43:36 +02:00
Mika Kuns 103eb9a687 fix(ui): Shutdown terminates the app even with secondary windows open
ShutdownWorkerAndCloseApp only closed MainWindow via CloseWindow, relying
on ShutdownMode.OnMainWindowClose to bring the process down. That mode
backs off if any window cancels its own Closing event, and
MissionControlWindow always does (it hides instead of closing) - so the
process never actually exited while Mission Control, Cheat Sheets, or the
diff viewer were still open. Call IClassicDesktopStyleApplicationLifetime
.Shutdown() directly, which force-closes every window regardless of
per-window cancellation.
2026-09-16 15:43:36 +02:00
Mika Kuns 7ecb1fa0b5 Fix: some Reactive stuff 2026-09-16 15:43:36 +02:00
ClaudeDo CI 18394dd6b2 docs(changelog): update for v2.15.0 2026-09-11 09:43:40 +00:00
mika kuns 251b70ce83 feat(merge): Stash-Option fuer uncommittete Aenderungen im Ziel-Tree
Changelog / changelog (push) Successful in 2s
Release / release (push) Successful in 43s
Ein dirty Ziel-Arbeitsverzeichnis gibt jetzt den eigenen Status
dirty_target zurueck statt blocked. Die UI bietet daraufhin einen
Retry an, der per git merge --autostash stasht, merged und die
Aenderungen danach wiederherstellt - opt-in pro Merge:

- Approve & Merge: Bestaetigungsdialog
- Merge-Modal: Button "Aenderungen stashen und mergen"
- MCP (merge_task/review_task) wirft weiterhin, kein autostash dort
2026-09-11 11:43:28 +02:00
ClaudeDo CI 8e2d37e63e docs(changelog): update for v2.14.0 2026-09-10 14:36:23 +00:00
mika kuns edcaee77dc Merge remote-tracking branch 'origin/main'
Changelog / changelog (push) Successful in 2s
Release / release (push) Successful in 42s
2026-09-10 15:41:57 +02:00
mika kuns bfb1c6523c feat(ui): Listen und Ordner in einer gemischten Sidebar-Reihenfolge
Die oberste Sidebar-Ebene ist jetzt eine gemischte TopLevel-Collection, so
dass eine Liste auch oberhalb eines Ordners stehen kann. DropAsync deckt
alle vier Quelle/Ziel-Kombinationen ab, ReorderSidebarAsync numeriert die
gesamte sichtbare Reihenfolge ueber lists und list_folders hinweg.
2026-09-10 15:40:10 +02:00
mika kuns 1770b67713 fix(tickets): Import broadcastet TaskUpdated fuer neue Tasks
ImportTickets sendete nur ListUpdated. Die UI liest das als Aenderung der
Listen-Metadaten und patcht nur bestehende Zeilen, also tauchten die
importierten Tasks erst nach Schliessen und Neuoeffnen der Liste auf.
TicketImportResult liefert jetzt die angelegten Task-Ids, der Hub
broadcastet pro Id ein TaskUpdated - derselbe Pfad, den jeder andere
out-of-band Creator nutzt.
2026-09-10 15:39:58 +02:00
mika kuns 3d09323ee1 fix(worker): ConnectedClientTracker in den externen MCP-Container teilen 2026-09-10 14:58:29 +02:00
mika kuns 7c399b26ba Merge branch 'claudedo/ea798a952ab54bcc95dbb442168ee0dd' 2026-09-10 13:59:50 +02:00
mika kuns d6696c3317 fix(localization): de.json-Konsistenz-Pass und restliche harte EN-Strings
Queue/Task(s)/Gate in deutschem Fliesstext auf Warteschlange/Aufgabe(n)/
Limit-Stopp vereinheitlicht, columnTask-Keys auf AUFGABE angeglichen,
Kill-Tonalitaet (closeSession/killSessionTip) ehrlich-destruktiv gemacht.
RepoImportModalViewModel.CreateButtonText und alle Installer-Check-Messages
(Git/GitIdentity/WriteAccess/ClaudeCli/ClaudeVersion/ClaudeAuth/
PermissionModeAuto/Ports) ueber Locale-Keys geroutet statt hartem Englisch,
mit dem bestehenden TrExtension.Localizer-Fallback-Muster.
2026-09-10 13:57:33 +02:00
mika kuns 73e038edd9 fix(claude-do): merge GitService stderr matches are English-only, same locale bug
ClaudeDo-Task: 66b7ad7b-ffc4-4ebd-8b21-54bba28e5b04
2026-09-10 13:56:14 +02:00
mika kuns 9d22c775f2 fix(claude-do): merge fix(ui,worker): Diff-Zähler locale-fest machen und toten Par
ClaudeDo-Task: 1085277d-ba7e-4e58-b06d-751e1b99b96f
2026-09-10 13:56:11 +02:00
mika kuns 407bc30554 feat(claude-do): merge feat(ui): Rückfrage bevor das X eine laufende ConPTY-Session
ClaudeDo-Task: 50c0d3ff-ad95-4612-8b16-344ac1c24f41
2026-09-10 13:54:26 +02:00
mika kuns 5ecf6f750a fix(data): force English git output for locale-fragile stderr matches
RevParseHeadAsync and CommitAsync's identity-error detection match
English-only substrings against git stderr. Under a non-English OS/git
locale these silently fail to match, falling through to a generic
error. Force LC_ALL=C and LANGUAGE=C on the git ProcessStartInfo so
git always emits English output regardless of ambient locale.
2026-09-10 13:54:14 +02:00
mika kuns eb62371430 feat(ui): confirm before closing a running ConPTY session
The tile's own X killed a live Claude session with no confirmation, unlike
the semantically similar Abandon-run action. Gate the close behind the same
ConfirmAsync mechanism, but only when Terminal.IsRunning -- a dead session
(StartError or exited-after-startup) still closes immediately since the X
there is pure cleanup.
2026-09-10 13:52:36 +02:00
mika kuns 395874d834 feat(claude-do): merge feat(ui): Worker-Menü "Shutdown" beendet nach Bestätigung Wo
ClaudeDo-Task: f97295c1e25a44db9db23df07a38062a
2026-09-10 13:52:30 +02:00
mika kuns 29ea18c427 fix(ui): make diff-stat parsing locale-safe and dedupe the two parsers
TaskRowViewModel had its own ParseDiffStat expecting "+12"/"-3" tokens that
`git diff --stat` never emits, so the row badge always showed 0/0. Meanwhile
DetailsIslandViewModel's parser matched only the English words
"insertion"/"deletion", so it broke on a localized git (e.g. German Windows:
"Einfügung(en)"/"Löschung(en)").

Row and detail badge now share one parser, anchored on git's untranslated
(+)/(-) suffix instead of the language-dependent word before it, so it reads
correctly in any locale. Also corrected the Worker CLAUDE.md's branch-name
claim (`claudedo/{taskId[:8]}`) to match the actual full-GUID branch name.
2026-09-10 13:50:35 +02:00
mika kuns 1bdf20272d feat(ui): worker-menu Shutdown ends worker + app after confirm
Adds a Shutdown entry after the Worker menu's Restart/Update Claude CLI
items. Confirms via IDialogService.ConfirmAsync, then kills this
installation's ClaudeDo.Worker process(es) (shared kill loop, extracted
from RestartWorkerService) and force-closes the window through the same
_forceClose path MainWindow already uses for the Mission-Control close
confirm, so no second confirmation dialog shows.
2026-09-10 13:48:50 +02:00
mika kuns 7eba0affbe feat(claude-do): merge feat(worker): normaler Parent mit Kindern — erst Parent ausf
ClaudeDo-Task: 646dd82f-4d3f-4aff-aef3-8e9f24b6e141
2026-09-10 13:36:24 +02:00
mika kuns d2648f965c feat(worker): chain a normal parent's children on WaitingForChildren
A standalone parent (PlanningPhase.None) with existing Idle/Queued children
now runs itself first, then sequences its children instead of flat-enqueuing
all of them at once: SubmitForChildrenAsync calls
PlanningChainCoordinator.SetupChainAsync(enqueue: true) right after the
Running -> WaitingForChildren transition, mirroring the planning path but
firing immediately instead of waiting for an explicit "Queue plan". Planning
parents are left untouched (they queue via QueuePlanAsync), and a child
already Running makes SetupChainAsync throw, which is now caught and logged
so it can't fail the parent's own transition.
2026-09-10 13:36:08 +02:00
mika kuns 897f287ee1 chore(claude-do): merge chore(ui): IWorkerClient.MergeProgressEvent-Forwarder entfer
ClaudeDo-Task: 2feaa8b5-0484-4b11-9519-6627f0bb95a3
2026-09-10 13:35:54 +02:00
mika kuns 1a5728749b fix(claude-do): merge fix(worker): max_turns-Fehlertext nicht fest deutsch — konsi
ClaudeDo-Task: 6549e3b5-cee3-4aa4-ba3a-6240bab952e6
2026-09-10 13:35:45 +02:00
mika kuns e628d97d29 fix(claude-do): merge fix(ui): fehlgeschlagenes Einfügen/Droppen im interaktiven T
ClaudeDo-Task: 81931eef-4d05-49d0-a476-7346cba7fbe5
2026-09-10 13:35:22 +02:00
mika kuns 0cec0a77ee fix(ui): report failed paste/drop in the interactive terminal
PasteAsync silently swallowed every exception and returned void, so a
package update renaming Iciclecreek's private write seam would break
Ctrl+V/drop with zero user-visible signal. PasteAsync/SendTextAsync now
return bool (mirroring SendLineAsync), and the view checks the result,
routing a failure through InteractiveTerminalViewModel.ErrorReported ->
ConPtyPaneViewModel.ErrorReported -> the existing footer error strip.
2026-09-10 13:35:16 +02:00
mika kuns acff815706 feat(claude-do): merge feat(ui): WorkConsole, DescriptionStepsCard und ROADBLOCK-La
ClaudeDo-Task: 6c91f950-f93b-44be-abb4-b12f65fb68ba
2026-09-10 13:35:14 +02:00
mika kuns 8e6f0d1605 feat(ui): localize WorkConsole, DescriptionStepsCard and the ROADBLOCK label
The review/merge cockpit was the last unlocalized surface in the detail
pane, mixing hard English with translated tooltips on the most-used screen.
Routes all literal strings through details.workConsole.*, details.stepsCard.*
and details.roadblockLabel, with en/de parity.
2026-09-10 13:35:07 +02:00
mika kuns bd393a0599 fix(claude-do): merge fix(ui): WorkerConnection-Modal meldet Fehlschläge sichtbar;
ClaudeDo-Task: 1db17881-7105-4f44-b035-0d13872bbfa0
2026-09-10 13:34:52 +02:00
mika kuns b4b6225432 fix(ui): surface worker connect/restart failures instead of no-opting
WorkerConnectionModalViewModel's StartWorker/RerunInstaller swallowed
missing-exe and Process.Start failures behind an empty catch and closed
the dialog anyway, looking like success. Now both show an inline error
and keep the dialog open; only a real launch closes it.

IslandsShellViewModel.RestartWorkerAsync never checked whether the
relaunched worker actually stayed up, and its status property was never
bound in any view. RestartWorkerService now fails if the new process
exits within a short survival window, and the outcome routes through
the footer error/success strip instead of the dead RestartWorkerStatus.

InstallArtifactLocator.Find() is now virtual and its two subclasses
unsealed so tests can fake exe resolution without touching the real
filesystem/registry.
2026-09-10 13:34:32 +02:00
mika kuns 46a0a27620 fix(claude-do): merge fix(ui): Settings-Politur — PowerUse-Zeitfenster validieren,
ClaudeDo-Task: f3f0a355-936c-4933-8236-d41c21fb73dc
2026-09-10 13:34:29 +02:00
mika kuns 423d39e9fb fix(claude-do): merge fix(worker): WeekReportService durch PermissionModeResolver
ClaudeDo-Task: b4198327-6045-451c-abf1-dbabad88e91a
2026-09-10 13:34:20 +02:00
mika kuns 951c2fe92a fix(ui): validate PowerUse window, explain effort and Prime Claude in Settings
Three usability-audit findings in Settings:
- An unparseable PowerUse window (e.g. "9:0") used to save silently as null
  (= round the clock), the opposite of what the typo implied. Validate() now
  rejects an unparseable start/end unless blank; the worker-side read-time
  tolerance is unchanged.
- "Effort" column header gets a tooltip explaining it's the model's reasoning
  effort (cost/depth tradeoff).
- The "Prime Claude" tab gets a tooltip explaining scheduled Claude runs
  (Ping / Fill My Day / custom prompt).

New locale keys added to en+de. Updated the PowerUse round-trip test that
asserted the old silent-normalize behavior.
2026-09-10 13:34:06 +02:00
mika kuns 6f1fbe5b93 fix(claude-do): merge fix(ui): Working-Dir beim Speichern der Listen-Settings als
ClaudeDo-Task: e8986885-add7-43b4-94bf-f12be5712848
2026-09-10 13:34:03 +02:00
mika kuns cfda3e9044 chore(ui): remove IWorkerClient.MergeProgressEvent forwarder
Group C of the operation-feedback batch is fully merged; the two consumers
(DetailsIslandViewModel.ApproveReviewAsync, MergeModalViewModel) now handle
the verifying phase from the generic OperationProgressEvent handler instead
of a separate forwarder event.
2026-09-10 13:33:57 +02:00
mika kuns 2a34d2453f fix(claude-do): merge fix(worker): start_list_handler ehrlich machen, wenn keine A
ClaudeDo-Task: 33e0f8f9-abac-4867-a873-ddc1c136a587
2026-09-10 13:33:40 +02:00
mika kuns 451c01848c fix(worker): start_list_handler ehrlich machen, wenn keine App verbunden ist
ConnectedClientTracker zaehlt verbundene UI-Clients (WorkerHub.OnConnectedAsync/
OnDisconnectedAsync). StartListHandler prueft ihn vor dem Broadcast und liefert
bei 0 verbundenen Clients Requested=false plus Reason statt unbedingtem true.
Tool-Beschreibung und external-mcp.md an das reale Verhalten angepasst.
2026-09-10 13:33:30 +02:00
mika kuns 0235b43bad fix(claude-do): merge fix(worker): Port-Konflikt beim Start laut melden statt stil
ClaudeDo-Task: 1eb4cfcd-a31e-4216-8c05-88cd662a211b
2026-09-10 13:33:28 +02:00
mika kuns 3348736e9d fix(ui): warn and block save when a list's working dir isn't a git repo
Reuses RepoScanner.IsRepo (now public) to validate WorkingDir whenever it
changes in ListSettingsModalViewModel — Browse or typing. A missing folder
or a non-repo folder shows an inline warning and gates Save via the same
CanExecute pattern the load-failure gate already uses; an empty WorkingDir
is untouched. Previously this only surfaced as a Failed task deep in
WorktreeManager on first run.

Also localizes the two hardcoded EN strings in the same file (delete
confirm, planning-sessions block) into vm.listSettings.* keys.
2026-09-10 13:32:52 +02:00
mika kuns 752cf0926b feat(claude-do): merge feat(ui): depends_on-Blockierung sichtbar machen (Status-Chi
ClaudeDo-Task: 701de3ab-c326-4152-9488-8ac21fa21ffc
2026-09-10 13:32:48 +02:00
mika kuns 4cf601e423 feat(ui): surface depends_on blocking in status chip, chain label, and detail pane
Usability-Audit 2026-09-10 found three gaps versus the dependency-chain-display
spec: a Queued task blocked on an unmet task_dependencies edge rendered the same
chip as one about to run, a cross-list predecessor silently dropped the
"after #N" chip, and the detail pane showed nothing about a wait at all.

- TaskRowViewModel gains IsBlockedByDependency/DependencyWaitLabel (extrinsic,
  assigned by TasksIslandViewModel like the existing chain fields); IsQueued/
  IsWaiting/StatusChipClass/StatusLabel/StatusChipTooltip now account for it
  alongside the existing BlockedByTaskId planning-chain link.
- TasksIslandViewModel.ApplyDependencyWaitState computes the blocked flag and
  wait label per row; a new RefreshExternalDependencyCacheAsync backfills
  Number/Title/Status for predecessors not loaded into the current list's
  Items (reusing the already-open DbContext, no new hub method), so
  BuildAfterLabel/blocking both resolve a listenfremder Vorgänger correctly.
- New "waiting" chip style (IslandStyles.axaml) and locale keys (en+de);
  TaskHeaderBar shows a "Waiting on #N" line bound straight to the same row.

Tests: TasksIslandChainTests (blocked/unblocked chip, cross-list predecessor),
DetailsIslandDependencyWaitTests (new), TaskRowViewModelNotificationsTests
updated for the new notification set.
2026-09-10 13:32:36 +02:00
mika kuns c1b133ff90 fix(claude-do): merge fix(ui): gestorbene ConPTY-Session auf der Kachel sichtbar m
ClaudeDo-Task: 4f97df3c-be1e-4513-9b86-742f243649f0
2026-09-10 13:32:34 +02:00
mika kuns 256bea5ffa fix(ui): show a banner when a ConPTY session dies after startup
InteractiveTerminalViewModel.HasExitedAfterStartup now covers every
post-startup death that ExitedAfterStartup alone missed (crash, clean
exit, quiet exit inside the grace window) -- previously the tile just
stayed looking alive/thinking with zero signal. ConPtyPaneView binds a
new banner to it (message + Retry + Close); CanRetry simplifies to
"any HasExited state" since the same descriptor factory can relaunch
either kind of death. HandlerRestartCoordinator's worker-side
auto-restart path is untouched.
2026-09-10 13:32:19 +02:00
mika kuns 2b0562b2ed fix(claude-do): merge fix(localization): doppelten Top-Level-Block "checks" in en.
ClaudeDo-Task: ba3b1423-fd00-4771-8b16-735cb441ebce
2026-09-10 13:32:16 +02:00
mika kuns 741f66fe14 fix(localization): merge duplicate top-level "checks" block in en/de.json
en.json and de.json each defined the checks object twice; JSON silently
kept the second block's values, so the first block's friendlier titles/hints
(e.g. "Permission Mode" over the raw "--permission-mode auto support" flag)
were dead text. Merged into one block per key, keeping the friendlier title
and the more actionable hint.

Added a Utf8JsonReader-based duplicate-top-level-key test, since
JsonDocument accepts duplicates without error and the existing parity test
can't see this failure mode either.
2026-09-10 13:31:01 +02:00
mika kuns 2d67ca3171 feat(claude-do): merge feat(ui): Worker-Menü "Update Claude CLI" führt `claude upda
ClaudeDo-Task: 7a02b6957f094dceb0f923c300c4675f
2026-09-10 13:30:58 +02:00
mika kuns 0fcfe7c524 fix(worker): translate max_turns failure text to English
TaskRunner.BuildFailureMarkdown returned a hardcoded German string for
TerminalReason == "max_turns", the only worker-generated string not in
English. Surfaced as the outcome/roadblock card for one of the most likely
first failures, looking broken to non-German users.
2026-09-10 13:22:30 +02:00
mika kuns 1c76852957 fix(worker): route WeekReportService permission-mode through PermissionModeResolver
Closes the last unrouted --permission-mode call site: haiku default models were
hardcoding raw "auto", which the CLI silently downgrades to interactive "default"
and hangs the report generation. Also drops the author's personal C:\Private
default exclude in favor of an empty default (config stays via ReportExcludedPaths).
2026-09-10 13:13:16 +02:00
mika kuns c9d4823f06 fix(worker): report startup port conflicts instead of crashing silently
Mutex was Local\ (per Windows session), so a second RDP/fast-user-switching
session bypassed the single-instance guard. A Kestrel bind failure on top of
that had no try/catch, so a second worker (or any process on 47821/47822)
died as an unhandled crash with nothing in the log to explain why the UI
never connects. Mutex is now Global\, bind failures and any last-resort
unhandled exception log a Fatal line and exit(1) instead of crashing raw.
2026-09-10 13:12:25 +02:00
mika kuns dbee4a0de9 feat(ui): Worker-Menü "Update Claude CLI" führt claude update aus
Neuer Eintrag im Worker-Menü der Titelleiste, der die Claude CLI über
das konfigurierte claude_bin (ExecutableResolver, inkl. Shim-Handling)
mit `claude update` aktualisiert. Ausgabe/Fehler landen im Footer-Strip
(FlashFooterSuccess/FlashFooterError), Menüpunkt ist während des Laufs
deaktiviert. 5-Minuten-Timeout tötet den Prozessbaum.
2026-09-10 13:10:30 +02:00
mika kuns 1177463a82 feat(ui): triage model picker (opus/fable) in the merge helper start modal 2026-09-10 09:42:55 +02:00
mika kuns 5477ae5302 docs: record list folders in the Data and Ui CLAUDE.md 2026-09-10 08:33:31 +02:00
mika kuns a0a85c5c24 test: cover list folders in the data and sidebar layers
Data: folder delete keeps its lists (ON DELETE SET NULL), rename patches
name/icon without resetting sort order or collapse state.
Sidebar: grouping on load, folder badge as the sum of its children, both
move routes, and the persisted collapse state.

Drops the LoadAsync/AddRowAsync normalization of a dangling folder_id:
FK enforcement is on for every connection, so the row it guarded against
cannot exist, and ContainerOf already falls back to the top level.
2026-09-10 08:32:52 +02:00
mika kuns 25c9a619dc feat(ui): collapsible folders for the list sidebar
Folders render above the top-level lists, each with its own collapsible
children; tapping a folder header folds it instead of selecting it.
Lists move in by dragging onto a folder header (or onto a row inside it)
and out by dropping between top-level rows or via the context menu.

Creating a folder is a toggle in the New-list modal, not a third sidebar
button: it reduces the modal to name + icon and writes a folder row
instead of the list row the create flow pre-created.
2026-09-10 08:29:56 +02:00
mika kuns 13e860f06b feat(data): list_folders table plus lists.folder_id
Sidebar folders get their own table rather than a flag on lists, so the
places that enumerate lists (MCP tools, move-to-list, queue picker, repo
import) need no folder filtering. ON DELETE SET NULL keeps a folder's
lists alive when the folder goes.
2026-09-10 08:29:56 +02:00
ClaudeDo CI ec1e60be1d docs(changelog): update for v2.13.6 2026-09-07 06:18:03 +00:00
141 changed files with 6156 additions and 922 deletions
+81
View File
@@ -1,5 +1,86 @@
# Changelog
## v2.16.0 — 2026-09-16
### Features
- Bilder aus der Zwischenablage ins interaktive Terminal einfuegen (81d835c0)
- preview_merge_set flags removed symbols and locale-key overlaps (fb7dddb3)
- poll the OAuth usage endpoint as fast as its measured rate limit allows (6b6d9895)
- dirty Ziel-Verzeichnis beim Oeffnen des Merge-Dialogs melden statt nach dem Fehlschlag (0805540a)
### Fixes
- depends_on-Nachfolger schon beim gelandeten Merge freigeben (21591a5d)
- preview_merge braucht einen runVerify-Parameter wie preview_merge_set (d725e3f1)
- Shutdown beendet die App auch mit offenen Nebenfenstern (d7898240)
- Worker-Neustart trifft nun den tatsaechlich laufenden Prozess (c486b85b)
- Ordner-Toggle in der Sidebar schluckt schnelle Klicks (0cd31411)
- Diff-Viewer scrollt jetzt auch horizontal synchron (f4af0b98)
- Worktrees-Uebersicht zeigt Task-Nummern, DIFF-Spalte trimmt statt abzuschneiden (62349c4f)
- duplizierter Confirm-Dialog mit "Delete"-Knopf zusammengefuehrt und lokalisiert (a0ad4d0f)
## v2.15.0 — 2026-09-11
### Features
- Stash-Option fuer uncommittete Aenderungen im Ziel-Tree (251b70ce)
### Documentation
- update for v2.14.0 (8e2d37e6)
## v2.14.0 — 2026-09-10
### Features
- Listen und Ordner in einer gemischten Sidebar-Reihenfolge (bfb1c652)
- confirm before closing a running ConPTY session (eb623714)
- worker-menu Shutdown ends worker + app after confirm (1bdf2027)
- chain a normal parent's children on WaitingForChildren (d2648f96)
- localize WorkConsole, DescriptionStepsCard and the ROADBLOCK label (8e6f0d16)
- surface depends_on blocking in status chip, chain label, and detail pane (4cf601e4)
- Worker-Menü "Update Claude CLI" führt claude update aus (dbee4a0d)
- triage model picker (opus/fable) in the merge helper start modal (1177463a)
- collapsible folders for the list sidebar (25c9a619)
- list_folders table plus lists.folder_id (13e860f0)
### Fixes
- Import broadcastet TaskUpdated fuer neue Tasks (1770b677)
- ConnectedClientTracker in den externen MCP-Container teilen (3d09323e)
- de.json-Konsistenz-Pass und restliche harte EN-Strings (d6696c33)
- force English git output for locale-fragile stderr matches (5ecf6f75)
- make diff-stat parsing locale-safe and dedupe the two parsers (29ea18c4)
- report failed paste/drop in the interactive terminal (0cec0a77)
- surface worker connect/restart failures instead of no-opting (b4b62254)
- validate PowerUse window, explain effort and Prime Claude in Settings (951c2fe9)
- start_list_handler ehrlich machen, wenn keine App verbunden ist (451c0184)
- warn and block save when a list's working dir isn't a git repo (3348736e)
- show a banner when a ConPTY session dies after startup (256bea5f)
- merge duplicate top-level "checks" block in en/de.json (741f66fe)
- translate max_turns failure text to English (0fcfe7c5)
- route WeekReportService permission-mode through PermissionModeResolver (1c768529)
- report startup port conflicts instead of crashing silently (c9d4823f)
### Documentation
- record list folders in the Data and Ui CLAUDE.md (5477ae53)
- update for v2.13.6 (ec1e60be)
## v2.13.6 — 2026-09-07
### Features
- Home-Ordner als Sitzungsziel in Mission Control (f231f08a)
- Einfuegen und Datei-Drop im interaktiven Terminal (23491d3b)
- Cheat-Sheet-Fenster im Hilfe-Menue (0db9fade)
- PowerUse-Einstellungen nach Settings -> Ausfuehrung verschieben (7c7c33d6)
### Documentation
- update for v2.13.5 (c7392e08)
## v2.13.5 — 2026-09-03
### Fixes
+8
View File
@@ -98,6 +98,7 @@ Daily prep: `GetDailyPrepCandidates`, `SetMyDay`.
| `TaskWaitMcpTools` | `WaitForTaskChange` |
| `QueueStateMcpTools` | `GetQueueState` |
| `AttachmentMcpTools` | `AddTaskAttachment`, `ListTaskAttachments`, `RemoveTaskAttachment` |
| `ListHandlerMcpTools` | `StartListHandler` |
## Per-tool behaviour worth knowing
@@ -235,6 +236,13 @@ task already outside those two (unknown ids reported as status `"NotFound"`, als
**`AttachmentMcpTools`** — re-attaching the same `fileName` overwrites. Add/remove refuse on a
`Running` task.
**`StartListHandler`** — the worker only broadcasts `ListHandlerStartRequested`; the connected
ClaudeDo App does the actual work (creates the handler task, opens the triage ConPTY tile). Before
broadcasting it checks `ConnectedClientTracker` (a `WorkerHub.OnConnectedAsync`/`OnDisconnectedAsync`-driven
singleton count) — with zero connected clients the broadcast would reach nobody, so the tool
returns `Requested: false` plus a `Reason` instead of claiming success. Does not queue or retry the
request for a later connect.
**`GetDailyPrepCandidates`** — Idle, non-blocked tasks in a git repo **not** excluded by
`AppSettings.ReportExcludedPaths` and not already `IsMyDay`, plus the current Idle MyDay tasks
and `maxTasks` (= `DailyPrepMaxTasks`). Repo-exclusion logic lives in the `DailyPrepFilter`
+3 -3
View File
@@ -184,9 +184,9 @@ detached-HEAD scratch worktree under the OS temp dir (`GitService.WorktreeAddDet
is always removed afterward (`finally`, non-cancellable cleanup). No verify command configured, or
`runVerify=false`, reproduces the pre-existing preview exactly — no delay, no scratch worktree.
Wired into `ExternalMcpService`: `preview_merge` (single task) always requests a verify run when the
list has a command configured; `preview_merge_set` only does when its `runVerify` parameter is
explicitly set (default `false`) — a set preview never starts N builds unasked. The Hub's
Wired into `ExternalMcpService`: both `preview_merge` (single task) and `preview_merge_set` only
request a verify run when their `runVerify` parameter is explicitly set (default `false`) — a
preview never starts a build unasked. The Hub's
`PreviewMerge` (the UI's live mergeability indicator) always passes `runVerify: false`, since
running a build on every poll would be a bad regression; `MergePreviewDto` carries the
verify fields anyway so a future UI entry point can opt in. Result fields: `VerifyExitCode` (null =
+6 -1
View File
@@ -21,6 +21,11 @@ authenticated with the Bearer access token Claude Code itself keeps fresh at
Because the endpoint is undocumented and can change without notice, **every consumer
fails open**. That is the single most important invariant here.
**Measured 2026-09-16** (clean burst against the live endpoint, Worker otherwise idle): exactly
5 requests succeed, the 6th 429s with `Retry-After: 300` — a flat 5-requests-per-5-minute quota,
no `ratelimit-*`/`x-ratelimit-*` headers on either the 200s or the 429. The quota is per-account,
not per-process, so a manual refresh or another consumer of the same OAuth token shares it.
## Components (`Usage/`)
| Type | Role |
@@ -28,7 +33,7 @@ fails open**. That is the single most important invariant here.
| `UsageModels` | `UsageBucket` / `UsageLimitRow` / `UsageSnapshot`. `UsageBucket.Utilization` is already a 0–100 percent — compare directly against thresholds, don't rescale. |
| `ClaudeOAuthUsageClient` | Reads the token, calls the endpoint. Defensive parsing: missing/null buckets → null, missing `limits` → empty list. |
| `UsageState` | Threadsafe singleton. A failed poll **never** overwrites the last good snapshot — it only sets `LastError`. |
| `UsageMonitorService` | `BackgroundService`; polls on `usage_poll_interval_seconds` (default 60, clamped to min 15 on config load), one poll at startup. Logs a failure at most once per distinct error message. Broadcasts `HubBroadcaster.UsageUpdated` after **every** tick, success or failure. |
| `UsageMonitorService` | `BackgroundService`; polls on `usage_poll_interval_active_seconds` / `usage_poll_interval_idle_seconds` (default 120 each, clamped to min 90 on config load), one poll at startup. Logs a failure at most once per distinct error message. Broadcasts `HubBroadcaster.UsageUpdated` after **every** tick, success or failure. |
| `UsageSnapshotBuilder` | Builds the Hub-facing `UsageSnapshotDto` from `UsageState` + `IUsageGate` + `AppSettings`. The one shared place for stale/threshold/gate logic — `WorkerHub.GetUsageSnapshot` and `UsageMonitorService` must not diverge. |
| `UsageGate` | Hard pause decision → `UsageGateDecision(IsBlocked, Reason)`. |
| `UsageThrottle` | Pure static staging of parallelism ahead of the gate. |
+2
View File
@@ -42,6 +42,8 @@ sealed class Program
ClaudeDoDbContext.MigrateAndConfigure(db);
}
ClipboardImageTempStore.DeleteOlderThan(TimeSpan.FromHours(24), DateTime.UtcNow);
try
{
ConfigureAppBuilder(AppBuilder.Configure(() => new App(services)))
+6 -2
View File
@@ -12,7 +12,9 @@ Shared data layer: models, repositories, SQLite infrastructure, and git operatio
- `InteractiveSessionId` = the claude session id an embedded ConPTY interactive task session runs under, persisted by `InteractiveLaunchSpecService` before launch so a closed/aborted session can be resumed → [conpty-sessions](../../docs/explore-notes/conpty-sessions.md).
- `Number` (INTEGER NOT NULL, unique index `idx_tasks_number`) — a global, monotonically increasing display alias for tasks. **Never reused**: deleting a task leaves a gap in numbering, ensuring that a task number that appears in a log or report always points to the same task (if it exists). Allocated by `TaskNumberAllocator.AddWithNumberAsync` on every insert via a persistent counter (`app_settings.next_task_number`). **Why not `MAX(number) + 1`:** deleting the highest-numbered task would free its number for reuse, breaking the immutability guarantee. The allocator uses an `UPDATE…RETURNING` statement to claim numbers atomically, retrying up to 5 times if a uniqueness collision occurs (the counter advances on each attempt, so retries always allocate fresh numbers). The one-time backfill for pre-existing rows lived in the `AddTaskNumbers` migration, squashed away 2026-08-26.
- Legacy status values `Manual`/`Planning`/`Planned`/`Draft`/`Waiting` were retired. The backfill migration was squashed away (2026-08-26) — a database still holding those values can't be upgraded, see Schema below.
- **ListEntity** — Id, Name, WorkingDir, DefaultCommitType, CreatedAt, IsManual (reminder list — tasks created here default to `IsManual`)
- **ListEntity** — Id, Name, WorkingDir, DefaultCommitType, CreatedAt, IsManual (reminder list — tasks created here default to `IsManual`), Icon, FolderId
- `FolderId` (`folder_id`, nullable FK → `list_folders.id`, `ON DELETE SET NULL`) — the sidebar folder the list sits in; null = top level. Written only by the UI (`ListsIslandViewModel` drag/context menu), never by MCP.
- **ListFolderEntity** — Id, Name, Icon, SortOrder, IsCollapsed, CreatedAt → `list_folders`. A pure sidebar grouping: no tasks, no config, no working dir, **one level** (folders never nest). Deliberately its own table rather than a flag on `lists`, so every caller that enumerates lists (MCP `list_task_lists`, "move to list", the queue picker, repo import) needs no folder filtering. Folder CRUD lives on `ListRepository`.
- **ListConfigEntity** — ListId (PK, 1:1), Model, SystemPrompt, AgentPath, MaxTurns, SessionSkills, VerifyCommand, PermissionMode, TicketProjectId (all nullable). `VerifyCommand` is an optional post-merge gate; null/blank = no gate → [review-merge](../../docs/explore-notes/review-merge.md). `PermissionMode` is null = inherit the global default; resolution order task → list → global lives in `EffectiveRunConfigResolver`. `TicketProjectId` (`ticket_project_id`) links the list to a project in the external ticket system; null = not linked → `ClaudeDo.Worker/CLAUDE.md` Tickets section.
- ⚠️ `ListRepository.SetConfigAsync` copies the entity **verbatim**, so every writer must carry the fields it doesn't own (`SessionSkills`, `PermissionMode`, `TicketProjectId`) or they silently reset. `UpdateListConfigDto.TicketProjectId` is tri-state (`null` = keep stored) for exactly that reason — only the list-settings modal sends an explicit value. This bit `PermissionMode` for real: its update-branch copy was missing from `SetConfigAsync` until `f0a3a186`, so a list's permission-mode override only ever stuck on the list's *first* save, never on a later one.
- **WorktreeEntity** — TaskId (PK, 1:1), Path, BranchName, BaseCommit, HeadCommit, DiffStat, MergeCommit (nullable — SHA of the merge commit this branch produced; the only thing making `revert_merge` possible without searching `git log`), State (`Active|Merged|Discarded|Kept`)
@@ -65,7 +67,8 @@ All use EF Core LINQ via `ClaudeDoDbContext`. The atomic `Queued → Running` cl
Worker's `QueuePicker` (`FromSqlRaw`), **not** here.
- **TaskRepository** — CRUD, planning helpers (`CreateChildAsync`, `SetPlanningStartedAsync`, `DiscardPlanningAsync`, `UpdateChildAsync`), `UpdateAgentSettingsAsync`. ⚠️ Status-mutation primitives (`MarkRunningAsync`/`MarkDoneAsync`/`MarkFailedAsync`/`FlipAllRunningToFailedAsync`) are **`internal`** — only the Worker's `TaskStateService` may call them. `CreateChildAsync` produces children with `Status=Idle, PlanningPhase=None`. **Task-number allocation:** `AddAsync` (line 20) and `CreateChildAsync` (line 276) are the two sole task-creation paths; both call `TaskNumberAllocator.AddWithNumberAsync` to allocate a number atomically during the same transaction as the insert. Every other creation path (UI, MCP `add_task`, `batch_add_tasks`, Online Inbox sync, merge-helper handler tasks, planning children) routes through one of these two.
- **ListRepository** — CRUD, `GetConfigAsync`/`SetConfigAsync` (upsert)/`DeleteConfigAsync` for `list_config`
- **ListRepository** — CRUD, `GetConfigAsync`/`SetConfigAsync` (upsert)/`DeleteConfigAsync` for `list_config`, plus the `list_folders` set: `GetFoldersAsync`, `AddFolderAsync` (appends), `RenameFolderAsync`, `DeleteFolderAsync` (folder only — the FK releases its lists), `SetFolderCollapsedAsync`, `SetListFolderAsync`. The folder writers are `ExecuteUpdate` patches, not entity `Update()`s, so a rename can't reset `SortOrder`/`IsCollapsed` the way `SetConfigAsync`'s verbatim copy resets forgotten columns.
- ⚠️ **`lists.sort_order` and `list_folders.sort_order` share one number space** — the sidebar interleaves folders and top-level lists in a single order, so `ReorderSidebarAsync` numbers the whole visual sequence (each folder followed by its children) across both tables, and `AddAsync`/`AddFolderAsync` append via `MAX(sort_order)+1` over **both**. Never renumber one table on its own.
- **WorktreeRepository** — CRUD, `UpdateHeadAsync`, `SetStateAsync`, `SetMergedAsync` (atomically sets State=Merged **and** stamps MergeCommit in one update — the only writer of MergeCommit)
- **TaskAttachmentRepository** — `AddAsync`, `UpdateAsync`, `GetAsync(taskId, fileName)`, `ListByTaskIdAsync`, `DeleteAsync(taskId, fileName)`. Bulk delete-per-task is the `ON DELETE CASCADE` on `task_attachments`, not a repository method.
- **DailyNoteRepository**, **WeekReportRepository**, **TaskRunRepository**, **SubtaskRepository**, **AppSettingsRepository**
@@ -116,6 +119,7 @@ Tables (one per line so parallel migrations don't collide on the same line):
- `week_reports`
- `task_attachments`
- `task_dependencies`
- `list_folders`
Managed by EF Core migrations in `Migrations/`. **The 40 incremental migrations were squashed into
a single `20260826094154_InitialCreate` on 2026-08-26** — the schema history is git history now,
+1
View File
@@ -43,6 +43,7 @@ public class ClaudeDoDbContext : DbContext
public DbSet<TaskEntity> Tasks => Set<TaskEntity>();
public DbSet<TaskDependencyEntity> TaskDependencies => Set<TaskDependencyEntity>();
public DbSet<ListEntity> Lists => Set<ListEntity>();
public DbSet<ListFolderEntity> ListFolders => Set<ListFolderEntity>();
public DbSet<ListConfigEntity> ListConfigs => Set<ListConfigEntity>();
public DbSet<WorktreeEntity> Worktrees => Set<WorktreeEntity>();
public DbSet<TaskRunEntity> TaskRuns => Set<TaskRunEntity>();
@@ -20,8 +20,17 @@ public class ListEntityConfiguration : IEntityTypeConfiguration<ListEntity>
builder.Property(l => l.IsManual).HasColumnName("is_manual").IsRequired().HasDefaultValue(false);
builder.Property(l => l.FindingsTracked).HasColumnName("findings_tracked").IsRequired().HasDefaultValue(false);
builder.Property(l => l.Icon).HasColumnName("icon");
builder.Property(l => l.FolderId).HasColumnName("folder_id");
builder.HasIndex(l => l.SortOrder).HasDatabaseName("idx_lists_sort");
builder.HasIndex(l => l.FolderId).HasDatabaseName("idx_lists_folder");
// No navigation property on either side: nothing needs the graph, and a nav would have to
// be Include'd (or silently come back empty) in every list query.
builder.HasOne<ListFolderEntity>()
.WithMany()
.HasForeignKey(l => l.FolderId)
.OnDelete(DeleteBehavior.SetNull);
builder.HasOne(l => l.Config)
.WithOne(c => c.List)
@@ -0,0 +1,23 @@
using ClaudeDo.Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace ClaudeDo.Data.Configuration;
public class ListFolderEntityConfiguration : IEntityTypeConfiguration<ListFolderEntity>
{
public void Configure(EntityTypeBuilder<ListFolderEntity> builder)
{
builder.ToTable("list_folders");
builder.HasKey(f => f.Id);
builder.Property(f => f.Id).HasColumnName("id");
builder.Property(f => f.Name).HasColumnName("name").IsRequired();
builder.Property(f => f.CreatedAt).HasColumnName("created_at").IsRequired();
builder.Property(f => f.Icon).HasColumnName("icon");
builder.Property(f => f.SortOrder).HasColumnName("sort_order").IsRequired().HasDefaultValue(0);
builder.Property(f => f.IsCollapsed).HasColumnName("is_collapsed").IsRequired().HasDefaultValue(false);
builder.HasIndex(f => f.SortOrder).HasDatabaseName("idx_list_folders_sort");
}
}
+26 -3
View File
@@ -424,14 +424,22 @@ public sealed class GitService
return File.Exists(Path.Combine(gitDir, "MERGE_HEAD"));
}
/// <param name="autostash">Stash the target working tree's uncommitted changes before the
/// merge and restore them after it. Git owns the bookkeeping: on a conflict the stash stays
/// pending and is re-applied by `merge --continue`/`--abort`, so a conflicted merge left in
/// the tree doesn't lose it. A restore that itself conflicts leaves the stash in
/// `git stash list` rather than dropping it.</param>
public async Task<(int ExitCode, string Stderr)> MergeNoFfAsync(
string repoDir, string sourceBranch, string message, CancellationToken ct = default)
string repoDir, string sourceBranch, string message, CancellationToken ct = default,
bool autostash = false)
{
// diff3 conflict style writes the merge base (|||||||) into conflict markers so the
// in-app resolver can show a true three-way view. It only enriches conflicted hunks;
// clean merges are unaffected.
var (exitCode, _, stderr) = await RunGitAsync(repoDir,
["-c", "merge.conflictStyle=diff3", "merge", "--no-ff", "-m", message, sourceBranch], ct);
string[] args = autostash
? ["-c", "merge.conflictStyle=diff3", "merge", "--no-ff", "--autostash", "-m", message, sourceBranch]
: ["-c", "merge.conflictStyle=diff3", "merge", "--no-ff", "-m", message, sourceBranch];
var (exitCode, _, stderr) = await RunGitAsync(repoDir, args, ct);
return (exitCode, stderr);
}
@@ -550,6 +558,16 @@ public sealed class GitService
return exitCode == 0 ? stdout : null;
}
/// <summary>
/// Content of <paramref name="path"/> at <paramref name="revision"/> via `git show revision:path`.
/// Null when the path doesn't exist at that revision (new, deleted, or renamed file).
/// </summary>
public async Task<string?> ShowFileAsync(string repoDir, string revision, string path, CancellationToken ct = default)
{
var (exitCode, stdout, _) = await RunGitAsync(repoDir, ["show", $"{revision}:{path}"], ct, trimOutput: false);
return exitCode == 0 ? stdout : null;
}
/// <summary>
/// Non-destructive mergeability probe via `git merge-tree --write-tree`. Writes only
/// loose objects — the working tree, index, and refs are left untouched.
@@ -704,6 +722,11 @@ public sealed class GitService
// (mktree "input format error") and would prepend to stdin commit messages.
StandardInputEncoding = stdinData is not null ? new UTF8Encoding(false) : null,
};
// Force English stderr/stdout so the English-only substring matches below
// (e.g. "ambiguous argument 'HEAD'", "tell me who you are") work regardless
// of the OS locale git for Windows picks up.
psi.Environment["LC_ALL"] = "C";
psi.Environment["LANGUAGE"] = "C";
psi.ArgumentList.Add("-C");
psi.ArgumentList.Add(workDir);
foreach (var a in args) psi.ArgumentList.Add(a);
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClaudeDo.Data.Migrations
{
/// <inheritdoc />
public partial class AddListFolders : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "folder_id",
table: "lists",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "list_folders",
columns: table => new
{
id = table.Column<string>(type: "TEXT", nullable: false),
name = table.Column<string>(type: "TEXT", nullable: false),
created_at = table.Column<DateTime>(type: "TEXT", nullable: false),
icon = table.Column<string>(type: "TEXT", nullable: true),
sort_order = table.Column<int>(type: "INTEGER", nullable: false, defaultValue: 0),
is_collapsed = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: false)
},
constraints: table =>
{
table.PrimaryKey("PK_list_folders", x => x.id);
});
migrationBuilder.CreateIndex(
name: "idx_lists_folder",
table: "lists",
column: "folder_id");
migrationBuilder.CreateIndex(
name: "idx_list_folders_sort",
table: "list_folders",
column: "sort_order");
migrationBuilder.AddForeignKey(
name: "FK_lists_list_folders_folder_id",
table: "lists",
column: "folder_id",
principalTable: "list_folders",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_lists_list_folders_folder_id",
table: "lists");
migrationBuilder.DropTable(
name: "list_folders");
migrationBuilder.DropIndex(
name: "idx_lists_folder",
table: "lists");
migrationBuilder.DropColumn(
name: "folder_id",
table: "lists");
}
}
}
@@ -324,6 +324,10 @@ namespace ClaudeDo.Data.Migrations
.HasDefaultValue(false)
.HasColumnName("findings_tracked");
b.Property<string>("FolderId")
.HasColumnType("TEXT")
.HasColumnName("folder_id");
b.Property<string>("Icon")
.HasColumnType("TEXT")
.HasColumnName("icon");
@@ -351,12 +355,54 @@ namespace ClaudeDo.Data.Migrations
b.HasKey("Id");
b.HasIndex("FolderId")
.HasDatabaseName("idx_lists_folder");
b.HasIndex("SortOrder")
.HasDatabaseName("idx_lists_sort");
b.ToTable("lists", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.ListFolderEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<string>("Icon")
.HasColumnType("TEXT")
.HasColumnName("icon");
b.Property<bool>("IsCollapsed")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnName("is_collapsed");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0)
.HasColumnName("sort_order");
b.HasKey("Id");
b.HasIndex("SortOrder")
.HasDatabaseName("idx_list_folders_sort");
b.ToTable("list_folders", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.PrimeScheduleEntity", b =>
{
b.Property<Guid>("Id")
@@ -934,6 +980,14 @@ namespace ClaudeDo.Data.Migrations
b.Navigation("List");
});
modelBuilder.Entity("ClaudeDo.Data.Models.ListEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.ListFolderEntity", null)
.WithMany()
.HasForeignKey("FolderId")
.OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
+3
View File
@@ -16,6 +16,9 @@ public sealed class ListEntity
public bool FindingsTracked { get; set; }
// Icon key into the UI's icon library (e.g. "Star"); null = the default folder icon.
public string? Icon { get; set; }
// Sidebar folder this list sits in (ListFolderEntity.Id); null = top level. ON DELETE SET NULL,
// so deleting a folder moves its lists back to the top level instead of deleting them.
public string? FolderId { get; set; }
// Navigation properties
public ListConfigEntity? Config { get; set; }
@@ -0,0 +1,20 @@
namespace ClaudeDo.Data.Models;
/// <summary>
/// A sidebar folder grouping user lists. Deliberately its own table rather than a flag on
/// <see cref="ListEntity"/>: every place that enumerates lists (MCP list_task_lists, "move to
/// list", the queue picker, repo import) would otherwise have to filter folders out.
/// One level only — a folder holds lists, never other folders.
/// </summary>
public sealed class ListFolderEntity
{
public required string Id { get; init; }
public required string Name { get; set; }
public required DateTime CreatedAt { get; init; }
// Icon key into the UI's icon library, same set as ListEntity.Icon; null = default folder icon.
public string? Icon { get; set; }
public int SortOrder { get; set; }
// Sidebar expand/collapse state. Lives here rather than in ui.config.json because the row is
// already being read for the folder itself.
public bool IsCollapsed { get; set; }
}
+1 -1
View File
@@ -523,7 +523,7 @@ public static class PromptFiles
- Clean merge → mergeStatus "merged_verify_pending" (expected: the task deliberately stays WaitingForReview until verify_merges passes) or "merged" (list has no verify command; the task is Done). Either way, move on.
- Conflict (markers left in the working tree, repoPath returned) → resolve it below.
After each merge, main has moved — a clean preview_merge_set result from before this merge is now stale for the remaining tasks. If you are unsure whether an earlier overlap warning still matters, call preview_merge for the next task again before merging it.
After each merge, main has moved — a clean preview_merge_set result from before this merge is now stale for the remaining tasks. If you are unsure whether an earlier overlap warning still matters, call preview_merge for the next task again before merging it (default runVerify=false — this is just a conflict recheck, not a build; the verify command still runs once via verify_merges after the last merge).
Every branch in this run forked from the same base, so conflicts between them are the NORMAL case, not a failure. Resolve them and keep going; do not abandon the run because a merge conflicted.
@@ -17,10 +17,20 @@ public sealed class ListRepository
public async Task AddAsync(ListEntity entity, CancellationToken ct = default)
{
NormalizeWorkingDir(entity);
if (entity.SortOrder == 0) entity.SortOrder = await NextSortOrderAsync(ct);
_context.Lists.Add(entity);
await _context.SaveChangesAsync(ct);
}
/// <summary>One past the highest <c>sort_order</c> in use — across <b>both</b> tables, because
/// the sidebar interleaves folders and top-level lists in a single order sequence.</summary>
private async Task<int> NextSortOrderAsync(CancellationToken ct = default)
{
var maxList = await _context.Lists.MaxAsync(l => (int?)l.SortOrder, ct) ?? -1;
var maxFolder = await _context.ListFolders.MaxAsync(f => (int?)f.SortOrder, ct) ?? -1;
return Math.Max(maxList, maxFolder) + 1;
}
public async Task UpdateAsync(ListEntity entity, CancellationToken ct = default)
{
NormalizeWorkingDir(entity);
@@ -56,18 +66,83 @@ public sealed class ListRepository
return await _context.Lists.OrderBy(l => l.SortOrder).ThenBy(l => l.CreatedAt).ToListAsync(ct);
}
public async Task ReorderAsync(IReadOnlyList<string> orderedListIds, CancellationToken ct = default)
/// <summary>
/// Writes the sidebar's visual order as one sequence spanning both tables: folders and lists
/// share the <c>sort_order</c> number space, which is what lets a top-level list sit between
/// two folders. A folder's own children follow it in the sequence, so ordering folders by
/// <c>sort_order</c> and lists by <c>sort_order</c> independently still reproduces the sidebar.
/// </summary>
public async Task ReorderSidebarAsync(IReadOnlyList<(string Id, bool IsFolder)> ordered, CancellationToken ct = default)
{
var idSet = orderedListIds.ToHashSet();
var entities = await _context.Lists.Where(l => idSet.Contains(l.Id)).ToListAsync(ct);
for (int i = 0; i < orderedListIds.Count; i++)
var listIds = ordered.Where(o => !o.IsFolder).Select(o => o.Id).ToHashSet();
var folderIds = ordered.Where(o => o.IsFolder).Select(o => o.Id).ToHashSet();
var lists = await _context.Lists.Where(l => listIds.Contains(l.Id)).ToListAsync(ct);
var folders = await _context.ListFolders.Where(f => folderIds.Contains(f.Id)).ToListAsync(ct);
for (int i = 0; i < ordered.Count; i++)
{
var e = entities.FirstOrDefault(x => x.Id == orderedListIds[i]);
if (e is not null) e.SortOrder = i;
var (id, isFolder) = ordered[i];
if (isFolder)
{
if (folders.FirstOrDefault(f => f.Id == id) is { } folder) folder.SortOrder = i;
}
else if (lists.FirstOrDefault(l => l.Id == id) is { } list) list.SortOrder = i;
}
await _context.SaveChangesAsync(ct);
}
// ---- Sidebar folders (list_folders) ----
// Folders live here rather than in their own repository because they exist only as a grouping
// of these lists — every caller that touches one already holds a ListRepository.
public async Task<List<ListFolderEntity>> GetFoldersAsync(CancellationToken ct = default)
{
return await _context.ListFolders
.OrderBy(f => f.SortOrder).ThenBy(f => f.CreatedAt)
.ToListAsync(ct);
}
public async Task AddFolderAsync(ListFolderEntity folder, CancellationToken ct = default)
{
folder.SortOrder = await NextSortOrderAsync(ct);
_context.ListFolders.Add(folder);
await _context.SaveChangesAsync(ct);
}
/// <summary>Patches just the two editable fields — a whole-entity Update would need
/// <c>CreatedAt</c>/<c>SortOrder</c>/<c>IsCollapsed</c> carried along and silently reset
/// whichever the caller forgot (see the SetConfigAsync note in CLAUDE.md).</summary>
public async Task RenameFolderAsync(string folderId, string name, string? icon, CancellationToken ct = default)
{
await _context.ListFolders
.Where(f => f.Id == folderId)
.ExecuteUpdateAsync(s => s
.SetProperty(f => f.Name, name)
.SetProperty(f => f.Icon, icon), ct);
}
/// <summary>Deletes the folder only — its lists survive and fall back to the top level via
/// the ON DELETE SET NULL on <c>lists.folder_id</c>.</summary>
public async Task DeleteFolderAsync(string folderId, CancellationToken ct = default)
{
await _context.ListFolders.Where(f => f.Id == folderId).ExecuteDeleteAsync(ct);
}
public async Task SetFolderCollapsedAsync(string folderId, bool collapsed, CancellationToken ct = default)
{
await _context.ListFolders
.Where(f => f.Id == folderId)
.ExecuteUpdateAsync(s => s.SetProperty(f => f.IsCollapsed, collapsed), ct);
}
/// <summary>Moves a list into <paramref name="folderId"/>, or back to the top level when null.</summary>
public async Task SetListFolderAsync(string listId, string? folderId, CancellationToken ct = default)
{
await _context.Lists
.Where(l => l.Id == listId)
.ExecuteUpdateAsync(s => s.SetProperty(l => l.FolderId, folderId), ct);
}
public async Task<ListConfigEntity?> GetConfigAsync(string listId, CancellationToken ct = default)
{
return await _context.ListConfigs.FirstOrDefaultAsync(c => c.ListId == listId, ct);
+4 -2
View File
@@ -72,7 +72,8 @@ public record WorktreeOverviewDto(
WorktreeState State,
string? DiffStat,
DateTime CreatedAt,
bool PathExistsOnDisk);
bool PathExistsOnDisk,
int TaskNumber = 0);
public record ForceRemoveResultDto(bool Removed, string? Reason);
@@ -91,7 +92,8 @@ public record MergePreviewDto(
int? VerifyExitCode = null, long? VerifyDurationMs = null, string? VerifyOutputTail = null);
public record MergeTargetsDto(
string DefaultBranch, IReadOnlyList<string> LocalBranches, string DefaultCommitMessage);
string DefaultBranch, IReadOnlyList<string> LocalBranches, string DefaultCommitMessage,
bool TargetDirty = false);
public record MergeConflictDocumentsDto(string TaskId, IReadOnlyList<ConflictDocumentDto> Files);
@@ -1,5 +1,6 @@
using System.Text.Json;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -23,11 +24,12 @@ public sealed class ClaudeAuthCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var lookup = await _lookup.ResolveAsync(ctx, ct);
if (lookup.Resolved is null)
{
return CheckResult.Unknown(Id, Severity, "checks.claudeAuth.title",
"The claude CLI was not found — login could not be checked.");
loc?["checks.claudeAuth.notFound"] ?? "The claude CLI was not found — login could not be checked.");
}
var (fileName, arguments) = ProcessCommand.For(lookup.Resolved, "auth", "status", "--json");
@@ -36,19 +38,19 @@ public sealed class ClaudeAuthCheck : IEnvironmentCheck
if (exitCode != 0)
{
return CheckResult.Unknown(Id, Severity, "checks.claudeAuth.title",
"Login status could not be determined.", output);
loc?["checks.claudeAuth.undetermined"] ?? "Login status could not be determined.", output);
}
var loggedIn = TryParseLoggedIn(output);
if (loggedIn is null)
{
return CheckResult.Unknown(Id, Severity, "checks.claudeAuth.title",
"Login status could not be determined.", output);
loc?["checks.claudeAuth.undetermined"] ?? "Login status could not be determined.", output);
}
return loggedIn.Value
? CheckResult.Ok(Id, Severity, "checks.claudeAuth.title", "Logged in.")
: CheckResult.Fail(Id, Severity, "checks.claudeAuth.title", "Not logged in.", "checks.claudeAuth.hint");
? CheckResult.Ok(Id, Severity, "checks.claudeAuth.title", loc?["checks.claudeAuth.loggedIn"] ?? "Logged in.")
: CheckResult.Fail(Id, Severity, "checks.claudeAuth.title", loc?["checks.claudeAuth.notLoggedIn"] ?? "Not logged in.", "checks.claudeAuth.hint");
}
private static bool? TryParseLoggedIn(string output)
@@ -1,6 +1,7 @@
using System.IO;
using ClaudeDo.Data.Environment;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -21,20 +22,21 @@ public sealed class ClaudeCliCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var lookup = await _lookup.ResolveAsync(ctx, ct);
if (lookup.Resolved is null)
{
var searched = string.Join(", ", SearchedLocations());
return CheckResult.Fail(Id, Severity, "checks.claudeCli.title",
$"'{ctx.ClaudeBin}' was not found on PATH. Searched: {searched}.",
loc?.Get("checks.claudeCli.notFound", ctx.ClaudeBin, searched) ?? $"'{ctx.ClaudeBin}' was not found on PATH. Searched: {searched}.",
"checks.claudeCli.hint");
}
if (lookup.ExitCode != 0)
{
return CheckResult.Fail(Id, Severity, "checks.claudeCli.title",
$"'{lookup.Resolved.Path}' exited with code {lookup.ExitCode}.",
loc?.Get("checks.claudeCli.exitCode", lookup.Resolved.Path, lookup.ExitCode) ?? $"'{lookup.Resolved.Path}' exited with code {lookup.ExitCode}.",
"checks.claudeCli.hint", detail: lookup.Output);
}
@@ -42,7 +44,8 @@ public sealed class ClaudeCliCheck : IEnvironmentCheck
var detail = lookup.Resolved.IsShim
? "Resolved via a shim (.cmd/.bat/.ps1), not a native .exe."
: null;
return CheckResult.Ok(Id, Severity, "checks.claudeCli.title", $"{lookup.Resolved.Path} — {version}", detail);
return CheckResult.Ok(Id, Severity, "checks.claudeCli.title",
loc?.Get("checks.claudeCli.resolvedFormat", lookup.Resolved.Path, version) ?? $"{lookup.Resolved.Path} — {version}", detail);
}
private IEnumerable<string> SearchedLocations()
@@ -1,4 +1,5 @@
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -27,28 +28,29 @@ public sealed class ClaudeVersionCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var lookup = await _lookup.ResolveAsync(ctx, ct);
if (lookup.Resolved is null)
{
return CheckResult.Unknown(Id, Severity, "checks.claudeVersion.title",
"The claude CLI was not found — version could not be checked.");
loc?["checks.claudeVersion.notFound"] ?? "The claude CLI was not found — version could not be checked.");
}
if (lookup.ExitCode != 0 || lookup.ParsedVersion is null)
{
return CheckResult.Unknown(Id, Severity, "checks.claudeVersion.title",
$"Could not parse a version from '{lookup.Output.Trim()}'.");
loc?.Get("checks.claudeVersion.parseFailed", lookup.Output.Trim()) ?? $"Could not parse a version from '{lookup.Output.Trim()}'.");
}
if (lookup.ParsedVersion < MinimumVersion)
{
return CheckResult.Fail(Id, Severity, "checks.claudeVersion.title",
$"claude {lookup.ParsedVersion} is older than the required {MinimumVersion}.",
loc?.Get("checks.claudeVersion.tooOld", lookup.ParsedVersion, MinimumVersion) ?? $"claude {lookup.ParsedVersion} is older than the required {MinimumVersion}.",
"checks.claudeVersion.hint");
}
return CheckResult.Ok(Id, Severity, "checks.claudeVersion.title",
$"claude {lookup.ParsedVersion} meets the minimum ({MinimumVersion}).");
loc?.Get("checks.claudeVersion.ok", lookup.ParsedVersion, MinimumVersion) ?? $"claude {lookup.ParsedVersion} meets the minimum ({MinimumVersion}).");
}
}
+8 -3
View File
@@ -2,6 +2,7 @@ using System.Text.RegularExpressions;
using ClaudeDo.Data.Environment;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Core.Interfaces;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -27,10 +28,12 @@ public sealed class GitCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var resolved = ExecutableResolver.Resolve("git", _pathOverride, _pathExtOverride);
if (resolved is null)
{
return CheckResult.Fail(Id, Severity, "checks.git.title", "git was not found on PATH.",
return CheckResult.Fail(Id, Severity, "checks.git.title",
loc?["checks.git.notFound"] ?? "git was not found on PATH.",
"checks.git.hint", "https://git-scm.com/downloads");
}
@@ -39,11 +42,13 @@ public sealed class GitCheck : IEnvironmentCheck
if (exitCode != 0)
{
return CheckResult.Fail(Id, Severity, "checks.git.title", $"'{resolved.Path}' exited with code {exitCode}.",
return CheckResult.Fail(Id, Severity, "checks.git.title",
loc?.Get("checks.git.exitCode", resolved.Path, exitCode) ?? $"'{resolved.Path}' exited with code {exitCode}.",
"checks.git.hint", "https://git-scm.com/downloads", output);
}
var version = VersionPattern.Match(output) is { Success: true } match ? match.Value : output.Trim();
return CheckResult.Ok(Id, Severity, "checks.git.title", $"{resolved.Path} — {version}");
return CheckResult.Ok(Id, Severity, "checks.git.title",
loc?.Get("checks.git.resolvedFormat", resolved.Path, version) ?? $"{resolved.Path} — {version}");
}
}
@@ -1,6 +1,7 @@
using ClaudeDo.Data.Environment;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Core.Interfaces;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -25,10 +26,12 @@ public sealed class GitIdentityCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var resolved = ExecutableResolver.Resolve("git", _pathOverride, _pathExtOverride);
if (resolved is null)
{
return CheckResult.Unknown(Id, Severity, "checks.gitIdentity.title", "git was not found — identity could not be checked.");
return CheckResult.Unknown(Id, Severity, "checks.gitIdentity.title",
loc?["checks.gitIdentity.notFound"] ?? "git was not found — identity could not be checked.");
}
var name = await ReadConfigAsync(resolved, "user.name", ct);
@@ -48,7 +51,8 @@ public sealed class GitIdentityCheck : IEnvironmentCheck
_ => "user.email",
};
return CheckResult.Fail(Id, Severity, "checks.gitIdentity.title", $"Missing git identity: {missing}.", "checks.gitIdentity.hint");
return CheckResult.Fail(Id, Severity, "checks.gitIdentity.title",
loc?.Get("checks.gitIdentity.missing", missing) ?? $"Missing git identity: {missing}.", "checks.gitIdentity.hint");
}
private async Task<string> ReadConfigAsync(ResolvedExecutable resolved, string key, CancellationToken ct)
@@ -1,5 +1,6 @@
using System.Text.RegularExpressions;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -28,11 +29,12 @@ public sealed class PermissionModeAutoCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var lookup = await _lookup.ResolveAsync(ctx, ct);
if (lookup.Resolved is null)
{
return CheckResult.Unknown(Id, Severity, "checks.permissionModeAuto.title",
"The claude CLI was not found — permission-mode support could not be checked.");
loc?["checks.permissionModeAuto.notFound"] ?? "The claude CLI was not found — permission-mode support could not be checked.");
}
var (fileName, arguments) = ProcessCommand.For(lookup.Resolved, "--help");
@@ -41,17 +43,17 @@ public sealed class PermissionModeAutoCheck : IEnvironmentCheck
if (exitCode != 0 || string.IsNullOrWhiteSpace(output))
{
return CheckResult.Unknown(Id, Severity, "checks.permissionModeAuto.title",
"Could not determine whether --permission-mode auto is supported.");
loc?["checks.permissionModeAuto.undetermined"] ?? "Could not determine whether --permission-mode auto is supported.");
}
if (AutoIsListed(output))
{
return CheckResult.Ok(Id, Severity, "checks.permissionModeAuto.title",
"--permission-mode auto is recognized by this CLI.");
loc?["checks.permissionModeAuto.ok"] ?? "--permission-mode auto is recognized by this CLI.");
}
return CheckResult.Fail(Id, Severity, "checks.permissionModeAuto.title",
"This claude CLI version does not list 'auto' as a --permission-mode choice.",
loc?["checks.permissionModeAuto.notListed"] ?? "This claude CLI version does not list 'auto' as a --permission-mode choice.",
"checks.permissionModeAuto.hint");
}
+9 -3
View File
@@ -2,6 +2,7 @@ using System.Net;
using System.Net.Sockets;
using ClaudeDo.Installer.Checks.Interfaces;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -19,6 +20,7 @@ public sealed class PortCheck : IEnvironmentCheck
public async Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
var ports = new (string Label, int Port)[]
{
("SignalR", ctx.SignalRPort),
@@ -39,7 +41,9 @@ public sealed class PortCheck : IEnvironmentCheck
continue;
}
blocked.Add(owner is null ? $"{label} port {port} is in use." : $"{label} port {port} is in use by '{owner}'.");
blocked.Add(owner is null
? loc?.Get("checks.ports.inUse", label, port) ?? $"{label} port {port} is in use."
: loc?.Get("checks.ports.inUseBy", label, port, owner) ?? $"{label} port {port} is in use by '{owner}'.");
}
if (blocked.Count > 0)
@@ -49,10 +53,12 @@ public sealed class PortCheck : IEnvironmentCheck
if (ownWorker.Count > 0)
{
return CheckResult.Ok(Id, Severity, "checks.ports.title", $"In use by the running ClaudeDo Worker: {string.Join(", ", ownWorker)}.");
var ownWorkerList = string.Join(", ", ownWorker);
return CheckResult.Ok(Id, Severity, "checks.ports.title",
loc?.Get("checks.ports.inUseByOwnWorker", ownWorkerList) ?? $"In use by the running ClaudeDo Worker: {ownWorkerList}.");
}
return CheckResult.Ok(Id, Severity, "checks.ports.title", "Ports are available.");
return CheckResult.Ok(Id, Severity, "checks.ports.title", loc?["checks.ports.available"] ?? "Ports are available.");
}
private static bool IsFree(int port)
@@ -1,6 +1,7 @@
using System.IO;
using ClaudeDo.Data;
using ClaudeDo.Installer.Core;
using ClaudeDo.Installer.Localization;
namespace ClaudeDo.Installer.Checks;
@@ -14,17 +15,19 @@ public sealed class WriteAccessCheck : IEnvironmentCheck
public Task<CheckResult> RunAsync(InstallContext ctx, CancellationToken ct)
{
var loc = TrExtension.Localizer;
foreach (var target in new[] { ctx.InstallDirectory, Paths.AppDataRoot() })
{
var error = TryWrite(target);
if (error is not null)
{
return Task.FromResult(CheckResult.Fail(Id, Severity, "checks.writeAccess.title",
$"Cannot write to '{target}': {error}", "checks.writeAccess.hint"));
loc?.Get("checks.writeAccess.cannotWrite", target, error) ?? $"Cannot write to '{target}': {error}", "checks.writeAccess.hint"));
}
}
return Task.FromResult(CheckResult.Ok(Id, Severity, "checks.writeAccess.title", "Install directory and data directory are writable."));
return Task.FromResult(CheckResult.Ok(Id, Severity, "checks.writeAccess.title",
loc?["checks.writeAccess.writable"] ?? "Install directory and data directory are writable."));
}
private static string? TryWrite(string path)
+115 -63
View File
@@ -11,6 +11,7 @@
"categoryGeneral": "Allgemein",
"categoryExecution": "Ausführung",
"categoryPrime": "Prime Claude",
"categoryPrimeHint": "Geplante Claude-Läufe: Ping, My Day füllen oder ein eigener Prompt, zu festen Zeiten.",
"categoryWorktrees": "Worktrees",
"categoryFiles": "Dateien & Prompts",
"categorySkills": "Session Skills",
@@ -27,6 +28,7 @@
"model": "Modell",
"maxTurns": "Max. Durchläufe",
"effort": "Effort",
"effortHint": "Denkaufwand, den das Modell anwendet. Höher kostet mehr und denkt tiefer.",
"modelPresets": "Vorgaben pro Modell",
"modelPresetsHint": "Effort und Durchlauf-Budget, mit denen eine Sitzung unter diesem Modell läuft. Overrides auf Listen- und Aufgabenebene gewinnen weiterhin.",
"maxTurnsCeiling": "Max. Durchläufe – Obergrenze",
@@ -36,11 +38,11 @@
"maxParallelExecutions": "Max. parallele Ausführungen",
"maxParallelExecutionsHint": "Wie viele Aufgaben aus der Warteschlange der Worker gleichzeitig ausführt.",
"usageGateHeading": "Usage-Limit-Stopp",
"usageGateHint": "Ab dieser Auslastung holt die Queue keine neuen Tasks mehr; laufende Tasks laufen zu Ende. 0 schaltet den Stopp ab.",
"usageGateHint": "Ab dieser Auslastung holt die Warteschlange keine neuen Aufgaben mehr; laufende Aufgaben laufen zu Ende. 0 schaltet den Stopp ab.",
"usageGateFiveHourPct": "5-Stunden-Fenster (%)",
"usageGateSevenDayPct": "7-Tage-Fenster (%)",
"autoContinueOnUsageLimit": "Nach Limit-Reset fortsetzen",
"autoContinueOnUsageLimitHint": "Ist ein Run am Nutzungslimit abgebrochen, wird er nach Ablauf des 5-Stunden-Fensters automatisch fortgesetzt. Weckt außerdem die pausierte Queue genau zum Reset-Zeitpunkt statt erst beim nächsten Backstop-Check.",
"autoContinueOnUsageLimitHint": "Ist ein Run am Nutzungslimit abgebrochen, wird er nach Ablauf des 5-Stunden-Fensters automatisch fortgesetzt. Weckt außerdem die pausierte Warteschlange genau zum Reset-Zeitpunkt statt erst beim nächsten Backstop-Check.",
"listHandlerMaxHandoffs": "Handoff-Budget des List-Handlers",
"listHandlerMaxHandoffsHint": "Wie viele Wait/Merge-Handoffs ein „Let Claude handle it\"-Run verketten darf. 4 entspricht zwei Merge-Runden. Für Läufe, die stundenlang durchlaufen sollen, höher setzen; der Wert begrenzt eine entlaufene Kette und darf daher nicht 0 sein.",
"powerUseHeading": "PowerUse",
@@ -50,8 +52,9 @@
"powerUseWindowPlaceholder": "HH:mm",
"powerUseHandoffPct": "Übergabe bei (% von 5h)",
"powerUseWindowHint": "Beide Zeiten leer = rund um die Uhr. Das Fenster wird bei jedem Start einer Handler-Phase geprüft — eine Kette, die über das Ende hinausläuft, macht ohne PowerUse weiter.",
"powerUseWindowInvalid": "PowerUse-Zeiten müssen im Format HH:mm sein oder leer bleiben.",
"throttleStagesHeading": "Throttle-Stufen",
"throttleStagesHint": "Die Parallelität wird vor dem harten Gate begrenzt: soft auf 2 Slots, hard auf 1. Eingestellt wird das durch Ziehen der Marker an den Gauges im Usage-Monitor. Der Monitor schließt diese Einstellungen — vorher speichern, wenn du etwas geändert hast.",
"throttleStagesHint": "Die Parallelität wird vor dem harten Limit-Stopp begrenzt: soft auf 2 Slots, hard auf 1. Eingestellt wird das durch Ziehen der Marker an den Gauges im Usage-Monitor. Der Monitor schließt diese Einstellungen — vorher speichern, wenn du etwas geändert hast.",
"throttleStagesValues": "5h: soft {0}% / hard {1}% · 7d: soft {2}% / hard {3}%",
"openUsageMonitor": "Usage-Monitor öffnen...",
"reportExcludedPaths": "Bericht: ausgeschlossene Pfade (einer pro Zeile)",
@@ -233,12 +236,13 @@
"reasonIsPlanningParent": "Teil eines Plans",
"reasonIsChildTask": "Teilaufgaben haben keine eigene Planungssitzung",
"reasonPlanAlreadyFinalized": "Plan ist bereits finalisiert",
"reasonNoWorktree": "Kein Worktree für diesen Task",
"reasonNoWorktree": "Kein Worktree für diese Aufgabe",
"cancel": "Abbrechen",
"removeFromQueueTip": "Aus Warteschlange entfernen",
"toggleSubtasksTip": "Unteraufgaben ein-/ausklappen",
"agentSuggestedTip": "Vom Agenten vorgeschlagen",
"interactiveChipTip": "Interaktive Sitzung offen — klicken, um im Mission Control dorthin zu springen",
"waitingOnTip": "Wartet auf {0}",
"scheduleTitle": "Aufgabe planen",
"scheduleWhen": "WANN",
"scheduleConfirm": "Planen",
@@ -260,21 +264,24 @@
"contextOpenFindings": "Findings-Ordner öffnen",
"contextImportTickets": "Aus Ticketsystem aktualisieren",
"contextSettings": "Einstellungen…",
"contextFolderSettings": "Ordner-Einstellungen…",
"contextRemoveFromFolder": "Aus Ordner herausnehmen",
"newList": "Neue Liste",
"addReposTip": "Repos als Listen hinzufügen",
"noRepoBannerText": "Noch kein Repo verknüpft. ClaudeDo führt Tasks in einem Git-Repo aus.",
"noRepoBannerText": "Noch kein Repo verknüpft. ClaudeDo führt Aufgaben in einem Git-Repo aus.",
"noRepoBannerButton": "Repo importieren",
"importTicketsResult": "{0} Tickets geprüft, {1} neue Tasks."
},
"details": {
"deleteTaskTip": "Aufgabe löschen",
"killSessionTip": "Laufende Sitzung beenden",
"killSessionTip": "Laufende Sitzung hart beenden",
"sendToQueue": "In Warteschlange einreihen",
"sendToQueueTip": "Diese Aufgabe in die Warteschlange einreihen, damit Claude sie beim nächsten Lauf übernimmt",
"copyTaskIdTip": "Aufgaben-ID kopieren",
"starTip": "Favorit",
"agentSettingsTip": "Agent-Einstellungen",
"agentSettingsHeading": "Agent-Einstellungen (Überschreibungen)",
"waitingOnPrefix": "Wartet auf",
"copyFormattedTip": "Titel, Beschreibung und offene Schritte kopieren",
"toggleEditPreviewTip": "Bearbeiten/Vorschau umschalten",
"planDay": "Tag planen",
@@ -300,7 +307,37 @@
"steps": "Schritte",
"files": "Dateien"
},
"emptyState": "Wähle eine Aufgabe aus, um Details zu sehen"
"emptyState": "Wähle eine Aufgabe aus, um Details zu sehen",
"roadblockLabel": "ROADBLOCK",
"stepsCard": {
"preview": "Vorschau",
"edit": "Bearbeiten",
"addStepPlaceholder": "Schritt hinzufügen…"
},
"workConsole": {
"continue": "Fortsetzen",
"resetAndRetry": "Zurücksetzen & erneut versuchen",
"tabOutput": "Ausgabe",
"tabGit": "Git",
"tabSession": "Sitzung",
"outcomeLabel": "ERGEBNIS",
"reviewLabel": "REVIEW",
"mergeLabel": "MERGE",
"targetBranch": "Zielbranch",
"openDiff": "Diff öffnen",
"worktree": "Worktree",
"reviewCombinedDiff": "Kombinierten Diff prüfen",
"openDiffHint": "Diff öffnen, um Mergen freizuschalten",
"targetDirty": "Ziel-Arbeitsverzeichnis hat uncommittete Änderungen — beim Mergen werden sie gestasht und danach wiederhergestellt.",
"approveMerge": "Genehmigen & Mergen",
"park": "Parken",
"parkTip": "Zurückstellen — zurück auf Leerlauf, Worktree bleibt erhalten",
"cancel": "Abbrechen",
"resetDiscardBranch": "Zurücksetzen (Branch verwerfen)…",
"submitForReviewHint": "Von Hand daran gearbeitet? Den Worktree zum Review einreichen, um ihn zu mergen.",
"submitForReview": "Zum Review einreichen",
"outcomesLabel": "ERGEBNISSE"
}
},
"agent": {
"openWorktreeTip": "Worktree im Datei-Explorer öffnen — benötigt einen aktiven Worktree",
@@ -343,10 +380,13 @@
"browseForFolder": "Ordner wählen…",
"focusMode": "Fokus",
"overviewMode": "Übersicht",
"closeSession": "Sitzung beenden",
"closeSession": "Sitzung hart beenden",
"closeSessionConfirm": "Laufende Sitzung beenden? Der Claude-Prozess wird abgebrochen.",
"conptyLaunchFailed": "Interaktive Sitzung konnte nicht geöffnet werden: {0}",
"conptyStarting": "Sitzung wird gestartet…",
"conptyExited": "Sitzung beendet (Code {0}).",
"usageWarningNotDelivered": "Die Listen-Handler-Sitzung konnte nicht vor dem Usage-Limit gewarnt werden.",
"terminalSendFailed": "Konnte nicht an die Terminal-Sitzung gesendet werden.",
"mergeHelperTitle": "Merge-Helfer",
"mergeHelperHandoffTitleSuffix": " (Übergabe)",
"mergeHelperTaskTitle": "Listen-Handler: {0}",
@@ -364,7 +404,7 @@
"queueRefreshFailed": "Warteschlange konnte nicht aktualisiert werden: {0}",
"abandonRun": "Lauf abbrechen",
"abandonRunTip": "Die noch offenen Tasks dieses Laufs abbrechen und die Sitzung schließen",
"abandonRunConfirm": "{0} offene(n) Task(s) abbrechen und diese Sitzung schließen? Tasks im Review oder bereits erledigt bleiben unangetastet.",
"abandonRunConfirm": "{0} offene Aufgabe(n) abbrechen und diese Sitzung schließen? Aufgaben im Review oder bereits erledigt bleiben unangetastet.",
"abandonRunFailed": "Offene Tasks konnten nicht abgebrochen werden: {0}",
"question": {
"title": "Claude fragt nach",
@@ -399,11 +439,18 @@
"body": "ClaudeDo kann den Hintergrund-Worker nicht erreichen. Normalerweise wird er bei der Anmeldung automatisch gestartet. Du kannst ihn jetzt starten oder neu installieren, falls das Problem bestehen bleibt.",
"dismiss": "Ausblenden",
"rerunInstaller": "Installer erneut ausführen",
"startWorker": "Worker starten"
"startWorker": "Worker starten",
"workerNotFound": "Worker-Programm nicht gefunden. Installation prüfen.",
"installerNotFound": "Installer nicht gefunden. Installation prüfen.",
"startFailed": "Start fehlgeschlagen: {0}"
},
"listSettings": {
"title": "LISTENEINSTELLUNGEN",
"folderTitle": "ORDNER",
"deleteList": "Liste löschen",
"deleteFolder": "Ordner löschen",
"createAsFolder": "Stattdessen einen Ordner anlegen",
"createAsFolderHint": "Ein Ordner gruppiert nur Listen in der Seitenleiste — er enthält keine Aufgaben und führt nichts aus. Listen per Drag-and-Drop hineinziehen.",
"sectionGeneral": "ALLGEMEIN",
"name": "Name",
"workingDirectory": "Arbeitsverzeichnis",
@@ -435,7 +482,8 @@
"targetBranch": "Ziel-Branch",
"removeWorktree": "Worktree nach dem Mergen entfernen",
"commitMessage": "Commit-Nachricht",
"conflictedFiles": "Konfliktdateien:"
"conflictedFiles": "Konfliktdateien:",
"stashAndMerge": "Änderungen stashen und mergen"
},
"diff": {
"title": "DIFF",
@@ -491,6 +539,8 @@
"windowTitle": "Claude machen lassen",
"scopeList": "Liste: {0}",
"scopeReview": "Alle Listen — Tasks im Review",
"modelLabel": "Modell",
"modelTip": "Modell für die Triage-Session (Dedupe & Verfeinern). Spätere Merge-Phasen laufen immer auf Opus.",
"confirm": "Claude machen lassen",
"cancel": "Abbrechen",
"selectAll": "Alle auswählen",
@@ -531,14 +581,14 @@
"noGauges": "Noch keine Nutzungslimits gemeldet.",
"refreshHint": "Jetzt aktualisieren — Abruf alle 5 Min., während ein Task läuft, sonst alle 15 Min.",
"staleFormat": "Werte veraltet (Stand {0})",
"staleGateHint": "Das Gate greift in diesem Zustand nicht.",
"staleGateHint": "Der Limit-Stopp greift in diesem Zustand nicht.",
"gateBlockedFormat": "Warteschlange pausiert — {0}",
"throttleFormat": "Warteschlange gedrosselt: {0}/{1} Slots ({2})",
"resetIn": "Reset in {0} ({1})",
"dragHint": "Marker ziehen oder Wert unten eintragen.",
"legendSoft": "Soft · 2 Slots",
"legendHard": "Hard · 1 Slot",
"legendGate": "Gate · Pause",
"legendGate": "Limit-Stopp · Pause",
"gaugeSession": "Session (5 Std.)",
"gaugeWeeklyAll": "Woche (alle Modelle)",
"gaugeWeeklyScopedFormat": "Woche ({0})",
@@ -558,7 +608,7 @@
"columnOtherOut": "ÜBRIGES OUT",
"columnOtherCache": "ÜBRIGES CACHE",
"columnShare": "ANTEIL",
"columnTask": "TASK",
"columnTask": "AUFGABE",
"columnList": "LISTE",
"columnModelShort": "MODELL",
"columnRuns": "RUNS",
@@ -662,35 +712,61 @@
"checks": {
"git": {
"title": "Git",
"hint": "Installiere Git und stelle sicher, dass es im PATH liegt."
"hint": "Installiere Git von https://git-scm.com/downloads und starte den Installer neu.",
"notFound": "git wurde nicht im PATH gefunden.",
"exitCode": "'{0}' wurde mit Exitcode {1} beendet.",
"resolvedFormat": "{0} — {1}"
},
"gitIdentity": {
"title": "Git-Identität",
"hint": "Lege deine Git-Identität fest: git config --global user.name \"...\" und user.email \"...\"."
"hint": "Führe aus: git config --global user.name \"Dein Name\" und git config --global user.email \"du@example.com\"",
"notFound": "git wurde nicht gefunden — Identität konnte nicht geprüft werden.",
"missing": "Fehlende Git-Identität: {0}."
},
"ports": {
"title": "Ports",
"hint": "Gib den Port frei oder ändere ihn nach der Installation auf der Worker-Seite."
"hint": "Ändere die SignalR-/MCP-Ports auf der Dienste-Seite, oder beende den blockierenden Prozess.",
"inUse": "{0}-Port {1} ist belegt.",
"inUseBy": "{0}-Port {1} ist belegt von '{2}'.",
"inUseByOwnWorker": "Belegt vom laufenden ClaudeDo Worker: {0}.",
"available": "Ports sind verfügbar."
},
"writeAccess": {
"title": "Schreibzugriff",
"hint": "Wähle ein anderes Installationsverzeichnis oder starte den Installer als Administrator."
"hint": "Wähle ein anderes Installationsverzeichnis oder starte den Installer mit ausreichenden Rechten (z. B. als Administrator).",
"cannotWrite": "Kein Schreibzugriff auf '{0}': {1}",
"writable": "Installations- und Datenverzeichnis sind beschreibbar."
},
"claudeCli": {
"title": "Claude CLI",
"hint": "Installiere die Claude CLI und stelle sicher, dass sie im PATH liegt."
"hint": "Installiere die Claude CLI (npm install -g @anthropic-ai/claude-code) und starte danach dein Terminal/deine Anmeldesitzung neu, damit der aktualisierte PATH greift.",
"notFound": "'{0}' wurde nicht im PATH gefunden. Durchsucht: {1}.",
"exitCode": "'{0}' wurde mit Exitcode {1} beendet.",
"resolvedFormat": "{0} — {1}"
},
"claudeVersion": {
"title": "Claude-CLI-Version",
"hint": "Aktualisiere die Claude CLI auf eine neuere Version."
"hint": "Aktualisiere die CLI: npm update -g @anthropic-ai/claude-code",
"notFound": "Die claude-CLI wurde nicht gefunden — Version konnte nicht geprüft werden.",
"parseFailed": "Konnte keine Version aus '{0}' auslesen.",
"tooOld": "claude {0} ist älter als die erforderliche Version {1}.",
"ok": "claude {0} erfüllt die Mindestanforderung ({1})."
},
"claudeAuth": {
"title": "Claude-Anmeldung",
"hint": "Führe 'claude auth login' aus, um dich anzumelden."
"title": "Claude-CLI-Login",
"hint": "Starte 'claude' einmal und schließe den Login-Vorgang ab.",
"notFound": "Die claude-CLI wurde nicht gefunden — Login konnte nicht geprüft werden.",
"undetermined": "Login-Status konnte nicht ermittelt werden.",
"notLoggedIn": "Nicht angemeldet.",
"loggedIn": "Angemeldet."
},
"permissionModeAuto": {
"title": "Berechtigungsmodus",
"hint": "Aktualisiere die Claude CLI auf eine Version, die --permission-mode auto unterstützt."
"hint": "Aktualisiere die CLI: npm update -g @anthropic-ai/claude-code. ClaudeDo funktioniert auch im Modus acceptEdits/default, dann mit mehr Rückfragen.",
"notFound": "Die claude-CLI wurde nicht gefunden — Unterstützung für permission-mode konnte nicht geprüft werden.",
"undetermined": "Konnte nicht ermitteln, ob --permission-mode auto unterstützt wird.",
"ok": "--permission-mode auto wird von dieser CLI erkannt.",
"notListed": "Diese claude-CLI-Version listet 'auto' nicht als --permission-mode-Option."
}
},
"planning": {
@@ -730,6 +806,14 @@
"done": "Fertig"
}
},
"dialog": {
"cancel": "Abbrechen",
"confirm": "Bestätigen",
"delete": "Löschen",
"ok": "OK",
"confirmTitle": "Bestätigen",
"errorTitle": "Fehler"
},
"shell": {
"menu": {
"help": "Hilfe",
@@ -737,6 +821,8 @@
"repositories": "Repositories",
"checkForUpdates": "Nach Updates suchen",
"restartWorker": "Worker neu starten",
"updateClaudeCli": "Claude CLI aktualisieren",
"shutdown": "Beenden",
"worktrees": "Worktrees…",
"weeklyReport": "Wochenbericht…",
"usageMonitor": "Usage Monitor…",
@@ -762,10 +848,10 @@
},
"vm": {
"connection": { "online": "Online", "connecting": "Verbinden…", "offline": "Offline" },
"shell": { "restartingWorker": "Worker wird neu gestartet…", "unexpectedError": "Unerwarteter Fehler: {0}" },
"shell": { "unexpectedError": "Unerwarteter Fehler: {0}", "shutdownConfirm": "Dadurch wird der ClaudeDo-Worker beendet (laufende Task-Runs und interaktive Sitzungen brechen ab) und die App geschlossen. Fortfahren?" },
"mainWindow": { "closeConfirm": { "message": "{0} Mission-Control-Sitzung(en) laufen noch. Beim Beenden werden sie abgebrochen. Trotzdem schließen?" } },
"agentStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "review": "Prüfung", "children": "Wartet auf Teilaufgaben", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen" },
"taskStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "waitingForReview": "Wartet auf Prüfung", "waitingForChildren": "Wartet auf Teilaufgaben", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen", "parked": "Geparkt", "interactive": "Interaktiv" },
"taskStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "waitingForReview": "Wartet auf Prüfung", "waitingForChildren": "Wartet auf Teilaufgaben", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen", "parked": "Geparkt", "interactive": "Interaktiv", "waiting": "Wartet" },
"failureReason": { "maxTurns": "Turn-Limit erreicht", "timeout": "Zeitüberschreitung", "usageLimit": "Nutzungslimit erreicht", "error": "Fehler", "cancelled": "Abgebrochen", "unknown": "Grund unbekannt" },
"failureReasonTooltip": { "maxTurns": "Turn-Limit erreicht ({0}/{1} Turns) — der Worktree ist meist brauchbar; Task fortsetzen statt zurücksetzen." },
"planningBadge": { "active": "PLANUNG", "finalized": "GEPLANT" },
@@ -774,7 +860,7 @@
"tasksIsland": { "completedHeader": "ABGESCHLOSSEN", "completedHeaderCount": "ABGESCHLOSSEN · {0}", "statusPill": "{0} laufend · {1} Prüfung", "openTaskOne": "1 offene Aufgabe", "openTasks": "{0} offene Aufgaben", "planningResumeFailed": "Planungssitzung konnte nicht fortgesetzt werden: {0}", "approveFailed": "Genehmigen & Mergen fehlgeschlagen: {0}", "cancelReviewFailed": "Prüfung abbrechen fehlgeschlagen: {0}", "sendToQueueFailed": "In die Warteschlange stellen fehlgeschlagen: {0}", "queuePlanBlockedInteractive": "Plan kann nicht in die Warteschlange gestellt werden — {0} hat eine offene interaktive Sitzung und muss zuerst geschlossen werden.", "moveRunningRejected": "Ein laufender Task kann nicht in eine andere Liste verschoben werden.", "moveWorktreeRejected": "Verschieben nicht möglich — dieser Task hat einen aktiven Worktree, der auf sein aktuelles Repo zeigt.", "moveRepoConfirm": "Unterschiedliche Repos — {0} → {1}. Task trotzdem verschieben?", "moveConfirmUnavailable": "Verschieben nicht möglich — der Bestätigungsdialog ist nicht verfügbar.", "quickClaudeNoWorkingDir": "Für diese Liste ist kein Arbeitsverzeichnis konfiguriert.", "quickClaudeDirMissing": "Arbeitsverzeichnis existiert nicht mehr: {0}", "setStatusFailed": "Status konnte nicht aktualisiert werden: {0}", "cancelFailed": "Abbrechen fehlgeschlagen: {0}", "rejectToQueueFailed": "Zurückweisen in die Warteschlange fehlgeschlagen: {0}", "rejectToIdleFailed": "Zurückweisen fehlgeschlagen: {0}", "deleteTaskConfirm": "\"{0}\" löschen? Dies kann nicht rückgängig gemacht werden.", "deleteTaskFailed": "Löschen fehlgeschlagen: {0}", "toggleDoneFailed": "Erledigt-Status konnte nicht aktualisiert werden: {0}", "removeFromQueueFailed": "Aus der Warteschlange entfernen fehlgeschlagen: {0}", "openWorktreeFailed": "Worktree konnte nicht geöffnet werden: {0}" },
"diff": { "loadFailed": "Diff konnte nicht geladen werden: {0}", "noChanges": "Keine Änderungen anzuzeigen.", "unavailable": "Diff nicht mehr verfügbar — Commit-Bereich unvollständig." },
"planningDiff": { "hubError": "Kombinierte Vorschau konnte nicht erstellt werden (Hub-Fehler).", "conflict": "Kombinierte Vorschau nicht möglich: Teilaufgabe {0} steht im Konflikt mit einer früheren Teilaufgabe ({1} Dateien).", "buildFailed": "Kombinierte Vorschau konnte nicht erstellt werden: {0}" },
"merge": { "commitMessage": "chore: merge {0}", "progressMerging": "Wird zusammengeführt…", "progressVerifying": "Verify-Kommando der Liste läuft… ({0})", "workerOfflineBranches": "Worker offline — Branches können nicht aufgelistet werden.", "loadBranchesFailed": "Branches konnten nicht geladen werden: {0}", "merged": "Zusammengeführt.", "blocked": "Blockiert: {0}", "verifyFailed": "Merge ist gelandet, aber das Verify-Kommando der Liste ist fehlgeschlagen — die Aufgabe wurde nicht auf Erledigt gesetzt.", "untrackedCollision": "Merge abgelehnt — er würde eine unversionierte Datei im Ziel-Arbeitsverzeichnis überschreiben.", "unknownStatus": "Unbekannter Status: {0}", "mergeFailed": "Merge fehlgeschlagen: {0}" },
"merge": { "commitMessage": "chore: merge {0}", "progressMerging": "Wird zusammengeführt…", "progressVerifying": "Verify-Kommando der Liste läuft… ({0})", "workerOfflineBranches": "Worker offline — Branches können nicht aufgelistet werden.", "loadBranchesFailed": "Branches konnten nicht geladen werden: {0}", "merged": "Zusammengeführt.", "blocked": "Blockiert: {0}", "verifyFailed": "Merge ist gelandet, aber das Verify-Kommando der Liste ist fehlgeschlagen — die Aufgabe wurde nicht auf Erledigt gesetzt.", "untrackedCollision": "Merge abgelehnt — er würde eine unversionierte Datei im Ziel-Arbeitsverzeichnis überschreiben.", "dirtyTarget": "Merge abgelehnt — das Ziel-Arbeitsverzeichnis hat uncommittete Änderungen.", "targetDirty": "Das Ziel-Arbeitsverzeichnis hat bereits uncommittete Änderungen — stashen und mergen?", "unknownStatus": "Unbekannter Status: {0}", "mergeFailed": "Merge fehlgeschlagen: {0}" },
"settingsModal": { "workerOffline": "Worker offline — Einstellungen schreibgeschützt.", "saveFailed": "Speichern fehlgeschlagen: {0}" },
"onlineInbox": { "workerOffline": "Worker offline — Konfiguration kann nicht geladen werden.", "saved": "Konfiguration gespeichert.", "saveFailed": "Speichern fehlgeschlagen: {0}", "signedIn": "Erfolgreich angemeldet.", "signedInNoRole": "Angemeldet, aber diesem Konto fehlt die Rolle 'user' in Zitadel — die Online-Synchronisierung wird abgelehnt, bis die Rolle im ClaudeDo-Projekt zugewiesen wird.", "signInFailed": "Anmeldung fehlgeschlagen: {0}", "signedOut": "Abgemeldet.", "signOutFailed": "Abmeldung fehlgeschlagen: {0}" },
"tickets": { "connectionOk": "Verbunden als {0}.", "connectionMissingScopes": "Verbunden als {0}, aber es fehlen Scopes: {1}", "tokenCleared": "Token entfernt.", "workerOffline": "Worker nicht erreichbar." },
@@ -793,12 +879,12 @@
"sessionSkillsTab": { "installed": "Installiert: {0}", "installFailed": "Installation fehlgeschlagen: {0}", "updated": "Aktualisiert.", "updateFailed": "Aktualisierung fehlgeschlagen: {0}", "removed": "Entfernt.", "removeFailed": "Entfernen fehlgeschlagen: {0}" },
"worktreesTab": { "workerOffline": "Worker offline.", "removed": "{0} Worktree(s) entfernt.", "blocked": "Zwangsentfernung nicht möglich: {0} Aufgabe(n) laufen noch. Brich sie zuerst ab.", "removedFrom": "{0} Worktree(s) von {1} Aufgabe(n) entfernt.", "cleanupFailed": "Aufräumen fehlgeschlagen: {0}", "resetFailed": "Zurücksetzen fehlgeschlagen: {0}" },
"worktreesOverview": { "titleAll": "Worktrees", "titleList": "Worktrees — {0}", "listFallback": "Liste", "cleanupFailed": "Aufräumen fehlgeschlagen.", "cleanupFailedDetailed": "Aufräumen fehlgeschlagen: {0}", "removed": "{0} Worktree(s) entfernt.", "discardConfirm": "Worktree für \"{0}\" verwerfen? Nicht committete Arbeit geht verloren.", "discardFailed": "Worktree konnte nicht verworfen werden.", "keepFailed": "Worktree konnte nicht behalten werden.", "cannotForceRunning": "Eine laufende Aufgabe kann nicht zwangsweise entfernt werden.", "forceRemoveFailed": "Zwangsentfernung fehlgeschlagen.", "forceRemoveFailedDetailed": "Zwangsentfernung fehlgeschlagen: {0}", "batchDone": "{0} gemergt, {1} zu lösen.", "openInExplorerFailed": "Pfad konnte nicht geöffnet werden: {0}" },
"listSettings": { "untitled": "Unbenannt", "ticketProjectNone": "— keins —", "loadFailed": "Listeneinstellungen konnten nicht geladen werden: {0}", "ticketProjectsLoadFailed": "Ticket-Projekte konnten nicht geladen werden: {0}" },
"detailsIsland": { "verifyFailed": "Merge ist erfolgt, aber das Verifikationskommando der Liste ist fehlgeschlagen — die Aufgabe wurde nicht auf 'Erledigt' gesetzt.", "untrackedCollision": "Merge abgelehnt — er würde eine unversionierte Datei im Ziel-Arbeitsverzeichnis überschreiben.", "stopOffline": "Worker offline — Task kann nicht gestoppt werden.", "stopFailed": "Stoppen fehlgeschlagen: {0}", "enqueueFailed": "In die Warteschlange stellen fehlgeschlagen: {0}", "dequeueFailed": "Aus der Warteschlange entfernen fehlgeschlagen: {0}", "resetAndRetryFailed": "Zurücksetzen & erneut versuchen fehlgeschlagen: {0}", "toggleDoneFailed": "Erledigt-Status konnte nicht aktualisiert werden: {0}" },
"listSettings": { "untitled": "Unbenannt", "ticketProjectNone": "— keins —", "loadFailed": "Listeneinstellungen konnten nicht geladen werden: {0}", "ticketProjectsLoadFailed": "Ticket-Projekte konnten nicht geladen werden: {0}", "confirmDeleteFolder": "Ordner \"{0}\" löschen? Die Listen darin bleiben erhalten und wandern auf die oberste Ebene.", "confirmDeleteList": "Liste \"{0}\" und alle ihre Aufgaben löschen? Das kann nicht rückgängig gemacht werden.", "deleteBlockedPlanning": "Diese Liste hat Planungssitzungen mit Kind-Aufgaben. Erst diese verwerfen, dann die Liste löschen.", "workingDirMissing": "Dieser Ordner existiert nicht.", "workingDirNotRepo": "Dieser Ordner ist noch kein Git-Repository. Führe darin zuerst `git init` aus, oder leere das Arbeitsverzeichnis, um dies als manuelle Liste zu speichern." },
"detailsIsland": { "verifyFailed": "Merge ist erfolgt, aber das Verifikationskommando der Liste ist fehlgeschlagen — die Aufgabe wurde nicht auf 'Erledigt' gesetzt.", "untrackedCollision": "Merge abgelehnt — er würde eine unversionierte Datei im Ziel-Arbeitsverzeichnis überschreiben.", "dirtyTarget": "Merge abgelehnt — das Ziel-Arbeitsverzeichnis hat uncommittete Änderungen.", "stashAndMergeConfirm": "Das Ziel-Arbeitsverzeichnis hat uncommittete Änderungen.\nStashen, mergen und danach wiederherstellen?", "stopOffline": "Worker offline — Task kann nicht gestoppt werden.", "stopFailed": "Stoppen fehlgeschlagen: {0}", "enqueueFailed": "In die Warteschlange stellen fehlgeschlagen: {0}", "dequeueFailed": "Aus der Warteschlange entfernen fehlgeschlagen: {0}", "resetAndRetryFailed": "Zurücksetzen & erneut versuchen fehlgeschlagen: {0}", "toggleDoneFailed": "Erledigt-Status konnte nicht aktualisiert werden: {0}" },
"mergeSection": { "openWorktreeFailed": "Worktree konnte nicht geöffnet werden: {0}" },
"about": { "openPathFailed": "Pfad konnte nicht geöffnet werden: {0}" },
"lists": { "localSuffix": "{0} / lokal", "smartMyDay": "Mein Tag", "smartImportant": "Wichtig", "smartPlanned": "Geplant", "smartNotes": "Notizen", "virtualQueue": "Warteschlange", "virtualRunning": "Läuft", "virtualReview": "Prüfung", "newList": "Neue Liste", "findingsNotFound": "Für diese Liste gibt es noch keine Findings.", "findingsOpenFailed": "Findings-Ordner konnte nicht geöffnet werden: {0}", "openInExplorerFailed": "Pfad konnte nicht geöffnet werden: {0}" },
"repoImport": { "loadFailed": "Gespeicherte Ordner konnten nicht geladen werden: {0}", "saveFailed": "Ordner konnten nicht gespeichert werden: {0}" }
"repoImport": { "loadFailed": "Gespeicherte Ordner konnten nicht geladen werden: {0}", "saveFailed": "Ordner konnten nicht gespeichert werden: {0}", "createButton": "{0} Liste(n) erstellen" }
},
"ops": {
"stalledHint": "Läuft weiter — Worker antwortet noch",
@@ -866,39 +952,5 @@
"lastError": "Letzter Fehler: {0}",
"throttled": "Gedrosselt: {0}/{1} Slots ({2})"
}
},
"checks": {
"git": {
"title": "Git",
"hint": "Installiere Git von https://git-scm.com/downloads und starte den Installer neu."
},
"gitIdentity": {
"title": "Git-Identität",
"hint": "Führe aus: git config --global user.name \"Dein Name\" und git config --global user.email \"du@example.com\""
},
"ports": {
"title": "Ports",
"hint": "Ändere die SignalR-/MCP-Ports auf der Dienste-Seite, oder beende den blockierenden Prozess."
},
"writeAccess": {
"title": "Schreibzugriff",
"hint": "Wähle ein anderes Installationsverzeichnis oder starte den Installer mit ausreichenden Rechten (z. B. als Administrator)."
},
"claudeCli": {
"title": "Claude CLI",
"hint": "Installiere die Claude CLI (npm install -g @anthropic-ai/claude-code) und starte danach dein Terminal/deine Anmeldesitzung neu, damit der aktualisierte PATH greift."
},
"claudeVersion": {
"title": "Claude-CLI-Version",
"hint": "Aktualisiere die CLI: npm update -g @anthropic-ai/claude-code"
},
"claudeAuth": {
"title": "Claude-CLI-Login",
"hint": "Starte 'claude' einmal und schließe den Login-Vorgang ab."
},
"permissionModeAuto": {
"title": "Unterstützung für --permission-mode auto",
"hint": "Aktualisiere die CLI: npm update -g @anthropic-ai/claude-code. ClaudeDo funktioniert auch im Modus acceptEdits/default, dann mit mehr Rückfragen."
}
}
}
+104 -52
View File
@@ -11,6 +11,7 @@
"categoryGeneral": "General",
"categoryExecution": "Execution",
"categoryPrime": "Prime Claude",
"categoryPrimeHint": "Scheduled Claude runs: Ping, Fill My Day, or a custom prompt, at fixed times.",
"categoryWorktrees": "Worktrees",
"categoryFiles": "Files & Prompts",
"categorySkills": "Session Skills",
@@ -27,6 +28,7 @@
"model": "Model",
"maxTurns": "Max turns",
"effort": "Effort",
"effortHint": "Reasoning effort the model applies. Higher costs more and reasons deeper.",
"modelPresets": "Per-model defaults",
"modelPresetsHint": "Reasoning effort and turn budget used when a session runs under that model. List- and task-level max-turn overrides still win.",
"maxTurnsCeiling": "Max turns ceiling",
@@ -50,6 +52,7 @@
"powerUseWindowPlaceholder": "HH:mm",
"powerUseHandoffPct": "Hand off at (% of 5h)",
"powerUseWindowHint": "Leave both times empty for round the clock. A window is checked whenever a handler phase starts, so a chain that runs past the end time continues without PowerUse.",
"powerUseWindowInvalid": "PowerUse window times must be HH:mm, or left blank.",
"throttleStagesHeading": "Throttle stages",
"throttleStagesHint": "Parallelism is capped before the hard gate: soft caps at 2 slots, hard at 1. Edited by dragging the markers on the usage-monitor gauges. Opening the monitor closes these settings — save first if you changed anything.",
"throttleStagesValues": "5h: soft {0}% / hard {1}% · 7d: soft {2}% / hard {3}%",
@@ -239,6 +242,7 @@
"toggleSubtasksTip": "Expand / collapse subtasks",
"agentSuggestedTip": "Suggested by the agent",
"interactiveChipTip": "Interactive session open — click to jump to it in Mission Control",
"waitingOnTip": "Waiting on {0}",
"scheduleTitle": "Schedule task",
"scheduleWhen": "WHEN",
"scheduleConfirm": "Schedule",
@@ -260,6 +264,8 @@
"contextOpenFindings": "Open findings folder",
"contextImportTickets": "Update from ticket system",
"contextSettings": "Settings…",
"contextFolderSettings": "Folder settings…",
"contextRemoveFromFolder": "Move out of folder",
"newList": "New list",
"addReposTip": "Add repos as lists",
"noRepoBannerText": "No repo linked yet. ClaudeDo runs tasks in a git repo.",
@@ -275,6 +281,7 @@
"starTip": "Star",
"agentSettingsTip": "Agent settings",
"agentSettingsHeading": "Agent settings (overrides)",
"waitingOnPrefix": "Waiting on",
"copyFormattedTip": "Copy title, description and open steps",
"toggleEditPreviewTip": "Toggle edit/preview",
"planDay": "Plan day",
@@ -300,7 +307,37 @@
"steps": "Steps",
"files": "Files"
},
"emptyState": "Select a task to see its details"
"emptyState": "Select a task to see its details",
"roadblockLabel": "ROADBLOCK",
"stepsCard": {
"preview": "Preview",
"edit": "Edit",
"addStepPlaceholder": "Add step…"
},
"workConsole": {
"continue": "Continue",
"resetAndRetry": "Reset & Retry",
"tabOutput": "Output",
"tabGit": "Git",
"tabSession": "Session",
"outcomeLabel": "OUTCOME",
"reviewLabel": "REVIEW",
"mergeLabel": "MERGE",
"targetBranch": "Target branch",
"openDiff": "Open Diff",
"worktree": "Worktree",
"reviewCombinedDiff": "Review Combined Diff",
"openDiffHint": "Open the diff to enable merge",
"targetDirty": "Target working directory has uncommitted changes — merging will stash and restore them.",
"approveMerge": "Approve & Merge",
"park": "Park",
"parkTip": "Set aside — back to Idle, keeps the worktree",
"cancel": "Cancel",
"resetDiscardBranch": "Reset (discard branch)…",
"submitForReviewHint": "Worked on this by hand? Submit the worktree for review to merge it.",
"submitForReview": "Submit for review",
"outcomesLabel": "OUTCOMES"
}
},
"agent": {
"openWorktreeTip": "Open worktree in file explorer — requires an active worktree",
@@ -344,9 +381,12 @@
"focusMode": "Focus",
"overviewMode": "Overview",
"closeSession": "Kill session",
"closeSessionConfirm": "End the running session? The Claude process will be aborted.",
"conptyLaunchFailed": "Couldn't open interactive session: {0}",
"conptyStarting": "Starting session…",
"conptyExited": "Session ended (code {0}).",
"usageWarningNotDelivered": "Couldn't warn the list-handler session about the usage limit.",
"terminalSendFailed": "Couldn't send that to the terminal session.",
"mergeHelperTitle": "Merge Helper",
"mergeHelperHandoffTitleSuffix": " (Handoff)",
"mergeHelperTaskTitle": "List handler: {0}",
@@ -399,11 +439,18 @@
"body": "ClaudeDo can't reach the background worker. It is normally started automatically at logon. You can start it now, or reinstall if the problem persists.",
"dismiss": "Dismiss",
"rerunInstaller": "Rerun Installer",
"startWorker": "Start Worker"
"startWorker": "Start Worker",
"workerNotFound": "Worker executable not found. Check the installation.",
"installerNotFound": "Installer not found. Check the installation.",
"startFailed": "Start failed: {0}"
},
"listSettings": {
"title": "LIST SETTINGS",
"folderTitle": "FOLDER",
"deleteList": "Delete list",
"deleteFolder": "Delete folder",
"createAsFolder": "Create a folder instead",
"createAsFolderHint": "A folder just groups lists in the sidebar — it holds no tasks and runs nothing. Drag lists onto it to fill it.",
"sectionGeneral": "GENERAL",
"name": "Name",
"workingDirectory": "Working directory",
@@ -435,7 +482,8 @@
"targetBranch": "Target branch",
"removeWorktree": "Remove worktree after merge",
"commitMessage": "Commit message",
"conflictedFiles": "Conflicted files:"
"conflictedFiles": "Conflicted files:",
"stashAndMerge": "Stash changes and merge"
},
"diff": {
"title": "DIFF",
@@ -491,6 +539,8 @@
"windowTitle": "Let Claude handle it",
"scopeList": "List: {0}",
"scopeReview": "All lists — tasks waiting for review",
"modelLabel": "Model",
"modelTip": "Model for the triage session (dedupe & refine). Later merge phases always run on opus.",
"confirm": "Let Claude handle it",
"cancel": "Cancel",
"selectAll": "Select all",
@@ -662,35 +712,61 @@
"checks": {
"git": {
"title": "Git",
"hint": "Install Git and make sure it is on PATH."
"hint": "Install Git from https://git-scm.com/downloads, then restart the installer.",
"notFound": "git was not found on PATH.",
"exitCode": "'{0}' exited with code {1}.",
"resolvedFormat": "{0} — {1}"
},
"gitIdentity": {
"title": "Git Identity",
"hint": "Set your git identity: git config --global user.name \"...\" and user.email \"...\"."
"hint": "Run: git config --global user.name \"Your Name\" and git config --global user.email \"you@example.com\"",
"notFound": "git was not found — identity could not be checked.",
"missing": "Missing git identity: {0}."
},
"ports": {
"title": "Ports",
"hint": "Free the port, or change it on the Worker page after install."
"hint": "Change the SignalR/MCP ports on the Service page, or stop the process using them.",
"inUse": "{0} port {1} is in use.",
"inUseBy": "{0} port {1} is in use by '{2}'.",
"inUseByOwnWorker": "In use by the running ClaudeDo Worker: {0}.",
"available": "Ports are available."
},
"writeAccess": {
"title": "Write Access",
"hint": "Choose a different install directory, or run the installer as administrator."
"hint": "Choose a different install directory, or run the installer with sufficient permissions (e.g. as administrator).",
"cannotWrite": "Cannot write to '{0}': {1}",
"writable": "Install directory and data directory are writable."
},
"claudeCli": {
"title": "Claude CLI",
"hint": "Install the Claude CLI and make sure it is on PATH."
"hint": "Install the Claude CLI (npm install -g @anthropic-ai/claude-code), then restart your terminal/login session so the updated PATH takes effect.",
"notFound": "'{0}' was not found on PATH. Searched: {1}.",
"exitCode": "'{0}' exited with code {1}.",
"resolvedFormat": "{0} — {1}"
},
"claudeVersion": {
"title": "Claude CLI Version",
"hint": "Update the Claude CLI to a newer version."
"hint": "Update the CLI: npm update -g @anthropic-ai/claude-code",
"notFound": "The claude CLI was not found — version could not be checked.",
"parseFailed": "Could not parse a version from '{0}'.",
"tooOld": "claude {0} is older than the required {1}.",
"ok": "claude {0} meets the minimum ({1})."
},
"claudeAuth": {
"title": "Claude Login",
"hint": "Run 'claude auth login' to sign in."
"title": "Claude CLI Login",
"hint": "Run 'claude' once and complete the login flow.",
"notFound": "The claude CLI was not found — login could not be checked.",
"undetermined": "Login status could not be determined.",
"notLoggedIn": "Not logged in.",
"loggedIn": "Logged in."
},
"permissionModeAuto": {
"title": "Permission Mode",
"hint": "Update the Claude CLI to a version that supports --permission-mode auto."
"hint": "Update the CLI: npm update -g @anthropic-ai/claude-code. ClaudeDo still works in acceptEdits/default mode, with more prompts.",
"notFound": "The claude CLI was not found — permission-mode support could not be checked.",
"undetermined": "Could not determine whether --permission-mode auto is supported.",
"ok": "--permission-mode auto is recognized by this CLI.",
"notListed": "This claude CLI version does not list 'auto' as a --permission-mode choice."
}
},
"planning": {
@@ -730,6 +806,14 @@
"done": "Done"
}
},
"dialog": {
"cancel": "Cancel",
"confirm": "Confirm",
"delete": "Delete",
"ok": "OK",
"confirmTitle": "Confirm",
"errorTitle": "Error"
},
"shell": {
"menu": {
"help": "Help",
@@ -737,6 +821,8 @@
"repositories": "Repositories",
"checkForUpdates": "Check for updates",
"restartWorker": "Restart worker",
"updateClaudeCli": "Update Claude CLI",
"shutdown": "Shutdown",
"worktrees": "Worktrees…",
"weeklyReport": "Weekly Report…",
"usageMonitor": "Usage Monitor…",
@@ -762,10 +848,10 @@
},
"vm": {
"connection": { "online": "Online", "connecting": "Connecting…", "offline": "Offline" },
"shell": { "restartingWorker": "Restarting worker…", "unexpectedError": "Unexpected error: {0}" },
"shell": { "unexpectedError": "Unexpected error: {0}", "shutdownConfirm": "This stops the ClaudeDo worker (any running task or interactive session is interrupted) and closes the app. Continue?" },
"mainWindow": { "closeConfirm": { "message": "{0} Mission Control session(s) are still running. Closing the app will end them. Close anyway?" } },
"agentStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "review": "Review", "children": "Waiting for Subtasks", "done": "Done", "failed": "Failed", "cancelled": "Cancelled" },
"taskStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "waitingForReview": "Waiting for Review", "waitingForChildren": "Waiting for Subtasks", "done": "Done", "failed": "Failed", "cancelled": "Cancelled", "parked": "Parked", "interactive": "Interactive" },
"taskStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "waitingForReview": "Waiting for Review", "waitingForChildren": "Waiting for Subtasks", "done": "Done", "failed": "Failed", "cancelled": "Cancelled", "parked": "Parked", "interactive": "Interactive", "waiting": "Waiting" },
"failureReason": { "maxTurns": "Turn limit reached", "timeout": "Timed out", "usageLimit": "Usage limit reached", "error": "Error", "cancelled": "Cancelled", "unknown": "Unknown reason" },
"failureReasonTooltip": { "maxTurns": "Turn limit reached ({0}/{1} turns) — the worktree is usually fine; continue the task instead of resetting it." },
"planningBadge": { "active": "PLANNING", "finalized": "PLANNED" },
@@ -774,7 +860,7 @@
"tasksIsland": { "completedHeader": "COMPLETED", "completedHeaderCount": "COMPLETED · {0}", "statusPill": "{0} running · {1} review", "openTaskOne": "1 open task", "openTasks": "{0} open tasks", "planningResumeFailed": "Couldn't resume planning session: {0}", "approveFailed": "Approve & merge failed: {0}", "cancelReviewFailed": "Cancel review failed: {0}", "sendToQueueFailed": "Send to queue failed: {0}", "queuePlanBlockedInteractive": "Can't queue the plan — {0} has an open interactive session and must be closed first.", "moveRunningRejected": "Can't move a running task to another list.", "moveWorktreeRejected": "Can't move — this task has an active worktree pointing at its current repo.", "moveRepoConfirm": "Different repos — {0} → {1}. Move the task anyway?", "moveConfirmUnavailable": "Can't move — the confirmation dialog isn't available.", "quickClaudeNoWorkingDir": "This list has no working directory configured.", "quickClaudeDirMissing": "Working directory no longer exists: {0}", "setStatusFailed": "Failed to update status: {0}", "cancelFailed": "Cancel failed: {0}", "rejectToQueueFailed": "Reject to queue failed: {0}", "rejectToIdleFailed": "Reject failed: {0}", "deleteTaskConfirm": "Delete \"{0}\"? This cannot be undone.", "deleteTaskFailed": "Delete failed: {0}", "toggleDoneFailed": "Couldn't update done state: {0}", "removeFromQueueFailed": "Remove from queue failed: {0}", "openWorktreeFailed": "Couldn't open worktree: {0}" },
"diff": { "loadFailed": "Failed to load diff: {0}", "noChanges": "No changes to show.", "unavailable": "Diff no longer available — commit range incomplete." },
"planningDiff": { "hubError": "Could not build combined preview (hub error).", "conflict": "Cannot build combined preview: subtask {0} conflicts with an earlier subtask ({1} files).", "buildFailed": "Could not build combined preview: {0}" },
"merge": { "commitMessage": "chore: merge {0}", "progressMerging": "Merging…", "progressVerifying": "Running the list's verify command… ({0})", "workerOfflineBranches": "Worker offline — cannot list branches.", "loadBranchesFailed": "Failed to load branches: {0}", "merged": "Merged.", "blocked": "Blocked: {0}", "verifyFailed": "Merge landed, but the list's verify command failed — the task was kept out of Done.", "untrackedCollision": "Merge refused — it would overwrite an untracked file in the target working directory.", "unknownStatus": "Unknown status: {0}", "mergeFailed": "Merge failed: {0}" },
"merge": { "commitMessage": "chore: merge {0}", "progressMerging": "Merging…", "progressVerifying": "Running the list's verify command… ({0})", "workerOfflineBranches": "Worker offline — cannot list branches.", "loadBranchesFailed": "Failed to load branches: {0}", "merged": "Merged.", "blocked": "Blocked: {0}", "verifyFailed": "Merge landed, but the list's verify command failed — the task was kept out of Done.", "untrackedCollision": "Merge refused — it would overwrite an untracked file in the target working directory.", "dirtyTarget": "Merge refused — the target working directory has uncommitted changes.", "targetDirty": "The target working directory already has uncommitted changes — stash them and merge?", "unknownStatus": "Unknown status: {0}", "mergeFailed": "Merge failed: {0}" },
"settingsModal": { "workerOffline": "Worker offline — settings read-only.", "saveFailed": "Save failed: {0}" },
"onlineInbox": { "workerOffline": "Worker offline — cannot load config.", "saved": "Config saved.", "saveFailed": "Save failed: {0}", "signedIn": "Signed in successfully.", "signedInNoRole": "Signed in, but this account is missing the 'user' role in Zitadel — online sync will be rejected until the role is granted in the ClaudeDo project.", "signInFailed": "Sign-in failed: {0}", "signedOut": "Signed out.", "signOutFailed": "Sign-out failed: {0}" },
"tickets": { "connectionOk": "Connected as {0}.", "connectionMissingScopes": "Connected as {0}, but missing scopes: {1}", "tokenCleared": "Token removed.", "workerOffline": "Worker not reachable." },
@@ -793,12 +879,12 @@
"sessionSkillsTab": { "installed": "Installed: {0}", "installFailed": "Install failed: {0}", "updated": "Updated.", "updateFailed": "Update failed: {0}", "removed": "Removed.", "removeFailed": "Remove failed: {0}" },
"worktreesTab": { "workerOffline": "Worker offline.", "removed": "Removed {0} worktree(s).", "blocked": "Cannot force-remove: {0} task(s) still running. Cancel them first.", "removedFrom": "Removed {0} worktree(s) from {1} task(s).", "cleanupFailed": "Cleanup failed: {0}", "resetFailed": "Reset failed: {0}" },
"worktreesOverview": { "titleAll": "Worktrees", "titleList": "Worktrees — {0}", "listFallback": "list", "cleanupFailed": "Cleanup failed.", "cleanupFailedDetailed": "Cleanup failed: {0}", "removed": "Removed {0} worktree(s).", "discardConfirm": "Discard the worktree for \"{0}\"? Uncommitted work will be lost.", "discardFailed": "Failed to discard worktree.", "keepFailed": "Failed to keep worktree.", "cannotForceRunning": "Cannot force-remove a running task.", "forceRemoveFailed": "Force remove failed.", "forceRemoveFailedDetailed": "Force remove failed: {0}", "batchDone": "Merged {0}, {1} need resolution.", "openInExplorerFailed": "Couldn't open path: {0}" },
"listSettings": { "untitled": "Untitled", "ticketProjectNone": "— none —", "loadFailed": "Couldn't load list settings: {0}", "ticketProjectsLoadFailed": "Couldn't load ticket projects: {0}" },
"detailsIsland": { "verifyFailed": "Merge landed, but the list's verify command failed — the task was kept out of Done.", "untrackedCollision": "Merge refused — it would overwrite an untracked file in the target working directory.", "stopOffline": "Worker offline — can't stop the task.", "stopFailed": "Stop failed: {0}", "enqueueFailed": "Queue failed: {0}", "dequeueFailed": "Remove from queue failed: {0}", "resetAndRetryFailed": "Reset & retry failed: {0}", "toggleDoneFailed": "Couldn't update done state: {0}" },
"listSettings": { "untitled": "Untitled", "ticketProjectNone": "— none —", "loadFailed": "Couldn't load list settings: {0}", "ticketProjectsLoadFailed": "Couldn't load ticket projects: {0}", "confirmDeleteFolder": "Delete folder \"{0}\"? The lists inside it are kept and move back to the top level.", "confirmDeleteList": "Delete list \"{0}\" and all its tasks? This cannot be undone.", "deleteBlockedPlanning": "This list has planning sessions with child tasks. Discard those first, then delete the list.", "workingDirMissing": "This folder doesn't exist.", "workingDirNotRepo": "This folder isn't a git repository yet. Run `git init` in it first, or clear the working directory to save this as a manual list." },
"detailsIsland": { "verifyFailed": "Merge landed, but the list's verify command failed — the task was kept out of Done.", "untrackedCollision": "Merge refused — it would overwrite an untracked file in the target working directory.", "dirtyTarget": "Merge refused — the target working directory has uncommitted changes.", "stashAndMergeConfirm": "The target working directory has uncommitted changes.\nStash them, merge, and restore them afterwards?", "stopOffline": "Worker offline — can't stop the task.", "stopFailed": "Stop failed: {0}", "enqueueFailed": "Queue failed: {0}", "dequeueFailed": "Remove from queue failed: {0}", "resetAndRetryFailed": "Reset & retry failed: {0}", "toggleDoneFailed": "Couldn't update done state: {0}" },
"mergeSection": { "openWorktreeFailed": "Couldn't open worktree: {0}" },
"about": { "openPathFailed": "Couldn't open path: {0}" },
"lists": { "localSuffix": "{0} / local", "smartMyDay": "My Day", "smartImportant": "Important", "smartPlanned": "Planned", "smartNotes": "Notes", "virtualQueue": "Queue", "virtualRunning": "Running", "virtualReview": "Review", "newList": "New list", "findingsNotFound": "No findings yet for this list.", "findingsOpenFailed": "Couldn't open findings folder: {0}", "openInExplorerFailed": "Couldn't open path: {0}" },
"repoImport": { "loadFailed": "Couldn't load remembered folders: {0}", "saveFailed": "Couldn't save folders: {0}" }
"repoImport": { "loadFailed": "Couldn't load remembered folders: {0}", "saveFailed": "Couldn't save folders: {0}", "createButton": "Create {0} list(s)" }
},
"ops": {
"stalledHint": "Still running — worker hasn't responded in a while",
@@ -866,39 +952,5 @@
"lastError": "Last error: {0}",
"throttled": "Throttled: {0}/{1} slots ({2})"
}
},
"checks": {
"git": {
"title": "Git",
"hint": "Install Git from https://git-scm.com/downloads, then restart the installer."
},
"gitIdentity": {
"title": "Git identity",
"hint": "Run: git config --global user.name \"Your Name\" and git config --global user.email \"you@example.com\""
},
"ports": {
"title": "Ports",
"hint": "Change the SignalR/MCP ports on the Service page, or stop the process using them."
},
"writeAccess": {
"title": "Write access",
"hint": "Choose a different install directory, or run the installer with sufficient permissions (e.g. as administrator)."
},
"claudeCli": {
"title": "Claude CLI",
"hint": "Install the Claude CLI (npm install -g @anthropic-ai/claude-code), then restart your terminal/login session so the updated PATH takes effect."
},
"claudeVersion": {
"title": "Claude CLI version",
"hint": "Update the CLI: npm update -g @anthropic-ai/claude-code"
},
"claudeAuth": {
"title": "Claude CLI login",
"hint": "Run 'claude' once and complete the login flow."
},
"permissionModeAuto": {
"title": "--permission-mode auto support",
"hint": "Update the CLI: npm update -g @anthropic-ai/claude-code. ClaudeDo still works in acceptEdits/default mode, with more prompts."
}
}
}
+3 -2
View File
@@ -41,6 +41,7 @@ Design/ — Tokens.axaml (design tokens; merged before styles)
- **IslandsShellViewModel** — root coordinator. Owns the three island VMs and the `WorkerClient`, wires cross-island events (selection, notes/prep mode, conflict resolution), connection state, the update banner, the inline worker-log strip (clickable → Log Visualizer overlay; `FlashFooterError` surfaces UI-action failures + the worker's Warn/Error there), responsive-layout flags (`ShowLists`/`ShowDetails` by window width), `PrimeStatus` flash, the modal openers, and `RestartWorkerAsync`/`CheckForUpdatesAsync`. Hosts `UpdateCheckService`.
- **ListsIslandViewModel** — smart lists (My Day, Important, Planned, virtual queued/running/review), user lists, selection, list CRUD, drag-reorder, badge counts, opens list settings / repo import / worktrees overview, `OpenInExplorer`/`OpenInTerminal`.
- **Folders:** the sidebar's top level is **one mixed collection**, `TopLevel` (`ObservableCollection<object>`: `ListFolderNavItemViewModel` rows, each with its own `Lists`, interleaved with folder-less `ListNavItemViewModel` rows) — that's what lets a list sit *above* a folder. `Folders`/`RootLists` are `OfType` **projections** of it, not collections to keep in sync. `UserLists` stays the **flat superset** every count refresh, row refresh and the no-repo banner work over — a row lives in both. `ContainerOf(row)` resolves which collection renders it (non-generic `IList`, since the top level is mixed). The view is a single `ItemsControl` over `TopLevel` with **implicit, type-matched `DataTemplate`s in `UserControl.DataTemplates`** — no keyed row template, and the folder's child `ItemsControl` resolves the same list template by walking up to the UserControl. A folder is never selectable: tapping the header runs `ToggleFolderCommand` (persisted to `list_folders.is_collapsed`), and its badge is the sum of its children. `DropAsync(source, target, placeBelow)` handles all four source/target combinations and doubles as the move: a drop position implies a container, so dropping a list onto a row in another folder — or next to *anything* at the top level, folder headers included — reassigns `FolderId`. A folder dropped onto a row inside a folder is ignored; folders never nest. `MoveToFolderAsync` is the drop-into-the-header path (reaches collapsed/empty folders, bound to the middle half of the header — the outer quarters insert *next to* the folder instead); `RemoveFromFolderCommand` is its context-menu counterpart. Both end in `PersistOrderAsync` → `ListRepository.ReorderSidebarAsync`, one `sort_order` sequence spanning **both tables**. ⚠️ A **folder** drag starts from `PointerMoved` past a 4px threshold using the *stored* `PointerPressedEventArgs` (`DoDragDropAsync` only accepts those) — starting it on press would capture the pointer and swallow the `Tapped` that folds the folder.
- **TasksIslandViewModel** — open/overdue/completed groups for the selected list with hierarchy-aware regrouping; task CRUD, drag-reorder, toggle done/star, schedule, enqueue/dequeue, cancel; review actions; planning session lifecycle; `RefineTask`, `OpenConPtySessionRequested`, `ToggleManual`, `SyncInteractiveSessions`; MyDay extras (`IsMyDayList`, `ClearDayCommand`, `ShowPrepLogCommand`) and the pinned Notes pseudo-row. Raises `NotesRequested`/`PrepRequested` for the shell.
- **DetailsIslandViewModel** — the detail pane for a bound `TaskRowViewModel`. Owns live-log streaming (`Log` via `StreamLineFormatter`), debounced title/description editing, subtasks, the session-outcome/roadblock split, the three-tab work console (`output`/`git`/`session`), child surfacing (`ChildOutcomes` + `ChildrenNeedingAttention` drive an attention band on the Session tab), attachments, and the modes `IsNotesMode`/`IsPrepMode`/computed `IsTaskDetailVisible`. Failures raise `ErrorReported`, wired by the shell into `FlashFooterError`.
- Three concerns are extracted into section VMs exposed as properties: `AgentSettings` (`AgentConfigEditorViewModel`, scope=Task), `MergeSectionViewModel`, `PrepPanelViewModel`. Helper rows live in the same file.
@@ -55,7 +56,7 @@ Design/ — Tokens.axaml (design tokens; merged before styles)
| VM | Notes |
|---|---|
| `SettingsModalViewModel` | Four tabs: General, Worktrees, Files (prompt paths), Prime Claude. General hosts the per-model preset table (`ModelPresetRowViewModel`: effort + max turns per alias) which **replaced** the single global "Max turns" field. The Prime Claude tab gives each schedule row a three-way action radio group (Ping / Fill My Day / Custom) — `RadioButton.GroupName` is bound to a **per-row** `RadioGroup` string, since a shared group name would make every schedule share one selection. `DailyPrepMaxTasks` is disabled unless some row is `FillMyDay`. |
| `ListSettingsModalViewModel` | Name, working dir, commit type, "manual list" flag, `VerifyCommand`, delete. Hosts the shared `AgentConfigEditorViewModel` as `Agent` (scope=List) — ⚠️ save delegates to `Agent.SaveAsync(verifyCommand)` because both land in the same `list_config` row via one `UpdateListConfig` call and would otherwise clobber each other. |
| `ListSettingsModalViewModel` | Name, working dir, commit type, "manual list" flag, `VerifyCommand`, delete. Hosts the shared `AgentConfigEditorViewModel` as `Agent` (scope=List) — ⚠️ save delegates to `Agent.SaveAsync(verifyCommand)` because both land in the same `list_config` row via one `UpdateListConfig` call and would otherwise clobber each other. **Doubles as the folder editor:** `IsFolder` collapses the body to name + icon, and it's reached either via the create-only "create a folder instead" toggle (`CanToggleFolder`, set by `BeginLoad`) or via `BeginLoadFolder` on an existing folder. There is no list↔folder conversion. Creating a folder writes a `list_folders` row and **deletes the list row the create flow pre-created**, reporting it as `Deleted` so the caller does a full reload. |
| `WeeklyReportModalViewModel` | Range pickers default "since last standup weekday → today", cached per range. |
| `MergeHelperSelectionModalViewModel` | "Let Claude handle it" picker → [conpty-sessions](../../docs/explore-notes/conpty-sessions.md). |
| `UsageMonitorModalViewModel` | Opened from the usage pill (shown **before** the data loads via `BeginLoad`); gauges are **dynamic** per `UsageSnapshotDto.Limits` row, and the 5h/7d ones carry three draggable stage markers (soft/hard/gate) via `UsageGaugeBar` + the pure `UsageThresholdDrag`, plus a colour-matched legend with a `NumericUpDown` per stage → [usage-monitoring](../../docs/explore-notes/usage-monitoring.md). The **analytics** part (models/tasks/cost) comes from the external TokenTracker export, not from us: without the CLI the modal shows a hint card with an install button (gated on Node ≥ 20) instead of the totals header. Gauges, gate and throttle are unaffected by it. The modal is **display + threshold drag only** — the PowerUse switch/window/handoff % it used to host moved to Settings → Execution (`GeneralSettingsTabViewModel`), and "Refresh now" is an icon in the titlebar via `ModalShell.HeaderActions` rather than a body row. |
@@ -91,7 +92,7 @@ single-task and planning unit-merge conflicts. Full detail →
The two surfaces are **not** variants of one control (read-only 2-way renderer over aligned rows
vs. 3-way editor over a writable document), but they share their AvaloniaEdit host plumbing via
`Views/Controls/DiffEditorSetup.cs`: the process-wide TextMate `Registry`, `InstallHighlighting`,
`ApplyGrammar`, the `Brush` resource fallback, the `Seg` segment, and `VerticalScrollSync`. Put
`ApplyGrammar`, the `Brush` resource fallback, the `Seg` segment, and `ScrollSync`. Put
new editor boilerplate there rather than copying it a third time.
## Services
+12
View File
@@ -297,6 +297,18 @@
<Setter Property="Foreground" Value="{StaticResource StatusQueuedBrush}" />
</Style>
<!-- waiting → muted amber: a Queued task blocked on an unmet predecessor (a task_dependencies
edge, or the planning chain's BlockedByTaskId) — distinct from queued (unblocked, next up
to run) and from children (a parent waiting on its own subtasks). Mutually exclusive with
.queued on the same chip (IsQueued/IsWaiting), so no declaration-order fight between them. -->
<Style Selector="Border.chip.waiting">
<Setter Property="Background" Value="#332F1A" />
<Setter Property="BorderBrush" Value="#4D451A" />
</Style>
<Style Selector="Border.chip.waiting > TextBlock">
<Setter Property="Foreground" Value="#C9A227" />
</Style>
<!-- done → green (#6FA86B) -->
<Style Selector="Border.chip.done">
<Setter Property="Background" Value="{StaticResource DoneTintBrush}" />
@@ -0,0 +1,45 @@
using System;
using System.IO;
using ClaudeDo.Data;
namespace ClaudeDo.Ui.Services;
/// <summary>
/// Temp PNGs written for clipboard-image paste into the interactive terminal (see
/// <see cref="ClaudeDo.Ui.Views.InteractiveTerminalView"/>) — dropped into the composer as a path,
/// the same way a file drop is, then read by Claude like any other file.
/// </summary>
public static class ClipboardImageTempStore
{
public static string Directory => Path.Combine(Paths.AppDataRoot(), "tmp");
/// <summary>A fresh, collision-free path for one pasted image.</summary>
public static string NewPngPath(DateTime utcNow) => NewPngPath(Directory, utcNow);
/// <summary>Deletes files older than <paramref name="maxAge"/> under the tmp dir — called once at
/// app startup, not a running cleanup service.</summary>
public static void DeleteOlderThan(TimeSpan maxAge, DateTime utcNow) => DeleteOlderThan(Directory, maxAge, utcNow);
/// <summary>Test seam for <see cref="NewPngPath(DateTime)"/> — takes the target dir explicitly
/// instead of the real app data root.</summary>
internal static string NewPngPath(string dir, DateTime utcNow) =>
Path.Combine(dir, $"paste-{utcNow:yyyyMMdd-HHmmssfff}-{Guid.NewGuid():N}.png");
/// <summary>Test seam for <see cref="DeleteOlderThan(TimeSpan,DateTime)"/> — takes the target dir
/// explicitly instead of the real app data root.</summary>
internal static void DeleteOlderThan(string dir, TimeSpan maxAge, DateTime utcNow)
{
if (!System.IO.Directory.Exists(dir)) return;
foreach (var file in System.IO.Directory.EnumerateFiles(dir))
{
try
{
if (utcNow - File.GetLastWriteTimeUtc(file) > maxAge)
File.Delete(file);
}
catch (IOException) { /* best effort */ }
catch (UnauthorizedAccessException) { /* best effort */ }
}
}
}
+3 -2
View File
@@ -28,8 +28,9 @@ public interface IDialogService
Task ShowConflictResolverAsync(ConflictResolverViewModel vm);
Task ShowLogVisualizerAsync(LogVisualizerViewModel vm);
/// <summary>Modal yes/no confirmation. Returns true only when confirmed.</summary>
Task<bool> ConfirmAsync(string message);
/// <summary>Modal yes/no confirmation. Returns true only when confirmed. <paramref name="confirmLabel"/>
/// overrides the default localized "Confirm" button text (e.g. a localized "Delete" for destructive actions).</summary>
Task<bool> ConfirmAsync(string message, string? confirmLabel = null);
/// <summary>Modal error notice with a single dismiss button.</summary>
Task ShowErrorAsync(string message);
@@ -1,9 +1,10 @@
namespace ClaudeDo.Ui.Services;
// Two named types because DI resolves them by type, not by key.
public sealed class InstallerLocator() : InstallArtifactLocator("uninstaller", "ClaudeDo.Installer.exe");
// Two named types because DI resolves them by type, not by key. Not sealed: tests subclass
// these to fake Find() without touching the real filesystem/registry.
public class InstallerLocator() : InstallArtifactLocator("uninstaller", "ClaudeDo.Installer.exe");
public sealed class WorkerLocator() : InstallArtifactLocator("worker", "ClaudeDo.Worker.exe");
public class WorkerLocator() : InstallArtifactLocator("worker", "ClaudeDo.Worker.exe");
/// <summary>
/// Locates an executable inside a ClaudeDo install: walk up from the running
@@ -14,7 +15,7 @@ public abstract class InstallArtifactLocator(string subdir, string exeName)
{
private const string InstallJson = "install.json";
public string? Find()
public virtual string? Find()
=> FindByWalkingUp(AppContext.BaseDirectory)
?? (OperatingSystem.IsWindows() ? FindByRegistry() : null);
@@ -52,13 +52,6 @@ public interface IWorkerClient : INotifyPropertyChanged
/// total.</summary>
event Action<string, string, int, int>? OperationProgressEvent;
/// <summary>(taskId, phase, elapsedSeconds) — phase of an in-flight single-task merge
/// ("merging" | "verifying"). Fires while the MergeTask call itself is still pending, so the
/// waiting UI can show what it's blocked on; the verify phase re-fires every 30 s. A thin
/// forwarder over <see cref="OperationProgressEvent"/> kept for existing consumers (elapsed
/// seconds riding in the generic "current" slot).</summary>
event Action<string, string, int>? MergeProgressEvent;
event Action<string, string>? PlanningMergeStartedEvent;
event Action<string, string>? PlanningSubtaskMergedEvent;
/// <summary>(planningTaskId, subtaskId, conflictedFiles, externallyDriven). externallyDriven
@@ -117,9 +110,11 @@ public interface IWorkerClient : INotifyPropertyChanged
/// and clears BlockedByTaskId in the same update) — call once per row (parent and each
/// queued child) rather than cascading server-side.</summary>
Task DequeueTaskAsync(string taskId);
Task<MergeResultDto?> ApproveReviewAsync(string taskId, string targetBranch);
/// <param name="autostash">Retry flag for status "dirty_target": stash the target working
/// tree's uncommitted changes before merging and restore them afterwards (git --autostash).</param>
Task<MergeResultDto?> ApproveReviewAsync(string taskId, string targetBranch, bool autostash = false);
Task<MergePreviewDto?> PreviewMergeAsync(string taskId, string targetBranch);
Task<MergeResultDto> MergeTaskAsync(string taskId, string targetBranch, bool removeWorktree, string commitMessage);
Task<MergeResultDto> MergeTaskAsync(string taskId, string targetBranch, bool removeWorktree, string commitMessage, bool autostash = false);
Task RejectReviewToQueueAsync(string taskId, string feedback);
Task RejectReviewToIdleAsync(string taskId);
Task CancelReviewAsync(string taskId);
@@ -143,8 +138,9 @@ public interface IWorkerClient : INotifyPropertyChanged
/// <summary>Launch spec for an embedded ConPTY "merge helper" session that drives the given
/// tasks to a merged/Done state. listId scopes the session (and cwd) to that list.
/// handlerTaskId (from CreateMergeHelperTaskAsync) is rendered into the brief so the session
/// can call handoff_list_handler on its own handler task.</summary>
Task<LaunchSpec> GetMergeHelperLaunchSpecAsync(IReadOnlyList<string> taskIds, string listId, string handlerTaskId, CancellationToken ct = default);
/// can call handoff_list_handler on its own handler task. model overrides the triage
/// session's model (null = default).</summary>
Task<LaunchSpec> GetMergeHelperLaunchSpecAsync(IReadOnlyList<string> taskIds, string listId, string handlerTaskId, string? model = null, CancellationToken ct = default);
/// <summary>Creates the ClaudeDo task that owns a list-handler run (one per run, Idle/IsManual,
/// never queued) so the ConPTY tile can be task-based instead of ad-hoc. Returns the new task id.</summary>
Task<string> CreateMergeHelperTaskAsync(
@@ -162,15 +162,19 @@ public sealed class PtyTerminalSession : IDisposable
/// writing the clipboard text raw, because that is what honours bracketed-paste mode — without
/// it a multi-line paste is read line by line and submits on the first newline.
/// </summary>
public async Task PasteAsync()
public async Task<bool> PasteAsync()
{
if (_control is not { } control || !IsRunning) return;
if (_control is not { } control || !IsRunning) return false;
try
{
if (s_terminalViewField?.GetValue(control) is TerminalView view)
await view.PasteAsync();
if (s_terminalViewField?.GetValue(control) is not TerminalView view) return false;
await view.PasteAsync();
return true;
}
catch (Exception)
{
return false;
}
catch (Exception) { /* best-effort, same as SendLineAsync */ }
}
// Long enough that the two writes can't be read as one chunk by the child's stdin reader.
+1 -1
View File
@@ -69,5 +69,5 @@ public static class RepoScanner
// A real clone has .git as a directory. Worktrees and submodules have it as a file
// ("gitdir: ...") — those are not standalone repos and would flood the list.
private static bool IsRepo(string dir) => Directory.Exists(Path.Combine(dir, ".git"));
public static bool IsRepo(string dir) => Directory.Exists(Path.Combine(dir, ".git"));
}
+8 -12
View File
@@ -67,7 +67,6 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
public event Action<UsageSnapshotDto>? UsageUpdatedEvent;
public event Action<string, string, int, int>? OperationProgressEvent;
public event Action<string, string, int>? MergeProgressEvent;
public event Action<string, string>? PlanningMergeStartedEvent;
public event Action<string, string>? PlanningSubtaskMergedEvent;
@@ -189,11 +188,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
_hub.On<string, string, int, int>("OperationProgress", (opKey, phase, current, total) =>
{
Dispatcher.UIThread.Post(() =>
{
OperationProgressEvent?.Invoke(opKey, phase, current, total);
MergeProgressEvent?.Invoke(opKey, phase, current);
});
Dispatcher.UIThread.Post(() => OperationProgressEvent?.Invoke(opKey, phase, current, total));
});
_hub.On<string, string>("PlanningMergeStarted", (planningTaskId, targetBranch) =>
@@ -358,10 +353,11 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
await InvokeTimedAsync("ResetTask", () => _hub.InvokeAsync("ResetTask", taskId));
}
public async Task<MergeResultDto> MergeTaskAsync(string taskId, string targetBranch, bool removeWorktree, string commitMessage)
public async Task<MergeResultDto> MergeTaskAsync(
string taskId, string targetBranch, bool removeWorktree, string commitMessage, bool autostash = false)
{
return await InvokeTimedAsync<MergeResultDto>("MergeTask", () => _hub.InvokeAsync<MergeResultDto>(
"MergeTask", taskId, targetBranch, removeWorktree, commitMessage));
"MergeTask", taskId, targetBranch, removeWorktree, commitMessage, autostash));
}
public Task<MergeResultDto> StartConflictMergeAsync(string taskId, string targetBranch)
@@ -558,10 +554,10 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
public Task DequeueTaskAsync(string taskId)
=> InvokeTimedAsync("DequeueTask", () => _hub.InvokeAsync("DequeueTask", taskId));
public async Task<MergeResultDto?> ApproveReviewAsync(string taskId, string targetBranch)
public async Task<MergeResultDto?> ApproveReviewAsync(string taskId, string targetBranch, bool autostash = false)
{
LastApproveTarget = targetBranch;
return await InvokeTimedAsync<MergeResultDto>("ApproveReview", () => _hub.InvokeAsync<MergeResultDto>("ApproveReview", taskId, targetBranch));
return await InvokeTimedAsync<MergeResultDto>("ApproveReview", () => _hub.InvokeAsync<MergeResultDto>("ApproveReview", taskId, targetBranch, autostash));
}
public Task<MergePreviewDto?> PreviewMergeAsync(string taskId, string targetBranch)
@@ -627,8 +623,8 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
public async Task<LaunchSpec> GetAdHocLaunchSpecAsync(string directory, CancellationToken ct = default)
=> await InvokeTimedAsync<LaunchSpec>("GetAdHocLaunchSpec", () => _hub.InvokeAsync<LaunchSpec>("GetAdHocLaunchSpec", directory, ct));
public async Task<LaunchSpec> GetMergeHelperLaunchSpecAsync(IReadOnlyList<string> taskIds, string listId, string handlerTaskId, CancellationToken ct = default)
=> await InvokeTimedAsync<LaunchSpec>("GetMergeHelperLaunchSpec", () => _hub.InvokeAsync<LaunchSpec>("GetMergeHelperLaunchSpec", taskIds, listId, handlerTaskId, ct));
public async Task<LaunchSpec> GetMergeHelperLaunchSpecAsync(IReadOnlyList<string> taskIds, string listId, string handlerTaskId, string? model = null, CancellationToken ct = default)
=> await InvokeTimedAsync<LaunchSpec>("GetMergeHelperLaunchSpec", () => _hub.InvokeAsync<LaunchSpec>("GetMergeHelperLaunchSpec", taskIds, listId, handlerTaskId, model, ct));
public async Task<string> CreateMergeHelperTaskAsync(
IReadOnlyList<string> taskIds, string listId, string title, string descriptionHeader, CancellationToken ct = default)
@@ -145,7 +145,7 @@ public sealed partial class ConflictResolverViewModel : ObservableObject
{
// Any non-conflict outcome here means nothing was left mid-merge for this dialog
// to resolve -- surface why instead of quietly closing with no explanation.
if (start.Status is "blocked" or "untracked_collision")
if (start.Status is "blocked" or "untracked_collision" or "dirty_target")
Error = start.ErrorMessage;
return false;
}
@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services;
using Iciclecreek.Terminal;
@@ -36,14 +37,29 @@ public sealed partial class InteractiveTerminalViewModel : ViewModelBase, IDispo
/// can show a spinner instead of an empty black pane.</summary>
public bool IsStarting => !IsRunning && !HasExited && StartError is null;
/// <summary>True once the process has died without a <see cref="StartError"/> already covering it —
/// i.e. every death that isn't a launch-time failure: a crash after running a while, a clean exit,
/// or a quiet exit inside the startup grace window. Drives the host's "session ended" banner so a
/// dead pane never looks like it's still running/thinking.</summary>
public bool HasExitedAfterStartup => HasExited && StartError is null;
partial void OnIsRunningChanged(bool value)
{
OnPropertyChanged(nameof(IsStarting));
if (value) _startedAtUtc = _utcNow();
}
partial void OnHasExitedChanged(bool value) => OnPropertyChanged(nameof(IsStarting));
partial void OnStartErrorChanged(string? value) => OnPropertyChanged(nameof(IsStarting));
partial void OnHasExitedChanged(bool value)
{
OnPropertyChanged(nameof(IsStarting));
OnPropertyChanged(nameof(HasExitedAfterStartup));
}
partial void OnStartErrorChanged(string? value)
{
OnPropertyChanged(nameof(IsStarting));
OnPropertyChanged(nameof(HasExitedAfterStartup));
}
public InteractiveTerminalViewModel() : this(() => DateTime.UtcNow)
{
@@ -96,6 +112,15 @@ public sealed partial class InteractiveTerminalViewModel : ViewModelBase, IDispo
}
}
/// <summary>Raised when a user-initiated paste or drop couldn't reach the session (write seam
/// gone, no running process) — mirrors the island ViewModels' ErrorReported, forwarded by
/// <see cref="ClaudeDo.Ui.ViewModels.MissionControl.ConPtyPaneViewModel"/> into the footer error strip.</summary>
public event Action<string>? ErrorReported;
/// <summary>Called by the view after a failed <see cref="PasteAsync"/>/<see cref="SendTextAsync"/>
/// so the failure surfaces through <see cref="ErrorReported"/> instead of vanishing silently.</summary>
public void ReportSendFailed() => ErrorReported?.Invoke(Loc.T("missionControl.terminalSendFailed"));
/// <summary>Raised when the process died non-zero *after* clearing <see cref="StartupGraceWindow"/> —
/// i.e. a session that ran, then broke. That used to be a silent dead tile with no signal at all;
/// the worker turns it into a usage-limit auto-restart for list-handler sessions
@@ -141,8 +166,9 @@ public sealed partial class InteractiveTerminalViewModel : ViewModelBase, IDispo
public Task<bool> SendTextAsync(string text) => _session.SendTextAsync(text);
/// <summary>Pastes the clipboard into the session (Ctrl+V) — see
/// <see cref="PtyTerminalSession.PasteAsync"/>.</summary>
public Task PasteAsync() => _session.PasteAsync();
/// <see cref="PtyTerminalSession.PasteAsync"/>. False when there is no running process to
/// paste into (or the write seam is gone).</summary>
public Task<bool> PasteAsync() => _session.PasteAsync();
public void Kill() => _session.Kill();
@@ -291,11 +291,9 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
// Set by shell so DeleteTaskCommand can remove from list
public Func<TaskRowViewModel, System.Threading.Tasks.Task>? DeleteFromList { get; set; }
// Set by the view so DeleteTaskCommand can prompt yes/no before deleting
public Func<string, System.Threading.Tasks.Task<bool>>? ConfirmAsync { get; set; }
// Set by the view so DeleteTaskCommand can show an error message
public Func<string, System.Threading.Tasks.Task>? ShowErrorAsync { get; set; }
// Set by the shell (mirrors ListsIslandViewModel.Dialogs) so confirm/error prompts go
// through the one shared dialog implementation instead of a view-local copy.
public IDialogService? Dialogs { get; set; }
// ── Review ──────────────────────────────────────────────────────────────
[ObservableProperty]
@@ -728,6 +726,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
Merge.MergeTargetBranches.Clear();
foreach (var b in targets.LocalBranches) Merge.MergeTargetBranches.Add(b);
Merge.SelectedMergeTarget = targets.DefaultBranch;
Merge.TargetDirty = targets.TargetDirty;
}
}
await Merge.RefreshMergePreviewAsync();
@@ -778,6 +777,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
foreach (var b in targets.LocalBranches)
Merge.MergeTargetBranches.Add(b);
Merge.SelectedMergeTarget = targets.DefaultBranch;
Merge.TargetDirty = targets.TargetDirty;
}
}
}
@@ -824,6 +824,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
foreach (var b in targets.LocalBranches)
Merge.MergeTargetBranches.Add(b);
Merge.SelectedMergeTarget = targets.DefaultBranch;
Merge.TargetDirty = targets.TargetDirty;
}
}
}
@@ -1042,9 +1043,9 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
{
if (Task == null) return;
var row = Task;
if (ConfirmAsync != null)
if (Dialogs != null)
{
var ok = await ConfirmAsync($"Delete \"{row.Title}\"? This cannot be undone.");
var ok = await Dialogs.ConfirmAsync($"Delete \"{row.Title}\"? This cannot be undone.", Loc.T("dialog.delete"));
if (!ok) return;
}
// Routed through the worker (mirrors the MCP delete_task tool) so a deleted child
@@ -1060,14 +1061,14 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
{
// Belt and braces: the connection can drop between the CanExecute check and
// this call, so a stray throw here must surface, not vanish silently.
if (ShowErrorAsync != null)
await ShowErrorAsync(ex.Message);
if (Dialogs != null)
await Dialogs.ShowErrorAsync(ex.Message);
return;
}
if (!deleted)
{
if (ShowErrorAsync != null)
await ShowErrorAsync(error ?? "Delete failed.");
if (Dialogs != null)
await Dialogs.ShowErrorAsync(error ?? "Delete failed.");
return;
}
if (DeleteFromList != null)
@@ -1216,10 +1217,10 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
private async System.Threading.Tasks.Task ResetAndRetryAsync()
{
if (Task == null) return;
if (ConfirmAsync == null) return;
if (Dialogs == null) return;
var branchName = $"claudedo/{Task.Id.Replace("-", "")}";
var ok = await ConfirmAsync(
var ok = await Dialogs.ConfirmAsync(
$"Reset and retry?\nThis discards branch {branchName} (and uncommitted changes), then queues the task to run from the beginning.");
if (!ok) return;
@@ -1262,43 +1263,51 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
using var op = ApproveOp.Begin(Loc.T("ops.merge.merging"));
// Subscribed only for the duration of the call: the worker broadcasts to every
// client, and a VM left on this event would keep reacting to merges for other tasks.
void OnMergeProgress(string progressTaskId, string phase, int elapsedSeconds)
{
if (progressTaskId != taskId || phase != MergePhaseVerifying) return;
ApproveOp.Report(Loc.T("ops.merge.verifying", FormatElapsed(elapsedSeconds)));
}
// Separate event: MergeProgressEvent forwards elapsed-seconds-only (verifying), but the
// rebase phase needs the branch count too, which only rides the untrimmed OperationProgress.
void OnOperationProgress(string opKey, string phase, int current, int total)
{
if (opKey != taskId || phase != MergePhaseRebasing) return;
ApproveOp.Report(FormatRebasing(current, total));
if (opKey != taskId) return;
if (phase == MergePhaseVerifying)
ApproveOp.Report(Loc.T("ops.merge.verifying", FormatElapsed(current)));
else if (phase == MergePhaseRebasing)
ApproveOp.Report(FormatRebasing(current, total));
}
_worker.MergeProgressEvent += OnMergeProgress;
_worker.OperationProgressEvent += OnOperationProgress;
try
{
var hasChildren = Subtasks.Count > 0 || ChildOutcomes.Count > 0;
var result = await _worker.ApproveReviewAsync(taskId, Merge.SelectedMergeTarget ?? "");
if (!hasChildren && result?.Status == "conflict")
// Nothing landed -- the target working dir has uncommitted changes (often another
// session's WIP in the shared main checkout). Offer the one-shot stash retry; git
// restores the changes itself once the merge is through.
if (result?.Status == "dirty_target" && Dialogs != null
&& await Dialogs.ConfirmAsync(Loc.T("vm.detailsIsland.stashAndMergeConfirm")))
{
ApproveOp.Report(Loc.T("ops.merge.merging"));
result = await _worker.ApproveReviewAsync(
taskId, Merge.SelectedMergeTarget ?? "", autostash: true);
}
if (result?.Status == "dirty_target" && Dialogs != null)
await Dialogs.ShowErrorAsync(result.ErrorMessage ?? Loc.T("vm.detailsIsland.dirtyTarget"));
else if (!hasChildren && result?.Status == "conflict")
await _merge.ResolveConflictAsync(taskId, Merge.SelectedMergeTarget ?? "");
// The merge itself already landed; the verify command failed, so the task stayed
// out of Done. Surface that instead of silently looking like nothing happened.
else if (!hasChildren && result?.Status == "verify_failed" && ShowErrorAsync != null)
await ShowErrorAsync(result.ErrorMessage ?? Loc.T("vm.detailsIsland.verifyFailed"));
else if (!hasChildren && result?.Status == "verify_failed" && Dialogs != null)
await Dialogs.ShowErrorAsync(result.ErrorMessage ?? Loc.T("vm.detailsIsland.verifyFailed"));
// Nothing landed -- the merge was refused before touching the repo because the
// branch would have overwritten an untracked file in the target working directory.
else if (!hasChildren && result?.Status == "untracked_collision" && ShowErrorAsync != null)
await ShowErrorAsync(result.ErrorMessage ?? Loc.T("vm.detailsIsland.untrackedCollision"));
else if (!hasChildren && result?.Status == "untracked_collision" && Dialogs != null)
await Dialogs.ShowErrorAsync(result.ErrorMessage ?? Loc.T("vm.detailsIsland.untrackedCollision"));
}
catch (Exception ex)
{
if (ShowErrorAsync != null)
await ShowErrorAsync(ex.Message);
if (Dialogs != null)
await Dialogs.ShowErrorAsync(ex.Message);
}
finally
{
_worker.MergeProgressEvent -= OnMergeProgress;
_worker.OperationProgressEvent -= OnOperationProgress;
}
}
@@ -1340,7 +1349,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
try { await _worker.SubmitTaskForReviewAsync(Task.Id); }
catch (Exception ex)
{
if (ShowErrorAsync != null) await ShowErrorAsync(ex.Message);
if (Dialogs != null) await Dialogs.ShowErrorAsync(ex.Message);
}
}
@@ -1371,9 +1380,9 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
[RelayCommand]
private async System.Threading.Tasks.Task ResetReviewAsync()
{
if (Task is null || !_worker.IsConnected || ConfirmAsync is null) return;
if (Task is null || !_worker.IsConnected || Dialogs is null) return;
var branchName = $"claudedo/{Task.Id.Replace("-", "")}";
var ok = await ConfirmAsync(
var ok = await Dialogs.ConfirmAsync(
$"Reset working tree?\nThis discards branch {branchName} (and all changes) and returns the task to Idle.");
if (!ok) return;
try { await _worker.ResetTaskAsync(Task.Id); }
@@ -1509,12 +1518,17 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
catch { /* best-effort */ }
}
// Shared by TaskRowViewModel.UpdateFromEntity — this is the one parser for
// `git diff --stat`'s summary line ("N insertions(+), M deletions(-)"). Anchored on the
// literal "(+)"/"(-)" markers rather than the English words: git for Windows localizes
// "insertion"/"deletion" to the OS language (e.g. German "Einfügung(en)"/"Löschung(en)"),
// but always keeps the untranslated (+)/(-) suffix, so this reads correctly in any locale.
internal static (int Additions, int Deletions) ParseDiffStat(string? stat)
{
if (string.IsNullOrEmpty(stat)) return (0, 0);
int add = 0, del = 0;
var m1 = System.Text.RegularExpressions.Regex.Match(stat, @"(\d+)\s+insertion");
var m2 = System.Text.RegularExpressions.Regex.Match(stat, @"(\d+)\s+deletion");
var m1 = System.Text.RegularExpressions.Regex.Match(stat, @"(\d+)[^,\n]*\(\+\)");
var m2 = System.Text.RegularExpressions.Regex.Match(stat, @"(\d+)[^,\n]*\(-\)");
if (m1.Success) int.TryParse(m1.Groups[1].Value, out add);
if (m2.Success) int.TryParse(m2.Groups[1].Value, out del);
return (add, del);
@@ -0,0 +1,27 @@
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
namespace ClaudeDo.Ui.ViewModels.Islands;
/// <summary>
/// A sidebar folder row. Not a <see cref="ListNavItemViewModel"/> and not a
/// <see cref="ListKind"/> — a folder holds no tasks and is never selectable, so tapping it
/// toggles <see cref="IsCollapsed"/> instead of changing the selection.
/// </summary>
public sealed partial class ListFolderNavItemViewModel : ViewModelBase
{
public required string Id { get; init; }
[ObservableProperty] private string _name = "";
[ObservableProperty] private string _iconKey = "Folder";
[ObservableProperty] private bool _isCollapsed;
// Sum of the child lists' counts — a collapsed folder still shows what's inside it.
[ObservableProperty] private int _count;
// Set while a dragged list row hovers over the middle of this folder header (move-into-folder).
[ObservableProperty] private bool _isDropTarget;
// Insert-position hints for a drop next to the folder instead of into it. Drawn around the
// whole folder block (header + children), not just the header.
[ObservableProperty] private bool _dropHintAbove;
[ObservableProperty] private bool _dropHintBelow;
public ObservableCollection<ListNavItemViewModel> Lists { get; } = new();
}
@@ -26,4 +26,6 @@ public sealed partial class ListNavItemViewModel : ViewModelBase
[ObservableProperty] private bool _isTaskDropTarget;
// Settable (not init) so a list-settings icon change refreshes the row in place.
[ObservableProperty] private string? _iconKey;
// The sidebar folder this row sits in (ListEntity.FolderId); null = top level.
[ObservableProperty] private string? _folderId;
}
@@ -17,8 +17,9 @@ namespace ClaudeDo.Ui.ViewModels.Islands;
public enum ListKind { Smart, Virtual, User }
/// <summary>Confirmed handler run: the scope list and the ordered selected task ids.</summary>
public sealed record MergeHelperRequest(string ListId, IReadOnlyList<string> TaskIds);
/// <summary>Confirmed handler run: the scope list, the ordered selected task ids, and the model
/// picked for the triage session (null = default; review-mode runs skip triage entirely).</summary>
public sealed record MergeHelperRequest(string ListId, IReadOnlyList<string> TaskIds, string? TriageModel = null);
public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
{
@@ -26,6 +27,9 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
/// island show the notes editor instead of rows.</summary>
public const string NotesListId = "smart:notes";
/// <summary>Icon key a folder falls back to when it has none of its own.</summary>
public const string ListFolderIcon = "Folder";
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
private readonly IServiceProvider? _services;
private readonly IWorkerClient? _worker;
@@ -111,7 +115,7 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
await vm.LoadAsync();
var ids = await Dialogs.ShowMergeHelperSelectionAsync(vm);
if (ids is { Count: > 0 })
LetClaudeHandleRequested?.Invoke(new MergeHelperRequest(rawId, ids));
LetClaudeHandleRequested?.Invoke(new MergeHelperRequest(rawId, ids, vm.SelectedModel));
}
/// <summary>Raised once per list after the review-scoped selection dialog is confirmed;
@@ -202,7 +206,22 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
public ObservableCollection<ListNavItemViewModel> Items { get; } = new();
public ObservableCollection<ListNavItemViewModel> SmartLists { get; } = new();
/// <summary>Every user list, flat, regardless of folder — the set the count refresh, the
/// row refresh and the no-repo banner work over.</summary>
public ObservableCollection<ListNavItemViewModel> UserLists { get; } = new();
/// <summary>The sidebar's top level, in render order: folder rows
/// (<see cref="ListFolderNavItemViewModel"/>) and folder-less lists
/// (<see cref="ListNavItemViewModel"/>) interleaved, so a list can sit above a folder.
/// This is what the view binds to; <see cref="UserLists"/> stays the flat superset.</summary>
public ObservableCollection<object> TopLevel { get; } = new();
/// <summary>Sidebar folders in order — a projection of <see cref="TopLevel"/>, not a second
/// collection to keep in sync.</summary>
public IReadOnlyList<ListFolderNavItemViewModel> Folders =>
TopLevel.OfType<ListFolderNavItemViewModel>().ToList();
/// <summary>The user lists that sit outside any folder — likewise a projection.</summary>
public IReadOnlyList<ListNavItemViewModel> RootLists =>
TopLevel.OfType<ListNavItemViewModel>().ToList();
[ObservableProperty] private string _searchText = "";
[ObservableProperty] private ListNavItemViewModel? _selectedList;
@@ -279,6 +298,7 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
Items.Clear();
SmartLists.Clear();
UserLists.Clear();
TopLevel.Clear();
var smart = new[]
{
@@ -299,6 +319,24 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
var ticketsConfigured = await IsTicketsConfiguredAsync();
await using var ctx = await _dbFactory.CreateDbContextAsync(ct);
var lists = new ListRepository(ctx);
// Folders and top-level lists share one sort_order space, so both go into a single
// ordered bucket and get merged by it — that's what interleaves them.
var topLevel = new List<(int Sort, object Item)>();
var foldersById = new Dictionary<string, ListFolderNavItemViewModel>();
foreach (var f in await lists.GetFoldersAsync(ct))
{
var folder = new ListFolderNavItemViewModel
{
Id = f.Id,
Name = f.Name,
IconKey = f.Icon ?? ListFolderIcon,
IsCollapsed = f.IsCollapsed,
};
foldersById[f.Id] = folder;
topLevel.Add((f.SortOrder, folder));
}
var seedNames = new HashSet<string>(new[] { "My Day", "Important", "Planned" });
foreach (var l in await lists.GetAllAsync(ct))
{
@@ -315,10 +353,20 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
IsManual = l.IsManual,
FindingsTracked = l.FindingsTracked,
HasTicketProject = ticketsConfigured && cfg?.TicketProjectId > 0,
FolderId = l.FolderId,
};
Items.Add(item);
UserLists.Add(item);
if (item.FolderId is { } fid && foldersById.TryGetValue(fid, out var owner))
owner.Lists.Add(item);
else
topLevel.Add((l.SortOrder, item));
}
// OrderBy is stable, so legacy rows (folders and lists each numbered from 0
// independently) keep the old look — folders first — until the first drag.
foreach (var (_, item) in topLevel.OrderBy(t => t.Sort))
TopLevel.Add(item);
ok = true;
}
finally { OperationTiming.Shared.Record("db", "ListsIsland.LoadAsync", sw.Elapsed, ok); }
@@ -365,6 +413,8 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
var filter = _filters.Resolve(item.Id);
item.Count = filter is null ? 0 : all.Count(filter.ShouldCount);
}
RecomputeFolderCounts();
ok = true;
}
catch (OperationCanceledException) { throw; }
@@ -403,6 +453,7 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
};
Items.Add(item);
UserLists.Add(item);
TopLevel.Add(item);
SelectedList = item;
RecomputeHasNoLinkedRepo();
@@ -410,7 +461,8 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
{
var vm = _services.GetRequiredService<ListSettingsModalViewModel>();
vm.ErrorReported += msg => ErrorReported?.Invoke(msg);
vm.BeginLoad(entity.Id, entity.Name, entity.WorkingDir, entity.DefaultCommitType, entity.IsManual, entity.FindingsTracked, entity.Icon);
// canToggleFolder: only the create flow offers "make this a folder instead".
vm.BeginLoad(entity.Id, entity.Name, entity.WorkingDir, entity.DefaultCommitType, entity.IsManual, entity.FindingsTracked, entity.Icon, canToggleFolder: true);
await Dialogs.ShowListSettingsAsync(vm);
if (!vm.Saved && !vm.Deleted)
{
@@ -432,42 +484,203 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
r.DropHintAbove = false;
r.DropHintBelow = false;
}
}
public void SetDropHint(ListNavItemViewModel target, bool placeBelow)
{
foreach (var r in UserLists)
foreach (var f in Folders)
{
var isTarget = ReferenceEquals(r, target);
r.DropHintAbove = isTarget && !placeBelow;
r.DropHintBelow = isTarget && placeBelow;
f.IsDropTarget = false;
f.DropHintAbove = false;
f.DropHintBelow = false;
}
}
public async Task ReorderAsync(ListNavItemViewModel source, ListNavItemViewModel target, bool placeBelow)
/// <summary>Marks the insert position for a drop next to <paramref name="target"/> — either a
/// list row or a folder header (folders take the same two hint lines, drawn around the whole
/// folder block).</summary>
public void SetDropHint(object target, bool placeBelow)
{
ClearDropHints();
switch (target)
{
case ListNavItemViewModel row:
row.DropHintAbove = !placeBelow;
row.DropHintBelow = placeBelow;
break;
case ListFolderNavItemViewModel folder:
folder.DropHintAbove = !placeBelow;
folder.DropHintBelow = placeBelow;
break;
}
}
public void SetFolderDropTarget(ListFolderNavItemViewModel? target)
{
ClearDropHints();
if (target is not null) target.IsDropTarget = true;
}
/// <summary>The collection a row is rendered in: its folder's <c>Lists</c>, or
/// <see cref="TopLevel"/> when it has no folder. Non-generic because the top level is mixed.</summary>
public System.Collections.IList ContainerOf(ListNavItemViewModel row) =>
Folders.FirstOrDefault(f => f.Id == row.FolderId)?.Lists ?? (System.Collections.IList)TopLevel;
/// <summary>Kept for the list→list case; <see cref="DropAsync"/> covers all four combinations.</summary>
public Task ReorderAsync(ListNavItemViewModel source, ListNavItemViewModel target, bool placeBelow) =>
DropAsync(source, target, placeBelow);
/// <summary>
/// Drops <paramref name="source"/> (a list row or a folder) at <paramref name="target"/>'s
/// position. Since a drop position implies a container, dropping a list onto a row in a
/// different folder (or next to anything at the top level) also *moves* it there — that's the
/// only way to drag a list out of a folder. Folders live at the top level only, so a folder
/// dropped onto a row inside a folder is ignored rather than nested.
/// </summary>
public async Task DropAsync(object source, object target, bool placeBelow)
{
if (source.Kind != ListKind.User || target.Kind != ListKind.User) return;
if (ReferenceEquals(source, target)) return;
if (target is ListNavItemViewModel { Kind: not ListKind.User }) return;
MoveWithinCollection(UserLists, source, target, placeBelow);
if (source is ListFolderNavItemViewModel folder)
{
if (target is ListNavItemViewModel { FolderId: not null }) return;
MoveWithinCollection(TopLevel, folder, target, placeBelow);
await PersistOrderAsync(null);
return;
}
if (source is not ListNavItemViewModel row || row.Kind != ListKind.User) return;
// Next to a folder *header* means top level, not inside it — MoveToFolderAsync is the
// drop-into-the-folder path.
var targetFolderId = target is ListNavItemViewModel t ? t.FolderId : null;
var folderChanged = row.FolderId != targetFolderId;
if (folderChanged)
{
ContainerOf(row).Remove(row);
row.FolderId = targetFolderId;
ContainerOf(row).Add(row);
}
MoveWithinCollection(ContainerOf(row), row, target, placeBelow);
await PersistOrderAsync(folderChanged ? row : null);
}
/// <summary>Appends a list to a folder (or to the top level when <paramref name="folder"/> is
/// null) — the drop-onto-the-folder-header path, which also reaches collapsed and empty folders.</summary>
public async Task MoveToFolderAsync(ListNavItemViewModel source, ListFolderNavItemViewModel? folder)
{
if (source.Kind != ListKind.User) return;
if (source.FolderId == folder?.Id) return;
ContainerOf(source).Remove(source);
source.FolderId = folder?.Id;
ContainerOf(source).Add(source);
await PersistOrderAsync(source);
}
/// <summary>
/// Writes the sidebar's visual order back as a single global <c>sort_order</c> sequence
/// (folders top to bottom, then the top-level lists) and, when a list changed folder, its new
/// <c>folder_id</c>.
/// </summary>
private async Task PersistOrderAsync(ListNavItemViewModel? movedRow)
{
var ordered = new List<(string Id, bool IsFolder)>();
foreach (var item in TopLevel)
{
switch (item)
{
case ListFolderNavItemViewModel f:
ordered.Add((f.Id, true));
ordered.AddRange(f.Lists.Select(l => (RawId(l.Id), false)));
break;
case ListNavItemViewModel l:
ordered.Add((RawId(l.Id), false));
break;
}
}
var orderedIds = UserLists.Select(i => i.Id["user:".Length..]).ToList();
var sw = System.Diagnostics.Stopwatch.StartNew();
var ok = false;
try
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
var lists = new ListRepository(ctx);
await lists.ReorderAsync(orderedIds);
if (movedRow is not null)
await lists.SetListFolderAsync(RawId(movedRow.Id), movedRow.FolderId);
await lists.ReorderSidebarAsync(ordered);
ok = true;
}
finally { OperationTiming.Shared.Record("db", "ListsIsland.ReorderAsync", sw.Elapsed, ok); }
RecomputeFolderCounts();
}
/// <summary>Context-menu counterpart to dragging a list out of a folder.</summary>
[RelayCommand]
private async Task RemoveFromFolderAsync(ListNavItemViewModel? row)
{
if (row is null) return;
await MoveToFolderAsync(row, null);
}
private readonly Dictionary<string, CancellationTokenSource> _folderCollapseCts = new();
// Synchronous on purpose: the fold is pure UI state and must never miss a click waiting on
// the AsyncRelayCommand's own CanExecute lock while the DB write below is in flight. The
// write is fire-and-forget with a per-folder cancellation token so a second toggle before the
// first one lands cancels it — the DB always ends up with the last-clicked state, never a
// stale one racing ahead of it.
[RelayCommand]
private void ToggleFolder(ListFolderNavItemViewModel? folder)
{
if (folder is null) return;
folder.IsCollapsed = !folder.IsCollapsed;
if (_folderCollapseCts.TryGetValue(folder.Id, out var previous)) previous.Cancel();
var cts = new CancellationTokenSource();
_folderCollapseCts[folder.Id] = cts;
_ = PersistFolderCollapsedAsync(folder.Id, folder.IsCollapsed, cts.Token);
}
private async Task PersistFolderCollapsedAsync(string folderId, bool isCollapsed, CancellationToken ct)
{
try
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
ct.ThrowIfCancellationRequested();
await new ListRepository(ctx).SetFolderCollapsedAsync(folderId, isCollapsed);
}
catch (OperationCanceledException) { }
catch (Exception ex)
{
// The fold itself already happened in the UI; only its persistence failed.
ErrorReported?.Invoke(ex.Message);
}
}
[RelayCommand]
private async Task OpenFolderSettingsAsync(ListFolderNavItemViewModel? folder)
{
if (folder is null || Dialogs is null || _services is null) return;
var vm = _services.GetRequiredService<ListSettingsModalViewModel>();
vm.ErrorReported += msg => ErrorReported?.Invoke(msg);
vm.BeginLoadFolder(folder.Id, folder.Name, folder.IconKey);
await Dialogs.ShowListSettingsAsync(vm);
// Rename, re-icon and delete all change the folder header (and delete releases its lists
// back to the top level) — one reload covers every outcome.
if (vm.Saved || vm.Deleted) await LoadAsync();
}
private void RecomputeFolderCounts()
{
foreach (var f in Folders) f.Count = f.Lists.Sum(l => l.Count);
}
private static string RawId(string rowId) =>
rowId.StartsWith("user:", StringComparison.Ordinal) ? rowId["user:".Length..] : rowId;
private static void MoveWithinCollection(
ObservableCollection<ListNavItemViewModel> coll,
ListNavItemViewModel source,
ListNavItemViewModel target,
System.Collections.IList coll,
object source,
object target,
bool placeBelow)
{
var srcIdx = coll.IndexOf(source);
@@ -480,7 +693,8 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
if (finalIdx >= coll.Count) finalIdx = coll.Count - 1;
if (finalIdx == srcIdx) return;
coll.Move(srcIdx, finalIdx);
coll.RemoveAt(srcIdx);
coll.Insert(finalIdx, source);
}
partial void OnSelectedListChanged(ListNavItemViewModel? value)
@@ -570,6 +784,7 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
IsManual = entity.IsManual,
FindingsTracked = entity.FindingsTracked,
HasTicketProject = hasTicketProject,
FolderId = entity.FolderId,
};
var seedNames = new HashSet<string>(new[] { "My Day", "Important", "Planned" });
@@ -579,6 +794,22 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
UserLists.Insert(insertAt, item);
Items.Insert(SmartLists.Count + insertAt, item);
// Inside a folder, the same DB-order position; at the top level just appended — the mixed
// top level has no index that a per-folder DB order maps onto, and AddAsync numbers a new
// list past everything anyway.
if (Folders.FirstOrDefault(f => f.Id == item.FolderId) is { } folder)
{
var containerIdx = ordered
.Where(l => l.FolderId == item.FolderId)
.Select(l => l.Id)
.ToList()
.IndexOf(entity.Id);
folder.Lists.Insert(
containerIdx < 0 || containerIdx > folder.Lists.Count ? folder.Lists.Count : containerIdx,
item);
}
else TopLevel.Add(item);
RecomputeHasNoLinkedRepo();
}
}
@@ -28,6 +28,10 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
[ObservableProperty] private ObservableCollection<string> _mergeTargetBranches = new();
[ObservableProperty] private string? _selectedMergeTarget;
// Mirrors MergeTargetsDto.TargetDirty — surfaced next to Approve so a dirty target working
// dir is visible before anyone clicks, not just after the merge modal refuses it.
[ObservableProperty] private bool _targetDirty;
// No CanExecute to gate here — RefreshMergePreviewAsync is triggered from the Bind path,
// not a [RelayCommand], so PreviewOp only drives the indicator, never locks a button.
public OperationStatus PreviewOp { get; } = new();
@@ -141,6 +145,7 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
MergePreviewText = "";
MergeIsClean = false;
MergeIsConflict = false;
TargetDirty = false;
SyncWorktree(null, null, null, null, null);
SyncTaskContext(null, null, false);
SyncChildOutcomes(false, 0);
@@ -112,11 +112,31 @@ public sealed partial class TaskRowViewModel : ViewModelBase
[NotifyPropertyChangedFor(nameof(IsQueued))]
[NotifyPropertyChangedFor(nameof(IsWaiting))]
[NotifyPropertyChangedFor(nameof(StatusChipClass))]
[NotifyPropertyChangedFor(nameof(StatusLabel))]
[NotifyPropertyChangedFor(nameof(StatusChipTooltip))]
[NotifyPropertyChangedFor(nameof(CanRemoveFromQueue))]
private string? _blockedByTaskId;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(DependsOnTaskId))]
private IReadOnlyList<string> _dependsOnTaskIds = [];
// Extrinsic — assigned by TasksIslandViewModel.ApplyDependencyWaitState, which alone has the
// cross-row graph (plus any cross-list predecessor lookup) needed to tell an unmet
// task_dependencies edge from a satisfied one. True only for the task_dependencies case;
// IsWaiting also ORs in the older BlockedByTaskId planning-chain link.
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsQueued))]
[NotifyPropertyChangedFor(nameof(IsWaiting))]
[NotifyPropertyChangedFor(nameof(StatusChipClass))]
[NotifyPropertyChangedFor(nameof(StatusLabel))]
[NotifyPropertyChangedFor(nameof(StatusChipTooltip))]
[NotifyPropertyChangedFor(nameof(CanRemoveFromQueue))]
private bool _isBlockedByDependency;
// The predecessor(s) this row is waiting on, rendered ("#42" or "#42, #57"), or null when not
// waiting. Prefers BlockedByTaskId's single predecessor (the planning chain "parent wins" the
// same way it does for the chain rail), else lists every unmet task_dependencies edge.
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusChipTooltip))]
private string? _dependencyWaitLabel;
// The single predecessor, or null when the task has none or several. The chain rail can only
// draw a line, so a task waiting on n predecessors gets a ChainAfterLabel instead — see
@@ -275,8 +295,8 @@ public sealed partial class TaskRowViewModel : ViewModelBase
// task). A live ConPTY session is that same shape but not parked — it reads "Interactive".
public bool IsParked => Status == TaskStatus.Idle && WorktreeState == ClaudeDo.Data.Models.WorktreeState.Active
&& !HasInteractiveSession;
public bool IsQueued => Status == TaskStatus.Queued && string.IsNullOrEmpty(BlockedByTaskId);
public bool IsWaiting => Status == TaskStatus.Queued && !string.IsNullOrEmpty(BlockedByTaskId);
public bool IsQueued => Status == TaskStatus.Queued && string.IsNullOrEmpty(BlockedByTaskId) && !IsBlockedByDependency;
public bool IsWaiting => Status == TaskStatus.Queued && (!string.IsNullOrEmpty(BlockedByTaskId) || IsBlockedByDependency);
public bool CanRemoveFromQueue => IsQueued || IsWaiting || HasQueuedSubtasks;
// "Send to queue" is the single queue entry. On a finalized planning parent it queues the
// plan (children) via CanQueuePlan; an Active (not-yet-finalized) planning parent is hidden —
@@ -412,9 +432,12 @@ public sealed partial class TaskRowViewModel : ViewModelBase
: FailureReasonLabel;
// Drives the status chip tooltip: an open interactive session takes priority (it's tappable),
// otherwise a Failed task's reason, otherwise no tooltip.
// then the predecessor(s) a waiting task is blocked on, then a Failed task's reason,
// otherwise no tooltip.
public string? StatusChipTooltip
=> HasInteractiveSession ? Loc.T("tasks.interactiveChipTip") : FailureReasonTooltip;
=> HasInteractiveSession ? Loc.T("tasks.interactiveChipTip")
: IsWaiting && DependencyWaitLabel is not null ? Loc.T("tasks.waitingOnTip", DependencyWaitLabel)
: FailureReasonTooltip;
public string DiffAdditionsText => $"+{DiffAdditions}";
public string DiffDeletionsText => $"−{DiffDeletions}";
@@ -422,7 +445,8 @@ public sealed partial class TaskRowViewModel : ViewModelBase
public string StatusLabel
=> HasInteractiveSession ? Loc.T("vm.taskStatus.interactive")
: IsParked ? Loc.T("vm.taskStatus.parked") : Status switch
: IsParked ? Loc.T("vm.taskStatus.parked")
: IsWaiting ? Loc.T("vm.taskStatus.waiting") : Status switch
{
TaskStatus.Idle => Loc.T("vm.taskStatus.idle"),
TaskStatus.Queued => Loc.T("vm.taskStatus.queued"),
@@ -444,7 +468,7 @@ public sealed partial class TaskRowViewModel : ViewModelBase
public string StatusChipClass => HasInteractiveSession
? "interactive"
: (Status, IsBlocked: !string.IsNullOrEmpty(BlockedByTaskId)) switch
: (Status, IsBlocked: !string.IsNullOrEmpty(BlockedByTaskId) || IsBlockedByDependency) switch
{
(TaskStatus.Running, _) => "running",
(TaskStatus.WaitingForReview, _) => "review",
@@ -476,7 +500,7 @@ public sealed partial class TaskRowViewModel : ViewModelBase
// Any entity-backed refresh reflects a settled state, so the transient creation-phase
// banner (set from the OperationProgress broadcast) has nothing left to announce.
CreationPhase = null;
var (add, del) = ParseDiffStat(t.Worktree?.DiffStat);
var (add, del) = DetailsIslandViewModel.ParseDiffStat(t.Worktree?.DiffStat);
Number = t.Number;
Title = t.Title;
ListName = t.List?.Name ?? "";
@@ -505,18 +529,4 @@ public sealed partial class TaskRowViewModel : ViewModelBase
FailureTurnsUsed = t.FailureTurnsUsed;
FailureMaxTurns = t.FailureMaxTurns;
}
// Best-effort parse of diff stat strings like "+12 -3" or "12 additions, 3 deletions".
private static (int add, int del) ParseDiffStat(string? s)
{
if (string.IsNullOrWhiteSpace(s)) return (0, 0);
int add = 0, del = 0;
var parts = s.Split(new[] { ' ', ',', '\t' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var p in parts)
{
if (p.Length > 1 && p[0] == '+' && int.TryParse(p.AsSpan(1), out var a)) add = a;
else if (p.Length > 1 && (p[0] == '-' || p[0] == '\u2212') && int.TryParse(p.AsSpan(1), out var d)) del = d;
}
return (add, del);
}
}
@@ -43,6 +43,12 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// Two events (TaskUpdated + WorktreeUpdated) drive the same delta refresh, so two reads for
// one task can be in flight at once. Only the newest may write to the row.
private readonly Dictionary<string, long> _deltaSeq = new();
// Number/Title/Status for a predecessor id that isn't loaded into Items (a different list, My
// Day, or the completed group) -- populated by RefreshExternalDependencyCacheAsync so
// ApplyChainGrouping/ApplyDependencyWaitState can still render "after #N" and the blocked
// chip for a cross-list predecessor instead of silently dropping it. Refreshed, never evicted:
// stale entries just get overwritten on the next load/delta that references the same id.
private readonly Dictionary<string, (int Number, string Title, TaskStatus Status)> _externalDependencyInfo = new();
private long _deltaCounter;
// Phase 3 reconcile tick — see the block at the end of this class.
private readonly System.Timers.Timer _reconcileTimer = new(4_000);
@@ -363,6 +369,12 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
r.ParentTaskId == parent.Id && (r.IsQueued || r.IsWaiting));
}
// entity is not null here whenever `existing` is still reachable (see the branching
// above: an early return covers every entity-null-but-existing case except delete, which
// needs no lookup refresh).
if (entity is not null && existing is not null)
await RefreshExternalDependencyCacheAsync(db, DependencyLookupIds([existing]));
Regroup();
UpdateSubtitle();
}
@@ -548,6 +560,8 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
r.ParentFinalized = !string.IsNullOrEmpty(r.ParentTaskId)
&& finalizedParents.Contains(r.ParentTaskId!);
await RefreshExternalDependencyCacheAsync(db, DependencyLookupIds(Items), ct);
Regroup();
UpdateSubtitle();
ok = true;
@@ -556,6 +570,32 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
finally { OperationTiming.Shared.Record("db", "TasksIsland.LoadForListAsync", sw.Elapsed, ok); }
}
// Every predecessor id a row in `items` could need labelled/checked: its task_dependencies
// edges plus the planning chain's BlockedByTaskId (both resolved the same way in
// ApplyDependencyWaitState/BuildAfterLabel).
private static IEnumerable<string> DependencyLookupIds(IEnumerable<TaskRowViewModel> items) =>
items.SelectMany(r => string.IsNullOrEmpty(r.BlockedByTaskId)
? r.DependsOnTaskIds
: r.DependsOnTaskIds.Append(r.BlockedByTaskId));
// Resolves predecessor ids that aren't loaded into Items (a different list, My Day, or the
// completed group) so cross-list dependency display doesn't silently drop them. Cheap: reuses
// the caller's already-open context, one query for however many ids are actually missing.
private async Task RefreshExternalDependencyCacheAsync(
ClaudeDoDbContext db, IEnumerable<string> ids, CancellationToken ct = default)
{
var known = Items.Select(r => r.Id).ToHashSet();
var missing = ids.Where(id => !string.IsNullOrEmpty(id) && !known.Contains(id)).Distinct().ToList();
if (missing.Count == 0) return;
var rows = await db.Tasks
.Where(t => missing.Contains(t.Id))
.Select(t => new { t.Id, t.Number, t.Title, t.Status })
.ToListAsync(ct);
foreach (var r in rows)
_externalDependencyInfo[r.Id] = (r.Number, r.Title, r.Status);
}
internal void Regroup()
{
// Collapse parents that have children by default, so subtasks stay tucked away until
@@ -691,13 +731,70 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// with a label rather than an orphaned rail. Whether the head is resolvable at all
// still uses the whole-Items graph (rowsById), independent of section.
var rowsById = Items.ToDictionary(r => r.Id);
overdue = ApplyChainGrouping(overdue, rowsById);
open = ApplyChainGrouping(open, rowsById);
completed = ApplyChainGrouping(completed, rowsById);
// Blocked-by-dependency is independent of section (a blocked row can be Overdue or Open
// alike) and independent of chain membership, so it's computed once over all of Items
// rather than per section.
foreach (var r in Items)
ApplyDependencyWaitState(r, rowsById, _externalDependencyInfo);
overdue = ApplyChainGrouping(overdue, rowsById, _externalDependencyInfo);
open = ApplyChainGrouping(open, rowsById, _externalDependencyInfo);
completed = ApplyChainGrouping(completed, rowsById, _externalDependencyInfo);
return (overdue, open, completed);
}
// Assigns IsBlockedByDependency/DependencyWaitLabel for one row. BlockedByTaskId (the planning
// chain's single link) wins the label the same way a planning child's parent indent wins over
// chain-rail membership -- "parent wins" is the existing precedent (ApplyChainGrouping below).
private static void ApplyDependencyWaitState(
TaskRowViewModel row, Dictionary<string, TaskRowViewModel> rowsById,
IReadOnlyDictionary<string, (int Number, string Title, TaskStatus Status)> external)
{
if (row.Status != TaskStatus.Queued)
{
row.IsBlockedByDependency = false;
row.DependencyWaitLabel = null;
return;
}
var unmet = row.DependsOnTaskIds.Where(id => IsUnmet(id, rowsById, external)).ToList();
row.IsBlockedByDependency = unmet.Count > 0;
var waitIds = !string.IsNullOrEmpty(row.BlockedByTaskId) ? [row.BlockedByTaskId] : unmet;
row.DependencyWaitLabel = waitIds.Count == 0 ? null
: string.Join(", ", waitIds.Select(id => ResolveLabel(id, rowsById, external)).Where(s => s is not null));
}
// A predecessor missing from both rowsById and the external cache counts as unmet -- mirrors
// QueuePicker/Worker's TaskBlocking.Unmet: an edge pointing at an unresolved/vanished task
// keeps blocking rather than being silently treated as satisfied. A landed merge satisfies
// the edge too (skipVerify parks a merged task in WaitingForReview until the batch verify);
// the external cache carries no worktree state, so a cross-list predecessor still shows as
// waiting until it reaches Done.
private static bool IsUnmet(
string id, Dictionary<string, TaskRowViewModel> rowsById,
IReadOnlyDictionary<string, (int Number, string Title, TaskStatus Status)> external)
{
if (rowsById.TryGetValue(id, out var p))
return p.Status != TaskStatus.Done && p.WorktreeState != WorktreeState.Merged;
if (external.TryGetValue(id, out var e)) return e.Status != TaskStatus.Done;
return true;
}
// Resolves a predecessor id to its display label, checking the in-view rows first and falling
// back to the cross-list cache (RefreshExternalDependencyCacheAsync) -- null only when the
// predecessor is genuinely unresolvable anywhere (e.g. a deleted task).
private static string? ResolveLabel(
string id, Dictionary<string, TaskRowViewModel> rowsById,
IReadOnlyDictionary<string, (int Number, string Title, TaskStatus Status)> external)
{
if (rowsById.TryGetValue(id, out var p)) return p.Number > 0 ? $"#{p.Number}" : p.Title;
if (external.TryGetValue(id, out var e)) return e.Number > 0 ? $"#{e.Number}" : e.Title;
return null;
}
// Cycles are rejected by TaskStateService.SetDependsOnAsync, so this should always
// terminate quickly — capped anyway against a corrupt/legacy row forming a loop.
private const int MaxChainWalkDepth = 64;
@@ -724,14 +821,15 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// Content only — "after " + localization is Slice 2's concern (the view), which is why this
// holds just the identifying fragment rather than an assembled sentence. Names every
// predecessor it can resolve: a task can wait on n of them, and hiding all but the first
// would misreport what the row is actually waiting for.
private static string? BuildAfterLabel(TaskRowViewModel row, Dictionary<string, TaskRowViewModel> rowsById)
// predecessor it can resolve (in-view first, then the cross-list external cache): a task can
// wait on n of them, and hiding all but the first would misreport what the row is waiting for.
private static string? BuildAfterLabel(
TaskRowViewModel row, Dictionary<string, TaskRowViewModel> rowsById,
IReadOnlyDictionary<string, (int Number, string Title, TaskStatus Status)> external)
{
var parts = row.DependsOnTaskIds
.Select(id => rowsById.TryGetValue(id, out var p) ? p : null)
.Select(id => ResolveLabel(id, rowsById, external))
.Where(p => p is not null)
.Select(p => p!.Number > 0 ? $"#{p.Number}" : p.Title)
.ToList();
return parts.Count == 0 ? null : string.Join(", ", parts);
}
@@ -741,7 +839,8 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// (ascending ChainStep), regardless of their SortOrder-derived position — mirroring how
// planning children already sit right after their parent regardless of Items order.
private static List<TaskRowViewModel> ApplyChainGrouping(
List<TaskRowViewModel> section, Dictionary<string, TaskRowViewModel> rowsById)
List<TaskRowViewModel> section, Dictionary<string, TaskRowViewModel> rowsById,
IReadOnlyDictionary<string, (int Number, string Title, TaskStatus Status)> external)
{
var sectionIds = section.Select(r => r.Id).ToHashSet();
var headIdOf = new Dictionary<TaskRowViewModel, string>();
@@ -763,7 +862,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
{
r.ShowAsChainMember = false;
r.ChainStep = null;
r.ChainAfterLabel = BuildAfterLabel(r, rowsById);
r.ChainAfterLabel = BuildAfterLabel(r, rowsById, external);
continue;
}
@@ -773,7 +872,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
{
r.ShowAsChainMember = false;
r.ChainStep = null;
r.ChainAfterLabel = BuildAfterLabel(r, rowsById);
r.ChainAfterLabel = BuildAfterLabel(r, rowsById, external);
continue;
}
@@ -790,7 +889,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
{
r.ShowAsChainMember = false;
r.ChainStep = null;
r.ChainAfterLabel = BuildAfterLabel(r, rowsById);
r.ChainAfterLabel = BuildAfterLabel(r, rowsById, external);
}
}
@@ -1110,9 +1209,9 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// block removing a completed planning parent together with its done children.
var toDelete = completed.OrderByDescending(r => r.IsChild).ToList();
if (ConfirmAsync is not null)
if (Dialogs is not null)
{
var ok = await ConfirmAsync($"Clear {toDelete.Count} completed task(s)? This cannot be undone.");
var ok = await Dialogs.ConfirmAsync($"Clear {toDelete.Count} completed task(s)? This cannot be undone.", Loc.T("dialog.delete"));
if (!ok) return;
}
@@ -1240,9 +1339,9 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
private async Task DeleteTaskAsync(TaskRowViewModel? row)
{
if (row is null || row.HasInteractiveSession || _worker is null) return;
if (ConfirmAsync is not null)
if (Dialogs is not null)
{
var ok = await ConfirmAsync(Loc.T("vm.tasksIsland.deleteTaskConfirm", row.Title));
var ok = await Dialogs.ConfirmAsync(Loc.T("vm.tasksIsland.deleteTaskConfirm", row.Title), Loc.T("dialog.delete"));
if (!ok) return;
}
@@ -1554,8 +1653,8 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
if (outcome.Result == DiscardPlanningResult.BlockedByQueuedChildren)
{
if (ConfirmAsync is null) return;
var ok = await ConfirmAsync(
if (Dialogs is null) return;
var ok = await Dialogs.ConfirmAsync(
$"{outcome.QueuedChildrenCount} child task(s) are queued.\n" +
"Dequeue them and discard the planning session?");
if (!ok) return;
@@ -1564,18 +1663,13 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
}
else if (outcome.Result == DiscardPlanningResult.BlockedByRunningChildren)
{
if (ConfirmAsync is null) return;
await ConfirmAsync(
if (Dialogs is null) return;
await Dialogs.ConfirmAsync(
$"{outcome.RunningChildrenCount} child task(s) are still running.\n" +
"Cancel them first, then try again.");
}
}
/// <summary>
/// Wired by the view via <see cref="ShowConfirmAsync"/>. Returns true when the user confirms.
/// </summary>
public Func<string, Task<bool>>? ConfirmAsync { get; set; }
private bool CanRunPlanningOperation() => !PlanningOperation.IsRunning;
[RelayCommand(CanExecute = nameof(CanRunPlanningOperation))]
@@ -1739,7 +1833,12 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// reflects any of that after a Regroup — without this the tick would heal the row's data
// while leaving a completed task sitting in the Open section under a stale count. Gated
// on a real change so an idle tick stays free.
if (groupingChanged) Regroup();
if (groupingChanged)
{
await using var db2 = await _dbFactory.CreateDbContextAsync(ct);
await RefreshExternalDependencyCacheAsync(db2, DependencyLookupIds(Items), ct);
Regroup();
}
}
// The slice of a row that Regroup reads: which section it lands in, where it sits inside it,
@@ -1,3 +1,5 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Threading;
using System;
using System.Threading;
@@ -66,7 +68,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
// Set by MainWindow so a reveal can bring the main window to the foreground.
public Action? BringToFront { get; set; }
// Single dialog seam (set by MainWindow); propagated to the lists island.
// Single dialog seam (set by MainWindow); propagated to the islands.
private IDialogService? _dialogs;
public IDialogService? Dialogs
{
@@ -76,6 +78,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
_dialogs = value;
if (Lists is not null) Lists.Dialogs = value;
if (Tasks is not null) Tasks.Dialogs = value;
if (Details is not null) Details.Dialogs = value;
}
}
@@ -370,7 +373,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
Lists.LetClaudeHandleRequested += req =>
{
OpenMissionControl();
_ = MissionControl.OpenMergeHelperConPtySessionAsync(req.ListId, req.TaskIds);
_ = MissionControl.OpenMergeHelperConPtySessionAsync(req.ListId, req.TaskIds, req.TriageModel);
};
Lists.MergeReviewsRequested += req =>
{
@@ -631,30 +634,66 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
await _updateCheck.CheckNowAsync(CancellationToken.None);
}
[ObservableProperty] private string? _restartWorkerStatus;
// How long to wait after launching the new worker process before deciding it survived
// (e.g. a port conflict kills it almost immediately — see #292 for the worker-side fix).
private const int RestartSurvivalCheckMs = 2000;
// Test seam: overrides the real kill-and-relaunch body, so tests can assert the
// success/failure footer routing without spawning a real worker process.
internal Func<Task>? RestartWorkerOperation { get; set; }
[RelayCommand]
private async Task RestartWorkerAsync()
{
RestartWorkerStatus = Loc.T("vm.shell.restartingWorker");
try
{
await Task.Run(RestartWorkerService);
await FlashRestartStatusAsync("Worker restarted.");
await (RestartWorkerOperation ?? (() => Task.Run(RestartWorkerService)))();
FlashFooterSuccess("Worker restarted.");
}
catch (Exception ex)
{
await FlashRestartStatusAsync($"Restart failed: {ex.Message}");
FlashFooterError($"Restart failed: {ex.Message} — check the worker log.");
}
}
private void RestartWorkerService()
{
var exe = _workerLocator.Find();
// Prefer the exe path of the worker that's actually running: _workerLocator.Find()
// walks up from AppContext.BaseDirectory looking for install.json and falls back to
// the registry's InstallLocation otherwise — on a debug build launched from the repo
// there's no install.json above it, so it returns the *installed* worker's path. That
// never matches the running debug process, so KillMatchingWorkerProcesses silently
// skips it (it only kills a process whose path equals the given exe) and this either
// launches a second worker that immediately dies on the already-bound port, or leaves
// the real one running untouched while nothing visibly changes.
var exe = RunningWorkerExePath() ?? _workerLocator.Find();
if (exe is null) throw new InvalidOperationException("Worker executable not found.");
// Only kill the worker belonging to THIS installation — not any other
// ClaudeDo.Worker on the machine (e.g. a second install).
KillMatchingWorkerProcesses(exe);
var started = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(exe) { UseShellExecute = true });
if (started is not null && started.WaitForExit(RestartSurvivalCheckMs))
throw new InvalidOperationException($"worker process exited immediately (code {started.ExitCode})");
}
private static string? RunningWorkerExePath()
{
foreach (var p in System.Diagnostics.Process.GetProcessesByName("ClaudeDo.Worker"))
{
try
{
if (p.MainModule?.FileName is { } path) return path;
}
catch { /* inaccessible */ }
finally { p.Dispose(); }
}
return null;
}
// Only kill the worker belonging to THIS installation — not any other
// ClaudeDo.Worker on the machine (e.g. a second install).
private static void KillMatchingWorkerProcesses(string exe)
{
var exeFull = System.IO.Path.GetFullPath(exe);
foreach (var p in System.Diagnostics.Process.GetProcessesByName("ClaudeDo.Worker"))
{
@@ -670,16 +709,124 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
catch { /* may have exited or be inaccessible */ }
finally { p.Dispose(); }
}
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(exe) { UseShellExecute = true });
}
private async Task FlashRestartStatusAsync(string text)
// Test seam: overrides the real kill-worker + close-window body.
internal Action? ShutdownOperation { get; set; }
[RelayCommand]
private async Task ShutdownAsync()
{
RestartWorkerStatus = text;
await Task.Delay(3000);
if (RestartWorkerStatus == text) RestartWorkerStatus = null;
if (Dialogs is null) return;
var confirmed = await Dialogs.ConfirmAsync(Loc.T("vm.shell.shutdownConfirm"));
if (!confirmed) return;
(ShutdownOperation ?? ShutdownWorkerAndCloseApp)();
}
private void ShutdownWorkerAndCloseApp()
{
var exe = _workerLocator.Find();
if (exe is not null) KillMatchingWorkerProcesses(exe);
// Closing just the MainWindow relies on ShutdownMode.OnMainWindowClose, which asks
// every open window to close and backs off if any of them cancels — and
// MissionControlWindow always cancels its own close (it hides instead, see
// MissionControlWindow.OnClosing), so the process never actually exited. Shutdown()
// force-closes every window, ignoring that cancellation.
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
desktop.Shutdown();
}
private bool _updatingClaudeCli;
private bool CanUpdateClaudeCli() => !_updatingClaudeCli;
[RelayCommand(CanExecute = nameof(CanUpdateClaudeCli))]
private async Task UpdateClaudeCliAsync()
{
_updatingClaudeCli = true;
UpdateClaudeCliCommand.NotifyCanExecuteChanged();
try
{
var dto = Worker is null ? null : await Worker.GetClaudeBinAsync();
if (dto is null)
{
FlashFooterError("Update failed: worker offline.");
return;
}
var (success, message) = await RunClaudeUpdateAsync(dto);
if (success) FlashFooterSuccess(message);
else FlashFooterError(message);
}
finally
{
_updatingClaudeCli = false;
UpdateClaudeCliCommand.NotifyCanExecuteChanged();
}
}
private static async Task<(bool Success, string Message)> RunClaudeUpdateAsync(ClaudeBinDto dto)
{
var resolved = ClaudeDo.Data.Environment.ExecutableResolver.Resolve(dto.Value);
if (resolved is null) return (false, $"Update failed: '{dto.Value}' not found.");
var psi = resolved.IsShim
? BuildShimUpdatePsi(resolved.Path)
: new System.Diagnostics.ProcessStartInfo { FileName = resolved.Path, ArgumentList = { "update" } };
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.CreateNoWindow = true;
using var process = new System.Diagnostics.Process { StartInfo = psi };
var stdout = new System.Text.StringBuilder();
var stderr = new System.Text.StringBuilder();
process.OutputDataReceived += (_, e) => { if (e.Data is not null) stdout.AppendLine(e.Data); };
process.ErrorDataReceived += (_, e) => { if (e.Data is not null) stderr.AppendLine(e.Data); };
try { process.Start(); }
catch (Exception ex) { return (false, $"Update failed: {ex.Message}"); }
process.BeginOutputReadLine();
process.BeginErrorReadLine();
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
var timedOut = false;
// On timeout: kill the tree, which unblocks WaitForExitAsync below and lets the
// async output readers drain/complete naturally (mirrors VerifyCommandRunner).
await using var ctr = cts.Token.Register(() =>
{
timedOut = true;
try { process.Kill(entireProcessTree: true); } catch { /* already exited */ }
});
await process.WaitForExitAsync(CancellationToken.None);
return timedOut
? (false, "Update failed: timed out after 5 minutes.")
: SummarizeClaudeUpdateOutcome(process.ExitCode, stdout.ToString(), stderr.ToString());
}
private static System.Diagnostics.ProcessStartInfo BuildShimUpdatePsi(string shimPath)
{
var shim = ClaudeDo.Data.Environment.ExecutableResolver.BuildShimStartInfo(shimPath, new[] { "update" });
return new System.Diagnostics.ProcessStartInfo { FileName = shim.FileName, Arguments = shim.Arguments };
}
// Pure so a test can drive it with fake process output instead of spawning a real `claude`.
internal static (bool Success, string Message) SummarizeClaudeUpdateOutcome(int exitCode, string stdout, string stderr)
{
if (exitCode == 0)
return (true, LastNonEmptyLine(stdout) ?? "Claude CLI is already up to date.");
var detail = LastNonEmptyLine(stderr) ?? LastNonEmptyLine(stdout) ?? "";
return (false, $"Update failed (exit {exitCode}): {detail}");
}
private static string? LastNonEmptyLine(string text) =>
text.Split('\n').Select(l => l.Trim()).LastOrDefault(l => l.Length > 0);
[RelayCommand]
private void DismissBanner()
{
@@ -2,6 +2,7 @@ using System;
using System.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services;
namespace ClaudeDo.Ui.ViewModels.MissionControl;
@@ -88,14 +89,18 @@ public sealed partial class ConPtyPaneViewModel : ViewModelBase, IDisposable
{
terminal.PropertyChanged += OnTerminalPropertyChanged;
terminal.ExitedAfterStartup += OnTerminalExitedAfterStartup;
terminal.ErrorReported += OnTerminalErrorReported;
}
private void Unsubscribe(InteractiveTerminalViewModel terminal)
{
terminal.PropertyChanged -= OnTerminalPropertyChanged;
terminal.ExitedAfterStartup -= OnTerminalExitedAfterStartup;
terminal.ErrorReported -= OnTerminalErrorReported;
}
private void OnTerminalErrorReported(string message) => ErrorReported?.Invoke(message);
private void OnTerminalExitedAfterStartup(int exitCode)
{
if (TaskId is { } id) SessionDiedAfterStartup?.Invoke(id, exitCode);
@@ -137,8 +142,18 @@ public sealed partial class ConPtyPaneViewModel : ViewModelBase, IDisposable
SubmitForReviewCommand.NotifyCanExecuteChanged();
RetryCommand.NotifyCanExecuteChanged();
}
if (e.PropertyName is nameof(InteractiveTerminalViewModel.HasExitedAfterStartup)
or nameof(InteractiveTerminalViewModel.ExitCode))
{
OnPropertyChanged(nameof(ExitedBannerText));
}
}
/// <summary>"Session ended (code N)" text for <see cref="InteractiveTerminalViewModel.HasExitedAfterStartup"/> —
/// computed here (rather than formatted in XAML) since <c>loc:Tr</c> has no binding-arg support.</summary>
public string ExitedBannerText => Loc.T("missionControl.conptyExited", Terminal.ExitCode ?? 0);
/// <summary>Types a message into this pane's live session and submits it (the worker's
/// pre-usage-limit warning). False when the session isn't running.</summary>
public System.Threading.Tasks.Task<bool> SendLineAsync(string text) => Terminal.SendLineAsync(text);
@@ -167,9 +182,10 @@ public sealed partial class ConPtyPaneViewModel : ViewModelBase, IDisposable
partial void OnIsAbandonPendingChanged(bool value) => AbandonRunCommand.NotifyCanExecuteChanged();
// A launch failure permanently occupies the TaskId dedupe slot unless the user can retry —
// re-opening the same task would otherwise just re-focus a dead tile.
private bool CanRetry() => Terminal.HasExited && Terminal.StartError is not null;
// A dead session permanently occupies the TaskId dedupe slot unless the user can retry — whether
// it died at launch (StartError) or after (HasExitedAfterStartup), the same descriptor factory
// can always relaunch it, so any HasExited state is retryable.
private bool CanRetry() => Terminal.HasExited;
[RelayCommand(CanExecute = nameof(CanRetry))]
private void Retry()
@@ -331,10 +331,10 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
// creates one new ClaudeDo task per run to own the session (title/diff/result), deduped by
// TaskId like OpenConPtySessionAsync. The handler still merges the tasks it handles itself
// (no worktree of its own) — see TaskEntity.HandlerBaseCommit/HandlerHeadCommit.
public System.Threading.Tasks.Task OpenMergeHelperConPtySessionAsync(string listId, IReadOnlyList<string> taskIds)
public System.Threading.Tasks.Task OpenMergeHelperConPtySessionAsync(string listId, IReadOnlyList<string> taskIds, string? triageModel = null)
=> OpenListHandlerConPtySessionAsync(listId, taskIds,
"missionControl.mergeHelperTitle", "missionControl.mergeHelperTaskTitle",
taskId => _worker.GetMergeHelperLaunchSpecAsync(taskIds, listId, taskId));
taskId => _worker.GetMergeHelperLaunchSpecAsync(taskIds, listId, taskId, triageModel));
// Merge-only list-handler session over a list's WaitingForReview tasks (the review list's
// "Let Claude merge the reviews"). Same host-task shape as the full run, but the session
@@ -449,7 +449,7 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
private void AddConPtyPane(ConPtyPaneViewModel pane)
{
pane.ErrorReported += OnConPtyPaneError;
pane.CloseRequested += CloseConPtySession;
pane.CloseRequested += OnPaneCloseRequested;
pane.SubmitForReviewRequested += OnPaneSubmitForReview;
pane.SessionDiedAfterStartup += OnPaneSessionDied;
pane.AbandonRunRequested += OnPaneAbandonRun;
@@ -543,11 +543,27 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
}
}
// The tile's own X: a reflex click must not silently kill a live session the way it would a
// regular window. Confirm only when the terminal is actually running -- a dead one (StartError,
// or HasExited i.e. the #290 exited banner) is pure cleanup and closes straight away, same as it
// always did. Every other close path (handoff replacing a pane, submit-for-review, abandon-run)
// still calls CloseConPtySession directly and is unaffected.
private async void OnPaneCloseRequested(ConPtyPaneViewModel pane)
{
if (pane.Terminal.IsRunning)
{
if (ConfirmAsync is null) return;
if (!await ConfirmAsync(Loc.T("missionControl.closeSessionConfirm"))) return;
}
CloseConPtySession(pane);
}
private void CloseConPtySession(ConPtyPaneViewModel pane)
{
if (!ConPtySessions.Contains(pane)) return;
pane.ErrorReported -= OnConPtyPaneError;
pane.CloseRequested -= CloseConPtySession;
pane.CloseRequested -= OnPaneCloseRequested;
pane.SubmitForReviewRequested -= OnPaneSubmitForReview;
pane.SessionDiedAfterStartup -= OnPaneSessionDied;
pane.AbandonRunRequested -= OnPaneAbandonRun;
@@ -601,7 +617,7 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
foreach (var c in ConPtySessions.ToList())
{
c.ErrorReported -= OnConPtyPaneError;
c.CloseRequested -= CloseConPtySession;
c.CloseRequested -= OnPaneCloseRequested;
c.SubmitForReviewRequested -= OnPaneSubmitForReview;
c.SessionDiedAfterStartup -= OnPaneSessionDied;
c.AbandonRunRequested -= OnPaneAbandonRun;
@@ -39,6 +39,11 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
[ObservableProperty] private string _name = "";
[ObservableProperty] private string _workingDir = "";
// Recomputed whenever WorkingDir changes (typing or Browse) — RepoScanner.IsRepo is the same
// check RepoImport uses, so a folder either scans in there or warns here, never neither.
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
private string _workingDirWarning = "";
[ObservableProperty] private string _defaultCommitType = CommitTypeRegistry.DefaultType;
// A manual list holds reminders: tasks created here start out manual (TaskEntity.IsManual).
[ObservableProperty] private bool _isManual;
@@ -55,7 +60,33 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
// Dropdown hidden entirely when no ticket-system base URL is configured (Settings → Files tab).
// Icon key into the UI icon library (IconKeyConverter -> "Icon.<key>" StreamGeometry).
[ObservableProperty] private string _icon = DefaultIcon;
[ObservableProperty] private bool _ticketsAvailable;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(ShowTicketProject))]
private bool _ticketsAvailable;
/// <summary>The dropdown needs a configured ticket system *and* a list — folders link to nothing.</summary>
public bool ShowTicketProject => TicketsAvailable && !IsFolder;
// ---- Folder mode ----
// A folder is a sidebar grouping, not a list: it carries only a name and an icon, so every
// other field/section collapses. Reached two ways — the "create a folder instead" toggle in
// the create flow (FolderId still null), and editing an existing folder (FolderId set).
// There is no list <-> folder conversion: the toggle is offered on create only.
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HeaderTitle))]
[NotifyPropertyChangedFor(nameof(DeleteLabel))]
[NotifyPropertyChangedFor(nameof(ShowTicketProject))]
private bool _isFolder;
/// <summary>True only while creating — an existing list can't become a folder or back.</summary>
[ObservableProperty] private bool _canToggleFolder;
private string? _folderId;
// Resolved rather than a {loc:Tr} key because the text depends on IsFolder.
public string HeaderTitle => Loc.T(IsFolder ? "modals.listSettings.folderTitle" : "modals.listSettings.title");
public string DeleteLabel => Loc.T(IsFolder ? "modals.listSettings.deleteFolder" : "modals.listSettings.deleteList");
[ObservableProperty] private TicketProjectOption? _selectedTicketProject;
public ObservableCollection<TicketProjectOption> TicketProjects { get; } = new();
@@ -123,8 +154,25 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
string defaultCommitType,
bool isManual = false,
bool findingsTracked = false,
string? icon = null)
=> _ = LoadAsync(listId, name, workingDir, defaultCommitType, isManual, findingsTracked, icon);
string? icon = null,
bool canToggleFolder = false)
{
CanToggleFolder = canToggleFolder;
_ = LoadAsync(listId, name, workingDir, defaultCommitType, isManual, findingsTracked, icon);
}
/// <summary>
/// Opens the modal on an existing folder: name + icon only, no list config to load and
/// nothing to fetch from the worker, so this needs no async counterpart.
/// </summary>
public void BeginLoadFolder(string folderId, string name, string? icon)
{
_folderId = folderId;
IsFolder = true;
CanToggleFolder = false;
Name = name;
Icon = IconOptions.Contains(icon) ? icon! : DefaultIcon;
}
public async Task LoadAsync(
string listId,
@@ -207,12 +255,29 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
}
}
private bool CanSave() => !IsLoading && !_loadFailed;
private bool CanSave() => !IsLoading && !_loadFailed && (IsFolder || string.IsNullOrEmpty(WorkingDirWarning));
private bool CanDelete() => !IsLoading;
// A manual list without a WorkingDir is untouched (empty is always valid) — this only fires
// for the "picked a folder that turns out not to be a repo" case the audit found: it would
// otherwise only surface as a Failed task the first time the worker tries to use it.
partial void OnWorkingDirChanged(string value)
{
if (string.IsNullOrWhiteSpace(value)) { WorkingDirWarning = ""; return; }
WorkingDirWarning = !Directory.Exists(value)
? Loc.T("vm.listSettings.workingDirMissing")
: RepoScanner.IsRepo(value) ? "" : Loc.T("vm.listSettings.workingDirNotRepo");
}
[RelayCommand(CanExecute = nameof(CanSave))]
private async Task SaveAsync()
{
if (IsFolder)
{
await SaveFolderAsync();
return;
}
await _worker.UpdateListAsync(new UpdateListDto(
ListId,
string.IsNullOrWhiteSpace(Name) ? Loc.T("vm.listSettings.untitled") : Name,
@@ -239,13 +304,49 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
CloseAction?.Invoke();
}
private async Task SaveFolderAsync()
{
var name = string.IsNullOrWhiteSpace(Name) ? Loc.T("vm.listSettings.untitled") : Name;
await using var ctx = await _dbFactory.CreateDbContextAsync();
var lists = new ListRepository(ctx);
if (_folderId is null)
{
await lists.AddFolderAsync(new ListFolderEntity
{
Id = Guid.NewGuid().ToString("N"),
Name = name,
Icon = Icon,
CreatedAt = DateTime.UtcNow,
});
// The create flow pre-creates a list row for this modal to save against; a folder
// doesn't need it. Deleted=true (it genuinely is) makes the caller do a full reload,
// which is what picks the new folder up.
await lists.DeleteAsync(ListId);
Deleted = true;
}
else
{
await lists.RenameFolderAsync(_folderId, name, Icon);
}
Saved = true;
CloseAction?.Invoke();
}
[RelayCommand(CanExecute = nameof(CanDelete))]
private async Task DeleteAsync()
{
if (IsFolder)
{
await DeleteFolderAsync();
return;
}
var displayName = string.IsNullOrWhiteSpace(Name) ? Loc.T("vm.listSettings.untitled") : Name;
if (ConfirmAsync is not null)
{
var ok = await ConfirmAsync($"Delete list \"{displayName}\" and all its tasks? This cannot be undone.");
var ok = await ConfirmAsync(Loc.T("vm.listSettings.confirmDeleteList", displayName));
if (!ok) return;
}
@@ -262,7 +363,35 @@ public sealed partial class ListSettingsModalViewModel : ViewModelBase
|| ex.InnerException?.Message.Contains("FOREIGN KEY", StringComparison.OrdinalIgnoreCase) == true))
{
if (ShowErrorAsync is not null)
await ShowErrorAsync("This list has planning sessions with child tasks. Discard those first, then delete the list.");
await ShowErrorAsync(Loc.T("vm.listSettings.deleteBlockedPlanning"));
return;
}
Deleted = true;
CloseAction?.Invoke();
}
private async Task DeleteFolderAsync()
{
// Create mode with the folder toggle on: nothing has been written yet, so this is a cancel
// — and the caller's rollback drops the pre-created list row.
if (_folderId is null) { CloseAction?.Invoke(); return; }
var displayName = string.IsNullOrWhiteSpace(Name) ? Loc.T("vm.listSettings.untitled") : Name;
if (ConfirmAsync is not null)
{
var ok = await ConfirmAsync(Loc.T("vm.listSettings.confirmDeleteFolder", displayName));
if (!ok) return;
}
try
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
await new ListRepository(ctx).DeleteFolderAsync(_folderId);
}
catch (Exception ex)
{
ErrorReported?.Invoke(ex.Message);
return;
}
@@ -67,6 +67,15 @@ public sealed partial class MergeHelperSelectionModalViewModel : ViewModelBase
public ObservableCollection<MergeHelperTaskRowViewModel> Tasks { get; } = new();
/// <summary>Model choices for the triage session. Only opus/fable are offered on purpose —
/// triage is the dedupe/refine leverage point; cheaper models aren't worth a picker slot.</summary>
public IReadOnlyList<string> ModelOptions { get; } = new[] { "opus", "fable" };
[ObservableProperty] private string _selectedModel = Data.Models.ModelRegistry.HandlerTriageAlias;
/// <summary>Hidden in review mode — those runs start directly at the merge phase, no triage.</summary>
public bool ShowModelPicker => !_reviewMode;
[ObservableProperty] private string _scopeLabel = "";
public bool HasTasks => Tasks.Count > 0;
@@ -100,6 +109,7 @@ public sealed partial class MergeHelperSelectionModalViewModel : ViewModelBase
{
_reviewMode = true;
ScopeLabel = Loc.T("modals.mergeHelper.scopeReview");
OnPropertyChanged(nameof(ShowModelPicker));
}
/// <summary>Groups a confirmed review-mode selection by owning list, preserving row order —
@@ -31,6 +31,10 @@ public sealed partial class MergeModalViewModel : ViewModelBase
[ObservableProperty] private string? _warningMessage;
[ObservableProperty] private string? _successMessage;
[ObservableProperty][NotifyCanExecuteChangedFor(nameof(SubmitCommand))] private bool _hasConflict;
/// The merge was refused because the target working dir is dirty — offer the stash retry
/// instead of dead-ending on the error text.
[ObservableProperty] private bool _showStashRetry;
[ObservableProperty] private IReadOnlyList<string> _conflictFiles = Array.Empty<string>();
public Action? CloseAction { get; set; }
@@ -72,6 +76,14 @@ public sealed partial class MergeModalViewModel : ViewModelBase
SelectedBranch = Branches.Contains(targets.DefaultBranch)
? targets.DefaultBranch
: Branches.FirstOrDefault();
// Known dirty before anyone clicks Merge — offer the stash retry right away instead
// of making the user hit the "dirty_target" refusal first.
if (targets.TargetDirty)
{
WarningMessage = Loc.T("vm.merge.targetDirty");
ShowStashRetry = true;
}
}
catch (Exception ex)
{
@@ -84,22 +96,29 @@ public sealed partial class MergeModalViewModel : ViewModelBase
!IsBusy && !HasConflict && !string.IsNullOrWhiteSpace(SelectedBranch);
[RelayCommand(CanExecute = nameof(CanSubmit))]
private async Task SubmitAsync()
private Task SubmitAsync() => RunMergeAsync(autostash: false);
/// Retry after "dirty_target": git stashes the target working tree's uncommitted changes,
/// merges, and restores them afterwards.
[RelayCommand(CanExecute = nameof(CanSubmit))]
private Task StashAndMergeAsync() => RunMergeAsync(autostash: true);
private async Task RunMergeAsync(bool autostash)
{
if (string.IsNullOrWhiteSpace(SelectedBranch)) return;
IsBusy = true;
ErrorMessage = null;
WarningMessage = null;
SuccessMessage = null;
ShowStashRetry = false;
// Subscribed only for the duration of the call: the worker's broadcast reaches every
// client, and a transient VM left on that event would outlive its window.
ProgressMessage = Loc.T("vm.merge.progressMerging");
_worker.MergeProgressEvent += OnMergeProgress;
_worker.OperationProgressEvent += OnOperationProgress;
try
{
var result = await _worker.MergeTaskAsync(
TaskId, SelectedBranch!, RemoveWorktree, CommitMessage);
TaskId, SelectedBranch!, RemoveWorktree, CommitMessage, autostash);
switch (result.Status)
{
@@ -131,6 +150,12 @@ public sealed partial class MergeModalViewModel : ViewModelBase
// point of the gate.
ErrorMessage = result.ErrorMessage ?? Loc.T("vm.merge.verifyFailed");
break;
case "dirty_target":
// Nothing landed -- the target working dir has uncommitted changes. Offer the
// stash retry; git restores the changes after the merge.
ErrorMessage = result.ErrorMessage ?? Loc.T("vm.merge.dirtyTarget");
ShowStashRetry = true;
break;
case "untracked_collision":
// Nothing landed -- the merge was refused before touching the repo. Show the
// real message (it names the colliding path and size); the locale string is
@@ -148,34 +173,23 @@ public sealed partial class MergeModalViewModel : ViewModelBase
}
finally
{
_worker.MergeProgressEvent -= OnMergeProgress;
_worker.OperationProgressEvent -= OnOperationProgress;
ProgressMessage = null;
IsBusy = false;
}
}
private void OnMergeProgress(string taskId, string phase, int elapsedSeconds)
{
if (taskId != TaskId) return;
// Rebasing is handled by OnOperationProgress (needs the branch total, which this
// elapsed-seconds-only forwarder drops) -- don't overwrite it with the generic fallback.
if (phase == MergePhaseRebasing) return;
ProgressMessage = phase switch
{
MergePhaseVerifying => Loc.T("vm.merge.progressVerifying", FormatElapsed(elapsedSeconds)),
_ => Loc.T("vm.merge.progressMerging"),
};
}
// Separate event: MergeProgressEvent forwards elapsed-seconds-only (verifying), but the
// rebase phase needs the branch count too, which only rides the untrimmed OperationProgress.
private void OnOperationProgress(string opKey, string phase, int current, int total)
{
if (opKey != TaskId || phase != MergePhaseRebasing) return;
ProgressMessage = total > 0
? $"{Loc.T("ops.worker.rebasingAfterMerge")} ({current}/{total})"
: Loc.T("ops.worker.rebasingAfterMerge");
if (opKey != TaskId) return;
ProgressMessage = phase switch
{
MergePhaseRebasing => total > 0
? $"{Loc.T("ops.worker.rebasingAfterMerge")} ({current}/{total})"
: Loc.T("ops.worker.rebasingAfterMerge"),
MergePhaseVerifying => Loc.T("vm.merge.progressVerifying", FormatElapsed(current)),
_ => Loc.T("vm.merge.progressMerging"),
};
}
/// Mirrors TaskMergeService.PhaseVerifying — a hub payload token, not a display string.
@@ -44,7 +44,7 @@ public sealed partial class RepoImportModalViewModel : ViewModelBase
public int CreateCount => Repos.Count(r => r.IsChecked && !r.AlreadyAdded);
public bool CanCreate => CreateCount > 0;
public string CreateButtonText => $"Create {CreateCount} list(s)";
public string CreateButtonText => Loc.T("vm.repoImport.createButton", CreateCount);
public bool HasFolders => _folders.Count > 0;
public RepoImportModalViewModel(IDbContextFactory<ClaudeDoDbContext> dbFactory, IWorkerClient workerClient)
@@ -119,8 +119,13 @@ public sealed partial class GeneralSettingsTabViewModel : ViewModelBase
foreach (var row in ModelPresets)
if (row.MaxTurns is < 1 or > 200)
return $"Max turns for {row.Model} must be between 1 and 200.";
if (!IsValidWindowBound(PowerUseWindowStart) || !IsValidWindowBound(PowerUseWindowEnd))
return Loc.T("settings.general.powerUseWindowInvalid");
return null;
}
private static bool IsValidWindowBound(string? value)
=> string.IsNullOrWhiteSpace(value) || PowerUseWindow.Parse(value) is not null;
}
/// <summary>One row of the per-model preset table. Single consumer, so it lives here.</summary>
@@ -1,7 +1,9 @@
using System;
using System.Diagnostics;
using System.IO;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace ClaudeDo.Ui.ViewModels.Modals;
@@ -11,6 +13,9 @@ public sealed partial class WorkerConnectionModalViewModel : ViewModelBase
private readonly WorkerLocator _workerLocator;
private readonly InstallerLocator _installerLocator;
// Test seam: real Process.Start by default, swappable to simulate a blocked/failed launch.
internal Action<ProcessStartInfo> ProcessStarter { get; set; } = psi => Process.Start(psi);
public WorkerConnectionModalViewModel(WorkerLocator workerLocator, InstallerLocator installerLocator)
{
_workerLocator = workerLocator;
@@ -19,15 +24,29 @@ public sealed partial class WorkerConnectionModalViewModel : ViewModelBase
public Action? CloseAction { get; set; }
[ObservableProperty] private string? _errorText;
[RelayCommand] private void Close() => CloseAction?.Invoke();
[RelayCommand]
private void StartWorker()
{
var exe = _workerLocator.Find();
if (exe is null) return;
try { Process.Start(new ProcessStartInfo(exe) { UseShellExecute = true }); }
catch { /* nothing useful to show */ }
if (exe is null)
{
ErrorText = Loc.T("modals.workerConnection.workerNotFound");
return;
}
try
{
ProcessStarter(new ProcessStartInfo(exe) { UseShellExecute = true });
}
catch (Exception ex)
{
ErrorText = Loc.T("modals.workerConnection.startFailed", ex.Message);
return;
}
ErrorText = null;
CloseAction?.Invoke();
}
@@ -35,18 +54,26 @@ public sealed partial class WorkerConnectionModalViewModel : ViewModelBase
private void RerunInstaller()
{
var path = _installerLocator.Find();
if (path is null) return;
if (path is null)
{
ErrorText = Loc.T("modals.workerConnection.installerNotFound");
return;
}
try
{
// See IslandsShellViewModel.UpdateNow: an inherited CWD inside the install dir
// makes the installer block its own app\ rename.
Process.Start(new ProcessStartInfo(path)
ProcessStarter(new ProcessStartInfo(path)
{
UseShellExecute = true,
WorkingDirectory = Path.GetTempPath(),
});
Environment.Exit(0);
}
catch { /* nothing useful to show */ }
catch (Exception ex)
{
ErrorText = Loc.T("modals.workerConnection.startFailed", ex.Message);
return;
}
Environment.Exit(0);
}
}
@@ -16,6 +16,7 @@ public enum BatchMergeOutcome { None, Merging, Merged, Conflict, Blocked, Verify
public sealed partial class WorktreeOverviewRowViewModel : ViewModelBase
{
[ObservableProperty] private string _taskId = "";
[ObservableProperty] private int _taskNumber;
[ObservableProperty] private string _taskTitle = "";
[ObservableProperty][NotifyPropertyChangedFor(nameof(IsRunning))] private TaskStatus _taskStatus;
[ObservableProperty] private string _listId = "";
@@ -49,6 +50,9 @@ public sealed partial class WorktreeOverviewRowViewModel : ViewModelBase
public bool IsKept => State == WorktreeState.Kept;
public bool IsRunning => TaskStatus == TaskStatus.Running;
// 0 = row without an allocated number (test seeds); a bare "#0" would be meaningless.
public bool ShowNumberBadge => TaskNumber > 0;
private static string FormatAge(TimeSpan ts)
{
if (ts.TotalDays >= 1) return $"{(int)ts.TotalDays}d ago";
@@ -366,7 +370,7 @@ public sealed partial class WorktreesOverviewModalViewModel : ViewModelBase
private static WorktreeOverviewRowViewModel Map(WorktreeOverviewDto d) => new()
{
TaskId = d.TaskId, TaskTitle = d.TaskTitle, TaskStatus = d.TaskStatus,
TaskId = d.TaskId, TaskNumber = d.TaskNumber, TaskTitle = d.TaskTitle, TaskStatus = d.TaskStatus,
ListId = d.ListId, ListName = d.ListName,
Path = d.Path, BranchName = d.BranchName, BaseCommit = d.BaseCommit, State = d.State,
DiffStat = d.DiffStat, CreatedAt = d.CreatedAt, PathExistsOnDisk = d.PathExistsOnDisk,
@@ -415,7 +419,8 @@ public sealed partial class WorktreesOverviewModalViewModel : ViewModelBase
private bool CanMergeAll() => !BatchMergeStatus.IsRunning && SelectedCount > 0 && !string.IsNullOrWhiteSpace(SelectedTarget);
[RelayCommand(CanExecute = nameof(CanMergeAll))]
private Task MergeAll() => MergeSelectedAsync(_worker.MergeTaskAsync);
private Task MergeAll() => MergeSelectedAsync(
(taskId, target, removeWorktree, message) => _worker.MergeTaskAsync(taskId, target, removeWorktree, message));
[RelayCommand]
private void ResolveConflict(WorktreeOverviewRowViewModel? row)
@@ -78,8 +78,8 @@ public partial class ConflictResolverView : Window
// Panes are whole files here, not aligned rows, so raw pixel offsets line up and the
// gutter buttons only have to be repositioned once per scroll.
new VerticalScrollSync(new[] { OursEditor, ResultEditor, TheirsEditor },
afterSync: PositionGutters);
new ScrollSync(new[] { OursEditor, ResultEditor, TheirsEditor },
afterSync: PositionGutters);
var conflict = DiffEditorSetup.Brush(this, "MergeConflictTintBrush", Color.Parse("#28C87060"));
var resolved = DiffEditorSetup.Brush(this, "MergeResolvedTintBrush", Color.Parse("#206FA86B"));
@@ -75,9 +75,11 @@ internal static class DiffEditorSetup
}
/// <summary>
/// Keeps a set of editors scrolled to the same vertical position. Construction wires the panes;
/// there is nothing to dispose, and nothing to keep a reference to — the event subscriptions on
/// the text views own the instance.
/// Keeps a set of editors scrolled to the same position, vertically always and horizontally
/// whenever the panes share the same content width (no per-pane offset conversion, unlike
/// <see cref="TargetOffset"/> for Y). Construction wires the panes; there is nothing to dispose,
/// and nothing to keep a reference to — the event subscriptions on the text views own the
/// instance.
/// </summary>
/// <remarks>
/// <para>
@@ -96,7 +98,7 @@ internal static class DiffEditorSetup
/// leaves the ScrollViewer's own offset (and therefore the scrollbar thumb) behind.
/// </para>
/// </remarks>
internal sealed class VerticalScrollSync
internal sealed class ScrollSync
{
private readonly TextEditor[] _editors;
private readonly ScrollViewer?[] _viewers;
@@ -108,8 +110,8 @@ internal sealed class VerticalScrollSync
/// <param name="isActive">Gate for layouts where the panes are not side by side.</param>
/// <param name="anchorByLine">True while lines wrap — see <see cref="TargetOffset"/>.</param>
/// <param name="afterSync">Runs once per user scroll, not per echo.</param>
public VerticalScrollSync(TextEditor[] editors, Func<bool>? isActive = null,
Func<bool>? anchorByLine = null, Action? afterSync = null)
public ScrollSync(TextEditor[] editors, Func<bool>? isActive = null,
Func<bool>? anchorByLine = null, Action? afterSync = null)
{
_editors = editors;
_viewers = new ScrollViewer?[editors.Length];
@@ -136,15 +138,18 @@ internal sealed class VerticalScrollSync
_syncing = true;
try
{
var x = _editors[sourceIndex].TextArea.TextView.ScrollOffset.X;
for (var i = 0; i < _editors.Length; i++)
{
if (i == sourceIndex) continue;
if (Viewer(i) is not { } viewer) continue;
if (TargetOffset(_editors[sourceIndex], _editors[i]) is not { } y) continue;
// The echo from the target's own ScrollOffsetChanged lands after _syncing is
// cleared again, so this comparison — not the flag — is what ends the loop.
if (Math.Abs(viewer.Offset.Y - y) > 0.5)
viewer.Offset = new Vector(viewer.Offset.X, y);
// cleared again, so this comparison — not the flag — is what ends the loop. Both
// axes must be checked: writing only when Y moved left X's own echo unguarded,
// which is how it looped forever once X was written below.
if (Math.Abs(viewer.Offset.X - x) > 0.5 || Math.Abs(viewer.Offset.Y - y) > 0.5)
viewer.Offset = new Vector(x, y);
}
}
finally { _syncing = false; }
@@ -85,8 +85,8 @@ public partial class DiffTextView : UserControl
_leftTm = DiffEditorSetup.InstallHighlighting(LeftEditor);
_rightTm = DiffEditorSetup.InstallHighlighting(RightEditor);
ReloadFile();
new VerticalScrollSync(new[] { LeftEditor, RightEditor },
isActive: () => IsSplit, anchorByLine: () => WrapLines);
new ScrollSync(new[] { LeftEditor, RightEditor },
isActive: () => IsSplit, anchorByLine: () => WrapLines);
}
/// Brushes and the mono typeface only resolve once the control is in the visual tree —
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels;
namespace ClaudeDo.Ui.Views;
@@ -43,7 +45,54 @@ public partial class InteractiveTerminalView : UserControl
if (DataContext is not InteractiveTerminalViewModel vm) return;
e.Handled = true;
_ = vm.PasteAsync();
_ = PasteAndReportAsync(this, vm);
}
// A clipboard image (e.g. a screenshot) can't be typed into the child process, so it's written
// to a temp PNG and its path is inserted the same way a dropped file is — Claude reads the file
// itself. Plain-text clipboard content keeps going through the existing bracketed-paste flow.
// Once a bitmap is confirmed present, any failure (dir/file write, send) is a real paste
// failure — never silently fall back to a text paste of the same clipboard.
private static async System.Threading.Tasks.Task PasteAndReportAsync(InteractiveTerminalView view, InteractiveTerminalViewModel vm)
{
Avalonia.Media.Imaging.Bitmap? bitmap = null;
try
{
bitmap = await TryGetClipboardBitmapAsync(TopLevel.GetTopLevel(view));
if (bitmap is null)
{
if (!await vm.PasteAsync()) vm.ReportSendFailed();
return;
}
var path = ClipboardImageTempStore.NewPngPath(DateTime.UtcNow);
Directory.CreateDirectory(ClipboardImageTempStore.Directory);
bitmap.Save(path);
if (!await vm.SendTextAsync(FormatDroppedPaths(new[] { path })))
vm.ReportSendFailed();
}
catch (Exception)
{
vm.ReportSendFailed();
}
finally
{
bitmap?.Dispose();
}
}
private static async System.Threading.Tasks.Task<Avalonia.Media.Imaging.Bitmap?> TryGetClipboardBitmapAsync(TopLevel? topLevel)
{
if (topLevel?.Clipboard is not { } clipboard) return null;
try
{
using var data = await clipboard.TryGetDataAsync();
return data is null ? null : await Avalonia.Input.AsyncDataTransferExtensions.TryGetBitmapAsync(data);
}
catch (Exception)
{
return null;
}
}
private static bool IsFilesDrop(DragEventArgs e) => e.DataTransfer?.Contains(DataFormat.File) == true;
@@ -62,7 +111,13 @@ public partial class InteractiveTerminalView : UserControl
e.Handled = true;
var text = FormatDroppedPaths(e.DataTransfer!.TryGetFiles()?.Select(i => i.TryGetLocalPath()));
if (text.Length > 0) _ = vm.SendTextAsync(text);
if (text.Length > 0) _ = SendTextAndReportAsync(vm, text);
}
private static async System.Threading.Tasks.Task SendTextAndReportAsync(InteractiveTerminalViewModel vm, string text)
{
if (!await vm.SendTextAsync(text))
vm.ReportSendFailed();
}
/// <summary>Joins dropped file paths into one insertable chunk: quoted when they contain a
@@ -88,8 +88,8 @@
ToolTip.Tip="{loc:Tr details.toggleEditPreviewTip}"
Command="{Binding ToggleEditDescriptionCommand}">
<Panel>
<TextBlock Text="Preview" IsVisible="{Binding IsEditingDescription}"/>
<TextBlock Text="Edit" IsVisible="{Binding !IsEditingDescription}"/>
<TextBlock Text="{loc:Tr details.stepsCard.preview}" IsVisible="{Binding IsEditingDescription}"/>
<TextBlock Text="{loc:Tr details.stepsCard.edit}" IsVisible="{Binding !IsEditingDescription}"/>
</Panel>
</Button>
@@ -123,7 +123,7 @@
<!-- Steps -->
<StackPanel IsVisible="{Binding IsStepsSection}" Spacing="6">
<TextBox Text="{Binding NewSubtaskTitle, Mode=TwoWay}"
PlaceholderText="Add step…"
PlaceholderText="{loc:Tr details.stepsCard.addStepPlaceholder}"
Padding="8"
Background="{DynamicResource Surface3Brush}"
BorderBrush="{DynamicResource LineBrush}"
@@ -41,6 +41,14 @@
</Viewbox>
<TextBlock Classes="meta" Text="{Binding Task.Branch}"/>
</StackPanel>
<!-- Dependency-wait line: this task is Queued but blocked on an unmet predecessor (a
task_dependencies edge, or the planning chain's BlockedByTaskId). -->
<StackPanel Orientation="Horizontal" Spacing="4" Margin="0,4,0,0"
IsVisible="{Binding Task.IsWaiting, FallbackValue=False}">
<TextBlock Classes="meta" Text="{loc:Tr details.waitingOnPrefix}"/>
<TextBlock Classes="meta" Text="{Binding Task.DependencyWaitLabel}"/>
</StackPanel>
</StackPanel>
<!-- Column 1: trash button (not running) -->
@@ -172,12 +172,12 @@
TextWrapping="Wrap" VerticalAlignment="Center" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Classes="btn accent" Content="Continue"
<Button Classes="btn accent" Content="{loc:Tr details.workConsole.continue}"
Command="{Binding ContinueCommand}"
IsVisible="{Binding ShowContinue}"
ToolTip.Tip="{loc:Tr session.continueNoSessionTip}"
ToolTip.ShowOnDisabled="True" />
<Button Classes="btn" Content="Reset &amp; Retry"
<Button Classes="btn" Content="{loc:Tr details.workConsole.resetAndRetry}"
Command="{Binding ResetAndRetryCommand}"
IsVisible="{Binding ShowResetAndRetry}"
ToolTip.Tip="{loc:Tr session.resetAndRetryInteractiveTip}"
@@ -194,7 +194,7 @@
<StackPanel Orientation="Horizontal">
<Button Classes="tab-btn"
Classes.active="{Binding IsOutputTab}"
Content="Output"
Content="{loc:Tr details.workConsole.tabOutput}"
Command="{Binding SelectTabCommand}"
CommandParameter="output" />
<Button Classes="tab-btn"
@@ -202,7 +202,7 @@
Command="{Binding SelectTabCommand}"
CommandParameter="git">
<StackPanel Orientation="Horizontal" Spacing="6">
<TextBlock Text="Git" VerticalAlignment="Center" />
<TextBlock Text="{loc:Tr details.workConsole.tabGit}" VerticalAlignment="Center" />
<!-- Review-pending dot: where to act when a task awaits review -->
<Ellipse Width="6" Height="6" VerticalAlignment="Center"
Fill="{DynamicResource AccentBrush}"
@@ -211,7 +211,7 @@
</Button>
<Button Classes="tab-btn"
Classes.active="{Binding IsSessionTab}"
Content="Session"
Content="{loc:Tr details.workConsole.tabSession}"
IsVisible="{Binding HasChildOutcomes}"
Command="{Binding SelectTabCommand}"
CommandParameter="session" />
@@ -233,7 +233,7 @@
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="1" CornerRadius="8">
<StackPanel Spacing="6">
<TextBlock Classes="section-label" Text="OUTCOME" />
<TextBlock Classes="section-label" Text="{loc:Tr details.workConsole.outcomeLabel}" />
<ScrollViewer MaxHeight="160" VerticalScrollBarVisibility="Auto">
<SelectableTextBlock Text="{Binding SessionOutcome}"
TextWrapping="Wrap"
@@ -309,9 +309,9 @@
<!-- Merge controls — shown whenever there's a worktree / unit to merge.
Header reads REVIEW while a decision is pending, otherwise MERGE. -->
<StackPanel Spacing="14" IsVisible="{Binding Merge.ShowMergeSection}">
<TextBlock Classes="section-label" Text="REVIEW"
<TextBlock Classes="section-label" Text="{loc:Tr details.workConsole.reviewLabel}"
IsVisible="{Binding IsWaitingForReview}" />
<TextBlock Classes="section-label" Text="MERGE"
<TextBlock Classes="section-label" Text="{loc:Tr details.workConsole.mergeLabel}"
IsVisible="{Binding !IsWaitingForReview}" />
<!-- Change summary (review only) -->
@@ -323,10 +323,14 @@
<!-- Target branch + pre-flight mergeability -->
<StackPanel Spacing="4">
<TextBlock Classes="field-label" Text="Target branch" />
<TextBlock Classes="field-label" Text="{loc:Tr details.workConsole.targetBranch}" />
<ComboBox ItemsSource="{Binding Merge.MergeTargetBranches}"
SelectedItem="{Binding Merge.SelectedMergeTarget, Mode=TwoWay}"
HorizontalAlignment="Stretch" />
<TextBlock Classes="meta" Text="{loc:Tr details.workConsole.targetDirty}"
TextWrapping="Wrap"
Foreground="{DynamicResource AmberBrush}"
IsVisible="{Binding Merge.TargetDirty}" />
</StackPanel>
<StackPanel Spacing="0">
@@ -344,7 +348,7 @@
<!-- Inspect: diff / worktree / combined diff -->
<WrapPanel Orientation="Horizontal">
<Button Classes="btn" Content="Open Diff" Margin="0,0,8,8"
<Button Classes="btn" Content="{loc:Tr details.workConsole.openDiff}" Margin="0,0,8,8"
ToolTip.Tip="{loc:Tr agent.openDiffTip}"
ToolTip.ShowOnDisabled="True"
Command="{Binding Merge.OpenDiffCommand}" />
@@ -353,11 +357,11 @@
ToolTip.ShowOnDisabled="True"
Command="{Binding Merge.OpenWorktreeCommand}">
<StackPanel Orientation="Horizontal" Spacing="5">
<TextBlock Text="Worktree" />
<TextBlock Text="{loc:Tr details.workConsole.worktree}" />
<PathIcon Data="{StaticResource Icon.ArrowOut}" Width="11" Height="11" />
</StackPanel>
</Button>
<Button Classes="btn" Content="Review Combined Diff" Margin="0,0,8,8"
<Button Classes="btn" Content="{loc:Tr details.workConsole.reviewCombinedDiff}" Margin="0,0,8,8"
ToolTip.Tip="{loc:Tr agent.reviewCombinedDiffTip}"
ToolTip.ShowOnDisabled="True"
Command="{Binding Merge.ReviewCombinedDiffCommand}" />
@@ -377,7 +381,7 @@
Foreground="{DynamicResource AmberBrush}" VerticalAlignment="Center" />
<TextBlock Classes="meta" VerticalAlignment="Center"
Foreground="{DynamicResource AmberBrush}"
Text="Open the diff to enable merge" />
Text="{loc:Tr details.workConsole.openDiffHint}" />
</StackPanel>
<TextBlock Classes="meta" Margin="17,0,0,0"
Text="{loc:Tr session.approveMergesUnitHint}" />
@@ -396,23 +400,23 @@
<WrapPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Spacing="{StaticResource SpaceSm}" Margin="0,0,8,8">
<Button Classes="btn accent" Content="Approve &amp; Merge"
<Button Classes="btn accent" Content="{loc:Tr details.workConsole.approveMerge}"
Command="{Binding ApproveReviewCommand}" />
<controls:OperationIndicator Status="{Binding ApproveOp}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="{StaticResource SpaceSm}" Margin="0,0,8,8">
<Button Classes="btn" Content="Park"
ToolTip.Tip="Set aside — back to Idle, keeps the worktree"
<Button Classes="btn" Content="{loc:Tr details.workConsole.park}"
ToolTip.Tip="{loc:Tr details.workConsole.parkTip}"
Command="{Binding ParkReviewCommand}" />
<controls:OperationIndicator Status="{Binding ParkOp}" />
</StackPanel>
<Button Classes="btn" Content="Cancel" Margin="0,0,8,8"
<Button Classes="btn" Content="{loc:Tr details.workConsole.cancel}" Margin="0,0,8,8"
ToolTip.Tip="{loc:Tr session.mergeDrainHint}"
ToolTip.ShowOnDisabled="True"
Command="{Binding CancelReviewCommand}" />
</WrapPanel>
<Button Classes="prompt-action" Content="Reset (discard branch)…"
<Button Classes="prompt-action" Content="{loc:Tr details.workConsole.resetDiscardBranch}"
ToolTip.Tip="{loc:Tr session.reviewResetTip}"
Command="{Binding ResetReviewCommand}" />
</StackPanel>
@@ -434,9 +438,9 @@
<Border Height="1" Background="{DynamicResource LineBrush}" />
<TextBlock Classes="meta" TextWrapping="Wrap"
Foreground="{DynamicResource TextMuteBrush}"
Text="Worked on this by hand? Submit the worktree for review to merge it." />
Text="{loc:Tr details.workConsole.submitForReviewHint}" />
<StackPanel Orientation="Horizontal" Spacing="{StaticResource SpaceSm}">
<Button Classes="btn accent" Content="Submit for review" HorizontalAlignment="Left"
<Button Classes="btn accent" Content="{loc:Tr details.workConsole.submitForReview}" HorizontalAlignment="Left"
Command="{Binding SubmitForReviewCommand}" />
<controls:OperationIndicator Status="{Binding SubmitOp}" />
</StackPanel>
@@ -466,7 +470,7 @@
<!-- Child outcomes -->
<StackPanel Spacing="6" IsVisible="{Binding HasChildOutcomes}">
<TextBlock Classes="section-label" Text="OUTCOMES" />
<TextBlock Classes="section-label" Text="{loc:Tr details.workConsole.outcomesLabel}" />
<ItemsControl ItemsSource="{Binding ChildOutcomes}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:ChildOutcomeRowViewModel">
@@ -51,7 +51,7 @@
<PathIcon Data="{StaticResource Icon.Warning}"
Foreground="{DynamicResource StatusReviewBrush}"
Width="14" Height="14" VerticalAlignment="Center"/>
<TextBlock Classes="section-label" Text="ROADBLOCK"
<TextBlock Classes="section-label" Text="{loc:Tr details.roadblockLabel}"
Foreground="{DynamicResource StatusReviewBrush}"
VerticalAlignment="Center"/>
</StackPanel>
@@ -173,8 +173,6 @@ public partial class DetailsIslandView : UserControl
await modal.ShowDialog(owner);
};
vm.ConfirmAsync = ShowConfirmAsync;
vm.ShowErrorAsync = ShowErrorDialogAsync;
}
}
@@ -213,87 +211,4 @@ public partial class DetailsIslandView : UserControl
_descriptionHeights[id] = DetailBodyGrid.RowDefinitions[0].Height.Value;
}
private async System.Threading.Tasks.Task ShowErrorDialogAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner == null) return;
var ok = new Button { Content = "OK", MinWidth = 90 };
var dialog = new Window
{
Title = "Error",
Width = 360,
SizeToContent = SizeToContent.Height,
CanResize = false,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
ShowInTaskbar = false,
Background = this.FindResource("SurfaceBrush") as IBrush,
Content = new StackPanel
{
Spacing = 16,
Margin = new Thickness(20),
Children =
{
new TextBlock { Text = message, TextWrapping = TextWrapping.Wrap },
new StackPanel
{
Orientation = Orientation.Horizontal,
Spacing = 8,
HorizontalAlignment = HorizontalAlignment.Right,
Children = { ok }
}
}
}
};
ok.Click += (_, _) => dialog.Close();
await dialog.ShowDialog(owner);
}
private async System.Threading.Tasks.Task<bool> ShowConfirmAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner == null) return false;
var tcs = new TaskCompletionSource<bool>();
var cancel = new Button { Content = "Cancel", MinWidth = 90 };
var confirm = new Button { Content = "Delete", MinWidth = 90, Classes = { "danger" } };
var dialog = new Window
{
Title = "Confirm",
Width = 360,
SizeToContent = SizeToContent.Height,
CanResize = false,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
ShowInTaskbar = false,
Background = this.FindResource("SurfaceBrush") as IBrush,
Content = new StackPanel
{
Spacing = 16,
Margin = new Thickness(20),
Children =
{
new TextBlock { Text = message, TextWrapping = TextWrapping.Wrap },
new StackPanel
{
Orientation = Orientation.Horizontal,
Spacing = 8,
HorizontalAlignment = HorizontalAlignment.Right,
Children = { cancel, confirm }
}
}
}
};
cancel.Click += (_, _) => { tcs.TrySetResult(false); dialog.Close(); };
confirm.Click += (_, _) => { tcs.TrySetResult(true); dialog.Close(); };
dialog.Closed += (_, _) => tcs.TrySetResult(false);
_ = dialog.ShowDialog(owner);
return await tcs.Task;
}
}
@@ -5,6 +5,152 @@
xmlns:loc="using:ClaudeDo.Ui.Localization"
x:Class="ClaudeDo.Ui.Views.Islands.ListsIslandView"
x:DataType="vm:ListsIslandViewModel">
<!-- Implicit, type-matched templates: the sidebar's top level is one mixed ItemsControl over
TopLevel (folders and folder-less lists interleaved), and each folder's children resolve the
list template the same way. -->
<UserControl.DataTemplates>
<!-- One user-list row. Shared by the top level and by each folder's children, so the
row (context menu, drag handlers, drop indicators) exists once. -->
<DataTemplate DataType="vm:ListNavItemViewModel">
<Grid RowDefinitions="Auto,Auto,Auto">
<!-- Above-row drop indicator -->
<Border Grid.Row="0" Height="2" VerticalAlignment="Center" Margin="4,0"
Background="{DynamicResource MossBrush}" CornerRadius="1"
IsVisible="{Binding DropHintAbove}"/>
<Border Grid.Row="1" Classes="list-item" Classes.active="{Binding IsActive}"
Classes.drop-target="{Binding IsTaskDropTarget}"
Tapped="OnItemTapped"
DragDrop.AllowDrop="True"
DragDrop.DragOver="OnListDragOver"
DragDrop.Drop="OnListDrop">
<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="{loc:Tr lists.contextWorktrees}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenWorktreesOverviewCommand}"
CommandParameter="{Binding}"/>
<Separator IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<MenuItem Header="{loc:Tr lists.contextOpenExplorer}"
IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenInExplorerCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextOpenFindings}"
IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenFindingsCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextOpenTerminal}"
IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenInTerminalCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextImportTickets}"
IsVisible="{Binding HasTicketProject}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).ImportTicketsCommand}"
CommandParameter="{Binding}"/>
<Separator/>
<MenuItem Header="{loc:Tr lists.contextRemoveFromFolder}"
IsVisible="{Binding FolderId, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).RemoveFromFolderCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextSettings}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenListSettingsCommand}"
CommandParameter="{Binding}"/>
</ContextMenu>
</Border.ContextMenu>
<Grid ColumnDefinitions="20,*,Auto">
<!-- Left accent bar for active state -->
<Border Grid.Column="0" Grid.ColumnSpan="3"
Background="Transparent"
CornerRadius="8" IsHitTestVisible="False"
IsVisible="{Binding IsActive}">
<Border Width="2" Height="16"
Background="{DynamicResource AccentBrush}"
CornerRadius="1"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="-8,0,0,0"/>
</Border>
<!-- Icon (list-settings → Icon tab; "Folder" when unset) -->
<PathIcon Grid.Column="0" Classes="list-icon"
Width="14" Height="14"
Data="{Binding IconKey, Converter={StaticResource IconKey}}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<!-- Name -->
<TextBlock Grid.Column="1" Classes="list-label"
Text="{Binding Name}"
VerticalAlignment="Center" Margin="8,0"
Foreground="{DynamicResource TextDimBrush}" FontSize="{StaticResource FontSizeBody}"/>
<!-- Count -->
<TextBlock Grid.Column="2" Classes="list-count"
Text="{Binding Count}"/>
</Grid>
</Border>
<!-- Below-row drop indicator (last item only) -->
<Border Grid.Row="2" Height="2" VerticalAlignment="Center" Margin="4,0"
Background="{DynamicResource MossBrush}" CornerRadius="1"
IsVisible="{Binding DropHintBelow}"/>
</Grid>
</DataTemplate>
<!-- One folder: header (never selectable — tapping folds it) plus its child lists. The two
drop indicators sit around the whole block, so "below this folder" doesn't draw a line
between the header and its children. -->
<DataTemplate DataType="vm:ListFolderNavItemViewModel">
<Grid RowDefinitions="Auto,Auto,Auto">
<Border Grid.Row="0" Height="2" VerticalAlignment="Center" Margin="4,0"
Background="{DynamicResource MossBrush}" CornerRadius="1"
IsVisible="{Binding DropHintAbove}"/>
<StackPanel Grid.Row="1">
<Border Classes="list-item"
Classes.drop-target="{Binding IsDropTarget}"
Tapped="OnFolderTapped"
DragDrop.AllowDrop="True"
DragDrop.DragOver="OnFolderDragOver"
DragDrop.Drop="OnFolderDrop">
<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="{loc:Tr lists.contextFolderSettings}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenFolderSettingsCommand}"
CommandParameter="{Binding}"/>
</ContextMenu>
</Border.ContextMenu>
<Grid ColumnDefinitions="12,20,*,Auto">
<PathIcon Grid.Column="0" Classes="list-icon"
Width="9" Height="9"
Data="{StaticResource Icon.ChevronRight}"
IsVisible="{Binding IsCollapsed}"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
<PathIcon Grid.Column="0" Classes="list-icon"
Width="9" Height="9"
Data="{StaticResource Icon.ChevronDown}"
IsVisible="{Binding !IsCollapsed}"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
<PathIcon Grid.Column="1" Classes="list-icon"
Width="14" Height="14"
Data="{Binding IconKey, Converter={StaticResource IconKey}}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Classes="list-label"
Text="{Binding Name}"
VerticalAlignment="Center" Margin="8,0"
Foreground="{DynamicResource TextDimBrush}" FontSize="{StaticResource FontSizeBody}"/>
<TextBlock Grid.Column="3" Classes="list-count"
Text="{Binding Count}"/>
</Grid>
</Border>
<ItemsControl ItemsSource="{Binding Lists}"
IsVisible="{Binding !IsCollapsed}"
Margin="14,0,0,0"/>
</StackPanel>
<Border Grid.Row="2" Height="2" VerticalAlignment="Center" Margin="4,0"
Background="{DynamicResource MossBrush}" CornerRadius="1"
IsVisible="{Binding DropHintBelow}"/>
</Grid>
</DataTemplate>
</UserControl.DataTemplates>
<DockPanel LastChildFill="True">
<!-- ── Header ── -->
@@ -133,86 +279,9 @@
<PathIcon Data="{StaticResource Icon.Folder}" Width="14" Height="14"/>
</Button>
</Grid>
<ItemsControl ItemsSource="{Binding UserLists}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:ListNavItemViewModel">
<Grid RowDefinitions="Auto,Auto,Auto">
<!-- Above-row drop indicator -->
<Border Grid.Row="0" Height="2" VerticalAlignment="Center" Margin="4,0"
Background="{DynamicResource MossBrush}" CornerRadius="1"
IsVisible="{Binding DropHintAbove}"/>
<Border Grid.Row="1" Classes="list-item" Classes.active="{Binding IsActive}"
Classes.drop-target="{Binding IsTaskDropTarget}"
Tapped="OnItemTapped"
DragDrop.AllowDrop="True"
DragDrop.DragOver="OnListDragOver"
DragDrop.Drop="OnListDrop">
<Border.ContextMenu>
<ContextMenu>
<MenuItem Header="{loc:Tr lists.contextWorktrees}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenWorktreesOverviewCommand}"
CommandParameter="{Binding}"/>
<Separator IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<MenuItem Header="{loc:Tr lists.contextOpenExplorer}"
IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenInExplorerCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextOpenFindings}"
IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenFindingsCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextOpenTerminal}"
IsVisible="{Binding WorkingDir, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenInTerminalCommand}"
CommandParameter="{Binding}"/>
<MenuItem Header="{loc:Tr lists.contextImportTickets}"
IsVisible="{Binding HasTicketProject}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).ImportTicketsCommand}"
CommandParameter="{Binding}"/>
<Separator/>
<MenuItem Header="{loc:Tr lists.contextSettings}"
Command="{Binding $parent[UserControl].((vm:ListsIslandViewModel)DataContext).OpenListSettingsCommand}"
CommandParameter="{Binding}"/>
</ContextMenu>
</Border.ContextMenu>
<Grid ColumnDefinitions="20,*,Auto">
<!-- Left accent bar for active state -->
<Border Grid.Column="0" Grid.ColumnSpan="3"
Background="Transparent"
CornerRadius="8" IsHitTestVisible="False"
IsVisible="{Binding IsActive}">
<Border Width="2" Height="16"
Background="{DynamicResource AccentBrush}"
CornerRadius="1"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="-8,0,0,0"/>
</Border>
<!-- Icon (list-settings → Icon tab; "Folder" when unset) -->
<PathIcon Grid.Column="0" Classes="list-icon"
Width="14" Height="14"
Data="{Binding IconKey, Converter={StaticResource IconKey}}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<!-- Name -->
<TextBlock Grid.Column="1" Classes="list-label"
Text="{Binding Name}"
VerticalAlignment="Center" Margin="8,0"
Foreground="{DynamicResource TextDimBrush}" FontSize="{StaticResource FontSizeBody}"/>
<!-- Count -->
<TextBlock Grid.Column="2" Classes="list-count"
Text="{Binding Count}"/>
</Grid>
</Border>
<!-- Below-row drop indicator (last item only) -->
<Border Grid.Row="2" Height="2" VerticalAlignment="Center" Margin="4,0"
Background="{DynamicResource MossBrush}" CornerRadius="1"
IsVisible="{Binding DropHintBelow}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Folders and folder-less lists in one sequence, so either can be dragged above the
other; each item picks its template from UserControl.DataTemplates by type. -->
<ItemsControl ItemsSource="{Binding TopLevel}"/>
</StackPanel>
</ScrollViewer>
@@ -17,11 +17,28 @@ public partial class ListsIslandView : UserControl
{
private static readonly DataFormat<string> ListRowFormat =
DataFormat.CreateStringApplicationFormat("claudedo-list-row");
private static readonly DataFormat<string> FolderRowFormat =
DataFormat.CreateStringApplicationFormat("claudedo-folder-row");
// A folder drag only starts once the pointer has moved: DoDragDropAsync captures the pointer,
// and starting it on press would swallow the Tapped that folds the folder. It only takes the
// *pressed* args, so the press is kept around until the threshold is crossed.
private ListFolderNavItemViewModel? _pendingFolderDrag;
private PointerPressedEventArgs? _pendingFolderDragPress;
private Point _folderDragOrigin;
private void CancelPendingFolderDrag()
{
_pendingFolderDrag = null;
_pendingFolderDragPress = null;
}
public ListsIslandView()
{
InitializeComponent();
AddHandler(PointerPressedEvent, OnTunnelPointerPressed, RoutingStrategies.Tunnel);
AddHandler(PointerMovedEvent, OnTunnelPointerMoved, RoutingStrategies.Tunnel);
AddHandler(PointerReleasedEvent, (_, _) => CancelPendingFolderDrag(), RoutingStrategies.Tunnel);
DataContextChanged += (_, _) =>
{
if (DataContext is ListsIslandViewModel vm)
@@ -42,9 +59,19 @@ public partial class ListsIslandView : UserControl
if (e.Source is not Visual src) return;
var border = FindListItemBorder(src);
if (border?.DataContext is not ListNavItemViewModel row || row.Kind != ListKind.User) return;
if (border is null) return;
if (!e.GetCurrentPoint(border).Properties.IsLeftButtonPressed) return;
if (border.DataContext is ListFolderNavItemViewModel folder)
{
_pendingFolderDrag = folder;
_pendingFolderDragPress = e;
_folderDragOrigin = e.GetPosition(this);
return;
}
if (border.DataContext is not ListNavItemViewModel row || row.Kind != ListKind.User) return;
// Double-click opens the list's settings instead of starting a drag. Handled here
// because DoDragDropAsync captures the pointer and would swallow a DoubleTapped event.
if (e.ClickCount == 2)
@@ -69,50 +96,149 @@ public partial class ListsIslandView : UserControl
}
}
private async void OnTunnelPointerMoved(object? sender, PointerEventArgs e)
{
if (_pendingFolderDrag is not { } folder || _pendingFolderDragPress is not { } press) return;
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) { CancelPendingFolderDrag(); return; }
var delta = e.GetPosition(this) - _folderDragOrigin;
if (Math.Abs(delta.X) < 4 && Math.Abs(delta.Y) < 4) return;
CancelPendingFolderDrag();
if (DataContext is not ListsIslandViewModel vm) return;
var data = new DataTransfer();
data.Add(DataTransferItem.Create(FolderRowFormat, folder.Id));
try
{
await DragDrop.DoDragDropAsync(press, data, DragDropEffects.Move);
}
finally
{
vm.ClearDropHints();
}
}
private void OnFolderTapped(object? sender, RoutedEventArgs e)
{
if (sender is Border { DataContext: ListFolderNavItemViewModel folder }
&& DataContext is ListsIslandViewModel vm)
vm.ToggleFolderCommand.Execute(folder);
}
/// <summary>The dragged row or folder, resolved from whichever of the two formats is present.</summary>
private static object? DragSource(ListsIslandViewModel vm, DragEventArgs e)
{
if (e.DataTransfer is not { } data) return null;
if (data.Contains(ListRowFormat))
return data.TryGetValue(ListRowFormat) is { } listId
? vm.UserLists.FirstOrDefault(r => r.Id == listId) : null;
if (data.Contains(FolderRowFormat))
return data.TryGetValue(FolderRowFormat) is { } folderId
? vm.Folders.FirstOrDefault(f => f.Id == folderId) : null;
return null;
}
private enum FolderDrop { None, Into, Beside }
/// <summary>
/// What a drop on a folder header means. For a list the middle half moves it *into* the folder
/// (the only route into a collapsed or empty one) while the outer quarters insert next to the
/// folder at the top level; a folder source has no "into" — folders never nest — so it splits
/// in half.
/// </summary>
private static (FolderDrop Kind, bool PlaceBelow) ClassifyFolderDrop(
object source, ListFolderNavItemViewModel folder, double y, double height)
{
if (source is ListFolderNavItemViewModel dragged)
return ReferenceEquals(dragged, folder)
? (FolderDrop.None, false)
: (FolderDrop.Beside, y > height / 2);
if (source is not ListNavItemViewModel row) return (FolderDrop.None, false);
if (y < height * 0.25) return (FolderDrop.Beside, false);
if (y > height * 0.75) return (FolderDrop.Beside, true);
return row.FolderId == folder.Id ? (FolderDrop.None, false) : (FolderDrop.Into, false);
}
private void OnFolderDragOver(object? sender, DragEventArgs e)
{
if (DataContext is not ListsIslandViewModel vm) { e.DragEffects = DragDropEffects.None; return; }
if (sender is not Border b || b.DataContext is not ListFolderNavItemViewModel folder)
{
Reject(vm, e);
return;
}
var source = DragSource(vm, e);
if (source is null) { Reject(vm, e); return; }
var (kind, placeBelow) = ClassifyFolderDrop(source, folder, e.GetPosition(b).Y, b.Bounds.Height);
switch (kind)
{
case FolderDrop.Into:
vm.SetFolderDropTarget(folder);
e.DragEffects = DragDropEffects.Move;
break;
case FolderDrop.Beside:
vm.SetDropHint(folder, placeBelow);
e.DragEffects = DragDropEffects.Move;
break;
default:
Reject(vm, e);
break;
}
}
private async void OnFolderDrop(object? sender, DragEventArgs e)
{
if (DataContext is not ListsIslandViewModel vm) return;
try
{
if (sender is not Border b || b.DataContext is not ListFolderNavItemViewModel folder) return;
var source = DragSource(vm, e);
if (source is null) return;
var (kind, placeBelow) = ClassifyFolderDrop(source, folder, e.GetPosition(b).Y, b.Bounds.Height);
vm.ClearDropHints();
if (kind == FolderDrop.Into && source is ListNavItemViewModel row)
await vm.MoveToFolderAsync(row, folder);
else if (kind == FolderDrop.Beside)
await vm.DropAsync(source, folder, placeBelow);
}
catch
{
vm.ClearDropHints();
throw;
}
}
private void OnListDragOver(object? sender, DragEventArgs e)
{
if (DataContext is not ListsIslandViewModel vm) { e.DragEffects = DragDropEffects.None; return; }
if (!e.DataTransfer?.Contains(ListRowFormat) ?? true)
{
e.DragEffects = DragDropEffects.None;
vm.ClearDropHints();
return;
}
if (sender is not Border b || b.DataContext is not ListNavItemViewModel target || target.Kind != ListKind.User)
{
e.DragEffects = DragDropEffects.None;
vm.ClearDropHints();
Reject(vm, e);
return;
}
var sourceId = e.DataTransfer?.TryGetValue(ListRowFormat);
if (string.IsNullOrEmpty(sourceId) || sourceId == target.Id)
{
e.DragEffects = DragDropEffects.None;
vm.ClearDropHints();
return;
}
var placeBelow = e.GetPosition(b).Y > b.Bounds.Height / 2;
var source = DragSource(vm, e);
if (source is null || ReferenceEquals(source, target)) { Reject(vm, e); return; }
// A folder can only be dropped at the top level, so a row inside a folder is no target.
if (source is ListFolderNavItemViewModel && target.FolderId is not null) { Reject(vm, e); return; }
// Canonicalize: "drop below X" == "drop above X+1". Only the last row shows a below-line.
ListNavItemViewModel hintRow = target;
bool hintBelow = false;
if (placeBelow)
object hintTarget = target;
var hintBelow = false;
if (e.GetPosition(b).Y > b.Bounds.Height / 2)
{
var next = FindNextUserList(vm, target);
if (next is not null) { hintRow = next; hintBelow = false; }
else { hintRow = target; hintBelow = true; }
if (FindNextInContainer(vm, target) is { } next) hintTarget = next;
else hintBelow = true;
}
if (hintRow.Id == sourceId)
{
e.DragEffects = DragDropEffects.None;
vm.ClearDropHints();
return;
}
if (ReferenceEquals(hintTarget, source)) { Reject(vm, e); return; }
vm.SetDropHint(hintRow, hintBelow);
vm.SetDropHint(hintTarget, hintBelow);
e.DragEffects = DragDropEffects.Move;
}
@@ -123,15 +249,13 @@ public partial class ListsIslandView : UserControl
{
if (sender is not Border b || b.DataContext is not ListNavItemViewModel target || target.Kind != ListKind.User) return;
var sourceId = e.DataTransfer?.TryGetValue(ListRowFormat);
if (string.IsNullOrEmpty(sourceId) || sourceId == target.Id) return;
var source = vm.UserLists.FirstOrDefault(r => r.Id == sourceId);
if (source is null) return;
var source = DragSource(vm, e);
if (source is null || ReferenceEquals(source, target)) return;
if (source is ListFolderNavItemViewModel && target.FolderId is not null) return;
var placeBelow = e.GetPosition(b).Y > b.Bounds.Height / 2;
vm.ClearDropHints();
await vm.ReorderAsync(source, target, placeBelow);
await vm.DropAsync(source, target, placeBelow);
}
catch
{
@@ -140,6 +264,12 @@ public partial class ListsIslandView : UserControl
}
}
private static void Reject(ListsIslandViewModel vm, DragEventArgs e)
{
e.DragEffects = DragDropEffects.None;
vm.ClearDropHints();
}
private static Border? FindListItemBorder(Visual? v)
{
while (v is not null)
@@ -150,11 +280,15 @@ public partial class ListsIslandView : UserControl
return null;
}
private static ListNavItemViewModel? FindNextUserList(ListsIslandViewModel vm, ListNavItemViewModel row)
// Next item *within the same container* — the row below the last list of a folder belongs to
// another container, so it is not a "drop above" candidate here. At the top level the next
// item can be a folder, which is a valid hint target.
private static object? FindNextInContainer(ListsIslandViewModel vm, ListNavItemViewModel row)
{
var idx = vm.UserLists.IndexOf(row);
var container = vm.ContainerOf(row);
var idx = container.IndexOf(row);
if (idx < 0) return null;
return idx + 1 < vm.UserLists.Count ? vm.UserLists[idx + 1] : null;
return idx + 1 < container.Count ? container[idx + 1] : null;
}
}
@@ -142,7 +142,8 @@
Classes.children="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=WaitingForChildren}"
Classes.done="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=Done}"
Classes.error="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=Failed}"
Classes.queued="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=Queued}">
Classes.queued="{Binding IsQueued}"
Classes.waiting="{Binding IsWaiting}">
<TextBlock Text="{Binding StatusLabel}"/>
</Border>
@@ -55,7 +55,6 @@ public partial class TasksIslandView : UserControl
await modal.ShowDialog(owner);
// ShowDialog completes once the window is closed (CloseAction or OS close).
};
vm.ConfirmAsync = ShowConfirmAsync;
vm.SelectionChanged += (_, _) => ScrollSelectedIntoView();
}
};
@@ -71,50 +70,6 @@ public partial class TasksIslandView : UserControl
Dispatcher.UIThread.Post(() => RowsListBox.ScrollIntoView(target), DispatcherPriority.Background);
}
private async System.Threading.Tasks.Task<bool> ShowConfirmAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return false;
var tcs = new TaskCompletionSource<bool>();
var cancel = new Button { Content = "Cancel", MinWidth = 90 };
var confirm = new Button { Content = "Confirm", MinWidth = 90, Classes = { "danger" } };
var dialog = new Window
{
Title = "Confirm",
Width = 380,
SizeToContent = SizeToContent.Height,
CanResize = false,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
ShowInTaskbar = false,
Background = this.FindResource("SurfaceBrush") as IBrush,
Content = new StackPanel
{
Margin = new Thickness(20),
Spacing = 16,
Children =
{
new TextBlock { Text = message, TextWrapping = TextWrapping.Wrap },
new StackPanel
{
Orientation = Orientation.Horizontal,
HorizontalAlignment = HorizontalAlignment.Right,
Spacing = 8,
Children = { cancel, confirm },
},
},
},
};
cancel.Click += (_, _) => { tcs.TrySetResult(false); dialog.Close(); };
confirm.Click += (_, _) => { tcs.TrySetResult(true); dialog.Close(); };
dialog.Closed += (_, _) => tcs.TrySetResult(false);
_ = dialog.ShowDialog(owner);
return await tcs.Task;
}
// ── Custom ghost drag ────────────────────────────────────────────────────
// Replaces both the OLE DoDragDropAsync reorder and the OLE drop-to-queue path: a hand-built
// drag (pointer capture + a transparent topmost ghost window) is the only way to get a
+5
View File
@@ -66,6 +66,11 @@
Command="{Binding RestartWorkerCommand}"/>
<MenuItem Header="{loc:Tr shell.menu.usageMonitor}"
Command="{Binding OpenUsageMonitorCommand}"/>
<MenuItem Header="{loc:Tr shell.menu.updateClaudeCli}"
Command="{Binding UpdateClaudeCliCommand}"/>
<Separator/>
<MenuItem Header="{loc:Tr shell.menu.shutdown}"
Command="{Binding ShutdownCommand}"/>
</MenuItem>
<MenuItem Header="{loc:Tr shell.menu.repositories}"
FontSize="{StaticResource FontSizeMono}"
@@ -55,6 +55,27 @@
</Grid>
</Border>
<!-- Session-ended banner: process died without a start-failure already covering it -->
<Border DockPanel.Dock="Top"
IsVisible="{Binding Terminal.HasExitedAfterStartup}"
Background="{DynamicResource ErrorTintBrush}"
BorderBrush="{DynamicResource BloodBrush}"
BorderThickness="0,0,0,1" Padding="12,6">
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBlock Grid.Column="0" Classes="meta" Text="{Binding ExitedBannerText}"
Foreground="{DynamicResource BloodBrush}"
TextWrapping="Wrap" VerticalAlignment="Center" />
<Button Grid.Column="1" Classes="btn" Margin="12,0,0,0"
Content="{loc:Tr missionControl.retry}"
ToolTip.Tip="{loc:Tr missionControl.retryTip}"
Command="{Binding RetryCommand}" />
<Button Grid.Column="2" Classes="btn" Margin="12,0,0,0"
Content="{loc:Tr missionControl.closeSession}"
ToolTip.Tip="{loc:Tr missionControl.closeSession}"
Command="{Binding CloseCommand}" />
</Grid>
</Border>
<!-- Embedded ConPTY terminal, with a starting overlay until the session is spawned -->
<Panel>
<views:InteractiveTerminalView DataContext="{Binding Terminal}" />
@@ -8,6 +8,7 @@ using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Platform.Storage;
using Avalonia.VisualTree;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.ViewModels;
namespace ClaudeDo.Ui.Views.MissionControl;
@@ -73,20 +74,21 @@ public partial class MissionControlView : UserControl
UpdateQueueColumn();
}
// Abandon-run confirmation -- same TaskCompletionSource-backed plain Window as
// TasksIslandView.ShowConfirmAsync (no shared control for this shape yet).
// Abandon-run confirmation -- own plain-Window TaskCompletionSource dialog, not routed
// through WindowDialogService: it's owned by the main window, so showing it while Mission
// Control (a separate Window) is focused would put it behind Mission Control.
private async Task<bool> ShowConfirmAsync(string message)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return false;
var tcs = new TaskCompletionSource<bool>();
var cancel = new Button { Content = "Cancel", MinWidth = 90 };
var confirm = new Button { Content = "Confirm", MinWidth = 90, Classes = { "danger" } };
var cancel = new Button { Content = Loc.T("dialog.cancel"), MinWidth = 90 };
var confirm = new Button { Content = Loc.T("dialog.confirm"), MinWidth = 90, Classes = { "danger" } };
var dialog = new Window
{
Title = "Confirm",
Title = Loc.T("dialog.confirmTitle"),
Width = 380,
SizeToContent = SizeToContent.Height,
CanResize = false,
@@ -20,10 +20,10 @@
<KeyBinding Gesture="Enter" Command="{Binding SaveCommand}"/>
</Window.KeyBindings>
<ctl:ModalShell Title="{loc:Tr modals.listSettings.title}" CloseCommand="{Binding CancelCommand}">
<ctl:ModalShell Title="{Binding HeaderTitle}" CloseCommand="{Binding CancelCommand}">
<ctl:ModalShell.Footer>
<Grid ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Center">
<Button Grid.Column="0" Content="{loc:Tr modals.listSettings.deleteList}" Classes="danger"
<Button Grid.Column="0" Content="{Binding DeleteLabel}" Classes="danger"
Command="{Binding DeleteCommand}" MinWidth="90"/>
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8">
<Button Classes="btn" Content="{loc:Tr settings.cancel}" Command="{Binding CancelCommand}" MinWidth="90"/>
@@ -40,8 +40,12 @@
VerticalAlignment="Top">
<ListBoxItem Content="{loc:Tr modals.listSettings.sectionGeneral}"/>
<ListBoxItem Content="{loc:Tr modals.listSettings.sectionIcon}"/>
<ListBoxItem Content="{loc:Tr modals.listSettings.sectionAgent}"/>
<ListBoxItem Content="{loc:Tr modals.listSettings.sectionVerify}"/>
<!-- A folder runs nothing, so it has neither agent config nor a verify command. The
TabItems stay in place (index-driven host) and just become unreachable. -->
<ListBoxItem Content="{loc:Tr modals.listSettings.sectionAgent}"
IsVisible="{Binding !IsFolder}"/>
<ListBoxItem Content="{loc:Tr modals.listSettings.sectionVerify}"
IsVisible="{Binding !IsFolder}"/>
</ListBox>
<Border Grid.Column="1" Background="{DynamicResource LineBrush}" Width="1" Margin="0,8"/>
@@ -69,48 +73,61 @@
<TabItem Header="{loc:Tr modals.listSettings.sectionGeneral}">
<ScrollViewer>
<StackPanel Spacing="12" Margin="0,8,0,0">
<!-- Create flow only: turns this into a sidebar folder (name + icon, nothing else).
Deliberately not a second sidebar button — the "+" and the repo-import button
already sit there. -->
<StackPanel Spacing="4" IsVisible="{Binding CanToggleFolder}">
<CheckBox IsChecked="{Binding IsFolder, Mode=TwoWay}"
Content="{loc:Tr modals.listSettings.createAsFolder}"/>
<TextBlock Text="{loc:Tr modals.listSettings.createAsFolderHint}"
Opacity="0.6" FontSize="12" TextWrapping="Wrap"/>
</StackPanel>
<StackPanel Spacing="4">
<TextBlock Classes="field-label" Text="{loc:Tr modals.listSettings.name}"/>
<TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Spacing="4">
<StackPanel Spacing="4" IsVisible="{Binding !IsFolder}">
<TextBlock Classes="field-label" Text="{loc:Tr modals.listSettings.workingDirectory}"/>
<Grid ColumnDefinitions="*,Auto">
<TextBox Grid.Column="0" Text="{Binding WorkingDir}" PlaceholderText="{loc:Tr modals.listSettings.workingDirectoryPlaceholder}" />
<Button Classes="btn" Grid.Column="1" Content="{loc:Tr modals.listSettings.browse}" Margin="8,0,0,0" Click="BrowseClicked" />
</Grid>
<TextBlock Text="{Binding WorkingDirWarning}"
IsVisible="{Binding WorkingDirWarning, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Foreground="{DynamicResource StatusErrorBrush}" FontSize="12" TextWrapping="Wrap"/>
</StackPanel>
<StackPanel Spacing="4">
<StackPanel Spacing="4" IsVisible="{Binding !IsFolder}">
<TextBlock Classes="field-label" Text="{loc:Tr modals.listSettings.defaultCommitType}"/>
<ComboBox ItemsSource="{Binding CommitTypeOptions}"
SelectedItem="{Binding DefaultCommitType, Mode=TwoWay}"
HorizontalAlignment="Left" MinWidth="160" />
</StackPanel>
<StackPanel Spacing="4">
<StackPanel Spacing="4" IsVisible="{Binding !IsFolder}">
<CheckBox IsChecked="{Binding IsManual, Mode=TwoWay}"
Content="{loc:Tr modals.listSettings.manualList}"/>
<TextBlock Text="{loc:Tr modals.listSettings.manualListHint}"
Opacity="0.6" FontSize="12" TextWrapping="Wrap"/>
</StackPanel>
<StackPanel Spacing="4">
<StackPanel Spacing="4" IsVisible="{Binding !IsFolder}">
<CheckBox IsChecked="{Binding FindingsTracked, Mode=TwoWay}"
Content="{loc:Tr modals.listSettings.findingsTracked}"/>
<TextBlock Text="{loc:Tr modals.listSettings.findingsTrackedHint}"
Opacity="0.6" FontSize="12" TextWrapping="Wrap"/>
</StackPanel>
<StackPanel Spacing="4">
<StackPanel Spacing="4" IsVisible="{Binding !IsFolder}">
<CheckBox IsChecked="{Binding PowerUseAllowed, Mode=TwoWay}"
Content="{loc:Tr modals.listSettings.powerUseAllowed}"/>
<TextBlock Text="{loc:Tr modals.listSettings.powerUseAllowedHint}"
Opacity="0.6" FontSize="12" TextWrapping="Wrap"/>
</StackPanel>
<StackPanel Spacing="4" IsVisible="{Binding TicketsAvailable}">
<StackPanel Spacing="4" IsVisible="{Binding ShowTicketProject}">
<TextBlock Classes="field-label" Text="{loc:Tr modals.listSettings.ticketProject}"/>
<ComboBox ItemsSource="{Binding TicketProjects}"
SelectedItem="{Binding SelectedTicketProject, Mode=TwoWay}"
@@ -29,11 +29,18 @@
<!-- Body: scope + select-all/none toolbar, headers, checkbox rows -->
<DockPanel>
<Grid DockPanel.Dock="Top" ColumnDefinitions="*,Auto,Auto" Margin="20,12,20,6">
<Grid DockPanel.Dock="Top" ColumnDefinitions="*,Auto,Auto,Auto" Margin="20,12,20,6">
<TextBlock Grid.Column="0" Classes="meta" Text="{Binding ScopeLabel}" VerticalAlignment="Center"/>
<Button Grid.Column="1" Classes="btn" Content="{loc:Tr modals.mergeHelper.selectAll}"
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6" Margin="0,0,12,0"
IsVisible="{Binding ShowModelPicker}"
ToolTip.Tip="{loc:Tr modals.mergeHelper.modelTip}">
<TextBlock Classes="meta" Text="{loc:Tr modals.mergeHelper.modelLabel}" VerticalAlignment="Center"/>
<ComboBox MinWidth="90" ItemsSource="{Binding ModelOptions}"
SelectedItem="{Binding SelectedModel, Mode=TwoWay}"/>
</StackPanel>
<Button Grid.Column="2" Classes="btn" Content="{loc:Tr modals.mergeHelper.selectAll}"
Command="{Binding SelectAllCommand}" IsEnabled="{Binding HasTasks}"/>
<Button Grid.Column="2" Classes="btn" Content="{loc:Tr modals.mergeHelper.selectNone}"
<Button Grid.Column="3" Classes="btn" Content="{loc:Tr modals.mergeHelper.selectNone}"
Command="{Binding SelectNoneCommand}" IsEnabled="{Binding HasTasks}" Margin="8,0,0,0"/>
</Grid>
@@ -70,6 +70,16 @@
TextWrapping="Wrap"
IsVisible="{Binding ErrorMessage, Converter={x:Static ObjectConverters.IsNotNull}}" />
<TextBlock Text="{Binding WarningMessage}"
Foreground="{DynamicResource AmberBrush}"
TextWrapping="Wrap"
IsVisible="{Binding WarningMessage, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Button Classes="btn" HorizontalAlignment="Left"
Content="{loc:Tr modals.merge.stashAndMerge}"
Command="{Binding StashAndMergeCommand}"
IsVisible="{Binding ShowStashRetry}" />
<Border Classes="danger-box"
IsVisible="{Binding HasConflict}">
<StackPanel Spacing="4">
@@ -190,7 +190,8 @@
Opacity="0.6" FontSize="12" TextWrapping="Wrap"/>
<Grid ColumnDefinitions="90,12,*,12,110" Margin="0,4,0,0">
<TextBlock Grid.Column="0" Classes="eyebrow" Text="{loc:Tr settings.general.model}"/>
<TextBlock Grid.Column="2" Classes="eyebrow" Text="{loc:Tr settings.general.effort}"/>
<TextBlock Grid.Column="2" Classes="eyebrow" Text="{loc:Tr settings.general.effort}"
ToolTip.Tip="{loc:Tr settings.general.effortHint}"/>
<TextBlock Grid.Column="4" Classes="eyebrow" Text="{loc:Tr settings.general.maxTurns}"/>
</Grid>
<ItemsControl ItemsSource="{Binding General.ModelPresets}">
@@ -307,7 +308,8 @@
</ScrollViewer>
</TabItem>
<TabItem Header="{loc:Tr settings.sidebar.categoryPrime}">
<TabItem Header="{loc:Tr settings.sidebar.categoryPrime}"
ToolTip.Tip="{loc:Tr settings.sidebar.categoryPrimeHint}">
<ScrollViewer>
<StackPanel Spacing="12" Margin="0,8,0,0">
<Border IsVisible="{Binding !HasLinkedRepo}"
@@ -16,10 +16,14 @@
</Window.KeyBindings>
<ctl:ModalShell Title="{loc:Tr modals.workerConnection.title}" CloseCommand="{Binding CloseCommand}">
<Grid RowDefinitions="*,Auto" Margin="20,16">
<Grid RowDefinitions="*,Auto,Auto" Margin="20,16">
<TextBlock Grid.Row="0" Classes="meta" TextWrapping="Wrap"
Text="{loc:Tr modals.workerConnection.body}"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="8"
<TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="0,8,0,0"
Foreground="{DynamicResource StatusErrorBrush}"
IsVisible="{Binding ErrorText, Converter={x:Static ObjectConverters.IsNotNull}}"
Text="{Binding ErrorText}"/>
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="8"
HorizontalAlignment="Right" Margin="0,16,0,0">
<Button Classes="btn" Content="{loc:Tr modals.workerConnection.dismiss}" Command="{Binding CloseCommand}"/>
<Button Classes="btn" Content="{loc:Tr modals.workerConnection.rerunInstaller}" Command="{Binding RerunInstallerCommand}"/>
@@ -58,13 +58,18 @@
CommandParameter="{Binding}"/>
</ContextMenu>
</Border.ContextMenu>
<Grid ColumnDefinitions="Auto,*,90,90,80,80">
<Grid ColumnDefinitions="Auto,*,90,90,110,80">
<CheckBox Grid.Column="0" VerticalAlignment="Center" Margin="0,0,8,0"
IsChecked="{Binding IsChecked, Mode=TwoWay}"
IsEnabled="{Binding IsActive}"
IsVisible="{Binding IsActive}"/>
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="2">
<TextBlock Classes="title" Text="{Binding TaskTitle}"/>
<Grid ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0" Classes="meta" Text="{Binding TaskNumber, StringFormat='#{0}'}"
IsVisible="{Binding ShowNumberBadge}"
VerticalAlignment="Center" Margin="0,0,6,0"/>
<TextBlock Grid.Column="1" Classes="title" Text="{Binding TaskTitle}"/>
</Grid>
<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Classes="meta" Text="{Binding TaskStatus}"/>
<TextBlock Classes="meta" Text="•"
@@ -85,7 +90,8 @@
HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="{Binding State}"/>
</Border>
<TextBlock Grid.Column="4" Classes="meta" Text="{Binding DiffStat}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="4" Classes="meta" Text="{Binding DiffStat}" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" ToolTip.Tip="{Binding DiffStat}"/>
<TextBlock Grid.Column="5" Classes="meta" Text="{Binding AgeText}" VerticalAlignment="Center"/>
</Grid>
</Border>
@@ -146,8 +152,11 @@
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:WorktreeOverviewRowViewModel">
<Grid ColumnDefinitions="*,Auto" Margin="0,2">
<TextBlock Grid.Column="0" Classes="meta" VerticalAlignment="Center"
Text="{Binding TaskTitle}"/>
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="4" VerticalAlignment="Center">
<TextBlock Classes="meta" Text="{Binding TaskNumber, StringFormat='#{0}'}"
IsVisible="{Binding ShowNumberBadge}"/>
<TextBlock Classes="meta" Text="{Binding TaskTitle}"/>
</StackPanel>
<Button Grid.Column="1" Classes="btn"
Content="{loc:Tr modals.worktreesOverview.resolve}"
Command="{Binding $parent[Window].((vm:WorktreesOverviewModalViewModel)DataContext).ResolveConflictCommand}"
@@ -159,7 +168,7 @@
</StackPanel>
</Border>
<!-- Column headers -->
<Grid ColumnDefinitions="Auto,*,90,90,80,80" Margin="12,0,12,4">
<Grid ColumnDefinitions="Auto,*,90,90,110,80" Margin="12,0,12,4">
<TextBlock Grid.Column="1" Classes="eyebrow" Text="{loc:Tr modals.worktreesOverview.columnTask}"/>
<TextBlock Grid.Column="2" Classes="eyebrow" Text="{loc:Tr modals.worktreesOverview.columnOutcome}"/>
<TextBlock Grid.Column="3" Classes="eyebrow" Text="{loc:Tr modals.worktreesOverview.columnState}"/>
+10 -9
View File
@@ -6,6 +6,7 @@ using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Layout;
using Avalonia.Media;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels;
using ClaudeDo.Ui.ViewModels.Conflicts;
@@ -71,7 +72,7 @@ public sealed class WindowDialogService : IDialogService
public async Task ShowSettingsAsync(SettingsModalViewModel vm)
{
vm.Worktrees.ConfirmAsync = ConfirmAsync;
vm.Worktrees.ConfirmAsync = message => ConfirmAsync(message);
var dlg = new SettingsModalView { DataContext = vm };
vm.RequestRepoImport = () =>
{
@@ -90,7 +91,7 @@ public sealed class WindowDialogService : IDialogService
{
var dlg = new ListSettingsModalView { DataContext = vm };
vm.CloseAction = () => dlg.Close();
vm.ConfirmAsync = ConfirmAsync;
vm.ConfirmAsync = message => ConfirmAsync(message);
vm.ShowErrorAsync = ShowErrorAsync;
await dlg.ShowDialog(_owner);
}
@@ -144,7 +145,7 @@ public sealed class WindowDialogService : IDialogService
_diffViewerWindow = diffDlg;
diffDlg.Show(_owner);
};
vm.ConfirmAction = ConfirmAsync;
vm.ConfirmAction = message => ConfirmAsync(message);
if (Shell is { } shell)
{
vm.ResolveMergeVm = shell.ResolveMergeVm;
@@ -206,13 +207,13 @@ public sealed class WindowDialogService : IDialogService
_cheatSheets.Activate();
}
public Task<bool> ConfirmAsync(string message)
public Task<bool> ConfirmAsync(string message, string? confirmLabel = null)
{
var tcs = new TaskCompletionSource<bool>();
var cancel = new Button { Content = "Cancel", MinWidth = 90 };
var confirm = new Button { Content = "Confirm", MinWidth = 90, Classes = { "danger" } };
var cancel = new Button { Content = Loc.T("dialog.cancel"), MinWidth = 90 };
var confirm = new Button { Content = confirmLabel ?? Loc.T("dialog.confirm"), MinWidth = 90, Classes = { "danger" } };
var dialog = NoticeWindow("Confirm", 380, message,
var dialog = NoticeWindow(Loc.T("dialog.confirmTitle"), 380, message,
new StackPanel
{
Orientation = Orientation.Horizontal,
@@ -231,8 +232,8 @@ public sealed class WindowDialogService : IDialogService
public Task ShowErrorAsync(string message)
{
var ok = new Button { Content = "OK", MinWidth = 90 };
var dialog = NoticeWindow("Error", 360, message,
var ok = new Button { Content = Loc.T("dialog.ok"), MinWidth = 90 };
var dialog = NoticeWindow(Loc.T("dialog.errorTitle"), 360, message,
new StackPanel
{
Orientation = Orientation.Horizontal,
+10 -8
View File
@@ -30,7 +30,7 @@ Worker/
Findings/ — FindingsStore + FindingsStoreLocator: the per-project `.claudedo/` trap store
Git/ — GitExcludeWriter (`.git/info/exclude`) + GitHead, shared by skill seeding and findings
Config/ — WorkerConfig
Hub/ — WorkerHub, HubBroadcaster
Hub/ — WorkerHub, HubBroadcaster, ConnectedClientTracker (connected-UI-client count)
Logging/ — LogRingBuffer (30-min window) + BroadcastLogSink (Serilog → footer + overlay)
Report/ — ClaudeHistoryReader, WeekReportPromptBuilder, WeekReportService
Prime/ — "Prime Claude" schedules: PrimeScheduler, PrimeRunner, PrimePrompts,
@@ -50,8 +50,8 @@ subfolder within their area; the namespace stays the area namespace.
## Architecture
- **Program.cs** — loads config, inits schema, registers DI, configures SignalR on `/hub`, binds to `127.0.0.1:47821`
- **TaskStateService** — the **only** component that writes `Status`, `PlanningPhase`, `BlockedByTaskId`, and the `task_dependencies` edges. All transitions return a `TransitionResult` (no exceptions on invalid moves). Wakes the queue and advances the planning chain on child terminal transitions. Every transition broadcasts via a private `NotifyAsync(taskId)` — never call `_broadcaster.TaskUpdated` directly from this class, `NotifyAsync` also drives `TicketStatusSync.SyncAsync` (see Tickets below) and a direct call skips that transition's ticket write-back. `SetDependsOnAsync` replaces the task's whole dependency **set** (empty list clears it) and rejects a self-reference, an unknown dependency id, or any link that would create a cycle — a BFS over the whole `task_dependencies` edge set from every proposed predecessor, so a multi-edge loop (A→B→C→A) is caught too, and one bad edge leaves the entire set unwritten.
- **IQueueWaker / IQueuePicker / QueueService** — waker is a singleton `SemaphoreSlim`; picker performs the atomic `Queued → Running` claim filtered by `BlockedByTaskId IS NULL`, `is_manual = 0`, schedule, and "no `task_dependencies` edge whose predecessor isn't `done`" (doubly negated on purpose: zero edges stays eligible, all edges must be done, and an edge pointing at a vanished task keeps blocking); QueueService is a thin `BackgroundService` looping on the waker, dispatching via `TaskRunner`. Per tick it also applies the usage throttle and gate → [usage-monitoring](../../docs/explore-notes/usage-monitoring.md).
- **TaskStateService** — the **only** component that writes `Status`, `PlanningPhase`, `BlockedByTaskId`, and the `task_dependencies` edges. All transitions return a `TransitionResult` (no exceptions on invalid moves). Wakes the queue and advances the planning chain on child terminal transitions. `SubmitForChildrenAsync` (Running → WaitingForChildren) also chains and immediately queues a normal parent's own Idle/Queued children via `PlanningChainCoordinator.SetupChainAsync(enqueue: true)` — unlike a planning parent (`PlanningPhase != None`), whose children stay untouched here and wait for the user's explicit "Queue plan" (`QueuePlanAsync`); a child already `Running` makes `SetupChainAsync` throw, which is caught and logged rather than failing the parent's own transition. Every transition broadcasts via a private `NotifyAsync(taskId)` — never call `_broadcaster.TaskUpdated` directly from this class, `NotifyAsync` also drives `TicketStatusSync.SyncAsync` (see Tickets below) and a direct call skips that transition's ticket write-back. `SetDependsOnAsync` replaces the task's whole dependency **set** (empty list clears it) and rejects a self-reference, an unknown dependency id, or any link that would create a cycle — a BFS over the whole `task_dependencies` edge set from every proposed predecessor, so a multi-edge loop (A→B→C→A) is caught too, and one bad edge leaves the entire set unwritten.
- **IQueueWaker / IQueuePicker / QueueService** — waker is a singleton `SemaphoreSlim`; picker performs the atomic `Queued → Running` claim filtered by `BlockedByTaskId IS NULL`, `is_manual = 0`, schedule, and "no `task_dependencies` edge whose predecessor isn't satisfied" — satisfied = `status = 'done'` **or** a landed merge (`worktrees.state = 'merged'`), so a predecessor merged with `skipVerify` and parked in `WaitingForReview` until the batch `verify_merges` no longer stalls its successors (doubly negated on purpose: zero edges stays eligible, all edges must be satisfied, and an edge pointing at a vanished task keeps blocking); QueueService is a thin `BackgroundService` looping on the waker, dispatching via `TaskRunner`. Per tick it also applies the usage throttle and gate → [usage-monitoring](../../docs/explore-notes/usage-monitoring.md).
- **RunCancellationRegistry** — taskId → running-run CTS. Lets `TaskStateService.CancelAsync` kill a cancelled task's process without a DI cycle.
- **OverrideSlotService** — owns `RunNow` / `ContinueTask`; goes through `TaskStateService.StartRunningAsync` (caller-driven, serialized by slot lock).
- **StaleTaskRecovery** — startup-only; calls `TaskStateService.RecoverStaleRunningAsync` to flip orphaned `Running` rows to `Failed`.
@@ -67,7 +67,7 @@ not conflated.
| `Status` | `Idle`, `Queued`, `Running`, `WaitingForChildren`, `WaitingForReview`, `Done`, `Failed`, `Cancelled` | Lifecycle only. `WaitingForChildren` = parent's own work done, waiting on children. |
| `PlanningPhase` | `None`, `Active`, `Finalized` | Parent-only marker. `Active` ≈ legacy `Planning`; `Finalized` ≈ legacy `Planned`. |
| `BlockedByTaskId` | nullable FK | Replaces legacy `Waiting`. A queued row with a non-null value is skipped by the picker. Internal to `PlanningChainCoordinator` — resolves (or cascades) on ANY terminal state of the predecessor. Because it self-resolves, `wait_for_task_change` deliberately keeps **waiting** through it instead of reporting `"Blocked"`. |
| `Dependencies` | 0..n rows in `task_dependencies` | User/MCP-declared predecessors (`add_task`/`update_task`), separate from `BlockedByTaskId` because the semantics differ: the picker skips a queued row until **every** dependency reached `Done` -- a Failed/Cancelled dependency does **not** cascade or auto-resolve, the dependent just stays blocked (see `QueuePicker`, `TaskStateService.SetDependsOnAsync`). `get_task`/`list_tasks`/`batch_get_tasks` surface this as `dependsOnTaskIds` + `blocked`/`blockedReason` (the reason names **all** open predecessors, via `External/TaskBlocking`); `wait_for_task_change` reports `"Blocked"` instead of silently running out its timeout. |
| `Dependencies` | 0..n rows in `task_dependencies` | User/MCP-declared predecessors (`add_task`/`update_task`), separate from `BlockedByTaskId` because the semantics differ: the picker skips a queued row until **every** dependency's merge has landed — `Done`, or `worktrees.state = 'merged'` while the batch `verify_merges` is still pending. A Failed/Cancelled dependency does **not** cascade or auto-resolve, the dependent just stays blocked; `revert_merge`/`abort_merge` put the worktree back to `Active` and re-block the successors; a failing `verify_merges` does **not** (the code is on the target branch either way). See `QueuePicker`, `TaskStateService.SetDependsOnAsync`. `get_task`/`list_tasks`/`batch_get_tasks` surface this as `dependsOnTaskIds` + `blocked`/`blockedReason` (the reason names **all** open predecessors, via `External/TaskBlocking`); `wait_for_task_change` reports `"Blocked"` instead of silently running out its timeout. |
| `IsManual` | bool | Reminder only the user can do. `EnqueueAsync`/`StartRunningAsync` refuse it, the picker skips it, `GetDailyPrepCandidates` never offers it. An interactive ConPTY session is still allowed. |
| `ReviewFeedback` | nullable string | Reviewer's rejection comment; consumed and cleared by `QueueService` on the next re-run. |
@@ -130,7 +130,7 @@ Full flow, invariants, and model/effort/max-turns resolution (including the low-
- **ClaudeProcess** — spawns `claude -p --output-format stream-json --verbose --permission-mode auto` (or whatever app settings specify). Prompt via stdin, NDJSON from stdout. CancellationToken kills the process tree. Resolves `_cfg.ClaudeBin` via `ExecutableResolver` (`ClaudeDo.Data`, shared with `ClaudeCliPreflight` and the Installer's checks) before spawning — a `.cmd`/`.bat` shim (e.g. an npm-installed `claude`) is launched through `cmd.exe /c` since `UseShellExecute = false` can't exec a shim directly; a resolved `.exe` starts exactly as before. Throws if nothing resolves. *(Not yet on `main` — see `Environment Checks` in `ClaudeDo.Installer/CLAUDE.md`.)*
- **ClaudeArgsBuilder** — `--model`, `--effort`, `--max-turns`, `--append-system-prompt`, `--agents`, `--json-schema`, `--resume`
- **StreamAnalyzer** — parses NDJSON; extracts session_id, token counts, turn counts, result text, structured output. Replaced MessageParser.
- **WorktreeManager** — worktrees on `claudedo/{taskId[:8]}` branches; commits with semantic messages, updates DB with head commit + diff stats
- **WorktreeManager** — worktrees on `claudedo/{id}` branches (full task GUID, dashes stripped — a prefix isn't enough to rule out collisions); commits with semantic messages, updates DB with head commit + diff stats
- **CommitMessageBuilder** — `{commitType}(slug): title\n\ndescription\n\nClaudeDo-Task: taskId`; `BuildMerge` is the merge-commit variant (`{commitType}(slug): merge title` + trailer). **Every merge caller passes a blank commit message on purpose** — `TaskMergeService` fills in `BuildMerge` from the task's commit type and its list's name, which is the only place that knows both. Don't reintroduce a caller-side literal.
- **TaskResetService** — discards a failed task's worktree, resets the row to Idle, preserves run history
- **AgentFileService** — manages `~/.claudeDo/agents/*.md`; list/refresh via SignalR
@@ -202,8 +202,7 @@ launch specs · worktrees · agents/settings/lists · reports/notes/prep · diag
- `PrepLine`
- `PrepFinished`
- `OperationProgress` (generic `(opKey, phase, current, total)` channel; merge phases are its
first producer — `IWorkerClient.MergeProgressEvent` on the Ui side is a thin forwarder over it
for existing consumers, elapsed seconds riding in the `current` slot)
first producer)
- `PlanningMergeStarted`
- `PlanningSubtaskMerged`
- `PlanningMergeConflict`
@@ -255,7 +254,10 @@ non-obvious, behaviour-changing. A fixed bug is git history, not a finding.
Both edit the DI-singleton `WorkerConfig` in place *and* persist via their own `SaveKey` call
(`SaveClaudeBin`/`SaveTicketApiBaseUrl`), so each applies without a restart. Every other field
here is hand-edit only.
- `usage_poll_interval_seconds` (60, clamped to min 15 on load)
- `usage_poll_interval_active_seconds` / `usage_poll_interval_idle_seconds` (120 each, clamped to
min 90 on load) — measured 2026-09-16: the endpoint allows exactly 5 requests per 5-minute
window, then 429s with `Retry-After: 300`; 120s leaves margin for manual refreshes and other
consumers of the same OAuth token, 60s eats the whole quota (see [usage-monitoring](../../docs/explore-notes/usage-monitoring.md)).
- `online_inbox` — `enabled` (false by default; when false the entire `Online/` stack is not registered), `api_base_url` (must be HTTPS or loopback, validated at startup), `poll_interval_seconds` (60), `zitadel.authority`/`client_id`/`scopes`. The refresh token is **not** in this file — DPAPI-encrypted at `~/.claudeDo/online-inbox.token`.
Per-list config (`list_config` in DB) provides defaults for `model`, `system_prompt`,
+15 -6
View File
@@ -46,16 +46,25 @@ public sealed class WorkerConfig
/// <summary>
/// Usage-monitor poll interval while at least one task is Running. Clamped to a minimum
/// of 60s on load — the endpoint rate-limits (429) on tighter polling.
/// of 90s on load. Measured 2026-09-16 against the live endpoint: a clean burst allows
/// exactly 5 requests before a 429, with <c>Retry-After: 300</c> (a flat 5-req/5-min quota,
/// no <c>ratelimit-*</c> headers). 120s leaves ~2.5 requests of headroom per 5-minute window
/// for manual refreshes and any other consumer of the same OAuth token — 60s consumes the
/// whole quota by itself with zero margin, which is what made the old flat-60s cadence 429
/// (see commit 2700c3d8). Same default as <see cref="UsagePollIntervalIdleSeconds"/>: the
/// quota is a flat per-account limit, not tied to ClaudeDo's own activity, so an active/idle
/// split buys nothing safety-wise. The two config keys stay separate for compatibility.
/// </summary>
[JsonPropertyName("usage_poll_interval_active_seconds")]
public int UsagePollIntervalActiveSeconds { get; set; } = 300;
public int UsagePollIntervalActiveSeconds { get; set; } = 120;
/// <summary>
/// Usage-monitor poll interval while nothing is running. Clamped to a minimum of 60s on load.
/// Usage-monitor poll interval while nothing is running. Clamped to a minimum of 90s on
/// load. Same default as <see cref="UsagePollIntervalActiveSeconds"/> — see that doc for the
/// measured rate limit this is sized against.
/// </summary>
[JsonPropertyName("usage_poll_interval_idle_seconds")]
public int UsagePollIntervalIdleSeconds { get; set; } = 900;
public int UsagePollIntervalIdleSeconds { get; set; } = 120;
/// <summary>Base URL of the Bandel ticket-system API. Null = ticket integration off entirely.</summary>
[JsonPropertyName("ticket_api_base_url")]
@@ -88,8 +97,8 @@ public sealed class WorkerConfig
cfg.SandboxRoot = Paths.Expand(cfg.SandboxRoot);
cfg.LogRoot = Paths.Expand(cfg.LogRoot);
cfg.CentralWorktreeRoot = Paths.Expand(cfg.CentralWorktreeRoot);
cfg.UsagePollIntervalActiveSeconds = Math.Max(60, cfg.UsagePollIntervalActiveSeconds);
cfg.UsagePollIntervalIdleSeconds = Math.Max(60, cfg.UsagePollIntervalIdleSeconds);
cfg.UsagePollIntervalActiveSeconds = Math.Max(90, cfg.UsagePollIntervalActiveSeconds);
cfg.UsagePollIntervalIdleSeconds = Math.Max(90, cfg.UsagePollIntervalIdleSeconds);
return cfg;
}
+20 -11
View File
@@ -216,14 +216,19 @@ public sealed class ExternalMcpService
.Distinct()
.ToList();
var dependencyStatuses = new Dictionary<string, TaskStatus>();
var predecessors = new Dictionary<string, (TaskStatus Status, bool Merged)>();
if (dependencyIds.Count > 0)
{
await using var ctx = await _dbFactory.CreateDbContextAsync(ct);
dependencyStatuses = await ctx.Tasks.AsNoTracking()
predecessors = await ctx.Tasks.AsNoTracking()
.Where(t => dependencyIds.Contains(t.Id))
.Select(t => new { t.Id, t.Status })
.ToDictionaryAsync(t => t.Id, t => t.Status, ct);
.Select(t => new
{
t.Id,
t.Status,
Merged = t.Worktree != null && t.Worktree.State == WorktreeState.Merged,
})
.ToDictionaryAsync(t => t.Id, t => (t.Status, t.Merged), ct);
}
var result = new Dictionary<string, (bool Blocked, string? Reason)>();
@@ -239,7 +244,7 @@ public sealed class ExternalMcpService
}
else
{
var unmet = TaskBlocking.Unmet(t.DependsOnTaskIds, dependencyStatuses);
var unmet = TaskBlocking.Unmet(t.DependsOnTaskIds, predecessors);
result[t.Id] = unmet.Count == 0 ? (false, null) : (true, TaskBlocking.Describe(unmet));
}
}
@@ -290,13 +295,14 @@ public sealed class ExternalMcpService
"for normal coding, 'opus' only for complex or cross-cutting work. null inherits the " +
"list/global default (normally sonnet).")]
string? model = null,
[Description("Id of a task that must reach Done (i.e. be merged) before the picker will claim this one, " +
"even once queued. Shorthand for a one-element dependsOnTaskIds; ignored when that is given. " +
[Description("Id of a task whose merge must have landed before the picker will claim this one, even once " +
"queued (Done, or merged and still awaiting the batch verify). Shorthand for a " +
"one-element dependsOnTaskIds; ignored when that is given. " +
"Rejected if it doesn't exist, is this task's own id, or would create a " +
"dependency cycle. If that predecessor instead ends up Failed or Cancelled, this task simply " +
"stays blocked rather than starving silently -- check get_task/list_tasks' blocked field.")]
string? dependsOnTaskId = null,
[Description("Ids of ALL tasks that must reach Done before the picker will claim this one. Use this when a " +
[Description("Ids of ALL tasks whose merges must have landed before the picker will claim this one. Use this when a " +
"task wires together, or verifies, the results of several independent tasks -- one waiting on " +
"A and B is the normal shape of a wave-style plan. Same rejection rules as dependsOnTaskId.")]
string[]? dependsOnTaskIds = null,
@@ -460,12 +466,13 @@ public sealed class ExternalMcpService
string? title = null,
string? description = null,
string? commitType = null,
[Description("Id of a task that must reach Done before the picker will claim this one. Shorthand for a " +
[Description("Id of a task whose merge must have landed (Done, or merged and still awaiting the batch " +
"verify) before the picker will claim this one. Shorthand for a " +
"one-element dependsOnTaskIds; ignored when that is given. Pass an empty " +
"string to clear all existing links; null leaves them unchanged. Rejected if it doesn't exist, " +
"is this task's own id, or would create a dependency cycle.")]
string? dependsOnTaskId = null,
[Description("Ids of ALL tasks that must reach Done before the picker will claim this one, replacing the " +
[Description("Ids of ALL tasks whose merges must have landed before the picker will claim this one, replacing the " +
"task's current set. Pass an empty array to clear it; null leaves it unchanged. Use this when " +
"a task wires together, or verifies, the results of several independent tasks.")]
string[]? dependsOnTaskIds = null,
@@ -708,7 +715,9 @@ public sealed class ExternalMcpService
else
{
var r = await _merge.ApproveAndMergeAsync(taskId, targetBranch ?? "", leaveConflictsInTree, cancellationToken, progress, skipVerify);
if (r.Status == TaskMergeService.StatusBlocked)
// dirty_target is a refusal like blocked -- only the UI turns it into a stash
// retry; an MCP session must not read it as an approve that went through.
if (r.Status is TaskMergeService.StatusBlocked or TaskMergeService.StatusDirtyTarget)
throw new InvalidOperationException(r.ErrorMessage ?? "approve failed");
mergeStatus = r.Status;
mergeConflicts = r.ConflictFiles;
+17 -6
View File
@@ -7,32 +7,36 @@ using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Worker.External;
public sealed record StartListHandlerResult(bool Requested, string ListId, string ListName, int TaskCount, IReadOnlyList<int> TaskNumbers);
public sealed record StartListHandlerResult(bool Requested, string ListId, string ListName, int TaskCount, IReadOnlyList<int> TaskNumbers, string? Reason = null);
// The "Let Claude handle it" button, reachable from outside the UI. The worker only broadcasts;
// the App owns the ConPTY tile and creates the handler task exactly as the button does
// (MissionControlViewModel.OpenMergeHelperConPtySessionAsync), so there is one code path for
// starting a run, not two. Without a connected App nothing happens -- the result says so.
// starting a run, not two. Without a connected App the broadcast has nobody to receive it, so
// ConnectedClientTracker is checked first and Requested comes back false with a Reason instead of
// an unconditional true.
[McpServerToolType]
public sealed class ListHandlerMcpTools
{
private readonly ListRepository _lists;
private readonly TaskRepository _tasks;
private readonly HubBroadcaster _broadcaster;
private readonly ConnectedClientTracker _clients;
public ListHandlerMcpTools(ListRepository lists, TaskRepository tasks, HubBroadcaster broadcaster)
public ListHandlerMcpTools(ListRepository lists, TaskRepository tasks, HubBroadcaster broadcaster, ConnectedClientTracker clients)
{
_lists = lists;
_tasks = tasks;
_broadcaster = broadcaster;
_clients = clients;
}
[McpServerTool, Description(
"Start a list-handler run (\"Let Claude handle it\") for a list, exactly like the button in " +
"Mission Control: the connected ClaudeDo App creates the handler task and opens the triage " +
"ConPTY tile for the given tasks. taskIds defaults to every Idle, non-manual task of the list. " +
"Requires the App to be running and connected to this worker -- the worker only broadcasts " +
"the request. taskIds accept task numbers (#123 or bare 123).")]
"Requires the App to be running and connected to this worker -- if it isn't, Requested comes " +
"back false with a reason and nothing is started. taskIds accept task numbers (#123 or bare 123).")]
public async Task<StartListHandlerResult> StartListHandler(
[Description("The list to run the handler on.")] string listId,
[Description("Tasks to hand to the run, in the order to triage them. Omit for all Idle, non-manual tasks of the list.")] IReadOnlyList<string>? taskIds = null,
@@ -65,8 +69,15 @@ public sealed class ListHandlerMcpTools
if (chosen.Count == 0)
throw new InvalidOperationException($"No tasks to hand to the list handler for {list.Name}.");
var numbers = chosen.Select(t => t.Number).ToList();
if (!_clients.AnyConnected)
{
return new StartListHandlerResult(false, listId, list.Name, chosen.Count, numbers,
"No ClaudeDo App is connected to this worker, so the request could not be delivered. Open the app and retry.");
}
var ids = chosen.Select(t => t.Id).ToList();
await _broadcaster.ListHandlerStartRequested(listId, ids);
return new StartListHandlerResult(true, listId, list.Name, ids.Count, chosen.Select(t => t.Number).ToList());
return new StartListHandlerResult(true, listId, list.Name, ids.Count, numbers);
}
}
+309 -43
View File
@@ -1,6 +1,8 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using ClaudeDo.Data;
using ClaudeDo.Data.Git;
using ClaudeDo.Data.Models;
@@ -61,7 +63,14 @@ public sealed record MergePreviewSetEntryDto(
// Mirrors TaskEntity.ExpectsNoDiff -- lets the merge helper tell a deliberately empty diff
// (verification/audit/research task) apart from a task that silently failed to commit, both
// of which otherwise show IsEmpty=true with no other distinguishing signal.
bool ExpectsNoDiff = false);
bool ExpectsNoDiff = false,
// Top-level C# declarations (methods/properties/fields/types/events) this task's diff removes
// -- a line-pattern scan over `-` lines, not a parser: false positives are possible, a missed
// removal is not the intent. Skips .axaml/.json. Null for an entry with Error set. A name
// another task in the same set still touches on a `+` line surfaces in SymbolWarnings below.
IReadOnlyList<RemovedSymbolDto>? RemovedSymbols = null);
public sealed record RemovedSymbolDto(string Name, string File);
public sealed record FileOverlapDto(string File, IReadOnlyList<string> TaskIds, IReadOnlyList<int> Numbers);
@@ -71,9 +80,16 @@ public sealed record FileOverlapDto(string File, IReadOnlyList<string> TaskIds,
// signal that TaskId's work may already be entirely covered by SupersetTaskId.
public sealed record SubsetRelationDto(string TaskId, int Number, string SupersetTaskId, int SupersetNumber);
// RemovedByTaskId's diff removes Symbol (in RemovedInFile); ReferencedByTaskId's diff still touches
// that name on a `+` line elsewhere -- no textual file conflict, so Overlaps alone misses it (e.g.
// one task deletes a method, a sibling task's edit in a different file still calls it).
public sealed record SymbolReferenceWarningDto(
string Symbol, string RemovedInFile, string RemovedByTaskId, int RemovedByNumber,
string ReferencedByTaskId, int ReferencedByNumber, string ReferencedInFile);
public sealed record MergePreviewSetResultDto(
IReadOnlyList<MergePreviewSetEntryDto> Tasks, IReadOnlyList<FileOverlapDto> Overlaps,
IReadOnlyList<SubsetRelationDto> Subsets);
IReadOnlyList<SubsetRelationDto> Subsets, IReadOnlyList<SymbolReferenceWarningDto> SymbolWarnings);
public sealed record RevertMergeResultDto(
bool Reverted, string? RevertCommit, IReadOnlyList<string> Conflicts, string? Message);
@@ -446,26 +462,30 @@ public sealed class MergeMcpTools
"untracked, in the target working directory — merge-tree can't see the working tree at all, so this is the " +
"only way to catch it before a real merge either refuses or, if that path became tracked in the meantime, " +
"silently overwrites it); behind counts commits on targetBranch not yet on this branch, which flags a stale " +
"branch even when the preview is clean. If the list has a verify command configured, a clean preview is " +
"additionally built/tested in a scratch worktree (still without touching the real working tree) — " +
"verifyExitCode 0 means it built clean, non-zero or -1 (timeout/failed to start) means it doesn't, with the " +
"tail of its output in verifyOutputTail; verifyExitCode stays null when no verify command is configured. " +
"isEmpty=true means the task's review range contributed nothing; check that flag rather than reading a " +
"small changedFileCount as empty. staleFiles lists files this branch touches that the target branch ALSO " +
"changed since this branch's fork point — a more honest staleness signal than `behind` alone, since a " +
"branch can be far behind yet touch nothing the target changed, or barely behind yet collide on the one " +
"file that matters (always empty for a worktree-less handler task, which has no fork point). Throws if the " +
"task has neither an active worktree nor a handler commit range, or the list's working directory is missing " +
"from disk." + McpToolDocs.ProgressHint)]
"branch even when the preview is clean. runVerify=false (default) never builds. runVerify=true additionally " +
"builds/tests a clean preview in a scratch worktree (still without touching the real working tree), if the " +
"list has a verify command configured — verifyExitCode 0 means it built clean, non-zero or -1 " +
"(timeout/failed to start) means it doesn't, with the tail of its output in verifyOutputTail; " +
"verifyExitCode/verifyDurationMs/verifyOutputTail stay null without runVerify=true or without a configured " +
"verify command. isEmpty=true means the task's review range contributed nothing; check that flag rather " +
"than reading a small changedFileCount as empty. staleFiles lists files this branch touches that the " +
"target branch ALSO changed since this branch's fork point — a more honest staleness signal than `behind` " +
"alone, since a branch can be far behind yet touch nothing the target changed, or barely behind yet " +
"collide on the one file that matters (always empty for a worktree-less handler task, which has no fork " +
"point). Throws if the task has neither an active worktree nor a handler commit range, or the list's " +
"working directory is missing from disk." + McpToolDocs.ProgressHint)]
public async Task<MergePreviewToolDto> PreviewMerge(
string taskId,
[Description("Branch to preview against; defaults to the repo's current branch.")]
string? targetBranch = null,
[Description("true: also run the verify command (if configured), building in a scratch worktree. " +
"false (default): no build.")]
bool runVerify = false,
CancellationToken cancellationToken = default,
IProgress<ProgressNotificationValue>? progress = null)
{
taskId = await TaskIdResolver.ResolveAsync(_tasks, taskId, cancellationToken);
var (preview, behind, _, isEmpty, staleFiles, _, _) = await PreviewMergeCoreAsync(taskId, targetBranch, runVerify: true, cancellationToken, progress);
var (preview, behind, _, isEmpty, staleFiles, _, _, _, _, _) = await PreviewMergeCoreAsync(taskId, targetBranch, runVerify, cancellationToken, progress);
return new MergePreviewToolDto(preview.Status, preview.ConflictFiles, preview.ChangedFileCount, behind, isEmpty,
preview.VerifyExitCode, preview.VerifyDurationMs, preview.VerifyOutputTail, staleFiles);
}
@@ -473,16 +493,21 @@ public sealed class MergeMcpTools
[McpServerTool, Description(
"Plan a batch merge: preview_merge for several tasks against the same targetBranch, plus a file-overlap " +
"check between them. Per entry you get preview_merge's fields, or error instead when that task could not " +
"be previewed (it is then left out of the overlap/subset computation). overlaps names, for each file " +
"touched by MORE THAN ONE of the given tasks, which tasks touch it — a single taskId always yields no " +
"overlaps. subsets flags a stronger relation: TaskId's changed files are a PROPER subset of " +
"be previewed (it is then left out of the overlap/subset/symbol computation). overlaps names, for each " +
"file touched by MORE THAN ONE of the given tasks, which tasks touch it — a single taskId always yields " +
"no overlaps; for a .json file this is narrowed to nested-key-path level (parsing both the base commit " +
"and the task branch's head), so two tasks adding different keys to the same locale file are not flagged " +
"and only a genuinely shared key is — unparsable JSON on either side falls back to the plain file-level " +
"check. subsets flags a stronger relation: TaskId's changed files are a PROPER subset of " +
"SupersetTaskId's — the strongest hint you get post-hoc that TaskId may be redundant with SupersetTaskId, " +
"worth checking before merging both. IMPORTANT: neither overlap nor subset is a safety guarantee — two " +
"tasks touching entirely different files (one deleting a symbol, another still referencing it) can still " +
"collide unflagged, and as with preview_merge a clean result does not mean the merge builds. " +
"runVerify=false (default) never builds — set it true to also run each task's list's verify command in a " +
"scratch worktree per entry (same fields as preview_merge); this can take a long time across many tasks, " +
"since builds run one at a time." + McpToolDocs.ProgressHint)]
"worth checking before merging both. removedSymbols (per task entry) lists C# methods/properties/fields/" +
"types/events that task's diff deletes (a line-pattern scan, not a parser — false positives possible, " +
"skips .axaml/.json); symbolWarnings then cross-references those names against every OTHER task's added " +
"lines in the same set, catching a same-symbol collision even when the two tasks touch entirely different " +
"files. IMPORTANT: none of overlaps/subsets/symbolWarnings is a safety guarantee, and as with preview_merge " +
"a clean result does not mean the merge builds. runVerify=false (default) never builds — set it true to " +
"also run each task's list's verify command in a scratch worktree per entry (same fields as preview_merge); " +
"this can take a long time across many tasks, since builds run one at a time." + McpToolDocs.ProgressHint)]
public async Task<MergePreviewSetResultDto> PreviewMergeSet(
IReadOnlyList<string> taskIds,
[Description("Branch to preview every task against; defaults to the repo's current branch.")]
@@ -501,18 +526,37 @@ public sealed class MergeMcpTools
var entries = new List<MergePreviewSetEntryDto>();
var filesByTask = new Dictionary<string, IReadOnlyList<string>>();
var numbersByTask = new Dictionary<string, int>();
var repoPathByTask = new Dictionary<string, string>();
var baseRefByTask = new Dictionary<string, string>();
var headRefByTask = new Dictionary<string, string?>();
var diffLinesByTask = new Dictionary<string, List<DiffLine>>();
var removedSymbolsByTask = new Dictionary<string, IReadOnlyList<RemovedSymbolDto>>();
for (var i = 0; i < taskIds.Count; i++)
{
var taskId = taskIds[i];
try
{
var (preview, behind, changedFiles, isEmpty, staleFiles, number, expectsNoDiff) = await PreviewMergeCoreAsync(taskId, targetBranch, runVerify, cancellationToken, progress);
entries.Add(new MergePreviewSetEntryDto(
taskId, preview.Status, preview.ConflictFiles, preview.ChangedFileCount, behind, null, isEmpty,
preview.VerifyExitCode, preview.VerifyDurationMs, preview.VerifyOutputTail, staleFiles, number, expectsNoDiff));
var (preview, behind, changedFiles, isEmpty, staleFiles, number, expectsNoDiff, repoPath, baseRef, headRef) =
await PreviewMergeCoreAsync(taskId, targetBranch, runVerify, cancellationToken, progress);
filesByTask[taskId] = changedFiles;
numbersByTask[taskId] = number;
repoPathByTask[taskId] = repoPath;
baseRefByTask[taskId] = baseRef;
headRefByTask[taskId] = headRef;
var diff = headRef is null
? await _git.GetBranchDiffAsync(repoPath, baseRef, ct: cancellationToken)
: await _git.GetCommitRangeDiffAsync(repoPath, baseRef, headRef, ct: cancellationToken);
var diffLines = ParseDiffLines(diff);
diffLinesByTask[taskId] = diffLines;
var removedSymbols = ExtractRemovedSymbols(diffLines);
removedSymbolsByTask[taskId] = removedSymbols;
entries.Add(new MergePreviewSetEntryDto(
taskId, preview.Status, preview.ConflictFiles, preview.ChangedFileCount, behind, null, isEmpty,
preview.VerifyExitCode, preview.VerifyDurationMs, preview.VerifyOutputTail, staleFiles, number,
expectsNoDiff, removedSymbols));
}
catch (InvalidOperationException ex)
{
@@ -525,23 +569,243 @@ public sealed class MergeMcpTools
ProgressReporter.ReportItem(progress, "Previewing merges", i + 1, taskIds.Count);
}
var overlaps = filesByTask
.SelectMany(kv => kv.Value.Select(f => (File: f, TaskId: kv.Key)))
.GroupBy(x => x.File, StringComparer.OrdinalIgnoreCase)
.Where(g => g.Select(x => x.TaskId).Distinct().Count() > 1)
.Select(g =>
{
var ids = g.Select(x => x.TaskId).Distinct().ToList();
return new FileOverlapDto(g.Key, ids, ids.Select(id => numbersByTask[id]).ToList());
})
.OrderBy(o => o.File, StringComparer.OrdinalIgnoreCase)
.ToList();
var overlaps = await ComputeOverlapsAsync(filesByTask, numbersByTask, repoPathByTask, baseRefByTask, headRefByTask, cancellationToken);
var subsets = FindSubsetRelations(filesByTask, numbersByTask);
var symbolWarnings = FindSymbolWarnings(removedSymbolsByTask, numbersByTask, diffLinesByTask);
return new MergePreviewSetResultDto(entries, overlaps, subsets);
return new MergePreviewSetResultDto(entries, overlaps, subsets, symbolWarnings);
}
// Cross-references each task's removed symbols (Teil 1) against every OTHER task's added
// lines in the same set -- a same-named symbol collision that overlaps/subsets (both purely
// file-based) can never catch, since the two tasks may not share a single file.
private static List<SymbolReferenceWarningDto> FindSymbolWarnings(
Dictionary<string, IReadOnlyList<RemovedSymbolDto>> removedSymbolsByTask,
Dictionary<string, int> numbersByTask,
Dictionary<string, List<DiffLine>> diffLinesByTask)
{
var warnings = new List<SymbolReferenceWarningDto>();
foreach (var (taskId, removed) in removedSymbolsByTask)
{
foreach (var symbol in removed)
{
foreach (var (otherTaskId, diffLines) in diffLinesByTask)
{
if (otherTaskId == taskId) continue;
var hit = diffLines.FirstOrDefault(l => l.Sign == '+' && ContainsWord(l.Text, symbol.Name));
if (hit.File is not null)
warnings.Add(new SymbolReferenceWarningDto(
symbol.Name, symbol.File, taskId, numbersByTask[taskId],
otherTaskId, numbersByTask[otherTaskId], hit.File));
}
}
}
return warnings
.OrderBy(w => w.Symbol, StringComparer.Ordinal)
.ThenBy(w => w.RemovedByTaskId, StringComparer.Ordinal)
.ThenBy(w => w.ReferencedByTaskId, StringComparer.Ordinal)
.ToList();
}
// File-level overlap for everything except .json; for .json, narrows to nested-key-path
// collisions between the tasks that touch it (Teil 2) -- unless either side fails to parse,
// in which case it falls back to the plain file-level check for that file.
private async Task<List<FileOverlapDto>> ComputeOverlapsAsync(
Dictionary<string, IReadOnlyList<string>> filesByTask, Dictionary<string, int> numbersByTask,
Dictionary<string, string> repoPathByTask, Dictionary<string, string> baseRefByTask,
Dictionary<string, string?> headRefByTask, CancellationToken ct)
{
var overlaps = new List<FileOverlapDto>();
var byFile = filesByTask
.SelectMany(kv => kv.Value.Select(f => (File: f, TaskId: kv.Key)))
.GroupBy(x => x.File, StringComparer.OrdinalIgnoreCase);
foreach (var group in byFile)
{
var taskIds = group.Select(x => x.TaskId).Distinct().ToList();
if (taskIds.Count <= 1) continue;
if (!group.Key.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
{
overlaps.Add(MakeOverlap(group.Key, taskIds, numbersByTask));
continue;
}
var colliding = await FindJsonKeyCollisionTasksAsync(
group.Key, taskIds, repoPathByTask, baseRefByTask, headRefByTask, ct);
if (colliding is null)
overlaps.Add(MakeOverlap(group.Key, taskIds, numbersByTask)); // unparsable -- fall back
else if (colliding.Count > 1)
overlaps.Add(MakeOverlap(group.Key, colliding, numbersByTask));
}
return overlaps.OrderBy(o => o.File, StringComparer.OrdinalIgnoreCase).ToList();
}
private static FileOverlapDto MakeOverlap(string file, IReadOnlyList<string> taskIds, Dictionary<string, int> numbersByTask)
=> new(file, taskIds, taskIds.Select(id => numbersByTask[id]).ToList());
// Null = give up and fall back to file-level (JSON unparsable on some side for some task).
// Otherwise: the subset of taskIds whose changed/added/removed key paths in `file` intersect
// with at least one other task's -- two tasks touching disjoint keys in the same file never appear.
private async Task<List<string>?> FindJsonKeyCollisionTasksAsync(
string file, List<string> taskIds,
Dictionary<string, string> repoPathByTask, Dictionary<string, string> baseRefByTask,
Dictionary<string, string?> headRefByTask, CancellationToken ct)
{
var keysByTask = new Dictionary<string, HashSet<string>>();
foreach (var taskId in taskIds)
{
var baseContent = await ReadFileContentAsync(repoPathByTask[taskId], baseRefByTask[taskId], file, ct);
var headContent = await ReadFileContentAsync(repoPathByTask[taskId], headRefByTask[taskId], file, ct);
if (!TryDiffJsonKeyPaths(baseContent, headContent, out var keys))
return null;
keysByTask[taskId] = keys;
}
var colliding = new HashSet<string>();
foreach (var a in taskIds)
foreach (var b in taskIds)
{
if (a == b) continue;
if (keysByTask[a].Overlaps(keysByTask[b]))
{
colliding.Add(a);
colliding.Add(b);
}
}
return taskIds.Where(colliding.Contains).ToList();
}
// gitRef null = read the live working tree off disk (mirrors GetBranchDiffAsync's own base-vs-
// working-tree comparison); non-null = `git show ref:path` (handler task's fixed commit range).
private async Task<string?> ReadFileContentAsync(string repoPath, string? gitRef, string relativePath, CancellationToken ct)
{
if (gitRef is null)
{
var full = Path.Combine(repoPath, relativePath);
return File.Exists(full) ? await File.ReadAllTextAsync(full, ct) : null;
}
return await _git.ShowFileAsync(repoPath, gitRef, relativePath, ct);
}
private static bool TryDiffJsonKeyPaths(string? baseContent, string? headContent, out HashSet<string> changedPaths)
{
changedPaths = new HashSet<string>(StringComparer.Ordinal);
if (!TryFlattenJson(baseContent, out var baseMap) || !TryFlattenJson(headContent, out var headMap))
return false;
foreach (var (path, value) in headMap)
if (!baseMap.TryGetValue(path, out var baseValue) || baseValue != value)
changedPaths.Add(path);
foreach (var path in baseMap.Keys)
if (!headMap.ContainsKey(path))
changedPaths.Add(path);
return true;
}
// Missing content (new/deleted file, either side) is an empty object, not a parse failure --
// only actually-malformed JSON triggers the file-level fallback.
private static bool TryFlattenJson(string? content, out Dictionary<string, string> flattened)
{
flattened = new Dictionary<string, string>(StringComparer.Ordinal);
if (string.IsNullOrWhiteSpace(content))
return true;
try
{
using var doc = JsonDocument.Parse(content);
FlattenJson(doc.RootElement, "", flattened);
return true;
}
catch (JsonException)
{
return false;
}
}
private static void FlattenJson(JsonElement element, string prefix, Dictionary<string, string> into)
{
if (element.ValueKind == JsonValueKind.Object)
{
foreach (var prop in element.EnumerateObject())
FlattenJson(prop.Value, prefix.Length == 0 ? prop.Name : $"{prefix}.{prop.Name}", into);
}
else
{
into[prefix] = element.GetRawText();
}
}
// One line of a unified diff, tagged with the file it belongs to ('-'/'+' only; context lines
// are dropped). File is set from the `diff --git a/<path> b/<path>` header, which (unlike
// `+++ b/...`) is present and names the real path even for a deleted file (`+++ /dev/null`).
private readonly record struct DiffLine(string? File, char Sign, string Text);
private static List<DiffLine> ParseDiffLines(string diff)
{
var result = new List<DiffLine>();
string? currentFile = null;
foreach (var raw in diff.Split('\n'))
{
var line = raw.TrimEnd('\r');
if (line.StartsWith("diff --git a/", StringComparison.Ordinal))
{
var rest = line["diff --git a/".Length..];
var sep = rest.IndexOf(" b/", StringComparison.Ordinal);
currentFile = sep >= 0 ? rest[..sep] : rest;
continue;
}
if (currentFile is null) continue;
if (line.StartsWith("---", StringComparison.Ordinal) || line.StartsWith("+++", StringComparison.Ordinal) ||
line.StartsWith("@@", StringComparison.Ordinal) || line.StartsWith("index ", StringComparison.Ordinal))
continue;
if (line.Length > 0 && line[0] == '-')
result.Add(new DiffLine(currentFile, '-', line[1..]));
else if (line.Length > 0 && line[0] == '+')
result.Add(new DiffLine(currentFile, '+', line[1..]));
}
return result;
}
// Deliberately a line-pattern scan, not a Roslyn parse: requires an explicit access modifier
// (this codebase's style never omits one on a real member/type), which is also what keeps a
// removed local variable or statement inside a method body from matching.
private static readonly Regex RemovedDeclarationRegex = new(
@"^\s*(?:\[[^\]]*\]\s*)*(?:public|private|protected|internal)(?:\s+(?:static|readonly|sealed|abstract|virtual|override|async|partial|const|new|extern|unsafe|required))*\s+" +
@"(?:(?:class|struct|interface|enum|record)\s+(?<name>[A-Za-z_]\w*)" +
@"|event\s+[\w<>\[\],.?]+\s+(?<name>[A-Za-z_]\w*)" +
@"|[\w<>\[\],.?]+\??\s+(?<name>[A-Za-z_]\w*)\s*(?:\(|\{|=>|;|=))",
RegexOptions.Compiled);
private static List<RemovedSymbolDto> ExtractRemovedSymbols(List<DiffLine> diffLines)
{
var seen = new HashSet<(string Name, string File)>();
var result = new List<RemovedSymbolDto>();
foreach (var line in diffLines)
{
if (line.Sign != '-' || line.File is null) continue;
if (line.File.EndsWith(".axaml", StringComparison.OrdinalIgnoreCase) ||
line.File.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
continue;
var match = RemovedDeclarationRegex.Match(line.Text);
if (!match.Success) continue;
if (seen.Add((match.Groups["name"].Value, line.File)))
result.Add(new RemovedSymbolDto(match.Groups["name"].Value, line.File));
}
return result;
}
private static bool ContainsWord(string text, string word)
=> Regex.IsMatch(text, $@"\b{Regex.Escape(word)}\b");
// A task's changed-file set is flagged only against another task's STRICTLY LARGER set that
// contains every one of its files -- an empty set (isEmpty task) never qualifies, since that
// case is already surfaced via IsEmpty and would otherwise match every other task trivially.
@@ -577,7 +841,7 @@ public sealed class MergeMcpTools
// (its commits already sit on the list's working dir) — falls back to the fixed
// HandlerBaseCommit..HandlerHeadCommit range, reporting a synthetic "clean" preview of that
// range's own diff-stat instead of throwing "has no worktree".
private async Task<(MergePreviewResult Preview, int Behind, IReadOnlyList<string> ChangedFiles, bool IsEmpty, IReadOnlyList<string> StaleFiles, int Number, bool ExpectsNoDiff)> PreviewMergeCoreAsync(
private async Task<(MergePreviewResult Preview, int Behind, IReadOnlyList<string> ChangedFiles, bool IsEmpty, IReadOnlyList<string> StaleFiles, int Number, bool ExpectsNoDiff, string RepoPath, string BaseRef, string? HeadRef)> PreviewMergeCoreAsync(
string taskId, string? targetBranch, bool runVerify, CancellationToken ct,
IProgress<ProgressNotificationValue>? progress = null)
{
@@ -619,7 +883,8 @@ public sealed class MergeMcpTools
.Intersect(targetChangedSinceFork, StringComparer.OrdinalIgnoreCase)
.ToList();
return (preview, behind, changedFiles, changedFiles.Count == 0, staleFiles, task.Number, task.ExpectsNoDiff);
return (preview, behind, changedFiles, changedFiles.Count == 0, staleFiles, task.Number, task.ExpectsNoDiff,
wt.Path, wt.BaseCommit, null);
}
if (task.HandlerBaseCommit is { Length: > 0 } handlerBase && task.HandlerHeadCommit is { Length: > 0 } handlerHead)
@@ -636,7 +901,8 @@ public sealed class MergeMcpTools
// No fork point to diff against: a handler task commits straight onto the list's
// working dir instead of a branch, so there is nothing else that could have "changed
// in the target since the fork".
return (preview, 0, changedFiles, isEmpty, Array.Empty<string>(), task.Number, task.ExpectsNoDiff);
return (preview, 0, changedFiles, isEmpty, Array.Empty<string>(), task.Number, task.ExpectsNoDiff,
list.WorkingDir, handlerBase, handlerHead);
}
throw new InvalidOperationException($"Task {taskId} has no worktree.");
+9 -6
View File
@@ -10,19 +10,22 @@ namespace ClaudeDo.Worker.External;
internal static class TaskBlocking
{
/// <summary>
/// The predecessors of <paramref name="dependencyIds"/> that have not reached Done — an id
/// missing from <paramref name="statuses"/> counts as unmet (the picker treats a dangling
/// edge as blocking too).
/// The predecessors of <paramref name="dependencyIds"/> the picker would still skip on: not
/// Done <i>and</i> without a landed merge. Mirrors <c>QueuePicker</c>'s SQL predicate — a
/// task merged with <c>skipVerify</c> sits in WaitingForReview until the batch verify runs,
/// yet its code is on the target branch, so it no longer blocks. An id missing from
/// <paramref name="predecessors"/> counts as unmet (a dangling edge blocks there too).
/// </summary>
public static List<(string Id, TaskStatus? Status)> Unmet(
IEnumerable<string> dependencyIds, IReadOnlyDictionary<string, TaskStatus> statuses)
IEnumerable<string> dependencyIds,
IReadOnlyDictionary<string, (TaskStatus Status, bool Merged)> predecessors)
{
var unmet = new List<(string Id, TaskStatus? Status)>();
foreach (var id in dependencyIds)
{
if (statuses.TryGetValue(id, out var status))
if (predecessors.TryGetValue(id, out var p))
{
if (status != TaskStatus.Done) unmet.Add((id, status));
if (p.Status != TaskStatus.Done && !p.Merged) unmet.Add((id, p.Status));
}
else
{
+11 -5
View File
@@ -1,5 +1,6 @@
using System.ComponentModel;
using ClaudeDo.Data;
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories;
using Microsoft.EntityFrameworkCore;
using ModelContextProtocol;
@@ -152,12 +153,17 @@ public sealed class TaskWaitMcpTools
.SelectMany(r => r.DependsOnTaskIds)
.Distinct()
.ToList();
var dependencyStatuses = dependencyIds.Count == 0
? new Dictionary<string, TaskStatus>()
var predecessors = dependencyIds.Count == 0
? new Dictionary<string, (TaskStatus Status, bool Merged)>()
: await ctx.Tasks.AsNoTracking()
.Where(t => dependencyIds.Contains(t.Id))
.Select(t => new { t.Id, t.Status })
.ToDictionaryAsync(t => t.Id, t => t.Status, ct);
.Select(t => new
{
t.Id,
t.Status,
Merged = t.Worktree != null && t.Worktree.State == WorktreeState.Merged,
})
.ToDictionaryAsync(t => t.Id, t => (t.Status, t.Merged), ct);
var result = new List<TaskStatusChangeDto>();
foreach (var id in taskIds)
@@ -175,7 +181,7 @@ public sealed class TaskWaitMcpTools
// every chained child and turn the wait into a one-turn-per-poll busy loop.
if (row.Status == TaskStatus.Queued && row.BlockedByTaskId is null)
{
var unmet = TaskBlocking.Unmet(row.DependsOnTaskIds, dependencyStatuses);
var unmet = TaskBlocking.Unmet(row.DependsOnTaskIds, predecessors);
if (unmet.Count > 0)
{
result.Add(new TaskStatusChangeDto(
@@ -0,0 +1,19 @@
namespace ClaudeDo.Worker.Hub;
/// <summary>
/// Counts SignalR clients (the ClaudeDo App) currently connected to <see cref="WorkerHub"/>.
/// A <c>Hub</c> instance is transient per connection, so this lives as a DI singleton and is
/// updated from <see cref="WorkerHub.OnConnectedAsync"/>/<see cref="WorkerHub.OnDisconnectedAsync"/>
/// — the only way an out-of-band caller (external MCP's start_list_handler, which only
/// broadcasts) can tell whether anything is listening before claiming it did something.
/// </summary>
public sealed class ConnectedClientTracker
{
private int _count;
public bool AnyConnected => Volatile.Read(ref _count) > 0;
public void Increment() => Interlocked.Increment(ref _count);
public void Decrement() => Interlocked.Decrement(ref _count);
}
+37 -10
View File
@@ -74,6 +74,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
private readonly TicketImportService _ticketImport;
private readonly HandlerRestartCoordinator? _handlerRestart;
private readonly HandlerRoundState? _roundState;
private readonly ConnectedClientTracker? _clientTracker;
public WorkerHub(
QueueService queue,
@@ -114,7 +115,8 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
TicketClientFactory ticketClients = null!,
TicketImportService ticketImport = null!,
HandlerRestartCoordinator? handlerRestart = null,
HandlerRoundState? roundState = null)
HandlerRoundState? roundState = null,
ConnectedClientTracker? clientTracker = null)
{
_queue = queue;
_waker = waker;
@@ -155,6 +157,21 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
_ticketImport = ticketImport;
_handlerRestart = handlerRestart;
_roundState = roundState;
_clientTracker = clientTracker;
}
// Tracks connected UI clients so an out-of-band caller (external MCP's start_list_handler)
// can tell whether the broadcast it just sent had anyone to receive it.
public override Task OnConnectedAsync()
{
_clientTracker?.Increment();
return base.OnConnectedAsync();
}
public override Task OnDisconnectedAsync(Exception? exception)
{
_clientTracker?.Decrement();
return base.OnDisconnectedAsync(exception);
}
// Persistence boundary for the session_skills JSON-array columns (task/list/global).
@@ -432,7 +449,8 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
var rows = await _wtMaintenance.GetOverviewAsync(listId, Context.ConnectionAborted);
return rows.Select(r => new WorktreeOverviewDto(
r.TaskId, r.TaskTitle, r.TaskStatus, r.ListId, r.ListName,
r.Path, r.BranchName, r.BaseCommit, r.State, r.DiffStat, r.CreatedAt, r.PathExistsOnDisk)).ToList();
r.Path, r.BranchName, r.BaseCommit, r.State, r.DiffStat, r.CreatedAt, r.PathExistsOnDisk,
r.TaskNumber)).ToList();
}
public async Task<bool> SetWorktreeState(string taskId, WorktreeState newState)
@@ -461,7 +479,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
}
public Task<MergeResultDto> MergeTask(
string taskId, string targetBranch, bool removeWorktree, string commitMessage)
string taskId, string targetBranch, bool removeWorktree, string commitMessage, bool autostash = false)
=> HubGuard(async () =>
{
// A blank message is handed through deliberately — TaskMergeService builds the
@@ -471,7 +489,9 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
targetBranch ?? "",
removeWorktree,
commitMessage,
CancellationToken.None);
leaveConflictsInTree: false,
CancellationToken.None,
autostash: autostash);
return new MergeResultDto(r.Status, r.ConflictFiles, r.ErrorMessage);
});
@@ -479,7 +499,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
=> HubGuard(async () =>
{
var t = await _mergeService.GetTargetsAsync(taskId, CancellationToken.None);
return new MergeTargetsDto(t.DefaultBranch, t.LocalBranches, t.DefaultCommitMessage);
return new MergeTargetsDto(t.DefaultBranch, t.LocalBranches, t.DefaultCommitMessage, t.TargetDirty);
});
public Task<MergePreviewDto> PreviewMerge(string taskId, string targetBranch)
@@ -666,7 +686,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
if (!result.Ok) throw new HubException(result.Reason ?? "dequeue failed");
}
public Task<MergeResultDto> ApproveReview(string taskId, string targetBranch)
public Task<MergeResultDto> ApproveReview(string taskId, string targetBranch, bool autostash = false)
=> HubGuard(async () =>
{
bool hasChildren;
@@ -681,7 +701,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
return new MergeResultDto(unitResult.Status, Array.Empty<string>(), unitResult.Reason);
}
var r = await _mergeService.ApproveAndMergeAsync(taskId, targetBranch ?? "", CancellationToken.None);
var r = await _mergeService.ApproveAndMergeAsync(taskId, targetBranch ?? "", CancellationToken.None, autostash);
if (r.Status == TaskMergeService.StatusBlocked)
throw new HubException(r.ErrorMessage ?? "approve failed");
return new MergeResultDto(r.Status, r.ConflictFiles, r.ErrorMessage);
@@ -755,6 +775,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
{
if (_interactiveLaunchSpec is null)
throw new InvalidOperationException("Interactive launch spec service is not configured.");
_broadcaster.WorktreeUpdated(taskId);
return _interactiveLaunchSpec.BuildForTaskAsync(taskId, Context.ConnectionAborted);
});
@@ -770,12 +791,13 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
// Builds the launch spec for an embedded ConPTY "merge helper" session that drives the given
// tasks to a merged/Done state via the mcp__claudedo__* tools. listId scopes the brief label
// and cwd to that list. handlerTaskId is the id returned by CreateMergeHelperTask -- it is
// rendered into the brief so the session can call handoff_list_handler on itself.
public Task<LaunchSpec> GetMergeHelperLaunchSpec(string[] taskIds, string listId, string handlerTaskId) => HubGuard(() =>
// rendered into the brief so the session can call handoff_list_handler on itself. model
// overrides the triage session's model (null = default opus).
public Task<LaunchSpec> GetMergeHelperLaunchSpec(string[] taskIds, string listId, string handlerTaskId, string? model) => HubGuard(() =>
{
if (_interactiveLaunchSpec is null)
throw new InvalidOperationException("Interactive launch spec service is not configured.");
return _interactiveLaunchSpec.BuildForMergeHelperAsync(taskIds, listId, handlerTaskId, Context.ConnectionAborted);
return _interactiveLaunchSpec.BuildForMergeHelperAsync(taskIds, listId, handlerTaskId, model, Context.ConnectionAborted);
});
// Creates the ClaudeDo task that owns a list-handler run, before the ConPTY tile opens --
@@ -1376,6 +1398,11 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
try
{
var result = await _ticketImport.ImportAsync(listId, Context.ConnectionAborted);
// ListUpdated allein reicht nicht: die UI liest das als "Listen-Metadaten geaendert"
// und patcht nur bestehende Zeilen. Neue Tasks tauchen nur ueber TaskUpdated auf, wie
// bei jedem anderen out-of-band Creator (add_task und Co.).
foreach (var taskId in result.CreatedTaskIds)
await _broadcaster.TaskUpdated(taskId);
await _broadcaster.ListUpdated(listId);
return new TicketImportResultDto(result.Examined, result.Created);
}
@@ -2,6 +2,7 @@ using ClaudeDo.Data;
using ClaudeDo.Data.Git;
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories;
using ClaudeDo.Worker.Hub;
using ClaudeDo.Worker.Runner;
using ClaudeDo.Worker.State;
using Microsoft.EntityFrameworkCore;
@@ -20,17 +21,20 @@ public sealed class InteractiveReviewSubmissionService
private readonly GitService _git;
private readonly ITaskStateService _state;
private readonly WorktreeManager? _worktreeManager;
private readonly HubBroadcaster? _broadcaster;
public InteractiveReviewSubmissionService(
IDbContextFactory<ClaudeDoDbContext> dbFactory,
GitService git,
ITaskStateService state,
WorktreeManager? worktreeManager = null)
WorktreeManager? worktreeManager = null,
HubBroadcaster? broadcaster = null)
{
_dbFactory = dbFactory;
_git = git;
_state = state;
_worktreeManager = worktreeManager;
_broadcaster = broadcaster;
}
public async Task SubmitAsync(string taskId, CancellationToken ct)
@@ -86,5 +90,14 @@ public sealed class InteractiveReviewSubmissionService
var result = await _state.SubmitInteractiveForReviewAsync(taskId, DateTime.UtcNow, ct);
if (!result.Ok)
throw new InvalidOperationException(result.Reason ?? "Could not submit for review.");
// The transition itself only broadcasts TaskUpdated, and the detail pane answers that by
// refreshing the task row alone -- its whole REVIEW/MERGE block (Open diff, branch picker,
// change summary) is gated on the worktree it last read, refreshed only on WorktreeUpdated.
// An interactive session creates its worktree at launch and gets it committed HERE, both
// outside the autonomous pipeline that would normally announce it, so without this the task
// arrives in WaitingForReview with the diff button missing until it is re-selected.
if (_broadcaster is not null)
await _broadcaster.WorktreeUpdated(taskId);
}
}
@@ -20,7 +20,8 @@ public sealed record MergeResult(
public sealed record MergeTargets(
string DefaultBranch,
IReadOnlyList<string> LocalBranches,
string DefaultCommitMessage);
string DefaultCommitMessage,
bool TargetDirty = false);
// VerifyExitCode/VerifyDurationMs/VerifyOutputTail are only populated when the caller asked for
// a verify run (runVerify=true) AND the list has a verify command configured AND the preview came
@@ -70,6 +71,10 @@ public sealed class TaskMergeService
public const string StatusMergedVerifyPending = "merged_verify_pending";
public const string StatusVerifyPassed = "verify_passed";
public const string StatusUntrackedCollision = "untracked_collision";
// Nothing landed -- the target working dir has uncommitted changes. Its own status rather
// than a Blocked reason string so callers can offer the autostash retry (MergeAsync's
// autostash: true) without matching on prose.
public const string StatusDirtyTarget = "dirty_target";
public const string StatusReverted = "reverted";
public const string StatusConflictAborted = "conflict_aborted";
@@ -375,7 +380,8 @@ public sealed class TaskMergeService
bool leaveConflictsInTree,
CancellationToken ct,
IProgress<ProgressNotificationValue>? progress = null,
bool skipVerify = false)
bool skipVerify = false,
bool autostash = false)
{
var (task, list, wt, verifyCommand) = await LoadMergeContextAsync(taskId, ct);
@@ -400,8 +406,10 @@ public sealed class TaskMergeService
return Blocked("working directory is not a git repository");
if (await _git.IsMidMergeAsync(list.WorkingDir, ct))
return Blocked("target working directory is mid-merge");
if (await _git.HasChangesAsync(list.WorkingDir, includeUntracked: false, ct))
return Blocked("target working tree has uncommitted changes");
// autostash hands the dirty tree to git itself (merge --autostash) instead of refusing.
if (!autostash && await _git.HasChangesAsync(list.WorkingDir, includeUntracked: false, ct))
return new MergeResult(StatusDirtyTarget, Array.Empty<string>(),
"target working tree has uncommitted changes");
var currentBranch = await _git.GetCurrentBranchAsync(list.WorkingDir, ct);
if (!string.Equals(currentBranch, targetBranch, StringComparison.Ordinal))
@@ -417,7 +425,7 @@ public sealed class TaskMergeService
var message = string.IsNullOrWhiteSpace(commitMessage)
? DefaultMergeMessage(task, list)
: commitMessage;
var (exitCode, stderr) = await _git.MergeNoFfAsync(list.WorkingDir, wt.BranchName, message, ct);
var (exitCode, stderr) = await _git.MergeNoFfAsync(list.WorkingDir, wt.BranchName, message, ct, autostash);
if (exitCode != 0)
{
List<string> files;
@@ -868,7 +876,8 @@ public sealed class TaskMergeService
var current = await _git.GetCurrentBranchAsync(list.WorkingDir, ct);
var branches = await _git.ListLocalBranchesAsync(list.WorkingDir, ct);
return new MergeTargets(current, branches, defaultMessage);
var dirty = await _git.HasChangesAsync(list.WorkingDir, includeUntracked: false, ct);
return new MergeTargets(current, branches, defaultMessage, dirty);
}
/// The commit message a merge uses when the caller passes none. Built here rather than in the
@@ -973,13 +982,15 @@ public sealed class TaskMergeService
}
}
public Task<MergeResult> ApproveAndMergeAsync(string taskId, string targetBranch, CancellationToken ct)
=> ApproveAndMergeAsync(taskId, targetBranch, leaveConflictsInTree: false, ct);
public Task<MergeResult> ApproveAndMergeAsync(
string taskId, string targetBranch, CancellationToken ct, bool autostash = false)
=> ApproveAndMergeAsync(taskId, targetBranch, leaveConflictsInTree: false, ct, autostash: autostash);
public async Task<MergeResult> ApproveAndMergeAsync(
string taskId, string targetBranch, bool leaveConflictsInTree, CancellationToken ct,
IProgress<ProgressNotificationValue>? progress = null,
bool skipVerify = false)
bool skipVerify = false,
bool autostash = false)
{
var (task, list, wt, verifyCommand) = await LoadMergeContextAsync(taskId, ct);
@@ -1070,7 +1081,7 @@ public sealed class TaskMergeService
// MergeAsync transitions the task WaitingForReview -> Done on a successful merge.
// Remove the worktree on approve (matching the unit-merge path) so merged
// worktrees don't pile up; the merge commit on the target branch is the record.
return await MergeAsync(taskId, target, removeWorktree: true, commitMessage: "", leaveConflictsInTree, ct, progress, skipVerify);
return await MergeAsync(taskId, target, removeWorktree: true, commitMessage: "", leaveConflictsInTree, ct, progress, skipVerify, autostash);
}
/// <summary>
@@ -0,0 +1,19 @@
namespace ClaudeDo.Worker.Lifecycle;
/// <summary>
/// Formats the Fatal log line for a startup/bind failure (e.g. a port already in use) so
/// Program.cs can log a diagnosable message and exit cleanly instead of crashing unhandled.
/// </summary>
public static class WorkerStartupFailure
{
public const int ExitCode = 1;
public static string FormatBindFailureMessage(Exception ex, int signalRPort, int externalMcpPort)
{
var ports = externalMcpPort > 0
? $"ports {signalRPort} and {externalMcpPort}"
: $"port {signalRPort}";
return $"ClaudeDo.Worker failed to start on {ports}: {ex.Message} " +
"Is another worker instance already running, or is another process using this port?";
}
}
+30 -8
View File
@@ -31,10 +31,11 @@ using ClaudeDo.Worker.Worktrees;
using Microsoft.EntityFrameworkCore;
using Serilog;
// Single-instance per user session. Multiple launch paths exist (logon task,
// app ensure-running, Restart button); a second instance exits cleanly instead
// of fighting over the SignalR port.
var mutex = new Mutex(true, @"Local\ClaudeDoWorker", out var createdNew);
// Single instance machine-wide. Multiple launch paths exist (logon task, app
// ensure-running, Restart button) and a Remote Desktop / Fast User Switching session
// gets its own `Local\` namespace, so `Global\` is required or a second session's
// worker silently fights the first one over the SignalR port instead of exiting.
var mutex = new Mutex(true, @"Global\ClaudeDoWorker", out var createdNew);
if (!createdNew)
return; // another instance already owns the port; exit 0
@@ -65,6 +66,14 @@ builder.Host.UseSerilog((ctx, lc) => lc
.WriteTo.Sink(broadcastSink));
builder.Services.AddSingleton(logBuffer);
// Last-resort net: any exception that misses every other handler (e.g. a crash on a
// background thread) still gets one Fatal line in the log before the process dies.
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
{
Log.Fatal(e.ExceptionObject as Exception, "Unhandled exception, terminating (IsTerminating: {IsTerminating})", e.IsTerminating);
Log.CloseAndFlush();
};
builder.Services.AddDbContextFactory<ClaudeDoDbContext>(opt =>
opt.UseSqlite($"Data Source={cfg.DbPath}"));
@@ -90,6 +99,7 @@ builder.Services.AddSignalR(options => options.MaximumParallelInvocationsPerClie
// Runner stack.
builder.Services.AddSingleton<IClaudeProcess, ClaudeProcess>();
builder.Services.AddSingleton<HubBroadcaster>();
builder.Services.AddSingleton<ConnectedClientTracker>();
builder.Services.AddSingleton<GitService>();
builder.Services.AddSingleton<WorktreeManager>();
builder.Services.AddSingleton<ClaudeArgsBuilder>();
@@ -328,6 +338,7 @@ if (cfg.ExternalMcpPort > 0)
externalBuilder.Services.AddSingleton(cfg);
Share<HubBroadcaster>();
Share<ConnectedClientTracker>();
Share<QueueService>();
Share<OverrideSlotService>();
Share<IDbContextFactory<ClaudeDoDbContext>>();
@@ -404,13 +415,24 @@ if (cfg.ExternalMcpPort > 0)
string.IsNullOrEmpty(cfg.ExternalMcpApiKey) ? "loopback-only" : "X-ClaudeDo-Key");
}
if (externalApp is null)
try
{
await app.RunAsync();
if (externalApp is null)
{
await app.RunAsync();
}
else
{
await Task.WhenAll(app.RunAsync(), externalApp.RunAsync());
}
}
else
catch (Exception ex)
{
await Task.WhenAll(app.RunAsync(), externalApp.RunAsync());
// Most commonly a Kestrel bind failure (port already in use by a second session's
// worker or an unrelated process) — log it plainly instead of an unhandled crash.
Log.Fatal(ex, "{Message}", WorkerStartupFailure.FormatBindFailureMessage(ex, cfg.SignalRPort, cfg.ExternalMcpPort));
Log.CloseAndFlush();
Environment.Exit(WorkerStartupFailure.ExitCode);
}
GC.KeepAlive(mutex);
+18 -6
View File
@@ -21,11 +21,19 @@ public sealed class QueuePicker : IQueuePicker
// Atomic queue claim: UPDATE + RETURNING in a single statement prevents TOCTOU races.
// Raw SQL because EF cannot express UPDATE...RETURNING.
// Eligible task must be Queued, unblocked (chain and depends-on), not manual, and due
// (or unscheduled). A task_dependencies edge only gates on the dependency's Status='done'
// -- unlike blocked_by_task_id there is no cascade on the dependency failing, so a task
// with a Failed dependency simply stays here, skipped, until someone intervenes. The
// depends-on clause is doubly negated on purpose: "no edge whose predecessor isn't done"
// means a task with zero edges is eligible, ALL edges must be done, and an edge pointing
// (or unscheduled). A task_dependencies edge is satisfied once the predecessor is 'done'
// OR its merge has landed (worktrees.state = 'merged'), because review_task(skipVerify)
// deliberately parks a successfully merged task in WaitingForReview until the batch
// verify_merges runs -- gating on 'done' alone stalled every successor for the whole
// batch. Consequences, all deliberate: a failing verify_merges leaves the merges on the
// target branch, so successors do run (the predecessor's code is there either way);
// revert_merge/abort_merge flip the worktree back to 'active' and re-block; a rejected
// task (reject_rerun/reject_park) never reached 'merged' and stays unmet; a task with no
// worktree (handler task, empty diff) is only ever satisfied via 'done'. Unlike
// blocked_by_task_id there is no cascade on the dependency failing, so a task with a
// Failed dependency simply stays here, skipped, until someone intervenes. The depends-on
// clause is doubly negated on purpose: "no edge whose predecessor isn't satisfied" means
// a task with zero edges is eligible, ALL edges must be satisfied, and an edge pointing
// at a vanished task keeps blocking (same as the old single-column form did).
// EF SQLite stores DateTime as "yyyy-MM-dd HH:mm:ss.fffffff" — same format used here for comparison.
var rows = await ctx.Tasks.FromSqlRaw("""
@@ -41,7 +49,11 @@ public sealed class QueuePicker : IQueuePicker
WHERE td.task_id = t.id
AND NOT EXISTS (
SELECT 1 FROM tasks d
WHERE d.id = td.depends_on_task_id AND d.status = 'done'
WHERE d.id = td.depends_on_task_id
AND (d.status = 'done' OR EXISTS (
SELECT 1 FROM worktrees w
WHERE w.task_id = d.id AND w.state = 'merged'
))
)
)
ORDER BY t.sort_order ASC, t.created_at ASC
@@ -10,7 +10,7 @@ namespace ClaudeDo.Worker.Report;
public sealed class WeekReportService
{
private static readonly string[] DefaultExcludes = { @"C:\Private" };
private static readonly string[] DefaultExcludes = Array.Empty<string>();
private const string NoActivity = "_No activity in this period._";
private readonly IClaudeHistoryReader _reader;
@@ -72,7 +72,7 @@ public sealed class WeekReportService
IReadOnlyList<string> args =
[
"-p", "--output-format", "stream-json", "--verbose",
"--permission-mode", "auto",
"--permission-mode", PermissionModeResolver.Resolve(safeModel, "auto"),
"--model", safeModel,
];
var result = await _claude.RunAsync(args, prompt, Path.GetTempPath(), _ => Task.CompletedTask, ct);
@@ -290,8 +290,10 @@ public sealed class InteractiveLaunchSpecService
/// handlerTaskId (the id returned by CreateMergeHelperTaskAsync) is rendered into the brief so
/// the session can call handoff_list_handler/submit_task_for_review on its own handler task.
/// Throws KeyNotFoundException if the list doesn't exist; InvalidOperationException if
/// taskIds is empty or the list has no existing working directory.</summary>
public async Task<LaunchSpec> BuildForMergeHelperAsync(IReadOnlyList<string> taskIds, string listId, string handlerTaskId, CancellationToken ct)
/// taskIds is empty or the list has no existing working directory.
/// model overrides the triage session's model (start-modal dropdown); null/unknown falls
/// back to <see cref="ModelRegistry.HandlerTriageAlias"/>. Handoff phases are unaffected.</summary>
public async Task<LaunchSpec> BuildForMergeHelperAsync(IReadOnlyList<string> taskIds, string listId, string handlerTaskId, string? model, CancellationToken ct)
{
if (taskIds.Count == 0)
throw new InvalidOperationException("No tasks selected for the list handler.");
@@ -344,12 +346,13 @@ public sealed class InteractiveLaunchSpecService
// longer influences a handler session at all, it would otherwise apply the LIST's effort
// preset to a completely different model.
var settings = await new AppSettingsRepository(ctx).GetAsync(ct);
var triageModel = ModelRegistry.TryNormalizeAlias(model) ?? ModelRegistry.HandlerTriageAlias;
var args = new List<string>
{
"--model", ModelRegistry.HandlerTriageAlias,
"--effort", EffortFor(settings, ModelRegistry.HandlerTriageAlias),
"--permission-mode", PermissionModeResolver.Resolve(ModelRegistry.HandlerTriageAlias, "auto"),
"--model", triageModel,
"--effort", EffortFor(settings, triageModel),
"--permission-mode", PermissionModeResolver.Resolve(triageModel, "auto"),
"--allowedTools", MergeHelperAllowedTools,
"--add-dir", sessionDir, repoDir,
"--append-system-prompt-file", systemPromptPath,
+4 -6
View File
@@ -553,8 +553,6 @@ public sealed class TaskRunner
var transition = await _state.SubmitForChildrenAsync(task.Id, finishedAt, reviewResult, CancellationToken.None);
if (!transition.Ok)
_logger.LogWarning("SubmitForChildrenAsync rejected for task {TaskId}: {Reason}", task.Id, transition.Reason);
foreach (var child in pendingChildren)
await _state.EnqueueAsync(child.Id, CancellationToken.None);
await _broadcaster.WorkerLog(
$"Finished #{task.Number} \"{task.Title}\" (waiting on {pendingChildren.Count} improvement(s))",
WorkerLogLevel.Success, DateTime.UtcNow);
@@ -791,10 +789,10 @@ public sealed class TaskRunner
switch (result.TerminalReason)
{
case "max_turns":
var ofConfigured = configuredMaxTurns is int m ? $" von {m}" : "";
return $"Turn-Budget erschöpft ({result.TurnCount}{ofConfigured} Turns). "
+ "Erhöhe `maxTurns` am Task (`set_task_config`) und stelle den Task erneut in die Queue "
+ "– der Worktree bleibt erhalten.";
var ofConfigured = configuredMaxTurns is int m ? $" of {m}" : "";
return $"Turn budget exhausted ({result.TurnCount}{ofConfigured} turns). "
+ "Raise `maxTurns` on the task (`set_task_config`) and re-queue it "
+ "- the worktree is kept.";
case "api_error":
if (!string.IsNullOrWhiteSpace(result.ResultMarkdown)) return result.ResultMarkdown;
+33 -9
View File
@@ -159,16 +159,40 @@ public sealed class TaskStateService : ITaskStateService
public async Task<TransitionResult> SubmitForChildrenAsync(string taskId, DateTime finishedAt, string? result, CancellationToken ct)
{
await using var ctx = await _dbFactory.CreateDbContextAsync(ct);
var affected = await ctx.Tasks
.Where(t => t.Id == taskId && t.Status == TaskStatus.Running)
.ExecuteUpdateAsync(s => s
.SetProperty(t => t.Status, TaskStatus.WaitingForChildren)
.SetProperty(t => t.FinishedAt, finishedAt)
.SetProperty(t => t.Result, result), ct);
PlanningPhase planningPhase;
await using (var ctx = await _dbFactory.CreateDbContextAsync(ct))
{
var affected = await ctx.Tasks
.Where(t => t.Id == taskId && t.Status == TaskStatus.Running)
.ExecuteUpdateAsync(s => s
.SetProperty(t => t.Status, TaskStatus.WaitingForChildren)
.SetProperty(t => t.FinishedAt, finishedAt)
.SetProperty(t => t.Result, result), ct);
if (affected == 0)
return new TransitionResult(false, "Task not running; cannot submit for children.");
if (affected == 0)
return new TransitionResult(false, "Task not running; cannot submit for children.");
planningPhase = await ctx.Tasks.AsNoTracking()
.Where(t => t.Id == taskId)
.Select(t => t.PlanningPhase)
.FirstAsync(ct);
}
// A normal (non-planning) parent queues its own children as a sequential chain right
// here; a planning parent's children wait for the user's explicit "Queue plan" action
// (PlanningChainCoordinator.QueuePlanAsync), so leave those untouched. A child that's
// already Running makes SetupChainAsync throw — log it rather than fail this transition.
if (planningPhase == PlanningPhase.None)
{
try
{
await _chain.SetupChainAsync(taskId, enqueue: true, ct);
}
catch (Exception ex)
{
_logger.LogWarning(ex, "SetupChainAsync failed for parent {TaskId}", taskId);
}
}
await NotifyAsync(taskId);
return new TransitionResult(true, null);
@@ -6,7 +6,7 @@ using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Worker.Tickets;
public sealed record TicketImportResult(int Examined, int Created);
public sealed record TicketImportResult(int Examined, int Created, IReadOnlyList<string> CreatedTaskIds);
/// <summary>
/// Holt das Board des verknüpften Ticket-Projekts und legt für jedes offene, dem Token-Inhaber
@@ -61,16 +61,17 @@ public sealed class TicketImportService
var knownSet = known.ToHashSet(StringComparer.OrdinalIgnoreCase);
var repo = new TaskRepository(ctx);
var created = 0;
var created = new List<string>();
foreach (var ticket in mine)
{
var reference = $"bandel:{ticket.Id}";
if (!knownSet.Add(reference)) continue;
var taskId = Guid.NewGuid().ToString();
await repo.AddAsync(new TaskEntity
{
Id = Guid.NewGuid().ToString(),
Id = taskId,
ListId = listId,
Title = ticket.Title,
Description = BuildDescription(ticket),
@@ -79,14 +80,14 @@ public sealed class TicketImportService
TicketRef = reference,
CreatedBy = "ticketsystem",
}, ct);
created++;
created.Add(taskId);
}
_logger.LogInformation(
"Ticket-Import für Liste {list_id}: {examined} geprüft, {created} neue Tasks",
listId, board.Count, created);
listId, board.Count, created.Count);
return new TicketImportResult(board.Count, created);
return new TicketImportResult(board.Count, created.Count, created);
}
/// <summary>
@@ -0,0 +1,147 @@
using ClaudeDo.Data;
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories;
using Microsoft.EntityFrameworkCore;
namespace ClaudeDo.Data.Tests;
public sealed class ListFolderTests : IDisposable
{
private readonly string _dbPath;
private readonly DbContextOptions<ClaudeDoDbContext> _options;
public ListFolderTests()
{
_dbPath = Path.Combine(Path.GetTempPath(), $"claudedo_folders_{Guid.NewGuid():N}.db");
_options = new DbContextOptionsBuilder<ClaudeDoDbContext>()
.UseSqlite($"Data Source={_dbPath}")
.Options;
using var ctx = new ClaudeDoDbContext(_options);
ctx.Database.EnsureCreated();
}
public void Dispose()
{
foreach (var suffix in new[] { "", "-wal", "-shm" })
try { File.Delete(_dbPath + suffix); } catch { }
}
private ClaudeDoDbContext Open() => new(_options);
private static ListFolderEntity NewFolder(string id, string name = "Group") =>
new() { Id = id, Name = name, CreatedAt = DateTime.UtcNow };
[Fact]
public async Task Deleting_a_folder_keeps_its_lists_and_moves_them_to_the_top_level()
{
await using (var ctx = Open())
{
var repo = new ListRepository(ctx);
await repo.AddFolderAsync(NewFolder("f1"));
await repo.AddAsync(new ListEntity { Id = "l1", Name = "Inside", CreatedAt = DateTime.UtcNow, FolderId = "f1" });
}
await using (var ctx = Open())
await new ListRepository(ctx).DeleteFolderAsync("f1");
await using (var ctx = Open())
{
var list = await ctx.Lists.AsNoTracking().FirstAsync(l => l.Id == "l1");
Assert.Null(list.FolderId);
Assert.Empty(await ctx.ListFolders.AsNoTracking().ToListAsync());
}
}
[Fact]
public async Task RenameFolderAsync_keeps_sort_order_and_collapse_state()
{
// The whole reason it patches instead of Update()-ing a rebuilt entity: a rename must not
// silently unfold the folder or shuffle it to the top.
await using (var ctx = Open())
{
var repo = new ListRepository(ctx);
await repo.AddFolderAsync(NewFolder("f1", "First"));
await repo.AddFolderAsync(NewFolder("f2", "Second"));
await repo.SetFolderCollapsedAsync("f2", true);
}
await using (var ctx = Open())
await new ListRepository(ctx).RenameFolderAsync("f2", "Renamed", "Star");
await using (var ctx = Open())
{
var folder = await ctx.ListFolders.AsNoTracking().FirstAsync(f => f.Id == "f2");
Assert.Equal("Renamed", folder.Name);
Assert.Equal("Star", folder.Icon);
Assert.True(folder.IsCollapsed);
Assert.Equal(1, folder.SortOrder);
}
}
[Fact]
public async Task SetListFolderAsync_moves_a_list_in_and_back_out()
{
await using (var ctx = Open())
{
var repo = new ListRepository(ctx);
await repo.AddFolderAsync(NewFolder("f1"));
await repo.AddAsync(new ListEntity { Id = "l1", Name = "Roaming", CreatedAt = DateTime.UtcNow });
}
await using (var ctx = Open())
await new ListRepository(ctx).SetListFolderAsync("l1", "f1");
await using (var ctx = Open())
Assert.Equal("f1", (await ctx.Lists.AsNoTracking().FirstAsync(l => l.Id == "l1")).FolderId);
await using (var ctx = Open())
await new ListRepository(ctx).SetListFolderAsync("l1", null);
await using (var ctx = Open())
Assert.Null((await ctx.Lists.AsNoTracking().FirstAsync(l => l.Id == "l1")).FolderId);
}
[Fact]
public async Task ReorderSidebarAsync_numbers_folders_and_lists_in_one_sequence()
{
await using var ctx = Open();
var repo = new ListRepository(ctx);
await repo.AddFolderAsync(NewFolder("f1"));
await repo.AddAsync(new ListEntity { Id = "inside", Name = "Inside", CreatedAt = DateTime.UtcNow, FolderId = "f1" });
await repo.AddAsync(new ListEntity { Id = "top", Name = "Top", CreatedAt = DateTime.UtcNow });
// Sidebar: the top-level list above the folder, whose one child follows the folder.
await repo.ReorderSidebarAsync([("top", false), ("f1", true), ("inside", false)]);
Assert.Equal(0, (await repo.GetByIdAsync("top"))!.SortOrder);
Assert.Equal(1, (await repo.GetFoldersAsync()).Single().SortOrder);
Assert.Equal(2, (await repo.GetByIdAsync("inside"))!.SortOrder);
}
[Fact]
public async Task AddAsync_appends_past_the_folders_too()
{
await using var ctx = Open();
var repo = new ListRepository(ctx);
await repo.AddFolderAsync(NewFolder("f1"));
await repo.AddFolderAsync(NewFolder("f2"));
await repo.AddAsync(new ListEntity { Id = "l1", Name = "Fresh", CreatedAt = DateTime.UtcNow });
// 2, not 0 — a new list must not jump above the existing folders on the next load.
Assert.Equal(2, (await repo.GetByIdAsync("l1"))!.SortOrder);
}
[Fact]
public async Task AddFolderAsync_appends_in_creation_order()
{
await using var ctx = Open();
var repo = new ListRepository(ctx);
await repo.AddFolderAsync(NewFolder("f1", "One"));
await repo.AddFolderAsync(NewFolder("f2", "Two"));
var folders = await repo.GetFoldersAsync();
Assert.Equal(["One", "Two"], folders.Select(f => f.Name));
Assert.Equal([0, 1], folders.Select(f => f.SortOrder));
}
}
@@ -0,0 +1,84 @@
using System.Text;
using System.Text.Json;
namespace ClaudeDo.Localization.Tests;
/// <summary>
/// JsonDocument/JsonElement silently keep the last value on a duplicate key instead of throwing,
/// so a repeated top-level block (e.g. two "checks" objects) is invisible to JSON-validity and
/// parity tests alike. This walks the raw token stream instead.
/// </summary>
public class DuplicateLocaleKeysTests
{
private static string LocalesDir()
{
var dir = AppContext.BaseDirectory;
while (dir is not null)
{
var candidate = Path.Combine(dir, "src", "ClaudeDo.Localization", "locales");
if (Directory.Exists(candidate)) return candidate;
dir = Path.GetDirectoryName(dir);
}
throw new DirectoryNotFoundException("Could not locate src/ClaudeDo.Localization/locales");
}
private static List<string> FindDuplicateTopLevelKeys(string json)
{
var reader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json));
var seen = new HashSet<string>(StringComparer.Ordinal);
var duplicates = new List<string>();
var depth = 0;
while (reader.Read())
{
switch (reader.TokenType)
{
case JsonTokenType.StartObject:
case JsonTokenType.StartArray:
depth++;
break;
case JsonTokenType.EndObject:
case JsonTokenType.EndArray:
depth--;
break;
case JsonTokenType.PropertyName:
if (depth == 1)
{
var name = reader.GetString()!;
if (!seen.Add(name)) duplicates.Add(name);
}
break;
}
}
return duplicates;
}
[Fact]
public void Detects_duplicate_top_level_key_in_fixture()
{
const string json = """
{
"checks": { "a": "1" },
"other": { "b": "2" },
"checks": { "c": "3" }
}
""";
var duplicates = FindDuplicateTopLevelKeys(json);
Assert.Contains("checks", duplicates);
}
[Fact]
public void Locale_files_have_no_duplicate_top_level_keys()
{
var localesDir = LocalesDir();
foreach (var path in Directory.EnumerateFiles(localesDir, "*.json"))
{
var duplicates = FindDuplicateTopLevelKeys(File.ReadAllText(path));
Assert.True(duplicates.Count == 0,
$"{Path.GetFileName(path)} has duplicate top-level keys: {string.Join(", ", duplicates)}");
}
}
}

Some files were not shown because too many files have changed in this diff Show More