|
4 | 4 |
|
5 | 5 | This repo uses `mainline` (`mq`) to coordinate the protected `main` branch. |
6 | 6 | All code changes happen in feature worktrees, never directly on `main`. |
| 7 | +`mq` is installed globally — auto-discovers the repo from cwd. |
7 | 8 |
|
8 | 9 | ### Rules |
9 | 10 |
|
10 | | -- **Never commit, merge, rebase, or push directly on `main`.** The main |
| 11 | +- **Never commit, merge, rebase, push, or reset on `main`.** The main |
11 | 12 | worktree is read-only for development purposes. |
12 | | -- Create feature worktrees with `wtnew <branch>` or under |
13 | | - `~/Projects/_wt/recallnet/codecontext/`. |
14 | | -- Do all work (commits, tests, iteration) in the feature worktree. |
15 | | -- `mq` auto-discovers the repo from your cwd — no `--repo` flag needed. |
16 | | -- When ready to land, submit from the feature worktree: `mq submit` |
17 | | -- Integrate and publish from the main worktree: `mq run-once` then |
18 | | - `mq publish` |
19 | | -- Clean up after landing: `wtdrop <path>` or |
20 | | - `git worktree remove <worktree-path>` |
| 13 | +- Create feature worktrees with `wtnew <branch>`. Do all work there. |
| 14 | +- Run `pnpm install` once in a new worktree (they don't share |
| 15 | + `node_modules`). |
| 16 | +- When ready to land: `mq submit` (from the feature worktree). |
| 17 | +- To integrate: `mq run-once` (from the main worktree). This rebases the |
| 18 | + topic onto `main`, runs the full QA suite (see `PreIntegrate` in |
| 19 | + `mainline.toml`), then fast-forwards `main`. |
| 20 | +- To push to remote: `mq publish` (from the main worktree). |
| 21 | +- Clean up after landing: `wtdrop <worktree-path>` |
21 | 22 |
|
22 | 23 | ### Quick reference |
23 | 24 |
|
24 | 25 | ``` |
25 | | -# Create worktree |
| 26 | +# Create worktree and work in it |
26 | 27 | wtnew my-feature |
| 28 | +pnpm install |
| 29 | +# ... edit, test, commit ... |
27 | 30 |
|
28 | | -# Work in it (cd into the worktree) |
29 | | -pnpm install # worktrees don't share node_modules |
30 | | -# ... make changes, commit ... |
31 | | -
|
32 | | -# Land through mainline (from the feature worktree) |
| 31 | +# Submit from the feature worktree |
33 | 32 | mq submit |
34 | 33 |
|
35 | | -# Integrate and publish (cd to the main worktree first) |
| 34 | +# Integrate and publish from the main worktree |
36 | 35 | mq run-once |
37 | 36 | mq publish |
38 | 37 |
|
39 | 38 | # Clean up |
40 | 39 | wtdrop <worktree-path> |
41 | 40 | ``` |
42 | 41 |
|
| 42 | +### Handling failures |
| 43 | + |
| 44 | +- If `mq run-once` fails (conflict, test failure), the protected branch |
| 45 | + is untouched. Fix the issue in the feature worktree, commit, then |
| 46 | + `mq retry --submission <id>`. |
| 47 | +- To abandon: `mq cancel --submission <id>` |
| 48 | +- Check what went wrong: `mq logs --follow` |
| 49 | + |
43 | 50 | ### Monitoring |
44 | 51 |
|
45 | 52 | - `mq status` — current queue state |
46 | | -- `mq doctor` — health check (branch state, locks, queue) |
47 | | -- `mq repo show` — repo config and worktree info |
| 53 | +- `mq doctor` — health check (branch, locks, queue) |
| 54 | +- `mq repo show` — config and worktree info |
48 | 55 | - `mq logs --follow` — integration history |
49 | | -- `mq watch` — live queue monitoring |
| 56 | +- `mq watch` — live queue updates |
| 57 | +- `mq events --follow` — raw audit trail |
| 58 | + |
| 59 | +### Daemon (optional) |
| 60 | + |
| 61 | +For unattended integration, run the daemon: |
| 62 | +`mainlined --interval 5s` |
| 63 | +It watches the queue, integrates, and publishes automatically. |
50 | 64 |
|
51 | 65 | ## Commit Flow |
52 | 66 |
|
|
0 commit comments