Summary #
The Owner registers a GitHub repository as a Repo from the Repos page, and the Repo's page opens. Pilot keeps one jj clone of each Repo. The Repo's page shows the clone, edits the setup command and the "Allow Cyber tasks" switch, and has a Danger zone with "Remove this Repo".
The protocol gets its first commands. Each one has an id, and the Daemon replies to it once. The events it causes come first.
type Repo = {
name: string
+ setupCommand: string
+ allowCyber: boolean
+ clone: { state: "cloning" } | { state: "ready" } | { state: "failed"; why: string }
}
DaemonMessage
+ | reposChanged { repos }
+ | replied { id, error: string | null }
-AppCommand = never
+AppCommand = registerRepo | changeRepo | cloneRepo (Try again) | removeRepo
daemon/src/
├── repos.ts # pilot_repos table in pilot.sqlite, the commands, the clones that run
├── workspaces.ts # one jj clone per Repo: moved into place only once complete, deleted on remove
├── github.ts # + cloneUrl()
└── server.ts # + commands in, one reply each
app/
├── daemon.ts # + send(command) → why it was refused, or null
├── Shell.tsx # the trail holds { page, repo }: a Repo opens like a page
├── home.tsx # Home, moved out of pages.tsx (it still builds its own rows until ticket 07)
└── pages.tsx # Repos page and Repo page
ui/ # CloneBadge, Row stacked, Dialog message, TextField verbatim, spin on Icon/Badge/Notice, trash-2
- A stop or a crash during a clone leaves the Repo "cloning". The clone starts again when the Daemon starts.
- Removing a Repo stops its clone if one runs and deletes Pilot's clone. The repository on GitHub stays.
- The loader icon turns while a clone runs, and on the Building Stage badge.
- The field takes "owner/name" or a GitHub link (https, ssh,
.git, a page inside the repository). It and the setup command's field are verbatim: macOS adds no capitals and corrects nothing. - The setup command is only stored for now. The Task runner (ticket 19) runs it.
Also in this PR, from the retro:
just lintnow checks that screens composeui/: no styledText, noBadgewith a one-off look, and a loader icon always turns.- A
scratchprofile for checks by hand:just scratch-daemon,just scratch-send '<command>',just shot <place> [width] [repo]. Agents no longer touch the dev profile's data. CODING_STANDARDS.mdfor reviews, and two DESIGN.md rules: Undo, and the Danger zone.- The scripted Daemon of the App's tests answers a command as the real one does:
daemon.answer({ events, error }). - Ticket 29 records the follow-up: the gallery as an app of its own, with
just gallery.
Evidence #
- Before: nothing could register a Repo.
AppCommand = never. After:just checkpasses (lint, Daemon types,nsh check).just testpasses: 20 Daemon tests and 31 App tests.
Daemon tests (a real Daemon, real jj, throwaway local git repositories served by the fake GitHub):
register acme/api → ready, no setup command, Cyber off, .jj and README in the clone, snapshot holds it
change both settings → kept after a restart
restart mid-clone → the clone starts again → ready
GitHub has no acme/apii → failed: "GitHub has no repository acme/apii, or Pilot cannot see it."
jj cannot clone → failed: "jj could not clone it: …" → Try again → ready
remove a cloned Repo → gone from reposChanged, clone folder deleted, GitHub's copy stays
remove while cloning → the clone stops, no folder left, no event after
a GitHub link → registers acme/api; other link shapes → "a Repo already"
"acme", "Acme/API" → refused in plain words
App tests (against the scripted Daemon):
paste a GitHub link → registerRepo acme/api, its page opens
Add Repo → registerRepo sent, the Repo's page opens on "Pilot is cloning acme/api with jj."
refused → "acme/api is a Repo already." shows, the field keeps the text
Repo page → Save setup command and the switch send changeRepo
failed clone → why shows, Try again sends cloneRepo
Remove this Repo → asks first; "Keep the Repo" sends nothing; confirm sends removeRepo → back to the list
Daemon stops → "Pilot could not load this Repo."
Checked by hand with the real gh and jj (scratch and dev Daemons): octocat/Hello-World cloned, a missing repository failed with GitHub's reason, microsoft/TypeScript was removed while it cloned, and the loader icon turns on macOS. Pictures: just shot Repos 1240 octocat/Hello-World.
Merge Danger #
Door: two-way
The new pilot_repos table sits beside Pi Durable's tables in the same SQLite file. A rollback leaves the table and the repos/ folder behind. Older code ignores both.
Blast Radius: Daemon
- The Daemon now runs
ghandjj. The launchd agent gets the PATH of the deploy, so deploy from a shell that has both. - A private Repo over HTTPS needs
gh auth setup-git, or its clone fails with jj's reason. Repoin the protocol has new fields. The App and the Daemon deploy together.- CI's
daemonjob now installsgitandjujutsu. - The new lint rules fail on any screen that styles its own text or badges. Only
app/home.tsx(until ticket 07),app/Shell.tsxand the gallery may.