Load reads .codemap/config.json from root. Returns zero-value ProjectConfig if the file is missing. Logs a warning to stderr and returns zero-value if JSON is malformed.
(root string)
| 206 | // Returns zero-value ProjectConfig if the file is missing. |
| 207 | // Logs a warning to stderr and returns zero-value if JSON is malformed. |
| 208 | func Load(root string) ProjectConfig { |
| 209 | data, err := os.ReadFile(ConfigPath(root)) |
| 210 | if err != nil { |
| 211 | return ProjectConfig{} |
| 212 | } |
| 213 | |
| 214 | var cfg ProjectConfig |
| 215 | if err := json.Unmarshal(data, &cfg); err != nil { |
| 216 | fmt.Fprintf(os.Stderr, "Warning: malformed .codemap/config.json: %v\n", err) |
| 217 | return ProjectConfig{} |
| 218 | } |
| 219 | return cfg |
| 220 | } |
| 221 | |
| 222 | // AssessSetup inspects .codemap/config.json and reports whether it should be |
| 223 | // initialized or tuned before deeper Codemap analysis. |