| 1 | #!/usr/bin/env bash |
| 2 | # valley — the S1 integrator's verbs, as a plain shell script. |
| 3 | # |
| 4 | # EVICTION CLAUSE (owner-ratified; the decision node is |
| 5 | # archive/.the-valley/decisions/dcr-74c3158-valley-cli-lifecycle.md). |
| 6 | # This tool is deliberately a shell script: it runs from any checkout with |
| 7 | # nothing but git and coreutils — no machinery, the portability stance of |
| 8 | # ida-b9f646c. It GRADUATES to its own repo and a real language the moment |
| 9 | # ANY tripwire is crossed: |
| 10 | # - it grows past ~300 lines; |
| 11 | # - it needs persistent state, config, or a daemon |
| 12 | # (CROSSED by review's notes, which outlive the session in |
| 13 | # $XDG_STATE_HOME/valley/notes.); |
| 14 | # - it needs dependencies beyond git + coreutils |
| 15 | # (CROSSED by Phase 1's tail/replay, which need the nats CLI, and again |
| 16 | # by checks, which needs the cue CLI, again by review's [a]pprove, which |
| 17 | # needs the attest helper, and again by status, ready, unready and |
| 18 | # withdraw, which are a Go program (status/) this script runs — |
| 19 | # graduation is now due; recording the decision node is part of taking it.); |
| 20 | # - its behavior gets subtle enough to need real tests |
| 21 | # (CROSSED by checks: glob matching is pinned by the policy-deriver |
| 22 | # flake check, not by reading the code.); |
| 23 | # - it needs nontrivial parsing or concurrency |
| 24 | # (CROSSED by checks: glob-to-regex translation and -z diff parsing.). |
| 25 | # The size tripwire (~300 lines) is crossed too. Which way to take the |
| 26 | # graduation is dcr-2aa1a12, still `proposed`. |
| 27 | # Graduation is a deliberate act, recorded as a decision node. |
| 28 | |
| 29 | set -euo pipefail |
| 30 | |
| 31 | # Every verb reads the repository's own objects. A replacement ref makes one |
| 32 | # object stand in for another wherever git looks it up, so a fetched or |
| 33 | # planted refs/replace/* could change the diff a reviewer reads, the policy |
| 34 | # a derivation composes, and the tree a request is filed for. git is told |
| 35 | # to ignore them, whatever configuration says, and the variables that point |
| 36 | # it at other objects or at another replacement namespace are dropped. What |
| 37 | # chooses the repository and the person's own configuration are kept: a |
| 38 | # fetch of the owning valley needs that configuration, and neither changes |
| 39 | # what an object id reads as once replacement refs are off. |
| 40 | export GIT_NO_REPLACE_OBJECTS=1 |
| 41 | unset GIT_REPLACE_REF_BASE GIT_GRAFT_FILE GIT_OBJECT_DIRECTORY GIT_ALTERNATE_OBJECT_DIRECTORIES |
| 42 | |
| 43 | # The version the package stamped on this script when nix built it |
| 44 | # (nix/packages.nix): the CLI's version and the commit it was built from. |
| 45 | # A script run straight from a checkout has none. It is taken here and |
| 46 | # unset, so no program this script runs inherits a stamp that is not its |
| 47 | # own; self-update is handed it explicitly. |
| 48 | VALLEY_STAMP="${VALLEY_VERSION:-}" |
| 49 | unset VALLEY_VERSION |
| 50 | |
| 51 | # When this invocation started, in microseconds, for its command record |
| 52 | # (valley help telemetry). Reading the clock starts no process. |
| 53 | TEL_T0="${EPOCHREALTIME/[.,]/}" |
| 54 | |
| 55 | die() { |
| 56 | printf 'valley: %s\n' "$*" >&2 |
| 57 | exit 1 |
| 58 | } |
| 59 | |
| 60 | usage() { |
| 61 | cat <<'EOF' |
| 62 | usage: valley <verb> [args] |
| 63 | |
| 64 | valley — S1 integrator verbs for a valley project: author, review, approve, and |
| 65 | track changes and the plan graph. |
| 66 | |
| 67 | Authoring and updating changes: |
| 68 | ready mark a branch head ready as a new version of its change |
| 69 | unready pause a ready change by marking it a draft |
| 70 | withdraw mark a ready or draft change withdrawn |
| 71 | rebase rebase a change and its stack onto origin/main |
| 72 | checks print the checks the composed policy requires of a diff |
| 73 | |
| 74 | Reviewing, approving, and inspecting changes: |
| 75 | pending list what needs an approval, in landing order, and what moves |
| 76 | review page through a change or stack to approve, rebase, or reject |
| 77 | approve run required checks and file an integration request |
| 78 | status read a change's integration request and last outcome |
| 79 | changes print every recorded change as valley-changes/v1 JSON |
| 80 | |
| 81 | Planning work: |
| 82 | plan show the project's plan graph as a milestone tree |
| 83 | knot read and write knots in the plan graph at refs/the-valley/knots |
| 84 | |
| 85 | Bus and client maintenance: |
| 86 | tail watch NATS bus events scroll by |
| 87 | replay publish ref-updated events for the current refs of a repo |
| 88 | self-update build, test, and install the tip of a branch of the-valley |
| 89 | telemetry read a valley host's diagnostics over ssh (observe grant) |
| 90 | |
| 91 | A change is named by its 32-letter change id, its handle (shortest unique |
| 92 | prefix, at least 4 letters, or <repo>:<handle>), or its branch name. |
| 93 | Runs from any checkout; nix run .#valley bundles git, valley-go, attest, cue, |
| 94 | less, and natscli (self-update also needs nix). Judgment stays with the human: |
| 95 | nothing here writes main. |
| 96 | |
| 97 | `valley --version` prints the package's version and commit (e.g. 0.1.0-97db597, |
| 98 | with -dirty for uncommitted changes, -unknown when nix knew no commit, or |
| 99 | unstamped when run straight from a checkout). |
| 100 | Run `valley help <verb>` (or `valley <verb> --help`) for a verb's flags and |
| 101 | rules. See docs/reference.md for the full CLI, ref, and schema reference. |
| 102 | EOF |
| 103 | } |
| 104 | |
| 105 | help_naming() { |
| 106 | cat <<'EOF' |
| 107 | |
| 108 | A change is named by its full change id, by its handle — the shortest |
| 109 | prefix of the id, four letters at least, that no other change recorded on |
| 110 | origin shares, written <repo>:<handle> too, with this repository's name — |
| 111 | or by its branch. A name written origin/<branch> is always |
| 112 | a branch. A handle that is also a branch on origin is refused unless the |
| 113 | change is on that branch. review, approve and rebase read a branch name, |
| 114 | written either way, against every record on origin: when exactly one |
| 115 | record's active version is on the branch, the name is that change, as if |
| 116 | its id were given, and when more than one's is, the verb refuses and lists |
| 117 | their ids. A change that has landed as any version — its head is on |
| 118 | main's first-parent history with no merge above it, or the integrator's |
| 119 | outcome record and verified transfer statement record that exact head |
| 120 | landing — is skipped, unless its active version was made on that landing, so a branch can be used again once its change has |
| 121 | landed. unready, withdraw and status read a branch the same way. A |
| 122 | branch no record's active version is on is acted on as a branch. A |
| 123 | change with a record is reviewed, approved and rebased at the |
| 124 | head its active version records, never at its branch's tip: review shows |
| 125 | that head and its [a]pprove approves it, and rebase and review's |
| 126 | [r]eject refuse, naming both, when the branch's tip on origin is another |
| 127 | commit. approve approves the head bound to it, wherever the branch is. |
| 128 | [r]eject deletes the branch under a lease on the recorded head. approve, |
| 129 | and rebase refuse a change whose record is not ready, naming its state, |
| 130 | and review offers neither [a]pprove nor [r]eject for a change that is not |
| 131 | ready when it shows it. approve and rebase read the record again just |
| 132 | before they act, and again before approve files or rebase pushes, and |
| 133 | refuse when the change is not ready. review reads the change again before |
| 134 | its [a]pprove or [r]eject acts. When the change has moved since review |
| 135 | showed it, returned to draft, withdrawn, given a new version or landed, |
| 136 | review says so in one line and moves on, without asking again. rebase also refuses when the change's |
| 137 | record has changed at all since it began, and approve when the head it |
| 138 | approves is not a version's. A name that read as a plain branch is |
| 139 | read again before approve files or rebase pushes. If it names a change by |
| 140 | then, rebase refuses, and approve files only while the change is ready at |
| 141 | the head it began with. An approval already past that last check can |
| 142 | still file if the change is unreadied or withdrawn in the moment before |
| 143 | its push; the integrator refuses to land it, since it lands no request |
| 144 | that would bring a version of a change that is not ready, whatever the |
| 145 | request is named. |
| 146 | The integrator reads the records last just before it moves main, so a |
| 147 | change paused in that moment can still land at the head the operator |
| 148 | approved, and never at any other. |
| 149 | EOF |
| 150 | } |
| 151 | |
| 152 | help_runtime() { |
| 153 | cat <<'EOF' |
| 154 | |
| 155 | Runs from any checkout of the project; needs only git and coreutils, |
| 156 | except tail and replay, which also need the nats CLI (natscli), checks, |
| 157 | which also needs the cue CLI, review's notes, which need less, approve |
| 158 | and review's [a]pprove, which need both the cue CLI and the attest |
| 159 | helper, and status, ready, unready, withdraw, review, approve and rebase, |
| 160 | which need the valley-go helper, as pending, changes, knot, plan and |
| 161 | self-update do. nix run .#valley bundles all of them. self-update also |
| 162 | needs nix. Deriving a policy fetches the owning valley's repository, so |
| 163 | checks and approving also need whatever reaching it takes. |
| 164 | No config but valley.principal, which ready, rebase, knot and plan read, |
| 165 | and valley.selfUpdate.repo and .branch, which self-update reads; no batch |
| 166 | mode; and no state but the notes file, the handle cache pending and |
| 167 | changes write for completion, and self-update's record of what it |
| 168 | installed — the judgment stays with the human. |
| 169 | EOF |
| 170 | } |
| 171 | |
| 172 | help_unready_withdraw_requests() { |
| 173 | cat <<'EOF' |
| 174 | the integrator lands no request that would bring a |
| 175 | version of a change that is not ready, so unready and |
| 176 | withdraw both stop a |
| 177 | pending integration request, under c-<change id> or a |
| 178 | branch's request name. each says so when origin holds |
| 179 | one. a draft's request stands and lands once the change |
| 180 | is ready again. withdrawing voids the request: the |
| 181 | integrator deletes it on its next pass while the change |
| 182 | is still withdrawn. withdraw warns, since a ready before |
| 183 | then leaves the request standing: only a holder of the |
| 184 | approve grant (also accepted as request) may touch a |
| 185 | request ref, so the operator must drop it then. |
| 186 | EOF |
| 187 | } |
| 188 | |
| 189 | help_pending() { |
| 190 | cat <<'EOF' |
| 191 | usage: valley pending [--all] [--repo <name>] [--checks] [--drafts] [--branches] [--json] [-v] [--known-signers <file>] [--integrator-name <name>] |
| 192 | |
| 193 | pending [--all] [--repo <name>] [--checks] [--drafts] [--branches] |
| 194 | [--json] [-v] [--known-signers <file>] [--integrator-name <name>] |
| 195 | list what waits on you and what is moving. one line |
| 196 | on main's state comes first for each project whose |
| 197 | policy declares follow checks: clear, clearing or |
| 198 | muddy. needs you holds the ready changes that wait on |
| 199 | an approval, one numbered row each in landing order: |
| 200 | oldest ready first, as the check worker builds them, |
| 201 | then by project and change id. a row gives the |
| 202 | handle and active version, its checks as passed out of |
| 203 | required (or how many are pending), and how long it |
| 204 | has been ready, with its title under it. a stack of |
| 205 | such changes is one row, its top's, saying `stack of |
| 206 | N`: approving the top lands every layer. moving holds |
| 207 | the ready changes that need no approval now, one line |
| 208 | each: ◐ approved, waiting on checks and the |
| 209 | integrator; ✗ a check failed, named; ✗ or ◇ a restack |
| 210 | holds it. older versions are never listed. a last line |
| 211 | counts the drafts and the branches no change is on. |
| 212 | lines fit the terminal, or 80 columns off one; titles |
| 213 | are cut short with …, names never. names are bold and |
| 214 | glyphs coloured on a terminal unless NO_COLOR is set. |
| 215 | --all every project the serving host |
| 216 | publishes, as one listing: each line |
| 217 | names its project, and the rows of |
| 218 | every project share one landing order |
| 219 | (see valley help changes) |
| 220 | --repo NAME that one project |
| 221 | --checks add to each row the checks the policy |
| 222 | requires of it, by cost, as checks |
| 223 | derives them, and its full check state, |
| 224 | naming the checks that failed and what |
| 225 | they cost the host's check worker to |
| 226 | build. with --json, give each pending |
| 227 | change its checks object |
| 228 | --drafts list the drafts in full, in place of |
| 229 | their count |
| 230 | --branches list the branches no change is on in |
| 231 | full, in place of their count. each |
| 232 | draft and branch is a block: its name |
| 233 | with its head's age and author, its |
| 234 | title, then the commits and the diff |
| 235 | it adds to the nearest listed entry |
| 236 | its head contains, or to main. a stack |
| 237 | is its top, then every entry the top |
| 238 | contains, at one indentation; an entry |
| 239 | not on the one listed after it says |
| 240 | `on <base>` |
| 241 | --json print valley-pending/v1: the |
| 242 | valley-changes/v1 shape, with the |
| 243 | pending changes in changes, each |
| 244 | marked approved or not, and the |
| 245 | drafts in drafts |
| 246 | -v follow each row with its block, its |
| 247 | stack drawn in full, with what its |
| 248 | head includes, `uncertain` when it may |
| 249 | have landed without its evidence |
| 250 | stored, and its full check state; and |
| 251 | warn on stderr when a plan graph is |
| 252 | missing or unreadable |
| 253 | --known-signers FILE, --integrator-name NAME |
| 254 | what a transfer statement is verified |
| 255 | with (see changes below) |
| 256 | reading the checks costs seconds for each project |
| 257 | with a ready change. needs the valley-go helper. |
| 258 | EOF |
| 259 | help_runtime |
| 260 | } |
| 261 | |
| 262 | help_changes() { |
| 263 | cat <<'EOF' |
| 264 | usage: valley changes --json [--all] [--repo <name>] [--checks] [-v] [--known-signers <file>] [--integrator-name <name>] |
| 265 | |
| 266 | changes --json [--all] [--repo <name>] [--checks] [-v] |
| 267 | [--known-signers <file>] [--integrator-name <name>] |
| 268 | print every change origin holds a record of, in every |
| 269 | state, as one JSON object, valley-changes/v1, for front |
| 270 | ends to read (docs/architecture.md): each version's |
| 271 | head, title and branch, how far it has landed |
| 272 | (landed, landed-recorded, uncertain or not-landed), |
| 273 | its pending request and its last outcome, the knots in |
| 274 | refs/the-valley/knots that link it |
| 275 | (valley:<project>/<change id>, active first), and |
| 276 | the branches no change is on. -v warns on stderr when a |
| 277 | plan graph is missing or unreadable. --checks adds |
| 278 | checks to the active version of each ready change that |
| 279 | has not landed: each check the policy requires of it, |
| 280 | passed, failed or pending by the note the integrator |
| 281 | would judge it by on origin, and other for a check the |
| 282 | host's worker does not run (docs/reference.md). each nix |
| 283 | check also gives its build time for this version, and |
| 284 | the median of its recent builds, from the host's |
| 285 | worker telemetry; when that cannot be read, those |
| 286 | fields are left out and stderr says why. it costs a |
| 287 | few seconds for each project with such a change. |
| 288 | handles are unique across |
| 289 | everything listed: a change id recorded in more than |
| 290 | one repository listed has the handle <repo>:<prefix> |
| 291 | in each. without --all it covers this |
| 292 | repository. --all covers every project the serving |
| 293 | host lists at refs/the-valley/projects in its instance |
| 294 | repository, which policy/valley names at main's tip on |
| 295 | origin; each project's URL is the instance's with its |
| 296 | last path segment replaced, and is read through a clone |
| 297 | kept under $XDG_CACHE_HOME/valley/repos. a url that |
| 298 | opens with a dash, names a <transport>:: helper such |
| 299 | as ext::, or has a scheme other than ssh, git, https or |
| 300 | file is refused. a repository that cannot be read is |
| 301 | listed with its error. --repo limits it to one |
| 302 | project. landed means on main's first-parent history |
| 303 | with no merge above it. landed-recorded needs a landed |
| 304 | commit with one parent and the integrator's transfer |
| 305 | statement for the version's request name, verified; |
| 306 | the integrator's outcome record for that name saying |
| 307 | land at the version's head; and the integrator's merge |
| 308 | of the head onto the landed commit's parent giving the |
| 309 | landed tree. attest verifies the statement with the |
| 310 | registry's known-signers file and the integrator's |
| 311 | signing name. each is taken from the first of these |
| 312 | that gives it: --known-signers FILE or |
| 313 | --integrator-name NAME; VALLEY_KNOWN_SIGNERS or |
| 314 | VALLEY_INTEGRATOR_SIGNER; what the serving host |
| 315 | publishes at refs/the-valley/signers in its instance |
| 316 | repository, read only when a statement needs |
| 317 | verifying. a file that does not read, or holds no key |
| 318 | under the name, is reported on stderr, and then no |
| 319 | statement is verified. |
| 320 | needs the valley-go helper. |
| 321 | EOF |
| 322 | help_runtime |
| 323 | } |
| 324 | |
| 325 | help_review() { |
| 326 | cat <<'EOF' |
| 327 | usage: valley review [-v] [--build-here] <change> |
| 328 | valley review [-v] [--build-here] [--repo <name>] |
| 329 | |
| 330 | review [-v] [--build-here] [--repo <name>] |
| 331 | with no change, review each change that needs you, as |
| 332 | valley pending --all lists them, in landing order, or |
| 333 | those of the project --repo names. each step opens |
| 334 | with `[1/3] <project> · <handle> v<N> · <checks>` and |
| 335 | is the review below, run where the project is read: |
| 336 | this checkout, or the clone valley keeps of another |
| 337 | project, lent this checkout's valley.principal, |
| 338 | user.name and user.email. a change that landed, is |
| 339 | not ready or has no branch since is not reviewed; one |
| 340 | at a new version is reviewed at it. the walk ends with |
| 341 | each change's outcome and what still needs you. a |
| 342 | project that did not read is said first and last. |
| 343 | ctrl-c ends the walk with what it walked, exit 130. |
| 344 | |
| 345 | review [-v] [--build-here] <change> |
| 346 | page through the change's branch: its log, with each |
| 347 | commit's whole message, and diff vs origin/main, or a |
| 348 | stack layer by layer (below). above |
| 349 | each change's diff, review shows every knot in the plan |
| 350 | graph that links the change, as `does oc-6335749 (open): |
| 351 | <title>` (valley-go does). a missing or unreadable graph |
| 352 | shows no knots; -v warns on stderr. before the prompt, a |
| 353 | ready change shows the state of its checks and what |
| 354 | they cost the host's check worker to build, as pending |
| 355 | --checks shows it: `checks: 21 passed in 9m10s (eval |
| 356 | 24s); worker-e2e 431s, +100s against its recent 331s`. |
| 357 | review reads them while it shows the diff and never |
| 358 | waits for them: a line not read by the prompt is not |
| 359 | shown, unless VALLEY_REVIEW_CHECKS_WAIT=<seconds> says |
| 360 | how long to wait for it. checks that cannot be read show no line; -v |
| 361 | warns on stderr. the prompt is one header line, the |
| 362 | change and its state, `nqyw v3 · checks: 4 passed · |
| 363 | behind main (integrator merges)`, then the keys it |
| 364 | takes; a change that can't be approved says why in the |
| 365 | header and is not offered [a]pprove. -v also passes -v |
| 366 | to approve. then choose: |
| 367 | [a]pprove file an integration request for the |
| 368 | head shown, as approve does (valley |
| 369 | help approve). it reuses the evidence |
| 370 | origin holds for the checks the |
| 371 | composed policy requires of this |
| 372 | change. when a required nix check has |
| 373 | none, it files the request at once |
| 374 | all the same, builds nothing, and |
| 375 | names the check. when evidence is |
| 376 | published, the integrator considers |
| 377 | the request again; it may never be |
| 378 | published. given |
| 379 | --build-here, review's [a]pprove builds |
| 380 | those nix checks here instead. it runs |
| 381 | the command checks, and any nix check |
| 382 | it builds, over a throwaway worktree of |
| 383 | that head, signs each result as an |
| 384 | attestation, and publishes the evidence |
| 385 | and the request ref to origin in ONE |
| 386 | atomic push. this files the request; |
| 387 | it does not wait for integration or |
| 388 | update your local checkout. use status |
| 389 | to read the result. the policy comes |
| 390 | from the target's tip and the owning |
| 391 | valley's, as checks describes (valley |
| 392 | help checks), so your checkout |
| 393 | can be on any branch. a change the policy |
| 394 | requires no check of is filed too, as a |
| 395 | request with no evidence, and says so. |
| 396 | approving a change already requested is |
| 397 | how it is filed again. at a head rebased |
| 398 | onto a moved main it replaces the request |
| 399 | ref under a lease and names the head it |
| 400 | replaced; at the same head it leaves the |
| 401 | ref alone and publishes only the new |
| 402 | evidence, which origin refuses when |
| 403 | this signer has already attested that |
| 404 | tree: approve publishes a signer's |
| 405 | evidence for a tree once (bd-7b7d58f). every write of the request |
| 406 | ref is leased, filing included, so an |
| 407 | approval that lost a race is refused |
| 408 | rather than clobbering the one that won. |
| 409 | needs the attest helper whenever a |
| 410 | check is required, and |
| 411 | VALLEY_ATTEST_KEY, the ed25519 key this |
| 412 | host signs with, whenever a check runs |
| 413 | here; VALLEY_ATTEST_NAME is the name it |
| 414 | signs under, defaulting to this host's. |
| 415 | [v]iew full diff |
| 416 | page the change's whole diff, with |
| 417 | notes taken as below, and ask again |
| 418 | [r]eject delete the remote branch (confirmed first) |
| 419 | [s]kip do nothing |
| 420 | a change with a record is first set against its |
| 421 | approved version: the greatest version below the one |
| 422 | shown whose exact head an integration request or a |
| 423 | land, stale or reject outcome on origin names, under |
| 424 | c-<change id> or a branch name of the change that |
| 425 | nothing else maps to (valley-go compare). with none, |
| 426 | or an ambiguous one, review pages the whole diff. its |
| 427 | first line says what changed since you approved v<m>: |
| 428 | `<change> v<n> at <head>: rebased since you approved |
| 429 | v<m> at <old head>, with the same file changes.` |
| 430 | each version's diff from its merge base with main |
| 431 | changes the same files the same way (valley-delta-v1). |
| 432 | review prints the commits main landed between the |
| 433 | bases, and pages nothing. |
| 434 | `... rebased since you approved v<m> at <old head>.` |
| 435 | the commits are the same patches, messages and |
| 436 | authors, but main also edited files the change edits. |
| 437 | review pages each file whose change differs, with the |
| 438 | landings that edited it, then the shown version's diff |
| 439 | of those files. |
| 440 | `... edited since you approved v<m> at <old head>.` |
| 441 | a commit's patch, message or author differs. review |
| 442 | pages how many commits changed, the files whose change |
| 443 | differs with the landings that edited them, git |
| 444 | range-diff of the two versions, and the shown |
| 445 | version's diff of those files, or prints a changed |
| 446 | message or author when the files are the same. -v adds |
| 447 | each file's mode and SHA-256 in each version. on a |
| 448 | terminal, unless NO_COLOR is set, the title, the |
| 449 | section headings and the hashes are styled; the buffer |
| 450 | the editor opens is plain. this is information only: |
| 451 | it files nothing and skips no check. |
| 452 | when [a]pprove's checks fail, the prompt says approving |
| 453 | needs a new head and stops offering [a]pprove until the |
| 454 | change has one. any other refusal keeps the prompt as |
| 455 | it was. |
| 456 | [a]pprove files the head shown, for a branch no record |
| 457 | is on too: it refuses, naming both heads, when the |
| 458 | branch on origin has moved off that head since. |
| 459 | [a]pprove is the only way a change reaches main from |
| 460 | here, and approve (valley help approve) is the same act |
| 461 | without the pager. |
| 462 | Nothing in review writes the protected ref: the |
| 463 | integrator does, having judged the request. |
| 464 | a change behind main (one that does not fast-forward |
| 465 | from it) is asked the same prompt, under one line: |
| 466 | `<branch> is behind main; the integrator lands it |
| 467 | onto main as main stands (no rebase needed).` |
| 468 | the integrator applies the change's delta onto main as |
| 469 | it stands, and the host's restacker rebases ready |
| 470 | changes itself, so review asks nothing more of it. |
| 471 | while the restacker reports a conflict for the change, |
| 472 | the line says `<branch> conflicts with main; its owner |
| 473 | is resolving it.` instead. [a]pprove is still offered, |
| 474 | and the integrator decides whether the change applies. |
| 475 | to rebase a change of your own, use valley rebase. |
| 476 | a change whose record is not ready says so above its |
| 477 | diff, and again in place of the prompt, which then |
| 478 | offers only [v]iew full diff and [s]kip: |
| 479 | `<change> v<n> is a draft: its owner (<owner>) hasn't |
| 480 | marked it ready, so it can't be approved yet.` |
| 481 | `<change> is withdrawn: there is nothing to approve.` |
| 482 | a draft is often a change an agent is still working on. |
| 483 | [a]pprove would be refused. [r]eject records nothing |
| 484 | on the change: it would only delete a branch its owner |
| 485 | may still be working on. |
| 486 | before [a]pprove or [r]eject acts, review reads the |
| 487 | change again. when it moved while you read it, review |
| 488 | says what changed in one line, and acts on nothing |
| 489 | unless you approve a new version it offers: |
| 490 | `<change> changed while you were reviewing: it was |
| 491 | returned to draft (since <time>), so there is |
| 492 | nothing to approve now. It comes back when it is |
| 493 | ready again.` |
| 494 | `<change> changed while you were reviewing: it was |
| 495 | withdrawn (since <time>), so there is nothing to |
| 496 | approve.` |
| 497 | `<change> moved to v<n> while you were reviewing |
| 498 | (<why>) · [a]pprove v<n>, [v]iew what changed |
| 499 | since v<m>, [s]kip?` |
| 500 | `<change> landed as v<n> while you were reviewing; |
| 501 | there is nothing left to approve.` |
| 502 | <time> is when the record last changed, in UTC. |
| 503 | a new version with the same changes and commits, such |
| 504 | as a restack the carry mode allows, keeps the answer: |
| 505 | `<change> moved to v<n> while you were reviewing. |
| 506 | v<n> is v<m> rebased onto the new main with no |
| 507 | other changes, so your approval covers it.` |
| 508 | and [a]pprove files v<m>, the head shown. its verdict |
| 509 | names v<n>, which lands, with v<n>'s checks. otherwise |
| 510 | <why> says whether the change's commits changed or |
| 511 | only main moved under them, and why the answer does |
| 512 | not carry. with its commits unchanged, [a]pprove v<n> |
| 513 | is offered at once; with a commit changed, only after |
| 514 | [v]iew. [a] files v<n>'s head, and is refused if the |
| 515 | change moves again first. |
| 516 | a branch no record is on has no state, and is offered |
| 517 | the usual prompt. |
| 518 | while paging, press v: less opens the diff in $EDITOR. |
| 519 | every line you insert there is a note. it is anchored to |
| 520 | the file and new-side line it sits on — to the file alone |
| 521 | when it sits above the first hunk. range-diff gives no |
| 522 | line numbers, so set against an approved version a |
| 523 | note keeps its file and line only in the section |
| 524 | headed `── v<n>'s diff of these files against main`. each note is then appended to |
| 525 | $XDG_STATE_HOME/valley/notes/<branch>.md (default |
| 526 | ~/.local/state) and printed after the verdict. notes |
| 527 | survive a stack's [b]ase onto main. lines you change |
| 528 | or delete instead of inserting are ignored, with a |
| 529 | warning. |
| 530 | a change whose active version names no branch is |
| 531 | refused, since notes and [r]eject act on a branch; |
| 532 | approve files its head without one. |
| 533 | a stack is reviewed one layer at a time, bottom first. |
| 534 | a layer below the top that is approved, as pending |
| 535 | lists it, is named in the list and not paged: it asks |
| 536 | nothing of you. the top is always paged. |
| 537 | its layers are what pending lists under the change: the |
| 538 | changes not landed and the branches no record is on |
| 539 | that its head contains (valley-go stack). review first |
| 540 | lists them, warns of a lower layer that is a draft or |
| 541 | withdrawn, since the integrator lands nothing above it, |
| 542 | and says how the review goes: [n] through the layers, |
| 543 | and approving the top lands them all. a stack whose |
| 544 | bottom does not fast-forward from main is then asked, |
| 545 | before any layer is paged, under `<top> · stack of <n> |
| 546 | · behind main`: |
| 547 | [b]ase onto main |
| 548 | rebase the whole stack onto origin/main, |
| 549 | as rebase does (valley help rebase), then |
| 550 | list it again and page the rebased layers, |
| 551 | so the heads paged are the heads approved |
| 552 | [v]iew diff page the top's whole diff against main |
| 553 | [s]kip end the review; nothing done |
| 554 | a rebase that is refused or left unfinished says what |
| 555 | happened, and then only [v]iew diff and [s]kip are |
| 556 | offered. |
| 557 | it then shows each layer, headed `change <k> of <n>: |
| 558 | <name> on <below>`, as a change alone is shown: set |
| 559 | against its own change's approved version, or its log |
| 560 | and diff against the layer below it paged, with notes |
| 561 | kept under that layer's branch. |
| 562 | after each lower layer it asks, naming the layer and |
| 563 | its place, as in `two, 2 of 3:`: |
| 564 | [n]ext layer go on to the layer above; the usual |
| 565 | answer |
| 566 | [a]pprove approve that layer at the head shown, |
| 567 | as review of it would. this lands it |
| 568 | and every layer under it, which the |
| 569 | prompt names (`one alone`, `one and |
| 570 | two`, `the <k> up to <name>`), and |
| 571 | ends the review |
| 572 | [v]iew full diff |
| 573 | page that layer's log and diff against |
| 574 | the layer below it, and ask again |
| 575 | [s]top end the review; nothing done |
| 576 | after the top it asks, as in `three, 3 of 3:`: |
| 577 | [a]pprove all <n> |
| 578 | approve the top at the head shown, |
| 579 | which lands every layer |
| 580 | [v]iew full diff |
| 581 | page the top's log and diff against |
| 582 | the layer below it, and ask again |
| 583 | [r]eject <name> |
| 584 | delete the top's branch (confirmed |
| 585 | first) |
| 586 | [s]top end the review; nothing done |
| 587 | only the top is offered [r]eject. when a layer's checks |
| 588 | fail, its prompt says approving needs a new head and |
| 589 | stops offering [a]pprove, as for any change. a layer |
| 590 | that is not ready says so as a change alone does, under |
| 591 | its heading and in its prompt. neither it nor any layer |
| 592 | above it is offered [a]pprove, since approving one would |
| 593 | land it: each prompt above it says `it would bring |
| 594 | <name>, change <k> of <n>, which is a draft` (or |
| 595 | withdrawn) in its place. a top that is not ready is not |
| 596 | offered [r]eject either. every layer's notes are printed |
| 597 | at the end. |
| 598 | EOF |
| 599 | help_naming |
| 600 | help_runtime |
| 601 | } |
| 602 | |
| 603 | help_approve() { |
| 604 | cat <<'EOF' |
| 605 | usage: valley approve [-v] [--head <sha>] [--build-here] <change> |
| 606 | |
| 607 | approve [-v] [--head <sha>] [--build-here] <change> |
| 608 | do what review's [a]pprove does for the change, without |
| 609 | paging it: the same checks, the same refusals, the same |
| 610 | leased request write and the same output. exits non-zero |
| 611 | when it refuses. a change with a record is approved at |
| 612 | exactly one head, and its request is filed as |
| 613 | refs/the-valley/integration-requests/main/c-<change id>, |
| 614 | at that head: |
| 615 | --head SHA approve exactly this head, which must be |
| 616 | one of the record's version heads, |
| 617 | active or not. a front end passes the |
| 618 | head it showed, so a record that moves |
| 619 | after review cannot change what lands. |
| 620 | without --head, approve shows the active version's head |
| 621 | and title and asks to confirm them, on a terminal; off |
| 622 | one it refuses. a branch no record is on is approved at |
| 623 | its tip on origin, which --head must name if it is |
| 624 | given (review's [a]pprove files the head it showed, and |
| 625 | refuses once the branch on origin has moved off it), under |
| 626 | the branch's request name: the branch with |
| 627 | each / replaced by -. a branch whose request name would |
| 628 | be c-<change id> is refused, since that name is the |
| 629 | change's. |
| 630 | approve first reads the evidence origin holds for that |
| 631 | head's tree, refs/the-valley/attestations/<tree>/*, byte |
| 632 | for byte. it judges each required nix check by the note |
| 633 | the integrator judges it by: the first, in ref order, |
| 634 | that attest verify accepts under the known-signers file |
| 635 | the host publishes. it reuses that note when it is pure |
| 636 | evidence for the check's name and flake attribute and |
| 637 | says it passed. VALLEY_KNOWN_SIGNERS, when set, must |
| 638 | accept it too: it can narrow what is reused, never widen |
| 639 | it. a required nix check whose judged note records a |
| 640 | failure refuses the approval, since the integrator |
| 641 | judges the check by that note. a command check is never |
| 642 | reused. a listing or a fetch of |
| 643 | origin's evidence that fails is refused, and nothing is |
| 644 | run. |
| 645 | a required nix check that origin holds no evidence for |
| 646 | does not stop the approval. approve files the request at |
| 647 | once, with the evidence origin holds, builds nothing, |
| 648 | and publishes no evidence for that check. required |
| 649 | command checks still run first, and a missing signing |
| 650 | key, a failed check, or a refused push still fails the |
| 651 | approval. approve says the approval is recorded and |
| 652 | how many checks it waits for. the integrator keeps the |
| 653 | request and considers it again when evidence is |
| 654 | published. landing still requires a clean apply and |
| 655 | acceptable evidence for every required check. an |
| 656 | enabled worker that serves the project attempts the nix |
| 657 | checks of a ready change's active version, but cannot |
| 658 | add checks to its own existing evidence ref for the |
| 659 | same tree, and a failed build publishes nothing. waiting |
| 660 | does not ensure the evidence will be published. no |
| 661 | worker builds a branch no record is on, or a version |
| 662 | that is not the active one, and approve says so and |
| 663 | offers --build-here. the |
| 664 | evidence of an approval that ran a command check |
| 665 | occupies this signer's ref for the tree, so use |
| 666 | --build-here on the initial approval. |
| 667 | --build-here build those nix checks on this |
| 668 | machine instead, and publish their |
| 669 | evidence with the request. |
| 670 | approve runs every command check, and every nix check |
| 671 | it builds, over a throwaway worktree of that head, signs |
| 672 | each result as an attestation, and publishes the new |
| 673 | evidence and the request ref to origin in ONE atomic |
| 674 | push. when every required check is reused, nothing |
| 675 | runs, no signing key is needed, and the push carries |
| 676 | the request alone. |
| 677 | this files the request; it does not wait for |
| 678 | integration or update your local checkout. use status to |
| 679 | read the result. the policy comes from the target's tip |
| 680 | and the owning valley's, as checks describes (valley help |
| 681 | checks), so your checkout can be on any branch. a change |
| 682 | the policy requires no check of is filed too, as a |
| 683 | request with no evidence, and says so. approving a |
| 684 | change already requested is how it is filed again: at a |
| 685 | head rebased onto a moved main it replaces the request |
| 686 | ref under a lease and names the head it replaced; at the |
| 687 | same head it leaves the ref alone and publishes only the |
| 688 | new evidence. origin already holding this signer's |
| 689 | evidence for that tree, without a check that still has |
| 690 | to run, is refused before anything runs: approve |
| 691 | publishes a signer's evidence for a tree once, as a |
| 692 | ref of the new notes alone, and origin keeps every |
| 693 | note the ref holds (bd-7b7d58f). every |
| 694 | write of the request ref |
| 695 | is leased, filing included, so an approval that lost a |
| 696 | race is refused rather than clobbering the one that won. |
| 697 | needs the attest helper whenever a check is required, |
| 698 | and VALLEY_ATTEST_KEY, the ed25519 key this host signs |
| 699 | with, whenever a check has to run here; |
| 700 | VALLEY_ATTEST_NAME is the name it signs under, |
| 701 | defaulting to this host's. approve never writes the |
| 702 | protected ref: the integrator does, having judged the |
| 703 | request. |
| 704 | approve refuses, before any check runs, a head that does |
| 705 | not fast-forward from main and would bring a version of |
| 706 | another change that has not landed: a layer above the |
| 707 | bottom of a stale stack. the refusal names the command |
| 708 | that rebases the stack, valley rebase <change>. this is |
| 709 | the project's choice, not a rule the integrator needs: |
| 710 | approved as it is, the stack would land as one commit |
| 711 | recorded against this request alone, so the changes |
| 712 | under it would have no landing record of their own, and |
| 713 | the checks would run over a head that has to be rebased |
| 714 | anyway. a stale head with no change under it, such as |
| 715 | the bottom layer of a stack or a change alone, is |
| 716 | approved as it is, and the integrator merges it onto |
| 717 | main. |
| 718 | approve ends in one verdict line: the change, whether |
| 719 | it was approved, and what happens next, with one |
| 720 | indented line under it only when you must act: |
| 721 | ✓ nqyw v3 approved · checks passed · landing on main |
| 722 | ◐ nqyw v3 approved · lands when 3 checks pass (1/4 passed) |
| 723 | ◇ nqyw v3 approved · waiting for 2 checks (no worker building) |
| 724 | run: valley approve --build-here nqyw |
| 725 | ⊘ nqyw v3 not approved · change is a draft |
| 726 | run: valley ready --change <id> <branch> |
| 727 | a refusal goes to stderr. checks built here show one |
| 728 | line of progress, and a failed check's log. the glyphs |
| 729 | are in colour on a terminal unless NO_COLOR is set. |
| 730 | -v, --verbose also print what approve read and |
| 731 | published: the checks it reuses and who |
| 732 | signed them, the tree's digest, the |
| 733 | evidence and request refs, and the |
| 734 | checks' own output and timings. |
| 735 | approve times each required check it runs, and |
| 736 | appends one JSON line per check to the timing log, |
| 737 | $XDG_STATE_HOME/valley/timings.jsonl (default |
| 738 | ~/.local/state/valley/timings.jsonl). the log stays on |
| 739 | this machine and is not evidence; a log that cannot be |
| 740 | written is a warning, and approving goes on. |
| 741 | EOF |
| 742 | help_naming |
| 743 | help_runtime |
| 744 | } |
| 745 | |
| 746 | help_rebase() { |
| 747 | cat <<'EOF' |
| 748 | usage: valley rebase [--known-signers <file>] [--integrator-name <name>] <change> |
| 749 | |
| 750 | rebase [--known-signers <file>] [--integrator-name <name>] <change> |
| 751 | rebase the change's whole stack onto origin/main, as |
| 752 | review's [b]ase onto main does: the layers valley-go stack |
| 753 | lists under the change, and the change itself. in a |
| 754 | throwaway worktree, bottom first, each layer's own commits |
| 755 | go onto the rebased layer below it, and the bottom's onto |
| 756 | origin/main, so each layer keeps its own diff. commits |
| 757 | under the bottom that a lower change landed through the |
| 758 | integrator drop out, since main holds them; that landing |
| 759 | is read as changes reads it, with the signers its two |
| 760 | flags, VALLEY_KNOWN_SIGNERS and VALLEY_INTEGRATOR_SIGNER, |
| 761 | or the host's publication give. one atomic |
| 762 | push then moves every layer's branch, each leased on the |
| 763 | tip read: every branch moves, or none does. last, bottom |
| 764 | first, each change gains its rebased head as a new |
| 765 | version, as valley.principal names, the way ready |
| 766 | --if-active does: only while the change is still ready |
| 767 | at the head the rebase began with. |
| 768 | it refuses, with nothing changed, a stack holding a |
| 769 | change that is not ready, records no branch, or whose |
| 770 | branch is missing on origin or is not at its recorded |
| 771 | head; a plain branch that is the branch of a change not |
| 772 | in the stack; two layers on one branch; a merge among the |
| 773 | commits to be rebased, or a version head of a change |
| 774 | that is not ready or not in the stack, since a rebase |
| 775 | gives each commit a new id; and a stack holding a change |
| 776 | while git config valley.principal names no one. a |
| 777 | conflict in any layer pushes nothing, records nothing |
| 778 | and names the layer. |
| 779 | a change alone prints its new head. a |
| 780 | stack prints a manifest: one line for each layer, with |
| 781 | its old and new head, whether its branch was pushed, and |
| 782 | whether a version was added. then, for each change left |
| 783 | unfinished, the valley ready command that finishes it, |
| 784 | and the exit status is non-zero. rebasing again refuses |
| 785 | a change whose branch holds a head no version records, |
| 786 | and prints the same command. last, it names each ready |
| 787 | change or branch outside the stack that is left on an |
| 788 | old head of a layer, such as a second stack on a lower |
| 789 | layer, with the rebase that moves it; it does not move |
| 790 | it. rebase does not re-review the result. a stack that |
| 791 | already fast-forwards from main is left as it is. |
| 792 | EOF |
| 793 | help_naming |
| 794 | help_runtime |
| 795 | } |
| 796 | |
| 797 | help_status() { |
| 798 | cat <<'EOF' |
| 799 | usage: valley status [--json] [-v] [--known-signers <file>] [--integrator-name <name>] <change> |
| 800 | |
| 801 | status [--json] [-v] [--known-signers <file>] [--integrator-name <name>] |
| 802 | <change> |
| 803 | read the request and the integrator's last decision from |
| 804 | origin. distinguish waiting, a decision that needs |
| 805 | attention, and a change integrated into origin/main. |
| 806 | a change with a record is read at its active version's |
| 807 | head, under c-<change id>, and the status says the |
| 808 | version, its title, the owner, and how far the version |
| 809 | has landed, as changes reads it. a change that landed |
| 810 | as an older version is read at that version's head. a refusal for a record |
| 811 | that is not ready, or for a merge in the change's |
| 812 | commits, is a state of its own. |
| 813 | after integration, show how to update the local checkout. |
| 814 | fetches objects without moving local branches or files; |
| 815 | no checks run and no request is filed. |
| 816 | --json print the status as one JSON object, |
| 817 | valley-status/v1, for front ends to read |
| 818 | (docs/architecture.md), with the knots |
| 819 | in the plan graph that link the change. |
| 820 | an error prints no object: it goes to |
| 821 | stderr and the exit status is non-zero. |
| 822 | -v with --json, warn on stderr when the plan |
| 823 | graph is missing or unreadable |
| 824 | --known-signers FILE, --integrator-name NAME |
| 825 | what a transfer statement is verified |
| 826 | with, as changes reads them |
| 827 | needs the valley-go helper. |
| 828 | EOF |
| 829 | help_naming |
| 830 | help_runtime |
| 831 | } |
| 832 | |
| 833 | help_ready() { |
| 834 | cat <<'EOF' |
| 835 | usage: valley ready [--head <sha>] [--change <id>] [--if-active <sha>] [--stamp] [<branch>] |
| 836 | |
| 837 | ready [--head <sha>] [--change <id>] [--if-active <sha>] [--stamp] [<branch>] |
| 838 | mark a head of the branch ready, as a new version of its |
| 839 | change, in the change's record on origin: |
| 840 | refs/the-valley/changes/main/<change id>. the branch |
| 841 | defaults to the current one. the head is --head, or else |
| 842 | origin/<branch>, and it must be on origin already. the |
| 843 | first ready of a change makes v1; each later one adds |
| 844 | the next version, at a head other than the active |
| 845 | version's. a draft or a withdrawn change comes back this |
| 846 | way: at the active version's head, it is ready again at |
| 847 | that version, and at another head it gains the next |
| 848 | version. prints the handle and version, e.g. |
| 849 | `app nxvp v2 ready`. |
| 850 | the change id is --change, else the head commit's jj |
| 851 | change-id header, else a Change-Id: trailer in its |
| 852 | message, else a new one, which is printed. a header and |
| 853 | a trailer that disagree are refused. so is a change |
| 854 | whose commits from its merge base with origin/main hold |
| 855 | a merge, or that has more than one merge base. |
| 856 | --if-active SHA |
| 857 | add the version only while the change |
| 858 | is ready at an active version whose head |
| 859 | is SHA. the record ref is leased on the |
| 860 | record read, so nothing comes between |
| 861 | that check and the write. rebase readies |
| 862 | the head it rebased this way. |
| 863 | --stamp amend the head of your local branch to |
| 864 | carry the id as a Change-Id: trailer and |
| 865 | push the branch, leased, before marking it |
| 866 | ready. it only starts a new change: it |
| 867 | is refused for a change that has a |
| 868 | record on origin already, and for a head |
| 869 | already on origin. |
| 870 | the record names the principal your key pushes as, read |
| 871 | from git config valley.principal; the host refuses one |
| 872 | naming anyone else. the record ref is pushed leased on |
| 873 | the value read. a new change is owned by the principal |
| 874 | that readies it, and a later version may come from its |
| 875 | owner, the operator, or a restack holder while the |
| 876 | change is ready. |
| 877 | a record never makes anything land, and approve is |
| 878 | still the only way to main. the integrator reads |
| 879 | records only to refuse: it lands no request that would |
| 880 | bring a version of a change that is not ready. |
| 881 | needs the valley-go helper. |
| 882 | EOF |
| 883 | help_naming |
| 884 | help_runtime |
| 885 | } |
| 886 | |
| 887 | help_unready() { |
| 888 | cat <<'EOF' |
| 889 | usage: valley unready <change> |
| 890 | |
| 891 | unready <change> |
| 892 | make a ready change a draft in its record on origin, as |
| 893 | its owner or the operator. a draft is a pause: it voids |
| 894 | nothing, and approvals of its active version stand when |
| 895 | it is readied again. ready brings it back. prints e.g. |
| 896 | `app nxvp v2 draft`. needs the valley-go helper. |
| 897 | EOF |
| 898 | help_unready_withdraw_requests |
| 899 | help_naming |
| 900 | help_runtime |
| 901 | } |
| 902 | |
| 903 | help_withdraw() { |
| 904 | cat <<'EOF' |
| 905 | usage: valley withdraw <change> |
| 906 | |
| 907 | withdraw <change> |
| 908 | mark a ready change or a draft withdrawn in its record |
| 909 | on origin, as its owner or the operator. withdrawing |
| 910 | voids everything outstanding on the change: its |
| 911 | integration requests, and the approvals and reviews of |
| 912 | every version, so a change brought back needs fresh |
| 913 | approvals. ready brings it back, at the same version |
| 914 | or a new one. prints e.g. `app nxvp v2 withdrawn`. |
| 915 | needs the valley-go helper. |
| 916 | EOF |
| 917 | help_unready_withdraw_requests |
| 918 | help_naming |
| 919 | help_runtime |
| 920 | } |
| 921 | |
| 922 | help_knot() { |
| 923 | cat <<'EOF' |
| 924 | usage: valley knot <verb> [args] |
| 925 | |
| 926 | knot <verb> [args] |
| 927 | read and write the project's plan graph: knots, at |
| 928 | refs/the-valley/knots on origin. a knot is an outcome, |
| 929 | a bug, an idea or a question; `knot schema` prints the |
| 930 | types, their statuses, active and terminal, the fields |
| 931 | and the edges. a write is one commit on the ref, made |
| 932 | without a checkout and pushed with a lease on the tip |
| 933 | it was made on; no review is involved. a write that |
| 934 | loses the lease is made again on the new tip, up to 5 |
| 935 | tries. every verb takes --project NAME, another |
| 936 | project on the same host, and --json. exit status 3 |
| 937 | is a conflict. needs the valley-go helper, and |
| 938 | git config valley.principal for every write. |
| 939 | new <type> <title> [--parent ID] [--blocked-by ID]... |
| 940 | [--owner P] [--target PROJECT] [--body -] |
| 941 | make a knot. its id is the type's prefix |
| 942 | and 7 hex digits of the sha-256 of the |
| 943 | title's slug. |
| 944 | show <id> [--at COMMIT] [--json] |
| 945 | its fields, body and comments, each |
| 946 | comment with its id, and the edges both |
| 947 | ways. --at shows the knot at a commit of |
| 948 | the graph; claim age uses the current |
| 949 | clock, and other projects' knots use |
| 950 | their current tips. |
| 951 | log <id> [--json] |
| 952 | every commit of the graph that touched |
| 953 | the knot or its comments, newest first: |
| 954 | time, committer, operation, and the |
| 955 | files it added, changed or deleted |
| 956 | list [--type T] [--status S] [--owner P] [--ready] |
| 957 | every knot. --status takes a status, |
| 958 | active or terminal. --ready lists the |
| 959 | active, unclaimed knots whose blockers |
| 960 | are all terminal. |
| 961 | set <id> <field>=<value>... [--if <field>=<value>]... |
| 962 | [--force] |
| 963 | change status, title, source, owner, |
| 964 | target or graduated_into. a field that |
| 965 | another write changed meanwhile is a |
| 966 | conflict unless --force. --if requires |
| 967 | a field to hold a value first. |
| 968 | link <id> (--blocked-by ID | --parent ID | --change X)... |
| 969 | unlink <id> (--blocked-by ID | --parent ID | --change X)... |
| 970 | add or drop an edge. a change is |
| 971 | valley:<project>/<change id> or a github |
| 972 | pull request url. outcomes and bugs link |
| 973 | the changes that do the work, and a |
| 974 | question links the change that records |
| 975 | its answer in the source. |
| 976 | edit <id> --body - |
| 977 | replace the body with stdin |
| 978 | comment <id> (-m TEXT | --body -) [--edit COMMENT-ID] |
| 979 | add a comment. --edit replaces the body |
| 980 | of the comment with that id; its author |
| 981 | and file stay, and it records who edited |
| 982 | it and when. only the comment's author |
| 983 | or a holder of the approve grant may |
| 984 | edit it. a comment that another edit |
| 985 | changed meanwhile is a conflict. |
| 986 | comments are never deleted; log and |
| 987 | show --at read every earlier text. |
| 988 | claim <id> --run RUN |
| 989 | claim an active outcome or bug for a |
| 990 | run; an open outcome becomes |
| 991 | in-progress. a knot claimed already is |
| 992 | a conflict. |
| 993 | unclaim <id> |
| 994 | release the claim. a claim that |
| 995 | changes before the release lands is |
| 996 | a conflict. |
| 997 | schema [--json] |
| 998 | print the model |
| 999 | EOF |
| 1000 | help_runtime |
| 1001 | } |
| 1002 | |
| 1003 | help_plan() { |
| 1004 | cat <<'EOF' |
| 1005 | usage: valley plan [--project NAME | --all] [--owner P] [--json] [--known-signers <file>] [--integrator-name <name>] |
| 1006 | |
| 1007 | plan [--project NAME | --all] [--owner P] [--json] |
| 1008 | [--known-signers <file>] [--integrator-name <name>] |
| 1009 | show the project's plan graph as a tree, to see where |
| 1010 | things stand. the roots are the outcomes with no |
| 1011 | parent, the milestones, each with its progress: its |
| 1012 | descendants that are terminal and not abandoned, out |
| 1013 | of those not abandoned, as a count and a bar. under |
| 1014 | each come its children, indented, in the order they |
| 1015 | were created, then by title. each knot has a glyph for |
| 1016 | its state (○ ready, ◐ in progress, ⊘ blocked, ◇ |
| 1017 | active, ✓ done, ✗ abandoned), its id and title, and, |
| 1018 | while active, its claim and the claim's age (marked |
| 1019 | stale past a day), its owner, and what blocks it. a |
| 1020 | blocker that ended abandoned, discarded, superseded or |
| 1021 | dropped clears the knot, and is marked with how it |
| 1022 | ended. a reference to another project's knot, |
| 1023 | <project>:<id>, is marked dangling when that |
| 1024 | project's graph cannot be read or holds no such knot. |
| 1025 | a root whose descendants are all terminal is one |
| 1026 | line. three sections follow. waiting on you: the |
| 1027 | active outcomes and bugs and the open questions the |
| 1028 | operator owns, then the changes ready for |
| 1029 | approval, as pending lists them. in flight: the |
| 1030 | claimed knots, oldest claim first. open residuals: |
| 1031 | the open bugs, under their parent. the operator is |
| 1032 | git config valley.principal, or --owner. lines fit |
| 1033 | the terminal as pending's do; glyphs are coloured on |
| 1034 | a terminal unless NO_COLOR is set. |
| 1035 | --project NAME another project on the same host |
| 1036 | --all every project the serving host |
| 1037 | publishes, each under its name, as |
| 1038 | pending --all reads them. a project |
| 1039 | that cannot be read is reported in |
| 1040 | its own section |
| 1041 | --owner P read P as the operator |
| 1042 | --json print valley-plan/v1: every knot with |
| 1043 | what the graph derives of it, and the |
| 1044 | three sections (docs/architecture.md) |
| 1045 | --known-signers FILE, --integrator-name NAME |
| 1046 | what a transfer statement is verified |
| 1047 | with, for the changes ready for |
| 1048 | approval, as changes reads them |
| 1049 | needs the valley-go helper. |
| 1050 | EOF |
| 1051 | help_runtime |
| 1052 | } |
| 1053 | |
| 1054 | help_checks() { |
| 1055 | cat <<'EOF' |
| 1056 | usage: valley checks [--schema FILE] [--instance DIR] [--project DIR] [--names [--cost COST] | --json] [<base> [<head>]] |
| 1057 | |
| 1058 | checks [<base> [<head>]] |
| 1059 | print the check names the composed verification policy |
| 1060 | (dcr-f41f718) requires of the change between two |
| 1061 | commits, which class made each one required, and the |
| 1062 | change's carry mode: how far an approval of it carries |
| 1063 | across a rebase, the strictest of exact, same-class and |
| 1064 | same-paths among the classes it matched. It prints: no |
| 1065 | check is run, nothing is gated, nothing is written. |
| 1066 | base defaults to the merge base with main, head to HEAD. |
| 1067 | by default both layers come from the target's tip |
| 1068 | (origin/main), never from your checkout: the project's |
| 1069 | own layer is policy/project there, and the owning valley |
| 1070 | is named one line at policy/valley there, fetched and |
| 1071 | read at policy/instance in that repository's integrated |
| 1072 | tip. a valley's own config repository carries |
| 1073 | policy/instance and uses it. a target carrying no |
| 1074 | policy/project is derived under the floor alone; a floor |
| 1075 | that is not there is refused. this is what the |
| 1076 | integrator reads, so the answer is the same from any |
| 1077 | branch, however stale. an option overrides each layer, |
| 1078 | which is the only way to derive against a layer that |
| 1079 | does not govern — the worked example under |
| 1080 | examples/policy/, say: |
| 1081 | --schema FILE default $VALLEY_VERIFICATION_SCHEMA |
| 1082 | --instance DIR default the owning valley's floor |
| 1083 | --project DIR default policy/project at the target |
| 1084 | naming a layer stops this reading the source it |
| 1085 | replaced. the schema is the shape a policy is written |
| 1086 | in rather than a layer, so it ships with this tool: the |
| 1087 | package sets VALLEY_VERIFICATION_SCHEMA to its own copy. |
| 1088 | with that unset, as when this script runs straight from |
| 1089 | a the-valley checkout, it is schema/verification.cue in |
| 1090 | the checkout. |
| 1091 | a class's globs match bytes, whatever your locale |
| 1092 | is: `?` is one byte, so `?.md` does not match |
| 1093 | é.md, whose é is two. |
| 1094 | after the report, two lines group the required checks |
| 1095 | by the cost the policy declares, `quick` or `slow`. a |
| 1096 | slow check takes minutes or needs special hardware. the |
| 1097 | cost changes nothing required: approving runs every |
| 1098 | required check whatever its cost, and the integrator |
| 1099 | requires evidence for every one. |
| 1100 | --names print only the required check names, |
| 1101 | one per line |
| 1102 | --cost COST with --names, only the quick or |
| 1103 | the slow ones, e.g. |
| 1104 | `valley checks --names --cost slow` |
| 1105 | --json print the valley-checks/v1 document |
| 1106 | instead of the report |
| 1107 | EOF |
| 1108 | help_runtime |
| 1109 | } |
| 1110 | |
| 1111 | help_tail() { |
| 1112 | cat <<'EOF' |
| 1113 | usage: valley tail [subject] |
| 1114 | |
| 1115 | tail [subject] watch bus events scroll by (default subject: valley.>); |
| 1116 | the server comes from the nats CLI's own config |
| 1117 | (NATS_URL or a nats context; default localhost) |
| 1118 | EOF |
| 1119 | help_runtime |
| 1120 | } |
| 1121 | |
| 1122 | help_replay() { |
| 1123 | cat <<'EOF' |
| 1124 | usage: valley replay [dir] |
| 1125 | |
| 1126 | replay [dir] publish one ref-updated event per current ref of the |
| 1127 | repo at dir (default: .) — rebuilds the stream's |
| 1128 | projection, e.g. after nats stream purge valley |
| 1129 | EOF |
| 1130 | help_runtime |
| 1131 | } |
| 1132 | |
| 1133 | help_telemetry() { |
| 1134 | cat <<'EOF' |
| 1135 | usage: valley telemetry [--remote <remote>] [--json] <operation> [flags] |
| 1136 | |
| 1137 | sources every source the host declares, and its state: |
| 1138 | disabled, unavailable, failed, stale, active or |
| 1139 | idle, with its units, its records and how far its |
| 1140 | journal reaches |
| 1141 | snapshot sources, with each producer's exported state and |
| 1142 | its open and latest runs |
| 1143 | read [--source <name>] [--since <cursor>] [--limit <n>] [--logs] |
| 1144 | records after the cursor (default: the newest |
| 1145 | --limit, 200, at most 1000); a source's systemd |
| 1146 | lifecycle from the journal; with --logs, its own |
| 1147 | output and the tail of its build logs, marked |
| 1148 | untrusted |
| 1149 | follow [--source <name>] [--since <cursor>] [--seconds <n>] [--logs] |
| 1150 | records as they are stored, and with --logs build |
| 1151 | output as it is written, for --seconds (default |
| 1152 | 60, at most 300); ends with a cursor to resume from |
| 1153 | flush send this workstation's spooled records now |
| 1154 | |
| 1155 | Reading needs a key whose principal holds the host's observe grant. The |
| 1156 | remote is the checkout's valley.telemetry.remote, else origin, or the one |
| 1157 | --remote names (a remote, an ssh URL, or user@host:path); its URL is read |
| 1158 | and never run. --json prints the valley-telemetry/v1 answer lines as they |
| 1159 | come. A gap, a cut-short answer or an error is said; an answer that does |
| 1160 | not end exits 1. |
| 1161 | |
| 1162 | With `git config valley.telemetry true`, every valley command records a |
| 1163 | command record: its verb (and knot's or telemetry's subverb), the names of |
| 1164 | the flags it was given, its project, its exit status and its wall time, |
| 1165 | and for pending and status the milliseconds and processes each phase took. |
| 1166 | It never records an argument's value, a path, a title or a body. Every |
| 1167 | approval attempt, from approve or from review, also records its steps and |
| 1168 | its checks' progress. Records go to an owner-only spool for the |
| 1169 | destination the checkout's telemetry remote names, under |
| 1170 | $XDG_STATE_HOME/valley/telemetry/spools. A background flusher sends each |
| 1171 | spool to its own destination, with the report grant; flush does the same |
| 1172 | now, and --remote limits it to that remote's spool. Telemetry never fails |
| 1173 | or holds up a command, and changes nothing it prints. |
| 1174 | EOF |
| 1175 | } |
| 1176 | |
| 1177 | help_self_update() { |
| 1178 | if command -v valley-go > /dev/null 2>&1; then |
| 1179 | valley-go self-update --help |
| 1180 | printf '\n' |
| 1181 | else |
| 1182 | cat <<'EOF' |
| 1183 | usage: valley self-update [-v] [--retry | --rollback | --pin | --unpin] |
| 1184 | [--repo <url>] [--branch <name>] |
| 1185 | |
| 1186 | EOF |
| 1187 | fi |
| 1188 | cat <<'EOF' |
| 1189 | self-update [-v] [--retry | --rollback | --pin | --unpin] |
| 1190 | [--repo <url>] [--branch <name>] |
| 1191 | install the tip of a branch of the-valley into your |
| 1192 | default nix profile, in place of its valley element, |
| 1193 | once that exact commit builds and passes a smoke test. |
| 1194 | a commit that fails is skipped until the branch moves, |
| 1195 | or until --retry. it is off until --repo or |
| 1196 | git config valley.selfUpdate.repo names the |
| 1197 | repository; the branch is valley.selfUpdate.branch, |
| 1198 | or main. --rollback reinstalls the previous build, and |
| 1199 | --pin and --unpin freeze and release the install. |
| 1200 | `valley-go self-update --help` gives every step. needs |
| 1201 | the valley-go helper and nix. |
| 1202 | |
| 1203 | --version print this valley's version: the package's version and |
| 1204 | the commit it was built from, e.g. 0.1.0-97db597, with |
| 1205 | -dirty after it for a tree with uncommitted changes and |
| 1206 | -unknown in its place when nix knew no commit. run |
| 1207 | straight from a checkout, it says it is unstamped. |
| 1208 | EOF |
| 1209 | help_runtime |
| 1210 | } |
| 1211 | |
| 1212 | fetch_origin() { |
| 1213 | git fetch --prune --quiet origin |
| 1214 | } |
| 1215 | |
| 1216 | # pending is valley-go's (status/pending.go). The fetch first keeps this |
| 1217 | # checkout's remote-tracking branches current, as pending always has. |
| 1218 | cmd_pending() { |
| 1219 | command -v valley-go > /dev/null 2>&1 \ |
| 1220 | || die "pending needs the valley-go helper; nix run .#valley bundles it" |
| 1221 | fetch_origin |
| 1222 | VALLEY_TELEMETRY_SINCE="$TEL_T0" VALLEY_TELEMETRY_VERSION="$VALLEY_STAMP" \ |
| 1223 | exec valley-go pending "$@" |
| 1224 | } |
| 1225 | |
| 1226 | # tel_command <status>: the command record of a verb this script runs |
| 1227 | # itself, handed to valley-go as the script exits, once. valley-go decides |
| 1228 | # whether telemetry is on; the verbs this script execs it for it records |
| 1229 | # itself. |
| 1230 | TEL_ARGS=() |
| 1231 | tel_command() { |
| 1232 | [ ${#TEL_ARGS[@]} -gt 0 ] || return 0 |
| 1233 | local -a args=("${TEL_ARGS[@]}") |
| 1234 | TEL_ARGS=() |
| 1235 | valley-go telemetry command --since "$TEL_T0" --version "$VALLEY_STAMP" --status "$1" \ |
| 1236 | -- "${args[@]}" < /dev/null > /dev/null 2>&1 || true |
| 1237 | } |
| 1238 | |
| 1239 | # status, ready, unready and withdraw are a Go program, valley-go |
| 1240 | # (status/). status reads a change's request and outcome from origin, |
| 1241 | # because what front ends read from it is a JSON contract, and because the |
| 1242 | # read is subtle enough to want a real parser: an outcome record it does |
| 1243 | # not recognise must read as unknown, never as success. It writes nothing |
| 1244 | # and moves no local branch. ready, unready and withdraw write a change's |
| 1245 | # record, in the one format the push hook reads it in (change/). knot |
| 1246 | # reads and writes the plan graph at refs/the-valley/knots, in the one |
| 1247 | # form the push hook validates (knot/), and plan shows that graph as a |
| 1248 | # view. |
| 1249 | cmd_go() { |
| 1250 | command -v valley-go > /dev/null 2>&1 \ |
| 1251 | || die "$1 needs the valley-go helper; nix run .#valley bundles it" |
| 1252 | VALLEY_TELEMETRY_SINCE="$TEL_T0" VALLEY_TELEMETRY_VERSION="$VALLEY_STAMP" exec valley-go "$@" |
| 1253 | } |
| 1254 | |
| 1255 | # review is valley-go's (status/review.go). With no change it walks what |
| 1256 | # needs the operator, and runs this script's review for each change, so it |
| 1257 | # is told this script's path. |
| 1258 | cmd_review() { |
| 1259 | command -v valley-go > /dev/null 2>&1 \ |
| 1260 | || die "review needs the valley-go helper; nix run .#valley bundles it" |
| 1261 | VALLEY_COMMAND="$0" VALLEY_TELEMETRY_SINCE="$TEL_T0" VALLEY_TELEMETRY_VERSION="$VALLEY_STAMP" \ |
| 1262 | exec valley-go review "$@" |
| 1263 | } |
| 1264 | |
| 1265 | # approve is review's [a]pprove without the pager, for a front end that |
| 1266 | # has shown the change its own way: valley-go approve (status/approve.go), |
| 1267 | # the code the key runs, so the verb and the key cannot drift apart. It |
| 1268 | # resolves the change before the fetch, as review does. |
| 1269 | cmd_approve() { |
| 1270 | command -v valley-go > /dev/null 2>&1 \ |
| 1271 | || die "approve needs the valley-go helper; nix run .#valley bundles it" |
| 1272 | VALLEY_TELEMETRY_SINCE="$TEL_T0" VALLEY_TELEMETRY_VERSION="$VALLEY_STAMP" \ |
| 1273 | exec valley-go approve "$@" |
| 1274 | } |
| 1275 | |
| 1276 | # rebase is review's [b]ase onto main without the pager. It runs the code |
| 1277 | # its key runs, valley-go rebase, and reads a change's name as review |
| 1278 | # reads it. The two flags that say what a transfer |
| 1279 | # statement is verified with are valley-go's, and pass through to it |
| 1280 | # untouched. |
| 1281 | cmd_rebase() { |
| 1282 | local usage="usage: valley rebase [--known-signers <file>] [--integrator-name <name>] <change>" |
| 1283 | local name="" verify=() |
| 1284 | while [ $# -gt 0 ]; do |
| 1285 | case "$1" in |
| 1286 | --known-signers | --integrator-name) |
| 1287 | [ $# -ge 2 ] || die "$usage" |
| 1288 | verify+=("$1" "$2") |
| 1289 | shift 2 |
| 1290 | ;; |
| 1291 | --known-signers=* | --integrator-name=*) |
| 1292 | verify+=("$1") |
| 1293 | shift |
| 1294 | ;; |
| 1295 | -*) die "$usage" ;; |
| 1296 | *) |
| 1297 | [ -z "$name" ] || die "$usage" |
| 1298 | name="$1" |
| 1299 | shift |
| 1300 | ;; |
| 1301 | esac |
| 1302 | done |
| 1303 | [ -n "$name" ] || die "$usage" |
| 1304 | command -v valley-go > /dev/null 2>&1 \ |
| 1305 | || die "review, approve and rebase read the change's record with the valley-go helper; nix run .#valley bundles it" |
| 1306 | fetch_origin |
| 1307 | VALLEY_TELEMETRY_SINCE="$TEL_T0" VALLEY_TELEMETRY_VERSION="$VALLEY_STAMP" \ |
| 1308 | exec valley-go rebase "${verify[@]}" "$name" |
| 1309 | } |
| 1310 | |
| 1311 | # tail and replay are thin wrappers over the nats CLI — anything they do, |
| 1312 | # plain nats and git can do. They are the only verbs needing more than git |
| 1313 | # and coreutils. |
| 1314 | need_nats() { |
| 1315 | command -v nats >/dev/null 2>&1 \ |
| 1316 | || die "this verb needs the nats CLI (natscli); nix run .#valley bundles it" |
| 1317 | } |
| 1318 | |
| 1319 | cmd_tail() { |
| 1320 | [ $# -le 1 ] || die "usage: valley tail [subject]" |
| 1321 | need_nats |
| 1322 | exec nats sub "${1:-valley.>}" |
| 1323 | } |
| 1324 | |
| 1325 | # One ref-updated event per existing ref, from git for-each-ref alone. A |
| 1326 | # ref's prior value is not derivable from the repository, so `old` is the |
| 1327 | # all-zero id — the same payload a push creating the ref would produce. |
| 1328 | # The payload construction mirrors the host module's publisher hook |
| 1329 | # (nix/valley-host.nix); change one only with the other. |
| 1330 | cmd_replay() { |
| 1331 | [ $# -le 1 ] || die "usage: valley replay [repo-dir]" |
| 1332 | need_nats |
| 1333 | local dir="${1:-.}" repo sha ref event count=0 |
| 1334 | git -C "$dir" rev-parse --git-dir >/dev/null 2>&1 \ |
| 1335 | || die "not a git repository: $dir" |
| 1336 | if [ "$(git -C "$dir" rev-parse --is-bare-repository)" = true ]; then |
| 1337 | repo="$(basename "$(git -C "$dir" rev-parse --absolute-git-dir)" .git)" |
| 1338 | else |
| 1339 | repo="$(basename "$(git -C "$dir" rev-parse --show-toplevel)")" |
| 1340 | fi |
| 1341 | while read -r sha ref; do |
| 1342 | # " is the only JSON-significant character a refname can contain (git |
| 1343 | # forbids \ and control characters); names and object ids are safe. |
| 1344 | event="$(printf '{"event":"ref-updated","repo":"%s","ref":"%s","old":"%s","new":"%s"}' \ |
| 1345 | "$repo" "${ref//\"/\\\"}" "${sha//?/0}" "$sha")" |
| 1346 | nats pub "valley.git.$repo.ref-updated" "$event" >/dev/null |
| 1347 | count=$((count + 1)) |
| 1348 | done < <(git -C "$dir" for-each-ref --format='%(objectname) %(refname)') |
| 1349 | echo "replayed $count refs of $repo onto the bus" |
| 1350 | } |
| 1351 | |
| 1352 | # ---------------------------------------------------------------------- |
| 1353 | # checks — the checks the verification policy requires of a change, and |
| 1354 | # the classes requiring each. The verb is valley-go's (status/checks.go): |
| 1355 | # it reads the policy's layers and derives with the Go deriver (derive/). |
| 1356 | cmd_checks() { |
| 1357 | command -v valley-go > /dev/null 2>&1 \ |
| 1358 | || die "checks needs the valley-go helper; nix run .#valley bundles it" |
| 1359 | VALLEY_TELEMETRY_SINCE="$TEL_T0" VALLEY_TELEMETRY_VERSION="$VALLEY_STAMP" \ |
| 1360 | exec valley-go checks "$@" |
| 1361 | } |
| 1362 | |
| 1363 | # self-update installs the tip of a branch of the-valley into the user's |
| 1364 | # nix profile (status/selfupdate.go). It is told this valley's stamp, which |
| 1365 | # says what is installed until it has installed something itself. |
| 1366 | cmd_self_update() { |
| 1367 | export VALLEY_VERSION="$VALLEY_STAMP" |
| 1368 | cmd_go self-update "$@" |
| 1369 | } |
| 1370 | |
| 1371 | cmd_version() { |
| 1372 | printf 'valley %s\n' "${VALLEY_STAMP:-unstamped (run from a checkout, not built by nix)}" |
| 1373 | } |
| 1374 | |
| 1375 | cmd_help() { |
| 1376 | [ $# -le 1 ] || die "usage: valley help [<verb>]" |
| 1377 | local out |
| 1378 | case "${1:-}" in |
| 1379 | '' | help | -h | --help) out="$(usage)" ;; |
| 1380 | pending) out="$(help_pending)" ;; |
| 1381 | changes) out="$(help_changes)" ;; |
| 1382 | review) out="$(help_review)" ;; |
| 1383 | approve) out="$(help_approve)" ;; |
| 1384 | rebase) out="$(help_rebase)" ;; |
| 1385 | status) out="$(help_status)" ;; |
| 1386 | ready) out="$(help_ready)" ;; |
| 1387 | unready) out="$(help_unready)" ;; |
| 1388 | withdraw) out="$(help_withdraw)" ;; |
| 1389 | knot) out="$(help_knot)" ;; |
| 1390 | plan) out="$(help_plan)" ;; |
| 1391 | checks) out="$(help_checks)" ;; |
| 1392 | tail) out="$(help_tail)" ;; |
| 1393 | replay) out="$(help_replay)" ;; |
| 1394 | self-update) out="$(help_self_update)" ;; |
| 1395 | telemetry) out="$(help_telemetry)" ;; |
| 1396 | *) die "unknown help topic: $1 (try 'valley help')" ;; |
| 1397 | esac |
| 1398 | printf '%s\n' "$out" 2> /dev/null || true |
| 1399 | } |
| 1400 | |
| 1401 | main() { |
| 1402 | local verb="${1:-help}" |
| 1403 | if [ $# -gt 0 ]; then shift; fi |
| 1404 | # The verb set is mirrored in completions/ (valley.bash, _valley) — |
| 1405 | # update both when it changes. |
| 1406 | case "$verb" in |
| 1407 | pending | changes | review | approve | rebase | status | ready | unready | withdraw | knot | plan | checks | tail | replay | self-update | telemetry) |
| 1408 | if [ $# -eq 1 ] && { [ "$1" = -h ] || [ "$1" = --help ]; }; then |
| 1409 | cmd_help "$verb" |
| 1410 | return |
| 1411 | fi |
| 1412 | ;; |
| 1413 | esac |
| 1414 | case "$verb" in |
| 1415 | checks | tail | replay) |
| 1416 | TEL_ARGS=("$verb" "$@") |
| 1417 | trap 'tel_command $?' EXIT |
| 1418 | ;; |
| 1419 | esac |
| 1420 | case "$verb" in |
| 1421 | pending) cmd_pending "$@" ;; |
| 1422 | review) cmd_review "$@" ;; |
| 1423 | approve) cmd_approve "$@" ;; |
| 1424 | rebase) cmd_rebase "$@" ;; |
| 1425 | status | ready | unready | withdraw | changes | knot | plan) cmd_go "$verb" "$@" ;; |
| 1426 | checks) cmd_checks "$@" ;; |
| 1427 | tail) cmd_tail "$@" ;; |
| 1428 | replay) cmd_replay "$@" ;; |
| 1429 | self-update) cmd_self_update "$@" ;; |
| 1430 | telemetry) cmd_go telemetry "$@" ;; |
| 1431 | --version) cmd_version ;; |
| 1432 | help | -h | --help) cmd_help "$@" ;; |
| 1433 | *) |
| 1434 | printf 'valley: unknown verb: %s\n\n' "$verb" >&2 |
| 1435 | usage >&2 |
| 1436 | exit 1 |
| 1437 | ;; |
| 1438 | esac |
| 1439 | } |
| 1440 | |
| 1441 | main "$@" |