The JSON output from bd show now includes the dependency_type field for both dependencies and dependents, enabling programmatic differentiation between dependency types (blocks, related, parent-child, discovered-from). Implementation approach: - Added IssueWithDependencyMetadata type with embedded Issue and DependencyType field - Extended GetDependenciesWithMetadata and GetDependentsWithMetadata to include dependency type from SQL JOIN - Made GetDependencies and GetDependents wrap the WithMetadata methods for backward compatibility - Added scanIssuesWithDependencyType helper to handle scanning with dependency type field - Updated bd show --json to use WithMetadata methods Tests added: - TestGetDependenciesWithMetadata - basic functionality - TestGetDependentsWithMetadata - dependent retrieval - TestGetDependenciesWithMetadataEmpty - edge case handling - TestGetDependenciesWithMetadataMultipleTypes - multiple types Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -153,6 +153,13 @@ type DependencyCounts struct {
|
||||
DependentCount int `json:"dependent_count"` // Number of issues that depend on this issue
|
||||
}
|
||||
|
||||
// IssueWithDependencyMetadata extends Issue with dependency relationship type
|
||||
// Note: We explicitly include all Issue fields to ensure proper JSON marshaling
|
||||
type IssueWithDependencyMetadata struct {
|
||||
Issue
|
||||
DependencyType DependencyType `json:"dependency_type"`
|
||||
}
|
||||
|
||||
// IssueWithCounts extends Issue with dependency relationship counts
|
||||
type IssueWithCounts struct {
|
||||
*Issue
|
||||
|
||||
Reference in New Issue
Block a user