|
3 | 3 | ## Branch Workflow (mainline) |
4 | 4 |
|
5 | 5 | This repo uses `mainline` (`mq`) to coordinate the protected `main` branch. |
| 6 | +`mq` is installed globally and auto-discovers the repo from cwd. |
| 7 | + |
6 | 8 | All code changes happen in feature worktrees, never directly on `main`. |
7 | | -`mq` is installed globally — auto-discovers the repo from cwd. |
8 | 9 |
|
9 | 10 | ### Rules |
10 | 11 |
|
11 | 12 | - **Never commit, merge, rebase, push, or reset on `main`.** The main |
12 | | - worktree is read-only for development purposes. |
| 13 | + worktree is read-only for development. |
| 14 | +- Allowed on `main`: `git status`, `git diff`, `git log`, `git show`, |
| 15 | + `git fetch`, `git worktree add`. |
13 | 16 | - Create feature worktrees with `wtnew <branch>`. Do all work there. |
14 | 17 | - Run `pnpm install` once in a new worktree (they don't share |
15 | 18 | `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>` |
| 19 | +- Land through `mq`, never through manual merge or push. |
| 20 | + |
| 21 | +### Agent turbo path |
22 | 22 |
|
23 | | -### Quick reference |
| 23 | +From a feature worktree, the fastest end-to-end path is: |
24 | 24 |
|
25 | 25 | ``` |
26 | | -# Create worktree and work in it |
27 | | -wtnew my-feature |
28 | | -pnpm install |
29 | | -# ... edit, test, commit ... |
| 26 | +mq submit --check-only --json # dry-run: verify branch is submittable |
| 27 | +mq land --json --timeout 30m # submit + integrate + publish, wait for completion |
| 28 | +``` |
30 | 29 |
|
31 | | -# Validate before submitting (dry run) |
32 | | -mq submit --check-only |
| 30 | +`mq land` is the all-in-one command: it submits, waits for serialized |
| 31 | +integration (rebase-then-ff onto `main`), then publishes to remote. |
33 | 32 |
|
34 | | -# Submit and wait for integration to complete |
35 | | -mq submit --wait --timeout 15m |
| 33 | +If you only need integration without publish: |
36 | 34 |
|
37 | | -# Or submit and integrate/publish manually from the main worktree |
38 | | -mq submit |
39 | | -mq run-once |
40 | | -mq publish |
41 | | -
|
42 | | -# Clean up |
43 | | -wtdrop <worktree-path> |
| 35 | +``` |
| 36 | +mq submit --wait --timeout 15m --json |
44 | 37 | ``` |
45 | 38 |
|
46 | | -### Submit options |
| 39 | +### Manual path |
47 | 40 |
|
48 | | -- `mq submit` — queue the branch for integration |
49 | | -- `mq submit --check-only` — dry-run validation (no side effects) |
50 | | -- `mq submit --wait` — submit and block until integration finishes |
51 | | -- `mq submit --wait --timeout 15m` — with timeout |
52 | | -- `mq submit --allow-newer-head` — allow if branch advanced since last |
53 | | - submit |
54 | | -- Add `--json` to any command for machine-readable output |
| 41 | +When the daemon is not running or you need step-by-step control: |
| 42 | + |
| 43 | +``` |
| 44 | +# From the feature worktree |
| 45 | +mq submit |
| 46 | +
|
| 47 | +# From the main worktree |
| 48 | +mq run-once # integrate one queued submission |
| 49 | +mq publish # push protected tip to remote |
| 50 | +``` |
55 | 51 |
|
56 | 52 | ### Handling failures |
57 | 53 |
|
58 | | -- If `mq run-once` fails (conflict, test failure), the protected branch |
59 | | - is untouched. Fix the issue in the feature worktree, commit, then |
60 | | - `mq retry --submission <id>`. |
| 54 | +- If integration fails (conflict, check failure), `main` is untouched. |
| 55 | + Fix the issue in the feature worktree, commit, then: |
| 56 | + `mq retry --submission <id>` |
61 | 57 | - To abandon: `mq cancel --submission <id>` |
62 | 58 | - Check what went wrong: `mq logs --follow` |
| 59 | +- Auto-repair stuck states: `mq doctor --fix` |
63 | 60 |
|
64 | 61 | ### Monitoring |
65 | 62 |
|
66 | | -- `mq status` — current queue state |
| 63 | +- `mq status --json` — queue state, workers, submissions |
67 | 64 | - `mq doctor` — health check (branch, locks, queue) |
68 | | -- `mq repo show` — config and worktree info |
69 | | -- `mq repo root` — canonical root trust status |
| 65 | +- `mq repo show --json` — config, worktrees, upstream status |
| 66 | +- `mq repo audit` — local branches not yet merged into `main` |
70 | 67 | - `mq logs --follow` — integration history |
71 | | -- `mq watch` — live queue updates |
72 | | -- `mq events --follow` — raw audit trail |
73 | | - |
74 | | -### Daemon (optional) |
75 | | - |
76 | | -For unattended integration, run the daemon: |
77 | | -`mainlined --interval 5s` |
78 | | -It watches the queue, integrates, and publishes automatically. |
| 68 | +- `mq watch` — live status refresh |
| 69 | +- `mq events --follow --json --lifecycle` — branch lifecycle stream |
79 | 70 |
|
80 | 71 | ## Commit Flow |
81 | 72 |
|
|
0 commit comments