Add --show-all-paths flag to bd dep tree

Implements bd-9: Allow users to view all paths through diamond dependencies
without deduplication. Useful for debugging complex dependency structures.

Changes:
- Added --show-all-paths flag to bd dep tree command
- Updated GetDependencyTree interface to accept showAllPaths parameter
- Modified deduplication logic to be conditional on flag
- Updated tests to pass new parameter

Amp-Thread-ID: https://ampcode.com/threads/T-43807dd5-8732-49ad-a839-cdb5dae70c35
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-18 11:52:57 -07:00
parent f44fc34761
commit d2e34b863b
5 changed files with 26 additions and 20 deletions

View File

@@ -177,8 +177,9 @@ var depTreeCmd = &cobra.Command{
defer store.Close()
}
showAllPaths, _ := cmd.Flags().GetBool("show-all-paths")
ctx := context.Background()
tree, err := store.GetDependencyTree(ctx, args[0], 50)
tree, err := store.GetDependencyTree(ctx, args[0], 50, showAllPaths)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
@@ -274,6 +275,7 @@ var depCyclesCmd = &cobra.Command{
func init() {
depAddCmd.Flags().StringP("type", "t", "blocks", "Dependency type (blocks|related|parent-child|discovered-from)")
depTreeCmd.Flags().Bool("show-all-paths", false, "Show all paths to nodes (no deduplication for diamond dependencies)")
depCmd.AddCommand(depAddCmd)
depCmd.AddCommand(depRemoveCmd)
depCmd.AddCommand(depTreeCmd)