Fix daemon/direct mode inconsistency in graph commands (bd-fu83)
Commands relate, unrelate, duplicate, and supersede now properly use RPC Update when daemonClient is available, instead of always calling store.UpdateIssue() directly and bypassing the daemon. Added RelatesTo, DuplicateOf, and SupersededBy fields to UpdateArgs in the RPC protocol, and updated server_issues_epics.go to handle them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -122,20 +122,44 @@ func runRelate(cmd *cobra.Command, args []string) error {
|
||||
// Add id2 to issue1's relates_to if not already present
|
||||
if !contains(issue1.RelatesTo, id2) {
|
||||
newRelatesTo1 := append(issue1.RelatesTo, id2)
|
||||
if err := store.UpdateIssue(ctx, id1, map[string]interface{}{
|
||||
"relates_to": formatRelatesTo(newRelatesTo1),
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id1, err)
|
||||
formattedRelatesTo1 := formatRelatesTo(newRelatesTo1)
|
||||
if daemonClient != nil {
|
||||
// Use RPC for daemon mode (bd-fu83)
|
||||
_, err := daemonClient.Update(&rpc.UpdateArgs{
|
||||
ID: id1,
|
||||
RelatesTo: &formattedRelatesTo1,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id1, err)
|
||||
}
|
||||
} else {
|
||||
if err := store.UpdateIssue(ctx, id1, map[string]interface{}{
|
||||
"relates_to": formattedRelatesTo1,
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id1, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add id1 to issue2's relates_to if not already present
|
||||
if !contains(issue2.RelatesTo, id1) {
|
||||
newRelatesTo2 := append(issue2.RelatesTo, id1)
|
||||
if err := store.UpdateIssue(ctx, id2, map[string]interface{}{
|
||||
"relates_to": formatRelatesTo(newRelatesTo2),
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id2, err)
|
||||
formattedRelatesTo2 := formatRelatesTo(newRelatesTo2)
|
||||
if daemonClient != nil {
|
||||
// Use RPC for daemon mode (bd-fu83)
|
||||
_, err := daemonClient.Update(&rpc.UpdateArgs{
|
||||
ID: id2,
|
||||
RelatesTo: &formattedRelatesTo2,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id2, err)
|
||||
}
|
||||
} else {
|
||||
if err := store.UpdateIssue(ctx, id2, map[string]interface{}{
|
||||
"relates_to": formattedRelatesTo2,
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id2, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,18 +256,42 @@ func runUnrelate(cmd *cobra.Command, args []string) error {
|
||||
|
||||
// Remove id2 from issue1's relates_to
|
||||
newRelatesTo1 := remove(issue1.RelatesTo, id2)
|
||||
if err := store.UpdateIssue(ctx, id1, map[string]interface{}{
|
||||
"relates_to": formatRelatesTo(newRelatesTo1),
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id1, err)
|
||||
formattedRelatesTo1 := formatRelatesTo(newRelatesTo1)
|
||||
if daemonClient != nil {
|
||||
// Use RPC for daemon mode (bd-fu83)
|
||||
_, err := daemonClient.Update(&rpc.UpdateArgs{
|
||||
ID: id1,
|
||||
RelatesTo: &formattedRelatesTo1,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id1, err)
|
||||
}
|
||||
} else {
|
||||
if err := store.UpdateIssue(ctx, id1, map[string]interface{}{
|
||||
"relates_to": formattedRelatesTo1,
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id1, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove id1 from issue2's relates_to
|
||||
newRelatesTo2 := remove(issue2.RelatesTo, id1)
|
||||
if err := store.UpdateIssue(ctx, id2, map[string]interface{}{
|
||||
"relates_to": formatRelatesTo(newRelatesTo2),
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id2, err)
|
||||
formattedRelatesTo2 := formatRelatesTo(newRelatesTo2)
|
||||
if daemonClient != nil {
|
||||
// Use RPC for daemon mode (bd-fu83)
|
||||
_, err := daemonClient.Update(&rpc.UpdateArgs{
|
||||
ID: id2,
|
||||
RelatesTo: &formattedRelatesTo2,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id2, err)
|
||||
}
|
||||
} else {
|
||||
if err := store.UpdateIssue(ctx, id2, map[string]interface{}{
|
||||
"relates_to": formattedRelatesTo2,
|
||||
}, actor); err != nil {
|
||||
return fmt.Errorf("failed to update %s: %w", id2, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger auto-flush
|
||||
|
||||
Reference in New Issue
Block a user