| 160 | } |
| 161 | |
| 162 | func configShow(root string) { |
| 163 | assessment := config.AssessSetup(root) |
| 164 | cfgPath := config.ConfigPath(root) |
| 165 | switch assessment.State { |
| 166 | case config.SetupStateMissing: |
| 167 | fmt.Println("No config file found.") |
| 168 | fmt.Printf("Run 'codemap config init' to create %s\n", cfgPath) |
| 169 | return |
| 170 | case config.SetupStateEmpty: |
| 171 | fmt.Println("Config is empty (no filters active).") |
| 172 | if len(assessment.Reasons) > 0 { |
| 173 | fmt.Println(assessment.Reasons[0]) |
| 174 | } |
| 175 | return |
| 176 | case config.SetupStateMalformed: |
| 177 | fmt.Println("Config is malformed or unreadable.") |
| 178 | if len(assessment.Reasons) > 0 { |
| 179 | fmt.Println(assessment.Reasons[0]) |
| 180 | } |
| 181 | fmt.Printf("Fix %s or rerun 'codemap config init' to recreate it.\n", cfgPath) |
| 182 | return |
| 183 | } |
| 184 | |
| 185 | cfg := config.Load(root) |
| 186 | fmt.Printf("Config: %s\n", cfgPath) |
| 187 | fmt.Println() |
| 188 | if len(cfg.Only) > 0 { |
| 189 | fmt.Printf(" only: %s\n", strings.Join(cfg.Only, ", ")) |
| 190 | } |
| 191 | if len(cfg.Exclude) > 0 { |
| 192 | fmt.Printf(" exclude: %s\n", strings.Join(cfg.Exclude, ", ")) |
| 193 | } |
| 194 | if cfg.Depth > 0 { |
| 195 | fmt.Printf(" depth: %d\n", cfg.Depth) |
| 196 | } |
| 197 | if strings.TrimSpace(cfg.Mode) != "" { |
| 198 | fmt.Printf(" mode: %s\n", cfg.ModeOrDefault()) |
| 199 | } |
| 200 | if cfg.Budgets.SessionStartBytes > 0 || cfg.Budgets.DiffBytes > 0 || cfg.Budgets.MaxHubs > 0 { |
| 201 | fmt.Println(" budgets:") |
| 202 | if cfg.Budgets.SessionStartBytes > 0 { |
| 203 | fmt.Printf(" session_start_bytes: %d\n", cfg.Budgets.SessionStartBytes) |
| 204 | } |
| 205 | if cfg.Budgets.DiffBytes > 0 { |
| 206 | fmt.Printf(" diff_bytes: %d\n", cfg.Budgets.DiffBytes) |
| 207 | } |
| 208 | if cfg.Budgets.MaxHubs > 0 { |
| 209 | fmt.Printf(" max_hubs: %d\n", cfg.Budgets.MaxHubs) |
| 210 | } |
| 211 | } |
| 212 | if strings.TrimSpace(cfg.Routing.Retrieval.Strategy) != "" || cfg.Routing.Retrieval.TopK > 0 || len(cfg.Routing.Subsystems) > 0 { |
| 213 | fmt.Println(" routing:") |
| 214 | if strings.TrimSpace(cfg.Routing.Retrieval.Strategy) != "" || cfg.Routing.Retrieval.TopK > 0 { |
| 215 | fmt.Printf(" retrieval: strategy=%s top_k=%d\n", cfg.RoutingStrategyOrDefault(), cfg.RoutingTopKOrDefault()) |
| 216 | } |
| 217 | if len(cfg.Routing.Subsystems) > 0 { |
| 218 | fmt.Printf(" subsystems: %d configured\n", len(cfg.Routing.Subsystems)) |
| 219 | const maxShown = 5 |