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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
//! Every name the tool says about itself, in one place (ADR-0064
//! `harness.renames`, plan "amont ships as greengate").
//!
//! Messages, usage text, error prefixes, `--version` lines and command hints
//! are built from these, never from a literal: a later name is one change
//! here. The names test (`crates/greengate/tests/it/names.rs`) fails on a new
//! literal `"amont "`, `"amont: "` or `"amont-fleet"` in any other source.
//!
//! The names the tool READS and WRITES are here too since greengate 4.0
//! (plan "greengate 4.0 renames its data names", a hard rename): the
//! `GREENGATE_` environment, the `greengate.` config keys, the state under
//! `$GIT_DIR` and the common dir, and the ledgers' headers. greengate 3.x's
//! spellings live only in `migrate.rs`, which moves them once; the names
//! test fails on an old data name anywhere else. Kept on purpose: the notes
//! namespaces (the old `amont-*` names, which only tests spell to prove they are ignored), the shim placeholder, and
//! the binary aliases above.
//!
//! In a format string, name the constant inline: `eprintln!("{BIN}: …")`.
//! For a `&'static str` built at compile time, use the [`bin!`] macro with
//! `concat!`.
/// The hook binary's name as a literal, for `concat!` in a `&'static str`.
/// The fleet binary's name as a literal, for `concat!` in a `&'static str`.
/// The product's name, as it introduces itself.
pub const PRODUCT: &str = "greengate";
/// The hook binary.
pub const BIN: &str = bin!;
/// The fleet binary.
pub const FLEET_BIN: &str = fleet_bin!;
/// The hook binary's old name, still installed as an alias (a copy).
pub const OLD_BIN: &str = "amont";
/// The fleet binary's old name, still installed as an alias (a copy).
pub const OLD_FLEET_BIN: &str = "amont-fleet";
/// The repository the releases come from.
pub const REPO: &str = "greenharness/greengate";
/// The one-line installer for Linux and macOS.
pub const INSTALLER_URL: &str =
"https://raw.githubusercontent.com/greenharness/greengate/main/install/install.sh";
/// The crate `cargo install` takes.
pub const CRATE: &str = "greengate";
/// The npm package.
pub const NPM_PACKAGE: &str = "@greenharness/greengate";
/// The Homebrew formula, tap-qualified.
pub const BREW_FORMULA: &str = "fredericrous/tap/greengate";
/// The git config namespace every key lives in (`greengate.timeout`).
pub const CONFIG_PREFIX: &str = "greengate.";
/// The environment namespace a host key answers to (`GREENGATE_TIMEOUT`).
pub const ENV_PREFIX: &str = "GREENGATE";
/// The folder of state under `$GIT_DIR` and the common dir (logs, land
/// receipts, pending detached runs).
pub const STATE_DIR: &str = "greengate";
/// The tree cache under `$GIT_DIR`.
pub const TREE_CACHE: &str = "greengate-cache";
/// Where the unstaged changes are parked during a check.
pub const HELD_STORE: &str = "greengate-held";
/// A held copy a mid-check edit displaced.
pub const PRESERVED_STORE: &str = "greengate-preserved";
/// The bypass ledger, and its header.
pub const BYPASS_LEDGER: &str = "greengate-bypasses";
pub const BYPASS_FORMAT: &str = "greengate-bypass-v1";
/// The downgrade ledger, and its header.
pub const DOWNGRADE_LEDGER: &str = "greengate-downgrades";
pub const DOWNGRADE_FORMAT: &str = "greengate-downgrade-v1";
/// The waves ledger, and its header.
pub const WAVES_LEDGER: &str = "greengate-waves";
pub const WAVES_FORMAT: &str = "greengate-waves-v1";
/// A rehearsal's state file, its log, and the state's header.
pub const REHEARSAL_STATE: &str = "greengate-rehearsal";
pub const REHEARSAL_LOG: &str = "greengate-rehearsal.log";
pub const REHEARSAL_FORMAT: &str = "greengate-rehearsal-v1";
/// The cold-cache warm worker's log under `$GIT_DIR`.
pub const WARM_LOG: &str = "greengate-warm.log";
/// The markers around a pack's block in the manifest, and the stem messages
/// quote.
pub const PACK_STEM: &str = "greengate:pack";
pub const PACK_START: &str = "# greengate:pack:start";
pub const PACK_END: &str = "# greengate:pack:end";
/// The `format` field of `greengate check --format json`.
pub const CHECK_FORMAT: &str = "greengate-check-v1";
/// The inline comment that waives a secret finding on its line.
pub const ALLOW_SECRET: &str = "greengate:allow-secret";
/// The message of the throwaway commit made for a stamped tree.
pub const STAMP_MESSAGE: &str = concat!;
/// The committed audit waivers file.
pub const AUDIT_WAIVERS: &str = ".greengate-audit-waivers";
/// The notes ref the release audit caches its verdicts in (local, never
/// pushed), and the header of each note.
pub const AUDIT_REF: &str = "greengate-audit";
pub const AUDIT_FORMAT: &str = "greengate-audit-v1";
/// The version-skew marker, and its header.
pub const SKEW_MARKER: &str = "greengate-skew";
pub const SKEW_FORMAT: &str = "greengate-skew-v1";
/// The held store's index header.
pub const HELD_FORMAT: &str = "greengate-held-v1";
/// The pre-commit → post-commit gate marker under `$GIT_DIR`. Its content
/// is the notes format (`greengate-gate-v1`, plan 3a-3 Phase 4).
pub const GATE_MARKER: &str = "greengate-gate";
/// The committed manifest a repository declares its checks in.
pub const MANIFEST: &str = "greengate.conf";
/// The file a pack repository declares its rows in.
pub const PACK_FILE: &str = "greengate.pack";
/// The markers around the block greengate generates in AGENTS.md and the
/// CLAUDE.md pointer.
pub const AGENTS_START: &str = "<!-- greengate:start -->";
pub const AGENTS_END: &str = "<!-- greengate:end -->";
/// The `list --json` envelope. Every greenbelay release and relais from
/// 0.54.0 read it and the old `amont-list-v1` alike.
pub const LIST_FORMAT: &str = "greengate-list-v1";
/// The migration's lock and its done-marker, in the common dir.
pub const MIGRATE_LOCK: &str = "greengate-migrate.lock";
pub const MIGRATED_MARKER: &str = "greengate-migrated";
/// The marker `greengate migrate --reverse` leaves in the common dir: the
/// first-run migration stands down until it is gone, so a 4.0 hook does
/// not move a rolled-back repository forward again before 3.x is installed.
pub const REVERSED_MARKER: &str = "greengate-reversed";
/// The name this tool holds a host slot under (`greengate slots`).
pub const SLOT_HOLDER: &str = "greengate";
/// The label every Job and Workflow of one run carries, read by `collect`
/// and the batched cluster reads.
pub const RUN_LABEL: &str = "greengate.run";
/// The annotations naming a cluster Job's gate and tree.
pub const GATE_ANNOTATION: &str = "greengate.dev/gate";
pub const TREE_ANNOTATION: &str = "greengate.dev/tree";
// The Kubernetes names below are a contract with homelab's
// `apps/greengate-gates`, which must define them; only the namespace can be
// overridden (`greengate.cluster.namespace`). A change to any of them follows
// the plan's two-change order: homelab adds the new name, then a release.
/// The namespace cluster gates run in, unless `greengate.cluster.namespace`
/// names another (homelab `apps/greengate-gates`).
pub const CLUSTER_NAMESPACE: &str = "greengate-gates";
/// `app.kubernetes.io/managed-by` on every Job and Workflow.
pub const MANAGED_BY: &str = "greengate";
/// A cluster Job's name before its slot number.
pub const JOB_PREFIX: &str = "greengate-gate-slot-";
/// A detached Workflow's name before its run label.
pub const WORKFLOW_PREFIX: &str = "greengate-rh-";
/// The ServiceAccount a detached Workflow's pods run as.
pub const EXECUTOR_ACCOUNT: &str = "greengate-gate-executor";
/// The Secret holding the snapshot repository's read token.
pub const READ_TOKEN_SECRET: &str = "greengate-bot-read-token";
/// The author and committer name of the commits this tool writes: a cluster
/// gate's throwaway commit and a detached run's snapshot.
pub const GIT_AUTHOR: &str = "greengate";
/// Their email.
pub const GIT_EMAIL: &str = "greengate@localhost";
/// greengate 3.x's names: what `migrate` moves, and the committed names
/// (manifest, pack, markers) read until the fleet sweep. Kept here, beside
/// the new ones, so no module depends on the migration to know them; the
/// census (Phase 6) removes the read-only ones.