Skip to content

Commit f4a5e5e

Browse files
author
giggabit-mac
committed
feat(operations): codify premote staging lanes
1 parent 74dfe68 commit f4a5e5e

21 files changed

Lines changed: 279 additions & 78 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: premote-staging
3+
description: Promote the T3 Code staging lane to main across Jordan's Linux server and Mac launcher checkout. Use when the user asks to "premote staging", "promote staging to main", update T3 Code main from staging, normalize the four durable T3 Code lanes, or run the project-specific staging promotion flow.
4+
---
5+
6+
# Premote Staging
7+
8+
## Overview
9+
10+
This skill runs the project-specific T3 Code promotion flow. It treats `original`, `nightly`, `staging`, and `main` as the only durable Linux lanes, promotes `staging` to the live `main` lane only after verification and backups, and then updates the Mac checkout to match.
11+
12+
## Required Reading
13+
14+
Read `references/procedure.md` before acting. Also read `docs/operations/premote-staging.md` from the repo if the procedure has changed since this skill was last edited.
15+
16+
## Operating Rules
17+
18+
- Use `fleet-ssh giggabit-server -- <command>` or `ssh giggabit-server` for Linux work. Prefer the fleet wrapper when Node, pnpm, or repo tools need the development PATH.
19+
- Do not move `main` while `T3 Code Main` is running from `/home/jgigg/code/t3code`; stop the launcher first and restart it after promotion.
20+
- Do not skip `vp check` or `vp run typecheck`. Run them with Node `24.13.1`.
21+
- Preserve dirty state with patch files, stashes, or backup refs before removing temporary worktrees or switching the Mac checkout.
22+
- Do not mass-delete GitHub branches during the promotion. Update durable remote lanes and create remote backup branches first.
23+
- If a required verification step fails, leave `main` untouched or restore it from the backup ref before reporting.
24+
25+
## Completion Criteria
26+
27+
The flow is complete only when Linux `main` and the Mac checkout point at the promoted commit, T3 Code Main is running again, required checks are recorded, and temporary local worktrees have either been removed or explicitly left with a reason.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Premote Staging"
3+
short_description: "Promote T3 Code staging to main"
4+
default_prompt: "Use $premote-staging to promote the T3 Code staging lane to main on giggabit-server."
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Premote Staging Procedure
2+
3+
Use this procedure to promote T3 Code `staging` to `main` for Jordan's local fleet.
4+
5+
## Lanes
6+
7+
- `original`: `/home/jgigg/code/t3code/.worktrees/original`, branch `original`, tracks `upstream/main`.
8+
- `nightly`: `/home/jgigg/code/t3code/.worktrees/nightly`, branch `nightly`, latest upstream plus replayed local topics.
9+
- `staging`: `/home/jgigg/code/t3code/.worktrees/staging`, branch `staging`, final verification lane.
10+
- `main`: `/home/jgigg/code/t3code`, branch `main`, live day-to-day lane.
11+
- Mac launcher checkout: `/Users/giggabit-mac/code/projects/t3code`, branch `main` after promotion.
12+
13+
## Workflow
14+
15+
1. Confirm the user explicitly wants staging promoted and accepts downtime for T3 Code Main.
16+
2. Audit:
17+
- `fleet-doctor`
18+
- remote `git status --short --branch` for all durable lanes
19+
- `git worktree list --porcelain`
20+
- running `t3code-dev-main`, `dev-runner`, Electron, and Vite+ processes
21+
3. Verify staging under Node `24.13.1`:
22+
- `mise x node@24.13.1 -- bash -lc './node_modules/.bin/vp check'`
23+
- `mise x node@24.13.1 -- bash -lc './node_modules/.bin/vp run typecheck'`
24+
- `mise x node@24.13.1 -- bash -lc './node_modules/.bin/vp run lint:mobile'`
25+
- `mise x node@24.13.1 -- bash -lc 'pnpm run topic-plugins:check'`
26+
4. Save backups:
27+
- dirty Mac patch or stash
28+
- dirty Linux temporary-worktree patches
29+
- `refs/backup/premote-staging/<timestamp>/{main,staging,original,nightly,origin-main,origin-staging,upstream-main}` where refs exist
30+
5. Stop T3 Code Main before mutating `/home/jgigg/code/t3code`.
31+
6. Promote locally:
32+
- `cd /home/jgigg/code/t3code`
33+
- `git reset --hard staging`
34+
7. Push safely:
35+
- create `origin/backup/premote-staging-<timestamp>-origin-main`
36+
- create `origin/backup/premote-staging-<timestamp>-origin-staging`
37+
- `git push --force-with-lease=main:<old-origin-main-sha> origin main:main`
38+
- `git push --force-with-lease=staging:<old-origin-staging-sha> origin staging:staging`
39+
- push `nightly` only after the durable nightly worktree exists and is clean
40+
8. Ensure durable Linux worktrees exist:
41+
- Reset `original` to `upstream/main` after backup.
42+
- Create or update `.worktrees/nightly` on branch `nightly`. If no newer replay candidate exists, it may temporarily match `staging`.
43+
- Keep `.worktrees/staging` on branch `staging`.
44+
- Keep `/home/jgigg/code/t3code` on branch `main`.
45+
9. Restart T3 Code Main with `~/.local/bin/t3code-dev-main`.
46+
10. Verify:
47+
- `git -C /home/jgigg/code/t3code rev-parse HEAD`
48+
- `curl -fsS https://giggabit-server.tailfb378a.ts.net/main/`
49+
- process list shows the launcher running from `/home/jgigg/code/t3code`
50+
11. Update Mac:
51+
- fetch origin
52+
- switch to `main`
53+
- reset to `origin/main`
54+
- reapply only intentional saved edits
55+
12. Local cleanup:
56+
- Remove temporary Linux worktrees after backup.
57+
- Delete extra local branches only when their commits are reachable from durable branches or backup refs.
58+
- Leave remote branch cleanup for a separate explicit pass.

AGENTS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
there.
2929
- `/home/jgigg/code/t3code/.worktrees/staging` is reserved for the `staging` branch and the staging promotion lane.
3030
Do not check out feature branches in this path.
31-
- `/home/jgigg/code/t3code/.worktrees/nightly-local` is the rolling upstream replay candidate worktree. It is owned
31+
- `/home/jgigg/code/t3code/.worktrees/nightly` is the durable upstream replay candidate worktree. It is owned
3232
by `pnpm run topic-stack:nightly -- --apply`; if it is dirty, nightly replay must fail closed instead of resetting
3333
it.
3434
- Do all new implementation work in a separate worktree whose directory name starts with `dev-`, for example
@@ -60,7 +60,7 @@
6060
- The `original` mirror should be synced from upstream and tested nightly so replayable local topics can be checked
6161
against the latest upstream base. Use `pnpm run topic-stack:nightly -- --dry-run` to inspect the plan and
6262
`pnpm run topic-stack:nightly -- --apply` to fetch `upstream`, back up and reset `original`, rebuild
63-
`.worktrees/nightly-local`, and run verification. The nightly script never promotes to `staging`.
63+
`.worktrees/nightly`, and run verification. The nightly script never promotes to `staging`.
6464
- Local replay topics are documented as repo-internal plugins under `local-plugins/<topic>/`. Keep each
6565
`plugin.json`, topic `README.md`, and `docs/operations/jordan-topic-stack.manifest.json` entry synchronized with
6666
the replay commit. These are not installable Codex plugins and must not use `.codex-plugin/plugin.json`.
@@ -122,8 +122,8 @@ Current topic order:
122122

123123
When upstream changes, prefer the scripted nightly workflow in
124124
`docs/operations/nightly-upstream-replay.md`. It fetches upstream, backs up and
125-
resets `original`, creates or reuses `.worktrees/nightly-local`, creates
126-
`dev/nightly-topic-stack-YYYYMMDD`, cherry-picks the manifest topics in order,
125+
resets `original`, creates or reuses `.worktrees/nightly`, resets branch
126+
`nightly`, cherry-picks the manifest topics in order,
127127
and writes artifacts, including `topic-audit.md`, under `.t3code-nightly-runs/`. Resolve conflicts in the
128128
owning topic, run the verification commands from
129129
`docs/operations/jordan-topic-stack.md`, and compare the final stack against the
@@ -250,7 +250,7 @@ Source commits intentionally not replayed as new follow-up commits:
250250
server port `13833`, and desktop debugging port `9232`. Its app data lives in
251251
`~/.local/share/t3code-dev/staging`, and its config lives in `~/.config/t3code-dev/staging`.
252252
- `T3 Code Nightly` uses `~/.local/bin/t3code-dev-nightly` and
253-
`~/.local/share/applications/t3code-dev-nightly.desktop`. It launches `.worktrees/nightly-local` on web port
253+
`~/.local/share/applications/t3code-dev-nightly.desktop`. It launches `.worktrees/nightly` on web port
254254
`5833`, server port `13873`, and desktop debugging port `9234`, and exposes the public HTTPS route
255255
`https://giggabit-server.tailfb378a.ts.net/nightly/`. Its app data lives in `~/.local/share/t3code-dev/nightly`, and its
256256
config lives in `~/.config/t3code-dev/nightly`. The nightly worktree is rebuilt by

CONTEXT.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,23 @@ _Avoid_: checkbox, checklist bullet, feature bullet
1111
**Topic Replay Audit**:
1212
A run-specific audit artifact that records what was inspected, replayed, repaired, verified, and signed off before a rebuilt local topic stack is promoted.
1313
_Avoid_: replay notes, checklist copy, promotion log
14+
15+
**Durable Lane**:
16+
A long-lived local branch and worktree role in the T3 Code fork. The durable lanes are `original`, `nightly`, `staging`, and `main`; temporary topic, replay, and investigation branches are not durable lanes.
17+
_Avoid_: permanent branch, protected worktree, environment
18+
19+
**Original Lane**:
20+
The resettable mirror of the upstream ping.gg T3 Code repository. It tracks `upstream/main` and does not contain Jordan-local topic commits.
21+
_Avoid_: upstream branch, clean copy
22+
23+
**Nightly Lane**:
24+
The rebuilt candidate produced by replaying Jordan-local topic commits on top of the Original Lane. It is the place to inspect fresh upstream compatibility before promoting anything to Staging.
25+
_Avoid_: nightly-local, dev/nightly-topic-stack branch
26+
27+
**Staging Lane**:
28+
The verified integration lane for Jordan-local updates. It receives tested topic commits from dev worktrees or the Nightly Lane and is the final proving ground before Main.
29+
_Avoid_: test branch, QA copy
30+
31+
**Main Lane**:
32+
The day-to-day T3 Code lane used by the operator. It is updated from Staging only after explicit confirmation, backups, green checks, and a controlled restart of the running main app.
33+
_Avoid_: production, root checkout

apps/desktop/scripts/verify-staging-public.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const DEFAULT_PAIRING_DEV_URL =
2828
? "http://127.0.0.1:5833/nightly/"
2929
: "http://127.0.0.1:5793/staging/";
3030
const DEFAULT_PROJECT_ROOT = PUBLIC_VERIFY_TARGET === "nightly" ? repoRoot : "";
31-
const DEFAULT_PROJECT_TITLE = PUBLIC_VERIFY_TARGET === "nightly" ? "nightly-local" : "";
31+
const DEFAULT_PROJECT_TITLE = PUBLIC_VERIFY_TARGET === "nightly" ? "nightly" : "";
3232
const DEFAULT_PAIRING_TTL = "5m";
3333
const DEFAULT_NETWORK_PREFLIGHT_TIMEOUT_MS = 20_000;
3434

apps/desktop/src/backend/DesktopServerExposure.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ describe("DesktopServerExposure", () => {
665665

666666
return withGitHarness(
667667
{
668-
appRootRelativePath: "repo/.worktrees/nightly-local",
669-
branch: "dev/nightly-topic-stack-20260626",
668+
appRootRelativePath: "repo/.worktrees/nightly",
669+
branch: "nightly",
670670
spawnerLayer: recordingSpawnerLayer(commands),
671671
},
672672
Effect.gen(function* () {
@@ -684,8 +684,8 @@ describe("DesktopServerExposure", () => {
684684
}
685685
assert.equal(error.servePath, "/staging");
686686
assert.include(error.message, "reserved for the staging branch/worktree");
687-
assert.include(error.message, ".worktrees/nightly-local");
688-
assert.include(error.message, "dev/nightly-topic-stack-20260626");
687+
assert.include(error.message, ".worktrees/nightly");
688+
assert.include(error.message, "nightly");
689689
assert.deepEqual(commands, []);
690690
}),
691691
);
@@ -718,13 +718,13 @@ describe("DesktopServerExposure", () => {
718718
);
719719
});
720720

721-
it.effect("allows /nightly from the rolling nightly replay worktree", () => {
721+
it.effect("allows /nightly from the durable nightly worktree", () => {
722722
const commands: Array<{ readonly command: string; readonly args: ReadonlyArray<string> }> = [];
723723

724724
return withGitHarness(
725725
{
726-
appRootRelativePath: "repo/.worktrees/nightly-local",
727-
branch: "dev/nightly-topic-stack-20260707",
726+
appRootRelativePath: "repo/.worktrees/nightly",
727+
branch: "nightly",
728728
spawnerLayer: recordingSpawnerLayer(commands),
729729
},
730730
Effect.gen(function* () {
@@ -768,7 +768,7 @@ describe("DesktopServerExposure", () => {
768768
);
769769
}
770770
assert.equal(error.servePath, "/nightly");
771-
assert.include(error.message, "reserved for the nightly replay branch/worktree");
771+
assert.include(error.message, "reserved for the nightly branch/worktree");
772772
assert.include(error.message, ".worktrees/staging");
773773
assert.deepEqual(commands, []);
774774
}),
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Four Durable T3 Code Lanes
2+
3+
The local T3 Code fork uses four durable lanes: `original`, `nightly`, `staging`, and `main`. This keeps the upstream mirror, nightly replay candidate, final verification lane, and day-to-day running version separate while allowing temporary topic branches and worktrees to be removed after their work is merged.
4+
5+
## Consequences
6+
7+
Temporary `dev-*`, replay, and investigation worktrees are disposable after backup and verification. Promotion to `main` is a controlled replacement from `staging`, not an ad hoc merge from whatever topic branch happens to exist.

docs/operations/jordan-topic-stack.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ pnpm run topic-stack:nightly -- --apply
119119
The detailed workflow lives in `docs/operations/nightly-upstream-replay.md`.
120120
It fetches `upstream`, backs up dirty or divergent `original`, resets
121121
`.worktrees/original` exactly to `upstream/main`, creates or reuses the rolling
122-
`.worktrees/nightly-local` candidate worktree, creates
123-
`dev/nightly-topic-stack-YYYYMMDD`, and cherry-picks manifest topics in order.
122+
`.worktrees/nightly` candidate worktree, resets branch `nightly`, and
123+
cherry-picks manifest topics in order.
124124
Artifacts are written under
125-
`.worktrees/nightly-local/.t3code-nightly-runs/YYYYMMDD-HHMMSS/`.
125+
`.worktrees/nightly/.t3code-nightly-runs/YYYYMMDD-HHMMSS/`.
126126
Each apply run also writes `topic-audit.md` with run metadata, branch-diff
127127
audit placeholders, replay outcomes, one topic checklist placeholder per
128128
manifest topic, verification placeholders, unresolved risk tracking, and a
@@ -218,7 +218,7 @@ Manual promotion from the nightly candidate:
218218
cd /home/jgigg/code/t3code/.worktrees/staging
219219
git status --short
220220
git update-ref refs/backup/staging-before-nightly-promote/$(date +%Y%m%d-%H%M%S) staging
221-
git merge --ff-only dev/nightly-topic-stack-YYYYMMDD
221+
git merge --ff-only nightly
222222
vp check
223223
vp run typecheck
224224
vp run verify:staging-public

docs/operations/nightly-upstream-replay.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ topic stack in a rolling candidate worktree. It does not promote anything to
1010
`upstream/main`. The nightly script creates a backup ref for dirty or
1111
divergent state, stashes dirty changes with untracked files, then resets the
1212
worktree to `upstream/main`.
13-
- `/home/jgigg/code/t3code/.worktrees/nightly-local` is the rebuild candidate.
13+
- `/home/jgigg/code/t3code/.worktrees/nightly` is the durable rebuild candidate.
1414
It is reused across runs. If it is dirty, the script fails closed before
1515
running mutating git commands.
1616
- `/home/jgigg/code/t3code/.worktrees/staging` is updated only by manual
@@ -81,25 +81,25 @@ pnpm run topic-stack:nightly -- --apply
8181

8282
Apply mode:
8383

84-
1. Verifies `nightly-local` is not dirty.
84+
1. Verifies `nightly` is not dirty.
8585
2. Fetches `upstream --prune`.
8686
3. Creates `refs/backup/original-before-nightly/YYYYMMDD-HHMMSS` when
8787
`original` is dirty or not at `upstream/main`.
8888
4. Stashes dirty `original` changes with untracked files.
8989
5. Resets `original` to `upstream/main` and removes untracked files.
90-
6. Creates or reuses `.worktrees/nightly-local`.
91-
7. Creates or resets branch `dev/nightly-topic-stack-YYYYMMDD`.
90+
6. Creates or reuses `.worktrees/nightly`.
91+
7. Creates or resets branch `nightly`.
9292
8. Cherry-picks manifest topics in order.
9393
9. Records empty cherry-picks and skips them with `git cherry-pick --skip`.
94-
10. Stops on conflicts and leaves `nightly-local` ready for human repair.
94+
10. Stops on conflicts and leaves `nightly` ready for human repair.
9595
11. Runs `vp check`, `vp run typecheck`, and
9696
`pnpm run topic-plugins:check`.
9797
12. Writes a `topic-audit.md` stub for the run.
9898

9999
Run artifacts are written under:
100100

101101
```text
102-
.worktrees/nightly-local/.t3code-nightly-runs/YYYYMMDD-HHMMSS/
102+
.worktrees/nightly/.t3code-nightly-runs/YYYYMMDD-HHMMSS/
103103
```
104104

105105
Run artifacts include `plan.json`, `topics.json`, and `topic-audit.md`.
@@ -113,7 +113,7 @@ complete the audit before promotion.
113113
## Nightly Launcher
114114

115115
The Omarchy launcher target for this rebuilt worktree is `nightly`. It expects
116-
`.worktrees/nightly-local` to be on `dev/nightly-topic-stack-YYYYMMDD`, serves
116+
`.worktrees/nightly` to be on branch `nightly`, serves
117117
the app through `https://giggabit-server.tailfb378a.ts.net/nightly/`, and uses isolated
118118
ports and app data:
119119

@@ -161,7 +161,7 @@ Promotion is manual only:
161161
cd /home/jgigg/code/t3code/.worktrees/staging
162162
git status --short
163163
git update-ref refs/backup/staging-before-nightly-promote/$(date +%Y%m%d-%H%M%S) staging
164-
git merge --ff-only dev/nightly-topic-stack-YYYYMMDD
164+
git merge --ff-only nightly
165165
vp check
166166
vp run typecheck
167167
vp run verify:staging-public

0 commit comments

Comments
 (0)