ee06a6c5 Andy McCall 1 month ago ↶
1
# Oxygen user guide
2
3
This guide is organised by task. It assumes the ` oxy` binary is on your
4
path (` cargo build --release` puts it in ` target/release/` ). The design
5
behind every command is in [ spec.md ] ( spec.md ) ; this guide only tells you
6
what to type and what to expect.
7
8
Oxygen tracks * changes* rather than snapshots: a change is the set of
9
edits you made, it commutes with unrelated changes, and conflicts are
10
recorded in history instead of blocking you. Two ideas recur below:
11
12
- A ** bookmark** (default ` main` ) names a * state* : the set of changes it
13
contains. A state can have several ** heads** when independent changes
14
have not been related to each other; that is normal, not a problem.
15
- The ** working copy** is itself a change that Oxygen rewrites every time
16
it looks at your files. ` oxy commit` turns it into a real change.
17
18
Output uses colour and glyphs on a terminal; pipe it, pass ` --plain` , or set
19
` NO_COLOR` for plain ASCII.
20
21
## 1. Set yourself up
22
23
```
24
oxy identity create --name "Ada Lovelace" --email [email protected]
25
oxy config --user core.sign change
26
```
27
28
` identity create` generates a composite Ed25519 + ML-DSA-65 key pair, keeps
29
the secret in ` ~/.config/oxy/keys/` , and records you as the default author
30
in ` ~/.config/oxy/config.toml` . With ` core.sign = change` every commit is
31
signed; without it, changes are sealed in batches when you push (also
32
authenticated, just later). Use ` --local` to record the identity in one
33
repository only.
34
35
` oxy identity show` prints the key, its expiry, delegates, and whether the
36
secret is available. ` oxy identity export` writes the public identity to a
37
file to hand to whoever manages a trust policy (section 8).
38
39
## 2. Start a repository
40
41
```
42
mkdir project && cd project
43
oxy init
44
oxy status
45
```
46
9ac1fbe2 Andy McCall 1 month ago ↶
47
` oxy init` creates ` .oxy/` . Add ` .oxyignore` (gitignore syntax, per
48
directory, negations with ` !` ) for files that should never be tracked;
49
` /target` and ` *.tmp` are typical entries. As in Git, ignore rules only
50
affect untracked files: a file already in history stays tracked until you
d4dbab97 Andy McCall 1 month ago ↶
51
delete it. A project's ` .gitignore` files are honoured too, so moving a Git
52
project to Oxygen does not commit its build output; ` .oxyignore` comes
53
first, and a ` !` rule there brings back what ` .gitignore` leaves out.
ee06a6c5 Andy McCall 1 month ago ↶
54
55
To take over an existing Git project, see section 12.
56
57
## 3. Everyday work
58
59
```
60
oxy status # what changed since the last commit
61
oxy diff # the edits, file by file
62
oxy commit -m "Add retry loop"
63
oxy log # newest first; -n 10, -v for full messages
47ce8b8e Andy McCall 1 month ago ↶
64
oxy log -r 'main.. & touches("src/**")' # a revset (docs/revset_query_language.md)
ee06a6c5 Andy McCall 1 month ago ↶
65
oxy show 658990aa # one change by ChangeId prefix, #hash prefix, or @
66
```
67
2bf22305 Andy McCall 1 month ago ↶
68
` oxy log` draws the history as a graph, newest first, two lines per change:
69
70
```
71
◉ 2f8518c0 Andy McCall just now
33472ccc Andy McCall 1 month ago ↶
72
│ (working copy)
2bf22305 Andy McCall 1 month ago ↶
73
● 1b5888b1 Andy McCall 2 minutes ago main #cc23b999 ✔ signed
74
│ Edit b
75
│ ● d6f52eca Andy McCall 3 minutes ago main #ec6a7dc4 ✔ signed
76
├─╯ Edit a
77
○ c0593116 Andy McCall 5 minutes ago #eeac7940 ✔ signed
78
Both files
79
```
80
81
The bright start of each ID is the shortest prefix that names it. ` ●` marks
82
a head, ` ◉` the working copy. Bookmarks and tags show beside their heads,
83
unless they have more than three. A lane follows the change each one most
84
directly builds on, its newest dependency. Two edits that build on the same
85
change take two lanes, which join above it, so independent work shows side
86
by side. ` ~` means the change builds on something further down than the
87
graph draws, or not shown; ` -v` lists every dependency.
88
957fee30 Andy McCall 1 month ago ↶
89
Commit part of what changed with ` oxy commit PATH.. -m "..."` (only those
90
paths; the rest stays as uncommitted work) or ` oxy commit -i -m "..."` , which
91
offers each hunk in turn like ` git add -p` ; a hunk that another chosen hunk
92
needs, such as the directory a new file lives in, comes along by itself.
93
50a046e4 Andy McCall 1 month ago ↶
94
` status --json` prints the same for tools, with every conflict's kind, path and
95
contributing ChangeIds. On a terminal, ` status` lists each path with a mark: ` ✚ added` , ` ✎ modified` , ` ✖ removed` ,
ee06a6c5 Andy McCall 1 month ago ↶
96
` ➜ renamed` , ` ⚙ mode` . Renames are detected: a removed file and an added
97
file of the same kind whose contents are at least half alike are recorded
98
as a move of the same file, so identity survives a rename.
99
100
Files containing NUL bytes are stored whole ("opaque"); text files are
101
stored line by line and merge line by line. ` .oxyattributes` overrides the
102
guess (section 14).
103
104
Every change has two names: a ** ChangeId** (` 658990aa…` ) that survives
105
rewrites, and a content hash (` #7469d16c…` ) that changes when the change is
106
edited. Use whichever you have; prefixes work.
107
fbda43e7 Andy McCall 1 month ago ↶
108
## 3a. Bookmarks: branches without merges
109
110
A bookmark names a state; each workspace works on one (` main` to begin
111
with). Because changes commute, "merging" is the union of two bookmarks'
112
heads, with no merge change and any real conflict recorded as in section 6.
113
114
```
115
oxy bookmark create feature # at the working copy's base
116
oxy bookmark switch feature # check it out; commits now go here
117
oxy commit -m "Feature work"
118
oxy bookmark switch main
119
oxy merge feature # main now holds both; working copy follows if clean
120
oxy bookmark list # ● current, heads, ↑n/↓n against origin
bf3a6781 Andy McCall 1 month ago ↶
121
oxy bookmark show feature # each head, newest first (list -v: every bookmark's)
fbda43e7 Andy McCall 1 month ago ↶
122
oxy push -b feature # publish a bookmark other than the current one
123
oxy bookmark set feature 658990aa # move it; oxy bookmark delete feature to drop it
124
```
125
126
` oxy checkout feature` materialises a bookmark without switching to it, and
127
a bookmark name works wherever a change is expected when it has one head.
bf3a6781 Andy McCall 1 month ago ↶
128
In a revset it means the bookmark's heads (` oxy log -r feature` );
129
` bookmark(feature)` means only the bookmark, never a tag or change prefix.
fbda43e7 Andy McCall 1 month ago ↶
130
Each workspace remembers its own bookmark, so two directories can sit on
131
two bookmarks of one repository.
132
4fe7d604 Andy McCall 1 month ago ↶
133
** A state is its heads, not a history.** If you are coming from Git, this
134
is the one thing to know. A bookmark holds its heads and what they depend
135
on, and a change depends only on the changes it builds on (the files it
136
touched), not on everything recorded before it. So on a bookmark with
137
several heads, a new bookmark at one change can be a much older-looking
138
tree. ` oxy bookmark create NAME CHANGE` refuses when that would leave out
139
earlier work and lists what it would lack. Then pick one:
140
141
```
142
oxy bookmark create logo 745307b4 --upto # everything here up to that change, as a Git branch would be
143
oxy bookmark create logo 745307b4 --only # just that change and what it depends on
144
oxy bookmark create logo # the whole current state, usually what you want
145
```
146
06d16dc2 Andy McCall 1 month ago ↶
147
` oxy bookmark set NAME CHANGE` asks the same when the move would lose
148
changes the bookmark holds that were recorded before CHANGE, and takes
149
` --upto` and ` --only` too. After merging a proposal's target into its
150
bookmark to resolve conflicts, ` oxy bookmark set NAME CHANGE --upto`
151
keeps everything the bookmark held.
152
4fe7d604 Andy McCall 1 month ago ↶
153
` oxy bookmark switch` says when the bookmark you switch to lacks changes
154
that the one you left has.
155
14edbaaf Andy McCall 1 month ago ↶
156
** A remote's bookmarks.** A clone fetches every change, checks out the
157
remote's default bookmark, and names the others ` origin/NAME` : use them
158
anywhere a bookmark is expected (` oxy log origin/develop` ,
159
` oxy diff main origin/develop` ). ` oxy bookmark list --all` shows them.
160
` oxy bookmark switch develop` makes a local ` develop` from ` origin/develop`
161
when there is none, and ` oxy pull` then keeps every local bookmark up to
162
date with the remote's of the same name, not only the current one. Pulling
72484195 Andy McCall 1 month ago ↶
163
is a union, so this never loses work. A local bookmark that is only behind
164
its remote (` -3` in ` bookmark list` ) is caught up when you switch to it.
14edbaaf Andy McCall 1 month ago ↶
165
166
```
167
oxy clone https://oxygenhub.io/owner/game --recursive # subrepos too
168
oxy bookmark list --all
169
oxy bookmark switch develop # from origin/develop
170
oxy pull # updates develop, main and the rest
171
```
172
314db9b4 Andy McCall 1 month ago ↶
173
### A develop / feature flow
174
175
Names with ` /` work everywhere, pushing included:
176
177
```
178
oxy bookmark create feature/42-login # at the working copy's base
179
oxy bookmark switch feature/42-login --carry # started already? take the edits along
180
oxy commit -F msg.txt # a long message from a file
181
oxy push -b feature/42-login
182
oxy bookmark switch develop
183
oxy merge feature/42-login # the working copy follows when it was clean
184
oxy push # develop, with the feature in it
185
oxy bookmark delete feature/42-login # oxy push --delete feature/42-login on the remote
186
```
187
188
` bookmark switch` stops when the working copy has uncommitted edits, so
189
nothing is lost by accident. There are two ways past it:
190
- ` --carry` takes the edits along. It is refused only when the target
191
bookmark has other versions of the files they touch.
192
- ` --discard` drops the edits.
193
194
` oxy describe` names what the working copy holds, for build stamps:
195
- a tag, when a tag holds exactly this state;
196
- otherwise the nearest tag with the distance from it and the change;
197
- or, with no tag behind it, the bookmark and the change;
198
- with ` -dirty` added when there are uncommitted edits.
199
ee06a6c5 Andy McCall 1 month ago ↶
200
## 4. Fix up history
201
202
Oxygen keeps its own record of every operation, so all of these are safe to
203
try and to undo.
204
205
```
206
oxy describe -m "Better message" # reword the head the working copy sits on
207
oxy describe 658990aa -m "..." # reword any change; dependents are rewritten
208
oxy amend # fold the working copy into the head
209
oxy amend --into 658990aa # fold it into an older change
210
oxy split 658990aa src/parser.rs # split a head: those paths become a separate first change
211
oxy abandon 658990aa # drop a change; its content stays on disk
728da0f9 Andy McCall 1 month ago ↶
212
oxy squash 658990aa --into 9df9ac29 # fold a change into one it depends on
213
oxy rebase 658990aa --onto feature # re-express a change against another base
e266b7d4 Andy McCall 1 month ago ↶
214
oxy rebase 658990aa --onto develop --into-working-copy # conflicted? resolve it here, then commit
ee06a6c5 Andy McCall 1 month ago ↶
215
oxy undo # undo the last operation, whatever it was
98a1620a Andy McCall 1 month ago ↶
216
oxy op log # every operation, what it changed, and its command
ee06a6c5 Andy McCall 1 month ago ↶
217
```
218
98a1620a Andy McCall 1 month ago ↶
219
### The operation log
220
221
Every command that changes the repository records an operation: the
222
bookmarks, tags and working copy as they were after it. ` oxy op log` lists
223
them newest first, each with what it changed and the command that did it;
224
working-copy snapshots fold into one row.
225
226
```
227
@ 13adb0d0b8bf just now
228
│ main: 1 → 2 heads; working copy now 91ab4d50
229
│ oxy commit -m "Third"
230
○ fa21727d70da just now
231
│ created bookmark test (1 head)
232
│ oxy bookmark create test
233
○ 2d15930afdef … 830168a3ddcd just now
234
│ 2 working-copy snapshots
235
```
236
237
Any operation can be looked at, gone back to, or undone alone:
238
239
```
240
oxy --at-op fa21727d log # the log as it was after that operation; any read-only command works
241
oxy op restore fa21727d # bookmarks and working copy as they were then
242
oxy op revert fa21727d # undo just that operation, keeping everything after it
243
oxy undo # takes back the last command, a restore included
244
```
245
246
` op restore` and ` op revert` are operations themselves, so ` oxy undo` takes
247
them back. ` op revert` puts back each bookmark the operation moved, unless
248
it has moved again since. Tags and the trust policy never go backwards.
249
` undo` brings the files back as well when nothing uncommitted would be
250
lost; an undone commit's edits stay on disk as uncommitted work.
251
252
Commands that move the working copy end by saying where it is:
253
254
```
255
* Committed 95245a21 #35bbf5097e0c Third
256
Working copy 91ab4d50
257
Bookmark main: 2 heads, newest 95245a21 Third
258
```
259
ee06a6c5 Andy McCall 1 month ago ↶
260
Rewriting a change that others depend on rewrites them too, keeping their
728da0f9 Andy McCall 1 month ago ↶
261
ChangeIds. Because unrelated changes already coexist, ` rebase` is rarely
262
needed; its job is to change what a change is said to build on, for instance
263
to drop a dependency on something you are about to abandon. Where a dependent referred to a line that no longer exists, the
ee06a6c5 Andy McCall 1 month ago ↶
264
reference is re-anchored to the nearest surviving line and ` oxy abandon`
265
prints a note about it.
266
957fee30 Andy McCall 1 month ago ↶
267
## 4a. Who wrote this, and what broke it
268
269
```
270
oxy blame src/parser.rs # every line: the change that introduced it, author, age
271
oxy blame src/parser.rs --json
272
```
273
274
Blame is exact: each line is an atom that remembers the change that
275
introduced it, so renames cost nothing and there is no heuristic.
276
277
```
278
oxy bisect start
279
oxy bisect good v1.2 # a change, bookmark or tag known to be fine
280
oxy bisect bad main # and one known to be broken
281
oxy bisect run make test # exit 0 good, 125 skip, anything else bad
282
oxy bisect reset # back to where you were
283
```
284
285
Without ` run` , each step checks out a state to test and you answer with
286
` oxy bisect good` , ` bad` , or ` skip` . The candidates are the changes the bad
287
state has that the good one lacks, ordered so every tested state is
288
well-formed; the answer is the first change whose inclusion breaks things.
289
ee06a6c5 Andy McCall 1 month ago ↶
290
## 5. Move around
291
292
```
293
oxy checkout # the bookmark's heads
294
oxy checkout 658990aa # the state of one change and its dependencies
295
oxy checkout v1.2 # a tag
296
oxy checkout --discard ... # throw away uncommitted work first
297
```
298
299
Checking out a single older change gives you the files that change and its
300
dependencies touch, not a full snapshot from that date: in Oxygen a change
301
depends only on what it actually builds on.
302
303
## 6. Conflicts
304
305
A conflict never stops a commit, fetch, or pull. It is recorded in the
306
state and shown by ` oxy status` , which exits with status 2 while any
307
conflict remains. Conflicted text files are written with markers:
308
309
```
310
<<<<<<< oxy conflict 1 of 2, side 1: change k7m2p9 "Add retry loop"
311
... lines ...
312
======= oxy conflict 1 of 2, side 2: change q3x8w1 "Refactor client"
313
... lines ...
314
>>>>>>> oxy conflict 1 of 2 end
315
```
316
317
Edit the file to what it should be (keep one side, both, or neither) and
318
remove the markers. Tree conflicts, such as two files wanting the same
319
name, appear as ` <name>.oxy-conflict-<n>` candidates: keep the one you
320
want under the right name and delete the rest.
321
157d02e9 Andy McCall 10 days ago ↶
322
A binary file or a subrepo pin changed two ways has no markers to edit:
323
the checkout writes one version, and you say which content wins by
324
naming it. Put the bytes you want at the path (or move the subrepo to the
325
pin you want), then:
326
327
```
328
oxy resolve assets/logo.png deps/lib # these paths' content settles them
329
```
330
9bd98cfb Andy McCall 9 days ago ↶
331
Two changes that each add lines at the same place (two new imports, two
332
changelog entries) conflict too, since oxy will not guess their order.
333
` oxy status` says when a conflict is one of these; keep both sides, the
334
earlier change's first, with one command:
335
336
```
337
oxy resolve --both CHANGELOG.md # --reverse for the later change's first
338
```
339
4afe288b Andy McCall 9 days ago ↶
340
For files where the order never matters, such as a changelog, say so once
341
in ` .oxyattributes` and checkouts keep both sides without asking:
342
343
```
344
CHANGELOG.md merge=union
345
```
346
ee06a6c5 Andy McCall 1 month ago ↶
347
```
348
oxy resolve # which conflicts your edits resolve, which still have markers
349
oxy commit -m "Resolve retry vs refactor"
350
```
351
352
The commit is recorded as a * resolution* , a change that depends on every
353
side of the conflict; anyone who fetches it gets the conflict resolved.
354
355
## 7. Work with others
356
357
Run a server (any machine with the repositories under one directory):
358
359
```
360
oxy serve --root /srv/oxy --bind 0.0.0.0:8890 --token SECRET \
361
--tls-cert cert.pem --tls-key key.pem
362
```
363
364
Without ` --tls-*` the server speaks plain HTTP; keep that on a loopback
365
address or behind a TLS terminator. ` --token` makes pushes require a bearer
366
token; reads stay open.
367
368
On your machine:
369
370
```
ff1f62fe Andy McCall 1 month ago ↶
371
echo SECRET | oxy auth login https://host:8890 --with-token --ca my-ca.pem
ee06a6c5 Andy McCall 1 month ago ↶
372
oxy clone https://host:8890/project
373
cd project
374
oxy push
375
oxy pull
376
```
377
ff1f62fe Andy McCall 1 month ago ↶
378
` --ca` is only for a server with a self-signed certificate. On a hub such as
379
OxygenHub, ` oxy auth login https://oxygenhub.io` signs in through the
380
browser instead: it shows a code to approve on the hub, and the hub issues a
381
token that lasts 90 days past its last use.
382
383
### Signing in
384
385
` oxy auth login HUB` keeps one token per hub (scheme, host and port) in
386
` ~/.config/oxy/credentials.toml` , readable by you only, and every repository
387
on that hub uses it: clone, fetch, push and subrepos alike. Nothing secret is
388
written into a checkout. ` oxy auth status` lists the hubs you are signed in
389
to and checks each token with its hub; ` oxy auth logout HUB` forgets the token
390
and revokes it on the hub.
391
392
To keep tokens in the system keyring instead, name a Git credential helper:
393
` oxy config --user auth.helper libsecret` (Linux), ` osxkeychain` (macOS) or
394
` manager` (Windows). The file then keeps only the account and CA.
395
396
A token is found in this order: the remote's own ` remote.<name>.token` , then
397
` $OXY_TOKEN` (for CI), then the store, then a remote on the same hub in an
68a92484 Andy McCall 22 days ago ↶
398
enclosing checkout (so a subrepo uses its parent's). When the token came
399
from the store or an enclosing checkout and the hub refuses it (a stale login,
400
or another account's), oxy tries the other tokens enclosing checkouts hold for
401
that hub before giving up, and says so once; a remote's own token and
402
` $OXY_TOKEN` are never swapped for another. oxy sends a token over
ff1f62fe Andy McCall 1 month ago ↶
403
` https` only, or over plain ` http` to this machine; it is never sent to
404
another host after a redirect, and a credentials file that others can read
405
is ignored.
406
ee06a6c5 Andy McCall 1 month ago ↶
407
- ` oxy fetch` updates ` origin/main` without touching your bookmark.
14edbaaf Andy McCall 1 month ago ↶
408
- ` oxy pull` fetches, then makes your bookmark, and every other local
409
bookmark the remote also has, the union of both sides.
ee06a6c5 Andy McCall 1 month ago ↶
410
There is no merge commit; unrelated changes simply coexist, and a real
72484195 Andy McCall 1 month ago ↶
411
conflict is recorded as in section 6. The working copy follows, taking
412
uncommitted work along when the pulled changes leave its files alone;
f6dccc45 Andy McCall 26 days ago ↶
413
otherwise it stays and ` oxy checkout` updates it. A working copy that had
414
fallen behind its bookmark catches up on the next pull too, and ` oxy
415
status` says when it is behind.
ee06a6c5 Andy McCall 1 month ago ↶
416
- ` oxy push` sends your changes and moves the remote bookmark. If the remote
417
moved since you last fetched, the push is refused: pull and push again.
418
` --force` overrides the compare-and-swap.
419
- ` oxy remote add|remove|list` manages remotes; the clone source is ` origin` .
42ccf504 Andy McCall 27 days ago ↶
420
Commands that take a remote use ` origin` , or the only remote there is; with
421
several and none named ` origin` , name one or set ` oxy config core.remote
422
NAME` . ` bookmark list` compares each bookmark with a remote that has it,
423
and names the remote when there is more than one.
ee06a6c5 Andy McCall 1 month ago ↶
424
425
A repository can also be cloned from a local path, which is handy for tests
426
and for a bare "hub" on a shared disk.
427
428
## 8. Decide who may publish: the trust policy
429
430
Without a policy a repository is * unverified* : everything is accepted and
431
every remote command says so. A policy names root keys and the keys allowed
432
to update each bookmark; servers and clients enforce it.
433
434
```
435
oxy policy init # your key becomes the only root; push publishes it
436
oxy policy show
437
oxy policy grant alice.identity # alice.identity came from her `oxy identity export`
438
oxy policy grant ci.identity --pattern 'release/*'
439
oxy policy revoke 9458b656 # by KeyId prefix
440
oxy verify # signature status of every change in the log
441
```
442
443
Several people can hold root keys:
444
445
```
446
oxy policy root add bob.identity
447
oxy policy root threshold 2 # future updates need two root signatures
448
```
449
450
Once the threshold is above one, an update you make alone becomes a
451
* proposal file* (` policy-<serial>.proposal` , or ` --out` ). Send it to another
452
root holder, who runs ` oxy policy sign policy-7.proposal` ; whoever completes
453
the threshold applies it, and the next push publishes it. Everyone else
454
picks it up on fetch, verifying each step from the policy they already
455
trust.
456
457
## 9. Keys over time
458
459
```
460
oxy identity rotate # fresh key pair; old signatures stay valid
461
oxy identity renew --expires 365 # same keys, new expiry in days (0 = never)
7ba155f2 Andy McCall 1 month ago ↶
462
oxy identity delegate add agent.identity --expires 8h # sign changes for me today
463
oxy identity delegate add ci.identity --scope changes,refs # sign and push for me
ee06a6c5 Andy McCall 1 month ago ↶
464
oxy identity delegate remove 3f2a…
7ba155f2 Andy McCall 1 month ago ↶
465
oxy identity revoke 3f2a… --reason "agent host compromised" # a key you delegated to
445ce913 Andy McCall 1 month ago ↶
466
```
467
468
Setting an agent up takes a home of its own, so it never holds your
469
secret key. In the agent's shell, inside any checkout:
470
471
```
472
export OXY_HOME=~/.oxy-agents/claude
473
oxy identity create --name "Claude Code on my laptop" --email [email protected]
474
# prints the agent's KeyId; its identity file is keys/<KeyId>.identity in that home
475
oxy config --user author.name "Your Name" # the agent authors as you…
476
oxy config --user author.email "[email protected] "
477
oxy config --user author.key <YOUR KeyId>
478
oxy config --user author.signer <THE AGENT's KeyId> # …and signs as itself
479
oxy config --user core.sign change
480
```
481
482
Then, in your own shell, in the repository: ` oxy identity delegate add
483
~/.oxy-agents/claude/keys/<KeyId>.identity --scope changes --expires 8h`
614f55e1 Andy McCall 1 month ago ↶
484
(several files at once are one rotation). This rotates your identity:
485
the new key is written to your user config, and to this repository's
486
file too if it pinned the old one, so other checkouts follow; put the
487
new KeyId in each agent's ` author.key` , and re-link it on your hub.
488
` oxy identity show` warns if a repository still pins an older key
489
(` oxy config --unset author.key` there). Every commit the agent makes
445ce913 Andy McCall 1 month ago ↶
490
carries you as author and its signature: ` oxy log -r 'delegated()'`
491
lists them, ` oxy verify` names the agent, and its own ` oxy push` is
492
refused under any policy, so you land its work.
493
c895bc52 Andy McCall 18 days ago ↶
494
** Keyless agents** (on an OxygenHub) hold no key at all. You give the
495
agent a grant instead, signed by your key, and the hub certifies a fresh
496
key for it each time it signs:
497
498
```
499
oh agent grant claude --for 30d # your shell: prints the agent's token, once
500
oxy auth grant < token # the agent's shell (its own OXY_HOME)
501
oxy config --user author.key <YOUR KeyId>
502
oxy config --user author.signer keyless
2452b440 Andy McCall 9 days ago ↶
503
oxy config --user author.for <YOUR ACCOUNT> # follow your newest identity
c895bc52 Andy McCall 18 days ago ↶
504
```
505
506
Each certificate lasts ten minutes and carries your grant, so the
507
agent's commits count as yours, and a push seals them with the fresh
508
key. A repository with a trust policy also names the agent:
509
` oxy policy grant-subject agent:claude@YOU --issuer hub.identity --scope
510
changes` (add ` refs` to let it push), with the hub's identity from
511
` /.well-known/oxyhub-key` . ` oh agent list` shows your grants and ` oh
2452b440 Andy McCall 9 days ago ↶
512
agent revoke ID` stops one at once; there is no key to rotate. When you
513
rotate your own key (every delegation does), an agent with ` author.for`
514
follows: the hub names your newest identity with each certificate, and
515
the agent authors as it from then on, rather than as the key you gave it.
516
A repository whose own config pins ` author.key` keeps that pin.
c895bc52 Andy McCall 18 days ago ↶
517
445ce913 Andy McCall 1 month ago ↶
518
```
ee06a6c5 Andy McCall 1 month ago ↶
519
oxy identity revoke # retire your own key
520
oxy identity revoke 3f2a… --reason "laptop stolen" # any key, if you hold a root
521
```
522
523
Rotation, renewal, and delegation all issue a successor identity that names
524
the previous one. If a policy names your key, it is updated to the successor
525
in the same step (as a proposal when more root signatures are needed).
526
Changes signed before the rotation remain authorised; a revoked key
527
authorises nothing. ` oxy verify` shows signatures by revoked keys as valid
528
but revoked.
529
530
## 10. Tags and workspaces
531
532
```
533
oxy tag create v1.2 -m "First release" # the current heads; or name changes
534
oxy tag list
535
oxy workspace add ../project-hotfix # a second checkout sharing the repository
536
oxy workspace list
537
oxy workspace forget ../project-hotfix
538
```
539
540
A tag is an immutable state, signed when you have a key, and travels with
541
push and fetch. Workspaces have their own working copy and bookmark
542
(` workspace.bookmark` ) but share objects and history.
543
fc1a466a Andy McCall 1 month ago ↶
544
### Receipts from CI
545
546
A runner such as OxygenFlow signs a receipt for every job it runs: what ran,
547
in what environment, on which files, and the result. Receipts are kept with
548
the state they ran on.
549
550
```
551
oxy receipt list # receipts for the bookmark's state
552
oxy receipt show 3f2a9c # one in full, with its signature checked
553
oxy receipt export 3f2a9c build.receipt # hand it to someone
554
oxy receipt verify build.receipt # check one without keeping it
555
oxy receipt import build.receipt # verify and keep it
a39754d0 Andy McCall 19 days ago ↶
556
oxy receipt export 3f2a9c prov.json --format slsa # SLSA provenance, signed with your key
557
oxy identity export --pem me.pem # the key cosign checks it with
fc1a466a Andy McCall 1 month ago ↶
558
```
559
a39754d0 Andy McCall 19 days ago ↶
560
The SLSA form is for tools outside Oxygen: in-toto and SLSA verifiers, and
561
` cosign verify-blob-attestation --key me.pem --type slsaprovenance1
562
--check-claims=false --signature prov.json` . Its subjects are named by
563
Oxygen hashes, which cosign cannot compute from a file, hence
564
` --check-claims=false` .
565
ee06a6c5 Andy McCall 1 month ago ↶
566
## 11. Big repositories: partial, sparse, shallow
567
568
```
569
oxy clone URL --max-blob 1M # files above 1 MiB are fetched on first read
570
oxy clone URL --sparse src --sparse docs # materialise only these subtrees
571
oxy clone URL --depth 50 # only the last 50 levels of history
572
oxy sparse src docs tests # change the filter later
573
oxy deepen 100 # fetch more history below the boundary
574
```
575
576
Lazy blobs and sparse trees do not affect commits: what you do not have is
577
left exactly as it was. A shallow clone starts from a * checkpoint* of the
578
state, so status and commit work at full speed from the first minute.
579
4dee277c Andy McCall 1 month ago ↶
580
## 11a. Nested repositories (submodules)
581
582
A subrepo is another repository checked out at a path and pinned to a state,
583
Oxygen or Git. The pin is versioned like a file, so two people pinning
584
different states get an ordinary conflict.
585
586
```
587
oxy submodule add https://host/lib.git libs/lib # Git or Oxygen URL; records .oxymodules
588
oxy commit -m "Add lib" # the pin is committed with the parent
589
oxy submodule status # pin vs what is on disk
590
oxy submodule update --init # after a clone: fetch nested repositories
591
oxy submodule remove libs/lib # drop the node; the directory stays
592
```
593
594
Committing the parent records whatever the nested repository is at, and
595
checking out an older parent state moves the nested repository back, unless
596
it has uncommitted changes, which are never overwritten. An absent nested
7993d465 Andy McCall 1 month ago ↶
597
repository keeps its pin until you run ` update --init` . A ` .oxymodules`
598
section written by hand has no pin until ` oxy submodule add` clones it;
599
` status` and ` update` name such entries, and ` update` exits non-zero. Git
600
submodules survive ` oxy git import` as Git pins and go back out as gitlinks
601
on export.
4dee277c Andy McCall 1 month ago ↶
602
ee06a6c5 Andy McCall 1 month ago ↶
603
## 12. Git interoperability
604
605
```
606
oxy git import ../project.git ./project-oxy --branch main # convert a Git history
607
oxy git fetch https://github.com/you/project.git # bring new Git commits in
608
oxy git push https://github.com/you/project.git # publish your changes to Git
609
oxy git export ../mirror.git # a plain Git mirror of the bookmark
610
```
611
612
Import turns each commit into one change (merge commits become
613
resolutions), keeps authors and hashes as ` Git-Author` /` Git-Commit`
614
trailers, detects renames, and skips submodules. ` git fetch` /` git push` keep
615
a bare mirror under ` .oxy/git/` ; a push is refused until the remote's tip
616
has been fetched, so it always fast-forwards. Exported commits carry
617
` Change-Id` and ` Oxy-Hash` trailers.
618
54e2e630 Andy McCall 29 days ago ↶
619
A long import moves its bookmark to the commits done so far every 2000
620
commits, so if it stops, ` oxy git fetch GIT_DIR --branch BRANCH` in the new
621
repository carries on from there. One stopped before its first checkpoint
622
(or by an older oxy) is recovered first with ` oxy git recover` , which
623
indexes the objects it had written and points the bookmark at them.
624
ee06a6c5 Andy McCall 1 month ago ↶
625
## 13. Automate: hooks
626
627
Executables in ` .oxy/hooks/<event>` (never cloned) receive one JSON object
628
on stdin. ` pre-commit` , ` pre-push` and other ` pre-*` hooks veto by exiting
629
non-zero, and their stderr becomes the error message. Events:
630
` pre-commit` , ` post-commit` , ` pre-push` , ` post-fetch` , ` post-checkout` , and
631
` semantic-deps` , which runs at commit when ` hooks.semantic-deps = true` and
632
answers ` {"deps": ["<hash>", …]}` to make the change depend on more than it
633
textually references.
634
635
## 14. Per-path attributes, ignores, locks
636
637
` .oxyattributes` uses gitattributes syntax:
638
639
```
640
*.png binary
641
*.txt text eol=lf
642
*.psd lockable nocompress
643
```
644
645
` binary` /` text` override content sniffing, ` eol=lf|crlf` normalises line
646
endings in the store and on checkout, ` nocompress` stores chunks raw, and
647
` lockable` files are checked out read-only until you take the local lock:
648
649
```
650
oxy lock assets/logo.psd
651
oxy unlock assets/logo.psd
652
```
653
654
Locks are advisory and local; server-side locks are planned.
655
656
## 15. Configuration
657
658
Two files, both ` key = "value"` lines: ` ~/.config/oxy/config.toml`
659
(` oxy config --user KEY VALUE` ) and ` .oxy/config` (` oxy config KEY VALUE` ).
d443639b Andy McCall 1 month ago ↶
660
The repository file wins. ` OXY_HOME` relocates the user directory. ` OXY_TIMINGS=1` prints how long each phase of a snapshot takes (loading the base state, rendering it, reading the working copy, building the change) to standard error, for finding out where a slow command spends its time. Built with ` cargo build --release --features alloc-stats` , oxy also reports each phase's live and peak memory and what it allocated, and a summary at the end.
ee06a6c5 Andy McCall 1 month ago ↶
661
662
663
664
| ` author.name` , ` author.email` , ` author.key` | who you are; ` key` is set by ` identity create` |
2452b440 Andy McCall 9 days ago ↶
665
| ` author.for` | in a keyless agent's home, the account it acts for: it authors as that person's newest identity, as the hub names it (a repository's own ` author.key` pin still wins) |
c895bc52 Andy McCall 18 days ago ↶
666
| ` author.signer` | the key that signs instead of ` author.key` : an agent's own key, which your identity lists as a delegate; or ` keyless` , for fresh keys the hub certifies under the agent's grant (also ` $OXY_SIGNER` ) |
667
| ` keyless.hub` | the hub that certifies keyless keys (default: the default remote's hub) |
ee06a6c5 Andy McCall 1 month ago ↶
668
| ` core.sign` | ` change` to sign every commit; otherwise seals at push |
669
| ` core.op-retention` | days for which old operations keep their states alive (90) |
670
| ` core.gc-grace` | days an unreachable object survives (14) |
671
| ` core.checkpoint-interval` | changes between automatic checkpoints (256) |
672
| ` filter.max-blob` , ` filter.paths` | lazy blobs and sparse subtrees (section 11) |
673
| ` hooks.semantic-deps` | run the semantic-deps hook at commit |
674
| ` workspace.bookmark` | this workspace's bookmark (` main` ) |
ff1f62fe Andy McCall 1 month ago ↶
675
| ` remote.<name>.url` , ` .token` , ` .ca` | remotes; token and CA fall back to ` OXY_TOKEN` and ` OXY_CA` , then ` oxy auth login` 's store |
676
| ` auth.helper` (user file) | a Git credential helper to keep ` oxy auth` tokens in, such as ` libsecret` |
ee06a6c5 Andy McCall 1 month ago ↶
677
678
## 16. Shell prompt
679
680
` oxy prompt` prints ` main 658990aa*+2` (bookmark, working copy, ` *` dirty,
681
` !` conflicted, ahead/behind origin) in a few milliseconds and records
682
nothing. See [ prompt.md ] ( prompt.md ) for bash, oh-my-bash, zsh, and fish
683
snippets and the ` --format` placeholders.
684
685
## 17. Housekeeping
686
687
```
da652d63 Andy McCall 1 month ago ↶
688
oxy gc # prune unreachable objects past the grace period, repack into one pack
ee06a6c5 Andy McCall 1 month ago ↶
689
oxy gc --now # ignore the grace period (only when nothing else is writing)
387335ff Andy McCall 1 month ago ↶
690
oxy fsck # check every object, the op log, references, signatures, checkpoints
3e5772cc Andy McCall 1 month ago ↶
691
oxy doctor # check identity, config and remotes, with what to do about each problem
ee06a6c5 Andy McCall 1 month ago ↶
692
oxy checkpoint # serialise the bookmark's state so large histories load instantly
693
```
694
695
Both run automatically: packing when loose objects pile up, checkpoints
696
every ` core.checkpoint-interval` changes.
697
c6aa5bd9 Andy McCall 1 month ago ↶
698
## 17a. Scripting and editors
699
700
Every reporting command takes ` --json` (` status` , ` log --path` , ` show` ,
701
` diff` , ` hunks` , ` blame` , ` resolve` , ` op log` , ` bookmark list` , ` remote list` ,
702
` fetch` , ` pull` , ` push` , ` submodule status` , ` bisect status` , ` verify` ,
703
` policy show` , ` root` , ` version` ). ` oxy cat PATH -r CHANGE` prints a file as
704
it was, ` oxy discard PATH..` restores files to the base, and ` oxy hunks`
705
numbers the working copy's hunks for ` commit --hunks` and ` discard --hunks` .
706
ee06a6c5 Andy McCall 1 month ago ↶
707
## 18. If something looks wrong
708
709
- ** "the remote has change … which you do not; pull first"** : someone
710
pushed since your last fetch. ` oxy pull` , then push.
711
- ** "policy needs N root signature(s)"** on fetch: the server's policy was
712
updated in a way your copy cannot verify. Ask a root holder whether the
713
chain of updates was published; a fresh clone trusts the current policy.
714
- ** ` oxy status` exits 2** : conflicts remain; see section 6.
715
- ** Many heads on ` main` ** : independent changes that do not reference one
716
another. Nothing to fix; the state is their union.
717
- ** Undo anything** : ` oxy undo` reverts the last operation, including
718
pulls, checkouts, and rewrites.
d42369ab Andy McCall 1 month ago
719
720
## Shell completions and man pages
721
722
``` sh
723
oxy completions bash > ~/.local/share/bash-completion/completions/oxy # bash
724
oxy completions zsh > "${fpath[1]}/_oxy" # zsh
725
oxy completions fish > ~/.config/fish/completions/oxy.fish # fish
726
oxy man --dir ~/.local/share/man/man1 # then: man oxy-commit
727
```
728
729
The oh-my-bash plugin in ` contrib/oh-my-bash` loads the bash completions itself.
e59512f2 Andy McCall 18 days ago ↶
730
731
## Transparency logs
732
733
A hub that keeps a transparency log (OxygenHub does, at ` /log` ) logs every signed object it accepts. ` oxy fetch` and ` oxy pull` check it as they go. They remember the log's key and its last checkpoint, and fail if the hub ever shows a log that does not extend what you saw before. That is the sign of a hub showing different histories to different people. To audit a hub's whole log and see what it holds for this repository:
734
735
```
736
oxy tlog verify # this checkout's hub
737
oxy tlog verify https://oxygenhub.io --all
738
oxy tlog verify --key <KeyId> # what a key signed
739
```