Summary
Internal quality improvements that affect debugging, maintainability, and the developer experience when things go wrong.
Items
1. No custom error type
All errors are io::Error::other(string) — no structured variants, no error chaining, no ability to programmatically distinguish error kinds. Consider adopting thiserror with a DaggerError enum:
#[derive(thiserror::Error, Debug)]
enum DaggerError {
#[error("branch '{0}' is not tracked")]
BranchNotTracked(String),
#[error("operation in progress, run --continue or --abort")]
PendingOperation,
#[error("git: {0}")]
Git(#[source] io::Error),
// ...
}
2. No logging/tracing framework
Zero debug output anywhere in the codebase. When something fails, there is no way to get verbose diagnostics. Consider tracing with a DAGGER_LOG env var (or --verbose flag) to enable debug output.
3. No dgr diff command
Can't see the diff between a branch and its tracked parent without manually looking up the parent name. A dgr diff that defaults to diffing against the tracked parent would be natural.
4. Trunk branch immutable after init
If dgr init is run on the wrong branch, the only fix is manually editing .git/.dagger/config.json. A dgr config trunk <branch> or dgr init --trunk <branch> would help.
5. ratatui is unused dead weight
Cargo.toml declares ratatui = "0.30.0" and palette.rs has #[allow(dead_code)]. The dependency adds compile time and binary size for no current benefit. Either remove it until a TUI is implemented, or gate it behind a cargo feature flag.
6. Archived nodes never pruned from state
archived: true soft-deletes nodes but they remain in state.json forever. Over time, the file grows unboundedly. Consider pruning nodes that have been archived for > N days, or adding a dgr gc command.
7. DaggerState.nodes is a Vec — O(n) lookups
find_branch_by_name and find_branch_by_id do linear scans. For typical stacks (< 20 branches) this is fine, but a HashMap<Uuid, BranchNode> would be more idiomatic and future-proof.
8. Missing event types in event log
The event log captures BranchCreated, BranchAdopted, BranchArchived, BranchReparented, BranchPullRequestTracked — but is missing events for several important state changes:
BranchRestacked
BranchPushed
BranchMerged
PullRequestRetargeted
SyncCompleted
9. No event log reader
Events are written to events.ndjson but never read. A dgr log command to view the audit trail would aid debugging and provide history.
10. No distinct exit codes
exit_code_from_result returns either 0 (success) or 1 (failure). Distinct codes for different failure modes (2 = usage error, 3 = conflict, 4 = pending operation, etc.) would improve scriptability.
Summary
Internal quality improvements that affect debugging, maintainability, and the developer experience when things go wrong.
Items
1. No custom error type
All errors are
io::Error::other(string)— no structured variants, no error chaining, no ability to programmatically distinguish error kinds. Consider adoptingthiserrorwith aDaggerErrorenum:2. No logging/tracing framework
Zero debug output anywhere in the codebase. When something fails, there is no way to get verbose diagnostics. Consider
tracingwith aDAGGER_LOGenv var (or--verboseflag) to enable debug output.3. No
dgr diffcommandCan't see the diff between a branch and its tracked parent without manually looking up the parent name. A
dgr diffthat defaults to diffing against the tracked parent would be natural.4. Trunk branch immutable after init
If
dgr initis run on the wrong branch, the only fix is manually editing.git/.dagger/config.json. Adgr config trunk <branch>ordgr init --trunk <branch>would help.5. ratatui is unused dead weight
Cargo.tomldeclaresratatui = "0.30.0"andpalette.rshas#[allow(dead_code)]. The dependency adds compile time and binary size for no current benefit. Either remove it until a TUI is implemented, or gate it behind a cargo feature flag.6. Archived nodes never pruned from state
archived: truesoft-deletes nodes but they remain instate.jsonforever. Over time, the file grows unboundedly. Consider pruning nodes that have been archived for > N days, or adding adgr gccommand.7.
DaggerState.nodesis a Vec — O(n) lookupsfind_branch_by_nameandfind_branch_by_iddo linear scans. For typical stacks (< 20 branches) this is fine, but aHashMap<Uuid, BranchNode>would be more idiomatic and future-proof.8. Missing event types in event log
The event log captures
BranchCreated,BranchAdopted,BranchArchived,BranchReparented,BranchPullRequestTracked— but is missing events for several important state changes:BranchRestackedBranchPushedBranchMergedPullRequestRetargetedSyncCompleted9. No event log reader
Events are written to
events.ndjsonbut never read. Adgr logcommand to view the audit trail would aid debugging and provide history.10. No distinct exit codes
exit_code_from_resultreturns either 0 (success) or 1 (failure). Distinct codes for different failure modes (2 = usage error, 3 = conflict, 4 = pending operation, etc.) would improve scriptability.