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
89
90
91
92
93
94
95
96
//! What:
//! The policy engine:
//! the registry,
//! triggers,
//! events,
//! the passes over candidates and direct fixes.
//! Why:
//! Policies are the reason the wrapper exists,
//! so the engine and its shared pieces have one home.
//!
//! In TS you'd write (pseudocode):
//! ```ts
//! // policy/index.ts: one `export * from './file'` per module below.
//! ```
/// JSONL event rendering for wrapper-made diagnostics.
/// The fixed registry of shipped policies.
/// Lifecycle triggers and the trigger set of every shipped policy.
/// Policy events and their JSON Lines rendering.
/// A pathname as events report it:
/// text,
/// plus base64 `pathBytes` when it is not UTF-8.
/// Exact repository path bytes as the operating system takes them, and as text for messages.
/// Ordered policy execution for one lifecycle point.
/// The bounded loop that repeats a pass after corrections changed candidate content.
/// The intent-guessing hint that follows a finding, an engine failure or a notice.
/// The shipped policies as checks over rule cores and repository facts.
/// What a lifecycle offers content policies,
/// and its candidates once prepared.
/// The built-in final-newline policy:
/// canonical final LF,
/// preserved paths,
/// findings.
/// The optional root-context policy:
/// no top-level `CONTEXT.md` enters the index.
/// The optional catalog-specifier policy over the shared rule crate:
/// every dependency in a tracked `package.json` is a catalog or workspace reference.
/// The optional forbidden-strings policy over the linked scanner,
/// with redacted findings.
/// Installing a direct fix's corrections into the worktree,
/// all or none.
/// The direct fix:
/// converge corrections in memory,
/// then install them.
/// The fixed argument transforms of a forwarded command,
/// in order.
/// One complete pass:
/// built-in policies,
/// fixed transforms,
/// optional policies.
/// The work of the installed cli-git that is not ported,
/// and the refusal notice.
/// A scripted repository-facts provider for unit tests;
/// never in the release build.
pub