1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Bundle type for loading user and project config together.
//!
//! [`LoadedConfigs::load`] runs the user-config disk load, the project-config
//! disk load, and a `project_identifier` cache warm-up on three scoped
//! threads. All three share `Repository`'s `Arc<RepoCache>` — clones are
//! cheap, and the `OnceCell`/`DashMap` entries each thread populates are
//! visible to every other clone (and to subsequent cache reads).
//!
//! ## When to use
//!
//! Call [`LoadedConfigs::load`] from command handlers that consume both
//! configs — alias dispatch, `wt config alias show`/`dry-run`,
//! `wt hook show`, hook execution, and any path whose downstream code calls
//! `Repository::load_project_config`.
//!
//! Sites that only consume `UserConfig` should call [`UserConfig::load`]
//! directly. The bundle loader reads `.config/wt.toml` and would emit
//! deprecation/unknown-field warnings from project config in commands that
//! never use it.
//!
//! ## Why not return a merged config?
//!
//! User and project configs serve different roles — user config is trusted,
//! project config requires command approval. Downstream merges
//! (`load_aliases`, hook resolution) keep the source distinction so
//! per-source policy can be applied. A flattened merged struct would erase
//! that.
//!
//! ## Warning ordering
//!
//! Both loads emit deprecation/unknown-field warnings to stderr inline.
//! Running them on sibling threads makes warning order nondeterministic
//! when both files have warnings. No existing test fixture exercises both
//! at once. Acceptable trade-off for the parallel savings; revisit with
//! a buffer-and-replay design if the ordering becomes a problem.
use Result;
use crateRepository;
use crateSpan;
use ;
/// User and project configs loaded together.
///
/// `project` is `None` when the repo has no `.config/wt.toml`.